Corrected selection of LinkedMonitors.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2619 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2008-09-01 14:03:52 +00:00
parent 64987d9399
commit 0c2edfef4a
2 changed files with 16 additions and 3 deletions

View File

@ -104,6 +104,18 @@ function validateForm( form )
errors[errors.length] = "<?= $SLANG['BadSignalCheckColour'] ?>"; errors[errors.length] = "<?= $SLANG['BadSignalCheckColour'] ?>";
if ( !form.elements['newMonitor[WebColour]'].value || !form.elements['newMonitor[WebColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) ) if ( !form.elements['newMonitor[WebColour]'].value || !form.elements['newMonitor[WebColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) )
errors[errors.length] = "<?= $SLANG['BadWebColour'] ?>"; errors[errors.length] = "<?= $SLANG['BadWebColour'] ?>";
if ( form.elements['monitorIds'] )
{
var monitorIds = new Array();
for ( var i = 0; i < form.elements['monitorIds'].options.length; i++ )
{
if ( form.elements['monitorIds'].options[i].selected )
monitorIds[monitorIds.length] = form.elements['monitorIds'].options[i].value;
}
form.elements['newMonitor[LinkedMonitors]'].value = monitorIds.join( ',' );
}
if ( errors.length ) if ( errors.length )
{ {
alert( errors.join( "\n" ) ); alert( errors.join( "\n" ) );

View File

@ -249,6 +249,7 @@ foreach ( $tabs as $name=>$value )
<input type="hidden" name="tab" value="<?= $_REQUEST['tab'] ?>"/> <input type="hidden" name="tab" value="<?= $_REQUEST['tab'] ?>"/>
<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']:'' ?>"/>
<?php <?php
if ( $_REQUEST['tab'] != 'general' ) if ( $_REQUEST['tab'] != 'general' )
{ {
@ -257,7 +258,7 @@ if ( $_REQUEST['tab'] != 'general' )
<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="newMonitor[LinkedMonitors]" value="<?= isset($newMonitor['LinkedMonitors'])?$newMonitor['LinkedMonitors']:'' ?>"/> <input type="hidden" name="monitorIds" value="<?= isset($_REQUEST['monitorIds'])?$_REQUEST['monitorIds']:'' ?>"/>
<input type="hidden" name="newMonitor[RefBlendPerc]" value="<?= $newMonitor['RefBlendPerc'] ?>"/> <input type="hidden" name="newMonitor[RefBlendPerc]" value="<?= $newMonitor['RefBlendPerc'] ?>"/>
<input type="hidden" name="newMonitor[MaxFPS]" value="<?= $newMonitor['MaxFPS'] ?>"/> <input type="hidden" name="newMonitor[MaxFPS]" value="<?= $newMonitor['MaxFPS'] ?>"/>
<input type="hidden" name="newMonitor[AlarmMaxFPS]" value="<?= $newMonitor['AlarmMaxFPS'] ?>"/> <input type="hidden" name="newMonitor[AlarmMaxFPS]" value="<?= $newMonitor['AlarmMaxFPS'] ?>"/>
@ -390,7 +391,7 @@ switch ( $_REQUEST['tab'] )
<tr> <tr>
<td><?= $SLANG['LinkedMonitors'] ?></td> <td><?= $SLANG['LinkedMonitors'] ?></td>
<td> <td>
<select name="newMonitor[LinkedMonitors]" size="4" multiple="multiple"> <select name="monitorIds" size="4" multiple="multiple">
<?php <?php
$monitors = dbFetchAll( "select Id,Name from Monitors order by Sequence asc" ); $monitors = dbFetchAll( "select Id,Name from Monitors order by Sequence asc" );
if ( !empty($newMonitor['LinkedMonitors']) ) if ( !empty($newMonitor['LinkedMonitors']) )
@ -399,7 +400,7 @@ switch ( $_REQUEST['tab'] )
$monitorIds = array(); $monitorIds = array();
foreach ( $monitors as $monitor ) foreach ( $monitors as $monitor )
{ {
if ( visibleMonitor( $monitor['Id'] ) ) if ( ($monitor['Id'] != $newMonitor['Id']) && visibleMonitor( $monitor['Id'] ) )
{ {
?> ?>
<option value="<?= $monitor['Id'] ?>"<?php if ( array_key_exists( $monitor['Id'], $monitorIds ) ) { ?> selected="selected"<?php } ?>><?= htmlentities($monitor['Name']) ?></option> <option value="<?= $monitor['Id'] ?>"<?php if ( array_key_exists( $monitor['Id'], $monitorIds ) ) { ?> selected="selected"<?php } ?>><?= htmlentities($monitor['Name']) ?></option>