incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmarga...@apache.org
Subject svn commit: r417618 [5/19] - in /incubator/xap/trunk/src/dojo/src: ./ lfx/ logging/ rpc/ selection/ storage/ string/ text/ undo/ uri/ uuid/ widget/ widget/html/ widget/svg/ widget/templates/ widget/templates/buttons/ widget/templates/images/ widget/tem...
Date Tue, 27 Jun 2006 22:49:06 GMT
Added: incubator/xap/trunk/src/dojo/src/lfx/html.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lfx/html.js?rev=417618&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lfx/html.js (added)
+++ incubator/xap/trunk/src/dojo/src/lfx/html.js Tue Jun 27 15:48:54 2006
@@ -0,0 +1,472 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.lfx.html");
+dojo.require("dojo.lfx.Animation");
+
+dojo.require("dojo.html");
+dojo.require("dojo.event");
+dojo.require("dojo.lang.func");
+
+dojo.lfx.html._byId = function(nodes){
+	if(dojo.lang.isArrayLike(nodes)){
+		if(!nodes.alreadyChecked){
+			var n = [];
+			dojo.lang.forEach(nodes, function(node){
+				n.push(dojo.byId(node));
+			});
+			n.alreadyChecked = true;
+			return n;
+		}else{
+			return nodes;
+		}
+	}else{
+		return [dojo.byId(nodes)];
+	}
+}
+
+dojo.lfx.html.propertyAnimation = function(	/*DOMNode*/ nodes, 
+											/*Array*/ propertyMap, 
+											/*int*/ duration,
+											/*function*/ easing){
+	nodes = dojo.lfx.html._byId(nodes);
+
+	if(nodes.length==1){
+		// FIXME: we're only supporting start-value filling when one node is
+		// passed
+
+		dojo.lang.forEach(propertyMap, function(prop){
+			if(typeof prop["start"] == "undefined"){
+				prop.start = parseInt(dojo.style.getComputedStyle(nodes[0], prop.property));
+				if(isNaN(prop.start) && (prop.property == "opacity")){
+					prop.start = 1;
+				}
+			}
+		});
+	}
+
+	var coordsAsInts = function(coords){
+		var cints = new Array(coords.length);
+		for(var i = 0; i < coords.length; i++){
+			cints[i] = Math.round(coords[i]);
+		}
+		return cints;
+	}
+	var setStyle = function(n, style){
+		n = dojo.byId(n);
+		if(!n || !n.style){ return; }
+		for(s in style){
+			if(s == "opacity"){
+				dojo.style.setOpacity(n, style[s]);
+			}else{
+				n.style[dojo.style.toCamelCase(s)] = style[s];
+			}
+		}
+	}
+	var propLine = function(properties){
+		this._properties = properties;
+		this.diffs = new Array(properties.length);
+		dojo.lang.forEach(properties, function(prop, i){
+			// calculate the end - start to optimize a bit
+			if(dojo.lang.isArray(prop.start)){
+				// don't loop through the arrays
+				this.diffs[i] = null;
+			}else{
+				this.diffs[i] = prop.end - prop.start;
+			}
+		}, this);
+		this.getValue = function(n){
+			var ret = {};
+			dojo.lang.forEach(this._properties, function(prop, i){
+				var value = null;
+				if(dojo.lang.isArray(prop.start)){
+					value = (prop.units||"rgb") + "(";
+					for(var j = 0 ; j < prop.start.length ; j++){
+						value += Math.round(((prop.end[j] - prop.start[j]) * n) + prop.start[j]) + (j < prop.start.length - 1 ? "," : "");
+					}
+					value += ")";
+				}else{
+					value = ((this.diffs[i]) * n) + prop.start + (prop.property != "opacity" ? prop.units||"px" : "");
+				}
+				ret[prop.property] = value;
+			}, this);
+			return ret;
+		}
+	}
+	
+	var anim = new dojo.lfx.Animation(duration, new propLine(propertyMap), easing);
+	
+	dojo.event.connect(anim, "onAnimate", function(propValues){
+		dojo.lang.forEach(nodes, function(node){
+			setStyle(node, propValues); 
+		});
+	});
+	
+	return anim;
+}
+
+dojo.lfx.html._makeFadeable = function(nodes){
+	var makeFade = function(node){
+		if(dojo.render.html.ie){
+			// only set the zoom if the "tickle" value would be the same as the
+			// default
+			if( (node.style.zoom.length == 0) &&
+				(dojo.style.getStyle(node, "zoom") == "normal") ){
+				// make sure the node "hasLayout"
+				// NOTE: this has been tested with larger and smaller user-set text
+				// sizes and works fine
+				node.style.zoom = "1";
+				// node.style.zoom = "normal";
+			}
+			// don't set the width to auto if it didn't already cascade that way.
+			// We don't want to f anyones designs
+			if(	(node.style.width.length == 0) &&
+				(dojo.style.getStyle(node, "width") == "auto") ){
+				node.style.width = "auto";
+			}
+		}
+	}
+	if(dojo.lang.isArrayLike(nodes)){
+		dojo.lang.forEach(nodes, makeFade);
+	}else{
+		makeFade(nodes);
+	}
+}
+
+dojo.lfx.html.fadeIn = function(nodes, duration, easing, callback){
+	nodes = dojo.lfx.html._byId(nodes);
+	dojo.lfx.html._makeFadeable(nodes);
+	var anim = dojo.lfx.propertyAnimation(nodes, [
+		{	property: "opacity",
+			start: dojo.style.getOpacity(nodes[0]),
+			end: 1 } ], duration, easing);
+	if(callback){
+		dojo.event.connect(anim, "onEnd", function(){
+			callback(nodes, anim);
+		});
+	}
+
+	return anim;
+}
+
+dojo.lfx.html.fadeOut = function(nodes, duration, easing, callback){
+	nodes = dojo.lfx.html._byId(nodes);
+	dojo.lfx.html._makeFadeable(nodes);
+	var anim = dojo.lfx.propertyAnimation(nodes, [
+		{	property: "opacity",
+			start: dojo.style.getOpacity(nodes[0]),
+			end: 0 } ], duration, easing);
+	if(callback){
+		dojo.event.connect(anim, "onEnd", function(){
+			callback(nodes, anim);
+		});
+	}
+
+	return anim;
+}
+
+dojo.lfx.html.fadeShow = function(nodes, duration, easing, callback){
+	var anim = dojo.lfx.html.fadeIn(nodes, duration, easing, callback);
+	dojo.event.connect(anim, "beforeBegin", function(){
+		if(dojo.lang.isArrayLike(nodes)){
+			dojo.lang.forEach(nodes, dojo.style.show);
+		}else{
+			dojo.style.show(nodes);
+		}
+	});
+	
+	return anim;
+}
+
+dojo.lfx.html.fadeHide = function(nodes, duration, easing, callback){
+	var anim = dojo.lfx.html.fadeOut(nodes, duration, easing, function(){
+		if(dojo.lang.isArrayLike(nodes)){
+			dojo.lang.forEach(nodes, dojo.style.hide);
+		}else{
+			dojo.style.hide(nodes);
+		}
+		if(callback){ callback(nodes, anim); }
+	});
+	
+	return anim;
+}
+
+dojo.lfx.html.wipeIn = function(nodes, duration, easing, callback){
+	nodes = dojo.lfx.html._byId(nodes);
+	var anims = [];
+
+	var init = function(node, overflow){
+		if(overflow == "visible") {
+			node.style.overflow = "hidden";
+		}
+		dojo.style.show(node);
+		node.style.height = 0;
+	}
+
+	dojo.lang.forEach(nodes, function(node){
+		var overflow = dojo.style.getStyle(node, "overflow");
+		var initialize = function(){
+			init(node, overflow);
+		}
+		initialize();
+		
+		var anim = dojo.lfx.propertyAnimation(node,
+			[{	property: "height",
+				start: 0,
+				end: node.scrollHeight }], duration, easing);
+		
+		dojo.event.connect(anim, "beforeBegin", initialize);
+		dojo.event.connect(anim, "onEnd", function(){
+			node.style.overflow = overflow;
+			node.style.height = "auto";
+			if(callback){ callback(node, anim); }
+		});
+		anims.push(anim);
+	});
+	
+	if(nodes.length > 1){ return dojo.lfx.combine(anims); }
+	else{ return anims[0]; }
+}
+
+dojo.lfx.html.wipeOut = function(nodes, duration, easing, callback){
+	nodes = dojo.lfx.html._byId(nodes);
+	var anims = [];
+	
+	var init = function(node, overflow){
+		dojo.style.show(node);
+		if(overflow == "visible") {
+			node.style.overflow = "hidden";
+		}
+	}
+	dojo.lang.forEach(nodes, function(node){
+		var overflow = dojo.style.getStyle(node, "overflow");
+		var initialize = function(){
+			init(node, overflow);
+		}
+		initialize();
+
+		var anim = dojo.lfx.propertyAnimation(node,
+			[{	property: "height",
+				start: node.offsetHeight,
+				end: 0 } ], duration, easing);
+		
+		dojo.event.connect(anim, "beforeBegin", initialize);
+		dojo.event.connect(anim, "onEnd", function(){
+			dojo.style.hide(node);
+			node.style.overflow = overflow;
+			if(callback){ callback(node, anim); }
+		});
+		anims.push(anim);
+	});
+
+	if(nodes.length > 1){ return dojo.lfx.combine(anims); }
+	else { return anims[0]; }
+}
+
+dojo.lfx.html.slideTo = function(nodes, coords, duration, easing, callback){
+	nodes = dojo.lfx.html._byId(nodes);
+	var anims = [];
+
+	dojo.lang.forEach(nodes, function(node){
+		var top = null;
+		var left = null;
+		var pos = null;
+		
+		var init = (function(){
+			var innerNode = node;
+			return function(){
+				top = node.offsetTop;
+				left = node.offsetLeft;
+				pos = dojo.style.getComputedStyle(node, 'position');
+
+				if (pos == 'relative' || pos == 'static') {
+					top = parseInt(dojo.style.getComputedStyle(node, 'top')) || 0;
+					left = parseInt(dojo.style.getComputedStyle(node, 'left')) || 0;
+				}
+			}
+		})();
+		init();
+		
+		var anim = dojo.lfx.propertyAnimation(node,
+			[{	property: "top",
+				start: top,
+				end: coords[0] },
+			{	property: "left",
+				start: left,
+				end: coords[1] }], duration, easing);
+		
+		dojo.event.connect(anim, "beforeBegin", init);
+		if(callback){
+			dojo.event.connect(anim, "onEnd", function(){
+				callback(node, anim);
+			});
+		}
+
+		anims.push(anim);
+	});
+	
+	if(nodes.length > 1){ return dojo.lfx.combine(anims); }
+	else{ return anims[0]; }
+}
+
+dojo.lfx.html.explode = function(start, endNode, duration, easing, callback){
+	var startCoords = dojo.style.toCoordinateArray(start);
+	var outline = document.createElement("div");
+	with(outline.style){
+		position = "absolute";
+		border = "1px solid black";
+		display = "none";
+	}
+	document.body.appendChild(outline);
+
+	endNode = dojo.byId(endNode);
+	with(endNode.style){
+		visibility = "hidden";
+		display = "block";
+	}
+	var endCoords = dojo.style.toCoordinateArray(endNode);
+	with(endNode.style){
+		display = "none";
+		visibility = "visible";
+	}
+
+	var anim = new dojo.lfx.Animation({
+		beforeBegin: function(){
+			dojo.style.show(outline);
+		},
+		onAnimate: function(value){
+			with(outline.style){
+				left = value[0] + "px";
+				top = value[1] + "px";
+				width = value[2] + "px";
+				height = value[3] + "px";
+			}
+		},
+		onEnd: function(){
+			dojo.style.show(endNode);
+			outline.parentNode.removeChild(outline);
+		}
+	}, duration, new dojo.lfx.Line(startCoords, endCoords), easing);
+	if(callback){
+		dojo.event.connect(anim, "onEnd", function(){
+			callback(endNode, anim);
+		});
+	}
+	return anim;
+}
+
+dojo.lfx.html.implode = function(startNode, end, duration, easing, callback){
+	var startCoords = dojo.style.toCoordinateArray(startNode);
+	var endCoords = dojo.style.toCoordinateArray(end);
+
+	startNode = dojo.byId(startNode);
+	var outline = document.createElement("div");
+	with(outline.style){
+		position = "absolute";
+		border = "1px solid black";
+		display = "none";
+	}
+	document.body.appendChild(outline);
+
+	var anim = new dojo.lfx.Animation({
+		beforeBegin: function(){
+			dojo.style.hide(startNode);
+			dojo.style.show(outline);
+		},
+		onAnimate: function(value){
+			with(outline.style){
+				left = value[0] + "px";
+				top = value[1] + "px";
+				width = value[2] + "px";
+				height = value[3] + "px";
+			}
+		},
+		onEnd: function(){
+			outline.parentNode.removeChild(outline);
+		}
+	}, duration, new dojo.lfx.Line(startCoords, endCoords), easing);
+	if(callback){
+		dojo.event.connect(anim, "onEnd", function(){
+			callback(startNode, anim);
+		});
+	}
+	return anim;
+}
+
+dojo.lfx.html.highlight = function(nodes, startColor, duration, easing, callback){
+	nodes = dojo.lfx.html._byId(nodes);
+	var anims = [];
+
+	dojo.lang.forEach(nodes, function(node){
+		var color = dojo.style.getBackgroundColor(node);
+		var bg = dojo.style.getStyle(node, "background-color").toLowerCase();
+		var wasTransparent = (bg == "transparent" || bg == "rgba(0, 0, 0, 0)");
+		while(color.length > 3) { color.pop(); }
+
+		var rgb = new dojo.graphics.color.Color(startColor).toRgb();
+		var endRgb = new dojo.graphics.color.Color(color).toRgb();
+
+		var anim = dojo.lfx.propertyAnimation(node, [{
+			property: "background-color",
+			start: rgb,
+			end: endRgb
+		}], duration, easing);
+
+		dojo.event.connect(anim, "beforeBegin", function(){
+			node.style.backgroundColor = "rgb(" + rgb.join(",") + ")";
+		});
+
+		dojo.event.connect(anim, "onEnd", function(){
+			if(wasTransparent){
+				node.style.backgroundColor = "transparent";
+			}
+			if(callback){
+				callback(node, anim);
+			}
+		});
+
+		anims.push(anim);
+	});
+
+	if(nodes.length > 1){ return dojo.lfx.combine(anims); }
+	else{ return anims[0]; }
+}
+
+dojo.lfx.html.unhighlight = function(nodes, endColor, duration, easing, callback){
+	nodes = dojo.lfx.html._byId(nodes);
+	var anims = [];
+
+	dojo.lang.forEach(nodes, function(node){
+		var color = new dojo.graphics.color.Color(dojo.style.getBackgroundColor(node)).toRgb();
+		var rgb = new dojo.graphics.color.Color(endColor).toRgb();
+		
+		var anim = dojo.lfx.propertyAnimation(node, [{
+			property: "background-color",
+			start: color,
+			end: rgb
+		}], duration, easing);
+
+		dojo.event.connect(anim, "beforeBegin", function(){
+			node.style.backgroundColor = "rgb(" + color.join(",") + ")";
+		});
+		if(callback){
+			dojo.event.connect(anim, "onEnd", function(){
+				callback(node, anim);
+			});
+		}
+
+		anims.push(anim);
+	});
+
+	if(nodes.length > 1){ return dojo.lfx.combine(anims); }
+	else{ return anims[0]; }
+}
+
+dojo.lang.mixin(dojo.lfx, dojo.lfx.html);

