diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in index 18306e52f..fc4143d8a 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in @@ -3825,6 +3825,41 @@ body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% s readonly => 1, category => "dynamic", }, + { + name => "ZM_SSMTP_MAIL", + default => "no", + description => qqq(" + Use a SSMTP mail server if available. + NEW_MAIL_MODULES must be enabled + "), + requires => [ + { name => "ZM_OPT_EMAIL", value => "yes" }, + { name => "ZM_OPT_MESSAGE", value => "yes" }, + { name => "ZM_NEW_MAIL_MODULES", value => "yes" } + ], + help => qqq(" + SSMTP is a lightweight and efficient method to send email. + The SSMTP application is not installed by default. + NEW_MAIL_MODULES must also be enabled. + Please visit: http://www.zoneminder.com/wiki/index.php/How_to_get_ssmtp_working_with_Zoneminder + for setup and configuration help. + "), + type => $types{boolean}, + category => "mail", + }, + { + name => "ZM_SSMTP_PATH", + default => "", + description => "SSMTP executable path", + requires => [{ name => "ZM_SSMTP_MAIL", value => "yes" }], + help => qqq(" + Recommend setting the path to the SSMTP application. + If path is not defined. Zoneminder will try to determine + the path via shell command. Example path: /usr/sbin/ssmtp. + "), + type => $types{string}, + category => "mail", + }, ); our %options_hash = map { ( $_->{name}, $_ ) } @options; diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in index 511754a33..7c8244f83 100755 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -779,9 +779,31 @@ sub sendEmail Disposition => "attachment" ); } + if ( $Config{ZM_SSMTP_MAIL} ){ + + my $ssmtp_location = $Config{ZM_SSMTP_PATH}; + + if( ! $ssmtp_location ){ + + $ssmtp_location = qx('which ssmtp'); + + if ( logDebugging() ) + { + Debug( "which ssmtp: $ssmtp_location - set ssmtp path in options to suppress this message\n" ); + } + + } + + $mail->send( 'sendmail', $ssmtp_location, $Config{ZM_EMAIL_ADDRESS} ); + + }else{ + + MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 ); + $mail->send(); + } ### Send the Message - MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 ); - $mail->send(); + #MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 ); + #$mail->send(); } else { diff --git a/web/lang/en_gb.php b/web/lang/en_gb.php index 571eb48d8..7636688ec 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 84beadb89..a9b3c673c 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -21,7 +21,7 @@ xhtmlHeaders( __FILE__, translate('Console') ); - + @@ -80,7 +80,7 @@ foreach( $displayMonitors as $monitor ) $dclass = "errorText"; else { - // https://github.com/ZoneMinder/ZoneMinder/issues/1082 + // https://github.com/ZoneMinder/ZoneMinder/issues/1082 if ( !$monitor['zma'] && $monitor['Function']!='Monitor' ) $dclass = "warnText"; else @@ -99,7 +99,7 @@ foreach( $displayMonitors as $monitor ) '.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', disabled' : '' ) .'', canEdit( 'Monitors' ) ) ?> - Name(); ?> @@ -113,9 +113,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 58e4a1e19..04f29d049 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -58,80 +58,88 @@ if ( ! empty($_REQUEST['mid']) ) { } else { $nextId = getTableAutoInc( 'Monitors' ); - $monitor = new Monitor(); - $monitor->set( 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, - 'SaveJPEGs' => "3", - 'VideoWriter' => "0", - 'EncoderParameters' => "# Lines beginning with # are a comment \n# For changing quality, use the crf option\n# 1 is best, 51 is worst quality\n#crf=23\n", - 'RecordAudio' => '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'], - 'StorageId' => '', - ) ); -} + if ( ! empty( $_REQUEST['dupId'] ) ) { + $monitor = new Monitor( $_REQUEST['dupId'] ); + if ( ZM_OPT_X10 ) + $x10Monitor = dbFetchOne( 'SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['dupId']) ); + $clonedName = $monitor->Name(); + $monitor->Name( translate('Monitor').'-'.$nextId ); + } else { + $monitor = new Monitor(); + $monitor->set( 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, + 'SaveJPEGs' => "3", + 'VideoWriter' => "0", + 'EncoderParameters' => "# Lines beginning with # are a comment \n# For changing quality, use the crf option\n# 1 is best, 51 is worst quality\n#crf=23\n", + 'RecordAudio' => '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'], + 'StorageId' => '', + ) ); + } # end if $_REQUEST['dupID'] +} # end if $_REQUEST['mid'] if ( ZM_OPT_X10 && empty($x10Monitor) ) { $x10Monitor = array( @@ -143,6 +151,7 @@ if ( ZM_OPT_X10 && empty($x10Monitor) ) { function fourcc( $a, $b, $c, $d ) { return( ord($a) | (ord($b) << 8) | (ord($c) << 16) | (ord($d) << 24) ); + } if ( isset( $_REQUEST['newMonitor'] ) ) { @@ -455,23 +464,22 @@ $videowriteropts = array( xhtmlHeaders(__FILE__, translate('Monitor')." - ".validHtmlStr($monitor->Name) ); ?> -
- +