diff --git a/src/messenger/compute_resources.pl b/src/messenger/compute_resources.pl
index 1eba1f07..9d19d4e1 100755
--- a/src/messenger/compute_resources.pl
+++ b/src/messenger/compute_resources.pl
@@ -14,8 +14,8 @@
["view/permissions.php", 2],
["view/agent.php", 2],
["view/agents.php", 2],
- ["view/department.php", 2],
- ["view/departments.php", 2],
+ ["view/group.php", 2],
+ ["view/groups.php", 2],
["view/gen_button.php", 2],
["view/install_err.php", 2],
["view/install_index.php", 2],
@@ -32,8 +32,8 @@
["operator/permissions.php", 2],
["operator/operator.php", 2],
["operator/operators.php", 2],
- ["operator/department.php", 2],
- ["operator/departments.php", 2],
+ ["operator/group.php", 2],
+ ["operator/groups.php", 2],
["operator/getcode.php", 2],
["operator/.*\\.php", 1],
diff --git a/src/messenger/webim/install/dbinfo.php b/src/messenger/webim/install/dbinfo.php
index 3b093c0a..1035db9e 100644
--- a/src/messenger/webim/install/dbinfo.php
+++ b/src/messenger/webim/install/dbinfo.php
@@ -13,8 +13,8 @@
*/
$dbtables = array(
- "chatdepartment" => array(
- "departmentid" => "int NOT NULL auto_increment PRIMARY KEY",
+ "chatgroup" => array(
+ "groupid" => "int NOT NULL auto_increment PRIMARY KEY",
"vclocalname" => "varchar(64) NOT NULL",
"vccommonname" => "varchar(64) NOT NULL",
"vclocaldescription" => "varchar(1024) NOT NULL",
@@ -43,7 +43,7 @@ $dbtables = array(
"shownmessageid" => "int NOT NULL DEFAULT 0",
"userAgent" => "varchar(255)",
"messageCount" => "varchar(16)",
- "departmentid" => "int references chatdepartment(departmentid)",
+ "groupid" => "int references chatgroup(groupid)",
),
"chatmessage" => array(
@@ -72,8 +72,8 @@ $dbtables = array(
"id" => "INT NOT NULL"
),
- "chatdepartmentoperator" => array(
- "departmentid" => "int NOT NULL references chatdepartment(departmentid)",
+ "chatgroupoperator" => array(
+ "groupid" => "int NOT NULL references chatgroup(groupid)",
"operatorid" => "int NOT NULL references chatoperator(operatorid)",
),
@@ -96,12 +96,12 @@ $dbtables = array(
$memtables = array();
$dbtables_can_update = array(
- "chatthread" => array("agentId", "userTyping", "agentTyping", "messageCount", "nextagent", "shownmessageid", "userid", "userAgent", "departmentid"),
+ "chatthread" => array("agentId", "userTyping", "agentTyping", "messageCount", "nextagent", "shownmessageid", "userid", "userAgent", "groupid"),
"chatmessage" => array("agentId"),
"chatoperator" => array("vcavatar", "vcjabbername", "iperm"),
"chatban" => array(),
- "chatdepartment" => array(),
- "chatdepartmentoperator" => array(),
+ "chatgroup" => array(),
+ "chatgroupoperator" => array(),
);
function show_install_err($text) {
diff --git a/src/messenger/webim/install/dbperform.php b/src/messenger/webim/install/dbperform.php
index e0debb58..01486431 100644
--- a/src/messenger/webim/install/dbperform.php
+++ b/src/messenger/webim/install/dbperform.php
@@ -118,8 +118,8 @@ if ($act == "silentcreateall") {
runsql("ALTER TABLE chatoperator ADD vcjabbername varchar(255)", $link);
}
- if( in_array("chatthread.departmentid", $absent) ) {
- runsql("ALTER TABLE chatthread ADD departmentid int references chatdepartment(departmentid)", $link);
+ if( in_array("chatthread.groupid", $absent) ) {
+ runsql("ALTER TABLE chatthread ADD groupid int references chatgroup(groupid)", $link);
}
if( in_array("chatthread.userAgent", $absent) ) {
diff --git a/src/messenger/webim/install/whatsnew.txt b/src/messenger/webim/install/whatsnew.txt
index b948a4f0..199ddb70 100644
--- a/src/messenger/webim/install/whatsnew.txt
+++ b/src/messenger/webim/install/whatsnew.txt
@@ -5,7 +5,7 @@
[+] right menu, show/hide menu on awaiting users page, nice locale chooser
[+] main page: warning if database is outdated (after install)
[+] "Updates" tab in settings: news, link to the latest version
- [+] Create/edit/remove departments
+ [+] Create/edit/remove groups
1.5.2
-----
diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php
index fc813b73..de636c4e 100644
--- a/src/messenger/webim/libs/common.php
+++ b/src/messenger/webim/libs/common.php
@@ -519,7 +519,7 @@ $settings = array(
'enableban' => '0',
'enablessl' => '0',
'usercanchangename' => '1',
- 'enabledepartments' => '0',
+ 'enablegroups' => '0',
'enablestatistics' => '1',
);
$settingsloaded = false;
diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php
index afb95963..d5c7b3a6 100644
--- a/src/messenger/webim/libs/operator.php
+++ b/src/messenger/webim/libs/operator.php
@@ -220,10 +220,28 @@ function prepare_menu($operator,$hasright=true) {
if($hasright) {
loadsettings();
$page['showban'] = $settings['enableban'] == "1";
- $page['showdep'] = $settings['enabledepartments'] == "1";
+ $page['showgroups'] = $settings['enablegroups'] == "1";
$page['showstat'] = $settings['enablestatistics'] == "1";
$page['showadmin'] = is_capable($can_administrate, $operator);
}
}
+function get_groups($countagents) {
+ $link = connect();
+ $query = "select groupid, vclocalname, vclocaldescription".
+ ($countagents ? ", 0 as inumofagents" : "").
+ " from chatgroup order by vclocalname";
+ $result = select_multi_assoc($query, $link);
+ mysql_close($link);
+ return $result;
+}
+
+function get_operator_groupids($operatorid) {
+ $link = connect();
+ $query = "select groupid from chatgroupoperator where operatorid = $operatorid";
+ $result = select_multi_assoc($query, $link);
+ mysql_close($link);
+ return $result;
+}
+
?>
diff --git a/src/messenger/webim/libs/operator_settings.php b/src/messenger/webim/libs/operator_settings.php
new file mode 100644
index 00000000..79f3388a
--- /dev/null
+++ b/src/messenger/webim/libs/operator_settings.php
@@ -0,0 +1,29 @@
+ $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();
+ }
+}
+
+?>
diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties
index 7b998c8c..28215214 100644
--- a/src/messenger/webim/locales/en/properties
+++ b/src/messenger/webim/locales/en/properties
@@ -107,14 +107,14 @@ form.field.ban_comment.description=Reason of block
form.field.ban_comment=Comment
form.field.ban_days.description=Numbers of days this address is blocked
form.field.ban_days=Days
-form.field.depname=Name
-form.field.depname.description=Name to identify the department.
-form.field.depdesc=Description
-form.field.depdesc.description=Description of the department.
-form.field.depcommonname=International name
-form.field.depcommonname.description=Name in English.
-form.field.depcommondesc=International description
-form.field.depcommondesc.description=Description in English.
+form.field.groupname=Name
+form.field.groupname.description=Name to identify the group.
+form.field.groupdesc=Description
+form.field.groupdesc.description=Description of the group.
+form.field.groupcommonname=International name
+form.field.groupcommonname.description=Name in English.
+form.field.groupcommondesc=International description
+form.field.groupcommondesc.description=Description in English.
form.field.email=Your email
form.field.login.description=Login can consist of small Latin letters and underscore.
form.field.login=Login
@@ -177,8 +177,8 @@ mailthread.perform=Send
mailthread.title=Send chat history
by mail
menu.agents=Agents list
menu.blocked=Blocked visitors
-menu.departments=Departments
-menu.departments.content=Group operators together.
+menu.groups=Groups
+menu.groups.content=Department or skill based operator groups.
menu.locale=Language
menu.locale.content=Change locale.
menu.main=Main
@@ -186,6 +186,8 @@ menu.operator=You are {0}
menu.translate=Localize
my_settings.error.password_match=Entered passwords do not match
no_such_operator=No such operator
+operator.groups.title=Operator groups
+operator.groups.intro=Choose groups according to operator skills.
page.analysis.search.head_host=Visitor's address
page.analysis.search.head_messages=Visitor's messages
page.analysis.search.head_name=Name
@@ -197,15 +199,15 @@ page.chat.old_browser.close=Close...
page.chat.old_browser.list=
\n- Internet Explorer 5.5+\n
- Firefox 1.0+\n
- Opera 8.0+\n
- Mozilla 1.4+\n
- Netscape 7.1+\n
- Safari 1.2+\n
\nAlso, we support some old browsers:\n\n- Internet Explorer 5.0\n
- Opera 7.0\n
page.chat.old_browser.problem=Your web browser is not fully supported by Web Messenger. \nPlease, use one of the following web browsers:
page.chat.old_browser.title=Please, use newer browser
-page.department.create_new=Here you can create new department.
-page.department.duplicate_name=Please choose another name, because department with entered name already exists.
-page.department.intro=On this page you can edit department details.
-page.department.membersnum=Agents
-page.department.no_such=No such department
-page.department.title=Department details
-page.departments.title=Departments
-page.departments.intro=This page displays list of departments in your company. Each department can have separate button and canned responses.
-page.departments.new=Create new department...
+page.group.create_new=Here you can create new group.
+page.group.duplicate_name=Please choose another name, because group with entered name already exists.
+page.group.intro=On this page you can edit group details.
+page.group.membersnum=Agents
+page.group.no_such=No such group
+page.group.title=Group details
+page.groups.title=Groups
+page.groups.intro=This page displays list of groups in your company. Each group can have separate button and canned responses.
+page.groups.new=Create new group...
page.gen_button.choose_image=Choose image
page.gen_button.choose_locale=Target locale
page.gen_button.choose_style=Chat window style
@@ -243,6 +245,7 @@ page_agent.error.duplicate_login=Please choose another login, because agent with
page_agent.error.wrong_login=Login should contain only latin characters, numbers and underscore symbol.
page_agent.intro=This page displays agent details, if you have access rights you can edit them.
page_agent.tab.avatar=Photo
+page_agent.tab.groups=Groups
page_agent.tab.main=General
page_agent.tab.permissions=Permissions
page_agent.title=Operator details
@@ -310,7 +313,7 @@ report.total=Total:
right.administration=Administration
right.main=Main
right.other=Other
-settings.chat.title.description=Department of your company for example.
+settings.chat.title.description=Name of your company for example.
settings.chat.title=Title in the chat window
settings.chatstyle.description=Preview for all pages of each style is available here
settings.chatstyle=Select style for your chat windows
@@ -320,8 +323,8 @@ settings.email.description=Enter email to receive system messages
settings.email=Email
settings.enableban.description=Using it you can block attacks from specific IPs
settings.enableban=Enable feature "Malicious Visitors"
-settings.enabledepartments.description=Use it to have separate queues for different questions.
-settings.enabledepartments=Enable "Departments"
+settings.enablegroups.description=Use it to have separate queues for different questions.
+settings.enablegroups=Enable "Groups"
settings.enablessl.description=Please, note that your web server should be configured to support https requests.
settings.enablessl=Allow secure connections (SSL)
settings.enablestatistics.description=Adds page with messenger usage reports.
diff --git a/src/messenger/webim/locales/names/level2 b/src/messenger/webim/locales/names/level2
index 45d9cbdd..14d86403 100644
--- a/src/messenger/webim/locales/names/level2
+++ b/src/messenger/webim/locales/names/level2
@@ -56,8 +56,8 @@ leftMenu.client_agents
leftMenu.client_gen_button
leftMenu.client_settings
menu.blocked
-menu.departments
-menu.departments.content
+menu.groups
+menu.groups.content
menu.locale
menu.locale.content
menu.operator
diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties
index f33ed679..634088a8 100644
--- a/src/messenger/webim/locales/ru/properties
+++ b/src/messenger/webim/locales/ru/properties
@@ -167,7 +167,6 @@ mailthread.perform=
mailthread.title=Отправить историю разговора
на почтовый ящик
menu.agents=Список агентов
menu.blocked=Нежелательные посетители
-menu.departments=Отделы
menu.locale=Язык
menu.locale.content=Сменить язык.
menu.main=Главная
diff --git a/src/messenger/webim/operator/avatar.php b/src/messenger/webim/operator/avatar.php
index 7427295c..a09c16b4 100644
--- a/src/messenger/webim/operator/avatar.php
+++ b/src/messenger/webim/operator/avatar.php
@@ -14,6 +14,7 @@
require_once('../libs/common.php');
require_once('../libs/operator.php');
+require_once('../libs/operator_settings.php');
$operator = check_login();
@@ -81,14 +82,10 @@ if( !$op ) {
$page['avatar'] = topage($op['vcavatar']);
}
-$page['tabs'] = array(
- getlocal("page_agent.tab.main") => "$webimroot/operator/operator.php?op=$opId",
- getlocal("page_agent.tab.avatar") => "",
- getlocal("page_agent.tab.permissions") => "$webimroot/operator/permissions.php?op=$opId"
-);
$page['currentop'] = topage(get_operator_name($op))." (".$op['vclogin'].")";
prepare_menu($operator);
+setup_operator_settings_tabs($opId,1);
start_html_output();
require('../view/avatar.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/department.php b/src/messenger/webim/operator/department.php
deleted file mode 100644
index c6f59d68..00000000
--- a/src/messenger/webim/operator/department.php
+++ /dev/null
@@ -1,124 +0,0 @@
- '');
-$errors = array();
-$departmentid = '';
-
-function department_by_id($id) {
- $link = connect();
- $department = select_one_row(
- "select * from chatdepartment where departmentid = $id", $link );
- mysql_close($link);
- return $department;
-}
-
-function department_by_name($name) {
- $link = connect();
- $department = select_one_row(
- "select * from chatdepartment where vclocalname = '".mysql_real_escape_string($name)."'", $link );
- mysql_close($link);
- return $department;
-}
-
-function create_department($name,$descr,$commonname,$commondescr) {
- $link = connect();
- $query = sprintf(
- "insert into chatdepartment (vclocalname,vclocaldescription,vccommonname,vccommondescription) values ('%s','%s','%s','%s')",
- mysql_real_escape_string($name),
- mysql_real_escape_string($descr),
- mysql_real_escape_string($commonname),
- mysql_real_escape_string($commondescr));
-
- perform_query($query,$link);
- $id = mysql_insert_id($link);
-
- $newdep = select_one_row("select * from chatdepartment where departmentid = $id", $link );
- mysql_close($link);
- return $newdep;
-}
-
-function update_department($departmentid,$name,$descr,$commonname,$commondescr) {
- $link = connect();
- $query = sprintf(
- "update chatdepartment set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s' where departmentid = %s",
- mysql_real_escape_string($name),
- mysql_real_escape_string($descr),
- mysql_real_escape_string($commonname),
- mysql_real_escape_string($commondescr),
- $departmentid );
-
- perform_query($query,$link);
- mysql_close($link);
-}
-
-
-if( isset($_POST['name'])) {
- $departmentid = verifyparam( "dep", "/^(\d{1,9})?$/", "");
- $name = getparam('name');
- $description = getparam('description');
- $commonname = getparam('commonname');
- $commondescription = getparam('commondescription');
-
- if( !$name )
- $errors[] = no_field("form.field.depname");
-
- $existing_department = department_by_name($name);
- if( (!$departmentid && $existing_department) ||
- ( $departmentid && $existing_department && $departmentid != $existing_department['departmentid']) )
- $errors[] = getlocal("page.department.duplicate_name");
-
- if( count($errors) == 0 ) {
- if (!$departmentid) {
- $newdep = create_department($name,$description,$commonname,$commondescription);
- header("Location: $webimroot/operator/departments.php");
- exit;
- } else {
- update_department($departmentid,$name,$description,$commonname,$commondescription);
- header("Location: $webimroot/operator/departments.php");
- exit;
- }
- } else {
- $page['formname'] = topage($name);
- $page['formdescription'] = topage($description);
- $page['formcommonname'] = topage($commonname);
- $page['formcommondescription'] = topage($commondescription);
- $page['depid'] = topage($departmentid);
- }
-
-} else if( isset($_GET['dep']) ) {
- $departmentid = verifyparam( 'dep', "/^\d{1,9}$/");
- $department = department_by_id($departmentid);
-
- if( !$department ) {
- $errors[] = getlocal("page.department.no_such");
- $page['depid'] = topage($departmentid);
- } else {
- $page['formname'] = topage($department['vclocalname']);
- $page['formdescription'] = topage($department['vclocaldescription']);
- $page['formcommonname'] = topage($department['vccommonname']);
- $page['formcommondescription'] = topage($department['vccommondescription']);
- $page['depid'] = topage($department['departmentid']);
- }
-}
-
-prepare_menu($operator);
-start_html_output();
-require('../view/department.php');
-?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/features.php b/src/messenger/webim/operator/features.php
index c2b23ec9..f8defadc 100644
--- a/src/messenger/webim/operator/features.php
+++ b/src/messenger/webim/operator/features.php
@@ -21,7 +21,7 @@ $operator = check_login();
$page = array('agentId' => '');
$errors = array();
-$options = array('enableban', 'usercanchangename', 'enablessl', 'enabledepartments', 'enablestatistics');
+$options = array('enableban', 'usercanchangename', 'enablessl', 'enablegroups', 'enablestatistics');
loadsettings();
$params = array();
diff --git a/src/messenger/webim/operator/group.php b/src/messenger/webim/operator/group.php
new file mode 100644
index 00000000..a8d76dad
--- /dev/null
+++ b/src/messenger/webim/operator/group.php
@@ -0,0 +1,124 @@
+ '');
+$errors = array();
+$groupid = '';
+
+function group_by_id($id) {
+ $link = connect();
+ $group = select_one_row(
+ "select * from chatgroup where groupid = $id", $link );
+ mysql_close($link);
+ return $group;
+}
+
+function group_by_name($name) {
+ $link = connect();
+ $group = select_one_row(
+ "select * from chatgroup where vclocalname = '".mysql_real_escape_string($name)."'", $link );
+ mysql_close($link);
+ return $group;
+}
+
+function create_group($name,$descr,$commonname,$commondescr) {
+ $link = connect();
+ $query = sprintf(
+ "insert into chatgroup (vclocalname,vclocaldescription,vccommonname,vccommondescription) values ('%s','%s','%s','%s')",
+ mysql_real_escape_string($name),
+ mysql_real_escape_string($descr),
+ mysql_real_escape_string($commonname),
+ mysql_real_escape_string($commondescr));
+
+ perform_query($query,$link);
+ $id = mysql_insert_id($link);
+
+ $newdep = select_one_row("select * from chatgroup where groupid = $id", $link );
+ mysql_close($link);
+ return $newdep;
+}
+
+function update_group($groupid,$name,$descr,$commonname,$commondescr) {
+ $link = connect();
+ $query = sprintf(
+ "update chatgroup set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s' where groupid = %s",
+ mysql_real_escape_string($name),
+ mysql_real_escape_string($descr),
+ mysql_real_escape_string($commonname),
+ mysql_real_escape_string($commondescr),
+ $groupid );
+
+ perform_query($query,$link);
+ mysql_close($link);
+}
+
+
+if( isset($_POST['name'])) {
+ $groupid = verifyparam( "dep", "/^(\d{1,9})?$/", "");
+ $name = getparam('name');
+ $description = getparam('description');
+ $commonname = getparam('commonname');
+ $commondescription = getparam('commondescription');
+
+ if( !$name )
+ $errors[] = no_field("form.field.groupname");
+
+ $existing_group = group_by_name($name);
+ if( (!$groupid && $existing_group) ||
+ ( $groupid && $existing_group && $groupid != $existing_group['groupid']) )
+ $errors[] = getlocal("page.group.duplicate_name");
+
+ if( count($errors) == 0 ) {
+ if (!$groupid) {
+ $newdep = create_group($name,$description,$commonname,$commondescription);
+ header("Location: $webimroot/operator/groups.php");
+ exit;
+ } else {
+ update_group($groupid,$name,$description,$commonname,$commondescription);
+ header("Location: $webimroot/operator/groups.php");
+ exit;
+ }
+ } else {
+ $page['formname'] = topage($name);
+ $page['formdescription'] = topage($description);
+ $page['formcommonname'] = topage($commonname);
+ $page['formcommondescription'] = topage($commondescription);
+ $page['depid'] = topage($groupid);
+ }
+
+} else if( isset($_GET['dep']) ) {
+ $groupid = verifyparam( 'dep', "/^\d{1,9}$/");
+ $group = group_by_id($groupid);
+
+ if( !$group ) {
+ $errors[] = getlocal("page.group.no_such");
+ $page['depid'] = topage($groupid);
+ } else {
+ $page['formname'] = topage($group['vclocalname']);
+ $page['formdescription'] = topage($group['vclocaldescription']);
+ $page['formcommonname'] = topage($group['vccommonname']);
+ $page['formcommondescription'] = topage($group['vccommondescription']);
+ $page['depid'] = topage($group['groupid']);
+ }
+}
+
+prepare_menu($operator);
+start_html_output();
+require('../view/group.php');
+?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/departments.php b/src/messenger/webim/operator/groups.php
similarity index 58%
rename from src/messenger/webim/operator/departments.php
rename to src/messenger/webim/operator/groups.php
index 2ce94547..2716f380 100644
--- a/src/messenger/webim/operator/departments.php
+++ b/src/messenger/webim/operator/groups.php
@@ -17,32 +17,23 @@ require_once('../libs/operator.php');
$operator = check_login();
-function get_departments() {
- $link = connect();
- $query = "select departmentid, vclocalname, vclocaldescription, 0 as inumofagents ".
- "from chatdepartment order by vclocalname";
- $result = select_multi_assoc($query, $link);
- mysql_close($link);
- return $result;
-}
-
if( isset($_GET['act']) && $_GET['act'] == 'del' ) {
// TODO check permissions, delete in other places
- $departmentid = verifyparam( "dep", "/^(\d{1,9})?$/");
+ $groupid = verifyparam( "dep", "/^(\d{1,9})?$/");
$link = connect();
- perform_query("delete from chatdepartment where departmentid = $departmentid",$link);
+ perform_query("delete from chatgroup where groupid = $groupid",$link);
mysql_close($link);
- header("Location: $webimroot/operator/departments.php");
+ header("Location: $webimroot/operator/groups.php");
exit;
}
$page = array();
-$page['departments'] = get_departments();
+$page['groups'] = get_groups(true);
prepare_menu($operator);
start_html_output();
-require('../view/departments.php');
+require('../view/groups.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/operator.php b/src/messenger/webim/operator/operator.php
index 2792e65f..f9bdc182 100644
--- a/src/messenger/webim/operator/operator.php
+++ b/src/messenger/webim/operator/operator.php
@@ -14,6 +14,7 @@
require_once('../libs/common.php');
require_once('../libs/operator.php');
+require_once('../libs/operator_settings.php');
$operator = check_login();
@@ -84,13 +85,8 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
}
}
-$page['tabs'] = $opId ? array(
- getlocal("page_agent.tab.main") => "",
- getlocal("page_agent.tab.avatar") => "$webimroot/operator/avatar.php?op=$opId",
- getlocal("page_agent.tab.permissions") => "$webimroot/operator/permissions.php?op=$opId"
-) : array();
-
prepare_menu($operator);
+setup_operator_settings_tabs($opId,0);
start_html_output();
require('../view/agent.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/opgroups.php b/src/messenger/webim/operator/opgroups.php
new file mode 100644
index 00000000..6639859f
--- /dev/null
+++ b/src/messenger/webim/operator/opgroups.php
@@ -0,0 +1,67 @@
+ $opId);
+$page['groups'] = get_groups(false);
+$errors = array();
+
+$op = operator_by_id($opId);
+
+if( !$op ) {
+ $errors[] = getlocal("no_such_operator");
+
+} else if( isset($_POST['op']) ) {
+
+ $new_groups = array();
+ foreach($page['groups'] as $group) {
+ if( verifyparam("group".$group['groupid'],"/^on$/", "") == "on") {
+ $new_groups[] = $group['groupid'];
+ }
+ }
+
+ update_operator_groups($op['operatorid'],$new_groups);
+ header("Location: $webimroot/operator/operator.php?op=$opId");
+ exit;
+}
+
+$page['formgroup'] = array();
+$page['currentop'] = $opId ? topage(get_operator_name($op))." (".$op['vclogin'].")" : "";
+
+if($opId) {
+ foreach(get_operator_groupids($opId) as $rel) {
+ $page['formgroup'][] = $rel['groupid'];
+ }
+}
+
+prepare_menu($operator);
+setup_operator_settings_tabs($opId,2);
+start_html_output();
+require('../view/operator_groups.php');
+?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/permissions.php b/src/messenger/webim/operator/permissions.php
index 0b55b888..a5bd7bda 100644
--- a/src/messenger/webim/operator/permissions.php
+++ b/src/messenger/webim/operator/permissions.php
@@ -14,6 +14,7 @@
require_once('../libs/common.php');
require_once('../libs/operator.php');
+require_once('../libs/operator_settings.php');
$operator = check_login();
@@ -58,12 +59,6 @@ if( !$op ) {
}
-$page['tabs'] = array(
- getlocal("page_agent.tab.main") => "$webimroot/operator/operator.php?op=$opId",
- getlocal("page_agent.tab.avatar") => "$webimroot/operator/avatar.php?op=$opId",
- getlocal("page_agent.tab.permissions") => ""
-);
-
$page['permissionsList'] = get_permission_list();
$page['formpermissions'] = array("");
$page['currentop'] = topage(get_operator_name($op))." (".$op['vclogin'].")";
@@ -75,6 +70,7 @@ foreach($permission_ids as $perm => $id) {
}
prepare_menu($operator);
+setup_operator_settings_tabs($opId,3);
start_html_output();
require('../view/permissions.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/view/features.php b/src/messenger/webim/view/features.php
index ed7e3d9f..522e44ec 100644
--- a/src/messenger/webim/view/features.php
+++ b/src/messenger/webim/view/features.php
@@ -72,11 +72,11 @@ require_once('inc_errors.php');
diff --git a/src/messenger/webim/view/department.php b/src/messenger/webim/view/group.php
similarity index 75%
rename from src/messenger/webim/view/department.php
rename to src/messenger/webim/view/group.php
index 9b5add18..3f8b089d 100644
--- a/src/messenger/webim/view/department.php
+++ b/src/messenger/webim/view/group.php
@@ -13,17 +13,17 @@
*/
require_once("inc_menu.php");
-$page['title'] = getlocal("page.department.title");
-$page['menuid'] = "departments";
+$page['title'] = getlocal("page.group.title");
+$page['menuid'] = "groups";
function tpl_content() { global $page, $webimroot, $errors;
?>
-
+
-
+
@@ -31,45 +31,45 @@ function tpl_content() { global $page, $webimroot, $errors;
require_once('inc_errors.php');
?>
-