diff --git a/notifications/inc/class.notifications_ajax.inc.php b/notifications/inc/class.notifications_ajax.inc.php index 1b1bf4574d..b1970b4f45 100644 --- a/notifications/inc/class.notifications_ajax.inc.php +++ b/notifications/inc/class.notifications_ajax.inc.php @@ -22,11 +22,6 @@ class notifications_ajax */ const _appname = 'notifications'; - /** - * Mailappname - */ - const _mailappname = 'mail'; - /** * Notification table in SQL database */ @@ -40,7 +35,7 @@ class notifications_ajax /** * Do NOT consider notifications older than this */ - const CUT_OFF_DATE = '-30days'; + static public $cut_off_date = '-30days'; /** * holds account object for user to notify @@ -49,13 +44,6 @@ class notifications_ajax */ private $recipient; - /** - * holds config object (sitewide application config) - * - * @var object - */ - private $config; - /** * holds preferences array of user to notify * @@ -91,7 +79,7 @@ class notifications_ajax public function __construct() { $this->response = Api\Json\Response::get(); - $this->recipient = (object)$GLOBALS['egw']->accounts->read($GLOBALS['egw_info']['user']['account_id']); + $this->recipient = (object)$GLOBALS['egw_info']['user']; $this->db = $GLOBALS['egw']->db; @@ -187,7 +175,7 @@ class notifications_ajax $notify_ids[] = $data; } } - $cut_off = $this->db->quote(Api\DateTime::to(self::CUT_OFF_DATE, Api\DateTime::DATABASE)); + $cut_off = $this->db->quote(Api\DateTime::to(self::$cut_off_date, Api\DateTime::DATABASE)); try { foreach($app_ids as $app => $ids) { @@ -243,4 +231,14 @@ class notifications_ajax $this->response->apply('app.notifications.append', array($entries['rows']??[], $browserNotify, $entries['total']??0)); return true; } + + public function initStatic() + { + $config = Api\Config::read(self::_appname); + + if (!empty($config['popup_cut_off_days']) && $config['popup_cut_off_days'] > 0) + { + self::$cut_off_date = "-$config[popup_cut_off_days]days"; + } + } } \ No newline at end of file diff --git a/notifications/inc/class.notifications_popup.inc.php b/notifications/inc/class.notifications_popup.inc.php index 24b28fa51d..248732d6d3 100644 --- a/notifications/inc/class.notifications_popup.inc.php +++ b/notifications/inc/class.notifications_popup.inc.php @@ -158,14 +158,14 @@ class notifications_popup implements notifications_iface if (($total = $db->select(self::_notification_table, 'COUNT(*)', [ 'account_id' => $_account_id, 'notify_type' => self::_type, - 'notify_created > '.($cut_off=$db->quote(Api\DateTime::to(notifications_ajax::CUT_OFF_DATE, Api\DateTime::DATABASE))), + 'notify_created > '.($cut_off=$db->quote(Api\DateTime::to(notifications_ajax::$cut_off_date, Api\DateTime::DATABASE))), 'notify_app_id IS NULL', ], __LINE__, __FILE__, false, '', self::_appname)->fetchColumn()+ $db->select( '('.$db->select(self::_notification_table, 'notify_app,notify_app_id', [ 'account_id' => $_account_id, 'notify_type' => self::_type, - 'notify_created > '.($cut_off=$db->quote(Api\DateTime::to(notifications_ajax::CUT_OFF_DATE, Api\DateTime::DATABASE))), + 'notify_created > '.($cut_off=$db->quote(Api\DateTime::to(notifications_ajax::$cut_off_date, Api\DateTime::DATABASE))), 'notify_app_id IS NOT NULL', ], false, false, false, 'GROUP BY notify_app,notify_app_id', self::_appname).') AS app_ids', 'COUNT(*)', false, __LINE__, __FILE__, false, '', self::_appname)->fetchColumn() diff --git a/notifications/lang/egw_de.lang b/notifications/lang/egw_de.lang index 1a588d4d1e..57fb63bb82 100644 --- a/notifications/lang/egw_de.lang +++ b/notifications/lang/egw_de.lang @@ -2,6 +2,7 @@ account: notifications de Benutzername: all possible notification backends notifications de Alle verfügbaren Benachrichtigungs-Schnittstellen are you sure you want to delete all notifications? notifications de Sind Sie sicher, dass Sie alle Benachrichtigungen löschen möchten? +automatic deleted notifications older than admin de Benachrichtigungen automatisch löschen, wenn älter als browser notifications de Browser browser is starting. notifications de Browser ist am starten. cancal settings? notifications de Einstellungen abbrechen? @@ -65,6 +66,7 @@ more info notifications de Mehr notification common de Benachrichtigung notifier notifications de Benachrichtiger notify me by notifications de Benachrichtige mich per +only used if no push server available! admin de Wird nur benutzt wenn kein Push Server verfügbar! open notified entry notifications de Eintrag öffnen optimize e-mails for external mail client notifications de Optimiere E-Mails für externe E-Mail-Programme page not found, please check serveraddress. notifications de Seite nicht gefunden, bitte überprüfen Sie die Server-Adresse diff --git a/notifications/lang/egw_en.lang b/notifications/lang/egw_en.lang index bc9a7f8bc9..4c2b62848c 100644 --- a/notifications/lang/egw_en.lang +++ b/notifications/lang/egw_en.lang @@ -2,6 +2,7 @@ account: notifications en Account: all possible notification backends notifications en All possible notification backends are you sure you want to delete all notifications? notifications en Are you sure you want to delete all notifications? +automatic deleted notifications older than admin en Automatic deleted notifications older than browser notifications en Browser browser is starting. notifications en Browser is starting. cancal settings? notifications en Cancel settings? @@ -65,6 +66,7 @@ more info notifications en More info notification common en Notification notifier notifications en Notifier notify me by notifications en Notify me by +only used if no push server available! admin en Only used if no push server available! open notified entry notifications en Open notified entry optimize e-mails for external mail client notifications en Optimize emails for external email client page not found, please check serveraddress. notifications en Page not found, please check server address. diff --git a/notifications/templates/default/config.xet b/notifications/templates/default/config.xet index 56838e6e4f..8187cfc6a4 100644 --- a/notifications/templates/default/config.xet +++ b/notifications/templates/default/config.xet @@ -12,7 +12,17 @@ - + + + + + + + + + + + @@ -35,7 +45,7 @@ - +