E-Mail notifications are now using eTemplate. Removed unused eTemplate from previous notifications of eGW 1.4. Updated some german lang phrases. Complete german translation follows soon.

This commit is contained in:
Christian Binder 2009-02-14 16:49:10 +00:00
parent 5a1a3879ac
commit 878590ea4c
4 changed files with 49 additions and 22 deletions

View File

@ -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 = '<table>';
// 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 .= '<tr>'
.'<td>'.$recent_message['folder'].'</td>'
.'<td>'.$recent_message['subject'].'</td>'
.'<td>'.$recent_message['sender_address'].'</td>'
.'</tr>';
$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 .= '</table>';
// 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();
}

View File

@ -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

View File

@ -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:<br />low: just display the notification bell in the topmenu - topmenu must be enabled !<br />medium: bring notification window to front<br />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:<br />low: just display the notification bell in the topmenu - topmenu must be enabled !<br />medium: bring notification window to front<br />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

View File

@ -1,9 +1,16 @@
<?php
// eTemplates for Application 'notifications', generated by soetemplate::dump4setup() 2006-09-06 19:42
/* $Id$ */
/**
* eGroupWare - eTemplates for Application notifications
* http://www.egroupware.org
* generated by soetemplate::dump4setup() 2009-02-14 18:23
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage setup
* @version $Id$
*/
$templ_version=1;
$templ_data[] = array('name' => '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',);