Added: incubator/xap/trunk/src/dojo/src/loader.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/loader.js?rev=417618&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/loader.js (added)
+++ incubator/xap/trunk/src/dojo/src/loader.js Tue Jun 27 15:48:54 2006
@@ -0,0 +1,405 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/*
+ * loader.js - runs before the hostenv_*.js file. Contains all of the package loading methods.
+ */
+
+//A semi-colon is at the start of the line because after doing a build, this function definition
+//get compressed onto the same line as the last line in bootstrap1.js. That list line is just a
+//curly bracket, and the browser complains about that syntax. The semicolon fixes it. Putting it
+//here instead of at the end of bootstrap1.js, since it is more of an issue for this file, (using
+//the closure), and bootstrap1.js could change in the future.
+;(function(){
+	//Additional properties for dojo.hostenv
+	var _addHostEnv = {
+		pkgFileName: "__package__",
+	
+		// for recursion protection
+		loading_modules_: {},
+		loaded_modules_: {},
+		addedToLoadingCount: [],
+		removedFromLoadingCount: [],
+	
+		inFlightCount: 0,
+	
+		// FIXME: it should be possible to pull module prefixes in from djConfig
+		modulePrefixes_: {
+			dojo: {name: "dojo", value: "src"}
+		},
+	
+	
+		setModulePrefix: function(module, prefix){
+			this.modulePrefixes_[module] = {name: module, value: prefix};
+		},
+	
+		getModulePrefix: function(module){
+			var mp = this.modulePrefixes_;
+			if((mp[module])&&(mp[module]["name"])){
+				return mp[module].value;
+			}
+			return module;
+		},
+	
+		getTextStack: [],
+		loadUriStack: [],
+		loadedUris: [],
+	
+		//WARNING: This variable is referenced by packages outside of bootstrap: FloatingPane.js and undo/browser.js
+		post_load_: false,
+		
+		//Egad! Lots of test files push on this directly instead of using dojo.addOnLoad.
+		modulesLoadedListeners: []
+	};
+	
+	//Add all of these properties to dojo.hostenv
+	for(var param in _addHostEnv){
+		dojo.hostenv[param] = _addHostEnv[param];
+	}
+})();
+
+/**
+ * Loads and interprets the script located at relpath, which is relative to the
+ * script root directory.  If the script is found but its interpretation causes
+ * a runtime exception, that exception is not caught by us, so the caller will
+ * see it.  We return a true value if and only if the script is found.
+ *
+ * For now, we do not have an implementation of a true search path.  We
+ * consider only the single base script uri, as returned by getBaseScriptUri().
+ *
+ * @param relpath A relative path to a script (no leading '/', and typically
+ * ending in '.js').
+ * @param module A module whose existance to check for after loading a path.
+ * Can be used to determine success or failure of the load.
+ */
+dojo.hostenv.loadPath = function(relpath, module /*optional*/, cb /*optional*/){
+	if((relpath.charAt(0) == '/')||(relpath.match(/^\w+:/))){
+		dojo.raise("relpath '" + relpath + "'; must be relative");
+	}
+	var uri = this.getBaseScriptUri() + relpath;
+	if(djConfig.cacheBust && dojo.render.html.capable) { uri += "?" + String(djConfig.cacheBust).replace(/\W+/g,""); }
+	try{
+		return ((!module) ? this.loadUri(uri, cb) : this.loadUriAndCheck(uri, module, cb));
+	}catch(e){
+		dojo.debug(e);
+		return false;
+	}
+}
+
+/**
+ * Reads the contents of the URI, and evaluates the contents.
+ * Returns true if it succeeded. Returns false if the URI reading failed.
+ * Throws if the evaluation throws.
+ * The result of the eval is not available to the caller.
+ */
+dojo.hostenv.loadUri = function(uri, cb){
+	if(this.loadedUris[uri]){
+		return;
+	}
+	var contents = this.getText(uri, null, true);
+	if(contents == null){ return 0; }
+	this.loadedUris[uri] = true;
+	var value = dj_eval(contents);
+	return 1;
+}
+
+// FIXME: probably need to add logging to this method
+dojo.hostenv.loadUriAndCheck = function(uri, module, cb){
+	var ok = true;
+	try{
+		ok = this.loadUri(uri, cb);
+	}catch(e){
+		dojo.debug("failed loading ", uri, " with error: ", e);
+	}
+	return ((ok)&&(this.findModule(module, false))) ? true : false;
+}
+
+dojo.loaded = function(){ }
+
+dojo.hostenv.loaded = function(){
+	this.post_load_ = true;
+	var mll = this.modulesLoadedListeners;
+	//Clear listeners so new ones can be added
+	//For other xdomain package loads after the initial load.
+	this.modulesLoadedListeners = [];
+	for(var x=0; x<mll.length; x++){
+		mll[x]();
+	}
+	dojo.loaded();
+}
+
+/*
+Call styles:
+	dojo.addOnLoad(functionPointer)
+	dojo.addOnLoad(object, "functionName")
+*/
+dojo.addOnLoad = function(obj, fcnName) {
+	var dh = dojo.hostenv;
+	if(arguments.length == 1) {
+		dh.modulesLoadedListeners.push(obj);
+	} else if(arguments.length > 1) {
+		dh.modulesLoadedListeners.push(function() {
+			obj[fcnName]();
+		});
+	}
+
+	//Added for xdomain loading. dojo.addOnLoad is used to
+	//indicate callbacks after doing some dojo.require() statements.
+	//In the xdomain case, if all the requires are loaded (after initial
+	//page load), then immediately call any listeners.
+	if(dh.post_load_ && dh.inFlightCount == 0){
+		dh.callLoaded();
+	}
+}
+
+dojo.hostenv.modulesLoaded = function(){
+	if(this.post_load_){ return; }
+	if((this.loadUriStack.length==0)&&(this.getTextStack.length==0)){
+		if(this.inFlightCount > 0){ 
+			dojo.debug("files still in flight!");
+			return;
+		}
+		dojo.hostenv.callLoaded();
+	}
+}
+
+dojo.hostenv.callLoaded = function(){
+	if(typeof setTimeout == "object"){
+		setTimeout("dojo.hostenv.loaded();", 0);
+	}else{
+		dojo.hostenv.loaded();
+	}
+}
+
+/**
+* loadModule("A.B") first checks to see if symbol A.B is defined. 
+* If it is, it is simply returned (nothing to do).
+*
+* If it is not defined, it will look for "A/B.js" in the script root directory,
+* followed by "A.js".
+*
+* It throws if it cannot find a file to load, or if the symbol A.B is not
+* defined after loading.
+*
+* It returns the object A.B.
+*
+* This does nothing about importing symbols into the current package.
+* It is presumed that the caller will take care of that. For example, to import
+* all symbols:
+*
+*    with (dojo.hostenv.loadModule("A.B")) {
+*       ...
+*    }
+*
+* And to import just the leaf symbol:
+*
+*    var B = dojo.hostenv.loadModule("A.B");
+*    ...
+*
+* dj_load is an alias for dojo.hostenv.loadModule
+*/
+dojo.hostenv._global_omit_module_check = false;
+dojo.hostenv.loadModule = function(modulename, exact_only, omit_module_check){
+	if(!modulename){ return; }
+	omit_module_check = this._global_omit_module_check || omit_module_check;
+	var module = this.findModule(modulename, false);
+	if(module){
+		return module;
+	}
+
+	// protect against infinite recursion from mutual dependencies
+	if(dj_undef(modulename, this.loading_modules_)){
+		this.addedToLoadingCount.push(modulename);
+	}
+	this.loading_modules_[modulename] = 1;
+
+	// convert periods to slashes
+	var relpath = modulename.replace(/\./g, '/') + '.js';
+
+	var syms = modulename.split(".");
+	var nsyms = modulename.split(".");
+	for (var i = syms.length - 1; i > 0; i--) {
+		var parentModule = syms.slice(0, i).join(".");
+		var parentModulePath = this.getModulePrefix(parentModule);
+		if (parentModulePath != parentModule) {
+			syms.splice(0, i, parentModulePath);
+			break;
+		}
+	}
+	var last = syms[syms.length - 1];
+	// figure out if we're looking for a full package, if so, we want to do
+	// things slightly diffrently
+	if(last=="*"){
+		modulename = (nsyms.slice(0, -1)).join('.');
+
+		while(syms.length){
+			syms.pop();
+			syms.push(this.pkgFileName);
+			relpath = syms.join("/") + '.js';
+			if(relpath.charAt(0)=="/"){
+				relpath = relpath.slice(1);
+			}
+			ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null));
+			if(ok){ break; }
+			syms.pop();
+		}
+	}else{
+		relpath = syms.join("/") + '.js';
+		modulename = nsyms.join('.');
+		var ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null));
+		if((!ok)&&(!exact_only)){
+			syms.pop();
+			while(syms.length){
+				relpath = syms.join('/') + '.js';
+				ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null));
+				if(ok){ break; }
+				syms.pop();
+				relpath = syms.join('/') + '/'+this.pkgFileName+'.js';
+				if(relpath.charAt(0)=="/"){
+					relpath = relpath.slice(1);
+				}
+				ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null));
+				if(ok){ break; }
+			}
+		}
+
+		if((!ok)&&(!omit_module_check)){
+			dojo.raise("Could not load '" + modulename + "'; last tried '" + relpath + "'");
+		}
+	}
+
+	// check that the symbol was defined
+	//Don't bother if we're doing xdomain (asynchronous) loading.
+	if(!omit_module_check && !this["isXDomain"]){
+		// pass in false so we can give better error
+		module = this.findModule(modulename, false);
+		if(!module){
+			dojo.raise("symbol '" + modulename + "' is not defined after loading '" + relpath + "'"); 
+		}
+	}
+
+	return module;
+}
+
+/**
+* startPackage("A.B") follows the path, and at each level creates a new empty
+* object or uses what already exists. It returns the result.
+*/
+dojo.hostenv.startPackage = function(packname){
+	var modref = dojo.evalObjPath((packname.split(".").slice(0, -1)).join('.'));
+	this.loaded_modules_[(new String(packname)).toLowerCase()] = modref;
+
+	var syms = packname.split(/\./);
+	if(syms[syms.length-1]=="*"){
+		syms.pop();
+	}
+	return dojo.evalObjPath(syms.join("."), true);
+}
+
+/**
+ * findModule("A.B") returns the object A.B if it exists, otherwise null.
+ * @param modulename A string like 'A.B'.
+ * @param must_exist Optional, defualt false. throw instead of returning null
+ * if the module does not currently exist.
+ */
+dojo.hostenv.findModule = function(modulename, must_exist){
+	// check cache
+	/*
+	if(!dj_undef(modulename, this.modules_)){
+		return this.modules_[modulename];
+	}
+	*/
+
+	var lmn = (new String(modulename)).toLowerCase();
+
+	if(this.loaded_modules_[lmn]){
+		return this.loaded_modules_[lmn];
+	}
+
+	// see if symbol is defined anyway
+	var module = dojo.evalObjPath(modulename);
+	if((modulename)&&(typeof module != 'undefined')&&(module)){
+		this.loaded_modules_[lmn] = module;
+		return module;
+	}
+
+	if(must_exist){
+		dojo.raise("no loaded module named '" + modulename + "'");
+	}
+	return null;
+}
+
+//Start of old bootstrap2:
+
+/*
+ * This method taks a "map" of arrays which one can use to optionally load dojo
+ * modules. The map is indexed by the possible dojo.hostenv.name_ values, with
+ * two additional values: "default" and "common". The items in the "default"
+ * array will be loaded if none of the other items have been choosen based on
+ * the hostenv.name_ item. The items in the "common" array will _always_ be
+ * loaded, regardless of which list is chosen.  Here's how it's normally
+ * called:
+ *
+ *	dojo.kwCompoundRequire({
+ *		browser: [
+ *			["foo.bar.baz", true, true], // an example that passes multiple args to loadModule()
+ *			"foo.sample.*",
+ *			"foo.test,
+ *		],
+ *		default: [ "foo.sample.*" ],
+ *		common: [ "really.important.module.*" ]
+ *	});
+ */
+dojo.kwCompoundRequire = function(modMap){
+	var common = modMap["common"]||[];
+	var result = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]);
+
+	for(var x=0; x<result.length; x++){
+		var curr = result[x];
+		if(curr.constructor == Array){
+			dojo.hostenv.loadModule.apply(dojo.hostenv, curr);
+		}else{
+			dojo.hostenv.loadModule(curr);
+		}
+	}
+}
+
+dojo.require = function(){
+	dojo.hostenv.loadModule.apply(dojo.hostenv, arguments);
+}
+
+dojo.requireIf = function(){
+	if((arguments[0] === true)||(arguments[0]=="common")||(arguments[0] && dojo.render[arguments[0]].capable)){
+		var args = [];
+		for (var i = 1; i < arguments.length; i++) { args.push(arguments[i]); }
+		dojo.require.apply(dojo, args);
+	}
+}
+
+dojo.requireAfterIf = dojo.requireIf;
+
+dojo.provide = function(){
+	return dojo.hostenv.startPackage.apply(dojo.hostenv, arguments);
+}
+
+dojo.setModulePrefix = function(module, prefix){
+	return dojo.hostenv.setModulePrefix(module, prefix);
+}
+
+// determine if an object supports a given method
+// useful for longer api chains where you have to test each object in the chain
+dojo.exists = function(obj, name){
+	var p = name.split(".");
+	for(var i = 0; i < p.length; i++){
+	if(!(obj[p[i]])) return false;
+		obj = obj[p[i]];
+	}
+	return true;
+}

