diff --git a/web/zm_html_view_monitor.php b/web/zm_html_view_monitor.php index 3a63e317d..9e1633390 100644 --- a/web/zm_html_view_monitor.php +++ b/web/zm_html_view_monitor.php @@ -71,6 +71,7 @@ else $monitor['Host'] = ""; $monitor['Path'] = ""; $monitor['Port'] = "80"; + $monitor['Palette'] = "4"; $monitor['Width'] = ""; $monitor['Height'] = ""; $monitor['Orientation'] = "0"; @@ -144,14 +145,112 @@ opener.location.reload(true); } ?> window.focus(); -function validateForm(Form) +function validateForm(form) { var errors = new Array(); - if ( Form.elements['new_monitor[Name]'].value.search( /[^\w-]/ ) >= 0 ) + if ( form.elements['new_monitor[Name]'].value.search( /[^\w-]/ ) >= 0 ) { errors[errors.length] = ""; } + if ( form.elements['new_monitor[MaxFPS]'].value && !(parseFloat(form.elements['new_monitor[MaxFPS]'].value) > 0 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[RefBlendPerc]'].value || !(parseInt(form.elements['new_monitor[RefBlendPerc]'].value) > 0 ) ) + { + errors[errors.length] = ""; + } + if ( form.elements['new_monitor[Type]'].value == 'Local' ) + { + if ( !form.elements['new_monitor[Device]'].value ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[Channel]'].value || !form.elements['new_monitor[Channel]'].value.match( /^\d+$/ ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[Format]'].value || !form.elements['new_monitor[Format]'].value.match( /^\d+$/ ) ) + { + errors[errors.length] = ""; + } + } + else if ( form.elements['new_monitor[Type]'].value == 'Remote' ) + { + if ( !form.elements['new_monitor[Host]'].value || !form.elements['new_monitor[Host]'].value.match( /^[0-9a-zA-Z_.-]+$/ ) ) + { + errors[errors.length] = ""; + } + if ( form.elements['new_monitor[Port]'].value && !form.elements['new_monitor[Port]'].value.match( /^\d+$/ ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[Path]'].value ) + { + errors[errors.length] = ""; + } + } + else if ( form.elements['new_monitor[Type]'].value == 'File' ) + { + if ( !form.elements['new_monitor[Path]'].value ) + { + errors[errors.length] = ""; + } + } + if ( !form.elements['new_monitor[Width]'].value || !(parseInt(form.elements['new_monitor[Width]'].value) > 0 ) ) + { + errors[errors.length] = ""; + } + alert( parseInt(form.elements['new_monitor[Height]'].value) ); + if ( !form.elements['new_monitor[Height]'].value || !(parseInt(form.elements['new_monitor[Height]'].value) > 0 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[LabelX]'].value || !(parseInt(form.elements['new_monitor[LabelX]'].value) >= 0 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[LabelY]'].value || !(parseInt(form.elements['new_monitor[LabelY]'].value) >= 0 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[ImageBufferCount]'].value || !(parseInt(form.elements['new_monitor[ImageBufferCount]'].value) >= 10 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[WarmupCount]'].value || !(parseInt(form.elements['new_monitor[WarmupCount]'].value) >= 0 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[PreEventCount]'].value || !(parseInt(form.elements['new_monitor[PreEventCount]'].value) > 0 ) || (parseInt(form.elements['new_monitor[PreEventCount]'].value) > parseInt(form.elements['new_monitor[ImageBufferCount]'].value)) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[PostEventCount]'].value || !(parseInt(form.elements['new_monitor[PostEventCount]'].value) >= 0 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[AlarmFrameCount]'].value || !(parseInt(form.elements['new_monitor[AlarmFrameCount]'].value) > 0 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[SectionLength]'].value || !(parseInt(form.elements['new_monitor[SectionLength]'].value) >= 30 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[FPSReportInterval]'].value || !(parseInt(form.elements['new_monitor[FPSReportInterval]'].value) >= 100 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[FrameSkip]'].value || !(parseInt(form.elements['new_monitor[FrameSkip]'].value) >= 0 ) ) + { + errors[errors.length] = ""; + } + if ( !form.elements['new_monitor[WebColour]'].value || !form.elements['new_monitor[WebColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) ) + { + errors[errors.length] = ""; + } if ( errors.length ) { alert( errors.join( "\n" ) ); @@ -160,11 +259,11 @@ function validateForm(Form) return( true ); } -function submitTab(Form,Tab) +function submitTab(form,tab) { - Form.action.value = ""; - Form.tab.value = Tab; - Form.submit(); + form.action.value = ""; + form.tab.value = tab; + form.submit(); } function selectLinkedMonitors() @@ -186,10 +285,10 @@ function closeWindow() if ( ZM_OPT_CONTROL && $tab == 'control' ) { ?> -function loadLocations( Form ) +function loadLocations( form ) { - var controlIdSelect = Form.elements['new_monitor[ControlId]']; - var returnLocationSelect = Form.elements['new_monitor[ReturnLocation]']; + var controlIdSelect = form.elements['new_monitor[ControlId]']; + var returnLocationSelect = form.elements['new_monitor[ReturnLocation]']; returnLocationSelect.options[option_count++] = new Option( '', -1 ); if ( controlIdSelect.selectedIndex ) @@ -301,15 +400,30 @@ if ( $tab != 'general' ) } } } -if ( $tab != 'source' ) +if ( $tab != 'source' || $new_monitor['Type'] != 'Local' ) { ?> + + + diff --git a/web/zm_lang_en_gb.php b/web/zm_lang_en_gb.php index 742e20242..eba85fc32 100644 --- a/web/zm_lang_en_gb.php +++ b/web/zm_lang_en_gb.php @@ -132,6 +132,27 @@ $zmSlangAutoVideoEvents = 'Automatically create video for all matches'; $zmSlangAutoVideoAbbr = 'Video'; $zmSlangAvgBrScore = 'Avg.
Score'; $zmSlangBadNameChars = 'Names may only contain alphanumeric characters plus hyphen and underscore'; +$zmSlangBadMaxFPS = 'Maximum FPS must be a positive integer or floating point value'; +$zmSlangBadRefBlendPerc = 'Reference blendpercentage must be a positive integer'; +$zmSlangBadDevice = 'Device must be set to a valid value'; +$zmSlangBadChannel = 'Channel must be set to an integer of zero or more'; +$zmSlangBadFormat = 'Format must be set to an integer of zero or more'; +$zmSlangBadWidth = 'Width must be set to a valid value'; +$zmSlangBadHeight = 'Height must be set to a valid value'; +$zmSlangBadHost = 'Host must be set to a valid ip address or hostname'; +$zmSlangBadPort = 'Port must be set to a valid number'; +$zmSlangBadPath = 'Path must be set to a valid value'; +$zmSlangBadLabelX = 'Label X co-ordinate must be set to an integer of zero or more'; +$zmSlangBadLabelY = 'Label Y co-ordinate must be set to an integer of zero or more'; +$zmSlangBadImageBufferCount = 'Image buffer size must be an integer of 10 or more'; +$zmSlangBadWarmupCount = 'Warmup frames must be an integer of zero or more'; +$zmSlangBadPreEventCount = 'Pre event image buffer must be at least zero, and less than image buffer size'; +$zmSlangBadPostEventCount = 'Post event image buffer must be an integer of zero or more'; +$zmSlangBadAlarmFrameCount = 'Alarm frame count must be an integer of one or more'; +$zmSlangBadSectionLength = 'Section length must be an integer of 30 or more'; +$zmSlangBadFPSReportInterval = 'FPS report interval buffer count must be an integer of 100 or more'; +$zmSlangBadFrameSkip = 'Frame skip count must be an integer of zero or more'; +$zmSlangBadWebColour = 'Web colour must be a valid web colour string'; $zmSlangBandwidth = 'Bandwidth'; $zmSlangBlobPx = 'Blob Px'; $zmSlangBlobs = 'Blobs';