[Zope-CVS] CVS: Products/CompositePage/manual - manual.js:1.1.2.2
manual_styles.css:1.1.2.3 page.pt:1.1.2.3
Shane Hathaway
shane at zope.com
Wed Feb 25 16:15:04 EST 2004
Update of /cvs-repository/Products/CompositePage/manual
In directory cvs.zope.org:/tmp/cvs-serv5497/manual
Modified Files:
Tag: composite-flat-ui-branch
manual.js manual_styles.css page.pt
Log Message:
Wired the add, remove, copy, cut, and paste functions.
Also added an icon for each element.
=== Products/CompositePage/manual/manual.js 1.1.2.1 => 1.1.2.2 ===
--- Products/CompositePage/manual/manual.js:1.1.2.1 Tue Feb 24 17:34:11 2004
+++ Products/CompositePage/manual/manual.js Wed Feb 25 16:15:03 2004
@@ -10,9 +10,75 @@
// Composite editing scripts (based on PDLib)
+function setUpSlotTarget(node) {
+ pd_setupDropTarget(node, 0);
+}
+
+pd_node_setup['slot_target'] = setUpSlotTarget;
+
function setUpSlotElement(node) {
pd_setupDragUI(node, composite_move, composite_checkmove);
- pd_setupContextMenu(node, 'slot-element-context-menu', null, true);
}
pd_node_setup['slot_element'] = setUpSlotElement;
+
+
+function getSelectedElements() {
+ var f = document.forms.manual_composite_ui;
+ var p, e, i, res=[];
+ for (i = 0; i < f.elements.length; i++) {
+ e = f.elements[i];
+ if (e.name == "source_paths:list" && e.checked) {
+ res[res.length] = e;
+ }
+ }
+ return res;
+}
+
+function manual_edit(element) {
+ var path = escape(element.getAttribute("source_path"));
+ window.top.document.location = ui_url + "/showElement?path=" + path;
+}
+
+function manual_add(target) {
+ // Note that target_index is also available.
+ var path = target.getAttribute("target_path");
+ var index = target.getAttribute("target_index");
+ //window.top.document.location = transformer_url + "/showSlot?path=" + path;
+ var url = ui_url + '/add_element_dialog?target_path=' + escape(path);
+ if (index) {
+ url = url + '&target_index=' + escape(index);
+ }
+ window.open(url, '', 'width=640, height=480, resizable, scrollbars, status');
+}
+
+function manual_delete() {
+ var nodes = getSelectedElements();
+ if (!nodes.length) {
+ window.alert("To remove, select elements then click 'Remove'.");
+ return;
+ }
+ composite_delete(nodes);
+}
+
+function manual_copy() {
+ var nodes = getSelectedElements();
+ if (!nodes.length) {
+ window.alert("To copy, select elements then click 'Copy'.");
+ return;
+ }
+ composite_copycut(nodes, false);
+}
+
+function manual_cut() {
+ var nodes = getSelectedElements();
+ if (!nodes.length) {
+ window.alert("To cut, select elements then click 'Cut'.");
+ return;
+ }
+ composite_copycut(nodes, true);
+}
+
+function manual_paste(target) {
+ composite_paste(target);
+}
=== Products/CompositePage/manual/manual_styles.css 1.1.2.2 => 1.1.2.3 ===
--- Products/CompositePage/manual/manual_styles.css:1.1.2.2 Wed Feb 25 13:46:51 2004
+++ Products/CompositePage/manual/manual_styles.css Wed Feb 25 16:15:03 2004
@@ -26,6 +26,10 @@
margin-left: 1em;
}
+.slot_element input, .slot_element_highlighted input {
+ margin-right: 0.5em;
+}
+
.slot_element a, .slot_element_highlighted a {
font-size: small;
}
=== Products/CompositePage/manual/page.pt 1.1.2.2 => 1.1.2.3 ===
--- Products/CompositePage/manual/page.pt:1.1.2.2 Wed Feb 25 13:46:51 2004
+++ Products/CompositePage/manual/page.pt Wed Feb 25 16:15:03 2004
@@ -1,22 +1,26 @@
<h1 tal:replace="structure here/manage_page_header">Header</h1>
<h1 tal:replace="structure here/manage_tabs">Header</h1>
-
<div tal:define="ui python: here.getUI('manual');
fragments python:ui.getFragments(here)">
+
<div tal:replace="structure fragments/header"></div>
<div tal:replace="structure fragments/top"></div>
-
+<form name="manual_composite_ui">
<table border="0" cellspacing="0" cellpadding="0">
<tbody tal:repeat="slot_info here/getSlotData">
<tr>
<td class="slot_top">
<span tal:content="slot_info/title">Headliner story</span>
- Slot <span tal:content="repeat/slot_info/number">1</span>
- <a href="#">+</a>
- <a href="#">-</a>
- <a href="#">C</a>
- <a href="#">X</a>
- <a href="#">P</a>
+<span target_index="0" tal:attributes="target_path slot_info/target_path">
+ <a href="#" onclick="manual_add(this.parentNode); return false;">+</a>
+ <a href="#" onclick="manual_delete(); return false;">-</a>
+ <a href="#" onclick="manual_copy(); return false;">C</a>
+ <a href="#" onclick="manual_cut(); return false;">X</a>
+ <tal:block tal:condition="request/__cp|nothing">
+ <a href="#" onclick="manual_paste(this.parentNode); return false;">P</a>
+ </tal:block>
+</span>
</td>
</tr>
@@ -24,14 +28,21 @@
<td class="slot_element" tal:attributes="source_path element_info/source_path">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
-<td colspan="2" class="slot_target"
+<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">
+ <input type="checkbox" name="source_paths:list"
+ tal:attributes="value element_info/source_path;
+ source_path element_info/source_path" />
+</td>
<td>
<div>
- <!--input type="checkbox" tal:attributes="name element_info/source_path" /-->
+ <img tal:condition="element_info/icon"
+ tal:attributes="src element_info/icon"
+ width="16" height="16" border="0" />
<b tal:content="element_info/title">Reducing Post-Bypass Readmissions</b>
</div>
<div>
@@ -41,14 +52,14 @@
<a href="#">move down</a>
</div>
</td>
-<td>
+<td valign="top">
<select>
<option value="">Choose a view...<option>
</select>
</td>
</tr>
<tr>
-<td colspan="2" class="slot_target"
+<td colspan="3" class="slot_target"
tal:attributes="target_path slot_info/target_path;
target_index element_info/next_index"></td>
</tr>
@@ -70,11 +81,15 @@
<tr>
<td class="slot_bottom">
- <a href="#">Add</a> |
- <a href="#">Remove</a> |
- <a href="#">Copy</a> |
- <a href="#">Cut</a> |
- <a href="#">Paste</a>
+<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_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>
+ </tal:block>
+</span>
</td>
</tr>
@@ -84,8 +99,8 @@
</tbody>
</table>
-
+</form>
<div tal:replace="structure fragments/bottom"></div>
-</div>
+</div>
<h1 tal:replace="structure here/manage_page_footer">Footer</h1>
More information about the Zope-CVS
mailing list