chat main window template

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@166 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2008-10-10 22:26:14 +00:00
parent e4b735a198
commit 22fbb1b89e
5 changed files with 24 additions and 11 deletions

View File

@ -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" ) {

View File

@ -124,7 +124,7 @@ ${if:user}
${msg:chat.client.name} ${page:ct.user.name}
</td>
${endif:canChangeName}
${endif:user}
${if:agent}
<td width="10" valign="top"><img src='${webimroot}/images/free.gif' width="10" height="1" border="0" alt="" /></td>
<td><a class="closethread" href="javascript:void(0)" onclick="return false;" title="${msg:chat.window.close_title}">
@ -255,7 +255,7 @@ ${if:canpost}
<td><a href="javascript:void(0)" onclick="return false;" title="${msg:chat.window.send_message}"><img src='${webimroot}/images/submit.gif' width="40" height="35" border="0" alt="" /></a></td>
<td background="${webimroot}/images/submitbg.gif" valign="top" class="submit">
<img src='${webimroot}/images/free.gif' width="1" height="10" border="0" alt="" /><br>
<a id="sndmessagelnk" href="javascript:void(0)" onclick="return false;" title="${msg:chat.window.send_message}"><?php echo getlocal2("chat.window.send_message_short",array($page['send_shortcut'])) ?></a><br>
<a id="sndmessagelnk" href="javascript:void(0)" onclick="return false;" title="${msg:chat.window.send_message}">${msg:chat.window.send_message_short,send_shortcut}</a><br>
</td>
<td width="10"><a href="javascript:void(0)" onclick="return false;" title="${msg:chat.window.send_message}"><img src='${webimroot}/images/submitrest.gif' width="10" height="35" border="0" alt="" /></a></td>
</tr>

View File

@ -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;

View File

@ -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 "<!-- wrong $prefix:$var -->";
}
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) {

View File

@ -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");
}
?>