Merge branch 'storageareas' into zma_to_thread

Conflicts:
	src/zm_monitor.cpp
This commit is contained in:
Isaac Connor 2018-02-08 12:40:24 -05:00
commit 4b6f40dd9f
15 changed files with 224 additions and 132 deletions

View File

@ -409,7 +409,7 @@ deterministic
begin
update Storage set DiskSpace = DiskSpace + space where Id = StorageId;
update Storage set DiskSpace = COALESCE(DiskSpace,0) + COALESCE(space,0) where Id = StorageId;
end;
@ -496,7 +496,9 @@ 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;

49
db/zm_update-1.31.37.sql Normal file
View File

@ -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)//

View File

@ -470,7 +470,7 @@ sub DiskSpace {
$_[0]{DiskSpace} = $size;
Debug("DiskSpace for event $_[0]{Id} at $_[0]{Path} Updated to $size bytes");
} 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
return $_[0]{DiskSpace};

View File

@ -1 +1 @@
1.31.36
1.31.37

View File

@ -2,7 +2,6 @@
#SpeedDiv{
vertical-align: top;
display: inline-flex;
border: 1px solid black;
width: 25%;
padding: 4px;
}
@ -10,6 +9,14 @@
#SpeedDiv label {
margin: 0;
}
#ButtonsDiv {
display: inline-flex;
flex-flow: row-wrap;
}
#ButtonsDiv button {
display: inline-flex;
min-width: 0;
}
#DateTimeDiv {
display: inline-flex;
}
@ -23,7 +30,7 @@
#timelinediv {
margin: 2px auto;
position:relative;
width:93%;
width:100%;
}
#timeline {

View File

@ -52,11 +52,11 @@
}
#imageFrame div {
background-image: url(../../../graphics/point-g.png);
background-image: url(/zm/skins/classic/graphics/point-g.png);
}
#imageFrame div.highlight {
background-image: url(../../../graphics/point-o.png);
background-image: url(/zm/skins/classic/graphics/point-o.png);
}
#imageFrame div.active {

View File

