forked from extern/egroupware
- Use link registry to open notification links
- Fix mark all notifications as read on popup close
This commit is contained in:
parent
f2d6cfdf0a
commit
30f35f01fa
@ -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'),
|
||||
);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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('<a href="'.$url.'" target="_blank">'.$image.$link->text.'</a>','','link');
|
||||
}
|
||||
|
@ -75,6 +75,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 ) {
|
||||
@ -146,7 +160,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");
|
||||
|
Loading…
Reference in New Issue
Block a user