/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
*/
-/*! SWFObject v2.2 <http://code.google.com/p/swfobject/> \r
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> \r
-*/\r
-\r
-var swfobject = function() {\r
- \r
- var UNDEF = "undefined",\r
- OBJECT = "object",\r
- SHOCKWAVE_FLASH = "Shockwave Flash",\r
- SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",\r
- FLASH_MIME_TYPE = "application/x-shockwave-flash",\r
- EXPRESS_INSTALL_ID = "SWFObjectExprInst",\r
- ON_READY_STATE_CHANGE = "onreadystatechange",\r
- \r
- win = window,\r
- doc = document,\r
- nav = navigator,\r
- \r
- plugin = false,\r
- domLoadFnArr = [main],\r
- regObjArr = [],\r
- objIdArr = [],\r
- listenersArr = [],\r
- storedAltContent,\r
- storedAltContentId,\r
- storedCallbackFn,\r
- storedCallbackObj,\r
- isDomLoaded = false,\r
- isExpressInstallActive = false,\r
- dynamicStylesheet,\r
- dynamicStylesheetMedia,\r
- autoHideShow = true,\r
- \r
- /* Centralized function for browser feature detection\r
- - User agent string detection is only used when no good alternative is possible\r
- - Is executed directly for optimal performance\r
- */ \r
- ua = function() {\r
- var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,\r
- u = nav.userAgent.toLowerCase(),\r
- p = nav.platform.toLowerCase(),\r
- windows = p ? /win/.test(p) : /win/.test(u),\r
- mac = p ? /mac/.test(p) : /mac/.test(u),\r
- webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit\r
- ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html\r
- playerVersion = [0,0,0],\r
- d = null;\r
- if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {\r
- d = nav.plugins[SHOCKWAVE_FLASH].description;\r
- if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+\r
- plugin = true;\r
- ie = false; // cascaded feature detection for Internet Explorer\r
- d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");\r
- playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);\r
- playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);\r
- playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;\r
- }\r
- }\r
- else if (typeof win.ActiveXObject != UNDEF) {\r
- try {\r
- var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);\r
- if (a) { // a will return null when ActiveX is disabled\r
- d = a.GetVariable("$version");\r
- if (d) {\r
- ie = true; // cascaded feature detection for Internet Explorer\r
- d = d.split(" ")[1].split(",");\r
- playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];\r
- }\r
- }\r
- }\r
- catch(e) {}\r
- }\r
- return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };\r
- }(),\r
- \r
- /* Cross-browser onDomLoad\r
- - Will fire an event as soon as the DOM of a web page is loaded\r
- - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/\r
- - Regular onload serves as fallback\r
- */ \r
- onDomLoad = function() {\r
- if (!ua.w3) { return; }\r
- if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically \r
- callDomLoadFunctions();\r
- }\r
- if (!isDomLoaded) {\r
- if (typeof doc.addEventListener != UNDEF) {\r
- doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);\r
- } \r
- if (ua.ie && ua.win) {\r
- doc.attachEvent(ON_READY_STATE_CHANGE, function() {\r
- if (doc.readyState == "complete") {\r
- doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);\r
- callDomLoadFunctions();\r
- }\r
- });\r
- if (win == top) { // if not inside an iframe\r
- (function(){\r
- if (isDomLoaded) { return; }\r
- try {\r
- doc.documentElement.doScroll("left");\r
- }\r
- catch(e) {\r
- setTimeout(arguments.callee, 0);\r
- return;\r
- }\r
- callDomLoadFunctions();\r
- })();\r
- }\r
- }\r
- if (ua.wk) {\r
- (function(){\r
- if (isDomLoaded) { return; }\r
- if (!/loaded|complete/.test(doc.readyState)) {\r
- setTimeout(arguments.callee, 0);\r
- return;\r
- }\r
- callDomLoadFunctions();\r
- })();\r
- }\r
- addLoadEvent(callDomLoadFunctions);\r
- }\r
- }();\r
- \r
- function callDomLoadFunctions() {\r
- if (isDomLoaded) { return; }\r
- try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early\r
- var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));\r
- t.parentNode.removeChild(t);\r
- }\r
- catch (e) { return; }\r
- isDomLoaded = true;\r
- var dl = domLoadFnArr.length;\r
- for (var i = 0; i < dl; i++) {\r
- domLoadFnArr[i]();\r
- }\r
- }\r
- \r
- function addDomLoadEvent(fn) {\r
- if (isDomLoaded) {\r
- fn();\r
- }\r
- else { \r
- domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+\r
- }\r
- }\r
- \r
- /* Cross-browser onload\r
- - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/\r
- - Will fire an event as soon as a web page including all of its assets are loaded \r
- */\r
- function addLoadEvent(fn) {\r
- if (typeof win.addEventListener != UNDEF) {\r
- win.addEventListener("load", fn, false);\r
- }\r
- else if (typeof doc.addEventListener != UNDEF) {\r
- doc.addEventListener("load", fn, false);\r
- }\r
- else if (typeof win.attachEvent != UNDEF) {\r
- addListener(win, "onload", fn);\r
- }\r
- else if (typeof win.onload == "function") {\r
- var fnOld = win.onload;\r
- win.onload = function() {\r
- fnOld();\r
- fn();\r
- };\r
- }\r
- else {\r
- win.onload = fn;\r
- }\r
- }\r
- \r
- /* Main function\r
- - Will preferably execute onDomLoad, otherwise onload (as a fallback)\r
- */\r
- function main() { \r
- if (plugin) {\r
- testPlayerVersion();\r
- }\r
- else {\r
- matchVersions();\r
- }\r
- }\r
- \r
- /* Detect the Flash Player version for non-Internet Explorer browsers\r
- - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:\r
- a. Both release and build numbers can be detected\r
- b. Avoid wrong descriptions by corrupt installers provided by Adobe\r
- c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports\r
- - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available\r
- */\r
- function testPlayerVersion() {\r
- var b = doc.getElementsByTagName("body")[0];\r
- var o = createElement(OBJECT);\r
- o.setAttribute("type", FLASH_MIME_TYPE);\r
- var t = b.appendChild(o);\r
- if (t) {\r
- var counter = 0;\r
- (function(){\r
- if (typeof t.GetVariable != UNDEF) {\r
- var d = t.GetVariable("$version");\r
- if (d) {\r
- d = d.split(" ")[1].split(",");\r
- ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];\r
- }\r
- }\r
- else if (counter < 10) {\r
- counter++;\r
- setTimeout(arguments.callee, 10);\r
- return;\r
- }\r
- b.removeChild(o);\r
- t = null;\r
- matchVersions();\r
- })();\r
- }\r
- else {\r
- matchVersions();\r
- }\r
- }\r
- \r
- /* Perform Flash Player and SWF version matching; static publishing only\r
- */\r
- function matchVersions() {\r
- var rl = regObjArr.length;\r
- if (rl > 0) {\r
- for (var i = 0; i < rl; i++) { // for each registered object element\r
- var id = regObjArr[i].id;\r
- var cb = regObjArr[i].callbackFn;\r
- var cbObj = {success:false, id:id};\r
- if (ua.pv[0] > 0) {\r
- var obj = getElementById(id);\r
- if (obj) {\r
- if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!\r
- setVisibility(id, true);\r
- if (cb) {\r
- cbObj.success = true;\r
- cbObj.ref = getObjectById(id);\r
- cb(cbObj);\r
- }\r
- }\r
- else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported\r
- var att = {};\r
- att.data = regObjArr[i].expressInstall;\r
- att.width = obj.getAttribute("width") || "0";\r
- att.height = obj.getAttribute("height") || "0";\r
- if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }\r
- if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }\r
- // parse HTML object param element's name-value pairs\r
- var par = {};\r
- var p = obj.getElementsByTagName("param");\r
- var pl = p.length;\r
- for (var j = 0; j < pl; j++) {\r
- if (p[j].getAttribute("name").toLowerCase() != "movie") {\r
- par[p[j].getAttribute("name")] = p[j].getAttribute("value");\r
- }\r
- }\r
- showExpressInstall(att, par, id, cb);\r
- }\r
- else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF\r
- displayAltContent(obj);\r
- if (cb) { cb(cbObj); }\r
- }\r
- }\r
- }\r
- else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)\r
- setVisibility(id, true);\r
- if (cb) {\r
- var o = getObjectById(id); // test whether there is an HTML object element or not\r
- if (o && typeof o.SetVariable != UNDEF) { \r
- cbObj.success = true;\r
- cbObj.ref = o;\r
- }\r
- cb(cbObj);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- \r
- function getObjectById(objectIdStr) {\r
- var r = null;\r
- var o = getElementById(objectIdStr);\r
- if (o && o.nodeName == "OBJECT") {\r
- if (typeof o.SetVariable != UNDEF) {\r
- r = o;\r
- }\r
- else {\r
- var n = o.getElementsByTagName(OBJECT)[0];\r
- if (n) {\r
- r = n;\r
- }\r
- }\r
- }\r
- return r;\r
- }\r
- \r
- /* Requirements for Adobe Express Install\r
- - only one instance can be active at a time\r
- - fp 6.0.65 or higher\r
- - Win/Mac OS only\r
- - no Webkit engines older than version 312\r
- */\r
- function canExpressInstall() {\r
- return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);\r
- }\r
- \r
- /* Show the Adobe Express Install dialog\r
- - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75\r
- */\r
- function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {\r
- isExpressInstallActive = true;\r
- storedCallbackFn = callbackFn || null;\r
- storedCallbackObj = {success:false, id:replaceElemIdStr};\r
- var obj = getElementById(replaceElemIdStr);\r
- if (obj) {\r
- if (obj.nodeName == "OBJECT") { // static publishing\r
- storedAltContent = abstractAltContent(obj);\r
- storedAltContentId = null;\r
- }\r
- else { // dynamic publishing\r
- storedAltContent = obj;\r
- storedAltContentId = replaceElemIdStr;\r
- }\r
- att.id = EXPRESS_INSTALL_ID;\r
- if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }\r
- if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }\r
- doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";\r
- var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",\r
- fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;\r
- if (typeof par.flashvars != UNDEF) {\r
- par.flashvars += "&" + fv;\r
- }\r
- else {\r
- par.flashvars = fv;\r
- }\r
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,\r
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work\r
- if (ua.ie && ua.win && obj.readyState != 4) {\r
- var newObj = createElement("div");\r
- replaceElemIdStr += "SWFObjectNew";\r
- newObj.setAttribute("id", replaceElemIdStr);\r
- obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf\r
- obj.style.display = "none";\r
- (function(){\r
- if (obj.readyState == 4) {\r
- obj.parentNode.removeChild(obj);\r
- }\r
- else {\r
- setTimeout(arguments.callee, 10);\r
- }\r
- })();\r
- }\r
- createSWF(att, par, replaceElemIdStr);\r
- }\r
- }\r
- \r
- /* Functions to abstract and display alternative content\r
- */\r
- function displayAltContent(obj) {\r
- if (ua.ie && ua.win && obj.readyState != 4) {\r
- // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,\r
- // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work\r
- var el = createElement("div");\r
- obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content\r
- el.parentNode.replaceChild(abstractAltContent(obj), el);\r
- obj.style.display = "none";\r
- (function(){\r
- if (obj.readyState == 4) {\r
- obj.parentNode.removeChild(obj);\r
- }\r
- else {\r
- setTimeout(arguments.callee, 10);\r
- }\r
- })();\r
- }\r
- else {\r
- obj.parentNode.replaceChild(abstractAltContent(obj), obj);\r
- }\r
- } \r
-\r
- function abstractAltContent(obj) {\r
- var ac = createElement("div");\r
- if (ua.win && ua.ie) {\r
- ac.innerHTML = obj.innerHTML;\r
- }\r
- else {\r
- var nestedObj = obj.getElementsByTagName(OBJECT)[0];\r
- if (nestedObj) {\r
- var c = nestedObj.childNodes;\r
- if (c) {\r
- var cl = c.length;\r
- for (var i = 0; i < cl; i++) {\r
- if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {\r
- ac.appendChild(c[i].cloneNode(true));\r
- }\r
- }\r
- }\r
- }\r
- }\r
- return ac;\r
- }\r
- \r
- /* Cross-browser dynamic SWF creation\r
- */\r
- function createSWF(attObj, parObj, id) {\r
- var r, el = getElementById(id);\r
- if (ua.wk && ua.wk < 312) { return r; }\r
- if (el) {\r
- if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content\r
- attObj.id = id;\r
- }\r
- if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML\r
- var att = "";\r
- for (var i in attObj) {\r
- if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries\r
- if (i.toLowerCase() == "data") {\r
- parObj.movie = attObj[i];\r
- }\r
- else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword\r
- att += ' class="' + attObj[i] + '"';\r
- }\r
- else if (i.toLowerCase() != "classid") {\r
- att += ' ' + i + '="' + attObj[i] + '"';\r
- }\r
- }\r
- }\r
- var par = "";\r
- for (var j in parObj) {\r
- if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries\r
- par += '<param name="' + j + '" value="' + parObj[j] + '" />';\r
- }\r
- }\r
- el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';\r
- objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)\r
- r = getElementById(attObj.id); \r
- }\r
- else { // well-behaving browsers\r
- var o = createElement(OBJECT);\r
- o.setAttribute("type", FLASH_MIME_TYPE);\r
- for (var m in attObj) {\r
- if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries\r
- if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword\r
- o.setAttribute("class", attObj[m]);\r
- }\r
- else if (m.toLowerCase() != "classid") { // filter out IE specific attribute\r
- o.setAttribute(m, attObj[m]);\r
- }\r
- }\r
- }\r
- for (var n in parObj) {\r
- if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element\r
- createObjParam(o, n, parObj[n]);\r
- }\r
- }\r
- el.parentNode.replaceChild(o, el);\r
- r = o;\r
- }\r
- }\r
- return r;\r
- }\r
- \r
- function createObjParam(el, pName, pValue) {\r
- var p = createElement("param");\r
- p.setAttribute("name", pName); \r
- p.setAttribute("value", pValue);\r
- el.appendChild(p);\r
- }\r
- \r
- /* Cross-browser SWF removal\r
- - Especially needed to safely and completely remove a SWF in Internet Explorer\r
- */\r
- function removeSWF(id) {\r
- var obj = getElementById(id);\r
- if (obj && obj.nodeName == "OBJECT") {\r
- if (ua.ie && ua.win) {\r
- obj.style.display = "none";\r
- (function(){\r
- if (obj.readyState == 4) {\r
- removeObjectInIE(id);\r
- }\r
- else {\r
- setTimeout(arguments.callee, 10);\r
- }\r
- })();\r
- }\r
- else {\r
- obj.parentNode.removeChild(obj);\r
- }\r
- }\r
- }\r
- \r
- function removeObjectInIE(id) {\r
- var obj = getElementById(id);\r
- if (obj) {\r
- for (var i in obj) {\r
- if (typeof obj[i] == "function") {\r
- obj[i] = null;\r
- }\r
- }\r
- obj.parentNode.removeChild(obj);\r
- }\r
- }\r
- \r
- /* Functions to optimize JavaScript compression\r
- */\r
- function getElementById(id) {\r
- var el = null;\r
- try {\r
- el = doc.getElementById(id);\r
- }\r
- catch (e) {}\r
- return el;\r
- }\r
- \r
- function createElement(el) {\r
- return doc.createElement(el);\r
- }\r
- \r
- /* Updated attachEvent function for Internet Explorer\r
- - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks\r
- */ \r
- function addListener(target, eventType, fn) {\r
- target.attachEvent(eventType, fn);\r
- listenersArr[listenersArr.length] = [target, eventType, fn];\r
- }\r
- \r
- /* Flash Player and SWF content version matching\r
- */\r
- function hasPlayerVersion(rv) {\r
- var pv = ua.pv, v = rv.split(".");\r
- v[0] = parseInt(v[0], 10);\r
- v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"\r
- v[2] = parseInt(v[2], 10) || 0;\r
- return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;\r
- }\r
- \r
- /* Cross-browser dynamic CSS creation\r
- - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php\r
- */ \r
- function createCSS(sel, decl, media, newStyle) {\r
- if (ua.ie && ua.mac) { return; }\r
- var h = doc.getElementsByTagName("head")[0];\r
- if (!h) { return; } // to also support badly authored HTML pages that lack a head element\r
- var m = (media && typeof media == "string") ? media : "screen";\r
- if (newStyle) {\r
- dynamicStylesheet = null;\r
- dynamicStylesheetMedia = null;\r
- }\r
- if (!dynamicStylesheet || dynamicStylesheetMedia != m) { \r
- // create dynamic stylesheet + get a global reference to it\r
- var s = createElement("style");\r
- s.setAttribute("type", "text/css");\r
- s.setAttribute("media", m);\r
- dynamicStylesheet = h.appendChild(s);\r
- if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {\r
- dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];\r
- }\r
- dynamicStylesheetMedia = m;\r
- }\r
- // add style rule\r
- if (ua.ie && ua.win) {\r
- if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {\r
- dynamicStylesheet.addRule(sel, decl);\r
- }\r
- }\r
- else {\r
- if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {\r
- dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));\r
- }\r
- }\r
- }\r
- \r
- function setVisibility(id, isVisible) {\r
- if (!autoHideShow) { return; }\r
- var v = isVisible ? "visible" : "hidden";\r
- if (isDomLoaded && getElementById(id)) {\r
- getElementById(id).style.visibility = v;\r
- }\r
- else {\r
- createCSS("#" + id, "visibility:" + v);\r
- }\r
- }\r
-\r
- /* Filter to avoid XSS attacks\r
- */\r
- function urlEncodeIfNecessary(s) {\r
- var regex = /[\\\"<>\.;]/;\r
- var hasBadChars = regex.exec(s) != null;\r
- return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;\r
- }\r
- \r
- /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)\r
- */\r
- var cleanup = function() {\r
- if (ua.ie && ua.win) {\r
- window.attachEvent("onunload", function() {\r
- // remove listeners to avoid memory leaks\r
- var ll = listenersArr.length;\r
- for (var i = 0; i < ll; i++) {\r
- listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);\r
- }\r
- // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect\r
- var il = objIdArr.length;\r
- for (var j = 0; j < il; j++) {\r
- removeSWF(objIdArr[j]);\r
- }\r
- // cleanup library's main closures to avoid memory leaks\r
- for (var k in ua) {\r
- ua[k] = null;\r
- }\r
- ua = null;\r
- for (var l in swfobject) {\r
- swfobject[l] = null;\r
- }\r
- swfobject = null;\r
- });\r
- }\r
- }();\r
- \r
- return {\r
- /* Public API\r
- - Reference: http://code.google.com/p/swfobject/wiki/documentation\r
- */ \r
- registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {\r
- if (ua.w3 && objectIdStr && swfVersionStr) {\r
- var regObj = {};\r
- regObj.id = objectIdStr;\r
- regObj.swfVersion = swfVersionStr;\r
- regObj.expressInstall = xiSwfUrlStr;\r
- regObj.callbackFn = callbackFn;\r
- regObjArr[regObjArr.length] = regObj;\r
- setVisibility(objectIdStr, false);\r
- }\r
- else if (callbackFn) {\r
- callbackFn({success:false, id:objectIdStr});\r
- }\r
- },\r
- \r
- getObjectById: function(objectIdStr) {\r
- if (ua.w3) {\r
- return getObjectById(objectIdStr);\r
- }\r
- },\r
- \r
- embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {\r
- var callbackObj = {success:false, id:replaceElemIdStr};\r
- if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {\r
- setVisibility(replaceElemIdStr, false);\r
- addDomLoadEvent(function() {\r
- widthStr += ""; // auto-convert to string\r
- heightStr += "";\r
- var att = {};\r
- if (attObj && typeof attObj === OBJECT) {\r
- for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs\r
- att[i] = attObj[i];\r
- }\r
- }\r
- att.data = swfUrlStr;\r
- att.width = widthStr;\r
- att.height = heightStr;\r
- var par = {}; \r
- if (parObj && typeof parObj === OBJECT) {\r
- for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs\r
- par[j] = parObj[j];\r
- }\r
- }\r
- if (flashvarsObj && typeof flashvarsObj === OBJECT) {\r
- for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs\r
- if (typeof par.flashvars != UNDEF) {\r
- par.flashvars += "&" + k + "=" + flashvarsObj[k];\r
- }\r
- else {\r
- par.flashvars = k + "=" + flashvarsObj[k];\r
- }\r
- }\r
- }\r
- if (hasPlayerVersion(swfVersionStr)) { // create SWF\r
- var obj = createSWF(att, par, replaceElemIdStr);\r
- if (att.id == replaceElemIdStr) {\r
- setVisibility(replaceElemIdStr, true);\r
- }\r
- callbackObj.success = true;\r
- callbackObj.ref = obj;\r
- }\r
- else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install\r
- att.data = xiSwfUrlStr;\r
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);\r
- return;\r
- }\r
- else { // show alternative content\r
- setVisibility(replaceElemIdStr, true);\r
- }\r
- if (callbackFn) { callbackFn(callbackObj); }\r
- });\r
- }\r
- else if (callbackFn) { callbackFn(callbackObj); }\r
- },\r
- \r
- switchOffAutoHideShow: function() {\r
- autoHideShow = false;\r
- },\r
- \r
- ua: ua,\r
- \r
- getFlashPlayerVersion: function() {\r
- return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };\r
- },\r
- \r
- hasFlashPlayerVersion: hasPlayerVersion,\r
- \r
- createSWF: function(attObj, parObj, replaceElemIdStr) {\r
- if (ua.w3) {\r
- return createSWF(attObj, parObj, replaceElemIdStr);\r
- }\r
- else {\r
- return undefined;\r
- }\r
- },\r
- \r
- showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {\r
- if (ua.w3 && canExpressInstall()) {\r
- showExpressInstall(att, par, replaceElemIdStr, callbackFn);\r
- }\r
- },\r
- \r
- removeSWF: function(objElemIdStr) {\r
- if (ua.w3) {\r
- removeSWF(objElemIdStr);\r
- }\r
- },\r
- \r
- createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {\r
- if (ua.w3) {\r
- createCSS(selStr, declStr, mediaStr, newStyleBoolean);\r
- }\r
- },\r
- \r
- addDomLoadEvent: addDomLoadEvent,\r
- \r
- addLoadEvent: addLoadEvent,\r
- \r
- getQueryParamValue: function(param) {\r
- var q = doc.location.search || doc.location.hash;\r
- if (q) {\r
- if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark\r
- if (param == null) {\r
- return urlEncodeIfNecessary(q);\r
- }\r
- var pairs = q.split("&");\r
- for (var i = 0; i < pairs.length; i++) {\r
- if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {\r
- return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));\r
- }\r
- }\r
- }\r
- return "";\r
- },\r
- \r
- // For internal usage only\r
- expressInstallCallback: function() {\r
- if (isExpressInstallActive) {\r
- var obj = getElementById(EXPRESS_INSTALL_ID);\r
- if (obj && storedAltContent) {\r
- obj.parentNode.replaceChild(storedAltContent, obj);\r
- if (storedAltContentId) {\r
- setVisibility(storedAltContentId, true);\r
- if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }\r
- }\r
- if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }\r
- }\r
- isExpressInstallActive = false;\r
- } \r
- }\r
- };\r
-}();\r
+/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+ ON_READY_STATE_CHANGE = "onreadystatechange",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ plugin = false,
+ domLoadFnArr = [main],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ storedAltContent,
+ storedAltContentId,
+ storedCallbackFn,
+ storedCallbackObj,
+ isDomLoaded = false,
+ isExpressInstallActive = false,
+ dynamicStylesheet,
+ dynamicStylesheetMedia,
+ autoHideShow = true,
+
+ /* Centralized function for browser feature detection
+ - User agent string detection is only used when no good alternative is possible
+ - Is executed directly for optimal performance
+ */
+ ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ windows = p ? (/win/).test(p) : /win/.test(u),
+ mac = p ? (/mac/).test(p) : /mac/.test(u),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ plugin = true;
+ ie = false; // cascaded feature detection for Internet Explorer
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ try {
+ var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ if (a) { // a will return null when ActiveX is disabled
+ d = a.GetVariable("$version");
+ if (d) {
+ ie = true; // cascaded feature detection for Internet Explorer
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ }
+ catch(e) {}
+ }
+ return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
+ }(),
+
+ /* Cross-browser onDomLoad
+ - Will fire an event as soon as the DOM of a web page is loaded
+ - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
+ - Regular onload serves as fallback
+ */
+ onDomLoad = function() {
+ if (!ua.w3) { return; }
+ if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
+ callDomLoadFunctions();
+ }
+ if (!isDomLoaded) {
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+ }
+ if (ua.ie && ua.win) {
+ doc.attachEvent(ON_READY_STATE_CHANGE, function() {
+ if (doc.readyState == "complete") {
+ doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
+ callDomLoadFunctions();
+ }
+ });
+ if (win == top) { // if not inside an iframe
+ (function(){
+ if (isDomLoaded) { return; }
+ try {
+ doc.documentElement.doScroll("left");
+ }
+ catch(e) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ }
+ if (ua.wk) {
+ (function(){
+ if (isDomLoaded) { return; }
+ if (!(/loaded|complete/).test(doc.readyState)) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+ callDomLoadFunctions();
+ })();
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }
+ }();
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) { return; }
+ try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
+ var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
+ t.parentNode.removeChild(t);
+ }
+ catch (e) { return; }
+ isDomLoaded = true;
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() {
+ if (plugin) {
+ testPlayerVersion();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Detect the Flash Player version for non-Internet Explorer browsers
+ - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
+ a. Both release and build numbers can be detected
+ b. Avoid wrong descriptions by corrupt installers provided by Adobe
+ c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
+ - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
+ */
+ function testPlayerVersion() {
+ var b = doc.getElementsByTagName("body")[0];
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ var t = b.appendChild(o);
+ if (t) {
+ var counter = 0;
+ (function(){
+ if (typeof t.GetVariable != UNDEF) {
+ var d = t.GetVariable("$version");
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ else if (counter < 10) {
+ counter++;
+ setTimeout(arguments.callee, 10);
+ return;
+ }
+ b.removeChild(o);
+ t = null;
+ matchVersions();
+ })();
+ }
+ else {
+ matchVersions();
+ }
+ }
+
+ /* Perform Flash Player and SWF version matching; static publishing only
+ */
+ function matchVersions() {
+ var rl = regObjArr.length;
+ if (rl > 0) {
+ for (var i = 0; i < rl; i++) { // for each registered object element
+ var id = regObjArr[i].id;
+ var cb = regObjArr[i].callbackFn;
+ var cbObj = {success:false, id:id};
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
+ setVisibility(id, true);
+ if (cb) {
+ cbObj.success = true;
+ cbObj.ref = getObjectById(id);
+ cb(cbObj);
+ }
+ }
+ else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
+ var att = {};
+ att.data = regObjArr[i].expressInstall;
+ att.width = obj.getAttribute("width") || "0";
+ att.height = obj.getAttribute("height") || "0";
+ if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
+ if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
+ // parse HTML object param element's name-value pairs
+ var par = {};
+ var p = obj.getElementsByTagName("param");
+ var pl = p.length;
+ for (var j = 0; j < pl; j++) {
+ if (p[j].getAttribute("name").toLowerCase() != "movie") {
+ par[p[j].getAttribute("name")] = p[j].getAttribute("value");
+ }
+ }
+ showExpressInstall(att, par, id, cb);
+ }
+ else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
+ displayAltContent(obj);
+ if (cb) { cb(cbObj); }
+ }
+ }
+ }
+ else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
+ setVisibility(id, true);
+ if (cb) {
+ var o = getObjectById(id); // test whether there is an HTML object element or not
+ if (o && typeof o.SetVariable != UNDEF) {
+ cbObj.success = true;
+ cbObj.ref = o;
+ }
+ cb(cbObj);
+ }
+ }
+ }
+ }
+ }
+
+ function getObjectById(objectIdStr) {
+ var r = null;
+ var o = getElementById(objectIdStr);
+ if (o && o.nodeName == "OBJECT") {
+ if (typeof o.SetVariable != UNDEF) {
+ r = o;
+ }
+ else {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (n) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ }
+
+ /* Requirements for Adobe Express Install
+ - only one instance can be active at a time
+ - fp 6.0.65 or higher
+ - Win/Mac OS only
+ - no Webkit engines older than version 312
+ */
+ function canExpressInstall() {
+ return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
+ isExpressInstallActive = true;
+ storedCallbackFn = callbackFn || null;
+ storedCallbackObj = {success:false, id:replaceElemIdStr};
+ var obj = getElementById(replaceElemIdStr);
+ if (obj) {
+ if (obj.nodeName == "OBJECT") { // static publishing
+ storedAltContent = abstractAltContent(obj);
+ storedAltContentId = null;
+ }
+ else { // dynamic publishing
+ storedAltContent = obj;
+ storedAltContentId = replaceElemIdStr;
+ }
+ att.id = EXPRESS_INSTALL_ID;
+ if (typeof att.width == UNDEF || (!(/%$/).test(att.width) && parseInt(att.width, 10) < 310)) {
+ att.width = "310";
+ }
+
+ if (typeof att.height == UNDEF || (!(/%$/).test(att.height) && parseInt(att.height, 10) < 137)) {
+ att.height = "137";
+ }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + fv;
+ }
+ else {
+ par.flashvars = fv;
+ }
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceElemIdStr += "SWFObjectNew";
+ newObj.setAttribute("id", replaceElemIdStr);
+ obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ createSWF(att, par, replaceElemIdStr);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
+ // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ obj.parentNode.removeChild(obj);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (ua.wk && ua.wk < 312) { return r; }
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else { // well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && obj.nodeName == "OBJECT") {
+ if (ua.ie && ua.win) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl, media, newStyle) {
+ if (ua.ie && ua.mac) { return; }
+ var h = doc.getElementsByTagName("head")[0];
+ if (!h) { return; } // to also support badly authored HTML pages that lack a head element
+ var m = (media && typeof media == "string") ? media : "screen";
+ if (newStyle) {
+ dynamicStylesheet = null;
+ dynamicStylesheetMedia = null;
+ }
+ if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
+ // create dynamic stylesheet + get a global reference to it
+ var s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", m);
+ dynamicStylesheet = h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
+ }
+ dynamicStylesheetMedia = m;
+ }
+ // add style rule
+ if (ua.ie && ua.win) {
+ if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
+ dynamicStylesheet.addRule(sel, decl);
+ }
+ }
+ else {
+ if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
+ dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ if (!autoHideShow) { return; }
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
+ if (ua.w3 && objectIdStr && swfVersionStr) {
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ regObj.callbackFn = callbackFn;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ }
+ else if (callbackFn) {
+ callbackFn({success:false, id:objectIdStr});
+ }
+ },
+
+ getObjectById: function(objectIdStr) {
+ if (ua.w3) {
+ return getObjectById(objectIdStr);
+ }
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
+ var callbackObj = {success:false, id:replaceElemIdStr};
+ if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ widthStr += ""; // auto-convert to string
+ heightStr += "";
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
+ att[i] = attObj[i];
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
+ par[j] = parObj[j];
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ if (hasPlayerVersion(swfVersionStr)) { // create SWF
+ var obj = createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ callbackObj.success = true;
+ callbackObj.ref = obj;
+ }
+ else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
+ att.data = xiSwfUrlStr;
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ return;
+ }
+ else { // show alternative content
+ setVisibility(replaceElemIdStr, true);
+ }
+ if (callbackFn) { callbackFn(callbackObj); }
+ });
+ }
+ else if (callbackFn) { callbackFn(callbackObj); }
+ },
+
+ switchOffAutoHideShow: function() {
+ autoHideShow = false;
+ },
+
+ ua: ua,
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
+ if (ua.w3 && canExpressInstall()) {
+ showExpressInstall(att, par, replaceElemIdStr, callbackFn);
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
+ if (ua.w3) {
+ createCSS(selStr, declStr, mediaStr, newStyleBoolean);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (q) {
+ if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ var pairs = q.split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj && storedAltContent) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
+ }
+ if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
+ }
+ isExpressInstallActive = false;
+ }
+ }
+ };
+}();
/**
* @class Ext.FlashComponent
* @extends Ext.BoxComponent
Ext.FlashComponent = Ext.extend(Ext.BoxComponent, {
/**
* @cfg {String} flashVersion
- * Indicates the version the flash content was published for. Defaults to <tt>'9.0.45'</tt>.
+ * Indicates the version the flash content was published for. Defaults to <tt>'9.0.115'</tt>.
*/
- flashVersion : '9.0.45',
+ flashVersion : '9.0.115',
/**
* @cfg {String} backgroundColor
* The wmode of the flash object. This can be used to control layering. Defaults to <tt>'opaque'</tt>.
*/
wmode: 'opaque',
-
+
/**
* @cfg {Object} flashVars
* A set of key value pairs to be passed to the flash object as flash variables. Defaults to <tt>undefined</tt>.
*/
flashVars: undefined,
-
+
/**
* @cfg {Object} flashParams
* A set of key value pairs to be passed to the flash object as parameters. Possible parameters can be found here:
initComponent : function(){
Ext.FlashComponent.superclass.initComponent.call(this);
- this.addEvents('initialize');
+ this.addEvents(
+ /**
+ * @event initialize
+ *
+ * @param {Chart} this
+ */
+ 'initialize'
+ );
},
onRender : function(){
wmode: this.wmode
}, this.flashParams), vars = Ext.apply({
allowedDomain: document.location.hostname,
- elementID: this.getId(),
- eventHandler: 'Ext.FlashEventProxy.onEvent'
+ YUISwfId: this.getId(),
+ YUIBridgeCallback: 'Ext.FlashEventProxy.onEvent'
}, this.flashVars);
new swfobject.embedSWF(this.url, this.id, this.swfWidth, this.swfHeight, this.flashVersion,
*/
Ext.FlashComponent.EXPRESS_INSTALL_URL = 'http:/' + '/swfobject.googlecode.com/svn/trunk/swfobject/expressInstall.swf';
-Ext.reg('flash', Ext.FlashComponent);/**\r
- * @class Ext.FlashProxy\r
- * @singleton\r
- */\r
-Ext.FlashEventProxy = {\r
- onEvent : function(id, e){\r
- var fp = Ext.getCmp(id);\r
- if(fp){\r
- fp.onFlashEvent(e);\r
- }else{\r
- arguments.callee.defer(10, this, [id, e]);\r
- }\r
- }\r
-}/**\r
- * @class Ext.chart.Chart\r
- * @extends Ext.FlashComponent\r
- * The Ext.chart package provides the capability to visualize data with flash based charting.\r
- * Each chart binds directly to an Ext.data.Store enabling automatic updates of the chart.\r
- * @constructor\r
- * @xtype chart\r
- */\r
- \r
- Ext.chart.Chart = Ext.extend(Ext.FlashComponent, {\r
- refreshBuffer: 100,\r
-\r
- /**\r
- * @cfg {Object} chartStyle\r
- * Sets styles for this chart. Contains a number of default values. Modifying this property will override\r
- * the base styles on the chart.\r
- */\r
- chartStyle: {\r
- padding: 10,\r
- animationEnabled: true,\r
- font: {\r
- name: 'Tahoma',\r
- color: 0x444444,\r
- size: 11\r
- },\r
- dataTip: {\r
- padding: 5,\r
- border: {\r
- color: 0x99bbe8,\r
- size:1\r
- },\r
- background: {\r
- color: 0xDAE7F6,\r
- alpha: .9\r
- },\r
- font: {\r
- name: 'Tahoma',\r
- color: 0x15428B,\r
- size: 10,\r
- bold: true\r
- }\r
- }\r
- },\r
- \r
- /**\r
- * @cfg {String} url\r
- * The url to load the chart from. This defaults to Ext.chart.Chart.CHART_URL, which should\r
- * be modified to point to the local charts resource.\r
- */\r
- \r
- /**\r
- * @cfg {Object} extraStyle\r
- * Contains extra styles that will be added or overwritten to the default chartStyle. Defaults to <tt>null</tt>.\r
- */\r
- extraStyle: null,\r
- \r
- /**\r
- * @cfg {Boolean} disableCaching\r
- * True to add a "cache buster" to the end of the chart url. Defaults to true for Opera and IE.\r
- */\r
- disableCaching: Ext.isIE || Ext.isOpera,\r
- disableCacheParam: '_dc',\r
-\r
- initComponent : function(){\r
- Ext.chart.Chart.superclass.initComponent.call(this);\r
- if(!this.url){\r
- this.url = Ext.chart.Chart.CHART_URL;\r
- }\r
- if(this.disableCaching){\r
- this.url = Ext.urlAppend(this.url, String.format('{0}={1}', this.disableCacheParam, new Date().getTime()));\r
- }\r
- this.addEvents(\r
- 'itemmouseover',\r
- 'itemmouseout',\r
- 'itemclick',\r
- 'itemdoubleclick',\r
- 'itemdragstart',\r
- 'itemdrag',\r
- 'itemdragend'\r
- );\r
- this.store = Ext.StoreMgr.lookup(this.store);\r
- },\r
-\r
- /**\r
- * Sets a single style value on the Chart instance.\r
- *\r
- * @param name {String} Name of the Chart style value to change.\r
- * @param value {Object} New value to pass to the Chart style.\r
- */\r
- setStyle: function(name, value){\r
- this.swf.setStyle(name, Ext.encode(value));\r
- },\r
-\r
- /**\r
- * Resets all styles on the Chart instance.\r
- *\r
- * @param styles {Object} Initializer for all Chart styles.\r
- */\r
- setStyles: function(styles){\r
- this.swf.setStyles(Ext.encode(styles));\r
- },\r
-\r
- /**\r
- * Sets the styles on all series in the Chart.\r
- *\r
- * @param styles {Array} Initializer for all Chart series styles.\r
- */\r
- setSeriesStyles: function(styles){\r
- var s = [];\r
- Ext.each(styles, function(style){\r
- s.push(Ext.encode(style));\r
- });\r
- this.swf.setSeriesStyles(s);\r
- },\r
-\r
- setCategoryNames : function(names){\r
- this.swf.setCategoryNames(names);\r
- },\r
-\r
- setTipRenderer : function(fn){\r
- var chart = this;\r
- this.tipFnName = this.createFnProxy(function(item, index, series){\r
- var record = chart.store.getAt(index);\r
- return fn(chart, record, index, series);\r
- }, this.tipFnName);\r
- this.swf.setDataTipFunction(this.tipFnName);\r
- },\r
-\r
- setSeries : function(series){\r
- this.series = series;\r
- this.refresh();\r
- },\r
-\r
- /**\r
- * Changes the data store bound to this chart and refreshes it.\r
- * @param {Store} store The store to bind to this chart\r
- */\r
- bindStore : function(store, initial){\r
- if(!initial && this.store){\r
- if(store !== this.store && this.store.autoDestroy){\r
- this.store.destroy();\r
- }else{\r
- this.store.un("datachanged", this.refresh, this);\r
- this.store.un("add", this.delayRefresh, this);\r
- this.store.un("remove", this.delayRefresh, this);\r
- this.store.un("update", this.delayRefresh, this);\r
- this.store.un("clear", this.refresh, this);\r
- }\r
- }\r
- if(store){\r
- store = Ext.StoreMgr.lookup(store);\r
- store.on({\r
- scope: this,\r
- datachanged: this.refresh,\r
- add: this.delayRefresh,\r
- remove: this.delayRefresh,\r
- update: this.delayRefresh,\r
- clear: this.refresh\r
- });\r
- }\r
- this.store = store;\r
- if(store && !initial){\r
- this.refresh();\r
- }\r
- },\r
-\r
- onSwfReady : function(isReset){\r
- Ext.chart.Chart.superclass.onSwfReady.call(this, isReset);\r
- this.swf.setType(this.type);\r
-\r
- if(this.chartStyle){\r
- this.setStyles(Ext.apply({}, this.extraStyle, this.chartStyle));\r
- }\r
-\r
- if(this.categoryNames){\r
- this.setCategoryNames(this.categoryNames);\r
- }\r
-\r
- if(this.tipRenderer){\r
- this.setTipRenderer(this.tipRenderer);\r
- }\r
- if(!isReset){\r
- this.bindStore(this.store, true);\r
- }\r
- this.refresh.defer(10, this);\r
- },\r
-\r
- delayRefresh : function(){\r
- if(!this.refreshTask){\r
- this.refreshTask = new Ext.util.DelayedTask(this.refresh, this);\r
- }\r
- this.refreshTask.delay(this.refreshBuffer);\r
- },\r
-\r
- refresh : function(){\r
- var styleChanged = false;\r
- // convert the store data into something YUI charts can understand\r
- var data = [], rs = this.store.data.items;\r
- for(var j = 0, len = rs.length; j < len; j++){\r
- data[j] = rs[j].data;\r
- }\r
- //make a copy of the series definitions so that we aren't\r
- //editing them directly.\r
- var dataProvider = [];\r
- var seriesCount = 0;\r
- var currentSeries = null;\r
- var i = 0;\r
- if(this.series){\r
- seriesCount = this.series.length;\r
- for(i = 0; i < seriesCount; i++){\r
- currentSeries = this.series[i];\r
- var clonedSeries = {};\r
- for(var prop in currentSeries){\r
- if(prop == "style" && currentSeries.style !== null){\r
- clonedSeries.style = Ext.encode(currentSeries.style);\r
- styleChanged = true;\r
- //we don't want to modify the styles again next time\r
- //so null out the style property.\r
- // this causes issues\r
- // currentSeries.style = null;\r
- } else{\r
- clonedSeries[prop] = currentSeries[prop];\r
- }\r
- }\r
- dataProvider.push(clonedSeries);\r
- }\r
- }\r
-\r
- if(seriesCount > 0){\r
- for(i = 0; i < seriesCount; i++){\r
- currentSeries = dataProvider[i];\r
- if(!currentSeries.type){\r
- currentSeries.type = this.type;\r
- }\r
- currentSeries.dataProvider = data;\r
- }\r
- } else{\r
- dataProvider.push({type: this.type, dataProvider: data});\r
- }\r
- this.swf.setDataProvider(dataProvider);\r
- },\r
-\r
- createFnProxy : function(fn, old){\r
- if(old){\r
- delete window[old];\r
- }\r
- var fnName = "extFnProxy" + (++Ext.chart.Chart.PROXY_FN_ID);\r
- window[fnName] = fn;\r
- return fnName;\r
- },\r
- \r
- onDestroy: function(){\r
- Ext.chart.Chart.superclass.onDestroy.call(this);\r
- this.bindStore(null);\r
- var tip = this.tipFnName;\r
- if(!Ext.isEmpty(tip)){\r
- delete window[tip];\r
- }\r
- }\r
-});\r
-Ext.reg('chart', Ext.chart.Chart);\r
-Ext.chart.Chart.PROXY_FN_ID = 0;\r
-\r
-/**\r
- * Sets the url to load the chart from. This should be set to a local resource.\r
- * @static\r
- * @type String\r
- */\r
-Ext.chart.Chart.CHART_URL = 'http:/' + '/yui.yahooapis.com/2.7.0/build/charts/assets/charts.swf';\r
-\r
-/**\r
- * @class Ext.chart.PieChart\r
- * @extends Ext.chart.Chart\r
- * @constructor\r
- * @xtype piechart\r
- */\r
-Ext.chart.PieChart = Ext.extend(Ext.chart.Chart, {\r
- type: 'pie',\r
-\r
- onSwfReady : function(isReset){\r
- Ext.chart.PieChart.superclass.onSwfReady.call(this, isReset);\r
-\r
- this.setDataField(this.dataField);\r
- this.setCategoryField(this.categoryField);\r
- },\r
-\r
- setDataField : function(field){\r
- this.dataField = field;\r
- this.swf.setDataField(field);\r
- },\r
-\r
- setCategoryField : function(field){\r
- this.categoryField = field;\r
- this.swf.setCategoryField(field);\r
- }\r
-});\r
-Ext.reg('piechart', Ext.chart.PieChart);\r
-\r
-/**\r
- * @class Ext.chart.CartesianChart\r
- * @extends Ext.chart.Chart\r
- * @constructor\r
- * @xtype cartesianchart\r
- */\r
-Ext.chart.CartesianChart = Ext.extend(Ext.chart.Chart, {\r
- onSwfReady : function(isReset){\r
- Ext.chart.CartesianChart.superclass.onSwfReady.call(this, isReset);\r
-\r
- if(this.xField){\r
- this.setXField(this.xField);\r
- }\r
- if(this.yField){\r
- this.setYField(this.yField);\r
- }\r
- if(this.xAxis){\r
- this.setXAxis(this.xAxis);\r
- }\r
- if(this.yAxis){\r
- this.setYAxis(this.yAxis);\r
- }\r
- },\r
-\r
- setXField : function(value){\r
- this.xField = value;\r
- this.swf.setHorizontalField(value);\r
- },\r
-\r
- setYField : function(value){\r
- this.yField = value;\r
- this.swf.setVerticalField(value);\r
- },\r
-\r
- setXAxis : function(value){\r
- this.xAxis = this.createAxis('xAxis', value);\r
- this.swf.setHorizontalAxis(this.xAxis);\r
- },\r
-\r
- setYAxis : function(value){\r
- this.yAxis = this.createAxis('yAxis', value);\r
- this.swf.setVerticalAxis(this.yAxis);\r
- },\r
-\r
- createAxis : function(axis, value){\r
- var o = Ext.apply({}, value), oldFn = null;\r
- if(this[axis]){\r
- oldFn = this[axis].labelFunction;\r
- }\r
- if(o.labelRenderer){\r
- var fn = o.labelRenderer;\r
- o.labelFunction = this.createFnProxy(function(v){\r
- return fn(v);\r
- }, oldFn);\r
- delete o.labelRenderer;\r
- }\r
- return o;\r
- }\r
-});\r
-Ext.reg('cartesianchart', Ext.chart.CartesianChart);\r
-\r
-/**\r
- * @class Ext.chart.LineChart\r
- * @extends Ext.chart.CartesianChart\r
- * @constructor\r
- * @xtype linechart\r
- */\r
-Ext.chart.LineChart = Ext.extend(Ext.chart.CartesianChart, {\r
- type: 'line'\r
-});\r
-Ext.reg('linechart', Ext.chart.LineChart);\r
-\r
-/**\r
- * @class Ext.chart.ColumnChart\r
- * @extends Ext.chart.CartesianChart\r
- * @constructor\r
- * @xtype columnchart\r
- */\r
-Ext.chart.ColumnChart = Ext.extend(Ext.chart.CartesianChart, {\r
- type: 'column'\r
-});\r
-Ext.reg('columnchart', Ext.chart.ColumnChart);\r
-\r
-/**\r
- * @class Ext.chart.StackedColumnChart\r
- * @extends Ext.chart.CartesianChart\r
- * @constructor\r
- * @xtype stackedcolumnchart\r
- */\r
-Ext.chart.StackedColumnChart = Ext.extend(Ext.chart.CartesianChart, {\r
- type: 'stackcolumn'\r
-});\r
-Ext.reg('stackedcolumnchart', Ext.chart.StackedColumnChart);\r
-\r
-/**\r
- * @class Ext.chart.BarChart\r
- * @extends Ext.chart.CartesianChart\r
- * @constructor\r
- * @xtype barchart\r
- */\r
-Ext.chart.BarChart = Ext.extend(Ext.chart.CartesianChart, {\r
- type: 'bar'\r
-});\r
-Ext.reg('barchart', Ext.chart.BarChart);\r
-\r
-/**\r
- * @class Ext.chart.StackedBarChart\r
- * @extends Ext.chart.CartesianChart\r
- * @constructor\r
- * @xtype stackedbarchart\r
- */\r
-Ext.chart.StackedBarChart = Ext.extend(Ext.chart.CartesianChart, {\r
- type: 'stackbar'\r
-});\r
-Ext.reg('stackedbarchart', Ext.chart.StackedBarChart);\r
-\r
-\r
-\r
-/**\r
- * @class Ext.chart.Axis\r
- * Defines a CartesianChart's vertical or horizontal axis.\r
- * @constructor\r
- */\r
-Ext.chart.Axis = function(config){\r
- Ext.apply(this, config);\r
-};\r
-\r
-Ext.chart.Axis.prototype =\r
-{\r
- /**\r
- * The type of axis.\r
- *\r
- * @property type\r
- * @type String\r
- */\r
- type: null,\r
-\r
- /**\r
- * The direction in which the axis is drawn. May be "horizontal" or "vertical".\r
- *\r
- * @property orientation\r
- * @type String\r
- */\r
- orientation: "horizontal",\r
-\r
- /**\r
- * If true, the items on the axis will be drawn in opposite direction.\r
- *\r
- * @property reverse\r
- * @type Boolean\r
- */\r
- reverse: false,\r
-\r
- /**\r
- * A string reference to the globally-accessible function that may be called to\r
- * determine each of the label values for this axis.\r
- *\r
- * @property labelFunction\r
- * @type String\r
- */\r
- labelFunction: null,\r
-\r
- /**\r
- * If true, labels that overlap previously drawn labels on the axis will be hidden.\r
- *\r
- * @property hideOverlappingLabels\r
- * @type Boolean\r
- */\r
- hideOverlappingLabels: true\r
-};\r
-\r
-/**\r
- * @class Ext.chart.NumericAxis\r
- * @extends Ext.chart.Axis\r
- * A type of axis whose units are measured in numeric values.\r
- * @constructor\r
- */\r
-Ext.chart.NumericAxis = Ext.extend(Ext.chart.Axis, {\r
- type: "numeric",\r
-\r
- /**\r
- * The minimum value drawn by the axis. If not set explicitly, the axis minimum\r
- * will be calculated automatically.\r
- *\r
- * @property minimum\r
- * @type Number\r
- */\r
- minimum: NaN,\r
-\r
- /**\r
- * The maximum value drawn by the axis. If not set explicitly, the axis maximum\r
- * will be calculated automatically.\r
- *\r
- * @property maximum\r
- * @type Number\r
- */\r
- maximum: NaN,\r
-\r
- /**\r
- * The spacing between major intervals on this axis.\r
- *\r
- * @property majorUnit\r
- * @type Number\r
- */\r
- majorUnit: NaN,\r
-\r
- /**\r
- * The spacing between minor intervals on this axis.\r
- *\r
- * @property minorUnit\r
- * @type Number\r
- */\r
- minorUnit: NaN,\r
-\r
- /**\r
- * If true, the labels, ticks, gridlines, and other objects will snap to\r
- * the nearest major or minor unit. If false, their position will be based\r
- * on the minimum value.\r
- *\r
- * @property snapToUnits\r
- * @type Boolean\r
- */\r
- snapToUnits: true,\r
-\r
- /**\r
- * If true, and the bounds are calculated automatically, either the minimum or\r
- * maximum will be set to zero.\r
- *\r
- * @property alwaysShowZero\r
- * @type Boolean\r
- */\r
- alwaysShowZero: true,\r
-\r
- /**\r
- * The scaling algorithm to use on this axis. May be "linear" or "logarithmic".\r
- *\r
- * @property scale\r
- * @type String\r
- */\r
- scale: "linear"\r
-});\r
-\r
-/**\r
- * @class Ext.chart.TimeAxis\r
- * @extends Ext.chart.Axis\r
- * A type of axis whose units are measured in time-based values.\r
- * @constructor\r
- */\r
-Ext.chart.TimeAxis = Ext.extend(Ext.chart.Axis, {\r
- type: "time",\r
-\r
- /**\r
- * The minimum value drawn by the axis. If not set explicitly, the axis minimum\r
- * will be calculated automatically.\r
- *\r
- * @property minimum\r
- * @type Date\r
- */\r
- minimum: null,\r
-\r
- /**\r
- * The maximum value drawn by the axis. If not set explicitly, the axis maximum\r
- * will be calculated automatically.\r
- *\r
- * @property maximum\r
- * @type Number\r
- */\r
- maximum: null,\r
-\r
- /**\r
- * The spacing between major intervals on this axis.\r
- *\r
- * @property majorUnit\r
- * @type Number\r
- */\r
- majorUnit: NaN,\r
-\r
- /**\r
- * The time unit used by the majorUnit.\r
- *\r
- * @property majorTimeUnit\r
- * @type String\r
- */\r
- majorTimeUnit: null,\r
-\r
- /**\r
- * The spacing between minor intervals on this axis.\r
- *\r
- * @property majorUnit\r
- * @type Number\r
- */\r
- minorUnit: NaN,\r
-\r
- /**\r
- * The time unit used by the minorUnit.\r
- *\r
- * @property majorTimeUnit\r
- * @type String\r
- */\r
- minorTimeUnit: null,\r
-\r
- /**\r
- * If true, the labels, ticks, gridlines, and other objects will snap to\r
- * the nearest major or minor unit. If false, their position will be based\r
- * on the minimum value.\r
- *\r
- * @property snapToUnits\r
- * @type Boolean\r
- */\r
- snapToUnits: true\r
-});\r
-\r
-/**\r
- * @class Ext.chart.CategoryAxis\r
- * @extends Ext.chart.Axis\r
- * A type of axis that displays items in categories.\r
- * @constructor\r
- */\r
-Ext.chart.CategoryAxis = Ext.extend(Ext.chart.Axis, {\r
- type: "category",\r
-\r
- /**\r
- * A list of category names to display along this axis.\r
- *\r
- * @property categoryNames\r
- * @type Array\r
- */\r
- categoryNames: null\r
-});\r
-\r
-/**\r
- * @class Ext.chart.Series\r
- * Series class for the charts widget.\r
- * @constructor\r
- */\r
-Ext.chart.Series = function(config) { Ext.apply(this, config); };\r
-\r
-Ext.chart.Series.prototype =\r
-{\r
- /**\r
- * The type of series.\r
- *\r
- * @property type\r
- * @type String\r
- */\r
- type: null,\r
-\r
- /**\r
- * The human-readable name of the series.\r
- *\r
- * @property displayName\r
- * @type String\r
- */\r
- displayName: null\r
-};\r
-\r
-/**\r
- * @class Ext.chart.CartesianSeries\r
- * @extends Ext.chart.Series\r
- * CartesianSeries class for the charts widget.\r
- * @constructor\r
- */\r
-Ext.chart.CartesianSeries = Ext.extend(Ext.chart.Series, {\r
- /**\r
- * The field used to access the x-axis value from the items from the data source.\r
- *\r
- * @property xField\r
- * @type String\r
- */\r
- xField: null,\r
-\r
- /**\r
- * The field used to access the y-axis value from the items from the data source.\r
- *\r
- * @property yField\r
- * @type String\r
- */\r
- yField: null\r
-});\r
-\r
-/**\r
- * @class Ext.chart.ColumnSeries\r
- * @extends Ext.chart.CartesianSeries\r
- * ColumnSeries class for the charts widget.\r
- * @constructor\r
- */\r
-Ext.chart.ColumnSeries = Ext.extend(Ext.chart.CartesianSeries, {\r
- type: "column"\r
-});\r
-\r
-/**\r
- * @class Ext.chart.LineSeries\r
- * @extends Ext.chart.CartesianSeries\r
- * LineSeries class for the charts widget.\r
- * @constructor\r
- */\r
-Ext.chart.LineSeries = Ext.extend(Ext.chart.CartesianSeries, {\r
- type: "line"\r
-});\r
-\r
-/**\r
- * @class Ext.chart.BarSeries\r
- * @extends Ext.chart.CartesianSeries\r
- * BarSeries class for the charts widget.\r
- * @constructor\r
- */\r
-Ext.chart.BarSeries = Ext.extend(Ext.chart.CartesianSeries, {\r
- type: "bar"\r
-});\r
-\r
-\r
-/**\r
- * @class Ext.chart.PieSeries\r
- * @extends Ext.chart.Series\r
- * PieSeries class for the charts widget.\r
- * @constructor\r
- */\r
-Ext.chart.PieSeries = Ext.extend(Ext.chart.Series, {\r
- type: "pie",\r
- dataField: null,\r
- categoryField: null\r
+Ext.reg('flash', Ext.FlashComponent);/**
+ * @class Ext.FlashProxy
+ * @singleton
+ */
+Ext.FlashEventProxy = {
+ onEvent : function(id, e){
+ var fp = Ext.getCmp(id);
+ if(fp){
+ fp.onFlashEvent(e);
+ }else{
+ arguments.callee.defer(10, this, [id, e]);
+ }
+ }
+};/**
+ * @class Ext.chart.Chart
+ * @extends Ext.FlashComponent
+ * The Ext.chart package provides the capability to visualize data with flash based charting.
+ * Each chart binds directly to an Ext.data.Store enabling automatic updates of the chart.
+ * To change the look and feel of a chart, see the {@link #chartStyle} and {@link #extraStyle} config options.
+ * @constructor
+ * @xtype chart
+ */
+
+ Ext.chart.Chart = Ext.extend(Ext.FlashComponent, {
+ refreshBuffer: 100,
+
+ /**
+ * @cfg {String} backgroundColor
+ * @hide
+ */
+
+ /**
+ * @cfg {Object} chartStyle
+ * Sets styles for this chart. This contains default styling, so modifying this property will <b>override</b>
+ * the built in styles of the chart. Use {@link #extraStyle} to add customizations to the default styling.
+ */
+ chartStyle: {
+ padding: 10,
+ animationEnabled: true,
+ font: {
+ name: 'Tahoma',
+ color: 0x444444,
+ size: 11
+ },
+ dataTip: {
+ padding: 5,
+ border: {
+ color: 0x99bbe8,
+ size:1
+ },
+ background: {
+ color: 0xDAE7F6,
+ alpha: .9
+ },
+ font: {
+ name: 'Tahoma',
+ color: 0x15428B,
+ size: 10,
+ bold: true
+ }
+ }
+ },
+
+ /**
+ * @cfg {String} url
+ * The url to load the chart from. This defaults to Ext.chart.Chart.CHART_URL, which should
+ * be modified to point to the local charts resource.
+ */
+
+ /**
+ * @cfg {Object} extraStyle
+ * Contains extra styles that will be added or overwritten to the default chartStyle. Defaults to <tt>null</tt>.
+ * For a detailed list of the options available, visit the YUI Charts site
+ * at <a href="http://developer.yahoo.com/yui/charts/#basicstyles">http://developer.yahoo.com/yui/charts/#basicstyles</a><br/>
+ * Some of the options availabe:<br />
+ * <ul style="padding:5px;padding-left:16px;list-style-type:inherit;">
+ * <li><b>padding</b> - The space around the edge of the chart's contents. Padding does not increase the size of the chart.</li>
+ * <li><b>animationEnabled</b> - A Boolean value that specifies whether marker animations are enabled or not. Enabled by default.</li>
+ * <li><b>font</b> - An Object defining the font style to be used in the chart. Defaults to <tt>{ name: 'Tahoma', color: 0x444444, size: 11 }</tt><br/>
+ * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
+ * <li><b>name</b> - font name</li>
+ * <li><b>color</b> - font color (hex code, ie: "#ff0000", "ff0000" or 0xff0000)</li>
+ * <li><b>size</b> - font size in points (numeric portion only, ie: 11)</li>
+ * <li><b>bold</b> - boolean</li>
+ * <li><b>italic</b> - boolean</li>
+ * <li><b>underline</b> - boolean</li>
+ * </ul>
+ * </li>
+ * <li><b>border</b> - An object defining the border style around the chart. The chart itself will decrease in dimensions to accomodate the border.<br/>
+ * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
+ * <li><b>color</b> - border color (hex code, ie: "#ff0000", "ff0000" or 0xff0000)</li>
+ * <li><b>size</b> - border size in pixels (numeric portion only, ie: 1)</li>
+ * </ul>
+ * </li>
+ * <li><b>background</b> - An object defining the background style of the chart.<br/>
+ * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
+ * <li><b>color</b> - border color (hex code, ie: "#ff0000", "ff0000" or 0xff0000)</li>
+ * <li><b>image</b> - an image URL. May be relative to the current document or absolute.</li>
+ * </ul>
+ * </li>
+ * <li><b>legend</b> - An object defining the legend style<br/>
+ * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
+ * <li><b>display</b> - location of the legend. Possible values are "none", "left", "right", "top", and "bottom".</li>
+ * <li><b>spacing</b> - an image URL. May be relative to the current document or absolute.</li>
+ * <li><b>padding, border, background, font</b> - same options as described above.</li>
+ * </ul></li>
+ * <li><b>dataTip</b> - An object defining the style of the data tip (tooltip).<br/>
+ * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
+ * <li><b>padding, border, background, font</b> - same options as described above.</li>
+ * </ul></li>
+ * <li><b>xAxis and yAxis</b> - An object defining the style of the style of either axis.<br/>
+ * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
+ * <li><b>color</b> - same option as described above.</li>
+ * <li><b>size</b> - same option as described above.</li>
+ * <li><b>showLabels</b> - boolean</li>
+ * <li><b>labelRotation</b> - a value in degrees from -90 through 90. Default is zero.</li>
+ * </ul></li>
+ * <li><b>majorGridLines and minorGridLines</b> - An object defining the style of the style of the grid lines.<br/>
+ * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
+ * <li><b>color, size</b> - same options as described above.</li>
+ * </ul></li></li>
+ * <li><b>zeroGridLine</b> - An object defining the style of the style of the zero grid line.<br/>
+ * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
+ * <li><b>color, size</b> - same options as described above.</li>
+ * </ul></li></li>
+ * <li><b>majorTicks and minorTicks</b> - An object defining the style of the style of ticks in the chart.<br/>
+ * <ul style="padding:5px;padding-left:26px;list-style-type:circle;">
+ * <li><b>color, size</b> - same options as described above.</li>
+ * <li><b>length</b> - the length of each tick in pixels extending from the axis.</li>
+ * <li><b>display</b> - how the ticks are drawn. Possible values are "none", "inside", "outside", and "cross".</li>
+ * </ul></li></li>
+ * </ul>
+ */
+ extraStyle: null,
+
+ /**
+ * @cfg {Object} seriesStyles
+ * Contains styles to apply to the series after a refresh. Defaults to <tt>null</tt>.
+ */
+ seriesStyles: null,
+
+ /**
+ * @cfg {Boolean} disableCaching
+ * True to add a "cache buster" to the end of the chart url. Defaults to true for Opera and IE.
+ */
+ disableCaching: Ext.isIE || Ext.isOpera,
+ disableCacheParam: '_dc',
+
+ initComponent : function(){
+ Ext.chart.Chart.superclass.initComponent.call(this);
+ if(!this.url){
+ this.url = Ext.chart.Chart.CHART_URL;
+ }
+ if(this.disableCaching){
+ this.url = Ext.urlAppend(this.url, String.format('{0}={1}', this.disableCacheParam, new Date().getTime()));
+ }
+ this.addEvents(
+ 'itemmouseover',
+ 'itemmouseout',
+ 'itemclick',
+ 'itemdoubleclick',
+ 'itemdragstart',
+ 'itemdrag',
+ 'itemdragend',
+ /**
+ * @event beforerefresh
+ * Fires before a refresh to the chart data is called. If the beforerefresh handler returns
+ * <tt>false</tt> the {@link #refresh} action will be cancelled.
+ * @param {Chart} this
+ */
+ 'beforerefresh',
+ /**
+ * @event refresh
+ * Fires after the chart data has been refreshed.
+ * @param {Chart} this
+ */
+ 'refresh'
+ );
+ this.store = Ext.StoreMgr.lookup(this.store);
+ },
+
+ /**
+ * Sets a single style value on the Chart instance.
+ *
+ * @param name {String} Name of the Chart style value to change.
+ * @param value {Object} New value to pass to the Chart style.
+ */
+ setStyle: function(name, value){
+ this.swf.setStyle(name, Ext.encode(value));
+ },
+
+ /**
+ * Resets all styles on the Chart instance.
+ *
+ * @param styles {Object} Initializer for all Chart styles.
+ */
+ setStyles: function(styles){
+ this.swf.setStyles(Ext.encode(styles));
+ },
+
+ /**
+ * Sets the styles on all series in the Chart.
+ *
+ * @param styles {Array} Initializer for all Chart series styles.
+ */
+ setSeriesStyles: function(styles){
+ this.seriesStyles = styles;
+ var s = [];
+ Ext.each(styles, function(style){
+ s.push(Ext.encode(style));
+ });
+ this.swf.setSeriesStyles(s);
+ },
+
+ setCategoryNames : function(names){
+ this.swf.setCategoryNames(names);
+ },
+
+ setLegendRenderer : function(fn, scope){
+ var chart = this;
+ scope = scope || chart;
+ chart.removeFnProxy(chart.legendFnName);
+ chart.legendFnName = chart.createFnProxy(function(name){
+ return fn.call(scope, name);
+ });
+ chart.swf.setLegendLabelFunction(chart.legendFnName);
+ },
+
+ setTipRenderer : function(fn, scope){
+ var chart = this;
+ scope = scope || chart;
+ chart.removeFnProxy(chart.tipFnName);
+ chart.tipFnName = chart.createFnProxy(function(item, index, series){
+ var record = chart.store.getAt(index);
+ return fn.call(scope, chart, record, index, series);
+ });
+ chart.swf.setDataTipFunction(chart.tipFnName);
+ },
+
+ setSeries : function(series){
+ this.series = series;
+ this.refresh();
+ },
+
+ /**
+ * Changes the data store bound to this chart and refreshes it.
+ * @param {Store} store The store to bind to this chart
+ */
+ bindStore : function(store, initial){
+ if(!initial && this.store){
+ if(store !== this.store && this.store.autoDestroy){
+ this.store.destroy();
+ }else{
+ this.store.un("datachanged", this.refresh, this);
+ this.store.un("add", this.delayRefresh, this);
+ this.store.un("remove", this.delayRefresh, this);
+ this.store.un("update", this.delayRefresh, this);
+ this.store.un("clear", this.refresh, this);
+ }
+ }
+ if(store){
+ store = Ext.StoreMgr.lookup(store);
+ store.on({
+ scope: this,
+ datachanged: this.refresh,
+ add: this.delayRefresh,
+ remove: this.delayRefresh,
+ update: this.delayRefresh,
+ clear: this.refresh
+ });
+ }
+ this.store = store;
+ if(store && !initial){
+ this.refresh();
+ }
+ },
+
+ onSwfReady : function(isReset){
+ Ext.chart.Chart.superclass.onSwfReady.call(this, isReset);
+ var ref;
+ this.swf.setType(this.type);
+
+ if(this.chartStyle){
+ this.setStyles(Ext.apply({}, this.extraStyle, this.chartStyle));
+ }
+
+ if(this.categoryNames){
+ this.setCategoryNames(this.categoryNames);
+ }
+
+ if(this.tipRenderer){
+ ref = this.getFunctionRef(this.tipRenderer);
+ this.setTipRenderer(ref.fn, ref.scope);
+ }
+ if(this.legendRenderer){
+ ref = this.getFunctionRef(this.legendRenderer);
+ this.setLegendRenderer(ref.fn, ref.scope);
+ }
+ if(!isReset){
+ this.bindStore(this.store, true);
+ }
+ this.refresh.defer(10, this);
+ },
+
+ delayRefresh : function(){
+ if(!this.refreshTask){
+ this.refreshTask = new Ext.util.DelayedTask(this.refresh, this);
+ }
+ this.refreshTask.delay(this.refreshBuffer);
+ },
+
+ refresh : function(){
+ if(this.fireEvent('beforerefresh', this) !== false){
+ var styleChanged = false;
+ // convert the store data into something YUI charts can understand
+ var data = [], rs = this.store.data.items;
+ for(var j = 0, len = rs.length; j < len; j++){
+ data[j] = rs[j].data;
+ }
+ //make a copy of the series definitions so that we aren't
+ //editing them directly.
+ var dataProvider = [];
+ var seriesCount = 0;
+ var currentSeries = null;
+ var i = 0;
+ if(this.series){
+ seriesCount = this.series.length;
+ for(i = 0; i < seriesCount; i++){
+ currentSeries = this.series[i];
+ var clonedSeries = {};
+ for(var prop in currentSeries){
+ if(prop == "style" && currentSeries.style !== null){
+ clonedSeries.style = Ext.encode(currentSeries.style);
+ styleChanged = true;
+ //we don't want to modify the styles again next time
+ //so null out the style property.
+ // this causes issues
+ // currentSeries.style = null;
+ } else{
+ clonedSeries[prop] = currentSeries[prop];
+ }
+ }
+ dataProvider.push(clonedSeries);
+ }
+ }
+
+ if(seriesCount > 0){
+ for(i = 0; i < seriesCount; i++){
+ currentSeries = dataProvider[i];
+ if(!currentSeries.type){
+ currentSeries.type = this.type;
+ }
+ currentSeries.dataProvider = data;
+ }
+ } else{
+ dataProvider.push({type: this.type, dataProvider: data});
+ }
+ this.swf.setDataProvider(dataProvider);
+ if(this.seriesStyles){
+ this.setSeriesStyles(this.seriesStyles);
+ }
+ this.fireEvent('refresh', this);
+ }
+ },
+
+ // private
+ createFnProxy : function(fn){
+ var fnName = 'extFnProxy' + (++Ext.chart.Chart.PROXY_FN_ID);
+ Ext.chart.Chart.proxyFunction[fnName] = fn;
+ return 'Ext.chart.Chart.proxyFunction.' + fnName;
+ },
+
+ // private
+ removeFnProxy : function(fn){
+ if(!Ext.isEmpty(fn)){
+ fn = fn.replace('Ext.chart.Chart.proxyFunction.', '');
+ delete Ext.chart.Chart.proxyFunction[fn];
+ }
+ },
+
+ // private
+ getFunctionRef : function(val){
+ if(Ext.isFunction(val)){
+ return {
+ fn: val,
+ scope: this
+ };
+ }else{
+ return {
+ fn: val.fn,
+ scope: val.scope || this
+ };
+ }
+ },
+
+ // private
+ onDestroy: function(){
+ if (this.refreshTask && this.refreshTask.cancel){
+ this.refreshTask.cancel();
+ }
+ Ext.chart.Chart.superclass.onDestroy.call(this);
+ this.bindStore(null);
+ this.removeFnProxy(this.tipFnName);
+ this.removeFnProxy(this.legendFnName);
+ }
+});
+Ext.reg('chart', Ext.chart.Chart);
+Ext.chart.Chart.PROXY_FN_ID = 0;
+Ext.chart.Chart.proxyFunction = {};
+
+/**
+ * Sets the url to load the chart from. This should be set to a local resource.
+ * @static
+ * @type String
+ */
+Ext.chart.Chart.CHART_URL = 'http:/' + '/yui.yahooapis.com/2.8.2/build/charts/assets/charts.swf';
+
+/**
+ * @class Ext.chart.PieChart
+ * @extends Ext.chart.Chart
+ * @constructor
+ * @xtype piechart
+ */
+Ext.chart.PieChart = Ext.extend(Ext.chart.Chart, {
+ type: 'pie',
+
+ onSwfReady : function(isReset){
+ Ext.chart.PieChart.superclass.onSwfReady.call(this, isReset);
+
+ this.setDataField(this.dataField);
+ this.setCategoryField(this.categoryField);
+ },
+
+ setDataField : function(field){
+ this.dataField = field;
+ this.swf.setDataField(field);
+ },
+
+ setCategoryField : function(field){
+ this.categoryField = field;
+ this.swf.setCategoryField(field);
+ }
+});
+Ext.reg('piechart', Ext.chart.PieChart);
+
+/**
+ * @class Ext.chart.CartesianChart
+ * @extends Ext.chart.Chart
+ * @constructor
+ * @xtype cartesianchart
+ */
+Ext.chart.CartesianChart = Ext.extend(Ext.chart.Chart, {
+ onSwfReady : function(isReset){
+ Ext.chart.CartesianChart.superclass.onSwfReady.call(this, isReset);
+ this.labelFn = [];
+ if(this.xField){
+ this.setXField(this.xField);
+ }
+ if(this.yField){
+ this.setYField(this.yField);
+ }
+ if(this.xAxis){
+ this.setXAxis(this.xAxis);
+ }
+ if(this.xAxes){
+ this.setXAxes(this.xAxes);
+ }
+ if(this.yAxis){
+ this.setYAxis(this.yAxis);
+ }
+ if(this.yAxes){
+ this.setYAxes(this.yAxes);
+ }
+ if(Ext.isDefined(this.constrainViewport)){
+ this.swf.setConstrainViewport(this.constrainViewport);
+ }
+ },
+
+ setXField : function(value){
+ this.xField = value;
+ this.swf.setHorizontalField(value);
+ },
+
+ setYField : function(value){
+ this.yField = value;
+ this.swf.setVerticalField(value);
+ },
+
+ setXAxis : function(value){
+ this.xAxis = this.createAxis('xAxis', value);
+ this.swf.setHorizontalAxis(this.xAxis);
+ },
+
+ setXAxes : function(value){
+ var axis;
+ for(var i = 0; i < value.length; i++) {
+ axis = this.createAxis('xAxis' + i, value[i]);
+ this.swf.setHorizontalAxis(axis);
+ }
+ },
+
+ setYAxis : function(value){
+ this.yAxis = this.createAxis('yAxis', value);
+ this.swf.setVerticalAxis(this.yAxis);
+ },
+
+ setYAxes : function(value){
+ var axis;
+ for(var i = 0; i < value.length; i++) {
+ axis = this.createAxis('yAxis' + i, value[i]);
+ this.swf.setVerticalAxis(axis);
+ }
+ },
+
+ createAxis : function(axis, value){
+ var o = Ext.apply({}, value),
+ ref,
+ old;
+
+ if(this[axis]){
+ old = this[axis].labelFunction;
+ this.removeFnProxy(old);
+ this.labelFn.remove(old);
+ }
+ if(o.labelRenderer){
+ ref = this.getFunctionRef(o.labelRenderer);
+ o.labelFunction = this.createFnProxy(function(v){
+ return ref.fn.call(ref.scope, v);
+ });
+ delete o.labelRenderer;
+ this.labelFn.push(o.labelFunction);
+ }
+ if(axis.indexOf('xAxis') > -1 && o.position == 'left'){
+ o.position = 'bottom';
+ }
+ return o;
+ },
+
+ onDestroy : function(){
+ Ext.chart.CartesianChart.superclass.onDestroy.call(this);
+ Ext.each(this.labelFn, function(fn){
+ this.removeFnProxy(fn);
+ }, this);
+ }
+});
+Ext.reg('cartesianchart', Ext.chart.CartesianChart);
+
+/**
+ * @class Ext.chart.LineChart
+ * @extends Ext.chart.CartesianChart
+ * @constructor
+ * @xtype linechart
+ */
+Ext.chart.LineChart = Ext.extend(Ext.chart.CartesianChart, {
+ type: 'line'
+});
+Ext.reg('linechart', Ext.chart.LineChart);
+
+/**
+ * @class Ext.chart.ColumnChart
+ * @extends Ext.chart.CartesianChart
+ * @constructor
+ * @xtype columnchart
+ */
+Ext.chart.ColumnChart = Ext.extend(Ext.chart.CartesianChart, {
+ type: 'column'
+});
+Ext.reg('columnchart', Ext.chart.ColumnChart);
+
+/**
+ * @class Ext.chart.StackedColumnChart
+ * @extends Ext.chart.CartesianChart
+ * @constructor
+ * @xtype stackedcolumnchart
+ */
+Ext.chart.StackedColumnChart = Ext.extend(Ext.chart.CartesianChart, {
+ type: 'stackcolumn'
+});
+Ext.reg('stackedcolumnchart', Ext.chart.StackedColumnChart);
+
+/**
+ * @class Ext.chart.BarChart
+ * @extends Ext.chart.CartesianChart
+ * @constructor
+ * @xtype barchart
+ */
+Ext.chart.BarChart = Ext.extend(Ext.chart.CartesianChart, {
+ type: 'bar'
+});
+Ext.reg('barchart', Ext.chart.BarChart);
+
+/**
+ * @class Ext.chart.StackedBarChart
+ * @extends Ext.chart.CartesianChart
+ * @constructor
+ * @xtype stackedbarchart
+ */
+Ext.chart.StackedBarChart = Ext.extend(Ext.chart.CartesianChart, {
+ type: 'stackbar'
+});
+Ext.reg('stackedbarchart', Ext.chart.StackedBarChart);
+
+
+
+/**
+ * @class Ext.chart.Axis
+ * Defines a CartesianChart's vertical or horizontal axis.
+ * @constructor
+ */
+Ext.chart.Axis = function(config){
+ Ext.apply(this, config);
+};
+
+Ext.chart.Axis.prototype =
+{
+ /**
+ * The type of axis.
+ *
+ * @property type
+ * @type String
+ */
+ type: null,
+
+ /**
+ * The direction in which the axis is drawn. May be "horizontal" or "vertical".
+ *
+ * @property orientation
+ * @type String
+ */
+ orientation: "horizontal",
+
+ /**
+ * If true, the items on the axis will be drawn in opposite direction.
+ *
+ * @property reverse
+ * @type Boolean
+ */
+ reverse: false,
+
+ /**
+ * A string reference to the globally-accessible function that may be called to
+ * determine each of the label values for this axis.
+ *
+ * @property labelFunction
+ * @type String
+ */
+ labelFunction: null,
+
+ /**
+ * If true, labels that overlap previously drawn labels on the axis will be hidden.
+ *
+ * @property hideOverlappingLabels
+ * @type Boolean
+ */
+ hideOverlappingLabels: true,
+
+ /**
+ * The space, in pixels, between labels on an axis.
+ *
+ * @property labelSpacing
+ * @type Number
+ */
+ labelSpacing: 2
+};
+
+/**
+ * @class Ext.chart.NumericAxis
+ * @extends Ext.chart.Axis
+ * A type of axis whose units are measured in numeric values.
+ * @constructor
+ */
+Ext.chart.NumericAxis = Ext.extend(Ext.chart.Axis, {
+ type: "numeric",
+
+ /**
+ * The minimum value drawn by the axis. If not set explicitly, the axis
+ * minimum will be calculated automatically.
+ *
+ * @property minimum
+ * @type Number
+ */
+ minimum: NaN,
+
+ /**
+ * The maximum value drawn by the axis. If not set explicitly, the axis
+ * maximum will be calculated automatically.
+ *
+ * @property maximum
+ * @type Number
+ */
+ maximum: NaN,
+
+ /**
+ * The spacing between major intervals on this axis.
+ *
+ * @property majorUnit
+ * @type Number
+ */
+ majorUnit: NaN,
+
+ /**
+ * The spacing between minor intervals on this axis.
+ *
+ * @property minorUnit
+ * @type Number
+ */
+ minorUnit: NaN,
+
+ /**
+ * If true, the labels, ticks, gridlines, and other objects will snap to the
+ * nearest major or minor unit. If false, their position will be based on
+ * the minimum value.
+ *
+ * @property snapToUnits
+ * @type Boolean
+ */
+ snapToUnits: true,
+
+ /**
+ * If true, and the bounds are calculated automatically, either the minimum
+ * or maximum will be set to zero.
+ *
+ * @property alwaysShowZero
+ * @type Boolean
+ */
+ alwaysShowZero: true,
+
+ /**
+ * The scaling algorithm to use on this axis. May be "linear" or
+ * "logarithmic".
+ *
+ * @property scale
+ * @type String
+ */
+ scale: "linear",
+
+ /**
+ * Indicates whether to round the major unit.
+ *
+ * @property roundMajorUnit
+ * @type Boolean
+ */
+ roundMajorUnit: true,
+
+ /**
+ * Indicates whether to factor in the size of the labels when calculating a
+ * major unit.
+ *
+ * @property calculateByLabelSize
+ * @type Boolean
+ */
+ calculateByLabelSize: true,
+
+ /**
+ * Indicates the position of the axis relative to the chart
+ *
+ * @property position
+ * @type String
+ */
+ position: 'left',
+
+ /**
+ * Indicates whether to extend maximum beyond data's maximum to the nearest
+ * majorUnit.
+ *
+ * @property adjustMaximumByMajorUnit
+ * @type Boolean
+ */
+ adjustMaximumByMajorUnit: true,
+
+ /**
+ * Indicates whether to extend the minimum beyond data's minimum to the
+ * nearest majorUnit.
+ *
+ * @property adjustMinimumByMajorUnit
+ * @type Boolean
+ */
+ adjustMinimumByMajorUnit: true
+
+});
+
+/**
+ * @class Ext.chart.TimeAxis
+ * @extends Ext.chart.Axis
+ * A type of axis whose units are measured in time-based values.
+ * @constructor
+ */
+Ext.chart.TimeAxis = Ext.extend(Ext.chart.Axis, {
+ type: "time",
+
+ /**
+ * The minimum value drawn by the axis. If not set explicitly, the axis
+ * minimum will be calculated automatically.
+ *
+ * @property minimum
+ * @type Date
+ */
+ minimum: null,
+
+ /**
+ * The maximum value drawn by the axis. If not set explicitly, the axis
+ * maximum will be calculated automatically.
+ *
+ * @property maximum
+ * @type Number
+ */
+ maximum: null,
+
+ /**
+ * The spacing between major intervals on this axis.
+ *
+ * @property majorUnit
+ * @type Number
+ */
+ majorUnit: NaN,
+
+ /**
+ * The time unit used by the majorUnit.
+ *
+ * @property majorTimeUnit
+ * @type String
+ */
+ majorTimeUnit: null,
+
+ /**
+ * The spacing between minor intervals on this axis.
+ *
+ * @property majorUnit
+ * @type Number
+ */
+ minorUnit: NaN,
+
+ /**
+ * The time unit used by the minorUnit.
+ *
+ * @property majorTimeUnit
+ * @type String
+ */
+ minorTimeUnit: null,
+
+ /**
+ * If true, the labels, ticks, gridlines, and other objects will snap to the
+ * nearest major or minor unit. If false, their position will be based on
+ * the minimum value.
+ *
+ * @property snapToUnits
+ * @type Boolean
+ */
+ snapToUnits: true,
+
+ /**
+ * Series that are stackable will only stack when this value is set to true.
+ *
+ * @property stackingEnabled
+ * @type Boolean
+ */
+ stackingEnabled: false,
+
+ /**
+ * Indicates whether to factor in the size of the labels when calculating a
+ * major unit.
+ *
+ * @property calculateByLabelSize
+ * @type Boolean
+ */
+ calculateByLabelSize: true
+
+});
+
+/**
+ * @class Ext.chart.CategoryAxis
+ * @extends Ext.chart.Axis
+ * A type of axis that displays items in categories.
+ * @constructor
+ */
+Ext.chart.CategoryAxis = Ext.extend(Ext.chart.Axis, {
+ type: "category",
+
+ /**
+ * A list of category names to display along this axis.
+ *
+ * @property categoryNames
+ * @type Array
+ */
+ categoryNames: null,
+
+ /**
+ * Indicates whether or not to calculate the number of categories (ticks and
+ * labels) when there is not enough room to display all labels on the axis.
+ * If set to true, the axis will determine the number of categories to plot.
+ * If not, all categories will be plotted.
+ *
+ * @property calculateCategoryCount
+ * @type Boolean
+ */
+ calculateCategoryCount: false
+
+});
+
+/**
+ * @class Ext.chart.Series
+ * Series class for the charts widget.
+ * @constructor
+ */
+Ext.chart.Series = function(config) { Ext.apply(this, config); };
+
+Ext.chart.Series.prototype =
+{
+ /**
+ * The type of series.
+ *
+ * @property type
+ * @type String
+ */
+ type: null,
+
+ /**
+ * The human-readable name of the series.
+ *
+ * @property displayName
+ * @type String
+ */
+ displayName: null
+};
+
+/**
+ * @class Ext.chart.CartesianSeries
+ * @extends Ext.chart.Series
+ * CartesianSeries class for the charts widget.
+ * @constructor
+ */
+Ext.chart.CartesianSeries = Ext.extend(Ext.chart.Series, {
+ /**
+ * The field used to access the x-axis value from the items from the data
+ * source.
+ *
+ * @property xField
+ * @type String
+ */
+ xField: null,
+
+ /**
+ * The field used to access the y-axis value from the items from the data
+ * source.
+ *
+ * @property yField
+ * @type String
+ */
+ yField: null,
+
+ /**
+ * False to not show this series in the legend. Defaults to <tt>true</tt>.
+ *
+ * @property showInLegend
+ * @type Boolean
+ */
+ showInLegend: true,
+
+ /**
+ * Indicates which axis the series will bind to
+ *
+ * @property axis
+ * @type String
+ */
+ axis: 'primary'
+});
+
+/**
+ * @class Ext.chart.ColumnSeries
+ * @extends Ext.chart.CartesianSeries
+ * ColumnSeries class for the charts widget.
+ * @constructor
+ */
+Ext.chart.ColumnSeries = Ext.extend(Ext.chart.CartesianSeries, {
+ type: "column"
+});
+
+/**
+ * @class Ext.chart.LineSeries
+ * @extends Ext.chart.CartesianSeries
+ * LineSeries class for the charts widget.
+ * @constructor
+ */
+Ext.chart.LineSeries = Ext.extend(Ext.chart.CartesianSeries, {
+ type: "line"
+});
+
+/**
+ * @class Ext.chart.BarSeries
+ * @extends Ext.chart.CartesianSeries
+ * BarSeries class for the charts widget.
+ * @constructor
+ */
+Ext.chart.BarSeries = Ext.extend(Ext.chart.CartesianSeries, {
+ type: "bar"
+});
+
+
+/**
+ * @class Ext.chart.PieSeries
+ * @extends Ext.chart.Series
+ * PieSeries class for the charts widget.
+ * @constructor
+ */
+Ext.chart.PieSeries = Ext.extend(Ext.chart.Series, {
+ type: "pie",
+ dataField: null,
+ categoryField: null
});
\ No newline at end of file