2006-09-07 09:04:15 +02:00
|
|
|
/**
|
|
|
|
* eGroupWare - Notifications
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package notifications
|
|
|
|
* @subpackage ajaxpoup
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Cornelius Weiss <nelius@cwtech.de>
|
2006-09-25 12:20:46 +02:00
|
|
|
* @version $Id$
|
2006-09-07 09:04:15 +02:00
|
|
|
*/
|
|
|
|
|
2007-11-22 09:29:16 +01:00
|
|
|
var notifymessages = new Array();
|
2008-06-02 19:48:31 +02:00
|
|
|
|
2006-09-07 09:04:15 +02:00
|
|
|
function notificationwindow_init() {
|
|
|
|
window.setTimeout("notificationwindow_refresh();", 1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
function notificationwindow_setTimeout() {
|
2007-06-01 13:57:49 +02:00
|
|
|
window.setTimeout("notificationwindow_refresh();", 60000);
|
2006-09-07 09:04:15 +02:00
|
|
|
}
|
|
|
|
function notificationwindow_refresh() {
|
2007-12-18 16:53:38 +01:00
|
|
|
xajax_doXMLHTTP("notifications.ajaxnotifications.get_popup_notifications");
|
2006-09-07 09:04:15 +02:00
|
|
|
notificationwindow_setTimeout();
|
|
|
|
}
|
|
|
|
|
|
|
|
function notificationwindow_display() {
|
|
|
|
var notificationwindow;
|
2007-11-22 09:29:16 +01:00
|
|
|
var notificationwindow_message;
|
2008-06-02 19:48:31 +02:00
|
|
|
var Browserwidth;
|
|
|
|
var Browserheight;
|
2008-06-04 15:01:19 +02:00
|
|
|
var notificationwindow_ok_button;
|
|
|
|
notificationwindow_ok_button = document.getElementById("notificationwindow_ok_button");
|
2006-09-07 09:04:15 +02:00
|
|
|
notificationwindow = document.getElementById("notificationwindow");
|
2007-11-22 09:29:16 +01:00
|
|
|
notificationwindow_message = document.getElementById("notificationwindow_message");
|
2006-09-07 09:04:15 +02:00
|
|
|
notificationwindow.style.display = "inline";
|
|
|
|
notificationwindow.style.position = "absolute";
|
|
|
|
notificationwindow.style.width = "500px";
|
2008-06-02 19:48:31 +02:00
|
|
|
Browserwidth = (window.innerWidth || document.body.clientWidth || 640)
|
|
|
|
Browserheight = (window.innerHeight || document.body.clientHeight || 480)
|
|
|
|
notificationwindow.style.left = (Browserwidth/2 - 250) + "px";
|
|
|
|
notificationwindow.style.top = (Browserheight/4) + "px";
|
2006-09-07 09:04:15 +02:00
|
|
|
notificationwindow.style.height = "100%";
|
2007-11-22 09:29:16 +01:00
|
|
|
notificationwindow_message.innerHTML = notifymessages[0];
|
|
|
|
if(notifymessages.length-1 > 0 ) {
|
|
|
|
notificationwindow_ok_button.value = "OK (" + (notifymessages.length-1) + ")";
|
|
|
|
} else {
|
|
|
|
notificationwindow_ok_button.value = "OK";
|
|
|
|
}
|
2008-06-02 19:48:31 +02:00
|
|
|
|
2007-11-22 09:29:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function notificationbell_switch(mode) {
|
|
|
|
var notificationbell;
|
|
|
|
notificationbell = document.getElementById("notificationbell");
|
|
|
|
if(mode == "active") {
|
|
|
|
notificationbell.style.display = "inline";
|
|
|
|
} else {
|
|
|
|
notificationbell.style.display = "none";
|
|
|
|
}
|
2006-09-07 09:04:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function notificationwindow_button_ok() {
|
|
|
|
var notificationwindow;
|
|
|
|
var notificationwindow_message;
|
|
|
|
notificationwindow = document.getElementById("notificationwindow");
|
|
|
|
notificationwindow_message = document.getElementById("notificationwindow_message");
|
2007-11-22 09:29:16 +01:00
|
|
|
notifymessages.shift();
|
|
|
|
if(notifymessages.length > 0) {
|
|
|
|
notificationwindow_display();
|
|
|
|
} else {
|
|
|
|
notificationwindow.style.display = "none";
|
|
|
|
notificationwindow_message.innerHTML = "";
|
|
|
|
notificationbell_switch("inactive");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function append_notification_message(_message) {
|
|
|
|
notifymessages.push(_message);
|
2006-09-07 09:04:15 +02:00
|
|
|
}
|