mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:29 +01:00
* Notifications: configurable number of days (default 30), after which older notifications get automatic deleted
This commit is contained in:
parent
92041df5bd
commit
9d45da268e
@ -22,11 +22,6 @@ class notifications_ajax
|
|||||||
*/
|
*/
|
||||||
const _appname = 'notifications';
|
const _appname = 'notifications';
|
||||||
|
|
||||||
/**
|
|
||||||
* Mailappname
|
|
||||||
*/
|
|
||||||
const _mailappname = 'mail';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification table in SQL database
|
* Notification table in SQL database
|
||||||
*/
|
*/
|
||||||
@ -40,7 +35,7 @@ class notifications_ajax
|
|||||||
/**
|
/**
|
||||||
* Do NOT consider notifications older than this
|
* 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
|
* holds account object for user to notify
|
||||||
@ -49,13 +44,6 @@ class notifications_ajax
|
|||||||
*/
|
*/
|
||||||
private $recipient;
|
private $recipient;
|
||||||
|
|
||||||
/**
|
|
||||||
* holds config object (sitewide application config)
|
|
||||||
*
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
private $config;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* holds preferences array of user to notify
|
* holds preferences array of user to notify
|
||||||
*
|
*
|
||||||
@ -91,7 +79,7 @@ class notifications_ajax
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->response = Api\Json\Response::get();
|
$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;
|
$this->db = $GLOBALS['egw']->db;
|
||||||
|
|
||||||
@ -187,7 +175,7 @@ class notifications_ajax
|
|||||||
$notify_ids[] = $data;
|
$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 {
|
try {
|
||||||
foreach($app_ids as $app => $ids)
|
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));
|
$this->response->apply('app.notifications.append', array($entries['rows']??[], $browserNotify, $entries['total']??0));
|
||||||
return true;
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -158,14 +158,14 @@ class notifications_popup implements notifications_iface
|
|||||||
if (($total = $db->select(self::_notification_table, 'COUNT(*)', [
|
if (($total = $db->select(self::_notification_table, 'COUNT(*)', [
|
||||||
'account_id' => $_account_id,
|
'account_id' => $_account_id,
|
||||||
'notify_type' => self::_type,
|
'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',
|
'notify_app_id IS NULL',
|
||||||
], __LINE__, __FILE__, false, '', self::_appname)->fetchColumn()+
|
], __LINE__, __FILE__, false, '', self::_appname)->fetchColumn()+
|
||||||
$db->select(
|
$db->select(
|
||||||
'('.$db->select(self::_notification_table, 'notify_app,notify_app_id', [
|
'('.$db->select(self::_notification_table, 'notify_app,notify_app_id', [
|
||||||
'account_id' => $_account_id,
|
'account_id' => $_account_id,
|
||||||
'notify_type' => self::_type,
|
'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',
|
'notify_app_id IS NOT NULL',
|
||||||
], false, false, false, 'GROUP BY notify_app,notify_app_id', self::_appname).') AS app_ids',
|
], false, false, false, 'GROUP BY notify_app,notify_app_id', self::_appname).') AS app_ids',
|
||||||
'COUNT(*)', false, __LINE__, __FILE__, false, '', self::_appname)->fetchColumn()
|
'COUNT(*)', false, __LINE__, __FILE__, false, '', self::_appname)->fetchColumn()
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
account: notifications de Benutzername:
|
account: notifications de Benutzername:
|
||||||
all possible notification backends notifications de Alle verfügbaren Benachrichtigungs-Schnittstellen
|
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?
|
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 notifications de Browser
|
||||||
browser is starting. notifications de Browser ist am starten.
|
browser is starting. notifications de Browser ist am starten.
|
||||||
cancal settings? notifications de Einstellungen abbrechen?
|
cancal settings? notifications de Einstellungen abbrechen?
|
||||||
@ -65,6 +66,7 @@ more info notifications de Mehr
|
|||||||
notification common de Benachrichtigung
|
notification common de Benachrichtigung
|
||||||
notifier notifications de Benachrichtiger
|
notifier notifications de Benachrichtiger
|
||||||
notify me by notifications de Benachrichtige mich per
|
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
|
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
|
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
|
page not found, please check serveraddress. notifications de Seite nicht gefunden, bitte überprüfen Sie die Server-Adresse
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
account: notifications en Account:
|
account: notifications en Account:
|
||||||
all possible notification backends notifications en All possible notification backends
|
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?
|
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 notifications en Browser
|
||||||
browser is starting. notifications en Browser is starting.
|
browser is starting. notifications en Browser is starting.
|
||||||
cancal settings? notifications en Cancel settings?
|
cancal settings? notifications en Cancel settings?
|
||||||
@ -65,6 +66,7 @@ more info notifications en More info
|
|||||||
notification common en Notification
|
notification common en Notification
|
||||||
notifier notifications en Notifier
|
notifier notifications en Notifier
|
||||||
notify me by notifications en Notify me by
|
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
|
open notified entry notifications en Open notified entry
|
||||||
optimize e-mails for external mail client notifications en Optimize emails for external email client
|
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.
|
page not found, please check serveraddress. notifications en Page not found, please check server address.
|
||||||
|
@ -12,7 +12,17 @@
|
|||||||
<et2-description value="EGroupware-Popup backend" span="all" class="subHeader"></et2-description>
|
<et2-description value="EGroupware-Popup backend" span="all" class="subHeader"></et2-description>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<et2-description value="Poll interval"></et2-description>
|
<et2-description value="Automatic deleted notifications older than"></et2-description>
|
||||||
|
<et2-hbox>
|
||||||
|
<et2-number id="newsettings[popup_cut_off_days]" placeholder="30"></et2-number>
|
||||||
|
<et2-description value="days" width="4em"></et2-description>
|
||||||
|
</et2-hbox>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<et2-vbox>
|
||||||
|
<et2-description value="Poll interval"></et2-description>
|
||||||
|
<et2-description value="Only used if no push server available!"></et2-description>
|
||||||
|
</et2-vbox>
|
||||||
<et2-select id="newsettings[popup_poll_interval]">
|
<et2-select id="newsettings[popup_poll_interval]">
|
||||||
<option value="5">5 seconds</option>
|
<option value="5">5 seconds</option>
|
||||||
<option value="60">1 {minute}</option>
|
<option value="60">1 {minute}</option>
|
||||||
@ -35,7 +45,7 @@
|
|||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<et2-description value="Mail account to use for notifications"></et2-description>
|
<et2-description value="Mail account to use for notifications"></et2-description>
|
||||||
<et2-select id="newsettings[async_identity]" emptyLable="automatic"></et2-select>
|
<et2-select id="newsettings[async_identity]" emptyLabel="automatic"></et2-select>
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
|
Loading…
Reference in New Issue
Block a user