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
This commit is contained in:
Evgeny Gryaznov 2008-10-12 20:35:42 +00:00
parent f0c0293889
commit 11018195ed
9 changed files with 73 additions and 14 deletions

View File

@ -133,11 +133,11 @@ ${endif:agent}
<td><img src='${webimroot}/images/buttondiv.gif' width="35" height="45" border="0" alt="" /></td> <td><img src='${webimroot}/images/buttondiv.gif' width="35" height="45" border="0" alt="" /></td>
${if:user} ${if:user}
<td><a href="${page:selfLink}&act=mailthread" target="_blank" title="${msg:chat.window.toolbar.mail_history}" onclick="this.newWindow = window.open('${page:selfLink}&act=mailthread', 'ForwardMail', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,width=603,height=254,resizable=0');this.newWindow.focus();this.newWindow.opener=window;return false;"><img src='${webimroot}/images/buttons/email.gif' width="25" height="25" border="0" alt="Mail&nbsp;"/></a></td> <td><a href="${page:mailLink}" target="_blank" title="${msg:chat.window.toolbar.mail_history}" onclick="this.newWindow = window.open('${page:mailLink}', 'ForwardMail', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,width=603,height=254,resizable=0');this.newWindow.focus();this.newWindow.opener=window;return false;"><img src='${webimroot}/images/buttons/email.gif' width="25" height="25" border="0" alt="Mail&nbsp;"/></a></td>
${endif:user} ${endif:user}
${if:agent} ${if:agent}
${if:canpost} ${if:canpost}
<td><a href="${page:selfLink}&act=redirect" title="${msg:chat.window.toolbar.redirect_user}"> <td><a href="${page:redirectLink}" title="${msg:chat.window.toolbar.redirect_user}">
<img src='${webimroot}/images/buttons/send.gif' width="25" height="25" border="0" alt="Redirect&nbsp;" /></a></td> <img src='${webimroot}/images/buttons/send.gif' width="25" height="25" border="0" alt="Redirect&nbsp;" /></a></td>
${endif:canpost} ${endif:canpost}
${if:historyParams} ${if:historyParams}

View File

@ -75,7 +75,7 @@
<td><img src='${webimroot}/images/buttondiv.gif' width="35" height="45" border="0" alt="" /></td> <td><img src='${webimroot}/images/buttondiv.gif' width="35" height="45" border="0" alt="" /></td>
<td><a href="${page:selfLink}&act=mailthread" target="_blank" title="${msg:chat.window.toolbar.mail_history}" onclick="this.newWindow = window.open('${page:selfLink}&act=mailthread', 'ForwardMail', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,width=603,height=254,resizable=0');this.newWindow.focus();this.newWindow.opener=window;return false;"><img src='${webimroot}/images/buttons/email.gif' width="25" height="25" border="0" alt="Mail" /></a></td> <td><a href="${page:mailLink}" target="_blank" title="${msg:chat.window.toolbar.mail_history}" onclick="this.newWindow = window.open('${page:mailLink}', 'ForwardMail', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,width=603,height=254,resizable=0');this.newWindow.focus();this.newWindow.opener=window;return false;"><img src='${webimroot}/images/buttons/email.gif' width="25" height="25" border="0" alt="Mail" /></a></td>
<td><a id="refresh" href="javascript:void(0)" onclick="return false;" title="${msg:chat.window.toolbar.refresh}"> <td><a id="refresh" href="javascript:void(0)" onclick="return false;" title="${msg:chat.window.toolbar.refresh}">
<img src='${webimroot}/images/buttons/refresh.gif' width="25" height="25" border="0" alt="Refresh" /></a></td> <img src='${webimroot}/images/buttons/refresh.gif' width="25" height="25" border="0" alt="Refresh" /></a></td>

View File

@ -276,7 +276,7 @@ function setup_chatview_for_user($thread,$level) {
$page['send_shortcut'] = "Ctrl-Enter"; $page['send_shortcut'] = "Ctrl-Enter";
$params = "thread=".$thread['threadid']."&token=".$thread['ltoken']; $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['isOpera95'] = is_agent_opera95();
$page['neediframesrc'] = needsFramesrc(); $page['neediframesrc'] = needsFramesrc();
@ -307,7 +307,7 @@ function setup_chatview_for_operator($thread,$operator) {
} }
$page['predefinedAnswers'] = $predefinedres; $page['predefinedAnswers'] = $predefinedres;
$params = "thread=".$thread['threadid']."&token=".$thread['ltoken']; $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'] = ""; $page['namePostfix'] = "";
} }

View File

