diff --git a/src/messenger/webim/install/dbinfo.php b/src/messenger/webim/install/dbinfo.php index 1035db9e..72053ffa 100644 --- a/src/messenger/webim/install/dbinfo.php +++ b/src/messenger/webim/install/dbinfo.php @@ -90,6 +90,13 @@ $dbtables = array( "id" => "INT NOT NULL auto_increment PRIMARY KEY", "vckey" => "varchar(255)", "vcvalue" => "varchar(255)", + ), + + "chatresponses" => array( + "id" => "INT NOT NULL auto_increment PRIMARY KEY", + "locale" => "varchar(8)", + "groupid" => "int references chatgroup(groupid)", + "vcvalue" => "varchar(1024) NOT NULL", ) ); @@ -102,6 +109,7 @@ $dbtables_can_update = array( "chatban" => array(), "chatgroup" => array(), "chatgroupoperator" => array(), + "chatresponses" => array(), ); function show_install_err($text) { diff --git a/src/messenger/webim/libs/settings.php b/src/messenger/webim/libs/settings.php index d12651ae..62875dab 100644 --- a/src/messenger/webim/libs/settings.php +++ b/src/messenger/webim/libs/settings.php @@ -31,8 +31,7 @@ function setup_settings_tabs($active) { $page['tabs'] = array( getlocal("page_settings.tab.main") => $active != 0 ? "$webimroot/operator/settings.php" : "", getlocal("page_settings.tab.features") => $active != 1 ? "$webimroot/operator/features.php" : "", - getlocal("page_settings.tab.themes") => $active != 2 ? "$webimroot/operator/preview.php" : "", - getlocal("page_settings.tab.updates") => $active != 3 ? "$webimroot/operator/updates.php" : "", + getlocal("page_settings.tab.themes") => $active != 2 ? "$webimroot/operator/themes.php" : "", ); } diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index d73814f5..0b47b67c 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -13,6 +13,17 @@ button.delete=Delete button.enter=Enter button.save=Save button.search=Search +canned.add=Add message +canned.title=Canned Messages +canned.descr=Edit messages that you frequently type into the chat. +canned.locale=Choose locale +canned.group=Choose group +cannednew.title=New Message +cannednew.descr=Add new message +cannededit.title=Edit Message +cannededit.descr=Adjust existing message +cannededit.done=Saved +cannededit.no_such=No such message chat.came.from=Vistor came from page {0} chat.client.changename=Change name chat.client.name=You are @@ -183,6 +194,7 @@ mailthread.perform=Send mailthread.title=Send chat history
by mail menu.agents=Agents list menu.blocked=Blocked visitors +menu.canned=Canned Messages menu.groups=Groups menu.groups.content=Department or skill based operator groups. menu.locale=Language @@ -190,6 +202,7 @@ menu.locale.content=Change locale. menu.main=Main menu.operator=You are {0} menu.translate=Localize +menu.updates=Updates my_settings.error.password_match=Entered passwords do not match no_such_operator=No such operator operator.groups.title=Operator groups @@ -296,7 +309,6 @@ page_settings.intro=Specify options affecting chat window and common system beha page_settings.tab.features=Optional Services page_settings.tab.main=General page_settings.tab.themes=Themes preview -page_settings.tab.updates=Updates pending.menu.hide=Hide menu >> pending.menu.show=Show menu >> pending.table.ban=Ban the visitor diff --git a/src/messenger/webim/operator/canned.php b/src/messenger/webim/operator/canned.php new file mode 100644 index 00000000..542c756c --- /dev/null +++ b/src/messenger/webim/operator/canned.php @@ -0,0 +1,123 @@ + '', 'vcvalue' => $answer); + } + if(count($result) > 0) { + $updatequery = "insert into chatresponses (vcvalue,locale,groupid) values "; + for($i=0;$i 0) { + $updatequery .= ", "; + } + $updatequery .= "('".mysql_real_escape_string($result[$i]['vcvalue'], $link)."','$locale', NULL)"; + } + perform_query($updatequery, $link); + $result = select_multi_assoc($query, $link); + } + } + mysql_close($link); + return $result; +} + +# locales + +$all_locales = get_available_locales(); +$locales_with_label = array(); +foreach($all_locales as $id) { + $locales_with_label[] = array('id' => $id, 'name' => getlocal_($id,"names")); +} +$page['locales'] = $locales_with_label; + +$lang = verifyparam("lang", "/^[\w-]{2,5}$/", ""); +if( !$lang || !in_array($lang,$all_locales) ) { + $lang = in_array($current_locale,$all_locales) ? $current_locale : $all_locales[0]; +} + +# 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 = ""; + } + } + + $allgroups = get_groups(false); + $page['groups'] = array(); + $page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); + foreach($allgroups as $g) { + $page['groups'][] = $g; + } +} + +# delete + +if(isset($_GET['act']) && $_GET['act'] == 'delete') { + $key = isset($_GET['key']) ? $_GET['key'] : ""; + + if( !preg_match( "/^\d+$/", $key )) { + $errors[] = "Wrong key"; + } + + if( count($errors) == 0 ) { + $link = connect(); + perform_query("delete from chatresponses where id = $key",$link); + mysql_close($link); + header("Location: $webimroot/operator/canned.php?lang=$lang&group=$groupid"); + exit; + } +} + +# get messages + +$messages = load_canned_messages($lang, $groupid); +setup_pagination($messages); + +# form values + +$page['formlang'] = $lang; +$page['formgroup'] = $groupid; + +prepare_menu($operator); +start_html_output(); +require('../view/canned.php'); +?> \ No newline at end of file diff --git a/src/messenger/webim/operator/cannededit.php b/src/messenger/webim/operator/cannededit.php new file mode 100644 index 00000000..16c692df --- /dev/null +++ b/src/messenger/webim/operator/cannededit.php @@ -0,0 +1,91 @@ + \ No newline at end of file diff --git a/src/messenger/webim/view/canned.php b/src/messenger/webim/view/canned.php new file mode 100644 index 00000000..baa7eb76 --- /dev/null +++ b/src/messenger/webim/view/canned.php @@ -0,0 +1,116 @@ + + + +
+
+ + +
+ +
+ +
+
+ +
+ + +
+
+ +
+ + +
+ +
+
+
+ +
+ + &group=" target="_blank" + onclick="this.newWindow = window.open('/operator/cannededit.php?lang=&group=', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=640,height=480,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"> + + +
+
+ + + + + + + + + + + + + + + + + + + +
+ Message + + Modify +
+ ",htmlspecialchars(topage($localstr['vcvalue']))) ?> + + edit, + &group=">delete +
+ +
+"; + echo generate_pagination($page['pagination']); + } +} +?> + + \ No newline at end of file diff --git a/src/messenger/webim/view/cannededit.php b/src/messenger/webim/view/cannededit.php new file mode 100644 index 00000000..e4600913 --- /dev/null +++ b/src/messenger/webim/view/cannededit.php @@ -0,0 +1,71 @@ + + + + + + + + + + +
+
+ + +
+ + + + + +
+ +
+
+
Message
+
+ +
+
+ +
+ +
+
+ +
+
+ + + + \ 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 3fa63d3f..52ef5ddf 100644 --- a/src/messenger/webim/view/inc_menu.php +++ b/src/messenger/webim/view/inc_menu.php @@ -31,9 +31,11 @@ function tpl_menu() { global $page, $webimroot, $errors; > + > > > > + > diff --git a/src/messenger/webim/view/updates.php b/src/messenger/webim/view/updates.php index ef39e5f7..6fe26671 100644 --- a/src/messenger/webim/view/updates.php +++ b/src/messenger/webim/view/updates.php @@ -14,7 +14,7 @@ require_once("inc_menu.php"); $page['title'] = getlocal("updates.title"); -$page['menuid'] = "settings"; +$page['menuid'] = "updates"; function tpl_header() { global $page, $webimroot; ?> @@ -31,15 +31,6 @@ function tpl_content() { global $page, $webimroot;

- -
    - - $v) { if($v) { ?> -
  • - -
  • -
-
News: