diff --git a/src/zm_storage.cpp b/src/zm_storage.cpp index 3f80e26aa..ff2ba4997 100644 --- a/src/zm_storage.cpp +++ b/src/zm_storage.cpp @@ -62,16 +62,16 @@ Storage::Storage( unsigned int p_id ) { if ( p_id ) { char sql[ZM_SQL_SML_BUFSIZ]; - snprintf( sql, sizeof(sql), "SELECT Id, Name, Path, Type, Scheme from Storage WHERE Id=%d", p_id ); + snprintf(sql, sizeof(sql), "SELECT Id, Name, Path, Type, Scheme FROM Storage WHERE Id=%d", p_id); Debug(2,"Loading Storage for %d using %s", p_id, sql ); zmDbRow dbrow; - if ( ! dbrow.fetch( sql ) ) { - Error( "Unable to load storage area for id %d: %s", p_id, mysql_error( &dbconn ) ); + if ( !dbrow.fetch(sql) ) { + Error("Unable to load storage area for id %d: %s", p_id, mysql_error(&dbconn)); } else { unsigned int index = 0; - id = atoi( dbrow[index++] ); - strncpy( name, dbrow[index++], sizeof(name)-1 ); - strncpy( path, dbrow[index++], sizeof(path)-1 ); + id = atoi(dbrow[index++]); + strncpy(name, dbrow[index++], sizeof(name)-1); + strncpy(path, dbrow[index++], sizeof(path)-1); type_str = std::string(dbrow[index++]); scheme_str = std::string(dbrow[index++]); if ( scheme_str == "Deep" ) { @@ -81,17 +81,17 @@ Storage::Storage( unsigned int p_id ) { } else { scheme = SHALLOW; } - Debug( 1, "Loaded Storage area %d '%s'", id, this->Name() ); + Debug(1, "Loaded Storage area %d '%s'", id, this->Name()); } } - if ( ! id ) { + if ( !id ) { if ( staticConfig.DIR_EVENTS[0] != '/' ) { // not using an absolute path. Make it one by appending ZM_PATH_WEB - snprintf( path, sizeof (path), "%s/%s", staticConfig.PATH_WEB.c_str( ), staticConfig.DIR_EVENTS.c_str() ); + snprintf(path, sizeof (path), "%s/%s", staticConfig.PATH_WEB.c_str(), staticConfig.DIR_EVENTS.c_str()); } else { - strncpy(path, staticConfig.DIR_EVENTS.c_str(), sizeof(path)-1 ); + strncpy(path, staticConfig.DIR_EVENTS.c_str(), sizeof(path)-1); } - Debug(1,"No id passed to Storage constructor. Using default path %s instead", path ); + Debug(1,"No id passed to Storage constructor. Using default path %s instead", path); strcpy(name, "Default"); scheme = MEDIUM; scheme_str = "Medium"; diff --git a/web/includes/Storage.php b/web/includes/Storage.php index 95f1dab84..a7372b15a 100644 --- a/web/includes/Storage.php +++ b/web/includes/Storage.php @@ -223,5 +223,19 @@ class Storage { } return $this->{'Server'}; } + + public function to_json() { + $json = array(); + foreach ($this->defaults as $key => $value) { + if ( is_callable(array($this, $key)) ) { + $json[$key] = $this->$key(); + } else if ( array_key_exists($key, $this) ) { + $json[$key] = $this->{$key}; + } else { + $json[$key] = $this->defaults{$key}; + } + } + return json_encode($json); + } } ?> diff --git a/web/skins/classic/views/events.php b/web/skins/classic/views/events.php index b10a20370..fafebfc8d 100644 --- a/web/skins/classic/views/events.php +++ b/web/skins/classic/views/events.php @@ -190,8 +190,8 @@ while ( $event_row = dbFetchNext($results) ) { $scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE ); ?> Archived()) echo ' class="archived"' ?>> - '.$event->Id().($event->Archived()?'*':'') ?> - '.validHtmlStr($event->Name()).($event->Archived()?'*':'') ?> + '.$event->Id().($event->Archived()?'*':'') ?> + '.validHtmlStr($event->Name()).($event->Archived()?'*':'') ?> MonitorId(), 'zmMonitor'.$event->Monitorid(), 'monitor', $event->MonitorName(), canEdit( 'Monitors' ) ) ?> Id(), 'zmEventDetail', 'eventdetail', validHtmlStr($event->Cause()), canEdit( 'Events' ), 'title="'.htmlspecialchars($event->Notes()).'"' ) ?> Notes() && ($event->Notes() != 'Forced Web: ')) echo "
".$event->Notes()."
" ?> @@ -227,12 +227,12 @@ while ( $event_row = dbFetchNext($results) ) { $streamSrc = $event->getStreamSrc(array( 'mode'=>'jpeg', 'scale'=>$scale, 'maxfps'=>ZM_WEB_VIDEO_MAXFPS, 'replay'=>'single')); - $imgHtml = ''. validHtmlStr('Event '.$event->Id()) .''; + $imgHtml = ''. validHtmlStr('Event '.$event->Id()) .''; echo ''.$imgHtml.''; echo ''; } // end if ZM_WEB_LIST_THUMBS ?> - +
- - - - - - -
@@ -301,6 +301,7 @@ if ( $pagination ) { diff --git a/web/skins/classic/views/filter.php b/web/skins/classic/views/filter.php index b7d9bec22..66b7c8118 100644 --- a/web/skins/classic/views/filter.php +++ b/web/skins/classic/views/filter.php @@ -165,7 +165,7 @@ xhtmlHeaders(__FILE__, translate('EventFilter') );
1 ) { - echo htmlSelect('Id', $filterNames, $filter->Id(), 'this.form.submit();'); + echo htmlSelect('Id', $filterNames, $filter->Id(), array('data-on-change-this'=>'selectFilter')); } else { ?> Id() ) { ?> - + monitor_element.width * 3/4 && pos_y < monitor_element.height/4 ) { + } else if ( pos_x > element.width * 3/4 && pos_y < element.height/4 ) { zoom(monId, 1/1.15); } else { showOneMonitor(monId); @@ -910,9 +919,25 @@ function initPage() { } if ( !liveMode ) { canvas = $("timeline"); + + canvas.addEventListener('mousemove', mmove, false); + canvas.addEventListener('touchmove', tmove, false); + canvas.addEventListener('mousedown', mdown, false); + canvas.addEventListener('mouseup', mup, false); + canvas.addEventListener('mouseout', mout, false); + ctx = canvas.getContext('2d'); drawGraph(); } + for ( i=0, len=monitorPtr.length; i < len; i += 1 ) { + var monitor_id = monitorPtr[i]; + monitor_canvas = $('Monitor'+monitor_id); + if ( ! monitor_canvas ) { + console.log("No canvas found for monitor " + monitor_id); + continue; + } + monitor_canvas.addEventListener('click',clickMonitor,false); + } setSpeed(speedIndex); //setFit(fitMode); // will redraw //setLive(liveMode); // will redraw diff --git a/web/skins/classic/views/js/montagereview.js.php b/web/skins/classic/views/js/montagereview.js.php index a31bbfa9e..c887bb0e3 100644 --- a/web/skins/classic/views/js/montagereview.js.php +++ b/web/skins/classic/views/js/montagereview.js.php @@ -119,13 +119,21 @@ echo " };\n"; } // end if initialmodeislive echo "\nvar Storage = [];\n"; +$have_storage_zero = 0; foreach ( Storage::find() as $Storage ) { - echo 'Storage[' . $Storage->Id() . '] = ' . json_encode($Storage). ";\n"; + echo 'Storage[' . $Storage->Id() . '] = ' . $Storage->to_json(). ";\n"; + if ( $Storage->Id() == 0 ) + $have_storage_zero = true; } +if ( !$have_storage_zero ) { + $Storage = new Storage(); + echo 'Storage[0] = ' . $Storage->to_json(). ";\n"; +} + echo "\nvar Servers = [];\n"; // Fall back to get Server paths, etc when no using multi-server mode $Server = new Server(); -echo 'Servers[0] = new Server(' . json_encode($Server). ");\n"; +echo 'Servers[0] = new Server(' . $Server->to_json(). ");\n"; foreach ( Server::find() as $Server ) { echo 'Servers[' . $Server->Id() . '] = new Server(' . $Server->to_json(). ");\n"; } diff --git a/web/skins/classic/views/montagereview.php b/web/skins/classic/views/montagereview.php index 039938824..a822febbe 100644 --- a/web/skins/classic/views/montagereview.php +++ b/web/skins/classic/views/montagereview.php @@ -290,7 +290,7 @@ if ( (!$liveMode) and (count($displayMonitors) != 0) ) {
- + @@ -304,8 +304,8 @@ if ( (!$liveMode) and (count($displayMonitors) != 0) ) {
Id().' ' .$m->Name().'" width="' . $m->Width() * $defaultScale . '" height="' . $m->Height() * $defaultScale . '" id="Monitor' . $m->Id() . '" style="border:1px solid ' . $m->WebColour() . '" onclick="clickMonitor(event,' . $m->Id() . ')">No Canvas Support!!'; + foreach ( $monitors as $m ) { + echo 'No Canvas Support!!'; } ?>