Merge pull request #2839 from connortechnology/add_alarmed_zone_to_filters
Add alarmed zone to filterspull/2874/head
commit
ade95283d9
|
@ -1,6 +1,6 @@
|
|||
# ==========================================================================
|
||||
#
|
||||
# ZoneMinder Filter Module, $Date$, $Revision$
|
||||
# ZoneMinder Filter Module
|
||||
# Copyright (C) 2001-2008 Philip Coombes
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
|
@ -162,7 +162,9 @@ sub Sql {
|
|||
my $value = $term->{val};
|
||||
my @value_list;
|
||||
if ( $term->{attr} ) {
|
||||
if ( $term->{attr} =~ /^Monitor/ ) {
|
||||
if ( $term->{attr} eq 'AlarmedZoneId' ) {
|
||||
$term->{op} = 'EXISTS';
|
||||
} elsif ( $term->{attr} =~ /^Monitor/ ) {
|
||||
my ( $temp_attr_name ) = $term->{attr} =~ /^Monitor(.+)$/;
|
||||
$self->{Sql} .= 'M.'.$temp_attr_name;
|
||||
} elsif ( $term->{attr} eq 'ServerId' or $term->{attr} eq 'MonitorServerId' ) {
|
||||
|
@ -214,7 +216,10 @@ sub Sql {
|
|||
|
||||
( my $stripped_value = $value ) =~ s/^["\']+?(.+)["\']+?$/$1/;
|
||||
foreach my $temp_value ( split( /["'\s]*?,["'\s]*?/, $stripped_value ) ) {
|
||||
if ( $term->{attr} =~ /^MonitorName/ ) {
|
||||
|
||||
if ( $term->{attr} eq 'AlarmedZoneId' ) {
|
||||
$value = '(SELECT * FROM Stats WHERE EventId=E.Id AND ZoneId='.$value.')';
|
||||
} elsif ( $term->{attr} =~ /^MonitorName/ ) {
|
||||
$value = "'$temp_value'";
|
||||
} elsif ( $term->{attr} =~ /ServerId/) {
|
||||
Debug("ServerId, temp_value is ($temp_value) ($ZoneMinder::Config::Config{ZM_SERVER_ID})");
|
||||
|
@ -256,6 +261,8 @@ sub Sql {
|
|||
} elsif ( $term->{attr} eq 'Date' or $term->{attr} eq 'StartDate' or $term->{attr} eq 'EndDate' ) {
|
||||
if ( $temp_value eq 'NULL' ) {
|
||||
$value = $temp_value;
|
||||
} elsif ( $temp_value eq 'CURDATE()' or $temp_value eq 'NOW()' ) {
|
||||
$value = 'to_days('.$temp_value.')';
|
||||
} else {
|
||||
$value = DateTimeToSQL($temp_value);
|
||||
if ( !$value ) {
|
||||
|
@ -294,6 +301,8 @@ sub Sql {
|
|||
} else {
|
||||
$self->{Sql} .= " IS $value";
|
||||
}
|
||||
} elsif ( $term->{op} eq 'EXISTS' ) {
|
||||
$self->{Sql} .= " EXISTS $value";
|
||||
} elsif ( $term->{op} eq 'IS NOT' ) {
|
||||
$self->{Sql} .= " IS NOT $value";
|
||||
} elsif ( $term->{op} eq '=[]' ) {
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
namespace ZM;
|
||||
require_once('database.php');
|
||||
require_once('Object.php');
|
||||
|
||||
|
||||
class Zone extends ZM_Object {
|
||||
protected static $table = 'Zones';
|
||||
|
||||
protected $defaults = array(
|
||||
'Id' => null,
|
||||
'Name' => '',
|
||||
'Type' => 'Active',
|
||||
'Units' => 'Pixels',
|
||||
'CheckMethod' => 'Blobs',
|
||||
'MinPixelThreshold' => null,
|
||||
'MaxPixelThreshold' => null,
|
||||
'MinAlarmPixels' => null,
|
||||
'MaxAlarmPixels' => null,
|
||||
'FilterX' => null,
|
||||
'FilterY' => null,
|
||||
'MinFilterPixels' => null,
|
||||
'MaxFilterPixels' => null,
|
||||
'MinBlobPixels' => null,
|
||||
'MaxBlobPixels' => null,
|
||||
'MinBlobs' => null,
|
||||
'MaxBlobs' => null,
|
||||
'OverloadFrames' => 0,
|
||||
'ExtendAlarmFrames' => 0,
|
||||
);
|
||||
|
||||
public static function find( $parameters = array(), $options = array() ) {
|
||||
return ZM_Object::_find(get_class(), $parameters, $options);
|
||||
}
|
||||
|
||||
public static function find_one( $parameters = array(), $options = array() ) {
|
||||
return ZM_Object::_find_one(get_class(), $parameters, $options);
|
||||
}
|
||||
|
||||
} # end class Zone
|
||||
?>
|
|
@ -1094,6 +1094,7 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&') {
|
|||
for ( $i = 0; $i < count($terms); $i++ ) {
|
||||
|
||||
$term = $terms[$i];
|
||||
ZM\Logger::Debug("Term: " . print_r($term,true));
|
||||
|
||||
if ( isset($term['cnj']) && array_key_exists($term['cnj'], $validQueryConjunctionTypes) ) {
|
||||
$filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][cnj]").'='.urlencode($term['cnj']);
|
||||
|
@ -1109,6 +1110,9 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&') {
|
|||
$filter['query'] .= $querySep.urlencode("filter[Query][terms][$i][attr]").'='.urlencode($term['attr']);
|
||||
$filter['fields'] .= "<input type=\"hidden\" name=\"filter[Query][terms][$i][attr]\" value=\"".htmlspecialchars($term['attr'])."\"/>\n";
|
||||
switch ( $term['attr'] ) {
|
||||
case 'AlarmedZoneId':
|
||||
$term['op'] = 'EXISTS';
|
||||
break;
|
||||
case 'MonitorName':
|
||||
$filter['sql'] .= 'M.Name';
|
||||
break;
|
||||
|
@ -1226,11 +1230,15 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&') {
|
|||
$valueList = array();
|
||||
foreach ( preg_split('/["\'\s]*?,["\'\s]*?/', preg_replace('/^["\']+?(.+)["\']+?$/', '$1', $term['val'])) as $value ) {
|
||||
switch ( $term['attr'] ) {
|
||||
|
||||
case 'AlarmedZoneId':
|
||||
$value = '(SELECT * FROM Stats WHERE EventId=E.Id AND ZoneId='.$value.')';
|
||||
break;
|
||||
case 'MonitorName':
|
||||
case 'Name':
|
||||
case 'Cause':
|
||||
case 'Notes':
|
||||
if($term['op'] == 'LIKE' || $term['op'] == 'NOT LIKE') {
|
||||
if ( $term['op'] == 'LIKE' || $term['op'] == 'NOT LIKE' ) {
|
||||
$value = '%'.$value.'%';
|
||||
}
|
||||
$value = dbEscape($value);
|
||||
|
@ -1261,8 +1269,11 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&') {
|
|||
case 'Date':
|
||||
case 'StartDate':
|
||||
case 'EndDate':
|
||||
if ( $value != 'NULL' )
|
||||
$value = 'to_days(\''.strftime(STRF_FMT_DATETIME_DB, strtotime($value)).'\')';
|
||||
if ( $value == 'CURDATE()' or $value == 'NOW()' ) {
|
||||
$value = 'to_days('.$value.')';
|
||||
} else if ( $value != 'NULL' ) {
|
||||
$value = 'to_days(\''.strftime(STRF_FMT_DATETIME_DB, strtotime($value)).'\')';
|
||||
}
|
||||
break;
|
||||
case 'Time':
|
||||
case 'StartTime':
|
||||
|
@ -1297,10 +1308,13 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&') {
|
|||
break;
|
||||
case '=[]' :
|
||||
case 'IN' :
|
||||
$filter['sql'] .= ' in ('.join(',', $valueList).')';
|
||||
$filter['sql'] .= ' IN ('.join(',', $valueList).')';
|
||||
break;
|
||||
case '![]' :
|
||||
$filter['sql'] .= ' not in ('.join(',', $valueList).')';
|
||||
break;
|
||||
case 'EXISTS' :
|
||||
$filter['sql'] .= ' EXISTS ' .$value;
|
||||
break;
|
||||
case 'IS' :
|
||||
if ( $value == 'Odd' ) {
|
||||
|
|
|
@ -34,7 +34,7 @@ if ( version_compare(phpversion(), '4.1.0', '<') ) {
|
|||
}
|
||||
|
||||
// Useful debugging lines for mobile devices
|
||||
if ( false ) {
|
||||
if ( true ) {
|
||||
ob_start();
|
||||
phpinfo(INFO_VARIABLES);
|
||||
$fp = fopen('/tmp/env.html', 'w+');
|
||||
|
@ -71,7 +71,7 @@ define('ZM_BASE_URL', '');
|
|||
|
||||
require_once('includes/functions.php');
|
||||
if ( $_SERVER['REQUEST_METHOD'] == 'OPTIONS' ) {
|
||||
ZM\Logger::Debug("OPTIONS Method, only doing CORS");
|
||||
ZM\Logger::Debug('OPTIONS Method, only doing CORS');
|
||||
# Add Cross domain access headers
|
||||
CORSHeaders();
|
||||
return;
|
||||
|
|
|
@ -116,6 +116,7 @@ $SLANG = array(
|
|||
'Area' => 'Area',
|
||||
'AreaUnits' => 'Area (px/%)',
|
||||
'AttrAlarmFrames' => 'Alarm Frames',
|
||||
'AttrAlarmedZone' => 'Alarmed Zone',
|
||||
'AttrArchiveStatus' => 'Archive Status',
|
||||
'AttrAvgScore' => 'Avg. Score',
|
||||
'AttrCause' => 'Cause',
|
||||
|
|
|
@ -191,21 +191,25 @@ while ( $event_row = dbFetchNext($results) ) {
|
|||
?>
|
||||
<tr<?php if ($event->Archived()) echo ' class="archived"' ?>>
|
||||
<td class="colId"><a href="?view=event&eid=<?php echo $event->Id().$filterQuery.$sortQuery.'&page=1">'.$event->Id().($event->Archived()?'*':'') ?></a></td>
|
||||
<td class="colName"><a href="?view=event&eid=<?php echo $event->Id().$filterQuery.$sortQuery.'&page=1">'.validHtmlStr($event->Name()).($event->Archived()?'*':'') ?></a></td>
|
||||
<td class="colName"><a href="?view=event&eid=<?php echo $event->Id().$filterQuery.$sortQuery.'&page=1">'.validHtmlStr($event->Name()).($event->Archived()?'*':'') ?></a><br/>
|
||||
<?php
|
||||
if ( $event->Emailed() )
|
||||
echo 'Emailed ';
|
||||
?>
|
||||
</td>
|
||||
<td class="colMonitorName"><?php echo makePopupLink( '?view=monitor&mid='.$event->MonitorId(), 'zmMonitor'.$event->MonitorId(), 'monitor', $event->MonitorName(), canEdit( 'Monitors' ) ) ?></td>
|
||||
<td class="colCause"><?php echo makePopupLink( '?view=eventdetail&eid='.$event->Id(), 'zmEventDetail', 'eventdetail', validHtmlStr($event->Cause()), canEdit( 'Events' ), 'title="'.htmlspecialchars($event->Notes()).'"' ) ?>
|
||||
<?php
|
||||
# display notes as small text
|
||||
if ($event->Notes()) {
|
||||
if ( $event->Notes() ) {
|
||||
# if notes include detection objects, then link it to objdetect.jpg
|
||||
if (strpos($event->Notes(),'detected:')!== false){
|
||||
if ( strpos($event->Notes(), 'detected:') !== false ) {
|
||||
# make a link
|
||||
echo makePopupLink( '?view=image&eid='.$event->Id().'&fid=objdetect', 'zmImage',
|
||||
array('image', reScale($event->Width(), $scale), reScale($event->Height(), $scale)),
|
||||
"<div class=\"small text-nowrap text-muted\"><u>".$event->Notes()."</u></div>");
|
||||
}
|
||||
elseif ($event->Notes() != 'Forced Web: ') {
|
||||
echo "<br/><div class=\"small text-nowrap text-muted\">".$event->Notes()."</div>";
|
||||
'<div class="small text-nowrap text-muted"><u>'.$event->Notes().'</u></div>');
|
||||
} else if ( $event->Notes() != 'Forced Web: ' ) {
|
||||
echo '<br/><div class="small text-nowrap text-muted">'.$event->Notes().'</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
//
|
||||
// ZoneMinder web filter view file, $Date$, $Revision$
|
||||
// ZoneMinder web filter view file
|
||||
// Copyright (C) 2001-2008 Philip Coombes
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
|
@ -25,6 +25,8 @@ if ( !canView('Events') ) {
|
|||
require_once('includes/Object.php');
|
||||
require_once('includes/Storage.php');
|
||||
require_once('includes/Filter.php');
|
||||
require_once('includes/Monitor.php');
|
||||
require_once('includes/Zone.php');
|
||||
parseSort();
|
||||
|
||||
$filterNames = array(''=>translate('ChooseFilter'));
|
||||
|
@ -69,6 +71,7 @@ if ( count($terms) ) {
|
|||
|
||||
$attrTypes = array(
|
||||
'AlarmFrames' => translate('AttrAlarmFrames'),
|
||||
'AlarmedZoneId' => translate('AttrAlarmedZone'),
|
||||
'Archived' => translate('AttrArchiveStatus'),
|
||||
'AvgScore' => translate('AttrAvgScore'),
|
||||
'Cause' => translate('AttrCause'),
|
||||
|
@ -78,17 +81,17 @@ $attrTypes = array(
|
|||
'EndDateTime' => translate('AttrEndDateTime'),
|
||||
'EndDate' => translate('AttrEndDate'),
|
||||
'EndTime' => translate('AttrEndTime'),
|
||||
'EndWeekday' => translate('AttrEndWeekday'),
|
||||
'FilterServerId' => translate('AttrFilterServer'),
|
||||
'Frames' => translate('AttrFrames'),
|
||||
'EndWeekday' => translate('AttrEndWeekday'),
|
||||
'Id' => translate('AttrId'),
|
||||
'Length' => translate('AttrDuration'),
|
||||
'Name' => translate('AttrName'),
|
||||
'Notes' => translate('AttrNotes'),
|
||||
'MaxScore' => translate('AttrMaxScore'),
|
||||
'MonitorId' => translate('AttrMonitorId'),
|
||||
'MonitorName' => translate('AttrMonitorName'),
|
||||
'MonitorServerId' => translate('AttrMonitorServer'),
|
||||
'Name' => translate('AttrName'),
|
||||
'Notes' => translate('AttrNotes'),
|
||||
'SecondaryStorageId' => translate('AttrSecondaryStorageArea'),
|
||||
'ServerId' => translate('AttrMonitorServer'),
|
||||
'StartDateTime' => translate('AttrStartDateTime'),
|
||||
|
@ -143,13 +146,22 @@ foreach ( dbFetchAll('SELECT `Id`, `Name` FROM `Servers` ORDER BY lower(`Name`)
|
|||
$servers[$server['Id']] = validHtmlStr($server['Name']);
|
||||
}
|
||||
$monitors = array();
|
||||
$monitor_names = array();
|
||||
foreach ( dbFetchAll('SELECT `Id`, `Name` FROM `Monitors` ORDER BY lower(`Name`) ASC') as $monitor ) {
|
||||
if ( visibleMonitor($monitor['Id']) ) {
|
||||
$monitors[$monitor['Name']] = validHtmlStr($monitor['Name']);
|
||||
$monitors[$monitor['Id']] = new ZM\Monitor($monitor);
|
||||
$monitor_names[] = validHtmlStr($monitor['Name']);
|
||||
}
|
||||
}
|
||||
$zones = array();
|
||||
foreach ( dbFetchAll('SELECT Id, Name, MonitorId FROM Zones ORDER BY lower(`Name`) ASC') as $zone ) {
|
||||
if ( visibleMonitor($zone['MonitorId']) ) {
|
||||
$zone['Name'] = validHtmlStr($monitors[$zone['MonitorId']]->Name().': '.$zone['Name']);
|
||||
$zones[$zone['Id']] = new ZM\Zone($zone);
|
||||
}
|
||||
}
|
||||
|
||||
xhtmlHeaders(__FILE__, translate('EventFilter') );
|
||||
xhtmlHeaders(__FILE__, translate('EventFilter'));
|
||||
?>
|
||||
<body>
|
||||
<div id="page">
|
||||
|
@ -259,10 +271,15 @@ for ( $i=0; $i < count($terms); $i++ ) {
|
|||
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", $weekdays, $term['val']); ?></td>
|
||||
<?php
|
||||
} elseif ( $term['attr'] == 'MonitorName' ) {
|
||||
} elseif ( $term['attr'] == 'Monitor' ) {
|
||||
?>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", $monitors, $term['val']); ?></td>
|
||||
<?php
|
||||
} elseif ( $term['attr'] == 'MonitorName' ) {
|
||||
?>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", array_combine($monitor_names,$monitor_names), $term['val']); ?></td>
|
||||
<?php
|
||||
} elseif ( $term['attr'] == 'ServerId' || $term['attr'] == 'MonitorServerId' || $term['attr'] == 'StorageServerId' || $term['attr'] == 'FilterServerId' ) {
|
||||
?>
|
||||
|
@ -273,6 +290,11 @@ for ( $i=0; $i < count($terms); $i++ ) {
|
|||
?>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", $storageareas, $term['val']); ?></td>
|
||||
<?php
|
||||
} elseif ( $term['attr'] == 'AlarmedZoneId' ) {
|
||||
?>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", $zones, $term['val']); ?></td>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
@ -423,7 +445,7 @@ if ( ZM_OPT_MESSAGE ) {
|
|||
<hr/>
|
||||
<div id="contentButtons">
|
||||
<button type="submit" data-on-click-this="submitToEvents"><?php echo translate('ListMatches') ?></button>
|
||||
<!--<button type="submit" data-on-click-this="submitToMontageReview"><?php echo translate('ViewMatches') ?></button>-->
|
||||
<button type="button" data-on-click-this="submitToMontageReview"><?php echo translate('ViewMatches') ?></button>
|
||||
<button type="button" data-on-click-this="submitToExport"><?php echo translate('ExportMatches') ?></button>
|
||||
<button type="button" name="executeButton" id="executeButton" data-on-click-this="executeFilter"><?php echo translate('Execute') ?></button>
|
||||
<?php
|
||||
|
|
|
@ -114,10 +114,12 @@ function submitToEvents( element ) {
|
|||
history.replaceState(null, null, '?view=filter&' + $j(form).serialize());
|
||||
}
|
||||
|
||||
function submitToMontageReview( element ) {
|
||||
function submitToMontageReview(element) {
|
||||
var form = element.form;
|
||||
form.action = thisUrl + '?view=montagereview';
|
||||
history.replaceState(null, null, '?view=filter&' + $j(form).serialize());
|
||||
console.log($j(form).serialize());
|
||||
window.location.assign('?view=montagereview&'+$j(form).serialize());
|
||||
history.replaceState(null, null, '?view=montagereview&live=0&' + $j(form).serialize());
|
||||
}
|
||||
|
||||
function submitToExport(element) {
|
||||
|
@ -192,7 +194,8 @@ function parseRows(rows) {
|
|||
}
|
||||
|
||||
var attr = inputTds.eq(2).children().val();
|
||||
if ( attr == 'Archived' ) { // Archived types
|
||||
|
||||
if ( attr == 'Archived' ) { //Archived types
|
||||
inputTds.eq(3).html('equal to<input type="hidden" name="filter[Query][terms][' + rowNum + '][op]" value="=">');
|
||||
var archiveSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for (var i = 0; i < archiveTypes.length; i++) {
|
||||
|
@ -200,6 +203,18 @@ function parseRows(rows) {
|
|||
}
|
||||
var archiveVal = inputTds.eq(4).children().val();
|
||||
inputTds.eq(4).html(archiveSelect).children().val(archiveVal).chosen({width: "101%"});
|
||||
} else if ( attr == 'AlarmedZoneId' ) {
|
||||
var zoneSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for ( monitor_id in monitors ) {
|
||||
for ( zone_id in zones ) {
|
||||
var zone = zones[zone_id];
|
||||
if ( monitor_id == zone.MonitorId ) {
|
||||
zoneSelect.append('<option value="' + zone_id + '">' + zone.Name + '</option>');
|
||||
}
|
||||
} // end foreach zone
|
||||
} // end foreach monitor
|
||||
var zoneVal = inputTds.eq(4).children().val();
|
||||
inputTds.eq(4).html(zoneSelect).children().val(zoneVal).chosen({width: "101%"});
|
||||
} else if ( attr.indexOf('Weekday') >= 0 ) { //Weekday selection
|
||||
var weekdaySelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for (var i = 0; i < weekdays.length; i++) {
|
||||
|
@ -230,22 +245,29 @@ function parseRows(rows) {
|
|||
inputTds.eq(4).html(storageSelect).children().val(storageVal).chosen({width: "101%"});
|
||||
} else if ( attr == 'MonitorName' ) { //Monitor names
|
||||
var monitorSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for (var key in monitors) {
|
||||
monitorSelect.append('<option value="' + key + '">' + monitors[key] + '</option>');
|
||||
for ( var monitor_id in monitors ) {
|
||||
monitorSelect.append('<option value="' + monitors[monitor_id].Name + '">' + monitors[monitor_id].Name + '</option>');
|
||||
}
|
||||
var monitorVal = inputTds.eq(4).children().val();
|
||||
inputTds.eq(4).html(monitorSelect).children().val(monitorVal);
|
||||
} else { //Reset to regular text field and operator for everything that isn't special
|
||||
var opSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][op]').attr('id', queryPrefix + rowNum + '][op]');
|
||||
for (var key in opTypes) {
|
||||
opSelect.append('<option value="' + key + '">' + opTypes[key] + '</option>');
|
||||
}
|
||||
var opVal = inputTds.eq(3).children().val();
|
||||
inputTds.eq(3).html(opSelect).children().val(opVal).chosen({width: "101%"});
|
||||
} else { // Reset to regular text field and operator for everything that isn't special
|
||||
var textInput = $j('<input></input>').attr('type', 'text').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
var textVal = inputTds.eq(4).children().val();
|
||||
inputTds.eq(4).html(textInput).children().val(textVal);
|
||||
}
|
||||
|
||||
// Validate the operator
|
||||
var opSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][op]').attr('id', queryPrefix + rowNum + '][op]');
|
||||
var opVal = inputTds.eq(3).children().val();
|
||||
if ( ! opVal ) {
|
||||
// Default to equals so that something gets selected
|
||||
console.log("No value for operator. Defaulting to =");
|
||||
opVal = '=';
|
||||
}
|
||||
for ( var key in opTypes ) {
|
||||
opSelect.append('<option value="' + key + '"'+(key == opVal ? ' selected="selected"' : '')+'>' + opTypes[key] + '</option>');
|
||||
}
|
||||
inputTds.eq(3).html(opSelect).children().val(opVal).chosen({width: "101%"});
|
||||
if ( attr.endsWith('DateTime') ) { //Start/End DateTime
|
||||
inputTds.eq(4).children().datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false});
|
||||
} else if ( attr.endsWith('Date') ) { //Start/End Date
|
||||
|
@ -279,7 +301,7 @@ function addTerm( element ) {
|
|||
var newRow = row.clone().insertAfter(row);
|
||||
row.find('select').chosen({width: '101%'});
|
||||
newRow.find('select').each( function() { //reset new row to default
|
||||
this[0].selected = 'selected';
|
||||
this[0].selected = 'selected';
|
||||
}).chosen({width: '101%'});
|
||||
newRow.find('input[type="text"]').val('');
|
||||
newRow[0].querySelectorAll("button[data-on-click-this]").forEach(function(el) {
|
||||
|
|
|
@ -10,6 +10,7 @@ var states = <?php echo isset($states) ? json_encode($states) : '' ?>;
|
|||
var servers = <?php echo isset($servers) ? json_encode($servers) : '' ?>;
|
||||
var storageareas = <?php echo isset($storageareas) ? json_encode($storageareas) : '' ?>;
|
||||
var monitors = <?php echo isset($monitors) ? json_encode($monitors) : '' ?>;
|
||||
var zones = <?php echo isset($zones) ? json_encode($zones) : '' ?>;
|
||||
|
||||
var errorBrackets = '<?php echo translate('ErrorBrackets') ?>';
|
||||
var errorValue = '<?php echo translate('ErrorValidValue') ?>';
|
||||
|
|
|
@ -464,6 +464,7 @@ function initPage() {
|
|||
|
||||
// Start the fps and status updates. give a random delay so that we don't assault the server
|
||||
var delay = Math.round( (Math.random()+0.5)*statusRefreshTimeout );
|
||||
console.log("delay: " + delay);
|
||||
monitors[i].start(delay);
|
||||
|
||||
var interval = monitors[i].refresh;
|
||||
|
|
|
@ -62,6 +62,17 @@ ob_end_clean();
|
|||
$filter = array();
|
||||
if ( isset($_REQUEST['filter']) ) {
|
||||
$filter = $_REQUEST['filter'];
|
||||
|
||||
# Try to guess min/max time from filter
|
||||
foreach ( $filter['Query'] as $term ) {
|
||||
if ( $term['attr'] == 'StartDateTime' ) {
|
||||
if ( $term['op'] == '<=' or $term['op'] == '<' ) {
|
||||
$maxTime = $term['val'];
|
||||
} else if ( $term['op'] == '>=' or $term['op'] == '>' ) {
|
||||
$minTime = $term['val'];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
if ( isset($_REQUEST['minTime']) && isset($_REQUEST['maxTime']) && (count($displayMonitors) != 0) ) {
|
||||
|
|
Loading…
Reference in New Issue