details:   /erp/devel/pi/rev/1112abfc0af2
changeset: 10895:1112abfc0af2
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Mon Feb 28 09:36:44 2011 +0100
summary:   Fixes issue 16010: Alerts link in Navigation Bar is not displayed 
after login

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-alert-manager.js
 |  16 ++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diffs (43 lines):

diff -r 1f1a47ca9207 -r 1112abfc0af2 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-alert-manager.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-alert-manager.js
      Mon Feb 28 08:51:19 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-alert-manager.js
      Mon Feb 28 09:36:44 2011 +0100
@@ -46,6 +46,11 @@
     listeners : [],
 
     delay : 50000,
+    
+    // last info
+    lastResponse: null,
+    lastData: null,
+    lastRequest: null,
 
     // ** {{{ AlertManager.addListener(listener) }}} **
     //
@@ -58,9 +63,17 @@
     // received.
     addListener : function(/* function */listener) {
       this.listeners[this.listeners.length] = listener;
+      if (this.lastResponse) {
+        // call the listener once with the last data
+        listener(this.lastResponse, this.lastData, this.lastRequest, true);
+      }
     },
 
     _notify : function(rpcResponse, data, rpcRequest) {
+      // store info for new listeners
+      OB.AlertManager.lastResponse = rpcResponse;
+      OB.AlertManager.lastData = data;
+      OB.AlertManager.lastRequest = rpcRequest;
       for ( var i = 0; i < OB.AlertManager.listeners.length; i++) {
         OB.AlertManager.listeners[i](rpcResponse, data, rpcRequest);
       }
@@ -110,6 +123,9 @@
 
         this.Super('initWidget', arguments);
 
+        OB.I18N.getLabel(instance.alertLabel,
+            [ '-' ], instance, 'setTitle');
+
         // call it to update the number of alerts directly after login
         OB.AlertManager.addListener(listener);
         
OB.TestRegistry.register('org.openbravo.client.application.AlertButton', this);

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to