Bug 206 - Changed check all links to master checkbox toggle.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1610 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2005-11-21 15:32:04 +00:00
parent 5e58bfa8c4
commit 4ed464d274
3 changed files with 61 additions and 47 deletions

View File

@ -74,19 +74,19 @@ elseif ( !empty( $limit ) )
<script type="text/javascript"> <script type="text/javascript">
function newWindow(Url,Name,Width,Height) function newWindow(Url,Name,Width,Height)
{ {
var Name = window.open(Url,Name,"resizable,scrollbars,width="+Width+",height="+Height); var Win = window.open(Url,Name,"resizable,scrollbars,width="+Width+",height="+Height);
} }
function eventWindow(Url,Name,Width,Height) function eventWindow(Url,Name,Width,Height)
{ {
var Name = window.open(Url,Name,"resizable,width="+Width+",height="+Height ); var Win = window.open(Url,Name,"resizable,width="+Width+",height="+Height );
} }
function filterWindow(Url,Name) function filterWindow(Url,Name)
{ {
var Name = window.open(Url,Name,"resizable,scrollbars,width=<?= $jws['filter']['w'] ?>,height=<?= $jws['filter']['h'] ?>"); var Win = window.open(Url,Name,"resizable,scrollbars,width=<?= $jws['filter']['w'] ?>,height=<?= $jws['filter']['h'] ?>");
} }
function timelineWindow(Url,Name) function timelineWindow(Url,Name)
{ {
var Name = window.open(Url,Name,"resizable,scrollbars,width=<?= $jws['timeline']['w'] ?>,height=<?= $jws['timeline']['h'] ?>"); var Win = window.open(Url,Name,"resizable,scrollbars,width=<?= $jws['timeline']['w'] ?>,height=<?= $jws['timeline']['h'] ?>");
} }
function closeWindow() function closeWindow()
{ {
@ -139,25 +139,30 @@ else
$unarchived = true; $unarchived = true;
} }
?> ?>
function checkAll(form,name) function toggleCheck(element,name)
{ {
var form = element.form;
var checked = element.checked;
for (var i = 0; i < form.elements.length; i++) for (var i = 0; i < form.elements.length; i++)
if (form.elements[i].name.indexOf(name) == 0) if (form.elements[i].name.indexOf(name) == 0)
form.elements[i].checked = 1; form.elements[i].checked = checked;
form.view_btn.disabled = false; form.view_btn.disabled = !checked;
form.edit_btn.disabled = false; form.edit_btn.disabled = !checked;
form.archive_btn.disabled = <?= $unarchived?"false":"true" ?>; form.archive_btn.disabled = <?= $unarchived?"!checked":"true" ?>;
form.unarchive_btn.disabled = <?= $archived?"false":"true" ?>; form.unarchive_btn.disabled = <?= $archived?"!checked":"true" ?>;
form.export_btn.disabled = false; form.export_btn.disabled = !checked;
form.delete_btn.disabled = false; form.delete_btn.disabled = !checked;
<?php if ( LEARN_MODE ) { ?> <?php if ( LEARN_MODE ) { ?>
form.learn_btn.disabled = false; form.learn_btn.disabled = !checked;
form.learn_state.disabled = false; form.learn_state.disabled = !checked;
<?php } ?> <?php } ?>
} }
function configureButton(form,name) function configureButton(element,name)
{ {
var checked = false; var form = element.form;
var checked = element.checked;
if ( !checked )
{
for (var i = 0; i < form.elements.length; i++) for (var i = 0; i < form.elements.length; i++)
{ {
if ( form.elements[i].name.indexOf(name) == 0) if ( form.elements[i].name.indexOf(name) == 0)
@ -169,6 +174,9 @@ function configureButton(form,name)
} }
} }
} }
}
if ( !element.checked )
form.toggle_check.checked = false;
form.view_btn.disabled = !checked; form.view_btn.disabled = !checked;
form.edit_btn.disabled = !checked; form.edit_btn.disabled = !checked;
form.archive_btn.disabled = (!checked)||<?= $unarchived?"false":"true" ?>; form.archive_btn.disabled = (!checked)||<?= $unarchived?"false":"true" ?>;
@ -193,7 +201,7 @@ function editEvents( form, name )
} }
} }
} }
var Name = newWindow( '<?= $PHP_SELF ?>?view=eventdetail&'+eids.join( '&' ), 'zmEventDetail', <?= $jws['eventdetail']['w'] ?>, <?= $jws['eventdetail']['h'] ?> ); var Win = newWindow( '<?= $PHP_SELF ?>?view=eventdetail&'+eids.join( '&' ), 'zmEventDetail', <?= $jws['eventdetail']['w'] ?>, <?= $jws['eventdetail']['h'] ?> );
} }
function exportEvents( form, name ) function exportEvents( form, name )
{ {
@ -208,7 +216,7 @@ function exportEvents( form, name )
} }
} }
} }
var Name = newWindow( '<?= $PHP_SELF ?>?view=export&'+eids.join( '&' ), 'zmExport', <?= $jws['export']['w'] ?>, <?= $jws['export']['h'] ?> ); var Win = newWindow( '<?= $PHP_SELF ?>?view=export&'+eids.join( '&' ), 'zmExport', <?= $jws['export']['w'] ?>, <?= $jws['export']['h'] ?> );
} }
function viewEvents( form, name ) function viewEvents( form, name )
{ {
@ -358,8 +366,7 @@ function viewEvents( form, name )
<tr> <tr>
<td align="left" class="text"><a href="javascript: location.reload(true);"><?= $zmSlangRefresh ?></td> <td align="left" class="text"><a href="javascript: location.reload(true);"><?= $zmSlangRefresh ?></td>
<td colspan="1" align="center" class="text"><a href="javascript: filterWindow( '<?= $PHP_SELF ?>?view=filter&page=<?= $page ?><?= $filter_query ?>', 'zmFilter' );"><?= $zmSlangShowFilterWindow ?></a></td> <td colspan="1" align="center" class="text"><a href="javascript: filterWindow( '<?= $PHP_SELF ?>?view=filter&page=<?= $page ?><?= $filter_query ?>', 'zmFilter' );"><?= $zmSlangShowFilterWindow ?></a></td>
<td colspan="1" align="right" class="text"><a href="javascript: timelineWindow( '<?= $PHP_SELF ?>?view=timeline&<?= $filter_query ?>', 'zmTimeline' );"><?= $zmSlangShowTimeline ?></a></td> <td colspan="2" align="right" class="text"><a href="javascript: timelineWindow( '<?= $PHP_SELF ?>?view=timeline&<?= $filter_query ?>', 'zmTimeline' );"><?= $zmSlangShowTimeline ?></a></td>
<td align="right" class="text"><?php if ( canEdit( 'Events' ) ) { ?><a href="javascript: checkAll( document.event_form, 'mark_eids' );"><?= $zmSlangCheckAll ?></a><?php } else { ?>&nbsp;<?php } ?></td>
</tr> </tr>
<tr><td colspan="4" class="text">&nbsp;</td></tr> <tr><td colspan="4" class="text">&nbsp;</td></tr>
<tr><td colspan="4"><table border="0" cellspacing="1" cellpadding="0" width="100%" bgcolor="#7F7FB2"> <tr><td colspan="4"><table border="0" cellspacing="1" cellpadding="0" width="100%" bgcolor="#7F7FB2">
@ -391,7 +398,7 @@ function viewEvents( form, name )
<?php <?php
} }
?> ?>
<td class="text"><?= $zmSlangMark ?></td> <td class="text"><input type="checkbox" name="toggle_check" value="1" onClick="toggleCheck( this, 'mark_eids' );"<?php if ( !canEdit( 'Events' ) ) { ?> disabled<?php } ?>></td>
</tr> </tr>
<?php <?php
} }
@ -425,7 +432,7 @@ function viewEvents( form, name )
<?php <?php
} }
?> ?>
<td align="center" class="text"><input type="checkbox" name="mark_eids[]" value="<?= $event['Id'] ?>" onClick="configureButton( document.event_form, 'mark_eids' );"<?php if ( !canEdit( 'Events' ) ) { ?> disabled<?php } ?>></td> <td align="center" class="text"><input type="checkbox" name="mark_eids[]" value="<?= $event['Id'] ?>" onClick="configureButton( this, 'mark_eids' );"<?php if ( !canEdit( 'Events' ) ) { ?> disabled<?php } ?>></td>
</tr> </tr>
<?php <?php
} }