@ -72,7 +72,7 @@ html ul.tabs li.active, html ul.tabs li.active a:hover {
-->
</style>
<script type="text/javascript">
<?php include(ZM_SKIN_PATH.'/js/jquery.js'
<?php include(ZM_SKIN_PATH.'/js/jquery.js') ?>
</script>
<script type="text/javascript" language="javascript" charset="utf-8">

View File

@ -22,6 +22,7 @@
function xhtmlHeaders( $file, $title ) {
global $css;
global $skin;
global $view;
# This idea is that we always include the classic css files,
# and then any different skin only needs to contain things that are different.
@ -132,7 +133,7 @@ echo output_link_if_exists( array(
?>
<script src='https://www.google.com/recaptcha/api.js'></script>
<?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-skin.css" rel="stylesheet">
@ -140,7 +141,11 @@ echo output_link_if_exists( array(
<script src="./js/videojs.zoomrotate.js"></script>
<script src="skins/<?php echo $skin ?>/js/moment.min.js"></script>
<?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">
<?php

View File

@ -33,7 +33,7 @@ var popupSizes = {
'device': { 'width': 260, 'height': 150 },
'devices': { 'width': 400, 'height': 240 },
'donate': { 'width': 500, 'height': 280 },
'download': { 'width': 350, 'height': 215 },
'download': { 'width': 350, 'height': 315 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
'eventdetail': { 'width': 600, 'height': 420 },
'events': { 'width': 1220, 'height': 780 },

View File

@ -289,13 +289,22 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
<tr>
<td class="colId"><?php echo count($displayMonitors) ?></td>
<td class="colLeftButtons" colspan="<?php echo $left_columns -1?>">
<input type="button" value="<?php echo translate('Refresh') ?>" onclick="location.reload(true);"/>
<!--<input type="button" name="addBtn" value="<?php echo translate('AddNewMonitor') ?>" onclick="addMonitor(this);"
<button name="addBtn" onclick="addMonitor(this);"
<?php echo (canEdit('Monitors') && !$user['MonitorIds']) ? '' : ' disabled="disabled"' ?>
/>-->
<?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?>
<input type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editMonitor( this )" disabled="disabled"/>
<input type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteMonitor( this )" disabled="disabled"/>
>
<?php echo translate('AddNewMonitor') ?>
</button>
<button name="cloneBtn" onclick="addMonitor(this);"
<?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>
<?php
foreach ( array_keys( $eventCounts ) as $i ) {

View File

@ -48,24 +48,19 @@ Error("No filtering in events, will load ALL!");
}
$eventsSql .= " ORDER BY $sortColumn $sortOrder";
if ( isset($_REQUEST['page']) )
$page = validInt($_REQUEST['page']);
else
$page = 0;
if ( isset($_REQUEST['limit']) )
$limit = validInt($_REQUEST['limit']);
else
$limit = 0;
$page = isset($_REQUEST['page']) ? validInt($_REQUEST['page']) : 0;
$limit = isset($_REQUEST['limit']) ? validInt($_REQUEST['limit']) : 0;
$nEvents = dbFetchOne( $countSql, 'EventCount' );
if ( !empty($limit) && $nEvents > $limit ) {
$nEvents = $limit;
}
$pages = (int)ceil($nEvents/ZM_WEB_EVENTS_PER_PAGE);
#Logger::Debug("Page $page Limit $limit #vents: $nEvents pages: $pages ");
if ( !empty($page) ) {
if ( $page < 0 )
$page = 1;
else if ( $page > $pages )
else if ( $pages and ( $page > $pages ) )
$page = $pages;
$limitStart = (($page-1)*ZM_WEB_EVENTS_PER_PAGE);

View File

@ -1,22 +1,35 @@
var jsTranslatedAddText;
var jsTranslatedCloneText;
function setButtonStates( element ) {
var form = element.form;
var checked = 0;
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 ( checked++ > 1 )
break;
checked ++;
tr.addClass("danger");
} else {
tr.removeClass("danger");
}
}
}
$(element).closest("tr").toggleClass("danger");
form.editBtn.disabled = checked ? false : true;
form.addBtn.value = (checked==1) ? jsTranslatedCloneText:jsTranslatedAddText;
form.deleteBtn.disabled = (checked==0);
if ( checked ) {
form.editBtn.disabled = false;
form.deleteBtn.disabled = false;
if ( checked == 1 ) {
$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) {
@ -75,8 +88,6 @@ function reloadWindow() {
}
function initPage() {
jsTranslatedAddText = translatedAddText;
jsTranslatedCloneText = translatedCloneText;
reloadWindow.periodical( consoleRefreshTimeout );
if ( showVersionPopup )
createPopup( '?view=version', 'zmVersion', 'version' );

View File

@ -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 showDonatePopup = <?php echo isset($showDonatePopup )?'true':'false' ?>;
var translatedAddText = "<?php echo translate('AddNewMonitor') ?>";
var translatedCloneText = "<?php echo translate('CloneMonitor') ?>";

View File

@ -49,7 +49,8 @@ function SetImageSource( monId, time ) {
if ( liveMode == 1 ) {
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] ) {
@ -71,7 +72,6 @@ function SetImageSource( monId, time ) {
} // end for
return "no data";
}
}
// callback when loading an image. Will load itself to the canvas, or draw no data
function imagedone( obj, monId, success ) {
@ -164,7 +164,7 @@ function loadImage2Monitor( monId, url ) {
function timerFire() {
// See if we need to reschedule
if ( currentDisplayInterval != timerInterval || currentSpeed == 0 ) {
if ( ( currentDisplayInterval != timerInterval ) || ( currentSpeed == 0 ) ) {
// zero just turn off interrupts
clearInterval(timerObj);
timerInterval=currentDisplayInterval;
@ -350,6 +350,7 @@ function redrawScreen() {
} else {
// switch out of liveview mode
$('DateTimeDiv').style.display="inline";
$('DateTimeDiv').style.display="inline-flex";
$('SpeedDiv').style.display="inline";
$('SpeedDiv').style.display="inline-flex";
$('timelinediv').style.display=null;
@ -476,7 +477,8 @@ function setSpeed( speed_index ) {
speedIndex = speed_index;
playSecsperInterval = Math.floor( 1000 * currentSpeed * currentDisplayInterval ) / 1000000;
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) {
@ -734,6 +736,20 @@ function clickMonitor(event,monId) {
}
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 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
window.addEvent( 'domready', initPage );

View File

@ -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);"/>
<span id="speedslideroutput"><?php echo $speeds[$speedIndex] ?> fps</span>
</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();" >&lt; <?php echo translate('Pan') ?></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>