Added: incubator/xap/trunk/src/dojo/src/loader_xd.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/loader_xd.js?rev=417618&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/loader_xd.js (added)
+++ incubator/xap/trunk/src/dojo/src/loader_xd.js Tue Jun 27 15:48:54 2006
@@ -0,0 +1,391 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+//Cross-domain package loader.
+
+//FIXME: How will xd loading work with debugAtAllCosts? Any bad interactions?
+//FIXME: widgets won't work fully (HTML/CSS) and also because of the requireIf() thing.
+
+dojo.hostenv.resetXd = function(){
+	//This flag indicates where or not we have crossed into xdomain territory. Once any package says
+	//it is cross domain, then the rest of the packages have to be treated as xdomain because we need
+	//to evaluate packages in order. If there is a xdomain package followed by a xhr package, we can't load
+	//the xhr package until the one before it finishes loading. The text of the xhr package will be converted
+	//to match the format for a xd package and put in the xd load queue.
+	//You can force all packages to be treated as xd by setting the djConfig.forceXDomain.
+	this.isXDomain = djConfig.forceXDomain || false;
+
+	this.xdTimer = 0;
+	this.xdInFlight = {};
+	this.xdOrderedReqs = [];
+	this.xdDepMap = {};
+	this.xdContents = [];
+}
+
+//Call reset immediately to set the state.
+dojo.hostenv.resetXd();
+
+dojo.hostenv.createXdPackage = function(contents){
+	//Find dependencies.
+	var deps = [];
+    var depRegExp = /dojo.(require|requireIf|requireAll|provide|requireAfterIf|requireAfter|kwCompoundRequire|conditionalRequire|hostenv\.conditionalLoadModule|.hostenv\.loadModule|hostenv\.moduleLoaded)\(([\w\W]*?)\)/mg;
+    var match;
+	while((match = depRegExp.exec(contents)) != null){
+		deps.push("\"" + match[1] + "\", " + match[2]);
+	}
+
+	//Create package object and the call to packageLoaded.
+	var output = [];
+	output.push("dojo.hostenv.packageLoaded({\n");
+
+	//Add dependencies
+	if(deps.length > 0){
+		output.push("depends: [");
+		for(var i = 0; i < deps.length; i++){
+			if(i > 0){
+				output.push(",\n");
+			}
+			output.push("[" + deps[i] + "]");
+		}
+		output.push("],");
+	}
+
+	//Add the contents of the file inside a function.
+	//Pass in dojo as an argument to the function to help with
+	//allowing multiple versions of dojo in a page.
+	output.push("\ndefinePackage: function(dojo){");
+	output.push(contents);
+	output.push("\n}});");
+	
+	return output.join("");
+}
+
+dojo.hostenv.loadPath = function(relpath, module /*optional*/, cb /*optional*/){
+	//Only do getBaseScriptUri if path does not start with a URL with a protocol.
+	//If there is a colon before the first / then, we have a URL with a protocol.
+	var colonIndex = relpath.indexOf(":");
+	var slashIndex = relpath.indexOf("/");
+	var uri;
+	var currentIsXDomain = false;
+	if(colonIndex > 0 && colonIndex < slashIndex){
+		uri = relpath;
+		this.isXDomain = currentIsXDomain = true;
+	}else{
+		uri = this.getBaseScriptUri() + relpath;
+
+		//Is ithe base script URI-based URL a cross domain URL?
+		colonIndex = uri.indexOf(":");
+		slashIndex = uri.indexOf("/");
+		if(colonIndex > 0 && colonIndex < slashIndex && (!location.host || uri.indexOf("http://" + location.host) != 0)){
+			this.isXDomain = currentIsXDomain = true;
+		}
+	}
+
+	if(djConfig.cacheBust && dojo.render.html.capable) { uri += "?" + String(djConfig.cacheBust).replace(/\W+/g,""); }
+	try{
+		return ((!module || this.isXDomain) ? this.loadUri(uri, cb, currentIsXDomain, module) : this.loadUriAndCheck(uri, module, cb));
+	}catch(e){
+		dojo.debug(e);
+		return false;
+	}
+}
+
+//Overriding loadUri for now. Wanted to override getText(), but it is used by
+//the widget code in too many, synchronous ways right now. This means the xd stuff
+//is not suitable for widgets yet.
+dojo.hostenv.loadUri = function(uri, cb, currentIsXDomain, module){
+	if(this.loadedUris[uri]){
+		return 1;
+	}
+
+	//Add the module (package) to the list of modules.
+	if(this.isXDomain){
+		//Curious: is this array going to get whacked with multiple access since scripts
+		//load asynchronously and may be accessing the array at the same time?
+		//JS is single-threaded supposedly, so it should be ok. And we don't need
+		//a precise ordering.
+		this.xdOrderedReqs.push(module);
+
+		//Add to waiting packages.
+		//If this is a __package__.js file, then this must be
+		//a package.* request (since xdomain can only work with the first
+		//path in a package search list. However, .* module names are not
+		//passed to this function, so do an adjustment here.
+		if(uri.indexOf("__package__") != -1){
+			module += ".*";
+		}
+
+		this.xdInFlight[module] = true;
+
+		//Increment inFlightCount
+		//This will stop the modulesLoaded from firing all the way.
+		this.inFlightCount++;
+				
+		//Start timer
+		if(!this.xdTimer){
+			this.xdTimer = setInterval("dojo.hostenv.watchInFlightXDomain();", 100);
+		}
+		this.xdStartTime = (new Date()).getTime();
+	}
+
+	if (currentIsXDomain){
+		//Fix name to be a .xd.fileextension name.
+		var lastIndex = uri.lastIndexOf('.');
+		if(lastIndex <= 0){
+			lastIndex = uri.length - 1;
+		}
+
+		var xdUri = uri.substring(0, lastIndex) + ".xd";
+		if(lastIndex != uri.length - 1){
+			xdUri += uri.substring(lastIndex, uri.length);
+		}
+
+		//Add to script src
+		var element = document.createElement("script");
+		element.type = "text/javascript";
+		element.src = xdUri;
+		if(!this.headElement){
+			this.headElement = document.getElementsByTagName("head")[0];
+		}
+		this.headElement.appendChild(element);
+	}else{
+		var contents = this.getText(uri, null, true);
+		if(contents == null){ return 0; }
+		
+		if(this.isXDomain){
+			var pkg = this.createXdPackage(contents);
+			dj_eval(pkg);
+		}else{
+			var value = dj_eval(contents);
+		}
+	}
+
+	//These steps are done in the non-xd loader version of this function.
+	//Maintain these steps to fit in with the existing system.
+	this.loadedUris[uri] = true;
+	return 1;
+}
+
+dojo.hostenv.packageLoaded = function(pkg){
+	var deps = pkg.depends;
+	var requireList = null;
+	var provideList = [];
+	if(deps && deps.length > 0){
+		var dep = null;
+		var insertHint = 0;
+		var attachedPackage = false;
+		for(var i = 0; i < deps.length; i++){
+			dep = deps[i];
+
+			//Look for specific dependency indicators.
+			if (dep[0] == "provide" || dep[0] == "hostenv.moduleLoaded"){
+				provideList.push(dep[1]);
+			}else{
+				if(!requireList){
+					requireList = [];
+				}
+				requireList = requireList.concat(this.unpackXdDependency(dep));
+			}
+
+			//Call the dependency indicator to allow for the normal dojo setup.
+			//Only allow for one dot reference, for the hostenv.* type calls.
+			var depType = dep[0];
+			var objPath = depType.split(".");
+			if(objPath.length == 2){
+				dojo[objPath[0]][objPath[1]].apply(dojo[objPath[0]], dep.slice(1));
+			}else{
+				dojo[depType].apply(dojo, dep.slice(1));
+			}
+		}
+
+		//Save off the package contents for definition later.
+		var contentIndex = this.xdContents.push({content: pkg.definePackage, isDefined: false}) - 1;
+
+		//Add provide/requires to dependency map.
+		for(var i = 0; i < provideList.length; i++){
+			this.xdDepMap[provideList[i]] = { requires: requireList, contentIndex: contentIndex };
+		}
+
+		//Now update the inflight status for any provided packages in this loaded package.
+		//Do this at the very end (in a *separate* for loop) to avoid shutting down the 
+		//inflight timer check too soon.
+		for(var i = 0; i < provideList.length; i++){
+			this.xdInFlight[provideList[i]] = false;
+		}
+	}
+}
+
+//This is a bit brittle: it has to know about the dojo methods that deal with dependencies
+//It would be ideal to intercept the actual methods and do something fancy at that point,
+//but I have concern about knowing which provide to match to the dependency in that case,
+//since scripts can load whenever they want, and trigger new calls to dojo.hostenv.packageLoaded().
+dojo.hostenv.unpackXdDependency = function(dep){
+	//Extract the dependency(ies).
+	var newDeps = null;
+	switch(dep[0]){
+		case "requireIf":
+		case "requireAfterIf":
+		case "conditionalRequire":
+			//First arg (dep[1]) is the test. Depedency is dep[2].
+			if((dep[1] === true)||(dep[1]=="common")||(dep[1] && dojo.render[dep[1]].capable)){
+				newDeps = [{name: dep[2], content: null}];
+			}
+			break;
+		case "requireAll":
+			//the arguments are an array, each element a call to require.
+			//Get rid of first item, which is "requireAll".
+			deps.shift();
+			newDeps = deps;
+			dojo.hostenv.flattenRequireArray(newDeps);
+			break;
+		case "kwCompoundRequire":
+		case "hostenv.conditionalLoadModule":
+			var modMap = dep[1];
+			var common = modMap["common"]||[];
+			var newDeps = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]);	
+			dojo.hostenv.flattenRequireArray(newDeps);
+			break;
+		case "require":
+		case "requireAfter":
+		case "hostenv.loadModule":
+			//Just worry about dep[1]
+			newDeps = [{name: dep[1], content: null}];
+			break;
+	}
+
+	return newDeps;
+}
+
+//Evaluate package contents for the given provide.
+dojo.hostenv.xdResolve = function(provide, pkg){
+	var contents = this.xdContents[pkg.contentIndex];
+	if(!contents.isDefined){
+		//Evaluate the package to bring it into being.
+		//Pass dojo in so that later, to support multiple versions of dojo
+		//in a page, we can pass which version of dojo to use.
+		contents.content(dojo);
+		contents.isDefined = true;
+	}
+
+	this.xdDepMap[provide] = null;
+}
+
+//Walks the requires and evaluates package contents in
+//the right order.
+dojo.hostenv.xdWalkReqs = function(){
+	var reqChain = null;
+	var req;
+	for(var i = 0; i < this.xdOrderedReqs.length; i++){
+		req = this.xdOrderedReqs[i];
+		if(this.xdDepMap[req]){
+			reqChain = [req];
+			reqChain[req] = true; //Allow for fast lookup of the req in the array
+			this.xdEvalReqs(reqChain);
+		}
+	}
+}
+
+//Do a depth first, breadth second search and eval or reqs.
+dojo.hostenv.xdEvalReqs = function(reqChain){
+	if(reqChain.length > 0){
+		var req = reqChain[reqChain.length - 1];
+		var pkg = this.xdDepMap[req];
+		if(pkg){
+			//Trace down any dependencies for this package.
+			if(pkg.requires && pkg.requires.length > 0){
+				var nextReq;
+				for(var i = 0; i < pkg.requires.length; i++){
+					nextReq = pkg.requires[i].name;
+					if(nextReq && !reqChain[nextReq]){
+						//New req depedency. Follow it down.
+						reqChain.push(nextReq);
+						reqChain[nextReq] = true;
+						this.xdEvalReqs(reqChain);
+					}
+				}
+			}
+
+			//Evaluate the package.
+			this.xdResolve(req, pkg);
+		}
+
+		//Done with that require. Remove it and go to the next one.
+		reqChain.pop();
+		this.xdEvalReqs(reqChain);
+	}
+}
+
+dojo.hostenv.clearXdInterval = function(){
+	clearInterval(this.xdTimer);
+	this.xdTimer = 0;
+}
+
+dojo.hostenv.watchInFlightXDomain = function(){
+	//Make sure we haven't waited timed out.
+	var waitInterval = (djConfig.xdWaitSeconds || 30) * 1000;
+
+	if(this.xdStartTime + waitInterval < (new Date()).getTime()){
+		this.clearXdInterval();
+		var noLoads = "";
+		for(var param in this.xdInFlight){
+			if(this.xdInFlight[param]){
+				noLoads += param + " ";
+			}
+		}
+		dojo.raise("Could not load cross-domain packages: " + noLoads);
+	}
+
+	//If any are true, then still waiting.
+	//Come back later.	
+	for(var param in this.xdInFlight){
+		if(this.xdInFlight[param]){
+			return;
+		}
+	}
+
+	//All done loading. Clean up and notify that we are loaded.
+	this.clearXdInterval();
+
+	this.xdWalkReqs();
+
+	//Evaluate any packages that were not evaled before.
+	//This normally shouldn't happen with proper dojo.provide and dojo.require
+	//usage, but providing it just in case. Note that these may not be executed
+	//in the original order that the developer intended.
+	//Pass dojo in so that later, to support multiple versions of dojo
+	//in a page, we can pass which version of dojo to use.
+	for(var i = 0; i < this.xdContents.length; i++){
+		var current = this.xdContents[i];
+		if(current.content && !current.isDefined){
+			current.content(dojo);
+		}
+	}
+
+	//Clean up for the next round of xd loading.
+	this.resetXd();
+
+	//Clear inflight count so we will finally do finish work.
+	this.inFlightCount = 0; 
+	this.callLoaded();
+}
+
+dojo.hostenv.flattenRequireArray = function(target){
+	//Each result could be an array of 3 elements  (the 3 arguments to dojo.require).
+	//We only need the first one.
+	if(target){
+		for(var i = 0; i < target.length; i++){
+			if(target[i] instanceof Array){
+				target[i] = {name: target[i][0], content: null};
+			}else{
+				target[i] = {name: target[i], content: null};
+			}
+		}
+	}
+}

