[Zope-CVS] CVS: Products/CompositePage/common - bottom.pt:1.3
edit.js:1.6
Shane Hathaway
shane at zope.com
Sat Dec 27 23:33:19 EST 2003
Update of /cvs-repository/Products/CompositePage/common
In directory cvs.zope.org:/tmp/cvs-serv16763/common
Modified Files:
bottom.pt edit.js
Log Message:
Implemented the clipboard using Zope's __cp cookie.
XXX need unit tests.
=== Products/CompositePage/common/bottom.pt 1.2 => 1.3 ===
--- Products/CompositePage/common/bottom.pt:1.2 Mon Dec 22 15:21:14 2003
+++ Products/CompositePage/common/bottom.pt Sat Dec 27 23:32:48 2003
@@ -14,6 +14,15 @@
<input type="hidden" name="delete_source_paths" value="" />
</form>
+<form action="useClipboard" name="useClipboard" method="POST"
+ tal:attributes="action
+ string:${options/tool/absolute_url}/useClipboard">
+<input type="hidden" name="func" value="" />
+<input type="hidden" name="source_paths" value="" />
+<input type="hidden" name="target_path" value="" />
+<input type="hidden" name="target_index" value="" />
+</form>
+
<script type="text/javascript"><!--
pd_setupPage();
// --></script>
=== Products/CompositePage/common/edit.js 1.5 => 1.6 ===
--- Products/CompositePage/common/edit.js:1.5 Sat Dec 27 17:56:44 2003
+++ Products/CompositePage/common/edit.js Sat Dec 27 23:32:48 2003
@@ -10,15 +10,8 @@
// Composite editing scripts (based on PDLib)
-function composite_move(selected_items, target_node) {
- var f, i, path, sources, s;
- f = document.forms.modify_composites;
- i = target_node.getAttribute("target_index");
- path = target_node.getAttribute("target_path");
- f.elements.move_target_index.value = i;
- f.elements.move_target_path.value = path;
-
- sources = "";
+function composite_getsources(selected_items) {
+ var i, s, sources = "";
for (i = 0; i < selected_items.length; i++) {
s = selected_items[i].getAttribute("source_path");
if (s) {
@@ -28,6 +21,17 @@
sources = s;
}
}
+ return sources;
+}
+
+function composite_move(selected_items, target_node) {
+ var f, i, path, sources;
+ f = document.forms.modify_composites;
+ i = target_node.getAttribute("target_index");
+ path = target_node.getAttribute("target_path");
+ f.elements.move_target_index.value = i;
+ f.elements.move_target_path.value = path;
+ sources = composite_getsources(selected_items);
f.elements.move_source_paths.value = sources;
f.submit();
}
@@ -50,37 +54,43 @@
}
function composite_delete(selected_items) {
- var f, i, s, sources;
+ var f, sources;
if (!selected_items)
return;
f = document.forms.modify_composites;
- sources = "";
- for (i = 0; i < selected_items.length; i++) {
- s = selected_items[i].getAttribute("source_path");
- if (s) {
- if (sources)
- sources = sources + ":" + s;
- else
- sources = s;
- }
- }
+ sources = composite_getsources(selected_items);
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;
+ var url, sources;
+ sources = composite_getsources(elems);
+ url = transformer_url + "/changeViewForm?paths=" + sources;
window.open(url, '', 'width=320, height=400, resizable, scrollbars, status');
+}
+
+function composite_copycut(selected_items, cut) {
+ var f, sources;
+ f = document.forms.useClipboard;
+ sources = composite_getsources(selected_items);
+ if (cut)
+ f.elements.func.value = "cut";
+ else
+ f.elements.func.value = "copy";
+ f.elements.source_paths.value = sources;
+ f.submit();
+}
+
+function composite_paste(target_node) {
+ var f, path, i;
+ path = target_node.getAttribute("target_path");
+ i = target_node.getAttribute("target_index");
+ f = document.forms.useClipboard;
+ f.elements.func.value = "paste";
+ f.elements.target_path.value = path;
+ f.elements.target_index.value = i;
+ f.submit();
}
function composite_prepare_element_menu(header) {
More information about the Zope-CVS
mailing list