diff --git a/etemplate/inc/class.bo_tracking.inc.php b/etemplate/inc/class.bo_tracking.inc.php index 93e294c321..d5354ecead 100644 --- a/etemplate/inc/class.bo_tracking.inc.php +++ b/etemplate/inc/class.bo_tracking.inc.php @@ -945,6 +945,8 @@ abstract class bo_tracking { return array( 'text' => $this->get_title($data,$old), + 'app' => $this->app, + 'id' => $data[$this->id_field], 'view' => $view, 'popup' => egw_link::is_popup($this->app,'view'), ); diff --git a/notifications/inc/class.notifications.inc.php b/notifications/inc/class.notifications.inc.php index 1255b842de..ef675aa208 100644 --- a/notifications/inc/class.notifications.inc.php +++ b/notifications/inc/class.notifications.inc.php @@ -328,7 +328,7 @@ final class notifications { $this->links = array(); // clear array if set foreach($_links as $link) { if(is_array($link)) { - $this->add_link($link['text'], $link['view'], $link['popup']); + $this->add_link($link['text'], $link['view'], $link['popup'], $link['app'],$link['id']); } } return true; @@ -355,13 +355,18 @@ final class notifications { * @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 + * @param string $_app Application name, to use link registry (popup & view ignored) + * @param string $_id Application ID, to use link registry (popup & view ignored) */ - public function add_link($_text, $_view, $_popup = false) { + public function add_link($_text, $_view, $_popup = false, $_app = false, $_id = false) { if(!$_view || !$_text) { return false; } - $this->links[] = (object)array( 'text' => $_text, - 'view' => $_view, - 'popup' => $_popup, - ); + $this->links[] = (object)array( + 'text' => $_text, + 'view' => $_view, + 'popup' => $_popup, + 'app' => $_app, + 'id' => $_id + ); return true; } diff --git a/notifications/inc/class.notifications_popup.inc.php b/notifications/inc/class.notifications_popup.inc.php index 61378171c7..b82c45a295 100644 --- a/notifications/inc/class.notifications_popup.inc.php +++ b/notifications/inc/class.notifications_popup.inc.php @@ -157,7 +157,14 @@ class notifications_popup implements notifications_iface { if($link->popup && !$GLOBALS['egw_info']['user']['preferences']['notifications']['external_mailclient']) { $dimensions = explode('x', $link->popup); - $rendered_links[] = html::div($image.$link->text,'onclick="'.$this->jspopup($url, '_blank', $dimensions[0], $dimensions[1]).'"','link'); + $data = array( + "data-app = '{$link->app}'", + "data-id = '{$link->id}'", + "data-url = '$url'", + "data-popup = '{$link->popup}'" + ); + + $rendered_links[] = html::div($image.$link->text,implode(' ',$data),'link'); } else { $rendered_links[] = html::div(''.$image.$link->text.'','','link'); } diff --git a/notifications/js/notificationajaxpopup.js b/notifications/js/notificationajaxpopup.js index 0aca6d5d48..1bb3496eda 100644 --- a/notifications/js/notificationajaxpopup.js +++ b/notifications/js/notificationajaxpopup.js @@ -83,6 +83,20 @@ egwpopup_message.style.maxHeight = (Browserheight/2) + "px"; for(var show in notifymessages) break; egwpopup_message.innerHTML = notifymessages[show]; + + // Activate links + $j('div[data-id],div[data-url]', egwpopup_message).on('click', + function() { + if(this.dataset.id) + { + egw.open(this.dataset.id,this.dataset.app); + } + else + { + egw.open_link(this.dataset.url,'_blank',this.dataset.popup); + } + } + ).addClass('et2_link'); var num = 0; for(var id in notifymessages) ++num; if(num-1 > 0 ) { @@ -154,7 +168,7 @@ for(var id in notifymessages) { ids.push(id); } - var request = egw.json("notifications.notifications_ajax.confirm_message", ids); + var request = egw.json("notifications.notifications_ajax.confirm_message", [ids]); request.sendRequest(); notifymessages = {}; var egwpopup = document.getElementById("egwpopup");