mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +01:00
Implement framework tab's notification
This commit is contained in:
parent
cf06054fd7
commit
1815b1e985
@ -270,7 +270,7 @@
|
||||
setActiveApp: function(_app)
|
||||
{
|
||||
var result = this._super.apply(this, arguments);
|
||||
|
||||
this.notifyAppTab(_app.appName , true);
|
||||
if (_app == _app.parentFw.activeApp)
|
||||
{
|
||||
//Set the sidebox width if a application specific sidebox width is set
|
||||
@ -507,6 +507,18 @@
|
||||
app[apps[i]].onLogout.call(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Notify tab
|
||||
*
|
||||
* @param {string} _appname
|
||||
* @param {boolean} _clear reset notification if set to true
|
||||
*/
|
||||
notifyAppTab: function(_appname, _clear)
|
||||
{
|
||||
var tab = this.tabsUi.getTab(_appname);
|
||||
if (tab) this.tabsUi.getTab(_appname).setNotification(_clear);
|
||||
}
|
||||
});
|
||||
})(window);
|
||||
|
@ -307,6 +307,7 @@ function egw_fw_ui_tab(_parent, _contHeaderDiv, _contDiv, _icon, _callback,
|
||||
this.closeCallback = _closeCallback;
|
||||
this.position = _pos;
|
||||
this.status = _status;
|
||||
this.notification = 0;
|
||||
|
||||
//Create the header div and set its "click" function and "hover" event
|
||||
this.headerDiv = document.createElement("span");
|
||||
@ -404,6 +405,18 @@ function egw_fw_ui_tab(_parent, _contHeaderDiv, _contDiv, _icon, _callback,
|
||||
jQuery(this.contDiv).append(this.contentDiv);
|
||||
}
|
||||
|
||||
/**
|
||||
* set notification
|
||||
*
|
||||
* @param {boolean} _off if set to true the notification gets reset
|
||||
*/
|
||||
egw_fw_ui_tab.prototype.setNotification = function(_off)
|
||||
{
|
||||
this.notification = _off ? 0 : this.notification+1;
|
||||
this.setTitle(this.notification > 0 ?
|
||||
this.tag.displayName+ " (" + this.notification + ")" : this.tag.displayName);
|
||||
};
|
||||
|
||||
/**
|
||||
* setTitle sets the title of this tab. An existing title will be removed.
|
||||
*
|
||||
@ -738,6 +751,24 @@ egw_fw_ui_tabs.prototype._isNotTheLastTab = function()
|
||||
return n > 1 ? true : false;
|
||||
};
|
||||
|
||||
/**
|
||||
* get tab object for given appname
|
||||
*
|
||||
* @param {string} _appname
|
||||
* @returns {object|boolean} returns tab object, returns false if no tab found
|
||||
*/
|
||||
egw_fw_ui_tabs.prototype.getTab = function(_appname)
|
||||
{
|
||||
for (var i = 0; i < this.tabs.length; i++)
|
||||
{
|
||||
if (this.tabs[i] && this.tabs[i]['tag']['appName'] == _appname)
|
||||
{
|
||||
return this.tabs[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class: egw_fw_ui_category
|
||||
* A class which manages and renderes a simple menu with categories, which can be opened and shown
|
||||
|
@ -812,9 +812,24 @@
|
||||
{
|
||||
var $topmenu_info_notifications = jQuery('#topmenu_info_notifications');
|
||||
var counter = 0;
|
||||
|
||||
for(var j in notifymessages)
|
||||
{
|
||||
//reset all tab notifications
|
||||
framework.notifyAppTab(notifymessages[j]['extra_data']['app'], true);
|
||||
}
|
||||
|
||||
for (var id in notifymessages)
|
||||
{
|
||||
if (notifymessages[id]['status'] != 'SEEN') counter++;
|
||||
if (notifymessages[id]['status'] != 'SEEN')
|
||||
{
|
||||
counter++;
|
||||
// do not set tab's notification if it's the active tab
|
||||
if (framework.activeApp.appName != notifymessages[id]['extra_data']['app'])
|
||||
{
|
||||
framework.notifyAppTab(notifymessages[id]['extra_data']['app']);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (counter > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user