You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2006/09/23 01:22:51 UTC
svn commit: r449122 [3/40] - in
/tapestry/tapestry4/trunk/tapestry-framework/src: java/org/apache/tapestry/
java/org/apache/tapestry/dojo/ java/org/apache/tapestry/dojo/form/
java/org/apache/tapestry/dojo/html/ java/org/apache/tapestry/form/
java/org/a...
Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/dojo.js.uncompressed.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/dojo.js.uncompressed.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/dojo.js.uncompressed.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/dojo.js.uncompressed.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,3239 @@
+if(typeof dojo == "undefined"){
+
+/**
+* @file bootstrap1.js
+*
+* summary: First file that is loaded that 'bootstraps' the entire dojo library suite.
+* note: Must run before hostenv_*.js file.
+*
+* @author Copyright 2004 Mark D. Anderson (mda@discerning.com)
+* TODOC: should the copyright be changed to Dojo Foundation?
+* @license Licensed under the Academic Free License 2.1 http://www.opensource.org/licenses/afl-2.1.php
+*
+* $Id: bootstrap1.js 5297 2006-08-17 00:32:04Z sjmiles $
+*/
+
+// TODOC: HOW TO DOC THE BELOW?
+// @global: djConfig
+// summary:
+// Application code can set the global 'djConfig' prior to loading
+// the library to override certain global settings for how dojo works.
+// description: The variables that can be set are as follows:
+// - isDebug: false
+// - allowQueryConfig: false
+// - baseScriptUri: ""
+// - baseRelativePath: ""
+// - libraryScriptUri: ""
+// - iePreventClobber: false
+// - ieClobberMinimal: true
+// - locale: undefined
+// - extraLocale: undefined
+// - preventBackButtonFix: true
+// - searchIds: []
+// - parseWidgets: true
+// TODOC: HOW TO DOC THESE VARIABLES?
+// TODOC: IS THIS A COMPLETE LIST?
+// note:
+// 'djConfig' does not exist under 'dojo.*' so that it can be set before the
+// 'dojo' variable exists.
+// note:
+// Setting any of these variables *after* the library has loaded does nothing at all.
+// TODOC: is this still true? Release notes for 0.3 indicated they could be set after load.
+//
+
+
+//TODOC: HOW TO DOC THIS?
+// @global: dj_global
+// summary:
+// an alias for the top-level global object in the host environment
+// (e.g., the window object in a browser).
+// description:
+// Refer to 'dj_global' rather than referring to window to ensure your
+// code runs correctly in contexts other than web browsers (eg: Rhino on a server).
+var dj_global = this;
+
+//TODOC: HOW TO DOC THIS?
+// @global: dj_currentContext
+// summary:
+// Private global context object. Where 'dj_global' always refers to the boot-time
+// global context, 'dj_currentContext' can be modified for temporary context shifting.
+// dojo.global() returns dj_currentContext.
+// description:
+// Refer to dojo.global() rather than referring to dj_global to ensure your
+// code runs correctly in managed contexts.
+var dj_currentContext = this;
+
+
+// ****************************************************************
+// global public utils
+// TODOC: DO WE WANT TO NOTE THAT THESE ARE GLOBAL PUBLIC UTILS?
+// ****************************************************************
+
+function dj_undef(/*String*/ name, /*Object?*/ object){
+ //summary: Returns true if 'name' is defined on 'object' (or globally if 'object' is null).
+ //description: Note that 'defined' and 'exists' are not the same concept.
+ return (typeof (object || dj_currentContext)[name] == "undefined"); // Boolean
+}
+
+// make sure djConfig is defined
+if(dj_undef("djConfig", this)){
+ var djConfig = {};
+}
+
+//TODOC: HOW TO DOC THIS?
+// dojo is the root variable of (almost all) our public symbols -- make sure it is defined.
+if(dj_undef("dojo", this)){
+ var dojo = {};
+}
+
+dojo.global = function(){
+ // summary:
+ // return the current global context object
+ // (e.g., the window object in a browser).
+ // description:
+ // Refer to 'dojo.global()' rather than referring to window to ensure your
+ // code runs correctly in contexts other than web browsers (eg: Rhino on a server).
+ return dj_currentContext;
+}
+
+// Override locale setting, if specified
+dojo.locale = djConfig.locale;
+
+//TODOC: HOW TO DOC THIS?
+dojo.version = {
+ // summary: version number of this instance of dojo.
+ major: 0, minor: 0, patch: 0, flag: "dev",
+ revision: Number("$Rev: 5297 $".match(/[0-9]+/)[0]),
+ toString: function(){
+ with(dojo.version){
+ return major + "." + minor + "." + patch + flag + " (" + revision + ")"; // String
+ }
+ }
+}
+
+dojo.evalProp = function(/*String*/ name, /*Object*/ object, /*Boolean?*/ create){
+ // summary: Returns 'object[name]'. If not defined and 'create' is true, will return a new Object.
+ // description:
+ // Returns null if 'object[name]' is not defined and 'create' is not true.
+ // Note: 'defined' and 'exists' are not the same concept.
+ if((!object)||(!name)) return undefined; // undefined
+ if(!dj_undef(name, object)) return object[name]; // mixed
+ return (create ? (object[name]={}) : undefined); // mixed
+}
+
+dojo.parseObjPath = function(/*String*/ path, /*Object?*/ context, /*Boolean?*/ create){
+ // summary: Parse string path to an object, and return corresponding object reference and property name.
+ // description:
+ // Returns an object with two properties, 'obj' and 'prop'.
+ // 'obj[prop]' is the reference indicated by 'path'.
+ // path: Path to an object, in the form "A.B.C".
+ // context: Object to use as root of path. Defaults to 'dojo.global()'.
+ // create: If true, Objects will be created at any point along the 'path' that is undefined.
+ var object = (context || dojo.global());
+ var names = path.split('.');
+ var prop = names.pop();
+ for (var i=0,l=names.length;i<l && object;i++){
+ object = dojo.evalProp(names[i], object, create);
+ }
+ return {obj: object, prop: prop}; // Object: {obj: Object, prop: String}
+}
+
+dojo.evalObjPath = function(/*String*/ path, /*Boolean?*/ create){
+ // summary: Return the value of object at 'path' in the global scope, without using 'eval()'.
+ // path: Path to an object, in the form "A.B.C".
+ // create: If true, Objects will be created at any point along the 'path' that is undefined.
+ if(typeof path != "string"){
+ return dojo.global();
+ }
+ // fast path for no periods
+ if(path.indexOf('.') == -1){
+ return dojo.evalProp(path, dojo.global(), create); // mixed
+ }
+
+ //MOW: old 'with' syntax was confusing and would throw an error if parseObjPath returned null.
+ var ref = dojo.parseObjPath(path, dojo.global(), create);
+ if(ref){
+ return dojo.evalProp(ref.prop, ref.obj, create); // mixed
+ }
+ return null;
+}
+
+dojo.errorToString = function(/*Error*/ exception){
+ // summary: Return an exception's 'message', 'description' or text.
+
+ // TODO: overriding Error.prototype.toString won't accomplish this?
+ // ... since natively generated Error objects do not always reflect such things?
+ if(!dj_undef("message", exception)){
+ return exception.message; // String
+ }else if(!dj_undef("description", exception)){
+ return exception.description; // String
+ }else{
+ return exception; // Error
+ }
+}
+
+dojo.raise = function(/*String*/ message, /*Error?*/ exception){
+ // summary: Throw an error message, appending text of 'exception' if provided.
+ // note: Also prints a message to the user using 'dojo.hostenv.println'.
+ if(exception){
+ message = message + ": "+dojo.errorToString(exception);
+ }
+
+ // print the message to the user if hostenv.println is defined
+ try { dojo.hostenv.println("FATAL: "+message); } catch (e) {}
+
+ throw Error(message);
+}
+
+//Stub functions so things don't break.
+//TODOC: HOW TO DOC THESE?
+dojo.debug = function(){}
+dojo.debugShallow = function(obj){}
+dojo.profile = { start: function(){}, end: function(){}, stop: function(){}, dump: function(){} };
+
+function dj_eval(/*String*/ scriptFragment){
+ // summary: Perform an evaluation in the global scope. Use this rather than calling 'eval()' directly.
+ // description: Placed in a separate function to minimize size of trapped evaluation context.
+ // note:
+ // - JSC eval() takes an optional second argument which can be 'unsafe'.
+ // - Mozilla/SpiderMonkey eval() takes an optional second argument which is the
+ // scope object for new symbols.
+ return dj_global.eval ? dj_global.eval(scriptFragment) : eval(scriptFragment); // mixed
+}
+
+dojo.unimplemented = function(/*String*/ funcname, /*String?*/ extra){
+ // summary: Throw an exception because some function is not implemented.
+ // extra: Text to append to the exception message.
+ var message = "'" + funcname + "' not implemented";
+ if (extra != null) { message += " " + extra; }
+ dojo.raise(message);
+}
+
+dojo.deprecated = function(/*String*/ behaviour, /*String?*/ extra, /*String?*/ removal){
+ // summary: Log a debug message to indicate that a behavior has been deprecated.
+ // extra: Text to append to the message.
+ // removal: Text to indicate when in the future the behavior will be removed.
+ var message = "DEPRECATED: " + behaviour;
+ if(extra){ message += " " + extra; }
+ if(removal){ message += " -- will be removed in version: " + removal; }
+ dojo.debug(message);
+}
+
+dojo.render = (function(){
+ //TODOC: HOW TO DOC THIS?
+ // summary: Details rendering support, OS and browser of the current environment.
+ // TODOC: is this something many folks will interact with? If so, we should doc the structure created...
+ function vscaffold(prefs, names){
+ var tmp = {
+ capable: false,
+ support: {
+ builtin: false,
+ plugin: false
+ },
+ prefixes: prefs
+ };
+ for(var i=0; i<names.length; i++){
+ tmp[names[i]] = false;
+ }
+ return tmp;
+ }
+
+ return {
+ name: "",
+ ver: dojo.version,
+ os: { win: false, linux: false, osx: false },
+ html: vscaffold(["html"], ["ie", "opera", "khtml", "safari", "moz"]),
+ svg: vscaffold(["svg"], ["corel", "adobe", "batik"]),
+ vml: vscaffold(["vml"], ["ie"]),
+ swf: vscaffold(["Swf", "Flash", "Mm"], ["mm"]),
+ swt: vscaffold(["Swt"], ["ibm"])
+ };
+})();
+
+// ****************************************************************
+// dojo.hostenv methods that must be defined in hostenv_*.js
+// ****************************************************************
+
+/**
+ * The interface definining the interaction with the EcmaScript host environment.
+*/
+
+/*
+ * None of these methods should ever be called directly by library users.
+ * Instead public methods such as loadModule should be called instead.
+ */
+dojo.hostenv = (function(){
+ // TODOC: HOW TO DOC THIS?
+ // summary: Provides encapsulation of behavior that changes across different 'host environments'
+ // (different browsers, server via Rhino, etc).
+ // description: None of these methods should ever be called directly by library users.
+ // Use public methods such as 'loadModule' instead.
+
+ // default configuration options
+ var config = {
+ isDebug: false,
+ allowQueryConfig: false,
+ baseScriptUri: "",
+ baseRelativePath: "",
+ libraryScriptUri: "",
+ iePreventClobber: false,
+ ieClobberMinimal: true,
+ preventBackButtonFix: true,
+ searchIds: [],
+ parseWidgets: true
+ };
+
+ if (typeof djConfig == "undefined") { djConfig = config; }
+ else {
+ for (var option in config) {
+ if (typeof djConfig[option] == "undefined") {
+ djConfig[option] = config[option];
+ }
+ }
+ }
+
+ return {
+ name_: '(unset)',
+ version_: '(unset)',
+
+
+ getName: function(){
+ // sumary: Return the name of the host environment.
+ return this.name_; // String
+ },
+
+
+ getVersion: function(){
+ // summary: Return the version of the hostenv.
+ return this.version_; // String
+ },
+
+ getText: function(/*String*/ uri){
+ // summary: Read the plain/text contents at the specified 'uri'.
+ // description:
+ // If 'getText()' is not implemented, then it is necessary to override
+ // 'loadUri()' with an implementation that doesn't rely on it.
+
+ dojo.unimplemented('getText', "uri=" + uri);
+ }
+ };
+})();
+
+
+dojo.hostenv.getBaseScriptUri = function(){
+ // summary: Return the base script uri that other scripts are found relative to.
+ // TODOC: HUH? This comment means nothing to me. What other scripts? Is this the path to other dojo libraries?
+ // MAYBE: Return the base uri to scripts in the dojo library. ???
+ // return: Empty string or a path ending in '/'.
+ if(djConfig.baseScriptUri.length){
+ return djConfig.baseScriptUri;
+ }
+
+ // MOW: Why not:
+ // uri = djConfig.libraryScriptUri || djConfig.baseRelativePath
+ // ??? Why 'new String(...)'
+ var uri = new String(djConfig.libraryScriptUri||djConfig.baseRelativePath);
+ if (!uri) { dojo.raise("Nothing returned by getLibraryScriptUri(): " + uri); }
+
+ // MOW: uri seems to not be actually used. Seems to be hard-coding to djConfig.baseRelativePath... ???
+ var lastslash = uri.lastIndexOf('/'); // MOW ???
+ djConfig.baseScriptUri = djConfig.baseRelativePath;
+ return djConfig.baseScriptUri; // String
+}
+
+/*
+ * loader.js - A bootstrap module. 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};
+ },
+
+ moduleHasPrefix: function(module){
+ var mp = this.modulePrefixes_;
+ return Boolean(mp[module] && mp[module].value);
+ },
+
+ getModulePrefix: function(module){
+ if(this.moduleHasPrefix(module)){
+ return this.modulePrefixes_[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: [],
+ unloadListeners: [],
+ loadNotifying: false
+ };
+
+ //Add all of these properties to dojo.hostenv
+ for(var param in _addHostEnv){
+ dojo.hostenv[param] = _addHostEnv[param];
+ }
+})();
+
+dojo.hostenv.loadPath = function(/*String*/relpath, /*String?*/module, /*Function?*/cb){
+// summary:
+// Load a Javascript module given a relative path
+//
+// description:
+// 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().
+//
+// relpath: A relative path to a script (no leading '/', and typically
+// ending in '.js').
+// module: A module whose existance to check for after loading a path.
+// Can be used to determine success or failure of the load.
+// cb: a callback function to pass the result of evaluating the script
+
+ var uri;
+ if(relpath.charAt(0) == '/' || relpath.match(/^\w+:/)){
+ // dojo.raise("relpath '" + relpath + "'; must be relative");
+ uri = relpath;
+ }else{
+ 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); // Boolean
+ }catch(e){
+ dojo.debug(e);
+ return false; // Boolean
+ }
+}
+
+dojo.hostenv.loadUri = function(/*String (URL)*/uri, /*Function?*/cb){
+// summary:
+// Loads JavaScript from a URI
+//
+// description:
+// Reads the contents of the URI, and evaluates the contents. This is used to load modules as well
+// as resource bundles. Returns true if it succeeded. Returns false if the URI reading failed.
+// Throws if the evaluation throws.
+//
+// uri: a uri which points at the script to be loaded
+// cb: a callback function to process the result of evaluating the script as an expression, typically
+// used by the resource bundle loader to load JSON-style resources
+
+ if(this.loadedUris[uri]){
+ return true; // Boolean
+ }
+ var contents = this.getText(uri, null, true);
+ if(!contents){ return false; } // Boolean
+ this.loadedUris[uri] = true;
+ if(cb){ contents = '('+contents+')'; }
+ var value = dj_eval(contents);
+ if(cb){ cb(value); }
+ return true; // Boolean
+}
+
+// FIXME: probably need to add logging to this method
+dojo.hostenv.loadUriAndCheck = function(uri, module, /*Function?*/cb){
+ var ok = true;
+ try{
+ ok = this.loadUri(uri, cb);
+ }catch(e){
+ dojo.debug("failed loading ", uri, " with error: ", e);
+ }
+ return Boolean(ok && this.findModule(module, false)); // Boolean
+}
+
+dojo.loaded = function(){ }
+dojo.unloaded = function(){ }
+
+dojo.hostenv.loaded = function(){
+ this.loadNotifying = true;
+ this.post_load_ = true;
+ var mll = this.modulesLoadedListeners;
+ for(var x=0; x<mll.length; x++){
+ mll[x]();
+ }
+
+ //Clear listeners so new ones can be added
+ //For other xdomain package loads after the initial load.
+ this.modulesLoadedListeners = [];
+ this.loadNotifying = false;
+
+ dojo.loaded();
+}
+
+dojo.hostenv.unloaded = function(){
+ var mll = this.unloadListeners;
+ while(mll.length){
+ (mll.pop())();
+ }
+ dojo.unloaded();
+}
+
+/*
+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.loadNotifying){
+ dh.callLoaded();
+ }
+}
+
+dojo.addOnUnload = function(obj, fcnName){
+ var dh = dojo.hostenv;
+ if(arguments.length == 1){
+ dh.unloadListeners.push(obj);
+ } else if(arguments.length > 1) {
+ dh.unloadListeners.push(function() {
+ obj[fcnName]();
+ });
+ }
+}
+
+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();
+ }
+}
+
+dojo.hostenv.getModuleSymbols = function(modulename){
+ var syms = modulename.split(".");
+ for(var i = syms.length; i>0; i--){
+ var parentModule = syms.slice(0, i).join(".");
+ if ((i==1) && !this.moduleHasPrefix(parentModule)){
+ //Support default module directory (sibling of dojo)
+ syms[0] = "../" + syms[0];
+ }else{
+ var parentModulePath = this.getModulePrefix(parentModule);
+ if(parentModulePath != parentModule){
+ syms.splice(0, i, parentModulePath);
+ break;
+ }
+ }
+ }
+ return syms;
+}
+
+dojo.hostenv._global_omit_module_check = false;
+dojo.hostenv.loadModule = function(modulename, exactOnly, omitModuleCheck){
+// summary:
+// loads a Javascript module from the appropriate URI
+//
+// description:
+// 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
+
+ if(!modulename){ return; }
+ omitModuleCheck = this._global_omit_module_check || omitModuleCheck;
+ 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 nsyms = modulename.split(".");
+
+ // this line allowed loading of a module manifest as if it were a namespace
+ // it's an interesting idea, but shouldn't be combined with 'namespaces' proper
+ // and leads to unwanted dependencies
+ // the effect can be achieved in other (albeit less-flexible) ways now, so I am
+ // removing this pending further design work
+ // perhaps we can explicitly define this idea of a 'module manifest', and subclass
+ // 'namespace manifest' from that
+ //dojo.getNamespace(nsyms[0]);
+
+ var syms = this.getModuleSymbols(modulename);
+ var startedRelative = ((syms[0].charAt(0) != '/') && !syms[0].match(/^\w+:/));
+ var last = syms[syms.length - 1];
+ var ok;
+ // 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(startedRelative && relpath.charAt(0)=="/"){
+ relpath = relpath.slice(1);
+ }
+ ok = this.loadPath(relpath, !omitModuleCheck ? modulename : null);
+ if(ok){ break; }
+ syms.pop();
+ }
+ }else{
+ relpath = syms.join("/") + '.js';
+ modulename = nsyms.join('.');
+ var modArg = !omitModuleCheck ? modulename : null;
+ ok = this.loadPath(relpath, modArg);
+ if(!ok && !exactOnly){
+ syms.pop();
+ while(syms.length){
+ relpath = syms.join('/') + '.js';
+ ok = this.loadPath(relpath, modArg);
+ if(ok){ break; }
+ syms.pop();
+ relpath = syms.join('/') + '/'+this.pkgFileName+'.js';
+ if(startedRelative && relpath.charAt(0)=="/"){
+ relpath = relpath.slice(1);
+ }
+ ok = this.loadPath(relpath, modArg);
+ if(ok){ break; }
+ }
+ }
+
+ if(!ok && !omitModuleCheck){
+ 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(!omitModuleCheck && !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;
+}
+
+dojo.hostenv.startPackage = function(packageName){
+// summary:
+// Creates a JavaScript package
+//
+// description:
+// startPackage("A.B") follows the path, and at each level creates a new empty
+// object or uses what already exists. It returns the result.
+//
+// packageName: the package to be created as a String in dot notation
+
+ //Make sure we have a string.
+ var fullPkgName = String(packageName);
+ var strippedPkgName = fullPkgName;
+
+ var syms = packageName.split(/\./);
+ if(syms[syms.length-1]=="*"){
+ syms.pop();
+ strippedPkgName = syms.join(".");
+ }
+ var evaledPkg = dojo.evalObjPath(strippedPkgName, true);
+ this.loaded_modules_[fullPkgName] = evaledPkg;
+ this.loaded_modules_[strippedPkgName] = evaledPkg;
+
+ return evaledPkg; // Object
+}
+
+dojo.hostenv.findModule = function(/*String*/moduleName, /*Boolean?*/mustExist){
+// summary:
+// Returns the Object representing the module, if it exists, otherwise null.
+//
+// moduleName A fully qualified module including package name, like 'A.B'.
+// mustExist Optional, default false. throw instead of returning null
+// if the module does not currently exist.
+
+ var lmn = String(moduleName);
+
+ if(this.loaded_modules_[lmn]){
+ return this.loaded_modules_[lmn]; // Object
+ }
+
+ if(mustExist){
+ dojo.raise("no loaded module named '" + moduleName + "'");
+ }
+ return null;
+}
+
+//Start of old bootstrap2:
+
+dojo.kwCompoundRequire = function(modMap){
+// description:
+// 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.*" ]
+// });
+
+ 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(){
+ var arg0 = arguments[0];
+ if((arg0 === true)||(arg0=="common")||(arg0 && dojo.render[arg0].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.registerModulePath = function(module, prefix){
+ return dojo.hostenv.setModulePrefix(module, prefix);
+}
+
+dojo.setModulePrefix = function(module, prefix){
+ dojo.deprecated('dojo.setModulePrefix("' + module + '", "' + prefix + '")', "replaced by dojo.registerModulePath", "0.5");
+ return dojo.registerModulePath(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;
+}
+
+// Localization routines
+
+dojo.hostenv.normalizeLocale = function(/*String?*/locale){
+// summary:
+// Returns canonical form of locale, as used by Dojo. All variants are case-insensitive and are separated by '-'
+// as specified in RFC 3066. If no locale is specified, the user agent's default is returned.
+
+ return locale ? locale.toLowerCase() : dojo.locale; // String
+};
+
+dojo.hostenv.searchLocalePath = function(/*String*/locale, /*Boolean*/down, /*Function*/searchFunc){
+// summary:
+// A helper method to assist in searching for locale-based resources. Will iterate through
+// the variants of a particular locale, either up or down, executing a callback function.
+// For example, "en-us" and true will try "en-us" followed by "en" and finally "ROOT".
+
+ locale = dojo.hostenv.normalizeLocale(locale);
+
+ var elements = locale.split('-');
+ var searchlist = [];
+ for(var i = elements.length; i > 0; i--){
+ searchlist.push(elements.slice(0, i).join('-'));
+ }
+ searchlist.push(false);
+ if(down){searchlist.reverse();}
+
+ for(var j = searchlist.length - 1; j >= 0; j--){
+ var loc = searchlist[j] || "ROOT";
+ var stop = searchFunc(loc);
+ if(stop){ break; }
+ }
+}
+
+dojo.hostenv.preloadLocalizations = function(){
+// summary:
+// Load built, flattened resource bundles, if available for all locales used in the page.
+// Execute only once. Note that this is a no-op unless there is a build.
+
+ var localesGenerated /***BUILD:localesGenerated***/; // value will be inserted at build time, if necessary
+
+ if(localesGenerated){
+ dojo.registerModulePath("nls","nls");
+
+ function preload(locale){
+ locale = dojo.hostenv.normalizeLocale(locale);
+ dojo.hostenv.searchLocalePath(locale, true, function(loc){
+ for(var i=0; i<localesGenerated.length;i++){
+ if(localesGenerated[i] == loc){
+ dojo.require("nls.dojo_"+loc);
+ return true;
+ }
+ }
+ return false;
+ });
+ }
+ preload();
+ var extra = djConfig.extraLocale||[];
+ for(var i=0; i<extra.length; i++){
+ preload(extra[i]);
+ }
+ }
+ dojo.hostenv.preloadLocalizations = function(){};
+}
+
+//FIXME: should I follow the pattern and put this under dojo.hostenv with a dojo.* alias?
+dojo.requireLocalization = function(moduleName, bundleName, locale /*optional*/){
+// summary:
+// Declares translated resources and loads them if necessary, in the same style as dojo.require.
+// Contents of the resource bundle are typically strings, but may be any name/value pair,
+// represented in JSON format. See also dojo.i18n.getLocalization.
+//
+// moduleName: name of the package containing the "nls" directory in which the bundle is found
+// bundleName: bundle name, i.e. the filename without the '.js' suffix
+// locale: the locale to load (optional) By default, the browser's user locale as defined by dojo.locale
+//
+// description:
+// Load translated resource bundles provided underneath the "nls" directory within a package.
+// Translated resources may be located in different packages throughout the source tree. For example,
+// a particular widget may define one or more resource bundles, structured in a program as follows,
+// where moduleName is mycode.mywidget and bundleNames available include bundleone and bundletwo:
+// ...
+// mycode/
+// mywidget/
+// nls/
+// bundleone.js (the fallback translation, English in this example)
+// bundletwo.js (also a fallback translation)
+// de/
+// bundleone.js
+// bundletwo.js
+// de-at/
+// bundleone.js
+// en/
+// (empty; use the fallback translation)
+// en-us/
+// bundleone.js
+// en-gb/
+// bundleone.js
+// es/
+// bundleone.js
+// bundletwo.js
+// ...etc
+// ...
+// Each directory is named for a locale as specified by RFC 3066, (http://www.ietf.org/rfc/rfc3066.txt),
+// normalized in lowercase. Note that the two bundles in the example do not define all the same variants.
+// For a given locale, bundles will be loaded for that locale and all more general locales above it, including
+// a fallback at the root directory. For example, a declaration for the "de-at" locale will first
+// load nls/de-at/bundleone.js, then nls/de/bundleone.js and finally nls/bundleone.js. The data will
+// be flattened into a single Object so that lookups will follow this cascading pattern. An optional build
+// step can preload the bundles to avoid data redundancy and the multiple network hits normally required to
+// load these resources.
+
+ dojo.hostenv.preloadLocalizations();
+ var bundlePackage = [moduleName, "nls", bundleName].join(".");
+//NOTE: When loading these resources, the packaging does not match what is on disk. This is an
+// implementation detail, as this is just a private data structure to hold the loaded resources.
+// e.g. tests/hello/nls/en-us/salutations.js is loaded as the object tests.hello.nls.salutations.en_us={...}
+// The structure on disk is intended to be most convenient for developers and translators, but in memory
+// it is more logical and efficient to store in a different order. Locales cannot use dashes, since the
+// resulting path will not evaluate as valid JS, so we translate them to underscores.
+
+ var bundle = dojo.hostenv.findModule(bundlePackage);
+ if(bundle){
+ if(djConfig.localizationComplete && bundle._built){return;}
+ var jsLoc = dojo.hostenv.normalizeLocale(locale).replace('-','_');
+ var translationPackage = bundlePackage+"."+jsLoc;
+ if(dojo.hostenv.findModule(translationPackage)){return;}
+ }
+
+ bundle = dojo.hostenv.startPackage(bundlePackage);
+ var syms = dojo.hostenv.getModuleSymbols(moduleName);
+ var modpath = syms.concat("nls").join("/");
+ var parent;
+ dojo.hostenv.searchLocalePath(locale, false, function(loc){
+ var jsLoc = loc.replace('-','_');
+ var translationPackage = bundlePackage + "." + jsLoc;
+ var loaded = false;
+ if(!dojo.hostenv.findModule(translationPackage)){
+ // Mark loaded whether it's found or not, so that further load attempts will not be made
+ dojo.hostenv.startPackage(translationPackage);
+ var module = [modpath];
+ if(loc != "ROOT"){module.push(loc);}
+ module.push(bundleName);
+ var filespec = module.join("/") + '.js';
+ loaded = dojo.hostenv.loadPath(filespec, null, function(hash){
+ // Use singleton with prototype to point to parent bundle, then mix-in result from loadPath
+ var clazz = function(){};
+ clazz.prototype = parent;
+ bundle[jsLoc] = new clazz();
+ for(var j in hash){ bundle[jsLoc][j] = hash[j]; }
+ });
+ }else{
+ loaded = true;
+ }
+ if(loaded && bundle[jsLoc]){
+ parent = bundle[jsLoc];
+ }else{
+ bundle[jsLoc] = parent;
+ }
+ });
+};
+
+(function(){
+ // If other locales are used, dojo.requireLocalization should load them as well, by default.
+ // Override dojo.requireLocalization to do load the default bundle, then iterate through the
+ // extraLocale list and load those translations as well, unless a particular locale was requested.
+
+ var extra = djConfig.extraLocale;
+ if(extra){
+ if(!extra instanceof Array){
+ extra = [extra];
+ }
+
+ var req = dojo.requireLocalization;
+ dojo.requireLocalization = function(m, b, locale){
+ req(m,b,locale);
+ if(locale){return;}
+ for(var i=0; i<extra.length; i++){
+ req(m,b,extra[i]);
+ }
+ };
+ }
+})();
+
+};
+
+if (typeof window != 'undefined') {
+
+// attempt to figure out the path to dojo if it isn't set in the config
+(function() {
+ // before we get any further with the config options, try to pick them out
+ // of the URL. Most of this code is from NW
+ if(djConfig.allowQueryConfig){
+ var baseUrl = document.location.toString(); // FIXME: use location.query instead?
+ var params = baseUrl.split("?", 2);
+ if(params.length > 1){
+ var paramStr = params[1];
+ var pairs = paramStr.split("&");
+ for(var x in pairs){
+ var sp = pairs[x].split("=");
+ // FIXME: is this eval dangerous?
+ if((sp[0].length > 9)&&(sp[0].substr(0, 9) == "djConfig.")){
+ var opt = sp[0].substr(9);
+ try{
+ djConfig[opt]=eval(sp[1]);
+ }catch(e){
+ djConfig[opt]=sp[1];
+ }
+ }
+ }
+ }
+ }
+
+ if(((djConfig["baseScriptUri"] == "")||(djConfig["baseRelativePath"] == "")) &&(document && document.getElementsByTagName)){
+ var scripts = document.getElementsByTagName("script");
+ var rePkg = /(__package__|dojo|bootstrap1)\.js([\?\.]|$)/i;
+ for(var i = 0; i < scripts.length; i++) {
+ var src = scripts[i].getAttribute("src");
+ if(!src) { continue; }
+ var m = src.match(rePkg);
+ if(m) {
+ var root = src.substring(0, m.index);
+ if(src.indexOf("bootstrap1") > -1) { root += "../"; }
+ if(!this["djConfig"]) { djConfig = {}; }
+ if(djConfig["baseScriptUri"] == "") { djConfig["baseScriptUri"] = root; }
+ if(djConfig["baseRelativePath"] == "") { djConfig["baseRelativePath"] = root; }
+ break;
+ }
+ }
+ }
+
+ // fill in the rendering support information in dojo.render.*
+ var dr = dojo.render;
+ var drh = dojo.render.html;
+ var drs = dojo.render.svg;
+ var dua = (drh.UA = navigator.userAgent);
+ var dav = (drh.AV = navigator.appVersion);
+ var t = true;
+ var f = false;
+ drh.capable = t;
+ drh.support.builtin = t;
+
+ dr.ver = parseFloat(drh.AV);
+ dr.os.mac = dav.indexOf("Macintosh") >= 0;
+ dr.os.win = dav.indexOf("Windows") >= 0;
+ // could also be Solaris or something, but it's the same browser
+ dr.os.linux = dav.indexOf("X11") >= 0;
+
+ drh.opera = dua.indexOf("Opera") >= 0;
+ drh.khtml = (dav.indexOf("Konqueror") >= 0)||(dav.indexOf("Safari") >= 0);
+ drh.safari = dav.indexOf("Safari") >= 0;
+ var geckoPos = dua.indexOf("Gecko");
+ drh.mozilla = drh.moz = (geckoPos >= 0)&&(!drh.khtml);
+ if (drh.mozilla) {
+ // gecko version is YYYYMMDD
+ drh.geckoVersion = dua.substring(geckoPos + 6, geckoPos + 14);
+ }
+ drh.ie = (document.all)&&(!drh.opera);
+ drh.ie50 = drh.ie && dav.indexOf("MSIE 5.0")>=0;
+ drh.ie55 = drh.ie && dav.indexOf("MSIE 5.5")>=0;
+ drh.ie60 = drh.ie && dav.indexOf("MSIE 6.0")>=0;
+ drh.ie70 = drh.ie && dav.indexOf("MSIE 7.0")>=0;
+
+ var cm = document["compatMode"];
+ drh.quirks = (cm == "BackCompat")||(cm == "QuirksMode")||drh.ie55||drh.ie50;
+
+ // TODO: is the HTML LANG attribute relevant?
+ dojo.locale = dojo.locale || (drh.ie ? navigator.userLanguage : navigator.language).toLowerCase();
+
+ dr.vml.capable=drh.ie;
+ drs.capable = f;
+ drs.support.plugin = f;
+ drs.support.builtin = f;
+ var tdoc = window["document"];
+ var tdi = tdoc["implementation"];
+
+ if((tdi)&&(tdi["hasFeature"])&&(tdi.hasFeature("org.w3c.dom.svg", "1.0"))){
+ drs.capable = t;
+ drs.support.builtin = t;
+ drs.support.plugin = f;
+ }
+ // webkits after 420 support SVG natively. The test string is "AppleWebKit/420+"
+ if(drh.safari){
+ var tmp = dua.split("AppleWebKit/")[1];
+ var ver = parseFloat(tmp.split(" ")[0]);
+ if(ver >= 420){
+ drs.capable = t;
+ drs.support.builtin = t;
+ drs.support.plugin = f;
+ }
+ }
+})();
+
+dojo.hostenv.startPackage("dojo.hostenv");
+
+dojo.render.name = dojo.hostenv.name_ = 'browser';
+dojo.hostenv.searchIds = [];
+
+// These are in order of decreasing likelihood; this will change in time.
+dojo.hostenv._XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
+
+dojo.hostenv.getXmlhttpObject = function(){
+ var http = null;
+ var last_e = null;
+ try{ http = new XMLHttpRequest(); }catch(e){}
+ if(!http){
+ for(var i=0; i<3; ++i){
+ var progid = dojo.hostenv._XMLHTTP_PROGIDS[i];
+ try{
+ http = new ActiveXObject(progid);
+ }catch(e){
+ last_e = e;
+ }
+
+ if(http){
+ dojo.hostenv._XMLHTTP_PROGIDS = [progid]; // so faster next time
+ break;
+ }
+ }
+
+ /*if(http && !http.toString) {
+ http.toString = function() { "[object XMLHttpRequest]"; }
+ }*/
+ }
+
+ if(!http){
+ return dojo.raise("XMLHTTP not available", last_e);
+ }
+
+ return http;
+}
+
+/**
+ * Read the contents of the specified uri and return those contents.
+ *
+ * @param uri A relative or absolute uri. If absolute, it still must be in the
+ * same "domain" as we are.
+ *
+ * @param async_cb If not specified, load synchronously. If specified, load
+ * asynchronously, and use async_cb as the progress handler which takes the
+ * xmlhttp object as its argument. If async_cb, this function returns null.
+ *
+ * @param fail_ok Default false. If fail_ok and !async_cb and loading fails,
+ * return null instead of throwing.
+ */
+dojo.hostenv._blockAsync = false;
+dojo.hostenv.getText = function(uri, async_cb, fail_ok){
+ // need to block async callbacks from snatching this thread as the result
+ // of an async callback might call another sync XHR, this hangs khtml forever
+ // hostenv._blockAsync must also be checked in BrowserIO's watchInFlight()
+ // NOTE: must be declared before scope switches ie. this.getXmlhttpObject()
+ if(!async_cb){ this._blockAsync = true; }
+
+ var http = this.getXmlhttpObject();
+
+ function isDocumentOk(http){
+ var stat = http["status"];
+ // allow a 304 use cache, needed in konq (is this compliant with the http spec?)
+ return Boolean((!stat)||((200 <= stat)&&(300 > stat))||(stat==304));
+ }
+
+ if(async_cb){
+ var _this = this, timer = null, gbl = dojo.global();
+ var xhr = dojo.evalObjPath("dojo.io.XMLHTTPTransport");
+ http.onreadystatechange = function(){
+ if(timer){ gbl.clearTimeout(timer); timer = null; }
+ if(_this._blockAsync || (xhr && xhr._blockAsync)){
+ timer = gbl.setTimeout(function () { http.onreadystatechange.apply(this); }, 10);
+ }else{
+ if(4==http.readyState){
+ if(isDocumentOk(http)){
+ // dojo.debug("LOADED URI: "+uri);
+ async_cb(http.responseText);
+ }
+ }
+ }
+ }
+ }
+
+ http.open('GET', uri, async_cb ? true : false);
+ try{
+ http.send(null);
+ if(async_cb){
+ return null;
+ }
+ if(!isDocumentOk(http)){
+ var err = Error("Unable to load "+uri+" status:"+ http.status);
+ err.status = http.status;
+ err.responseText = http.responseText;
+ throw err;
+ }
+ }catch(e){
+ this._blockAsync = false;
+ if((fail_ok)&&(!async_cb)){
+ return null;
+ }else{
+ throw e;
+ }
+ }
+
+ this._blockAsync = false;
+ return http.responseText;
+}
+
+/*
+ * It turns out that if we check *right now*, as this script file is being loaded,
+ * then the last script element in the window DOM is ourselves.
+ * That is because any subsequent script elements haven't shown up in the document
+ * object yet.
+ */
+ /*
+function dj_last_script_src() {
+ var scripts = window.document.getElementsByTagName('script');
+ if(scripts.length < 1){
+ dojo.raise("No script elements in window.document, so can't figure out my script src");
+ }
+ var script = scripts[scripts.length - 1];
+ var src = script.src;
+ if(!src){
+ dojo.raise("Last script element (out of " + scripts.length + ") has no src");
+ }
+ return src;
+}
+
+if(!dojo.hostenv["library_script_uri_"]){
+ dojo.hostenv.library_script_uri_ = dj_last_script_src();
+}
+*/
+
+dojo.hostenv.defaultDebugContainerId = 'dojoDebug';
+dojo.hostenv._println_buffer = [];
+dojo.hostenv._println_safe = false;
+dojo.hostenv.println = function (line){
+ if(!dojo.hostenv._println_safe){
+ dojo.hostenv._println_buffer.push(line);
+ }else{
+ try {
+ var console = document.getElementById(djConfig.debugContainerId ?
+ djConfig.debugContainerId : dojo.hostenv.defaultDebugContainerId);
+ if(!console) { console = dojo.body(); }
+
+ var div = document.createElement("div");
+ div.appendChild(document.createTextNode(line));
+ console.appendChild(div);
+ } catch (e) {
+ try{
+ // safari needs the output wrapped in an element for some reason
+ document.write("<div>" + line + "</div>");
+ }catch(e2){
+ window.status = line;
+ }
+ }
+ }
+}
+
+dojo.addOnLoad(function(){
+ dojo.hostenv._println_safe = true;
+ while(dojo.hostenv._println_buffer.length > 0){
+ dojo.hostenv.println(dojo.hostenv._println_buffer.shift());
+ }
+});
+
+function dj_addNodeEvtHdlr(node, evtName, fp, capture){
+ var oldHandler = node["on"+evtName] || function(){};
+ node["on"+evtName] = function(){
+ fp.apply(node, arguments);
+ oldHandler.apply(node, arguments);
+ }
+ return true;
+}
+
+// BEGIN DOMContentLoaded, from Dean Edwards (http://dean.edwards.name/weblog/2006/06/again/)
+function dj_load_init(e){
+ // allow multiple calls, only first one will take effect
+ // A bug in khtml calls events callbacks for document for event which isnt supported
+ // for example a created contextmenu event calls DOMContentLoaded, workaround
+ var type = (e && e.type) ? e.type.toLowerCase() : "load";
+ if(arguments.callee.initialized || (type!="domcontentloaded" && type!="load")){ return; }
+ arguments.callee.initialized = true;
+ if(typeof(_timer) != 'undefined'){
+ clearInterval(_timer);
+ delete _timer;
+ }
+
+ var initFunc = function(){
+ //perform initialization
+ if(dojo.render.html.ie){
+ dojo.hostenv.makeWidgets();
+ }
+ };
+
+ if(dojo.hostenv.inFlightCount == 0){
+ initFunc();
+ dojo.hostenv.modulesLoaded();
+ }else{
+ dojo.addOnLoad(initFunc);
+ }
+}
+
+// START DOMContentLoaded
+// Mozilla and Opera 9 expose the event we could use
+if(document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", dj_load_init, null);
+
+ // mainly for Opera 8.5, won't be fired if DOMContentLoaded fired already.
+ document.addEventListener("load", dj_load_init, null);
+}
+
+// for Internet Explorer. readyState will not be achieved on init call, but dojo doesn't need it
+// however, we'll include it because we don't know if there are other functions added that might.
+// Note that this has changed because the build process strips all comments--including conditional
+// ones.
+if(dojo.render.html.ie && dojo.render.os.win){
+ document.attachEvent("onreadystatechange", function(e){
+ if(document.readyState == "complete"){
+ dj_load_init();
+ }
+ });
+}
+
+if (/(WebKit|khtml)/i.test(navigator.userAgent)) { // sniff
+ var _timer = setInterval(function() {
+ if (/loaded|complete/.test(document.readyState)) {
+ dj_load_init(); // call the onload handler
+ }
+ }, 10);
+}
+// END DOMContentLoaded
+
+dj_addNodeEvtHdlr(window, "unload", function(){
+ dojo.hostenv.unloaded();
+});
+
+dojo.hostenv.makeWidgets = function(){
+ // you can put searchIds in djConfig and dojo.hostenv at the moment
+ // we should probably eventually move to one or the other
+ var sids = [];
+ if(djConfig.searchIds && djConfig.searchIds.length > 0) {
+ sids = sids.concat(djConfig.searchIds);
+ }
+ if(dojo.hostenv.searchIds && dojo.hostenv.searchIds.length > 0) {
+ sids = sids.concat(dojo.hostenv.searchIds);
+ }
+
+ if((djConfig.parseWidgets)||(sids.length > 0)){
+ if(dojo.evalObjPath("dojo.widget.Parse")){
+ // we must do this on a delay to avoid:
+ // http://www.shaftek.org/blog/archives/000212.html
+ // IE is such a tremendous peice of shit.
+ var parser = new dojo.xml.Parse();
+ if(sids.length > 0){
+ for(var x=0; x<sids.length; x++){
+ var tmpNode = document.getElementById(sids[x]);
+ if(!tmpNode){ continue; }
+ var frag = parser.parseElement(tmpNode, null, true);
+ dojo.widget.getParser().createComponents(frag);
+ }
+ }else if(djConfig.parseWidgets){
+ var frag = parser.parseElement(dojo.body(), null, true);
+ dojo.widget.getParser().createComponents(frag);
+ }
+ }
+ }
+}
+
+dojo.addOnLoad(function(){
+ if(!dojo.render.html.ie) {
+ dojo.hostenv.makeWidgets();
+ }
+});
+
+try {
+ if (dojo.render.html.ie) {
+ document.namespaces.add("v","urn:schemas-microsoft-com:vml");
+ document.createStyleSheet().addRule("v\\:*", "behavior:url(#default#VML)");
+ }
+} catch (e) { }
+
+// stub, over-ridden by debugging code. This will at least keep us from
+// breaking when it's not included
+dojo.hostenv.writeIncludes = function(){}
+
+//TODOC: HOW TO DOC THIS?
+// @global: dj_currentDocument
+// summary:
+// Current document object. 'dj_currentDocument' can be modified for temporary context shifting.
+// description:
+// dojo.doc() returns dojo.currentDocument.
+// Refer to dojo.doc() rather than referring to 'window.document' to ensure your
+// code runs correctly in managed contexts.
+if(!dj_undef("document", this)){
+ dj_currentDocument = this.document;
+}
+
+dojo.doc = function(){
+ // summary:
+ // return the document object associated with the dojo.global()
+ return dj_currentDocument;
+}
+
+dojo.body = function(){
+ // summary:
+ // return the body object associated with dojo.doc()
+ // Note: document.body is not defined for a strict xhtml document
+ return dojo.doc().body || dojo.doc().getElementsByTagName("body")[0];
+}
+
+dojo.byId = function(id, doc){
+ if((id)&&((typeof id == "string")||(id instanceof String))){
+ if (!doc) { doc = dj_currentDocument; }
+ var ele = doc.getElementById(id);
+ // workaround bug in IE and Opera 8.2 where getElementById returns wrong element
+ if (ele && (ele.id != id) && doc.all) {
+ ele = null;
+ // get all matching elements with this id
+ eles = doc.all[id];
+ if (eles) {
+ // if more than 1, choose first with the correct id
+ if (eles.length) {
+ for (var i=0; i < eles.length; i++) {
+ if (eles[i].id == id) {
+ ele = eles[i];
+ break;
+ }
+ }
+ // return 1 and only element
+ } else { ele = eles; }
+ }
+ }
+ return ele;
+ }
+ return id; // assume it's a node
+}
+
+dojo.setContext = function(/*Object*/globalObject, /*Object*/ globalDocument){
+ dj_currentContext = globalObject;
+ dj_currentDocument = globalDocument;
+};
+
+dojo._fireCallback = function(callback, context, cbArguments) {
+ if((context)&&((typeof callback == "string")||(callback instanceof String))){
+ callback=context[callback];
+ }
+ return (context ? callback.apply(context, cbArguments || [ ]) : callback());
+}
+
+dojo.withGlobal = function(/*Object*/globalObject, /*Function*/callback, /*Object?*/thisObject, /*Array?*/cbArguments){
+ // summary:
+ // Call callback with globalObject as dojo.global() and globalObject.document
+ // as dojo.doc(). If provided, globalObject will be executed in the context of
+ // object thisObject
+ // description:
+ // When callback() returns or throws an error, the dojo.global() and dojo.doc() will
+ // be restored to its previous state.
+ var rval;
+ var oldGlob = dj_currentContext;
+ var oldDoc = dj_currentDocument;
+ try{
+ dojo.setContext(globalObject, globalObject.document);
+ rval = dojo._fireCallback(callback, thisObject, cbArguments);
+ }finally{
+ dojo.setContext(oldGlob, oldDoc);
+ }
+ return rval;
+}
+
+dojo.withDoc = function (/*Object*/documentObject, /*Function*/callback, /*Object?*/thisObject, /*Array?*/cbArguments) {
+ // summary:
+ // Call callback with documentObject as dojo.doc(). If provided, callback will be executed
+ // in the context of object thisObject
+ // description:
+ // When callback() returns or throws an error, the dojo.doc() will
+ // be restored to its previous state.
+ var rval;
+ var oldDoc = dj_currentDocument;
+ try{
+ dj_currentDocument = documentObject;
+ rval = dojo._fireCallback(callback, thisObject, cbArguments);
+ }finally{
+ dj_currentDocument = oldDoc;
+ }
+ return rval;
+}
+
+}
+//Semicolon is for when this file is integrated with a custom build on one line
+//with some other file's contents. Sometimes that makes things not get defined
+//properly, particularly with the using the closure below to do all the work.
+;(function(){
+ //Don't do this work if dojo.js has already done it.
+ if(typeof dj_usingBootstrap != "undefined"){
+ return;
+ }
+
+ var isRhino = false;
+ var isSpidermonkey = false;
+ var isDashboard = false;
+ if((typeof this["load"] == "function")&&((typeof this["Packages"] == "function")||(typeof this["Packages"] == "object"))){
+ isRhino = true;
+ }else if(typeof this["load"] == "function"){
+ isSpidermonkey = true;
+ }else if(window.widget){
+ isDashboard = true;
+ }
+
+ var tmps = [];
+ if((this["djConfig"])&&((djConfig["isDebug"])||(djConfig["debugAtAllCosts"]))){
+ tmps.push("debug.js");
+ }
+
+ if((this["djConfig"])&&(djConfig["debugAtAllCosts"])&&(!isRhino)&&(!isDashboard)){
+ tmps.push("browser_debug.js");
+ }
+
+ //Support compatibility packages. Right now this only allows setting one
+ //compatibility package. Might need to revisit later down the line to support
+ //more than one.
+ if((this["djConfig"])&&(djConfig["compat"])){
+ tmps.push("compat/" + djConfig["compat"] + ".js");
+ }
+
+ var loaderRoot = djConfig["baseScriptUri"];
+ if((this["djConfig"])&&(djConfig["baseLoaderUri"])){
+ loaderRoot = djConfig["baseLoaderUri"];
+ }
+
+ for(var x=0; x < tmps.length; x++){
+ var spath = loaderRoot+"src/"+tmps[x];
+ if(isRhino||isSpidermonkey){
+ load(spath);
+ } else {
+ try {
+ document.write("<scr"+"ipt type='text/javascript' src='"+spath+"'></scr"+"ipt>");
+ } catch (e) {
+ var script = document.createElement("script");
+ script.src = spath;
+ document.getElementsByTagName("head")[0].appendChild(script);
+ }
+ }
+ }
+})();
+
+dojo.provide("dojo.lang.common");
+
+dojo.lang.inherits = function(/*Function*/ subclass, /*Function*/ superclass){
+ // summary: Set up inheritance between two classes.
+ if(typeof superclass != 'function'){
+ dojo.raise("dojo.inherits: superclass argument ["+superclass+"] must be a function (subclass: ["+subclass+"']");
+ }
+ subclass.prototype = new superclass();
+ subclass.prototype.constructor = subclass;
+ subclass.superclass = superclass.prototype;
+ // DEPRICATED: super is a reserved word, use 'superclass'
+ subclass['super'] = superclass.prototype;
+}
+
+dojo.lang._mixin = function(/*Object*/ obj, /*Object*/ props){
+ // summary: Adds all properties and methods of props to obj.
+ var tobj = {};
+ for(var x in props){
+ // the "tobj" condition avoid copying properties in "props"
+ // inherited from Object.prototype. For example, if obj has a custom
+ // toString() method, don't overwrite it with the toString() method
+ // that props inherited from Object.protoype
+ if((typeof tobj[x] == "undefined") || (tobj[x] != props[x])){
+ obj[x] = props[x];
+ }
+ }
+ // IE doesn't recognize custom toStrings in for..in
+ if(dojo.render.html.ie
+ && (typeof(props["toString"]) == "function")
+ && (props["toString"] != obj["toString"])
+ && (props["toString"] != tobj["toString"]))
+ {
+ obj.toString = props.toString;
+ }
+ return obj;
+}
+
+dojo.lang.mixin = function(/*Object*/ obj, /*Object...*/props){
+ // summary: Adds all properties and methods of props to obj.
+ for(var i=1, l=arguments.length; i<l; i++){
+ dojo.lang._mixin(obj, arguments[i]);
+ }
+ return obj; // Object
+}
+
+dojo.lang.extend = function(/*Object*/ constructor, /*Object...*/ props){
+ // summary: Adds all properties and methods of props to constructor's prototype,
+ // making them available to all instances created with constructor.
+ for(var i=1, l=arguments.length; i<l; i++){
+ dojo.lang._mixin(constructor.prototype, arguments[i]);
+ }
+ return constructor;
+}
+
+// Promote to dojo module
+dojo.inherits = dojo.lang.inherits;
+//dojo.lang._mixin = dojo.lang._mixin;
+dojo.mixin = dojo.lang.mixin;
+dojo.extend = dojo.lang.extend;
+
+dojo.lang.find = function( /*Array*/ array,
+ /*Object*/ value,
+ /*Boolean?*/ identity,
+ /*Boolean?*/ findLast){
+ // summary: Return the index of value in array, returning -1 if not found.
+
+ // param: identity: If true, matches with identity comparison (===).
+ // If false, uses normal comparison (==).
+ // param: findLast: If true, returns index of last instance of value.
+ // usage:
+ // find(array, value[, identity [findLast]]) // recommended
+ // usage:
+ // find(value, array[, identity [findLast]]) // deprecated
+
+ // support both (array, value) and (value, array)
+ if(!dojo.lang.isArrayLike(array) && dojo.lang.isArrayLike(value)) {
+ dojo.deprecated('dojo.lang.find(value, array)', 'use dojo.lang.find(array, value) instead', "0.5");
+ var temp = array;
+ array = value;
+ value = temp;
+ }
+ var isString = dojo.lang.isString(array);
+ if(isString) { array = array.split(""); }
+
+ if(findLast) {
+ var step = -1;
+ var i = array.length - 1;
+ var end = -1;
+ } else {
+ var step = 1;
+ var i = 0;
+ var end = array.length;
+ }
+ if(identity){
+ while(i != end) {
+ if(array[i] === value){ return i; }
+ i += step;
+ }
+ }else{
+ while(i != end) {
+ if(array[i] == value){ return i; }
+ i += step;
+ }
+ }
+ return -1; // number
+}
+
+dojo.lang.indexOf = dojo.lang.find;
+
+dojo.lang.findLast = function(/*Array*/ array, /*Object*/ value, /*boolean?*/ identity){
+ // summary: Return index of last occurance of value in array, returning -1 if not found.
+
+ // param: identity: If true, matches with identity comparison (===).
+ // If false, uses normal comparison (==).
+ return dojo.lang.find(array, value, identity, true);
+}
+
+dojo.lang.lastIndexOf = dojo.lang.findLast;
+
+dojo.lang.inArray = function(array /*Array*/, value /*Object*/){
+ // summary: Return true if value is present in array.
+ return dojo.lang.find(array, value) > -1; // return: boolean
+}
+
+/**
+ * Partial implmentation of is* functions from
+ * http://www.crockford.com/javascript/recommend.html
+ * NOTE: some of these may not be the best thing to use in all situations
+ * as they aren't part of core JS and therefore can't work in every case.
+ * See WARNING messages inline for tips.
+ *
+ * The following is* functions are fairly "safe"
+ */
+
+dojo.lang.isObject = function(it){
+ // summary: Return true if it is an Object, Array or Function.
+ if(typeof it == "undefined"){ return false; }
+ return (typeof it == "object" || it === null || dojo.lang.isArray(it) || dojo.lang.isFunction(it));
+}
+
+dojo.lang.isArray = function(it){
+ // summary: Return true if it is an Array.
+ return (it && it instanceof Array || typeof it == "array");
+}
+
+dojo.lang.isArrayLike = function(it){
+ // summary: Return true if it can be used as an array (i.e. is an object with an integer length property).
+ if((!it)||(dojo.lang.isUndefined(it))){ return false; }
+ if(dojo.lang.isString(it)){ return false; }
+ if(dojo.lang.isFunction(it)){ return false; } // keeps out built-in constructors (Number, String, ...) which have length properties
+ if(dojo.lang.isArray(it)){ return true; }
+ // form node itself is ArrayLike, but not always iterable. Use form.elements instead.
+ if((it.tagName)&&(it.tagName.toLowerCase()=='form')){ return false; }
+ if(dojo.lang.isNumber(it.length) && isFinite(it.length)){ return true; }
+ return false;
+}
+
+dojo.lang.isFunction = function(it){
+ // summary: Return true if it is a Function.
+ if(!it){ return false; }
+ // webkit treats NodeList as a function, which is bad
+ //if(it.toString().indexOf("NodeList")!=-1) { return false; }
+ return (it instanceof Function || typeof it == "function");
+}
+
+dojo.lang.isString = function(it){
+ // summary: Return true if it is a String.
+ return (it instanceof String || typeof it == "string");
+}
+
+dojo.lang.isAlien = function(it){
+ // summary: Return true if it is not a built-in function.
+ if(!it){ return false; }
+ return !dojo.lang.isFunction() && /\{\s*\[native code\]\s*\}/.test(String(it));
+}
+
+dojo.lang.isBoolean = function(it){
+ // summary: Return true if it is a Boolean.
+ return (it instanceof Boolean || typeof it == "boolean");
+}
+
+/**
+ * The following is***() functions are somewhat "unsafe". Fortunately,
+ * there are workarounds the the language provides and are mentioned
+ * in the WARNING messages.
+ *
+ */
+dojo.lang.isNumber = function(it){
+ // summary: Return true if it is a number.
+
+ // warning:
+ // In most cases, isNaN(it) is sufficient to determine whether or not
+ // something is a number or can be used as such. For example, a number or string
+ // can be used interchangably when accessing array items (array["1"] is the same as
+ // array[1]) and isNaN will return false for both values ("1" and 1). However,
+ // isNumber("1") will return false, which is generally not too useful.
+ // Also, isNumber(NaN) returns true, again, this isn't generally useful, but there
+ // are corner cases (like when you want to make sure that two things are really
+ // the same type of thing). That is really where isNumber "shines".
+ //
+ // recommendation: Use isNaN(it) when possible
+
+ return (it instanceof Number || typeof it == "number");
+}
+
+/*
+ * FIXME: Should isUndefined go away since it is error prone?
+ */
+dojo.lang.isUndefined = function(it){
+ // summary: Return true if it is not defined.
+
+ // warning: In some cases, isUndefined will not behave as you
+ // might expect. If you do isUndefined(foo) and there is no earlier
+ // reference to foo, an error will be thrown before isUndefined is
+ // called. It behaves correctly if you scope yor object first, i.e.
+ // isUndefined(foo.bar) where foo is an object and bar isn't a
+ // property of the object.
+ //
+ // recommendation: Use typeof foo == "undefined" when possible
+
+ return ((typeof(it) == "undefined")&&(it == undefined));
+}
+
+// end Crockford functions
+
+dojo.provide("dojo.lang.array");
+
+
+// FIXME: Is this worthless since you can do: if(name in obj)
+// is this the right place for this?
+dojo.lang.has = function(obj, name){
+ try{
+ return (typeof obj[name] != "undefined");
+ }catch(e){ return false; }
+}
+
+dojo.lang.isEmpty = function(obj) {
+ if(dojo.lang.isObject(obj)) {
+ var tmp = {};
+ var count = 0;
+ for(var x in obj){
+ if(obj[x] && (!tmp[x])){
+ count++;
+ break;
+ }
+ }
+ return (count == 0);
+ } else if(dojo.lang.isArrayLike(obj) || dojo.lang.isString(obj)) {
+ return obj.length == 0;
+ }
+}
+
+dojo.lang.map = function(arr, obj, unary_func){
+ var isString = dojo.lang.isString(arr);
+ if(isString){
+ arr = arr.split("");
+ }
+ if(dojo.lang.isFunction(obj)&&(!unary_func)){
+ unary_func = obj;
+ obj = dj_global;
+ }else if(dojo.lang.isFunction(obj) && unary_func){
+ // ff 1.5 compat
+ var tmpObj = obj;
+ obj = unary_func;
+ unary_func = tmpObj;
+ }
+ if(Array.map){
+ var outArr = Array.map(arr, unary_func, obj);
+ }else{
+ var outArr = [];
+ for(var i=0;i<arr.length;++i){
+ outArr.push(unary_func.call(obj, arr[i]));
+ }
+ }
+ if(isString) {
+ return outArr.join("");
+ } else {
+ return outArr;
+ }
+}
+
+dojo.lang.reduce = function(arr, initialValue, obj, binary_func){
+ var reducedValue = initialValue;
+ var ob = obj ? obj : dj_global;
+ dojo.lang.map(arr,
+ function(val){
+ reducedValue = binary_func.call(ob, reducedValue, val);
+ }
+ );
+ return reducedValue;
+}
+
+// http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:forEach
+dojo.lang.forEach = function(anArray /* Array */, callback /* Function */, thisObject /* Object */){
+ if(dojo.lang.isString(anArray)){
+ anArray = anArray.split("");
+ }
+ if(Array.forEach){
+ Array.forEach(anArray, callback, thisObject);
+ }else{
+ // FIXME: there are several ways of handilng thisObject. Is dj_global always the default context?
+ if(!thisObject){
+ thisObject=dj_global;
+ }
+ for(var i=0,l=anArray.length; i<l; i++){
+ callback.call(thisObject, anArray[i], i, anArray);
+ }
+ }
+}
+
+dojo.lang._everyOrSome = function(every, arr, callback, thisObject){
+ if(dojo.lang.isString(arr)){
+ arr = arr.split("");
+ }
+ if(Array.every){
+ return Array[ (every) ? "every" : "some" ](arr, callback, thisObject);
+ }else{
+ if(!thisObject){
+ thisObject = dj_global;
+ }
+ for(var i=0,l=arr.length; i<l; i++){
+ var result = callback.call(thisObject, arr[i], i, arr);
+ if((every)&&(!result)){
+ return false;
+ }else if((!every)&&(result)){
+ return true;
+ }
+ }
+ return (every) ? true : false;
+ }
+}
+
+dojo.lang.every = function(arr, callback, thisObject){
+ return this._everyOrSome(true, arr, callback, thisObject);
+}
+
+dojo.lang.some = function(arr, callback, thisObject){
+ return this._everyOrSome(false, arr, callback, thisObject);
+}
+
+dojo.lang.filter = function(arr, callback, thisObject) {
+ var isString = dojo.lang.isString(arr);
+ if(isString) { arr = arr.split(""); }
+ if(Array.filter) {
+ var outArr = Array.filter(arr, callback, thisObject);
+ } else {
+ if(!thisObject) {
+ if(arguments.length >= 3) { dojo.raise("thisObject doesn't exist!"); }
+ thisObject = dj_global;
+ }
+
+ var outArr = [];
+ for(var i = 0; i < arr.length; i++) {
+ if(callback.call(thisObject, arr[i], i, arr)) {
+ outArr.push(arr[i]);
+ }
+ }
+ }
+ if(isString) {
+ return outArr.join("");
+ } else {
+ return outArr;
+ }
+}
+
+/**
+ * Creates a 1-D array out of all the arguments passed,
+ * unravelling any array-like objects in the process
+ *
+ * Ex:
+ * unnest(1, 2, 3) ==> [1, 2, 3]
+ * unnest(1, [2, [3], [[[4]]]]) ==> [1, 2, 3, 4]
+ */
+dojo.lang.unnest = function(/* ... */) {
+ var out = [];
+ for(var i = 0; i < arguments.length; i++) {
+ if(dojo.lang.isArrayLike(arguments[i])) {
+ var add = dojo.lang.unnest.apply(this, arguments[i]);
+ out = out.concat(add);
+ } else {
+ out.push(arguments[i]);
+ }
+ }
+ return out;
+}
+
+/**
+ * Converts an array-like object (i.e. arguments, DOMCollection)
+ * to an array
+**/
+dojo.lang.toArray = function(arrayLike, startOffset) {
+ var array = [];
+ for(var i = startOffset||0; i < arrayLike.length; i++) {
+ array.push(arrayLike[i]);
+ }
+ return array;
+}
+
+dojo.provide("dojo.lang.extras");
+
+
+/**
+ * Sets a timeout in milliseconds to execute a function in a given context
+ * with optional arguments.
+ *
+ * setTimeout (Object context, function func, number delay[, arg1[, ...]]);
+ * setTimeout (function func, number delay[, arg1[, ...]]);
+ */
+dojo.lang.setTimeout = function(func, delay){
+ var context = window, argsStart = 2;
+ if(!dojo.lang.isFunction(func)){
+ context = func;
+ func = delay;
+ delay = arguments[2];
+ argsStart++;
+ }
+
+ if(dojo.lang.isString(func)){
+ func = context[func];
+ }
+
+ var args = [];
+ for (var i = argsStart; i < arguments.length; i++) {
+ args.push(arguments[i]);
+ }
+ return dojo.global().setTimeout(function () { func.apply(context, args); }, delay);
+}
+
+dojo.lang.clearTimeout = function(timer){
+ dojo.global().clearTimeout(timer);
+}
+
+dojo.lang.getNameInObj = function(ns, item){
+ if(!ns){ ns = dj_global; }
+
+ for(var x in ns){
+ if(ns[x] === item){
+ return new String(x);
+ }
+ }
+ return null;
+}
+
+dojo.lang.shallowCopy = function(obj, deep) {
+ var i, ret;
+
+ if (obj === null) return null;
+
+ if (dojo.lang.isObject(obj)) {
+ ret = new obj.constructor();
+ for (i in obj) {
+ if(dojo.lang.isUndefined(ret[i])) {
+ ret[i] = deep ? dojo.lang.shallowCopy(obj[i], deep) : obj[i];
+ }
+ }
+ } else if (dojo.lang.isArray(obj)) {
+ ret = [];
+ for(i=0; i<obj.length; i++) {
+ ret[i] = deep ? dojo.lang.shallowCopy(obj[i], deep) : obj[i];
+ }
+ } else {
+ ret = obj;
+ }
+
+ return ret;
+}
+
+/**
+ * Return the first argument that isn't undefined
+ */
+dojo.lang.firstValued = function(/* ... */) {
+ for(var i = 0; i < arguments.length; i++) {
+ if(typeof arguments[i] != "undefined") {
+ return arguments[i];
+ }
+ }
+ return undefined;
+}
+
+/**
+ * Get a value from a reference specified as a string descriptor,
+ * (e.g. "A.B") in the given context.
+ *
+ * getObjPathValue(String objpath [, Object context, Boolean create])
+ *
+ * If context is not specified, dj_global is used
+ * If create is true, undefined objects in the path are created.
+ */
+dojo.lang.getObjPathValue = function(objpath, context, create){
+ with(dojo.parseObjPath(objpath, context, create)){
+ return dojo.evalProp(prop, obj, create);
+ }
+}
+
+/**
+ * Set a value on a reference specified as a string descriptor.
+ * (e.g. "A.B") in the given context.
+ *
+ * setObjPathValue(String objpath, value [, Object context, Boolean create])
+ *
+ * If context is not specified, dj_global is used
+ * If create is true, undefined objects in the path are created.
+ */
+dojo.lang.setObjPathValue = function(objpath, value, context, create){
+ if(arguments.length < 4){
+ create = true;
+ }
+ with(dojo.parseObjPath(objpath, context, create)){
+ if(obj && (create || (prop in obj))){
+ obj[prop] = value;
+ }
+ }
+}
+
+dojo.provide("dojo.lang.func");
+
+
+/**
+ * Runs a function in a given scope (thisObject), can
+ * also be used to preserve scope.
+ *
+ * hitch(foo, "bar"); // runs foo.bar() in the scope of foo
+ * hitch(foo, myFunction); // runs myFunction in the scope of foo
+ */
+dojo.lang.hitch = function(thisObject, method){
+ var fcn = (dojo.lang.isString(method) ? thisObject[method] : method) || function(){};
+
+ return function() {
+ return fcn.apply(thisObject, arguments);
+ };
+}
+
+dojo.lang.anonCtr = 0;
+dojo.lang.anon = {};
+dojo.lang.nameAnonFunc = function(anonFuncPtr, namespaceObj, searchForNames){
+ var nso = (namespaceObj || dojo.lang.anon);
+ if( (searchForNames) ||
+ ((dj_global["djConfig"])&&(djConfig["slowAnonFuncLookups"] == true)) ){
+ for(var x in nso){
+ try{
+ if(nso[x] === anonFuncPtr){
+ return x;
+ }
+ }catch(e){} // window.external fails in IE embedded in Eclipse (Eclipse bug #151165)
+ }
+ }
+ var ret = "__"+dojo.lang.anonCtr++;
+ while(typeof nso[ret] != "undefined"){
+ ret = "__"+dojo.lang.anonCtr++;
+ }
+ nso[ret] = anonFuncPtr;
+ return ret;
+}
+
+dojo.lang.forward = function(funcName){
+ // Returns a function that forwards a method call to this.func(...)
+ return function(){
+ return this[funcName].apply(this, arguments);
+ };
+}
+
+dojo.lang.curry = function(ns, func /* args ... */){
+ var outerArgs = [];
+ ns = ns||dj_global;
+ if(dojo.lang.isString(func)){
+ func = ns[func];
+ }
+ for(var x=2; x<arguments.length; x++){
+ outerArgs.push(arguments[x]);
+ }
+ // since the event system replaces the original function with a new
+ // join-point runner with an arity of 0, we check to see if it's left us
+ // any clues about the original arity in lieu of the function's actual
+ // length property
+ var ecount = (func["__preJoinArity"]||func.length) - outerArgs.length;
+ // borrowed from svend tofte
+ function gather(nextArgs, innerArgs, expected){
+ var texpected = expected;
+ var totalArgs = innerArgs.slice(0); // copy
+ for(var x=0; x<nextArgs.length; x++){
+ totalArgs.push(nextArgs[x]);
+ }
+ // check the list of provided nextArgs to see if it, plus the
+ // number of innerArgs already supplied, meets the total
+ // expected.
+ expected = expected-nextArgs.length;
+ if(expected<=0){
+ var res = func.apply(ns, totalArgs);
+ expected = texpected;
+ return res;
+ }else{
+ return function(){
+ return gather(arguments,// check to see if we've been run
+ // with enough args
+ totalArgs, // a copy
+ expected); // how many more do we need to run?;
+ };
+ }
+ }
+ return gather([], outerArgs, ecount);
+}
+
+dojo.lang.curryArguments = function(ns, func, args, offset){
+ var targs = [];
+ var x = offset||0;
+ for(x=offset; x<args.length; x++){
+ targs.push(args[x]); // ensure that it's an arr
+ }
+ return dojo.lang.curry.apply(dojo.lang, [ns, func].concat(targs));
+}
+
+dojo.lang.tryThese = function(){
+ for(var x=0; x<arguments.length; x++){
+ try{
+ if(typeof arguments[x] == "function"){
+ var ret = (arguments[x]());
+ if(ret){
+ return ret;
+ }
+ }
+ }catch(e){
+ dojo.debug(e);
+ }
+ }
+}
+
+dojo.lang.delayThese = function(farr, cb, delay, onend){
+ /**
+ * alternate: (array funcArray, function callback, function onend)
+ * alternate: (array funcArray, function callback)
+ * alternate: (array funcArray)
+ */
+ if(!farr.length){
+ if(typeof onend == "function"){
+ onend();
+ }
+ return;
+ }
+ if((typeof delay == "undefined")&&(typeof cb == "number")){
+ delay = cb;
+ cb = function(){};
+ }else if(!cb){
+ cb = function(){};
+ if(!delay){ delay = 0; }
+ }
+ setTimeout(function(){
+ (farr.shift())();
+ cb();
+ dojo.lang.delayThese(farr, cb, delay, onend);
+ }, delay);
+}
+
+dojo.provide("dojo.event.common");
+
+
+// TODO: connection filter functions
+// these are functions that accept a method invocation (like around
+// advice) and return a boolean based on it. That value determines
+// whether or not the connection proceeds. It could "feel" like around
+// advice for those who know what it is (calling proceed() or not),
+// but I think presenting it as a "filter" and/or calling it with the
+// function args and not the MethodInvocation might make it more
+// palletable to "normal" users than around-advice currently is
+// TODO: execution scope mangling
+// YUI's event facility by default executes listeners in the context
+// of the source object. This is very odd, but should probably be
+// supported as an option (both for the source and for the dest). It
+// can be thought of as a connection-specific hitch().
+// TODO: more resiliency for 4+ arguments to connect()
+
+dojo.event = new function(){
+ this.canTimeout = dojo.lang.isFunction(dj_global["setTimeout"])||dojo.lang.isAlien(dj_global["setTimeout"]);
+
+ // FIXME: where should we put this method (not here!)?
+ function interpolateArgs(args, searchForNames){
+ var dl = dojo.lang;
+ var ao = {
+ srcObj: dj_global,
+ srcFunc: null,
+ adviceObj: dj_global,
+ adviceFunc: null,
+ aroundObj: null,
+ aroundFunc: null,
+ adviceType: (args.length>2) ? args[0] : "after",
+ precedence: "last",
+ once: false,
+ delay: null,
+ rate: 0,
+ adviceMsg: false
+ };
+
+ switch(args.length){
+ case 0: return;
+ case 1: return;
+ case 2:
+ ao.srcFunc = args[0];
+ ao.adviceFunc = args[1];
+ break;
+ case 3:
+ if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isString(args[2]))){
+ ao.adviceType = "after";
+ ao.srcObj = args[0];
+ ao.srcFunc = args[1];
+ ao.adviceFunc = args[2];
+ }else if((dl.isString(args[1]))&&(dl.isString(args[2]))){
+ ao.srcFunc = args[1];
+ ao.adviceFunc = args[2];
+ }else if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isFunction(args[2]))){
+ ao.adviceType = "after";
+ ao.srcObj = args[0];
+ ao.srcFunc = args[1];
+ var tmpName = dl.nameAnonFunc(args[2], ao.adviceObj, searchForNames);
+ ao.adviceFunc = tmpName;
+ }else if((dl.isFunction(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))){
+ ao.adviceType = "after";
+ ao.srcObj = dj_global;
+ var tmpName = dl.nameAnonFunc(args[0], ao.srcObj, searchForNames);
+ ao.srcFunc = tmpName;
+ ao.adviceObj = args[1];
+ ao.adviceFunc = args[2];
+ }
+ break;
+ case 4:
+ if((dl.isObject(args[0]))&&(dl.isObject(args[2]))){
+ // we can assume that we've got an old-style "connect" from
+ // the sigslot school of event attachment. We therefore
+ // assume after-advice.
+ ao.adviceType = "after";
+ ao.srcObj = args[0];
+ ao.srcFunc = args[1];
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else if((dl.isString(args[0]))&&(dl.isString(args[1]))&&(dl.isObject(args[2]))){
+ ao.adviceType = args[0];
+ ao.srcObj = dj_global;
+ ao.srcFunc = args[1];
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else if((dl.isString(args[0]))&&(dl.isFunction(args[1]))&&(dl.isObject(args[2]))){
+ ao.adviceType = args[0];
+ ao.srcObj = dj_global;
+ var tmpName = dl.nameAnonFunc(args[1], dj_global, searchForNames);
+ ao.srcFunc = tmpName;
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else if((dl.isString(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))&&(dl.isFunction(args[3]))){
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ var tmpName = dl.nameAnonFunc(args[3], dj_global, searchForNames);
+ ao.adviceObj = dj_global;
+ ao.adviceFunc = tmpName;
+ }else if(dl.isObject(args[1])){
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ ao.adviceObj = dj_global;
+ ao.adviceFunc = args[3];
+ }else if(dl.isObject(args[2])){
+ ao.srcObj = dj_global;
+ ao.srcFunc = args[1];
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else{
+ ao.srcObj = ao.adviceObj = ao.aroundObj = dj_global;
+ ao.srcFunc = args[1];
+ ao.adviceFunc = args[2];
+ ao.aroundFunc = args[3];
+ }
+ break;
+ case 6:
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ ao.adviceObj = args[3]
+ ao.adviceFunc = args[4];
+ ao.aroundFunc = args[5];
+ ao.aroundObj = dj_global;
+ break;
+ default:
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ ao.adviceObj = args[3]
+ ao.adviceFunc = args[4];
+ ao.aroundObj = args[5];
+ ao.aroundFunc = args[6];
+ ao.once = args[7];
+ ao.delay = args[8];
+ ao.rate = args[9];
+ ao.adviceMsg = args[10];
+ break;
+ }
+
+ if(dl.isFunction(ao.aroundFunc)){
+ var tmpName = dl.nameAnonFunc(ao.aroundFunc, ao.aroundObj, searchForNames);
+ ao.aroundFunc = tmpName;
+ }
+
+ if(dl.isFunction(ao.srcFunc)){
+ ao.srcFunc = dl.getNameInObj(ao.srcObj, ao.srcFunc);
+ }
+
+ if(dl.isFunction(ao.adviceFunc)){
+ ao.adviceFunc = dl.getNameInObj(ao.adviceObj, ao.adviceFunc);
+ }
+
+ if((ao.aroundObj)&&(dl.isFunction(ao.aroundFunc))){
+ ao.aroundFunc = dl.getNameInObj(ao.aroundObj, ao.aroundFunc);
+ }
+
+ if(!ao.srcObj){
+ dojo.raise("bad srcObj for srcFunc: "+ao.srcFunc);
+ }
+ if(!ao.adviceObj){
+ dojo.raise("bad adviceObj for adviceFunc: "+ao.adviceFunc);
+ }
+
+ if(!ao.adviceFunc){
+ dojo.debug("bad adviceFunc for srcFunc: "+ao.srcFunc);
+ dojo.debugShallow(ao);
+ }
+
+ return ao;
+ }
+
+ this.connect = function(){
+ // summary:
+ // dojo.event.connect is the glue that holds most Dojo-based
+ // applications together.
+ if(arguments.length == 1){
+ var ao = arguments[0];
+ }else{
+ var ao = interpolateArgs(arguments, true);
+ }
+ if(dojo.lang.isString(ao.srcFunc) && (ao.srcFunc.toLowerCase() == "onkey") ){
+ if(dojo.render.html.ie){
+ ao.srcFunc = "onkeydown";
+ this.connect(ao);
+ }
+ ao.srcFunc = "onkeypress";
+ }
+
+ if(dojo.lang.isArray(ao.srcObj) && ao.srcObj!=""){
+ var tmpAO = {};
+ for(var x in ao){
+ tmpAO[x] = ao[x];
+ }
+ var mjps = [];
+ dojo.lang.forEach(ao.srcObj, function(src){
+ if((dojo.render.html.capable)&&(dojo.lang.isString(src))){
+ src = dojo.byId(src);
+ // dojo.debug(src);
+ }
+ tmpAO.srcObj = src;
+ // dojo.debug(tmpAO.srcObj, tmpAO.srcFunc);
+ // dojo.debug(tmpAO.adviceObj, tmpAO.adviceFunc);
+ mjps.push(dojo.event.connect.call(dojo.event, tmpAO));
+ });
+ return mjps;
+ }
+
+ // FIXME: just doing a "getForMethod()" seems to be enough to put this into infinite recursion!!
+ var mjp = dojo.event.MethodJoinPoint.getForMethod(ao.srcObj, ao.srcFunc);
+ if(ao.adviceFunc){
+ var mjp2 = dojo.event.MethodJoinPoint.getForMethod(ao.adviceObj, ao.adviceFunc);
+ }
+
+ mjp.kwAddAdvice(ao);
+
+ return mjp; // advanced users might want to fsck w/ the join point
+ // manually
+ }
+
+ this.log = function(a1, a2){
+ var kwArgs;
+ if((arguments.length == 1)&&(typeof a1 == "object")){
+ kwArgs = a1;
+ }else{
+ kwArgs = {
+ srcObj: a1,
+ srcFunc: a2
+ };
+ }
+ kwArgs.adviceFunc = function(){
+ var argsStr = [];
+ for(var x=0; x<arguments.length; x++){
+ argsStr.push(arguments[x]);
+ }
+ dojo.debug("("+kwArgs.srcObj+")."+kwArgs.srcFunc, ":", argsStr.join(", "));
+ }
+ this.kwConnect(kwArgs);
+ }
+
+ this.connectBefore = function(){
+ var args = ["before"];
+ for(var i = 0; i < arguments.length; i++){ args.push(arguments[i]); }
+ return this.connect.apply(this, args);
+ }
+
+ this.connectAround = function(){
+ var args = ["around"];
+ for(var i = 0; i < arguments.length; i++){ args.push(arguments[i]); }
+ return this.connect.apply(this, args);
+ }
+
+ this.connectOnce = function(){
+ var ao = interpolateArgs(arguments, true);
+ ao.once = true;
+ return this.connect(ao);
+ }
+
+ this._kwConnectImpl = function(kwArgs, disconnect){
+ var fn = (disconnect) ? "disconnect" : "connect";
+ if(typeof kwArgs["srcFunc"] == "function"){
+ kwArgs.srcObj = kwArgs["srcObj"]||dj_global;
+ var tmpName = dojo.lang.nameAnonFunc(kwArgs.srcFunc, kwArgs.srcObj, true);
+ kwArgs.srcFunc = tmpName;
+ }
+ if(typeof kwArgs["adviceFunc"] == "function"){
+ kwArgs.adviceObj = kwArgs["adviceObj"]||dj_global;
+ var tmpName = dojo.lang.nameAnonFunc(kwArgs.adviceFunc, kwArgs.adviceObj, true);
+ kwArgs.adviceFunc = tmpName;
+ }
+ return dojo.event[fn]( (kwArgs["type"]||kwArgs["adviceType"]||"after"),
+ kwArgs["srcObj"]||dj_global,
+ kwArgs["srcFunc"],
+ kwArgs["adviceObj"]||kwArgs["targetObj"]||dj_global,
+ kwArgs["adviceFunc"]||kwArgs["targetFunc"],
+ kwArgs["aroundObj"],
+ kwArgs["aroundFunc"],
+ kwArgs["once"],
+ kwArgs["delay"],
+ kwArgs["rate"],
+ kwArgs["adviceMsg"]||false );
+ }
+
+ this.kwConnect = function(kwArgs){
+ return this._kwConnectImpl(kwArgs, false);
+
+ }
+
+ this.disconnect = function(){
+ if(arguments.length == 1){
+ var ao = arguments[0];
+ }else{
+ var ao = interpolateArgs(arguments, true);
+ }
+ if(!ao.adviceFunc){ return; } // nothing to disconnect
+ if(dojo.lang.isString(ao.srcFunc) && (ao.srcFunc.toLowerCase() == "onkey") ){
+ if(dojo.render.html.ie){
+ ao.srcFunc = "onkeydown";
+ this.disconnect(ao);
+ }
+ ao.srcFunc = "onkeypress";
+ }
+ var mjp = dojo.event.MethodJoinPoint.getForMethod(ao.srcObj, ao.srcFunc);
+ return mjp.removeAdvice(ao.adviceObj, ao.adviceFunc, ao.adviceType, ao.once);
+ }
+
+ this.kwDisconnect = function(kwArgs){
+ return this._kwConnectImpl(kwArgs, true);
+ }
+}
+
+// exactly one of these is created whenever a method with a joint point is run,
+// if there is at least one 'around' advice.
+dojo.event.MethodInvocation = function(join_point, obj, args){
+ this.jp_ = join_point;
+ this.object = obj;
+ this.args = [];
+ for(var x=0; x<args.length; x++){
+ this.args[x] = args[x];
+ }
+ // the index of the 'around' that is currently being executed.
+ this.around_index = -1;
+}
+
+dojo.event.MethodInvocation.prototype.proceed = function(){
+ this.around_index++;
+ if(this.around_index >= this.jp_.around.length){
+ return this.jp_.object[this.jp_.methodname].apply(this.jp_.object, this.args);
+ // return this.jp_.run_before_after(this.object, this.args);
+ }else{
+ var ti = this.jp_.around[this.around_index];
+ var mobj = ti[0]||dj_global;
+ var meth = ti[1];
+ return mobj[meth].call(mobj, this);
+ }
+}
+
+
+dojo.event.MethodJoinPoint = function(obj, methname){
+ this.object = obj||dj_global;
+ this.methodname = methname;
+ this.methodfunc = this.object[methname];
+ this.before = [];
+ this.after = [];
+ this.around = [];
+}
+
+dojo.event.MethodJoinPoint.getForMethod = function(obj, methname){
+ // if(!(methname in obj)){
+ if(!obj){ obj = dj_global; }
+ if(!obj[methname]){
+ // supply a do-nothing method implementation
+ obj[methname] = function(){};
+ if(!obj[methname]){
+ // e.g. cannot add to inbuilt objects in IE6
+ dojo.raise("Cannot set do-nothing method on that object "+methname);
+ }
+ }else if((!dojo.lang.isFunction(obj[methname]))&&(!dojo.lang.isAlien(obj[methname]))){
+ return null; // FIXME: should we throw an exception here instead?
+ }
+ // we hide our joinpoint instance in obj[methname + '$joinpoint']
+ var jpname = methname + "$joinpoint";
+ var jpfuncname = methname + "$joinpoint$method";
+ var joinpoint = obj[jpname];
+ if(!joinpoint){
+ var isNode = false;
+ if(dojo.event["browser"]){
+ if( (obj["attachEvent"])||
+ (obj["nodeType"])||
+ (obj["addEventListener"]) ){
+ isNode = true;
+ dojo.event.browser.addClobberNodeAttrs(obj, [jpname, jpfuncname, methname]);
+ }
+ }
+ var origArity = obj[methname].length;
+ obj[jpfuncname] = obj[methname];
+ // joinpoint = obj[jpname] = new dojo.event.MethodJoinPoint(obj, methname);
+ joinpoint = obj[jpname] = new dojo.event.MethodJoinPoint(obj, jpfuncname);
+ obj[methname] = function(){
+ var args = [];
+
+ if((isNode)&&(!arguments.length)){
+ var evt = null;
+ try{
+ if(obj.ownerDocument){
+ evt = obj.ownerDocument.parentWindow.event;
+ }else if(obj.documentElement){
+ evt = obj.documentElement.ownerDocument.parentWindow.event;
+ }else if(obj.event){ //obj is a window
+ evt = obj.event;
+ }else{
+ evt = window.event;
+ }
+ }catch(e){
+ evt = window.event;
+ }
+
+ if(evt){
+ args.push(dojo.event.browser.fixEvent(evt, this));
+ }
+ }else{
+ for(var x=0; x<arguments.length; x++){
+ if((x==0)&&(isNode)&&(dojo.event.browser.isEvent(arguments[x]))){
+ args.push(dojo.event.browser.fixEvent(arguments[x], this));
+ }else{
+ args.push(arguments[x]);
+ }
+ }
+ }
+ // return joinpoint.run.apply(joinpoint, arguments);
+ return joinpoint.run.apply(joinpoint, args);
+ }
+ obj[methname].__preJoinArity = origArity;
+ }
+ return joinpoint;
+}
+
+dojo.lang.extend(dojo.event.MethodJoinPoint, {
+ unintercept: function(){
+ this.object[this.methodname] = this.methodfunc;
+ this.before = [];
+ this.after = [];
+ this.around = [];
+ },
+
+ disconnect: dojo.lang.forward("unintercept"),
+
+ run: function(){
+ var obj = this.object||dj_global;
+ var args = arguments;
+
+ // optimization. We only compute once the array version of the arguments
+ // pseudo-arr in order to prevent building it each time advice is unrolled.
+ var aargs = [];
+ for(var x=0; x<args.length; x++){
+ aargs[x] = args[x];
+ }
+
+ var unrollAdvice = function(marr){
+ if(!marr){
+ dojo.debug("Null argument to unrollAdvice()");
+ return;
+ }
+
+ var callObj = marr[0]||dj_global;
+ var callFunc = marr[1];
+
+ if(!callObj[callFunc]){
+ dojo.raise("function \"" + callFunc + "\" does not exist on \"" + callObj + "\"");
+ }
+
+ var aroundObj = marr[2]||dj_global;
+ var aroundFunc = marr[3];
+ var msg = marr[6];
+ var undef;
+
+ var to = {
+ args: [],
+ jp_: this,
+ object: obj,
+ proceed: function(){
+ return callObj[callFunc].apply(callObj, to.args);
+ }
+ };
+ to.args = aargs;
+
+ var delay = parseInt(marr[4]);
+ var hasDelay = ((!isNaN(delay))&&(marr[4]!==null)&&(typeof marr[4] != "undefined"));
+ if(marr[5]){
+ var rate = parseInt(marr[5]);
+ var cur = new Date();
+ var timerSet = false;
+ if((marr["last"])&&((cur-marr.last)<=rate)){
+ if(dojo.event.canTimeout){
+ if(marr["delayTimer"]){
+ clearTimeout(marr.delayTimer);
+ }
+ var tod = parseInt(rate*2); // is rate*2 naive?
+ var mcpy = dojo.lang.shallowCopy(marr);
+ marr.delayTimer = setTimeout(function(){
+ // FIXME: on IE at least, event objects from the
+ // browser can go out of scope. How (or should?) we
+ // deal with it?
+ mcpy[5] = 0;
+ unrollAdvice(mcpy);
+ }, tod);
+ }
+ return;
+ }else{
+ marr.last = cur;
+ }
+ }
+
+ // FIXME: need to enforce rates for a connection here!
+
+ if(aroundFunc){
+ // NOTE: around advice can't delay since we might otherwise depend
+ // on execution order!
+ aroundObj[aroundFunc].call(aroundObj, to);
+ }else{
+ // var tmjp = dojo.event.MethodJoinPoint.getForMethod(obj, methname);
+ if((hasDelay)&&((dojo.render.html)||(dojo.render.svg))){ // FIXME: the render checks are grotty!
+ dj_global["setTimeout"](function(){
+ if(msg){
+ callObj[callFunc].call(callObj, to);
+ }else{
+ callObj[callFunc].apply(callObj, args);
+ }
+ }, delay);
+ }else{ // many environments can't support delay!
+ if(msg){
+ callObj[callFunc].call(callObj, to);
+ }else{
+ callObj[callFunc].apply(callObj, args);
+ }
+ }
+ }
+ }
+
+ if(this.before.length>0){
+ // pass a cloned array, if this event disconnects this event forEach on this.before wont work
+ dojo.lang.forEach(this.before.concat(new Array()), unrollAdvice);
+ }
+
+ var result;
+ if(this.around.length>0){
+ var mi = new dojo.event.MethodInvocation(this, obj, args);
+ result = mi.proceed();
+ }else if(this.methodfunc){
+ result = this.object[this.methodname].apply(this.object, args);
+ }
+
+ if(this.after.length>0){
+ // see comment on this.before above
+ dojo.lang.forEach(this.after.concat(new Array()), unrollAdvice);
+ }
+
+ return (this.methodfunc) ? result : null;
+ },
+
+ getArr: function(kind){
+ var arr = this.after;
+ // FIXME: we should be able to do this through props or Array.in()
+ if((typeof kind == "string")&&(kind.indexOf("before")!=-1)){
+ arr = this.before;
+ }else if(kind=="around"){
+ arr = this.around;
+ }
+ return arr;
+ },
+
+ kwAddAdvice: function(args){
+ this.addAdvice( args["adviceObj"], args["adviceFunc"],
+ args["aroundObj"], args["aroundFunc"],
+ args["adviceType"], args["precedence"],
+ args["once"], args["delay"], args["rate"],
+ args["adviceMsg"]);
+ },
+
+ addAdvice: function( thisAdviceObj, thisAdvice,
+ thisAroundObj, thisAround,
+ advice_kind, precedence,
+ once, delay, rate, asMessage){
+ var arr = this.getArr(advice_kind);
+ if(!arr){
+ dojo.raise("bad this: " + this);
+ }
+
+ var ao = [thisAdviceObj, thisAdvice, thisAroundObj, thisAround, delay, rate, asMessage];
+
+ if(once){
+ if(this.hasAdvice(thisAdviceObj, thisAdvice, advice_kind, arr) >= 0){
+ return;
+ }
+ }
+
+ if(precedence == "first"){
+ arr.unshift(ao);
+ }else{
+ arr.push(ao);
+ }
+ },
+
+ hasAdvice: function(thisAdviceObj, thisAdvice, advice_kind, arr){
+ if(!arr){ arr = this.getArr(advice_kind); }
+ var ind = -1;
+ for(var x=0; x<arr.length; x++){
+ var aao = (typeof thisAdvice == "object") ? (new String(thisAdvice)).toString() : thisAdvice;
+ var a1o = (typeof arr[x][1] == "object") ? (new String(arr[x][1])).toString() : arr[x][1];
+ if((arr[x][0] == thisAdviceObj)&&(a1o == aao)){
+ ind = x;
+ }
+ }
+ return ind;
+ },
+
+ removeAdvice: function(thisAdviceObj, thisAdvice, advice_kind, once){
[... 438 lines stripped ...]