Added: incubator/xap/trunk/src/dojo/src/logging/Logger.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/logging/Logger.js?rev=417618&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/logging/Logger.js (added)
+++ incubator/xap/trunk/src/dojo/src/logging/Logger.js Tue Jun 27 15:48:54 2006
@@ -0,0 +1,408 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/*		This is the dojo logging facility, which is imported from nWidgets
+		(written by Alex Russell, CLA on file), which is patterned on the
+		Python logging module, which in turn has been heavily influenced by
+		log4j (execpt with some more pythonic choices, which we adopt as well).
+
+		While the dojo logging facilities do provide a set of familiar
+		interfaces, many of the details are changed to reflect the constraints
+		of the browser environment. Mainly, file and syslog-style logging
+		facilites are not provided, with HTTP POST and GET requests being the
+		only ways of getting data from the browser back to a server. Minimal
+		support for this (and XML serialization of logs) is provided, but may
+		not be of practical use in a deployment environment.
+
+		The Dojo logging classes are agnostic of any environment, and while
+		default loggers are provided for browser-based interpreter
+		environments, this file and the classes it define are explicitly
+		designed to be portable to command-line interpreters and other
+		ECMA-262v3 envrionments.
+
+	the logger needs to accomidate:
+		log "levels"
+		type identifiers
+		file?
+		message
+		tic/toc?
+
+	The logger should ALWAYS record:
+		time/date logged
+		message
+		type
+		level
+*/
+// TODO: conver documentation to javadoc style once we confirm that is our choice
+// TODO: define DTD for XML-formatted log messages
+// TODO: write XML Formatter class
+// TODO: write HTTP Handler which uses POST to send log lines/sections
+
+// Filename:	LogCore.js
+// Purpose:		a common logging infrastructure for dojo
+// Classes:		dojo.logging, dojo.logging.Logger, dojo.logging.Record, dojo.logging.LogFilter
+// Global Objects:	dojo.logging
+// Dependencies:	none
+
+dojo.provide("dojo.logging.Logger");
+dojo.provide("dojo.log");
+dojo.require("dojo.lang");
+
+/*
+	A simple data structure class that stores information for and about
+	a logged event. Objects of this type are created automatically when
+	an event is logged and are the internal format in which information
+	about log events is kept.
+*/
+
+dojo.logging.Record = function(lvl, msg){
+	this.level = lvl;
+	this.message = msg;
+	this.time = new Date();
+	// FIXME: what other information can we receive/discover here?
+}
+
+// an empty parent (abstract) class which concrete filters should inherit from.
+dojo.logging.LogFilter = function(loggerChain){
+	this.passChain = loggerChain || "";
+	this.filter = function(record){
+		// FIXME: need to figure out a way to enforce the loggerChain
+		// restriction
+		return true; // pass all records
+	}
+}
+
+dojo.logging.Logger = function(){
+	this.cutOffLevel = 0;
+	this.propagate = true;
+	this.parent = null;
+	// storage for dojo.logging.Record objects seen and accepted by this logger
+	this.data = [];
+	this.filters = [];
+	this.handlers = [];
+}
+
+dojo.lang.extend(dojo.logging.Logger, {
+	argsToArr: function(args){
+		// utility function, reproduced from __util__ here to remove dependency
+		var ret = [];
+		for(var x=0; x<args.length; x++){
+			ret.push(args[x]);
+		}
+		return ret;
+	},
+
+	setLevel: function(lvl){
+		this.cutOffLevel = parseInt(lvl);
+	},
+
+	isEnabledFor: function(lvl){
+		return parseInt(lvl) >= this.cutOffLevel;
+	},
+
+	getEffectiveLevel: function(){
+		if((this.cutOffLevel==0)&&(this.parent)){
+			return this.parent.getEffectiveLevel();
+		}
+		return this.cutOffLevel;
+	},
+
+	addFilter: function(flt){
+		this.filters.push(flt);
+		return this.filters.length-1;
+	},
+
+	removeFilterByIndex: function(fltIndex){
+		if(this.filters[fltIndex]){
+			delete this.filters[fltIndex];
+			return true;
+		}
+		return false;
+	},
+
+	removeFilter: function(fltRef){
+		for(var x=0; x<this.filters.length; x++){
+			if(this.filters[x]===fltRef){
+				delete this.filters[x];
+				return true;
+			}
+		}
+		return false;
+	},
+
+	removeAllFilters: function(){
+		this.filters = []; // clobber all of them
+	},
+
+	filter: function(rec){
+		for(var x=0; x<this.filters.length; x++){
+			if((this.filters[x]["filter"])&&
+			   (!this.filters[x].filter(rec))||
+			   (rec.level<this.cutOffLevel)){
+				return false;
+			}
+		}
+		return true;
+	},
+
+	addHandler: function(hdlr){
+		this.handlers.push(hdlr);
+		return this.handlers.length-1;
+	},
+
+	handle: function(rec){
+		if((!this.filter(rec))||(rec.level<this.cutOffLevel)){ return false; }
+		for(var x=0; x<this.handlers.length; x++){
+			if(this.handlers[x]["handle"]){
+			   this.handlers[x].handle(rec);
+			}
+		}
+		// FIXME: not sure what to do about records to be propagated that may have
+		// been modified by the handlers or the filters at this logger. Should
+		// parents always have pristine copies? or is passing the modified record
+		// OK?
+		// if((this.propagate)&&(this.parent)){ this.parent.handle(rec); }
+		return true;
+	},
+
+	// the heart and soul of the logging system
+	log: function(lvl, msg){
+		if(	(this.propagate)&&(this.parent)&&
+			(this.parent.rec.level>=this.cutOffLevel)){
+			this.parent.log(lvl, msg);
+			return false;
+		}
+		// FIXME: need to call logging providers here!
+		this.handle(new dojo.logging.Record(lvl, msg));
+		return true;
+	},
+
+	// logger helpers
+	debug:function(msg){
+		return this.logType("DEBUG", this.argsToArr(arguments));
+	},
+
+	info: function(msg){
+		return this.logType("INFO", this.argsToArr(arguments));
+	},
+
+	warning: function(msg){
+		return this.logType("WARNING", this.argsToArr(arguments));
+	},
+
+	error: function(msg){
+		return this.logType("ERROR", this.argsToArr(arguments));
+	},
+
+	critical: function(msg){
+		return this.logType("CRITICAL", this.argsToArr(arguments));
+	},
+
+	exception: function(msg, e, squelch){
+		// FIXME: this needs to be modified to put the exception in the msg
+		// if we're on Moz, we can get the following from the exception object:
+		//		lineNumber
+		//		message
+		//		fileName
+		//		stack
+		//		name
+		// on IE, we get:
+		//		name
+		//		message (from MDA?)
+		//		number
+		//		description (same as message!)
+		if(e){
+			var eparts = [e.name, (e.description||e.message)];
+			if(e.fileName){
+				eparts.push(e.fileName);
+				eparts.push("line "+e.lineNumber);
+				// eparts.push(e.stack);
+			}
+			msg += " "+eparts.join(" : ");
+		}
+
+		this.logType("ERROR", msg);
+		if(!squelch){
+			throw e;
+		}
+	},
+
+	logType: function(type, args){
+		var na = [dojo.logging.log.getLevel(type)];
+		if(typeof args == "array"){
+			na = na.concat(args);
+		}else if((typeof args == "object")&&(args["length"])){
+			na = na.concat(this.argsToArr(args));
+			/* for(var x=0; x<args.length; x++){
+				na.push(args[x]);
+			} */
+		}else{
+			na = na.concat(this.argsToArr(arguments).slice(1));
+			/* for(var x=1; x<arguments.length; x++){
+				na.push(arguments[x]);
+			} */
+		}
+		return this.log.apply(this, na);
+	}
+});
+
+void(function(){
+	var ptype = dojo.logging.Logger.prototype;
+	ptype.warn = ptype.warning;
+	ptype.err = ptype.error;
+	ptype.crit = ptype.critical;
+})();
+
+// the Handler class
+dojo.logging.LogHandler = function(level){
+	this.cutOffLevel = (level) ? level : 0;
+	this.formatter = null; // FIXME: default formatter?
+	this.data = [];
+	this.filters = [];
+}
+
+dojo.logging.LogHandler.prototype.setFormatter = function(fmtr){
+	// FIXME: need to vet that it is indeed a formatter object
+	dojo.unimplemented("setFormatter");
+}
+
+dojo.logging.LogHandler.prototype.flush = function(){
+	dojo.unimplemented("flush");
+}
+
+dojo.logging.LogHandler.prototype.close = function(){
+	dojo.unimplemented("close");
+}
+
+dojo.logging.LogHandler.prototype.handleError = function(){
+	dojo.unimplemented("handleError");
+}
+
+dojo.logging.LogHandler.prototype.handle = function(record){
+	// emits the passed record if it passes this object's filters
+	if((this.filter(record))&&(record.level>=this.cutOffLevel)){
+		this.emit(record);
+	}
+}
+
+dojo.logging.LogHandler.prototype.emit = function(record){
+	// do whatever is necessaray to actually log the record
+	dojo.unimplemented("emit");
+}
+
+// set aliases since we don't want to inherit from dojo.logging.Logger
+void(function(){ // begin globals protection closure
+	var names = [
+		"setLevel", "addFilter", "removeFilterByIndex", "removeFilter",
+		"removeAllFilters", "filter"
+	];
+	var tgt = dojo.logging.LogHandler.prototype;
+	var src = dojo.logging.Logger.prototype;
+	for(var x=0; x<names.length; x++){
+		tgt[names[x]] = src[names[x]];
+	}
+})(); // end globals protection closure
+
+dojo.logging.log = new dojo.logging.Logger();
+
+// an associative array of logger objects. This object inherits from
+// a list of level names with their associated numeric levels
+dojo.logging.log.levels = [ {"name": "DEBUG", "level": 1},
+						   {"name": "INFO", "level": 2},
+						   {"name": "WARNING", "level": 3},
+						   {"name": "ERROR", "level": 4},
+						   {"name": "CRITICAL", "level": 5} ];
+
+dojo.logging.log.loggers = {};
+
+dojo.logging.log.getLogger = function(name){
+	if(!this.loggers[name]){
+		this.loggers[name] = new dojo.logging.Logger();
+		this.loggers[name].parent = this;
+	}
+	return this.loggers[name];
+}
+
+dojo.logging.log.getLevelName = function(lvl){
+	for(var x=0; x<this.levels.length; x++){
+		if(this.levels[x].level == lvl){
+			return this.levels[x].name;
+		}
+	}
+	return null;
+}
+
+dojo.logging.log.addLevelName = function(name, lvl){
+	if(this.getLevelName(name)){
+		this.err("could not add log level "+name+" because a level with that name already exists");
+		return false;
+	}
+	this.levels.append({"name": name, "level": parseInt(lvl)});
+	return true;
+}
+
+dojo.logging.log.getLevel = function(name){
+	for(var x=0; x<this.levels.length; x++){
+		if(this.levels[x].name.toUpperCase() == name.toUpperCase()){
+			return this.levels[x].level;
+		}
+	}
+	return null;
+}
+
+// a default handler class, it simply saves all of the handle()'d records in
+// memory. Useful for attaching to with dojo.event.connect()
+dojo.logging.MemoryLogHandler = function(level, recordsToKeep, postType, postInterval){
+	// mixin style inheritance
+	dojo.logging.LogHandler.call(this, level);
+	// default is unlimited
+	this.numRecords = (typeof djConfig['loggingNumRecords'] != 'undefined') ? djConfig['loggingNumRecords'] : ((recordsToKeep) ? recordsToKeep : -1);
+	// 0=count, 1=time, -1=don't post TODO: move this to a better location for prefs
+	this.postType = (typeof djConfig['loggingPostType'] != 'undefined') ? djConfig['loggingPostType'] : ( postType || -1);
+	// milliseconds for time, interger for number of records, -1 for non-posting,
+	this.postInterval = (typeof djConfig['loggingPostInterval'] != 'undefined') ? djConfig['loggingPostInterval'] : ( postType || -1);
+	
+}
+// prototype inheritance
+dojo.logging.MemoryLogHandler.prototype = new dojo.logging.LogHandler();
+
+// FIXME
+// dojo.inherits(dojo.logging.MemoryLogHandler, 
+
+// over-ride base-class
+dojo.logging.MemoryLogHandler.prototype.emit = function(record){
+	this.data.push(record);
+	if(this.numRecords != -1){
+		while(this.data.length>this.numRecords){
+			this.data.shift();
+		}
+	}
+}
+
+dojo.logging.logQueueHandler = new dojo.logging.MemoryLogHandler(0,50,0,10000);
+// actual logging event handler
+dojo.logging.logQueueHandler.emit = function(record){
+	// we should probably abstract this in the future
+	var logStr = String(dojo.log.getLevelName(record.level)+": "+record.time.toLocaleTimeString())+": "+record.message;
+	if(!dj_undef("debug", dj_global)){
+		dojo.debug(logStr);
+	}else if((typeof dj_global["print"] == "function")&&(!dojo.render.html.capable)){
+		print(logStr);
+	}
+	this.data.push(record);
+	if(this.numRecords != -1){
+		while(this.data.length>this.numRecords){
+			this.data.shift();
+		}
+	}
+}
+
+dojo.logging.log.addHandler(dojo.logging.logQueueHandler);
+dojo.log = dojo.logging.log;

