diff --git a/src/messenger/webim/client.php b/src/messenger/webim/client.php
index f88d7639..e669e139 100644
--- a/src/messenger/webim/client.php
+++ b/src/messenger/webim/client.php
@@ -69,7 +69,7 @@ $pparam = verifyparam( "act", "/^(mailthread)$/", "default");
if( $pparam == "mailthread" ) {
require('view/chat_mailthread.php');
} else if( $level == "ajaxed" ) {
- require('view/chat_ajaxed.php');
+ expand("design/default/chat.tpl");
} else if( $level == "simple" ) {
require('view/chat_simple.php');
} else if( $level == "old" ) {
diff --git a/src/messenger/webim/design/default/chat.tpl b/src/messenger/webim/design/default/chat.tpl
index 34417883..7eb7ee3b 100644
--- a/src/messenger/webim/design/default/chat.tpl
+++ b/src/messenger/webim/design/default/chat.tpl
@@ -124,7 +124,7 @@ ${if:user}
${msg:chat.client.name} ${page:ct.user.name}
${endif:canChangeName}
-
+${endif:user}
${if:agent}
|
@@ -255,7 +255,7 @@ ${if:canpost}
| |
-
+ ${msg:chat.window.send_message_short,send_shortcut}
|
|
diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php
index e3b23f42..03f4fd43 100644
--- a/src/messenger/webim/libs/chat.php
+++ b/src/messenger/webim/libs/chat.php
@@ -299,6 +299,7 @@ function setup_chatview_for_operator($thread,$operator) {
$page['isOpera95'] = is_agent_opera95();
$page['neediframesrc'] = needsFramesrc();
$page['historyParams'] = array("userid" => "".$thread['userid']);
+ $page['historyParamsLink'] = add_params($webimroot."/operator/userhistory.php",$page['historyParams']);
$page['predefinedList'] = explode("\n", getlocal_('chat.predefined_answers', $thread['locale']));
$params = "thread=".$thread['threadid']."&token=".$thread['ltoken'];
$page['selfLink'] = "$webimroot/operator/agent.php?".$params;
diff --git a/src/messenger/webim/libs/expand.php b/src/messenger/webim/libs/expand.php
index 2c50f0c7..3b14796a 100644
--- a/src/messenger/webim/libs/expand.php
+++ b/src/messenger/webim/libs/expand.php
@@ -12,6 +12,8 @@
* Evgeny Gryaznov - initial API and implementation
*/
+$ifregexp = "/\\\${(if|ifnot):([\w\.]+)}(.*?)(\\\${else:\\2}.*?)?\\\${endif:\\2}/s";
+
function check_condition($condition) {
global $errors, $page;
if($condition == 'errors') {
@@ -21,12 +23,12 @@ function check_condition($condition) {
}
function expand_condition($matches) {
- global $page;
+ global $page, $ifregexp;
$value = check_condition($matches[2]) ^ ($matches[1] != 'if');
if($value) {
- return $matches[3];
- } else if($matches[4]) {
- return substr($matches[4],strpos($matches[4],"}")+1);
+ return preg_replace_callback($ifregexp, "expand_condition", $matches[3]);
+ } else if(isset($matches[4])) {
+ return preg_replace_callback($ifregexp, "expand_condition", substr($matches[4],strpos($matches[4],"}")+1));
}
return "";
}
@@ -50,19 +52,28 @@ function expand_var($matches) {
}
} else if($prefix == 'msg:') {
+ if(strpos($var,",")!==false) {
+ $pos = strpos($var,",");
+ $param = substr($var, $pos+1);
+ $var = substr($var, 0, $pos);
+ return getlocal2($var, array($page[$param]));
+ }
return getlocal($var);
} else if($prefix == 'form:') {
return $page["form$var"];
} else if($prefix == 'page:') {
- return $page["$var"];
+ return $page[$var];
+ } else if($prefix == 'if:' || $prefix == 'else:' || $prefix == 'endif:' || $prefix == 'ifnot:') {
+ return "";
}
return "";
}
function expandtext($text) {
- $text = preg_replace_callback("/\\\${(if|ifnot):([\w\.]+)}(.*?)(\\\${else:\\2}.*?)?\\\${endif:\\2}/sm", "expand_condition", $text);
- return preg_replace_callback("/\\\${(\w+:)?([\w\.]+)}/", "expand_var", $text);
+ global $ifregexp;
+ $text = preg_replace_callback($ifregexp, "expand_condition", $text);
+ return preg_replace_callback("/\\\${(\w+:)?([\w\.,]+)}/", "expand_var", $text);
}
function expand($filename) {
diff --git a/src/messenger/webim/operator/agent.php b/src/messenger/webim/operator/agent.php
index 53227251..82daa83a 100644
--- a/src/messenger/webim/operator/agent.php
+++ b/src/messenger/webim/operator/agent.php
@@ -16,6 +16,7 @@ require_once('../libs/common.php');
require_once('../libs/chat.php');
require_once('../libs/operator.php');
require_once('../libs/pagination.php');
+require_once('../libs/expand.php');
$operator = check_login();
@@ -71,7 +72,7 @@ if( $pparam == "redirect" ) {
$page['params'] = array('thread' => $threadid, 'token' => $token);
require('../view/redirect.php');
} else {
- require('../view/chat_ajaxed.php');
+ expand("../design/default/chat.tpl");
}
?>
\ No newline at end of file