[Zope-CVS] CVS: Products/CompositePage/common - changeViewForm.pt:1.1 edit.js:1.5

Shane Hathaway shane at zope.com
Sat Dec 27 17:57:15 EST 2003


Update of /cvs-repository/Products/CompositePage/common
In directory cvs.zope.org:/tmp/cvs-serv20150/common

Modified Files:
	edit.js 
Added Files:
	changeViewForm.pt 
Log Message:
Add inline views (with an inline view selector) and tidied here and there.


=== Added File Products/CompositePage/common/changeViewForm.pt ===
<html>
<head>
<title>Change View</title>
</head>
<body>

<div tal:define="info python: here.getViewChangeInfo(request['paths'])">
<form action="changeView" method="POST">
<input type="hidden" name="paths" tal:attributes="value request/paths" />

<div><strong>Change inline view for:</strong></div>
<div style="margin-left: 1em;" tal:repeat="ob info/obs">
  <img tal:define="icon ob/getIcon|ob/icon|nothing" tal:condition="icon"
     tal:attributes="src icon" width="16" height="16" />
  <span tal:replace="ob/title_and_id" />
</div>

<div tal:condition="info/views">
<div><strong>To:</strong></div>
<div tal:repeat="view info/views">
 <input type="radio" name="view" tal:attributes="
   value view; id view; checked python: view == info['current_view']" />
 <label tal:attributes="for view" tal:content="view" />
</div>
</div>

<div tal:condition="not:info/views">
<em tal:condition="python: len(info['obs']) == 1">
No inline views are available for this object.
</em>
<em tal:condition="python: len(info['obs']) > 1">
No inline views are available for all selected objects.
Try selecting only one item at a time.
</em>
</div>

<input tal:condition="info/views" type="submit" name="submit"
  value="Save Changes" />
<button onclick="window.close()">Cancel</button>

</form>
</div>

</body>
</html>


=== Products/CompositePage/common/edit.js 1.4 => 1.5 ===
--- Products/CompositePage/common/edit.js:1.4	Sat Dec 27 13:40:20 2003
+++ Products/CompositePage/common/edit.js	Sat Dec 27 17:56:44 2003
@@ -1,3 +1,12 @@
+// Copyright (c) 2002 Zope Corporation and Contributors.
+// All Rights Reserved.
+//
+// This software is subject to the provisions of the Zope Public License,
+// Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+// FOR A PARTICULAR PURPOSE.
 
 // Composite editing scripts (based on PDLib)
 
@@ -58,6 +67,57 @@
   f.elements.delete_source_paths.value = sources;
   f.submit();
 }
+
+function composite_change_view(elems) {
+  var i, s, url, sources = '';
+  for (i = 0; i < elems.length; i++) {
+    s = elems[i].getAttribute("source_path");
+    if (s) {
+      if (sources)
+        sources = sources + ":" + s;
+      else
+        sources = s;
+    }
+  }
+  var url = transformer_url + "/changeViewForm?paths=" + sources;
+  window.open(url, '', 'width=320, height=400, resizable, scrollbars, status');
+}
+
+function composite_prepare_element_menu(header) {
+  // Prepares the header of the element context menu.
+  var node;
+  if (!pd_selected_item) {
+    icon = null;
+    text = '' + pd_selected_items.length + ' Elements Selected';
+  }
+  else {
+    icon = pd_selected_item.getAttribute('icon');
+    text = pd_selected_item.getAttribute('title');
+  }
+  while (header.childNodes.length)
+    header.removeChild(header.childNodes[0]);
+  if (icon) {
+    node = document.createElement("img");
+    node.setAttribute("src", icon);
+    node.setAttribute("width", "16");
+    node.setAttribute("height", "16");
+    header.appendChild(node);
+  }
+  node = document.createTextNode(text);
+  header.appendChild(node);
+  return true;
+}
+
+function composite_prepare_target_menu(header) {
+  // Prepares the header of the target context menu.
+  while (header.childNodes.length)
+    header.removeChild(header.childNodes[0]);
+  text = pd_selected_item.getAttribute('title') || 'Slot';
+  node = document.createTextNode(text);
+  header.appendChild(node);
+  return true;
+}
+
 
 function setUpSlotTarget(node) {
   pd_setupDropTarget(node, 0);




More information about the Zope-CVS mailing list