add a scale element to the frame view. Include some bits from StorageAreas to make it work
This commit is contained in:
parent
98cde11e86
commit
c74cc54ac0
|
@ -49,6 +49,7 @@ if ( false )
|
|||
require_once( 'includes/config.php' );
|
||||
require_once( 'includes/logger.php' );
|
||||
require_once( 'includes/Server.php' );
|
||||
require_once( 'includes/Storage.php' );
|
||||
require_once( 'includes/Monitor.php' );
|
||||
|
||||
if ( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' )
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
#header h2 {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
#header:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
font-size: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
#scaleControl {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#controls {
|
||||
width: 80%;
|
||||
text-align: center;
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
|
||||
if ( !canView( 'Events' ) )
|
||||
{
|
||||
if ( !canView( 'Events' ) ) {
|
||||
$view = "error";
|
||||
return;
|
||||
}
|
||||
|
@ -30,19 +29,19 @@ $eid = validInt($_REQUEST['eid']);
|
|||
if ( !empty($_REQUEST['fid']) )
|
||||
$fid = validInt($_REQUEST['fid']);
|
||||
|
||||
$sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultScale FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?';
|
||||
$event = dbFetchOne( $sql, NULL, array($eid) );
|
||||
$Event = new Event( $eid );
|
||||
$Monitor = $Event->Monitor();
|
||||
|
||||
if ( !empty($fid) ) {
|
||||
$sql = 'SELECT * FROM Frames WHERE EventId = ? AND FrameId = ?';
|
||||
if ( !($frame = dbFetchOne( $sql, NULL, array($eid, $fid) )) )
|
||||
$frame = array( 'FrameId'=>$fid, 'Type'=>'Normal', 'Score'=>0 );
|
||||
$sql = 'SELECT * FROM Frames WHERE EventId = ? AND FrameId = ?';
|
||||
if ( !($frame = dbFetchOne( $sql, NULL, array($eid, $fid) )) )
|
||||
$frame = array( 'FrameId'=>$fid, 'Type'=>'Normal', 'Score'=>0 );
|
||||
} else {
|
||||
$frame = dbFetchOne( 'SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array( $eid, $event['MaxScore'] ) );
|
||||
$frame = dbFetchOne( 'SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array( $eid, $Event->MaxScore() ) );
|
||||
}
|
||||
$Frame = new Frame( $frame );
|
||||
|
||||
$maxFid = $event['Frames'];
|
||||
$maxFid = $Event->Frames();
|
||||
|
||||
$firstFid = 1;
|
||||
$prevFid = $Frame->FrameId()-1;
|
||||
|
@ -51,12 +50,17 @@ $lastFid = $maxFid;
|
|||
|
||||
$alarmFrame = $Frame->Type()=='Alarm';
|
||||
|
||||
if ( isset( $_REQUEST['scale'] ) )
|
||||
$scale = validInt($_REQUEST['scale']);
|
||||
else
|
||||
$scale = max( reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||
if ( isset( $_REQUEST['scale'] ) ) {
|
||||
$scale = validInt($_REQUEST['scale']);
|
||||
} else if ( isset( $_COOKIE['zmWatchScale'.$Monitor->Id()] ) ) {
|
||||
$scale = $_COOKIE['zmWatchScale'.$Monitor->Id()];
|
||||
} else if ( isset( $_COOKIE['zmWatchScale'] ) ) {
|
||||
$scale = $_COOKIE['zmWatchScale'];
|
||||
} else {
|
||||
$scale = max( reScale( SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||
}
|
||||
|
||||
$imageData = getImageSrc( $event, $frame, $scale, (isset($_REQUEST['show']) && $_REQUEST['show']=="capt") );
|
||||
$imageData = $Event->getImageSrc( $frame, $scale, (isset($_REQUEST['show']) && $_REQUEST['show']=="capt") );
|
||||
|
||||
$imagePath = $imageData['thumbPath'];
|
||||
$eventPath = $imageData['eventPath'];
|
||||
|
@ -65,43 +69,48 @@ $rImagePath = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-diag-r.jpg", $eventPath,
|
|||
|
||||
$focusWindow = true;
|
||||
|
||||
xhtmlHeaders(__FILE__, translate('Frame')." - ".$event['Id']." - ".$Frame->FrameId() );
|
||||
xhtmlHeaders(__FILE__, translate('Frame')." - ".$Event->Id()." - ".$Frame->FrameId() );
|
||||
?>
|
||||
<body>
|
||||
<div id="page">
|
||||
<div id="header">
|
||||
<form>
|
||||
<div id="headerButtons">
|
||||
<?php if ( ZM_RECORD_EVENT_STATS && $alarmFrame ) { echo makePopupLink( '?view=stats&eid='.$event['Id'].'&fid='.$Frame->FrameId(), 'zmStats', 'stats', translate('Stats') ); } ?>
|
||||
<?php if ( canEdit( 'Events' ) ) { ?><a href="?view=none&action=delete&markEid=<?php echo $event['Id'] ?>"><?php echo translate('Delete') ?></a><?php } ?>
|
||||
<?php if ( ZM_RECORD_EVENT_STATS && $alarmFrame ) { echo makePopupLink( '?view=stats&eid='.$Event->Id().'&fid='.$Frame->FrameId(), 'zmStats', 'stats', translate('Stats') ); } ?>
|
||||
<?php if ( canEdit( 'Events' ) ) { ?><a href="?view=none&action=delete&markEid=<?php echo $Event->Id() ?>"><?php echo translate('Delete') ?></a><?php } ?>
|
||||
<a href="#" onclick="closeWindow(); return( false );"><?php echo translate('Close') ?></a>
|
||||
</div>
|
||||
<h2><?php echo translate('Frame') ?> <?php echo $event['Id']."-".$Frame->FrameId()." (".$Frame->Score().")" ?></h2>
|
||||
<h2><?php echo translate('Frame') ?> <?php echo $Event->Id()."-".$Frame->FrameId()." (".$Frame->Score().")" ?></h2>
|
||||
<div id="scaleControl"><label for="scale"><?php echo translate('Scale') ?></label><?php echo buildSelect( "scale", $scales, "changeScale();" ); ?></div>
|
||||
<input type="hidden" name="base_width" id="base_width" value="<?php echo $Event->Width(); ?>"/>
|
||||
<input type="hidden" name="base_height" id="base_height" value="<?php echo $Event->Height(); ?>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="content">
|
||||
<p id="image">
|
||||
<?php if ( $imageData['hasAnalImage'] ) { ?>
|
||||
<a href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $Frame->FrameId() ?>&scale=<?php echo $scale ?>&show=<?php echo $imageData['isAnalImage']?"capt":"anal" ?>">
|
||||
<a href="?view=frame&eid=<?php echo $Event->Id() ?>&fid=<?php echo $Frame->FrameId() ?>&scale=<?php echo $scale ?>&show=<?php echo $imageData['isAnalImage']?"capt":"anal" ?>">
|
||||
<?php } ?>
|
||||
<img src="<?php echo $Frame->getImageSrc($imageData['isAnalImage']?'analyse':'capture') ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" alt="<?php echo $Frame->EventId()."-".$Frame->FrameId() ?>" class="<?php echo $imageData['imageClass'] ?>"/>
|
||||
<img id="frameImg" src="<?php echo $Frame->getImageSrc($imageData['isAnalImage']?'analyse':'capture') ?>" width="<?php echo reScale( $Event->Width(), $Event->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Event->DefaultScale(), $scale ) ?>" alt="<?php echo $Frame->EventId()."-".$Frame->FrameId() ?>" class="<?php echo $imageData['imageClass'] ?>"/>
|
||||
<?php if ( $imageData['hasAnalImage'] ) { ?></a><?php } ?>
|
||||
|
||||
<p id="controls">
|
||||
<?php if ( $Frame->FrameId() > 1 ) { ?>
|
||||
<a id="firstLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $firstFid ?>&scale=<?php echo $scale ?>"><?php echo translate('First') ?></a>
|
||||
<a id="firstLink" href="?view=frame&eid=<?php echo $Event->Id() ?>&fid=<?php echo $firstFid ?>&scale=<?php echo $scale ?>"><?php echo translate('First') ?></a>
|
||||
<?php } if ( $Frame->FrameId() > 1 ) { ?>
|
||||
<a id="prevLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $prevFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Prev') ?></a>
|
||||
<a id="prevLink" href="?view=frame&eid=<?php echo $Event->Id() ?>&fid=<?php echo $prevFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Prev') ?></a>
|
||||
<?php } if ( $Frame->FrameId() < $maxFid ) { ?>
|
||||
<a id="nextLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $nextFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Next') ?></a>
|
||||
<a id="nextLink" href="?view=frame&eid=<?php echo $Event->Id() ?>&fid=<?php echo $nextFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Next') ?></a>
|
||||
<?php } if ( $Frame->FrameId() < $maxFid ) { ?>
|
||||
<a id="lastLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $lastFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Last') ?></a>
|
||||
<a id="lastLink" href="?view=frame&eid=<?php echo $Event->Id() ?>&fid=<?php echo $lastFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Last') ?></a>
|
||||
<?php } ?>
|
||||
</p>
|
||||
<?php if (file_exists ($dImagePath)) { ?>
|
||||
<p id="diagImagePath"><?php echo $dImagePath ?></p>
|
||||
<p id="diagImage"><img src=?"<?php echo viewImagePath( $dImagePath ) ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p>
|
||||
<p id="diagImage"><img src=?"<?php echo viewImagePath( $dImagePath ) ?>" width="<?php echo reScale( $Event->Width(), $Event->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Event->DefaultScale(), $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p>
|
||||
<?php } if (file_exists ($rImagePath)) { ?>
|
||||
<p id="refImagePath"><?php echo $rImagePath ?></p>
|
||||
<p id="refImage"><img src="<?php echo viewImagePath( $rImagePath ) ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p>
|
||||
<p id="refImage"><img src="<?php echo viewImagePath( $rImagePath ) ?>" width="<?php echo reScale( $Event->Width(), $Event->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Event->DefaultScale(), $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue