Author: jmorliaguet
Date: Sun Jan 15 18:49:30 2006
New Revision: 2219

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

- simpler code



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 Sun Jan 15 
18:49:30 2006
@@ -315,42 +315,38 @@
        return CPSSkins.Cache[node_id].data;
     }
 
-    var node_data = null;
+    var node_info = null;
     var model_node = this._getModelNode(node);
     if (model_node) {
-      node_data = CPSSkins.jsonParse(model_node);
+      node_info = CPSSkins.jsonParse(model_node);
     }
 
-    if (node_id && node_data) {
-      CPSSkins.Cache[node_id] = node_data;
+    if (node_id && node_info) {
+      CPSSkins.Cache[node_id] = node_info;
     }
-    if (node_data) { return node_data.data; }
+    if (node_info) { return node_info.data; }
   },
 
   setNodeData: function(node, data) {
     node = $(node);
     var node_id = Identifiable.isIdentifiable(node) ? 
                   node.getAttribute("id") : null;
-    var node_data = null;
+
+    var node_info = {};
     var model_node = this._getModelNode(node);
 
     if (model_node) {
-      node_data = CPSSkins.jsonParse(model_node);
+      node_info = CPSSkins.jsonParse(model_node);
     } else {
-      node_data = {};
+      model_node = document.createElement("ins")
+      node.parentNode.insertBefore(model_node, node);
     }
-    node_data.data = data;
+    node_info.data = data;
 
     if (node_id) {
-      CPSSkins.Cache[node_id] = node_data;
+      CPSSkins.Cache[node_id] = node_info;
     } else {
-      var str = JSON.stringify(node_data);
-      var ins_node = model_node;
-      if (!ins_node) {
-        ins_node = document.createElement("ins")
-        node.parentNode.insertBefore(ins_node, node);
-      }
-      ins_node.innerHTML = str;
+      model_node.innerHTML = JSON.stringify(node_info);
     }
 
     // Update the views and controllers that are registered as observers
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to