forked from extern/egroupware
Fix notifications stalling login
This commit is contained in:
parent
bd8b99f8c1
commit
631587eab1
@ -270,7 +270,7 @@
|
||||
setActiveApp: function(_app)
|
||||
{
|
||||
var result = this._super.apply(this, arguments);
|
||||
this.notifyAppTab(_app.appName , true);
|
||||
this.notifyAppTab(_app.appName , 0);
|
||||
if (_app == _app.parentFw.activeApp)
|
||||
{
|
||||
//Set the sidebox width if a application specific sidebox width is set
|
||||
@ -513,15 +513,15 @@
|
||||
* Notify tab
|
||||
*
|
||||
* @param {string} _appname
|
||||
* @param {boolean} _clear reset notification if set to true
|
||||
* @param {int} _value to set as notification, 0 will reset notification
|
||||
*/
|
||||
notifyAppTab: function(_appname, _clear)
|
||||
notifyAppTab: function(_appname, _value)
|
||||
{
|
||||
var tab = this.tabsUi.getTab(_appname);
|
||||
// do not set tab's notification if it's the active tab
|
||||
if (tab && (this.activeApp.appName != _appname || _clear))
|
||||
if (tab && (this.activeApp.appName != _appname || _value == 0))
|
||||
{
|
||||
this.tabsUi.getTab(_appname).setNotification(_clear);
|
||||
this.tabsUi.getTab(_appname).setNotification(_value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -418,11 +418,12 @@ function egw_fw_ui_tab(_parent, _contHeaderDiv, _contDiv, _icon, _callback,
|
||||
/**
|
||||
* set notification
|
||||
*
|
||||
* @param {boolean} _off if set to true the notification gets reset
|
||||
* @param {int} _value if set to 0 the notification gets reset if nothing set
|
||||
* it will increase the notification value by one
|
||||
*/
|
||||
egw_fw_ui_tab.prototype.setNotification = function(_off)
|
||||
egw_fw_ui_tab.prototype.setNotification = function(_value)
|
||||
{
|
||||
this.notification = _off ? 0 : this.notification+1;
|
||||
this.notification = typeof _value != 'undefined' ? _value : this.notification+1;
|
||||
jQuery(this.notificationDiv).text(this.notification).toggle(this.notification > 0);
|
||||
};
|
||||
|
||||
|
@ -218,16 +218,16 @@
|
||||
for(var index in indexes)
|
||||
{
|
||||
var id = indexes[index];
|
||||
if (this.filter && notifymessages[id]['data']['app'] != this.filter) continue;
|
||||
var $message, $mark, $delete, $inner_container, $nav_prev, $nav_next,
|
||||
$more_info, $top_toolbar, $open_entry, $date, $collapse;
|
||||
var message_id = 'egwpopup_message_'+id;
|
||||
var time_label = this.getTimeLabel(notifymessages[id]['created'], notifymessages[id]['current']);
|
||||
if (jQuery('#'+message_id,$egwpopup_list).length > 0)
|
||||
{
|
||||
this.update_message_status(id, notifymessages[id]['status']);
|
||||
this.update_message_status(id, notifymessages[id]['status'], true);
|
||||
continue;
|
||||
}
|
||||
if (this.filter && notifymessages[id]['data']['app'] != this.filter) continue;
|
||||
// set the time labels on
|
||||
switch (time_label)
|
||||
{
|
||||
@ -352,7 +352,7 @@
|
||||
$egwpopup_list.append($message);
|
||||
// bind click handler after the message container is attached
|
||||
$message.click(jQuery.proxy(this.clickOnMessage, this,[$message]));
|
||||
this.update_message_status(id, notifymessages[id]['status']);
|
||||
this.update_message_status(id, notifymessages[id]['status'], true);
|
||||
if (notifymessages[id]['extra_data']
|
||||
&& !notifymessages[id]['status']
|
||||
&& notifymessages[id]['extra_data']['egw_pr_notify'])
|
||||
@ -543,7 +543,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
notifications.prototype.update_message_status = function (_id, _status)
|
||||
notifications.prototype.update_message_status = function (_id, _status, _noCounterUpdate)
|
||||
{
|
||||
var $egwpopup_message = jQuery('#egwpopup_message_'+_id);
|
||||
notifymessages[_id]['status'] = _status;
|
||||
@ -560,7 +560,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.counterUpdate();
|
||||
if (!_noCounterUpdate) this.counterUpdate();
|
||||
};
|
||||
|
||||
notifications.prototype.delete_all = function () {
|
||||
@ -784,6 +784,7 @@
|
||||
{
|
||||
this.filter = _appname;
|
||||
this.toggle();
|
||||
this.display();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -799,7 +800,7 @@
|
||||
var $egwpopup = jQuery('#egwpopup');
|
||||
var $body = jQuery('body');
|
||||
var $counter = jQuery('#topmenu_info_notifications');
|
||||
this.display();
|
||||
if (!_stat) this.display();
|
||||
var self = this;
|
||||
if (!$egwpopup.is(":visible"))
|
||||
{
|
||||
@ -833,23 +834,30 @@
|
||||
{
|
||||
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);
|
||||
}
|
||||
var apps = {};
|
||||
|
||||
for (var id in notifymessages)
|
||||
{
|
||||
if (typeof apps[notifymessages[id]['extra_data']['app']] == 'undefined')
|
||||
{
|
||||
apps[notifymessages[id]['extra_data']['app']] = 0;
|
||||
}
|
||||
if (notifymessages[id]['status'] != 'SEEN')
|
||||
{
|
||||
counter++;
|
||||
framework.notifyAppTab(notifymessages[id]['extra_data']['app']);
|
||||
if (typeof apps[notifymessages[id]['extra_data']['app']] != 'undefined')
|
||||
{
|
||||
apps[notifymessages[id]['extra_data']['app']] +=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (counter > 0)
|
||||
{
|
||||
for (var app in apps)
|
||||
{
|
||||
framework.notifyAppTab(app, apps[app]);
|
||||
}
|
||||
|
||||
$topmenu_info_notifications.addClass('egwpopup_notify');
|
||||
framework.topmenu_info_notify('notifications', true, counter,egw.lang('You have %1 unread notifications', counter));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user