You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ca...@apache.org on 2007/01/11 23:36:18 UTC
svn commit: r495409 [17/47] - in
/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource:
./ src/ src/animation/ src/cal/ src/charting/ src/charting/svg/
src/charting/vml/ src/collections/ src/crypto/ src/data/ src/data/...
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_browser.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_browser.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_browser.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_browser.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,538 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+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;
+ }
+ }else{
+ }
+ })();
+
+ 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(){
+ // summary: does the work of portably generating a new XMLHTTPRequest object.
+ 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; // XMLHTTPRequest instance
+ }
+
+ dojo.hostenv._blockAsync = false;
+ dojo.hostenv.getText = function(uri, async_cb, fail_ok){
+ // summary: Read the contents of the specified uri and return those contents.
+ // uri:
+ // A relative or absolute uri. If absolute, it still must be in
+ // the same "domain" as we are.
+ // 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.
+ // fail_ok:
+ // Default false. If fail_ok and !async_cb and loading fails,
+ // return null instead of throwing.
+
+ // 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; // String
+ }
+
+ dojo.hostenv.defaultDebugContainerId = 'dojoDebug';
+ dojo.hostenv._println_buffer = [];
+ dojo.hostenv._println_safe = false;
+ dojo.hostenv.println = function(/*String*/line){
+ // summary:
+ // prints the provided line to whatever logging container is
+ // available. If the page isn't loaded yet, the line may be added
+ // to a buffer for printing later.
+ 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(/*DomNode*/node, /*String*/evtName, /*Function*/fp){
+ // summary:
+ // non-destructively adds the specified function to the node's
+ // evtName handler.
+ // node: the DomNode to add the handler to
+ // evtName: should be in the form "click" for "onclick" handlers
+ 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{
+ //This else case should be xdomain loading.
+ //Make sure this is the first thing in the load listener array.
+ //Part of the dojo.addOnLoad guarantee is that when the listeners are notified,
+ //It means the DOM (or page) has loaded and that widgets have been parsed.
+ dojo.hostenv.modulesLoadedListeners.unshift(initFunc);
+ }
+ }
+
+ // START DOMContentLoaded
+ // Mozilla and Opera 9 expose the event we could use
+ if(document.addEventListener){
+ if(dojo.render.html.opera || (dojo.render.html.moz && !djConfig.delayMozLoadingFix)){
+ document.addEventListener("DOMContentLoaded", dj_load_init, null);
+ }
+
+ // mainly for Opera 8.5, won't be fired if DOMContentLoaded fired already.
+ // also used for Mozilla because of trac #1640
+ window.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
+
+ // IE WebControl hosted in an application can fire "beforeunload" and "unload"
+ // events when control visibility changes, causing Dojo to unload too soon. The
+ // following code fixes the problem
+ // Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;199155
+ if(dojo.render.html.ie){
+ dj_addNodeEvtHdlr(window, "beforeunload", function(){
+ dojo.hostenv._unloading = true;
+ window.setTimeout(function() {
+ dojo.hostenv._unloading = false;
+ }, 0);
+ });
+ }
+
+ dj_addNodeEvtHdlr(window, "unload", function(){
+ dojo.hostenv.unloaded();
+ if((!dojo.render.html.ie)||(dojo.render.html.ie && dojo.hostenv._unloading)){
+ 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 bug)
+ 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(/*String*/id, /*DocumentElement*/doc){
+ // summary:
+ // similar to other library's "$" function, takes a string
+ // representing a DOM id or a DomNode and returns the
+ // corresponding DomNode. If a Node is passed, this function is a
+ // no-op. Returns a single DOM node or null, working around
+ // several browser-specific bugs to do so.
+ // id: DOM id or DOM Node
+ // doc:
+ // optional, defaults to the current value of dj_currentDocument.
+ // Can be used to retreive node references from other documents.
+ 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; // DomNode
+ }
+ return id; // DomNode
+ }
+
+ dojo.setContext = function(/*Object*/globalObject, /*DocumentElement*/globalDocument){
+ // summary:
+ // changes the behavior of many core Dojo functions that deal with
+ // namespace and DOM lookup, changing them to work in a new global
+ // context. The varibles dj_currentContext and dj_currentDocument
+ // are modified as a result of calling this function.
+ 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;
+ }
+
+} //if (typeof window != 'undefined')
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_dashboard.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_dashboard.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_dashboard.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_dashboard.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,197 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.render.name = dojo.hostenv.name_ = "dashboard";
+
+dojo.hostenv.println = function(/*String*/ message){
+ // summary: Prints a message to the OS X console
+ return alert(message); // null
+}
+
+dojo.hostenv.getXmlhttpObject = function(/*Object*/ kwArgs){
+ // summary: Returns the appropriate transfer object for the call type
+ if(widget.system && kwArgs){
+ if((kwArgs.contentType && kwArgs.contentType.indexOf("text/") != 0) || (kwArgs.headers && kwArgs.headers["content-type"] && kwArgs.headers["content-type"].indexOf("text/") != 0)){
+ var curl = new dojo.hostenv.CurlRequest;
+ curl._save = true;
+ return curl;
+ }else if(kwArgs.method && kwArgs.method.toUpperCase() == "HEAD"){
+ return new dojo.hostenv.CurlRequest;
+ }else if(kwArgs.headers && kwArgs.header.referer){
+ return new dojo.hostenv.CurlRequest;
+ }
+ }
+ return new XMLHttpRequest; // XMLHttpRequest
+}
+
+dojo.hostenv.CurlRequest = function(){
+ // summary: Emulates the XMLHttpRequest Object
+ this.onreadystatechange = null;
+ this.readyState = 0;
+ this.responseText = "";
+ this.responseXML = null;
+ this.status = 0;
+ this.statusText = "";
+ this._method = "";
+ this._url = "";
+ this._async = true;
+ this._referrer = "";
+ this._headers = [];
+ this._save = false;
+ this._responseHeader = "";
+ this._responseHeaders = {};
+ this._fileName = "";
+ this._username = "";
+ this._password = "";
+}
+
+dojo.hostenv.CurlRequest.prototype.open = function(/*String*/ method, /*URL*/ url, /*Boolean?*/ async, /*String?*/ username, /*String?*/ password){
+ this._method = method;
+ this._url = url;
+ if(async){
+ this._async = async;
+ }
+ if(username){
+ this._username = username;
+ }
+ if(password){
+ this._password = password;
+ }
+}
+
+dojo.hostenv.CurlRequest.prototype.setRequestHeader = function(/*String*/ label, /*String*/ value){
+ switch(label){
+ case "Referer":
+ this._referrer = value;
+ break;
+ case "content-type":
+ break;
+ default:
+ this._headers.push(label + "=" + value);
+ break;
+ }
+}
+
+dojo.hostenv.CurlRequest.prototype.getAllResponseHeaders = function(){
+ return this._responseHeader; // String
+}
+
+dojo.hostenv.CurlRequest.prototype.getResponseHeader = function(/*String*/ headerLabel){
+ return this._responseHeaders[headerLabel]; // String
+}
+
+// -sS = Show only errors in errorString
+// -i = Display headers with return
+// -e = Referrer URI
+// -H = Headers
+// -d = data to be sent (forces POST)
+// -G = forces GET
+// -o = Writes to file (in the cache directory)
+// -I = Only load headers
+// -u = user:password
+dojo.hostenv.CurlRequest.prototype.send = function(/*String*/ content){
+ this.readyState = 1;
+ if(this.onreadystatechange){
+ this.onreadystatechange.call(this);
+ }
+ var query = {sS: ""};
+ if(this._referrer){
+ query.e = this._referrer;
+ }
+ if(this._headers.length){
+ query.H = this._headers.join("&");
+ }
+ if(this._username){
+ if(this._password){
+ query.u = this._username + ":" + this._password;
+ }else{
+ query.u = this._username;
+ }
+ }
+ if(content){
+ query.d = this.content;
+ if(this._method != "POST"){
+ query.G = "";
+ }
+ }
+ if(this._method == "HEAD"){
+ query.I = "";
+ }else{
+ if(this._save){
+ query.I = ""; // Get the headers in the initial query
+ }else{
+ query.i = "";
+ }
+ }
+
+ var system = widget.system(dojo.hostenv.CurlRequest._formatCall(query, this._url), null);
+ this.readyState = 2;
+ if(this.onreadystatechange){
+ this.onreadystatechange.call(this);
+ }
+ if(system.errorString){
+ this.responseText = system.errorString;
+ this.status = 0;
+ }else{
+ if(this._save){
+ this._responseHeader = system.outputString;
+ }else{
+ var split = system.outputString.replace(/\r/g, "").split("\n\n", 2);
+ this._responseHeader = split[0];
+ this.responseText = split[1];
+ }
+ split = this._responseHeader.split("\n");
+ this.statusText = split.shift();
+ this.status = this.statusText.split(" ")[1];
+ for(var i = 0, header; header = split[i]; i++){
+ var header_split = header.split(": ", 2);
+ this._responseHeaders[header_split[0]] = header_split[1];
+ }
+ if(this._save){
+ widget.system("/bin/mkdir cache", null);
+ // First, make a file name
+ this._fileName = this._url.split("/").pop().replace(/\W/g, "");
+ // Then, get its extension
+ this._fileName += "." + this._responseHeaders["Content-Type"].replace(/[\r\n]/g, "").split("/").pop()
+ delete query.I;
+ query.o = "cache/" + this._fileName; // Tell it where to be saved.
+ system = widget.system(dojo.hostenv.CurlRequest._formatCall(query, this._url), null);
+ if(!system.errorString){
+ this.responseText = "cache/" + this._fileName;
+ }
+ }else if(this._method == "HEAD"){
+ this.responseText = this._responseHeader;
+ }
+ }
+
+ this.readyState = 4;
+ if(this.onreadystatechange){
+ this.onreadystatechange.call(this);
+ }
+}
+
+dojo.hostenv.CurlRequest._formatCall = function(query, url){
+ var call = ["/usr/bin/curl"];
+ for(var key in query){
+ if(query[key] != ""){
+ call.push("-" + key + " '" + query[key].replace(/'/g, "\'") + "'");
+ }else{
+ call.push("-" + key);
+ }
+ }
+ call.push("'" + url.replace(/'/g, "\'") + "'");
+ return call.join(" ");
+}
+
+dojo.hostenv.exit = function(){
+ if(widget.system){
+ widget.system("/bin/rm -rf cache/*", null);
+ }
+}
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_jsc.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_jsc.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_jsc.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_jsc.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,76 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/*
+ * JScript .NET jsc
+ *
+ */
+
+dojo.hostenv.name_ = 'jsc';
+
+// Sanity check this is the right hostenv.
+// See the Rotor source code jscript/engine/globalobject.cs for what globals
+// are available.
+if((typeof ScriptEngineMajorVersion != 'function')||(ScriptEngineMajorVersion() < 7)){
+ dojo.raise("attempt to use JScript .NET host environment with inappropriate ScriptEngine");
+}
+
+// for more than you wanted to know about why this import is required even if
+// we fully qualify all symbols, see
+// http://groups.google.com/groups?th=f050c7aeefdcbde2&rnum=12
+import System;
+
+dojo.hostenv.getText = function(uri){
+ if(!System.IO.File.Exists(uri)){
+ // dojo.raise("No such file '" + uri + "'");
+ return 0;
+ }
+ var reader = new System.IO.StreamReader(uri);
+ var contents : String = reader.ReadToEnd();
+ return contents;
+}
+
+dojo.hostenv.loadUri = function(uri){
+ var contents = this.getText(uri);
+ if(!contents){
+ dojo.raise("got no back contents from uri '" + uri + "': " + contents);
+ }
+ // TODO: in JScript .NET, eval will not affect the symbol table of the current code?
+ var value = dj_eval(contents);
+ dojo.debug("jsc eval of contents returned: ", value);
+ return 1;
+
+ // for an example doing runtime code compilation, see:
+ // http://groups.google.com/groups?selm=eQ1aeciCBHA.1644%40tkmsftngp05&rnum=6
+ // Microsoft.JScript or System.CodeDom.Compiler ?
+ // var engine = new Microsoft.JScript.Vsa.VsaEngine()
+ // what about loading a js file vs. a dll?
+ // GetObject("script:" . uri);
+}
+
+/* The System.Environment object is useful:
+ print ("CommandLine='" + System.Environment.CommandLine + "' " +
+ "program name='" + System.Environment.GetCommandLineArgs()[0] + "' " +
+ "CurrentDirectory='" + System.Environment.CurrentDirectory + "' " +
+ "StackTrace='" + System.Environment.StackTrace + "'");
+*/
+
+// same as System.Console.WriteLine
+// sigh; Rotor treats symbol "print" at parse time without actually putting it
+// in the builtin symbol table.
+// Note that the print symbol is not available if jsc is run with the "/print-"
+// option.
+dojo.hostenv.println = function(s){
+ print(s); // = print
+}
+
+dojo.hostenv.getLibraryScriptUri = function(){
+ return System.Environment.GetCommandLineArgs()[0];
+}
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_rhino.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_rhino.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_rhino.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_rhino.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,257 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/*
+* Rhino host environment
+*/
+// make jsc shut up (so we can use jsc for sanity checking)
+/*@cc_on
+@if (@_jscript_version >= 7)
+var loadClass; var print; var load; var quit; var version; var Packages; var java;
+@end
+@*/
+
+dojo.hostenv.println=function(line){
+ if(arguments.length > 0){
+ print(arguments[0]);
+ for(var i=1; i<arguments.length; i++){
+ var valid=false;
+ for (var p in arguments[i]){valid=true;break;}
+ if(valid){
+ dojo.debugShallow(arguments[i]);
+ }
+ }
+ } else {
+ print(line);
+ }
+}
+
+dojo.locale = dojo.locale || java.util.Locale.getDefault().toString().replace('_','-').toLowerCase();
+dojo.render.name = dojo.hostenv.name_ = 'rhino';
+dojo.hostenv.getVersion = function() {return version();};
+
+if (dj_undef("byId")) {
+ dojo.byId = function(id, doc){
+ if(id && (typeof id == "string" || id instanceof String)){
+ if(!doc){ doc = document; }
+ return doc.getElementById(id);
+ }
+ return id; // assume it's a node
+ }
+}
+
+// see comments in spidermonkey loadUri
+dojo.hostenv.loadUri = function(uri, cb){
+ try{
+ var local = (new java.io.File(uri)).exists();
+ if(!local){
+ try{
+ // try it as a file first, URL second
+ var stream = (new java.net.URL(uri)).openStream();
+ // close the stream so we don't leak resources
+ stream.close();
+ }catch(e){
+ // no debug output; this failure just means the uri was not found.
+ return false;
+ }
+ }
+//FIXME: Use Rhino 1.6 native readFile/readUrl if available?
+ if(cb){
+ var contents = (local ? readText : readUri)(uri, "UTF-8");
+ cb(eval('('+contents+')'));
+ }else{
+ load(uri);
+ }
+ return true;
+ }catch(e){
+ dojo.debug("rhino load('" + uri + "') failed. Exception: " + e);
+ return false;
+ }
+}
+
+dojo.hostenv.exit = function(exitcode){
+ quit(exitcode);
+}
+
+// Hack to determine current script...
+//
+// These initial attempts failed:
+// 1. get an EcmaError and look at e.getSourceName(): try {eval ("static in return")} catch(e) { ...
+// Won't work because NativeGlobal.java only does a put of "name" and "message", not a wrapped reflecting object.
+// Even if the EcmaError object had the sourceName set.
+//
+// 2. var e = Packages.org.mozilla.javascript.Context.getCurrentContext().reportError('');
+// Won't work because it goes directly to the errorReporter, not the return value.
+// We want context.interpreterSourceFile and context.interpreterLine, which are used in static Context.getSourcePositionFromStack
+// (set by Interpreter.java at interpretation time, if in interpreter mode).
+//
+// 3. var e = Packages.org.mozilla.javascript.Context.getCurrentContext().reportRuntimeError('');
+// This returns an object, but e.message still does not have source info.
+// In compiler mode, perhaps not set; in interpreter mode, perhaps not used by errorReporter?
+//
+// What we found works is to do basically the same hack as is done in getSourcePositionFromStack,
+// making a new java.lang.Exception() and then calling printStackTrace on a string stream.
+// We have to parse the string for the .js files (different from the java files).
+// This only works however in compiled mode (-opt 0 or higher).
+// In interpreter mode, entire stack is java.
+// When compiled, printStackTrace is like:
+// java.lang.Exception
+// at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
+// at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
+// at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
+// at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
+// at org.mozilla.javascript.NativeJavaClass.constructSpecific(NativeJavaClass.java:228)
+// at org.mozilla.javascript.NativeJavaClass.construct(NativeJavaClass.java:185)
+// at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:1269)
+// at org.mozilla.javascript.gen.c2.call(/Users/mda/Sites/burstproject/testrhino.js:27)
+// ...
+// at org.mozilla.javascript.tools.shell.Main.main(Main.java:76)
+//
+// Note may get different answers based on:
+// Context.setOptimizationLevel(-1)
+// Context.setGeneratingDebug(true)
+// Context.setGeneratingSource(true)
+//
+// Some somewhat helpful posts:
+// http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=9v9n0g%246gr1%40ripley.netscape.com
+// http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=3BAA2DC4.6010702%40atg.com
+//
+// Note that Rhino1.5R5 added source name information in some exceptions.
+// But this seems not to help in command-line Rhino, because Context.java has an error reporter
+// so no EvaluationException is thrown.
+
+// do it by using java java.lang.Exception
+function dj_rhino_current_script_via_java(depth) {
+ var optLevel = Packages.org.mozilla.javascript.Context.getCurrentContext().getOptimizationLevel();
+ // if (optLevel == -1){ dojo.unimplemented("getCurrentScriptURI (determine current script path for rhino when interpreter mode)", ''); }
+ var caw = new java.io.CharArrayWriter();
+ var pw = new java.io.PrintWriter(caw);
+ var exc = new java.lang.Exception();
+ var s = caw.toString();
+ // we have to exclude the ones with or without line numbers because they put double entries in:
+ // at org.mozilla.javascript.gen.c3._c4(/Users/mda/Sites/burstproject/burst/Runtime.js:56)
+ // at org.mozilla.javascript.gen.c3.call(/Users/mda/Sites/burstproject/burst/Runtime.js)
+ var matches = s.match(/[^\(]*\.js\)/gi);
+ if(!matches){
+ throw Error("cannot parse printStackTrace output: " + s);
+ }
+
+ // matches[0] is entire string, matches[1] is this function, matches[2] is caller, ...
+ var fname = ((typeof depth != 'undefined')&&(depth)) ? matches[depth + 1] : matches[matches.length - 1];
+ var fname = matches[3];
+ if(!fname){ fname = matches[1]; }
+ // print("got fname '" + fname + "' from stack string '" + s + "'");
+ if (!fname){ throw Error("could not find js file in printStackTrace output: " + s); }
+ //print("Rhino getCurrentScriptURI returning '" + fname + "' from: " + s);
+ return fname;
+}
+
+// UNUSED: leverage new support in native exception for getSourceName
+/*
+function dj_rhino_current_script_via_eval_exception() {
+ var exc;
+ // 'ReferenceError: "undefinedsymbol" is not defined.'
+ try {eval ("undefinedsymbol()") } catch(e) {exc = e;}
+ // 'Error: whatever'
+ // try{throw Error("whatever");} catch(e) {exc = e;}
+ // 'SyntaxError: identifier is a reserved word'
+ // try {eval ("static in return")} catch(e) { exc = e; }
+ // print("got exception: '" + exc + "' type=" + (typeof exc));
+ // print("exc.stack=" + (typeof exc.stack));
+ var sn = exc.rhinoException.getSourceName();
+ print("SourceName=" + sn);
+ return sn;
+}*/
+
+// reading a file from disk in Java is a humiliating experience by any measure.
+// Lets avoid that and just get the freaking text
+function readText(path, encoding){
+ encoding = encoding || "utf-8";
+ // NOTE: we intentionally avoid handling exceptions, since the caller will
+ // want to know
+ var jf = new java.io.File(path);
+ var is = new java.io.FileInputStream(jf);
+ return dj_readInputStream(is, encoding);
+}
+
+function readUri(uri, encoding){
+ var conn = (new java.net.URL(uri)).openConnection();
+ encoding = encoding || conn.getContentEncoding() || "utf-8";
+ var is = conn.getInputStream();
+ return dj_readInputStream(is, encoding);
+}
+
+function dj_readInputStream(is, encoding){
+ var input = new java.io.BufferedReader(new java.io.InputStreamReader(is, encoding));
+ try {
+ var sb = new java.lang.StringBuffer();
+ var line = "";
+ while((line = input.readLine()) !== null){
+ sb.append(line);
+ sb.append(java.lang.System.getProperty("line.separator"));
+ }
+ return sb.toString();
+ } finally {
+ input.close();
+ }
+}
+
+// call this now because later we may not be on the top of the stack
+if(!djConfig.libraryScriptUri.length){
+ try{
+ djConfig.libraryScriptUri = dj_rhino_current_script_via_java(1);
+ }catch(e){
+ // otherwise just fake it
+ if(djConfig["isDebug"]){
+ print("\n");
+ print("we have no idea where Dojo is located.");
+ print("Please try loading rhino in a non-interpreted mode or set a");
+ print("\n\tdjConfig.libraryScriptUri\n");
+ print("Setting the dojo path to './'");
+ print("This is probably wrong!");
+ print("\n");
+ print("Dojo will try to load anyway");
+ }
+ djConfig.libraryScriptUri = "./";
+ }
+}
+
+dojo.doc = function(){
+ // summary:
+ // return the document object associated with the dojo.global()
+ return document;
+}
+
+dojo.body = function(){
+ return document.body;
+}
+
+function setTimeout(func, delay){
+ // summary: provides timed callbacks using Java threads
+
+ var def={
+ sleepTime:delay,
+ hasSlept:false,
+
+ run:function(){
+ if (!this.hasSlept){
+ this.hasSlept=true;
+ java.lang.Thread.currentThread().sleep(this.sleepTime);
+ }
+ try {
+ func();
+ } catch(e){dojo.debug("Error running setTimeout thread:" + e);}
+ }
+ };
+
+ var runnable=new java.lang.Runnable(def);
+ var thread=new java.lang.Thread(runnable);
+ thread.start();
+}
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_spidermonkey.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_spidermonkey.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_spidermonkey.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_spidermonkey.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/*
+ * SpiderMonkey host environment
+ */
+
+dojo.hostenv.name_ = 'spidermonkey';
+
+dojo.hostenv.println = print;
+dojo.hostenv.exit = function(exitcode){
+ quit(exitcode);
+}
+
+// version() returns 0, sigh. and build() returns nothing but just prints.
+dojo.hostenv.getVersion = function(){ return version(); }
+
+// make jsc shut up (so we can use jsc for sanity checking)
+/*@cc_on
+@if (@_jscript_version >= 7)
+var line2pc; var print; var load; var quit;
+@end
+@*/
+
+if(typeof line2pc == 'undefined'){
+ dojo.raise("attempt to use SpiderMonkey host environment when no 'line2pc' global");
+}
+
+/*
+ * This is a hack that determines the current script file by parsing a generated
+ * stack trace (relying on the non-standard "stack" member variable of the
+ * SpiderMonkey Error object).
+ * If param depth is passed in, it'll return the script file which is that far down
+ * the stack, but that does require that you know how deep your stack is when you are
+ * calling.
+ */
+function dj_spidermonkey_current_file(depth){
+ var s = '';
+ try{
+ throw Error("whatever");
+ }catch(e){
+ s = e.stack;
+ }
+ // lines are like: bu_getCurrentScriptURI_spidermonkey("ScriptLoader.js")@burst/Runtime.js:101
+ var matches = s.match(/[^@]*\.js/gi);
+ if(!matches){
+ dojo.raise("could not parse stack string: '" + s + "'");
+ }
+ var fname = (typeof depth != 'undefined' && depth) ? matches[depth + 1] : matches[matches.length - 1];
+ if(!fname){
+ dojo.raise("could not find file name in stack string '" + s + "'");
+ }
+ //print("SpiderMonkeyRuntime got fname '" + fname + "' from stack string '" + s + "'");
+ return fname;
+}
+
+// call this now because later we may not be on the top of the stack
+if(!dojo.hostenv.library_script_uri_){
+ dojo.hostenv.library_script_uri_ = dj_spidermonkey_current_file(0);
+}
+
+dojo.hostenv.loadUri = function(uri){
+ // spidermonkey load() evaluates the contents into the global scope (which
+ // is what we want).
+ // TODO: sigh, load() does not return a useful value.
+ // Perhaps it is returning the value of the last thing evaluated?
+ var ok = load(uri);
+ // dojo.debug("spidermonkey load(", uri, ") returned ", ok);
+ return 1;
+}
+
+
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_svg.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_svg.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_svg.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_svg.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,223 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+// hostenv_svg
+if(typeof window == 'undefined'){
+ dojo.raise("attempt to use adobe svg hostenv when no window object");
+}
+dojo.debug = function(){
+ if (!djConfig.isDebug) { return; }
+ var args = arguments;
+ var isJUM = dj_global["jum"];
+ var s = isJUM ? "": "DEBUG: ";
+ for (var i = 0; i < args.length; ++i){ s += args[i]; }
+ if (isJUM){ // this seems to be the only way to get JUM to "play nice"
+ jum.debug(s);
+ } else{
+ dojo.hostenv.println(s);
+ }
+};
+
+// set up dojo.render.
+dojo.render.name = navigator.appName;
+dojo.render.ver = parseFloat(navigator.appVersion, 10);
+switch(navigator.platform){
+ case "MacOS":
+ dojo.render.os.osx = true;
+ break;
+ case "Linux":
+ dojo.render.os.linux = true;
+ break;
+ case "Windows":
+ dojo.render.os.win = true;
+ break;
+ default:
+ dojo.render.os.linux = true;
+ break;
+};
+dojo.render.svg.capable = true;
+dojo.render.svg.support.builtin = true;
+// FIXME the following two is a big-ass hack for now.
+dojo.render.svg.moz = ((navigator.userAgent.indexOf("Gecko") >= 0) && (!((navigator.appVersion.indexOf("Konqueror") >= 0) || (navigator.appVersion.indexOf("Safari") >= 0))));
+dojo.render.svg.adobe = (window.parseXML != null);
+
+// agent-specific implementations.
+
+// from old hostenv_adobesvg.
+dojo.hostenv.startPackage("dojo.hostenv");
+dojo.hostenv.println = function(s){
+ try {
+ var ti = document.createElement("text");
+ ti.setAttribute("x","50");
+ ti.setAttribute("y", (25 + 15 * document.getElementsByTagName("text").length));
+ ti.appendChild(document.createTextNode(s));
+ document.documentElement.appendChild(ti);
+ } catch(e){ }
+};
+dojo.hostenv.name_ = "svg";
+
+// expected/defined by bootstrap1.js
+dojo.hostenv.setModulePrefix = function(module, prefix){ };
+dojo.hostenv.getModulePrefix = function(module){ };
+dojo.hostenv.getTextStack = [];
+dojo.hostenv.loadUriStack = [];
+dojo.hostenv.loadedUris = [];
+dojo.hostenv.modules_ = {};
+dojo.hostenv.modulesLoadedFired = false;
+dojo.hostenv.modulesLoadedListeners = [];
+dojo.hostenv.getText = function(uri, cb, data){
+ if (!cb) var cb = function(result){ window.alert(result); };
+ if (!data) {
+ window.getUrl(uri, cb);
+ } else {
+ window.postUrl(uri, data, cb);
+ }
+};
+dojo.hostenv.getLibaryScriptUri = function(){ };
+
+dojo.hostenv.loadUri = function(uri){ };
+dojo.hostenv.loadUriAndCheck = function(uri, module){ };
+
+// aliased in loader.js, don't ignore
+// we are going to kill loadModule for the first round of SVG stuff, and include stuff manually.
+dojo.hostenv.loadModule = function(moduleName){
+ // just like startPackage, but this time we're just checking to make sure it exists already.
+ var a = moduleName.split(".");
+ var currentObj = window;
+ var s = [];
+ for (var i = 0; i < a.length; i++){
+ if (a[i] == "*") continue;
+ s.push(a[i]);
+ if (!currentObj[a[i]]){
+ dojo.raise("dojo.require('" + moduleName + "'): module does not exist.");
+ } else currentObj = currentObj[a[i]];
+ }
+ return;
+};
+dojo.hostenv.startPackage = function(moduleName){
+ var a = moduleName.split(".");
+ var currentObj = window;
+ var s = [];
+ for (var i = 0; i < a.length; i++){
+ if (a[i] == "*") continue;
+ s.push(a[i]);
+ if (!currentObj[a[i]]) currentObj[a[i]] = {};
+ currentObj = currentObj[a[i]];
+ }
+ return;
+};
+
+// wrapper objects for ASVG
+if (window.parseXML){
+ window.XMLSerialzer = function(){
+ // based on WebFX RichTextControl getXHTML() function.
+ function nodeToString(n, a) {
+ function fixText(s) { return String(s).replace(/\&/g, "&").replace(/>/g, ">").replace(/</g, "<"); }
+ function fixAttribute(s) { return fixText(s).replace(/\"/g, """); }
+ switch (n.nodeType) {
+ case 1: { // ELEMENT
+ var name = n.nodeName;
+ a.push("<" + name);
+ for (var i = 0; i < n.attributes.length; i++) {
+ if (n.attributes.item(i).specified) {
+ a.push(" " + n.attributes.item(i).nodeName.toLowerCase() + "=\"" + fixAttribute(n.attributes.item(i).nodeValue) + "\"");
+ }
+ }
+ if (n.canHaveChildren || n.hasChildNodes()) {
+ a.push(">");
+ for (var i = 0; i < n.childNodes.length; i++) nodeToString(n.childNodes.item(i), a);
+ a.push("</" + name + ">\n");
+ } else a.push(" />\n");
+ break;
+ }
+ case 3: { // TEXT
+ a.push(fixText(n.nodeValue));
+ break;
+ }
+ case 4: { // CDATA
+ a.push("<![CDA" + "TA[\n" + n.nodeValue + "\n]" + "]>");
+ break;
+ }
+ case 7:{ // PROCESSING INSTRUCTION
+ a.push(n.nodeValue);
+ if (/(^<\?xml)|(^<\!DOCTYPE)/.test(n.nodeValue)) a.push("\n");
+ break;
+ }
+ case 8:{ // COMMENT
+ a.push("<!-- " + n.nodeValue + " -->\n");
+ break;
+ }
+ case 9: // DOCUMENT
+ case 11:{ // DOCUMENT FRAGMENT
+ for (var i = 0; i < n.childNodes.length; i++) nodeToString(n.childNodes.item(i), a);
+ break;
+ }
+ default:{
+ a.push("<!--\nNot Supported:\n\n" + "nodeType: " + n.nodeType + "\nnodeName: " + n.nodeName + "\n-->");
+ }
+ }
+ }
+ this.serializeToString = function(node){
+ var a = [];
+ nodeToString(node, a);
+ return a.join("");
+ };
+ };
+
+ window.DOMParser = function(){
+ // mimetype is basically ignored
+ this.parseFromString = function(s){
+ return parseXML(s, window.document);
+ }
+ };
+
+ window.XMLHttpRequest = function(){
+ // we ignore the setting and getting of content-type.
+ var uri = null;
+ var method = "POST";
+ var isAsync = true;
+ var cb = function(d){
+ this.responseText = d.content;
+ try {
+ this.responseXML = parseXML(this.responseText, window.document);
+ } catch(e){}
+ this.status = "200";
+ this.statusText = "OK";
+ if (!d.success) {
+ this.status = "500";
+ this.statusText = "Internal Server Error";
+ }
+ this.onload();
+ this.onreadystatechange();
+ };
+ this.onload = function(){};
+ this.readyState = 4;
+ this.onreadystatechange = function(){};
+ this.status = 0;
+ this.statusText = "";
+ this.responseBody = null;
+ this.responseStream = null;
+ this.responseXML = null;
+ this.responseText = null;
+ this.abort = function(){ return; };
+ this.getAllResponseHeaders = function(){ return []; };
+ this.getResponseHeader = function(n){ return null; };
+ this.setRequestHeader = function(nm, val){ };
+ this.open = function(meth, url, async){
+ method = meth;
+ uri = url;
+ };
+ this.send = function(data){
+ var d = data || null;
+ if (method == "GET") getURL(uri, cb);
+ else postURL(uri, data, cb);
+ };
+ };
+}
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_wsh.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_wsh.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_wsh.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/hostenv_wsh.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,46 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/*
+ * WSH
+ */
+
+dojo.hostenv.name_ = 'wsh';
+
+// make jsc shut up (so can sanity check)
+/*@cc_on
+@if (@_jscript_version >= 7)
+var WScript;
+@end
+@*/
+
+// make sure we are in right environment
+if(typeof WScript == 'undefined'){
+ dojo.raise("attempt to use WSH host environment when no WScript global");
+}
+
+dojo.hostenv.println = WScript.Echo;
+
+dojo.hostenv.getCurrentScriptUri = function(){
+ return WScript.ScriptFullName();
+}
+
+dojo.hostenv.getText = function(fpath){
+ var fso = new ActiveXObject("Scripting.FileSystemObject");
+ var istream = fso.OpenTextFile(fpath, 1); // iomode==1 means read only
+ if(!istream){
+ return null;
+ }
+ var contents = istream.ReadAll();
+ istream.Close();
+ return contents;
+}
+
+dojo.hostenv.exit = function(exitcode){ WScript.Quit(exitcode); }
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,14 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.html");
+
+dojo.require("dojo.html.*");
+dojo.deprecated("dojo.html", "replaced by dojo.html.*", "0.5");
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/__package__.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/__package__.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/__package__.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/__package__.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,15 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.kwCompoundRequire({
+ common: [ "dojo.html.common",
+ "dojo.html.style" ]
+});
+dojo.provide("dojo.html.*");
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/color.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/color.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/color.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/color.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,35 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.require("dojo.html.style");
+dojo.provide("dojo.html.color");
+
+dojo.require("dojo.gfx.color");
+dojo.require("dojo.lang.common");
+
+dojo.html.getBackgroundColor = function(/* HTMLElement */node){
+ // summary
+ // returns the background color of the passed node as a 32-bit color (RGBA)
+ node = dojo.byId(node);
+ var color;
+ do{
+ color = dojo.html.getStyle(node, "background-color");
+ // Safari doesn't say "transparent"
+ if(color.toLowerCase() == "rgba(0, 0, 0, 0)") { color = "transparent"; }
+ if(node == document.getElementsByTagName("body")[0]) { node = null; break; }
+ node = node.parentNode;
+ }while(node && dojo.lang.inArray(["transparent", ""], color));
+ if(color == "transparent"){
+ color = [255, 255, 255, 0];
+ }else{
+ color = dojo.gfx.color.extractRGB(color);
+ }
+ return color; // array
+}
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/common.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/common.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/common.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/common.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,230 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.html.common");
+dojo.require("dojo.lang.common");
+dojo.require("dojo.dom");
+
+dojo.lang.mixin(dojo.html, dojo.dom);
+
+dojo.html.body = function(){
+ dojo.deprecated("dojo.html.body() moved to dojo.body()", "0.5");
+ return dojo.body();
+}
+
+// FIXME: we are going to assume that we can throw any and every rendering
+// engine into the IE 5.x box model. In Mozilla, we do this w/ CSS.
+// Need to investigate for KHTML and Opera
+
+dojo.html.getEventTarget = function(/* DOMEvent */evt){
+ // summary
+ // Returns the target of an event
+ if(!evt) { evt = dojo.global().event || {} };
+ var t = (evt.srcElement ? evt.srcElement : (evt.target ? evt.target : null));
+ while((t)&&(t.nodeType!=1)){ t = t.parentNode; }
+ return t; // HTMLElement
+}
+
+dojo.html.getViewport = function(){
+ // summary
+ // Returns the dimensions of the viewable area of a browser window
+ var _window = dojo.global();
+ var _document = dojo.doc();
+ var w = 0;
+ var h = 0;
+
+ if(dojo.render.html.mozilla){
+ // mozilla
+ w = _document.documentElement.clientWidth;
+ h = _window.innerHeight;
+ }else if(!dojo.render.html.opera && _window.innerWidth){
+ //in opera9, dojo.body().clientWidth should be used, instead
+ //of window.innerWidth/document.documentElement.clientWidth
+ //so we have to check whether it is opera
+ w = _window.innerWidth;
+ h = _window.innerHeight;
+ } else if (!dojo.render.html.opera && dojo.exists(_document, "documentElement.clientWidth")){
+ // IE6 Strict
+ var w2 = _document.documentElement.clientWidth;
+ // this lets us account for scrollbars
+ if(!w || w2 && w2 < w) {
+ w = w2;
+ }
+ h = _document.documentElement.clientHeight;
+ } else if (dojo.body().clientWidth){
+ // IE, Opera
+ w = dojo.body().clientWidth;
+ h = dojo.body().clientHeight;
+ }
+ return { width: w, height: h }; // object
+}
+
+dojo.html.getScroll = function(){
+ // summary
+ // Returns the scroll position of the document
+ var _window = dojo.global();
+ var _document = dojo.doc();
+ var top = _window.pageYOffset || _document.documentElement.scrollTop || dojo.body().scrollTop || 0;
+ var left = _window.pageXOffset || _document.documentElement.scrollLeft || dojo.body().scrollLeft || 0;
+ return {
+ top: top,
+ left: left,
+ offset:{ x: left, y: top } // note the change, NOT an Array with added properties.
+ }; // object
+}
+
+dojo.html.getParentByType = function(/* HTMLElement */node, /* string */type) {
+ // summary
+ // Returns the first ancestor of node with tagName type.
+ var _document = dojo.doc();
+ var parent = dojo.byId(node);
+ type = type.toLowerCase();
+ while((parent)&&(parent.nodeName.toLowerCase()!=type)){
+ if(parent==(_document["body"]||_document["documentElement"])){
+ return null;
+ }
+ parent = parent.parentNode;
+ }
+ return parent; // HTMLElement
+}
+
+dojo.html.getAttribute = function(/* HTMLElement */node, /* string */attr){
+ // summary
+ // Returns the value of attribute attr from node.
+ node = dojo.byId(node);
+ // FIXME: need to add support for attr-specific accessors
+ if((!node)||(!node.getAttribute)){
+ // if(attr !== 'nwType'){
+ // alert("getAttr of '" + attr + "' with bad node");
+ // }
+ return null;
+ }
+ var ta = typeof attr == 'string' ? attr : new String(attr);
+
+ // first try the approach most likely to succeed
+ var v = node.getAttribute(ta.toUpperCase());
+ if((v)&&(typeof v == 'string')&&(v!="")){
+ return v; // string
+ }
+
+ // try returning the attributes value, if we couldn't get it as a string
+ if(v && v.value){
+ return v.value; // string
+ }
+
+ // this should work on Opera 7, but it's a little on the crashy side
+ if((node.getAttributeNode)&&(node.getAttributeNode(ta))){
+ return (node.getAttributeNode(ta)).value; // string
+ }else if(node.getAttribute(ta)){
+ return node.getAttribute(ta); // string
+ }else if(node.getAttribute(ta.toLowerCase())){
+ return node.getAttribute(ta.toLowerCase()); // string
+ }
+ return null; // string
+}
+
+dojo.html.hasAttribute = function(/* HTMLElement */node, /* string */attr){
+ // summary
+ // Determines whether or not the specified node carries a value for the attribute in question.
+ return dojo.html.getAttribute(dojo.byId(node), attr) ? true : false; // boolean
+}
+
+dojo.html.getCursorPosition = function(/* DOMEvent */e){
+ // summary
+ // Returns the mouse position relative to the document (not the viewport).
+ // For example, if you have a document that is 10000px tall,
+ // but your browser window is only 100px tall,
+ // if you scroll to the bottom of the document and call this function it
+ // will return {x: 0, y: 10000}
+ // NOTE: for events delivered via dojo.event.connect() and/or dojoAttachEvent (for widgets),
+ // you can just access evt.pageX and evt.pageY, rather than calling this function.
+ e = e || dojo.global().event;
+ var cursor = {x:0, y:0};
+ if(e.pageX || e.pageY){
+ cursor.x = e.pageX;
+ cursor.y = e.pageY;
+ }else{
+ var de = dojo.doc().documentElement;
+ var db = dojo.body();
+ cursor.x = e.clientX + ((de||db)["scrollLeft"]) - ((de||db)["clientLeft"]);
+ cursor.y = e.clientY + ((de||db)["scrollTop"]) - ((de||db)["clientTop"]);
+ }
+ return cursor; // object
+}
+
+dojo.html.isTag = function(/* HTMLElement */node) {
+ // summary
+ // Like dojo.dom.isTag, except case-insensitive
+ node = dojo.byId(node);
+ if(node && node.tagName) {
+ for (var i=1; i<arguments.length; i++){
+ if (node.tagName.toLowerCase()==String(arguments[i]).toLowerCase()){
+ return String(arguments[i]).toLowerCase(); // string
+ }
+ }
+ }
+ return ""; // string
+}
+
+//define dojo.html.createExternalElement for IE to workaround the annoying activation "feature" in new IE
+//details: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp
+if(dojo.render.html.ie && !dojo.render.html.ie70){
+ //only define createExternalElement for IE in none https to avoid "mixed content" warning dialog
+ if(window.location.href.substr(0,6).toLowerCase() != "https:"){
+ (function(){
+ // FIXME: this seems not to work correctly on IE 7!!
+
+ //The trick is to define a function in a script.src property:
+ // <script src="javascript:'function createExternalElement(){...}'"></script>,
+ //which will be treated as an external javascript file in IE
+ var xscript = dojo.doc().createElement('script');
+ xscript.src = "javascript:'dojo.html.createExternalElement=function(doc, tag){ return doc.createElement(tag); }'";
+ dojo.doc().getElementsByTagName("head")[0].appendChild(xscript);
+ })();
+ }
+}else{
+ //for other browsers, simply use document.createElement
+ //is enough
+ dojo.html.createExternalElement = function(/* HTMLDocument */doc, /* string */tag){
+ // summary
+ // Creates an element in the HTML document, here for ActiveX activation workaround.
+ return doc.createElement(tag); // HTMLElement
+ }
+}
+
+dojo.html._callDeprecated = function(inFunc, replFunc, args, argName, retValue){
+ dojo.deprecated("dojo.html." + inFunc,
+ "replaced by dojo.html." + replFunc + "(" + (argName ? "node, {"+ argName + ": " + argName + "}" : "" ) + ")" + (retValue ? "." + retValue : ""), "0.5");
+ var newArgs = [];
+ if(argName){ var argsIn = {}; argsIn[argName] = args[1]; newArgs.push(args[0]); newArgs.push(argsIn); }
+ else { newArgs = args }
+ var ret = dojo.html[replFunc].apply(dojo.html, args);
+ if(retValue){ return ret[retValue]; }
+ else { return ret; }
+}
+
+dojo.html.getViewportWidth = function(){
+ return dojo.html._callDeprecated("getViewportWidth", "getViewport", arguments, null, "width");
+}
+dojo.html.getViewportHeight = function(){
+ return dojo.html._callDeprecated("getViewportHeight", "getViewport", arguments, null, "height");
+}
+dojo.html.getViewportSize = function(){
+ return dojo.html._callDeprecated("getViewportSize", "getViewport", arguments);
+}
+dojo.html.getScrollTop = function(){
+ return dojo.html._callDeprecated("getScrollTop", "getScroll", arguments, null, "top");
+}
+dojo.html.getScrollLeft = function(){
+ return dojo.html._callDeprecated("getScrollLeft", "getScroll", arguments, null, "left");
+}
+dojo.html.getScrollOffset = function(){
+ return dojo.html._callDeprecated("getScrollOffset", "getScroll", arguments, null, "offset");
+}
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/display.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/display.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/display.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/display.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,196 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.html.display");
+dojo.require("dojo.html.style");
+
+dojo.html._toggle = function(node, tester, setter){
+ node = dojo.byId(node);
+ setter(node, !tester(node));
+ return tester(node);
+}
+
+dojo.html.show = function(/* HTMLElement */node){
+ // summary
+ // Show the passed element by reverting display property set by dojo.html.hide
+ node = dojo.byId(node);
+ if(dojo.html.getStyleProperty(node, 'display')=='none'){
+ dojo.html.setStyle(node, 'display', (node.dojoDisplayCache||''));
+ node.dojoDisplayCache = undefined; // cannot use delete on a node in IE6
+ }
+}
+
+dojo.html.hide = function(/* HTMLElement */node){
+ // summary
+ // Hide the passed element by setting display:none
+ node = dojo.byId(node);
+ if(typeof node["dojoDisplayCache"] == "undefined"){ // it could == '', so we cannot say !node.dojoDisplayCount
+ var d = dojo.html.getStyleProperty(node, 'display')
+ if(d!='none'){
+ node.dojoDisplayCache = d;
+ }
+ }
+ dojo.html.setStyle(node, 'display', 'none');
+}
+
+dojo.html.setShowing = function(/* HTMLElement */node, /* boolean? */showing){
+ // summary
+ // Calls show() if showing is true, hide() otherwise
+ dojo.html[(showing ? 'show' : 'hide')](node);
+}
+
+dojo.html.isShowing = function(/* HTMLElement */node){
+ // summary
+ // Returns whether the element is displayed or not.
+ // FIXME: returns true if node is bad, isHidden would be easier to make correct
+ return (dojo.html.getStyleProperty(node, 'display') != 'none'); // boolean
+}
+
+dojo.html.toggleShowing = function(/* HTMLElement */node){
+ // summary
+ // Call setShowing() on node with the complement of isShowing(), then return the new value of isShowing()
+ return dojo.html._toggle(node, dojo.html.isShowing, dojo.html.setShowing); // boolean
+}
+
+// Simple mapping of tag names to display values
+// FIXME: simplistic
+dojo.html.displayMap = { tr: '', td: '', th: '', img: 'inline', span: 'inline', input: 'inline', button: 'inline' };
+
+dojo.html.suggestDisplayByTagName = function(/* HTMLElement */node){
+ // summary
+ // Suggest a value for the display property that will show 'node' based on it's tag
+ node = dojo.byId(node);
+ if(node && node.tagName){
+ var tag = node.tagName.toLowerCase();
+ return (tag in dojo.html.displayMap ? dojo.html.displayMap[tag] : 'block'); // string
+ }
+}
+
+dojo.html.setDisplay = function(/* HTMLElement */node, /* string */display){
+ // summary
+ // Sets the value of style.display to value of 'display' parameter if it is a string.
+ // Otherwise, if 'display' is false, set style.display to 'none'.
+ // Finally, set 'display' to a suggested display value based on the node's tag
+ dojo.html.setStyle(node, 'display', ((display instanceof String || typeof display == "string") ? display : (display ? dojo.html.suggestDisplayByTagName(node) : 'none')));
+}
+
+dojo.html.isDisplayed = function(/* HTMLElement */node){
+ // summary
+ // Is true if the the computed display style for node is not 'none'
+ // FIXME: returns true if node is bad, isNotDisplayed would be easier to make correct
+ return (dojo.html.getComputedStyle(node, 'display') != 'none'); // boolean
+}
+
+dojo.html.toggleDisplay = function(/* HTMLElement */node){
+ // summary
+ // Call setDisplay() on node with the complement of isDisplayed(), then
+ // return the new value of isDisplayed()
+ return dojo.html._toggle(node, dojo.html.isDisplayed, dojo.html.setDisplay); // boolean
+}
+
+dojo.html.setVisibility = function(/* HTMLElement */node, /* string */visibility){
+ // summary
+ // Sets the value of style.visibility to value of 'visibility' parameter if it is a string.
+ // Otherwise, if 'visibility' is false, set style.visibility to 'hidden'. Finally, set style.visibility to 'visible'.
+ dojo.html.setStyle(node, 'visibility', ((visibility instanceof String || typeof visibility == "string") ? visibility : (visibility ? 'visible' : 'hidden')));
+}
+
+dojo.html.isVisible = function(/* HTMLElement */node){
+ // summary
+ // Returns true if the the computed visibility style for node is not 'hidden'
+ // FIXME: returns true if node is bad, isInvisible would be easier to make correct
+ return (dojo.html.getComputedStyle(node, 'visibility') != 'hidden'); // boolean
+}
+
+dojo.html.toggleVisibility = function(node){
+ // summary
+ // Call setVisibility() on node with the complement of isVisible(), then return the new value of isVisible()
+ return dojo.html._toggle(node, dojo.html.isVisible, dojo.html.setVisibility); // boolean
+}
+
+dojo.html.setOpacity = function(/* HTMLElement */node, /* float */opacity, /* boolean? */dontFixOpacity){
+ // summary
+ // Sets the opacity of node in a cross-browser way.
+ // float between 0.0 (transparent) and 1.0 (opaque)
+ node = dojo.byId(node);
+ var h = dojo.render.html;
+ if(!dontFixOpacity){
+ if( opacity >= 1.0){
+ if(h.ie){
+ dojo.html.clearOpacity(node);
+ return;
+ }else{
+ opacity = 0.999999;
+ }
+ }else if( opacity < 0.0){ opacity = 0; }
+ }
+ if(h.ie){
+ if(node.nodeName.toLowerCase() == "tr"){
+ // FIXME: is this too naive? will we get more than we want?
+ var tds = node.getElementsByTagName("td");
+ for(var x=0; x<tds.length; x++){
+ tds[x].style.filter = "Alpha(Opacity="+opacity*100+")";
+ }
+ }
+ node.style.filter = "Alpha(Opacity="+opacity*100+")";
+ }else if(h.moz){
+ node.style.opacity = opacity; // ffox 1.0 directly supports "opacity"
+ node.style.MozOpacity = opacity;
+ }else if(h.safari){
+ node.style.opacity = opacity; // 1.3 directly supports "opacity"
+ node.style.KhtmlOpacity = opacity;
+ }else{
+ node.style.opacity = opacity;
+ }
+}
+
+dojo.html.clearOpacity = function(/* HTMLElement */node){
+ // summary
+ // Clears any opacity setting on the passed element.
+ node = dojo.byId(node);
+ var ns = node.style;
+ var h = dojo.render.html;
+ if(h.ie){
+ try {
+ if( node.filters && node.filters.alpha ){
+ ns.filter = ""; // FIXME: may get rid of other filter effects
+ }
+ } catch(e) {
+ /*
+ * IE7 gives error if node.filters not set;
+ * don't know why or how to workaround (other than this)
+ */
+ }
+ }else if(h.moz){
+ ns.opacity = 1;
+ ns.MozOpacity = 1;
+ }else if(h.safari){
+ ns.opacity = 1;
+ ns.KhtmlOpacity = 1;
+ }else{
+ ns.opacity = 1;
+ }
+}
+
+dojo.html.getOpacity = function(/* HTMLElement */node){
+ // summary
+ // Returns the opacity of the passed element
+ node = dojo.byId(node);
+ var h = dojo.render.html;
+ if(h.ie){
+ var opac = (node.filters && node.filters.alpha &&
+ typeof node.filters.alpha.opacity == "number"
+ ? node.filters.alpha.opacity : 100) / 100;
+ }else{
+ var opac = node.style.opacity || node.style.MozOpacity ||
+ node.style.KhtmlOpacity || 1;
+ }
+ return opac >= 0.999999 ? 1.0 : Number(opac); // float
+}
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/iframe.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/iframe.js?view=auto&rev=495409
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/iframe.js (added)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/iframe.js Thu Jan 11 14:35:53 2007
@@ -0,0 +1,128 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.html.iframe");
+dojo.require("dojo.html.util");
+
+// thanks burstlib!
+dojo.html.iframeContentWindow = function(/* HTMLIFrameElement */iframe_el) {
+ // summary
+ // returns the window reference of the passed iframe
+ var win = dojo.html.getDocumentWindow(dojo.html.iframeContentDocument(iframe_el)) ||
+ // Moz. TODO: is this available when defaultView isn't?
+ dojo.html.iframeContentDocument(iframe_el).__parent__ ||
+ (iframe_el.name && document.frames[iframe_el.name]) || null;
+ return win; // Window
+}
+
+dojo.html.iframeContentDocument = function(/* HTMLIFrameElement */iframe_el){
+ // summary
+ // returns a reference to the document object inside iframe_el
+ var doc = iframe_el.contentDocument // W3
+ || ((iframe_el.contentWindow)&&(iframe_el.contentWindow.document)) // IE
+ || ((iframe_el.name)&&(document.frames[iframe_el.name])&&(document.frames[iframe_el.name].document))
+ || null;
+ return doc; // HTMLDocument
+}
+
+dojo.html.BackgroundIframe = function(/* HTMLElement */node) {
+ // summary
+ // For IE z-index schenanigans
+ // Two possible uses:
+ // 1. new dojo.html.BackgroundIframe(node)
+ // Makes a background iframe as a child of node, that fills area (and position) of node
+ // 2. new dojo.html.BackgroundIframe()
+ // Attaches frame to dojo.body(). User must call size() to set size.
+ if(dojo.render.html.ie55 || dojo.render.html.ie60) {
+ var html="<iframe src='javascript:false'"
+ + " style='position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;"
+ + "z-index: -1; filter:Alpha(Opacity=\"0\");' "
+ + ">";
+ this.iframe = dojo.doc().createElement(html);
+ this.iframe.tabIndex = -1; // Magic to prevent iframe from getting focus on tab keypress - as style didnt work.
+ if(node){
+ node.appendChild(this.iframe);
+ this.domNode=node;
+ }else{
+ dojo.body().appendChild(this.iframe);
+ this.iframe.style.display="none";
+ }
+ }
+}
+dojo.lang.extend(dojo.html.BackgroundIframe, {
+ iframe: null,
+ onResized: function(){
+ // summary
+ // Resize event handler.
+ // TODO: this function shouldn't be necessary but setting width=height=100% doesn't work!
+ if(this.iframe && this.domNode && this.domNode.parentNode){ // No parentElement if onResized() timeout event occurs on a removed domnode
+ var outer = dojo.html.getMarginBox(this.domNode);
+ if (outer.width == 0 || outer.height == 0 ){
+ dojo.lang.setTimeout(this, this.onResized, 100);
+ return;
+ }
+ this.iframe.style.width = outer.width + "px";
+ this.iframe.style.height = outer.height + "px";
+ }
+ },
+
+ size: function(/* HTMLElement */node) {
+ // summary:
+ // Call this function if the iframe is connected to dojo.body()
+ // rather than the node being shadowed
+
+ // (TODO: erase)
+ if(!this.iframe){ return; }
+ var coords = dojo.html.toCoordinateObject(node, true, dojo.html.boxSizing.BORDER_BOX);
+ with(this.iframe.style){
+ width = coords.width + "px";
+ height = coords.height + "px";
+ left = coords.left + "px";
+ top = coords.top + "px";
+ }
+ },
+
+ setZIndex: function(/* HTMLElement */node){
+ // summary
+ // Sets the z-index of the background iframe.
+ if(!this.iframe){ return; }
+ if(dojo.dom.isNode(node)){
+ this.iframe.style.zIndex = dojo.html.getStyle(node, "z-index") - 1;
+ }else if(!isNaN(node)){
+ this.iframe.style.zIndex = node;
+ }
+ },
+
+ show: function(){
+ // summary:
+ // show the iframe
+ if(this.iframe){
+ this.iframe.style.display = "block";
+ }
+ },
+
+ hide: function(){
+ // summary:
+ // hide the iframe
+ if(this.iframe){
+ this.iframe.style.display = "none";
+ }
+ },
+
+ remove: function(){
+ // summary:
+ // remove the iframe
+ if(this.iframe){
+ dojo.html.removeNode(this.iframe, true);
+ delete this.iframe;
+ this.iframe=null;
+ }
+ }
+});
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowB.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowB.png?view=auto&rev=495409
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowB.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowBL.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowBL.png?view=auto&rev=495409
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowBL.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowBR.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowBR.png?view=auto&rev=495409
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowBR.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowL.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowL.png?view=auto&rev=495409
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowL.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowR.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowR.png?view=auto&rev=495409
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowR.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowT.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowT.png?view=auto&rev=495409
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowT.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowTL.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowTL.png?view=auto&rev=495409
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowTL.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowTR.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowTR.png?view=auto&rev=495409
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/html/images/shadowTR.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream