dashboard (+nice locale chooser), pending users (+show/hide menu), fixed layout for install

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@404 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2009-03-13 23:46:25 +00:00
parent 9785472323
commit baba7b9008
15 changed files with 302 additions and 54 deletions

View File

@ -62,40 +62,40 @@ var HtmlGenerationUtils = {
},
generateOneRowTable: function(content) {
return '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr>' + content + '</tr></table>';
return '<table class="inner"><tr>' + content + '</tr></table>';
},
viewOpenCell: function(username,servlet,id,canview,canopen,ban,message,cantakenow) {
var cellsCount = 2;
var link = servlet+"?thread="+id;
var gen = '<td style="padding-left:0px; padding-right:0px;">';
var gen = '<td>';
if(canopen || canview ) {
gen += HtmlGenerationUtils.popupLink( (cantakenow||!canview) ? link : link+"&viewonly=true", localized[canopen ? 0 : 1], "ImCenter"+id, username, 640, 480, ban);
gen += HtmlGenerationUtils.popupLink( (cantakenow||!canview) ? link : link+"&viewonly=true", localized[canopen ? 0 : 1], "ImCenter"+id, username, 640, 480, null);
} else {
gen += '<a href="#">' + username + '</a>';
}
gen += '</td><td><img src="'+webimRoot+'/images/free.gif" width="5" height="1" border="0" alt=""></td>';
gen += '</td>';
if( canopen ) {
gen += '<td width="30" align="center">';
gen += '<td class="icon">';
gen += HtmlGenerationUtils.popupLink( link, localized[0], "ImCenter"+id, '<img src="'+webimRoot+'/images/tbliclspeak.gif" width="15" height="15" border="0" alt="'+localized[0]+'">', 640, 480, null);
gen += '</td>';
cellsCount++;
}
if( canview ) {
gen += '<td width="30" align="center">';
gen += '<td class="icon">';
gen += HtmlGenerationUtils.popupLink( link+"&viewonly=true", localized[1], "ImCenter"+id, '<img src="'+webimRoot+'/images/tbliclread.gif" width="15" height="15" border="0" alt="'+localized[1]+'">', 640, 480, null);
gen += '</td>';
cellsCount++;
}
if( message != "" ) {
gen += '</tr><tr><td class="firstmessage" align="right" colspan="'+cellsCount+'"><a href="javascript:void(0)" title="'+message+'" onclick="alert(this.title);return false;">';
gen += '</tr><tr><td class="firstmessage" colspan="'+cellsCount+'"><a href="javascript:void(0)" title="'+message+'" onclick="alert(this.title);return false;">';
gen += message.length > 30 ? message.substring(0,30) + '...' : message;
gen += '</a></td>';
}
return HtmlGenerationUtils.generateOneRowTable(gen);
},
banCell: function(id,banid){
return '<td width="30" align="center">'+
return '<td class="icon">'+
HtmlGenerationUtils.popupLink( webimRoot+'/operator/ban.php?'+(banid ? 'id='+banid : 'thread='+id), localized[2], "ban"+id, '<img src="'+webimRoot+'/images/ban.gif" width="15" height="15" border="0" alt="'+localized[2]+'">', 720, 480, null)+
'</td>';
}
@ -193,6 +193,7 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
}
if( row == null ) {
row = this.t.insertRow(startRow.rowIndex+1);
row.className = (ban == "blocked" && stateid != "chat") ? "ban" : "in"+stateid;
row.id = "thr"+id;
this.threadTimers[id] = new Array(vtime,modified,stateid);
CommonUtils.insertCell(row, "name", "visitor", null, null, HtmlGenerationUtils.viewOpenCell(vname,this._options.agentservl,id,canview,canopen,ban,message,stateid!='chat'));
@ -207,6 +208,7 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
return true;
} else {
this.threadTimers[id] = new Array(vtime,modified,stateid);
row.className = (ban == "blocked" && stateid != "chat") ? "ban" : "in"+stateid;
setcell(this.t, row,"name",HtmlGenerationUtils.viewOpenCell(vname,this._options.agentservl,id,canview,canopen,ban,message,stateid!='chat'));
setcell(this.t, row,"contid",vaddr);
setcell(this.t, row,"state",vstate);
@ -303,9 +305,32 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
}
});
function togglemenu() {
if($("sidebar") && $("wcontent") && $("togglemenu")) {
if($("wcontent").className == "contentnomenu") {
$("sidebar").style.display = "block";
$("wcontent").className = "contentinner";
$("togglemenu").innerHTML = localized[4];
} else {
$("sidebar").style.display = "none";
$("wcontent").className = "contentnomenu";
$("togglemenu").innerHTML = localized[3];
}
}
}
Behaviour.register({
'#togglemenu' : function(el) {
el.onclick = function() {
togglemenu();
};
}
});
var webimRoot = "";
EventHelper.register(window, 'onload', function(){
webimRoot = updaterOptions.wroot;
new Ajax.ThreadListUpdater(({table:$("threadlist"),status:$("connstatus")}).extend(updaterOptions || {}));
togglemenu();
});

