Fixed issues with remote method not being preserved.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2622 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
45190dee61
commit
31a0762d9e
|
@ -48,9 +48,9 @@ function loadLocations( element )
|
||||||
|
|
||||||
function initPage()
|
function initPage()
|
||||||
{
|
{
|
||||||
var protocolSelector = $('contentForm').elements['newMonitor[Protocol]'];
|
//var protocolSelector = $('contentForm').elements['newMonitor[Protocol]'];
|
||||||
if ( $(protocolSelector).getTag() == 'select' )
|
//if ( $(protocolSelector).getTag() == 'select' )
|
||||||
updateMethods( $(protocolSelector) );
|
//updateMethods( $(protocolSelector) );
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEvent( 'domready', initPage );
|
window.addEvent( 'domready', initPage );
|
||||||
|
|
|
@ -128,16 +128,20 @@ function updateMethods( element )
|
||||||
{
|
{
|
||||||
var form = element.form;
|
var form = element.form;
|
||||||
|
|
||||||
form.elements['newMonitor[Method]'].length = 0;
|
var origMethod = form.elements['origMethod'];
|
||||||
switch ( form.elements['newMonitor[Protocol]'].value )
|
var methodSelector = form.elements['newMonitor[Method]'];
|
||||||
|
methodSelector.options.length = 0;
|
||||||
|
switch ( element.value )
|
||||||
{
|
{
|
||||||
case 'http' :
|
case 'http' :
|
||||||
{
|
{
|
||||||
<?php
|
<?php
|
||||||
foreach( $httpMethods as $label=>$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;
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -147,10 +151,12 @@ foreach( $httpMethods as $label=>$value )
|
||||||
case 'rtsp' :
|
case 'rtsp' :
|
||||||
{
|
{
|
||||||
<?php
|
<?php
|
||||||
foreach( $rtspMethods as $label=>$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;
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -250,12 +250,13 @@ foreach ( $tabs as $name=>$value )
|
||||||
<input type="hidden" name="action" value="monitor"/>
|
<input type="hidden" name="action" value="monitor"/>
|
||||||
<input type="hidden" name="mid" value="<?= $monitor['Id'] ?>"/>
|
<input type="hidden" name="mid" value="<?= $monitor['Id'] ?>"/>
|
||||||
<input type="hidden" name="newMonitor[LinkedMonitors]" value="<?= isset($newMonitor['LinkedMonitors'])?$newMonitor['LinkedMonitors']:'' ?>"/>
|
<input type="hidden" name="newMonitor[LinkedMonitors]" value="<?= isset($newMonitor['LinkedMonitors'])?$newMonitor['LinkedMonitors']:'' ?>"/>
|
||||||
|
<input type="hidden" name="origMethod" value="<?= isset($newMonitor['Method'])?$newMonitor['Method']:'' ?>"/>
|
||||||
<?php
|
<?php
|
||||||
if ( $_REQUEST['tab'] != 'general' )
|
if ( $_REQUEST['tab'] != 'general' )
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<input type="hidden" name="newMonitor[Name]" value="<?= $newMonitor['Name'] ?>"/>
|
<input type="hidden" name="newMonitor[Name]" value="<?= $newMonitor['Name'] ?>"/>
|
||||||
<input Type="hidden" name="newMonitor[Type]" value="<?= $newMonitor['Type'] ?>"/>
|
<input type="hidden" name="newMonitor[Type]" value="<?= $newMonitor['Type'] ?>"/>
|
||||||
<input type="hidden" name="newMonitor[Function]" value="<?= $newMonitor['Function'] ?>"/>
|
<input type="hidden" name="newMonitor[Function]" value="<?= $newMonitor['Function'] ?>"/>
|
||||||
<input type="hidden" name="newMonitor[Enabled]" value="<?= $newMonitor['Enabled'] ?>"/>
|
<input type="hidden" name="newMonitor[Enabled]" value="<?= $newMonitor['Enabled'] ?>"/>
|
||||||
<input type="hidden" name="monitorIds" value="<?= isset($_REQUEST['monitorIds'])?$_REQUEST['monitorIds']:'' ?>"/>
|
<input type="hidden" name="monitorIds" value="<?= isset($_REQUEST['monitorIds'])?$_REQUEST['monitorIds']:'' ?>"/>
|
||||||
|
@ -465,7 +466,20 @@ switch ( $_REQUEST['tab'] )
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<tr><td><?= $SLANG['RemoteProtocol'] ?></td><td><?= buildSelect( "newMonitor[Protocol]", $remoteProtocols, "updateMethods( this )" ); ?></td></tr>
|
<tr><td><?= $SLANG['RemoteProtocol'] ?></td><td><?= buildSelect( "newMonitor[Protocol]", $remoteProtocols, "updateMethods( this )" ); ?></td></tr>
|
||||||
<tr><td><?= $SLANG['RemoteMethod'] ?></td><td><?= buildSelect( "newMonitor[Method]", array() ); ?></td></tr>
|
<?php
|
||||||
|
if ( empty($newMonitor['Protocol']) || $newMonitor['Protocol'] == "http" )
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<tr><td><?= $SLANG['RemoteMethod'] ?></td><td><?= buildSelect( "newMonitor[Method]", $httpMethods ); ?></td></tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<tr><td><?= $SLANG['RemoteMethod'] ?></td><td><?= buildSelect( "newMonitor[Method]", $rtspMethods ); ?></td></tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
<tr><td><?= $SLANG['RemoteHostName'] ?></td><td><input type="text" name="newMonitor[Host]" value="<?= $newMonitor['Host'] ?>" size="36"/></td></tr>
|
<tr><td><?= $SLANG['RemoteHostName'] ?></td><td><input type="text" name="newMonitor[Host]" value="<?= $newMonitor['Host'] ?>" size="36"/></td></tr>
|
||||||
<tr><td><?= $SLANG['RemoteHostPort'] ?></td><td><input type="text" name="newMonitor[Port]" value="<?= $newMonitor['Port'] ?>" size="6"/></td></tr>
|
<tr><td><?= $SLANG['RemoteHostPort'] ?></td><td><input type="text" name="newMonitor[Port]" value="<?= $newMonitor['Port'] ?>" size="6"/></td></tr>
|
||||||
<tr><td><?= $SLANG['RemoteHostPath'] ?></td><td><input type="text" name="newMonitor[Path]" value="<?= $newMonitor['Path'] ?>" size="36"/></td></tr>
|
<tr><td><?= $SLANG['RemoteHostPath'] ?></td><td><input type="text" name="newMonitor[Path]" value="<?= $newMonitor['Path'] ?>" size="36"/></td></tr>
|
||||||
|
|
Loading…
Reference in New Issue