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

View File

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

View File

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

View File

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

View File

@ -69,9 +69,7 @@ if ($stringid) {
$message = ""; $message = "";
$page['locale'] = verifyparam("lang", "/^[\w-]{2,5}$/", ""); $page['locale'] = verifyparam("lang", "/^[\w-]{2,5}$/", "");
$page['groupid'] = ""; $page['groupid'] = "";
if ($settings['enablegroups'] == '1') { $page['groupid'] = verifyparam("group", "/^\d{0,8}$/");
$page['groupid'] = verifyparam("group", "/^\d{0,8}$/");
}
} }
if (isset($_POST['message'])) { 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>"; echo "<option value=\"".$k["id"]."\"".($k["id"] == form_value("lang") ? " selected=\"selected\"" : "").">".$k["name"]."</option>";
} ?></select> } ?></select>
</div> </div>
<?php if($page['showgroups']) { ?>
<div class="packedFormField"> <div class="packedFormField">
<?php echo getlocal("canned.group") ?><br/> <?php echo getlocal("canned.group") ?><br/>
<select name="group" onchange="this.form.submit();"><?php <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>"; echo "<option value=\"".$k["groupid"]."\"".($k["groupid"] == form_value("group") ? " selected=\"selected\"" : "").">".$k["vclocalname"]."</option>";
} ?></select> } ?></select>
</div> </div>
<?php } ?>
<br clear="all"/> <br clear="all"/>

View File

@ -71,14 +71,12 @@ require_once('inc_errors.php');
<?php } ?> <?php } ?>
<br clear="all"/> <br clear="all"/>
<?php if($page['showgroups']) { ?>
<div class="fieldinrow"> <div class="fieldinrow">
<div class="flabel"><?php echo getlocal("page.gen_button.choose_group") ?></div> <div class="flabel"><?php echo getlocal("page.gen_button.choose_group") ?></div>
<div class="fvaluenodesc"> <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> <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>
</div> </div>
<?php } ?>
<br clear="all"/> <br clear="all"/>
<div class="fieldinrow"> <div class="fieldinrow">

View File

@ -56,9 +56,7 @@ function tpl_menu() { global $page, $webimroot, $errors;
<?php if(isset($page['showadmin']) && $page['showadmin']) { ?> <?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("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> <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> <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("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("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> <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> </td>
<?php menuseparator(); ?> <?php menuseparator(); ?>
<?php if($page['showgroups']) { ?>
<td class="dashitem"> <td class="dashitem">
<img src="<?php echo $webimroot ?>/images/dash/dep.gif" alt=""/> <img src="<?php echo $webimroot ?>/images/dash/dep.gif" alt=""/>
<a href='<?php echo $webimroot ?>/operator/groups.php'> <a href='<?php echo $webimroot ?>/operator/groups.php'>
@ -126,7 +125,6 @@ $menuItemsCount = 2;
<?php echo getlocal('menu.groups.content') ?> <?php echo getlocal('menu.groups.content') ?>
</td> </td>
<?php menuseparator(); ?> <?php menuseparator(); ?>
<?php } ?>
<td class="dashitem"> <td class="dashitem">
<img src="<?php echo $webimroot ?>/images/dash/settings.gif" alt=""/> <img src="<?php echo $webimroot ?>/images/dash/settings.gif" alt=""/>