mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 12:21:26 +02:00
- Use link registry to open notification links
- Fix mark all notifications as read on popup close
This commit is contained in:
parent
cc71329be0
commit
da3d0d23c4
@ -945,6 +945,8 @@ abstract class bo_tracking
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'text' => $this->get_title($data,$old),
|
'text' => $this->get_title($data,$old),
|
||||||
|
'app' => $this->app,
|
||||||
|
'id' => $data[$this->id_field],
|
||||||
'view' => $view,
|
'view' => $view,
|
||||||
'popup' => egw_link::is_popup($this->app,'view'),
|
'popup' => egw_link::is_popup($this->app,'view'),
|
||||||
);
|
);
|
||||||
|
@ -328,7 +328,7 @@ final class notifications {
|
|||||||
$this->links = array(); // clear array if set
|
$this->links = array(); // clear array if set
|
||||||
foreach($_links as $link) {
|
foreach($_links as $link) {
|
||||||
if(is_array($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;
|
return true;
|
||||||
@ -355,12 +355,17 @@ final class notifications {
|
|||||||
* @param string $_text a descriptive text for the link
|
* @param string $_text a descriptive text for the link
|
||||||
* @param array $_view all params needed to view the link (name => value pairs)
|
* @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 $_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; }
|
if(!$_view || !$_text) { return false; }
|
||||||
$this->links[] = (object)array( 'text' => $_text,
|
$this->links[] = (object)array(
|
||||||
|
'text' => $_text,
|
||||||
'view' => $_view,
|
'view' => $_view,
|
||||||
'popup' => $_popup,
|
'popup' => $_popup,
|
||||||
|
'app' => $_app,
|
||||||
|
'id' => $_id
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,14 @@ class notifications_popup implements notifications_iface {
|
|||||||
if($link->popup && !$GLOBALS['egw_info']['user']['preferences']['notifications']['external_mailclient'])
|
if($link->popup && !$GLOBALS['egw_info']['user']['preferences']['notifications']['external_mailclient'])
|
||||||
{
|
{
|
||||||
$dimensions = explode('x', $link->popup);
|
$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 {
|
} else {
|
||||||
$rendered_links[] = html::div('<a href="'.$url.'" target="_blank">'.$image.$link->text.'</a>','','link');
|
$rendered_links[] = html::div('<a href="'.$url.'" target="_blank">'.$image.$link->text.'</a>','','link');
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,20 @@
|
|||||||
egwpopup_message.style.maxHeight = (Browserheight/2) + "px";
|
egwpopup_message.style.maxHeight = (Browserheight/2) + "px";
|
||||||
for(var show in notifymessages) break;
|
for(var show in notifymessages) break;
|
||||||
egwpopup_message.innerHTML = notifymessages[show];
|
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;
|
var num = 0;
|
||||||
for(var id in notifymessages) ++num;
|
for(var id in notifymessages) ++num;
|
||||||
if(num-1 > 0 ) {
|
if(num-1 > 0 ) {
|
||||||
@ -154,7 +168,7 @@
|
|||||||
for(var id in notifymessages) {
|
for(var id in notifymessages) {
|
||||||
ids.push(id);
|
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();
|
request.sendRequest();
|
||||||
notifymessages = {};
|
notifymessages = {};
|
||||||
var egwpopup = document.getElementById("egwpopup");
|
var egwpopup = document.getElementById("egwpopup");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user