[Zope-CVS] CVS: Packages/Moztop/moztop/content/Explorer - Explorer.js:1.13

Stephan Richter srichter@cbu.edu
Sat, 15 Mar 2003 19:08:14 -0500


Update of /cvs-repository/Packages/Moztop/moztop/content/Explorer
In directory cvs.zope.org:/tmp/cvs-serv3036/moztop/content/Explorer

Modified Files:
	Explorer.js 
Log Message:
Yeah, fixed the "Open Selected Resource" function. The getSelectedResource
method only checked the this.ds datasource and not the this.sitedatasources
for the node, so it would not find any of the content objects. 

Now that this is fixed, you can open both sites and folders. 

I also added some documentation where I touch the code. Added SitesManager
API methods list to Explorer doc string.

To do: 

- Move SitesManager out of Explorer.js into SitesManager.js

- Implement retrieval of resource types (RDF) from server.

- Implement other content object views.

- Implement add and delete resource.


=== Packages/Moztop/moztop/content/Explorer/Explorer.js 1.12 => 1.13 === (938/1038 lines abridged)
--- Packages/Moztop/moztop/content/Explorer/Explorer.js:1.12	Sat Mar 15 17:24:45 2003
+++ Packages/Moztop/moztop/content/Explorer/Explorer.js	Sat Mar 15 19:08:13 2003
@@ -1,497 +1,538 @@
-/*****************************************************************************
-*
-* Copyright (c) 2002, 2003 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.
-*
-******************************************************************************
-Explorer library; here to manage Content Object Tree.
-
-
-SitesManager API Methods:
-
-  * getSelectedResource - Get the in the tree selected resource. 
-
-  * openSelectedResource - Open resource views.
-
-$Id$
-
-******************************************************************************/
-
-/* Some regular expressions to fix the case-sensitivity of Moz RDF */
-var fixer1 = /rdf:rdf/g;
-var fixer2 = /rdf:description/g;
-var fixer3 = /rdf:seq/g;
-
-function SitesManager () {
-    /* A prototype to manage the sites database and datasources */
-
-    // Initialization
-    if( !(this instanceof SitesManager) ) 
-	return new SitesManager( );
-    DataSourceManager.call(this);
-    
-    // Grab appropriate Content Tree RDF datasource
-    this.ds = new RDFDataSource(this.profileurl + "/moztop.rdf",null);
-    
-    // Define Content Type RDF datasource
-    this.commontypesds = new RDFDataSource();
-    this.commontypesds.parseFromString(commontypes_data,
-				       "http://www.zope.org/rdf");
-

[-=- -=- -=- 938 lines omitted -=- -=- -=-]

+
+    alert('Called cutContentObject for ' + obj_name + ' on ' + path +'.');
+}
+
+function copyContentObject() {
+    var obj_name = getObjectName();
+    var parent = getContainerPath();
+
+    var xmlRpc = getXmlRpc();
+    xmlRpc.init(XMLRPC_BASE + parent);
+    var name = xmlRpc.createType(xmlRpc.STRING, {});
+    name.data = obj_name;
+    xmlRpc.asyncCall(Listener, null, 'copyObject', [name], 1);
+
+}
+
+function pasteContentObject() {
+    var path = getContainerPath();
+
+    alert('Called pasteContentObject on ' + path +'.');
+}
+
+/* Utility functions */
+function getPath() {
+    var tree = document.getElementById("navigationtree");
+    var index = tree.view.selection.currentIndex;
+    var rdf = tree.view.getItemAtIndex(index).resource;
+    var path = rdf.Value.replace('urn:explorer:data', '');
+    while (path.indexOf(":") > -1)
+	path = path.replace(":", "/");
+
+    return path
+}
+
+function getContainerPath() {
+    var path = getPath()
+    var obj_name = getObjectName()
+    var container = path.substring(0, path.length-obj_name.length);
+
+    return container
+}
+
+function getObjectName() {
+  var path = getPath();
+    var parts = path.split('/');
+    var obj_name = parts[parts.length-1];
+    
+    return obj_name
+}
+