From: <jay...@us...> - 2008-01-30 19:24:31
|
Author: jaytraxx Date: Wed Jan 30 19:58:00 2008 New Revision: 24919 URL: http://www.egroupware.org/viewvc?rev=3D3D24919&view=3D3Drev Log: enabled class autoloading for notifications, let admins enable or disable n= =3D otification backends, security fixes for email and egwpopup backend, unifie= =3D d link arrays used for notifications Added: trunk/notifications/inc/class.notifications.inc.php - copied, changed from r24847, trunk/notifications/inc/class.notifica= =3D tion.inc.php trunk/notifications/inc/class.notifications_email.inc.php - copied, changed from r24845, trunk/notifications/inc/class.notifica= =3D tion_email.inc.php trunk/notifications/inc/class.notifications_iface.inc.php - copied, changed from r24845, trunk/notifications/inc/class.iface_no= =3D tification.inc.php trunk/notifications/inc/class.notifications_popup.inc.php - copied, changed from r24845, trunk/notifications/inc/class.notifica= =3D tion_popup.inc.php trunk/notifications/inc/class.notifications_winpopup.inc.php - copied, changed from r24845, trunk/notifications/inc/class.notifica= =3D tion_winpopup.inc.php Removed: trunk/notifications/inc/class.iface_notification.inc.php trunk/notifications/inc/class.notification.inc.php trunk/notifications/inc/class.notification_email.inc.php trunk/notifications/inc/class.notification_popup.inc.php trunk/notifications/inc/class.notification_winpopup.inc.php Modified: trunk/calendar/inc/class.bocalupdate.inc.php trunk/etemplate/inc/class.bo_tracking.inc.php trunk/notifications/inc/hook_admin.inc.php trunk/notifications/inc/hook_preferences.inc.php trunk/notifications/inc/hook_settings.inc.php trunk/notifications/setup/setup.inc.php trunk/notifications/templates/default/config.tpl trunk/phpgwapi/templates/idots/css/idots.css trunk/phpgwapi/templates/jerryr/css/brushed-metal.css trunk/phpgwapi/templates/jerryr/css/jerryr.css Modified: trunk/calendar/inc/class.bocalupdate.inc.php URL: http://www.egroupware.org/viewvc/trunk/calendar/inc/class.bocalupdate.= =3D inc.php?rev=3D3D24919&r1=3D3D24918&r2=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/calendar/inc/class.bocalupdate.inc.php (original) +++ trunk/calendar/inc/class.bocalupdate.inc.php Wed Jan 30 19:58:00 2008 @@ -605,9 +605,8 @@ } // send via notification_app if($GLOBALS['egw_info']['apps']['notifications']['enabled']) { - require_once(EGW_INCLUDE_ROOT. '/notifications/inc/class.notification= =3D .inc.php'); try { - $notification =3D3D new notification(); + $notification =3D3D new notifications(); $notification->set_receivers(array($userid)); $notification->set_message($body); $notification->set_sender($senderid); @@ -621,7 +620,7 @@ continue; } } else { - error_log('calendar: cannot send any notifications because notificati= =3D on-app is not installed'); + error_log('calendar: cannot send any notifications because notificati= =3D ons is not installed'); } } } @@ -869,13 +868,15 @@ /* this is needed for notification-app * notification-app creates the link individual for * every user, so we must provide a neutral link-style + * if calendar implements tracking in near future, this part can be dele= =3D ted */ $link_arr =3D3D array(); - $link_arr['menuaction'] =3D3D 'calendar.uiforms.edit'; - $link_arr['params'] =3D3D array( 'cal_id' =3D3D> $event['id'], - 'date' =3D3D> $eventStart_arr['full'], - ); $link_arr['text'] =3D3D $event['title']; + $link_arr['view'] =3D3D array( 'menuaction' =3D3D> 'calendar.uiforms.edi= t', + 'cal_id' =3D3D> $event['id'], + 'date' =3D3D> $eventStart_arr['full'], + ); + $link_arr['popup'] =3D3D '750x400'; $details['link_arr'] =3D3D $link_arr; =3D $dis =3D3D array(); Modified: trunk/etemplate/inc/class.bo_tracking.inc.php URL: http://www.egroupware.org/viewvc/trunk/etemplate/inc/class.bo_tracking= =3D .inc.php?rev=3D3D24919&r1=3D3D24918&r2=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/etemplate/inc/class.bo_tracking.inc.php (original) +++ trunk/etemplate/inc/class.bo_tracking.inc.php Wed Jan 30 19:58:00 2008 @@ -22,7 +22,7 @@ * 1. set the required class-vars: app, id_field * 2. optional set class-vars: creator_field, assigned_field, check2prefs * 3. implement the required methods: get_config, get_details - * 4. optionally re-implement: get_subject, get_body, get_attachments, get= =3D _link, get_message + * 4. optionally re-implement: get_title, get_subject, get_body, get_attac= =3D hments, get_link, get_notification_link, get_message * They are all documented in this file via phpDocumentor comments. */ class bo_tracking @@ -370,16 +370,14 @@ if ($GLOBALS['egw_info']['apps']['notifications']['enabled']) { // send via notification_app $receiver =3D3D is_numeric($user_or_lang) ? $user_or_lang : $email; - require_once(EGW_INCLUDE_ROOT. '/notifications/inc/class.notification.i= =3D nc.php'); try { - $notification =3D3D new notification(); + $notification =3D3D new notifications(); $notification->set_receivers(array($receiver)); - $notification->set_message($this->get_body(false,$data,$old)); // set = =3D message as plaintext - $notification->set_message($this->get_body(true,$data,$old)); // and h= =3D tml + $notification->set_message($this->get_body(false,$data,$old,false)); /= =3D / set message as plaintext + $notification->set_message($this->get_body(true,$data,$old,false)); //= =3D and html $notification->set_sender($this->get_sender($data,$old,true)); $notification->set_subject($this->get_subject($data,$old)); - // does not work atm - //$notification->set_links(array($this->get_notification_link($data,$o= =3D ld))); + $notification->set_links(array($this->get_notification_link($data,$old= =3D ))); $attachments =3D3D $this->get_attachments($data,$old); if(is_array($attachments)) { $notification->set_attachments($attachmen= =3D ts); } $notification->send(); @@ -389,7 +387,7 @@ return false; } } else { - error_log('tracking: cannot send any notifications because notification= =3D -app is not installed'); + error_log('tracking: cannot send any notifications because notification= =3D s is not installed'); } =3D return true; @@ -450,6 +448,23 @@ //echo "<p>bo_tracking::get_sender()=3D3D'".htmlspecialchars($sender)."'= </=3D p>\n"; return $sender; } + =3D + /** + * Get the title for a given entry, can be reimplemented + * + * @param array $data + * @param array $old + * @return string + */ + function get_title($data,$old) + { + if (!is_object($GLOBALS['egw']->link)) + { + require_once(EGW_API_INC.'/class.bolink.inc.php'); + $GLOBALS['egw']->link =3D3D& new bolink(); + } + return $GLOBALS['egw']->link->title($this->app,$data[$this->id_field]); + } =3D /** * Get the subject for a given entry, can be reimplemented @@ -532,7 +547,7 @@ } =3D /** - * Get a link for notifications to view the entry + * Get a link for notifications to view the entry, can be reimplemented * * @param array $data * @param array $old @@ -542,21 +557,16 @@ { if (!is_object($GLOBALS['egw']->link)) { - require_once(EGW_API_INC.'/class.bolink.inc.php'); - $GLOBALS['egw']->link =3D3D& new bolink(); + $GLOBALS['egw']->link =3D3D new bolink(); } if($view =3D3D $GLOBALS['egw']->link->view($this->app,$data[$this->id_fi= el=3D d])) { - return array( 'menuaction' =3D3D> $view['menuaction'], - 'params' =3D3D> array ( 'action' =3D3D> $view['action'], - 'action_id' =3D3D> $view['action_id'], - ), - 'text' =3D3D> $data['info_subject'], + return array( 'text' =3D3D> $this->get_title($data,$old), + 'view' =3D3D> $view, + 'popup' =3D3D> $GLOBALS['egw']->link->is_popup($this->app,'view'), ); - } else { - return false; - } - } - =3D + } + return false; + } =3D =3D /** * Get the body of the notification message, can be reimplemented @@ -564,9 +574,10 @@ * @param boolean $html_email * @param array $data * @param array $old + * @param boolean $integrate_link to have links embedded inside the bo= =3D dy * @return string */ - function get_body($html_email,$data,$old) + function get_body($html_email,$data,$old,$integrate_link =3D3D true) { $body =3D3D ''; if ($html_email) @@ -578,7 +589,7 @@ { $body .=3D3D $this->format_line($html_email,'message',false,$m= es=3D sage); } - if (($link =3D3D $this->get_link($data,$old))) + if ($integrate_link && ($link =3D3D $this->get_link($data,$old))) { $body .=3D3D $this->format_line($html_email,'link',false,lang(= 'Y=3D ou can respond by visiting:'),$link); } @@ -621,7 +632,7 @@ if (!$this->html_content_allow) $line =3D3D $this->html->htmlspecialcha= rs=3D ($line); // XSS =3D $color =3D3D $modified ? 'red' : false; - $size =3D3D '120%'; + $size =3D3D '110%'; $bold =3D3D false; $background =3D3D '#FFFFF1'; switch($type) @@ -686,7 +697,7 @@ } =3D /** - * Get the attachments for a notification mail + * Get the attachments for a notification * * @param array $data * @param array $old Copied: trunk/notifications/inc/class.notifications.inc.php (from r24847, t= =3D runk/notifications/inc/class.notification.inc.php) URL: http://www.egroupware.org/viewvc/trunk/notifications/inc/class.notific= =3D ations.inc.php?p2=3D3Dtrunk/notifications/inc/class.notifications.inc.php&p= 1=3D =3D3Dtrunk/notifications/inc/class.notification.inc.php&r1=3D3D24847&r2=3D3= D24919=3D &rev=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/notifications/inc/class.notification.inc.php (original) +++ trunk/notifications/inc/class.notifications.inc.php Wed Jan 30 19:58:00= =3D 2008 @@ -20,11 +20,11 @@ * This class takes care about the notification-routing. It chooses one or= =3D more backends for each * given recipient depending on its prefs or falls back to self::_fallback= =3D * =3D - * The classes doing the notifications are called notification_<backend> a= =3D nd should only be =3D + * The classes doing the notifications are called notifications_<backend> = =3D and should only be =3D * called from this class. The backend's job is to deliver ONE message to = =3D ONE recipient. * */ -final class notification { +final class notifications { =3D /** * Appname @@ -36,29 +36,58 @@ */ const _fallback =3D3D 'email_only'; =3D + /** + * registered backends + * @var array + */ + private $backends =3D3D array('popup', 'winpopup', 'email'); + =3D /** =3D - * pre-defined notificaton chains - * @abstract - * arrays with name =3D3D> chain pairs - * the chain itself consists of an array with framework =3D3D> action pai= rs =3D - * where action defines what to do after the framework has been executed: - * stop: stop executing notifications - * fail: do not stop if framework fails, otherwise stop - * continue: execute next framework - * - * @var array - */ + * pre-defined notificaton chains + * @abstract + * arrays with name =3D3D> chain pairs + * the chain itself consists of an array with framework =3D3D> action pai= rs =3D + * where action defines what to do after the framework has been executed: + * stop: stop executing notifications + * fail: do not stop if framework fails, otherwise stop + * continue: execute next framework + * + * @var array + */ private $notification_chains =3D3D array( - 'disable' =3D3D> false, - 'popup_only' =3D3D> array('popup' =3D3D> 'stop'), - 'winpopup_only' =3D3D> array('winpopup' =3D3D> 'stop'), - 'email_only' =3D3D> array('email' =3D3D> 'stop'), - 'popup_or_email' =3D3D> array('popup' =3D3D> 'fail', 'email' =3D3D> 'sto= p'), - 'winpopup_or_email' =3D3D> array('winpopup' =3D3D> 'fail', 'email' =3D3D= > 'sto=3D p'), - 'popup_and_email' =3D3D> array('popup' =3D3D> 'continue', 'email' =3D3D>= 'stop=3D '), - 'winpopup_and_email' =3D3D> array('winpopup' =3D3D> 'continue', 'email' = =3D3D>=3D 'stop'), - 'egwpopup_and_winpopup' =3D3D> array('popup' =3D3D> 'continue', 'winpopu= p' =3D =3D3D> 'stop'), - 'all' =3D3D> array('popup' =3D3D> 'continue', 'winpopup' =3D3D> 'continu= e', 'e=3D mail' =3D3D> 'stop'), + 'disable' =3D3D> false, // will be created by $this->get_available_c= ha=3D ins + 'email_only' =3D3D> false, // will be created by $this->get_available= _c=3D hains + 'all' =3D3D> false, // will be created by $this->get_available_chai= ns + 'popup_only' =3D3D> array('popup' =3D3D> 'stop'), + 'popup_or_email' =3D3D> array('popup' =3D3D> 'fail', 'email' =3D3D> '= stop'), + //'popup_or_sms' =3D3D> array('popup' =3D3D> 'fail', 'sms' =3D3D> 's= top'), + 'popup_and_email' =3D3D> array('popup' =3D3D> 'continue', 'email' =3D= 3D> 's=3D top'), + 'popup_and_winpopup' =3D3D> array('popup' =3D3D> 'continue', 'winpopup'= =3D3D=3D > 'stop'), + 'winpopup_only' =3D3D> array('winpopup' =3D3D> 'stop'), + 'winpopup_or_email' =3D3D> array('winpopup' =3D3D> 'fail', 'email' =3D3= D> 'st=3D op'), + //'winpopup_or_sms' =3D3D> array('winpopup' =3D3D> 'fail', 'sms' =3D3D>= 'stop=3D '), + 'winpopup_and_email' =3D3D> array('winpopup' =3D3D> 'continue', 'email'= =3D3D=3D > 'stop'), + //'sms_only' =3D3D> array('sms' =3D3D> 'stop'), + ); + + /** =3D + * human readable descriptions for the notification chains + * @var array + */ + private $chains_descriptions =3D3D array( + 'disable' =3D3D> 'do not notify me at all', + 'email_only' =3D3D> 'E-Mail only', + 'all' =3D3D> 'all possible notification backends', + 'popup_only' =3D3D> 'eGroupWare-Popup only', + 'popup_or_email' =3D3D> 'eGroupWare-Popup first, if that fails notify = me=3D by E-Mail', + //'popup_or_sms' =3D3D> 'eGroupware-Popup first, if that fails notify= m=3D e by SMS', + 'popup_and_email' =3D3D> 'eGroupWare-Popup and E-Mail', + 'popup_and_winpopup' =3D3D> 'eGroupWare-Popup and Windows-Popup', + 'winpopup_only' =3D3D> 'Windows-Popup only', + 'winpopup_or_email' =3D3D> 'Windows-Popup first, if that fails notify m= e =3D by E-Mail', + //'winpopup_or_sms' =3D3D> 'Windows-Popup first, if that fails notify = me=3D by SMS', + 'winpopup_and_email' =3D3D> 'Windows-Popup and E-Mail', + //'sms_only' =3D3D> 'SMS only', ); =3D /** @@ -111,7 +140,7 @@ private $config; =3D /** - * constructor of notification + * constructor of notifications * */ public function __construct() { @@ -221,13 +250,13 @@ /** * sets the notification links * =3D - * @param array $links link array (like defined in $this->add_link) + * @param array $_links link array (like defined in $this->add_link) */ public function set_links(array $_links) { $this->links =3D3D array(); // clear array if set foreach($_links as $link) { if(is_array($link)) { - $this->add_link($link['menuaction'], $link['params'], $link['text']); + $this->add_link($link['text'], $link['view'], $link['popup']); } } return true; @@ -235,16 +264,16 @@ =3D /** * adds a notification link - * =3D - * @param string $menuaction egw menuaction (appname.classname.functionna= =3D me) - * @param array $params params to append (name =3D3D> value pairs) - * @param string $text a descriptive text for the link - */ - public function add_link($_menuaction, $_params, $_text) { - if(!$_menuaction || !$_params || !$_text) { return false; } - $this->links[] =3D3D (object)array( 'menuaction' =3D3D> $_menuaction, - 'params' =3D3D> $_params, - 'text' =3D3D> $_text, + * + * @param string $_text a descriptive text for the link + * @param array $_view all params needed to view the link (name =3D3D> va= lu=3D e pairs) + * @param string $_popup if link can be viewed in a popup something like = =3D '300x200' otherwise false + */ + public function add_link($_text, $_view, $_popup =3D3D false) { + if(!$_view || !$_text) { return false; } + $this->links[] =3D3D (object)array( 'text' =3D3D> $_text, + 'view' =3D3D> $_view, + 'popup' =3D3D> $_popup, ); return true; } @@ -252,7 +281,7 @@ /** * sets the notification attachments * =3D - * @param array $attachments attachment array (like defined in $this->add= =3D _attachment + * @param array $_attachments attachment array (like defined in $this->ad= =3D d_attachment) */ public function set_attachments(array $_attachments) { $this->attachments =3D3D array(); // clear array if set @@ -273,10 +302,10 @@ * This method can be used to attach ascii or binary data, * such as a BLOB record from a database. * =3D - * @param string $string Attachment data. - * @param string $filename Name of the attachment. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. + * @param string $_string Attachment data. + * @param string $_filename Name of the attachment. + * @param string $_encoding File encoding (see $Encoding). + * @param string $_type File extension (MIME) type. */ public function add_attachment($_string, $_filename, $_encoding =3D3D "ba= se=3D 64", $_type =3D3D "application/octet-stream") { if(!$_string || !$_filename) { return false; } @@ -289,20 +318,24 @@ } =3D /** - * sends notification =3D + * sends notifications */ public function send() { if (!is_object($this->sender)) { - throw new Exception('Error: cannot send notification. No sender supplie= =3D d'); + throw new Exception('Error: cannot send notifications. No sender suppli= =3D ed'); } if (!is_array($this->receivers) || count($this->receivers) =3D3D=3D3D 0)= { - throw new Exception('Error: cannot send notification. No receivers supp= =3D lied'); + throw new Exception('Error: cannot send notifications. No receivers sup= =3D plied'); } if(!$messages =3D3D $this->create_messages($this->message_plain, $this->= me=3D ssage_html)) { - throw new Exception('Error: cannot send notification. No valid messages= =3D supplied'); - } + throw new Exception('Error: cannot send notifications. No valid message= =3D s supplied'); + } + =3D + $available_chains =3D3D $this->get_available_chains('routing'); + =3D foreach ($this->receivers as $receiver) { $user_notified =3D3D false; + $prepend_message =3D3D ''; $backend_errors =3D3D array(); try { // system or non-system user @@ -318,37 +351,42 @@ $preferences =3D3D $prefs->read(); $preferences =3D3D (object)$preferences[self::_appname]; if($preferences->notification_chain) { - $notification_chain =3D3D $this->notification_chains[$preferences->= no=3D tification_chain]; + // fallback: admin disabled user-chosen chain + if(!$notification_chain =3D3D $available_chains[$preferences->notif= ic=3D ation_chain]) { + $prepend_message .=3D3D lang( 'This eGroupWare notification has be= en=3D sent to you by mail because your' + .' chosen notification-chain has been disabled by the admin= =3D istrator.' + .' Please choose another notification-chain in your prefere= =3D nces!'); + $notification_chain =3D3D $available_chains[self::_fallback]; + } } else { - $notification_chain =3D3D $this->notification_chains[self::_fallbac= k]=3D ; // fallback: no prefs + $notification_chain =3D3D $available_chains[self::_fallback]; // fa= ll=3D back: no prefs } } else { - $notification_chain =3D3D $this->notification_chains[self::_fallback= ];=3D // fallback: no rights to app + $notification_chain =3D3D $available_chains[self::_fallback]; // fal= lb=3D ack: no rights to app } } else { // non-system user $receiver->handle =3D3D $receiver->account_email; - $notification_chain =3D3D $this->notification_chains[self::_fallback]= ; =3D // fallback: non-system user + $notification_chain =3D3D $available_chains[self::_fallback]; // fall= ba=3D ck: non-system user } =3D - if($notification_chain =3D3D=3D3D=3D3D false) { + if($notification_chain =3D3D=3D3D 'disable') { continue; //user disabled notifications } =3D foreach($notification_chain as $notification_backend =3D3D> $action) { try { - $notification_backend =3D3D 'notification_'.$notification_backend; + $notification_backend =3D3D self::_appname.'_'.$notification_backend; if(!file_exists(EGW_INCLUDE_ROOT. SEP. self::_appname. SEP. 'inc'. S= =3D EP. 'class.'. $notification_backend. '.inc.php')) { throw new Exception('file for '.$notification_backend. ' does not e= =3D xist'); } - require_once(EGW_INCLUDE_ROOT. SEP. self::_appname. SEP. 'inc'. SEP.= =3D 'class.'. $notification_backend. '.inc.php'); - $obj =3D3D @new $notification_backend( $this->sender, $receiver, $th= is=3D ->config, $preferences ); - if ( !is_a( $obj, iface_notification )) { + $obj =3D3D new $notification_backend( $this->sender, $receiver, $thi= s-=3D >config, $preferences ); + if ( !($obj instanceof notifications_iface) ) { unset ( $obj ); - throw new Exception($notification_backend. ' is no implementation = =3D of iface_notification'); + throw new Exception($notification_backend. ' is no implementation = =3D of notifications_iface'); } =3D - $obj->send($messages, $this->subject, $this->links, $this->attachmen= =3D ts); + $obj->send($this->prepend_message($messages, $prepend_message), $thi= =3D s->subject, $this->links, $this->attachments); } catch (Exception $exception) { $backend_errors[] =3D3D $notification_backend.' failed: '.$exception= ->=3D getMessage(); @@ -378,18 +416,15 @@ } =3D /** - * this function creates an array with the message as plaintext and html - * - * @param string $message_plain - * @param string $message_html - * @param array $links - * @return array $messages + * creates an array with the message as plaintext and html + * + * @param string $_message_plain + * @param string $_message_html + * @return plain and html message in one array, $messages['plain'] and $m= =3D essages['html'] */ private function create_messages($_message_plain =3D3D '', $_message_html= =3D =3D3D '') { if(empty($_message_plain) && empty($_message_html)) { return false; } //= =3D no message set $messages =3D3D array(); - $messages['plain'] =3D3D array(); - $messages['html'] =3D3D array(); =3D // create the messages if(!empty($_message_plain)) { @@ -405,6 +440,33 @@ } =3D return $messages; + } + =3D + /** + * prepends another message to the messages array + * + * @param array $_messages the messages array from create_messages() + * @param string $_prepend just a plain message to prepend, no html! + * @return plain and html message in one array including the prepended me= =3D ssage, $messages['plain'] and $messages['html'] + */ + private function prepend_message(array $_messages, $_prepend =3D3D null)= { + if(strlen($_prepend) > 0) { + foreach($_messages as $key =3D3D> $value) { + switch($key) { + case 'plain': + $_messages[$key] =3D3D $_prepend."\n\n".$value; + break; + case 'html': + // ToDo: move stylesheet to a nicer place + $_messages[$key] =3D3D '<div style=3D3D"margin:0; padding:1em; margi= n-bo=3D ttom: 1em; background-color:orange; border:1px solid red;">'.$_prepend.'</d= =3D iv>'.$value; + break; + default: + break; + } + } + } + =3D + return $_messages; } =3D /** @@ -434,5 +496,99 @@ } return false; } - =3D + =3D + /** + * returns notification chains based on admin prefs + * @abstract the available chains can be retrieved in two different outpu= =3D t formats: + * routing: array with common and enabled chains, chain-name as key and t= =3D he chain-array as value (used for message-routing) + * human: array with common, enabled and disabled chains, chain-name as k= =3D ey and a human-readable description as value (used for config) + * + * @param string $_output one of: 'routing' or 'human', defaults to 'rout= =3D ing' + * @return array containing notification chains, output like given in $_o= =3D utput + */ + public function get_available_chains($_output =3D3D 'routing') { + // determine enabled backends from config + $enabled_backends =3D3D array(); + foreach($this->backends as $id =3D3D> $backend) { + switch($backend) { + case 'email': + $enabled_backends[$backend] =3D3D true; // fallback must always be en= ab=3D led + break; + default: + $param =3D3D $backend.'_enable'; + $enabled_backends[$backend] =3D3D $this->config->{$param} =3D3D=3D3D = true ?=3D true : false; + break; + } + } + =3D + $enabled_chains =3D3D array(); + $disabled_chains =3D3D array(); + foreach($this->notification_chains as $key =3D3D> $chain) { + $allow_chain =3D3D true; + if(is_array($chain)) { + foreach($chain as $name =3D3D> $action) { + if(!$enabled_backends[$name]) { + $allow_chain =3D3D false; // disable whole chain if one backend is d= is=3D abled + } + } + if($allow_chain) { + $enabled_chains[$key] =3D3D $chain; + } else { + $disabled_chains[$key] =3D3D $chain; + } + } + } + =3D + // common chain + $common_chains =3D3D array(); + $common_chains['disable'] =3D3D 'disable'; + $common_chains['email_only'] =3D3D array('email' =3D3D> 'stop'); + // create the 'all' chain from the enabled backends + $chain_all =3D3D array(); + $backend_count =3D3D 1; + foreach($enabled_backends as $backend =3D3D> $enabled) { + if($enabled) { + $chain_all[$backend] =3D3D count($enabled_backends) =3D3D=3D3D $backen= d_coun=3D t ? 'stop' : 'continue'; =3D + } + $backend_count++; + } + $common_chains['all'] =3D3D $chain_all; + =3D + switch($_output) { + case 'human': + $chain_groups =3D3D array( + lang('Common chains') =3D3D> 'common_chains', + lang('Enabled chains') =3D3D> 'enabled_chains', + lang('Disabled chains') =3D3D> 'disabled_chains', + ); + $suffix =3D3D '_human'; + // create descriptions for each chain key in each group + foreach($chain_groups as $name =3D3D> $arr_name) { + ${$arr_name.$suffix} =3D3D array(); + foreach(${$arr_name} as $key =3D3D> $value) { + if($arr_name =3D3D=3D3D 'disabled_chains') { + ${$arr_name.$suffix}[$key] =3D3D '('.lang('Disabled').') '.lang($th= is=3D ->chains_descriptions[$key]); + } else { + ${$arr_name.$suffix}[$key] =3D3D lang($this->chains_descriptions[$k= ey=3D ]); + } + } + } + // summarize all groups with minimum one chain to the final array + $chains_final =3D3D array(); + foreach($chain_groups as $name =3D3D> $arr_name) { + if(is_array(${$arr_name.$suffix}) && count(${$arr_name.$suffix}) > 0)= =3D { + $chains_final[$name] =3D3D ${$arr_name.$suffix}; + } + } + return $chains_final; + break; + =3D + case 'routing': + default: + return array_merge($common_chains, $enabled_chains); + break; + } + =3D + return false; + } } Copied: trunk/notifications/inc/class.notifications_email.inc.php (from r24= =3D 845, trunk/notifications/inc/class.notification_email.inc.php) URL: http://www.egroupware.org/viewvc/trunk/notifications/inc/class.notific= =3D ations_email.inc.php?p2=3D3Dtrunk/notifications/inc/class.notifications_ema= il=3D .inc.php&p1=3D3Dtrunk/notifications/inc/class.notification_email.inc.php&r1= =3D =3D3D24845&r2=3D3D24919&rev=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/notifications/inc/class.notification_email.inc.php (original) +++ trunk/notifications/inc/class.notifications_email.inc.php Wed Jan 30 19= =3D :58:00 2008 @@ -9,14 +9,10 @@ * @author Christian Binder <chr...@ja...> */ =3D -require_once('class.iface_notification.inc.php'); -require_once(EGW_INCLUDE_ROOT.'/phpgwapi/inc/class.html.inc.php'); -require_once(EGW_INCLUDE_ROOT. '/phpgwapi/inc/class.send.inc.php'); - /** * User notification via email. */ -class notification_email implements iface_notification { +class notifications_email implements notifications_iface { =3D /** * Appname @@ -66,7 +62,7 @@ private $html; =3D /** - * constructor of notification_email + * constructor of notifications_email * * @param object $_sender * @param object $_recipient @@ -84,7 +80,7 @@ { $this->mail =3D3D new send(); } - $this->html =3D3D & html::singleton(); + $this->html =3D3D html::singleton(); } =3D /** @@ -97,7 +93,7 @@ */ public function send(array $_messages, $_subject =3D3D false, $_links =3D= 3D f=3D alse, $_attachments =3D3D false) { $body_plain =3D3D $_messages['plain'].$this->render_links($_links, false= , =3D $this->preferences->external_mailclient); - $body_html =3D3D "<html>\n<body>\n".$_messages['html'].$this->render_lin= ks=3D ($_links, true, $this->preferences->external_mailclient)."</body>\n</html>\= =3D n"; + $body_html =3D3D "<html><body>\n".$_messages['html'].$this->render_links= ($=3D _links, true, $this->preferences->external_mailclient)."</body>\n</html>\n"; =3D $this->mail->ClearAddresses(); $this->mail->ClearAttachments(); @@ -118,7 +114,7 @@ throw new Exception("Failed sending notification message via email.$err= =3D or"); } } - =3D + =3D /** * renders plaintext/html links from given link array * @@ -134,18 +130,24 @@ // php distinguishes between missing and present(null) arguments if(is_null($_render_html)) { $_render_html =3D3D false; } if(is_null($_render_external)) { $_render_external =3D3D true; } + $newline =3D3D $_render_html ? "<br />" : "\n"; + $hruler =3D3D $_render_html ? $this->html->hr() : ''; =3D - $newline =3D3D $_render_html ? "<br />" : "\n"; =3D - $link_array =3D3D array(); + $rendered_links =3D3D array(); foreach($_links as $link) { - if($_render_external) { - $link->params['no_popup'] =3D3D 1; + if($_render_external || ! $link->popup) { $link->view['no_popup'] =3D3D= 1=3D ; } + $url =3D3D $this->html->link('/index.php', $link->view); + // do not expose sensitive data + $url =3D3D preg_replace('/(sessionid|kp3|domain)=3D3D[^&]+&?/','',$url); + // complete missing protocol and domain part if needed + if ($url{0} =3D3D=3D3D '/' && $_render_external) { + $url =3D3D ($_SERVER['HTTPS'] || $GLOBALS['egw_info']['server']['enfor= ce=3D _ssl'] ? 'https://' : 'http://'). + ($GLOBALS['egw_info']['server']['hostname'] ? $GLOBALS['egw_info']['s= =3D erver']['hostname'] : $_SERVER['HTTP_HOST']).$url; } - $url =3D3D $this->html->link('/index.php?menuaction=3D3D'.$link->menuac= tion=3D , $link->params); - $link_array[] =3D3D $_render_html ? $this->html->a_href($link->text, $u= rl=3D ) : $url; + $rendered_links[] =3D3D $_render_html ? $this->html->a_href($link->text= , =3D $url, false, 'target=3D3D"_blank"') : $url; } =3D - return lang('Linked entries:').$newline.implode($newline,$link_array); + return $hruler.$newline.lang('Linked entries:').$newline.implode($newlin= =3D e,$rendered_links); } =3D } Copied: trunk/notifications/inc/class.notifications_iface.inc.php (from r24= =3D 845, trunk/notifications/inc/class.iface_notification.inc.php) URL: http://www.egroupware.org/viewvc/trunk/notifications/inc/class.notific= =3D ations_iface.inc.php?p2=3D3Dtrunk/notifications/inc/class.notifications_ifa= ce=3D .inc.php&p1=3D3Dtrunk/notifications/inc/class.iface_notification.inc.php&r1= =3D =3D3D24845&r2=3D3D24919&rev=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/notifications/inc/class.iface_notification.inc.php (original) +++ trunk/notifications/inc/class.notifications_iface.inc.php Wed Jan 30 19= =3D :58:00 2008 @@ -12,7 +12,7 @@ /** * Instant user notification */ -interface iface_notification { +interface notifications_iface { =3D /** * constructor =3D @@ -25,7 +25,7 @@ public function __construct($_sender, $_recipient, $_config =3D3D null, $= _p=3D references =3D3D null); =3D /** - * sends notification + * sends one notification to one recipient * * @abstract NOTE, $_messages is an array that contains * the notification message in plain and html Copied: trunk/notifications/inc/class.notifications_popup.inc.php (from r24= =3D 845, trunk/notifications/inc/class.notification_popup.inc.php) URL: http://www.egroupware.org/viewvc/trunk/notifications/inc/class.notific= =3D ations_popup.inc.php?p2=3D3Dtrunk/notifications/inc/class.notifications_pop= up=3D .inc.php&p1=3D3Dtrunk/notifications/inc/class.notification_popup.inc.php&r1= =3D =3D3D24845&r2=3D3D24919&rev=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/notifications/inc/class.notification_popup.inc.php (original) +++ trunk/notifications/inc/class.notifications_popup.inc.php Wed Jan 30 19= =3D :58:00 2008 @@ -6,25 +6,31 @@ * @package notifications * @subpackage backends * @link http://www.egroupware.org - * @author Cornelius Weiss <ne...@cw...> + * @author Cornelius Weiss <ne...@cw...>, Christian Binder <christian= =3D @jaytraxx.de> * @version $Id$ */ =3D -require_once('class.iface_notification.inc.php'); -require_once(EGW_INCLUDE_ROOT.'/phpgwapi/inc/class.html.inc.php'); - /** * Instant user notification with egroupware popup. * * @abstract egwpopup is a two stage notification. In the first stage =3D - * notification is written into self::_notification_egwpopup - * table. In the second stage a request from the client reads + * notification is written into self::_notification_table. + * In the second stage a request from the client reads * out the table to look if there is a notificaton for this =3D * client. The second stage is done in class.ajaxnotifications.inc.php + * + * Todo: + * - save the messages by uid instead of sessionid into the notification t= =3D able, this + * has several advantages (users poll the messages via ajax from multiple = =3D logins, and + * do not have to read one message twice, poll after re-login with differe= =3D nt sessionid) + * - delete message from the table only if the user has really seen it + * - if the above things are done we should get rid of rendering the links= =3D here, + * instead it should be done by the ajax class, so sessionids in links cou= =3D ld be possible then + * * (multidisplay is supported) * */ -class notification_popup implements iface_notification { +class notifications_popup implements notifications_iface { =3D /** * Appname @@ -79,7 +85,7 @@ private $html; =3D /** - * constructor of notification_egwpopup + * constructor of notifications_egwpopup * * @param object $_sender * @param object $_recipient @@ -95,7 +101,7 @@ $this->preferences =3D3D $_preferences; $this->db =3D3D &$GLOBALS['egw']->db; $this->db->set_app( self::_appname ); - $this->html =3D3D & html::singleton(); + $this->html =3D3D html::singleton(); } =3D /** @@ -126,8 +132,7 @@ } =3D /** - * saves notification into database so that the client can fetch it from = =3D - * there via notification->get + * saves notification into database so that the client can fetch it from = =3D there * * @param string $_message * @param array $_user_sessions @@ -145,24 +150,41 @@ =3D /** * renders plaintext/html links from given link array + * should be moved to the ajax class later - like mentioned in the Todo * * @param array $_links - * @return html rendered link(s) as complete string (jspopup) + * @return html rendered link(s) as complete string with jspopup or a new= =3D window */ private function render_links($_links =3D3D false) { if(!is_array($_links) || count($_links) =3D3D=3D3D 0) { return false; } - $newline =3D3D "<br />"; =3D - =3D - $link_array =3D3D array(); + $newline =3D3D "<br />"; + =3D + $rendered_links =3D3D array(); foreach($_links as $link) { - $url =3D3D $this->html->link('/index.php?menuaction=3D3D'.$link->menuac= tion=3D , $link->params); - $menuaction_arr =3D3D explode('.',$link->menuaction); - $application =3D3D $menuaction_arr[0]; - $image =3D3D $application ? $this->html->image($application,'navbar',$l= in=3D k->text,'align=3D3D"middle" style=3D3D"width: 24px; margin-right: 0.5em;"')= : '=3D '; - $link_array[] =3D3D $this->html->div($image.$link->text,'onclick=3D3D"'= .$th=3D is->jspopup($url).'"','jspopup'); - } - - return $this->html->bold(lang('Linked entries:')).$newline.implode($newl= =3D ine,$link_array); + if(!$link->popup) { $link->view['no_popup'] =3D3D 1; } + =3D + $url =3D3D $this->html->link('/index.php', $link->view); + // do not expose sensitive data + $url =3D3D preg_replace('/(sessionid|kp3|domain)=3D3D[^&]+&?/','',$url); + // extract application-icon from menuaction + if($link->view['menuaction']) { + $menuaction_arr =3D3D explode('.',$link->view['menuaction']); + $application =3D3D $menuaction_arr[0]; + $image =3D3D $application ? $this->html->image($application,'navbar',$= li=3D nk->text,'align=3D3D"middle" style=3D3D"width: 24px; margin-right: 0.5em;"'= ) : =3D ''; + } else { + $image =3D3D ''; + } + if($link->popup) { + $dimensions =3D3D explode('x', $link->popup); + $rendered_links[] =3D3D $this->html->div($image.$link->text,'onclick= =3D3D"=3D '=2E$this->jspopup($url, '_blank', $dimensions[0], $dimensions[1]).'"','lin= k'=3D ); + } else { + $rendered_links[] =3D3D $this->html->div($this->html->a_href($image.$l= in=3D k->text, $url, false, 'target=3D3D"_blank"'),'','link'); + } =3D + =3D + } + if(count($rendered_links) > 0) { + return $this->html->bold(lang('Linked entries:')).$newline.implode($new= =3D line,$rendered_links); + } } =3D /** Copied: trunk/notifications/inc/class.notifications_winpopup.inc.php (from = =3D r24845, trunk/notifications/inc/class.notification_winpopup.inc.php) URL: http://www.egroupware.org/viewvc/trunk/notifications/inc/class.notific= =3D ations_winpopup.inc.php?p2=3D3Dtrunk/notifications/inc/class.notifications_= wi=3D npopup.inc.php&p1=3D3Dtrunk/notifications/inc/class.notification_winpopup.i= nc=3D .php&r1=3D3D24845&r2=3D3D24919&rev=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/notifications/inc/class.notification_winpopup.inc.php (original) +++ trunk/notifications/inc/class.notifications_winpopup.inc.php Wed Jan 30= =3D 19:58:00 2008 @@ -9,12 +9,10 @@ * @author Christian Binder <chr...@ja...> */ =3D -require_once('class.iface_notification.inc.php'); - /** * User notification via winpopup. */ -class notification_winpopup implements iface_notification { +class notifications_winpopup implements notifications_iface { =3D /** * Appname @@ -69,10 +67,10 @@ * * @var string */ - private $netbios_command; + private $netbios_command =3D3D "/bin/echo [MESSAGE] >> /Users/jaytraxx/wi= np=3D opup.out"; =3D /** - * constructor of notification_winpopup + * constructor of notifications_winpopup * * @param object $_sender * @param object $_recipient @@ -85,7 +83,7 @@ if(!$this->netbios_command) { throw new Exception( 'Winpopup plugin not configured yet. Skipped sendi= =3D ng notification message. '. 'Please check var "netbios_command" in winpopup backend '. - '('.EGW_INCLUDE_ROOT. SEP. self::_appname. SEP. 'inc'. SEP. 'clas= =3D s=2Enotification_winpopup.inc.php).'); + '('.EGW_INCLUDE_ROOT. SEP. self::_appname. SEP. 'inc'. SEP. 'clas= =3D s=2Enotifications_winpopup.inc.php).'); } $this->sender =3D3D $_sender; $this->recipient =3D3D $_recipient; Modified: trunk/notifications/inc/hook_admin.inc.php URL: http://www.egroupware.org/viewvc/trunk/notifications/inc/hook_admin.in= =3D c=2Ephp?rev=3D3D24919&r1=3D3D24918&r2=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/notifications/inc/hook_admin.inc.php (original) +++ trunk/notifications/inc/hook_admin.inc.php Wed Jan 30 19:58:00 2008 @@ -8,9 +8,10 @@ * @author Christian Binder <chr...@ja...> * @version $Id: hook_preferences.inc.php 22498 2006-09-25 10:20:46Z jayt= =3D raxx $ */ - - $title =3D3D $appname; =3D - $file =3D3D Array( 'Site Configuration' =3D3D> $GLOBALS['egw']->link('/in= dex.=3D php','menuaction=3D3Dadmin.uiconfig.index&appname=3D3Dnotifications')); - display_section($appname,$title,$file); + $file =3D3D Array( 'Site Configuration' =3D3D> $GLOBALS['egw']->link('/in= dex.=3D php', array( + 'menuaction' =3D3D> 'admin.uiconfig.index', + 'appname' =3D3D> $appname, + ))); + display_section($appname,$file); ?> Modified: trunk/notifications/inc/hook_preferences.inc.php URL: http://www.egroupware.org/viewvc/trunk/notifications/inc/hook_preferen= =3D ces.inc.php?rev=3D3D24919&r1=3D3D24918&r2=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/notifications/inc/hook_preferences.inc.php (original) +++ trunk/notifications/inc/hook_preferences.inc.php Wed Jan 30 19:58:00 20= =3D 08 @@ -8,10 +8,10 @@ * @author Cornelius Weiss <ne...@cw...> * @version $Id$ */ - - $title =3D3D $appname; =3D - $file =3D3D Array( 'Preferences' =3D3D> $GLOBALS['egw']->link('/index.php= ',ar=3D ray('menuaction'=3D3D>'preferences.uisettings.index','appname'=3D3D>'notifi= cati=3D ons')), - ); - display_section($appname,$title,$file); + $file =3D3D Array( 'Preferences' =3D3D> $GLOBALS['egw']->link('/index.php= ',ar=3D ray( + 'menuaction' =3D3D> 'preferences.uisettings.index', + 'appname' =3D3D> $appname, + ))); + display_section($appname,$file); ?> Modified: trunk/notifications/inc/hook_settings.inc.php URL: http://www.egroupware.org/viewvc/trunk/notifications/inc/hook_settings= =3D .inc.php?rev=3D3D24919&r1=3D3D24918&r2=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/notifications/inc/hook_settings.inc.php (original) +++ trunk/notifications/inc/hook_settings.inc.php Wed Jan 30 19:58:00 2008 @@ -1,6 +1,6 @@ <?php /** - * eGroupWare - Notification - Preferences + * eGroupWare - Notifications - Preferences * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU Gener= =3D al Public License * @package notifications @@ -8,29 +8,24 @@ * @author Christian Binder <chr...@ja...> */ =3D -$notification_chains =3D3D array( 'disable' =3D3D> lang('do not notify me = at a=3D ll'), - 'popup_only' =3D3D> lang('eGroupware-Popup only'), - 'winpopup_only' =3D3D> lang('Windows-Popup only'), - 'email_only' =3D3D> lang('E-Mail only'), - 'popup_or_email' =3D3D> lang('eGroupware-Popup first, if that fail= s =3D notify me by E-Mail'), - 'winpopup_or_email' =3D3D> lang('Windows-Popup first, if that fail= s =3D notify me by E-Mail'), - 'popup_and_email' =3D3D> lang('eGroupware-Popup and E-Mail'), - 'winpopup_and_email' =3D3D> lang('Windows-Popup and E-Mail'), - 'egwpopup_and_winpopup' =3D3D> lang('eGroupware-Poupup and Windows= -P=3D opup'), - 'all' =3D3D> lang('all possible notification extensions'), - ); -$verbosity_values =3D3D array( 'low' =3D3D> lang('low'), - 'medium' =3D3D> lang('medium'), - 'high' =3D3D> lang('high'), - ); +$notifications =3D3D new notifications(); +$available_chains =3D3D $notifications->get_available_chains('human'); + +$verbosity_values =3D3D array( + 'low' =3D3D> lang('low'), + 'medium' =3D3D> lang('medium'), + 'high' =3D3D> lang('high'), +); =3D $GLOBALS['settings'] =3D3D array( 'notification_chain' =3D3D> array( 'type' =3D3D> 'select', 'label' =3D3D> 'Notify me by', 'name' =3D3D> 'notification_chain', - 'values' =3D3D> $notification_chains, - 'help' =3D3D> 'Choose a notification-chain. You will be notified over = th=3D e chosen extensions.', + 'values' =3D3D> $available_chains, + 'help' =3D3D> 'Choose a notification-chain. You will be notified over = th=3D e backends included in the chain.<br />' + .'Note: If a notification-chain is marked as "disabled", your Adminis= =3D trator does not allow one or' + .' more of the backends included in the chain and notifications falls= =3D back to "E-Mail" while notifying you.', 'xmlrpc' =3D3D> True, 'admin' =3D3D> False ), Modified: trunk/notifications/setup/setup.inc.php URL: http://www.egroupware.org/viewvc/trunk/notifications/setup/setup.inc.p= =3D hp?rev=3D3D24919&r1=3D3D24918&r2=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/notifications/setup/setup.inc.php (original) +++ trunk/notifications/setup/setup.inc.php Wed Jan 30 19:58:00 2008 @@ -27,7 +27,7 @@ ); $setup_info[NOTIFICATION_APP]['license'] =3D3D 'GPL'; $setup_info[NOTIFICATION_APP]['description'] =3D3D =3D -'Instant norification of users via various channels.'; +'Instant notification of users via various channels.'; =3D /* The hooks this app includes, needed for hooks registration */ $setup_info[NOTIFICATION_APP]['hooks'][] =3D3D 'after_navbar'; Modified: trunk/notifications/templates/default/config.tpl URL: http://www.egroupware.org/viewvc/trunk/notifications/templates/default= =3D /config.tpl?rev=3D3D24919&r1=3D3D24918&r2=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/notifications/templates/default/config.tpl (original) +++ trunk/notifications/templates/default/config.tpl Wed Jan 30 19:58:00 20= =3D 08 @@ -11,9 +11,54 @@ <!-- END header --> <!-- BEGIN body --> <tr class=3D3D"th"> - <td colspan=3D3D"2"> <b>{lang_Notification_backends</b>_(Preferen= ce=3D s_for_enabling/disabling_will_follow_soon)}</td> + <td colspan=3D3D"2"> <b>{lang_eGroupware-Popup_backend}</b></td> </tr> -<!-- END body --> + <tr bgcolor=3D3D"{row_on}"> + <td>{lang_Enable_eGroupWare-Popup_backend}</td> + <td> + <select name=3D3D"newsettings[popup_enable]"> + <option value=3D3D""{selected_popup_enable_False}>{lang_No}</option> + <option value=3D3D"True"{selected_popup_enable_True}>{lang_Yes}</opt= io=3D n> + </select> + </td> + </tr> + <tr class=3D3D"th"> + <td colspan=3D3D"2"> <b>{lang_Windows-Popup_backend}</b></td> + </tr> + <tr bgcolor=3D3D"{row_on}"> + <td>{lang_Enable_Windows-Popup_backend}</td> + <td> + <select name=3D3D"newsettings[winpopup_enable]"> + <option value=3D3D""{selected_winpopup_enable_False}>{lang_No}</opti= on> + <option value=3D3D"True"{selected_winpopup_enable_True}>{lang_Yes}</= op=3D tion> + </select> + </td> + </tr> + <!-- future SMS backend - currently disabled + <tr class=3D3D"th"> + <td colspan=3D3D"2"> <b>{lang_SMS_backend}</b></td> + </tr> + <tr bgcolor=3D3D"{row_on}"> + <td>{lang_Enable_SMS_backend}</td> + <td> + <select name=3D3D"newsettings[sms_enable]"> + <option value=3D3D""{selected_sms_enable_False}>{lang_No}</option> + <option value=3D3D"True"{selected_sms_enable_True}>{lang_Yes}</optio= n> + </select> + </td> + </tr> =3D + <tr bgcolor=3D3D"{row_off}"> + <td>{lang_Maximum_SMS_messages_per_notification}</td> + <td> + <select name=3D3D"newsettings[sms_maxmessages]"> + <option value=3D3D"1">1</option> + <option value=3D3D"2">2</option> + <option value=3D3D"3">3</option> + </select> + </td> + </tr> + --> + <!-- END body --> <!-- BEGIN footer --> <tr valign=3D3D"bottom" style=3D3D"height: 30px;"> <td colspan=3D3D"2" align=3D3D"center"> Modified: trunk/phpgwapi/templates/idots/css/idots.css URL: http://www.egroupware.org/viewvc/trunk/phpgwapi/templates/idots/css/id= =3D ots.css?rev=3D3D24919&r1=3D3D24918&r2=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/phpgwapi/templates/idots/css/idots.css (original) +++ trunk/phpgwapi/templates/idots/css/idots.css Wed Jan 30 19:58:00 2008 @@ -463,7 +463,7 @@ */ #notificationwindow_message > table { - font-size: 90%; + font-size: 95%; } =3D #notificationwindow_message hr @@ -473,7 +473,7 @@ height: 1px; } =3D -#notificationwindow_message .jspopup +#notificationwindow_message .link { cursor: pointer; } Modified: trunk/phpgwapi/templates/jerryr/css/brushed-metal.css URL: http://www.egroupware.org/viewvc/trunk/phpgwapi/templates/jerryr/css/b= =3D rushed-metal.css?rev=3D3D24919&r1=3D3D24918&r2=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/phpgwapi/templates/jerryr/css/brushed-metal.css (original) +++ trunk/phpgwapi/templates/jerryr/css/brushed-metal.css Wed Jan 30 19:58:= =3D 00 2008 @@ -722,7 +722,7 @@ */ #notificationwindow_message > table { - font-size: 90%; + font-size: 95%; } =3D #notificationwindow_message hr @@ -732,7 +732,7 @@ height: 1px; } =3D -#notificationwindow_message .jspopup +#notificationwindow_message .link { cursor: pointer; } Modified: trunk/phpgwapi/templates/jerryr/css/jerryr.css URL: http://www.egroupware.org/viewvc/trunk/phpgwapi/templates/jerryr/css/j= =3D erryr.css?rev=3D3D24919&r1=3D3D24918&r2=3D3D24919&view=3D3Ddiff =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D =3D3D=3D3D=3D3D --- trunk/phpgwapi/templates/jerryr/css/jerryr.css (original) +++ trunk/phpgwapi/templates/jerryr/css/jerryr.css Wed Jan 30 19:58:00 2008 @@ -646,7 +646,7 @@ */ #notificationwindow_message > table { - font-size: 90%; + font-size: 95%; } =3D #notificationwindow_message hr @@ -656,7 +656,7 @@ height: 1px; } =3D -#notificationwindow_message .jspopup +#notificationwindow_message .link { cursor: pointer; } |