Author: jmorliaguet
Date: Mon Jan 30 22:28:03 2006
New Revision: 2255

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
Log:

- bug fix: the controller definitions and the model definitions must be 
  registered before the views since the views refer to controllers and models.



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 Mon Jan 30 
22:28:03 2006
@@ -44,8 +44,6 @@
 
   Perspectives: $H({}),
 
-  Cache: $H({}),
-
   CurrentPerspective: "",
   PreviousPerspective: "",
 
@@ -95,33 +93,36 @@
   },
 
   parse: function(node) {
-    var elements = node.getElementsByTagName("ins");
-    $A(elements).each(function(el, index) {
+    $A(["model", "controller", "view"]).each(function(type) {
+
+      var elements = node.getElementsByTagName("ins");
+      $A(elements).each(function(el, index) {
 
-      var classid = el.className;
+        var this_type = el.className;
+        if (this_type != type) return;
 
-      var url = el.getAttribute("cite");
-      if (url) {
-        var options = {
-          onComplete: function(req) {
-            el.innerHTML = req.responseText;
-            CPSSkins.load(el, classid, index);
+        var url = el.getAttribute("cite");
+        if (url) {
+          var options = {
+            onComplete: function(req) {
+              el.innerHTML = req.responseText;
+              CPSSkins.register(el, type, index);
+            }
           }
+          var parts = url.split('?');
+          if (parts.length == 2) {
+            var url = parts[0];
+            options.parameters = parts[1];
+          }
+          new Ajax.Request(url, options);
+        } else {
+          CPSSkins.register(el, type, index);
         }
-        var parts = url.split('?');
-        if (parts.length == 2) {
-          var url = parts[0];
-          options.parameters = parts[1];
-        }
-        new Ajax.Request(url, options);
-      } else {
-        CPSSkins.load(el, classid, index);
-      }
-
+      });
     });
   },
 
-  load: function(el, classid, index) {
+  register: function(el, classid, index) {
 
       // make the element identifiable
       var name = classid + index;
@@ -890,7 +891,7 @@
     return '[CPSSkins Panel:' + this.url + ']';
   },
 
-  // TODO: use a model instead of return data directly
+  // TODO: use a model instead of returning data directly
   getData: function() {
     return this.url;
   },

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
    (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/cpsskins_storage_adapters.pt
    Mon Jan 30 22:28:03 2006
@@ -145,7 +145,7 @@
   <div id="area1">
 
     <ins class="model">
-    {"id": "data-provider",
+    {"id": "local-data-provider",
      "data": {
       "content": ""
      },
@@ -160,7 +160,7 @@
     {"widget": {
       "type": "inputbox"
      },
-     "model": "data-provider",
+     "model": "local-data-provider",
      "controller": "controller"
     }
     </ins>
@@ -198,7 +198,7 @@
   <div id="area2">
 
     <ins class="model">
-    {"id": "data-provider",
+    {"id": "remote-data-provider",
      "data": {
       "content": "Loading data ..."
      },
@@ -216,7 +216,7 @@
     {"widget": {
       "type": "inputbox"
      },
-     "model": "data-provider",
+     "model": "remote-data-provider",
      "controller": "controller"
     }
     </ins>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to