mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-12 00:49:04 +01:00
* Calendar: popup notifications now include a link again
This commit is contained in:
parent
6b8a937977
commit
7ade6b4f55
@ -907,12 +907,14 @@ class calendar_boupdate extends calendar_bo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// set message (without separator) for popup notifications
|
|
||||||
$notification->set_popupmessage($notify_body."\n\n".$details['description']."\n\n".$details_body);
|
|
||||||
|
|
||||||
// iCal: description need to be separated from body by fancy separator
|
// iCal: description need to be separated from body by fancy separator
|
||||||
$notification->set_message($notify_body."\n\n".$details_body."\n*~*~*~*~*~*~*~*~*~*\n\n".$details['description']);
|
$notification->set_message($notify_body."\n\n".$details_body."\n*~*~*~*~*~*~*~*~*~*\n\n".$details['description']);
|
||||||
}
|
}
|
||||||
|
// popup notifiactions: set subject, different message (without separator) and (always) links
|
||||||
|
$notification->set_popupsubject($subject);
|
||||||
|
$notification->set_popupmessage($notify_body."\n\n".$details['description']."\n\n".$details_body);
|
||||||
|
$notification->set_popuplinks(array($details['link_arr']));
|
||||||
|
|
||||||
if(is_array($attachment)) { $notification->set_attachments(array($attachment)); }
|
if(is_array($attachment)) { $notification->set_attachments(array($attachment)); }
|
||||||
$notification->send();
|
$notification->send();
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,12 @@ final class notifications {
|
|||||||
*/
|
*/
|
||||||
private $links = array();
|
private $links = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* array with objects of links
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $popup_links = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* array with objects of attachments
|
* array with objects of attachments
|
||||||
* @var array
|
* @var array
|
||||||
@ -298,8 +304,8 @@ final class notifications {
|
|||||||
/**
|
/**
|
||||||
* sets the notification links
|
* sets the notification links
|
||||||
*
|
*
|
||||||
* @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) {
|
public function set_links(array $_links) {
|
||||||
$this->links = array(); // clear array if set
|
$this->links = array(); // clear array if set
|
||||||
foreach($_links as $link) {
|
foreach($_links as $link) {
|
||||||
@ -310,6 +316,21 @@ final class notifications {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets the notification links for popups
|
||||||
|
*
|
||||||
|
* @param array $_links link array (like defined in $this->add_link)
|
||||||
|
*/
|
||||||
|
public function set_popuplinks(array $_links) {
|
||||||
|
$this->popup_links = array(); // clear array if set
|
||||||
|
foreach($_links as $link) {
|
||||||
|
if(is_array($link)) {
|
||||||
|
$this->add_popuplink($link['text'], $link['view'], $link['popup']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* adds a notification link
|
* adds a notification link
|
||||||
*
|
*
|
||||||
@ -326,6 +347,22 @@ final class notifications {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds a notification link for popups
|
||||||
|
*
|
||||||
|
* @param string $_text a descriptive text for the link
|
||||||
|
* @param array $_view all params needed to view the link (name => value pairs)
|
||||||
|
* @param string $_popup if link can be viewed in a popup something like '300x200' otherwise false
|
||||||
|
*/
|
||||||
|
public function add_popuplink($_text, $_view, $_popup = false) {
|
||||||
|
if(!$_view || !$_text) { return false; }
|
||||||
|
$this->popup_links[] = (object)array( 'text' => $_text,
|
||||||
|
'view' => $_view,
|
||||||
|
'popup' => $_popup,
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the notification attachments
|
* sets the notification attachments
|
||||||
*
|
*
|
||||||
@ -466,8 +503,13 @@ final class notifications {
|
|||||||
throw new Exception($notification_backend. ' is no implementation of notifications_iface');
|
throw new Exception($notification_backend. ' is no implementation of notifications_iface');
|
||||||
}
|
}
|
||||||
$lsubject = $this->subject;
|
$lsubject = $this->subject;
|
||||||
if ($backend=='popup' && isset($this->popupsubject) && !empty($this->popupsubject)) $lsubject = $this->popupsubject;
|
$llinks = $this->links;
|
||||||
$obj->send($this->prepend_message($messages, $prepend_message), $lsubject, $this->links, $this->attachments);
|
if ($backend == 'popup')
|
||||||
|
{
|
||||||
|
if (!empty($this->popupsubject)) $lsubject = $this->popupsubject;
|
||||||
|
if ($this->popup_links) $llinks = $this->popup_links;
|
||||||
|
}
|
||||||
|
$obj->send($this->prepend_message($messages, $prepend_message), $lsubject, $llinks, $this->attachments);
|
||||||
}
|
}
|
||||||
catch (Exception $exception) {
|
catch (Exception $exception) {
|
||||||
$backend_errors[] = $notification_backend.' failed: '.$exception->getMessage();
|
$backend_errors[] = $notification_backend.' failed: '.$exception->getMessage();
|
||||||
|
Loading…
Reference in New Issue
Block a user