disable feature checkboxes for non-admin

This commit is contained in:
Evgeny Gryaznov 2011-02-22 00:16:31 +01:00
parent d308977a00
commit d61a9d30f7
2 changed files with 19 additions and 17 deletions

View File

@ -54,10 +54,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

@ -58,7 +58,7 @@ $(function(){
<?php
}
function tpl_content() { global $page, $webimroot;
function tpl_content() { global $page, $webimroot, $errors;
?>
<?php echo getlocal("page_settings.intro") ?>
@ -81,7 +81,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"/>
@ -90,7 +90,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"/>
@ -98,7 +98,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"/>
@ -108,7 +108,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"/>
@ -117,7 +117,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"/>
@ -126,7 +126,7 @@ require_once('inc_errors.php');
<div class="field">
<div class="flabel"><?php echo getlocal('settings.enablejabber') ?></div>
<div class="fvalue">
<input type="checkbox" name="enablejabber" value="on"<?php echo form_value_cb('enablejabber') ? " checked=\"checked\"" : "" ?>/>
<input type="checkbox" name="enablejabber" value="on"<?php echo form_value_cb('enablejabber') ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.enablejabber.description') ?></div>
<br clear="all"/>
@ -135,7 +135,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"/>
@ -144,7 +144,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"/>
@ -152,7 +152,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"/>
@ -161,7 +161,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"/>
@ -170,7 +170,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"/>
@ -180,7 +180,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"/>
@ -189,7 +189,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"/>
@ -198,16 +198,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>