disable feature checkboxes for non-admin

This commit is contained in:
Evgeny Gryaznov 2011-02-22 00:22:36 +01:00
parent 56edca952c
commit 7443faf449
2 changed files with 18 additions and 16 deletions

View File

@ -50,10 +50,11 @@ if (isset($_POST['sent'])) {
header("Location: $webimroot/operator/features.php?stored");
exit;
} else {
$errors[] = "Not an administrator.";
$errors[] = "Not an administrator";
}
}
$page['canmodify'] = is_capable($can_administrate, $operator);
$page['stored'] = isset($_GET['stored']);
foreach($options as $opt) {
$page["form$opt"] = $params[$opt] == "1";

View File

@ -57,7 +57,7 @@ $(function(){
<?php
}
function tpl_content() { global $page, $webimroot;
function tpl_content() { global $page, $webimroot, $errors;
?>
<?php echo getlocal("page_settings.intro") ?>
@ -88,7 +88,7 @@ require_once('inc_errors.php');
<div class="field">
<div class="flabel"><?php echo getlocal('settings.usercanchangename') ?></div>
<div class="fvalue">
<input type="checkbox" name="usercanchangename" value="on"<?php echo form_value_cb('usercanchangename') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="usercanchangename" value="on"<?php echo form_value_cb('usercanchangename') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.usercanchangename.description') ?></div>
<br clear="all"/>
@ -97,7 +97,7 @@ require_once('inc_errors.php');
<div class="field">
<div class="flabel"><?php echo getlocal('settings.enablessl') ?></div>
<div class="fvalue">
<input id="enablessl" type="checkbox" name="enablessl" value="on"<?php echo form_value_cb('enablessl') ? " checked=\"checked\"" : "" ?>/>
<input id="enablessl" type="checkbox" name="enablessl" value="on"<?php echo form_value_cb('enablessl') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.enablessl.description') ?></div>
<br clear="all"/>
@ -105,7 +105,7 @@ require_once('inc_errors.php');
<div class="subfield underssl">
<div class="flabel"><?php echo getlocal('settings.forcessl') ?></div>
<div class="fvalue">
<input type="checkbox" name="forcessl" value="on"<?php echo form_value_cb('forcessl') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="forcessl" value="on"<?php echo form_value_cb('forcessl') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.forcessl.description') ?></div>
<br clear="all"/>
@ -115,7 +115,7 @@ require_once('inc_errors.php');
<div class="field">
<div class="flabel"><?php echo getlocal('settings.enableban') ?></div>
<div class="fvalue">
<input type="checkbox" name="enableban" value="on"<?php echo form_value_cb('enableban') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="enableban" value="on"<?php echo form_value_cb('enableban') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.enableban.description') ?></div>
<br clear="all"/>
@ -124,7 +124,7 @@ require_once('inc_errors.php');
<div class="field">
<div class="flabel"><?php echo getlocal('settings.enablegroups') ?></div>
<div class="fvalue">
<input type="checkbox" name="enablegroups" value="on"<?php echo form_value_cb('enablegroups') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="enablegroups" value="on"<?php echo form_value_cb('enablegroups') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.enablegroups.description') ?></div>
<br clear="all"/>
@ -133,7 +133,7 @@ require_once('inc_errors.php');
<div class="field">
<div class="flabel"><?php echo getlocal('settings.enablestatistics') ?></div>
<div class="fvalue">
<input type="checkbox" name="enablestatistics" value="on"<?php echo form_value_cb('enablestatistics') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="enablestatistics" value="on"<?php echo form_value_cb('enablestatistics') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.enablestatistics.description') ?></div>
<br clear="all"/>
@ -142,7 +142,7 @@ require_once('inc_errors.php');
<div class="field">
<div class="flabel"><?php echo getlocal('settings.enablepresurvey') ?></div>
<div class="fvalue">
<input id="enablepresurvey" type="checkbox" name="enablepresurvey" value="on"<?php echo form_value_cb('enablepresurvey') ? " checked=\"checked\"" : "" ?>/>
<input id="enablepresurvey" type="checkbox" name="enablepresurvey" value="on"<?php echo form_value_cb('enablepresurvey') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.enablepresurvey.description') ?></div>
<br clear="all"/>
@ -150,7 +150,7 @@ require_once('inc_errors.php');
<div class="subfield undersurvey">
<div class="flabel"><?php echo getlocal('settings.survey.askmail') ?></div>
<div class="fvalue">
<input type="checkbox" name="surveyaskmail" value="on"<?php echo form_value_cb('surveyaskmail') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="surveyaskmail" value="on"<?php echo form_value_cb('surveyaskmail') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.survey.askmail.description') ?></div>
<br clear="all"/>
@ -159,7 +159,7 @@ require_once('inc_errors.php');
<div class="subfield undersurvey">
<div class="flabel"><?php echo getlocal('settings.survey.askgroup') ?></div>
<div class="fvalue">
<input type="checkbox" name="surveyaskgroup" value="on"<?php echo form_value_cb('surveyaskgroup') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="surveyaskgroup" value="on"<?php echo form_value_cb('surveyaskgroup') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.survey.askgroup.description') ?></div>
<br clear="all"/>
@ -168,7 +168,7 @@ require_once('inc_errors.php');
<div class="subfield undersurvey">
<div class="flabel"><?php echo getlocal('settings.survey.askmessage') ?></div>
<div class="fvalue">
<input type="checkbox" name="surveyaskmessage" value="on"<?php echo form_value_cb('surveyaskmessage') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="surveyaskmessage" value="on"<?php echo form_value_cb('surveyaskmessage') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.survey.askmessage.description') ?></div>
<br clear="all"/>
@ -178,7 +178,7 @@ require_once('inc_errors.php');
<div class="field">
<div class="flabel"><?php echo getlocal('settings.popup_notification') ?></div>
<div class="fvalue">
<input type="checkbox" name="enablepopupnotification" value="on"<?php echo form_value_cb('enablepopupnotification') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="enablepopupnotification" value="on"<?php echo form_value_cb('enablepopupnotification') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.popup_notification.description') ?></div>
<br clear="all"/>
@ -187,7 +187,7 @@ require_once('inc_errors.php');
<div class="field">
<div class="flabel"><?php echo getlocal('settings.show_online_operators') ?></div>
<div class="fvalue">
<input type="checkbox" name="showonlineoperators" value="on"<?php echo form_value_cb('showonlineoperators') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="showonlineoperators" value="on"<?php echo form_value_cb('showonlineoperators') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.show_online_operators.description') ?></div>
<br clear="all"/>
@ -196,16 +196,17 @@ require_once('inc_errors.php');
<div class="field">
<div class="flabel"><?php echo getlocal('settings.leavemessage_captcha') ?></div>
<div class="fvalue">
<input type="checkbox" name="enablecaptcha" value="on"<?php echo form_value_cb('enablecaptcha') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="enablecaptcha" value="on"<?php echo form_value_cb('enablecaptcha') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.leavemessage_captcha.description') ?></div>
<br clear="all"/>
</div>
<?php if($page['canmodify']) { ?>
<div class="fbutton">
<input type="image" name="save" value="" src='<?php echo $webimroot.getlocal("image.button.save") ?>' alt='<?php echo getlocal("button.save") ?>'/>
</div>
<?php } ?>
</div>
</div><div class="formbottom"><div class="formbottomi"></div></div></div>