View File

@ -56,25 +56,31 @@ $monitor = mysql_fetch_assoc( $result );
<script type="text/javascript"> <script type="text/javascript">
function newWindow(Url,Name,Width,Height) function newWindow(Url,Name,Width,Height)
{ {
var Name = window.open(Url,Name,"resizable,scrollbars,width="+Width+",height="+Height); var Win = window.open(Url,Name,"resizable,scrollbars,width="+Width+",height="+Height);
} }
function eventWindow(Url,Name) function eventWindow(Url,Name)
{ {
var Name = window.open(Url,Name,"resizable,width=<?= $monitor['Width']+$jws['event']['w'] ?>,height=<?= $monitor['Height']+$jws['event']['h'] ?>"); var Win = window.open(Url,Name,"resizable,width=<?= $monitor['Width']+$jws['event']['w'] ?>,height=<?= $monitor['Height']+$jws['event']['h'] ?>");
} }
function closeWindow() function closeWindow()
{ {
top.window.close(); top.window.close();
} }
function checkAll(form,name){ function toggleCheck(element,name)
{
var form = element.form;
var checked = element.checked;
for (var i = 0; i < form.elements.length; i++) for (var i = 0; i < form.elements.length; i++)
if (form.elements[i].name.indexOf(name) == 0) if (form.elements[i].name.indexOf(name) == 0)
form.elements[i].checked = 1; form.elements[i].checked = checked;
form.delete_btn.disabled = false; form.delete_btn.disabled = !checked;
} }
function configureButton(form,name) function configureButton(element,name)
{ {
var checked = false; var form = element.form;
var checked = element.checked;
if ( !checked )
{
for (var i = 0; i < form.elements.length; i++) for (var i = 0; i < form.elements.length; i++)
{ {
if ( form.elements[i].name.indexOf(name) == 0) if ( form.elements[i].name.indexOf(name) == 0)
@ -86,6 +92,9 @@ function configureButton(form,name)
} }
} }
} }
}
if ( !element.checked )
form.toggle_check.checked = false;
form.delete_btn.disabled = !checked; form.delete_btn.disabled = !checked;
} }
<?php <?php
@ -119,13 +128,12 @@ if ( !$result )
$n_events = mysql_num_rows( $result ); $n_events = mysql_num_rows( $result );
?> ?>
<tr> <tr>
<td class="text"><b><?= sprintf( $zmClangLastEvents, $n_events, strtolower( zmVlang( $zmVlangEvent, $n_events ) ) ) ?></b></td> <td width="30%"align="left" class="text"><b><?= sprintf( $zmClangLastEvents, $n_events, strtolower( zmVlang( $zmVlangEvent, $n_events ) ) ) ?></b></td>
<td align="center" class="text"><?= makeLink( "javascript: newWindow( '$PHP_SELF?view=events&page=1&filter=1&trms=1&attr1=MonitorId&op1=%3d&val1=".$monitor['Id']."', 'zmEvents', ".$jws['events']['w'].", ".$jws['events']['h']." );", $zmSlangAll, canView( 'Events' ) ) ?></td> <td align="center" class="text"><?= makeLink( "javascript: newWindow( '$PHP_SELF?view=events&page=1&filter=1&trms=1&attr1=MonitorId&op1=%3d&val1=".$monitor['Id']."', 'zmEvents', ".$jws['events']['w'].", ".$jws['events']['h']." );", $zmSlangAll, canView( 'Events' ) ) ?></td>
<td align="center" class="text"><?= makeLink( "javascript: newWindow( '$PHP_SELF?view=events&page=1&filter=1&trms=2&attr1=MonitorId&op1=%3d&val1=".$monitor['Id']."&cnj2=and&attr2=Archived&val2=1', 'zmEvents', ".$jws['events']['w'].", ".$jws['events']['h']." );", $zmSlangArchive, canView( 'Events' ) ) ?></td> <td width="30%"align="right" class="text"><?= makeLink( "javascript: newWindow( '$PHP_SELF?view=events&page=1&filter=1&trms=2&attr1=MonitorId&op1=%3d&val1=".$monitor['Id']."&cnj2=and&attr2=Archived&val2=1', 'zmEvents', ".$jws['events']['w'].", ".$jws['events']['h']." );", $zmSlangArchive, canView( 'Events' ) ) ?></td>
<td align="right" class="text"><?php if ( canEdit( 'Events' ) ) { ?><a href="javascript: checkAll( document.event_form, 'mark_eids' );"><?= $zmSlangCheckAll ?></a><?php } else { ?>&nbsp;<?php } ?></td>
</tr> </tr>
<tr><td colspan="5" class="text">&nbsp;</td></tr> <tr><td colspan="3" class="text">&nbsp;</td></tr>
<tr><td colspan="5"><table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#7F7FB2"> <tr><td colspan="3"><table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#7F7FB2">
<tr align="center" bgcolor="#FFFFFF"> <tr align="center" bgcolor="#FFFFFF">
<td width="4%" class="text"><a href="<?= $PHP_SELF ?>?view=watchevents&mid=<?= $mid ?>&max_events=<?= $max_events ?>&sort_field=Id&sort_asc=<?= $sort_field == 'Id'?!$sort_asc:0 ?>"><?= $zmSlangId ?><?php if ( $sort_field == "Id" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td> <td width="4%" class="text"><a href="<?= $PHP_SELF ?>?view=watchevents&mid=<?= $mid ?>&max_events=<?= $max_events ?>&sort_field=Id&sort_asc=<?= $sort_field == 'Id'?!$sort_asc:0 ?>"><?= $zmSlangId ?><?php if ( $sort_field == "Id" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
<td width="24%" class="text"><a href="<?= $PHP_SELF ?>?view=watchevents&mid=<?= $mid ?>&max_events=<?= $max_events ?>&sort_field=Name&sort_asc=<?= $sort_field == 'Name'?!$sort_asc:0 ?>"><?= $zmSlangName ?><?php if ( $sort_field == "Name" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td> <td width="24%" class="text"><a href="<?= $PHP_SELF ?>?view=watchevents&mid=<?= $mid ?>&max_events=<?= $max_events ?>&sort_field=Name&sort_asc=<?= $sort_field == 'Name'?!$sort_asc:0 ?>"><?= $zmSlangName ?><?php if ( $sort_field == "Name" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
@ -133,7 +141,7 @@ $n_events = mysql_num_rows( $result );
<td class="text"><a href="<?= $PHP_SELF ?>?view=watchevents&mid=<?= $mid ?>&max_events=<?= $max_events ?>&sort_field=Length&sort_asc=<?= $sort_field == 'Length'?!$sort_asc:0 ?>"><?= $zmSlangSecs ?><?php if ( $sort_field == "Length" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td> <td class="text"><a href="<?= $PHP_SELF ?>?view=watchevents&mid=<?= $mid ?>&max_events=<?= $max_events ?>&sort_field=Length&sort_asc=<?= $sort_field == 'Length'?!$sort_asc:0 ?>"><?= $zmSlangSecs ?><?php if ( $sort_field == "Length" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
<td class="text"><a href="<?= $PHP_SELF ?>?view=watchevents&mid=<?= $mid ?>&max_events=<?= $max_events ?>&sort_field=Frames&sort_asc=<?= $sort_field == 'Frames'?!$sort_asc:0 ?>"><?= $zmSlangFrames ?><?php if ( $sort_field == "Frames" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td> <td class="text"><a href="<?= $PHP_SELF ?>?view=watchevents&mid=<?= $mid ?>&max_events=<?= $max_events ?>&sort_field=Frames&sort_asc=<?= $sort_field == 'Frames'?!$sort_asc:0 ?>"><?= $zmSlangFrames ?><?php if ( $sort_field == "Frames" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
<td class="text"><a href="<?= $PHP_SELF ?>?view=watchevents&mid=<?= $mid ?>&max_events=<?= $max_events ?>&sort_field=Score&sort_asc=<?= $sort_field == 'Score'?!$sort_asc:0 ?>"><?= $zmSlangScore ?><?php if ( $sort_field == "Score" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td> <td class="text"><a href="<?= $PHP_SELF ?>?view=watchevents&mid=<?= $mid ?>&max_events=<?= $max_events ?>&sort_field=Score&sort_asc=<?= $sort_field == 'Score'?!$sort_asc:0 ?>"><?= $zmSlangScore ?><?php if ( $sort_field == "Score" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
<td class="text"><?= $zmSlangMark ?></td> <td class="text"><input type="checkbox" name="toggle_check" value="1" onClick="toggleCheck( this, 'mark_eids' );"<?php if ( !canEdit( 'Events' ) ) { ?> disabled<?php } ?>></td>
</tr> </tr>
<?php <?php
while( $event = mysql_fetch_assoc( $result ) ) while( $event = mysql_fetch_assoc( $result ) )
@ -146,7 +154,7 @@ while( $event = mysql_fetch_assoc( $result ) )
<td align="center" class="text"><?= $event['Length'] ?></td> <td align="center" class="text"><?= $event['Length'] ?></td>
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=frames&eid=<?= $event['Id'] ?>', 'zmFrames', <?= $jws['frames']['w'] ?>, <?= $jws['frames']['h'] ?> );"><?= $event['Frames'] ?>/<?= $event['AlarmFrames'] ?></a></td> <td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=frames&eid=<?= $event['Id'] ?>', 'zmFrames', <?= $jws['frames']['w'] ?>, <?= $jws['frames']['h'] ?> );"><?= $event['Frames'] ?>/<?= $event['AlarmFrames'] ?></a></td>
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=frame&eid=<?= $event['Id'] ?>&fid=0', 'zmImage', <?= $monitor['Width']+$jws['image']['w'] ?>, <?= $monitor['Height']+$jws['image']['h'] ?> );"><?= $event['AvgScore'] ?>/<?= $event['MaxScore'] ?></a></td> <td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=frame&eid=<?= $event['Id'] ?>&fid=0', 'zmImage', <?= $monitor['Width']+$jws['image']['w'] ?>, <?= $monitor['Height']+$jws['image']['h'] ?> );"><?= $event['AvgScore'] ?>/<?= $event['MaxScore'] ?></a></td>
<td align="center" class="text"><input type="checkbox" name="mark_eids[]" value="<?= $event['Id'] ?>" onClick="configureButton( document.event_form, 'mark_eids' );"<?php if ( !canEdit( 'Events' ) ) { ?> disabled<?php } ?>></td> <td align="center" class="text"><input type="checkbox" name="mark_eids[]" value="<?= $event['Id'] ?>" onClick="configureButton( this, 'mark_eids' );"<?php if ( !canEdit( 'Events' ) ) { ?> disabled<?php } ?>></td>
</tr> </tr>
<?php <?php
} }

View File

@ -171,7 +171,6 @@ $zmSlangCaptureHeight = 'Capture Height';
$zmSlangCapturePalette = 'Capture Palette'; $zmSlangCapturePalette = 'Capture Palette';
$zmSlangCaptureWidth = 'Capture Width'; $zmSlangCaptureWidth = 'Capture Width';
$zmSlangCause = 'Cause'; $zmSlangCause = 'Cause';
$zmSlangCheckAll = 'Check All';
$zmSlangCheckMethod = 'Alarm Check Method'; $zmSlangCheckMethod = 'Alarm Check Method';
$zmSlangChooseFilter = 'Choose Filter'; $zmSlangChooseFilter = 'Choose Filter';
$zmSlangClose = 'Close'; $zmSlangClose = 'Close';