The 'Group' checkbox in system settings do not affect the ability to edit groups of operators, but affects only their actual availability to visitors.

This commit is contained in:
Dmitriy Simushev 2012-01-21 15:09:49 +00:00
parent 87064f2da4
commit 219b593b94
9 changed files with 36 additions and 61 deletions

View File

@ -53,16 +53,14 @@ function generate_button($title, $locale, $style, $invitationstyle, $group, $inn
function verifyparam_groupid($paramid)
{
global $settings, $errors;
global $errors;
$groupid = "";
if ($settings['enablegroups'] == '1') {
$groupid = verifyparam($paramid, "/^\d{0,8}$/", "");
if ($groupid) {
$group = group_by_id($groupid);
if (!$group) {
$errors[] = getlocal("page.group.no_such");
$groupid = "";
}
$groupid = verifyparam($paramid, "/^\d{0,8}$/", "");
if ($groupid) {
$group = group_by_id($groupid);
if (!$group) {
$errors[] = getlocal("page.group.no_such");
$groupid = "";
}
}
return $groupid;
@ -70,16 +68,13 @@ function verifyparam_groupid($paramid)
function get_groups_list()
{
global $settings;
$result = array();
if ($settings['enablegroups'] == '1') {
$link = connect();
$allgroups = get_all_groups($link);
close_connection($link);
$result[] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group"));
foreach ($allgroups as $g) {
$result[] = $g;
}
$link = connect();
$allgroups = get_all_groups($link);
close_connection($link);
$result[] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group"));
foreach ($allgroups as $g) {
$result[] = $g;
}
return $result;
}

View File

@ -381,7 +381,6 @@ function prepare_menu($operator, $hasright = true)
if ($hasright) {
loadsettings();
$page['showban'] = $settings['enableban'] == "1";
$page['showgroups'] = $settings['enablegroups'] == "1";
$page['showstat'] = $settings['enablestatistics'] == "1";
$page['showadmin'] = is_capable($can_administrate, $operator);
$page['currentopid'] = $operator['operatorid'];

View File

@ -25,20 +25,12 @@ function setup_operator_settings_tabs($opId, $active)
loadsettings();
if ($opId) {
if ($settings['enablegroups'] == '1') {
$page['tabs'] = array(
getlocal("page_agent.tab.main") => $active != 0 ? "$webimroot/operator/operator.php?op=$opId" : "",
getlocal("page_agent.tab.avatar") => $active != 1 ? "$webimroot/operator/avatar.php?op=$opId" : "",
getlocal("page_agent.tab.groups") => $active != 2 ? "$webimroot/operator/opgroups.php?op=$opId" : "",
getlocal("page_agent.tab.permissions") => $active != 3 ? "$webimroot/operator/permissions.php?op=$opId" : ""
);
} else {
$page['tabs'] = array(
getlocal("page_agent.tab.main") => $active != 0 ? "$webimroot/operator/operator.php?op=$opId" : "",
getlocal("page_agent.tab.avatar") => $active != 1 ? "$webimroot/operator/avatar.php?op=$opId" : "",
getlocal("page_agent.tab.permissions") => $active != 3 ? "$webimroot/operator/permissions.php?op=$opId" : ""
);
}
$page['tabs'] = array(
getlocal("page_agent.tab.main") => $active != 0 ? "$webimroot/operator/operator.php?op=$opId" : "",
getlocal("page_agent.tab.avatar") => $active != 1 ? "$webimroot/operator/avatar.php?op=$opId" : "",
getlocal("page_agent.tab.groups") => $active != 2 ? "$webimroot/operator/opgroups.php?op=$opId" : "",
getlocal("page_agent.tab.permissions") => $active != 3 ? "$webimroot/operator/permissions.php?op=$opId" : ""
);
} else {
$page['tabs'] = array();
}

View File

@ -82,24 +82,22 @@ if (!$lang || !in_array($lang, $all_locales)) {
# groups
$groupid = "";
if ($settings['enablegroups'] == '1') {
$groupid = verifyparam("group", "/^\d{0,8}$/", "");
if ($groupid) {
$group = group_by_id($groupid);
if (!$group) {
$errors[] = getlocal("page.group.no_such");
$groupid = "";
}
$groupid = verifyparam("group", "/^\d{0,8}$/", "");
if ($groupid) {
$group = group_by_id($groupid);
if (!$group) {
$errors[] = getlocal("page.group.no_such");
$groupid = "";
}
}
$link = connect();
$allgroups = get_all_groups($link);
close_connection($link);
$page['groups'] = array();
$page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group"));
foreach ($allgroups as $g) {
$page['groups'][] = $g;
}
$link = connect();
$allgroups = get_all_groups($link);
close_connection($link);
$page['groups'] = array();
$page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group"));
foreach ($allgroups as $g) {
$page['groups'][] = $g;
}
# delete

View File

@ -69,9 +69,7 @@ if ($stringid) {
$message = "";
$page['locale'] = verifyparam("lang", "/^[\w-]{2,5}$/", "");
$page['groupid'] = "";
if ($settings['enablegroups'] == '1') {
$page['groupid'] = verifyparam("group", "/^\d{0,8}$/");
}
$page['groupid'] = verifyparam("group", "/^\d{0,8}$/");
}
if (isset($_POST['message'])) {

View File

@ -44,8 +44,7 @@ require_once('inc_errors.php');
echo "<option value=\"".$k["id"]."\"".($k["id"] == form_value("lang") ? " selected=\"selected\"" : "").">".$k["name"]."</option>";
} ?></select>
</div>
<?php if($page['showgroups']) { ?>
<div class="packedFormField">
<?php echo getlocal("canned.group") ?><br/>
<select name="group" onchange="this.form.submit();"><?php
@ -53,7 +52,7 @@ require_once('inc_errors.php');
echo "<option value=\"".$k["groupid"]."\"".($k["groupid"] == form_value("group") ? " selected=\"selected\"" : "").">".$k["vclocalname"]."</option>";
} ?></select>
</div>
<?php } ?>
<br clear="all"/>

View File

@ -71,14 +71,12 @@ require_once('inc_errors.php');
<?php } ?>
<br clear="all"/>
<?php if($page['showgroups']) { ?>
<div class="fieldinrow">
<div class="flabel"><?php echo getlocal("page.gen_button.choose_group") ?></div>
<div class="fvaluenodesc">
<select name="group" onchange="this.form.submit();"><?php foreach($page['groups'] as $k) { echo "<option value=\"".$k['groupid']."\"".($k['groupid'] == form_value("group") ? " selected=\"selected\"" : "").">".$k['vclocalname']."</option>"; } ?></select>
</div>
</div>
<?php } ?>
<br clear="all"/>
<div class="fieldinrow">

View File

@ -56,9 +56,7 @@ function tpl_menu() { global $page, $webimroot, $errors;
<?php if(isset($page['showadmin']) && $page['showadmin']) { ?>
<li<?php menuli("getcode")?>><a href='<?php echo $webimroot ?>/operator/getcode.php'><?php echo getlocal('leftMenu.client_gen_button') ?></a></li>
<li<?php menuli("operators")?>><a href='<?php echo $webimroot ?>/operator/operators.php'><?php echo getlocal('leftMenu.client_agents') ?></a></li>
<?php if(isset($page['showgroups']) && $page['showgroups']) { ?>
<li<?php menuli("groups")?>><a href='<?php echo $webimroot ?>/operator/groups.php'><?php echo getlocal('menu.groups') ?></a></li>
<?php } ?>
<li<?php menuli("settings")?>><a href='<?php echo $webimroot ?>/operator/settings.php'><?php echo getlocal('leftMenu.client_settings') ?></a></li>
<li<?php menuli("translate")?>><a href='<?php echo $webimroot ?>/operator/translate.php'><?php echo getlocal('menu.translate') ?></a></li>
<li<?php menuli("updates")?>><a href='<?php echo $webimroot ?>/operator/updates.php'><?php echo getlocal('menu.updates') ?></a></li>

View File

@ -118,7 +118,6 @@ $menuItemsCount = 2;
</td>
<?php menuseparator(); ?>
<?php if($page['showgroups']) { ?>
<td class="dashitem">
<img src="<?php echo $webimroot ?>/images/dash/dep.gif" alt=""/>
<a href='<?php echo $webimroot ?>/operator/groups.php'>
@ -126,7 +125,6 @@ $menuItemsCount = 2;
<?php echo getlocal('menu.groups.content') ?>
</td>
<?php menuseparator(); ?>
<?php } ?>
<td class="dashitem">
<img src="<?php echo $webimroot ?>/images/dash/settings.gif" alt=""/>