Add Snapshots and Snapshot_Events Tables. Add HomeView to Users.
This commit is contained in:
parent
620806a1bf
commit
6682ec7da5
|
@ -578,5 +578,20 @@ class Monitor extends ZM_Object {
|
||||||
global $user;
|
global $user;
|
||||||
return ( $user && ($user['Monitors'] == 'Edit') && ( !$this->{'Id'} || visibleMonitor($this->{'Id'}) ));
|
return ( $user && ($user['Monitors'] == 'Edit') && ( !$this->{'Id'} || visibleMonitor($this->{'Id'}) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function TriggerOn() {
|
||||||
|
$cmd = getZmuCommand(' -a -m '.$this->{'Id'});
|
||||||
|
$output = shell_exec($cmd);
|
||||||
|
Debug("Running $cmd output: $output");
|
||||||
|
if ( $output and preg_match('/Alarmed event id: (\d+)$/', $output, $matches) ) {
|
||||||
|
return $matches[1];
|
||||||
|
}
|
||||||
|
Warning("No event returned from TriggerOn");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
function TriggerOff() {
|
||||||
|
$cmd = getZmuCommand(' -c -m '.$this->{'Id'});
|
||||||
|
$output = shell_exec($cmd);
|
||||||
|
}
|
||||||
} // end class Monitor
|
} // end class Monitor
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -337,9 +337,12 @@ class ZM_Object {
|
||||||
$sql = 'INSERT INTO `'.$table.
|
$sql = 'INSERT INTO `'.$table.
|
||||||
'` ('.implode(', ', array_map(function($field) {return '`'.$field.'`';}, $fields)).
|
'` ('.implode(', ', array_map(function($field) {return '`'.$field.'`';}, $fields)).
|
||||||
') VALUES ('.
|
') VALUES ('.
|
||||||
implode(', ', array_map(function($field){return '?';}, $fields)).')';
|
implode(', ', array_map(function($field){return $this->$field() == 'NOW()' ? 'NOW()' : '?';}, $fields)).')';
|
||||||
|
|
||||||
$values = array_map(function($field){return $this->$field();}, $fields);
|
$values = array_values(array_map(
|
||||||
|
function($field){return $this->$field();},
|
||||||
|
array_filter($fields, function($field){ return $this->$field() != 'NOW()';})
|
||||||
|
));
|
||||||
if ( dbQuery($sql, $values) ) {
|
if ( dbQuery($sql, $values) ) {
|
||||||
$this->{'Id'} = dbInsertId();
|
$this->{'Id'} = dbInsertId();
|
||||||
return true;
|
return true;
|
||||||
|
@ -415,5 +418,8 @@ class ZM_Object {
|
||||||
Error("Unable to lock $class record for Id=".$this->Id());
|
Error("Unable to lock $class record for Id=".$this->Id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public function remove_from_cache() {
|
||||||
|
return ZM_Object::_remove_from_cache(get_class(), $this);
|
||||||
|
}
|
||||||
} # end class Object
|
} # end class Object
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -24,6 +24,7 @@ class User extends ZM_Object {
|
||||||
'MonitorIds' => '',
|
'MonitorIds' => '',
|
||||||
'TokenMinExpiry' => 0,
|
'TokenMinExpiry' => 0,
|
||||||
'APIEnabled' => 1,
|
'APIEnabled' => 1,
|
||||||
|
'HomeView' => '',
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function find( $parameters = array(), $options = array() ) {
|
public static function find( $parameters = array(), $options = array() ) {
|
||||||
|
|
|
@ -233,6 +233,7 @@ function getNormalNavBarHTML($running, $user, $bandwidth_options, $view, $skin)
|
||||||
echo getCycleHTML($view);
|
echo getCycleHTML($view);
|
||||||
echo getMontageHTML($view);
|
echo getMontageHTML($view);
|
||||||
echo getMontageReviewHTML($view);
|
echo getMontageReviewHTML($view);
|
||||||
|
echo getSnapshotsHTML($view);
|
||||||
echo getRprtEvntAuditHTML($view);
|
echo getRprtEvntAuditHTML($view);
|
||||||
echo getHeaderFlipHTML();
|
echo getHeaderFlipHTML();
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
@ -361,6 +362,7 @@ function getCollapsedNavBarHTML($running, $user, $bandwidth_options, $view, $ski
|
||||||
echo getCycleHTML($view);
|
echo getCycleHTML($view);
|
||||||
echo getMontageHTML($view);
|
echo getMontageHTML($view);
|
||||||
echo getMontageReviewHTML($view);
|
echo getMontageReviewHTML($view);
|
||||||
|
echo getSnapshotsHTML($view);
|
||||||
echo getRprtEvntAuditHTML($view);
|
echo getRprtEvntAuditHTML($view);
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
|
@ -672,7 +674,7 @@ function getMontageHTML($view) {
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
if ( canView('Stream') ) {
|
if ( canView('Stream') ) {
|
||||||
$class = $view == 'cycle' ? ' selected' : '';
|
$class = $view == 'montage' ? ' selected' : '';
|
||||||
$result .= '<li id="getMontageHTML" class="nav-item dropdown"><a class="nav-link'.$class.'" href="?view=montage">' .translate('Montage'). '</a></li>'.PHP_EOL;
|
$result .= '<li id="getMontageHTML" class="nav-item dropdown"><a class="nav-link'.$class.'" href="?view=montage">' .translate('Montage'). '</a></li>'.PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,6 +708,18 @@ function getMontageReviewHTML($view) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the html representing the Montage menu item
|
||||||
|
function getSnapshotsHTML($view) {
|
||||||
|
$result = '';
|
||||||
|
|
||||||
|
if ( canView('Events') ) {
|
||||||
|
$class = $view == 'snapshots' ? ' selected' : '';
|
||||||
|
$result .= '<li id="getSnapshotsHTML" class="nav-item dropdown"><a class="nav-link'.$class.'" href="?view=snapshots">' .translate('Snapshots'). '</a></li>'.PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the html representing the Audit Events Report menu item
|
// Returns the html representing the Audit Events Report menu item
|
||||||
function getRprtEvntAuditHTML($view) {
|
function getRprtEvntAuditHTML($view) {
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
// Static JavaScript should go in skin.js
|
// Static JavaScript should go in skin.js
|
||||||
//
|
//
|
||||||
|
|
||||||
|
global $user;
|
||||||
?>
|
?>
|
||||||
var AJAX_TIMEOUT = <?php echo ZM_WEB_AJAX_TIMEOUT ?>;
|
var AJAX_TIMEOUT = <?php echo ZM_WEB_AJAX_TIMEOUT ?>;
|
||||||
var navBarRefresh = <?php echo 1000*ZM_WEB_REFRESH_NAVBAR ?>;
|
var navBarRefresh = <?php echo 1000*ZM_WEB_REFRESH_NAVBAR ?>;
|
||||||
|
@ -82,4 +83,10 @@ var imagePrefix = "<?php echo '?view=image&eid=' ?>";
|
||||||
|
|
||||||
var auth_hash = '<?php echo generateAuthHash(ZM_AUTH_HASH_IPS) ?>';
|
var auth_hash = '<?php echo generateAuthHash(ZM_AUTH_HASH_IPS) ?>';
|
||||||
var auth_relay = '<?php echo get_auth_relay() ?>';
|
var auth_relay = '<?php echo get_auth_relay() ?>';
|
||||||
|
var user = {
|
||||||
|
<?php if ( $user ) { ?>
|
||||||
|
"Id" : "<?php echo $user['Id'] ?>",
|
||||||
|
"Username" : "<?php echo $user['Username'] ?>"
|
||||||
|
<?php } ?>
|
||||||
|
};
|
||||||
var running = <?php echo daemonCheck()?'true':'false' ?>;
|
var running = <?php echo daemonCheck()?'true':'false' ?>;
|
||||||
|
|
|
@ -270,6 +270,11 @@ function reloadWebSite(ndx) {
|
||||||
document.getElementById('imageFeed'+ndx).innerHTML = document.getElementById('imageFeed'+ndx).innerHTML;
|
document.getElementById('imageFeed'+ndx).innerHTML = document.getElementById('imageFeed'+ndx).innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function takeSnapshot() {
|
||||||
|
monitor_ids = monitorData.map( monitor=> { return 'monitor_ids[]='+monitor.id; });
|
||||||
|
window.location = '?view=snapshot&action=create&'+monitor_ids.join('&');
|
||||||
|
}
|
||||||
|
|
||||||
var monitors = new Array();
|
var monitors = new Array();
|
||||||
function initPage() {
|
function initPage() {
|
||||||
$j("#hdrbutton").click(function() {
|
$j("#hdrbutton").click(function() {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
// redirect the user to his original intended destination by appending it to the URL.
|
// redirect the user to his original intended destination by appending it to the URL.
|
||||||
//
|
//
|
||||||
|
|
||||||
$redirectSuffix = '?view=console';
|
$redirectSuffix = $user['HomeView'] != '' ? $user['HomeView'] : '?view=console';
|
||||||
if ( !empty($_SESSION['postLoginQuery']) ) {
|
if ( !empty($_SESSION['postLoginQuery']) ) {
|
||||||
parse_str($_SESSION['postLoginQuery'], $queryParams);
|
parse_str($_SESSION['postLoginQuery'], $queryParams);
|
||||||
$redirectSuffix = '?' . http_build_query($queryParams);
|
$redirectSuffix = '?' . http_build_query($queryParams);
|
||||||
|
|
|
@ -197,6 +197,11 @@ if ( $showZones ) {
|
||||||
<button type="button" value="Save" data-on-click-this="save_layout"><?php echo translate('Save') ?></button>
|
<button type="button" value="Save" data-on-click-this="save_layout"><?php echo translate('Save') ?></button>
|
||||||
<button type="button" value="Cancel" data-on-click-this="cancel_layout"><?php echo translate('Cancel') ?></button>
|
<button type="button" value="Cancel" data-on-click-this="cancel_layout"><?php echo translate('Cancel') ?></button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<button type="button" name="snapshotBtn" data-on-click-this="takeSnapshot">
|
||||||
|
<i class="material-icons md-18">camera_enhance</i>
|
||||||
|
<?php echo translate('Snapshot') ?>
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -155,6 +155,11 @@ if ( canEdit('System') and ( $newUser->Username() != 'admin' ) ) {
|
||||||
} // end if ZM_OPT_USE_API
|
} // end if ZM_OPT_USE_API
|
||||||
} // end if canEdit(System)
|
} // end if canEdit(System)
|
||||||
?>
|
?>
|
||||||
|
<tr>
|
||||||
|
<th class="text-right" scope="row"><?php echo translate('Home View') ?></th>
|
||||||
|
<td><input type="text" name="newUser[HomeView]" value="<?php echo validHtmlStr($newUser->HomeView()); ?>"/></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div id="contentButtons">
|
<div id="contentButtons">
|
||||||
|
|
Loading…
Reference in New Issue