clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [33/87] [abbrv] [partial] clerezza git commit: CLEREZZA-966: removed platform. prefix of folder names
Date Tue, 14 Apr 2015 13:13:08 GMT
http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/mozile/src/gui/htmlToolbar.css
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/mozile/src/gui/htmlToolbar.css b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/mozile/src/gui/htmlToolbar.css
new file mode 100644
index 0000000..18d0939
--- /dev/null
+++ b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/mozile/src/gui/htmlToolbar.css
@@ -0,0 +1,162 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Licensed under Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ * Full Terms at http://mozile.mozdev.org/0.8/LICENSE
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is James A. Overton's code (james@overton.ca).
+ *
+ * The Initial Developer of the Original Code is James A. Overton.
+ * Portions created by the Initial Developer are Copyright (C) 2005-2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *	James A. Overton <james@overton.ca>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/**
+ * @fileoverview Provides CSS styles for Mozile's HTML Toolbar GUI.
+ * @link http://mozile.mozdev.org 
+ * @author James A. Overton <james@overton.ca>
+ * @version 0.8
+ * $Id: htmlToolbar.css,v 1.3 2006/08/31 14:18:17 jameso Exp $
+ */
+
+/* 
+ * NOTE: There are several CSS hacks coded into the "htmlToolbar.js" file which override the defaults set here. Be careful.
+ */
+
+/*
+#mozileToolbar, .mozileMenu {
+	background-color: #EEEEEE;
+	border: 1px solid #888888;
+	font-family: Arial, Helvitica, sans-serif;
+}
+*/
+
+#mozileToolbar {
+	text-decoration: none;
+	color: black;
+	background-color: #EEEEEE;
+	border: 1px solid #888888;
+	font-family: sans-serif;
+	padding: 1px 0px 1px 0px;
+	position: absolute;
+	top: -1px;
+	left: 0px;
+	z-index: 1000;
+	vertical-align: middle;
+	font-family: Arial, Helvitica, sans-serif;
+	-moz-user-select: none;
+}
+
+#mozileToolbar img {
+	border: 0px;
+	vertical-align: middle;
+}
+
+#mozileToolbar *[available=false] {
+	opacity: 0.5;
+}
+
+.mozileButton {
+	margin: 0px 0px 1px 0px;
+	padding: 1px 1px 2px 1px;
+	border: 0px;
+	text-decoration: none;
+	min-width: 16px;
+	height: 16px;
+}
+
+.mozileButton img {
+	margin: 0px;
+	padding: 0px;
+}
+
+.mozileButton * {
+	text-decoration: none;
+}
+
+.mozileButton[active=true] {
+	background-color: #C1D2EE;
+	border: 1px solid #316AC5;
+	padding: 0px 0px 1px 0px;
+}
+
+.mozileButton:hover {
+	background-color: #DDDDFF;
+	border: 1px solid #316AC5;
+	padding: 0px 0px 1px 0px;
+}
+
+.mozileMenuItem {
+	vertical-align: middle;
+	cursor: pointer;
+	padding: 0px;
+}
+
+.mozileMenuItem td {
+	margin: 0px;
+}
+
+.mozileMenuItem:hover {
+	background-color: #316AC5;
+	color: white;
+}
+
+.mozileMenuItem img {
+	vertical-align: middle;
+}
+
+.mozileMenu {
+	background-color: #EEEEEE;
+	border: 1px solid #888888;
+	position: absolute;
+	padding: 1px 1px 1px 1px;
+	vertical-align: middle;
+}
+
+.mozileRight {
+	position: absolute;
+	right: 2px;
+	vertical-align: middle;
+}
+
+.mozileActive {
+}
+
+.mozileIcon {
+}
+
+.mozileLabel {
+	white-space: pre;
+}
+
+.mozileAccel {
+	text-align: right;
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/parameters.js
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/parameters.js b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/parameters.js
new file mode 100644
index 0000000..6fdcde7
--- /dev/null
+++ b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/parameters.js
@@ -0,0 +1,72 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+function Parameters() {
+
+	this.parameterArray = new Array(0);
+    var url   = window.location.search;
+    if (url != "")
+     {
+      url = url.substring(1,url.length);                      
+      splittedURL = url.split("&"); 
+      for (i=0;i < splittedURL.length;i++)
+       {
+        temp = splittedURL[i].split("=");
+        currentField = new field();
+				currentField.name = temp[0];
+				currentField.value = Parameters.readField(temp[1]);
+				this.parameterArray.push(currentField);
+       }
+     }
+     
+}
+
+Parameters.prototype.getField = function(name) {
+
+	for (i = 0; i < this.parameterArray.length; i++) {
+		if (this.parameterArray[i].name == name) {
+			return this.parameterArray[i].value;
+		}
+	}
+	return null;
+}
+
+Parameters.readField = function(raw) {
+	if (raw == null) {
+		return null;
+	}
+	var result = raw.replace(/\+/g," ");
+	return unescape(result);
+}
+
+	 
+function field() {
+ 	var name;
+	var value;
+}
+	
+	
+	
+	
+
+
+   
+	 	

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/rdfparser.js
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/rdfparser.js b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/rdfparser.js
new file mode 100644
index 0000000..74eaa46
--- /dev/null
+++ b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/rdfparser.js
@@ -0,0 +1,544 @@
+/**
+ * @fileoverview
+ * TABULATOR RDF PARSER
+ *
+ * Version 0.1
+ *  Parser believed to be in full positive RDF/XML parsing compliance
+ *  with the possible exception of handling deprecated RDF attributes
+ *  appropriately. Parser is believed to comply fully with other W3C
+ *  and industry standards where appropriate (DOM, ECMAScript, &c.)
+ *
+ *  Author: David Sheets <dsheets@mit.edu>
+ *  SVN ID: $Id$
+ *
+ * W3C® SOFTWARE NOTICE AND LICENSE
+ * http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ * This work (and included software, documentation such as READMEs, or
+ * other related items) is being provided by the copyright holders under
+ * the following license. By obtaining, using and/or copying this work,
+ * you (the licensee) agree that you have read, understood, and will
+ * comply with the following terms and conditions.
+ * 
+ * Permission to copy, modify, and distribute this software and its
+ * documentation, with or without modification, for any purpose and
+ * without fee or royalty is hereby granted, provided that you include
+ * the following on ALL copies of the software and documentation or
+ * portions thereof, including modifications:
+ * 
+ * 1. The full text of this NOTICE in a location viewable to users of
+ * the redistributed or derivative work.
+ * 2. Any pre-existing intellectual property disclaimers, notices, or terms and
+ * conditions. If none exist, the W3C Software Short Notice should be
+ * included (hypertext is preferred, text is permitted) within the body
+ * of any redistributed or derivative code.
+ * 3. Notice of any changes or modifications to the files, including the
+ * date changes were made. (We recommend you provide URIs to the location
+ * from which the code is derived.)
+ * 
+ * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
+ * HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS
+ * FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
+ * DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
+ * TRADEMARKS OR OTHER RIGHTS.
+ * 
+ * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
+ * OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+ * DOCUMENTATION.
+ * 
+ * The name and trademarks of copyright holders may NOT be used in
+ * advertising or publicity pertaining to the software without specific,
+ * written prior permission. Title to copyright in this software and any
+ * associated documentation will at all times remain with copyright
+ * holders.
+ */
+/**
+ * @class Class defining an RDFParser resource object tied to an RDFStore
+ *  
+ * @author David Sheets <dsheets@mit.edu>
+ * @version 0.1
+ * 
+ * @constructor
+ * @param {RDFStore} store An RDFStore object
+ */
+function RDFParser(store) {
+    /** Standard namespaces that we know how to handle @final
+     *  @member RDFParser
+     */
+    RDFParser['ns'] = {'RDF':
+		       "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+		       'RDFS':
+		       "http://www.w3.org/2000/01/rdf-schema#"}
+    /** DOM Level 2 node type magic numbers @final
+     *  @member RDFParser
+     */
+    RDFParser['nodeType'] = {'ELEMENT': 1, 'ATTRIBUTE': 2, 'TEXT': 3,
+			     'CDATA_SECTION': 4, 'ENTITY_REFERENCE': 5,
+			     'ENTITY': 6, 'PROCESSING_INSTRUCTION': 7,
+			     'COMMENT': 8, 'DOCUMENT': 9, 'DOCUMENT_TYPE': 10,
+			     'DOCUMENT_FRAGMENT': 11, 'NOTATION': 12}
+
+    /**
+     * Frame class for namespace and base URI lookups
+     * Base lookups will always resolve because the parser knows
+     * the default base.
+     *
+     * @private
+     */
+    this['frameFactory'] = function (parser, parent, element) {
+	return {'NODE': 1,
+		'ARC': 2,
+		'parent': parent,
+		'parser': parser,
+		'store': parser['store'],
+		'element': element,
+		'lastChild': 0,
+		'base': null,
+		'lang': null,
+		'node': null,
+		'nodeType': null,
+		'listIndex': 1,
+		'rdfid': null,
+		'datatype': null,
+		'collection': false,
+
+	/** Terminate the frame and notify the store that we're done */
+		'terminateFrame': function () {
+		    if (this['collection']) {
+			this['node']['close']()
+		    }
+		},
+	
+	/** Add a symbol of a certain type to the this frame */
+		'addSymbol': function (type, uri) {
+		    uri = Util.uri.join(uri, this['base'])
+		    this['node'] = this['store']['sym'](uri)
+		    this['nodeType'] = type
+		},
+	
+	/** Load any constructed triples into the store */
+		'loadTriple': function () {
+		    if (this['parent']['parent']['collection']) {
+			this['parent']['parent']['node']['append'](this['node'])
+		    }
+		    else {
+			this['store']['add'](this['parent']['parent']['node'],
+				       this['parent']['node'],
+				       this['node'],
+				       this['parser']['why'])
+		    }
+		    if (this['parent']['rdfid'] != null) { // reify
+			var triple = this['store']['sym'](
+			    Util.uri.join("#"+this['parent']['rdfid'],
+					  this['base']))
+			this['store']['add'](triple,
+					     this['store']['sym'](
+						 RDFParser['ns']['RDF']
+						     +"type"),
+					     this['store']['sym'](
+						 RDFParser['ns']['RDF']
+						     +"Statement"),
+					     this['parser']['why'])
+			this['store']['add'](triple,
+					     this['store']['sym'](
+						 RDFParser['ns']['RDF']
+						     +"subject"),
+					     this['parent']['parent']['node'],
+					     this['parser']['why'])
+			this['store']['add'](triple,
+					     this['store']['sym'](
+						 RDFParser['ns']['RDF']
+						     +"predicate"),
+					     this['parent']['node'],
+					     this['parser']['why'])
+			this['store']['add'](triple,
+					     this['store']['sym'](
+						 RDFParser['ns']['RDF']
+						     +"object"),
+					     this['node'],
+					     this['parser']['why'])
+		    }
+		},
+
+	/** Check if it's OK to load a triple */
+		'isTripleToLoad': function () {
+		    return (this['parent'] != null
+			    && this['parent']['parent'] != null
+			    && this['nodeType'] == this['NODE']
+			    && this['parent']['nodeType'] == this['ARC']
+			    && this['parent']['parent']['nodeType']
+			    == this['NODE'])
+		},
+
+	/** Add a symbolic node to this frame */
+		'addNode': function (uri) {
+		    this['addSymbol'](this['NODE'],uri)
+		    if (this['isTripleToLoad']()) {
+			this['loadTriple']()
+		    }
+		},
+
+	/** Add a collection node to this frame */
+		'addCollection': function () {
+		    this['nodeType'] = this['NODE']
+		    this['node'] = this['store']['collection']()
+		    this['collection'] = true
+		    if (this['isTripleToLoad']()) {
+			this['loadTriple']()
+		    }
+		},
+
+	/** Add a collection arc to this frame */
+		'addCollectionArc': function () {
+		    this['nodeType'] = this['ARC']
+		},
+
+	/** Add a bnode to this frame */
+		'addBNode': function (id) {
+		    if (id != null) {
+			if (this['parser']['bnodes'][id] != null) {
+			    this['node'] = this['parser']['bnodes'][id]
+			} else {
+			    this['node'] = this['parser']['bnodes'][id] = this['store']['bnode']()
+			}
+		    } else { this['node'] = this['store']['bnode']() }
+		    
+		    this['nodeType'] = this['NODE']
+		    if (this['isTripleToLoad']()) {
+			this['loadTriple']()
+		    }
+		},
+
+	/** Add an arc or property to this frame */
+		'addArc': function (uri) {
+		    if (uri == RDFParser['ns']['RDF']+"li") {
+			uri = RDFParser['ns']['RDF']+"_"+this['parent']['listIndex']++
+		    }
+		    this['addSymbol'](this['ARC'], uri)
+		},
+
+	/** Add a literal to this frame */
+		'addLiteral': function (value) {
+		    if (this['parent']['datatype']) {
+			this['node'] = this['store']['literal'](
+			    value, "", this['store']['sym'](
+				this['parent']['datatype']))
+		    }
+		    else {
+			this['node'] = this['store']['literal'](
+			    value, this['lang'])
+		    }
+		    this['nodeType'] = this['NODE']
+		    if (this['isTripleToLoad']()) {
+			this['loadTriple']()
+		    }
+		}
+	       }
+    }
+
+    /** Our triple store reference @private */
+    this['store'] = store
+    /** Our identified blank nodes @private */
+    this['bnodes'] = {}
+    /** A context for context-aware stores @private */
+    this['why'] = null
+    /** Reification flag */
+    this['reify'] = false
+
+    /**
+     * Build our initial scope frame and parse the DOM into triples
+     * @param {DOMTree} document The DOM to parse
+     * @param {String} base The base URL to use 
+     * @param {Object} why The context to which this resource belongs
+     */
+    this['parse'] = function (document, base, why) {
+	var children = document['childNodes']
+
+	// clean up for the next run
+	this['cleanParser']()
+
+	// figure out the root element
+	if (document['nodeType'] == RDFParser['nodeType']['DOCUMENT']) {
+	    for (var c=0; c<children['length']; c++) {
+		if (children[c]['nodeType']
+		    == RDFParser['nodeType']['ELEMENT']) {
+		    var root = children[c]
+		    break
+		}
+	    }	    
+	}
+	else if (document['nodeType'] == RDFParser['nodeType']['ELEMENT']) {
+	    var root = document
+	}
+	else {
+	    throw new Error("RDFParser: can't find root in " + base
+			    + ". Halting. ")
+	    return false
+	}
+	
+	this['why'] = why
+
+	// our topmost frame
+
+	var f = this['frameFactory'](this)
+	f['base'] = base
+	f['lang'] = ''
+	
+	this['parseDOM'](this['buildFrame'](f,root))
+	return true
+    }
+    this['parseDOM'] = function (frame) {
+	// a DOM utility function used in parsing
+	var elementURI = function (el) {
+	    return el['namespaceURI'] + el['localName']
+	}
+	var dig = true // if we'll dig down in the tree on the next iter
+
+	while (frame['parent']) {
+	    var dom = frame['element']
+	    var attrs = dom['attributes']
+
+	    if (dom['nodeType']
+		== RDFParser['nodeType']['TEXT']
+		|| dom['nodeType']
+		== RDFParser['nodeType']['CDATA_SECTION']) {//we have a literal
+		frame['addLiteral'](dom['nodeValue'])
+	    }
+	    else if (elementURI(dom)
+		     != RDFParser['ns']['RDF']+"RDF") { // not root
+		if (frame['parent'] && frame['parent']['collection']) {
+		    // we're a collection element
+		    frame['addCollectionArc']()
+		    frame = this['buildFrame'](frame,frame['element'])
+		    frame['parent']['element'] = null
+		}
+                if (!frame['parent'] || !frame['parent']['nodeType']
+		    || frame['parent']['nodeType'] == frame['ARC']) {
+		    // we need a node
+		    var about =dom['getAttributeNodeNS'](
+			RDFParser['ns']['RDF'],"about")
+		    var rdfid =dom['getAttributeNodeNS'](
+			RDFParser['ns']['RDF'],"ID")
+		    if (about && rdfid) {
+			throw new Error("RDFParser: " + dom['nodeName']
+					+ " has both rdf:id and rdf:about."
+					+ " Halting. Only one of these"
+					+ " properties may be specified on a"
+					+ " node.");
+		    }
+		    if (about == null && rdfid) {
+			frame['addNode']("#"+rdfid['nodeValue'])
+			dom['removeAttributeNode'](rdfid)
+		    }
+		    else if (about == null && rdfid == null) {
+			var bnid = dom['getAttributeNodeNS'](
+			    RDFParser['ns']['RDF'],"nodeID")
+			if (bnid) {
+			    frame['addBNode'](bnid['nodeValue'])
+			    dom['removeAttributeNode'](bnid)
+			} else { frame['addBNode']() }
+		    }
+		    else {
+			frame['addNode'](about['nodeValue'])
+			dom['removeAttributeNode'](about)
+		    }
+		
+		    // Typed nodes
+		    var rdftype = dom['getAttributeNodeNS'](
+			RDFParser['ns']['RDF'],"type")
+		    if (RDFParser['ns']['RDF']+"Description"
+			!= elementURI(dom)) {
+			rdftype = {'nodeValue': elementURI(dom)}
+		    }
+		    if (rdftype != null) {
+			this['store']['add'](frame['node'],
+					     this['store']['sym'](
+						 RDFParser['ns']['RDF']+"type"),
+					     this['store']['sym'](
+						 Util.uri.join(
+						     rdftype['nodeValue'],
+						     frame['base'])),
+					     this['why'])
+			if (rdftype['nodeName']){
+			    dom['removeAttributeNode'](rdftype)
+			}
+		    }
+		    
+		    // Property Attributes
+		    for (var x = attrs['length']-1; x >= 0; x--) {
+			this['store']['add'](frame['node'],
+					     this['store']['sym'](
+						 elementURI(attrs[x])),
+					     this['store']['literal'](
+						 attrs[x]['nodeValue'],
+						 frame['lang']),
+					     this['why'])
+		    }
+		}
+		else { // we should add an arc (or implicit bnode+arc)
+		    frame['addArc'](elementURI(dom))
+
+		    // save the arc's rdf:ID if it has one
+		    if (this['reify']) {
+			var rdfid = dom['getAttributeNodeNS'](
+			    RDFParser['ns']['RDF'],"ID")
+			if (rdfid) {
+			    frame['rdfid'] = rdfid['nodeValue']
+			    dom['removeAttributeNode'](rdfid)
+			}
+		    }
+
+		    var parsetype = dom['getAttributeNodeNS'](
+			RDFParser['ns']['RDF'],"parseType")
+		    var datatype = dom['getAttributeNodeNS'](
+			RDFParser['ns']['RDF'],"datatype")
+		    if (datatype) {
+			frame['datatype'] = datatype['nodeValue']
+			dom['removeAttributeNode'](datatype)
+		    }
+
+		    if (parsetype) {
+			var nv = parsetype['nodeValue']
+			if (nv == "Literal") {
+			    frame['datatype']
+				= RDFParser['ns']['RDF']+"XMLLiteral"
+			    // (this.buildFrame(frame)).addLiteral(dom)
+			    // should work but doesn't
+			    frame = this['buildFrame'](frame)
+			    frame['addLiteral'](dom)
+			    dig = false
+			}
+			else if (nv == "Resource") {
+			    frame = this['buildFrame'](frame,frame['element'])
+			    frame['parent']['element'] = null
+			    frame['addBNode']()
+			}
+			else if (nv == "Collection") {
+			    frame = this['buildFrame'](frame,frame['element'])
+			    frame['parent']['element'] = null
+			    frame['addCollection']()
+			}
+			dom['removeAttributeNode'](parsetype)
+		    }
+
+		    if (attrs['length'] != 0) {
+			var resource = dom['getAttributeNodeNS'](
+			    RDFParser['ns']['RDF'],"resource")
+			var bnid = dom['getAttributeNodeNS'](
+			    RDFParser['ns']['RDF'],"nodeID")
+
+			frame = this['buildFrame'](frame)
+			if (resource) {
+			    frame['addNode'](resource['nodeValue'])
+			    dom['removeAttributeNode'](resource)
+			} else {
+			    if (bnid) {
+				frame['addBNode'](bnid['nodeValue'])
+				dom['removeAttributeNode'](bnid)
+			    } else { frame['addBNode']() }
+			}
+
+			for (var x = attrs['length']-1; x >= 0; x--) {
+			    var f = this['buildFrame'](frame)
+			    f['addArc'](elementURI(attrs[x]))
+			    if (elementURI(attrs[x])
+				==RDFParser['ns']['RDF']+"type"){
+				(this['buildFrame'](f))['addNode'](
+				    attrs[x]['nodeValue'])
+			    } else {
+				(this['buildFrame'](f))['addLiteral'](
+				    attrs[x]['nodeValue'])
+			    }
+			}
+		    }
+		    else if (dom['childNodes']['length'] == 0) {
+			(this['buildFrame'](frame))['addLiteral']("")
+		    }
+		}
+	    } // rdf:RDF
+
+	    // dig dug
+	    dom = frame['element']
+	    while (frame['parent']) {
+		var pframe = frame
+		while (dom == null) {
+		    frame = frame['parent']
+		    dom = frame['element']
+		}
+		var candidate = dom['childNodes'][frame['lastChild']]
+		if (candidate == null || !dig) {
+		    frame['terminateFrame']()
+		    if (!(frame = frame['parent'])) { break } // done
+		    dom = frame['element']
+		    dig = true
+		}
+		else if ((candidate['nodeType']
+			  != RDFParser['nodeType']['ELEMENT']
+			  && candidate['nodeType']
+			  != RDFParser['nodeType']['TEXT']
+			  && candidate['nodeType']
+			  != RDFParser['nodeType']['CDATA_SECTION'])
+			 || ((candidate['nodeType']
+			      == RDFParser['nodeType']['TEXT']
+			      || candidate['nodeType']
+			      == RDFParser['nodeType']['CDATA_SECTION'])
+			     && dom['childNodes']['length'] != 1)) {
+		    frame['lastChild']++
+		}
+		else { // not a leaf
+		    frame['lastChild']++
+		    frame = this['buildFrame'](pframe,
+					       dom['childNodes'][frame['lastChild']-1])
+		    break
+		}
+	    }
+	} // while
+    }
+
+    /**
+     * Cleans out state from a previous parse run
+     * @private
+     */
+    this['cleanParser'] = function () {
+	this['bnodes'] = {}
+	this['why'] = null
+    }
+
+    /**
+     * Builds scope frame 
+     * @private
+     */
+    this['buildFrame'] = function (parent, element) {
+	var frame = this['frameFactory'](this,parent,element)
+	if (parent) {
+	    frame['base'] = parent['base']
+	    frame['lang'] = parent['lang']
+	}
+	if (element == null
+	    || element['nodeType'] == RDFParser['nodeType']['TEXT']
+	    || element['nodeType'] == RDFParser['nodeType']['CDATA_SECTION']) {
+	    return frame
+	}
+
+	var attrs = element['attributes']
+
+	var base = element['getAttributeNode']("xml:base")
+	if (base != null) {
+	    frame['base'] = base['nodeValue']
+	    element['removeAttribute']("xml:base")
+	}
+	var lang = element['getAttributeNode']("xml:lang")
+	if (lang != null) {
+	    frame['lang'] = lang['nodeValue']
+	    element['removeAttribute']("xml:lang")
+	}
+
+	// remove all extraneous xml and xmlns attributes
+	for (var x = attrs['length']-1; x >= 0; x--) {
+	    if (attrs[x]['nodeName']['substr'](0,3) == "xml") {
+		element['removeAttributeNode'](attrs[x])
+	    }
+	}
+	return frame
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/rdfxmlserializer.js
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/rdfxmlserializer.js b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/rdfxmlserializer.js
new file mode 100644
index 0000000..edbf4c8
--- /dev/null
+++ b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/rdfxmlserializer.js
@@ -0,0 +1,130 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+function RDFXMLSerializer() {
+}
+
+
+RDFXMLSerializer.serialize = function(rdfFormula, baseURL) {
+	var statements = rdfFormula.statements;
+	var result = document.implementation.createDocument("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf:RDF", null);
+	var root = result.firstChild;
+	var elementMap = new Object();
+	for (var i = 0; i < statements.length; i++) {
+		RDFXMLSerializer.addStatement(statements[i], result, root, baseURL, elementMap);
+	}
+	root.appendChild(result.createTextNode("\n"));
+	for (var key in elementMap) {
+		elementMap[key].appendChild(result.createTextNode("\n\t"));
+	}
+	//alert(new XMLSerializer().serializeToString(result));
+	return result;
+}
+
+RDFXMLSerializer.addStatement = function(statement, result, root, baseURL, elementMap) {
+	
+	var elem = result.createElementNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdf:Description");
+	var elemId;
+	if (statement.subject.termType == "symbol") {
+		elemId = statement.subject.uri;
+		elem.setAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdf:about", RDFXMLSerializer.getRelativePath(statement.subject.uri, baseURL));
+	} else {
+		elemId = statement.subject.id;
+		elem.setAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdf:nodeID", "a"+statement.subject.id);
+	}
+	if (elementMap[elemId]) {
+		elem = elementMap[elemId];
+	} else {
+		elementMap[elemId] = elem;
+		root.appendChild(result.createTextNode("\n\t"));
+		root.appendChild(elem);
+	}
+	elem.appendChild(result.createTextNode("\n"));
+	elem.appendChild(result.createTextNode("\t\t"));
+	var splittedURI = RDFXMLSerializer.splitURI(statement.predicate.uri);
+	var propertyElem = result.createElementNS(splittedURI.ns, splittedURI.name);
+	elem.appendChild(propertyElem);
+	if (statement.object.termType == "symbol") {
+		propertyElem.setAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdf:resource", RDFXMLSerializer.getRelativePath(statement.object.uri, baseURL));
+	} else {
+		if (statement.object.termType == "literal") {
+			//note supports hacked xml-literals, other types are not in the store
+			if (statement.object.elementValue) {
+				var nodes = statement.object.elementValue.childNodes;
+				for (var i = 0; i < nodes.length; i ++) {
+					propertyElem.appendChild(nodes[i].cloneNode(true));
+				}
+				propertyElem.setAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdf:parseType", "Literal");
+			} else {
+				var textNode = result.createTextNode(statement.object.value);
+				propertyElem.appendChild(textNode);
+				if (statement.object.lang) {
+					propertyElem.setAttribute("xml:lang", statement.object.lang);
+				}
+			}
+		} else {
+			propertyElem.setAttributeNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdf:nodeID", "a"+statement.object.id);
+		}
+	}
+}
+
+RDFXMLSerializer.splitURI = function(uri) {
+	var poundPos = uri.indexOf('#');
+	var splitPos; 
+	if (poundPos > -1) {
+		splitPos = poundPos;
+	} else {
+		splitPos = uri.lastIndexOf('/');
+	}
+	var result = new Object();
+	result.ns = uri.substring(0, splitPos+1);
+	result.name = uri.substring(splitPos+1);
+	return result;
+	
+}
+
+RDFXMLSerializer.getRelativePath = function(url, contextURL) {
+	if (!contextURL) {
+		return url;
+	}
+	var contextCollection = contextURL.substring(0, contextURL.lastIndexOf('/'));
+	var contextualisation =  RDFXMLSerializer.getRelativePathToCollection(url, contextCollection);
+	if (contextualisation) {
+		return contextualisation;
+	} else {
+		return url;
+	}
+}
+
+RDFXMLSerializer.getRelativePathToCollection = function(url, contextCollection) {
+	if (url.indexOf(contextCollection) == 0) {
+		return url.substring(contextCollection.length+1);
+	} else {
+		if (contextCollection.match(/.*\/\/.*\.*\//)) {
+			var contextCollection = contextCollection.substring(0, contextCollection.lastIndexOf('/'));
+			var superContextualisation = RDFXMLSerializer.getRelativePathToCollection(url, contextCollection);
+			if (superContextualisation) {
+				return "../"+superContextualisation;
+			}
+		} 
+		return null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/term.js
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/term.js b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/term.js
new file mode 100644
index 0000000..29e5d7f
--- /dev/null
+++ b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/term.js
@@ -0,0 +1,307 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+// These are the classes corresponding to the RDF and N3 data models
+//
+// Designed to look like rdflib and cwm designs.
+//
+// Issues: Should the names start with RDF to make them
+//      unique as program-wide symbols?
+//
+// W3C open source licence 2005.
+//
+
+RDFTracking = 0  // Are we requiring reasons for statements?
+
+//takes in an object and makes it an object if it's a literal
+function makeTerm(val) {
+    //  fyi("Making term from " + val)
+    if (typeof val == 'object') return val;
+    if (typeof val == 'string') return new RDFLiteral(val);
+    if (typeof val == 'undefined') return undefined;
+    alert("Can't make term from " + val + " of type " + typeof val) // @@ add numbers
+}
+
+
+
+//	Symbol
+
+function RDFEmpty() {
+	return this;
+}
+RDFEmpty.prototype.termType = 'empty'
+RDFEmpty.prototype.toString = function () { return "" }
+RDFEmpty.prototype.toNT = function () { return "" }
+
+function RDFSymbol_toNT(x) {
+    return ("<" + x.uri + ">")
+}
+
+function toNT() {
+    return RDFSymbol_toNT(this)
+}
+
+function RDFSymbol(uri) {
+    this.uri = uri
+    return this
+}
+	
+RDFSymbol.prototype.termType = 'symbol'
+RDFSymbol.prototype.toString = toNT
+RDFSymbol.prototype.toNT = toNT
+
+
+//	Blank Node
+
+var RDFNextId = 0;  // Gobal genid
+RDFGenidPrefix = "genid:"
+NTAnonymousNodePrefix = "_:n"
+
+function RDFBlankNode(id) {
+    /*if (id)
+    	this.id = id;
+    else*/
+    this.id = RDFNextId++
+    return this
+}
+
+RDFBlankNode.prototype.termType = 'bnode'
+
+RDFBlankNode.prototype.toNT = function() {
+    return NTAnonymousNodePrefix + this.id
+}
+RDFBlankNode.prototype.toString = RDFBlankNode.prototype.toNT  
+
+//	Literal
+
+//LiteralSmush = []
+
+function RDFLiteral(value, lang, datatype) {
+	if (typeof value == 'object') {	
+		var serializer = new XMLSerializer();
+		this.value = serializer.serializeToString(value);
+		this.elementValue = value.cloneNode(true); //cloning so taht literal doesn't become mutable
+	} else {
+		//console.debug("value: " +value+" type "+ typeof value);
+    	this.value = value.toString();
+    }
+    this.lang=lang;	  // string
+    this.datatype=datatype;  // term
+    this.toString = RDFLiteralToString
+    this.toNT = RDFLiteral_toNT
+    //if (LiteralSmush[this.toNT()]) return LiteralSmush[this.toNT()];
+    //else LiteralSmush[this.toNT()]=this;
+    return this
+}
+
+RDFLiteral.prototype.termType = 'literal'
+
+function RDFLiteral_toNT() {
+    var str = this.value
+    if (typeof str != 'string') {
+	throw Error("Value of RDF literal is not string: "+str)
+    }
+    str = str.replace(/\\/g, '\\\\');  // escape
+    str = str.replace(/\"/g, '\\"');
+    str = '"' + str + '"'
+
+    if (this.datatype){
+    //alert(this.datatype.termType+"   "+typeof this.datatype)
+	str = str + '^^' + this.datatype//.toNT()
+    }
+    if (this.lang) {
+	str = str + "@" + this.lang
+    }
+    return str
+}
+
+function RDFLiteralToString() {
+    return this.value
+}
+    
+RDFLiteral.prototype.toString = RDFLiteralToString   
+RDFLiteral.prototype.toNT = RDFLiteral_toNT
+
+function RDFCollection() {
+    this.id = RDFNextId++
+    this.elements = []
+    this.closed = false
+}
+
+RDFCollection.prototype.termType = 'collection'
+
+RDFCollection.prototype.toNT = function() {
+    return NTAnonymousNodePrefix + this.id
+}
+RDFCollection.prototype.toString = RDFCollection.prototype.toNT 
+
+RDFCollection.prototype.append = function (el) {
+    this.elements.push(el)
+}
+
+RDFCollection.prototype.close = function () {
+    this.closed = true
+}
+
+//	Statement
+//
+//  This is a triple with an optional reason.
+//
+//   The reason can point to provenece or inference
+//
+function RDFStatement_toNT() {
+    return (this.subject.toNT() + " "
+	    + this.predicate.toNT() + " "
+	    +  this.object.toNT() +" .")
+}
+
+function RDFStatement(subject, predicate, object, why) {
+    this.subject = makeTerm(subject)
+    this.predicate = makeTerm(predicate)
+    this.object = makeTerm(object)
+    if (typeof why !='undefined') {
+	this.why = why
+    } else if (RDFTracking) {
+	fyi("WARNING: No reason on "+subject+" "+predicate+" "+object)
+    }
+    return this
+}
+
+RDFStatement.prototype.toNT = RDFStatement_toNT
+RDFStatement.prototype.toString = RDFStatement_toNT
+	
+
+//	Formula
+//
+//	Set of statements.
+
+function RDFFormula() {
+    this.statements = []
+    this.constraints = []
+    this.initBindings = []
+    this.optional = []
+    return this
+}
+
+/*function RDFQueryFormula() {
+	this.statements = []
+	this.constraints = []
+	this.initBindings = []
+	this.optional = []
+	return this
+}*/
+
+function RDFFormula_toNT() {
+    return "{\n" + this.statements.join('\n') + "}"
+}
+
+//RDFQueryFormula.prototype = new RDFFormula()
+//RDFQueryFormula.termType = 'queryFormula'
+RDFFormula.prototype.termType = 'formula'
+RDFFormula.prototype.toNT = RDFFormula_toNT
+RDFFormula.prototype.toString = RDFFormula_toNT   
+
+RDFFormula.prototype.add = function(subj, pred, obj, why) {
+    this.statements.push(new RDFStatement(subj, pred, obj, why))
+}
+
+// Convenience methods on a formula allow the creation of new RDF terms:
+
+RDFFormula.prototype.sym = function(uri,name) {
+    if (name != null) {
+	uri = this.namespaces[uri] + name
+    }
+    return new RDFSymbol(uri)
+}
+
+RDFFormula.prototype.literal = function(val, lang, dt) {
+    return new RDFLiteral(val, lang, dt)
+}
+
+RDFFormula.prototype.bnode = function(id) {
+    return new RDFBlankNode(id)
+}
+
+RDFFormula.prototype.formula = function() {
+    return new RDFFormula()
+}
+
+RDFFormula.prototype.collection = function () {
+    return new RDFCollection()
+}
+
+
+/*RDFFormula.prototype.queryFormula = function() {
+	return new RDFQueryFormula()
+}*/
+
+RDFVariableBase = "varid:"; // We deem variabe x to be the symbol varid:x 
+
+//An RDFVariable is a type of s/p/o that's not literal. All it holds is it's URI.
+//It has type 'variable', and a function toNT that turns it into NTriple form
+function RDFVariable(rel) {
+    this.uri = URIjoin(rel, RDFVariableBase);
+    return this;
+}
+
+RDFVariable.prototype.termType = 'variable';
+RDFVariable.prototype.toNT = function() {
+    if (this.uri.slice(0, RDFVariableBase.length) == RDFVariableBase) {
+	return '?'+ this.uri.slice(RDFVariableBase.length);} // @@ poor man's refTo
+    return '?' + this.uri;
+};
+
+RDFVariable.prototype.toString = RDFVariable.prototype.toNT;
+RDFVariable.prototype.classOrder = 7;
+
+RDFFormula.prototype.variable = function(name) {
+    return new RDFVariable(name);
+};
+
+RDFVariable.prototype.hashString = RDFVariable.prototype.toNT;
+
+
+// The namespace function generator 
+
+function Namespace(nsuri) {
+    return function(ln) { return new RDFSymbol(nsuri+ln) }
+}
+
+// Parse a single token
+//
+// The bnode bit should not be used on program-external values; designed
+// for internal work such as storing a bnode id in an HTML attribute.
+// Not coded for literals.
+
+RDFFormula.prototype.fromNT = function(str) {
+    var len = str.length
+    var ch = str.slice(0,1)
+    if (ch == '<') return this.sym(str.slice(1,len-1))
+    if (ch == '_') {
+	var x = new RDFBlankNode()
+	x.id = parseInt(str.slice(3))
+	RDFNextId--
+	return x
+    }
+    alert("Can't yet convert from NT: '"+str+"', "+str[0])
+}
+
+// ends

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/uri.js
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/uri.js b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/uri.js
new file mode 100644
index 0000000..2a8582e
--- /dev/null
+++ b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/uri.js
@@ -0,0 +1,123 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+//  Implementing URI-specific functions
+//
+//	See RFC 2386
+//
+// This is or was   http://www.w3.org/2005/10/ajaw/uri.js
+// 2005 W3C open source licence
+//
+//
+//  Take a URI given in relative or absolute form and a base
+//  URI, and return an absolute URI
+//
+//  See also http://www.w3.org/2000/10/swap/uripath.py
+//
+
+if (typeof Util == "undefined") { Util = {}}
+if (typeof Util.uri == "undefined") { Util.uri = {}}
+
+Util.uri.join = function (given, base) {
+    // if (typeof fyi != 'undefined') fyi("   URI given="+given+" base="+base)
+    var baseHash = base.indexOf('#')
+    if (baseHash > 0) base = base.slice(0, baseHash)
+    if (given.length==0) return base // before chopping its filename off
+    if (given.indexOf('#')==0) return base + given
+    var colon = given.indexOf(':')
+    if (colon >= 0) return given	// Absolute URI form overrides base URI
+    var baseColon = base.indexOf(':')
+    if (baseColon<0) {alert("Invalid base URL "+ base); return given}
+    var baseScheme = base.slice(0,baseColon+1)  // eg http:
+    if (given.indexOf("//") == 0)     // Starts with //
+	return baseScheme + given;
+    if (base.indexOf('//', baseColon)==baseColon+1) {  // Any hostpart?
+	    var baseSingle = base.indexOf("/", baseColon+3)
+	if (baseSingle < 0) {
+	    if (base.length-baseColon-3 > 0) {
+		return base + "/" + given
+	    } else {
+		return baseScheme + given
+	    }
+	}
+    } else {
+	var baseSingle = base.indexOf("/", baseColon+1)
+	if (baseSingle < 0) {
+	    if (base.length-baseColon-1 > 0) {
+		return base + "/" + given
+	    } else {
+		return baseScheme + given
+	    }
+	}
+    }
+
+    if (given.indexOf('/') == 0)	// starts with / but not //
+	return base.slice(0, baseSingle) + given
+    
+    var path = base.slice(baseSingle)
+    var lastSlash = path.lastIndexOf("/")
+    if (lastSlash <0) return baseScheme + given
+    if ((lastSlash >=0) && (lastSlash < (path.length-1)))
+	path = path.slice(0, lastSlash+1) // Chop trailing filename from base
+    
+    path = path + given
+    while (path.match(/[^\/]*\/\.\.\//)) // must apply to result of prev
+	path = path.replace( /[^\/]*\/\.\.\//, '') // ECMAscript spec 7.8.5
+    path = path.replace( /\.\//g, '') // spec vague on escaping
+    return base.slice(0, baseSingle) + path
+}
+
+/** returns URI without the frag **/
+Util.uri.docpart = function (uri) {
+    var i = uri.indexOf("#")
+    if (i < 0) return uri
+    return uri.slice(0,i)
+} 
+
+/** return the protocol of a uri **/
+Util.uri.protocol = function (uri) {
+    return uri.slice(0, uri.indexOf(':'))
+} //protocol
+
+URIjoin = Util.uri.join
+uri_docpart = Util.uri.docpart
+uri_protocol = Util.uri.protocol
+
+
+/** returns true if has a protocol & domain **/
+/* No -- this is general URI code.  Not all URIs have protocol and domain.
+** Eg file:, mailto: etc
+
+function uri_valid(uri) {
+	return (uri.match(/(.+?):\/\/(.+?)/));  
+} //valid
+
+
+// returns the filename of a uri @fixme
+function uri_filename(uri) {
+	if (uri_valid(uri))
+		return uri.slice(uri.lastIndexOf('/')+1);
+} //filename
+
+*/
+
+
+//ends

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/util.js
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/util.js b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/util.js
new file mode 100644
index 0000000..3c43d13
--- /dev/null
+++ b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/util.js
@@ -0,0 +1,174 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+/**
+ * Utility functions for tabulator
+ */
+
+/**
+ * A function emulating Scheme's filter. Should have been part of JavaScript so
+ * it is global.
+ */
+function filter(func, list) {
+    //tdebug("entered filter with list length=" + list.length);
+    var output = [];
+    for (var elt in list) {
+	//tdebug("elt=" + list[elt] + ", true? " + func(list[elt]));
+	if (func(list[elt])) {
+	    output.push(list[elt]);
+	}
+    } //construct output
+    //tdebug("exiting filter with list length=" + output.length);
+    return output;
+}
+
+/** 
+ * A function emulating Scheme's map. Should have been part of JavaScript so it
+ * is global.
+ */
+function map(func, list) {
+    //tdebug("entered map with list=" + list.join(", "));
+    var output = [];
+    for (var i in list)  //works on assoc? i hope so
+	output[i] = func(list[i]);
+    return output;
+}
+
+// These are extra
+
+/**
+ * @class A utility class
+ */
+Util = {
+    /** A simple debugging function */         
+        'output': function (o) {
+	    var k = document.createElement('div')
+	    k.textContent = o
+	    document.body.appendChild(k)
+	},
+    /**
+     * A standard way to add callback functionality to an object
+     */
+        'callbackify': function (obj,callbacks) {
+	    obj.callbacks = {}
+	    for (var x=callbacks.length-1; x>=0; x--) {
+		obj.callbacks[callbacks[x]] = []
+	    }
+	    
+	    obj.addHook = function (hook) {
+		if (!obj.callbacks[hook]) { obj.callbacks[hook] = [] }
+	    }
+
+	    obj.addCallback = function (hook, func) {
+		obj.callbacks[hook].push(func)
+	    }
+
+	    obj.fireCallbacks = function (hook, args) {
+		var newCallbacks = []
+		var replaceCallbacks = []
+		var len = obj.callbacks[hook].length
+		for (var x=len-1; x>=0; x--) {
+		    if (obj.callbacks[hook][x].apply(obj,args)) {
+			newCallbacks.push(obj.callbacks[hook][x])
+		    }
+		}
+
+		for (var x=newCallbacks.length-1; x>=0; x--) {
+		    replaceCallbacks.push(newCallbacks[x])
+		}
+		
+		for (var x=len; x<obj.callbacks[hook].length; x++) {
+		    replaceCallbacks.push(obj.callbacks[hook][x])
+		}
+		
+		obj.callbacks[hook] = replaceCallbacks
+	    }
+	},
+    
+    /**
+     * A standard way to create XMLHttpRequest objects
+     */
+	'XMLHTTPFactory': function () {
+	    if (window.XMLHttpRequest) {
+		try {
+		    return new XMLHttpRequest()
+		} catch (e) {
+		    return false
+		}
+	    }
+	    else if (window.ActiveXObject) {
+		try {
+		    return new ActiveXObject("Msxml2.XMLHTTP")
+		} catch (e) {
+		    try {
+			return new ActiveXObject("Microsoft.XMLHTTP")
+		    } catch (e) {
+			return false
+		    }
+		}
+	    }
+	    else {
+		return false
+	    }
+	},
+    /**
+     * Returns a hash of headers and values
+     */
+	'getHTTPHeaders': function (xhr) {
+	    var lines = xhr.getAllResponseHeaders().split("\n")
+	    var headers = {}
+	    var last = undefined
+	    for (var x=0; x<lines.length; x++) {
+		if (lines[x].length > 0) {
+		    var pair = lines[x].split(': ')
+		    if (typeof pair[1] == "undefined") { // continuation
+			headers[last] += "\n"+pair[0]
+		    } else {
+			last = pair[0].toLowerCase()
+			headers[last] = pair[1]
+		    }
+		}
+	    }
+	    return headers
+	},
+
+        'dtstamp': function () {
+	    var now = new Date();
+	    var year  = now.getYear() + 1900;
+	    var month = now.getMonth() + 1;
+	    var day  = now.getDate() + 1;
+	    var hour = now.getUTCHours();
+	    var minute = now.getUTCMinutes();
+	    var second = now.getSeconds();
+	    if (month < 10) month = "0" + month;
+	    if (day < 10) day = "0" + day;
+	    if (hour < 10) hour = "0" + hour;
+	    if (minute < 10) minute = "0" + minute;
+	    if (second < 10) second = "0" + second;
+	    return year + "-" + month + "-" + day + "T"
+		+ hour + ":" + minute + ":" + second + "Z";
+	},
+
+        'enablePrivilege': netscape.security.PrivilegeManager.enablePrivilege,
+
+        'disablePrivilege': netscape.security.PrivilegeManager.disablePrivilege
+}
+

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/widget-factory.js
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/widget-factory.js b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/widget-factory.js
new file mode 100644
index 0000000..1d5317c
--- /dev/null
+++ b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/discoscripts/widget-factory.js
@@ -0,0 +1,995 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+xhtmlNS  = "http://www.w3.org/1999/xhtml";
+
+function RDF(localName) {
+	return new RDFSymbol('http://www.w3.org/1999/02/22-rdf-syntax-ns#'+localName);
+}
+
+function RDFS(localName) {
+	return new RDFSymbol('http://www.w3.org/2000/01/rdf-schema#'+localName);
+}
+
+function WidgetFactory() {
+}
+
+window.onbeforeunload = function () {
+	var overview = "";
+	var unsavedCount = 0;
+	for (var i = 0; i < WidgetFactory.openWidgets.length; i++) {
+		overview += WidgetFactory.openWidgets [i].rdfSymbol+"="+WidgetFactory.openWidgets[i].modified+", ";
+		if (WidgetFactory.openWidgets[i].modified) {
+			unsavedCount++;
+		}
+	}
+	//alert("DEBUG. "+overview);
+	if (unsavedCount > 1) {
+		return "There are "+unsavedCount+" unsaved discobits.";
+	}
+	if (unsavedCount == 1) {
+		return "There is an unsaved discobit.";
+	}
+	return undefined;
+}
+
+WidgetFactory.typeWidgets = new Array();
+
+WidgetFactory.openWidgets = new Array();
+
+
+/**
+ * Creates a new widget
+ * ...
+ * @param {RDFIndexedFormula} lastSavedContent the last saved version of the store, if this is provided the save-link is active in the new widget
+ * @type String
+ */
+WidgetFactory.createBackground = function(terminationListener, rdfSymbol, xhtmlContainer, providedFunctions, store, widgetHolder, lastSavedContent) {
+			// use FireBug extension to inspect console.debug'd objects
+		// Using TestStore you can access store.triples
+		/*if (typeof(console) !=  'undefined') {
+			console.debug('creating '+rdfSymbol+' with WidgetFactory.store',WidgetFactory.store);
+		}*/
+	if (!widgetHolder) {
+		var widgetHolder = new Object();
+		//temporary pseudo-widget, a hack to make rdfSymbol accesible already
+		widgetHolder.widget = new Object();
+		widgetHolder.widget.rdfSymbol = rdfSymbol;
+	}
+	window.setTimeout(function(){
+		WidgetFactory.create(terminationListener, rdfSymbol, xhtmlContainer, providedFunctions, store, widgetHolder, lastSavedContent);
+		
+	}, 0)
+	
+	return widgetHolder;
+}
+WidgetFactory.create = function(terminationListener, rdfSymbol, xhtmlContainer, providedFunctions, store, widgetHolder, lastSavedContent) {
+	//alert("creating widget");
+	//private functions
+	if (!widgetHolder) {
+			var widgetHolder = new Object();
+	}
+	var fillController = function(functions, container) {
+		while (container.firstChild) {
+			container.removeChild(container.firstChild);
+		}
+		for (var i = 0; i < functions.length; i++) {
+			var controlFunction = functions[i];
+			var functionLinkElement = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
+			if (controlFunction.icon) {
+				var functIcon = document.createElementNS("http://www.w3.org/1999/xhtml", "img");
+				functionLinkElement.appendChild(functIcon);
+				functIcon.src = controlFunction.icon;
+				functIcon.alt = controlFunction.label;
+			} else {
+				functionLinkElement.appendChild(document.createTextNode(controlFunction.label));			
+				
+			}
+			functionLinkElement.href = "#";
+			container.appendChild(functionLinkElement);
+			
+			functionLinkElement.onclick = WidgetFactory.createOnClickFromPerform(controlFunction.perform);
+			container.appendChild(document.createTextNode(" "));
+		}
+	}
+	
+	var getGenericControls = function() {
+		var controlFunctions = new Array();
+		var RDFControl = new Object();
+	   	RDFControl.label = "RDF"
+	   	RDFControl.perform = function() {
+	   		mozile.edit.disable();
+		   	var div = document.createElementNS(xhtmlNS, "div");
+			var textarea = document.createElementNS(xhtmlNS, "textarea");
+			div.appendChild(textarea);
+			var useButton = document.createElementNS(xhtmlNS, "button");
+			useButton.appendChild(document.createTextNode("use"));
+			div.appendChild(useButton);
+			var discardButton = document.createElementNS(xhtmlNS, "button");
+			discardButton.appendChild(document.createTextNode("discard"));
+			div.appendChild(discardButton);
+			var body = document.getElementsByTagNameNS(xhtmlNS,"body")[0];
+			div.className = "sourceEdit";
+			textarea.appendChild(document.createTextNode(new XMLSerializer().serializeToString(RDFXMLSerializer.serialize(widgetHolder.widget.getStore(), ""))));
+	   		body.appendChild(div);
+	   		useButton.onclick = function() {
+	   			var editedStore = new RDFIndexedFormula();
+	   			var nodeTree = (new DOMParser()).parseFromString(textarea.value, 'text/xml');
+	   			var docElem = nodeTree.documentElement;
+	   			if (docElem.namespaceURI == 'http://www.mozilla.org/newlayout/xml/parsererror.xml') {
+	   				alert(new XMLSerializer().serializeToString(docElem.firstChild));
+	   				return;
+	   			}
+	   			var parser = new RDFParser(editedStore);
+	   			parser.parse(nodeTree,rdfSymbol.uri);
+				while (xhtmlContainer.firstChild) {
+					xhtmlContainer.removeChild(xhtmlContainer.firstChild);
+				}
+				widgetHolder.widget.remove();
+				WidgetFactory.create(function() {
+					body.removeChild(div);
+					mozile.edit.enable();
+				}, rdfSymbol, xhtmlContainer, providedFunctions, editedStore, widgetHolder, widgetHolder.widget.lastSavedContent);
+					   		}
+	   		discardButton.onclick = function() {
+				body.removeChild(div);
+				mozile.edit.enable();
+	   		}
+   		}
+   		controlFunctions[controlFunctions.length] = RDFControl;
+   		
+   		/* control to view RDF to be revoked
+   		var revRDFControl = new Object();
+	   	revRDFControl.label = "REVRDF"
+	   	revRDFControl.perform = function() {
+	   	
+	   		alert(new XMLSerializer().serializeToString(RDFXMLSerializer.serialize(widget.lastSavedContent, "")));
+   		}
+   		controlFunctions[controlFunctions.length] = revRDFControl;
+   		*/
+   		var uriControl = new Object();
+	   	uriControl.label = "URI"
+	   	uriControl.perform = function() {
+	   		alert(rdfSymbol.uri);
+   		}
+   		controlFunctions[controlFunctions.length] = uriControl;
+   		
+   		var reloadControl = new Object();
+	   	reloadControl.label = "RELOAD"
+	   	reloadControl.perform = function() {
+			var reloadedStore = new RDFIndexedFormula();
+			WidgetFactory.load(rdfSymbol, reloadedStore, function() {
+				while (xhtmlContainer.firstChild) {
+					xhtmlContainer.removeChild(xhtmlContainer.firstChild);
+				}
+				widgetHolder.widget.remove();
+				var body = document.getElementsByTagNameNS(xhtmlNS,"body")[0];
+				var origCursor = body.style.cursor;
+				body.style.cursor = 'progress';
+				WidgetFactory.create(function() {
+					body.style.cursor = origCursor;
+				},rdfSymbol, xhtmlContainer, providedFunctions, reloadedStore, widgetHolder);
+			});
+
+   		}
+   		controlFunctions[controlFunctions.length] = reloadControl;
+   		
+	 	return controlFunctions;
+	}
+	
+	
+	xhtmlContainer.style.border = "dashed";
+	xhtmlContainer.style.borderWidth = "1px 1px 0px 0px";
+	
+	var saveLink = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
+	saveLink.style.visibility ="hidden";
+	//saveLink.appendChild(document.createTextNode("Save"));
+	var saveIcon = document.createElementNS("http://www.w3.org/1999/xhtml", "img");
+	saveLink.appendChild(saveIcon);
+	saveIcon.src = WidgetFactory.root+"mozile/images/silk/page_save.png";
+	;
+	saveLink.onclick = function() {
+		widgetHolder.widget.save();
+	}
+	var controlArea = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
+	controlArea.className = "controlArea";
+	
+	//order: genericControls, widgetControls, contextControls, save
+	var genericFunctionContainer = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
+	controlArea.appendChild(genericFunctionContainer);
+	var widgetFunctionContainer = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
+	controlArea.appendChild(widgetFunctionContainer);
+	var contextFunctionContainer = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
+	controlArea.appendChild(contextFunctionContainer);
+	xhtmlContainer.appendChild(controlArea);
+	controlArea.appendChild(saveLink);
+	
+	fillController(getGenericControls(), genericFunctionContainer);
+	
+	var fillContextControler = function(contextFunctions) {
+		fillController(contextFunctions, contextFunctionContainer);
+	}
+
+	if (providedFunctions) {
+		fillContextControler(providedFunctions);
+	}
+		
+	var typeWidget = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
+	typeWidget.className = "typeWidget";
+	xhtmlContainer.appendChild(typeWidget);
+	
+	
+	var afterLoading = function() {
+		//	alert("hasType "+WidgetFactory.hasType(rdfSymbol, new RDFSymbol("http://discobits.org/ontology#XHTMLInfoDiscoBit")));
+		
+		widgetHolder.widget = null;
+		
+		var controller = new Object();
+		controller.modifiedStateChanged = function(newState, widget) {
+			if (newState) {
+				saveLink.style.visibility ="";
+				widget.modified = true;
+			} else {
+				saveLink.style.visibility ="hidden";
+				widget.modified = false;
+			}
+		}
+		
+		for (var i = 0; i < WidgetFactory.typeWidgets.length; i++) {
+			if (WidgetFactory.hasType(rdfSymbol, WidgetFactory.typeWidgets[i].type, store)) {
+				widgetHolder.widget = new WidgetFactory.typeWidgets[i](store, rdfSymbol, typeWidget, controller, function(widget) {
+					WidgetFactory.openWidgets.push(widget);
+					if(terminationListener) {
+						window.setTimeout(function(){
+							terminationListener(widgetHolder);
+						}, 0);
+					}
+				});
+				break;
+			}
+		}
+	
+		if (widgetHolder.widget == null) {
+			//throw new Error(rdfSymbol+" no good");
+			widgetHolder.widget = new TypeSelectionWidget(rdfSymbol, typeWidget, xhtmlContainer, providedFunctions);
+			if(terminationListener) {
+				terminationListener(widgetHolder);
+			}
+		}
+	
+		widgetHolder.widget.remove = function() {
+			var newOpenWidgets = new Array();
+			for (var i = 0; i < WidgetFactory.openWidgets.length; i++) {
+				if (WidgetFactory.openWidgets[i] != widgetHolder.widget) {
+					newOpenWidgets.push(WidgetFactory.openWidgets[i]);
+				}
+			}
+			WidgetFactory.openWidgets = newOpenWidgets;
+			if (this.removeChildWidgets) {
+				this.removeChildWidgets();
+			}
+		}
+		 
+	
+		if (widgetHolder.widget.getWidgetControls) {
+			fillController(widgetHolder.widget.getWidgetControls(), widgetFunctionContainer);
+		}
+		widgetHolder.widget.fillContextControler = fillContextControler;
+		widgetHolder.widget.xhtmlContainer = xhtmlContainer
+		widgetHolder.widget.rdfSymbol = rdfSymbol;
+		widgetHolder.widget.controller = controller;
+		if (lastSavedContent) {
+			widgetHolder.widget.lastSavedContent = lastSavedContent;
+			widgetHolder.widget.controller.modifiedStateChanged(true, widgetHolder.widget);
+		} else {
+			if (widgetHolder.widget.getStore) {
+				widgetHolder.widget.lastSavedContent = widgetHolder.widget.getStore();
+			}
+		}
+		if (widgetHolder.widget.getStore) {
+			widgetHolder.widget.save = function() {
+				var widgetStore = widgetHolder.widget.getStore();
+				WidgetFactory.putData(widgetHolder.widget.rdfSymbol, widgetStore, widgetHolder.widget.lastSavedContent);
+				widgetHolder.widget.lastSavedContent = widgetStore;
+				widgetHolder.widget.controller.modifiedStateChanged(false, widgetHolder.widget);
+			}
+		}
+		//alert(new XMLSerializer().serializeToString(RDFXMLSerializer.serialize(widget.getStore(), rdfSymbol.uri)));
+		
+		
+	}
+	
+	if (!store) {
+		var store = WidgetFactory.store;
+		WidgetFactory.ensureDicoBitLoaded(rdfSymbol, function() {
+			store = WidgetFactory.store;
+			afterLoading();
+		});
+	} else {
+		afterLoading();
+	}
+
+}
+
+WidgetFactory.createOnClickFromPerform = function(perform) {
+	return function() {
+		perform();
+		return false;
+	}
+}
+
+TypeSelectionWidget = function(rdfSymbol, typeWidget, xhtmlContainer, providedFunctions) {
+	var select = document.createElementNS("http://www.w3.org/1999/xhtml", "select");
+	typeWidget.appendChild(select);
+	var selectText = "--- select type ----";
+	var option = document.createElementNS("http://www.w3.org/1999/xhtml", "option");
+		select.appendChild(option);
+		option.appendChild(document.createTextNode(selectText));
+	for (var i = 0; i < WidgetFactory.typeWidgets.length; i++) {
+		var option = document.createElementNS("http://www.w3.org/1999/xhtml", "option");
+		select.appendChild(option);
+		option.value = WidgetFactory.typeWidgets[i].type.uri;
+		var label;
+		if (WidgetFactory.typeWidgets[i].description) {
+			label = WidgetFactory.typeWidgets[i].description;
+		} else {
+			label = WidgetFactory.typeWidgets[i].type.uri
+		}
+		option.appendChild(document.createTextNode(label));
+	}
+	var button = document.createElementNS("http://www.w3.org/1999/xhtml", "button");
+	button.appendChild(document.createTextNode("set"));
+	button.disabled = true;
+	typeWidget.appendChild(button);
+	select.onchange = function() {
+		button.disabled = (this.value == selectText);
+	};
+	button.onclick = function() {
+		WidgetFactory.store.add(rdfSymbol, 
+			new RDFSymbol('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), 
+			new RDFSymbol(select.value));
+		while (xhtmlContainer.firstChild) {
+			xhtmlContainer.removeChild(xhtmlContainer.firstChild);
+		}
+		WidgetFactory.create(function() {}, rdfSymbol, xhtmlContainer, providedFunctions, undefined, undefined, new RDFIndexedFormula());
+		//alert(select.value);
+	};
+}
+
+
+//mozile.debug.logLevel = "debug";
+
+{
+	var found = false;
+	for(var i=0; i < mozile.edit.commands._commands.length; i++) {
+		if(mozile.edit.commands._commands[i] == mozile.edit.save);
+		//delete(mozile.edit.commands._commands[i]);
+		found = true;
+		if (found) {
+			mozile.edit.commands._commands[i] = mozile.edit.commands._commands[i+1];
+		}
+	}
+	mozile.edit.commands._commands.pop();
+}
+
+	
+function XHTMLInfoDiscoBitWidget(store, rdfSymbol, xhtmlContainer, controller, terminationListener) {
+	// Configure Mozile Basics
+	if (!XHTMLInfoDiscoBitWidget.mozileInitialized) {
+		mozile.root = WidgetFactory.root+"mozile/";
+		mozile.useSchema("lib/xhtml.rng");
+		XHTMLInfoDiscoBitWidget.mozileInitialized = true;
+	}
+	this.rdfSymbol = rdfSymbol;
+	this.controller = controller;
+	this.xhtmlContainer = xhtmlContainer;
+	this.origStore = store;
+	this.loadData(store);
+	terminationListener(this);
+}
+
+WidgetFactory.typeWidgets.push(XHTMLInfoDiscoBitWidget);
+
+XHTMLInfoDiscoBitWidget.type = new RDFSymbol("http://discobits.org/ontology#XHTMLInfoDiscoBit");
+
+
+XHTMLInfoDiscoBitWidget.prototype.getWidgetControls = function() {
+	var controlFunctions = new Array();
+	var RDFControl = new Object();
+   	RDFControl.label = "XHTML"
+   	var widget = this;
+   	RDFControl.perform = function() {
+   		mozile.edit.disable();
+	   	var div = document.createElementNS(xhtmlNS, "div");
+		var textarea = document.createElementNS(xhtmlNS, "textarea");
+		div.appendChild(textarea);
+		var useButton = document.createElementNS(xhtmlNS, "button");
+		useButton.appendChild(document.createTextNode("use"));
+		div.appendChild(useButton);
+		var discardButton = document.createElementNS(xhtmlNS, "button");
+		discardButton.appendChild(document.createTextNode("discard"));
+		div.appendChild(discardButton);
+		var body = document.getElementsByTagNameNS(xhtmlNS,"body")[0];
+		div.className = "sourceEdit";
+		var serialized = "";
+		for (var i = 0; i < widget.editableArea.childNodes.length; i++) {
+			serialized += new XMLSerializer().serializeToString(widget.editableArea.childNodes[i]);
+		}
+		textarea.appendChild(document.createTextNode(serialized));
+   		body.appendChild(div);
+   		useButton.onclick = function() {
+   			var editedStore = new RDFIndexedFormula();
+   			var nodeTree = (new DOMParser()).parseFromString("<elem xmlns=\"http://www.w3.org/1999/xhtml\">"+textarea.value+"</elem>", 'text/xml');
+   			var docElem = nodeTree.documentElement;
+   			if (docElem.namespaceURI == 'http://www.mozilla.org/newlayout/xml/parsererror.xml') {
+   				alert(new XMLSerializer().serializeToString(docElem.firstChild));
+   				return;
+   			}
+   			widget.remove();
+   			while (widget.editableArea.firstChild) {
+	   			widget.editableArea.removeChild(widget.editableArea.firstChild);
+   			}
+   			for (var i = 0; i < nodeTree.documentElement.childNodes.length; i++) {
+				widget.editableArea.appendChild(nodeTree.documentElement.childNodes[i].cloneNode(true));
+			}
+			widget.controller.modifiedStateChanged(true, widget);
+   			body.removeChild(div);
+			mozile.edit.enable();
+   		}
+   		discardButton.onclick = function() {
+			body.removeChild(div);
+			mozile.edit.enable();
+   		}
+  		}
+  		controlFunctions[controlFunctions.length] = RDFControl;
+  		return controlFunctions;
+}   		
+
+XHTMLInfoDiscoBitWidget.prototype.loadData = function(store) {
+	var infobitProperty = store.anyStatementMatching(this.rdfSymbol, new RDFSymbol("http://discobits.org/ontology#infoBit"), undefined);
+	if (infobitProperty) {
+		var objectElement = infobitProperty.object.elementValue;
+	} else {
+		var objectElement = document.createElementNS("http://discobits.org/ontology#","infoBit");
+		objectElement.appendChild(document.createTextNode("empty"));
+	}
+	//var editableParagraph = document.createElementNS("http://www.w3.org/1999/xhtml", "p");
+	//xhtmlContainer.appendChild(editableParagraph);
+	WidgetFactory.appendChildrenInDiv(objectElement, this.xhtmlContainer);
+	this.editableArea = this.xhtmlContainer.childNodes[0];
+	mozile.editElement(this.editableArea);
+	var controller = this.controller;
+	var widget = this;
+	var modifiedTrue = function() {
+		controller.modifiedStateChanged(true, widget);
+	}
+	this.editableArea.addEventListener("change", modifiedTrue, false);
+}
+
+XHTMLInfoDiscoBitWidget.prototype.getStore = function() {
+	var store = new RDFIndexedFormula();
+	store.add(this.rdfSymbol, new RDFSymbol("http://discobits.org/ontology#infoBit"), new RDFLiteral(this.editableArea));
+	store.add(this.rdfSymbol, 
+		new RDFSymbol('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), 
+		new RDFSymbol("http://discobits.org/ontology#XHTMLInfoDiscoBit"));
+	var origStatements = this.origStore.statements
+	for (var i=0; i<origStatements.length; i++) {
+        var statement = origStatements[i];
+		if (statement.subject.uri == this.rdfSymbol.uri) {
+			if (!(statement.predicate.uri == "http://discobits.org/ontology#infoBit")) {
+				store.add(statement.subject, statement.predicate, statement.object)
+			}
+		}
+    }
+	return store;
+}
+
+
+
+
+
+function OrderedContentWidget(store, rdfSymbol, xhtmlContainer, controller, terminationListener) {
+	this.controller = controller;
+	this.rdfSymbol = rdfSymbol;
+	this.origStore = store;
+	this.load(store, rdfSymbol, xhtmlContainer, terminationListener);	
+}
+
+
+
+OrderedContentWidget.prototype.load = function(store, rdfSymbol, xhtmlContainer, terminationListener) {
+   
+    var containsStatements = store.statementsMatching(rdfSymbol, new RDFSymbol("http://discobits.org/ontology#contains"), undefined);
+    this.childElemContainer = document.createElementNS("http://www.w3.org/1999/xhtml", "ol");
+    this.childElemContainer.className = this.getChildElemContainerClassName();
+    
+    var children = new Array();//the rdfSymbolS of the children, will accessible by childWidgets[i].rdfSymbol
+    var thisWidget = this;
+    for(var i=0;i<containsStatements.length;i++) {
+        var entry = containsStatements[i].object;
+        var pos = store.statementsMatching(entry, new RDFSymbol("http://discobits.org/ontology#pos"), undefined);
+        var holdsStatements = store.statementsMatching(entry, new RDFSymbol("http://discobits.org/ontology#holds"), undefined);
+        children[pos[0].object] = holdsStatements[0].object; 
+    }
+	var elementsToAdd = children.length;
+	if (elementsToAdd == 0) {
+    	window.setTimeout(function() {terminationListener(thisWidget);}, 0);
+    }
+    this.childWidgets = new Array(children.length);
+    for(var j=0;j<children.length;j++) {  
+    	this.addChild(children[j], j, undefined, function() {
+    		elementsToAdd--;
+    		if (elementsToAdd == 0) {
+    			terminationListener(thisWidget);
+    		}
+    	});    	
+    }
+    xhtmlContainer.appendChild(this.childElemContainer);
+}
+
+OrderedContentWidget.type = new RDFSymbol("http://discobits.org/ontology#OrderedContent");
+
+WidgetFactory.typeWidgets.push(OrderedContentWidget);
+
+OrderedContentWidget.prototype.addChild = function(child, pos, lastSavedStore, terminationListener) {
+   	var li = document.createElementNS("http://www.w3.org/1999/xhtml", "li");
+   	var div = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
+   	this.positionHandling(pos, div);
+   	var controlFunctions = this.getControlFunctions(li, pos);
+   	this.childElemContainer.appendChild(li);
+   	li.appendChild(div);
+   	this.childWidgets[pos] = WidgetFactory.createBackground(terminationListener, child, div, controlFunctions, undefined, undefined, lastSavedStore);
+}
+
+OrderedContentWidget.prototype.removeChildWidgets = function() {
+	for (var i = 0; i < this.childWidgets.length; i++) {
+		this.childWidgets[i].widget.remove();
+	}
+}
+
+OrderedContentWidget.prototype.getWidgetControls = function() {
+	var controlFunctions = new Array();
+	var moveUpControl = new Object();
+   	moveUpControl.label = "ADD";
+   	var orderedContentWidget = this;
+   	moveUpControl.perform = function() {
+   		var baseURI = orderedContentWidget.rdfSymbol.uri;
+   		if (!baseURI.match(/\/$/)) {
+   			baseURI += "-el/";
+   		}
+   		var childRDFSymbol = new RDFSymbol(baseURI+orderedContentWidget.childWidgets.length);
+   		orderedContentWidget.addChild(childRDFSymbol, orderedContentWidget.childWidgets.length); 
+   		orderedContentWidget.controller.modifiedStateChanged(true, orderedContentWidget);
+   	}
+   	controlFunctions[controlFunctions.length] = moveUpControl;
+	return controlFunctions;
+}
+OrderedContentWidget.prototype.getControlFunctions = function(li, pos) {
+	var controlFunctions = new Array();
+	var childWidgets = this.childWidgets;
+	var containerWidget = this;
+	
+	if (pos > 0) {
+	   	var moveUpControl = new Object();
+	   	moveUpControl.label = "UP";
+	   	moveUpControl.perform = function() {
+	   		if (!li.previousSibling) {
+	   			alert("no previous element");
+	   			return;
+	   		}
+	   		var previousLiElem = li.previousSibling;
+	   		var ulElem = li.parentNode;
+	   		ulElem.removeChild(li);
+	   		ulElem.insertBefore(li, previousLiElem);
+	   		var previousWidget = childWidgets[pos -1];
+	   		childWidgets[pos -1] = childWidgets[pos];
+	   		childWidgets[pos] = previousWidget;
+	   		for (var i = 0; i < childWidgets.length; i++) {
+	   			childWidgets[i].widget.fillContextControler(containerWidget.getControlFunctions(ulElem.childNodes[i], i));
+	   		}
+	   		containerWidget.controller.modifiedStateChanged(true, containerWidget);
+	   	}
+	   	controlFunctions[controlFunctions.length] = moveUpControl;
+	   	
+   	}
+   	if (pos < (this.childWidgets.length -1)) {
+	   	var moveDownControl = new Object();
+	   	moveDownControl.label = "DOWN";
+	   	moveDownControl.perform = function() {
+	   		if (!li.nextSibling) {
+	   			alert("no next element");
+	   			return;
+	   		}
+	   		var nextLiElem = li.nextSibling;
+	   		var ulElem = li.parentNode;
+	   		ulElem.removeChild(nextLiElem);
+	   		ulElem.insertBefore(nextLiElem, li);
+	   		var nextWidget = childWidgets[pos +1];
+	   		childWidgets[pos +1] = childWidgets[pos];
+	   		childWidgets[pos] = nextWidget;
+	   		for (var i = 0; i < childWidgets.length; i++) {
+	   			childWidgets[i].widget.fillContextControler(containerWidget.getControlFunctions(ulElem.childNodes[i], i));
+	   		}
+	   		containerWidget.controller.modifiedStateChanged(true, containerWidget);
+	   	}
+	   	controlFunctions[controlFunctions.length] = moveDownControl;
+   	}
+   	
+   	
+   	var removeControl = new Object();
+   	removeControl.label = "REMOVE"
+   	removeControl.perform = function() {
+   		var ulElem = li.parentNode;
+   		ulElem.removeChild(li);
+   		containerWidget.controller.modifiedStateChanged(true, containerWidget);
+   		var j = 0;
+   		for (var i = 0; i < childWidgets.length; i++) {
+   			if (i != pos) {
+	   			childWidgets[j] = childWidgets[i];
+	   			j++;
+	   		} else {
+	   			//alert("DEBUG: removing "+childWidgets[i].widget.rdfSymbol);
+	   			childWidgets[i].widget.remove();
+	   		}
+	   	}
+	   	childWidgets.length = childWidgets.length-1;
+	   	for (var i = 0; i < childWidgets.length; i++) {
+		   	childWidgets[i].widget.fillContextControler(containerWidget.getControlFunctions(ulElem.childNodes[i], i));
+		}
+   	}
+   	controlFunctions[controlFunctions.length] = removeControl;
+   	
+   	return controlFunctions;
+}
+
+OrderedContentWidget.prototype.getChildElemContainerClassName = function() {
+	return "orderedContent";
+}
+
+OrderedContentWidget.prototype.positionHandling = function(pos, div) {
+	//div.appendChild(document.createTextNode("regular: "));
+}
+OrderedContentWidget.prototype.getStore = function() {
+	var store = new RDFIndexedFormula();
+	store.add(this.rdfSymbol, 
+		new RDFSymbol('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), 
+		new RDFSymbol('http://discobits.org/ontology#OrderedContent'));
+	for (var i = 0; i < this.childWidgets.length; i++) {
+		var entry = this.getEntryForChild(store, i);
+		store.add(this.rdfSymbol,  
+		new RDFSymbol('http://discobits.org/ontology#contains'),
+		entry);
+	}
+	var origStatements = this.origStore.statements
+	for (i=0; i<origStatements.length; i++) {
+        var statement = origStatements[i];
+		if (statement.subject.uri == this.rdfSymbol.uri) {
+			if (!(statement.predicate.uri == "http://discobits.org/ontology#contains")) {
+				store.add(statement.subject, statement.predicate, statement.object)
+			}
+		}
+    }
+	return store;
+}
+
+OrderedContentWidget.prototype.getEntryForChild = function(store, entryPos) {
+	var result = new RDFBlankNode();
+	store.add(result, 
+		new RDFSymbol('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), 
+		new RDFSymbol('http://discobits.org/ontology#Entry'));
+	store.add(result,  
+		new RDFSymbol('http://discobits.org/ontology#pos'),
+		new RDFLiteral(entryPos));
+	store.add(result,  
+		new RDFSymbol('http://discobits.org/ontology#holds'),
+		this.childWidgets[entryPos].widget.rdfSymbol);
+	return result;
+}
+
+
+function TitledContentWidget(store, rdfSymbol, xhtmlContainer, controller, terminationListener) {
+	var containsStatements = store.statementsMatching(rdfSymbol, new RDFSymbol("http://discobits.org/ontology#contains"), undefined);
+    this.childElemContainer = document.createElementNS("http://www.w3.org/1999/xhtml", "ol");
+    this.childElemContainer.className = this.getChildElemContainerClassName();
+	this.origStore = store
+    var titledContentWidget = this;
+    var elementsToAdd = 2;
+    var subTerminationListener = function() {
+    	elementsToAdd--;
+    	if (elementsToAdd == 0) {
+    		terminationListener(titledContentWidget);
+    	}
+    }
+    
+    if (containsStatements.length != 2) {
+    	this.childWidgets = new Array(2);
+    	var baseURI = rdfSymbol.uri;
+   		if (!baseURI.match(/\/$/)) {
+   			baseURI += "-";
+   		}
+   		
+   		var titleURI = baseURI + "title";
+   		var titleRDFSymbol = new RDFSymbol(titleURI);
+   		WidgetFactory.store.add(titleRDFSymbol,  RDF("type"), XHTMLInfoDiscoBitWidget.type);
+		this.addChild(titleRDFSymbol, 0, new RDFIndexedFormula(), function(widgetHolder) {
+			widgetHolder.widget.controller.modifiedStateChanged(true, widgetHolder.widget);
+			//titledContentWidget.childWidgets[0].widget.controller.modifiedStateChanged(true);
+			subTerminationListener();
+		});    		
+   		var contentURI = baseURI + "content";
+   		var contentRDFSymbol = new RDFSymbol(contentURI);
+		this.addChild(contentRDFSymbol, 1, undefined, subTerminationListener); 
+   		controller.modifiedStateChanged(true, this);
+   		
+   		xhtmlContainer.appendChild(this.childElemContainer);
+    } else {
+		this.load(store, rdfSymbol, xhtmlContainer, terminationListener);
+	}
+
+	
+}
+
+TitledContentWidget.type = new RDFSymbol("http://discobits.org/ontology#TitledContent");
+
+WidgetFactory.typeWidgets.push(TitledContentWidget);
+
+TitledContentWidget.prototype.load = OrderedContentWidget.prototype.load;
+TitledContentWidget.prototype.addChild = OrderedContentWidget.prototype.addChild;
+TitledContentWidget.prototype.getEntryForChild = OrderedContentWidget.prototype.getEntryForChild;
+TitledContentWidget.prototype.removeChildWidgets = OrderedContentWidget.prototype.removeChildWidgets;
+
+TitledContentWidget.prototype.getControlFunctions = function(li, pos) {
+	controlFunctions = new Array();
+	return controlFunctions;
+}
+
+TitledContentWidget.prototype.getChildElemContainerClassName = function() {
+	return "titledContent";
+}
+
+TitledContentWidget.prototype.positionHandling = function(pos, div) {
+	if (pos == 0) {
+		WidgetFactory.addClass(div, "title");
+	}
+	
+	if (pos == 1) {
+		WidgetFactory.addClass(div, "content");
+	}
+}
+
+TitledContentWidget.prototype.getStore = function() {
+	var store = new RDFIndexedFormula();
+	store.add(this.rdfSymbol, 
+		new RDFSymbol('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), 
+		new RDFSymbol('http://discobits.org/ontology#TitledContent'));
+	for (var i = 0; i < this.childWidgets.length; i++) {
+		var entry = this.getEntryForChild(store, i);
+		store.add(this.rdfSymbol,  
+		new RDFSymbol('http://discobits.org/ontology#contains'),
+		entry);
+	}
+	var origStatements = this.origStore.statements
+	for (i=0; i<origStatements.length; i++) {
+        var statement = origStatements[i];
+		if (statement.subject.uri == this.rdfSymbol.uri) {
+			if (!(statement.predicate.uri == "http://discobits.org/ontology#contains")) {
+				store.add(statement.subject, statement.predicate, statement.object)
+			}
+		}
+    }
+	return store;
+}
+
+// helpers ////////////
+WidgetFactory.addClass = function(elem, className) {
+	//elem.className += "foo bar ";
+	elem.className += " "+className;
+	
+}
+WidgetFactory.hasType = function(rdfSymbol, type, store) {
+ 	//alert("anyStatementMatching for "+rdfSymbol+WidgetFactory.store.anyStatementMatching(rdfSymbol, undefined, undefined));
+	//return (typeof(WidgetFactory.store.anyStatementMatching(rdfSymbol, undefined, type)) != 'undefined')
+	return (typeof(store.anyStatementMatching(rdfSymbol, new RDFSymbol('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), type)) != 'undefined')
+}
+
+WidgetFactory.appendChildrenInDiv = function(objectElement, xhtmlContainer) {
+		var div = document.createElementNS("http://www.w3.org/1999/xhtml", "p");
+		/*if (typeof(console) !=  'undefined') {
+			console.debug(objectElement);
+		}*/
+		for( var i=0; i< objectElement.childNodes.length; i++ ){
+			/*if (typeof(console) !=  'undefined') {
+				console.debug("adding node "+i+" "+objectElement.childNodes[i]);
+			}*/
+			div.appendChild(objectElement.childNodes[i].cloneNode(true));		
+		}
+		xhtmlContainer.appendChild(div);	
+	}
+WidgetFactory.putData = function(rdfSymbol, store, previousStore, noContainerCreation) {
+	var url = rdfSymbol.uri;
+	var xhr = Util.XMLHTTPFactory();
+	
+	xhr.open("PUT", url, false);
+	xhr.setRequestHeader("Content-Type", "application/rdf+xml");
+	xhr.send(new XMLSerializer().serializeToString(RDFXMLSerializer.serialize(store, rdfSymbol.uri)));
+	/*RFC 2518 says: "A PUT that would result in the creation of a resource without an
+   appropriately scoped parent collection MUST fail with a 409."
+   
+   Apache however sends a 403*/
+	if ((xhr.status == 409) || (xhr.status == 403)) {
+  		//alert("collection does not exist"+xhr.responseText);
+  		if (!noContainerCreation) {
+  			WidgetFactory.createContainingCollection(url);
+  			WidgetFactory.putData(rdfSymbol, store, previousStore, true);
+  		} else {
+  			throw new Error(xhr.responseText);
+  		}
+  	} else {
+	  	if (xhr.status >= 300) {
+	  		alert("server returned failure: "+xhr.responseText);
+	  	}
+	 }
+}
+
+WidgetFactory.createContainingCollection = function(url, noContainerCreation) {
+	if (url == "/") {
+		return;
+	} 
+	var containerURL = url.substring(0, url.lastIndexOf('/',url.length -2)+1);
+	var xhr = Util.XMLHTTPFactory();
+	xhr.open("MKCOL", containerURL, false);
+	xhr.send();
+	if ((xhr.status == 409) || (xhr.status == 403)) {
+  		//alert("collection does not exist"+xhr.responseText);
+  		if (!noContainerCreation) {
+  			WidgetFactory.createContainingCollection(containerURL);
+  			WidgetFactory.createContainingCollection(url, true);
+  		} else {
+  			throw new Error(xhr.responseText);
+  		}
+  	} else {
+	  	if (xhr.status >= 300) {
+	  		alert("server returned failure: "+xhr.responseText);
+	  	}
+  	}
+}
+
+WidgetFactory.ensureDicoBitLoaded = function(rdfSymbol, terminationListener) {
+	if(WidgetFactory.isLoading) {
+		window.setTimeout(function() {
+			WidgetFactory.ensureDicoBitLoaded(rdfSymbol, terminationListener);
+		}, 10);
+	} else {
+		if (typeof(WidgetFactory.store.anyStatementMatching(rdfSymbol)) == 'undefined') {
+			WidgetFactory.isLoading = true;
+			WidgetFactory.store = WidgetFactory.removeContext(rdfSymbol, WidgetFactory.store);
+			WidgetFactory.load(rdfSymbol, WidgetFactory.store, function(store) {
+				WidgetFactory.isLoading = false;
+				terminationListener(store);
+			});
+		} else {
+			terminationListener();
+		}
+	}
+}
+
+WidgetFactory.createURIderefURL = function(uri) {
+	return uri;
+}
+/**
+* returns the context of a resource as an aaray of statements
+*/
+WidgetFactory.getContext = function(rdfSymbol, store, pResult) {
+	if (pResult) {
+		var result = pResult;
+	} else {
+		var result = [ ];
+	}
+	var directedExpander = function(directioner) {
+		for (var i = 0; i < statements.length; i++) {
+			if (result.contains(statements[i])) {
+				continue;
+			}
+			result.push(statements[i]);
+			var other = directioner(statements[i]);
+			if (other.termType == 'bnode') {
+				WidgetFactory.getContext(other, store, result);
+			}
+		}
+	}
+	var statements = store.statementsMatching(rdfSymbol, undefined, undefined);
+	directedExpander(function(statement) {
+		return statement.object;
+	});
+	statements = store.statementsMatching(undefined, undefined, rdfSymbol);
+	directedExpander(function(statement) {
+		return statement.subject;
+	});
+	return result;
+}
+
+WidgetFactory.removeContext = function(rdfSymbol, store) {
+	var result = new RDFIndexedFormula();
+	var blockStatements = WidgetFactory.getContext(rdfSymbol, store);
+	var statements = store.statementsMatching(undefined, undefined, undefined);
+	for (var i = 0; i < statements.length; i++) {
+		if (!blockStatements.contains(statements[i])) {
+			result.statements.push(statements[i]);
+		}
+	}
+	return result;
+}
+
+
+WidgetFactory.load = function(rdfSymbol, pStore, terminationListener) {
+	var store;
+	if (pStore) {
+		store = pStore;
+	} else {
+		store = new RDFIndexedFormula();
+	}
+	var parser = new RDFParser(store);
+	parser.reify = parser.forceRDF = true;
+	// forceRDF isn't used??
+	
+	
+	// var url = 'http://something.or/other';
+	
+	// get the XML
+	var xhr = Util.XMLHTTPFactory(); // returns a new XMLHttpRequest, or ActiveX XMLHTTP object
+	if (xhr.overrideMimeType) {
+	    xhr.overrideMimeType("text/xml");
+	}
+	// the "data/" path and encoding is just how I store files locally
+	xhr.onload = function() {
+		var nodeTree = xhr.responseXML;
+		if (nodeTree === null && xhr.responseText !== null) {
+		    // Only if the server fails to set Content-Type: text/xml AND xmlhttprequest doesn't have the overrideMimeType method
+		    nodeTree = (new DOMParser()).parseFromString(xhr.responseText, 'text/xml');
+		}
+		// must be an XML document node tree
+		parser.parse(nodeTree,rdfSymbol.uri);
+		terminationListener(store);	
+	};
+	xhr.open("GET", WidgetFactory.createURIderefURL(rdfSymbol.uri), true);
+        xhr.setRequestHeader("Accept", "application/rdf+xml");
+	// xhr.open("GET", "data/" + encodeURIComponent(encodeURIComponent(url)), false);
+	xhr.send("");
+	
+	
+}
+WidgetFactory.store = new RDFIndexedFormula();//WidgetFactory.load(document.location.toString().substring(0, document.location.toString().lastIndexOf('/')+1)+'sample1b.rdf');
+
+Array.prototype.contains = function(element) {
+  for(var i = 0; i < this.length; i++) {
+    if (this[i] == element) {
+      return true;
+    }
+  }
+  return false;
+}
+
+
+//////////////////
+
+
+
+

http://git-wip-us.apache.org/repos/asf/clerezza/blob/70220239/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/scripts/tria-disco.js
----------------------------------------------------------------------
diff --git a/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/scripts/tria-disco.js b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/scripts/tria-disco.js
new file mode 100644
index 0000000..7026eca
--- /dev/null
+++ b/platform/content/src/main/resources/org/apache/clerezza/platform/content/staticweb/scripts/tria-disco.js
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+function TriaDisco() {
+	var graphUri = null;
+}
+
+
+TriaDisco.putData = function(rdfSymbol, store, previousStore, noContainerCreation) {
+    var xhr = Util.XMLHTTPFactory();
+    var postUrl = "post";
+	if (TriaDisco.graphUri != null) {
+		postUrl += "?graph="+TriaDisco.graphUri
+	}
+    xhr.open('POST', postUrl, false);
+
+	var assertedRDF = new XMLSerializer().serializeToString(RDFXMLSerializer.serialize(store, ""));
+	var revokedRDF = new XMLSerializer().serializeToString(RDFXMLSerializer.serialize(previousStore, ""));
+	var parameters = "assert="+encodeURIComponent(assertedRDF);
+	parameters += "&revoke="+encodeURIComponent(revokedRDF);
+	xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+	xhr.setRequestHeader("Content-length", parameters.length);
+	//xhr.setRequestHeader("Connection", "close");
+	xhr.send(parameters);
+    if (xhr.status >= 300) {
+        alert(xhr.status+" " +xhr.statusText);
+        throw new Error(xhr.status+" " +xhr.statusText);
+    }
+            
+}
+
+WidgetFactory.createURIderefURL = function(uri) {
+	var getUrl = "get?resource="+uri;
+	if (TriaDisco.graphUri != null) {
+		getUrl += "&graph="+TriaDisco.graphUri
+	}
+	return getUrl;
+}


Mime
View raw message