[Zope-CVS] CVS: Packages/Moztop/moztop/content/Menu - ToolBar.js:1.3 ToolBarOverlay.xul:1.5
Stephan Richter
srichter@cbu.edu
Tue, 14 Jan 2003 21:26:42 -0500
Update of /cvs-repository/Packages/Moztop/moztop/content/Menu
In directory cvs.zope.org:/tmp/cvs-serv14021/moztop/content/Menu
Modified Files:
ToolBar.js ToolBarOverlay.xul
Log Message:
Now arbitrary items with arbitrary names can be added.
=== Packages/Moztop/moztop/content/Menu/ToolBar.js 1.2 => 1.3 ===
--- Packages/Moztop/moztop/content/Menu/ToolBar.js:1.2 Tue Jan 14 20:26:38 2003
+++ Packages/Moztop/moztop/content/Menu/ToolBar.js Tue Jan 14 21:26:39 2003
@@ -29,6 +29,7 @@
};
+/* Send the Add request via XML-RPC and handle the result. */
function sendAddRequest(parent, obj_type, obj_name) {
var xmlRpc = getXmlRpc();
xmlRpc.init(ZOPE3_URL + parent);
@@ -39,25 +40,16 @@
xmlRpc.asyncCall(Listener, null, 'createAndAdd', [type, name], 2);
}
-
-/* Add a Folder */
-function addFolder() {
+/* Add a content object to the folder that is selected in the tree. */
+function addContentObject() {
+ var type = document.getElementById("field_obj_type").selectedItem.label;
+ var name = document.getElementById("field_obj_name").value;
var tree = document.getElementById("navigationtree");
- var start = new Object();
- var end = new Object();
- var source = new Object();
- var numRanges = tree.view.selection.getRangeCount();
-
- for (var t=0; t<numRanges; t++){
- tree.view.selection.getRangeAt(t,start,end);
- for (var v = start.value; v <= end.value; v++){
- rdf = tree.view.getItemAtIndex(v).resource;
- var parent = rdf.Value.replace('urn:explorer:data', '') + '/';
- while (parent.indexOf(":") > -1)
- parent = parent.replace(":", "/");
- alert(parent);
- sendAddRequest(parent, 'Folder', 'FooBar');
- }
- }
-
+ index = tree.view.selection.currentIndex;
+ rdf = tree.view.getItemAtIndex(index).resource;
+ var parent = rdf.Value.replace('urn:explorer:data', '') + '/';
+ while (parent.indexOf(":") > -1)
+ parent = parent.replace(":", "/");
+ // alert(parent);
+ sendAddRequest(parent, type, name);
}
=== Packages/Moztop/moztop/content/Menu/ToolBarOverlay.xul 1.4 => 1.5 ===
--- Packages/Moztop/moztop/content/Menu/ToolBarOverlay.xul:1.4 Tue Jan 14 20:26:38 2003
+++ Packages/Moztop/moztop/content/Menu/ToolBarOverlay.xul Tue Jan 14 21:26:39 2003
@@ -16,7 +16,6 @@
<button onclick="return addTask('add', 'Add Item', 'in progress');"
label="Add Task" />
<button onclick="deleteSelectedTask();" label="Delete Task" />
- <button onclick="addFolder(); return false;" label="Add folder" />
<button onclick="reloadContentData();" label="Reload Content" />
<spring flex="100%" />
</toolbar>