unpopup zone view

This commit is contained in:
Andrew Bauer 2020-09-25 10:52:13 -05:00
parent 5a6e793b76
commit ae9139b00c
4 changed files with 22 additions and 5 deletions

View File

@ -487,6 +487,16 @@ function makePopupButton($url, $winName, $winSize, $buttonValue, $condition=1, $
return $string;
}
function makeButton($url, $buttonValue, $condition=1, $options='') {
$string = '<button type="button" data-on-click-this="'.$buttonValue.'"';
$string .= ' data-url="' .$url. '"';
if (!$condition) {
$string .= ' disabled="disabled"';
}
$string .= ($options ? (' ' . $options) : '') . '/>'.translate($buttonValue).'</button>'.PHP_EOL;
return $string;
}
function htmlSelect($name, $contents, $values, $behaviours=false) {
$behaviourText = '';
if ( !empty($behaviours) ) {

View File

@ -9,6 +9,12 @@ function streamCmdQuit( ) {
}
}
// Manage the Add New Zone button
function AddNewZone(el) {
url = el.getAttribute('data-url');
window.location.assign(url);
}
var monitors = new Array();
function initPage() {

View File

@ -118,6 +118,7 @@ $StreamHTML = getStreamHTML($monitor, array('mode'=>'single'));
xhtmlHeaders(__FILE__, translate('Zone'));
?>
<body>
<?php echo getNavBarHTML() ?>
<div id="page">
<div id="header">
<h2><?php echo translate('Monitor').' '.$monitor->Name().' - '.translate('Zone').' '.$newZone['Name'] ?></h2>

View File

@ -101,7 +101,7 @@ xhtmlHeaders(__FILE__, translate('Zones'));
foreach( $zones as $zone ) {
?>
<tr>
<td class="colName"><?php echo makePopupLink('?view=zone&mid='.$mid.'&zid='.$zone['Id'], 'zmZone', array('zone', $monitor->ViewWidth(), $monitor->ViewHeight()), validHtmlStr($zone['Name']), true, 'data-on-click-true="streamCmdQuit"'); ?></td>
<td class="colName"><?php echo makeLink('?view=zone&mid='.$mid.'&zid='.$zone['Id'], validHtmlStr($zone['Name']), true, 'data-on-click-true="streamCmdQuit"'); ?></td>
<td class="colType"><?php echo validHtmlStr($zone['Type']) ?></td>
<td class="colUnits"><?php echo $zone['Area'] ?>&nbsp;/&nbsp;<?php echo sprintf('%.2f', ($zone['Area']*100)/($monitor->ViewWidth()*$monitor->ViewHeight()) ) ?></td>
<td class="colMark"><input type="checkbox" name="markZids[]" value="<?php echo $zone['Id'] ?>" data-on-click-this="configureDeleteButton"<?php if ( !canEdit('Monitors') ) { ?> disabled="disabled"<?php } ?>/></td>
@ -112,7 +112,7 @@ xhtmlHeaders(__FILE__, translate('Zones'));
</tbody>
</table>
<div id="contentButtons">
<?php echo makePopupButton('?view=zone&mid='.$mid.'&zid=0', 'zmZone', array('zone', $monitor->ViewWidth(), $monitor->ViewHeight()), translate('AddNewZone'), canEdit('Monitors')); ?>
<?php echo makeButton('?view=zone&mid='.$mid.'&zid=0', 'AddNewZone', canEdit('Monitors')); ?>
<button type="submit" name="deleteBtn" value="Delete" disabled="disabled"><?php echo translate('Delete') ?></button>
</div>
</div><!--zones-->