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: dojo.js.uncompressed.js,v 1.1 2006/08/09 17:26:18 yannoo Exp $ */ // 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 // - 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; 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. if(object==null){ object = dj_global; } // exception if object is not an Object return (typeof object[name] == "undefined"); // Boolean } // make sure djConfig is defined if(dj_undef("djConfig")){ 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")){ var dojo = {}; } //TODOC: HOW TO DOC THIS? dojo.version = { // summary: version number of this instance of dojo. major: 0, minor: 3, patch: 1, flag: "", revision: Number("$Rev: 4342 $".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. return (object && !dj_undef(name, object) ? object[name] : (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 'dj_global'. // create: If true, Objects will be created at any point along the 'path' that is undefined. var object = (context != null ? context : dj_global); var names = path.split('.'); var prop = names.pop(); for (var i=0,l=names.length;i 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 - 1; i > 0; i--){ var parentModule = syms.slice(0, i).join("."); var parentModulePath = this.getModulePrefix(parentModule); if(parentModulePath != parentModule){ syms.splice(0, i, parentModulePath); break; } } return syms; } /** * loadModule("A.B") first checks to see if symbol A.B is defined. * If it is, it is simply returned (nothing to do). * * If it is not defined, it will look for "A/B.js" in the script root directory, * followed by "A.js". * * It throws if it cannot find a file to load, or if the symbol A.B is not * defined after loading. * * It returns the object A.B. * * This does nothing about importing symbols into the current package. * It is presumed that the caller will take care of that. For example, to import * all symbols: * * with (dojo.hostenv.loadModule("A.B")) { * ... * } * * And to import just the leaf symbol: * * var B = dojo.hostenv.loadModule("A.B"); * ... * * dj_load is an alias for dojo.hostenv.loadModule */ dojo.hostenv._global_omit_module_check = false; dojo.hostenv.loadModule = function(modulename, exact_only, omit_module_check){ if(!modulename){ return; } omit_module_check = this._global_omit_module_check || omit_module_check; var module = this.findModule(modulename, false); if(module){ return module; } // protect against infinite recursion from mutual dependencies if(dj_undef(modulename, this.loading_modules_)){ this.addedToLoadingCount.push(modulename); } this.loading_modules_[modulename] = 1; // convert periods to slashes var relpath = modulename.replace(/\./g, '/') + '.js'; var syms = this.getModuleSymbols(modulename); var startedRelative = ((syms[0].charAt(0) != '/')&&(!syms[0].match(/^\w+:/))); var last = syms[syms.length - 1]; // figure out if we're looking for a full package, if so, we want to do // things slightly diffrently var nsyms = modulename.split("."); 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, ((!omit_module_check) ? modulename : null)); if(ok){ break; } syms.pop(); } }else{ relpath = syms.join("/") + '.js'; modulename = nsyms.join('.'); var ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); if((!ok)&&(!exact_only)){ syms.pop(); while(syms.length){ relpath = syms.join('/') + '.js'; ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); if(ok){ break; } syms.pop(); relpath = syms.join('/') + '/'+this.pkgFileName+'.js'; if(startedRelative && (relpath.charAt(0)=="/")){ relpath = relpath.slice(1); } ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null)); if(ok){ break; } } } if((!ok)&&(!omit_module_check)){ dojo.raise("Could not load '" + modulename + "'; last tried '" + relpath + "'"); } } // check that the symbol was defined //Don't bother if we're doing xdomain (asynchronous) loading. if(!omit_module_check && !this["isXDomain"]){ // pass in false so we can give better error module = this.findModule(modulename, false); if(!module){ dojo.raise("symbol '" + modulename + "' is not defined after loading '" + relpath + "'"); } } return module; } /** * startPackage("A.B") follows the path, and at each level creates a new empty * object or uses what already exists. It returns the result. */ dojo.hostenv.startPackage = function(packname){ var modref = dojo.evalObjPath((packname.split(".").slice(0, -1)).join('.')); this.loaded_modules_[(new String(packname)).toLowerCase()] = modref; var syms = packname.split(/\./); if(syms[syms.length-1]=="*"){ syms.pop(); } return dojo.evalObjPath(syms.join("."), true); } /** * findModule("A.B") returns the object A.B if it exists, otherwise null. * @param modulename A string like 'A.B'. * @param must_exist Optional, defualt false. throw instead of returning null * if the module does not currently exist. */ dojo.hostenv.findModule = function(modulename, must_exist){ // check cache /* if(!dj_undef(modulename, this.modules_)){ return this.modules_[modulename]; } */ var lmn = (new String(modulename)).toLowerCase(); if(this.loaded_modules_[lmn]){ return this.loaded_modules_[lmn]; } // see if symbol is defined anyway var module = dojo.evalObjPath(modulename); if((modulename)&&(typeof module != 'undefined')&&(module)){ this.loaded_modules_[lmn] = module; return module; } if(must_exist){ dojo.raise("no loaded module named '" + modulename + "'"); } return null; } //Start of old bootstrap2: /* * This method taks a "map" of arrays which one can use to optionally load dojo * modules. The map is indexed by the possible dojo.hostenv.name_ values, with * two additional values: "default" and "common". The items in the "default" * array will be loaded if none of the other items have been choosen based on * the hostenv.name_ item. The items in the "common" array will _always_ be * loaded, regardless of which list is chosen. Here's how it's normally * called: * * dojo.kwCompoundRequire({ * browser: [ * ["foo.bar.baz", true, true], // an example that passes multiple args to loadModule() * "foo.sample.*", * "foo.test, * ], * default: [ "foo.sample.*" ], * common: [ "really.important.module.*" ] * }); */ dojo.kwCompoundRequire = function(modMap){ var common = modMap["common"]||[]; var result = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]); for(var x=0; x 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; // TODO: is the HTML LANG attribute relevant? 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; if (document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("org.w3c.dom.svg", "1.0") ){ 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.getText = function(uri, async_cb, fail_ok){ var http = this.getXmlhttpObject(); if(async_cb){ http.onreadystatechange = function(){ if(4==http.readyState){ if((!http["status"])||((200 <= http.status)&&(300 > http.status))){ // 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((http["status"])&&((200 > http.status)||(300 <= http.status))){ throw Error("Unable to load "+uri+" status:"+ http.status); } }catch(e){ if((fail_ok)&&(!async_cb)){ return null; }else{ throw e; } } 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 = document.getElementsByTagName("body")[0] || document.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("
" + line + "
"); }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; } /* Uncomment this to allow init after DOMLoad, not after window.onload // Mozilla exposes the event we could use if (dojo.render.html.mozilla) { document.addEventListener("DOMContentLoaded", dj_load_init, null); } // for Internet Explorer. readyState will not be achieved on init call, but dojo doesn't need it //Tighten up the comments below to allow init after DOMLoad, not after window.onload / * @cc_on @ * / / * @if (@_win32) document.write("