/** * @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 6824 2006-12-06 09:34:32Z alex $ */ // 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: 4, patch: 1, flag: "", revision: Number("$Rev: 6824 $".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