[Zope-CVS] CVS: Products/CompositePage/manual - manual.js:1.1.2.3 page.pt:1.1.2.4

Shane Hathaway shane at zope.com
Thu Feb 26 11:28:48 EST 2004


Update of /cvs-repository/Products/CompositePage/manual
In directory cvs.zope.org:/tmp/cvs-serv10961/manual

Modified Files:
      Tag: composite-flat-ui-branch
	manual.js page.pt 
Log Message:
Edit, preview, move up, and move down are now functional.


=== Products/CompositePage/manual/manual.js 1.1.2.2 => 1.1.2.3 ===
--- Products/CompositePage/manual/manual.js:1.1.2.2	Wed Feb 25 16:15:03 2004
+++ Products/CompositePage/manual/manual.js	Thu Feb 26 11:28:47 2004
@@ -35,13 +35,44 @@
   return res;
 }
 
+function findSourceNode(node) {
+  while (node) {
+    if (node.getAttribute("source_path"))
+      return node;
+    node = node.parentNode;
+  }
+}
+
+function findTargetNode(node) {
+  while (node) {
+    if (node.getAttribute("target_path"))
+      return node;
+    node = node.parentNode;
+  }
+}
+
 function manual_edit(element) {
+  element = findSourceNode(element);
   var path = escape(element.getAttribute("source_path"));
   window.top.document.location = ui_url + "/showElement?path=" + path;
 }
 
+function manual_preview(element) {
+  element = findSourceNode(element);
+  var path = escape(element.getAttribute("source_path"));
+  var url = ui_url + "/previewElement?path=" + path;
+  window.open(url, '', 'width=640, height=480, resizable, scrollbars, status');
+}
+
+function manual_move(element) {
+  var s = findSourceNode(element);
+  var t = findTargetNode(element);
+  composite_move([s], t);
+}
+
 function manual_add(target) {
   // Note that target_index is also available.
+  target = findTargetNode(target);
   var path = target.getAttribute("target_path");
   var index = target.getAttribute("target_index");
   //window.top.document.location = transformer_url + "/showSlot?path=" + path;
@@ -80,5 +111,6 @@
 }
 
 function manual_paste(target) {
+  target = findTargetNode(target);
   composite_paste(target);
 }


=== Products/CompositePage/manual/page.pt 1.1.2.3 => 1.1.2.4 ===
--- Products/CompositePage/manual/page.pt:1.1.2.3	Wed Feb 25 16:15:03 2004
+++ Products/CompositePage/manual/page.pt	Thu Feb 26 11:28:47 2004
@@ -26,19 +26,19 @@
 
 <tr tal:repeat="element_info slot_info/elements">
 <td class="slot_element" tal:attributes="source_path element_info/source_path">
-<table border="0" cellspacing="0" cellpadding="0">
+<table border="0" cellspacing="0" cellpadding="0" width="100%">
 <tr>
 <td colspan="3" class="slot_target"
   tal:attributes="target_path slot_info/target_path;
   target_index element_info/index"></td>
 </tr>
 <tr>
-<td valign="top">
+<td valign="top" width="0%">
   <input type="checkbox" name="source_paths:list"
      tal:attributes="value element_info/source_path;
      source_path element_info/source_path" />
 </td>
-<td>
+<td width="100%">
 <div>
   <img tal:condition="element_info/icon"
      tal:attributes="src element_info/icon"
@@ -46,13 +46,23 @@
   <b tal:content="element_info/title">Reducing Post-Bypass Readmissions</b>
 </div>
 <div>
-  <a href="#">edit</a> |
-  <a href="#">preview</a> |
-  <a href="#">move up</a> |
-  <a href="#">move down</a>
+<span tal:attributes="source_path element_info/source_path">
+  <a href="#" onclick="manual_edit(this); return false;">edit</a> |
+  <a href="#" onclick="manual_preview(this); return false;">preview</a>
+  <span tal:condition="element_info/can_move_up"> |
+  <a href="#" onclick="manual_move(this); return false;"
+    tal:attributes="target_path slot_info/target_path;
+      target_index python: element_info['index'] - 1">move up</a>
+  </span>
+  <span tal:condition="element_info/can_move_down"> |
+  <a href="#" onclick="manual_move(this); return false;"
+    tal:attributes="target_path slot_info/target_path;
+      target_index python: element_info['index'] + 2">move down</a>
+  </span>
+</span>
 </div>
 </td>
-<td valign="top">
+<td valign="top" align="right">
 <select>
 <option value="">Choose a view...<option>
 </select>
@@ -82,12 +92,12 @@
 <tr>
 <td class="slot_bottom">
 <span target_index="0" tal:attributes="target_path slot_info/target_path">
-  <a href="#" onclick="manual_add(this.parentNode); return false;">Add</a> |
+  <a href="#" onclick="manual_add(this); return false;">Add</a> |
   <a href="#" onclick="manual_delete(); return false;">Remove</a> |
   <a href="#" onclick="manual_copy(); return false;">Copy</a> |
   <a href="#" onclick="manual_cut(); return false;">Cut</a>
   <tal:block tal:condition="request/__cp|nothing"> |
-  <a href="#" onclick="manual_paste(this.parentNode); return false;">Paste</a>
+  <a href="#" onclick="manual_paste(this); return false;">Paste</a>
   </tal:block>
 </span>
 </td>




More information about the Zope-CVS mailing list