pull/2077/head
Isaac Connor 2017-10-27 13:37:51 -07:00
parent 71222d7f2f
commit eb48759ff8
4 changed files with 126 additions and 9 deletions

View File

@ -553,7 +553,7 @@ void MonitorStream::runStream() {
Debug( 2, "Assigned temporary buffer" );
}
}
}
} // end if connkey & playback_buffer
float max_secs_since_last_sent_frame = 10.0; //should be > keep alive amount (5 secs)
while ( !zm_terminate ) {

View File

@ -44,7 +44,7 @@ switch ( $_REQUEST['command'] ) {
$remSockFile = ZM_PATH_SOCKS.'/zms-'.sprintf("%06d",$_REQUEST['connkey']).'s.sock';
$max_socket_tries = 10;
while ( !file_exists($remSockFile) && $max_socket_tries-- ) { //sometimes we are too fast for our own good, if it hasn't been setup yet give it a second.
usleep(200000);
usleep(2000000);
}
if ( !file_exists($remSockFile) ) {

View File

@ -87,8 +87,12 @@ function Monitor( monitorData ) {
} else {
console.error( respObj.message );
// Try to reload the image stream.
if ( stream )
if ( stream ) {
console.log('Reloading stream: ' + stream.src );
stream.src = stream.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
} else {
console.log( 'No stream to reload?' );
}
}
var streamCmdTimeout = statusRefreshTimeout;
if ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT )
@ -147,7 +151,7 @@ console.log("applying " + style + ': ' + styles[style]);
if ( ! layout ) {
return;
}
Cookie.write( 'zmMontageLayout', layout, { duration: 10*365 } );
Cookie.write( 'zmMontageLayout', layout_id, { duration: 10*365 } );
if ( layout_id != 1 ) { // 'montage_freeform.css' ) {
Cookie.write( 'zmMontageScale', '', { duration: 10*365 } );
$('scale').set('value', '' );
@ -264,6 +268,42 @@ function initPage() {
monitors[i].start( delay );
}
selectLayout($('layout'));
$j('#monitors .monitorFrame').draggable({
cursor: 'crosshair',
revert: 'invalid'
});
function toGrid(value) {
return Math.round(value / 80) * 80;
}
$j('#monitors').droppable({
accept: '#monitors .monitorFrame',
drop: function(event, ui) {
//console.log(event);
$j(this).removeClass('border over');
$j(ui.draggable).detach().
appendTo($j(this).find('ul')).
draggable({
containment: '.fw-content',
cursor: 'help',
grid: [ 80, 80 ]
}).
css({
position: 'absolute',
left: toGrid(event.clientX - $j('#monitors').offset().left),
top: toGrid(event.clientY - $j('#monitors').offset().top)
});
},
over: function(event, elem) {
console.log('over');
$j(this).addClass('over');
},
out: function(event, elem) {
$j(this).removeClass('over');
}
});
}
// Kick everything off

View File

@ -103,6 +103,35 @@ ob_end_clean();
$groupSql = Group::get_group_sql( $group_id );
$servers = Server::find_all();
$ServersById = array();
foreach ( $servers as $S ) {
$ServersById[$S->Id()] = $S;
}
session_start();
foreach ( array('ServerFilter','StorageFilter') as $var ) {
if ( isset( $_REQUEST[$var] ) ) {
if ( $_REQUEST[$var] != '' ) {
$_SESSION[$var] = $_REQUEST[$var];
} else {
unset( $_SESSION[$var] );
}
} else if ( isset( $_COOKIE[$var] ) ) {
if ( $_COOKIE[$var] != '' ) {
$_SESSION[$var] = $_COOKIE[$var];
} else {
unset($_SESSION[$var]);
}
}
}
session_write_close();
$storage_areas = Storage::find_all();
$StorageById = array();
foreach ( $storage_areas as $S ) {
$StorageById[$S->Id()] = $S;
}
$monitor_id = 0;
if ( isset( $_REQUEST['monitor_id'] ) ) {
$monitor_id = $_REQUEST['monitor_id'];
@ -112,15 +141,46 @@ if ( isset( $_REQUEST['monitor_id'] ) ) {
$monitors = array();
$monitors_dropdown = array( '' => 'All' );
$sql = "SELECT * FROM Monitors WHERE Function != 'None'";
if ( $groupSql ) { $sql .= ' AND ' . $groupSql; };
if ( $monitor_id ) { $sql .= ' AND Id='.$monitor_id; };
$conditions = array();
$values = array();
$sql .= ' ORDER BY Sequence';
foreach( dbFetchAll( $sql ) as $row ) {
if ( $groupSql )
$conditions[] = $groupSql;
if ( isset($_SESSION['ServerFilter']) ) {
$conditions[] = 'ServerId=?';
$values[] = $_SESSION['ServerFilter'];
}
if ( isset($_SESSION['StorageFilter']) ) {
$conditions[] = 'StorageId=?';
$values[] = $_SESSION['StorageFilter'];
}
$sql = 'SELECT * FROM Monitors' . ( count($conditions) ? ' WHERE ' . implode(' AND ', $conditions ) : '' ).' ORDER BY Sequence ASC';
$monitor_rows = dbFetchAll( $sql, null, $values );
if ( $monitor_id ) {
$found_selected_monitor = false;
for ( $i = 0; $i < count($monitor_rows); $i++ ) {
if ( !visibleMonitor( $monitor_rows[$i]['Id'] ) ) {
continue;
}
$monitors_dropdown[$monitor_rows[$i]['Id']] = $monitor_rows[$i]['Name'];
if ( $monitor_rows[$i]['Id'] == $monitor_id ) {
$found_selected_monitor = true;
}
}
if ( ! $found_selected_monitor ) {
$monitor_id = '';
}
}
$monitors = array();
foreach( $monitor_rows as $row ) {
if ( !visibleMonitor( $row['Id'] ) ) {
continue;
}
if ( $monitor_id and $row['Id'] != $monitor_id )
continue;
$row['Scale'] = $scale;
$row['PopupScale'] = reScale( SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
@ -169,6 +229,23 @@ if ( $showZones ) {
<span id="monitorControl"><label><?php echo translate('Monitor') ?>:</label>
<?php echo htmlSelect( 'monitor_id', $monitors_dropdown, $monitor_id, array('onchange'=>'changeMonitor(this);') ); ?>
</span>
<?php if ( count($ServersById) > 0 ) { ?>
<span class="ServerFilter"><label><?php echo translate('Server')?>:</label>
<?php
echo htmlSelect( 'ServerFilter', array(''=>'All')+$ServersById, (isset($_SESSION['ServerFilter'])?$_SESSION['ServerFilter']:''), array('onchange'=>'changeFilter(this);') );
?>
</span>
<?php
}
if ( count($StorageById) > 0 ) { ?>
<span class="StorageFilter"><label><?php echo translate('Storage')?>:</label>
<?php
echo htmlSelect( 'StorageFilter', array(''=>'All')+$StorageById, (isset($_SESSION['StorageFilter'])?$_SESSION['StorageFilter']:''), array('onchange'=>'changeFilter(this);') );
?>
</span>
<?php
}
?>
<br/>
<span id="widthControl"><label><?php echo translate('Width') ?>:</label><?php echo htmlSelect( 'width', $widths, $options['width'], 'changeSize(this);' ); ?></span>
<span id="heightControl"><label><?php echo translate('Height') ?>:</label><?php echo htmlSelect( 'height', $heights, $options['height'], 'changeSize(this);' ); ?></span>