diff --git a/web/skins/classic/views/js/monitor.js b/web/skins/classic/views/js/monitor.js index 11698562b..bf83fa7f7 100644 --- a/web/skins/classic/views/js/monitor.js +++ b/web/skins/classic/views/js/monitor.js @@ -48,9 +48,9 @@ function loadLocations( element ) function initPage() { - var protocolSelector = $('contentForm').elements['newMonitor[Protocol]']; - if ( $(protocolSelector).getTag() == 'select' ) - updateMethods( $(protocolSelector) ); + //var protocolSelector = $('contentForm').elements['newMonitor[Protocol]']; + //if ( $(protocolSelector).getTag() == 'select' ) + //updateMethods( $(protocolSelector) ); } window.addEvent( 'domready', initPage ); diff --git a/web/skins/classic/views/js/monitor.js.php b/web/skins/classic/views/js/monitor.js.php index bca3e12c6..b1f45e884 100644 --- a/web/skins/classic/views/js/monitor.js.php +++ b/web/skins/classic/views/js/monitor.js.php @@ -128,16 +128,20 @@ function updateMethods( element ) { var form = element.form; - form.elements['newMonitor[Method]'].length = 0; - switch ( form.elements['newMonitor[Protocol]'].value ) + var origMethod = form.elements['origMethod']; + var methodSelector = form.elements['newMonitor[Method]']; + methodSelector.options.length = 0; + switch ( element.value ) { case 'http' : { $value ) +foreach( $httpMethods as $value=>$label ) { ?> - form.elements['newMonitor[Method]'].options[form.elements['newMonitor[Method]'].length] = new Option( "= $value ?>", "= htmlspecialchars($label) ?>" ); + methodSelector.options[methodSelector.options.length] = new Option( "= htmlspecialchars($label) ?>", "= $value ?>" ); + if ( origMethod.value == "= $value ?>" ) + methodSelector.selectedIndex = methodSelector.options.length-1; @@ -147,10 +151,12 @@ foreach( $httpMethods as $label=>$value ) case 'rtsp' : { $value ) +foreach( $rtspMethods as $value=>$label ) { ?> - form.elements['newMonitor[Method]'].options[form.elements['newMonitor[Method]'].length] = new Option( "= $value ?>", "= htmlspecialchars($label) ?>" ); + methodSelector.options[methodSelector.options.length] = new Option( "= htmlspecialchars($label) ?>", "= $value ?>" ); + if ( origMethod.value == "= $value ?>" ) + methodSelector.selectedIndex = form.elements['newMonitor[Method]'].options.length-1; diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 8fc86bfcd..078f2578e 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -250,12 +250,13 @@ foreach ( $tabs as $name=>$value ) + - + @@ -465,7 +466,20 @@ switch ( $_REQUEST['tab'] ) { ?>