From 11018195edb9145d2c06a6c55632bacd3d57e547 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Sun, 12 Oct 2008 20:35:42 +0000 Subject: [PATCH] improve demothread, fix mail link from thread, added 5 previews git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@180 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/webim/design/default/chat.tpl | 4 +-- .../webim/design/default/chatsimple.tpl | 2 +- src/messenger/webim/libs/chat.php | 4 +-- src/messenger/webim/libs/demothread.php | 16 ++++++++-- src/messenger/webim/locales/en/properties | 5 +++ src/messenger/webim/locales/ru/properties | 5 +++ src/messenger/webim/operator/preview.php | 31 +++++++++++++++++-- src/messenger/webim/thread.php | 2 +- src/messenger/webim/view/preview.php | 18 +++++++++-- 9 files changed, 73 insertions(+), 14 deletions(-) diff --git a/src/messenger/webim/design/default/chat.tpl b/src/messenger/webim/design/default/chat.tpl index 39bb2cd9..58b028c7 100644 --- a/src/messenger/webim/design/default/chat.tpl +++ b/src/messenger/webim/design/default/chat.tpl @@ -133,11 +133,11 @@ ${endif:agent} ${if:user} - Mail  + Mail  ${endif:user} ${if:agent} ${if:canpost} - + Redirect  ${endif:canpost} ${if:historyParams} diff --git a/src/messenger/webim/design/default/chatsimple.tpl b/src/messenger/webim/design/default/chatsimple.tpl index ca109402..49167136 100644 --- a/src/messenger/webim/design/default/chatsimple.tpl +++ b/src/messenger/webim/design/default/chatsimple.tpl @@ -75,7 +75,7 @@ - Mail + Mail Refresh diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index 1c497ee0..297d702e 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -276,7 +276,7 @@ function setup_chatview_for_user($thread,$level) { $page['send_shortcut'] = "Ctrl-Enter"; $params = "thread=".$thread['threadid']."&token=".$thread['ltoken']; - $page['selfLink'] = "$webimroot/client.php?".$params."&level=".$level; + $page['mailLink'] = "$webimroot/client.php?".$params."&level=$level&act=mailthread"; $page['isOpera95'] = is_agent_opera95(); $page['neediframesrc'] = needsFramesrc(); @@ -307,7 +307,7 @@ function setup_chatview_for_operator($thread,$operator) { } $page['predefinedAnswers'] = $predefinedres; $params = "thread=".$thread['threadid']."&token=".$thread['ltoken']; - $page['selfLink'] = "$webimroot/operator/agent.php?".$params; + $page['redirectLink'] = "$webimroot/operator/agent.php?".$params."&act=redirect"; $page['namePostfix'] = ""; } diff --git a/src/messenger/webim/libs/demothread.php b/src/messenger/webim/libs/demothread.php index c3eb9fe8..c5df7565 100644 --- a/src/messenger/webim/libs/demothread.php +++ b/src/messenger/webim/libs/demothread.php @@ -17,12 +17,12 @@ function demo_print_message($msg) { print "".myiconv($webim_encoding,"utf-8",escape_with_cdata(message_to_html($msg)))."\n"; } -function demo_process_thread($act,$lastid,$isuser,$canpost) { +function demo_process_thread($act,$lastid,$isuser,$canpost,$istyping,$postmessage) { global $kind_for_agent, $kind_info, $kind_events, $kind_user, $kind_agent; - if( $act == "refresh" ) { + if( $act == "refresh" || $act == "post" ) { $lastid++; start_xml_output(); - print(""); + print(""); if($lastid == 1) { demo_print_message( array('ikind'=>$kind_for_agent,'created'=>time()-15,'tname'=>'', @@ -39,6 +39,16 @@ function demo_process_thread($act,$lastid,$isuser,$canpost) { demo_print_message( array('ikind'=>$kind_user,'created'=>time()-5,'tname'=>getstring("chat.default.username"), 'tmessage'=>getstring("demo.chat.question"))); + if($canpost) { + demo_print_message( + array('ikind'=>$kind_info,'created'=>time()-5,'tname'=>'', + 'tmessage'=>'Hint: type something in message field to see typing notification')); + } + } + if($act == 'post') { + demo_print_message( + array('ikind'=>$isuser?$kind_user:$kind_agent,'created'=>time(),'tmessage'=>$postmessage, + 'tname'=>$isuser?getstring("chat.default.username"):"Administrator")); } print(""); } diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index eece8f3a..1b16f7cf 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -232,7 +232,12 @@ page.gen_button.choose_locale=Target locale page.gen_button.include_site_name=Include host name into code page.gen_button.secure_links=Use secure links (https) page.preview.choose=Choose style +page.preview.choosetpl=Choose template page.preview.intro=You can preview styles for your site +page.preview.leavemessage=Leave message window +page.preview.leavemessagesent=Leave message sent window +page.preview.mail=Mail thread window +page.preview.mailsent=Mail is sent window page.preview.title=Site style page.preview.userchat=Chat window (user-mode) page_agent.create_new=Here you can create new operator diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties index 65134288..66460d7c 100644 --- a/src/messenger/webim/locales/ru/properties +++ b/src/messenger/webim/locales/ru/properties @@ -232,7 +232,12 @@ page.gen_button.choose_locale= page.gen_button.include_site_name=Включать имя сайта в код page.gen_button.secure_links=Использовать защищенное соединение (https) page.preview.choose=Выберите стиль +page.preview.choosetpl=Выберите шаблон page.preview.intro=Здесь вы можете посмотреть на стиль вашего сайта +page.preview.leavemessage=Leave message window +page.preview.leavemessagesent=Leave message sent window +page.preview.mail=Mail thread window +page.preview.mailsent=Mail is sent window page.preview.title=Стиль мессенджера page.preview.userchat=Chat window (user-mode) page_agent.create_new=Создание нового оператора diff --git a/src/messenger/webim/operator/preview.php b/src/messenger/webim/operator/preview.php index 698c5099..84adef8f 100644 --- a/src/messenger/webim/operator/preview.php +++ b/src/messenger/webim/operator/preview.php @@ -35,19 +35,44 @@ if(!in_array($preview, $designlist)) { $preview = $designlist[0]; } -$show = verifyparam("show", "/^(chat)$/", ""); +$show = verifyparam("show", "/^(chat|mail|mailsent|leavemessage|leavemessagesent)$/", ""); -if($show == 'chat') { +if($show == 'chat' || $show == 'mail' || $show == 'leavemessage' || $show == 'leavemessagesent') { setup_chatview_for_user(array('threadid' => 0,'userName' => getstring("chat.default.username"), 'ltoken' => 123), "ajaxed"); - expand("../design/$preview/chat.tpl"); + $page['mailLink'] = "$webimroot/operator/preview.php?preview=$preview&show=mail"; + expand("../design/$preview/$show.tpl"); + exit; +} +if($show == 'mailsent') { + $page['email'] = "admin@yourdomain.com"; + expand("../design/$preview/$show.tpl"); exit; } +$templateList = array( + array('label' => getlocal("page.preview.userchat"), 'id' => 'chat', 'h' => 420, 'w' => 600), + array('label' => getlocal("page.preview.leavemessage"), 'id' => 'leavemessage', 'h' => 420, 'w' => 600), + array('label' => getlocal("page.preview.leavemessagesent"), 'id' => 'leavemessagesent', 'h' => 420, 'w' => 600), + array('label' => getlocal("page.preview.mail"), 'id' => 'mail', 'h' => 254, 'w' => 603), + array('label' => getlocal("page.preview.mailsent"), 'id' => 'mailsent', 'h' => 254, 'w' => 603), +); + +$template = verifyparam("template", "/^\w+$/", "chat"); + $page['formpreview'] = $preview; +$page['formtemplate'] = $template; $page['availablePreviews'] = $designlist; +$page['availableTemplates'] = array("chat", "leavemessage", "leavemessagesent", "mail", "mailsent", "all"); $page['operator'] = topage(get_operator_name($operator)); $page['showlink'] = "$webimroot/operator/preview.php?preview=$preview&show="; +$page['previewList'] = array(); +foreach($templateList as $tpl) { + if($tpl['id'] == $template || $template == 'all') { + $page['previewList'][] = $tpl; + } +} + start_html_output(); require('../view/preview.php'); ?> \ No newline at end of file diff --git a/src/messenger/webim/thread.php b/src/messenger/webim/thread.php index 6c1974db..d90ac9a3 100644 --- a/src/messenger/webim/thread.php +++ b/src/messenger/webim/thread.php @@ -26,7 +26,7 @@ $istyping = verifyparam( "typed", "/^1$/", "") == '1'; if($threadid == 0 && ($token == 123 || $token == 124)) { require_once('libs/demothread.php'); $lastid = verifyparam( "lastid", "/^\d{1,9}$/", 0); - demo_process_thread($act,$lastid,$isuser,$token == 123); + demo_process_thread($act,$lastid,$isuser,$token == 123,$istyping,$act=="post"?getrawparam('message') : ""); exit; } diff --git a/src/messenger/webim/view/preview.php b/src/messenger/webim/view/preview.php index 61a2e179..0e18d888 100644 --- a/src/messenger/webim/view/preview.php +++ b/src/messenger/webim/view/preview.php @@ -57,16 +57,30 @@ - + + + + + + + + + + + + + link + - +