mirror of
https://github.com/Mibew/tray.git
synced 2025-01-22 18:10:34 +03:00
department -> group, manages groups of agent
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@431 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
9d2f6ec2f5
commit
2fb7e37d7b
@ -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],
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) ) {
|
||||
|
@ -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
|
||||
-----
|
||||
|
@ -519,7 +519,7 @@ $settings = array(
|
||||
'enableban' => '0',
|
||||
'enablessl' => '0',
|
||||
'usercanchangename' => '1',
|
||||
'enabledepartments' => '0',
|
||||
'enablegroups' => '0',
|
||||
'enablestatistics' => '1',
|
||||
);
|
||||
$settingsloaded = false;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
29
src/messenger/webim/libs/operator_settings.php
Normal file
29
src/messenger/webim/libs/operator_settings.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
function setup_operator_settings_tabs($opId, $active) {
|
||||
global $page, $webimroot;
|
||||
if($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();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -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<br>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=<p><ul>\n<li>Internet Explorer 5.5+\n<li>Firefox 1.0+\n<li>Opera 8.0+\n<li>Mozilla 1.4+\n<li>Netscape 7.1+\n<li>Safari 1.2+\n</ul></p>\nAlso, we support some old browsers:\n<p><ul>\n<li>Internet Explorer 5.0\n<li>Opera 7.0\n</ul></p>
|
||||
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 <a href="preview.php">here</a>
|
||||
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.
|
||||
|
@ -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
|
||||
|
@ -167,7 +167,6 @@ mailthread.perform=
|
||||
mailthread.title=Отправить историю разговора<br>на почтовый ящик
|
||||
menu.agents=Список агентов
|
||||
menu.blocked=Нежелательные посетители
|
||||
menu.departments=Îòäåëû
|
||||
menu.locale=Язык
|
||||
menu.locale.content=Сменить язык.
|
||||
menu.main=Главная
|
||||
|
@ -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');
|
||||
?>
|
@ -1,124 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
require_once('../libs/common.php');
|
||||
require_once('../libs/operator.php');
|
||||
|
||||
$operator = check_login();
|
||||
|
||||
$page = array('depid' => '');
|
||||
$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');
|
||||
?>
|
@ -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();
|
||||
|
124
src/messenger/webim/operator/group.php
Normal file
124
src/messenger/webim/operator/group.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
require_once('../libs/common.php');
|
||||
require_once('../libs/operator.php');
|
||||
|
||||
$operator = check_login();
|
||||
|
||||
$page = array('depid' => '');
|
||||
$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');
|
||||
?>
|
@ -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');
|
||||
?>
|
@ -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');
|
||||
?>
|
67
src/messenger/webim/operator/opgroups.php
Normal file
67
src/messenger/webim/operator/opgroups.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
require_once('../libs/common.php');
|
||||
require_once('../libs/operator.php');
|
||||
require_once('../libs/operator_settings.php');
|
||||
|
||||
$operator = check_login();
|
||||
|
||||
function update_operator_groups($operatorid,$newvalue) {
|
||||
$link = connect();
|
||||
perform_query("delete from chatgroupoperator where operatorid = $operatorid", $link);
|
||||
foreach($newvalue as $groupid) {
|
||||
perform_query("insert into chatgroupoperator (groupid, operatorid) values ($groupid,$operatorid)", $link);
|
||||
}
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
$opId = verifyparam( "op","/^\d{1,9}$/");
|
||||
$page = array('op' => $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');
|
||||
?>
|
@ -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');
|
||||
?>
|
@ -72,11 +72,11 @@ require_once('inc_errors.php');
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="flabel"><?php echo getlocal('settings.enabledepartments') ?></div>
|
||||
<div class="flabel"><?php echo getlocal('settings.enablegroups') ?></div>
|
||||
<div class="fvalue">
|
||||
<input type="checkbox" name="enabledepartments" value="on"<?php echo form_value_cb('enabledepartments') ? " checked=\"checked\"" : "" ?>/>
|
||||
<input type="checkbox" name="enablegroups" value="on"<?php echo form_value_cb('enablegroups') ? " checked=\"checked\"" : "" ?>/>
|
||||
</div>
|
||||
<div class="fdescr"> — <?php echo getlocal('settings.enabledepartments.description') ?></div>
|
||||
<div class="fdescr"> — <?php echo getlocal('settings.enablegroups.description') ?></div>
|
||||
<br clear="left"/>
|
||||
</div>
|
||||
|
||||
|
@ -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;
|
||||
?>
|
||||
|
||||
<?php if( $page['depid'] ) { ?>
|
||||
<?php echo getlocal("page.department.intro") ?>
|
||||
<?php echo getlocal("page.group.intro") ?>
|
||||
<?php } ?>
|
||||
<?php if( !$page['depid'] ) { ?>
|
||||
<?php echo getlocal("page.department.create_new") ?>
|
||||
<?php echo getlocal("page.group.create_new") ?>
|
||||
<?php } ?>
|
||||
<br />
|
||||
<br />
|
||||
@ -31,45 +31,45 @@ function tpl_content() { global $page, $webimroot, $errors;
|
||||
require_once('inc_errors.php');
|
||||
?>
|
||||
|
||||
<form name="departmentForm" method="post" action="<?php echo $webimroot ?>/operator/department.php">
|
||||
<form name="groupForm" method="post" action="<?php echo $webimroot ?>/operator/group.php">
|
||||
<input type="hidden" name="dep" value="<?php echo $page['depid'] ?>"/>
|
||||
<div>
|
||||
<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">
|
||||
|
||||
<div class="fieldForm">
|
||||
<div class="field">
|
||||
<div class="flabel"><?php echo getlocal('form.field.depname') ?><span class="required">*</span></div>
|
||||
<div class="flabel"><?php echo getlocal('form.field.groupname') ?><span class="required">*</span></div>
|
||||
<div class="fvalue">
|
||||
<input type="text" name="name" size="40" value="<?php echo form_value('name') ?>" class="formauth"/>
|
||||
</div>
|
||||
<div class="fdescr"> — <?php echo getlocal('form.field.depname.description') ?></div>
|
||||
<div class="fdescr"> — <?php echo getlocal('form.field.groupname.description') ?></div>
|
||||
<br clear="left"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="flabel"><?php echo getlocal('form.field.depdesc') ?></div>
|
||||
<div class="flabel"><?php echo getlocal('form.field.groupdesc') ?></div>
|
||||
<div class="fvalue">
|
||||
<input type="text" name="description" size="40" value="<?php echo form_value('description') ?>" class="formauth"/>
|
||||
</div>
|
||||
<div class="fdescr"> — <?php echo getlocal('form.field.depdesc.description') ?></div>
|
||||
<div class="fdescr"> — <?php echo getlocal('form.field.groupdesc.description') ?></div>
|
||||
<br clear="left"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="flabel"><?php echo getlocal('form.field.depcommonname') ?></div>
|
||||
<div class="flabel"><?php echo getlocal('form.field.groupcommonname') ?></div>
|
||||
<div class="fvalue">
|
||||
<input type="text" name="commonname" size="40" value="<?php echo form_value('commonname') ?>" class="formauth"/>
|
||||
</div>
|
||||
<div class="fdescr"> — <?php echo getlocal('form.field.depcommonname.description') ?></div>
|
||||
<div class="fdescr"> — <?php echo getlocal('form.field.groupcommonname.description') ?></div>
|
||||
<br clear="left"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="flabel"><?php echo getlocal('form.field.depcommondesc') ?></div>
|
||||
<div class="flabel"><?php echo getlocal('form.field.groupcommondesc') ?></div>
|
||||
<div class="fvalue">
|
||||
<input type="text" name="commondescription" size="40" value="<?php echo form_value('commondescription') ?>" class="formauth"/>
|
||||
</div>
|
||||
<div class="fdescr"> — <?php echo getlocal('form.field.depcommondesc.description') ?></div>
|
||||
<div class="fdescr"> — <?php echo getlocal('form.field.groupcommondesc.description') ?></div>
|
||||
<br clear="left"/>
|
||||
</div>
|
||||
|
@ -13,20 +13,20 @@
|
||||
*/
|
||||
|
||||
require_once("inc_menu.php");
|
||||
$page['title'] = getlocal("page.departments.title");
|
||||
$page['menuid'] = "departments";
|
||||
$page['title'] = getlocal("page.groups.title");
|
||||
$page['menuid'] = "groups";
|
||||
|
||||
function tpl_content() { global $page, $webimroot;
|
||||
?>
|
||||
|
||||
<?php echo getlocal("page.departments.intro") ?>
|
||||
<?php echo getlocal("page.groups.intro") ?>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<div class="tabletool">
|
||||
<img src='<?php echo $webimroot ?>/images/buttons/createdep.gif' border="0" alt="" />
|
||||
<a href='<?php echo $webimroot ?>/operator/department.php' title="<?php echo getlocal("page.departments.new") ?>">
|
||||
<?php echo getlocal("page.departments.new") ?>
|
||||
<a href='<?php echo $webimroot ?>/operator/group.php' title="<?php echo getlocal("page.groups.new") ?>">
|
||||
<?php echo getlocal("page.groups.new") ?>
|
||||
</a>
|
||||
</div>
|
||||
<br clear="all"/>
|
||||
@ -36,22 +36,22 @@ function tpl_content() { global $page, $webimroot;
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>
|
||||
<?php echo getlocal("form.field.depname") ?>
|
||||
<?php echo getlocal("form.field.groupname") ?>
|
||||
</th><th>
|
||||
<?php echo getlocal("form.field.depdesc") ?>
|
||||
<?php echo getlocal("form.field.groupdesc") ?>
|
||||
</th><th>
|
||||
<?php echo getlocal("page.department.membersnum") ?>
|
||||
<?php echo getlocal("page.group.membersnum") ?>
|
||||
</th><th>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if(count($page['departments']) > 0) {
|
||||
foreach( $page['departments'] as $dep ) { ?>
|
||||
if(count($page['groups']) > 0) {
|
||||
foreach( $page['groups'] as $dep ) { ?>
|
||||
<tr>
|
||||
<td class="notlast">
|
||||
<a href="<?php echo $webimroot ?>/operator/department.php?dep=<?php echo $dep['departmentid'] ?>" class="man">
|
||||
<a href="<?php echo $webimroot ?>/operator/group.php?dep=<?php echo $dep['groupid'] ?>" class="man">
|
||||
<?php echo htmlspecialchars(topage($dep['vclocalname'])) ?>
|
||||
</a>
|
||||
</td>
|
||||
@ -62,7 +62,7 @@ if(count($page['departments']) > 0) {
|
||||
<?php echo htmlspecialchars(topage($dep['inumofagents'])) ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?php echo $webimroot ?>/operator/departments.php?act=del&dep=<?php echo $dep['departmentid'] ?>">
|
||||
<a href="<?php echo $webimroot ?>/operator/groups.php?act=del&dep=<?php echo $dep['groupid'] ?>">
|
||||
remove
|
||||
</a>
|
||||
</td>
|
@ -28,8 +28,8 @@ function tpl_menu() { global $page, $webimroot, $errors;
|
||||
<h2><?php echo getlocal('right.administration') ?></h2>
|
||||
<ul class="submenu">
|
||||
<li<?php menuli("operators")?>><a href='<?php echo $webimroot ?>/operator/operators.php'><?php echo getlocal('leftMenu.client_agents') ?></a></li>
|
||||
<?php if(isset($page['showdep']) && $page['showdep']) { ?>
|
||||
<li<?php menuli("departments")?>><a href='<?php echo $webimroot ?>/operator/departments.php'><?php echo getlocal('menu.departments') ?></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("getcode")?>><a href='<?php echo $webimroot ?>/operator/getcode.php'><?php echo getlocal('leftMenu.client_gen_button') ?></a></li>
|
||||
<li<?php menuli("settings")?>><a href='<?php echo $webimroot ?>/operator/settings.php'><?php echo getlocal('leftMenu.client_settings') ?></a></li>
|
||||
|
@ -89,12 +89,12 @@ if( $page['showadmin'] ) { ?>
|
||||
</td>
|
||||
<?php menuseparator(); ?>
|
||||
|
||||
<?php if($page['showdep']) { ?>
|
||||
<?php if($page['showgroups']) { ?>
|
||||
<td class="dashitem">
|
||||
<img src="/webim/images/dash/dep.gif" alt=""/>
|
||||
<a href='<?php echo $webimroot ?>/operator/departments.php'>
|
||||
<?php echo getlocal('menu.departments') ?></a>
|
||||
<?php echo getlocal('menu.departments.content') ?>
|
||||
<a href='<?php echo $webimroot ?>/operator/groups.php'>
|
||||
<?php echo getlocal('menu.groups') ?></a>
|
||||
<?php echo getlocal('menu.groups.content') ?>
|
||||
</td>
|
||||
<?php menuseparator(); ?>
|
||||
<?php } ?>
|
||||
|
69
src/messenger/webim/view/operator_groups.php
Normal file
69
src/messenger/webim/view/operator_groups.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
require_once("inc_menu.php");
|
||||
$page['title'] = getlocal("operator.groups.title");
|
||||
$page['menuid'] = "operators";
|
||||
|
||||
function tpl_content() { global $page, $webimroot, $errors;
|
||||
?>
|
||||
|
||||
<?php echo getlocal("operator.groups.intro") ?>
|
||||
<br />
|
||||
<br />
|
||||
<?php
|
||||
require_once('inc_errors.php');
|
||||
?>
|
||||
|
||||
<form name="opgroupsForm" method="post" action="<?php echo $webimroot ?>/operator/opgroups.php">
|
||||
<input type="hidden" name="op" value="<?php echo $page['op'] ?>"/>
|
||||
<div>
|
||||
<?php if($page['tabs']) { ?>
|
||||
<ul class="tabs">
|
||||
|
||||
<?php foreach($page['tabs'] as $k => $v) { if($v) { ?>
|
||||
<li><a href="<?php echo $v ?>"><?php echo $k ?></a></li>
|
||||
<?php } else { ?>
|
||||
<li class="active"><a href="#"><?php echo $k ?></a></li><?php }} ?>
|
||||
</ul>
|
||||
<?php } ?>
|
||||
<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">
|
||||
|
||||
<p>
|
||||
<b><?php echo $page['currentop'] ?></b>
|
||||
</p>
|
||||
<?php foreach( $page['groups'] as $pm ) { ?>
|
||||
<div class="field">
|
||||
<div class="flabel"><?php echo $pm['vclocalname'] ?></div>
|
||||
<div class="fvalue">
|
||||
<input type="checkbox" name="group<?php echo $pm['groupid'] ?>" value="on"<?php echo form_value_mb('group',$pm['groupid']) ? " checked=\"checked\"" : "" ?>/>
|
||||
</div>
|
||||
<div class="fdescr"> — <?php echo $pm['vclocaldescription'] ?></div>
|
||||
<br clear="left"/>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="fbutton">
|
||||
<input type="image" name="save" value="" src='<?php echo $webimroot.getlocal("image.button.save") ?>' alt='<?php echo getlocal("button.save") ?>'/>
|
||||
</div>
|
||||
|
||||
</div><div class="formbottom"><div class="formbottomi"></div></div></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
} /* content */
|
||||
|
||||
require_once('inc_main.php');
|
||||
?>
|
Loading…
Reference in New Issue
Block a user