2008-10-12 19:03:13 +04:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* This file is part of Web Instant Messenger project.
|
|
|
|
*
|
2009-01-14 01:19:12 +03:00
|
|
|
* Copyright (c) 2005-2009 Web Messenger Community
|
2008-10-12 19:03:13 +04:00
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* Evgeny Gryaznov - initial API and implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once('../libs/common.php');
|
|
|
|
require_once('../libs/chat.php');
|
2008-10-15 01:14:49 +04:00
|
|
|
require_once('../libs/pagination.php');
|
2008-10-12 19:03:13 +04:00
|
|
|
require_once('../libs/operator.php');
|
2009-03-29 03:51:33 +04:00
|
|
|
require_once('../libs/groups.php');
|
2008-10-12 19:03:13 +04:00
|
|
|
require_once('../libs/expand.php');
|
2009-01-14 01:19:12 +03:00
|
|
|
require_once('../libs/settings.php');
|
2008-10-12 19:03:13 +04:00
|
|
|
|
|
|
|
$operator = check_login();
|
|
|
|
|
2008-10-15 00:21:25 +04:00
|
|
|
$stylelist = array();
|
|
|
|
$stylesfolder = "../styles";
|
|
|
|
if($handle = opendir($stylesfolder)) {
|
2008-10-12 19:03:13 +04:00
|
|
|
while (false !== ($file = readdir($handle))) {
|
2008-10-15 00:21:25 +04:00
|
|
|
if (preg_match("/^\w+$/", $file) && is_dir("$stylesfolder/$file")) {
|
|
|
|
$stylelist[] = $file;
|
2008-10-12 19:03:13 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir($handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
$preview = verifyparam("preview","/^\w+$/", "default");
|
2008-10-15 00:21:25 +04:00
|
|
|
if(!in_array($preview, $stylelist)) {
|
|
|
|
$preview = $stylelist[0];
|
2008-10-12 19:03:13 +04:00
|
|
|
}
|
|
|
|
|
2009-04-05 04:08:26 +04:00
|
|
|
$show = verifyparam("show", "/^(chat|chatsimple|nochat|mail|mailsent|survey|leavemessage|leavemessagesent|redirect|redirected|agentchat|agentrochat)$/", "");
|
2008-11-08 04:07:46 +03:00
|
|
|
$showerrors = verifyparam("showerr", "/^on$/", "") == "on";
|
2008-11-08 02:24:45 +03:00
|
|
|
$errors = array();
|
|
|
|
if($showerrors) {
|
|
|
|
$errors[] = "Test error";
|
|
|
|
}
|
2008-10-12 19:03:13 +04:00
|
|
|
|
2008-10-13 03:05:47 +04:00
|
|
|
if($show == 'chat' || $show == 'mail' || $show == 'leavemessage' || $show == 'leavemessagesent' || $show == 'chatsimple' || $show == 'nochat') {
|
2008-10-12 19:03:13 +04:00
|
|
|
setup_chatview_for_user(array('threadid' => 0,'userName' => getstring("chat.default.username"), 'ltoken' => 123), "ajaxed");
|
2008-10-13 00:35:42 +04:00
|
|
|
$page['mailLink'] = "$webimroot/operator/preview.php?preview=$preview&show=mail";
|
2009-03-12 04:07:35 +03:00
|
|
|
$page['info'] = "";
|
2008-10-15 00:21:25 +04:00
|
|
|
expand("../styles", "$preview", "$show.tpl");
|
2008-10-12 19:03:13 +04:00
|
|
|
exit;
|
|
|
|
}
|
2009-04-05 04:08:26 +04:00
|
|
|
if($show == 'survey') {
|
|
|
|
loadsettings();
|
|
|
|
setup_survey("Visitor", "", "", "", "http://google.com");
|
|
|
|
setup_logo();
|
|
|
|
expand("../styles", "$preview", "$show.tpl");
|
|
|
|
exit;
|
|
|
|
}
|
2008-10-13 00:35:42 +04:00
|
|
|
if($show == 'mailsent') {
|
|
|
|
$page['email'] = "admin@yourdomain.com";
|
2008-11-08 02:24:45 +03:00
|
|
|
setup_logo();
|
2008-10-15 00:21:25 +04:00
|
|
|
expand("../styles", "$preview", "$show.tpl");
|
2008-10-13 00:35:42 +04:00
|
|
|
exit;
|
|
|
|
}
|
2008-10-15 01:14:49 +04:00
|
|
|
if($show == 'redirect' || $show == 'redirected' || $show == 'agentchat' || $show == 'agentrochat' ) {
|
|
|
|
setup_chatview_for_operator(
|
|
|
|
array(
|
|
|
|
'threadid' => 0,
|
|
|
|
'userName' => getstring("chat.default.username"),
|
|
|
|
'remote' => "1.2.3.4",
|
|
|
|
'agentId' => 1,
|
|
|
|
'userid' => 'visitor1',
|
|
|
|
'locale' => $current_locale,
|
|
|
|
'ltoken' => $show=='agentrochat' ? 124 : 123),
|
|
|
|
array(
|
|
|
|
'operatorid' => ($show=='agentrochat' ? 2 : 1),
|
|
|
|
));
|
|
|
|
if($show=='redirect') {
|
2009-03-29 03:51:33 +04:00
|
|
|
setup_redirect_links( 0,$show=='agentrochat' ? 124 : 123);
|
2008-10-15 01:14:49 +04:00
|
|
|
} elseif($show=='redirected') {
|
2009-03-29 03:51:33 +04:00
|
|
|
$page['message'] = getlocal2("chat.redirected.content",array("Administrator"));
|
2008-10-15 01:14:49 +04:00
|
|
|
}
|
|
|
|
$page['redirectLink'] = "$webimroot/operator/preview.php?preview=$preview&show=redirect";
|
|
|
|
expand("../styles", "$preview", "$show.tpl");
|
|
|
|
exit;
|
|
|
|
}
|
2008-10-13 00:35:42 +04:00
|
|
|
|
|
|
|
$templateList = array(
|
2008-11-08 02:24:45 +03:00
|
|
|
array('label' => getlocal("page.preview.userchat"), 'id' => 'chat', 'h' => 480, 'w' => 640),
|
|
|
|
array('label' => getlocal("page.preview.chatsimple"), 'id' => 'chatsimple', 'h' => 480, 'w' => 640),
|
|
|
|
array('label' => getlocal("page.preview.nochat"), 'id' => 'nochat', 'h' => 480, 'w' => 640),
|
2009-04-05 04:08:26 +04:00
|
|
|
array('label' => getlocal("page.preview.survey"), 'id' => 'survey', 'h' => 480, 'w' => 640),
|
2008-11-08 02:24:45 +03:00
|
|
|
array('label' => getlocal("page.preview.leavemessage"), 'id' => 'leavemessage', 'h' => 480, 'w' => 640),
|
|
|
|
array('label' => getlocal("page.preview.leavemessagesent"), 'id' => 'leavemessagesent', 'h' => 480, 'w' => 640),
|
2008-10-13 00:35:42 +04:00
|
|
|
array('label' => getlocal("page.preview.mail"), 'id' => 'mail', 'h' => 254, 'w' => 603),
|
|
|
|
array('label' => getlocal("page.preview.mailsent"), 'id' => 'mailsent', 'h' => 254, 'w' => 603),
|
2008-11-08 02:24:45 +03:00
|
|
|
array('label' => getlocal("page.preview.redirect"), 'id' => 'redirect', 'h' => 480, 'w' => 640),
|
|
|
|
array('label' => getlocal("page.preview.redirected"), 'id' => 'redirected', 'h' => 480, 'w' => 640),
|
|
|
|
array('label' => getlocal("page.preview.agentchat"), 'id' => 'agentchat', 'h' => 480, 'w' => 640),
|
|
|
|
array('label' => getlocal("page.preview.agentrochat"), 'id' => 'agentrochat', 'h' => 480, 'w' => 640),
|
2008-10-13 00:35:42 +04:00
|
|
|
);
|
|
|
|
|
|
|
|
$template = verifyparam("template", "/^\w+$/", "chat");
|
2008-10-12 19:03:13 +04:00
|
|
|
|
|
|
|
$page['formpreview'] = $preview;
|
2008-10-13 00:35:42 +04:00
|
|
|
$page['formtemplate'] = $template;
|
2008-11-08 04:07:46 +03:00
|
|
|
$page['canshowerrors'] = $template == 'leavemessage' || $template == 'mail' || $template == 'all';
|
|
|
|
$page['formshowerr'] = $showerrors;
|
2008-10-15 00:21:25 +04:00
|
|
|
$page['availablePreviews'] = $stylelist;
|
2008-10-15 01:14:49 +04:00
|
|
|
$page['availableTemplates'] = array(
|
|
|
|
"chat", "chatsimple", "nochat",
|
2009-04-05 04:08:26 +04:00
|
|
|
"survey", "leavemessage", "leavemessagesent",
|
2008-10-15 01:14:49 +04:00
|
|
|
"mail", "mailsent",
|
|
|
|
"redirect", "redirected",
|
|
|
|
"agentchat", "agentrochat",
|
|
|
|
"all");
|
|
|
|
|
2008-11-08 04:07:46 +03:00
|
|
|
$page['showlink'] = "$webimroot/operator/preview.php?preview=$preview&".($showerrors?"showerr=on&":"")."show=";
|
2008-10-12 19:03:13 +04:00
|
|
|
|
2008-10-13 00:35:42 +04:00
|
|
|
$page['previewList'] = array();
|
|
|
|
foreach($templateList as $tpl) {
|
|
|
|
if($tpl['id'] == $template || $template == 'all') {
|
|
|
|
$page['previewList'][] = $tpl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-16 04:20:04 +03:00
|
|
|
prepare_menu($operator);
|
2008-10-12 19:03:13 +04:00
|
|
|
start_html_output();
|
2009-01-14 06:01:25 +03:00
|
|
|
setup_settings_tabs(2);
|
2008-10-12 19:03:13 +04:00
|
|
|
require('../view/preview.php');
|
|
|
|
?>
|