fix function view after actions cleanup

This commit is contained in:
Isaac Connor 2019-01-10 12:08:25 -05:00
parent 4a82f460b2
commit b373577589
2 changed files with 11 additions and 9 deletions

View File

@ -45,5 +45,6 @@ if ( !empty($_REQUEST['mid']) && canEdit('Monitors', $_REQUEST['mid']) ) {
$refreshParent = true;
}
} // end if action
$view = 'none';
} // end if $mid and canEdit($mid)
?>

View File

@ -18,42 +18,43 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
if ( !canEdit( 'Monitors' ) ) {
if ( !canEdit('Monitors') ) {
$view = 'error';
return;
}
$monitor = dbFetchMonitor( $_REQUEST['mid'] );
$monitor = dbFetchMonitor($_REQUEST['mid']);
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Function')." - ".validHtmlStr($monitor['Name']) );
xhtmlHeaders(__FILE__, translate('Function').' - '.validHtmlStr($monitor['Name']));
?>
<body>
<div id="page">
<div id="header">
<h2><?php echo translate('Function')." - ".validHtmlStr($monitor['Name']) ?></h2>
<h2><?php echo translate('Function').' - '.validHtmlStr($monitor['Name']) ?></h2>
</div>
<div id="content">
<form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="view" value="none"/>
<input type="hidden" name="view" value="function"/>
<input type="hidden" name="action" value="function"/>
<input type="hidden" name="mid" value="<?php echo $monitor['Id'] ?>"/>
<p>
<select name="newFunction">
<?php
foreach ( getEnumValues( 'Monitors', 'Function' ) as $optFunction ) {
foreach ( getEnumValues('Monitors', 'Function') as $optFunction ) {
?>
<option value="<?php echo $optFunction ?>"<?php if ( $optFunction == $monitor['Function'] ) { ?> selected="selected"<?php } ?>><?php echo translate('Fn'.$optFunction) ?></option>
<?php
}
?>
</select>
<label for="newEnabled"><?php echo translate('Enabled') ?></label><input type="checkbox" name="newEnabled" id="newEnabled" value="1"<?php if ( !empty($monitor['Enabled']) ) { ?> checked="checked"<?php } ?>/>
<label for="newEnabled"><?php echo translate('Enabled') ?></label>
<input type="checkbox" name="newEnabled" id="newEnabled" value="1"<?php if ( !empty($monitor['Enabled']) ) { ?> checked="checked"<?php } ?>/>
</p>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"/>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<button type="submit" value="Save"><?php echo translate('Save') ?></button>
<button type="button" onclick="closeWindow()"><?php echo translate('Cancel') ?></button>
</div>
</form>
</div>