Added: incubator/xap/trunk/src/dojo/src/math.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/math.js?rev=417618&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/math.js (added)
+++ incubator/xap/trunk/src/dojo/src/math.js Tue Jun 27 15:48:54 2006
@@ -0,0 +1,134 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.math");
+
+dojo.math.degToRad = function (x) { return (x*Math.PI) / 180; }
+dojo.math.radToDeg = function (x) { return (x*180) / Math.PI; }
+
+dojo.math.factorial = function (n) {
+	if(n<1){ return 0; }
+	var retVal = 1;
+	for(var i=1;i<=n;i++){ retVal *= i; }
+	return retVal;
+}
+
+//The number of ways of obtaining an ordered subset of k elements from a set of n elements
+dojo.math.permutations = function (n,k) {
+	if(n==0 || k==0) return 1;
+	return (dojo.math.factorial(n) / dojo.math.factorial(n-k));
+}
+
+//The number of ways of picking n unordered outcomes from r possibilities
+dojo.math.combinations = function (n,r) {
+	if(n==0 || r==0) return 1;
+	return (dojo.math.factorial(n) / (dojo.math.factorial(n-r) * dojo.math.factorial(r)));
+}
+
+dojo.math.bernstein = function (t,n,i) {
+	return (dojo.math.combinations(n,i) * Math.pow(t,i) * Math.pow(1-t,n-i));
+}
+
+/**
+ * Returns random numbers with a Gaussian distribution, with the mean set at
+ * 0 and the variance set at 1.
+ *
+ * @return A random number from a Gaussian distribution
+ */
+dojo.math.gaussianRandom = function () {
+	var k = 2;
+	do {
+		var i = 2 * Math.random() - 1;
+		var j = 2 * Math.random() - 1;
+		k = i * i + j * j;
+	} while (k >= 1);
+	k = Math.sqrt((-2 * Math.log(k)) / k);
+	return i * k;
+}
+
+/**
+ * Calculates the mean of an Array of numbers.
+ *
+ * @return The mean of the numbers in the Array
+ */
+dojo.math.mean = function () {
+	var array = dojo.lang.isArray(arguments[0]) ? arguments[0] : arguments;
+	var mean = 0;
+	for (var i = 0; i < array.length; i++) { mean += array[i]; }
+	return mean / array.length;
+}
+
+/**
+ * Extends Math.round by adding a second argument specifying the number of
+ * decimal places to round to.
+ *
+ * @param number The number to round
+ * @param places The number of decimal places to round to
+ * @return The rounded number
+ */
+// TODO: add support for significant figures
+dojo.math.round = function (number, places) {
+	if (!places) { var shift = 1; }
+	else { var shift = Math.pow(10, places); }
+	return Math.round(number * shift) / shift;
+}
+
+/**
+ * Calculates the standard deviation of an Array of numbers
+ *
+ * @return The standard deviation of the numbers
+ */
+dojo.math.sd = function () {
+	var array = dojo.lang.isArray(arguments[0]) ? arguments[0] : arguments;
+	return Math.sqrt(dojo.math.variance(array));
+}
+
+/**
+ * Calculates the variance of an Array of numbers
+ *
+ * @return The variance of the numbers
+ */
+dojo.math.variance = function () {
+	var array = dojo.lang.isArray(arguments[0]) ? arguments[0] : arguments;
+	var mean = 0, squares = 0;
+	for (var i = 0; i < array.length; i++) {
+		mean += array[i];
+		squares += Math.pow(array[i], 2);
+	}
+	return (squares / array.length)
+		- Math.pow(mean / array.length, 2);
+}
+
+/**
+ * Like range() in python
+**/
+dojo.math.range = function(a, b, step) {
+    if(arguments.length < 2) {
+        b = a;
+        a = 0;
+    }
+    if(arguments.length < 3) {
+        step = 1;
+    }
+
+    var range = [];
+    if(step > 0) {
+        for(var i = a; i < b; i += step) {
+            range.push(i);
+        }
+    } else if(step < 0) {
+        for(var i = a; i > b; i += step) {
+            range.push(i);
+        }
+    } else {
+        throw new Error("dojo.math.range: step must be non-zero");
+    }
+    return range;
+}

