Merge pull request #2297 from connortechnology/introduce_getBodyTopHTML

Introduce get body top html
This commit is contained in:
Andrew Bauer 2018-12-11 09:35:54 -06:00 committed by GitHub
commit 4d7e98475f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 8 deletions

View File

@ -554,7 +554,8 @@ if ( canEdit('Monitors') ) {
$maxSeq = dbFetchOne('SELECT MAX(Sequence) AS MaxSequence FROM Monitors', 'MaxSequence');
$changes[] = 'Sequence = '.($maxSeq+1);
if ( dbQuery('INSERT INTO Monitors SET '.implode(', ', $changes)) ) {
$sql = 'INSERT INTO Monitors SET '.implode(', ', $changes);
if ( dbQuery($sql) ) {
$mid = dbInsertId();
$zoneArea = $_REQUEST['newMonitor']['Width'] * $_REQUEST['newMonitor']['Height'];
dbQuery("INSERT INTO Zones SET MonitorId = ?, Name = 'All', Type = 'Active', Units = 'Percent', NumCoords = 4, Coords = ?, Area=?, AlarmRGB = 0xff0000, CheckMethod = 'Blobs', MinPixelThreshold = 25, MinAlarmPixels=?, MaxAlarmPixels=?, FilterX = 3, FilterY = 3, MinFilterPixels=?, MaxFilterPixels=?, MinBlobPixels=?, MinBlobs = 1", array( $mid, sprintf( "%d,%d %d,%d %d,%d %d,%d", 0, 0, $_REQUEST['newMonitor']['Width']-1, 0, $_REQUEST['newMonitor']['Width']-1, $_REQUEST['newMonitor']['Height']-1, 0, $_REQUEST['newMonitor']['Height']-1 ), $zoneArea, intval(($zoneArea*3)/100), intval(($zoneArea*75)/100), intval(($zoneArea*3)/100), intval(($zoneArea*75)/100), intval(($zoneArea*2)/100) ) );
@ -566,6 +567,7 @@ if ( canEdit('Monitors') ) {
} else {
Error('Error saving new Monitor.');
$error_message = dbError($sql);
return;
}
} else {

View File

@ -170,6 +170,7 @@ if ( !is_writable(ZM_DIR_EVENTS) || !is_writable(ZM_DIR_IMAGES) ) {
}
# Globals
$error_message = null;
$redirect = null;
$view = null;
if ( isset($_REQUEST['view']) )

View File

@ -201,6 +201,23 @@ echo output_link_if_exists( array(
<?php
} // end function xhtmlHeaders( $file, $title )
// Outputs an opening body tag, and any additional content that should go at the very top, like warnings and error messages.
function getBodyTopHTML() {
echo '
<body>
<noscript>
<div style="background-color:red;color:white;font-size:x-large;">
'. ZM_WEB_TITLE .' requires Javascript. Please enable Javascript in your browser for this site.
</div>
</noscript>
';
global $error_message;
if ( $error_message ) {
echo '<div class="error">'.$error_message.'</div>';
}
} // end function getBodyTopHTML
function getNavBarHTML($reload = null) {
# Provide a facility to turn off the headers if you put headers=0 into the url
if ( isset($_REQUEST['navbar']) and $_REQUEST['navbar']=='0' )
@ -228,11 +245,6 @@ function getNavBarHTML($reload = null) {
$running = daemonCheck();
$status = $running?translate('Running'):translate('Stopped');
?>
<noscript>
<div style="background-color:red;color:white;font-size:x-large;">
<?php echo ZM_WEB_TITLE ?> requires Javascript. Please enable Javascript in your browser for this site.
</div>
</noscript>
<div class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">

View File

@ -158,8 +158,8 @@ if ( $show_storage_areas ) $left_columns += 1;
xhtmlHeaders( __FILE__, translate('Console') );
getBodyTopHTML();
?>
<body>
<form name="monitorForm" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="action" value=""/>

View File

@ -454,8 +454,8 @@ $savejpegopts = array(
xhtmlHeaders(__FILE__, translate('Monitor')." - ".validHtmlStr($monitor->Name()) );
getBodyTopHTML();
?>
<body>
<div id="page">
<div id="header">
<?php