diff --git a/src/messenger/webim/images/buttons/createdep.gif b/src/messenger/webim/images/buttons/createdep.gif new file mode 100644 index 00000000..138e2000 Binary files /dev/null and b/src/messenger/webim/images/buttons/createdep.gif differ diff --git a/src/messenger/webim/images/dash/dep.gif b/src/messenger/webim/images/dash/dep.gif new file mode 100644 index 00000000..d43fe879 Binary files /dev/null and b/src/messenger/webim/images/dash/dep.gif differ diff --git a/src/messenger/webim/install/dbinfo.php b/src/messenger/webim/install/dbinfo.php index f60ce81a..3b093c0a 100644 --- a/src/messenger/webim/install/dbinfo.php +++ b/src/messenger/webim/install/dbinfo.php @@ -15,8 +15,10 @@ $dbtables = array( "chatdepartment" => array( "departmentid" => "int NOT NULL auto_increment PRIMARY KEY", - "vcname" => "varchar(64) NOT NULL", - "vcdescription" => "varchar(1024) NOT NULL", + "vclocalname" => "varchar(64) NOT NULL", + "vccommonname" => "varchar(64) NOT NULL", + "vclocaldescription" => "varchar(1024) NOT NULL", + "vccommondescription" => "varchar(1024) NOT NULL", ), "chatthread" => array( diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php index 82721129..50e0f581 100644 --- a/src/messenger/webim/libs/common.php +++ b/src/messenger/webim/libs/common.php @@ -17,7 +17,7 @@ session_start(); require_once(dirname(__FILE__).'/converter.php'); require_once(dirname(__FILE__).'/config.php'); -$version = '1.5.2'; +$version = '1.6.0 alpha 1'; function myiconv($in_enc, $out_enc, $string) { global $_utf8win1251, $_win1251utf8; @@ -498,7 +498,7 @@ function webim_mail($toaddr, $reply_to, $subject, $body) { mail($toaddr, $real_subject, wordwrap(myiconv($webim_encoding, $mail_encoding, $body),70), $headers); } -$dbversion = '1.5.2'; +$dbversion = '1.6.0.1'; $settings = array( 'dbversion' => 0, @@ -519,6 +519,7 @@ $settings = array( 'enableban' => '0', 'enablessl' => '0', 'usercanchangename' => '1', + 'enabledepartments' => '0', ); $settingsloaded = false; $settings_in_db = array(); diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php index ee986de1..f38a7d4e 100644 --- a/src/messenger/webim/libs/operator.php +++ b/src/messenger/webim/libs/operator.php @@ -220,6 +220,7 @@ function prepare_menu($operator,$hasright=true) { if($hasright) { loadsettings(); $page['showban'] = $settings['enableban'] == "1"; + $page['showdep'] = $settings['enabledepartments'] == "1"; $page['showadmin'] = is_capable($can_administrate, $operator); } } diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index 02f4567f..8e908fa9 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -107,6 +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.email=Your email form.field.login.description=Login can consist of small Latin letters and underscore. form.field.login=Login @@ -170,6 +178,7 @@ 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.locale=Language menu.locale.content=Change locale. menu.main=Main @@ -188,6 +197,15 @@ page.chat.old_browser.close=Close... page.chat.old_browser.list=

\nAlso, we support some old browsers:\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.gen_button.choose_image=Choose image page.gen_button.choose_locale=Target locale page.gen_button.choose_style=Chat window style @@ -290,6 +308,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.enablessl.description=Please, note that your web server should be
configured to support https requests. settings.enablessl=Allow secure connections (SSL) settings.geolink.description=Each IP becomes a link opening in new window. {ip} is substituted with a real ip. diff --git a/src/messenger/webim/operator/department.php b/src/messenger/webim/operator/department.php new file mode 100644 index 00000000..c6f59d68 --- /dev/null +++ b/src/messenger/webim/operator/department.php @@ -0,0 +1,124 @@ + ''); +$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/departments.php b/src/messenger/webim/operator/departments.php new file mode 100644 index 00000000..2ce94547 --- /dev/null +++ b/src/messenger/webim/operator/departments.php @@ -0,0 +1,48 @@ + \ No newline at end of file diff --git a/src/messenger/webim/operator/features.php b/src/messenger/webim/operator/features.php index 23d04154..a79caad6 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'); +$options = array('enableban', 'usercanchangename', 'enablessl', 'enabledepartments'); loadsettings(); $params = array(); diff --git a/src/messenger/webim/view/department.php b/src/messenger/webim/view/department.php new file mode 100644 index 00000000..9b5add18 --- /dev/null +++ b/src/messenger/webim/view/department.php @@ -0,0 +1,94 @@ + + + + + + + + +
+
+ + +
+ +
+
+ +
+
+
*
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ + diff --git a/src/messenger/webim/view/departments.php b/src/messenger/webim/view/departments.php new file mode 100644 index 00000000..2e2b0724 --- /dev/null +++ b/src/messenger/webim/view/departments.php @@ -0,0 +1,89 @@ + + + +
+
+ +
+ + "> + + +
+
+ + + + + + + + + + 0) { + foreach( $page['departments'] as $dep ) { ?> + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + remove + +
+ +
+ + \ No newline at end of file diff --git a/src/messenger/webim/view/features.php b/src/messenger/webim/view/features.php index 824dc0ff..05e83bc6 100644 --- a/src/messenger/webim/view/features.php +++ b/src/messenger/webim/view/features.php @@ -71,6 +71,15 @@ require_once('inc_errors.php');
+
+
+
+ /> +
+
+
+
+
diff --git a/src/messenger/webim/view/inc_main.php b/src/messenger/webim/view/inc_main.php index 977175c2..d6ece1ed 100644 --- a/src/messenger/webim/view/inc_main.php +++ b/src/messenger/webim/view/inc_main.php @@ -64,7 +64,7 @@
 
\ No newline at end of file diff --git a/src/messenger/webim/view/inc_menu.php b/src/messenger/webim/view/inc_menu.php index 5f94907d..32b26e7b 100644 --- a/src/messenger/webim/view/inc_menu.php +++ b/src/messenger/webim/view/inc_menu.php @@ -25,7 +25,9 @@ function tpl_menu() { global $page, $webimroot, $errors;