Added: incubator/xap/trunk/src/dojo/src/profile.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/profile.js?rev=417618&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/profile.js (added)
+++ incubator/xap/trunk/src/dojo/src/profile.js Tue Jun 27 15:48:54 2006
@@ -0,0 +1,117 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.profile");
+
+dojo.profile = new function(){
+	var profiles = {};
+	var pns = [];
+
+	this.start = function(name){
+		if(!profiles[name]){
+			profiles[name] = {iters: 0, total: 0};
+			pns[pns.length] = name;
+		}else{
+			if(profiles[name]["start"]){
+				this.end(name);
+			}
+		}
+		profiles[name].end = null;
+		profiles[name].start = new Date();
+	}
+
+	this.end = function(name){
+		var ed = new Date();
+		if((profiles[name])&&(profiles[name]["start"])){
+			with(profiles[name]){
+				end = ed;
+				total += (end - start);
+				start = null;
+				iters++;
+			}
+		}else{
+			// oops! bad call to end(), what should we do here?
+			return true;
+		}
+	}
+
+	this.stop = this.end;
+
+	this.dump = function(appendToDoc){
+		var tbl = document.createElement("table");
+		with(tbl.style){
+			border = "1px solid black";
+			borderCollapse = "collapse";
+		}
+		var hdr = tbl.createTHead();
+		var hdrtr = hdr.insertRow(0);
+		// document.createElement("tr");
+		var cols = ["Identifier","Calls","Total","Avg"];
+		for(var x=0; x<cols.length; x++){
+			var ntd = hdrtr.insertCell(x);
+			with(ntd.style){
+				backgroundColor = "#225d94";
+				color = "white";
+				borderBottom = "1px solid black";
+				borderRight = "1px solid black";
+				fontFamily = "tahoma";
+				fontWeight = "bolder";
+				paddingLeft = paddingRight = "5px";
+			}
+			ntd.appendChild(document.createTextNode(cols[x]));
+		}
+
+		for(var x=0; x < pns.length; x++){
+			var prf = profiles[pns[x]];
+			this.end(pns[x]);
+			if(prf.iters>0){
+				var bdytr = tbl.insertRow(true);
+				var vals = [pns[x], prf.iters, prf.total, parseInt(prf.total/prf.iters)];
+				for(var y=0; y<vals.length; y++){
+					var cc = bdytr.insertCell(y);
+					cc.appendChild(document.createTextNode(vals[y]));
+					with(cc.style){
+						borderBottom = "1px solid gray";
+						paddingLeft = paddingRight = "5px";
+						if(x%2){
+							backgroundColor = "#e1f1ff";
+						}
+						if(y>0){
+							textAlign = "right";
+							borderRight = "1px solid gray";
+						}else{
+							borderRight = "1px solid black";
+						}
+					}
+				}
+			}
+		}
+
+		if(appendToDoc){
+			var ne = document.createElement("div");
+			ne.id = "profileOutputTable";
+			with(ne.style){
+				fontFamily = "Courier New, monospace";
+				fontSize = "12px";
+				lineHeight = "16px";
+				borderTop = "1px solid black";
+				padding = "10px";
+			}
+			if(document.getElementById("profileOutputTable")){
+				document.body.replaceChild(ne, document.getElementById("profileOutputTable"));
+			}else{
+				document.body.appendChild(ne);
+			}
+			ne.appendChild(tbl);
+		}
+
+		return tbl;
+	}
+}

