diff --git a/notifications/inc/class.ajaxnotifications.inc.php b/notifications/inc/class.ajaxnotifications.inc.php index 091f1742e7..6864105b61 100644 --- a/notifications/inc/class.ajaxnotifications.inc.php +++ b/notifications/inc/class.ajaxnotifications.inc.php @@ -168,14 +168,21 @@ class ajaxnotifications { $this->restore_session_data(); $recent_messages = array(); + $folder_status = array(); foreach($notify_folders as $id=>$notify_folder) { + if(!is_array($this->session_data['notified_mail_uids'][$notify_folder])) { + $this->session_data['notified_mail_uids'][$notify_folder] = array(); + } + $folder_status[$notify_folder] = $bofelamimail->getFolderStatus($notify_folder); $headers = $bofelamimail->getHeaders($notify_folder, 1, false, 0, true, array('status'=>'UNSEEN')); if(is_array($headers['header']) && count($headers['header']) > 0) { foreach($headers['header'] as $id=>$header) { // check if unseen mail has already been notified - if(!in_array($header['uid'], $this->session_data['notified_mail_uids'])) { + if(!in_array($header['uid'], $this->session_data['notified_mail_uids'][$notify_folder])) { // got a REAL recent message $header['folder'] = $notify_folder; + $header['folder_display_name'] = $folder_status[$notify_folder]['displayName']; + $header['folder_base64'] = base64_encode($notify_folder); $recent_messages[] = $header; } } @@ -183,30 +190,34 @@ class ajaxnotifications { } if(count($recent_messages) > 0) { - // create notify messages and save notification status in user session - if(count($recent_messages) == 1) { - $notify_subject = lang("You've got a new mail"); - } else { - $notify_subject = lang("You've got new mails"); - } - $notify_message = ''; + // create notify message + $notification_subject = lang("You've got new mail"); + $values = array(); + $values[] = array(); // content array starts at index 1 foreach($recent_messages as $id=>$recent_message) { - $notify_message .= '' - .'' - .'' - .'' - .''; + $values[] = array( + 'mail_uid' => $recent_message['uid'], + 'mail_folder' => $recent_message['folder_display_name'], + 'mail_folder_base64' => $recent_message['folder_base64'], + 'mail_subject' => $recent_message['subject'], + 'mail_from' => !empty($recent_message['sender_name']) ? $recent_message['sender_name'] : $recent_message['sender_address'], + 'mail_received' => $recent_message['date'], + ); // save notification status - $this->session_data['notified_mail_uids'][] = $recent_message['uid']; + $this->session_data['notified_mail_uids'][$recent_message['folder']][] = $recent_message['uid']; } - $notify_message .= '
'.$recent_message['folder'].''.$recent_message['subject'].''.$recent_message['sender_address'].'
'; + + // create etemplate + $tpl = new etemplate(); + $tpl->read('notifications.checkmailbox'); + $notification_message = $tpl->exec(false, $values, false, false, false, 1); // send notification $notification = new notifications(); $notification->set_receivers(array($this->recipient->account_id)); - $notification->set_message($notify_message); + $notification->set_message($notification_message); $notification->set_sender($this->recipient->account_id); - $notification->set_subject($notify_subject); + $notification->set_subject($notification_subject); $notification->set_skip_backends(array('email')); $notification->send(); } diff --git a/notifications/setup/egw_de.lang b/notifications/setup/egw_de.lang index afd927ef67..5ad0311cae 100644 --- a/notifications/setup/egw_de.lang +++ b/notifications/setup/egw_de.lang @@ -1,3 +1,8 @@ don't notify me via popups in egroupware notifications de Benachrichtigungen durch Popups unterdrücken. -notification notifications de Benachrichtigung +folder notifications de Ordner +from notifications de Von +message from notifications de Nachricht von +notification common de Benachrichtigung preferences for notification notifications de Benachrichtigungs-Einstellungen +received notifications de Erhalten +you've got new mail notifications de Sie haben neue E-Mails diff --git a/notifications/setup/egw_en.lang b/notifications/setup/egw_en.lang index 9eff673e44..2eb8b79500 100644 --- a/notifications/setup/egw_en.lang +++ b/notifications/setup/egw_en.lang @@ -9,6 +9,8 @@ enable egroupware-popup backend admin en Enable eGroupWare-Popup backend enable sms backend admin en Enable SMS backend enable windows-popup backend admin en Enable Windows-Popup backend enabled chains notifications en Enabled chains +folder notifications en Folder +from notifications en From how verbose should the egroupware-popup behave if a notification is sent to the user:
low: just display the notification bell in the topmenu - topmenu must be enabled !
medium: bring notification window to front
high: bring notification window to front and let the browser do something to announce itself notifications en How verbose should the eGroupware-Popup behave if a notification is sent to the user:
low: just display the notification bell in the topmenu - topmenu must be enabled !
medium: bring notification window to front
high: bring notification window to front and let the browser do something to announce itself if set, embedded links get rendered special for external clients notifications en If set, embedded links get rendered special for external clients linked entries: notifications en Linked entries: @@ -18,6 +20,8 @@ notification common en Notification notify me by notifications en Notify me by optimize e-mails for external mail client notifications en Optimize E-Mails for external mail client preferences for notification notifications en Preferences for notification +received notifications en Received sms backend admin en SMS backend this egroupware notification has been sent to you by mail because your notifications en This eGroupWare notification has been sent to you by mail because your windows-popup backend admin en Windows-Popup backend +you've got new mail notifications en You've got new mail diff --git a/notifications/setup/etemplates.inc.php b/notifications/setup/etemplates.inc.php index e20cc92364..587cc86330 100644 --- a/notifications/setup/etemplates.inc.php +++ b/notifications/setup/etemplates.inc.php @@ -1,9 +1,16 @@ 'notifications.prefsindex','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:8:"checkbox";s:4:"name";s:17:"disable_ajaxpopup";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:40:"Don\'t notify me via popups in eGroupWare";}}i:3;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:4;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:5;a:2:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:3:"all";i:1;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:6:"button";s:5:"label";s:4:"save";s:4:"name";s:12:"button[save]";}i:2;a:3:{s:4:"type";s:6:"button";s:5:"label";s:5:"apply";s:4:"name";s:13:"button[apply]";}}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"cancel";s:5:"align";s:5:"right";s:4:"name";s:14:"button[cancel]";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:5;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1157394610',); +$templ_data[] = array('name' => 'notifications.checkmailbox','template' => '','lang' => '','group' => '0','version' => '1.7.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:2:{s:2:"c1";s:2:"th";s:2:"c2";s:7:"row,top";}i:1;a:4:{s:1:"A";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:3:{s:8:"readonly";s:4:"true";s:4:"type";s:5:"label";s:5:"label";s:6:"Folder";}}s:1:"B";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:3:{s:8:"readonly";s:4:"true";s:4:"type";s:5:"label";s:5:"label";s:7:"Subject";}}s:1:"C";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:3:{s:8:"readonly";s:4:"true";s:4:"type";s:5:"label";s:5:"label";s:4:"From";}}s:1:"D";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:3:{s:8:"readonly";s:4:"true";s:4:"type";s:5:"label";s:5:"label";s:8:"Received";}}}i:2;a:4:{s:1:"A";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:2:{s:4:"name";s:19:"${row}[mail_folder]";s:4:"type";s:5:"label";}}s:1:"B";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:20:"${row}[mail_subject]";s:4:"size";s:103:"b,felamimail.uidisplay.display&uid=$row_cont[mail_uid]&mailbox=$row_cont[mail_folder_base64],,,,750x500";s:4:"type";s:5:"label";}}s:1:"C";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:3:{s:7:"no_lang";s:1:"1";s:4:"name";s:17:"${row}[mail_from]";s:4:"type";s:5:"label";}}s:1:"D";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:4:{s:8:"readonly";s:4:"true";s:4:"name";s:21:"${row}[mail_received]";s:4:"size";s:2:",8";s:4:"type";s:9:"date-time";}}}}s:4:"cols";i:4;s:4:"rows";i:2;}}','size' => '','style' => '','modified' => '1234631988',);