diff --git a/web/lang/en_gb.php b/web/lang/en_gb.php
index e2c2aac7c..d559a567a 100644
--- a/web/lang/en_gb.php
+++ b/web/lang/en_gb.php
@@ -230,6 +230,7 @@ $SLANG = array(
'ChooseLogFormat' => 'Choose a log format',
'ChooseLogSelection' => 'Choose a log selection',
'ChoosePreset' => 'Choose Preset',
+ 'CloneMonitor' => 'Clone Monitor',
'Close' => 'Close',
'Colour' => 'Colour',
'Command' => 'Command',
diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php
index 070c85b59..dbf0ea2f4 100644
--- a/web/skins/classic/views/console.php
+++ b/web/skins/classic/views/console.php
@@ -77,8 +77,8 @@ $run_state = dbFetchOne('select Name from States where IsActive = 1', 'Name' );
$group = NULL;
if ( ! empty($_COOKIE['zmGroup']) ) {
- if ( $group = dbFetchOne( 'select * from Groups where Id = ?', NULL, array($_COOKIE['zmGroup'])) )
- $groupIds = array_flip(explode( ',', $group['MonitorIds'] ));
+ if ( $group = dbFetchOne( 'select * from Groups where Id = ?', NULL, array($_COOKIE['zmGroup'])) )
+ $groupIds = array_flip(explode( ',', $group['MonitorIds'] ));
}
noCacheHeaders();
@@ -182,6 +182,7 @@ $seqDownFile = getSkinFile( 'graphics/seq-d.gif' );
$versionClass = (ZM_DYN_DB_VERSION&&(ZM_DYN_DB_VERSION!=ZM_VERSION))?'errorText':'';
+
xhtmlHeaders( __FILE__, translate('Console') );
?>
@@ -243,7 +244,7 @@ else
|
|
- |
+ |
|
-
+
+
|
'.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', disabled' : '' ) .'', canEdit( 'Monitors' ) ) ?> |
- Name();
?> |
@@ -330,9 +332,9 @@ echo $Server->Name();
'.$shortpath.'', canEdit( 'Monitors' ) ) ?> |
diff --git a/web/skins/classic/views/js/console.js b/web/skins/classic/views/js/console.js
index 5182a5fd5..99f175c23 100644
--- a/web/skins/classic/views/js/console.js
+++ b/web/skins/classic/views/js/console.js
@@ -1,3 +1,6 @@
+var jsTranslatedAddText;
+var jsTranslatedCloneText;
+
function setButtonStates( element )
{
var form = element.form;
@@ -15,9 +18,36 @@ function setButtonStates( element )
}
$(element).getParent( 'tr' ).toggleClass( 'highlight' );
form.editBtn.disabled = (checked!=1);
+ form.addBtn.value = (checked==1) ? jsTranslatedCloneText:jsTranslatedAddText;
+
form.deleteBtn.disabled = (checked==0);
}
+function addMonitor( element)
+{
+
+ var form = element.form;
+ var dupParam;
+ var monitorId=-1;
+ if (form.addBtn.value == jsTranslatedCloneText)
+ {
+ // get the value of the first checkbox
+ for ( var i = 0; i < form.elements.length; i++ )
+ {
+ if ( form.elements[i].type == "checkbox" )
+ {
+ if ( form.elements[i].checked )
+ {
+ monitorId = form.elements[i].value;
+ break;
+ }
+ }
+ }
+ }
+ dupParam = (monitorId == -1 ) ? '': '&dupId='+monitorId;
+ createPopup( '?view=monitor'+dupParam, 'zmMonitor0','monitor' );
+}
+
function editMonitor( element )
{
var form = element.form;
@@ -55,6 +85,8 @@ function reloadWindow()
function initPage()
{
+ jsTranslatedAddText = translatedAddText;
+ jsTranslatedCloneText = translatedCloneText;
reloadWindow.periodical( consoleRefreshTimeout );
if ( showVersionPopup )
createPopup( '?view=version', 'zmVersion', 'version' );
diff --git a/web/skins/classic/views/js/console.js.php b/web/skins/classic/views/js/console.js.php
index 93cf0cdb7..98417a985 100644
--- a/web/skins/classic/views/js/console.js.php
+++ b/web/skins/classic/views/js/console.js.php
@@ -26,7 +26,7 @@ elseif ( ZM_DYN_SHOW_DONATE_REMINDER )
?>
var showVersionPopup = ;
var showDonatePopup = ;
-
-
+var translatedAddText = "";
+var translatedCloneText = "";
diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php
index c55d77187..9f4375eae 100644
--- a/web/skins/classic/views/monitor.php
+++ b/web/skins/classic/views/monitor.php
@@ -42,11 +42,11 @@ if ( isset($_REQUEST['tab']) )
else
$tab = "general";
- $Server = null;
+ $Server = null;
if ( defined( 'ZM_SERVER_ID' ) ) {
$Server = dbFetchOne( 'SELECT * FROM Servers WHERE Id=?', NULL, array( ZM_SERVER_ID ) );
- }
- if ( ! $Server ) {
+ }
+ if ( ! $Server ) {
$Server = array( 'Id' => '' );
}
@@ -56,74 +56,11 @@ if ( ! empty($_REQUEST['mid']) ) {
$x10Monitor = dbFetchOne( 'SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['mid']) );
} else {
- $nextId = getTableAutoInc( 'Monitors' );
- $monitor = array(
- 'Id' => 0,
- 'Name' => translate('Monitor').'-'.$nextId,
- 'Function' => "Monitor",
- 'Enabled' => true,
- 'LinkedMonitors' => "",
- 'Type' => "",
- 'Device' => "/dev/video0",
- 'Channel' => "0",
- 'Format' => 0x000000ff,
- 'Protocol' => "",
- 'Method' => "",
- 'Host' => "",
- 'Path' => "",
- 'Options' => "",
- 'Port' => "80",
- 'User' => "",
- 'Pass' => "",
- 'Colours' => 3,
- 'Palette' => 0,
- 'Width' => "320",
- 'Height' => "240",
- 'Orientation' => "0",
- 'Deinterlacing' => 0,
- 'RTSPDescribe' => 0,
- 'LabelFormat' => '%N - %d/%m/%y %H:%M:%S',
- 'LabelX' => 0,
- 'LabelY' => 0,
- 'LabelSize' => 1,
- 'ImageBufferCount' => 50,
- 'WarmupCount' => 25,
- 'PreEventCount' => 25,
- 'PostEventCount' => 25,
- 'StreamReplayBuffer' => 1000,
- 'AlarmFrameCount' => 1,
- 'Controllable' => 0,
- 'ControlId' => "",
- 'ControlType' => 0,
- 'ControlDevice' => "",
- 'ControlAddress' => "",
- 'AutoStopTimeout' => "",
- 'TrackMotion' => 0,
- 'TrackDelay' => "",
- 'ReturnLocation' => -1,
- 'ReturnDelay' => "",
- 'SectionLength' => 600,
- 'FrameSkip' => 0,
- 'MotionFrameSkip' => 0,
- 'EventPrefix' => 'Event-',
- 'AnalysisFPS' => "",
- 'AnalysisUpdateDelay' => 0,
- 'MaxFPS' => "",
- 'AlarmMaxFPS' => "",
- 'FPSReportInterval' => 1000,
- 'RefBlendPerc' => 6,
- 'AlarmRefBlendPerc' => 6,
- 'DefaultView' => 'Events',
- 'DefaultRate' => '100',
- 'DefaultScale' => '100',
- 'SignalCheckColour' => '#0000c0',
- 'WebColour' => 'red',
- 'Exif' => '0',
- 'Triggers' => "",
- 'V4LMultiBuffer' => '',
- 'V4LCapturesPerFrame' => 1,
- 'ServerId' => $Server['Id'],
- );
+ $nextId = getTableAutoInc( 'Monitors' );
+ $monitor = getMonitorObject($_REQUEST['dupId']);
+ $clonedName = $monitor['Name'];
+ $monitor['Name'] = translate('Monitor').'-'.$nextId;
+ $monitor['Id']='0';
}
if ( ZM_OPT_X10 && empty($x10Monitor) )
@@ -135,6 +72,85 @@ if ( ZM_OPT_X10 && empty($x10Monitor) )
);
}
+function getMonitorObject( $mid = null)
+{
+ if ($mid !== null)
+ {
+ $monitor = dbFetchMonitor($mid);
+ }
+ else
+ {
+ $monitor = array(
+ 'Id' => 0,
+ 'Name' => "willbereplaced",
+ 'Function' => "Monitor",
+ 'Enabled' => true,
+ 'LinkedMonitors' => "",
+ 'Type' => "",
+ 'Device' => "/dev/video0",
+ 'Channel' => "0",
+ 'Format' => 0x000000ff,
+ 'Protocol' => "",
+ 'Method' => "",
+ 'Host' => "",
+ 'Path' => "",
+ 'Options' => "",
+ 'Port' => "80",
+ 'User' => "",
+ 'Pass' => "",
+ 'Colours' => 3,
+ 'Palette' => 0,
+ 'Width' => "320",
+ 'Height' => "240",
+ 'Orientation' => "0",
+ 'Deinterlacing' => 0,
+ 'RTSPDescribe' => 0,
+ 'LabelFormat' => '%N - %d/%m/%y %H:%M:%S',
+ 'LabelX' => 0,
+ 'LabelY' => 0,
+ 'LabelSize' => 1,
+ 'ImageBufferCount' => 50,
+ 'WarmupCount' => 25,
+ 'PreEventCount' => 25,
+ 'PostEventCount' => 25,
+ 'StreamReplayBuffer' => 1000,
+ 'AlarmFrameCount' => 1,
+ 'Controllable' => 0,
+ 'ControlId' => "",
+ 'ControlType' => 0,
+ 'ControlDevice' => "",
+ 'ControlAddress' => "",
+ 'AutoStopTimeout' => "",
+ 'TrackMotion' => 0,
+ 'TrackDelay' => "",
+ 'ReturnLocation' => -1,
+ 'ReturnDelay' => "",
+ 'SectionLength' => 600,
+ 'FrameSkip' => 0,
+ 'MotionFrameSkip' => 0,
+ 'EventPrefix' => 'Event-',
+ 'AnalysisFPS' => "",
+ 'AnalysisUpdateDelay' => 0,
+ 'MaxFPS' => "",
+ 'AlarmMaxFPS' => "",
+ 'FPSReportInterval' => 1000,
+ 'RefBlendPerc' => 6,
+ 'AlarmRefBlendPerc' => 6,
+ 'DefaultView' => 'Events',
+ 'DefaultRate' => '100',
+ 'DefaultScale' => '100',
+ 'SignalCheckColour' => '#0000c0',
+ 'WebColour' => 'red',
+ 'Exif' => '0',
+ 'Triggers' => "",
+ 'V4LMultiBuffer' => '',
+ 'V4LCapturesPerFrame' => 1,
+ 'ServerId' => $Server['Id'],
+ );
+ }
+ return ($monitor);
+}
+
function fourcc( $a, $b, $c, $d )
{
return( ord($a) | (ord($b) << 8) | (ord($c) << 16) | (ord($d) << 24) );
@@ -450,16 +466,31 @@ xhtmlHeaders(__FILE__, translate('Monitor')." - ".validHtmlStr($monitor['Name'])
if ( canEdit( 'Monitors' ) )
{
?>
+
+
+
+
+ Configuration cloned from Monitor:
+
+
+
+
| |
|
'None');
- $result = dbQuery( 'SELECT * FROM Servers ORDER BY Name');
- $results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Server' );
- foreach ( $results as $row => $server_obj ) {
- $servers[$server_obj->Id] = $server_obj->Name();
- }
+ $servers = array(''=>'None');
+ $result = dbQuery( 'SELECT * FROM Servers ORDER BY Name');
+ $results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Server' );
+ foreach ( $results as $row => $server_obj ) {
+ $servers[$server_obj->Id] = $server_obj->Name();
+ }
?>
-
+
|
| |
| |