From 42bb76d504988a6fe905ee125d7381721bad8c97 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Fri, 15 Jan 2010 23:47:35 +0000 Subject: [PATCH] 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 --- src/messenger/webim/default.css | 23 ++++++++++++++++-- .../webim/images/dash/notifications.gif | Bin 0 -> 690 bytes src/messenger/webim/images/dash/warn.gif | Bin 0 -> 1175 bytes src/messenger/webim/libs/common.php | 15 +++++++++--- src/messenger/webim/libs/operator.php | 9 +++++++ src/messenger/webim/locales/en/properties | 2 ++ src/messenger/webim/locales/ru/properties | 2 ++ src/messenger/webim/operator/index.php | 7 +++++- src/messenger/webim/view/inc_menu.php | 6 +++++ src/messenger/webim/view/menu.php | 8 ++++++ src/messenger/webim/view/pending_users.php | 2 +- 11 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 src/messenger/webim/images/dash/notifications.gif create mode 100644 src/messenger/webim/images/dash/warn.gif diff --git a/src/messenger/webim/default.css b/src/messenger/webim/default.css index cac44539..20f54fd3 100644 --- a/src/messenger/webim/default.css +++ b/src/messenger/webim/default.css @@ -412,10 +412,27 @@ input.formauth { font-size: 0.85em; font-weight:bold; max-width: 700px; - margin: 0px 2px 10px; + margin: -10px 2px 10px; 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 { padding: 10px 20px; } @@ -720,6 +737,8 @@ table.awaiting td.visitor { .dashitem img, #dashlocalesPopup h2 img { float: left; padding-right:10px; + width: 24px; + height: 24px; } #dashlocalesPopup h2 img { @@ -836,7 +855,7 @@ table.awaiting td.visitor { /* rtl rules */ -.lrtl .dashitem img, .lrtl #dashlocalesPopup h2 img { +.lrtl .dashitem img, .lrtl #dashlocalesPopup h2 img, .lrtl #offwarn img { float: right; padding-right:0px; padding-left:10px; diff --git a/src/messenger/webim/images/dash/notifications.gif b/src/messenger/webim/images/dash/notifications.gif new file mode 100644 index 0000000000000000000000000000000000000000..d52e47cc4cc3d13263cdd93ccb5902beb12ed4ee GIT binary patch literal 690 zcmZ?wbhEHblwgoxcoxd=|NsA8yLQzrKGL!L(AEpL*B!q$eb1ePx1Mdkc&BI8k<~{p zPu_51!>Q{N)*f53|HAS^mlp0hKWp3RxjWBJ+kC2f<>8H|uiw3Uw|~vCz1JVlS+~D- z)~4+j?^aFUu;bFbx$E~gEe*S>iBqCLlNK6^89&7Q^k z&d=F#cIMX8bG9E|u={-DyseYgAMaazq+#xsE$41sdH8JW`CI*Kj!s>_chdS3bG99t zx%Je7-RBnXJu!9Dsn&(t`d02*bL`TMr?2MhIMcms=cKiJr*1k4^ghFY0>z&!j0_B+ z3_2iJfZ~LK{eMGfQ*%peTYE=mt2s+=U;l(&jeur-e+fnQS+nQNQIybjZt`}KmF8Hn za@8tnStqk58x<8%o^9KAY!?+}5cOzMU}a!Ea`f171_nKaCKJt*To*50zI2j7%dII` z_Zt7b`w#f<8d)?Ms`Fjrd;R9kD?UrVCIedmfotD>e*5vwE2zo1#6uz@cfr9Xw#8Qj zuB5oPvq1GcK=koqh0-0yiW7qf>Le!`DT-R(yVSceS|ygEau9hA)Ny literal 0 HcmV?d00001 diff --git a/src/messenger/webim/images/dash/warn.gif b/src/messenger/webim/images/dash/warn.gif new file mode 100644 index 0000000000000000000000000000000000000000..a775a52ddab471fd441dfd3c20f23d7eaaa82425 GIT binary patch literal 1175 zcmchW{WIGK0LH)ZR%%slZll*9=&*2Jns{lv#7le$J6Eymde_bjHFafer_Q>y>xh>s zLZ}=qdPJ%=bWtz0(usIqmFP4$=? zAa*ve(u10Sf6C9`nmrnmu-u0YHAH@p1)}sMI+>X4Ml&A^ay)gV_&!LbL&`^Q5#B6< zdJAf2ugnd-K`0N?&OF3@HY!5U02|H94|TKQO2V)8bMNTj<`wVVk_8Y-P3OT_#%1gA0k9O^!*IS>yS+TjvxFD%Ha zF~mi>13JCXD^Yeo!UKPZoHsjik>ibqfX&TKNRQ(Z9e16ep1|WkoVSC5L;V(kX&J5I(4*Oh&44DIanIPKrm|kcMH6r-9f1@ z21>O3!H@;@b+n+&7uiARA+;|bqudVymz@G0>Rc$rw-7qc&CTJ)iQSTu5R-eg9*|st zJOj;~1@$~y{LmMVtv~VaKBg;L-63G&(#M+padMn?+mfjV@el_Y)@Sid0(m&v zm>8;AxpS84NJF8ccIqcAsj%`2KL;So0i|5zFtsC6q`RQ&i;yRfy;DLOny@8u}vxFu# znpjlrm)KmuJrWZ|lssx*MdE*twMLId5L1NXyXJSFAPhk?8y#gSM$0{um}ZfK!m2{c z^9g$57gDjz*!n1ocbZ?+mu;YkHcCz^6rCFMb}@W@ue2^2*y$3)nw;@g|9#uJm?LL?j3Z4C<>fe!5ucjs*ydKzLRuCpnewdZ<`yrkADYAP#!_3vIc05+~N7L5fhNgAhCRIj1 zn61y#e^+KrrsKA`)l8b+2f`q0uwQUJK1*U6+v}3_*-Uej%bBj0ap#5{jBKoAH?6Yi tV#4UUILp6X6?1^**tR&Ar$=WPTIlNk5lpbub*~F(tk?`5M_-Td{tr7Xa#R2S literal 0 HcmV?d00001 diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php index acb7f288..5c9b3929 100644 --- a/src/messenger/webim/libs/common.php +++ b/src/messenger/webim/libs/common.php @@ -592,15 +592,14 @@ $settings = array( $settingsloaded = false; $settings_in_db = array(); -function loadsettings() { +function loadsettings_($link) { global $settingsloaded, $settings_in_db, $settings; if($settingsloaded) { return; } $settingsloaded = true; - $link = connect(); - $sqlresult = mysql_query('select vckey,vcvalue from chatconfig',$link) or die(' Query failed: '.mysql_error().": ".$query); + $sqlresult = mysql_query('select vckey,vcvalue from chatconfig',$link) or die(' Query failed: '.mysql_error($link).": ".$query); while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) { $name = $row['vckey']; @@ -608,9 +607,17 @@ function loadsettings() { $settings_in_db[$name] = true; } mysql_free_result($sqlresult); - mysql_close($link); } +function loadsettings() { + global $settingsloaded; + if(!$settingsloaded) { + $link = connect(); + loadsettings_($link); + mysql_close($link); + } +} + function getchatstyle() { global $settings; $chatstyle = verifyparam( "style", "/^\w+$/", ""); diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php index ff0957f9..7ad85973 100644 --- a/src/messenger/webim/libs/operator.php +++ b/src/messenger/webim/libs/operator.php @@ -136,6 +136,15 @@ function has_online_operators($groupid="") { 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) { global $home_locale, $current_locale; if( $home_locale == $current_locale ) diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index 7ec20db4..9e9a3b18 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -216,11 +216,13 @@ mailthread.title=Send chat history
by mail menu.agents=Operators list menu.blocked=Blocked visitors menu.canned=Canned Messages +menu.goonline=You are Offline.
Connect.. menu.groups.content=Department or skill based operator groups. menu.groups=Groups menu.locale.content=Change locale. menu.locale=Language menu.main=Main +menu.notifications.content=All notifications sent by messenger. menu.notifications=Notifications menu.operator=You are {0} menu.profile.content=You can change your personal information on this page. diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties index af2946e4..768563d3 100644 --- a/src/messenger/webim/locales/ru/properties +++ b/src/messenger/webim/locales/ru/properties @@ -216,11 +216,13 @@ mailthread.title= menu.agents=Список операторов menu.blocked=Нежелательные посетители menu.canned=Шаблоны ответов +menu.goonline=Вы Оффлайн.
Подключиться.. menu.groups.content=Объединения операторов на основе отделов или областей знаний. menu.groups=Группы menu.locale.content=Выбрать язык системы. menu.locale=Язык menu.main=Главная +menu.notifications.content=История всех отправленных уведомлений. menu.notifications=Уведомления menu.operator=Вы {0} menu.profile.content=На этой странице вы можете отредактировать свою персональную информацию. diff --git a/src/messenger/webim/operator/index.php b/src/messenger/webim/operator/index.php index f20af42b..4ffe6b73 100644 --- a/src/messenger/webim/operator/index.php +++ b/src/messenger/webim/operator/index.php @@ -23,7 +23,11 @@ require_once('../libs/common.php'); require_once('../libs/operator.php'); $operator = check_login(); -loadsettings(); + +$link = connect(); +loadsettings_($link); +$isonline = is_operator_online($operator['operatorid'], $link); +mysql_close($link); $page = array( 'version' => $version, @@ -32,6 +36,7 @@ $page = array( 'updateWizard' => "$webimroot/install/", 'newFeatures' => $settings['featuresversion'] != $featuresversion, 'featuresPage' => "$webimroot/operator/features.php", + 'isOnline' => $isonline ); prepare_menu($operator); diff --git a/src/messenger/webim/view/inc_menu.php b/src/messenger/webim/view/inc_menu.php index 4956c2c7..8f0f7638 100644 --- a/src/messenger/webim/view/inc_menu.php +++ b/src/messenger/webim/view/inc_menu.php @@ -28,6 +28,12 @@ function menuli($name) { } function tpl_menu() { global $page, $webimroot, $errors; + if(isset($page['isOnline']) && !$page['isOnline']) { ?> +
  • + +

    +
  • +
  • diff --git a/src/messenger/webim/view/menu.php b/src/messenger/webim/view/menu.php index 732f8bb7..234566ef 100644 --- a/src/messenger/webim/view/menu.php +++ b/src/messenger/webim/view/menu.php @@ -161,6 +161,14 @@ $menuItemsCount = 2; + + + + + + + + diff --git a/src/messenger/webim/view/pending_users.php b/src/messenger/webim/view/pending_users.php index 622d5916..ff5becb5 100644 --- a/src/messenger/webim/view/pending_users.php +++ b/src/messenger/webim/view/pending_users.php @@ -92,7 +92,7 @@ function tpl_content() { global $page, $webimroot; "> -"> +">