diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index 1831601700..72d541fedc 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -1063,7 +1063,8 @@ class calendar_boupdate extends calendar_bo // Add ACCEPT|REHECT|TENTATIVE actions $notification->set_popupdata('calendar', array( 'event_id' => $event['id'], - 'user_id' => $userid + 'user_id' => $userid, + 'egw_pr_notify' => 1 )); } $notification->set_popupmessage($subject."\n\n".$notify_body."\n\n".$details['description']."\n\n".$details_body."\n\n"); diff --git a/notifications/inc/class.notifications_ajax.inc.php b/notifications/inc/class.notifications_ajax.inc.php index 1e7e85190c..92ace80549 100644 --- a/notifications/inc/class.notifications_ajax.inc.php +++ b/notifications/inc/class.notifications_ajax.inc.php @@ -200,7 +200,8 @@ class notifications_ajax { 'status' => $notification['notify_status'], 'created' => Api\DateTime::to($notification['notify_created']), 'current' => new DateTime(), - 'action' => is_array($actions)?$actions:NULL + 'actions' => is_array($actions)?$actions:NULL, + 'extra_data' => $data['data'] ); } diff --git a/notifications/js/notificationajaxpopup.js b/notifications/js/notificationajaxpopup.js index a6b758e3e4..733b973eac 100644 --- a/notifications/js/notificationajaxpopup.js +++ b/notifications/js/notificationajaxpopup.js @@ -40,6 +40,27 @@ */ const TIME_LABEL_LAST_MONTH = 3; + /** + * Heigh priorority action for notifing about an entry. + * Action: It pops up the entry once + * @type Number + */ + const EGW_PR_NOTIFY_HEIGH = 1; + + /** + * Medium priority for notifing about an entry + * Action: Not defined + * @type Number + */ + const EGW_PR_NOTIFY_MEDIUM = 2; + + /** + * Low priority for notifing about an entry + * Action: Not defined + * @type Number + */ + const EGW_PR_NOTIFY_LOW = 3; + /** * Constructor inits polling and installs handlers, polling frequence is passed via data-poll-interval of script tag */ @@ -277,6 +298,21 @@ // bind click handler after the message container is attached $message.click(jQuery.proxy(this.clickOnMessage, this,[$message])); this.update_message_status(id, notifymessages[id]['status']); + if (notifymessages[id]['extra_data'] + && !notifymessages[id]['status'] + && notifymessages[id]['extra_data']['egw_pr_notify']) + { + switch (notifymessages[id]['extra_data']['egw_pr_notify']) + { + case EGW_PR_NOTIFY_HEIGH: + poped.push(id); + this.toggle(true); + break; + case EGW_PR_NOTIFY_MEDIUM: + case EGW_PR_NOTIFY_LOW: + //Could be define with all sort of stuffs + } + } } if (poped.length > 0) @@ -489,7 +525,8 @@ data: data, status: _rawData[i]['status'], created: _rawData[i]['created'], - current: _rawData[i]['current'] + current: _rawData[i]['current'], + extra_data: _rawData[i]['extra_data'] }; if (_rawData[i]['actions'] && _rawData[i]['actions'].length > 0) notifymessages[_rawData[i]['id']]['data']['actions'] = _rawData[i]['actions']; // Notification API @@ -573,8 +610,9 @@ /** * toggle notifications container + * @param boolean _stat true keeps the popup on */ - notifications.prototype.toggle = function () + notifications.prototype.toggle = function (_stat) { var $egwpopup = jQuery('#egwpopup'); var $body = jQuery('body'); @@ -593,6 +631,7 @@ } else { + if (_stat) return; $body.off('click'); } // Remove popup_note as soon as message list is toggled