Author: jmorliaguet
Date: Tue Mar 21 13:31:07 2006
New Revision: 2676

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
Log:

- each view controlled by a same "Remote Scripting" controller are refreshed
  when the remote script has been executed.

  (only visible views are actually refreshed)



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Tue Mar 21 
13:31:07 2006
@@ -605,10 +605,11 @@
     if (target.tagName.toLowerCase() == 'a') {
 
       var _request = this._request;
-      this.views.entries().each(function(v) {
+      var views = this.views;
+      views.entries().each(function(v) {
         var view = CPSSkins.getViewById(v);
         if (target.childOf(view.widget)) {
-          _request(view, target.href);
+          _request(views, view, target.href);
         }
       });
 
@@ -616,7 +617,7 @@
     }
   },
 
-  _request: function(view, url) {
+  _request: function(views, view, url) {
     var options = {
       onComplete: function(req) {
         var disp = req.getResponseHeader('content-disposition');
@@ -628,7 +629,9 @@
           var data = JSON.parse(req.responseText);
           view.model.writeData(data);
         }
-        view.refresh();
+        views.entries().each(function(v) {
+          CPSSkins.getViewById(v).refresh();
+        });
       }
     };
     var parts = url.split('?');
@@ -1760,6 +1763,7 @@
   },
 
   refresh: function() {
+    if (!this._visible) return;
     var data = this.readData();
     if (data) {
       this.display(data);
@@ -1767,6 +1771,7 @@
   },
 
   reload: function() {
+    if (!this._visible) return;
     var data = this.getData();
     if (data) {
       this.display(data);
@@ -1788,6 +1793,8 @@
     CPSSkins.notify("gained focus", {'publisher': this,
                                      'context': this.selected});
 
+    this._visible = true;
+
     // refresh the view
     this.refresh();
 
@@ -1799,7 +1806,6 @@
     } else {
       widget.show();
     }
-    this._visible = true;
   },
 
   hide: function() {
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to