--- /dev/null
+/*******************************************************************************\r
+ * OpenAjax.js / OpenAjaxBootstrap.js:\r
+ *\r
+ * Component of the OpenAjax Hub, as specified by OpenAjax Alliance.\r
+ * Specification is under development at: \r
+ *\r
+ * http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification\r
+ *\r
+ * In the current implementation, the OpenAjax.js file is created by simply \r
+ * concatenating the individual component JavaScript files in a particular order, with\r
+ * where this file must be the first one in the list.\r
+ *\r
+ * Copyright 2006-2007 OpenAjax Alliance\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not \r
+ * use this file except in compliance with the License. You may obtain a copy \r
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless \r
+ * required by applicable law or agreed to in writing, software distributed \r
+ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR \r
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the \r
+ * specific language governing permissions and limitations under the License.\r
+ *\r
+ ******************************************************************************/\r
+\r
+/*\r
+ * OpenAjax Hub configuration parameters.\r
+ * These configuration parameters are meant for use by the application developer,\r
+ * not the Ajax runtime library developer. \r
+ *\r
+ * The following is a quick summary of available parameters.\r
+ * Refer to the OpenAjax Hub Specification for the official and detailed definition of these features.\r
+ *\r
+ * bootstrapFile = string \r
+ * Holds name of JavaScript file that initializes OpenAjax object and includes definition of\r
+ * OpenAjax.require() function for dynamic module loading.\r
+ * idsToScan = array of strings (Default is [])\r
+ * Provides to the OpenAjax Hub a list of element IDs upon which to invoke the\r
+ * markup scanner.\r
+ * scanPage = boolean (Default is true)\r
+ * Tells the OpenAjax Hub whether to auto-invoke its markup scanner \r
+ * on the BODY element in the document.\r
+ */\r
+if (typeof OpenAjaxConfig == "undefined") {\r
+ OpenAjaxConfig = {};\r
+}\r
+\r
+/*\r
+ * Only create an OpenAjax object if it doesn't exist already.\r
+ * (If it already exists, then assume the prior instance provides the services that are needed.\r
+ * Also, attempts to initialize a second time probably will clobber key data from existing OpenAjax object.)\r
+ */\r
+if (typeof OpenAjax == "undefined") {\r
+\r
+ OpenAjax = {\r
+\r
+ implementer: "http://openajax.org",\r
+ implVersion: "0.3",\r
+ specVersion: "0.3",\r
+ implExtraData: {},\r
+ _allModules: {"Libraries":1,"LoadUnload":1,"Globals":1,"PublishSubscribe":1,"MarkupScanner":1},\r
+ loadDone: false,\r
+ unloadDone: false,\r
+\r
+\r
+ // Public function. If module has not been loaded already, load it now.\r
+ require: function(modules) {\r
+ var head = document.head;\r
+ if (!head) {\r
+ // Overcome bug in Mozilla when XSLT generates the HTML document.\r
+ head = document.getElementsByTagName("head").item(0);\r
+ }\r
+ if (!head) {\r
+ return;\r
+ }\r
+ var reqmods = modules.split(",");\r
+ var allmods = OpenAjax._allModules;\r
+ for (var i=0; i<reqmods.length; i++) {\r
+ var module = reqmods[i];\r
+ if (!allmods[module]) {\r
+ break;\r
+ }\r
+ if (OpenAjax["__module"+module]){\r
+ break;\r
+ }\r
+ var fname=OpenAjax._path+module+".js";\r
+ var se = document.createElement("script");\r
+ se.setAttribute("type", "text/javascript");\r
+ se.setAttribute("src", fname);\r
+ head.appendChild(se);\r
+ }\r
+ }\r
+ };\r
+\r
+\r
+ // Find path to bootstrap file (for case where bootstrapping approach is used).\r
+ // Note: can't get script tags via document.getElementsByTagName("script") due to Mozilla bug.\r
+ // Instead, have to loop through children of HEAD looking for SCRIPT elements.\r
+ var head = document.getElementsByTagName("head").item(0);\r
+ var children = head.childNodes;\r
+ var re = new RegExp((OpenAjaxConfig.bootstrapFile || "OpenAjaxBootstrap.js")+".*$");\r
+ for (var i=0; i < children.length; i++) {\r
+ var s = children[i];\r
+ if (s.nodeType != 1 || s.nodeName != "SCRIPT") {\r
+ continue;\r
+ }\r
+ if (s.src && s.src.match(re)) {\r
+ // FIXME: We need automated tests for all of this bootstrapping logic.\r
+ // FIXME: load= has yet to be tested. May not work at all.\r
+ OpenAjax._path = s.src.replace(re,'');\r
+ var requiredModules = s.src.match(/\?.*load=([A-Za-z,]*)/);\r
+ if (requiredModules) {\r
+ OpenAjax.require(requiredModules);\r
+ } else {\r
+ // Note: We do not load all modules by default.\r
+ OpenAjax.require("Libraries,LoadUnload,Globals,PublishSubscribe,MarkupScanner");\r
+ }\r
+ break;\r
+ }\r
+ }\r
+\r
+}\r
+\r
+/* For single-file distribution of entire Hub, the other OpenAjax Hub JavaScript files \r
+ should be concatenated after this comment into file OpenAjax.js. */\r
+\r
+/*******************************************************************************\r
+ * Libraries.js:\r
+ *\r
+ * A component of the OpenAjax Hub, as specified by OpenAjax Alliance.\r
+ * Specification is under development at: \r
+ *\r
+ * http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification\r
+ *\r
+ * This file manages the Ajax libraries that register themselves with\r
+ * the OpenAjax Hub via the OpenAjax.registerLibrary() method.\r
+ *\r
+ * The logic from OpenAjaxBootstrap.js must have been loaded before this file.\r
+ *\r
+ * Copyright 2006-2007 OpenAjax Alliance\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not \r
+ * use this file except in compliance with the License. You may obtain a copy \r
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless \r
+ * required by applicable law or agreed to in writing, software distributed \r
+ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR \r
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the \r
+ * specific language governing permissions and limitations under the License.\r
+ *\r
+ ******************************************************************************/\r
+\r
+ OpenAjax.__moduleLibraries = 1;\r
+\r
+ // holds the libraries that have been registered so far.\r
+ OpenAjax.libraries = {};\r
+\r
+ /*\r
+ * Registers an Ajax library with the OpenAjax Hub.\r
+ */\r
+ OpenAjax.registerLibrary = function (\r
+ prefix, // Unique library ID string, suitable as prefix in xmlns declaration\r
+ namespaceURI, // Namespace URI string suitable for use with xmlns attribute\r
+ version, // Library version in the form of #[.#]*, such as "1", "1.1" or "1.20.2".\r
+ extraData){ // Optional, can be null. Arbitrary Object holding extra info about library.\r
+ if (this.libraries[prefix]) {\r
+ throw new Error("Repeat attempt to register library: " + prefix);\r
+ }\r
+ this.libraries[prefix] = {\r
+ prefix: prefix,\r
+ namespaceURI: namespaceURI,\r
+ version: version,\r
+ extraData: extraData\r
+ };\r
+ };\r
+\r
+ /*\r
+ * Unregisters an Ajax library with the OpenAjax Hub.\r
+ */\r
+\r
+ OpenAjax.unregisterLibrary = function(\r
+ prefix ){ // Library prefix that was passed to registerLibrary().\r
+\r
+ // Remove references to any globals registered to this library.\r
+ // (See Globals.js)\r
+ if (this.globals) {\r
+ delete this.globals[prefix];\r
+ }\r
+\r
+ // Remove registration for this library.\r
+ delete this.libraries[prefix];\r
+ };\r
+\r
+ // Register the OpenAjax Hub itself as a library.\r
+ OpenAjax.registerLibrary("OpenAjax", "http://openajax.org/hub", "0.3", {});\r
+/*******************************************************************************\r
+ * LoadUnload.js:\r
+ *\r
+ * A component of the OpenAjax Hub, as specified by OpenAjax Alliance.\r
+ * Specification is under development at: \r
+ *\r
+ * http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification\r
+ *\r
+ * This file manages load and unload event handlers on the BODY element.\r
+ *\r
+ * The logic from OpenAjaxBootstrap.js must have been loaded before this file.\r
+ *\r
+ * Copyright 2006-2007 OpenAjax Alliance\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not \r
+ * use this file except in compliance with the License. You may obtain a copy \r
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless \r
+ * required by applicable law or agreed to in writing, software distributed \r
+ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR \r
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the \r
+ * specific language governing permissions and limitations under the License.\r
+ *\r
+ ******************************************************************************/\r
+\r
+ OpenAjax.__moduleLoadUnload = 1;\r
+\r
+ OpenAjax._callbacks = {load: {}, unload: {}};\r
+\r
+(function(){\r
+ var addCallback = function( \r
+ eventName, // load or unload\r
+ funcOrName, // callback function or string that holds name of function\r
+ scope, // object, default is window\r
+ phase) { // "library", "component", or "application", default is "application"\r
+ if(typeof funcOrName == "string"){\r
+ // get a function object\r
+ scope = scope || window;\r
+ funcOrName = scope[funcOrName];\r
+ }\r
+ phase = phase || "application";\r
+ var cb = OpenAjax._callbacks[eventName];\r
+ (cb[phase]=cb[phase]||[]).push(funcOrName);\r
+ };\r
+\r
+ /*\r
+ * Registers an event handler non-destructively to be fired\r
+ * when the window's onload handler is executed\r
+ */\r
+ OpenAjax.addOnLoad = function( \r
+ funcOrName, // callback function or string that holds name of function\r
+ scope, // object, defaults is window\r
+ phase){ // "library", "component", or "application", default is "application"\r
+\r
+ addCallback("load", funcOrName, scope, phase);\r
+ };\r
+\r
+ /*\r
+ * Registers an event handler non-destructively to be fired\r
+ * when the window's onunload handler is executed\r
+ */\r
+ OpenAjax.addOnUnload = function(\r
+ funcOrName, // callback function or string that holds name of function\r
+ scope, // object, defaults is window\r
+ phase){ // "library", "component", or "application", default is "application"\r
+\r
+ addCallback("unload", funcOrName, scope, phase);\r
+ };\r
+})();\r
+\r
+(function(){\r
+ var invokeCallbacks = function(phase, eventName) {\r
+ var arr = OpenAjax._callbacks[eventName][phase]||[];\r
+ for (var i=0; i < arr.length; i++) {\r
+ arr[i].call();\r
+ }\r
+ // Callbacks have been called, so clear array.\r
+ OpenAjax._callbacks[eventName][phase] = [];\r
+ };\r
+\r
+ /*\r
+ * This is the OpenAjax onload event handler that the OpenAjax library\r
+ * registers on the BODY element.\r
+ */\r
+ OpenAjax.OnLoadHandler = function() {\r
+ // Invoke registered load event handlers for "library" phase.\r
+ invokeCallbacks("library", "load");\r
+ // Invoke registered load event handlers for "component" phase.\r
+ invokeCallbacks("component", "load");\r
+\r
+ // Invoke markup scanner if markup scanner module is loaded.\r
+ // FIXME: Need to add a test for this check.\r
+ if (OpenAjax.__moduleMarkupScanner) {\r
+ OpenAjax.scanDocument();\r
+ }\r
+\r
+ // Invoke registered load event handlers for "application" phase.\r
+ invokeCallbacks("application", "load");\r
+\r
+ // Set flag indicating that OpenAjax load handling is done.\r
+ // FIXME: Need to add a test for this.\r
+ OpenAjax.loadDone = true;\r
+ };\r
+\r
+\r
+ /*\r
+ * This is the OpenAjax onunload event handler that the OpenAjax library\r
+ * registers on the BODY element.\r
+ */\r
+ OpenAjax.OnUnloadHandler = function() {\r
+ // Invoke registered unload event handlers for "application" phase.\r
+ invokeCallbacks("application", "unload");\r
+\r
+ // Invoke registered unload event handlers for "component" phase.\r
+ invokeCallbacks("component", "unload");\r
+\r
+ // Invoke registered unload event handlers for "library" phase.\r
+ invokeCallbacks("library", "unload");\r
+\r
+ // Set flag indicating that OpenAjax unload handling is done.\r
+ // FIXME: Need to add a test for this.\r
+ OpenAjax.unloadDone = true;\r
+ };\r
+})();\r
+\r
+(function(){\r
+ /*\r
+ * Private function that attaches an event listener for a given event\r
+ * on the specified target object.\r
+ */\r
+ var addOnEvent = function(\r
+ type, // event type string\r
+ funcOrName, // callback function or string that holds name of function\r
+ scope){ // object, defaults is window\r
+\r
+ if(typeof funcOrName == "string"){\r
+ scope = scope || window;\r
+ funcOrName = scope[funcOrName];\r
+ }\r
+ var enclosedFunc = function(){ return funcOrName.apply(scope, arguments); };\r
+\r
+ if(window["attachEvent"]){\r
+ window.attachEvent("on"+type, enclosedFunc);\r
+ } else if(window["addEventListener"]){\r
+ window.addEventListener(type, enclosedFunc, false);\r
+ } else if(document["addEventListener"]){\r
+ document.addEventListener(type, enclosedFunc, false);\r
+ }\r
+ };\r
+\r
+ /*\r
+ * Register the OpenAjax load and unload event handlers on the BODY element.\r
+ */\r
+ addOnEvent("load", OpenAjax.OnLoadHandler);\r
+ addOnEvent("unload", OpenAjax.OnUnloadHandler);\r
+})();\r
+/*******************************************************************************\r
+ * Globals.js:\r
+ *\r
+ * A component of the OpenAjax Hub, as specified by OpenAjax Alliance.\r
+ * Specification is under development at: \r
+ *\r
+ * http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification\r
+ *\r
+ * This file manages the global objects that are added to the JavaScript\r
+ * runtime environment by the Ajax libraries.\r
+ *\r
+ * Includes function OpenAjax.globalsCollisionCheck(globals, prefix), \r
+ * which determines whether the list of global objects in array 'globals'\r
+ * collides with any of the global objects used by currently\r
+ * registered Ajax libraries.\r
+ *\r
+ * The logic from OpenAjaxBootstrap.js must have been loaded before this file.\r
+ *\r
+ * Copyright 2006-2007 OpenAjax Alliance\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not \r
+ * use this file except in compliance with the License. You may obtain a copy \r
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless \r
+ * required by applicable law or agreed to in writing, software distributed \r
+ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR \r
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the \r
+ * specific language governing permissions and limitations under the License.\r
+ *\r
+ ******************************************************************************/\r
+\r
+ OpenAjax.__moduleGlobals = 1;\r
+\r
+ // Hash mapping libraries registered so far to a list of their global object names\r
+ OpenAjax.globals = {};\r
+\r
+ /*\r
+ * Identifies the global objects that the given Ajax library is adding to\r
+ * the JavaScript runtime environment. If any collisions are found,\r
+ * a runtime error will be raised.\r
+ */\r
+ OpenAjax.registerGlobals = function (\r
+ prefix, // Library prefix that was passed to registerLibrary().\r
+ globals){ // An array of strings that identify the globals added \r
+ // to the JavaScript runtime environment by this library.\r
+\r
+ // Check the list of globals against the previously registered globals.\r
+ var err = this.globalsCollisionCheck(globals, prefix);\r
+ if (err) {\r
+ throw new Error(err);\r
+ }\r
+\r
+ // Everything is OK, so register the globals for this library.\r
+ this.globals[prefix] = globals;\r
+ };\r
+\r
+\r
+ /*\r
+ * Determines whether the list of global objects in array 'candidates'\r
+ * collides with any of the global objects that have been listed by currently\r
+ * registered Ajax libraries.\r
+ */\r
+ //FIXME: Would be better if this returned an array of collisions, where the array was machine-parsable.\r
+ OpenAjax.globalsCollisionCheck = function (\r
+ candidates, // An array of strings that identify the globals against which we want to check\r
+ prefix){ // If provided, then don't compare 'globals' against globals registered by 'prefix'.\r
+ var err = null;\r
+\r
+ // see if there are collisions\r
+ for (var registered in this.globals) {\r
+ // do not check the list of globals for 'prefix'.\r
+ if (registered != prefix) {\r
+ var names = this.globals[registered];\r
+ for (var x=0; x<candidates.length; x++) {\r
+ candidate_global = candidates[x];\r
+ for (var y=0; y<names.length; y++) {\r
+ if (candidate_global == names[y]) {\r
+ err = "Global object collision for object '"+candidate_global+"'. "+\r
+ "Previously registered by library '"+registered+"'.";\r
+ if (prefix) {\r
+ err += " Library attempting to register this global: '"+prefix+"'.";\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ if (err) {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ if (err) {\r
+ break;\r
+ }\r
+ }\r
+ return err;\r
+ }\r
+\r
+\r
+\r
+ // Register the OpenAjax Hub's globals\r
+ OpenAjax.registerGlobals("OpenAjax", ["OpenAjax","OpenAjaxConfig"]);\r
+/*******************************************************************************\r
+ * PublishSubscribe.js:\r
+ *\r
+ * A component of the OpenAjax Hub, as specified by OpenAjax Alliance.\r
+ * Specification is under development at: \r
+ *\r
+ * http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification\r
+ *\r
+ * This file provides a publish/subscribe mechanism such that Ajax libraries\r
+ * can communication with each other. An Ajax library can publish events\r
+ * to which other Ajax libraries can subscribe.\r
+ *\r
+ * The logic from OpenAjaxBootstrap.js must have been loaded before this file.\r
+ *\r
+ * Copyright 2006-2007 OpenAjax Alliance\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not \r
+ * use this file except in compliance with the License. You may obtain a copy \r
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless \r
+ * required by applicable law or agreed to in writing, software distributed \r
+ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR \r
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the \r
+ * specific language governing permissions and limitations under the License.\r
+ *\r
+ ******************************************************************************/\r
+\r
+/* FIXME\r
+add unsubcribe method\r
+*/\r
+\r
+ OpenAjax.__modulePublishSubscribe = 1;\r
+\r
+ // Private variable, holds the listeners that Ajax libraries have registered.\r
+ OpenAjax._listeners = { "*": { "*": [] } };\r
+\r
+ /*\r
+ * Allows registration of interest in named events based on\r
+ * toolkit-specific prefix and event name. Global event\r
+ * matching is provided by passing "*" in the prefix and/or\r
+ * name arguments. Optional arguments may be specified for\r
+ * executing the specified handler function in a provided\r
+ * scope and for further filtering events prior to application\r
+ */\r
+ OpenAjax.subscribe = function (\r
+ prefix, // Library prefix that was passed to registerLibrary().string, or null, or "*" to match all.\r
+ name, // Event name. Can be "*" to match all.\r
+ refOrName, // callback function or string that holds name of function\r
+ scope, // object, default is window\r
+ subscriberData, // arbitrary object, can be null\r
+ filter){ // function\r
+\r
+ // NOTE: the following code is written in a verbose style for the\r
+ // sake of readability. Non-reference implementations should use a\r
+ // terser variant.\r
+\r
+ if (prefix == null || prefix == "") {\r
+ prefix = "__null__";\r
+ }\r
+\r
+ if(!this._listeners[prefix]){\r
+ this._listeners[prefix] = { "*": [] };\r
+ }\r
+\r
+ if(!this._listeners[prefix][name]){\r
+ this._listeners[prefix][name] = [];\r
+ }\r
+\r
+ if (typeof subscriberData == 'undefined') {\r
+ subscriberData = null;\r
+ }\r
+\r
+ if(!scope){\r
+ scope = window;\r
+ }\r
+\r
+ if(typeof refOrName == "string"){\r
+ // get a function object\r
+ refOrName = scope[refOrName];\r
+ }\r
+\r
+ this._listeners[prefix][name].push({\r
+ "func": refOrName, \r
+ "data": subscriberData,\r
+ "scope": scope, \r
+ "filter": filter\r
+ });\r
+ }\r
+\r
+\r
+ /*\r
+ * Publish events based on toolkit-specific prefix and event name.\r
+ */\r
+ OpenAjax.publish = function (\r
+ prefix, // Library prefix that was passed to registerLibrary().string, or null.\r
+ name, // Event name.\r
+ publisherData){ // arbitrary object, can be null\r
+\r
+ // NOTE: the following code is written in a verbose style for the\r
+ // sake of readability. Non-reference implementations should use a\r
+ // terser variant.\r
+\r
+ if (prefix == null || prefix == "") {\r
+ prefix = "__null__";\r
+ }\r
+ if (typeof publisherData == 'undefined') {\r
+ publisherData = null;\r
+ }\r
+\r
+ var globals = this._listeners["*"]["*"];\r
+\r
+ var handlers = [];\r
+\r
+ // aggregate the various handler sets to form a single list of handlers\r
+ if(this._listeners[prefix]){\r
+\r
+ if(this._listeners[prefix][name]){\r
+ handlers = handlers.concat( this._listeners[prefix][name] );\r
+ }\r
+\r
+ if(this._listeners[prefix]["*"]){\r
+ handlers = handlers.concat( this._listeners[prefix]["*"] );\r
+ }\r
+\r
+ }else{\r
+ handlers = globals;\r
+ }\r
+\r
+ if(this._listeners["*"][name]){\r
+ handlers = handlers.concat( this._listeners["*"][name] );\r
+ }\r
+\r
+ if(handlers.length == 0){\r
+ // avoid iterations if we aren't going to call any listeners anyway\r
+ return false;\r
+ }\r
+\r
+ for(var x=0; x<handlers.length; x++){\r
+\r
+ var argsArr = [prefix, name, handlers[x].data, publisherData];\r
+ if(typeof handlers[x].filter == "function"){\r
+ if( !handlers[x].filter.apply(window, argsArr) ){ continue; }\r
+ }\r
+\r
+ handlers[x].func.apply(handlers[x].scope, argsArr);\r
+\r
+ }\r
+ return true;\r
+ }/*******************************************************************************\r
+ * MarkupScanner.js:\r
+ *\r
+ * A component of the OpenAjax Hub, as specified by OpenAjax Alliance.\r
+ * Specification is under development at: \r
+ *\r
+ * http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification\r
+ *\r
+ * This file manages the process of dispatching particular elements within\r
+ * the document to particular Ajax runtime libraries in order to\r
+ * perform that library's DOM transformation on the subtree headed by\r
+ * that particular element.\r
+ *\r
+ * An Ajax library registers callbacks which are invoked either\r
+ * before, during, or after a top-down analysis of the document DOM.\r
+ *\r
+ * The logic from OpenAjaxBootstrap.js must have been loaded before this file.\r
+ *\r
+ * Copyright 2006-2007 OpenAjax Alliance\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not \r
+ * use this file except in compliance with the License. You may obtain a copy \r
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless \r
+ * required by applicable law or agreed to in writing, software distributed \r
+ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR \r
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the \r
+ * specific language governing permissions and limitations under the License.\r
+ *\r
+ ******************************************************************************/\r
+\r
+ OpenAjax.__moduleMarkupScanner = 1;\r
+\r
+ /* -------------- PRIVATE VARIABLES AND FUNCTIONS -------------------- */\r
+\r
+ // Private variables, holds the markup scanner callbacks to invoke in response\r
+ // to various built-in scanning features.\r
+ // The value of each is an array of objects, where each object\r
+ // holds the parameters from the corresponding register function.\r
+ OpenAjax._TagNameCBs = []; // Examine element's tagname, possibly prefixed\r
+ OpenAjax._AttrNameCBs = []; // Look for a particular attribute, possibly prefixed\r
+\r
+ // Private variable, holds the custom markup scanner callbacks that have been registered so far.\r
+ // The value of each entry is a function pointer to the registered markup scanner callback.\r
+ OpenAjax._CustomScannerCBs = { };\r
+\r
+ /*\r
+ * Utility routines used by the public functions listed further down in the file.\r
+ */\r
+\r
+ /* Add a given callback function that the appropriate private array. */\r
+ OpenAjax._regScanCB = function (\r
+ functionName, // Public function name for error messages\r
+ arrayToAdjust, // The array to which this registration will be added.\r
+ prefix, // The prefix that corresponds to this library.\r
+ nodeName, // For attributes: attr name. For elements: tag name. Can have namespace prefix.\r
+ checkType, // "match"=must match entire string, "match-start"=must match initial characters\r
+ // For attribute matching, additional options are available for space-separated\r
+ // value lists, such as 'class' attribute:\r
+ // "token"=must match entire token, "token-start"=must mast initial characters\r
+ // For element matching, additional options are available.\r
+ // "match-namespace"=matches given namespace URI, "match-prefix"=matches given prefix.\r
+ checkString, // string to check\r
+ refOrName, // function or string that will be called with the HTML subtree root element\r
+ scope){ // object, default is window\r
+\r
+ var nsuri;\r
+ if(!scope){\r
+ scope = window;\r
+ }\r
+ if(typeof refOrName == "string"){\r
+ // get a function object\r
+ refOrName = scope[refOrName];\r
+ }\r
+ if(typeof refOrName != "function"){\r
+ throw new Error("invalid function reference passed to "+functionName+"()");\r
+ }\r
+ if (nodeName) {\r
+ if(typeof nodeName != "string"){\r
+ throw new Error("nodeName is not a string in "+functionName+"()");\r
+ }\r
+ var t = nodeName.split(":");\r
+ // To save space, we assume parameters passed according to rules, so if there is at least one colon, assume there is only one.\r
+ if (t.length >= 2) {\r
+ nsuri = OpenAjax.libraries[t[0]].namespaceURI;\r
+ nodeName = t[1];\r
+ } else {\r
+ nsuri = null;\r
+ // No namespace prefix, so nodeName already has correct value.\r
+ }\r
+ }\r
+ arrayToAdjust.push({\r
+ "prefix": prefix, \r
+ "nsuri": nsuri, \r
+ "nodeName": nodeName, \r
+ "checkType": checkType,\r
+ "checkString": checkString, \r
+ "func": refOrName\r
+ });\r
+ }\r
+\r
+ /* Remove callback functions from the appropriate private array. */\r
+ OpenAjax._unregScanCB = function (\r
+ functionName, // Public function name for error messages\r
+ arrayToAdjust, // The array from which registrations will be removed.\r
+ prefix){ // The prefix that corresponds to this library.\r
+ for (var i=arrayToAdjust.length-1; i >=0 ; i--) {\r
+ if (arrayToAdjust[i].prefix == prefix) {\r
+ // Use 'slice' instead of 'splice' due to bug in IE7.\r
+ var tail = arrayToAdjust.slice(i+1);\r
+ var len = arrayToAdjust.length;\r
+ for (var p=i; p<len; p++) {\r
+ arrayToAdjust.pop();\r
+ }\r
+ arrayToAdjust = arrayToAdjust.concat(tail);\r
+ }\r
+ }\r
+ return(arrayToAdjust);\r
+ }\r
+\r
+ /* -------------- PUBLIC FUNCTIONS -------------------- */\r
+ /* -------------- BUILT-IN SCANNER CHECKS ------------- */\r
+\r
+ /*\r
+ * Registers a callback function that is invoked for element nodes in the document\r
+ * that have a particular attribute set to a particular value.\r
+ */\r
+ OpenAjax.registerAttrScanCB = function (\r
+ prefix, // The prefix that corresponds to this library.\r
+ attrName, // attribute to check\r
+ checkType, // "match"=must match entire string, "match-start"=must match initial characters\r
+ // For attributes with space-separated values,\r
+ // "token"=must match entire token, "token-start"=must mast initial characters\r
+ checkString, // value string to check\r
+ refOrName, // function or string that will be called with the HTML subtree root element\r
+ scope){ // object, default is window\r
+ if (OpenAjax._error) {\r
+ throw OpenAjax._error; // Hub is in bad state. Bail with error message.\r
+ }\r
+ if (arguments.length < 5) {\r
+ throw new Error("Insufficient number of arguments in OpenAjax.registerAttrScanCB");\r
+ }\r
+ OpenAjax._regScanCB("registerAttrScanCB", OpenAjax._AttrNameCBs,\r
+ prefix, attrName, checkType, checkString, refOrName, scope);\r
+ }\r
+\r
+ /*\r
+ * Unregisters all callback functions registered by the given library for the attribute.\r
+ */\r
+ OpenAjax.unregisterAttrScanCB = function(prefix){ \r
+ OpenAjax._AttrNameCBs = OpenAjax._unregScanCB("unregisterAttrScanCB", OpenAjax._AttrNameCBs, prefix);\r
+ }\r
+\r
+ /*\r
+ * Registers a callback function that is invoked for element nodes in the document\r
+ * that have a particular tagName (with or without NS), namespace, or prefix.\r
+ */\r
+ OpenAjax.registerTagnameScanCB = function (\r
+ prefix, // The prefix that corresponds to this library.\r
+ checkType, // "match"=must match localName exactly, along with NS or prefix if not null.\r
+ // "match-start"=must match first N chars of localName, along with NS or prefix if not null.\r
+ // "match-namespace"=must be in a given NS (requires DOM Level 2 namespaces),\r
+ // "match-prefix"=must have given prefix (with or without DOM Level 2 namespaces).\r
+ checkString, // value string to check\r
+ refOrName, // function or string that will be called with the HTML subtree root element\r
+ scope){ // object, default is window\r
+ if (OpenAjax._error) {\r
+ throw OpenAjax._error; // Hub is in bad state. Bail with error message.\r
+ }\r
+ if (arguments.length < 4) {\r
+ throw new Error("Insufficient number of arguments in OpenAjax.registerTagnameScanCB");\r
+ }\r
+ OpenAjax._regScanCB("registerTagnameScanCB", OpenAjax._TagNameCBs,\r
+ prefix, checkString, checkType, null, refOrName, scope);\r
+ }\r
+\r
+ /*\r
+ * Unregisters all callback functions registered by the given library for the attribute.\r
+ */\r
+ OpenAjax.unregisterTagnameScanCB = function(prefix){ \r
+ OpenAjax._TagNameCBs = OpenAjax._unregScanCB("unregisterTagnameScanCB", OpenAjax._TagNameCBs, prefix);\r
+ }\r
+\r
+ /* -------------- PUBLIC FUNCTIONS -------------------- */\r
+ /* -------------- CUSTOM SCANNER CHECKS ------------- */\r
+\r
+ /*\r
+ * Registers a custom callback function to invoke for element nodes in the document\r
+ * during the (top-to-bottom) document scanning process.\r
+ */\r
+ OpenAjax.registerCustomScannerCB = function (\r
+ prefix, // Library prefix that was passed to registerLibrary().\r
+ refOrName, // The callback function object reference or the name of a function to be called.\r
+ scope){ // Optional. An Object in which to execute refOrName. If null, default is window.\r
+\r
+ if (OpenAjax._error) {\r
+ throw OpenAjax._error; // Hub is in bad state. Bail with error message.\r
+ }\r
+ if (arguments.length < 2)\r
+ throw new Error("Insufficient number of arguments in OpenAjax.registerCustomScanner");\r
+ if (prefix == null)\r
+ throw new Error("prefix cannot be null in OpenAjax.registerCustomScanner()");\r
+ if (prefix == "")\r
+ throw new Error("prefix cannot be empty string in OpenAjax.registerCustomScanner()");\r
+\r
+ if(!scope){\r
+ scope = window;\r
+ }\r
+\r
+ if(typeof refOrName == "string"){\r
+ // get a function object\r
+ refOrName = scope[refOrName];\r
+ }\r
+\r
+ if(typeof refOrName != "function"){\r
+ throw new Error("invalid function reference passed to OpenAjax.registerCustomScanner()");\r
+ }\r
+\r
+ OpenAjax._CustomScannerCBs[prefix] = refOrName;\r
+ }\r
+\r
+ /*\r
+ * Unregisters a custom callback function .\r
+ */\r
+ OpenAjax.unregisterCustomScannerCB = function(\r
+ prefix){ // Library prefix that was passed to registerLibrary().\r
+\r
+ if (!OpenAjax._CustomScannerCBs[prefix]) {\r
+ throw new Error("Attempt to unregister a CustomScannerCB for '" + prefix + "' that has not been registered.");\r
+ } else { \r
+ // Remove registration for this library.\r
+ delete OpenAjax._CustomScannerCBs[prefix];\r
+ }\r
+ }\r
+\r
+ /* -------------- PUBLIC FUNCTIONS -------------------- */\r
+ /* -------------- DOCUMENT AND NODE SCANNERS ---------- */\r
+\r
+ /*\r
+ * Perform markup scanning on the document.\r
+ */\r
+ OpenAjax.scanDocument = function() {\r
+ var any = false;\r
+\r
+ if (OpenAjax._error) {\r
+ throw OpenAjax._error; // Hub is in bad state. Bail with error message.\r
+ }\r
+\r
+ // See if any attr=value scanner CBs have been registered.\r
+ if (OpenAjax._AttrNameCBs.length) { \r
+ any = true;\r
+ }\r
+\r
+ // See if any tagname scanner CBs have been registered.\r
+ if (OpenAjax._TagNameCBs.length) { \r
+ any = true;\r
+ }\r
+\r
+ // See if OpenAjax._CustomScannerCBs has any entries.\r
+ for (prefix in OpenAjax._CustomScannerCBs) {\r
+ any = true;\r
+ break;\r
+ }\r
+\r
+ if (any) {\r
+ var ids = OpenAjaxConfig.idsToScan;\r
+ if (ids && ids.length) {\r
+ for (var i = 0 ; i<ids.length; i++){\r
+ OpenAjax.scanNode(document.getElementById(ids[i]));\r
+ } \r
+ } else if (OpenAjaxConfig.scanPage !== false) {\r
+ OpenAjax.scanNode(document.body);\r
+ }\r
+ }\r
+ }\r
+\r
+ /*\r
+ * Invoke any registered markup handler callbacks on this element node.\r
+ */\r
+ OpenAjax.scanNode = function (\r
+ node , //the node to recursively process\r
+ shallowScan ){ //if true, only scan this node not any children. defaults to false=deep scan.\r
+ var returnValue;\r
+\r
+ // Ignore everything but element nodes (nodeType==1)\r
+ if (!node || node.nodeType!=1) {\r
+ return;\r
+ }\r
+ // IE has a bug where it sometimes treats close tag as an open tag.\r
+ // So, ignore any so-called elements where first character of nodeName is "/"\r
+ if (!node.nodeName || node.nodeName.charAt(0) == "/") {\r
+ return;\r
+ }\r
+ if (typeof shallowScan == 'undefined') {\r
+ shallowScan = false;\r
+ }\r
+\r
+ var stopScanChildNodes = false;\r
+ var stopScanThisNode = false;\r
+\r
+ // Check if any attribute=value callbacks have been registered.\r
+ if (!stopScanThisNode) {\r
+ if (OpenAjax._AttrNameCBs.length) {\r
+ for (var i=0; i<OpenAjax._AttrNameCBs.length; i++) {\r
+ var attrValue = null;\r
+ var cbObject = OpenAjax._AttrNameCBs[i];\r
+ var nsuri = cbObject.nsuri;\r
+ var attrName = cbObject.nodeName;\r
+ if (nsuri) {\r
+ if (node.getAttributeNS) {\r
+ attrValue = node.getAttributeNS(nsuri, attrName);\r
+ // Workaround for Safari 2.0.4, which incorrectly implements getAttributeNS\r
+ // where it matches against any old nsuri.\r
+ var tempValue = node.getAttributeNS("zzz-bogus-uri", attrName);\r
+ if (tempValue == attrValue) {\r
+ attrValue = null;\r
+ }\r
+ }\r
+ // Look for prefix:attrName for browsers that do not have namespace support\r
+ // or which choose to treat the document as HTML4 without namespace support.\r
+ if (!attrValue || attrValue == "") {\r
+ attrValue = node.getAttribute(cbObject.prefix+":"+attrName);\r
+ }\r
+ } else {\r
+ attrValue = node.getAttribute(attrName);\r
+ }\r
+ // IE has a bug where it doesn't support 'class' via getAttribute.\r
+ if (!attrValue && !nsuri && attrName == "class" && node.className) {\r
+ attrValue = node.className;\r
+ }\r
+ if (attrValue) {\r
+ returnValue = null;\r
+ var checkType = cbObject.checkType;\r
+ if (checkType == "match") {\r
+ if (attrValue.length == cbObject.checkString.length && attrValue.indexOf(cbObject.checkString) == 0) {\r
+ returnValue = cbObject.func.call(window, node);\r
+ }\r
+ } else if (checkType == "match-start") {\r
+ if (attrValue.indexOf(cbObject.checkString) == 0) {\r
+ returnValue = cbObject.func.call(window, node);\r
+ }\r
+ } else if (checkType == "token" || checkType == "token-start") {\r
+ var str_array = attrValue.split(" ");\r
+ for (var j=0; j < str_array.length; j++) {\r
+ var token = str_array[j];\r
+ if (checkType == "token") {\r
+ if (token.length == cbObject.checkString.length && token.indexOf(cbObject.checkString) == 0) {\r
+ returnValue = cbObject.func.call(window, node);\r
+ break;\r
+ }\r
+ } else if (checkType == "token-start") {\r
+ if (token.indexOf(cbObject.checkString) == 0) {\r
+ returnValue = cbObject.func.call(window, node);\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ if (returnValue) {\r
+ // If any callbacks sets stopScanChildNodes to true, then don't scan child nodes.\r
+ if (returnValue.stopScanChildNodes) {\r
+ stopScanChildNodes = true;\r
+ }\r
+ // If returnValue says to cancel all further scanning, then break out of this loop.\r
+ if (returnValue.stopScanThisNode) {\r
+ stopScanThisNode = true;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ // Check if any tagname callbacks have been registered.\r
+ if (!stopScanThisNode) {\r
+ if (OpenAjax._TagNameCBs.length) {\r
+ for (var i=0; i<OpenAjax._TagNameCBs.length; i++) {\r
+ var cbObject = OpenAjax._TagNameCBs[i];\r
+ var tagPrefix = null;\r
+ var tagNS = null;\r
+ var tagLocalName = null;\r
+ if (node.prefix && node.namespaceURI && node.localName) {\r
+ // DOM Level 2 namespaces is supported.\r
+ tagPrefix = node.prefix;\r
+ tagNS = node.namespaceURI;\r
+ tagLocalName = node.localName;\r
+ } else {\r
+ if (node.tagName) {\r
+ var tagName = node.tagName;\r
+ if (tagName.indexOf(":") != -1) {\r
+ var temp_array = tagName.split(":");\r
+ tagPrefix = temp_array[0];\r
+ tagLocalName = temp_array[1];\r
+ } else {\r
+ tagLocalName = tagName;\r
+ }\r
+ }\r
+ }\r
+ if (tagLocalName) {\r
+ returnValue = null;\r
+ var checkType = cbObject.checkType;\r
+ if (checkType == "match-namespace") {\r
+ // FIXME: Need to create test cases for namespace option.\r
+ // FIXME: May need to uppercase the namespace URIs before comparisons.\r
+ if (tagNS && tagNS == cbObject.nsuri) {\r
+ // FIXME - Need to review code associated with 3rd and 4th params on callbacks.\r
+ returnValue = cbObject.func.call(window, node);\r
+ }\r
+ } else if (checkType == "match-prefix") {\r
+ var checkPrefix = cbObject.prefix.toUpperCase();\r
+ if (tagPrefix && tagPrefix == checkPrefix) {\r
+ returnValue = cbObject.func.call(window, node);\r
+ }\r
+ } else if (checkType == "match" || checkType == "match-start") {\r
+ var checkPrefix = cbObject.prefix.toUpperCase();\r
+ var checkNS = cbObject.nsuri;\r
+ var checkLocalName = cbObject.nodeName.toUpperCase();\r
+ if ((checkType == "match" && checkLocalName == tagLocalName) ||\r
+ (checkType == "match-start" && tagLocalName.indexOf(checkLocalName) == 0)) {\r
+ if ((!tagPrefix && !tagNS) || \r
+ (tagNS && tagNS == checkNS) ||\r
+ (tagPrefix && tagPrefix == checkPrefix)) {\r
+ // FIXME - Need to review code associated with 3rd and 4th params on callbacks.\r
+ returnValue = cbObject.func.call(window, node);\r
+ }\r
+ }\r
+ }\r
+ if (returnValue) {\r
+ // If any callbacks sets stopScanChildNodes to true, then don't scan child nodes.\r
+ if (returnValue.stopScanChildNodes) {\r
+ stopScanChildNodes = true;\r
+ }\r
+ // If returnValue says to cancel all further scanning, then break out of this loop.\r
+ if (returnValue.stopScanThisNode) {\r
+ stopScanThisNode = true;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if (!stopScanThisNode) {\r
+ for (prefix in OpenAjax._CustomScannerCBs) {\r
+ returnValue = OpenAjax._CustomScannerCBs[prefix].call(window, node);\r
+ if (returnValue) {\r
+ // If any callbacks sets stopScanChildNodes to true, then don't scan child nodes.\r
+ if (returnValue.stopScanChildNodes) {\r
+ stopScanChildNodes = true;\r
+ }\r
+ // If returnValue says to cancel all further scanning, then break out of this loop.\r
+ if (returnValue.stopScanThisNode) {\r
+ stopScanThisNode = true;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ if (!shallowScan && !stopScanChildNodes) {\r
+ var childNode, i = 0, childNodes = node.childNodes;\r
+ while(childNode = childNodes[i++]){\r
+ if (childNode.nodeType!=1)\r
+ continue;\r
+ OpenAjax.scanNode(childNode);\r
+ }\r
+ }\r
+ }\r
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" \r
+ "http://www.w3.org/TR/html4/loose.dtd">\r
+<!--\r
+/*******************************************************************************\r
+ * HubTest-BasicConformance.html:\r
+ * Test case for Ajax libraries that verifies whether a given library\r
+ * supports the most basic requirements from the OpenAjax Hub Specification.\r
+ *\r
+ * To use this test case against a given Ajax library, this test case\r
+ * needs to be customized. At a minimum, you will need to replace the\r
+ * following line:\r
+ *\r
+ * <script language="JavaScript" type="text/javascript" src="SampleAjaxLibrary.js"></script>\r
+ *\r
+ * with a <script> element that loads your Ajax library instead of SampleAjaxLibrary.js.\r
+ *\r
+ * Libraries can make other modifications, but the <div> block\r
+ * with id=HubTest_BasicConformance" must be left intact.\r
+ *\r
+ * Other customization instructions are included within the comments in the\r
+ * various files.\r
+ *\r
+ * Copyright 2007 OpenAjax Alliance\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not \r
+ * use this file except in compliance with the License. You may obtain a copy \r
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless \r
+ * required by applicable law or agreed to in writing, software distributed \r
+ * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR \r
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the \r
+ * specific language governing permissions and limitations under the License.\r
+ *\r
+ ******************************************************************************/\r
+-->\r
+\r
+<!-- ****************************************************************************\r
+ The xmlns declarations are included in this test case below because they are required\r
+ by the OpenAjax Hub Specification which is forward looking to when browsers\r
+ support XML/XHTML properly. Note, however, that xmlns declarations generally have \r
+ no effect with browsers shipping at the time this test case was developed (early 2007).\r
+\r
+ The xmlns:SampleAjaxLibrary declaration should be changed such that\r
+ - "SampleAjaxLibrary" is changed to the prefix used by the given library\r
+ - "http://example.com/SampleAjaxLibrary" is changed to the namespaceURI for the library\r
+ (See documentation on OpenAjax.registerLibrary() for more about prefix and namespaceURI.)\r
+ **************************************************************************** -->\r
+\r
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ITMillToolkit40="http://itmill.com/toolkit">\r
+<head>\r
+ <!-- ****************************************************************************\r
+ THE CONTENTS OF THE FOLLOWING HEAD ELEMENTS MUST NOT BE CHANGED\r
+ (except it is OK to change the location of the referenced files). \r
+ **************************************************************************** -->\r
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
+ <title>OpenAjax Hub Basic Conformance Test: IT Mill Toolkit 4</title>\r
+ <link rel="StyleSheet" href="stylesheets/hubtest.css" type="text/css" />\r
+\r
+ <!-- ****************************************************************************\r
+ THE FOLLOWING SCRIPT ELEMENTS USUALLY NEED TO BE AT THE TOP OF THE HTML FILE.\r
+ HERE IS THE LIST OF CUSTOMIZATIONS YOU MUST OR MAY DO TO THIS SECTION:\r
+\r
+ YOU MUST CUSTOMIZE IT AS FOLLOWS.\r
+ - You must change HubTest-BasicConformance-MyPrefix from "SampleAjaxLibrary"\r
+ to the prefix used by your library.\r
+\r
+ YOU MAY CUSTOMIZE THE FOLLOWING LOGIC AS FOLLOWS.\r
+ - Your toolkit might include the OpenAjax Hub (i.e., ../../release/OpenAjax.js)\r
+ within your toolkit distribution or might put the Hub source code in a different\r
+ location than ../../release/OpenAjax.js. Therefore, it is OK to change\r
+ the 'src' attribute or remove the SCRIPT tag for OpenAjax.js entirely\r
+ (if you include the Hub within your toolkit).\r
+ (But be aware that if the Hub is part of your toolkit, you probably have to move\r
+ the SCRIPT tag for HubTest-BasicConformance.js such that it is loaded\r
+ after your toolkit because it makes calls into various OpenAjax.* functions.)\r
+\r
+ - If you are using a different implementation of the Hub than the \r
+ Alliance's reference implementation at http://openajaxallianc.sourceforge.net,\r
+ and your library register load event handlers with the Hub,\r
+ you probably need to change the logic within function HubTest_BasicConformance_Verify_Load()\r
+ to look at your implementation's private variables.\r
+ **************************************************************************** -->\r
+ <script language="JavaScript" type="text/javascript" src="OpenAjax.js"></script>\r
+\r
+ <script language="JavaScript" type="text/javascript">\r
+ var HubTest_BasicConformance_MyPrefix = "ITMillToolkit40";\r
+\r
+ function HubTest_BasicConformance_Verify_Load() {\r
+ if ((OpenAjax._callbacks.load.library && OpenAjax._callbacks.load.library.length) || \r
+ (OpenAjax._callbacks.load.component && OpenAjax._callbacks.load.component.length)) {\r
+ loadHandlerWorking = true;\r
+ }\r
+ }\r
+\r
+ // Invoke HubTest_BasicConformance_Verify_Load as the first thing that happens\r
+ // during OnLoad event processing. (Determine if callback arrays have been set properly.)\r
+ OpenAjax.addOnLoad("HubTest_BasicConformance_Verify_Load", null, "library");\r
+ </script>\r
+\r
+ <script language="JavaScript" type="text/javascript" src="HubTest-BasicConformance.js"></script>\r
+\r
+ <!-- ****************************************************************************\r
+ YOU MUST REMOVE/REPLACE THE FOLLOWING SCRIPT ELEMENT.\r
+ The <script> tag below that references SampleAjaxLibrary.js must be removed and \r
+ instead you will need to have your own Ajax library loaded instead.\r
+ **************************************************************************** -->\r
+ <link rel="stylesheet" href="../features/RES/base/css/base-ajax.css" type="text/css" />\r
+ <link rel="stylesheet" href="../features/RES/base/css/calendar-default.css" type="text/css" />\r
+ <script src="../features/RES/base/script/ajax-client.js" type="text/javascript"></script>\r
+ <script src="../features/RES/base/script/base-ajax-components.js" type="text/javascript"></script>\r
+ <script src="../features/RES/base/ext/jscalendar/calendar.js" type="text/javascript"></script>\r
+ <script src="../features/RES/base/ext/jscalendar/lang/calendar-en.js" type="text/javascript"></script>\r
+ <script src="../features/RES/base/ext/jscalendar/calendar-setup.js" type="text/javascript"></script>\r
+ <script src="../features/RES/base/ext/firebug/firebug.js" type="text/javascript"></script>\r
+ <link rel="stylesheet" href="../features/RES/corporate/css/corporate-ajax.css" type="text/css" />\r
+ <script src="../features/RES/corporate/script/corporate-ajax-components.js" type="text/javascript"></script>\r
+ <script src="../features/RES/demo/featurebrowser/components.js" type="text/javascript"></script>\r
+ <link rel="stylesheet" href="../features/RES/demo/featurebrowser/featurebrowser.css" type="text/css" />\r
+\r
+ <!-- ****************************************************************************\r
+ YOU MAY CUSTOMIZE THE FOLLOWING LOGIC.\r
+ - Instead of having the ConformanceChecks() happen at the end of OnLoad processing\r
+ (as the code below does),\r
+ you might want instead to invoke ConformanaceChecks() manually, particularly if your toolkit\r
+ performs some of its initialization after the OnLoad event has completed.\r
+ **************************************************************************** -->\r
+ <script language="JavaScript" type="text/javascript">\r
+ // Invoke ConformanceChecks so that they happen at the end of OnLoad processing.\r
+ OpenAjax.addOnLoad("ConformanceChecks");\r
+ </script>\r
+\r
+\r
+</head>\r
+\r
+<body class="itmtk">\r
+ <div id="hubtestwin" style="position:absolute; z-index: 40000; background-color: white; border: 4px ridge gray; margin: 80px;">\r
+ <div style="position: absolute; width: 16px; height: 16px; padding-top: 4px; text-align: center; top: 0; right: 0; background-color: red; border: 1px outset red; cursor: pointer; " onclick="document.getElementById('hubtestwin').style.display='none';">X</div>\r
+\r
+\r
+ <!-- ****************************************************************************\r
+ THE CONTENTS OF THE FOLLOWING DIV BLOCK MUST NOT BE CHANGED.\r
+ (But it's OK if your library needs to move this block elsewhere\r
+ within the document hierarchy and OK if you need to add other\r
+ elements to the BODY.)\r
+ **************************************************************************** -->\r
+ <div id="HubTest_BasicConformance">\r
+ <p id="OpenAjaxBanner" class="imageContainer">\r
+ <a href="http://www.openajax.org">\r
+ <img id="OpenAjaxBanner" src="images/OpenAjaxAllianceBanner.jpg" border="0" width="846px" alt="OpenAjax Alliance banner"/>\r
+ </a>\r
+ </p>\r
+ <h1 class="HubTestTitle">OpenAjax Hub Basic Conformance Test</h1>\r
+ <p id="LibraryName">For library: (unknown)</p>\r
+ <table id="HubTestResults" class="HubTestResults">\r
+ <tbody>\r
+ <tr>\r
+ <td class="HubTestNumber">1</td>\r
+ <td class="HubTestLabel">OpenAjax Conformance Requirement (Libraries): Library Registration</td>\r
+ <td class="HubTestResult" id="registerLibraryResult"><span style="color:red">TEST NOT SUCCESSFUL</span></td>\r
+ </tr>\r
+ <tr>\r
+ <td class="HubTestNumber">2</td>\r
+ <td class="HubTestLabel">OpenAjax Conformance Requirement (Libraries): Globals Registration</td>\r
+ <td class="HubTestResult" id="registerGlobalsResult"><span style="color:red">TEST NOT SUCCESSFUL</span></td>\r
+ </tr>\r
+ <tr>\r
+ <td class="HubTestNumber">3</td>\r
+ <td class="HubTestLabel">OpenAjax Conformance Requirement (Libraries): Load/Unload Handlers Registered Indirectly Through the Hub</td>\r
+ <td class="HubTestResult" id="addOnLoadResult"><span style="color:blue">TEST NOT APPLICABLE</span></td>\r
+ </tr>\r
+ <tr>\r
+ <td class="HubTestNumber">4</td>\r
+ <td class="HubTestLabel">OpenAjax Hub Publish/Subscribe Test</td>\r
+ <td class="HubTestResult" id="PublishSubscribeResult"><span style="color:red">TEST NOT SUCCESSFUL</span></td>\r
+ </tr>\r
+ <tr>\r
+ <td class="HubTestNumber">5</td>\r
+ <td class="HubTestLabel">OpenAjax Hub Markup Scanner Test</td>\r
+ <td class="HubTestResult" id="MarkupScannerResult"><span style="color:red">TEST NOT SUCCESSFUL</span></td>\r
+ </tr>\r
+ </tbody>\r
+ </table>\r
+ <p>Notes:</p>\r
+ <ul>\r
+ <li>A library completely passes this test if all boxes say TEST SUCCEEDED.</li>\r
+ <li>Some toolkits do not initialize themselves during 'load' event processing.\r
+ Because of these situations, it is OK if the load/unload test case says TEST NOT APPLICABLE.</li>\r
+ </ul>\r
+ </div>\r
+ \r
+ \r
+ </div>\r
+\r
+ <!-- ****************************************************************************\r
+ Extra credit: A library developer might want to include a snippet of content that uses\r
+ his Ajax library to include extra graphical content in order spice up the \r
+ visual result from the test.\r
+ **************************************************************************** -->\r
+\r
+<div id="ajax-wait">Loading...</div>\r
+<div id="ajax-window"></div>\r
+<script language="JavaScript">\r
+ // Initialize client part of the IT Mill Toolkit and start it\r
+ function ITMillToolkit_Start () {\r
+ var client = new itmill.Client(document.getElementById('ajax-window'),"../features/UIDL/","../features/RES/base/client/",document.getElementById('ajax-wait'));\r
+ (new itmill.themes.Demo("../features/RES/demo/")).registerTo(client);\r
+ client.start();\r
+ }\r
+ OpenAjax.addOnLoad("ITMillToolkit_Start", null, "library");\r
+</script>\r
+\r
+</body>\r
+</html>
\ No newline at end of file