Merge branch 'release-1.34'

This commit is contained in:
Isaac Connor 2020-04-04 16:35:09 -04:00
commit 571ff260cc
17 changed files with 298 additions and 330 deletions

View File

@ -356,11 +356,16 @@ sub handleMessage {
my $connection = shift;
my $message = shift;
# CUA - Axis camera send the message quoted with"
# CUA - Also Axis camera cannot save the plus sign which
$message =~ s/^\"//g;
$message =~ s/\"$//g;
my ( $id, $action, $score, $cause, $text, $showtext )
= split( /\|/, $message );
$score = 0 if ( !defined($score) );
$cause = '' if ( !defined($cause) );
$text = '' if ( !defined($text) );
$score = 0 if !defined($score);
$cause = '' if !defined($cause);
$text = '' if !defined($text);
my $monitor = $monitors{$id};
if ( !$monitor ) {
@ -372,7 +377,7 @@ sub handleMessage {
next if !zmMemVerify($monitor);
Debug("Handling action '$action'");
if ( $action =~ /^(enable|disable)(?:\+(\d+))?$/ ) {
if ( $action =~ /^(enable|disable)(?:[\+ ](\d+))?$/ ) {
my $state = $1;
my $delay = $2;
if ( $state eq 'enable' ) {

View File

@ -1,5 +1,5 @@
<?php
error_reporting(E_ERROR);
ini_set('display_errors','0');
if ( empty($_REQUEST['id']) && empty($_REQUEST['eids']) ) {
ajaxError('No event id(s) supplied');
@ -155,5 +155,5 @@ if ( canEdit('Events') ) {
} // end switch action
} // end if canEdit('Events')
ajaxError('Unrecognised action '.$_REQUEST['action'].' or insufficient permissions for user ' . $user['Username']);
ajaxError('Unrecognised action '.$_REQUEST['action'].' or insufficient permissions for user '.$user['Username']);
?>

View File

@ -42,6 +42,8 @@ if ( $action == 'version' && isset($_REQUEST['option']) ) {
$nextReminder += 24*60*60;
} elseif ( $option == 'week' ) {
$nextReminder += 7*24*60*60;
} elseif ( $option == 'month' ) {
$nextReminder += 30*24*60*60;
}
dbQuery("UPDATE Config SET Value = '".$nextReminder."' WHERE Name = 'ZM_DYN_NEXT_REMINDER'");
break;

View File

@ -193,7 +193,7 @@ if ( ! defined('ZM_SERVER_ID') ) {
}
}
if ( ZM_TIMEZONE )
if ( defined('ZM_TIMEZONE') and ZM_TIMEZONE )
ini_set('date.timezone', ZM_TIMEZONE);
function process_configfile($configFile) {

View File

@ -798,6 +798,7 @@ $SLANG = array(
'VersionRemindHour' => 'Remind again in 1 hour',
'VersionRemindNever' => 'Don\'t remind about new versions',
'VersionRemindWeek' => 'Remind again in 1 week',
'VersionRemindMonth' => 'Remind again in 1 month',
'Version' => 'Version',
'ViewMatches' => 'View Matches',
'VideoFormat' => 'Video Format',

View File

@ -52,3 +52,42 @@ td.monoRow {
background-color: #ffffff;
}
ul.tabs {
margin: 0;
margin-bottom: -1px;
padding: 0;
float: left;
list-style: none;
height: 32px;
border-bottom: 1px solid #7f7fb2;
border-left: 1px solid #7f7fb2;
width: 100%;
}
ul.tabs li {
float: left;
margin: 0;
padding: 0;
height: 31px;
line-height: 31px;
border: 1px solid #7f7fb2;
border-left: none;
margin-bottom: -1px;
background: #fff;
overflow: hidden;
position: relative;
}
ul.tabs li a {
text-decoration: none;
color: #000;
display: block;
font-size: 1.2em;
padding: 0 20px;
outline: none;
}
ul.tabs li a:hover {
background: #ccc;
}
html ul.tabs li.active, html ul.tabs li.active a:hover {
background: #dddddd;
border-bottom: 1px solid #e0e0e0;
}

View File

@ -445,14 +445,14 @@ th.table-th-sort span.table-th-sort-span {
float: right;
width: 12px;
height: 12px;
background: url("/skins/classic/graphics/arrow-s-u.png") no-repeat 0 0;
background: url("../skins/classic/graphics/arrow-s-u.png") no-repeat 0 0;
}
th.table-th-sort-rev span.table-th-sort-span {
float: right;
width: 12px;
height: 12px;
background: url("/skins/classic/graphics/arrow-s-d.png") no-repeat 0 0;
background: url("../skins/classic/graphics/arrow-s-d.png") no-repeat 0 0;
}
.table-tr-odd {

View File

@ -1,54 +0,0 @@
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
font-weight: normal;
color: #333333;
}
table {
border-collapse: collapse;
}
th, td {
border: 1px solid #7f7fb2;
text-align: center;
padding: 2px 4px;
}
a:link {
color: #7f7fb2;
text-decoration: none
}
a:visited {
color: #7f7fb2;
text-decoration: none
}
a:hover {
color: #666699;
text-decoration: underline
}
img.thumb {
width: 40px;
}
td.monoRow {
line-height: 200%;
text-align: center;
vertical-align: middle;
}
#eventFrames tr.alarm {
background-color: #fa8072;
}
#eventFrames tr.bulk {
background-color: #cccccc;
}
#eventFrames tr.normal {
background-color: #ffffff;
}

View File

@ -1,54 +0,0 @@
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
font-weight: normal;
color: #333333;
}
table {
border-collapse: collapse;
}
th, td {
border: 1px solid #7f7fb2;
text-align: center;
padding: 2px 4px;
}
a:link {
color: #7f7fb2;
text-decoration: none
}
a:visited {
color: #7f7fb2;
text-decoration: none
}
a:hover {
color: #666699;
text-decoration: underline
}
img.thumb {
width: 40px;
}
td.monoRow {
line-height: 200%;
text-align: center;
vertical-align: middle;
}
#eventFrames tr.alarm {
background-color: #fa8072;
}
#eventFrames tr.bulk {
background-color: #cccccc;
}
#eventFrames tr.normal {
background-color: #ffffff;
}

