Merge branch 'storageareas' into zma_to_thread
Conflicts: src/zm_monitor.cpp
This commit is contained in:
commit
4b6f40dd9f
|
@ -409,7 +409,7 @@ deterministic
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
||||||
update Storage set DiskSpace = DiskSpace + space where Id = StorageId;
|
update Storage set DiskSpace = COALESCE(DiskSpace,0) + COALESCE(space,0) where Id = StorageId;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -496,7 +496,9 @@ DROP TRIGGER IF EXISTS event_delete_trigger//
|
||||||
CREATE TRIGGER event_delete_trigger BEFORE DELETE ON Events
|
CREATE TRIGGER event_delete_trigger BEFORE DELETE ON Events
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
call update_storage_stats(OLD.StorageId, -OLD.DiskSpace);
|
IF ( OLD.DiskSpace ) THEN
|
||||||
|
call update_storage_stats(OLD.StorageId, -OLD.DiskSpace);
|
||||||
|
END IF;
|
||||||
DELETE FROM Events_Hour WHERE EventId=OLD.Id;
|
DELETE FROM Events_Hour WHERE EventId=OLD.Id;
|
||||||
DELETE FROM Events_Day WHERE EventId=OLD.Id;
|
DELETE FROM Events_Day WHERE EventId=OLD.Id;
|
||||||
DELETE FROM Events_Week WHERE EventId=OLD.Id;
|
DELETE FROM Events_Week WHERE EventId=OLD.Id;
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
DROP PROCEDURE IF EXISTS update_storage_stats;
|
||||||
|
|
||||||
|
DELIMITER //
|
||||||
|
|
||||||
|
CREATE PROCEDURE update_storage_stats(IN StorageId smallint(5), IN space BIGINT)
|
||||||
|
|
||||||
|
sql security invoker
|
||||||
|
|
||||||
|
deterministic
|
||||||
|
|
||||||
|
begin
|
||||||
|
|
||||||
|
update Storage set DiskSpace = COALESCE(DiskSpace,0) + COALESCE(space,0) where Id = StorageId;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
DROP TRIGGER IF EXISTS event_delete_trigger//
|
||||||
|
|
||||||
|
CREATE TRIGGER event_delete_trigger BEFORE DELETE ON Events
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
IF ( OLD.DiskSpace ) THEN
|
||||||
|
call update_storage_stats(OLD.StorageId, -OLD.DiskSpace);
|
||||||
|
END IF;
|
||||||
|
DELETE FROM Events_Hour WHERE EventId=OLD.Id;
|
||||||
|
DELETE FROM Events_Day WHERE EventId=OLD.Id;
|
||||||
|
DELETE FROM Events_Week WHERE EventId=OLD.Id;
|
||||||
|
DELETE FROM Events_Month WHERE EventId=OLD.Id;
|
||||||
|
IF ( OLD.Archived ) THEN
|
||||||
|
DELETE FROM Events_Archived WHERE EventId=OLD.Id;
|
||||||
|
UPDATE Monitors SET
|
||||||
|
ArchivedEvents = ArchivedEvents - 1,
|
||||||
|
ArchivedEventDiskSpace = COALESCE(ArchivedEventDiskSpace,0) - COALESCE(OLD.DiskSpace,0),
|
||||||
|
TotalEvents = TotalEvents - 1,
|
||||||
|
TotalEventDiskSpace = COALESCE(TotalEventDiskSpace,0) - COALESCE(OLD.DiskSpace,0)
|
||||||
|
WHERE Id=OLD.MonitorId;
|
||||||
|
ELSE
|
||||||
|
UPDATE Monitors SET
|
||||||
|
TotalEvents = TotalEvents-1,
|
||||||
|
TotalEventDiskSpace=COALESCE(TotalEventDiskSpace,0)-COALESCE(OLD.DiskSpace,0)
|
||||||
|
WHERE Id=OLD.MonitorId;
|
||||||
|
END IF;
|
||||||
|
END;
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
UPDATE Storage SET DiskSpace=(SELECT SUM(COALESCE(DiskSpace,0)) FROM Events WHERE StorageId=Storage.Id)//
|
|
@ -470,7 +470,7 @@ sub DiskSpace {
|
||||||
$_[0]{DiskSpace} = $size;
|
$_[0]{DiskSpace} = $size;
|
||||||
Debug("DiskSpace for event $_[0]{Id} at $_[0]{Path} Updated to $size bytes");
|
Debug("DiskSpace for event $_[0]{Id} at $_[0]{Path} Updated to $size bytes");
|
||||||
} else {
|
} else {
|
||||||
Warning("Event does not exist at $_[0]{Path}");
|
Warning("DiskSpace: Event does not exist at $_[0]{Path}:" . $Event->to_string() );
|
||||||
}
|
}
|
||||||
} # end if ! defined DiskSpace
|
} # end if ! defined DiskSpace
|
||||||
return $_[0]{DiskSpace};
|
return $_[0]{DiskSpace};
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#SpeedDiv{
|
#SpeedDiv{
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
border: 1px solid black;
|
|
||||||
width: 25%;
|
width: 25%;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +9,14 @@
|
||||||
#SpeedDiv label {
|
#SpeedDiv label {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
#ButtonsDiv {
|
||||||
|
display: inline-flex;
|
||||||
|
flex-flow: row-wrap;
|
||||||
|
}
|
||||||
|
#ButtonsDiv button {
|
||||||
|
display: inline-flex;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
#DateTimeDiv {
|
#DateTimeDiv {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +30,7 @@
|
||||||
#timelinediv {
|
#timelinediv {
|
||||||
margin: 2px auto;
|
margin: 2px auto;
|
||||||
position:relative;
|
position:relative;
|
||||||
width:93%;
|
width:100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#timeline {
|
#timeline {
|
||||||
|
|
|
@ -52,11 +52,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#imageFrame div {
|
#imageFrame div {
|
||||||
background-image: url(../../../graphics/point-g.png);
|
background-image: url(/zm/skins/classic/graphics/point-g.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
#imageFrame div.highlight {
|
#imageFrame div.highlight {
|
||||||
background-image: url(../../../graphics/point-o.png);
|
background-image: url(/zm/skins/classic/graphics/point-o.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
#imageFrame div.active {
|
#imageFrame div.active {
|
||||||
|
|
|
@ -72,7 +72,7 @@ html ul.tabs li.active, html ul.tabs li.active a:hover {
|
||||||
-->
|
-->
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<?php include(ZM_SKIN_PATH.'/js/jquery.js'
|
<?php include(ZM_SKIN_PATH.'/js/jquery.js') ?>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" language="javascript" charset="utf-8">
|
<script type="text/javascript" language="javascript" charset="utf-8">
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
function xhtmlHeaders( $file, $title ) {
|
function xhtmlHeaders( $file, $title ) {
|
||||||
global $css;
|
global $css;
|
||||||
global $skin;
|
global $skin;
|
||||||
|
global $view;
|
||||||
|
|
||||||
# This idea is that we always include the classic css files,
|
# This idea is that we always include the classic css files,
|
||||||
# and then any different skin only needs to contain things that are different.
|
# and then any different skin only needs to contain things that are different.
|
||||||
|
@ -41,7 +42,7 @@ function xhtmlHeaders( $file, $title ) {
|
||||||
|
|
||||||
extract( $GLOBALS, EXTR_OVERWRITE );
|
extract( $GLOBALS, EXTR_OVERWRITE );
|
||||||
function output_link_if_exists( $files ) {
|
function output_link_if_exists( $files ) {
|
||||||
global $skin;
|
global $skin;
|
||||||
$html = array();
|
$html = array();
|
||||||
foreach ( $files as $file ) {
|
foreach ( $files as $file ) {
|
||||||
if ( getSkinFile( $file ) ) {
|
if ( getSkinFile( $file ) ) {
|
||||||
|
@ -132,7 +133,7 @@ echo output_link_if_exists( array(
|
||||||
?>
|
?>
|
||||||
<script src='https://www.google.com/recaptcha/api.js'></script>
|
<script src='https://www.google.com/recaptcha/api.js'></script>
|
||||||
<?php
|
<?php
|
||||||
} else if ( $title == 'Event' ) {
|
} else if ( $view == 'event' ) {
|
||||||
?>
|
?>
|
||||||
<link href="skins/<?php echo $skin ?>/js/video-js.css" rel="stylesheet">
|
<link href="skins/<?php echo $skin ?>/js/video-js.css" rel="stylesheet">
|
||||||
<link href="skins/<?php echo $skin ?>/js/video-js-skin.css" rel="stylesheet">
|
<link href="skins/<?php echo $skin ?>/js/video-js-skin.css" rel="stylesheet">
|
||||||
|
@ -140,7 +141,11 @@ echo output_link_if_exists( array(
|
||||||
<script src="./js/videojs.zoomrotate.js"></script>
|
<script src="./js/videojs.zoomrotate.js"></script>
|
||||||
<script src="skins/<?php echo $skin ?>/js/moment.min.js"></script>
|
<script src="skins/<?php echo $skin ?>/js/moment.min.js"></script>
|
||||||
<?php
|
<?php
|
||||||
} else if ( $title == 'Watch' ) {
|
} else if ( $view == 'montagereview' ) {
|
||||||
|
?>
|
||||||
|
<script src="skins/<?php echo $skin ?>/js/moment.min.js"></script>
|
||||||
|
<?php
|
||||||
|
} else if ( $view == 'watch' ) {
|
||||||
?>
|
?>
|
||||||
<link href="<?php echo cache_bust($viewCssFileExtra) ?>" rel="stylesheet">
|
<link href="<?php echo cache_bust($viewCssFileExtra) ?>" rel="stylesheet">
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -33,7 +33,7 @@ var popupSizes = {
|
||||||
'device': { 'width': 260, 'height': 150 },
|
'device': { 'width': 260, 'height': 150 },
|
||||||
'devices': { 'width': 400, 'height': 240 },
|
'devices': { 'width': 400, 'height': 240 },
|
||||||
'donate': { 'width': 500, 'height': 280 },
|
'donate': { 'width': 500, 'height': 280 },
|
||||||
'download': { 'width': 350, 'height': 215 },
|
'download': { 'width': 350, 'height': 315 },
|
||||||
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
|
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
|
||||||
'eventdetail': { 'width': 600, 'height': 420 },
|
'eventdetail': { 'width': 600, 'height': 420 },
|
||||||
'events': { 'width': 1220, 'height': 780 },
|
'events': { 'width': 1220, 'height': 780 },
|
||||||
|
|
|
@ -289,13 +289,22 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
|
||||||
<tr>
|
<tr>
|
||||||
<td class="colId"><?php echo count($displayMonitors) ?></td>
|
<td class="colId"><?php echo count($displayMonitors) ?></td>
|
||||||
<td class="colLeftButtons" colspan="<?php echo $left_columns -1?>">
|
<td class="colLeftButtons" colspan="<?php echo $left_columns -1?>">
|
||||||
<input type="button" value="<?php echo translate('Refresh') ?>" onclick="location.reload(true);"/>
|
<button name="addBtn" onclick="addMonitor(this);"
|
||||||
<!--<input type="button" name="addBtn" value="<?php echo translate('AddNewMonitor') ?>" onclick="addMonitor(this);"
|
<?php echo (canEdit('Monitors') && !$user['MonitorIds']) ? '' : ' disabled="disabled"' ?>
|
||||||
<?php echo (canEdit( 'Monitors' ) && !$user['MonitorIds']) ? '' : ' disabled="disabled"' ?>
|
>
|
||||||
/>-->
|
<?php echo translate('AddNewMonitor') ?>
|
||||||
<?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?>
|
</button>
|
||||||
<input type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editMonitor( this )" disabled="disabled"/>
|
<button name="cloneBtn" onclick="addMonitor(this);"
|
||||||
<input type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteMonitor( this )" disabled="disabled"/>
|
<?php echo (canEdit('Monitors') && !$user['MonitorIds']) ? '' : ' disabled="disabled"' ?>
|
||||||
|
style="display:none;">
|
||||||
|
<?php echo translate('CloneMonitor') ?>
|
||||||
|
</button>
|
||||||
|
<button name="editBtn" onclick="editMonitor(this);" disabled="disabled">
|
||||||
|
<?php echo translate('Edit') ?>
|
||||||
|
</button>
|
||||||
|
<button name="deleteBtn" onclick="deleteMonitor(this);" disabled="disabled">
|
||||||
|
<?php echo translate('Delete') ?>
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
foreach ( array_keys( $eventCounts ) as $i ) {
|
foreach ( array_keys( $eventCounts ) as $i ) {
|
||||||
|
|
|
@ -48,24 +48,19 @@ Error("No filtering in events, will load ALL!");
|
||||||
}
|
}
|
||||||
$eventsSql .= " ORDER BY $sortColumn $sortOrder";
|
$eventsSql .= " ORDER BY $sortColumn $sortOrder";
|
||||||
|
|
||||||
if ( isset($_REQUEST['page']) )
|
$page = isset($_REQUEST['page']) ? validInt($_REQUEST['page']) : 0;
|
||||||
$page = validInt($_REQUEST['page']);
|
$limit = isset($_REQUEST['limit']) ? validInt($_REQUEST['limit']) : 0;
|
||||||
else
|
|
||||||
$page = 0;
|
|
||||||
if ( isset($_REQUEST['limit']) )
|
|
||||||
$limit = validInt($_REQUEST['limit']);
|
|
||||||
else
|
|
||||||
$limit = 0;
|
|
||||||
|
|
||||||
$nEvents = dbFetchOne( $countSql, 'EventCount' );
|
$nEvents = dbFetchOne( $countSql, 'EventCount' );
|
||||||
if ( !empty($limit) && $nEvents > $limit ) {
|
if ( !empty($limit) && $nEvents > $limit ) {
|
||||||
$nEvents = $limit;
|
$nEvents = $limit;
|
||||||
}
|
}
|
||||||
$pages = (int)ceil($nEvents/ZM_WEB_EVENTS_PER_PAGE);
|
$pages = (int)ceil($nEvents/ZM_WEB_EVENTS_PER_PAGE);
|
||||||
|
#Logger::Debug("Page $page Limit $limit #vents: $nEvents pages: $pages ");
|
||||||
if ( !empty($page) ) {
|
if ( !empty($page) ) {
|
||||||
if ( $page < 0 )
|
if ( $page < 0 )
|
||||||
$page = 1;
|
$page = 1;
|
||||||
else if ( $page > $pages )
|
else if ( $pages and ( $page > $pages ) )
|
||||||
$page = $pages;
|
$page = $pages;
|
||||||
|
|
||||||
$limitStart = (($page-1)*ZM_WEB_EVENTS_PER_PAGE);
|
$limitStart = (($page-1)*ZM_WEB_EVENTS_PER_PAGE);
|
||||||
|
|
|
@ -1,22 +1,35 @@
|
||||||
var jsTranslatedAddText;
|
|
||||||
var jsTranslatedCloneText;
|
|
||||||
|
|
||||||
function setButtonStates( element ) {
|
function setButtonStates( element ) {
|
||||||
var form = element.form;
|
var form = element.form;
|
||||||
var checked = 0;
|
var checked = 0;
|
||||||
for ( var i = 0; i < form.elements.length; i++ ) {
|
for ( var i=0; i < form.elements.length; i++ ) {
|
||||||
if ( form.elements[i].type == "checkbox" ) {
|
if (
|
||||||
|
form.elements[i].type=="checkbox"
|
||||||
|
&&
|
||||||
|
form.elements[i].name=="markMids[]"
|
||||||
|
) {
|
||||||
|
var tr = $j(form.elements[i]).closest("tr");
|
||||||
if ( form.elements[i].checked ) {
|
if ( form.elements[i].checked ) {
|
||||||
if ( checked++ > 1 )
|
checked ++;
|
||||||
break;
|
tr.addClass("danger");
|
||||||
|
} else {
|
||||||
|
tr.removeClass("danger");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(element).closest("tr").toggleClass("danger");
|
if ( checked ) {
|
||||||
form.editBtn.disabled = checked ? false : true;
|
form.editBtn.disabled = false;
|
||||||
form.addBtn.value = (checked==1) ? jsTranslatedCloneText:jsTranslatedAddText;
|
form.deleteBtn.disabled = false;
|
||||||
|
if ( checked == 1 ) {
|
||||||
form.deleteBtn.disabled = (checked==0);
|
$j(form.cloneBtn).css('display','inline');
|
||||||
|
} else {
|
||||||
|
form.cloneBtn.hide();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
form.cloneBtn.hide();
|
||||||
|
form.editBtn.disabled = true;
|
||||||
|
form.deleteBtn.disabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addMonitor(element) {
|
function addMonitor(element) {
|
||||||
|
@ -75,8 +88,6 @@ function reloadWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function initPage() {
|
function initPage() {
|
||||||
jsTranslatedAddText = translatedAddText;
|
|
||||||
jsTranslatedCloneText = translatedCloneText;
|
|
||||||
reloadWindow.periodical( consoleRefreshTimeout );
|
reloadWindow.periodical( consoleRefreshTimeout );
|
||||||
if ( showVersionPopup )
|
if ( showVersionPopup )
|
||||||
createPopup( '?view=version', 'zmVersion', 'version' );
|
createPopup( '?view=version', 'zmVersion', 'version' );
|
||||||
|
@ -84,7 +95,7 @@ function initPage() {
|
||||||
createPopup( '?view=donate', 'zmDonate', 'donate' );
|
createPopup( '?view=donate', 'zmDonate', 'donate' );
|
||||||
|
|
||||||
// Makes table sortable
|
// Makes table sortable
|
||||||
$j( function() {
|
$j( function() {
|
||||||
$j( "#consoleTableBody" ).sortable({
|
$j( "#consoleTableBody" ).sortable({
|
||||||
handle: ".glyphicon-sort",
|
handle: ".glyphicon-sort",
|
||||||
update: applySort,
|
update: applySort,
|
||||||
|
|
|
@ -18,5 +18,3 @@ if ( ZM_CHECK_FOR_UPDATES && canEdit('System') && ZM_DYN_LAST_VERSION && ( verNu
|
||||||
?>
|
?>
|
||||||
var showVersionPopup = <?php echo isset($showVersionPopup )?'true':'false' ?>;
|
var showVersionPopup = <?php echo isset($showVersionPopup )?'true':'false' ?>;
|
||||||
var showDonatePopup = <?php echo isset($showDonatePopup )?'true':'false' ?>;
|
var showDonatePopup = <?php echo isset($showDonatePopup )?'true':'false' ?>;
|
||||||
var translatedAddText = "<?php echo translate('AddNewMonitor') ?>";
|
|
||||||
var translatedCloneText = "<?php echo translate('CloneMonitor') ?>";
|
|
||||||
|
|
|
@ -49,28 +49,28 @@ function SetImageSource( monId, time ) {
|
||||||
if ( liveMode == 1 ) {
|
if ( liveMode == 1 ) {
|
||||||
return monitorImageObject[monId].src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
|
return monitorImageObject[monId].src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
|
||||||
|
|
||||||
} else {
|
|
||||||
for ( var i=0, eIdlength = eId.length; i < eIdlength; i++ ) {
|
|
||||||
// Search for the event matching this time. Would be more efficient if we had events indexed by monitor
|
|
||||||
if ( eMonId[i] == monId && time >= eStartSecs[i] && time <= eEndSecs[i] ) {
|
|
||||||
var duration = eEndSecs[i]-eStartSecs[i];
|
|
||||||
var frame = parseInt((time - eStartSecs[i])/(duration)*eventFrames[i])+1;
|
|
||||||
var storage = Storage[eStorageId[i]];
|
|
||||||
if ( storage.ServerId ) {
|
|
||||||
var server = Servers[storage.ServerId];
|
|
||||||
if ( server ) {
|
|
||||||
//console.log( server.Hostname + " for event " + eId[i] );
|
|
||||||
return location.protocol + '//' + server.Hostname + '/index.php?view=image&eid=' + eId[i] + '&fid='+frame + "&width=" + monitorCanvasObj[monId].width + "&height=" + monitorCanvasObj[monId].height;
|
|
||||||
} else {
|
|
||||||
console.log("No server found for " + storage.ServerId );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//console.log("No storage found for " + eStorageId[i] );
|
|
||||||
return "index.php?view=image&eid=" + eId[i] + '&fid='+frame + "&width=" + monitorCanvasObj[monId].width + "&height=" + monitorCanvasObj[monId].height;
|
|
||||||
}
|
|
||||||
} // end for
|
|
||||||
return "no data";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for ( var i=0, eIdlength = eId.length; i < eIdlength; i++ ) {
|
||||||
|
// Search for the event matching this time. Would be more efficient if we had events indexed by monitor
|
||||||
|
if ( eMonId[i] == monId && time >= eStartSecs[i] && time <= eEndSecs[i] ) {
|
||||||
|
var duration = eEndSecs[i]-eStartSecs[i];
|
||||||
|
var frame = parseInt((time - eStartSecs[i])/(duration)*eventFrames[i])+1;
|
||||||
|
var storage = Storage[eStorageId[i]];
|
||||||
|
if ( storage.ServerId ) {
|
||||||
|
var server = Servers[storage.ServerId];
|
||||||
|
if ( server ) {
|
||||||
|
//console.log( server.Hostname + " for event " + eId[i] );
|
||||||
|
return location.protocol + '//' + server.Hostname + '/index.php?view=image&eid=' + eId[i] + '&fid='+frame + "&width=" + monitorCanvasObj[monId].width + "&height=" + monitorCanvasObj[monId].height;
|
||||||
|
} else {
|
||||||
|
console.log("No server found for " + storage.ServerId );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//console.log("No storage found for " + eStorageId[i] );
|
||||||
|
return "index.php?view=image&eid=" + eId[i] + '&fid='+frame + "&width=" + monitorCanvasObj[monId].width + "&height=" + monitorCanvasObj[monId].height;
|
||||||
|
}
|
||||||
|
} // end for
|
||||||
|
return "no data";
|
||||||
}
|
}
|
||||||
|
|
||||||
// callback when loading an image. Will load itself to the canvas, or draw no data
|
// callback when loading an image. Will load itself to the canvas, or draw no data
|
||||||
|
@ -164,7 +164,7 @@ function loadImage2Monitor( monId, url ) {
|
||||||
|
|
||||||
function timerFire() {
|
function timerFire() {
|
||||||
// See if we need to reschedule
|
// See if we need to reschedule
|
||||||
if ( currentDisplayInterval != timerInterval || currentSpeed == 0 ) {
|
if ( ( currentDisplayInterval != timerInterval ) || ( currentSpeed == 0 ) ) {
|
||||||
// zero just turn off interrupts
|
// zero just turn off interrupts
|
||||||
clearInterval(timerObj);
|
clearInterval(timerObj);
|
||||||
timerInterval=currentDisplayInterval;
|
timerInterval=currentDisplayInterval;
|
||||||
|
@ -335,60 +335,61 @@ function drawGraph() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function redrawScreen() {
|
function redrawScreen() {
|
||||||
if ( liveMode == 1 ) {
|
if ( liveMode == 1 ) {
|
||||||
// if we are not in live view switch to history -- this has to come before fit in case we re-establish the timeline
|
// if we are not in live view switch to history -- this has to come before fit in case we re-establish the timeline
|
||||||
$('DateTimeDiv').style.display="none";
|
$('DateTimeDiv').style.display="none";
|
||||||
$('SpeedDiv').style.display="none";
|
$('SpeedDiv').style.display="none";
|
||||||
$('timelinediv').style.display="none";
|
$('timelinediv').style.display="none";
|
||||||
$('live').innerHTML="History";
|
$('live').innerHTML="History";
|
||||||
$('zoomin').style.display="none";
|
$('zoomin').style.display="none";
|
||||||
$('zoomout').style.display="none";
|
$('zoomout').style.display="none";
|
||||||
$('panleft').style.display="none";
|
$('panleft').style.display="none";
|
||||||
$('panright').style.display="none";
|
$('panright').style.display="none";
|
||||||
if ($('downloadVideo')) $('downloadVideo').style.display="none";
|
if ($('downloadVideo')) $('downloadVideo').style.display="none";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// switch out of liveview mode
|
// switch out of liveview mode
|
||||||
$('DateTimeDiv').style.display="inline";
|
$('DateTimeDiv').style.display="inline";
|
||||||
$('SpeedDiv').style.display="inline";
|
$('DateTimeDiv').style.display="inline-flex";
|
||||||
$('SpeedDiv').style.display="inline-flex";
|
$('SpeedDiv').style.display="inline";
|
||||||
$('timelinediv').style.display=null;
|
$('SpeedDiv').style.display="inline-flex";
|
||||||
$('live').innerHTML="Live";
|
$('timelinediv').style.display=null;
|
||||||
$('zoomin').style.display="inline";
|
$('live').innerHTML="Live";
|
||||||
$('zoomin').style.display="inline-flex";
|
$('zoomin').style.display="inline";
|
||||||
$('zoomout').style.display="inline";
|
$('zoomin').style.display="inline-flex";
|
||||||
$('zoomout').style.display="inline-flex";
|
$('zoomout').style.display="inline";
|
||||||
$('panleft').style.display="inline";
|
$('zoomout').style.display="inline-flex";
|
||||||
$('panleft').style.display="inline-flex";
|
$('panleft').style.display="inline";
|
||||||
$('panright').style.display="inline";
|
$('panleft').style.display="inline-flex";
|
||||||
$('panright').style.display="inline-flex";
|
$('panright').style.display="inline";
|
||||||
if ($('downloadVideo')) $('downloadVideo').style.display="inline";
|
$('panright').style.display="inline-flex";
|
||||||
}
|
if ($('downloadVideo')) $('downloadVideo').style.display="inline";
|
||||||
|
}
|
||||||
|
|
||||||
if ( fitMode == 1 ) {
|
if ( fitMode == 1 ) {
|
||||||
$('ScaleDiv').style.display="none";
|
$('ScaleDiv').style.display="none";
|
||||||
$('fit').innerHTML="Scale";
|
$('fit').innerHTML="Scale";
|
||||||
var vh=window.innerHeight;
|
var vh=window.innerHeight;
|
||||||
var vw=window.innerWidth;
|
var vw=window.innerWidth;
|
||||||
var pos=$('monitors').getPosition();
|
var pos=$('monitors').getPosition();
|
||||||
var mh=(vh - pos.y - $('fps').getSize().y);
|
var mh=(vh - pos.y - $('fps').getSize().y);
|
||||||
$('monitors').setStyle('height',mh.toString() + "px"); // leave a small gap at bottom
|
$('monitors').setStyle('height',mh.toString() + "px"); // leave a small gap at bottom
|
||||||
if(maxfit2($('monitors').getSize().x,$('monitors').getSize().y) == 0) /// if we fail to fix we back out of fit mode -- ??? This may need some better handling
|
if(maxfit2($('monitors').getSize().x,$('monitors').getSize().y) == 0) /// if we fail to fix we back out of fit mode -- ??? This may need some better handling
|
||||||
fitMode=1-fitMode;
|
fitMode=1-fitMode;
|
||||||
} else {
|
} else {
|
||||||
// switch out of fit mode
|
// switch out of fit mode
|
||||||
// if we fit, then monitors were absolutely positioned already (or will be) otherwise release them to float
|
// if we fit, then monitors were absolutely positioned already (or will be) otherwise release them to float
|
||||||
for( var i=0; i<numMonitors; i++ )
|
for( var i=0; i<numMonitors; i++ )
|
||||||
monitorCanvasObj[monitorPtr[i]].style.position="";
|
monitorCanvasObj[monitorPtr[i]].style.position="";
|
||||||
$('monitors').setStyle('height',"auto");
|
$('monitors').setStyle('height',"auto");
|
||||||
$('ScaleDiv').style.display="inline";
|
$('ScaleDiv').style.display="inline";
|
||||||
$('ScaleDiv').style.display="inline-flex";
|
$('ScaleDiv').style.display="inline-flex";
|
||||||
$('fit').innerHTML="Fit";
|
$('fit').innerHTML="Fit";
|
||||||
setScale(currentScale);
|
setScale(currentScale);
|
||||||
}
|
}
|
||||||
drawGraph();
|
drawGraph();
|
||||||
outputUpdate(currentTimeSecs);
|
outputUpdate(currentTimeSecs);
|
||||||
timerFire(); // force a fire in case it's not timing
|
timerFire(); // force a fire in case it's not timing
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputUpdate(time) {
|
function outputUpdate(time) {
|
||||||
|
@ -401,21 +402,21 @@ function outputUpdate(time) {
|
||||||
|
|
||||||
/// Found this here: http://stackoverflow.com/questions/55677/how-do-i-get-the-coordinates-of-a-mouse-click-on-a-canvas-element
|
/// Found this here: http://stackoverflow.com/questions/55677/how-do-i-get-the-coordinates-of-a-mouse-click-on-a-canvas-element
|
||||||
function relMouseCoords(event){
|
function relMouseCoords(event){
|
||||||
var totalOffsetX = 0;
|
var totalOffsetX = 0;
|
||||||
var totalOffsetY = 0;
|
var totalOffsetY = 0;
|
||||||
var canvasX = 0;
|
var canvasX = 0;
|
||||||
var canvasY = 0;
|
var canvasY = 0;
|
||||||
var currentElement = this;
|
var currentElement = this;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
totalOffsetX += currentElement.offsetLeft - currentElement.scrollLeft;
|
totalOffsetX += currentElement.offsetLeft - currentElement.scrollLeft;
|
||||||
totalOffsetY += currentElement.offsetTop - currentElement.scrollTop;
|
totalOffsetY += currentElement.offsetTop - currentElement.scrollTop;
|
||||||
} while(currentElement = currentElement.offsetParent);
|
} while(currentElement = currentElement.offsetParent);
|
||||||
|
|
||||||
canvasX = event.pageX - totalOffsetX;
|
canvasX = event.pageX - totalOffsetX;
|
||||||
canvasY = event.pageY - totalOffsetY;
|
canvasY = event.pageY - totalOffsetY;
|
||||||
|
|
||||||
return {x:canvasX, y:canvasY}
|
return {x:canvasX, y:canvasY}
|
||||||
}
|
}
|
||||||
HTMLCanvasElement.prototype.relMouseCoords = relMouseCoords;
|
HTMLCanvasElement.prototype.relMouseCoords = relMouseCoords;
|
||||||
|
|
||||||
|
@ -476,7 +477,8 @@ function setSpeed( speed_index ) {
|
||||||
speedIndex = speed_index;
|
speedIndex = speed_index;
|
||||||
playSecsperInterval = Math.floor( 1000 * currentSpeed * currentDisplayInterval ) / 1000000;
|
playSecsperInterval = Math.floor( 1000 * currentSpeed * currentDisplayInterval ) / 1000000;
|
||||||
showSpeed(speed_index);
|
showSpeed(speed_index);
|
||||||
if ( timerInterval != currentDisplayInterval || currentSpeed == 0 ) timerFire(); // if the timer isn't firing we need to trigger it to update
|
if ( timerInterval != currentDisplayInterval ) timerFire(); // if the timer isn't firing we need to trigger it to update
|
||||||
|
//if ( (timerInterval != currentDisplayInterval || currentSpeed == 0 ) timerFire(); // if the timer isn't firing we need to trigger it to update
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLive(value) {
|
function setLive(value) {
|
||||||
|
@ -734,6 +736,20 @@ function clickMonitor(event,monId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeDateTime(e) {
|
function changeDateTime(e) {
|
||||||
|
var minTime_element = $j('#minTime');
|
||||||
|
var maxTime_element = $j('#maxTime');
|
||||||
|
|
||||||
|
var minTime = moment(minTime_element.val());
|
||||||
|
var maxTime = moment(maxTime_element.val());
|
||||||
|
if ( minTime.isAfter(maxTime) ) {
|
||||||
|
maxTime_element.parent().addClass('has-error');
|
||||||
|
console.log("maxTime is less than mintime");
|
||||||
|
return; // Don't reload because we have invalid datetime filter.
|
||||||
|
} else {
|
||||||
|
console.log("maxTime is greater than mintime");
|
||||||
|
maxTime_element.parent().removeClass('has-error');
|
||||||
|
}
|
||||||
|
|
||||||
var minStr = "&minTime="+($j('#minTime')[0].value);
|
var minStr = "&minTime="+($j('#minTime')[0].value);
|
||||||
var maxStr = "&maxTime="+($j('#maxTime')[0].value);
|
var maxStr = "&maxTime="+($j('#maxTime')[0].value);
|
||||||
|
|
||||||
|
@ -798,6 +814,6 @@ function initPage() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.addEventListener("resize",redrawScreen);
|
window.addEventListener("resize",redrawScreen,{passive:true});
|
||||||
// Kick everything off
|
// Kick everything off
|
||||||
window.addEvent( 'domready', initPage );
|
window.addEvent( 'domready', initPage );
|
||||||
|
|
|
@ -232,7 +232,7 @@ xhtmlHeaders(__FILE__, translate('MontageReview') );
|
||||||
<input id="speedslider" type="range" min="0" max="<?php echo count($speeds)-1?>" value="<?php echo $speedIndex ?>" step="1" onchange="setSpeed(this.value);" oninput="showSpeed(this.value);"/>
|
<input id="speedslider" type="range" min="0" max="<?php echo count($speeds)-1?>" value="<?php echo $speedIndex ?>" step="1" onchange="setSpeed(this.value);" oninput="showSpeed(this.value);"/>
|
||||||
<span id="speedslideroutput"><?php echo $speeds[$speedIndex] ?> fps</span>
|
<span id="speedslideroutput"><?php echo $speeds[$speedIndex] ?> fps</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: inline-flex; border: 1px solid black; flex-flow: row wrap;">
|
<div id="ButtonsDiv">
|
||||||
<button type="button" id="panleft" onclick="click_panleft();" >< <?php echo translate('Pan') ?></button>
|
<button type="button" id="panleft" onclick="click_panleft();" >< <?php echo translate('Pan') ?></button>
|
||||||
<button type="button" id="zoomin" onclick="click_zoomin();" ><?php echo translate('In +') ?></button>
|
<button type="button" id="zoomin" onclick="click_zoomin();" ><?php echo translate('In +') ?></button>
|
||||||
<button type="button" id="zoomout" onclick="click_zoomout();" ><?php echo translate('Out -') ?></button>
|
<button type="button" id="zoomout" onclick="click_zoomout();" ><?php echo translate('Out -') ?></button>
|
||||||
|
|
Loading…
Reference in New Issue