notifications on home page, warn if operator is offline

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@724 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2010-01-15 23:47:35 +00:00
parent b39c9a8d33
commit 42bb76d504
11 changed files with 66 additions and 8 deletions

View File

@ -412,10 +412,27 @@ input.formauth {
font-size: 0.85em; font-size: 0.85em;
font-weight:bold; font-weight:bold;
max-width: 700px; max-width: 700px;
margin: 0px 2px 10px; margin: -10px 2px 10px;
color: #515151; color: #515151;
} }
#offwarn {
border: 1px solid #4CD496;
background-color: #E7F9F1;
color: #515151;
padding: 8px 11px;
font-size: 0.85em;
font-weight:bold;
line-height: 140%;
margin: 0px;
}
#offwarn img {
margin-top: .4em;
float: left;
padding-right: 10px;
}
.asterisk { .asterisk {
padding: 10px 20px; padding: 10px 20px;
} }
@ -720,6 +737,8 @@ table.awaiting td.visitor {
.dashitem img, #dashlocalesPopup h2 img { .dashitem img, #dashlocalesPopup h2 img {
float: left; float: left;
padding-right:10px; padding-right:10px;
width: 24px;
height: 24px;
} }
#dashlocalesPopup h2 img { #dashlocalesPopup h2 img {
@ -836,7 +855,7 @@ table.awaiting td.visitor {
/* rtl rules */ /* rtl rules */
.lrtl .dashitem img, .lrtl #dashlocalesPopup h2 img { .lrtl .dashitem img, .lrtl #dashlocalesPopup h2 img, .lrtl #offwarn img {
float: right; float: right;
padding-right:0px; padding-right:0px;
padding-left:10px; padding-left:10px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -592,15 +592,14 @@ $settings = array(
$settingsloaded = false; $settingsloaded = false;
$settings_in_db = array(); $settings_in_db = array();
function loadsettings() { function loadsettings_($link) {
global $settingsloaded, $settings_in_db, $settings; global $settingsloaded, $settings_in_db, $settings;
if($settingsloaded) { if($settingsloaded) {
return; return;
} }
$settingsloaded = true; $settingsloaded = true;
$link = connect(); $sqlresult = mysql_query('select vckey,vcvalue from chatconfig',$link) or die(' Query failed: '.mysql_error($link).": ".$query);
$sqlresult = mysql_query('select vckey,vcvalue from chatconfig',$link) or die(' Query failed: '.mysql_error().": ".$query);
while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) { while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) {
$name = $row['vckey']; $name = $row['vckey'];
@ -608,7 +607,15 @@ function loadsettings() {
$settings_in_db[$name] = true; $settings_in_db[$name] = true;
} }
mysql_free_result($sqlresult); mysql_free_result($sqlresult);
mysql_close($link); }
function loadsettings() {
global $settingsloaded;
if(!$settingsloaded) {
$link = connect();
loadsettings_($link);
mysql_close($link);
}
} }
function getchatstyle() { function getchatstyle() {

View File

@ -136,6 +136,15 @@ function has_online_operators($groupid="") {
return $row['time'] < $settings['online_timeout'] && $row['total'] > 0; return $row['time'] < $settings['online_timeout'] && $row['total'] > 0;
} }
function is_operator_online($operatorid, $link) {
global $settings;
loadsettings_($link);
$query = "select count(*) as total, min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ".
"from chatoperator where operatorid = $operatorid";
$row = select_one_row($query,$link);
return $row['time'] < $settings['online_timeout'] && $row['total'] == 1;
}
function get_operator_name($operator) { function get_operator_name($operator) {
global $home_locale, $current_locale; global $home_locale, $current_locale;
if( $home_locale == $current_locale ) if( $home_locale == $current_locale )

View File

@ -216,11 +216,13 @@ mailthread.title=Send chat history<br/>by mail
menu.agents=Operators list menu.agents=Operators list
menu.blocked=Blocked visitors menu.blocked=Blocked visitors
menu.canned=Canned Messages menu.canned=Canned Messages
menu.goonline=You are Offline.<br/><a href="{0}">Connect..</a>
menu.groups.content=Department or skill based operator groups. menu.groups.content=Department or skill based operator groups.
menu.groups=Groups menu.groups=Groups
menu.locale.content=Change locale. menu.locale.content=Change locale.
menu.locale=Language menu.locale=Language
menu.main=Main menu.main=Main
menu.notifications.content=All notifications sent by messenger.
menu.notifications=Notifications menu.notifications=Notifications
menu.operator=You are {0} menu.operator=You are {0}
menu.profile.content=You can change your personal information on this page. menu.profile.content=You can change your personal information on this page.

View File

@ -216,11 +216,13 @@ mailthread.title=
menu.agents=Список операторов menu.agents=Список операторов
menu.blocked=Нежелательные посетители menu.blocked=Нежелательные посетители
menu.canned=Шаблоны ответов menu.canned=Шаблоны ответов
menu.goonline=Âû Îôôëàéí.<br/><a href="{0}">Ïîäêëþ÷èòüñÿ..</a>
menu.groups.content=Объединения операторов на основе отделов или областей знаний. menu.groups.content=Объединения операторов на основе отделов или областей знаний.
menu.groups=Группы menu.groups=Группы
menu.locale.content=Выбрать язык системы. menu.locale.content=Выбрать язык системы.
menu.locale=Язык menu.locale=Язык
menu.main=Главная menu.main=Главная
menu.notifications.content=Èñòîðèÿ âñåõ îòïðàâëåííûõ óâåäîìëåíèé.
menu.notifications=Уведомления menu.notifications=Уведомления
menu.operator=Вы {0} menu.operator=Вы {0}
menu.profile.content=На этой странице вы можете отредактировать свою персональную информацию. menu.profile.content=На этой странице вы можете отредактировать свою персональную информацию.

View File

@ -23,7 +23,11 @@ require_once('../libs/common.php');
require_once('../libs/operator.php'); require_once('../libs/operator.php');
$operator = check_login(); $operator = check_login();
loadsettings();
$link = connect();
loadsettings_($link);
$isonline = is_operator_online($operator['operatorid'], $link);
mysql_close($link);
$page = array( $page = array(
'version' => $version, 'version' => $version,
@ -32,6 +36,7 @@ $page = array(
'updateWizard' => "$webimroot/install/", 'updateWizard' => "$webimroot/install/",
'newFeatures' => $settings['featuresversion'] != $featuresversion, 'newFeatures' => $settings['featuresversion'] != $featuresversion,
'featuresPage' => "$webimroot/operator/features.php", 'featuresPage' => "$webimroot/operator/features.php",
'isOnline' => $isonline
); );
prepare_menu($operator); prepare_menu($operator);

View File

@ -28,6 +28,12 @@ function menuli($name) {
} }
function tpl_menu() { global $page, $webimroot, $errors; function tpl_menu() { global $page, $webimroot, $errors;
if(isset($page['isOnline']) && !$page['isOnline']) { ?>
<li id="offwarn">
<img src="<?php echo $webimroot ?>/images/dash/warn.gif" alt="" width="24" height="24"/>
<p><?php echo getlocal2("menu.goonline",array($webimroot."/operator/users.php?nomenu")) ?></p>
</li>
<?php }
if(isset($page['operator'])) { ?> if(isset($page['operator'])) { ?>
<li> <li>
<h2><?php echo getlocal('right.main') ?></h2> <h2><?php echo getlocal('right.main') ?></h2>

View File

@ -161,6 +161,14 @@ $menuItemsCount = 2;
<?php echo getlocal('menu.updates.content') ?> <?php echo getlocal('menu.updates.content') ?>
</td> </td>
<?php menuseparator(); ?> <?php menuseparator(); ?>
<td class="dashitem">
<img src="<?php echo $webimroot ?>/images/dash/notifications.gif" alt=""/>
<a href='<?php echo $webimroot ?>/operator/notifications.php'>
<?php echo getlocal('menu.notifications') ?></a>
<?php echo getlocal('menu.notifications.content') ?>
</td>
<?php menuseparator(); ?>
<?php } ?> <?php } ?>
<td class="dashitem"> <td class="dashitem">

View File

@ -92,7 +92,7 @@ function tpl_content() { global $page, $webimroot;
<?php if($page['istatus']) { ?> <?php if($page['istatus']) { ?>
<a href="users.php<?php echo $page['havemenu'] ? "" : "?nomenu" ?>"><?php echo getlocal("pending.status.setonline") ?></a> <a href="users.php<?php echo $page['havemenu'] ? "" : "?nomenu" ?>"><?php echo getlocal("pending.status.setonline") ?></a>
<?php } else { ?> <?php } else { ?>
<a href="users.php?away<?php echo $page['havemenu'] ? "" : "&nomenu" ?>"><?php echo getlocal("pending.status.setaway") ?></a> <a href="users.php?away<?php echo $page['havemenu'] ? "" : "&amp;nomenu" ?>"><?php echo getlocal("pending.status.setaway") ?></a>
<?php } ?> <?php } ?>
</div> </div>