Added: incubator/xap/trunk/src/dojo/src/regexp.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/regexp.js?rev=417618&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/regexp.js (added)
+++ incubator/xap/trunk/src/dojo/src/regexp.js Tue Jun 27 15:48:54 2006
@@ -0,0 +1,566 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.regexp");
+dojo.provide("dojo.regexp.us");
+
+// *** Regular Expression Generators ***
+
+/**
+  Builds a RE that matches a top-level domain.
+
+  @param flags  An object.
+    flags.allowCC  Include 2 letter country code domains.  Default is true.
+    flags.allowGeneric  Include the generic domains.  Default is true.
+    flags.allowInfra  Include infrastructure domains.  Default is true.
+
+  @return  A string for a regular expression for a top-level domain.
+*/
+dojo.regexp.tld = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.allowCC != "boolean") { flags.allowCC = true; }
+	if (typeof flags.allowInfra != "boolean") { flags.allowInfra = true; }
+	if (typeof flags.allowGeneric != "boolean") { flags.allowGeneric = true; }
+
+	// Infrastructure top-level domain - only one at present
+	var infraRE = "arpa";
+
+	// Generic top-level domains RE.
+	var genericRE = 
+		"aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|xxx|jobs|mobi|post";
+	
+	// Country Code top-level domains RE
+	var ccRE = 
+		"ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|" +
+		"bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|" +
+		"ec|ee|eg|er|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|" +
+		"hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|" +
+		"lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|" +
+		"mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|" +
+		"ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sk|sl|sm|sn|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|" +
+		"to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw";
+
+	// Build top-level domain RE
+	var a = [];
+	if (flags.allowInfra) { a.push(infraRE); }
+	if (flags.allowGeneric) { a.push(genericRE); }
+	if (flags.allowCC) { a.push(ccRE); }
+
+	var tldRE = "";
+	if (a.length > 0) {
+		tldRE = "(" + a.join("|") + ")";
+	}
+
+	return tldRE;
+}
+
+/**
+  Builds a RE that matches an IP Address.
+  Supports 5 formats for IPv4: dotted decimal, dotted hex, dotted octal, decimal and hexadecimal.
+  Supports 2 formats for Ipv6.
+
+  @param flags  An object.  All flags are boolean with default = true.
+    flags.allowDottedDecimal  Example, 207.142.131.235.  No zero padding.
+    flags.allowDottedHex  Example, 0x18.0x11.0x9b.0x28.  Case insensitive.  Zero padding allowed.
+    flags.allowDottedOctal  Example, 0030.0021.0233.0050.  Zero padding allowed.
+    flags.allowDecimal  Example, 3482223595.  A decimal number between 0-4294967295.
+    flags.allowHex  Example, 0xCF8E83EB.  Hexadecimal number between 0x0-0xFFFFFFFF.
+      Case insensitive.  Zero padding allowed.
+    flags.allowIPv6   IPv6 address written as eight groups of four hexadecimal digits.
+    flags.allowHybrid   IPv6 address written as six groups of four hexadecimal digits
+      followed by the usual 4 dotted decimal digit notation of IPv4. x:x:x:x:x:x:d.d.d.d
+
+  @return  A string for a regular expression for an IP address.
+*/
+dojo.regexp.ipAddress = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.allowDottedDecimal != "boolean") { flags.allowDottedDecimal = true; }
+	if (typeof flags.allowDottedHex != "boolean") { flags.allowDottedHex = true; }
+	if (typeof flags.allowDottedOctal != "boolean") { flags.allowDottedOctal = true; }
+	if (typeof flags.allowDecimal != "boolean") { flags.allowDecimal = true; }
+	if (typeof flags.allowHex != "boolean") { flags.allowHex = true; }
+	if (typeof flags.allowIPv6 != "boolean") { flags.allowIPv6 = true; }
+	if (typeof flags.allowHybrid != "boolean") { flags.allowHybrid = true; }
+
+	// decimal-dotted IP address RE.
+	var dottedDecimalRE = 
+		// Each number is between 0-255.  Zero padding is not allowed.
+		"((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
+
+	// dotted hex IP address RE.  Each number is between 0x0-0xff.  Zero padding is allowed, e.g. 0x00.
+	var dottedHexRE = "(0[xX]0*[\\da-fA-F]?[\\da-fA-F]\\.){3}0[xX]0*[\\da-fA-F]?[\\da-fA-F]";
+
+	// dotted octal IP address RE.  Each number is between 0000-0377.  
+	// Zero padding is allowed, but each number must have at least 4 characters.
+	var dottedOctalRE = "(0+[0-3][0-7][0-7]\\.){3}0+[0-3][0-7][0-7]";
+
+	// decimal IP address RE.  A decimal number between 0-4294967295.  
+	var decimalRE =  "(0|[1-9]\\d{0,8}|[1-3]\\d{9}|4[01]\\d{8}|42[0-8]\\d{7}|429[0-3]\\d{6}|" +
+		"4294[0-8]\\d{5}|42949[0-5]\\d{4}|429496[0-6]\\d{3}|4294967[01]\\d{2}|42949672[0-8]\\d|429496729[0-5])";
+
+	// hexadecimal IP address RE. 
+	// A hexadecimal number between 0x0-0xFFFFFFFF. Case insensitive.  Zero padding is allowed.
+	var hexRE = "0[xX]0*[\\da-fA-F]{1,8}";
+
+	// IPv6 address RE. 
+	// The format is written as eight groups of four hexadecimal digits, x:x:x:x:x:x:x:x,
+	// where x is between 0000-ffff. Zero padding is optional. Case insensitive. 
+	var ipv6RE = "([\\da-fA-F]{1,4}\\:){7}[\\da-fA-F]{1,4}";
+
+	// IPv6/IPv4 Hybrid address RE. 
+	// The format is written as six groups of four hexadecimal digits, 
+	// followed by the 4 dotted decimal IPv4 format. x:x:x:x:x:x:d.d.d.d
+	var hybridRE = "([\\da-fA-F]{1,4}\\:){6}" + 
+		"((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
+
+	// Build IP Address RE
+	var a = [];
+	if (flags.allowDottedDecimal) { a.push(dottedDecimalRE); }
+	if (flags.allowDottedHex) { a.push(dottedHexRE); }
+	if (flags.allowDottedOctal) { a.push(dottedOctalRE); }
+	if (flags.allowDecimal) { a.push(decimalRE); }
+	if (flags.allowHex) { a.push(hexRE); }
+	if (flags.allowIPv6) { a.push(ipv6RE); }
+	if (flags.allowHybrid) { a.push(hybridRE); }
+
+	var ipAddressRE = "";
+	if (a.length > 0) {
+		ipAddressRE = "(" + a.join("|") + ")";
+	}
+
+	return ipAddressRE;
+}
+
+/**
+  Builds a RE that matches a host.
+	A host is a domain name or an IP address, possibly followed by a port number.
+
+  @param flags  An object.
+    flags.allowIP  Allow an IP address for hostname.  Default is true.
+    flags.allowLocal  Allow the host to be "localhost".  Default is false.
+    flags.allowPort  Allow a port number to be present.  Default is true.
+    flags in regexp.ipAddress can be applied.
+    flags in regexp.tld can be applied.
+
+  @return  A string for a regular expression for a host.
+*/
+dojo.regexp.host = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.allowIP != "boolean") { flags.allowIP = true; }
+	if (typeof flags.allowLocal != "boolean") { flags.allowLocal = false; }
+	if (typeof flags.allowPort != "boolean") { flags.allowPort = true; }
+
+	// Domain names can not end with a dash.
+	var domainNameRE = "([0-9a-zA-Z]([-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?\\.)+" + dojo.regexp.tld(flags);
+
+	// port number RE
+	portRE = ( flags.allowPort ) ? "(\\:" + dojo.regexp.integer({signed: false}) + ")?" : "";
+
+	// build host RE
+	var hostNameRE = domainNameRE;
+	if (flags.allowIP) { hostNameRE += "|" +  dojo.regexp.ipAddress(flags); }
+	if (flags.allowLocal) { hostNameRE += "|localhost"; }
+
+	return "(" + hostNameRE + ")" + portRE;
+}
+
+/**
+  Builds a regular expression that matches a URL.
+
+  @param flags  An object.
+    flags.scheme  Can be true, false, or [true, false]. 
+      This means: required, not allowed, or match either one.
+    flags in regexp.host can be applied.
+    flags in regexp.ipAddress can be applied.
+    flags in regexp.tld can be applied.
+
+  @return  A string for a regular expression for a URL.
+*/
+dojo.regexp.url = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.scheme == "undefined") { flags.scheme = [true, false]; }
+
+	// Scheme RE
+	var protocalRE = dojo.regexp.buildGroupRE(flags.scheme,
+		function(q) { if (q) { return "(https?|ftps?)\\://"; }  return ""; }
+	);
+
+	// Path and query and anchor RE
+	var pathRE = "(/([^?#\\s/]+/)*)?([^?#\\s/]+(\\?[^?#\\s/]*)?(#[A-Za-z][\\w.:-]*)?)?";
+
+	return (protocalRE + dojo.regexp.host(flags) + pathRE);
+}
+
+/**
+  Builds a regular expression that matches an email address.
+
+  @param flags  An object.
+    flags.allowCruft  Allow address like <mailto:foo@yahoo.com>.  Default is false.
+    flags in regexp.host can be applied.
+    flags in regexp.ipAddress can be applied.
+    flags in regexp.tld can be applied.
+
+  @return  A string for a regular expression for an email address.
+*/
+dojo.regexp.emailAddress = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.allowCruft != "boolean") { flags.allowCruft = false; }
+	flags.allowPort = false; // invalid in email addresses
+
+	// user name RE - apostrophes are valid if there's not 2 in a row
+	var usernameRE = "([\\da-z]+[-._+&'])*[\\da-z]+";
+
+	// build emailAddress RE
+	var emailAddressRE = usernameRE + "@" + dojo.regexp.host(flags);
+
+	// Allow email addresses with cruft
+	if ( flags.allowCruft ) {
+		emailAddressRE = "<?(mailto\\:)?" + emailAddressRE + ">?";
+	}
+
+	return emailAddressRE;
+}
+
+/**
+  Builds a regular expression that matches a list of email addresses.
+
+  @param flags  An object.
+    flags.listSeparator  The character used to separate email addresses.  Default is ";", ",", "\n" or " ".
+    flags in regexp.emailAddress can be applied.
+    flags in regexp.host can be applied.
+    flags in regexp.ipAddress can be applied.
+    flags in regexp.tld can be applied.
+
+  @return  A string for a regular expression for an email address list.
+*/
+dojo.regexp.emailAddressList = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.listSeparator != "string") { flags.listSeparator = "\\s;,"; }
+
+	// build a RE for an Email Address List
+	var emailAddressRE = dojo.regexp.emailAddress(flags);
+	var emailAddressListRE = "(" + emailAddressRE + "\\s*[" + flags.listSeparator + "]\\s*)*" + 
+		emailAddressRE + "\\s*[" + flags.listSeparator + "]?\\s*";
+
+	return emailAddressListRE;
+}
+
+/**
+  Builds a regular expression that matches an integer.
+
+  @param flags  An object.
+    flags.signed  The leading plus-or-minus sign.  Can be true, false, or [true, false].
+      Default is [true, false], (i.e. will match if it is signed or unsigned).
+    flags.separator  The character used as the thousands separator.  Default is no separator.
+      For more than one symbol use an array, e.g. [",", ""], makes ',' optional.
+
+  @return  A string for a regular expression for an integer.
+*/
+dojo.regexp.integer = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.signed == "undefined") { flags.signed = [true, false]; }
+	if (typeof flags.separator == "undefined") { flags.separator = ""; }
+
+	// build sign RE
+	var signRE = dojo.regexp.buildGroupRE(flags.signed,
+		function(q) { if (q) { return "[-+]"; }  return ""; }
+	);
+
+	// number RE
+	var numberRE = dojo.regexp.buildGroupRE(flags.separator,
+		function(sep) { 
+			if ( sep == "" ) { 
+				return "(0|[1-9]\\d*)"; 
+			}
+			return "(0|[1-9]\\d{0,2}([" + sep + "]\\d{3})*)"; 
+		}
+	);
+	var numberRE;
+
+	// integer RE
+	return (signRE + numberRE);
+}
+
+/**
+  Builds a regular expression to match a real number in exponential notation.
+
+  @param flags  An object.
+    flags.places  The integer number of decimal places.
+      If not given, the decimal part is optional and the number of places is unlimited.
+    flags.decimal  A string for the character used as the decimal point.  Default is ".".
+    flags.exponent  Express in exponential notation.  Can be true, false, or [true, false].
+      Default is [true, false], (i.e. will match if the exponential part is present are not).
+    flags.eSigned  The leading plus-or-minus sign on the exponent.  Can be true, false, 
+      or [true, false].  Default is [true, false], (i.e. will match if it is signed or unsigned).
+    flags in regexp.integer can be applied.
+
+  @return  A string for a regular expression for a real number.
+*/
+dojo.regexp.realNumber = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.places != "number") { flags.places = Infinity; }
+	if (typeof flags.decimal != "string") { flags.decimal = "."; }
+	if (typeof flags.exponent == "undefined") { flags.exponent = [true, false]; }
+	if (typeof flags.eSigned == "undefined") { flags.eSigned = [true, false]; }
+
+	// integer RE
+	var integerRE = dojo.regexp.integer(flags);
+
+	// decimal RE
+	var decimalRE = "";
+	if ( flags.places == Infinity) { 
+		decimalRE = "(\\" + flags.decimal + "\\d+)?"; 
+	}
+	else if ( flags.places > 0) { 
+		decimalRE = "\\" + flags.decimal + "\\d{" + flags.places + "}"; 
+	}
+
+	// exponent RE
+	var exponentRE = dojo.regexp.buildGroupRE(flags.exponent,
+		function(q) { 
+			if (q) { return "([eE]" + dojo.regexp.integer({signed: flags.eSigned}) + ")"; }
+			return ""; 
+		}
+	);
+
+	// real number RE
+	return (integerRE + decimalRE + exponentRE);
+}
+
+/**
+  Builds a regular expression to match a monetary value.
+
+  @param flags  An object.
+    flags.signed  The leading plus-or-minus sign.  Can be true, false, or [true, false].
+      Default is [true, false], (i.e. will match if it is signed or unsigned).
+    flags.symbol  A currency symbol such as Yen "�", Pound "�", or the Euro sign "�".  
+      Default is "$".  For more than one symbol use an array, e.g. ["$", ""], makes $ optional.
+    flags.placement  The symbol can come "before" the number or "after".  Default is "before".
+    flags.separator  The character used as the thousands separator. The default is ",".
+    flags.cents  The two decimal places for cents.  Can be true, false, or [true, false].
+      Default is [true, false], (i.e. will match if cents are present are not).
+    flags.decimal  A string for the character used as the decimal point.  Default is ".".
+
+  @return  A string for a regular expression for a monetary value.
+*/
+dojo.regexp.currency = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.signed == "undefined") { flags.signed = [true, false]; }
+	if (typeof flags.symbol == "undefined") { flags.symbol = "$"; }
+	if (typeof flags.placement != "string") { flags.placement = "before"; }
+	if (typeof flags.separator != "string") { flags.separator = ","; }
+	if (typeof flags.cents == "undefined") { flags.cents = [true, false]; }
+	if (typeof flags.decimal != "string") { flags.decimal = "."; }
+
+	// build sign RE
+	var signRE = dojo.regexp.buildGroupRE(flags.signed,
+		function(q) { if (q) { return "[-+]"; }  return ""; }
+	);
+
+	// build symbol RE
+	var symbolRE = dojo.regexp.buildGroupRE(flags.symbol,
+		function(symbol) { 
+			// escape all special characters
+			return "\\s?" + symbol.replace( /([.$?*!=:|\\\/^])/g, "\\$1") + "\\s?";
+		}
+	);
+
+	// number RE
+	var numberRE = dojo.regexp.integer( {signed: false, separator: flags.separator} );
+
+	// build cents RE
+	var centsRE = dojo.regexp.buildGroupRE(flags.cents,
+		function(q) { if (q) { return "(\\" + flags.decimal + "\\d\\d)"; }  return ""; }
+	);
+
+	// build currency RE
+	var currencyRE;
+	if (flags.placement == "before") {
+		currencyRE = signRE + symbolRE + numberRE + centsRE;
+	}
+	else {
+		currencyRE = signRE + numberRE + centsRE + symbolRE;
+	}
+
+	return currencyRE;
+}
+
+/**
+  A regular expression to match US state and territory abbreviations.
+
+  @param flags  An object.
+    flags.allowTerritories  Allow Guam, Puerto Rico, etc.  Default is true.
+    flags.allowMilitary  Allow military 'states', e.g. Armed Forces Europe (AE).  Default is true.
+
+  @return  A string for a regular expression for a US state.
+*/
+dojo.regexp.us.state = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.allowTerritories != "boolean") { flags.allowTerritories = true; }
+	if (typeof flags.allowMilitary != "boolean") { flags.allowMilitary = true; }
+
+	// state RE
+	var statesRE = 
+		"AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|" + 
+		"NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY";
+
+	// territories RE
+	var territoriesRE = "AS|FM|GU|MH|MP|PW|PR|VI";
+
+	// military states RE
+	var militaryRE = "AA|AE|AP";
+
+	// Build states and territories RE
+	if (flags.allowTerritories) { statesRE += "|" + territoriesRE; }
+	if (flags.allowMilitary) { statesRE += "|" + militaryRE; }
+
+	return "(" + statesRE + ")";
+}
+
+/**
+  Builds a regular expression to match any International format for time.
+  The RE can match one format or one of multiple formats.
+
+  Format
+  h        12 hour, no zero padding.
+  hh       12 hour, has leading zero.
+  H        24 hour, no zero padding.
+  HH       24 hour, has leading zero.
+  m        minutes, no zero padding.
+  mm       minutes, has leading zero.
+  s        seconds, no zero padding.
+  ss       seconds, has leading zero.
+  t        am or pm, case insensitive.
+  All other characters must appear literally in the expression.
+
+  Example
+    "h:m:s t"  ->   2:5:33 PM
+    "HH:mm:ss" ->  14:05:33
+
+  @param flags  An object.
+    flags.format  A string or an array of strings.  Default is "h:mm:ss t".
+    flags.amSymbol  The symbol used for AM.  Default is "AM".
+    flags.pmSymbol  The symbol used for PM.  Default is "PM".
+
+  @return  A string for a regular expression for a time value.
+*/
+dojo.regexp.time = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.format == "undefined") { flags.format = "h:mm:ss t"; }
+	if (typeof flags.amSymbol != "string") { flags.amSymbol = "AM"; }
+	if (typeof flags.pmSymbol != "string") { flags.pmSymbol = "PM"; }
+
+	// Converts a time format to a RE
+	var timeRE = function(format) {
+		// escape all special characters
+		format = format.replace( /([.$?*!=:|{}\(\)\[\]\\\/^])/g, "\\$1");
+		var amRE = flags.amSymbol.replace( /([.$?*!=:|{}\(\)\[\]\\\/^])/g, "\\$1");
+		var pmRE = flags.pmSymbol.replace( /([.$?*!=:|{}\(\)\[\]\\\/^])/g, "\\$1");
+
+		// replace tokens with Regular Expressions
+		format = format.replace("hh", "(0[1-9]|1[0-2])");
+		format = format.replace("h", "([1-9]|1[0-2])");
+		format = format.replace("HH", "([01][0-9]|2[0-3])");
+		format = format.replace("H", "([0-9]|1[0-9]|2[0-3])");
+		format = format.replace("mm", "([0-5][0-9])");
+		format = format.replace("m", "([1-5][0-9]|[0-9])");
+		format = format.replace("ss", "([0-5][0-9])");
+		format = format.replace("s", "([1-5][0-9]|[0-9])");
+		format = format.replace("t", "\\s?(" + amRE + "|" + pmRE + ")\\s?" );
+
+		return format;
+	};
+
+	// build RE for multiple time formats
+	return dojo.regexp.buildGroupRE(flags.format, timeRE);
+}
+
+/**
+  Builds a regular expression to match any sort of number based format.
+  Use it for phone numbers, social security numbers, zip-codes, etc.
+  The RE can match one format or one of multiple formats.
+
+  Format
+    #        Stands for a digit, 0-9.
+    ?        Stands for an optional digit, 0-9 or nothing.
+    All other characters must appear literally in the expression.
+
+  Example   
+    "(###) ###-####"       ->   (510) 542-9742
+    "(###) ###-#### x#???" ->   (510) 542-9742 x153
+    "###-##-####"          ->   506-82-1089       i.e. social security number
+    "#####-####"           ->   98225-1649        i.e. zip code
+
+  @param flags  An object.
+    flags.format  A string or an Array of strings for multiple formats.
+  @return  A string for a regular expression for the number format(s).
+*/
+dojo.regexp.numberFormat = function(flags) {
+	// assign default values to missing paramters
+	flags = (typeof flags == "object") ? flags : {};
+	if (typeof flags.format == "undefined") { flags.format = "###-###-####"; }
+
+	// Converts a number format to RE.
+	var digitRE = function(format) {
+		// escape all special characters, except '?'
+		format = format.replace( /([.$*!=:|{}\(\)\[\]\\\/^])/g, "\\$1");
+
+		// Now replace '?' with Regular Expression
+		format = format.replace(/\?/g, "\\d?");
+
+		// replace # with Regular Expression
+		format = format.replace(/#/g, "\\d");
+
+		return format;
+	};
+
+	// build RE for multiple number formats
+	return dojo.regexp.buildGroupRE(flags.format, digitRE);
+}
+
+
+/**
+  This is basically a utility function used by some of the RE generators.
+  Builds a regular expression that groups subexpressions.
+  The subexpressions are constructed by the function, re, in the second parameter.
+  re builds one subexpression for each elem in the array a, in the first parameter.
+
+  @param a  A single value or an array of values.
+  @param re  A function.  Takes one parameter and converts it to a regular expression. 
+  @return  A string for a regular expression that groups all the subexpressions.
+*/
+dojo.regexp.buildGroupRE = function(a, re) {
+
+	// case 1: a is a single value.
+	if ( !( a instanceof Array ) ) { 
+		return re(a);
+	}
+
+	// case 2: a is an array
+	var b = [];
+	for (var i = 0; i < a.length; i++) {
+		// convert each elem to a RE
+		b.push(re(a[i]));
+	}
+
+	 // join the REs as alternatives in a RE group.
+	return "(" + b.join("|") + ")";
+}

Added: incubator/xap/trunk/src/dojo/src/rpc/Deferred.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/rpc/Deferred.js?rev=417618&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/rpc/Deferred.js (added)
+++ incubator/xap/trunk/src/dojo/src/rpc/Deferred.js Tue Jun 27 15:48:54 2006
@@ -0,0 +1,15 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.rpc.Deferred");
+dojo.require("dojo.Deferred");
+
+dojo.rpc.Deferred = dojo.Deferred;
+dojo.rpc.Deferred.prototype = dojo.Deferred.prototype;

Propchange: incubator/xap/trunk/src/dojo/src/rpc/Deferred.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/src/dojo/src/rpc/JotService.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/rpc/JotService.js?rev=417618&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/rpc/JotService.js (added)
+++ incubator/xap/trunk/src/dojo/src/rpc/JotService.js Tue Jun 27 15:48:54 2006
@@ -0,0 +1,41 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.rpc.JotService");
+dojo.require("dojo.rpc.RpcService");
+dojo.require("dojo.rpc.JsonService");
+dojo.require("dojo.json");
+
+dojo.rpc.JotService = function(){
+	this.serviceUrl = "/_/jsonrpc";
+}
+
+dojo.inherits(dojo.rpc.JotService, dojo.rpc.JsonService);
+
+dojo.lang.extend(dojo.rpc.JotService, {
+	bind: function(method, parameters, deferredRequestHandler, url){
+		dojo.io.bind({
+			url: url||this.serviceUrl,
+			content: {
+				json: this.createRequest(method, parameters)
+			},
+			method: "POST",
+			mimetype: "text/json",
+			load: this.resultCallback(deferredRequestHandler),
+			error: this.errorCallback(deferredRequestHandler),
+			preventCache: true
+		});
+	},
+
+	createRequest: function(method, params){
+		var req = { "params": params, "method": method, "id": this.lastSubmissionId++ };
+		return dojo.json.serialize(req);
+	}
+});

Propchange: incubator/xap/trunk/src/dojo/src/rpc/JotService.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/src/dojo/src/rpc/JsonService.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/rpc/JsonService.js?rev=417618&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/rpc/JsonService.js (added)
+++ incubator/xap/trunk/src/dojo/src/rpc/JsonService.js Tue Jun 27 15:48:54 2006
@@ -0,0 +1,103 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.rpc.JsonService");
+dojo.require("dojo.rpc.RpcService");
+dojo.require("dojo.io.*");
+dojo.require("dojo.json");
+dojo.require("dojo.lang");
+
+dojo.rpc.JsonService = function(args){
+	// passing just the URL isn't terribly useful. It's expected that at
+	// various times folks will want to specify:
+	//	- just the serviceUrl (for use w/ remoteCall())
+	//	- the text of the SMD to evaluate
+	// 	- a raw SMD object
+	//	- the SMD URL
+	if(args){
+		if(dojo.lang.isString(args)){
+			// we assume it's an SMD file to be processed, since this was the
+			// earlier function signature
+
+			// FIXME: also accept dojo.uri.Uri objects?
+			this.connect(args);
+		}else{
+			// otherwise we assume it's an arguments object with the following
+			// (optional) properties:
+			//	- serviceUrl
+			//	- strictArgChecks
+			//	- smdUrl
+			//	- smdStr
+			//	- smdObj
+			if(args["smdUrl"]){
+				this.connect(args.smdUrl);
+			}
+			if(args["smdStr"]){
+				this.processSmd(dj_eval("("+args.smdStr+")"));
+			}
+			if(args["smdObj"]){
+				this.processSmd(args.smdObj);
+			}
+			if(args["serviceUrl"]){
+				this.serviceUrl = args.serviceUrl;
+			}
+			if(typeof args["strictArgChecks"] != "undefined"){
+				this.strictArgChecks = args.strictArgChecks;
+			}
+		}
+	}
+}
+
+dojo.inherits(dojo.rpc.JsonService, dojo.rpc.RpcService);
+
+dojo.lang.extend(dojo.rpc.JsonService, {
+
+	bustCache: false,
+	
+	contentType: "application/json-rpc",
+
+	lastSubmissionId: 0,
+
+	callRemote: function(method, params){
+		var deferred = new dojo.rpc.Deferred();
+		this.bind(method, params, deferred);
+		return deferred;
+	},
+
+	bind: function(method, parameters, deferredRequestHandler, url){
+		dojo.io.bind({
+			url: url||this.serviceUrl,
+			postContent: this.createRequest(method, parameters),
+			method: "POST",
+			contentType: this.contentType,
+			mimetype: "text/json",
+			load: this.resultCallback(deferredRequestHandler),
+			preventCache:this.bustCache 
+		});
+	},
+
+	createRequest: function(method, params){
+		var req = { "params": params, "method": method, "id": ++this.lastSubmissionId };
+		var data = dojo.json.serialize(req);
+		dojo.debug("JsonService: JSON-RPC Request: " + data);
+		return data;
+	},
+
+	parseResults: function(obj){
+		if(!obj){ return; }
+		if(obj["Result"]||obj["result"]){
+			return obj["result"]||obj["Result"];
+		}else if(obj["ResultSet"]){
+			return obj["ResultSet"];
+		}else{
+			return obj;
+		}
+	}
+});

Propchange: incubator/xap/trunk/src/dojo/src/rpc/JsonService.js
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message