View File

@ -20,52 +20,18 @@
function exportHeader($title) {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $title ?></title>
<style type="text/css">
<?php include(ZM_PATH_WEB.'/'.ZM_SKIN_PATH.'/css/'.ZM_SKIN_NAME.'/export.css'); ?>
ul.tabs {
margin: 0;
margin-bottom: -1px;
padding: 0;
float: left;
list-style: none;
height: 32px;
border-bottom: 1px solid #7f7fb2;
border-left: 1px solid #7f7fb2;
width: 100%;
}
ul.tabs li {
float: left;
margin: 0;
padding: 0;
height: 31px;
line-height: 31px;
border: 1px solid #7f7fb2;
border-left: none;
margin-bottom: -1px;
background: #fff;
overflow: hidden;
position: relative;
}
ul.tabs li a {
text-decoration: none;
color: #000;
display: block;
font-size: 1.2em;
padding: 0 20px;
outline: none;
}
ul.tabs li a:hover {
background: #ccc;
}
html ul.tabs li.active, html ul.tabs li.active a:hover {
background: #dddddd;
border-bottom: 1px solid #e0e0e0;
}
<style>
<?php
include(ZM_PATH_WEB.'/'.ZM_SKIN_PATH.'/css/base/export.css');
if ( $css != 'base' ) {
include(ZM_PATH_WEB.'/'.ZM_SKIN_PATH.'/css/'.$css.'/export.css');
}
?>
</style>
<script src="<?php echo ($title == translate('Images').' Master' ? '' : '../') ?>jquery.js"></script>
<!--<script type="text/javascript" src="<?php echo ($title == translate('Images').' Master' ? '' : '../') ?>video.js"></script>-->
@ -95,21 +61,21 @@ html ul.tabs li.active, html ul.tabs li.active a:hover {
</script>
</head>
<?php
}
} // end exportHeader
function exportEventDetail($event, $exportFrames, $exportImages) {
ob_start();
exportHeader(translate('Event').' '.$event->Id());
$otherlinks = '';
if( $exportFrames ) $otherlinks .= '<a href="zmEventFrames.html">'.translate('Frames').'</a>,';
if( $exportImages ) $otherlinks .= '<a href="zmEventImages.html">'.translate('Images').'</a>,';
$otherlinks = substr($otherlinks,0,-1);
if ( $exportFrames ) $otherlinks .= ' <a href="zmEventFrames.html">'.translate('Frames').'</a>,';
if ( $exportImages ) $otherlinks .= ' <a href="zmEventImages.html">'.translate('Images').'</a>,';
$otherlinks = substr($otherlinks, 0, -1);
?>
<body>
<div id="page">
<div id="content">
<h2><?php echo translate('Event') ?>: <?php echo validHtmlStr($event->Name()) ?><?php if(!empty($otherlinks)) { ?> (<?php echo$otherlinks?>) <?php } ?></h2>
<h2><?php echo translate('Event') .': '.validHtmlStr($event->Name()).( (!empty($otherlinks)) ? ' ('.$otherlinks.') ' : '' ) ?></h2>
<table id="eventDetail">
<tr><th scope="row"><?php echo translate('Id') ?></th><td><?php echo $event->Id() ?></td></tr>
<tr><th scope="row"><?php echo translate('Name') ?></th><td><?php echo validHtmlStr($event->Name()) ?></td></tr>
@ -134,21 +100,21 @@ function exportEventDetail($event, $exportFrames, $exportImages) {
}
function exportEventFrames($event, $exportDetail, $exportImages) {
$sql = 'SELECT *, unix_timestamp( TimeStamp ) AS UnixTimeStamp FROM Frames WHERE EventID = ? ORDER BY FrameId';
$sql = 'SELECT *, unix_timestamp(TimeStamp) AS UnixTimeStamp FROM Frames WHERE EventID = ? ORDER BY FrameId';
$frames = dbFetchAll($sql, NULL, array($event->Id()));
ob_start();
exportHeader(translate('Frames').' '.$event->Id());
$otherlinks = '';
if ( $exportDetail ) $otherlinks .= '<a href="zmEventDetail.html">'.translate('Event').'</a>,';
if ( $exportImages ) $otherlinks .= '<a href="zmEventImages.html">'.translate('Images').'</a>,';
$otherlinks = substr($otherlinks,0,-1);
if ( $exportDetail ) $otherlinks .= ' <a href="zmEventDetail.html">'.translate('Event').'</a>,';
if ( $exportImages ) $otherlinks .= ' <a href="zmEventImages.html">'.translate('Images').'</a>,';
$otherlinks = substr($otherlinks, 0, -1);
?>
<body>
<div id="page">
<div id="content">
<h2><?php echo translate('Frames') ?>: <?php echo validHtmlStr($event->Name()) ?><?php if(!empty($otherlinks)) { ?> (<?php echo$otherlinks?>) <?php } ?></h2>
<h2><?php echo translate('Frames').': '.validHtmlStr($event->Name()).( (!empty($otherlinks)) ? ' ('.$otherlinks.')':'') ?></h2>
<table id="eventFrames">
<tr>
<th><?php echo translate('FrameId') ?></th>
@ -208,26 +174,45 @@ function exportEventFrames($event, $exportDetail, $exportImages) {
</html>
<?php
return ob_get_clean();
}
} // end function exportEventFrames($event, $exportDetail, $exportImages)
function exportEventImages($event, $exportDetail, $exportFrames, $myfilelist) {
ob_start();
exportHeader(translate('Images').' '.$event->Id());
$otherlinks = '';
if( $exportDetail ) $otherlinks .= '<a href="zmEventDetail.html">'.translate('Event').'</a>,';
if( $exportFrames ) $otherlinks .= '<a href="zmEventFrames.html">'.translate('Frames').'</a>,';
$otherlinks = substr($otherlinks,0,-1);
if ( $exportDetail ) $otherlinks .= ' <a href="zmEventDetail.html">'.translate('Event').'</a>,';
if ( $exportFrames ) $otherlinks .= ' <a href="zmEventFrames.html">'.translate('Frames').'</a>,';
$otherlinks = substr($otherlinks, 0, -1);
$filelist = array_keys($myfilelist);
sort($filelist,SORT_NUMERIC);
sort($filelist, SORT_NUMERIC);
$slides = '"'.implode('","',$filelist).'"';
$listcount = count($filelist);
?>
<body>
<style>
.horizontal_track {background-color: #bbb;width: <?php echo $event->Width()?>px;line-height: 0px;font-size: 0px;text-align: left;padding: 4px;border: 1px solid;border-color: #ddd #999 #999 #ddd;}
.horizontal_slider {background-color: #666;width: 16px;height: 8px;position: relative;z-index: 2;line-height: 0;margin: 0;border: 2px solid;border-color: #999 #333 #333 #999;}
.horizontal_track {
background-color: #bbb;
width: <?php echo $event->Width()?>px;
line-height: 0;
font-size: 0;
text-align: left;
padding: 4px;
border: 1px solid;
border-color: #ddd #999 #999 #ddd;
}
.horizontal_slider {
background-color: #666;
width: 16px;
height: 8px;
position: relative;
z-index: 2;
line-height: 0;
margin: 0;
border: 2px solid;
border-color: #999 #333 #333 #999;
}
.horizontal_slit {background-color: #333;width: <?php echo($event->Width()-10)?>px;height: 2px;margin: 4px 4px 2px 4px;line-height: 0;position: absolute;z-index: 1;border: 1px solid;border-color: #999 #ddd #ddd #999;}
.vertical_track {background-color: #bbb;padding: 3px 5px 15px 5px;border: 1px solid;border-color: #ddd #999 #999 #ddd;}
.vertical_slider {background-color: #666;width: 18px;height: 8px;font: 0px;text-align: left;line-height: 0px;position: relative;z-index: 1;border: 2px solid;border-color: #999 #333 #333 #999;}
@ -236,7 +221,7 @@ function exportEventImages($event, $exportDetail, $exportFrames, $myfilelist) {
.value_display {background-color: #bbb;color: #333;width: 30px;margin: 0 2px;text-align: right;font-size: 8pt;font-face: verdana, arial, helvetica, sans-serif;font-weight: bold;line-height: 12px;border: 0;cursor: default;}
</style>
<h2><?php echo translate('Images') ?>: <?php echo validHtmlStr($event->Name()) ?><?php if(!empty($otherlinks)) { ?> (<?php echo$otherlinks?>) <?php } ?></h2>
<h2><?php echo translate('Images').': '.validHtmlStr($event->Name()).( (!empty($otherlinks)) ? ' ('.$otherlinks.') ' : '' ) ?></h2>
<?php
if ( $event->DefaultVideo() ) {
@ -247,12 +232,12 @@ function exportEventImages($event, $exportDetail, $exportFrames, $myfilelist) {
if ( $Monitor->VideoWriter() == '2' ) {
# Passthrough
$Rotation = $event->Orientation();
if ( in_array($event->Orientation(),array('ROTATE_90','ROTATE_270')) )
if ( in_array($event->Orientation(), array('ROTATE_90','ROTATE_270')) )
$Zoom = $event->Height()/$event->Width();
}
} # end if passthrough
?>
<div id="videoFeed">
<video id="videoobj" class="video-js vjs-default-skin" style="transform: matrix(1, 0, 0, 1, 0, 0)"
<video id="videoobj" class="video-js vjs-default-skin" style="transform: matrix(1, 0, 0, 1, 0, 0);"
width="<?php echo $event->Width() ?>"
height="<?php echo $event->Height() ?>"
data-setup='{ "controls": true, "autoplay": true, "preload": "auto", "plugins": { "zoomrotate": { "zoom": "<?php echo $Zoom ?>"}}}'>
@ -582,36 +567,45 @@ else if (document.layers) window.onload=start_slider;
</html>
<?php
return ob_get_clean();
}
} # end function exportEventImages($event, $exportDetail, $exportFrames, $myfilelist)
function eventlist_html($Event) {
?>
<div class="event">
<?php
function eventlist_html($Event, $exportDetail, $exportFrames) {
$html = '<div class="event">
';
if ( $Event->SaveJPEGs() ) {
?>
<a href="#" onclick="switchevent('<?php echo $Event->Id(); ?>/zmEventImages.html');return false;">
<?php if ( ZM_WEB_LIST_THUMBS ) { ?>
<img width="<?php echo ZM_WEB_LIST_THUMB_WIDTH ?>" src="<?php echo $Event->Id(); ?>/snapshot.jpg" alt="<?php echo $Event->Id()?>"/>
<?php } else { echo $Event->Id(); } ?>
</a>
<?php
$html .= '<a href="#" onclick="switchevent(\''.$Event->Id().'/zmEventImages.html\');return false;">
';
if ( ZM_WEB_LIST_THUMBS ) {
$html .= '<img width="'.ZM_WEB_LIST_THUMB_WIDTH.'" src="'. $Event->Id().'/snapshot.jpg" alt="'.$Event->Id().'"/>
';
} else {
$html .= $Event->Id();
}
$html .= '</a><br/>
';
} # end if has jpegs
if ( $Event->DefaultVideo() ) {
if ( ZM_WEB_LIST_THUMBS ) {
?>
<a href="<?php echo $Event->Id().'/'.$Event->DefaultVideo() ?>">
<img width="<?php echo ZM_WEB_LIST_THUMB_WIDTH ?>" src="<?php echo $Event->Id(); ?>/snapshot.jpg" alt="<?php echo $Event->Id()?>"/>
</a>
<?php
$html .= '<a href="'.$Event->Id().'/'.$Event->DefaultVideo() .'">';
$html .= '<img width="'.ZM_WEB_LIST_THUMB_WIDTH.'" src="'. $Event->Id().'/snapshot.jpg" alt="'.$Event->Id().'"/>';
$html .= '</a><br/>
';
}
}
?>
</div><!--event-->
<?php
}
if ( $exportDetail ) {
$html .= '<a href="#" onclick="switchevent(\''.$Event->Id().'/zmEventDetail.html\');return false;">Detail</a>
';
}
if ( $exportFrames ) {
$html .= '<a href="#" onclick="switchevent(\''.$Event->Id().'/zmEventFrames.html\');return false;">Frames</a>
';
}
$html .= '</div><!--event-->
';
return $html;
} // end function eventlist_html
function exportEventImagesMaster($eids) {
function exportEventImagesMaster($eids, $exportDetail, $exportFrames) {
ob_start();
exportHeader(translate('Images').' Master');
?>
@ -620,10 +614,10 @@ function exportEventImagesMaster($eids) {
<?php
$events = ZM\Event::find(array('Id'=>$eids));
foreach ($events as $event) {
foreach ( $events as $event ) {
//get monitor id and event id
$eventMonitorId[$eid] = $event->MonitorId();
$eventPath[$eid] = $event->Relative_Path();
$eventMonitorId[$event->Id()] = $event->MonitorId();
$eventPath[$event->Id()] = $event->Relative_Path();
}
$monitors = array_values(array_flip(array_flip($eventMonitorId))); //unique monitors and reindex the array
@ -631,11 +625,10 @@ function exportEventImagesMaster($eids) {
//*
if ( !empty($monitors) ) {
$tmp = dbFetchAll('SELECT Id,Name FROM Monitors WHERE Id IN ('.implode(',', $monitors).') ');
$tmp = dbFetchAll('SELECT Id, Name FROM Monitors WHERE Id IN ('.implode(',', $monitors).') ');
foreach ( $tmp as $row ) { $monitorNames[$row['Id']] = $row['Name']; }
}
//*/
//trigger_error(print_r($monitorNames,1));
?>
<div id="tabs">
<ul class="tabs">
@ -647,31 +640,32 @@ function exportEventImagesMaster($eids) {
?>
</ul>
</div>
<table width="100%" height="100%">
<table>
<tr>
<td valign="top" bgcolor="#dddddd" style="padding:10px;">
<div class="tab_content" id="all">
<h2> All </h2>
<?php
foreach($events as $event) {
eventlist_html($event);
echo eventlist_html($event, $exportDetail, $exportFrames);
} # end foreach event
?>
</div>
</div>
<?php
foreach ($monitors as $monitor_id) {
echo "<div class=\"tab_content\" id=\"tab$monitor_id\">";
echo '<h2>Monitor: ' . $monitorNames[$monitor_id] . ' </h2>';
foreach ( $monitors as $monitor_id ) {
echo '<div class="tab_content" id="tab'.$monitor_id.'">';
echo '<h2>Monitor: '.$monitorNames[$monitor_id].'</h2>';
foreach ( $events as $event ) {
if ( $event->MonitorId() == $monitor_id ) {
eventlist_html($event);
echo eventlist_html($event, $exportDetail, $exportFrames);
} # end if its the right monitor
} # end foreach event
echo '</div>';
} # end foreach monitor
?>
</td><td>
<iframe id="myframe" onload="resizeCaller();" name="myframe" src="#"
</td><td valign="top">
<iframe id="myframe" onload="resizeCaller();" name="myframe" src="about:blank"
scrolling="no" marginwidth="0" marginheight="0" frameborder="0"
vspace="0" hspace="0" style="overflow:visible; width:100%; display:none">
</iframe>
@ -681,7 +675,7 @@ function exportEventImagesMaster($eids) {
<script>
function switchevent(src) {
$('#myframe').attr('src',src);
$('#myframe').attr('src', src);
$('#myframe').show();
}
@ -702,48 +696,66 @@ var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Fire
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0; //extra height in px to add to iframe in FireFox 1.0+ browsers
function resizeCaller() {
var dyniframe=new Array();
for (i=0; i<iframeids.length; i++){
if (document.getElementById) resizeIframe(iframeids[i]);
//reveal iframe for lower end browsers? (see var above):
if ( (document.all || document.getElementById) && iframehide=="no" ) {
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i]);
tempobj.style.display="block";
}
}
var dyniframe=new Array();
for (i=0; i<iframeids.length; i++){
if (document.getElementById) resizeIframe(iframeids[i]);
//reveal iframe for lower end browsers? (see var above):
if ( (document.all || document.getElementById) && iframehide=="no" ) {
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i]);
tempobj.style.display="block";
}
}
}
function resizeIframe(frameid) {
var currentfr = document.getElementById(frameid);
if ( currentfr && !window.opera ) {
currentfr.style.display = "block";
if ( currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight ) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if ( currentfr.Document && currentfr.Document.body.scrollHeight ) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
var currentfr = document.getElementById(frameid);
if ( currentfr && !window.opera ) {
currentfr.style.display = "block";
if ( currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight ) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if ( currentfr.Document && currentfr.Document.body.scrollHeight ) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if ( currentfr.addEventListener ) {
currentfr.addEventListener("load", readjustIframe, false);
} else if ( currentfr.attachEvent ) {
currentfr.detachEvent("onload", readjustIframe); // Bug fix line
currentfr.attachEvent("onload", readjustIframe);
}
}
currentfr.detachEvent("onload", readjustIframe); // Bug fix line
currentfr.attachEvent("onload", readjustIframe);
}
}
}
function readjustIframe(loadevt) {
var crossevt = window.event ? event : loadevt;
var iframeroot = crossevt.currentTarget ? crossevt.currentTarget : crossevt.srcElement;
if (iframeroot) resizeIframe(iframeroot.id);
var crossevt = window.event ? event : loadevt;
var iframeroot = crossevt.currentTarget ? crossevt.currentTarget : crossevt.srcElement;
if (iframeroot) resizeIframe(iframeroot.id);
$('#myframe').load($('#myframe').src);
}
function loadintoIframe(iframeid, url) {
if (document.getElementById) document.getElementById(iframeid).src=url;
if (document.getElementById) document.getElementById(iframeid).src=url;
}
//if (window.addEventListener) window.addEventListener("load", resizeCaller, false)
//else if (window.attachEvent) window.attachEvent("onload", resizeCaller)
//else window.onload=resizeCaller
/*==========[tab code]==========*/
$(document).ready(function() {
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
});
</script>
</body>
</html>
@ -751,7 +763,14 @@ function loadintoIframe(iframeid, url) {
return ob_get_clean();
}
function exportFileList($event, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc) {
function exportFileList(
$event,
$exportDetail,
$exportFrames,
$exportImages,
$exportVideo,
$exportMisc
) {
if ( !canView('Events') or !$event ) {
return;
@ -773,28 +792,31 @@ function exportFileList($event, $exportDetail, $exportFrames, $exportImages, $ex
if ( $exportDetail ) {
$file = 'zmEventDetail.html';
if ( !($fp = fopen($eventPath.'/'.$file, 'w')) ) {
ZM\Fatal("Can't open event detail export file '$file'");
if ( $fp = fopen($eventPath.'/'.$file, 'w') ) {
fwrite($fp, exportEventDetail($event, $exportFrames, $exportImages));
fclose($fp);
$exportFileList[$file] = $file;
} else {
ZM\Error("Can't open event detail export file '$file'");
}
fwrite($fp, exportEventDetail($event, $exportFrames, $exportImages));
fclose($fp);
$exportFileList[$file] = $file;
}
if ( $exportFrames ) {
$file = 'zmEventFrames.html';
if ( !($fp = fopen($eventPath.'/'.$file, 'w')) ) {
ZM\Fatal("Can't open event frames export file '$file'");
if ( $fp = fopen($eventPath.'/'.$file, 'w') ) {
fwrite($fp, exportEventFrames($event, $exportDetail, $exportImages));
fclose($fp);
$exportFileList[$file] = $file;
} else {
ZM\Error("Can't open event frames export file '$file'");
}
fwrite($fp, exportEventFrames($event, $exportDetail, $exportImages));
fclose($fp);
$exportFileList[$file] = $file;
}
if ( $exportImages ) {
$filesLeft = array();
$myfilelist = array();
foreach ( $files as $file ) {
if ( preg_match('/-(?:capture|analyse).jpg$/', $file ) ) {
if ( preg_match('/-(?:capture|analyse).jpg$/', $file) ) {
$myfilelist[$file] = $exportFileList[$file] = $file;
} else {
$filesLeft[$file] = $file;
@ -805,11 +827,13 @@ function exportFileList($event, $exportDetail, $exportFrames, $exportImages, $ex
// create an image slider
if ( !empty($myfilelist) ) {
$file = 'zmEventImages.html';
if ( !($fp = fopen($file, 'w')) )
ZM\Fatal("Can't open event images export file '$file'");
fwrite($fp, exportEventImages($event, $exportDetail, $exportFrames, $myfilelist));
fclose($fp);
$exportFileList[$file] = $file;
if ( $fp = fopen($eventPath.'/'.$file, 'w') ) {
fwrite($fp, exportEventImages($event, $exportDetail, $exportFrames, $myfilelist));
fclose($fp);
$exportFileList[$file] = $file;
} else {
ZM\Error("Can't open event images export file '$file'");
}
}
} # end if exportImages
@ -823,7 +847,7 @@ function exportFileList($event, $exportDetail, $exportFrames, $exportImages, $ex
}
}
$files = $filesLeft;
} # end if exportVideo
} # end if exportVideo
if ( $exportMisc ) {
foreach ( $files as $file ) {
@ -869,13 +893,14 @@ function exportEvents(
# Ensure that we are going to be able to do this.
if ( ! ( mkdir($export_dir) or file_exists($export_dir) ) ) {
ZM\Fatal("Can't create exports dir at '$export_dir'");
} else {
ZM\Logger::Debug("Successfully created dir '$export_dir'");
ZM\Error("Can't create exports dir at '$export_dir'");
return false;
}
ZM\Logger::Debug("Successfully created dir '$export_dir'");
chmod($export_dir, 0700);
if ( !chdir($export_dir) ) {
ZM\Fatal("Can't chdir to $export_dir");
ZM\Error("Can't chdir to $export_dir");
return;
}
$export_root = 'zmExport';
@ -886,43 +911,37 @@ function exportEvents(
if ( !is_array($eids) ) {
$eids = array($eids);
}
ZM\Logger::Debug('Eids: ' . print_r($eids,true));
foreach ( $eids as $eid ) {
$event = new ZM\Event($eid);
$event_dir = $export_dir.'/'.$event->Id();
if ( !(mkdir($event_dir) or file_exists($event_dir) ) ) {
if ( !(mkdir($event_dir) or file_exists($event_dir)) ) {
ZM\Error("Can't mkdir $event_dir");
}
$event_exportFileList = exportFileList($event, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc);
ZM\Logger::Debug("File list for event $eid " . print_r($event_exportFileList, true));
$exportFileList = array_merge($exportFileList,$event_exportFileList);
$exportFileList = array_merge($exportFileList, $event_exportFileList);
foreach ( $event_exportFileList as $file ) {
if ( preg_match('/\.html$/', $file) )
continue;
#exec('cp -as '.$event->Path().'/../'.$file.' '.$export_dir.'/'.$file, $output, $return);
#if ( preg_match('/\.html$/', $file) )
#continue;
$cmd = 'cp -as '.$event->Path().'/'.$file.' '.$export_dir.'/'.$event->Id().'/'.$file. ' 2>&1';
exec($cmd, $output, $return);
ZM\Logger::Debug($cmd.' return code: '.$return.' output: '.print_r($output,true));
}
} # end foreach event_exportFile
} # end foreach event
// create an master image
if ( $exportImages ) {
if ( !symlink(ZM_PATH_WEB.'/'.ZM_SKIN_PATH.'/js/jquery.js', $export_dir.'/jquery.js') )
ZM\Error('Failed linking jquery.js');
//if ( !symlink(ZM_PATH_WEB.'/'.ZM_SKIN_PATH.'/js/video.js', $export_dir.'/video.js') )
//Error("Failed linking video.js");
if ( !symlink(ZM_PATH_WEB.'/'.ZM_SKIN_PATH.'/js/jquery.js', $export_dir.'/jquery.js') )
ZM\Error('Failed linking jquery.js');
//if ( !symlink(ZM_PATH_WEB.'/'.ZM_SKIN_PATH.'/js/video.js', $export_dir.'/video.js') )
//Error("Failed linking video.js");
$html_eventMaster_file = 'zmEventImagesMaster_'.date('Ymd_His'). '.html';
$html_eventMaster_path = $export_dir.'/'.$html_eventMaster_file;
$html_eventMaster_file = 'zmEventImagesMaster.html';
$html_eventMaster_path = $export_dir.'/'.$html_eventMaster_file;
if ( ($fp = fopen($html_eventMaster_path, 'w')) ) {
fwrite($fp, exportEventImagesMaster($eids));
fclose($fp);
$exportFileList[] = $html_eventMaster_file;
} else {
ZM\Error("Can't open event images export file '$html_eventMaster_path'");
}
if ( ($fp = fopen($html_eventMaster_path, 'w')) ) {
fwrite($fp, exportEventImagesMaster($eids, $exportDetail, $exportFrames));
fclose($fp);
$exportFileList[] = $html_eventMaster_file;
} else {
ZM\Error("Can't open event images export file '$html_eventMaster_path'");
}
$listFile = $export_dir.'/'.$export_listFile;
@ -949,10 +968,10 @@ function exportEvents(
$exportFormat .= '.gz';
}
if ( $exportStructure == 'flat' ) {
if (preg_match("/BSD/i", $version)) {
$command .= " -s '#^.*/##'";
if ( preg_match('/BSD/i', $version) ) {
$command .= ' -s \'#^.*/##\'';
} else {
$command .= " --xform='s#^.+/##x'";
$command .= ' --xform=\'s#^.+/##x\'';
}
}
$command .= ' --file='.escapeshellarg($archive);
@ -974,10 +993,10 @@ function exportEvents(
return false;
}
//clean up temporary files
// clean up temporary files
if ( !empty($html_eventMaster) ) {
unlink($monitorPath.'/'.$html_eventMaster);
}
return '?view=archive%26type='.$exportFormat.'%26connkey='.$connkey;
}
} // end function exportEvents

View File

@ -101,7 +101,7 @@ if ( isset($_REQUEST['eid']) and $_REQUEST['eid'] ) {
$eventsSql .= $_REQUEST['filter']['sql'];
}
$eventsSql .= " ORDER BY $sortColumn $sortOrder";
if ( isset($_REQUEST['filter']['Query']['limit']) )
if ( isset($_REQUEST['filter']['Query']['limit']) )
$eventsSql .= ' LIMIT '.validInt($_REQUEST['filter']['Query']['limit']);
} # end if filter
@ -244,30 +244,28 @@ while ( $event_row = dbFetchNext($results) ) {
</div><!--row-->
<button type="button" id="exportButton" name="exportButton" value="Export" disabled="disabled"><?php echo translate('Export') ?></button>
</div><!--container-->
<?php
?>
<h2 id="exportProgress" class="<?php
if ( isset($_REQUEST['generated']) ) {
if ( $_REQUEST['generated'] )
echo 'infoText';
else
echo 'errorText';
} else {
echo 'hidden warnText';
}
?>">
<h2 id="exportProgress" class="<?php
if ( isset($_REQUEST['generated']) ) {
if ( $_REQUEST['generated'] )
echo 'infoText';
else
echo 'errorText';
} else {
echo 'hidden warnText';
}
?>">
<span id="exportProgressText">
<?php
<?php
if ( isset($_REQUEST['generated']) ) {
if ( $_REQUEST['generated'] )
echo translate('ExportSucceeded');
else
else
echo translate('ExportFailed');
}
?></span>
<span id="exportProgressTicker"></span>
</h2>
<button type="button" data-on-click-this="startDownload" <?php echo empty($_REQUEST['generated'])? ' class="hidden"' : '' ?>><?php echo translate('Download') ?></button>
<button type="button" data-on-click-this="startDownload"<?php echo empty($_REQUEST['generated'])? ' class="hidden"' : '' ?>><?php echo translate('Download') ?></button>
<input type="hidden" name="exportFile" value="<?php echo isset($_REQUEST['exportFile']) ? validHtmlStr($_REQUEST['exportFile']) : '' ?>"/>
<input type="hidden" name="generated" value="<?php echo isset($_REQUEST['generated']) ? validHtmlStr($_REQUEST['generated']) : '' ?>"/>
</form>

View File

@ -69,7 +69,7 @@ function group_line( $Group ) {
$html .= str_repeat('<td class="colName">&nbsp;</td>', $Group->depth());
$html .= '<td class="colName" colspan="'.($max_depth-($Group->depth()-1)).'">';
if ( canEdit('Groups') ) {
$html .= '<a href="#" onclick="editGroup('.$Group->Id().');">'. validHtmlStr($Group->Id() . ' ' . $Group->Name()).'</a>';
$html .= '<a href="#" data-on-click-this="editGroup" data-group-id="'.$Group->Id().'">'.validHtmlStr($Group->Id().' '.$Group->Name()).'</a>';
} else {
$html .= validHtmlStr($Group->Name());
}

View File

@ -1,20 +1,24 @@
var consoleRefreshTimeout = <?php echo 1000*ZM_WEB_REFRESH_MAIN ?>;
<?php
if ( ZM_CHECK_FOR_UPDATES && canEdit('System') && ZM_DYN_LAST_VERSION && ( verNum(ZM_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( verNum(ZM_DYN_CURR_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( ZM_DYN_NEXT_REMINDER < time() ) ) {
$showVersionPopup = true;
} elseif ( ZM_DYN_SHOW_DONATE_REMINDER ) {
if ( canEdit('System') ) {
if ( canEdit('System') ) {
if ( ZM_CHECK_FOR_UPDATES && ZM_DYN_LAST_VERSION && ( verNum(ZM_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( verNum(ZM_DYN_CURR_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( ZM_DYN_NEXT_REMINDER < time() ) ) {
$showVersionPopup = true;
$nextReminder = time() + 60*60;
// limit popups to one per hour instead of on every console refresh.
dbQuery("UPDATE Config SET Value = '".$nextReminder."' WHERE Name = 'ZM_DYN_NEXT_REMINDER'");
} else if ( ZM_DYN_SHOW_DONATE_REMINDER ) {
if ( ZM_DYN_DONATE_REMINDER_TIME > 0 ) {
if ( ZM_DYN_DONATE_REMINDER_TIME < time() ) {
$showDonatePopup = true;
}
} else {
$nextReminder = time() + 30*24*60*60;
dbQuery( "update Config set Value = '".$nextReminder."' where Name = 'ZM_DYN_DONATE_REMINDER_TIME'" );
dbQuery("UPDATE Config SET Value = '".$nextReminder."' WHERE Name = 'ZM_DYN_DONATE_REMINDER_TIME'");
}
}
}
} // end if canEdit('System')
?>
var showVersionPopup = <?php echo isset($showVersionPopup )?'true':'false' ?>;
var showDonatePopup = <?php echo isset($showDonatePopup )?'true':'false' ?>;

View File

@ -65,7 +65,7 @@ function exportResponse(respObj, respText) {
//window.location.replace( thisUrl+'?view='+currentView+'&'+eids.join('&')+'&exportFile='+respObj.exportFile+'&generated='+((respObj.result=='Ok')?1:0) );
}
function exportEvent( ) {
function exportEvents( ) {
var parms = 'view=event&request=event&action=export';
parms += '&'+$('contentForm').toQueryString();
var query = new Request.JSON( {
@ -87,7 +87,7 @@ function initPage() {
if ( exportReady ) {
startDownload.pass(exportFile).delay(1500);
}
document.getElementById('exportButton').addEventListener('click', exportEvent);
document.getElementById('exportButton').addEventListener('click', exportEvents);
}
window.addEventListener('DOMContentLoaded', initPage);

View File

@ -8,8 +8,13 @@ function setGroup( element ) {
form.submit();
}
function editGroup( gid ) {
createPopup( '?view=group&gid='+gid, 'zmGroup', 'group' );
function editGroup( element ) {
var gid = element.getAttribute('data-group-id');
if ( !gid ) {
console.log('No group id found in editGroup');
} else {
createPopup('?view=group&gid='+gid, 'zmGroup'+gid, 'group');
}
}
function deleteGroup( element ) {

View File

@ -33,6 +33,7 @@ if ( verNum(ZM_DYN_CURR_VERSION) != verNum(ZM_DYN_LAST_VERSION) and canEdit('Sys
'hour' => translate('VersionRemindHour'),
'day' => translate('VersionRemindDay'),
'week' => translate('VersionRemindWeek'),
'month' => translate('VersionRemindMonth'),
'never' => translate('VersionRemindNever')
) );
}
@ -64,16 +65,16 @@ if ( ZM_DYN_DB_VERSION && (ZM_DYN_DB_VERSION != ZM_VERSION) ) {
} else {
?>
<form name="contentForm" id="contentForm" method="get" action="?">
<input type="hidden" name="view" value="none"/>
<input type="hidden" name="view" value="version"/>
<input type="hidden" name="action" value="version"/>
<p><?php echo translate('UpdateAvailable') ?></p>
<p><?php echo sprintf( $CLANG['LatestRelease'], ZM_DYN_LAST_VERSION, ZM_VERSION ) ?></p>
<p><?php echo buildSelect( "option", $options ); ?></p>
<p><?php echo buildSelect('option', $options); ?></p>
<div id="contentButtons">
<?php
if ( canEdit('System') ) {
?>
<button type="submit" data-on-click-this="submitForm" value="Apply"><?php echo translate('Apply') ?></button>
<button type="submit"><?php echo translate('Apply') ?></button>
<?php
}
}

View File

@ -50,9 +50,13 @@ if ( $archivetype ) {
$filename_path = ZM_DIR_EXPORTS.'/'.$filename;
ZM\Logger::Debug("downloading archive from $filename_path");
if ( is_readable($filename_path) ) {
while (ob_get_level()) {
ZM\Logger::Debug('Clearing ob');
ob_end_clean();
}
header("Content-type: application/$mimetype" );
header("Content-Disposition: inline; filename=$filename");
header('Content-Length: ' . filesize($filename_path) );
header('Content-Length: '.filesize($filename_path));
set_time_limit(0);
if ( ! @readfile($filename_path) ) {
ZM\Error("Error sending $filename_path");
@ -61,11 +65,9 @@ if ( $archivetype ) {
ZM\Error("$filename_path does not exist or is not readable.");
}
} else {
ZM\Error("Unsupported archive type specified. Supported archives are tar and zip");
ZM\Error('Unsupported archive type specified. Supported archives are tar and zip');
}
} else {
ZM\Error("No archive type given to archive.php. Please specify a tar or zip archive.");
ZM\Error('No archive type given to archive.php. Please specify a tar or zip archive.');
}
?>