View File

@ -70,6 +70,7 @@ a {
.contentinner {
margin-right: 210px;
padding: 10px 60px 10px 20px;
overflow: hidden;
}
.contentnomenu {
@ -418,24 +419,54 @@ table.awaiting th {
color: #1D485E;
padding: 10px 8px;
border-bottom: 2px solid #2F7598;
text-align: center;
}
table.awaiting th.first {
text-align: left;
}
table.awaiting table.inner {
border: none;
width: 100%;
}
table.awaiting table.inner .icon {
width: 30px;
text-align: center;
}
table.awaiting td.visitor {
color: #2f7599;
color: #296685;
border-bottom: 1px solid #ccc;
padding: 10px 8px;
margin: 0px;
}
.awaiting .visitor a { color: #296685; }
.awaiting tr:hover .visitor, .awaiting tr:hover .visitor a { color: #1D485E; }
.awaiting tr.ban .visitor, .awaiting tr.ban .visitor a { color: #9AC8E0; }
.awaiting tr.ban:hover .visitor, .awaiting tr.ban:hover .visitor a { color: #4C9CC8; }
.awaiting tr.inwait .visitor, .awaiting tr.inwait a { font-weight: bold; }
.awaiting tr.inprio .visitor, .awaiting tr.inprio a { font-weight: bold; font-size: 1.05em; }
.awaiting tr.inchat .visitor, .awaiting tr.inchat .visitor a { color: #777; }
.awaiting tr.inchat:hover .visitor, .awaiting tr.inchat:hover .visitor a { color: #444; }
.awaiting tr.inchat a { text-decoration: none; }
.firstmessage {
text-align: right;
font-size: 0.8em;
padding-right: 10px;
}
.firstmessage a {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 10px;
text-decoration: none;
color: #6a6a6a;
}
.firstmessage a:hover {
color: #8a6a6a;
text-decoration: underline;
}
#connstatus {
@ -528,24 +559,79 @@ table.awaiting td.visitor {
/* dashboard */
#dashboard {
width: 100%;
}
.dashitem {
width: 200px;
height: 7em;
margin: 0px 2em 2em 0px;
padding: 5px 5px;
float: left;
width:33%;
margin: 0px 2em 5em 0px;
padding: 5px 2em 5em;
vertical-align: top;
}
.dashitem:hover {
}
.dashitem a {
background: url(images/graydot.gif) repeat-x left bottom;
padding-top:2px;
padding-bottom: 10px;
margin-bottom: 10px;
display: block;
}
.dashitem img, #dashlocalesPopup h2 img {
float: left;
padding-right:10px;
}
#dashlocalesPopup h2 img {
margin-top: -3px;
}
#dashlocalesPopup .locales {
line-height: 180%;
margin-left:10px;
}
#dashlocalesPopup h2 {
font-size: 1.5em;
margin-bottom: 0.9em;
padding: 5px 30px 0.8em 0px;
border-bottom: 2px solid #2F7598;
}
#dashlocalesPopupClose {
float: right;
position:absolute;
right:5px;
top:5px;
}
#dashlocalesPopup {
display:none;
position:fixed;
_position:absolute; /* ie6*/
background:#FFFFFF;
border:2px solid #2F7598;
z-index:110;
padding:1em 1em;
font-size:1em;
}
#backgroundPopup{
display:none;
position:fixed;
_position:absolute; /* ie6*/
height:100%;
opacity: .5;
width:100%;
top:0;
left:0;
background:#000000;
border:1px solid #cecece;
z-index:101;
}
/* install */
#install li {
@ -596,3 +682,4 @@ table.awaiting td.visitor {
color: #A1A1A1;
font-size: 11px;
}

View File

@ -1 +1 @@
var myAgent="";var hk=0;var myRealAgent="";function ik(){var jk=["\u006fpe\162\141","\155\163i\145","sa\u0066\141\162i","\146ir\u0065\146\u006f\u0078","\u006eets\u0063ap\u0065","\u006do\u007ail\u006c\141"];var ej=navigator.userAgent.toLowerCase();for(var i=0;i<jk.length;i++){var kk=jk[i];if(ej.indexOf(kk)!=-1){myAgent=kk;if(!window.RegExp)break;var lk=new RegExp(kk+"\u005b \/]\u003f([0\u002d\071\135+\u0028\.\133\060-9\135\053)\077\u0029");if(lk.exec(ej)!=null){hk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="G\u0065c\153\u006f")myAgent="moz";} ik();function getEl(name){return document.getElementById(name);}
var myAgent="";var ik=0;var myRealAgent="";function jk(){var kk=["opera","m\u0073i\145","\u0073af\141\162\u0069","\146ire\u0066\u006f\170","ne\164s\143\141pe","mo\172il\154a"];var ej=navigator.userAgent.toLowerCase();for(var i=0;i<kk.length;i++){var lk=kk[i];if(ej.indexOf(lk)!=-1){myAgent=lk;if(!window.RegExp)break;var ok=new RegExp(lk+"[\040\/\u005d\u003f(\u005b0\u002d\u0039\135\053(\.\u005b0-9]+\051\u003f\u0029");if(ok.exec(ej)!=null){ik=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="\107ec\u006bo")myAgent="\u006d\u006f\172";} jk();function getEl(name){return document.getElementById(name);}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
var popupStatus = 0;
function loadPopup(){
if(popupStatus==0){
$("#backgroundPopup").css({
"opacity": "0.7"
});
$("#backgroundPopup").fadeIn("slow");
$("#dashlocalesPopup").fadeIn("slow");
popupStatus = 1;
}
}
function disablePopup(){
if(popupStatus==1){
$("#backgroundPopup").fadeOut("slow");
$("#dashlocalesPopup").fadeOut("slow");
popupStatus = 0;
}
}
function normpos(a) {
if(a < 10) {
return 10;
}
return a;
}
function centerPopup(){
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#dashlocalesPopup").height();
var popupWidth = $("#dashlocalesPopup").width();
$("#dashlocalesPopup").css({
"position": "absolute",
"top": normpos((windowHeight-popupHeight) * 0.2),
"left": normpos(windowWidth/2-popupWidth/2)
});
$("#backgroundPopup").css({
"height": windowHeight
});
}
$(function(){
$("#changelang").click(function(){
centerPopup();
loadPopup();
return false;
});
$("#dashlocalesPopupClose").click(function(){
disablePopup();
return false;
});
$("#backgroundPopup").click(function(){
disablePopup();
});
$(document).keypress(function(e){
if(e.keyCode==27 && popupStatus==1){
disablePopup();
}
});
});

File diff suppressed because one or more lines are too long

View File

@ -147,6 +147,7 @@ install.updatedb=Please, run <a href="{0}">Update wizard</a> to adjust your data
installed.login_link=Proceed to login page
installed.message=<b>Application installed successfully.</b>
installed.notice=You can logon as admin with empty password.<br/><br/><font color="#c13030"><b>!!! For security reasons, please change your password immediately and remove /webim/install folder from your server.</b></font>
lang.choose=Choose your language
leavemail.body=Your have a message from {0}:\n\n{2}\n\nHis email: {1}\n{3}\n--- \nYours site messenger
leavemail.subject=Question from {0}
leavemessage.close=Close
@ -167,6 +168,8 @@ mailthread.perform=Send
mailthread.title=Send chat history<br>by mail
menu.agents=Agents list
menu.blocked=Blocked visitors
menu.locale=Language
menu.locale.content=Change locale.
menu.main=Main
menu.operator=You are {0}
my_settings.error.password_match=Entered passwords do not match
@ -254,6 +257,8 @@ page_settings.tab.features=Optional Services
page_settings.tab.main=General
page_settings.tab.themes=Themes preview
page_settings.tab.updates=Updates
pending.menu.hide=Hide menu >>
pending.menu.show=Show menu >>
pending.table.ban=Ban the visitor
pending.table.head.contactid=Visitor's address
pending.table.head.etc=Misc

View File

@ -6,6 +6,7 @@ admin.content.client_gen_button=
admin.content.client_settings=Вы можете задать опции влияющие на отображение чат окна и общее поведение системы
admin.content.description=Набор функций, доступный только зарегистрированным операторам
agent.not_logged_in=Ваша сессия устарела, войдите, пожалуйста, снова
app.descr=Веб Мессенджер это приложение для общения с посетителями вашего сайта.
app.title=Веб Мессенджер
ban.error.duplicate=Адрес {0} уже зарегестрирован в системе, нажмите <a href="ban.php?id={1}">здесь</a> чтобы отредактировать его.
button.delete=Удалить
@ -145,6 +146,7 @@ install.title=
installed.login_link=Войти в систему
installed.message=<b>Установка успешно завершена. </b>
installed.notice=Вы можете войти в систему как admin с пустым паролем.<br/><br/><font color="#c13030"><b>!!! В целях безопасности, удалите, пожалуйста, каталог /webim/install с вашего сервера и поменяйте пароль.</b></font>
lang.choose=Выберите ваш язык
leavemail.body=Ваш посетитель '{0}' оставил сообщение:\n\n{2}\n\nЕmail: {1}\n{3}\n--- \nС уважением,\nВаш Веб Мессенджер
leavemail.subject=Вопрос от {0}
leavemessage.close=Закрыть
@ -165,6 +167,8 @@ mailthread.perform=
mailthread.title=Отправить историю разговора<br>на почтовый ящик
menu.agents=Список агентов
menu.blocked=Нежелательные посетители
menu.locale=Язык
menu.locale.content=Сменить язык.
menu.main=Главная
menu.operator=Вы {0}
my_settings.error.password_match=Введенные пароли должны совпадать
@ -241,6 +245,7 @@ page_bans.title=
page_bans.to=До
page_client.pending_users=На этой странице можно просмотреть список ожидающих ответа посетителей.
page_login.error=Введен неправильный логин или пароль
page_login.intro=Пожалуйста, введите ваши имя и пароль для получения операторского доступа к системе.
page_login.login=Логин:
page_login.password=Пароль:
page_login.remember=Запомнить
@ -250,6 +255,8 @@ page_settings.intro=
page_settings.tab.features=Дополнительные сервисы
page_settings.tab.main=Общее
page_settings.tab.themes=Просмотр стилей
pending.menu.hide=Спрятать меню >>
pending.menu.show=Показать меню >>
pending.table.ban=Пометить посетителя как нежелательного
pending.table.head.contactid=Адрес посетителя
pending.table.head.etc=Разное

View File

@ -71,7 +71,11 @@ function thread_to_xml($thread,$link) {
}
$result .= " state=\"$state\" typing=\"".$thread['userTyping']."\">";
$result .= "<name>".htmlspecialchars(htmlspecialchars(get_user_name($thread['userName'],$thread['remote'], $thread['userid'])))."</name>";
$result .="<name>";
if($banForThread) {
$result .= htmlspecialchars("[spam]&nbsp;");
}
$result .= htmlspecialchars(htmlspecialchars(get_user_name($thread['userName'],$thread['remote'], $thread['userid'])))."</name>";
$result .= "<addr>".htmlspecialchars(get_user_addr($thread['remote']))."</addr>";
$result .= "<agent>".htmlspecialchars(htmlspecialchars($threadoperator))."</agent>";
$result .= "<time>".$thread['unix_timestamp(dtmcreated)']."000</time>";

View File

@ -10,7 +10,7 @@ function tpl_menu() { global $page, $webimroot, $errors, $current_locale;
?>
<?php if(isset($page) && isset($page['localeLinks'])) { ?>
<li>
<h2><b>locales</b></h2>
<h2><b><?php echo getlocal("lang.choose") ?></b></h2>
<ul class="locales">
<?php foreach($page['localeLinks'] as $id => $title) { ?>
<li<?php menuloc($id)?> ><a href='?locale=<?php echo $id ?>'><?php echo $title ?></a></li>

View File

@ -40,9 +40,9 @@
<div class="contentdiv">
<?php if(function_exists('tpl_menu')) { ?>
<div class="contentinner">
<div id="wcontent" class="contentinner">
<?php } else { ?>
<div class="contentnomenu">
<div id="wcontent" class="contentnomenu">
<?php } ?>
<?php
tpl_content();

View File

@ -14,6 +14,7 @@
$page['title'] = getlocal("install.err.title");
$page['no_right_menu'] = true;
$page['fixedwrap'] = true;
function tpl_content() { global $page, $webimroot, $errors;
?>

View File

@ -14,6 +14,7 @@
require_once('inc_locales.php');
$page['title'] = getlocal("install.title");
$page['fixedwrap'] = true;
function tpl_content() { global $page, $webimroot, $errors;
?>

View File

@ -16,71 +16,102 @@ require_once("inc_menu.php");
$page['title'] = getlocal("topMenu.admin");
$page['menuid'] = "main";
function tpl_content() { global $page, $webimroot;
function tpl_header() { global $page, $webimroot;
?>
<script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/locale.js"></script>
<?php
}
function tpl_content() { global $page, $webimroot, $current_locale;
?>
<?php echo getlocal("admin.content.description") ?>
<br/>
<br/>
<br/>
<?php if( $page['needUpdate'] ) { ?>
<div id="formmessage"><?php echo getlocal2("install.updatedb",array($page['updateWizard'])) ?></div>
<br/>
<?php } ?>
<div id="dashboard">
<div class="dashitem">
<table id="dashboard">
<tr>
<td class="dashitem">
<img src="/webim/images/dash/visitors.gif" alt=""/>
<a href='<?php echo $webimroot ?>/operator/users.php'>
<?php echo getlocal('topMenu.users') ?></a>
<?php echo getlocal('page_client.pending_users') ?>
</div>
</td>
<div class="dashitem">
<td class="dashitem">
<img src="/webim/images/dash/history.gif" alt=""/>
<a href='<?php echo $webimroot ?>/operator/history.php'>
<?php echo getlocal('page_analysis.search.title') ?></a>
<?php echo getlocal('content.history') ?>
</div>
</td>
<?php if( $page['showban'] ) { ?>
<div class="dashitem">
<td class="dashitem">
<img src="/webim/images/dash/blocked.gif" alt=""/>
<a href='<?php echo $webimroot ?>/operator/blocked.php'>
<?php echo getlocal('menu.blocked') ?></a>
<?php echo getlocal('content.blocked') ?>
</div>
</td>
<?php } ?>
</tr>
<?php if( $page['showadmin'] ) { ?>
<br clear="all"/>
<div class="dashitem">
<tr>
<td class="dashitem">
<img src="/webim/images/dash/operators.gif" alt=""/>
<a href='<?php echo $webimroot ?>/operator/operators.php'>
<?php echo getlocal('leftMenu.client_agents') ?></a>
<?php echo getlocal('admin.content.client_agents') ?>
</div>
</td>
<div class="dashitem">
<td class="dashitem">
<img src="/webim/images/dash/getcode.gif" alt=""/>
<a href='<?php echo $webimroot ?>/operator/getcode.php'>
<?php echo getlocal('leftMenu.client_gen_button') ?></a>
<?php echo getlocal('admin.content.client_gen_button') ?>
</div>
</td>
<div class="dashitem">
<td class="dashitem">
<img src="/webim/images/dash/settings.gif" alt=""/>
<a href='<?php echo $webimroot ?>/operator/settings.php'>
<?php echo getlocal('leftMenu.client_settings') ?></a>
<?php echo getlocal('admin.content.client_settings') ?>
</div>
</td>
</tr>
<?php } ?>
<br clear="all"/>
<tr>
<td class="dashitem">
<img src="/webim/images/dash/locale.gif" alt=""/>
<a href='#' id="changelang">
<?php echo getlocal('menu.locale') ?></a>
<?php echo getlocal('menu.locale.content') ?>
</td>
<div class="dashitem">
<td class="dashitem">
<img src="/webim/images/dash/exit.gif" alt=""/>
<a href='<?php echo $webimroot ?>/operator/logout.php'>
<?php echo getlocal('topMenu.logoff') ?></a>
<?php echo getlocal('content.logoff') ?>
</div>
</td>
</tr>
</table>
<div id="dashlocalesPopup">
<a href="#" id="dashlocalesPopupClose"><img src="/webim/images/dash/close.gif" alt="X"/></a>
<h2><img src="/webim/images/dash/locale.gif" alt=""/>
<b><?php echo getlocal("lang.choose") ?></b></h2>
<ul class="locales">
<?php foreach($page['localeLinks'] as $id => $title) { ?>
<li<?php echo $current_locale == $id ? " class=\"active\"" : "" ?> ><a href='?locale=<?php echo $id ?>'><?php echo $title ?></a></li>
<?php } ?>
</ul>
</div>
<div id="backgroundPopup"></div>
<?php
} /* content */

View File

@ -12,6 +12,7 @@
* Evgeny Gryaznov - initial API and implementation
*/
require_once("inc_menu.php");
$page['title'] = getlocal("clients.title");
function tpl_header() { global $page, $webimroot;
@ -21,7 +22,9 @@ function tpl_header() { global $page, $webimroot;
var localized = new Array(
"<?php echo getlocal("pending.table.speak") ?>",
"<?php echo getlocal("pending.table.view") ?>",
"<?php echo getlocal("pending.table.ban") ?>"
"<?php echo getlocal("pending.table.ban") ?>",
"<?php echo htmlspecialchars(getlocal("pending.menu.show")) ?>",
"<?php echo htmlspecialchars(getlocal("pending.menu.hide")) ?>"
);
var updaterOptions = {
url:"<?php echo $webimroot ?>/operator/update.php",wroot:"<?php echo $webimroot ?>",
@ -35,16 +38,20 @@ var updaterOptions = {
function tpl_content() { global $page, $webimroot;
?>
<div>
<div style="float:right;padding-right:10px;">
<a href="#" id="togglemenu"></a>
</div>
<?php echo getlocal("clients.intro") ?>
<br/>
<?php echo getlocal("clients.how_to") ?>
<br/>
</div>
<br/>
<table id="threadlist" class="awaiting" border="0">
<thead>
<tr>
<th><?php echo getlocal("pending.table.head.name") ?></th>
<th class="first"><?php echo getlocal("pending.table.head.name") ?></th>
<th><?php echo getlocal("pending.table.head.contactid") ?></th>
<th><?php echo getlocal("pending.table.head.state") ?></th>
<th><?php echo getlocal("pending.table.head.operator") ?></th>