@ -17,12 +17,12 @@ function demo_print_message($msg) {
print "<message>".myiconv($webim_encoding,"utf-8",escape_with_cdata(message_to_html($msg)))."</message>\n"; print "<message>".myiconv($webim_encoding,"utf-8",escape_with_cdata(message_to_html($msg)))."</message>\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; global $kind_for_agent, $kind_info, $kind_events, $kind_user, $kind_agent;
if( $act == "refresh" ) { if( $act == "refresh" || $act == "post" ) {
$lastid++; $lastid++;
start_xml_output(); start_xml_output();
print("<thread lastid=\"$lastid\" typing=\"".((($lastid/3)%2)==1 ? 1 : 0)."\" canpost=\"".($canpost ? 1 : 0)."\">"); print("<thread lastid=\"$lastid\" typing=\"".($istyping ? 1 : 0)."\" canpost=\"".($canpost ? 1 : 0)."\">");
if($lastid == 1) { if($lastid == 1) {
demo_print_message( demo_print_message(
array('ikind'=>$kind_for_agent,'created'=>time()-15,'tname'=>'', array('ikind'=>$kind_for_agent,'created'=>time()-15,'tname'=>'',
@ -39,6 +39,16 @@ function demo_process_thread($act,$lastid,$isuser,$canpost) {
demo_print_message( demo_print_message(
array('ikind'=>$kind_user,'created'=>time()-5,'tname'=>getstring("chat.default.username"), array('ikind'=>$kind_user,'created'=>time()-5,'tname'=>getstring("chat.default.username"),
'tmessage'=>getstring("demo.chat.question"))); '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("</thread>"); print("</thread>");
} }

View File

@ -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.include_site_name=Include host name into code
page.gen_button.secure_links=Use secure links (https) page.gen_button.secure_links=Use secure links (https)
page.preview.choose=Choose style page.preview.choose=Choose style
page.preview.choosetpl=Choose template
page.preview.intro=You can preview styles for your site 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.title=Site style
page.preview.userchat=Chat window (user-mode) page.preview.userchat=Chat window (user-mode)
page_agent.create_new=Here you can create new operator page_agent.create_new=Here you can create new operator

View File

@ -232,7 +232,12 @@ page.gen_button.choose_locale=
page.gen_button.include_site_name=Включать имя сайта в код page.gen_button.include_site_name=Включать имя сайта в код
page.gen_button.secure_links=Использовать защищенное соединение (https) page.gen_button.secure_links=Использовать защищенное соединение (https)
page.preview.choose=Выберите стиль page.preview.choose=Выберите стиль
page.preview.choosetpl=Âûáåðèòå øàáëîí
page.preview.intro=Здесь вы можете посмотреть на стиль вашего сайта 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.title=Стиль мессенджера
page.preview.userchat=Chat window (user-mode) page.preview.userchat=Chat window (user-mode)
page_agent.create_new=Создание нового оператора page_agent.create_new=Создание нового оператора

View File

@ -35,19 +35,44 @@ if(!in_array($preview, $designlist)) {
$preview = $designlist[0]; $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"); 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&amp;show=mail";
expand("../design/$preview/$show.tpl");
exit;
}
if($show == 'mailsent') {
$page['email'] = "admin@yourdomain.com";
expand("../design/$preview/$show.tpl");
exit; 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['formpreview'] = $preview;
$page['formtemplate'] = $template;
$page['availablePreviews'] = $designlist; $page['availablePreviews'] = $designlist;
$page['availableTemplates'] = array("chat", "leavemessage", "leavemessagesent", "mail", "mailsent", "all");
$page['operator'] = topage(get_operator_name($operator)); $page['operator'] = topage(get_operator_name($operator));
$page['showlink'] = "$webimroot/operator/preview.php?preview=$preview&amp;show="; $page['showlink'] = "$webimroot/operator/preview.php?preview=$preview&amp;show=";
$page['previewList'] = array();
foreach($templateList as $tpl) {
if($tpl['id'] == $template || $template == 'all') {
$page['previewList'][] = $tpl;
}
}
start_html_output(); start_html_output();
require('../view/preview.php'); require('../view/preview.php');
?> ?>

View File

@ -26,7 +26,7 @@ $istyping = verifyparam( "typed", "/^1$/", "") == '1';
if($threadid == 0 && ($token == 123 || $token == 124)) { if($threadid == 0 && ($token == 123 || $token == 124)) {
require_once('libs/demothread.php'); require_once('libs/demothread.php');
$lastid = verifyparam( "lastid", "/^\d{1,9}$/", 0); $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; exit;
} }

View File

@ -57,16 +57,30 @@
</tr> </tr>
<tr><td colspan="3" height="10"></td></tr> <tr><td colspan="3" height="10"></td></tr>
<tr> <tr>
<td colspan="3" class="formauth"><?php echo getlocal("page.preview.userchat") ?></td> <td colspan="3" class="formauth"><?php echo getlocal("page.preview.choosetpl") ?></td>
</tr>
<tr><td colspan="3" height="2"></td></tr>
<tr>
<td colspan="3">
<select name="template" onchange="this.form.submit();"><?php foreach($page['availableTemplates'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("template") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
</td>
</tr>
<?php foreach( $page['previewList'] as $pp ) { ?>
<tr><td colspan="3" height="10"></td></tr>
<tr>
<td colspan="3" class="formauth"><?php echo htmlspecialchars($pp['label']) ?>
<a href="<?php echo $page['showlink'] ?><?php echo $pp['id'] ?>" target="_blank">link</a>
</td>
</tr> </tr>
<tr><td colspan="3" height="7"></td></tr> <tr><td colspan="3" height="7"></td></tr>
<tr> <tr>
<td colspan="3"> <td colspan="3">
<iframe id="sample1" width="600" height="420" src="<?php echo $page['showlink'] ?>chat" frameborder="1" style="overflow:none;"> <iframe id="sample<?php echo $pp['id'] ?>" width="<?php echo $pp['w'] ?>" height="<?php echo $pp['h'] ?>" src="<?php echo $page['showlink'] ?><?php echo $pp['id'] ?>" frameborder="1" scrolling="no">
No iframes No iframes
</iframe> </iframe>
</td> </td>
</tr> </tr>
<?php } ?>
</table></td><td></td></tr><tr><td><img src='<?php echo $webimroot ?>/images/logincrnlb.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='<?php echo $webimroot ?>/images/logincrnrb.gif' width='16' height='16' border='0' alt=''></td></tr></table></td></tr></table> </table></td><td></td></tr><tr><td><img src='<?php echo $webimroot ?>/images/logincrnlb.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='<?php echo $webimroot ?>/images/logincrnrb.gif' width='16' height='16' border='0' alt=''></td></tr></table></td></tr></table>
</form> </form>
</td> </td>