[Erp5-report] r19915 - in /experimental/bt5/erp5_xhtml_style_experimental: SkinTemplateItem...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 14 16:06:11 CET 2008


Author: bartek
Date: Fri Mar 14 16:06:11 2008
New Revision: 19915

URL: http://svn.erp5.org?rev=19915&view=rev
Log:
JS to drive ParallelListField (working prototype); to be used with  ERP5Form_DynamicParallelListField patch.

Added:
    experimental/bt5/erp5_xhtml_style_experimental/SkinTemplateItem/portal_skins/erp5_xhtml_style_experimental/dynamicGUI.js.xml
Modified:
    experimental/bt5/erp5_xhtml_style_experimental/bt/revision

Added: experimental/bt5/erp5_xhtml_style_experimental/SkinTemplateItem/portal_skins/erp5_xhtml_style_experimental/dynamicGUI.js.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_xhtml_style_experimental/SkinTemplateItem/portal_skins/erp5_xhtml_style_experimental/dynamicGUI.js.xml?rev=19915&view=auto
==============================================================================
--- experimental/bt5/erp5_xhtml_style_experimental/SkinTemplateItem/portal_skins/erp5_xhtml_style_experimental/dynamicGUI.js.xml (added)
+++ experimental/bt5/erp5_xhtml_style_experimental/SkinTemplateItem/portal_skins/erp5_xhtml_style_experimental/dynamicGUI.js.xml Fri Mar 14 16:06:11 2008
@@ -1,0 +1,105 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="DTMLDocument" module="OFS.DTMLDocument"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>__name__</string> </key>
+            <value> <string>dynamicGUI.js</string> </value>
+        </item>
+        <item>
+            <key> <string>_vars</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+        <item>
+            <key> <string>globals</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+        <item>
+            <key> <string>raw</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+function parallel(select){\n
+  /*\n
+  XXX the implementation is plain awful\n
+  will undergo a complete refactoring\n
+  */\n
+  // get current box with neighbours\n
+  var input = select.parentNode;\n
+  var field = input.parentNode;\n
+  var t = input.previousSibling\n
+  var label = t.previousSibling;\n
+  var tt = input.nextSibling;\n
+  var p = tt.nextSibling;\n
+  // get and store field label\n
+  main_label = field.getElementsByTagName(\'label\')[0]\n
+  label_text = main_label.innerHTML;\n
+  // calculate base select name\n
+  base = select.name.match(/(.*?)\\d+/)[1]\n
+  // clone\n
+  var c_input = input.cloneNode(true);\n
+  var c_label = label.cloneNode(true);\n
+  var c_p = p.cloneNode(true);\n
+  var c_t = t.cloneNode(true);\n
+  var c_tt = tt.cloneNode(true);\n
+  // remove all empty boxes\n
+  var box_list = field.getElementsByTagName(\'div\');\n
+  for(var i=box_list.length-1;i>=0;i--){\n
+    var div = box_list[i];\n
+    var sel = div.getElementsByTagName(\'select\')[0]\n
+    var idx = sel.selectedIndex;\n
+    if(idx < 1){\n
+      field.removeChild(div.previousSibling);\n
+      field.removeChild(div.previousSibling);\n
+      field.removeChild(div.nextSibling);\n
+      field.removeChild(div.nextSibling);\n
+      field.removeChild(div);\n
+    }\n
+  }\n
+  // append an empty box\n
+  c_input.getElementsByTagName(\'select\')[0].selectedIndex = -1;\n
+  c_label.innerHTML = \'&nbsp;\';\n
+  field.appendChild(c_label);\n
+  field.appendChild(c_t);\n
+  field.appendChild(c_input);\n
+  field.appendChild(c_tt);\n
+  field.appendChild(c_p);\n
+  // restore field label\n
+  main_label = field.getElementsByTagName(\'label\')[0]\n
+  main_label.innerHTML = label_text;\n
+  // name inputs\n
+  var select_list = field.getElementsByTagName(\'select\');\n
+  for(var i=0;i<box_list.length;i++){\n
+    select_list[i].name = base + i;\n
+  }\n
+}\n
+\n
+// vim:set filetype=javascript shiftwidth=2 expandtab:\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: experimental/bt5/erp5_xhtml_style_experimental/bt/revision
URL: http://svn.erp5.org/experimental/bt5/erp5_xhtml_style_experimental/bt/revision?rev=19915&r1=19914&r2=19915&view=diff
==============================================================================
--- experimental/bt5/erp5_xhtml_style_experimental/bt/revision (original)
+++ experimental/bt5/erp5_xhtml_style_experimental/bt/revision Fri Mar 14 16:06:11 2008
@@ -1,1 +1,1 @@
-6
+7




More information about the Erp5-report mailing list