[redirect] action + views

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@133 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2008-10-02 09:48:03 +00:00
parent 78e48df62d
commit 823d445e67
3 changed files with 310 additions and 0 deletions

View File

@ -0,0 +1,59 @@
<?php
/*
* This file is part of Web Instant Messenger project.
*
* Copyright (c) 2005-2008 Internet Services Ltd.
* 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/operator.php');
require_once('../libs/chat.php');
$operator = check_login();
$threadid = verifyparam( "thread", "/^\d{1,8}$/");
$token = verifyparam( "token", "/^\d{1,8}$/");
$thread = thread_by_id($threadid);
if( !$thread || !isset($thread['ltoken']) || $token != $thread['ltoken'] ) {
die("wrong thread");
}
$nextid = verifyparam( "nextAgent", "/^\d{1,8}$/");
$nextOperator = operator_by_id($nextid);
$page = array();
$errors = array();
if( $nextOperator ) {
$page['nextAgent'] = topage(get_operator_name($nextOperator));
if( $thread['istate'] == $state_chatting ) {
$link = connect();
commit_thread( $threadid,
array("istate" => $state_waiting, "nextagent" => $nextid, "agentId" => 0), $link);
post_message_($thread['threadid'], $kind_events,
getstring2_("chat.status.operator.redirect",
array(get_operator_name($operator)),$thread['locale']), $link);
mysql_close($link);
} else {
$errors[] = "You are not chatting with visitor"; // FIXME
}
} else {
$errors[] = "Unknown operator"; // FIXME
}
start_html_output();
if( count($errors) > 0 ) {
require('../view/chat_error.php');
} else {
require('../view/redirected.php');
}
?>

View File

@ -0,0 +1,148 @@
<?php
/*
* This file is part of Web Instant Messenger project.
*
* Copyright (c) 2005-2008 Internet Services Ltd.
* 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
*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title><?php echo getlocal("chat.window.title.agent") ?></title>
<link rel="shortcut icon" href="<?php echo $webimroot ?>/images/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="<?php echo $webimroot ?>/chat.css" />
</head>
<body bgcolor="#FFFFFF" background="<?php echo $webimroot ?>/images/bg.gif" text="#000000" link="#C28400" vlink="#C28400" alink="#C28400" marginwidth="0" marginheight="0" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td valign="top">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td height="90"></td>
<td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="50%" height="90" class="window"><h1><?php echo getlocal("chat.redirect.title") ?></h1></td>
<td width="50%" align="right" valign="bottom" class="window">
<h2><?php echo getlocal("chat.redirect.choose_operator") ?></h2>
<img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="5" border="0" alt="" /><br>
</td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr>
<td height="100%"></td>
<td>
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="15"><img src='<?php echo $webimroot ?>/images/wincrnlt.gif' width="15" height="15" border="0" alt="" /></td>
<td width="100%" background="<?php echo $webimroot ?>/images/winbg.gif" class="bgcy"><img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="1" border="0" alt="" /></td>
<td width="15"><img src='<?php echo $webimroot ?>/images/wincrnrt.gif' width="15" height="15" border="0" alt="" /></td>
</tr>
<tr>
<td height="100%" bgcolor="#FED840"><img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="1" border="0" alt="" /></td>
<td background="<?php echo $webimroot ?>/images/winbg.gif" class="bgcy">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="33%" valign="top" class="window">
<?php for( $indagent = 0; $indagent < count($page['pagination.items']); $indagent += 3 ) { $agent = $page['pagination.items'][$indagent]; ?>
<?php $page['params']['nextAgent'] = $agent['operatorid']; ?>
<a href="<?php echo add_params($webimroot."/operator/redirect.php",$page['params']) ?>" title="<?php echo topage($agent['vclocalename']) ?>"><?php echo topage($agent['vclocalename']) ?></a><br>
<img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="5" border="0" alt="" /><br>
<?php } ?>
</td>
<td width="50" background="<?php echo $webimroot ?>/images/textdiv.gif" valign="top">
<img src='<?php echo $webimroot ?>/images/textdiv.gif' width="50" height="1" border="0" alt="" /></td>
<td width="33%" valign="top" class="window">
<?php for( $indagent = 1; $indagent < count($page['pagination.items']); $indagent += 3 ) { $agent = $page['pagination.items'][$indagent]; ?>
<?php $page['params']['nextAgent'] = $agent['operatorid']; ?>
<a href="<?php echo add_params($webimroot."/operator/redirect.php",$page['params']) ?>" title="<?php echo topage($agent['vclocalename']) ?>"><?php echo topage($agent['vclocalename']) ?></a><br>
<img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="5" border="0" alt="" /><br>
<?php } ?>
</td>
<td width="50" background="<?php echo $webimroot ?>/images/textdiv.gif" valign="top">
<img src='<?php echo $webimroot ?>/images/textdiv.gif' width="50" height="1" border="0" alt="" /></td>
<td width="33%" valign="top" class="window">
<?php for( $indagent = 2; $indagent < count($page['pagination.items']); $indagent += 3 ) { $agent = $page['pagination.items'][$indagent]; ?>
<?php $page['params']['nextAgent'] = $agent['operatorid']; ?>
<a href="<?php echo add_params($webimroot."/operator/redirect.php",$page['params']) ?>" title="<?php echo topage($agent['vclocalename']) ?>"><?php echo topage($agent['vclocalename']) ?></a><br>
<img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="5" border="0" alt="" /><br>
<?php } ?>
</td>
</tr>
</table>
</td>
<td bgcolor="#E8A400"><img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="1" border="0" alt="" /></td>
</tr>
<tr>
<td><img src='<?php echo $webimroot ?>/images/wincrnlb.gif' width="15" height="15" border="0" alt="" /></td>
<td background="<?php echo $webimroot ?>/images/winbg.gif" class="bgcy"><img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="1" border="0" alt="" /></td>
<td><img src='<?php echo $webimroot ?>/images/wincrnrb.gif' width="15" height="15" border="0" alt="" /></td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr>
<td height="90"></td>
<td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="50%" align="left">
<?php echo generate_pagination($page['pagination']) ?>
</td>
<td width="50%" align="right">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><a href="javascript:window.back();" title="<?php echo getlocal("chat.redirect.back") ?>"><img src='<?php echo $webimroot ?>/images/buttons/back.gif' width="25" height="25" border="0" alt="" /></a></td>
<td width="5"></td>
<td class="button"><a href="javascript:window.back();" title="<?php echo getlocal("chat.redirect.back") ?>"><?php echo getlocal("chat.redirect.back") ?></a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr>
<td width="30"><img src='<?php echo $webimroot ?>/images/free.gif' width="30" height="1" border="0" alt="" /></td>
<td width="100%"><img src='<?php echo $webimroot ?>/images/free.gif' width="540" height="1" border="0" alt="" /></td>
<td width="30"><img src='<?php echo $webimroot ?>/images/free.gif' width="30" height="1" border="0" alt="" /></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,103 @@
<?php
/*
* This file is part of Web Instant Messenger project.
*
* Copyright (c) 2005-2008 Internet Services Ltd.
* 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
*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title><?php echo getlocal("chat.window.title.agent") ?></title>
<link rel="shortcut icon" href="<?php echo $webimroot ?>/images/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="<?php echo $webimroot ?>/chat.css" />
</head>
<body bgcolor="#FFFFFF" background="<?php echo $webimroot ?>/images/bg.gif" text="#000000" link="#C28400" vlink="#C28400" alink="#C28400" marginwidth="0" marginheight="0" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td valign="top">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td height="75"></td>
<td class="window">
<h1><?php echo getlocal("chat.redirected.title") ?></h1>
</td>
<td></td>
</tr>
<tr>
<td height="100%"></td>
<td>
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="15"><img src='<?php echo $webimroot ?>/images/wincrnlt.gif' width="15" height="15" border="0" alt="" /></td>
<td width="100%" background="<?php echo $webimroot ?>/images/winbg.gif" class="bgcy"><img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="1" border="0" alt="" /></td>
<td width="15"><img src='<?php echo $webimroot ?>/images/wincrnrt.gif' width="15" height="15" border="0" alt="" /></td>
</tr>
<tr>
<td height="100%" bgcolor="#FED840"><img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="1" border="0" alt="" /></td>
<td background="<?php echo $webimroot ?>/images/winbg.gif" class="bgcy">
<?php echo getlocal2("chat.redirected.content",array($page['nextAgent'])) ?><br/>
<a href="javascript:window.close();"><?php echo getlocal("chat.redirected.closewindow") ?></a>
</td>
<td bgcolor="#E8A400"><img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="1" border="0" alt="" /></td>
</tr>
<tr>
<td><img src='<?php echo $webimroot ?>/images/wincrnlb.gif' width="15" height="15" border="0" alt="" /></td>
<td background="<?php echo $webimroot ?>/images/winbg.gif" class="bgcy"><img src='<?php echo $webimroot ?>/images/free.gif' width="1" height="1" border="0" alt="" /></td>
<td><img src='<?php echo $webimroot ?>/images/wincrnrb.gif' width="15" height="15" border="0" alt="" /></td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr>
<td height="70"></td>
<td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="100%" align="right">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><a href="javascript:window.close();" title="<?php echo getlocal("chat.redirected.close") ?>"><img src='<?php echo $webimroot ?>/images/buttons/back.gif' width="25" height="25" border="0" alt="" /></a></td>
<td width="5"></td>
<td class="button"><a href="javascript:window.close();" title="<?php echo getlocal("chat.redirected.close") ?>"><?php echo getlocal("chat.redirected.close") ?></a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr>
<td width="30"><img src='<?php echo $webimroot ?>/images/free.gif' width="30" height="1" border="0" alt="" /></td>
<td width="100%"><img src='<?php echo $webimroot ?>/images/free.gif' width="540" height="1" border="0" alt="" /></td>
<td width="30"><img src='<?php echo $webimroot ?>/images/free.gif' width="30" height="1" border="0" alt="" /></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>