Moved jsclient to a toplevel project to give it its own release cycle
git-svn-id: https://svn.apache.org/repos/asf/incubator/chemistry/trunk@980485 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/jsclient/README.txt b/jsclient/README.txt
deleted file mode 100644
index c22e566..0000000
--- a/jsclient/README.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-Contains the JavaScript Client, Tests and Examples.
-
-The JavaScript Client library is designed to run from the same server (URL) as
-your CMIS Server. Depending on the implementation the cmisclient.js (and the additional
-html files) can be dropped into the repository and accessed with a browser.
-
-To get started just drop all the files in the webroot in your repository and access
-the index.html.
\ No newline at end of file
diff --git a/jsclient/webroot/bg-body.png b/jsclient/webroot/bg-body.png
deleted file mode 100644
index ef4fc74..0000000
--- a/jsclient/webroot/bg-body.png
+++ /dev/null
Binary files differ
diff --git a/jsclient/webroot/bg-twocols.png b/jsclient/webroot/bg-twocols.png
deleted file mode 100644
index 7575e06..0000000
--- a/jsclient/webroot/bg-twocols.png
+++ /dev/null
Binary files differ
diff --git a/jsclient/webroot/cmisclient.js b/jsclient/webroot/cmisclient.js
deleted file mode 100644
index 176bfdd..0000000
--- a/jsclient/webroot/cmisclient.js
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * The CMIS javascript client gives access to a CMIS document management system
- * from client-side java script code.
- *
- */
-CMISClient = function (url) {
- this.CMIS_SERVICE_URL=url;
- this.info = this.getRepositoryInfo();
- this.connected = this.info?true:false;
-}
-
-CMISClient.NAME_OF_THIS_FILE = "cmisclient.js";
-
-/** trim helper */
-CMISClient.trim = function(s) {
- return s.replace(/^\s*/, "").replace(/\s*$/, "");
-}
-
-/** implements transformation from an xml document to a reasonable js object
-essentially poor mans jquery
-*/
-CMISClient.flatten = function(elem, obj) {
- if (!obj) obj=new Object();
- var i=0;
- while (i<elem.childNodes.length) {
- /* iterate through all the child nodes of the atom structure */
- var child=elem.childNodes[i];
- var value="";
-
- switch (child.nodeType) {
- /* found an element */
- case Node.ELEMENT_NODE:
- if (child.attributes.length==0 && child.childNodes.length==1 && child.childNodes[0].nodeType==Node.TEXT_NODE && child.childNodes[0].nodeValue) {
- /* fold simple cdata into a property */
- obj[child.nodeName]=this.trim(child.childNodes[0].nodeValue);
- } else {
- if (!obj[child.nodeName]) {
- /* proper substructure without same name sibling */
- obj[child.nodeName]=new Object();
- this.flatten(child, obj[child.nodeName]);
- } else {
- /* ugly same name sibling handling needs fixing */
- var j=1;
- while (obj[child.nodeName+"_"+j]) {
- j++;
- }
- obj[child.nodeName+"_"+j]=new Object();
- CMISClient.flatten(child, obj[child.nodeName+"_"+j]);
- }
- }
- break;
-
- case Node.TEXT_NODE:
- /* cdata in unexpected place */
- var val=CMISClient.trim(child.nodeValue);
- if (val) {
- obj["text"]=CMISClient.trim(child.nodeValue);
- }
-
- break;
- }
- i++;
- }
- var i=0;
- if (elem.attributes) {
- while (i<elem.attributes.length) {
- /* place attribute values with their names */
- var child=elem.attributes[i];
- obj[child.nodeName]=child.nodeValue;
- i++;
- }
- }
- return (obj);
-}
-
-/** Processes an Atom entry into a usable js object */
-CMISClient.processEntry = function(node) {
- var entry=new Object();
- for (var a in node) {
- var elem=node[a];
- if (a.indexOf("link")==0) {
- entry[elem.rel]=elem.href;
- } else if (a=="cmis:object") {
- var props=elem["cmis:properties"];
- for (var b in props) {
- var prop=props[b];
- entry[prop["cmis:name"]]=prop["cmis:value"];
- }
- } else {
- entry[a]=elem;
- }
- }
-
- entry.author=node.author.name;
- entry.content=node.content;
- entry.id=node.id;
- return (entry);
-}
-
-/** Gets a folder from via atom url */
-CMISClient.prototype.getFolder = function(url) {
-
- if (url=="/" || !url) {
- url=this.info.collections["rootchildren"];
- }
- var htcon=this.httpGet(url);
- this.lastHttpStatus = htcon.status;
- if (htcon.status != 200) {
- return null;
- }
-
- var doc=htcon.responseXML;
- var flatres=CMISClient.flatten(doc);
-
- var feed=flatres.feed;
-
- var res=new Object();
- res.author=feed.author.name;
- res.id=feed.id;
- res.title=feed.title;
- res.updated=feed.updated;
-
- res.links=new Object();
- res.entries=new Object();
-
- var linkcount=0;
- var entrycount=0;
-
- for (var a in feed) {
- var node=feed[a];
- if (a.indexOf("entry")==0) {
- res.entries[entrycount++]=CMISClient.processEntry(node);
- }
- if (a.indexOf("link")==0) {
-
- }
- }
-
- return(res);
-}
-
-/** This method reads the repository Info */
-CMISClient.prototype.getRepositoryInfo = function() {
- var htcon=this.httpGet(this.CMIS_SERVICE_URL);
- this.lastHttpStatus = htcon.status;
-
- /* could not connect */
- if (htcon.status != 200) {
- return null;
- }
-
- var doc=htcon.responseXML;
- var flatres=CMISClient.flatten(doc);
- var res=new Object();
-
- var repoinfo=flatres.service.workspace["cmis:repositoryInfo"];
-
- res.repositoryId = repoinfo["cmis:repositoryId"];
- res.repositoryName = repoinfo["cmis:repositoryName"];
- res.repositoryRelationship = repoinfo["cmis:repositoryRelationship"];
- res.repositoryDescription = repoinfo["cmis:repositoryDescription"];
- res.vendorName = repoinfo["cmis:vendorName"];
- res.productName = repoinfo["cmis:productName"];
- res.productVersion = repoinfo["cmis:productVersion"];
- res.rootFolderId= repoinfo["cmis:rootFolderId"];
-
- var caps=repoinfo["cmis:capabilities"];
- res.capabilities = new Object();
- res.capabilities.multifiling = caps["cmis:capabilityMultifiling"];
- res.capabilities.unfiling = caps["cmis:capabilityUnfiling"];
-
- res.cmisVersionsSupported = repoinfo["cmis:cmisVersionsSupported"];
-
- res.collections = new Object();
-
- for (var a in flatres.service.workspace) {
- if (a.indexOf("collection")==0) {
- var collection=flatres.service.workspace[a];
- res.collections[collection["cmis:collectionType"]]=collection.href;
- }
- }
- return (res);
-}
-
-/**
- * Get an XMLHttpRequest in a portable way.
- */
-CMISClient.prototype.getXHR = function () {
- var xhr=null;
-
- if(!xhr) {
- try {
- // built-in (firefox, recent Opera versions, etc)
- xhr=new XMLHttpRequest();
- } catch (e) {
- // ignore
- }
- }
-
- if(!xhr) {
- try {
- // IE, newer versions
- xhr=new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- // ignore
- }
- }
-
- if(!xhr) {
- try {
- // IE, older versions
- xhr=new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {
- // ignore
- }
- }
-
- if(!xhr) {
- alert("Unable to access XMLHttpRequest object, cmis client will not work!");
- }
-
- return xhr;
-}
-
-/**
- * HTTP GET XHR Helper.
- * @param {String} url The URL
- * @return the XHR object, use .responseText for the data
- * @type String
- */
-CMISClient.prototype.httpGet = function(url) {
- var httpcon = this.getXHR();
- if (httpcon) {
- httpcon.open('GET', url, false);
- httpcon.send(null);
- return httpcon;
- } else {
- return null;
- }
-}
-
-/**
- * Produces a "sort-of-json" string representation of a object.
- * For debugging purposes only.
- * @param {Object} obj The object
- * @param {int} level The indentation level
- * @return The result
- * @type String
- */
-CMISClient.dumpObj = function(obj, level) {
- var res="";
- for (var a in obj) {
- if (typeof(obj[a])!="object") {
- res+=a+":"+obj[a]+" ";
- } else {
- res+=a+": { ";
- res+=this.dumpObj(obj[a])+"} ";
- }
- }
- return (res);
-}
diff --git a/jsclient/webroot/footer.js b/jsclient/webroot/footer.js
deleted file mode 100644
index f4585e9..0000000
--- a/jsclient/webroot/footer.js
+++ /dev/null
@@ -1,2 +0,0 @@
-document.write('<div class="footer"><a href="http://www.apache.org/licenses/">License</a> | Powered by <a href="http://jackrabbit.apache.org/">Apache Jackrabbit</a></div>');
-
diff --git a/jsclient/webroot/header.js b/jsclient/webroot/header.js
deleted file mode 100644
index a73275b..0000000
--- a/jsclient/webroot/header.js
+++ /dev/null
@@ -1 +0,0 @@
-document.write('<div class="header"><div class="logo"><a href="http://jackrabbit.apache.org/" align="right"><img src="logo.png" align="right"></a></div><a href="index.html">CMIS v0.61+ JavaScript Client</a><br>Content Management Interoperability Services (CMIS) draft implementation</div>');
diff --git a/jsclient/webroot/index.html b/jsclient/webroot/index.html
deleted file mode 100644
index 7a07ce0..0000000
--- a/jsclient/webroot/index.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<html>
-<head>
-<title>CMIS JavaScript Client / Example</title>
-<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>
-<link rel="stylesheet" type="text/css" href="main.css"></link>
-</head>
-
-<body>
- <!-- poor mans client side include for header layout -->
- <script src="header.js"></script>
-
- <!-- cmis client include -->
- <script src="cmisclient.js"></script>
-
-<script>
-function traverse (cmisclient, folder) {
- var tree=document.getElementById("tree");
- for (var a in folder.entries) {
- var entry=folder.entries[a];
- var newdiv = document.createElement("div");
- newdiv.innerHTML = entry.title.text + (entry["children"]?(":" + entry["children"]):"");
- tree.appendChild(newdiv);
- if (entry.children) {
- var childfolder=cmisclient.getFolder(entry["children"]);
- traverse(cmisclient, childfolder);
- }
- }
-}
-
-function start() {
- /* get url from form */
- var cmisurl=document.getElementById("url").value;
-
- /* instantiate cmisclient */
- var cmisclient= new CMISClient(cmisurl);
-
- if (cmisclient.connected) {
- /* get root folder */
- var rootfolder=cmisclient.getFolder("/");
-
- /* start traversal */
- traverse(cmisclient, rootfolder);
- } else {
- alert ("Could not connect to the repository at: "+cmisurl+" ("+ cmisclient.lastHttpStatus +")");
- }
-}
-</script>
-<style>
-</style>
- <div class="content">
- <h1>CMIS JavaScript Client Traversal Example</h1>
- <h2>Setup Instructions</h2>
- <p>To make this work the CMISClient.js needs to be located / accessible on the same server
- as the CMIS service document due to XSS limitations of the browser.
- </p>
- <form method="GET" action="getRepositoryInfo.xml" target="result">
- <table class="formtable">
- <tr>
- <td>Service document / Connection URL</td>
- <td><input class="text" type="text" value="/chemistry/repository" name="url" id="url"></td>
- </tr><tr><td> </td><td>
- <input type="button" value="Start Traversal" onClick="start()"><br></td></tr></table>
- </form>
- <div id="tree">
-
- </div>
- <!-- poor mans client side include for footer layout -->
- <script src="footer.js"></script>
- </div>
-</body>
-</html>
diff --git a/jsclient/webroot/logo.png b/jsclient/webroot/logo.png
deleted file mode 100644
index 9bb1fdc..0000000
--- a/jsclient/webroot/logo.png
+++ /dev/null
Binary files differ
diff --git a/jsclient/webroot/main.css b/jsclient/webroot/main.css
deleted file mode 100644
index 18c9381..0000000
--- a/jsclient/webroot/main.css
+++ /dev/null
@@ -1,151 +0,0 @@
-body {
- background: #eee url(bg-body.png) top center repeat-y;
- color: #333;
- font-family: Georgia, Times New Roman, serif;
- margin: 0 auto 0;
- padding: 0;
-}
-
-.logo {
- float: right;
-}
-
-.twocols {
- background: #eee url(bg-twocols.png) top center repeat-y;
-}
-
-a, a:visited {
- color: #58a;
- text-decoration: none;
-}
-
-a:hover {
- background-color: #ffc;
- text-decoration: underline;
-}
-
-img {
- border-style: none;
-}
-
-.header {
- background: #fff;
- margin: 0 auto 0;
- text-align: left;
- padding: 9px 0 29px 0;
- width: 960px;
- border-top: 10px solid #ccc;
-}
-
-.header a {
- font-family: Helvetica, Verdana, sans-serif;
- letter-spacing: -1px;
- font-size: 31px;
- font-weight: bold;
- color: #58a;
- text-decoration: none;
- padding: 0 10px 0 0;
- margin: 0;
-}
-
-.header a:hover {
- color: #69d;
- text-decoration: underline;
-}
-
-.leftcol {
- width: 440px;
- margin: 0 20px 0 0;
- padding: 5px 0 5px 0;
-}
-
-.rightcol {
- width: 440px;
- margin: 0 20px 0 0;
- padding: 5px 0 5px 0;
-}
-
-.formtable {
- margin-top: 20px;
- width: 600px;
- padding: 0;
- clear: both;
-}
-
-.formtable td {
- padding: 5px;
- width: 300px;
- border-top: dotted #ddd 1px;
-}
-
-.formtable input.text {
- width: 300px;
-}
-
-
-.content {
- width: 960px;
- margin: 0 auto 0;
- padding: 0;
- clear: both;
-}
-
-.content p {
- padding: 0 0 15px 0;
- margin: 0;
- line-height: 20px;
- font-size: 14px;
-}
-
-.content p img {
- float: left;
- border: none;
- margin-right: 15px;
- margin-bottom: 10px;
-}
-
-.content h1 {
- border-top: 2px solid olive;
- color: #58a;
- font-family: Helvetica,Verdana,sans-serif;
- font-size: 18px;
- font-weight: bold;
- line-height: 20px;
- margin: 0;
- padding: 5px 0;
-}
-
-.content h1 a {
- color: #58a;
- margin-left: -5px;
- padding: 0 10px 0 5px;
- text-decoration: none;
-}
-
-.content h1 a:hover {
- background-color: #ffc;
- color: #68b;
-}
-
-.content h2 {
- color: olive;
- font-size: 12px;
- font-family: Helvetica, Verdana, sans-serif;
- font-weight: bold;
- margin: 20px 0 5px 0;
- padding: 3px 0 3px 0;
- border-top: 2px solid olive;
- border-bottom: 1px dotted #ccc;
-}
-
-.footer {
- font-size: 12px;
- background: #fff;
- width: 960px;
- margin: 0 auto 0;
- padding: 10px 0 10px 0;
- text-align: left;
- border-top: 1px solid #ccc;
- clear: both;
-}
-