EVME_HOSTING_PATH = "http://esprelive.com/projects/wren/els3.0.0.0009g.15/hosting/"; EVME_XSL_PATH = "http://esprelive.com/projects/wren/els3.0.0.0009g.15/mediaengine/"; EVME_HOST_DOMAIN = "esprelive.com"; EVME_CHAT_PATH = "http://esprelive.com/projects/wren/els3.0.0.0009g.15/chat/ChannelManager.php"; EVME_VXN_ADDR = "74.53.191.98"; EVME_VXN_PORT = "443"; EVME_RTPR_ADDR = "74.53.191.98"; EVME_RTPR_PORT = "8080"; EVME_RTPR_CTRL_PORT = "8083"; EVME_PRODUCT_TYPE = "UNSIGNED_PLAYER"; EVME_PRODUCT_FOLDER = "LivePlayer"; EVME_ACTOR_TYPE = "unsignedActor"; //Actor.sdlPathType = "absolute"; function ComponentFactory(){ this.codebase = "http://esprelive.com/projects/wren/els3.0.0.0009g.15/mediaengine/components/"; var componentdata = eval({"components":{"liveapplet":{"code":"es.applet.EspreLiveService","cache_archive":"EspreLiveService_signed.jar,commons-logging-api-1.1.jar,commons-httpclient-3.0.1.jar,commons-codec-1.2.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0","package_spec":""},"signedActor":{"code":"es.applet.StreamActor","cache_archive":"EspreLiveService_signed.jar,commons-logging-api-1.1.jar,commons-httpclient-3.0.1.jar,commons-codec-1.2.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0"},"sdlWriter":{"code":"es.theater.ClipContextApplet","cache_archive":"EspreLiveService_signed.jar,commons-logging-api-1.1.jar,commons-httpclient-3.0.1.jar,commons-codec-1.2.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0"},"SIGNED_PLAYER":{"code":"es.applet.EspreLiveService","cache_archive":"EspreLiveService_signed.jar,commons-logging-api-1.1.jar,commons-httpclient-3.0.1.jar,commons-codec-1.2.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0","package_spec":"LivePlayer"},"unsignedActor":{"code":"es.applet.StreamActor","cache_archive":"EspreLiveService.jar,commons-logging-api-1.1_unsigned.jar","\/\/cache_version":"1.0.0.0,1.0.0.0","package_spec":""},"UNSIGNED_PLAYER":{"code":"es.applet.EspreLiveService","cache_archive":"EspreLiveService.jar,commons-logging-api-1.1_unsigned.jar","\/\/cache_version":"1.0.0.0,1.0.0.0","package_spec":""},"EMMS":{"code":"espre.EmmsLoaderJApplet","cache_archive":"EmmsLoaderLibrary.jar","\/\/cache_version":"1.0.0.0,1.0.0.0","package_spec":""}}}); this.getAppletInformation = function (appletType) { if (componentdata['components'][appletType] != "" || componentdata['components'][appletType] != "undefined") { return componentdata['components'][appletType]; } else { return false; } } } function Stream() { var that = this; this.doc = null; var JSInterfaceObject = JSInterface.theInstance(); JSInterfaceObject.getLogger("Stream",callbackForEncoderLogger);//Call to Java Script Interface Object for Encoder Logger function callbackForEncoderLogger(loggerObject) { loggerJObject = loggerObject; } this.processResult = function(_callingMethod, _status){ if(arguments.length < 2) return true; if(_status == true || _status == 1){ return true; } else { ErrorCode.log(_callingMethod,_status,1); //warn return false; } } var _uri = null; var _isInput = null; if (arguments.length == 3) { _uri = arguments[0]; if (arguments[1] !== null) { _isInput = arguments[1]; } else { _isInput = true; } this.doc = arguments[2]; } else if (arguments.length == 2) { _uri = arguments[0]; _isInput = arguments[1]; } else if(arguments.length == 1) { _uri = arguments[0]; _isInput = true; } else { // Invalid parameter. Error var errorString = 'Stream. INVALID PARAMETER'; directorTrace(errorString); throw(errorString); return null; } if (this.doc === null) { this.doc = window; } this.Event = EventManager; this.Event(this.doc); directorTrace('Stream constructor: this.routeid=' + this.routeid); _uri = Stream.ResolveUri(_uri,_isInput); // similar to resolveClip //Is it an avi file if ((_uri.toLowerCase().indexOf("ifile:/") >= 0) && (_uri.toLowerCase().indexOf(".avi") > 0)) { this.stream = AVIStream; } //if uri is of encoded form else if ((_uri.toLowerCase().indexOf("ifile:/") >= 0) || (_uri.toLowerCase().indexOf("http://") >= 0) || (_uri.toLowerCase().indexOf("https://") >= 0) || (_uri.toLowerCase().indexOf("hosting://") >= 0) || (_uri.toLowerCase().indexOf("rtpr://") >= 0)){ this.stream = LSVXStream; } else if (_uri.toLowerCase().indexOf("irtp:/") >= 0) { this.stream = IRTPStream; } else if (_uri.toLowerCase().indexOf("ortp:/") >= 0) { this.stream = ORTPStream; }else if (_uri.toLowerCase().indexOf("device:/") >= 0) { this.stream = DeviceStream; } else if (_uri.toLowerCase().indexOf("ofile:/") >= 0) { this.stream = OAVIStream; } else { //return currenSource; //Log error //alert ("ERROR: Unknown type!"); //this.processResult("Stream Construction") var errorString = 'Stream. UNKNOWN STREAM TYPE'; directorTrace(errorString); throw(errorString); return null; } this.stream(_uri); } Stream.IsAStreamInstance = function(_newStream) { if (_newStream instanceof Stream){ return true; } if (EVME_PRODUCT_TYPE == "liveApplet") { //The following if statement may not be necessary,if the all stream objects are created by the actor. if ((_newStream instanceof AVIStream) || (_newStream instanceof DeviceStream) || (_newStream instanceof LSVXStream) || (_newStream instanceof IRTPStream) || (_newStream instanceof ORTPStream) || (_newStream instanceof OAVIStream)) { return true; } // throw exception //alert("Invalid Stream type"); return false; } else { if (_newStream instanceof LSVXStream){ return true; } return false; } } Stream.ResolveUri = function(_uri,_type) { var resolvedUri = null; var async = false; if (_uri && (_uri.length > 0)) { if (_uri.indexOf('http://') >= 0 || _uri.indexOf('https://') >= 0 || _uri.indexOf('device:/') >= 0) { resolvedUri = _uri; } else if ((_uri.indexOf('rtp://') >= 0) && _type){ resolvedUri = "i" + _uri; } else if ((_uri.indexOf('rtp://') >= 0) && Stream.IsBoolean(_type)){ resolvedUri = "o" + _uri; } else if ((_uri.indexOf('file:/') >= 0) && _type){ resolvedUri = "i" + _uri; } else if ((_uri.indexOf('file:/') >= 0) && Stream.IsBoolean(_type)){ resolvedUri = "o" + _uri; } else if ((_uri.indexOf('hosting://') >= 0) && Stream.IsBoolean(_type)){ resolvedUri = _uri; //Stream.ResolveHostingUri(_uri.substring(10)); } else if ((_uri.indexOf('rtpr://') >= 0) && Stream.IsBoolean(_type)){ resolvedUri = _uri; //Stream.ResolveHostingUri(_uri.substring(10)); } else { //TODO: alert ("URI COULD NOT BE RESOLVED!"); } //TODO: Resolve theHosting agent types uri's. } return resolvedUri.trim(); } //TODO: TO BE REMOVED--- MAY NOT BE NEEDED ANYMORE Stream.ResolveHostingUri = function(_input){ var hostingResolved = null; var defaultSdl = 'video_s1.dat.sdl'; var uriPath = _input.split('/'); var defaultNS = "default"; var _project = null; if(uriPath.length == 1){ _project = uriPath[0]; } else if(uriPath.length == 2){ defaultNS = uriPath[0]; _project = uriPath[1]; } var _myHosting = new HostingAgent(); //_myHosting.setNamespace(defaultNS); hostingResolved = _myHosting.getDefaultFile + defaultNS + '/' + _project + '/' + defaultSdl; return hostingResolved; } Stream.UNKNOWN = -1; Stream.STOPPED = 0; Stream.PLAYING = 1; Stream.PLAYING_END = 2; Stream.PAUSED = 3; Stream.FORWARDING = 4; Stream.REVERSING = 5; Stream.INITIALIZING = 6; Stream.STREAM_STATE = { '-1': 'UNKNOWN','0':'STOPPED', '1':'PLAYING','2':'PLAYING_END','3':'PAUSED', '4':'FORWARDING','5':'REVERSING', '6':'INITIALIZING'}; Stream.CurrentState = function(_cState){ return ((Stream.STREAM_STATE[_cState] != null)? Stream.STREAM_STATE[_cState] : Stream.STREAM_STATE['-1']); } Stream.IsNumeric = function(sText) { return !(isNaN(sText)); } Stream.getStreamInstance = function(_id){ return Stream.streamArray[_id]; } Stream.removeStreamInstance = function(_id) { delete Stream.streamArray[_id]; } Stream.streamArray = new Array(); String.prototype.startsWith = function(aString) { return this.indexOf(aString) == 0; } Stream.IsString = function (o) { return ((o != null) && (typeof o == 'string')); } Stream.IsBoolean = function (o) { return ((o != null) && (typeof o == 'boolean')); } String.prototype.endsWith = function (suffix) { return this.substring(this.length - suffix.length) == suffix; } String.prototype.trim = function() { return this.replace(/^\s*|\s*$/g,''); } if (!String.prototype.strip) { String.prototype.strip = function() { return this.replace(/^\s*(.*?)\s*$/, "$1"); }; } /** * @ignore * @fileoverview */ /* Copyright (c) 2004-2006, The Dojo Foundation All Rights Reserved. Licensed under the Academic Free License version 2.1 or above OR the modified BSD license. For more information on Dojo licensing, see: http://dojotoolkit.org/community/licensing.shtml */ /* This is a compiled version of Dojo, built for deployment and not for development. To get an editable version, please visit: http://dojotoolkit.org for documentation and information on getting the source. */ if(typeof dojo=="undefined"){ var dj_global=this; var dj_currentContext=this; function dj_undef(_1,_2){ return (typeof (_2||dj_currentContext)[_1]=="undefined"); } if(dj_undef("djConfig",this)){ var djConfig={}; } if(dj_undef("dojo",this)){ var dojo={}; } dojo.global=function(){ return dj_currentContext; }; dojo.locale=djConfig.locale; dojo.version={major:0,minor:4,patch:0,flag:"",revision:Number("$Rev: 6258 $".match(/[0-9]+/)[0]),toString:function(){ with(dojo.version){ return major+"."+minor+"."+patch+flag+" ("+revision+")"; } }}; dojo.evalProp=function(_3,_4,_5){ if((!_4)||(!_3)){ return undefined; } if(!dj_undef(_3,_4)){ return _4[_3]; } return (_5?(_4[_3]={}):undefined); }; dojo.parseObjPath=function(_6,_7,_8){ var _9=(_7||dojo.global()); var _a=_6.split("."); var _b=_a.pop(); for(var i=0,l=_a.length;i1){ dh.modulesLoadedListeners.push(function(){ obj[_3d](); }); } } if(dh.post_load_&&dh.inFlightCount==0&&!dh.loadNotifying){ dh.callLoaded(); } }; dojo.addOnUnload=function(obj,_40){ var dh=dojo.hostenv; if(arguments.length==1){ dh.unloadListeners.push(obj); }else{ if(arguments.length>1){ dh.unloadListeners.push(function(){ obj[_40](); }); } } }; dojo.hostenv.modulesLoaded=function(){ if(this.post_load_){ return; } if(this.loadUriStack.length==0&&this.getTextStack.length==0){ if(this.inFlightCount>0){ dojo.debug("files still in flight!"); return; } dojo.hostenv.callLoaded(); } }; dojo.hostenv.callLoaded=function(){ if(typeof setTimeout=="object"){ setTimeout("dojo.hostenv.loaded();",0); }else{ dojo.hostenv.loaded(); } }; dojo.hostenv.getModuleSymbols=function(_42){ var _43=_42.split("."); for(var i=_43.length;i>0;i--){ var _45=_43.slice(0,i).join("."); if((i==1)&&!this.moduleHasPrefix(_45)){ _43[0]="../"+_43[0]; }else{ var _46=this.getModulePrefix(_45); if(_46!=_45){ _43.splice(0,i,_46); break; } } } return _43; }; dojo.hostenv._global_omit_module_check=false; dojo.hostenv.loadModule=function(_47,_48,_49){ if(!_47){ return; } _49=this._global_omit_module_check||_49; var _4a=this.findModule(_47,false); if(_4a){ return _4a; } if(dj_undef(_47,this.loading_modules_)){ this.addedToLoadingCount.push(_47); } this.loading_modules_[_47]=1; var _4b=_47.replace(/\./g,"/")+".js"; var _4c=_47.split("."); var _4d=this.getModuleSymbols(_47); var _4e=((_4d[0].charAt(0)!="/")&&!_4d[0].match(/^\w+:/)); var _4f=_4d[_4d.length-1]; var ok; if(_4f=="*"){ _47=_4c.slice(0,-1).join("."); while(_4d.length){ _4d.pop(); _4d.push(this.pkgFileName); _4b=_4d.join("/")+".js"; if(_4e&&_4b.charAt(0)=="/"){ _4b=_4b.slice(1); } ok=this.loadPath(_4b,!_49?_47:null); if(ok){ break; } _4d.pop(); } }else{ _4b=_4d.join("/")+".js"; _47=_4c.join("."); var _51=!_49?_47:null; ok=this.loadPath(_4b,_51); if(!ok&&!_48){ _4d.pop(); while(_4d.length){ _4b=_4d.join("/")+".js"; ok=this.loadPath(_4b,_51); if(ok){ break; } _4d.pop(); _4b=_4d.join("/")+"/"+this.pkgFileName+".js"; if(_4e&&_4b.charAt(0)=="/"){ _4b=_4b.slice(1); } ok=this.loadPath(_4b,_51); if(ok){ break; } } } if(!ok&&!_49){ dojo.raise("Could not load '"+_47+"'; last tried '"+_4b+"'"); } } if(!_49&&!this["isXDomain"]){ _4a=this.findModule(_47,false); if(!_4a){ dojo.raise("symbol '"+_47+"' is not defined after loading '"+_4b+"'"); } } return _4a; }; dojo.hostenv.startPackage=function(_52){ var _53=String(_52); var _54=_53; var _55=_52.split(/\./); if(_55[_55.length-1]=="*"){ _55.pop(); _54=_55.join("."); } var _56=dojo.evalObjPath(_54,true); this.loaded_modules_[_53]=_56; this.loaded_modules_[_54]=_56; return _56; }; dojo.hostenv.findModule=function(_57,_58){ var lmn=String(_57); if(this.loaded_modules_[lmn]){ return this.loaded_modules_[lmn]; } if(_58){ dojo.raise("no loaded module named '"+_57+"'"); } return null; }; dojo.kwCompoundRequire=function(_5a){ var _5b=_5a["common"]||[]; var _5c=_5a[dojo.hostenv.name_]?_5b.concat(_5a[dojo.hostenv.name_]||[]):_5b.concat(_5a["default"]||[]); for(var x=0;x<_5c.length;x++){ var _5e=_5c[x]; if(_5e.constructor==Array){ dojo.hostenv.loadModule.apply(dojo.hostenv,_5e); }else{ dojo.hostenv.loadModule(_5e); } } }; dojo.require=function(_5f){ dojo.hostenv.loadModule.apply(dojo.hostenv,arguments); }; dojo.requireIf=function(_60,_61){ var _62=arguments[0]; if((_62===true)||(_62=="common")||(_62&&dojo.render[_62].capable)){ var _63=[]; for(var i=1;i0;i--){ _73.push(_72.slice(0,i).join("-")); } _73.push(false); if(_70){ _73.reverse(); } for(var j=_73.length-1;j>=0;j--){ var loc=_73[j]||"ROOT"; var _77=_71(loc); if(_77){ break; } } }; dojo.hostenv.localesGenerated; dojo.hostenv.registerNlsPrefix=function(){ dojo.registerModulePath("nls","nls"); }; dojo.hostenv.preloadLocalizations=function(){ if(dojo.hostenv.localesGenerated){ dojo.hostenv.registerNlsPrefix(); function preload(_78){ _78=dojo.hostenv.normalizeLocale(_78); dojo.hostenv.searchLocalePath(_78,true,function(loc){ for(var i=0;i1){ var _98=_97[1]; var _99=_98.split("&"); for(var x in _99){ var sp=_99[x].split("="); if((sp[0].length>9)&&(sp[0].substr(0,9)=="djConfig.")){ var opt=sp[0].substr(9); try{ djConfig[opt]=eval(sp[1]); } catch(e){ djConfig[opt]=sp[1]; } } } } } if(((djConfig["baseScriptUri"]=="")||(djConfig["baseRelativePath"]==""))&&(document&&document.getElementsByTagName)){ var _9d=document.getElementsByTagName("script"); var _9e=/(__package__|dojo|bootstrap1)\.js([\?\.]|$)/i; for(var i=0;i<_9d.length;i++){ var src=_9d[i].getAttribute("src"); if(!src){ continue; } var m=src.match(_9e); if(m){ var _a2=src.substring(0,m.index); if(src.indexOf("bootstrap1")>-1){ _a2+="../"; } if(!this["djConfig"]){ djConfig={}; } if(djConfig["baseScriptUri"]==""){ djConfig["baseScriptUri"]=_a2; } if(djConfig["baseRelativePath"]==""){ djConfig["baseRelativePath"]=_a2; } break; } } } var dr=dojo.render; var drh=dojo.render.html; var drs=dojo.render.svg; var dua=(drh.UA=navigator.userAgent); var dav=(drh.AV=navigator.appVersion); var t=true; var f=false; drh.capable=t; drh.support.builtin=t; dr.ver=parseFloat(drh.AV); dr.os.mac=dav.indexOf("Macintosh")>=0; dr.os.win=dav.indexOf("Windows")>=0; dr.os.linux=dav.indexOf("X11")>=0; drh.opera=dua.indexOf("Opera")>=0; drh.khtml=(dav.indexOf("Konqueror")>=0)||(dav.indexOf("Safari")>=0); drh.safari=dav.indexOf("Safari")>=0; var _aa=dua.indexOf("Gecko"); drh.mozilla=drh.moz=(_aa>=0)&&(!drh.khtml); if(drh.mozilla){ drh.geckoVersion=dua.substring(_aa+6,_aa+14); } drh.ie=(document.all)&&(!drh.opera); drh.ie50=drh.ie&&dav.indexOf("MSIE 5.0")>=0; drh.ie55=drh.ie&&dav.indexOf("MSIE 5.5")>=0; drh.ie60=drh.ie&&dav.indexOf("MSIE 6.0")>=0; drh.ie70=drh.ie&&dav.indexOf("MSIE 7.0")>=0; var cm=document["compatMode"]; drh.quirks=(cm=="BackCompat")||(cm=="QuirksMode")||drh.ie55||drh.ie50; dojo.locale=dojo.locale||(drh.ie?navigator.userLanguage:navigator.language).toLowerCase(); dr.vml.capable=drh.ie; drs.capable=f; drs.support.plugin=f; drs.support.builtin=f; var _ac=window["document"]; var tdi=_ac["implementation"]; if((tdi)&&(tdi["hasFeature"])&&(tdi.hasFeature("org.w3c.dom.svg","1.0"))){ drs.capable=t; drs.support.builtin=t; drs.support.plugin=f; } if(drh.safari){ var tmp=dua.split("AppleWebKit/")[1]; var ver=parseFloat(tmp.split(" ")[0]); if(ver>=420){ drs.capable=t; drs.support.builtin=t; drs.support.plugin=f; } } })(); dojo.hostenv.startPackage("dojo.hostenv"); dojo.render.name=dojo.hostenv.name_="browser"; dojo.hostenv.searchIds=[]; dojo.hostenv._XMLHTTP_PROGIDS=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"]; dojo.hostenv.getXmlhttpObject=function(){ var _b0=null; var _b1=null; try{ _b0=new XMLHttpRequest(); } catch(e){ } if(!_b0){ for(var i=0;i<3;++i){ var _b3=dojo.hostenv._XMLHTTP_PROGIDS[i]; try{ _b0=new ActiveXObject(_b3); } catch(e){ _b1=e; } if(_b0){ dojo.hostenv._XMLHTTP_PROGIDS=[_b3]; break; } } } if(!_b0){ return dojo.raise("XMLHTTP not available",_b1); } return _b0; }; dojo.hostenv._blockAsync=false; dojo.hostenv.getText=function(uri,_b5,_b6){ if(!_b5){ this._blockAsync=true; } var _b7=this.getXmlhttpObject(); function isDocumentOk(_b8){ var _b9=_b8["status"]; return Boolean((!_b9)||((200<=_b9)&&(300>_b9))||(_b9==304)); } if(_b5){ var _ba=this,_bb=null,gbl=dojo.global(); var xhr=dojo.evalObjPath("dojo.io.XMLHTTPTransport"); _b7.onreadystatechange=function(){ if(_bb){ gbl.clearTimeout(_bb); _bb=null; } if(_ba._blockAsync||(xhr&&xhr._blockAsync)){ _bb=gbl.setTimeout(function(){ _b7.onreadystatechange.apply(this); },10); }else{ if(4==_b7.readyState){ if(isDocumentOk(_b7)){ _b5(_b7.responseText); } } } }; } _b7.open("GET",uri,_b5?true:false); try{ _b7.send(null); if(_b5){ return null; } if(!isDocumentOk(_b7)){ var err=Error("Unable to load "+uri+" status:"+_b7.status); err.status=_b7.status; err.responseText=_b7.responseText; throw err; } } catch(e){ this._blockAsync=false; if((_b6)&&(!_b5)){ return null; }else{ throw e; } } this._blockAsync=false; return _b7.responseText; }; dojo.hostenv.defaultDebugContainerId="dojoDebug"; dojo.hostenv._println_buffer=[]; dojo.hostenv._println_safe=false; dojo.hostenv.println=function(_bf){ if(!dojo.hostenv._println_safe){ dojo.hostenv._println_buffer.push(_bf); }else{ try{ var _c0=document.getElementById(djConfig.debugContainerId?djConfig.debugContainerId:dojo.hostenv.defaultDebugContainerId); if(!_c0){ _c0=dojo.body(); } var div=document.createElement("div"); div.appendChild(document.createTextNode(_bf)); _c0.appendChild(div); } catch(e){ try{ document.write("
"+_bf+"
"); } catch(e2){ window.status=_bf; } } } }; dojo.addOnLoad(function(){ dojo.hostenv._println_safe=true; while(dojo.hostenv._println_buffer.length>0){ dojo.hostenv.println(dojo.hostenv._println_buffer.shift()); } }); function dj_addNodeEvtHdlr(_c2,_c3,fp,_c5){ var _c6=_c2["on"+_c3]||function(){ }; _c2["on"+_c3]=function(){ fp.apply(_c2,arguments); _c6.apply(_c2,arguments); }; return true; } function dj_load_init(e){ var _c8=(e&&e.type)?e.type.toLowerCase():"load"; if(arguments.callee.initialized||(_c8!="domcontentloaded"&&_c8!="load")){ return; } arguments.callee.initialized=true; if(typeof (_timer)!="undefined"){ clearInterval(_timer); delete _timer; } var _c9=function(){ if(dojo.render.html.ie){ dojo.hostenv.makeWidgets(); } }; if(dojo.hostenv.inFlightCount==0){ _c9(); dojo.hostenv.modulesLoaded(); }else{ dojo.addOnLoad(_c9); } } if(document.addEventListener){ if(dojo.render.html.opera||(dojo.render.html.moz&&!djConfig.delayMozLoadingFix)){ document.addEventListener("DOMContentLoaded",dj_load_init,null); } window.addEventListener("load",dj_load_init,null); } if(dojo.render.html.ie&&dojo.render.os.win){ document.attachEvent("onreadystatechange",function(e){ if(document.readyState=="complete"){ dj_load_init(); } }); } if(/(WebKit|khtml)/i.test(navigator.userAgent)){ var _timer=setInterval(function(){ if(/loaded|complete/.test(document.readyState)){ dj_load_init(); } },10); } if(dojo.render.html.ie){ dj_addNodeEvtHdlr(window,"beforeunload",function(){ dojo.hostenv._unloading=true; window.setTimeout(function(){ dojo.hostenv._unloading=false; },0); }); } dj_addNodeEvtHdlr(window,"unload",function(){ dojo.hostenv.unloaded(); if((!dojo.render.html.ie)||(dojo.render.html.ie&&dojo.hostenv._unloading)){ dojo.hostenv.unloaded(); } }); dojo.hostenv.makeWidgets=function(){ var _cb=[]; if(djConfig.searchIds&&djConfig.searchIds.length>0){ _cb=_cb.concat(djConfig.searchIds); } if(dojo.hostenv.searchIds&&dojo.hostenv.searchIds.length>0){ _cb=_cb.concat(dojo.hostenv.searchIds); } if((djConfig.parseWidgets)||(_cb.length>0)){ if(dojo.evalObjPath("dojo.widget.Parse")){ var _cc=new dojo.xml.Parse(); if(_cb.length>0){ for(var x=0;x<_cb.length;x++){ var _ce=document.getElementById(_cb[x]); if(!_ce){ continue; } var _cf=_cc.parseElement(_ce,null,true); dojo.widget.getParser().createComponents(_cf); } }else{ if(djConfig.parseWidgets){ var _cf=_cc.parseElement(dojo.body(),null,true); dojo.widget.getParser().createComponents(_cf); } } } } }; dojo.addOnLoad(function(){ if(!dojo.render.html.ie){ dojo.hostenv.makeWidgets(); } }); try{ if(dojo.render.html.ie){ document.namespaces.add("v","urn:schemas-microsoft-com:vml"); document.createStyleSheet().addRule("v\\:*","behavior:url(#default#VML)"); } } catch(e){ } dojo.hostenv.writeIncludes=function(){ }; if(!dj_undef("document",this)){ dj_currentDocument=this.document; } dojo.doc=function(){ return dj_currentDocument; }; dojo.body=function(){ return dojo.doc().body||dojo.doc().getElementsByTagName("body")[0]; }; dojo.byId=function(id,doc){ if((id)&&((typeof id=="string")||(id instanceof String))){ if(!doc){ doc=dj_currentDocument; } var ele=doc.getElementById(id); if(ele&&(ele.id!=id)&&doc.all){ ele=null; eles=doc.all[id]; if(eles){ if(eles.length){ for(var i=0;i"); } catch(e){ var _ed=document.createElement("script"); _ed.src=_ec; document.getElementsByTagName("head")[0].appendChild(_ed); } } } })(); dojo.provide("dojo.string.common"); dojo.string.trim=function(str,wh){ if(!str.replace){ return str; } if(!str.length){ return str; } var re=(wh>0)?(/^\s+/):(wh<0)?(/\s+$/):(/^\s+|\s+$/g); return str.replace(re,""); }; dojo.string.trimStart=function(str){ return dojo.string.trim(str,1); }; dojo.string.trimEnd=function(str){ return dojo.string.trim(str,-1); }; dojo.string.repeat=function(str,_f4,_f5){ var out=""; for(var i=0;i<_f4;i++){ out+=str; if(_f5&&i<_f4-1){ out+=_f5; } } return out; }; dojo.string.pad=function(str,len,c,dir){ var out=String(str); if(!c){ c="0"; } if(!dir){ dir=1; } while(out.length0){ out=c+out; }else{ out+=c; } } return out; }; dojo.string.padLeft=function(str,len,c){ return dojo.string.pad(str,len,c,1); }; dojo.string.padRight=function(str,len,c){ return dojo.string.pad(str,len,c,-1); }; dojo.provide("dojo.string"); dojo.provide("dojo.lang.common"); dojo.lang.inherits=function(_103,_104){ if(typeof _104!="function"){ dojo.raise("dojo.inherits: superclass argument ["+_104+"] must be a function (subclass: ["+_103+"']"); } _103.prototype=new _104(); _103.prototype.constructor=_103; _103.superclass=_104.prototype; _103["super"]=_104.prototype; }; dojo.lang._mixin=function(obj,_106){ var tobj={}; for(var x in _106){ if((typeof tobj[x]=="undefined")||(tobj[x]!=_106[x])){ obj[x]=_106[x]; } } if(dojo.render.html.ie&&(typeof (_106["toString"])=="function")&&(_106["toString"]!=obj["toString"])&&(_106["toString"]!=tobj["toString"])){ obj.toString=_106.toString; } return obj; }; dojo.lang.mixin=function(obj,_10a){ for(var i=1,l=arguments.length;i-1; }; dojo.lang.isObject=function(it){ if(typeof it=="undefined"){ return false; } return (typeof it=="object"||it===null||dojo.lang.isArray(it)||dojo.lang.isFunction(it)); }; dojo.lang.isArray=function(it){ return (it&&it instanceof Array||typeof it=="array"); }; dojo.lang.isArrayLike=function(it){ if((!it)||(dojo.lang.isUndefined(it))){ return false; } if(dojo.lang.isString(it)){ return false; } if(dojo.lang.isFunction(it)){ return false; } if(dojo.lang.isArray(it)){ return true; } if((it.tagName)&&(it.tagName.toLowerCase()=="form")){ return false; } if(dojo.lang.isNumber(it.length)&&isFinite(it.length)){ return true; } return false; }; dojo.lang.isFunction=function(it){ if(!it){ return false; } if((typeof (it)=="function")&&(it=="[object NodeList]")){ return false; } return (it instanceof Function||typeof it=="function"); }; dojo.lang.isString=function(it){ return (typeof it=="string"||it instanceof String); }; dojo.lang.isAlien=function(it){ if(!it){ return false; } return !dojo.lang.isFunction()&&/\{\s*\[native code\]\s*\}/.test(String(it)); }; dojo.lang.isBoolean=function(it){ return (it instanceof Boolean||typeof it=="boolean"); }; dojo.lang.isNumber=function(it){ return (it instanceof Number||typeof it=="number"); }; dojo.lang.isUndefined=function(it){ return ((typeof (it)=="undefined")&&(it==undefined)); }; dojo.provide("dojo.lang.extras"); dojo.lang.setTimeout=function(func,_129){ var _12a=window,_12b=2; if(!dojo.lang.isFunction(func)){ _12a=func; func=_129; _129=arguments[2]; _12b++; } if(dojo.lang.isString(func)){ func=_12a[func]; } var args=[]; for(var i=_12b;i=4){ this.changeUrl=_141; } } }; dojo.lang.extend(dojo.io.Request,{url:"",mimetype:"text/plain",method:"GET",content:undefined,transport:undefined,changeUrl:undefined,formNode:undefined,sync:false,bindSuccess:false,useCache:false,preventCache:false,load:function(type,data,_144,_145){ },error:function(type,_147,_148,_149){ },timeout:function(type,_14b,_14c,_14d){ },handle:function(type,data,_150,_151){ },timeoutSeconds:0,abort:function(){ },fromKwArgs:function(_152){ if(_152["url"]){ _152.url=_152.url.toString(); } if(_152["formNode"]){ _152.formNode=dojo.byId(_152.formNode); } if(!_152["method"]&&_152["formNode"]&&_152["formNode"].method){ _152.method=_152["formNode"].method; } if(!_152["handle"]&&_152["handler"]){ _152.handle=_152.handler; } if(!_152["load"]&&_152["loaded"]){ _152.load=_152.loaded; } if(!_152["changeUrl"]&&_152["changeURL"]){ _152.changeUrl=_152.changeURL; } _152.encoding=dojo.lang.firstValued(_152["encoding"],djConfig["bindEncoding"],""); _152.sendTransport=dojo.lang.firstValued(_152["sendTransport"],djConfig["ioSendTransport"],false); var _153=dojo.lang.isFunction; for(var x=0;x0){ dojo.io.bind(dojo.io._bindQueue.shift()); }else{ dojo.io._queueBindInFlight=false; } } }; dojo.io._bindQueue=[]; dojo.io._queueBindInFlight=false; dojo.io.argsFromMap=function(map,_167,last){ var enc=/utf/i.test(_167||"")?encodeURIComponent:dojo.string.encodeAscii; var _16a=[]; var _16b=new Object(); for(var name in map){ var _16d=function(elt){ var val=enc(name)+"="+enc(elt); _16a[(last==name)?"push":"unshift"](val); }; if(!_16b[name]){ var _170=map[name]; if(dojo.lang.isArray(_170)){ dojo.lang.forEach(_170,_16d); }else{ _16d(_170); } } } return _16a.join("&"); }; dojo.io.setIFrameSrc=function(_171,src,_173){ try{ var r=dojo.render.html; if(!_173){ if(r.safari){ _171.location=src; }else{ frames[_171.name].location=src; } }else{ var idoc; if(r.ie){ idoc=_171.contentWindow.document; }else{ if(r.safari){ idoc=_171.document; }else{ idoc=_171.contentWindow; } } if(!idoc){ _171.location=src; return; }else{ idoc.location.replace(src); } } } catch(e){ dojo.debug(e); dojo.debug("setIFrameSrc: "+e); } }; dojo.provide("dojo.lang.array"); dojo.lang.has=function(obj,name){ try{ return typeof obj[name]!="undefined"; } catch(e){ return false; } }; dojo.lang.isEmpty=function(obj){ if(dojo.lang.isObject(obj)){ var tmp={}; var _17a=0; for(var x in obj){ if(obj[x]&&(!tmp[x])){ _17a++; break; } } return _17a==0; }else{ if(dojo.lang.isArrayLike(obj)||dojo.lang.isString(obj)){ return obj.length==0; } } }; dojo.lang.map=function(arr,obj,_17e){ var _17f=dojo.lang.isString(arr); if(_17f){ arr=arr.split(""); } if(dojo.lang.isFunction(obj)&&(!_17e)){ _17e=obj; obj=dj_global; }else{ if(dojo.lang.isFunction(obj)&&_17e){ var _180=obj; obj=_17e; _17e=_180; } } if(Array.map){ var _181=Array.map(arr,_17e,obj); }else{ var _181=[]; for(var i=0;i=3){ dojo.raise("thisObject doesn't exist!"); } _19e=dj_global; } _1a0=[]; for(var i=0;i/gm,">").replace(/"/gm,"""); if(!_1df){ str=str.replace(/'/gm,"'"); } return str; }; dojo.string.escapeSql=function(str){ return str.replace(/'/gm,"''"); }; dojo.string.escapeRegExp=function(str){ return str.replace(/\\/gm,"\\\\").replace(/([\f\b\n\t\r[\^$|?*+(){}])/gm,"\\$1"); }; dojo.string.escapeJavaScript=function(str){ return str.replace(/(["'\f\b\n\t\r])/gm,"\\$1"); }; dojo.string.escapeString=function(str){ return ("\""+str.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r"); }; dojo.string.summary=function(str,len){ if(!len||str.length<=len){ return str; } return str.substring(0,len).replace(/\.+$/,"")+"..."; }; dojo.string.endsWith=function(str,end,_1e8){ if(_1e8){ str=str.toLowerCase(); end=end.toLowerCase(); } if((str.length-end.length)<0){ return false; } return str.lastIndexOf(end)==str.length-end.length; }; dojo.string.endsWithAny=function(str){ for(var i=1;i-1){ return true; } } return false; }; dojo.string.normalizeNewlines=function(text,_1f3){ if(_1f3=="\n"){ text=text.replace(/\r\n/g,"\n"); text=text.replace(/\r/g,"\n"); }else{ if(_1f3=="\r"){ text=text.replace(/\r\n/g,"\r"); text=text.replace(/\n/g,"\r"); }else{ text=text.replace(/([^\r])\n/g,"$1\r\n").replace(/\r([^\n])/g,"\r\n$1"); } } return text; }; dojo.string.splitEscaped=function(str,_1f5){ var _1f6=[]; for(var i=0,_1f8=0;i0){ return _216[0]; } node=node.parentNode; } if(_215){ return null; } return _216; }; dojo.dom.getAncestorsByTag=function(node,tag,_21a){ tag=tag.toLowerCase(); return dojo.dom.getAncestors(node,function(el){ return ((el.tagName)&&(el.tagName.toLowerCase()==tag)); },_21a); }; dojo.dom.getFirstAncestorByTag=function(node,tag){ return dojo.dom.getAncestorsByTag(node,tag,true); }; dojo.dom.isDescendantOf=function(node,_21f,_220){ if(_220&&node){ node=node.parentNode; } while(node){ if(node==_21f){ return true; } node=node.parentNode; } return false; }; dojo.dom.innerXML=function(node){ if(node.innerXML){ return node.innerXML; }else{ if(node.xml){ return node.xml; }else{ if(typeof XMLSerializer!="undefined"){ return (new XMLSerializer()).serializeToString(node); } } } }; dojo.dom.createDocument=function(){ var doc=null; var _223=dojo.doc(); if(!dj_undef("ActiveXObject")){ var _224=["MSXML2","Microsoft","MSXML","MSXML3"]; for(var i=0;i<_224.length;i++){ try{ doc=new ActiveXObject(_224[i]+".XMLDOM"); } catch(e){ } if(doc){ break; } } }else{ if((_223.implementation)&&(_223.implementation.createDocument)){ doc=_223.implementation.createDocument("","",null); } } return doc; }; dojo.dom.createDocumentFromText=function(str,_227){ if(!_227){ _227="text/xml"; } if(!dj_undef("DOMParser")){ var _228=new DOMParser(); return _228.parseFromString(str,_227); }else{ if(!dj_undef("ActiveXObject")){ var _229=dojo.dom.createDocument(); if(_229){ _229.async=false; _229.loadXML(str); return _229; }else{ dojo.debug("toXml didn't work?"); } }else{ var _22a=dojo.doc(); if(_22a.createElement){ var tmp=_22a.createElement("xml"); tmp.innerHTML=str; if(_22a.implementation&&_22a.implementation.createDocument){ var _22c=_22a.implementation.createDocument("foo","",null); for(var i=0;i1){ var _244=dojo.doc(); dojo.dom.replaceChildren(node,_244.createTextNode(text)); return text; }else{ if(node.textContent!=undefined){ return node.textContent; } var _245=""; if(node==null){ return _245; } for(var i=0;i"); } } catch(e){ } if(dojo.render.html.opera){ dojo.debug("Opera is not supported with dojo.undo.browser, so back/forward detection will not work."); } dojo.undo.browser={initialHref:window.location.href,initialHash:window.location.hash,moveForward:false,historyStack:[],forwardStack:[],historyIframe:null,bookmarkAnchor:null,locationTimer:null,setInitialState:function(args){ this.initialState=this._createState(this.initialHref,args,this.initialHash); },addToHistory:function(args){ this.forwardStack=[]; var hash=null; var url=null; if(!this.historyIframe){ this.historyIframe=window.frames["djhistory"]; } if(!this.bookmarkAnchor){ this.bookmarkAnchor=document.createElement("a"); dojo.body().appendChild(this.bookmarkAnchor); this.bookmarkAnchor.style.display="none"; } if(args["changeUrl"]){ hash="#"+((args["changeUrl"]!==true)?args["changeUrl"]:(new Date()).getTime()); if(this.historyStack.length==0&&this.initialState.urlHash==hash){ this.initialState=this._createState(url,args,hash); return; }else{ if(this.historyStack.length>0&&this.historyStack[this.historyStack.length-1].urlHash==hash){ this.historyStack[this.historyStack.length-1]=this._createState(url,args,hash); return; } } this.changingUrl=true; setTimeout("window.location.href = '"+hash+"'; dojo.undo.browser.changingUrl = false;",1); this.bookmarkAnchor.href=hash; if(dojo.render.html.ie){ url=this._loadIframeHistory(); var _254=args["back"]||args["backButton"]||args["handle"]; var tcb=function(_256){ if(window.location.hash!=""){ setTimeout("window.location.href = '"+hash+"';",1); } _254.apply(this,[_256]); }; if(args["back"]){ args.back=tcb; }else{ if(args["backButton"]){ args.backButton=tcb; }else{ if(args["handle"]){ args.handle=tcb; } } } var _257=args["forward"]||args["forwardButton"]||args["handle"]; var tfw=function(_259){ if(window.location.hash!=""){ window.location.href=hash; } if(_257){ _257.apply(this,[_259]); } }; if(args["forward"]){ args.forward=tfw; }else{ if(args["forwardButton"]){ args.forwardButton=tfw; }else{ if(args["handle"]){ args.handle=tfw; } } } }else{ if(dojo.render.html.moz){ if(!this.locationTimer){ this.locationTimer=setInterval("dojo.undo.browser.checkLocation();",200); } } } }else{ url=this._loadIframeHistory(); } this.historyStack.push(this._createState(url,args,hash)); },checkLocation:function(){ if(!this.changingUrl){ var hsl=this.historyStack.length; if((window.location.hash==this.initialHash||window.location.href==this.initialHref)&&(hsl==1)){ this.handleBackButton(); return; } if(this.forwardStack.length>0){ if(this.forwardStack[this.forwardStack.length-1].urlHash==window.location.hash){ this.handleForwardButton(); return; } } if((hsl>=2)&&(this.historyStack[hsl-2])){ if(this.historyStack[hsl-2].urlHash==window.location.hash){ this.handleBackButton(); return; } } } },iframeLoaded:function(evt,_25c){ if(!dojo.render.html.opera){ var _25d=this._getUrlQuery(_25c.href); if(_25d==null){ if(this.historyStack.length==1){ this.handleBackButton(); } return; } if(this.moveForward){ this.moveForward=false; return; } if(this.historyStack.length>=2&&_25d==this._getUrlQuery(this.historyStack[this.historyStack.length-2].url)){ this.handleBackButton(); }else{ if(this.forwardStack.length>0&&_25d==this._getUrlQuery(this.forwardStack[this.forwardStack.length-1].url)){ this.handleForwardButton(); } } } },handleBackButton:function(){ var _25e=this.historyStack.pop(); if(!_25e){ return; } var last=this.historyStack[this.historyStack.length-1]; if(!last&&this.historyStack.length==0){ last=this.initialState; } if(last){ if(last.kwArgs["back"]){ last.kwArgs["back"](); }else{ if(last.kwArgs["backButton"]){ last.kwArgs["backButton"](); }else{ if(last.kwArgs["handle"]){ last.kwArgs.handle("back"); } } } } this.forwardStack.push(_25e); },handleForwardButton:function(){ var last=this.forwardStack.pop(); if(!last){ return; } if(last.kwArgs["forward"]){ last.kwArgs.forward(); }else{ if(last.kwArgs["forwardButton"]){ last.kwArgs.forwardButton(); }else{ if(last.kwArgs["handle"]){ last.kwArgs.handle("forward"); } } } this.historyStack.push(last); },_createState:function(url,args,hash){ return {"url":url,"kwArgs":args,"urlHash":hash}; },_getUrlQuery:function(url){ var _265=url.split("?"); if(_265.length<2){ return null; }else{ return _265[1]; } },_loadIframeHistory:function(){ var url=dojo.hostenv.getBaseScriptUri()+"iframe_history.html?"+(new Date()).getTime(); this.moveForward=true; dojo.io.setIFrameSrc(this.historyIframe,url,false); return url; }}; dojo.provide("dojo.io.BrowserIO"); dojo.io.checkChildrenForFile=function(node){ var _268=false; var _269=node.getElementsByTagName("input"); dojo.lang.forEach(_269,function(_26a){ if(_268){ return; } if(_26a.getAttribute("type")=="file"){ _268=true; } }); return _268; }; dojo.io.formHasFile=function(_26b){ return dojo.io.checkChildrenForFile(_26b); }; dojo.io.updateNode=function(node,_26d){ node=dojo.byId(node); var args=_26d; if(dojo.lang.isString(_26d)){ args={url:_26d}; } args.mimetype="text/html"; args.load=function(t,d,e){ while(node.firstChild){ if(dojo["event"]){ try{ dojo.event.browser.clean(node.firstChild); } catch(e){ } } node.removeChild(node.firstChild); } node.innerHTML=d; }; dojo.io.bind(args); }; dojo.io.formFilter=function(node){ var type=(node.type||"").toLowerCase(); return !node.disabled&&node.name&&!dojo.lang.inArray(["file","submit","image","reset","button"],type); }; dojo.io.encodeForm=function(_274,_275,_276){ if((!_274)||(!_274.tagName)||(!_274.tagName.toLowerCase()=="form")){ dojo.raise("Attempted to encode a non-form element."); } if(!_276){ _276=dojo.io.formFilter; } var enc=/utf/i.test(_275||"")?encodeURIComponent:dojo.string.encodeAscii; var _278=[]; for(var i=0;i<_274.elements.length;i++){ var elm=_274.elements[i]; if(!elm||elm.tagName.toLowerCase()=="fieldset"||!_276(elm)){ continue; } var name=enc(elm.name); var type=elm.type.toLowerCase(); if(type=="select-multiple"){ for(var j=0;j=200)&&(http.status<300))||(http.status==304)||(location.protocol=="file:"&&(http.status==0||http.status==undefined))||(location.protocol=="chrome:"&&(http.status==0||http.status==undefined))){ var ret; if(_29f.method.toLowerCase()=="head"){ var _2a5=http.getAllResponseHeaders(); ret={}; ret.toString=function(){ return _2a5; }; var _2a6=_2a5.split(/[\r\n]+/g); for(var i=0;i<_2a6.length;i++){ var pair=_2a6[i].match(/^([^:]+)\s*:\s*(.+)$/i); if(pair){ ret[pair[1]]=pair[2]; } } }else{ if(_29f.mimetype=="text/javascript"){ try{ ret=dj_eval(http.responseText); } catch(e){ dojo.debug(e); dojo.debug(http.responseText); ret=null; } }else{ if(_29f.mimetype=="text/json"||_29f.mimetype=="application/json"){ try{ ret=dj_eval("("+http.responseText+")"); } catch(e){ dojo.debug(e); dojo.debug(http.responseText); ret=false; } }else{ if((_29f.mimetype=="application/xml")||(_29f.mimetype=="text/xml")){ ret=http.responseXML; if(!ret||typeof ret=="string"||!http.getResponseHeader("Content-Type")){ ret=dojo.dom.createDocumentFromText(http.responseText); } }else{ ret=http.responseText; } } } } if(_2a3){ addToCache(url,_2a2,_29f.method,http); } _29f[(typeof _29f.load=="function")?"load":"handle"]("load",ret,http,_29f); }else{ var _2a9=new dojo.io.Error("XMLHttpTransport Error: "+http.status+" "+http.statusText); _29f[(typeof _29f.error=="function")?"error":"handle"]("error",_2a9,http,_29f); } } function setHeaders(http,_2ab){ if(_2ab["headers"]){ for(var _2ac in _2ab["headers"]){ if(_2ac.toLowerCase()=="content-type"&&!_2ab["contentType"]){ _2ab["contentType"]=_2ab["headers"][_2ac]; }else{ http.setRequestHeader(_2ac,_2ab["headers"][_2ac]); } } } } this.inFlight=[]; this.inFlightTimer=null; this.startWatchingInFlight=function(){ if(!this.inFlightTimer){ this.inFlightTimer=setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();",10); } }; this.watchInFlight=function(){ var now=null; if(!dojo.hostenv._blockAsync&&!_293._blockAsync){ for(var x=this.inFlight.length-1;x>=0;x--){ try{ var tif=this.inFlight[x]; if(!tif||tif.http._aborted||!tif.http.readyState){ this.inFlight.splice(x,1); continue; } if(4==tif.http.readyState){ this.inFlight.splice(x,1); doLoad(tif.req,tif.http,tif.url,tif.query,tif.useCache); }else{ if(tif.startTime){ if(!now){ now=(new Date()).getTime(); } if(tif.startTime+(tif.req.timeoutSeconds*1000)-1){ dojo.debug("Warning: dojo.io.bind: stripping hash values from url:",url); url=url.split("#")[0]; } if(_2b3["file"]){ _2b3.method="post"; } if(!_2b3["method"]){ _2b3.method="get"; } if(_2b3.method.toLowerCase()=="get"){ _2b3.multipart=false; }else{ if(_2b3["file"]){ _2b3.multipart=true; }else{ if(!_2b3["multipart"]){ _2b3.multipart=false; } } } if(_2b3["backButton"]||_2b3["back"]||_2b3["changeUrl"]){ dojo.undo.browser.addToHistory(_2b3); } var _2b8=_2b3["content"]||{}; if(_2b3.sendTransport){ _2b8["dojo.transport"]="xmlhttp"; } do{ if(_2b3.postContent){ _2b5=_2b3.postContent; break; } if(_2b8){ _2b5+=dojo.io.argsFromMap(_2b8,_2b3.encoding); } if(_2b3.method.toLowerCase()=="get"||!_2b3.multipart){ break; } var t=[]; if(_2b5.length){ var q=_2b5.split("&"); for(var i=0;i-1?"&":"?")+_2b5; } if(_2bf){ _2c5+=(dojo.string.endsWithAny(_2c5,"?","&")?"":(_2c5.indexOf("?")>-1?"&":"?"))+"dojo.preventCache="+new Date().valueOf(); } if(!_2b3.user){ http.open(_2b3.method.toUpperCase(),_2c5,_2be); }else{ http.open(_2b3.method.toUpperCase(),_2c5,_2be,_2b3.user,_2b3.password); } setHeaders(http,_2b3); try{ http.send(null); } catch(e){ if(typeof http.abort=="function"){ http.abort(); } doLoad(_2b3,{status:404},url,_2b5,_2c0); } } if(!_2be){ doLoad(_2b3,http,url,_2b5,_2c0); _293._blockAsync=false; } _2b3.abort=function(){ try{ http._aborted=true; } catch(e){ } return http.abort(); }; return; }; dojo.io.transports.addTransport("XMLHTTPTransport"); }; dojo.provide("dojo.io.cookie"); dojo.io.cookie.setCookie=function(name,_2c7,days,path,_2ca,_2cb){ var _2cc=-1; if(typeof days=="number"&&days>=0){ var d=new Date(); d.setTime(d.getTime()+(days*24*60*60*1000)); _2cc=d.toGMTString(); } _2c7=escape(_2c7); document.cookie=name+"="+_2c7+";"+(_2cc!=-1?" expires="+_2cc+";":"")+(path?"path="+path:"")+(_2ca?"; domain="+_2ca:"")+(_2cb?"; secure":""); }; dojo.io.cookie.set=dojo.io.cookie.setCookie; dojo.io.cookie.getCookie=function(name){ var idx=document.cookie.lastIndexOf(name+"="); if(idx==-1){ return null; } var _2d0=document.cookie.substring(idx+name.length+1); var end=_2d0.indexOf(";"); if(end==-1){ end=_2d0.length; } _2d0=_2d0.substring(0,end); _2d0=unescape(_2d0); return _2d0; }; dojo.io.cookie.get=dojo.io.cookie.getCookie; dojo.io.cookie.deleteCookie=function(name){ dojo.io.cookie.setCookie(name,"-",0); }; dojo.io.cookie.setObjectCookie=function(name,obj,days,path,_2d7,_2d8,_2d9){ if(arguments.length==5){ _2d9=_2d7; _2d7=null; _2d8=null; } var _2da=[],_2db,_2dc=""; if(!_2d9){ _2db=dojo.io.cookie.getObjectCookie(name); } if(days>=0){ if(!_2db){ _2db={}; } for(var prop in obj){ if(prop==null){ delete _2db[prop]; }else{ if(typeof obj[prop]=="string"||typeof obj[prop]=="number"){ _2db[prop]=obj[prop]; } } } prop=null; for(var prop in _2db){ _2da.push(escape(prop)+"="+escape(_2db[prop])); } _2dc=_2da.join("&"); } dojo.io.cookie.setCookie(name,_2dc,days,path,_2d7,_2d8); }; dojo.io.cookie.getObjectCookie=function(name){ var _2df=null,_2e0=dojo.io.cookie.getCookie(name); if(_2e0){ _2df={}; var _2e1=_2e0.split("&"); for(var i=0;i<_2e1.length;i++){ var pair=_2e1[i].split("="); var _2e4=pair[1]; if(isNaN(_2e4)){ _2e4=unescape(pair[1]); } _2df[unescape(pair[0])]=_2e4; } } return _2df; }; dojo.io.cookie.isSupported=function(){ if(typeof navigator.cookieEnabled!="boolean"){ dojo.io.cookie.setCookie("__TestingYourBrowserForCookieSupport__","CookiesAllowed",90,null); var _2e5=dojo.io.cookie.getCookie("__TestingYourBrowserForCookieSupport__"); navigator.cookieEnabled=(_2e5=="CookiesAllowed"); if(navigator.cookieEnabled){ this.deleteCookie("__TestingYourBrowserForCookieSupport__"); } } return navigator.cookieEnabled; }; if(!dojo.io.cookies){ dojo.io.cookies=dojo.io.cookie; } dojo.provide("dojo.io.*"); dojo.provide("dojo.io"); dojo.deprecated("dojo.io","replaced by dojo.io.*","0.5"); dojo.provide("dojo.event.common"); dojo.event=new function(){ this._canTimeout=dojo.lang.isFunction(dj_global["setTimeout"])||dojo.lang.isAlien(dj_global["setTimeout"]); function interpolateArgs(args,_2e7){ var dl=dojo.lang; var ao={srcObj:dj_global,srcFunc:null,adviceObj:dj_global,adviceFunc:null,aroundObj:null,aroundFunc:null,adviceType:(args.length>2)?args[0]:"after",precedence:"last",once:false,delay:null,rate:0,adviceMsg:false}; switch(args.length){ case 0: return; case 1: return; case 2: ao.srcFunc=args[0]; ao.adviceFunc=args[1]; break; case 3: if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isString(args[2]))){ ao.adviceType="after"; ao.srcObj=args[0]; ao.srcFunc=args[1]; ao.adviceFunc=args[2]; }else{ if((dl.isString(args[1]))&&(dl.isString(args[2]))){ ao.srcFunc=args[1]; ao.adviceFunc=args[2]; }else{ if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isFunction(args[2]))){ ao.adviceType="after"; ao.srcObj=args[0]; ao.srcFunc=args[1]; var _2ea=dl.nameAnonFunc(args[2],ao.adviceObj,_2e7); ao.adviceFunc=_2ea; }else{ if((dl.isFunction(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))){ ao.adviceType="after"; ao.srcObj=dj_global; var _2ea=dl.nameAnonFunc(args[0],ao.srcObj,_2e7); ao.srcFunc=_2ea; ao.adviceObj=args[1]; ao.adviceFunc=args[2]; } } } } break; case 4: if((dl.isObject(args[0]))&&(dl.isObject(args[2]))){ ao.adviceType="after"; ao.srcObj=args[0]; ao.srcFunc=args[1]; ao.adviceObj=args[2]; ao.adviceFunc=args[3]; }else{ if((dl.isString(args[0]))&&(dl.isString(args[1]))&&(dl.isObject(args[2]))){ ao.adviceType=args[0]; ao.srcObj=dj_global; ao.srcFunc=args[1]; ao.adviceObj=args[2]; ao.adviceFunc=args[3]; }else{ if((dl.isString(args[0]))&&(dl.isFunction(args[1]))&&(dl.isObject(args[2]))){ ao.adviceType=args[0]; ao.srcObj=dj_global; var _2ea=dl.nameAnonFunc(args[1],dj_global,_2e7); ao.srcFunc=_2ea; ao.adviceObj=args[2]; ao.adviceFunc=args[3]; }else{ if((dl.isString(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))&&(dl.isFunction(args[3]))){ ao.srcObj=args[1]; ao.srcFunc=args[2]; var _2ea=dl.nameAnonFunc(args[3],dj_global,_2e7); ao.adviceObj=dj_global; ao.adviceFunc=_2ea; }else{ if(dl.isObject(args[1])){ ao.srcObj=args[1]; ao.srcFunc=args[2]; ao.adviceObj=dj_global; ao.adviceFunc=args[3]; }else{ if(dl.isObject(args[2])){ ao.srcObj=dj_global; ao.srcFunc=args[1]; ao.adviceObj=args[2]; ao.adviceFunc=args[3]; }else{ ao.srcObj=ao.adviceObj=ao.aroundObj=dj_global; ao.srcFunc=args[1]; ao.adviceFunc=args[2]; ao.aroundFunc=args[3]; } } } } } } break; case 6: ao.srcObj=args[1]; ao.srcFunc=args[2]; ao.adviceObj=args[3]; ao.adviceFunc=args[4]; ao.aroundFunc=args[5]; ao.aroundObj=dj_global; break; default: ao.srcObj=args[1]; ao.srcFunc=args[2]; ao.adviceObj=args[3]; ao.adviceFunc=args[4]; ao.aroundObj=args[5]; ao.aroundFunc=args[6]; ao.once=args[7]; ao.delay=args[8]; ao.rate=args[9]; ao.adviceMsg=args[10]; break; } if(dl.isFunction(ao.aroundFunc)){ var _2ea=dl.nameAnonFunc(ao.aroundFunc,ao.aroundObj,_2e7); ao.aroundFunc=_2ea; } if(dl.isFunction(ao.srcFunc)){ ao.srcFunc=dl.getNameInObj(ao.srcObj,ao.srcFunc); } if(dl.isFunction(ao.adviceFunc)){ ao.adviceFunc=dl.getNameInObj(ao.adviceObj,ao.adviceFunc); } if((ao.aroundObj)&&(dl.isFunction(ao.aroundFunc))){ ao.aroundFunc=dl.getNameInObj(ao.aroundObj,ao.aroundFunc); } if(!ao.srcObj){ dojo.raise("bad srcObj for srcFunc: "+ao.srcFunc); } if(!ao.adviceObj){ dojo.raise("bad adviceObj for adviceFunc: "+ao.adviceFunc); } if(!ao.adviceFunc){ dojo.debug("bad adviceFunc for srcFunc: "+ao.srcFunc); dojo.debugShallow(ao); } return ao; } this.connect=function(){ if(arguments.length==1){ var ao=arguments[0]; }else{ var ao=interpolateArgs(arguments,true); } if(dojo.lang.isString(ao.srcFunc)&&(ao.srcFunc.toLowerCase()=="onkey")){ if(dojo.render.html.ie){ ao.srcFunc="onkeydown"; this.connect(ao); } ao.srcFunc="onkeypress"; } if(dojo.lang.isArray(ao.srcObj)&&ao.srcObj!=""){ var _2ec={}; for(var x in ao){ _2ec[x]=ao[x]; } var mjps=[]; dojo.lang.forEach(ao.srcObj,function(src){ if((dojo.render.html.capable)&&(dojo.lang.isString(src))){ src=dojo.byId(src); } _2ec.srcObj=src; mjps.push(dojo.event.connect.call(dojo.event,_2ec)); }); return mjps; } var mjp=dojo.event.MethodJoinPoint.getForMethod(ao.srcObj,ao.srcFunc); if(ao.adviceFunc){ var mjp2=dojo.event.MethodJoinPoint.getForMethod(ao.adviceObj,ao.adviceFunc); } mjp.kwAddAdvice(ao); return mjp; }; this.log=function(a1,a2){ var _2f4; if((arguments.length==1)&&(typeof a1=="object")){ _2f4=a1; }else{ _2f4={srcObj:a1,srcFunc:a2}; } _2f4.adviceFunc=function(){ var _2f5=[]; for(var x=0;x=this.jp_.around.length){ return this.jp_.object[this.jp_.methodname].apply(this.jp_.object,this.args); }else{ var ti=this.jp_.around[this.around_index]; var mobj=ti[0]||dj_global; var meth=ti[1]; return mobj[meth].call(mobj,this); } }; dojo.event.MethodJoinPoint=function(obj,_30c){ this.object=obj||dj_global; this.methodname=_30c; this.methodfunc=this.object[_30c]; this.squelch=false; }; dojo.event.MethodJoinPoint.getForMethod=function(obj,_30e){ if(!obj){ obj=dj_global; } if(!obj[_30e]){ obj[_30e]=function(){ }; if(!obj[_30e]){ dojo.raise("Cannot set do-nothing method on that object "+_30e); } }else{ if((!dojo.lang.isFunction(obj[_30e]))&&(!dojo.lang.isAlien(obj[_30e]))){ return null; } } var _30f=_30e+"$joinpoint"; var _310=_30e+"$joinpoint$method"; var _311=obj[_30f]; if(!_311){ var _312=false; if(dojo.event["browser"]){ if((obj["attachEvent"])||(obj["nodeType"])||(obj["addEventListener"])){ _312=true; dojo.event.browser.addClobberNodeAttrs(obj,[_30f,_310,_30e]); } } var _313=obj[_30e].length; obj[_310]=obj[_30e]; _311=obj[_30f]=new dojo.event.MethodJoinPoint(obj,_310); obj[_30e]=function(){ var args=[]; if((_312)&&(!arguments.length)){ var evt=null; try{ if(obj.ownerDocument){ evt=obj.ownerDocument.parentWindow.event; }else{ if(obj.documentElement){ evt=obj.documentElement.ownerDocument.parentWindow.event; }else{ if(obj.event){ evt=obj.event; }else{ evt=window.event; } } } } catch(e){ evt=window.event; } if(evt){ args.push(dojo.event.browser.fixEvent(evt,this)); } }else{ for(var x=0;x0)){ dojo.lang.forEach(this.before.concat(new Array()),_32b); } var _32c; try{ if((this["around"])&&(this.around.length>0)){ var mi=new dojo.event.MethodInvocation(this,obj,args); _32c=mi.proceed(); }else{ if(this.methodfunc){ _32c=this.object[this.methodname].apply(this.object,args); } } } catch(e){ if(!this.squelch){ dojo.raise(e); } } if((this["after"])&&(this.after.length>0)){ dojo.lang.forEach(this.after.concat(new Array()),_32b); } return (this.methodfunc)?_32c:null; },getArr:function(kind){ var type="after"; if((typeof kind=="string")&&(kind.indexOf("before")!=-1)){ type="before"; }else{ if(kind=="around"){ type="around"; } } if(!this[type]){ this[type]=[]; } return this[type]; },kwAddAdvice:function(args){ this.addAdvice(args["adviceObj"],args["adviceFunc"],args["aroundObj"],args["aroundFunc"],args["adviceType"],args["precedence"],args["once"],args["delay"],args["rate"],args["adviceMsg"]); },addAdvice:function(_331,_332,_333,_334,_335,_336,once,_338,rate,_33a){ var arr=this.getArr(_335); if(!arr){ dojo.raise("bad this: "+this); } var ao=[_331,_332,_333,_334,_338,rate,_33a]; if(once){ if(this.hasAdvice(_331,_332,_335,arr)>=0){ return; } } if(_336=="first"){ arr.unshift(ao); }else{ arr.push(ao); } },hasAdvice:function(_33d,_33e,_33f,arr){ if(!arr){ arr=this.getArr(_33f); } var ind=-1; for(var x=0;x=0;i=i-1){ var el=na[i]; try{ if(el&&el["__clobberAttrs__"]){ for(var j=0;j=65&&_38f<=90&&evt.shiftKey==false){ _38f+=32; } if(_38f>=1&&_38f<=26&&evt.ctrlKey){ _38f+=96; } evt.key=String.fromCharCode(_38f); } } }else{ if(evt["type"]=="keypress"){ if(dojo.render.html.opera){ if(evt.which==0){ evt.key=evt.keyCode; }else{ if(evt.which>0){ switch(evt.which){ case evt.KEY_SHIFT: case evt.KEY_CTRL: case evt.KEY_ALT: case evt.KEY_CAPS_LOCK: case evt.KEY_NUM_LOCK: case evt.KEY_SCROLL_LOCK: break; case evt.KEY_PAUSE: case evt.KEY_TAB: case evt.KEY_BACKSPACE: case evt.KEY_ENTER: case evt.KEY_ESCAPE: evt.key=evt.which; break; default: var _38f=evt.which; if((evt.ctrlKey||evt.altKey||evt.metaKey)&&(evt.which>=65&&evt.which<=90&&evt.shiftKey==false)){ _38f+=32; } evt.key=String.fromCharCode(_38f); } } } }else{ if(dojo.render.html.ie){ if(!evt.ctrlKey&&!evt.altKey&&evt.keyCode>=evt.KEY_SPACE){ evt.key=String.fromCharCode(evt.keyCode); } }else{ if(dojo.render.html.safari){ switch(evt.keyCode){ case 63232: evt.key=evt.KEY_UP_ARROW; break; case 63233: evt.key=evt.KEY_DOWN_ARROW; break; case 63234: evt.key=evt.KEY_LEFT_ARROW; break; case 63235: evt.key=evt.KEY_RIGHT_ARROW; break; default: evt.key=evt.charCode>0?String.fromCharCode(evt.charCode):evt.keyCode; } }else{ evt.key=evt.charCode>0?String.fromCharCode(evt.charCode):evt.keyCode; } } } } } } if(dojo.render.html.ie){ if(!evt.target){ evt.target=evt.srcElement; } if(!evt.currentTarget){ evt.currentTarget=(_38d?_38d:evt.srcElement); } if(!evt.layerX){ evt.layerX=evt.offsetX; } if(!evt.layerY){ evt.layerY=evt.offsetY; } var doc=(evt.srcElement&&evt.srcElement.ownerDocument)?evt.srcElement.ownerDocument:document; var _391=((dojo.render.html.ie55)||(doc["compatMode"]=="BackCompat"))?doc.body:doc.documentElement; if(!evt.pageX){ evt.pageX=evt.clientX+(_391.scrollLeft||0); } if(!evt.pageY){ evt.pageY=evt.clientY+(_391.scrollTop||0); } if(evt.type=="mouseover"){ evt.relatedTarget=evt.fromElement; } if(evt.type=="mouseout"){ evt.relatedTarget=evt.toElement; } this.currentEvent=evt; evt.callListener=this.callListener; evt.stopPropagation=this._stopPropagation; evt.preventDefault=this._preventDefault; } return evt; }; this.stopEvent=function(evt){ if(window.event){ evt.returnValue=false; evt.cancelBubble=true; }else{ evt.preventDefault(); evt.stopPropagation(); } }; }; dojo.provide("dojo.event.*"); dojo.provide("dojo.gfx.color"); dojo.gfx.color.Color=function(r,g,b,a){ if(dojo.lang.isArray(r)){ this.r=r[0]; this.g=r[1]; this.b=r[2]; this.a=r[3]||1; }else{ if(dojo.lang.isString(r)){ var rgb=dojo.gfx.color.extractRGB(r); this.r=rgb[0]; this.g=rgb[1]; this.b=rgb[2]; this.a=g||1; }else{ if(r instanceof dojo.gfx.color.Color){ this.r=r.r; this.b=r.b; this.g=r.g; this.a=r.a; }else{ this.r=r; this.g=g; this.b=b; this.a=a; } } } }; dojo.gfx.color.Color.fromArray=function(arr){ return new dojo.gfx.color.Color(arr[0],arr[1],arr[2],arr[3]); }; dojo.extend(dojo.gfx.color.Color,{toRgb:function(_399){ if(_399){ return this.toRgba(); }else{ return [this.r,this.g,this.b]; } },toRgba:function(){ return [this.r,this.g,this.b,this.a]; },toHex:function(){ return dojo.gfx.color.rgb2hex(this.toRgb()); },toCss:function(){ return "rgb("+this.toRgb().join()+")"; },toString:function(){ return this.toHex(); },blend:function(_39a,_39b){ var rgb=null; if(dojo.lang.isArray(_39a)){ rgb=_39a; }else{ if(_39a instanceof dojo.gfx.color.Color){ rgb=_39a.toRgb(); }else{ rgb=new dojo.gfx.color.Color(_39a).toRgb(); } } return dojo.gfx.color.blend(this.toRgb(),rgb,_39b); }}); dojo.gfx.color.named={white:[255,255,255],black:[0,0,0],red:[255,0,0],green:[0,255,0],lime:[0,255,0],blue:[0,0,255],navy:[0,0,128],gray:[128,128,128],silver:[192,192,192]}; dojo.gfx.color.blend=function(a,b,_39f){ if(typeof a=="string"){ return dojo.gfx.color.blendHex(a,b,_39f); } if(!_39f){ _39f=0; } _39f=Math.min(Math.max(-1,_39f),1); _39f=((_39f+1)/2); var c=[]; for(var x=0;x<3;x++){ c[x]=parseInt(b[x]+((a[x]-b[x])*_39f)); } return c; }; dojo.gfx.color.blendHex=function(a,b,_3a4){ return dojo.gfx.color.rgb2hex(dojo.gfx.color.blend(dojo.gfx.color.hex2rgb(a),dojo.gfx.color.hex2rgb(b),_3a4)); }; dojo.gfx.color.extractRGB=function(_3a5){ var hex="0123456789abcdef"; _3a5=_3a5.toLowerCase(); if(_3a5.indexOf("rgb")==0){ var _3a7=_3a5.match(/rgba*\((\d+), *(\d+), *(\d+)/i); var ret=_3a7.splice(1,3); return ret; }else{ var _3a9=dojo.gfx.color.hex2rgb(_3a5); if(_3a9){ return _3a9; }else{ return dojo.gfx.color.named[_3a5]||[255,255,255]; } } }; dojo.gfx.color.hex2rgb=function(hex){ var _3ab="0123456789ABCDEF"; var rgb=new Array(3); if(hex.indexOf("#")==0){ hex=hex.substring(1); } hex=hex.toUpperCase(); if(hex.replace(new RegExp("["+_3ab+"]","g"),"")!=""){ return null; } if(hex.length==3){ rgb[0]=hex.charAt(0)+hex.charAt(0); rgb[1]=hex.charAt(1)+hex.charAt(1); rgb[2]=hex.charAt(2)+hex.charAt(2); }else{ rgb[0]=hex.substring(0,2); rgb[1]=hex.substring(2,4); rgb[2]=hex.substring(4); } for(var i=0;i0){ this.duration=_3cb; } if(_3ce){ this.repeatCount=_3ce; } if(rate){ this.rate=rate; } if(_3ca){ dojo.lang.forEach(["handler","beforeBegin","onBegin","onEnd","onPlay","onStop","onAnimate"],function(item){ if(_3ca[item]){ this.connect(item,_3ca[item]); } },this); } if(_3cd&&dojo.lang.isFunction(_3cd)){ this.easing=_3cd; } }; dojo.inherits(dojo.lfx.Animation,dojo.lfx.IAnimation); dojo.lang.extend(dojo.lfx.Animation,{_startTime:null,_endTime:null,_timer:null,_percent:0,_startRepeatCount:0,play:function(_3d1,_3d2){ if(_3d2){ clearTimeout(this._timer); this._active=false; this._paused=false; this._percent=0; }else{ if(this._active&&!this._paused){ return this; } } this.fire("handler",["beforeBegin"]); this.fire("beforeBegin"); if(_3d1>0){ setTimeout(dojo.lang.hitch(this,function(){ this.play(null,_3d2); }),_3d1); return this; } this._startTime=new Date().valueOf(); if(this._paused){ this._startTime-=(this.duration*this._percent/100); } this._endTime=this._startTime+this.duration; this._active=true; this._paused=false; var step=this._percent/100; var _3d4=this.curve.getValue(step); if(this._percent==0){ if(!this._startRepeatCount){ this._startRepeatCount=this.repeatCount; } this.fire("handler",["begin",_3d4]); this.fire("onBegin",[_3d4]); } this.fire("handler",["play",_3d4]); this.fire("onPlay",[_3d4]); this._cycle(); return this; },pause:function(){ clearTimeout(this._timer); if(!this._active){ return this; } this._paused=true; var _3d5=this.curve.getValue(this._percent/100); this.fire("handler",["pause",_3d5]); this.fire("onPause",[_3d5]); return this; },gotoPercent:function(pct,_3d7){ clearTimeout(this._timer); this._active=true; this._paused=true; this._percent=pct; if(_3d7){ this.play(); } return this; },stop:function(_3d8){ clearTimeout(this._timer); var step=this._percent/100; if(_3d8){ step=1; } var _3da=this.curve.getValue(step); this.fire("handler",["stop",_3da]); this.fire("onStop",[_3da]); this._active=false; this._paused=false; return this; },status:function(){ if(this._active){ return this._paused?"paused":"playing"; }else{ return "stopped"; } return this; },_cycle:function(){ clearTimeout(this._timer); if(this._active){ var curr=new Date().valueOf(); var step=(curr-this._startTime)/(this._endTime-this._startTime); if(step>=1){ step=1; this._percent=100; }else{ this._percent=step*100; } if((this.easing)&&(dojo.lang.isFunction(this.easing))){ step=this.easing(step); } var _3dd=this.curve.getValue(step); this.fire("handler",["animate",_3dd]); this.fire("onAnimate",[_3dd]); if(step<1){ this._timer=setTimeout(dojo.lang.hitch(this,"_cycle"),this.rate); }else{ this._active=false; this.fire("handler",["end"]); this.fire("onEnd"); if(this.repeatCount>0){ this.repeatCount--; this.play(null,true); }else{ if(this.repeatCount==-1){ this.play(null,true); }else{ if(this._startRepeatCount){ this.repeatCount=this._startRepeatCount; this._startRepeatCount=0; } } } } } return this; }}); dojo.lfx.Combine=function(_3de){ dojo.lfx.IAnimation.call(this); this._anims=[]; this._animsEnded=0; var _3df=arguments; if(_3df.length==1&&(dojo.lang.isArray(_3df[0])||dojo.lang.isArrayLike(_3df[0]))){ _3df=_3df[0]; } dojo.lang.forEach(_3df,function(anim){ this._anims.push(anim); anim.connect("onEnd",dojo.lang.hitch(this,"_onAnimsEnded")); },this); }; dojo.inherits(dojo.lfx.Combine,dojo.lfx.IAnimation); dojo.lang.extend(dojo.lfx.Combine,{_animsEnded:0,play:function(_3e1,_3e2){ if(!this._anims.length){ return this; } this.fire("beforeBegin"); if(_3e1>0){ setTimeout(dojo.lang.hitch(this,function(){ this.play(null,_3e2); }),_3e1); return this; } if(_3e2||this._anims[0].percent==0){ this.fire("onBegin"); } this.fire("onPlay"); this._animsCall("play",null,_3e2); return this; },pause:function(){ this.fire("onPause"); this._animsCall("pause"); return this; },stop:function(_3e3){ this.fire("onStop"); this._animsCall("stop",_3e3); return this; },_onAnimsEnded:function(){ this._animsEnded++; if(this._animsEnded>=this._anims.length){ this.fire("onEnd"); } return this; },_animsCall:function(_3e4){ var args=[]; if(arguments.length>1){ for(var i=1;i0){ setTimeout(dojo.lang.hitch(this,function(){ this.play(null,_3f0); }),_3ef); return this; } if(_3f1){ if(this._currAnim==0){ this.fire("handler",["begin",this._currAnim]); this.fire("onBegin",[this._currAnim]); } this.fire("onPlay",[this._currAnim]); _3f1.play(null,_3f0); } return this; },pause:function(){ if(this._anims[this._currAnim]){ this._anims[this._currAnim].pause(); this.fire("onPause",[this._currAnim]); } return this; },playPause:function(){ if(this._anims.length==0){ return this; } if(this._currAnim==-1){ this._currAnim=0; } var _3f2=this._anims[this._currAnim]; if(_3f2){ if(!_3f2._active||_3f2._paused){ this.play(); }else{ this.pause(); } } return this; },stop:function(){ var _3f3=this._anims[this._currAnim]; if(_3f3){ _3f3.stop(); this.fire("onStop",[this._currAnim]); } return _3f3; },_playNext:function(){ if(this._currAnim==-1||this._anims.length==0){ return this; } this._currAnim++; if(this._anims[this._currAnim]){ this._anims[this._currAnim].play(null,true); } return this; }}); dojo.lfx.combine=function(_3f4){ var _3f5=arguments; if(dojo.lang.isArray(arguments[0])){ _3f5=arguments[0]; } if(_3f5.length==1){ return _3f5[0]; } return new dojo.lfx.Combine(_3f5); }; dojo.lfx.chain=function(_3f6){ var _3f7=arguments; if(dojo.lang.isArray(arguments[0])){ _3f7=arguments[0]; } if(_3f7.length==1){ return _3f7[0]; } return new dojo.lfx.Chain(_3f7); }; dojo.provide("dojo.uri.Uri"); dojo.uri=new function(){ this.dojoUri=function(uri){ return new dojo.uri.Uri(dojo.hostenv.getBaseScriptUri(),uri); }; this.moduleUri=function(_3f9,uri){ var loc=dojo.hostenv.getModulePrefix(_3f9); if(!loc){ return null; } if(loc.lastIndexOf("/")!=loc.length-1){ loc+="/"; } return new dojo.uri.Uri(dojo.hostenv.getBaseScriptUri()+loc,uri); }; this.Uri=function(){ var uri=arguments[0]; for(var i=1;i0&&!(j==1&&segs[0]=="")&&segs[j]==".."&&segs[j-1]!=".."){ if(j==segs.length-1){ segs.splice(j,1); segs[j-1]=""; }else{ segs.splice(j-1,2); j-=2; } } } } _3fe.path=segs.join("/"); } } } } uri=""; if(_3fe.scheme!=null){ uri+=_3fe.scheme+":"; } if(_3fe.authority!=null){ uri+="//"+_3fe.authority; } uri+=_3fe.path; if(_3fe.query!=null){ uri+="?"+_3fe.query; } if(_3fe.fragment!=null){ uri+="#"+_3fe.fragment; } } this.uri=uri.toString(); var _403="^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"; var r=this.uri.match(new RegExp(_403)); this.scheme=r[2]||(r[1]?"":null); this.authority=r[4]||(r[3]?"":null); this.path=r[5]; this.query=r[7]||(r[6]?"":null); this.fragment=r[9]||(r[8]?"":null); if(this.authority!=null){ _403="^((([^:]+:)?([^@]+))@)?([^:]*)(:([0-9]+))?$"; r=this.authority.match(new RegExp(_403)); this.user=r[3]||null; this.password=r[4]||null; this.host=r[5]; this.port=r[7]||null; } this.toString=function(){ return this.uri; }; }; }; dojo.provide("dojo.html.style"); dojo.html.getClass=function(node){ node=dojo.byId(node); if(!node){ return ""; } var cs=""; if(node.className){ cs=node.className; }else{ if(dojo.html.hasAttribute(node,"class")){ cs=dojo.html.getAttribute(node,"class"); } } return cs.replace(/^\s+|\s+$/g,""); }; dojo.html.getClasses=function(node){ var c=dojo.html.getClass(node); return (c=="")?[]:c.split(/\s+/g); }; dojo.html.hasClass=function(node,_40a){ return (new RegExp("(^|\\s+)"+_40a+"(\\s+|$)")).test(dojo.html.getClass(node)); }; dojo.html.prependClass=function(node,_40c){ _40c+=" "+dojo.html.getClass(node); return dojo.html.setClass(node,_40c); }; dojo.html.addClass=function(node,_40e){ if(dojo.html.hasClass(node,_40e)){ return false; } _40e=(dojo.html.getClass(node)+" "+_40e).replace(/^\s+|\s+$/g,""); return dojo.html.setClass(node,_40e); }; dojo.html.setClass=function(node,_410){ node=dojo.byId(node); var cs=new String(_410); try{ if(typeof node.className=="string"){ node.className=cs; }else{ if(node.setAttribute){ node.setAttribute("class",_410); node.className=cs; }else{ return false; } } } catch(e){ dojo.debug("dojo.html.setClass() failed",e); } return true; }; dojo.html.removeClass=function(node,_413,_414){ try{ if(!_414){ var _415=dojo.html.getClass(node).replace(new RegExp("(^|\\s+)"+_413+"(\\s+|$)"),"$1$2"); }else{ var _415=dojo.html.getClass(node).replace(_413,""); } dojo.html.setClass(node,_415); } catch(e){ dojo.debug("dojo.html.removeClass() failed",e); } return true; }; dojo.html.replaceClass=function(node,_417,_418){ dojo.html.removeClass(node,_418); dojo.html.addClass(node,_417); }; dojo.html.classMatchType={ContainsAll:0,ContainsAny:1,IsOnly:2}; dojo.html.getElementsByClass=function(_419,_41a,_41b,_41c,_41d){ _41d=false; var _41e=dojo.doc(); _41a=dojo.byId(_41a)||_41e; var _41f=_419.split(/\s+/g); var _420=[]; if(_41c!=1&&_41c!=2){ _41c=0; } var _421=new RegExp("(\\s|^)(("+_41f.join(")|(")+"))(\\s|$)"); var _422=_41f.join(" ").length; var _423=[]; if(!_41d&&_41e.evaluate){ var _424=".//"+(_41b||"*")+"[contains("; if(_41c!=dojo.html.classMatchType.ContainsAny){ _424+="concat(' ',@class,' '), ' "+_41f.join(" ') and contains(concat(' ',@class,' '), ' ")+" ')"; if(_41c==2){ _424+=" and string-length(@class)="+_422+"]"; }else{ _424+="]"; } }else{ _424+="concat(' ',@class,' '), ' "+_41f.join(" ') or contains(concat(' ',@class,' '), ' ")+" ')]"; } var _425=_41e.evaluate(_424,_41a,null,XPathResult.ANY_TYPE,null); var _426=_425.iterateNext(); while(_426){ try{ _423.push(_426); _426=_425.iterateNext(); } catch(e){ break; } } return _423; }else{ if(!_41b){ _41b="*"; } _423=_41a.getElementsByTagName(_41b); var node,i=0; outer: while(node=_423[i++]){ var _429=dojo.html.getClasses(node); if(_429.length==0){ continue outer; } var _42a=0; for(var j=0;j<_429.length;j++){ if(_421.test(_429[j])){ if(_41c==dojo.html.classMatchType.ContainsAny){ _420.push(node); continue outer; }else{ _42a++; } }else{ if(_41c==dojo.html.classMatchType.IsOnly){ continue outer; } } } if(_42a==_41f.length){ if((_41c==dojo.html.classMatchType.IsOnly)&&(_42a==_429.length)){ _420.push(node); }else{ if(_41c==dojo.html.classMatchType.ContainsAll){ _420.push(node); } } } } return _420; } }; dojo.html.getElementsByClassName=dojo.html.getElementsByClass; dojo.html.toCamelCase=function(_42c){ var arr=_42c.split("-"),cc=arr[0]; for(var i=1;i=1){ if(h.ie){ dojo.html.clearOpacity(node); return; }else{ _491=0.999999; } }else{ if(_491<0){ _491=0; } } } if(h.ie){ if(node.nodeName.toLowerCase()=="tr"){ var tds=node.getElementsByTagName("td"); for(var x=0;x=0.999999?1:Number(opac); }; dojo.provide("dojo.html.color"); dojo.html.getBackgroundColor=function(node){ node=dojo.byId(node); var _49d; do{ _49d=dojo.html.getStyle(node,"background-color"); if(_49d.toLowerCase()=="rgba(0, 0, 0, 0)"){ _49d="transparent"; } if(node==document.getElementsByTagName("body")[0]){ node=null; break; } node=node.parentNode; }while(node&&dojo.lang.inArray(["transparent",""],_49d)); if(_49d=="transparent"){ _49d=[255,255,255,0]; }else{ _49d=dojo.gfx.color.extractRGB(_49d); } return _49d; }; dojo.provide("dojo.html.common"); dojo.lang.mixin(dojo.html,dojo.dom); dojo.html.body=function(){ dojo.deprecated("dojo.html.body() moved to dojo.body()","0.5"); return dojo.body(); }; dojo.html.getEventTarget=function(evt){ if(!evt){ evt=dojo.global().event||{}; } var t=(evt.srcElement?evt.srcElement:(evt.target?evt.target:null)); while((t)&&(t.nodeType!=1)){ t=t.parentNode; } return t; }; dojo.html.getViewport=function(){ var _4a0=dojo.global(); var _4a1=dojo.doc(); var w=0; var h=0; if(dojo.render.html.mozilla){ w=_4a1.documentElement.clientWidth; h=_4a0.innerHeight; }else{ if(!dojo.render.html.opera&&_4a0.innerWidth){ w=_4a0.innerWidth; h=_4a0.innerHeight; }else{ if(!dojo.render.html.opera&&dojo.exists(_4a1,"documentElement.clientWidth")){ var w2=_4a1.documentElement.clientWidth; if(!w||w2&&w20){ ret.x+=isNaN(n)?0:n; } var m=_4db["offsetTop"]; ret.y+=isNaN(m)?0:m; _4db=_4db.offsetParent; }while((_4db!=_4d9)&&(_4db!=null)); }else{ if(node["x"]&&node["y"]){ ret.x+=isNaN(node.x)?0:node.x; ret.y+=isNaN(node.y)?0:node.y; } } } } if(_4d0){ var _4de=dojo.html.getScroll(); ret.y+=_4de.top; ret.x+=_4de.left; } var _4df=[dojo.html.getPaddingExtent,dojo.html.getBorderExtent,dojo.html.getMarginExtent]; if(_4d4>_4d5){ for(var i=_4d5;i<_4d4;++i){ ret.y+=_4df[i](node,"top"); ret.x+=_4df[i](node,"left"); } }else{ if(_4d4<_4d5){ for(var i=_4d5;i>_4d4;--i){ ret.y-=_4df[i-1](node,"top"); ret.x-=_4df[i-1](node,"left"); } } } ret.top=ret.y; ret.left=ret.x; return ret; }; dojo.html.isPositionAbsolute=function(node){ return (dojo.html.getComputedStyle(node,"position")=="absolute"); }; dojo.html._sumPixelValues=function(node,_4e3,_4e4){ var _4e5=0; for(var x=0;x<_4e3.length;x++){ _4e5+=dojo.html.getPixelValue(node,_4e3[x],_4e4); } return _4e5; }; dojo.html.getMargin=function(node){ return {width:dojo.html._sumPixelValues(node,["margin-left","margin-right"],(dojo.html.getComputedStyle(node,"position")=="absolute")),height:dojo.html._sumPixelValues(node,["margin-top","margin-bottom"],(dojo.html.getComputedStyle(node,"position")=="absolute"))}; }; dojo.html.getBorder=function(node){ return {width:dojo.html.getBorderExtent(node,"left")+dojo.html.getBorderExtent(node,"right"),height:dojo.html.getBorderExtent(node,"top")+dojo.html.getBorderExtent(node,"bottom")}; }; dojo.html.getBorderExtent=function(node,side){ return (dojo.html.getStyle(node,"border-"+side+"-style")=="none"?0:dojo.html.getPixelValue(node,"border-"+side+"-width")); }; dojo.html.getMarginExtent=function(node,side){ return dojo.html._sumPixelValues(node,["margin-"+side],dojo.html.isPositionAbsolute(node)); }; dojo.html.getPaddingExtent=function(node,side){ return dojo.html._sumPixelValues(node,["padding-"+side],true); }; dojo.html.getPadding=function(node){ return {width:dojo.html._sumPixelValues(node,["padding-left","padding-right"],true),height:dojo.html._sumPixelValues(node,["padding-top","padding-bottom"],true)}; }; dojo.html.getPadBorder=function(node){ var pad=dojo.html.getPadding(node); var _4f2=dojo.html.getBorder(node); return {width:pad.width+_4f2.width,height:pad.height+_4f2.height}; }; dojo.html.getBoxSizing=function(node){ var h=dojo.render.html; var bs=dojo.html.boxSizing; if((h.ie)||(h.opera)){ var cm=document["compatMode"]; if((cm=="BackCompat")||(cm=="QuirksMode")){ return bs.BORDER_BOX; }else{ return bs.CONTENT_BOX; } }else{ if(arguments.length==0){ node=document.documentElement; } var _4f7=dojo.html.getStyle(node,"-moz-box-sizing"); if(!_4f7){ _4f7=dojo.html.getStyle(node,"box-sizing"); } return (_4f7?_4f7:bs.CONTENT_BOX); } }; dojo.html.isBorderBox=function(node){ return (dojo.html.getBoxSizing(node)==dojo.html.boxSizing.BORDER_BOX); }; dojo.html.getBorderBox=function(node){ node=dojo.byId(node); return {width:node.offsetWidth,height:node.offsetHeight}; }; dojo.html.getPaddingBox=function(node){ var box=dojo.html.getBorderBox(node); var _4fc=dojo.html.getBorder(node); return {width:box.width-_4fc.width,height:box.height-_4fc.height}; }; dojo.html.getContentBox=function(node){ node=dojo.byId(node); var _4fe=dojo.html.getPadBorder(node); return {width:node.offsetWidth-_4fe.width,height:node.offsetHeight-_4fe.height}; }; dojo.html.setContentBox=function(node,args){ node=dojo.byId(node); var _501=0; var _502=0; var isbb=dojo.html.isBorderBox(node); var _504=(isbb?dojo.html.getPadBorder(node):{width:0,height:0}); var ret={}; if(typeof args.width!="undefined"){ _501=args.width+_504.width; ret.width=dojo.html.setPositivePixelValue(node,"width",_501); } if(typeof args.height!="undefined"){ _502=args.height+_504.height; ret.height=dojo.html.setPositivePixelValue(node,"height",_502); } return ret; }; dojo.html.getMarginBox=function(node){ var _507=dojo.html.getBorderBox(node); var _508=dojo.html.getMargin(node); return {width:_507.width+_508.width,height:_507.height+_508.height}; }; dojo.html.setMarginBox=function(node,args){ node=dojo.byId(node); var _50b=0; var _50c=0; var isbb=dojo.html.isBorderBox(node); var _50e=(!isbb?dojo.html.getPadBorder(node):{width:0,height:0}); var _50f=dojo.html.getMargin(node); var ret={}; if(typeof args.width!="undefined"){ _50b=args.width-_50e.width; _50b-=_50f.width; ret.width=dojo.html.setPositivePixelValue(node,"width",_50b); } if(typeof args.height!="undefined"){ _50c=args.height-_50e.height; _50c-=_50f.height; ret.height=dojo.html.setPositivePixelValue(node,"height",_50c); } return ret; }; dojo.html.getElementBox=function(node,type){ var bs=dojo.html.boxSizing; switch(type){ case bs.MARGIN_BOX: return dojo.html.getMarginBox(node); case bs.BORDER_BOX: return dojo.html.getBorderBox(node); case bs.PADDING_BOX: return dojo.html.getPaddingBox(node); case bs.CONTENT_BOX: default: return dojo.html.getContentBox(node); } }; dojo.html.toCoordinateObject=dojo.html.toCoordinateArray=function(_514,_515,_516){ if(_514 instanceof Array||typeof _514=="array"){ dojo.deprecated("dojo.html.toCoordinateArray","use dojo.html.toCoordinateObject({left: , top: , width: , height: }) instead","0.5"); while(_514.length<4){ _514.push(0); } while(_514.length>4){ _514.pop(); } var ret={left:_514[0],top:_514[1],width:_514[2],height:_514[3]}; }else{ if(!_514.nodeType&&!(_514 instanceof String||typeof _514=="string")&&("width" in _514||"height" in _514||"left" in _514||"x" in _514||"top" in _514||"y" in _514)){ var ret={left:_514.left||_514.x||0,top:_514.top||_514.y||0,width:_514.width||0,height:_514.height||0}; }else{ var node=dojo.byId(_514); var pos=dojo.html.abs(node,_515,_516); var _51a=dojo.html.getMarginBox(node); var ret={left:pos.left,top:pos.top,width:_51a.width,height:_51a.height}; } } ret.x=ret.left; ret.y=ret.top; return ret; }; dojo.html.setMarginBoxWidth=dojo.html.setOuterWidth=function(node,_51c){ return dojo.html._callDeprecated("setMarginBoxWidth","setMarginBox",arguments,"width"); }; dojo.html.setMarginBoxHeight=dojo.html.setOuterHeight=function(){ return dojo.html._callDeprecated("setMarginBoxHeight","setMarginBox",arguments,"height"); }; dojo.html.getMarginBoxWidth=dojo.html.getOuterWidth=function(){ return dojo.html._callDeprecated("getMarginBoxWidth","getMarginBox",arguments,null,"width"); }; dojo.html.getMarginBoxHeight=dojo.html.getOuterHeight=function(){ return dojo.html._callDeprecated("getMarginBoxHeight","getMarginBox",arguments,null,"height"); }; dojo.html.getTotalOffset=function(node,type,_51f){ return dojo.html._callDeprecated("getTotalOffset","getAbsolutePosition",arguments,null,type); }; dojo.html.getAbsoluteX=function(node,_521){ return dojo.html._callDeprecated("getAbsoluteX","getAbsolutePosition",arguments,null,"x"); }; dojo.html.getAbsoluteY=function(node,_523){ return dojo.html._callDeprecated("getAbsoluteY","getAbsolutePosition",arguments,null,"y"); }; dojo.html.totalOffsetLeft=function(node,_525){ return dojo.html._callDeprecated("totalOffsetLeft","getAbsolutePosition",arguments,null,"left"); }; dojo.html.totalOffsetTop=function(node,_527){ return dojo.html._callDeprecated("totalOffsetTop","getAbsolutePosition",arguments,null,"top"); }; dojo.html.getMarginWidth=function(node){ return dojo.html._callDeprecated("getMarginWidth","getMargin",arguments,null,"width"); }; dojo.html.getMarginHeight=function(node){ return dojo.html._callDeprecated("getMarginHeight","getMargin",arguments,null,"height"); }; dojo.html.getBorderWidth=function(node){ return dojo.html._callDeprecated("getBorderWidth","getBorder",arguments,null,"width"); }; dojo.html.getBorderHeight=function(node){ return dojo.html._callDeprecated("getBorderHeight","getBorder",arguments,null,"height"); }; dojo.html.getPaddingWidth=function(node){ return dojo.html._callDeprecated("getPaddingWidth","getPadding",arguments,null,"width"); }; dojo.html.getPaddingHeight=function(node){ return dojo.html._callDeprecated("getPaddingHeight","getPadding",arguments,null,"height"); }; dojo.html.getPadBorderWidth=function(node){ return dojo.html._callDeprecated("getPadBorderWidth","getPadBorder",arguments,null,"width"); }; dojo.html.getPadBorderHeight=function(node){ return dojo.html._callDeprecated("getPadBorderHeight","getPadBorder",arguments,null,"height"); }; dojo.html.getBorderBoxWidth=dojo.html.getInnerWidth=function(){ return dojo.html._callDeprecated("getBorderBoxWidth","getBorderBox",arguments,null,"width"); }; dojo.html.getBorderBoxHeight=dojo.html.getInnerHeight=function(){ return dojo.html._callDeprecated("getBorderBoxHeight","getBorderBox",arguments,null,"height"); }; dojo.html.getContentBoxWidth=dojo.html.getContentWidth=function(){ return dojo.html._callDeprecated("getContentBoxWidth","getContentBox",arguments,null,"width"); }; dojo.html.getContentBoxHeight=dojo.html.getContentHeight=function(){ return dojo.html._callDeprecated("getContentBoxHeight","getContentBox",arguments,null,"height"); }; dojo.html.setContentBoxWidth=dojo.html.setContentWidth=function(node,_531){ return dojo.html._callDeprecated("setContentBoxWidth","setContentBox",arguments,"width"); }; dojo.html.setContentBoxHeight=dojo.html.setContentHeight=function(node,_533){ return dojo.html._callDeprecated("setContentBoxHeight","setContentBox",arguments,"height"); }; dojo.provide("dojo.lfx.html"); dojo.lfx.html._byId=function(_534){ if(!_534){ return []; } if(dojo.lang.isArrayLike(_534)){ if(!_534.alreadyChecked){ var n=[]; dojo.lang.forEach(_534,function(node){ n.push(dojo.byId(node)); }); n.alreadyChecked=true; return n; }else{ return _534; } }else{ var n=[]; n.push(dojo.byId(_534)); n.alreadyChecked=true; return n; } }; dojo.lfx.html.propertyAnimation=function(_537,_538,_539,_53a,_53b){ _537=dojo.lfx.html._byId(_537); var _53c={"propertyMap":_538,"nodes":_537,"duration":_539,"easing":_53a||dojo.lfx.easeDefault}; var _53d=function(args){ if(args.nodes.length==1){ var pm=args.propertyMap; if(!dojo.lang.isArray(args.propertyMap)){ var parr=[]; for(var _541 in pm){ pm[_541].property=_541; parr.push(pm[_541]); } pm=args.propertyMap=parr; } dojo.lang.forEach(pm,function(prop){ if(dj_undef("start",prop)){ if(prop.property!="opacity"){ prop.start=parseInt(dojo.html.getComputedStyle(args.nodes[0],prop.property)); }else{ prop.start=dojo.html.getOpacity(args.nodes[0]); } } }); } }; var _543=function(_544){ var _545=[]; dojo.lang.forEach(_544,function(c){ _545.push(Math.round(c)); }); return _545; }; var _547=function(n,_549){ n=dojo.byId(n); if(!n||!n.style){ return; } for(var s in _549){ if(s=="opacity"){ dojo.html.setOpacity(n,_549[s]); }else{ n.style[s]=_549[s]; } } }; var _54b=function(_54c){ this._properties=_54c; this.diffs=new Array(_54c.length); dojo.lang.forEach(_54c,function(prop,i){ if(dojo.lang.isFunction(prop.start)){ prop.start=prop.start(prop,i); } if(dojo.lang.isFunction(prop.end)){ prop.end=prop.end(prop,i); } if(dojo.lang.isArray(prop.start)){ this.diffs[i]=null; }else{ if(prop.start instanceof dojo.gfx.color.Color){ prop.startRgb=prop.start.toRgb(); prop.endRgb=prop.end.toRgb(); }else{ this.diffs[i]=prop.end-prop.start; } } },this); this.getValue=function(n){ var ret={}; dojo.lang.forEach(this._properties,function(prop,i){ var _553=null; if(dojo.lang.isArray(prop.start)){ }else{ if(prop.start instanceof dojo.gfx.color.Color){ _553=(prop.units||"rgb")+"("; for(var j=0;j3){ _5c4.pop(); } var rgb=new dojo.gfx.color.Color(_5be); var _5c9=new dojo.gfx.color.Color(_5c4); var anim=dojo.lfx.propertyAnimation(node,{"background-color":{start:rgb,end:_5c9}},_5bf,_5c0,{"beforeBegin":function(){ if(_5c6){ node.style.backgroundImage="none"; } node.style.backgroundColor="rgb("+rgb.toRgb().join(",")+")"; },"onEnd":function(){ if(_5c6){ node.style.backgroundImage=_5c6; } if(_5c7){ node.style.backgroundColor="transparent"; } if(_5c1){ _5c1(node,anim); } }}); _5c2.push(anim); }); return dojo.lfx.combine(_5c2); }; dojo.lfx.html.unhighlight=function(_5cb,_5cc,_5cd,_5ce,_5cf){ _5cb=dojo.lfx.html._byId(_5cb); var _5d0=[]; dojo.lang.forEach(_5cb,function(node){ var _5d2=new dojo.gfx.color.Color(dojo.html.getBackgroundColor(node)); var rgb=new dojo.gfx.color.Color(_5cc); var _5d4=dojo.html.getStyle(node,"background-image"); var anim=dojo.lfx.propertyAnimation(node,{"background-color":{start:_5d2,end:rgb}},_5cd,_5ce,{"beforeBegin":function(){ if(_5d4){ node.style.backgroundImage="none"; } node.style.backgroundColor="rgb("+_5d2.toRgb().join(",")+")"; },"onEnd":function(){ if(_5cf){ _5cf(node,anim); } }}); _5d0.push(anim); }); return dojo.lfx.combine(_5d0); }; dojo.lang.mixin(dojo.lfx,dojo.lfx.html); dojo.provide("dojo.lfx.*"); function ParameterMap(defaultGroupName) { var that = this; // let the private functions access the object. var defaultGroup = defaultGroupName || "general"; var tables = new Object(); // primary structure describes parameters: // tables[group][name]["value"|property]=value // (TBD) tables[group]["parameters"][name]["value"|property]=value // (TBD) extended structure describes groups // (TBD) tables[group]["groupDesc"][name]["value"]=value var supportedGroups = []; function keys(object) { var _keys = []; for (var property in object) _keys.push(property); return _keys; } this.keys = keys; this.asArray = function (object) { if (!object) return []; var results = []; for (var i = 0, length = object.length; i < length; i++) { results.push(object[i]); } return results; } function createGroup(group) { //alert("Creating group " + group + "\n\nCurrent groups: " + keys(tables)); tables[group] = new Object(); supportedGroups = keys(tables); return tables[group]; } function getGroup(group) { group = group || defaultGroup; group = group.toString(); if (!tables[group]) { createGroup(group); } return tables[group]; } function getCell(group, name) { if (!getGroup(group)[name]) { getGroup(group)[name] = {}; } return getGroup(group)[name]; } function checkArgs(args) { if (args.length < args.callee.length) { throw new Error('Missing input parameters.'); } var inputs = that.asArray(arguments); inputs.shift(); if (inputs.length == 0) return; for (var index = 0, length = inputs.length; index < length; index++){ var value = inputs[index]; if (!value || 'string' !== typeof value) { throw new Error('Illegal input parameter.'); } } } this.getSupportedGroups = function() { return [].concat(supportedGroups); } this._setParameter = function (group, name, value) { checkArgs(arguments, name); getCell(group, name).value = value; return true; } this.setParameter = this._setParameter; this._getParameter = function (group, name) { checkArgs(arguments, name); return getCell(group, name).value; } this.getParameter = this._getParameter; this.defineParameter = function (group, name) {/* parameter,value) */ checkArgs(arguments, name); var cell = getCell(group, name); for (var i = 2,length = arguments.length ; (i+1) " + e.message, 3); } return xmlString; } this._toXML = this.toXML; // this.toString = this.toXML; } function ChannelManager(host) { var url = host; var docbase = document.location.href; if (docbase.lastIndexOf('/') != -1) { docbase = docbase.substr(0, docbase.lastIndexOf('/') + 1); } var HTTPRequestObj = new HttpRequest(); // function registerChannels(name, callbackmethod ) this.registerChannels = function(name, callbackmethod) { if (url != null) { //alert(url); HTTPRequestObj.sendRequest("GET", url, Array("name=" + name, "mode=sendAndRegister", "docbase=" + docbase), true, callbackmethod, "sendAndRegister"); } else { return false; } } // function lookupChannels(name, callbackmethod ) this.lookupChannels = function(name, callbackmethod) { if (url != null) { HTTPRequestObj.sendRequest("GET", url, Array("name=" + name, "mode=sendAndLookUp", "docbase=" + docbase), true, callbackmethod, "sendAndLookUp"); } else { return false; } } // function deregisterChannels(name, callbackmethod ) this.deregisterChannels = function(name, callbackmethod) { if (url != null) { HTTPRequestObj.sendRequest("GET", url, Array("name=" + name, "mode=sendAndDelete", "docbase=" + docbase), true, callbackmethod, "sendAndDelete"); } else { return false; } } } function EventManager() { var that = this; this.PMgr = ParameterManager; this.PMgr(); var router = new EventRouter(); this.routeid = router.getRouteId(this); this.javainterface = new Array(); //Fix for Bug 706 tm = new Date(); this.objectid = hex_md5(String((Math.random()) * tm.getTime()));; this.eventqueue = new Array(); this.raweventqueue = new Array(); this.events = {}; this.rawevents = []; if (arguments.length == 1) { this.doc = arguments[0]; } else { this.doc = window; } this.setJavaInterface = function(javainterface) { //Begin: Fix for Bug 706 this.javainterface[this.javainterface.length] = javainterface; //End: Fix for Bug 706 for(var i = 0; i < this.eventqueue.length;i++) { this.addJavaEventListener(this.eventqueue[i]); } this.eventqueue = new Array(); for(var i = 0; i < this.raweventqueue.length;i++) { this.addJavaRawEventListener(this.raweventqueue[i]); } this.raweventqueue = new Array(); } //Begin: Fix for Bug 706 this.removeJavaInterface = function(javainterface) { for(var i=0; i < this.javainterface.length; i++) { if (this.javainterface[i] == javainterface) { this.javainterface.splice(i,1); } } } //End: Fix for Bug 706 this.addEventListener = function() { var once = false; var evt; var func; var dw; dw = this.doc; if (arguments.length == 3) { once = arguments[2]; } else if (arguments.length == 4) { if (arguments[2] !== null) { once = arguments[2]; } dw = arguments[3]; } else if (arguments.length != 2) { directorTrace('[ERROR] EventManager.addEventListener' + ' INVALID NUMBER OF ARGUMENTS: ' + arguments.length); return false; } var evt = arguments[0]; var func = arguments[1]; var list; if (typeof this.events[evt] === "undefined") { this.events[evt] = []; } list = this.events[evt]; for (var item = 0;item < list.length;item++) { if (list[item]['docwindow'] === dw && list[item]['function'] === func) { return false; } } var er = []; er['function'] = func; er['once'] = once; er['docwindow'] = dw; if (dw.location.href !== window.location.href) { setTimeout("_EspreLive.theInstance().hack()",100); } list.push(er); this.events[evt] = list; this.addJavaEventListener(evt); return true; } this.removeEventListener = function() { var evt; var func; if (arguments.length !== 2) { directorTrace('[ERROR] EventManager.removeEventListener' + ' INVALID NUMBER OF ARGUMENTS: ' + arguments.length); return false; } var evt = arguments[0]; var func = arguments[1]; directorTrace('EventManager.removeEventListener' + ' evt: ' + evt + ' func: ' + func); if (typeof this.events[evt] === "undefined") { return false; } list = this.events[evt]; for (var item = 0;item < list.length;item++) { if (list[item]['function'] === func) { list.splice(item,1); this.events[evt] = list; if (list.length == 0) { this.removeJavaEventListener(evt); } return true; } } return false; } this.addJavaEventListener = function(evt) { if (typeof this.getParameter("event",evt) === "undefined") { //Begin: Fix for Bug 706 var i = 0; do { if (this.javainterface[i]) { this.setParameter("event",evt,evt); this.javainterface[i].ep_addEventListener(evt, "EventRouter.getInstance(" + this.routeid + ").routeEvent"); //End: Fix for Bug 706 } else { this.eventqueue[this.eventqueue.length] = evt; } i++; } while (i < this.javainterface.length); } }; this.removeJavaEventListener = function(evt) { //Begin: Fix for Bug 706 for (var i = 0; i < this.javainterface.length; i++) { if (this.javainterface[i] !== null) { return false; } else { if (typeof this.getParameter(evt, evt) !== "undefined") { this.removeParameter("event",evt,evt); this.javainterface[i].ep_removeEventListener(evt, "EventRouter.getInstance(" + this.routeid + ").routeEvent"); } //End: Fix for Bug 706 } } } this.handleEvent = function(data) { var literal = ''; var list = []; literal = data; literal = literal.replace(/{/g,'\\{'); literal = literal.replace(/}/g,'\\}'); literal = literal.replace(/'/g,"\\'"); literal = literal.replace(/"/g,'\\"'); literal = literal.replace(/:/g,'\\:'); literal = literal.replace(/&&/g,'&'); literal = literal.replace(/=/g,':"'); literal = literal.replace(/&/g,'",'); literal = "({" + literal + "\"})"; evt = eval(literal); if (typeof this.events[evt.type] === "undefined") { return; } list = this.events[evt.type]; for (var item = 0;item < list.length;item++) { if (typeof EventManager.noTryCatch === 'undefined') { try { if (typeof list[item]['function'] === "string") { list[item]['docwindow'].eval(list[item]['function']); } else { list[item]['function'](evt); } } catch(err) { alert('EventManager.handleEvent EXCEPTION: ' + err.description + '\n event: ' + event); } } else { if (typeof list[item]['function'] === "string") { list[item]['docwindow'].eval(list[item]['function']); } else { list[item]['function'](evt); } } if (list[item]['once'] === true) { this.removeEventListener(evt.type, list[item]['function']); } } } var defaultEventRuleGroupName = "_default"; this._eventRuleGroups = null; this._eventRuleGroupName = defaultEventRuleGroupName; this.getEventRuleGroupName = function() { return this._eventRuleGroupName; } this._setEventRuleGroupName = function(name) { this._eventRuleGroupName = name; } this._resetEventRuleGroupName = function() { this._eventRuleGroupName = defaultEventRuleGroupName; } /** * @private */ this._addEventRule = function(event,action) { directorTrace("EventManager._addEventRule : event=" + event + " action=" + action + " routeid=" + this.routeid + " this.doc.location.href=" + this.doc.location.href); this._addEventRuleToGroup(this._eventRuleGroupName,event,action); } /** * @private */ this.addEventRule = function(event,action) { directorTrace("EventManager.addEventRule : event=" + event + " action=" + action + " routeid=" + this.routeid + " this.doc.location.href=" + this.doc.location.href); this._addEventRuleToGroup(this._eventRuleGroupName,event,action); } this._addEventRuleToGroup = function(group,event,action) { if (this._eventRuleGroups == null) { this._eventRuleGroups = new Object(); } if (!this._eventRuleGroups[group]) { this._eventRuleGroups[group] = new Object(); } if (!this._eventRuleGroups[group][event]) { this._eventRuleGroups[group][event] = new Object(); } this._eventRuleGroups[group][event][action] = action; var tb = []; tb['group'] = group; tb['event'] = event; tb['action'] = action; tb['docwindow'] = this.doc; this.rawevents[this.rawevents.length] = tb; this.addJavaRawEventListener(event); } this.getActionWindow = function (event,action) { for (var i = 0;i < this.rawevents.length;i++) { if (this.rawevents[i]['group'] === this._eventRuleGroupName) { if (this.rawevents[i]['event'] === event) { if (this.rawevents[i]['action'] === action) { return this.rawevents[i]['docwindow']; } } } } return null; } this._removeEventRule = function(event,action) { this._removeEventRuleFromGroup(this._eventRuleGroupName,event,action); } this._removeEventRuleFromGroup = function(group,event,action) { if (this._eventRuleGroups[group]) { if (this._eventRuleGroup[group][event]) { if (this._eventRuleGroup[group][event][action]) { delete this._eventRuleGroup[group][event][action]; } } } } this.getEventActions = function(event) { return this.getEventActionsFromGroup(this._eventRuleGroupName,event); } this.getEventActionsFromGroup = function(group,event) { var eventActions = null; if ((this._eventRuleGroups !== null) && (this._eventRuleGroups[group])) { if (this._eventRuleGroups[group][event]) { eventActions = this._eventRuleGroups[group][event]; } } return eventActions; } var excludedEvents = new Object(); // Use an Object as a Hash//'playing_started,playing_progress,playing_end_of_video,playing_stopped,imageDisplayed,nextSegment'; this.excludeEvents = function(eventList) { // replace or initialize exclution hash this.excludedEvents = new Object(); this.addExcludedEvents(eventList); } this.addExcludedEvents = function(eventList){ var eventArray = eventList.split(","); if(eventArray.length > 0){ for (event in eventArray){ this.excludedEvents[event] = event; } } } this.removeExcludedEvents = function(eventList){ var eventArray = eventList.split(","); if(eventArray.length > 0){ for (event in eventArray){ if(isExcludedEvent(event)){ delete this.excludedEvents[event]; } } } } this.isExcludedEvent = function(event) { return (excludedEvents[event]==event); } this._eventDescriptor = null; this.getEventDescriptor = function() { return this._eventDescriptor; } this.invoke = function(event,eventDescriptor) { this._event = event; this._eventDescriptor = eventDescriptor; if (!this.notifyInProgress) { this.notifyDependents(event,eventDescriptor); } //preInit(); //this.trackTransitions(event,eventDescriptor); var actions = this.getEventActions(event); if ((actions != null) && (typeof actions !== 'undefined')) { var actionFound = false; for (var action in actions) { if (!actionFound) { this.invokeEvent(event,eventDescriptor); } actionFound = true; if (this.isExcludedEvent(event)) { } var dw = this.getActionWindow(event,action); directorTrace("EventManager.invoke : event=" + event + " action=" + action + " routeid=" + this.routeid + " window.location.href=" + dw.location.href); if (action.indexOf('(') !== -1) { //directorTrace('EventManager.invoke action: ' + action + ' typeof action: ' + (typeof action)); if (typeof EventManager.noTryCatch == 'undefined') { try { dw.eval(action); } catch(err) { directorTrace('EventManager.invoke EXCEPTION: ' + err.description + '\n action: ' + action + '\n event: ' + event + '\n eventDescriptor: ' + eventDescriptor + '\n dw.location.href: ' + dw.location.href); } } else { //directorTrace('EventManager.invoke' + ' ruleGroupName: ' + this._eventRuleGroupName + ' eventDescriptor: ' + eventDescriptor + ' action: ' + action); dw.eval(action); } } } if (!actionFound) { //directorTrace('Actor.invoke ACTION NOT FOUND FOR EVENT: ' + event); } } else { if (this.isExcludedEvent(event)) { //directorTrace('[2]Actor.invoke' + ' eventDescriptor: ' + eventDescriptor); } this.invokeEvent(event,eventDescriptor); } } this.invokeEvent = function(event,eventDescriptor) { if ((event.indexOf('=') == -1) && (event != 'init') && (eval('this.' + event) != undefined)) { eval('this.' + event + "(\'" + eventDescriptor + "\')"); } } this.dumpEventRuleGroup = function(group) { alert('group: ' + group); var events = this._eventRuleGroups[group]; for (var event in events) { alert('event: ' + event); for (var action in event) { alert('action: ' + action); } } } var dependents = null; this.addDependent = function(aDependent) { if (dependents === null) { dependents = new Array(); dependents[0] = null; } if (aDependent) { for (var i = 0; i < dependents.length; i++) { if (dependents[i] === null) { dependents[i] = aDependent; return; } } dependents[dependents.length] = aDependent; } } this.removeDependent = function(aDependent) { if (dependents !== null) { for (var i = 0; i < dependents.length; i++) { if (dependents[i] === aDependent) { dependents[i] = null; return; } } } } this.notifyInProgress = false; this.notifyDependents = function(event,eventDescriptor) { if (dependents !== null) { for (var i = 0; i < dependents.length; i++) { dependent = dependents[i]; if (dependent !== null) { this.notifyInProgress = true; try {dependent.invoke(event,eventDescriptor);} catch(err) { if (false) { /* directorTrace('EventManager.notifyDependents EXCEPTION: ' + err.description + '\n dependent: ' + dependent + '\n event: ' + event + '\n eventDescriptor: ' + eventDescriptor); */ } } this.notifyInProgress = false; } } } } this.fireEventDescriptor = function(eventDescriptor) { //directorTrace('EventManager.fireEventDescriptor eventDescriptor: ' + eventDescriptor); this.notifyDependents(ContextEventDescriptor.getEvent(eventDescriptor),eventDescriptor); } this.handleRawEvent = function (evt) { evt = unescape(evt); this.invoke(evt.split(';',1)[0],evt); } this.addJavaRawEventListener = function(evt) { if (typeof this.getParameter("rawevent",evt) == "undefined") { //Begin: Fix for Bug 706 if (this.javainterface.length != 0) { for (var i = 0; i < this.javainterface.length; i++) { if (this.javainterface[i] != null) { this.setParameter("rawevent",evt,evt); //this.javainterface.ep_addEventListener(evt, "EventRouter.getInstance(" + this.routeid + ").routeEvent"); this.javainterface[i].ep_addEventListener(evt, "EventRouter.getInstance(" + this.routeid + ").routeRawEvent", null, false); //End: Fix for Bug 706 } else { this.raweventqueue[this.raweventqueue.length] = evt; } } } else { this.raweventqueue[this.raweventqueue.length] = evt; } } } } function Style(_name) { //debugger; var that = this; var tempDiv = AppletManager.theInstance().getTempDivStyle(); if (tempDiv == false) { MeAddEvent(window, 'load',setTempDiv); } var containerDiv = null; var styleTimeout = null; var _cssText = ""; var _height = ""; var _width = ""; var _visibility = ""; var _display = ""; var _backgroundColor = ""; var _position = ""; var _left = ""; var _top = ""; var _cssFloat = ""; this.actorName = _name; this.isTempDiv = function() { if (tempDiv == false) { return false; } else { return true; } } function setTempDiv() { if (tempDiv == false) { tempDiv = AppletManager.theInstance().getTempDivStyle(); if (tempDiv != false) { if (_cssText != "") { tempDiv.cssText = _cssText; } if (_height != "" && _cssText == "") { tempDiv.height = _height; } if (_width != "" && _cssText == "") { tempDiv.width = _width; } if (_visibility != "" && _cssText == "") { tempDiv.visibility = _visibility; } if (_display != "" && _cssText == "") { tempDiv.display = _display; } if (_backgroundColor != "" && _cssText == "") { tempDiv.backgroundColor = _backgroundColor; } if (_position != "" && _cssText == "") { tempDiv.position = _position; } if (_left != "" && _cssText == "") { tempDiv.left = _left; } if (_top != "" && _cssText == "") { tempDiv.top = _top; } if (_cssFloat != "" && _cssText == "") { tempDiv.cssFloat = _cssFloat; } } //that.sync(); } } this.setContainerDiv = function(div) { if((div != "") && (div != "undefined") && (div!= null)){ containerDiv = div; setTimeout(function() { syncLater();},50); } } var syncLater = function() { that.sync(); } this.sync = function() { if (containerDiv != null) { if ((containerDiv.style.height != tempDiv.height) || (containerDiv.style.width != tempDiv.width)) { //Change for Height or Width calls wait for 50 milli secs to make Java resize call, to make sure that other height/width pair gets in... if((containerDiv.style.height != tempDiv.height)) { containerDiv.style.height = tempDiv.height; if (styleTimeout != null) { window.clearTimeout(styleTimeout); } else { styleTimeout = window.setTimeout(function() {syncLater();},50); return; } } if (containerDiv.style.width != tempDiv.width){ containerDiv.style.width = tempDiv.width; if (styleTimeout != null) { window.clearTimeout(styleTimeout); } else { styleTimeout = window.setTimeout(function() {syncLater();},50); return; } } styleTimeout = null; //Only one resize() call is made to Java Layer (even when both height and width are changed) //AppletManager.theInstance().resize(that.actorName,containerDiv.style.width,containerDiv.style.height); var tt = AppletManager.theInstance().getApplet(that.actorName); if ((typeof tt === 'undefined') || (tt === null)) { styleTimeout = window.setTimeout(function() {syncLater();},50); return; } tt.height = '100%'; //containerDiv.style.height; tt.width = '100%'; //containerDiv.style.width; //tt.height = containerDiv.style.height; //tt.width = containerDiv.style.width; } if(containerDiv.style.visibility != tempDiv.visibility) { containerDiv.style.visibility = tempDiv.visibility; } if(containerDiv.style.display != tempDiv.display) { containerDiv.style.display = tempDiv.display; } if(containerDiv.style.backgroundColor != tempDiv.backgroundColor) { containerDiv.style.backgroundColor = tempDiv.backgroundColor; AppletManager.theInstance().setBackgroundColor(that.actorName,containerDiv.style.backgroundColor); } if(containerDiv.style.position != tempDiv.position) { containerDiv.style.position = tempDiv.position; } if(containerDiv.style.left != tempDiv.left) { containerDiv.style.left = tempDiv.left; } if(containerDiv.style.top != tempDiv.top) { containerDiv.style.top = tempDiv.top; } if(containerDiv.style.cssFloat != tempDiv.cssFloat) { containerDiv.style.cssFloat = tempDiv.cssFloat; } } } this.cssText = function() { if (arguments.length == 0) { if (tempDiv == false) { return _cssText; } else { return tempDiv.cssText; } } if((arguments[0] == "undefined") || (arguments[0] == "")) { return; } if (tempDiv == false) { _cssText = arguments[0]; } else { tempDiv.cssText = arguments[0]; this.sync(); } } this.height = function() { if (arguments.length == 0) { if (tempDiv == false) { return _height; } else { return tempDiv.height; } } if((arguments[0] == "undefined")||(arguments[0] == "")) { return; } if (tempDiv == false) { _height = arguments[0]; } else { tempDiv.height = arguments[0]; this.sync(); } } this.width = function() { if (arguments.length == 0) { if (tempDiv == false) { return _width; } else { return tempDiv.width; } } if((arguments[0] == "undefined") ||(arguments[0] == "")){ return; } if (tempDiv == false) { _width = arguments[0]; } else { tempDiv.width = arguments[0]; this.sync(); } } this.visibility = function() { if (arguments.length == 0) { if (tempDiv == false) { return _visibility; } else { return tempDiv.visibility; } } if((arguments[0] == "undefined")||(arguments[0] == "")) { return; } if (tempDiv == false) { _visibility = arguments[0]; } else { tempDiv.visibility = arguments[0]; this.sync(); } } this.display = function() { if (arguments.length == 0) { if (tempDiv == false) { return _display; } else { return tempDiv.display; } } if((arguments[0] == "undefined")||(arguments[0] == "")) { return; } if (tempDiv == false) { _display = arguments[0]; } else { tempDiv.display = arguments[0]; this.sync(); } } this.backgroundColor = function() { if (arguments.length == 0) { if (tempDiv == false) { return _backgroundColor; } else { return tempDiv.backgroundColor; } } if((arguments[0] == "undefined")||(arguments[0] == "")) { return; } if (tempDiv == false) { _backgroundColor = arguments[0]; } else { tempDiv.backgroundColor = arguments[0]; this.sync(); } } this.position = function() { if (arguments.length == 0) { if (tempDiv == false) { return _position; } else { return tempDiv.position; } } if((arguments[0] == "undefined")||(arguments[0] == "")) { return; } if (tempDiv == false) { _position = arguments[0]; } else { tempDiv.position = arguments[0]; this.sync(); } } this.left = function() { if (arguments.length == 0) { if (tempDiv == false) { return _left; } else { return tempDiv.left; } } if((arguments[0] == "undefined")||(arguments[0] == "")) { return; } if (tempDiv == false) { _left = arguments[0]; } else { tempDiv.left = arguments[0]; this.sync(); } } this.top = function() { if (arguments.length == 0) { if (tempDiv == false) { return _top; } else { return tempDiv.top; } } if((arguments[0] == "undefined")||(arguments[0] == "")) { return; } if (tempDiv == false) { _top = arguments[0]; } else { tempDiv.top = arguments[0]; this.sync(); } } this.cssFloat = function() { if (arguments.length == 0) { if (tempDiv == false) { return _cssFloat; } else { return tempDiv.cssFloat; } } if((arguments[0] == "undefined")||(arguments[0] == "")) { return; } if (tempDiv == false) { _cssFloat = arguments[0]; } else { tempDiv.cssFloat = arguments[0]; this.sync(); } } } //End of style object function LSVXStream(){ var that = this; //this.Event = EventManager; //this.Event(); // acquire parametermanager this.PMgr = ParameterManager; this.PMgr("general"); // TODO: Communicate with ShaoMin to make sure that the javascript default // values match with the java object var defaultAutoMute = false; var defaultNoAudio = false; var defaultLoop = false; var defaultPrimary = true; var defaultVolume = 90; var defaultPauseViaStall = true; var defaultConvertSegments = false; var defaultRgbSrcEnabled = false; var defaultRgbSrcIdx = -1; var defaultVideoDataCacheSize = 524288; var defaultVideoIndexCacheSize = 262144; var defaultAudioDataCacheSize = 262144; var defaultAudioIndexCacheSize = 262144; var defaultUri = 'video_s1.dat.sdl'; var defaultAuditPlayState = false; var defaultAuditPointer = false; var defaultAutoBandwidth = false; var defaultSyncBandwidth = false; var defaultMute = false; this.autoMute = defaultAutoMute; this.loop = defaultLoop; this.pauseViaStall = defaultPauseViaStall; this.noAudio = defaultNoAudio; this._mute = defaultMute; this.convertSegments = defaultConvertSegments; this.volume = defaultVolume; this.videoDataCacheSize = defaultVideoDataCacheSize; this.videoIndexCacheSize = defaultVideoIndexCacheSize; this.audioDataCacheSize = defaultAudioDataCacheSize this.audioIndexCacheSize = defaultAudioIndexCacheSize this.auditPlayState = defaultAuditPlayState; this.auditPointer = defaultAuditPointer; this.autoBandwidth = defaultAutoBandwidth; this.syncBandwidth = defaultSyncBandwidth; this.isPrimary = true; this.TriesToConnect = 0; this.codeBaseOverride = null; this.uri = defaultUri; this.assignedActor = null; var jLsvxStream = null; var jLogger = null; var hostingResolved = true; var gatewayResolved = true; this.fromSeg = 1; this.fromFrm = 0; this.toSeg = -1; this.toFrm = -1; this.pauseAtEnd = false; this.queueAtPercentage = -1; var stubResolveGatewayUri= function(){ var recordingName = that.uri.trim().substring(7); that.uri = "http://" + EVME_RTPR_ADDR + ":" + EVME_RTPR_PORT + "/" + recordingName + "/video_s1.dat.sdl"; // that.uri = "http://esprelive.com:8080/" + recordingName + "/video_s1.dat.sdl"; gateWayResolved = true; } var resolveHostingUri = function(){ var uriPathArray = that.uri.substring(10).split('/'); var newNS = null; var _project = null; if (uriPathArray.length == 1) { _project = uriPathArray[0]; } else if (uriPathArray.length == 2) { newNS = uriPathArray[0]; _project = uriPathArray[1]; } var _myHosting = new HostingAgent(); //_myHosting.setNamespace(defaultNS); if (newNS != null) { hostingResolved = _myHosting.getDefaultFile(newNS, _project, urlResolvedCallBack); } else { hostingResolved = _myHosting.getDefaultFile(_project, urlResolvedCallBack); } } if (arguments.length >= 1) { this.uri = (arguments[0].startsWith('ifile:/') || arguments[0].startsWith('ifile:/')) ? arguments[0].substring(1) : arguments[0]; // ignore the 'i' in 'ifile:/...' if (this.uri.indexOf("hosting://") >= 0) { hostingResolved = false; resolveHostingUri(); } else if(this.uri.indexOf("rtpr://") >= 0){ gateWayResolved = false; stubResolveGatewayUri(); } } function urlResolvedCallBack(_result){ hostingResolved = true; if (Stream.IsBoolean(_result)) { //TODO: Add error event alert("URL Can not be resolved"); } that.uri = _result; } this.setLsvxParameter = function(_name, _value){ this.setParameter("general", _name, _value); if(this.isOpen()){ jLsvxStream.ep_setParameter(_name,_value); this.removeParameter("general", _name); } } this.getLsvxParameter = function(_name){ if(this.isOpen()){ return jLsvxStream.ep_getParameter(_name); } return null; } this.setLoop = function(_loop){ this.loop = _loop; if (this.isOpen()) { jLsvxStream.ep_setParameter("loop", this.loop); } } this.getLoop = function(){ if (this.isOpen()) { return jLsvxStream.ep_getParameter("loop"); } return -1; } this.setNoAudio = function(_noAudio){ if (typeof _noAudio == 'boolean') { this.noAudio = _noAudio; } else if (typeof _noAudio == 'string') { this.noAudio = (_noAudio.toLowerCase() == 'true') ? true : false; } if (this.noAudio) { this.setVolume(0); this.setAudioDataCacheSize(-1); this.setAudioIndexCacheSize(-1); if (this.isOpen()) { jLsvxStream.ep_setVolume(0); jLsvxStream.ep_setAudioDataCacheSize(-1); jLsvxStream.ep_setAudioIndexCacheSize(-1); } } if (this.isOpen()) { jLsvxStream.ep_setNoAudio(this.noAudio); } } this.getNoAudio = function(){ return this.noAudio; } this.mute = function(){ this._mute = true; if(this.isOpen()){ jLsvxStream.ep_manualMute(); } } this.unmute = function(){ this._mute = false; if (this.isOpen()) { jLsvxStream.ep_manualUnMute()(); } } this.setMute = function(_mute){ if ((typeof _mute == 'string') && ((_mute.toLowerCase() == 'false') || _mute.toLowerCase() == '0')){ this._mute = false; } else { this._mute = (new Boolean(_mute)).valueOf(); } if (this.isOpen()) { (this._mute) ? jLsvxStream.ep_manualMute() : jLsvxStream.ep_manualUnMute(); } } this.setConvertSegments = function(_convertSegments){ this.convertSegments = _convertSegments; if (this.isOpen()) { jLsvxStream.ep_setConvertSegments(this.convertSegments); } } this.getConvertSegments = function(){ if (this.isOpen()) { return jLsvxStream.ep_convertSegments; } return -1; //TODO: Error } this.setVolume = function(_volume){ if (!Stream.IsNumeric(_volume)) { return; } if (_volume > 100) { _volume = 100; } else if (_volume < 0) { _volume = 0; } this.volume = _volume; if (this.isOpen()) { jLsvxStream.ep_setVolume(this.volume); } } this.getVolume = function(){ return this.volume; } this.setVideoDataCacheSize = function(_vdc){ this.videoDataCacheSize = _vdc; if (this.isOpen()) { jLsvxStream.ep_setVideoDataCacheSize(this.videoDataCacheSize); } } this.getVideoDataCacheSize = function(){ return this.videoDataCacheSize; } this.setVideoIndexCacheSize = function(_vic){ this.videoIndexCacheSize = _vic; if (this.isOpen()) { jLsvxStream.ep_setVideoIndexCacheSize(this.videoIndexCacheSize); } } this.getVideoIndexCacheSize = function(){ return this.videoIndexCacheSize; } this.setAudioDataCacheSize = function(_adc){ this.audioDataCacheSize = _adc; if (this.isOpen()) { jLsvxStream.ep_setAudioDataCacheSize(this.audioDataCacheSize); } } this.getAudioDataCacheSize = function(){ if (this.isOpen()) { return jLsvxStream.ep_getAudioDataCacheSize(); } //TODO: } this.setAudioIndexCacheSize = function(_aic){ this.audioIndexCacheSize = _aic; if (this.isOpen()) { jLsvxStream.ep_setAudioIndexCacheSize(this.audioIndexCacheSize); } } this.getAudioIndexCacheSize = function(){ if (this.isOpen()) { return jLsvxStream.ep_getAudioIndexCacheSize(); } return -1; //TODO: } this.setAutoBandwidth = function(_autoBandwidth){ this.autoBandwidth = _autoBandwidth; if (this.isOpen()) { jLsvxStream.ep_setAutoBandwidth(this.autoBandwidth); } } this.getAutoBandwidth = function(){ return this.autoBandwidth; } this.setSyncBandwidth = function(_syncBandwidth){ this.syncBandwidth = _syncBandwidth; if (this.isOpen()) { jLsvxStream.ep_setSyncBandwidth(this.syncBandwidth); } } this.getSyncBandwidth = function(){ if (this.isOpen()) { return jLsvxStream.ep_getSyncBandwidth(); } //TODO: } this.setCodeBaseOverride = function(_codeBaseOverride){ this.codeBaseOverride = _codeBaseOverride; if (this.isOpen()) { jLsvxStream.ep_setCodeBaseOverride(this.codeBaseOverride); } } this.getCodeBaseOverride = function(){ return this.codeBaseOverride; } this.setUri = function(_uri){ this.uri = _uri; if (this.isOpen()) { jLsvxStream.ep_setSdlUrl(that.uri); } } this.getUri = function(){ return this.uri; } this.open = function(){ // TODO GLM please review how to open an already open stream. Can cause major memory leak. //if (this.isOpen()) this.close(); //connect(); if (!this.isOpen()) connect(); } this.close = function(){ if (this.isOpen()) { jLsvxStream.ep_stopStream(); jLsvxStream = null; } } // Private function var connect = function(){ var JSInterfaceObject = JSInterface.theInstance(); JSInterfaceObject.getInterface(that.getStreamType(), callbackfromInterface); } // Private Function var callbackfromInterface = function(InterfaceObject){ jLsvxStream = InterfaceObject; // alert("Stream ready."); syncJsToJava(); Stream.streamArray[that.getStreamId()] = that; that.setJavaInterface(InterfaceObject); } // Users may have changed the default values, look through the list and sync // to java object var syncJsToJava = function(){ if (that.assignedActor != null) { jLsvxStream.ep_assignActor(that.assignedActor); } if (that.autoMute != defaultAutoMute) { jLsvxStream.ep_setParameter("autoMute", that.autoMute); } if (that.loop != defaultLoop) { jLsvxStream.ep_setParameter("loop", that.loop); } // TODO: what exactly does that do? if (that.pauseViaStall != defaultPauseViaStall) { jLsvxStream.ep_setPauseViaStall(that.pauseViaStall); } if (that.noAudio != defaultNoAudio) { jLsvxStream.ep_setNoAudio(that.noAudio); } if (that._mute != defaultMute) { jLsvxStream.ep_manualMute(); } if(that.uri != defaultUri){ jLsvxStream.ep_setSdlUrl(that.uri); } if (that.convertSegments != defaultConvertSegments) { jLsvxStream.ep_setConvertSegments(that.convertSegments); } if (that.volume != defaultVolume) { jLsvxStream.ep_setVolume(that.volume); } if (that.videoDataCacheSize != defaultVideoDataCacheSize) { jLsvxStream.ep_setVideoDataCacheSize(that.videoDataCacheSize); } if (that.videoIndexCacheSize != defaultVideoIndexCacheSize) { jLsvxStream.ep_setVideoIndexCacheSize(that.videoIndexCacheSize); } if (that.audioDataCacheSize != defaultAudioDataCacheSize) { jLsvxStream.ep_setAudioDataCacheSize(that.audioDataCacheSize); } if (that.audioIndexCacheSize != defaultAudioIndexCacheSize) { jLsvxStream.ep_setAudioIndexCacheSize(that.audioIndexCacheSize); } // if (that.auditPlayState != false){ // jLsvxStream.ep_(that.auditPlayState); // } // if (that.auditPointer != false){ // jLsvxStream.ep_(that.auditPointer); // } if (that.autoBandwidth != false) { jLsvxStream.ep_setAutoBandwidth(that.autoBandwidth); } if(that.isPrimary == false){ jLsvxStream.ep_setSecondary(); } else { jLsvxStream.ep_setPrimary(); } // if (that.syncBandwidth != false){ // jLsvxStream.ep_(that.syncBandwidth); // } // if (that.codeBaseOverride != null) { // jLsvxStream.ep_setCodeBaseOverride(that.codeBaseOverride); // } // jLsvxStream.ep_setParameter('playIcon','/images/play.gif'); // jLsvxStream.ep_setParameter('controlsVisible','true'); // jLsvxStream.ep_setParameter('pauseIcon','/images/pause.gif'); // jLsvxStream.ep_setParameter('stopIcon','/images/stop.gif'); //jLsvxStream.ep_setParameter('startUpImage','http://www.espresolutions.com/newsite2007/images/solutions_r1_c1.gif'); // TODO jLsvxStream.ep_setParameter("pels", '320'); // TODO: jLsvxStream.ep_setParameter("lines", '240'); // TODO jLsvxStream.ep_setParameter('backgroundColor', 'yellow'); // if (that.uri != defaultUri){ // c(that.uri); // } // TODO:Check if there are any parameters that are set and propagate // these paramaters to java object. // jLsvxStream.ep_setParameter(name, that.value); if (that.gestures != defaultGestures) { jLsvxStream.ep_setParameter("gestures", that.gestures); } //debugger; var aParams = that.getActiveParameters("general"); for( var i= 0; i < aParams.length; i++){ jLsvxStream.ep_setParameter(aParams[i], that.getParameter("general",aParams[i] )); that.removeParameter("general", aParams[i]); } } this.getState = function(){ if (!this.isOpen()) { return "NOTREADY"; } return Stream.CurrentState(jLsvxStream.ep_getState()); } this.isOpen = function(){ if (jLsvxStream != null) return true; return false; }; // THE FOLLOWING METHODS ARE ONLY VALID IF THE STREAM IS OPEN this.assignActor = function(_name){ this.assignedActor = _name; if (this.isOpen()) { jLsvxStream.ep_assignActor(_name); } } this.unassignActor = function(){ var oldAssignedActor = this.assignedActor; this.assignedActor = null; if (this.isOpen()) { jLsvxStream.ep_unassignActor(); } return oldAssignedActor; } this.buffer = function(){ this.fromSeg = 1; this.fromFrm = 0; if (arguments.length == 1) { // just the uri this.setUri(arguments[0]); } else if (arguments.length == 3) { this.fromSeg = Stream.IsNumeric(arguments[0]) ? arguments[0] : this.fromSeg; this.fromFrm = Stream.IsNumeric(arguments[1]) ? arguments[1] : this.fromFrm; this.setUri(arguments[2]); } _buffer(); } var _buffer = function(){ if (!that.isOpen()) { if (that.TriesToConnect < LSVXStream.LIMIT) { that.TriesToConnect++; setTimeout(function(){ _buffer(); }, 1000); return; } else { //TODO: log Add error event saying that the stream could not be opened. directorTrace("LSVXStream._buffer UNABLE TO OPEN STREAM." + " uri: " + that.getUri()); return null; } } var _status = null; var oldName = jLsvxStream.ep_getStreamName(); var newName = that.getStreamType() + that.localIndex; if (oldName == null || oldName != newName) { jLsvxStream.ep_setStreamName(that.getStreamType() + that.localIndex); // TODO } //_status = jLsvxStream.ep_playClipFromTo(that.fromSeg, that.fromFrm, that.toSeg, that.toFrm, // that.pauseAtEnd, that.getUri()); _status = jLsvxStream.ep_bufferClipFrom(that.fromSeg, that.fromFrm, that.getUri()); return that.processResult(" streamId: " + that.getStreamId() + " streamType: " + that.getStreamType() + " ep_bufferClipFrom()", _status); } this.play = function(){ var _staus = null; this.fromSeg = 1; this.fromFrm = 0; this.toSeg = -1; this.toFrm = -1; this.pauseAtEnd = true; if (arguments.length == 1) { // just the uri this.setUri(arguments[0]); } else if (arguments.length == 2) { this.setUri(arguments[0]); this.pauseAtEnd = (arguments[1] == false) ? false : true; } else if (arguments.length == 6) { this.fromSeg = Stream.IsNumeric(arguments[0]) ? arguments[0] : fromSeg; this.fromFrm = Stream.IsNumeric(arguments[1]) ? arguments[1] : fromFrm; this.toSeg = Stream.IsNumeric(arguments[2]) ? arguments[2] : toSeg; this.toFrm = Stream.IsNumeric(arguments[3]) ? arguments[3] : toFrm; this.pauseAtEnd = (arguments[4] == false) ? false : true; this.setUri(arguments[5]); } _play(); //call a local function } var _play = function(){ if (!that.isOpen()) { if (that.TriesToConnect < LSVXStream.LIMIT) { that.TriesToConnect++; setTimeout(function(){ _play(); }, 1000); return; } else { //TODO: log Add error event saying that the stream could not be opened. directorTrace("LSVXStream._play UNABLE TO OPEN STREAM." + " uri: " + that.getUri()); return null; } } var _status = null; var oldName = jLsvxStream.ep_getStreamName(); var newName = that.getStreamType() + that.localIndex; if (oldName == null || oldName != newName) { jLsvxStream.ep_setStreamName(that.getStreamType() + that.localIndex); // TODO } if(that.queueAtPercentage != -1){ _status = jLsvxStream.ep_play(); that.queueAtPercentage = -1; } else { _status = jLsvxStream.ep_playClipFromTo(that.fromSeg, that.fromFrm, that.toSeg, that.toFrm, that.pauseAtEnd, that.getUri()); } //directorTrace('LSVXStream._play EXIT streamName: ' + jLsvxStream.ep_getStreamName() + ' streamId: ' + jLsvxStream.ep_getStreamId()); return that.processResult(" streamId: " + that.getStreamId() + " streamType: " + that.getStreamType() + " ep_play()", _status); } this.stop = function(){ var _status = null; if (this.isOpen()) { _status = jLsvxStream.ep_stop(); } return this.processResult("ep_stop()", _status); } this.pause = function(){ var _status = null; if (this.isOpen()) { _status = jLsvxStream.ep_pause(); } return this.processResult(" streamId: " + this.getStreamId() + " streamType: " + this.getStreamType() + " ep_pause()", _status); } this.resume = function(){ var _status = null; if (this.isOpen()) { _status = jLsvxStream.ep_resume(); } return this.processResult(" streamId: " + this.getStreamId() + " streamType: " + this.getStreamType() + " ep_resume()", _status); } this.getStreamType = function(){ return "LSVXStream"; } this.isMuted = function(){ if (this.isOpen()) { return jLsvxStream.ep_isManualMuted(); } else { // TODO: } } this.isPlaying = function(){ if (this.isOpen()) { return jLsvxStream.ep_isPlaying(); } else { // TODO: } } this.isPaused = function(){ if (this.isOpen()) { return jLsvxStream.ep_isPaused(); } else { // TODO: } } this.fullScreen = function(){ if (this.isOpen()) { jLsvxStream.ep_fullScreen(); } else { //TODO: } } this.isStopped = function(){ if (this.isOpen()) { return jLsvxStream.ep_isStopped(); } else { // TODO: } } this.getStreamId = function(){ if (this.isOpen()) { return jLsvxStream.ep_getStreamId(); } return -1; } this.localIndex = LSVXStream.COUNTER++; var defaultGestures = 'false'; this.gestures = defaultGestures; this.setGestures = function(_gestures) { this.gestures = _gestures; if (this.isOpen()) { jLsvxStream.ep_setParameter("gestures", this.gestures); } } // Thumbnail generation this.generateThumbnail = function(width, height) { if (this.isOpen()) { if (arguments.length == 0) return jLsvxStream.ep_generateThumbnail(); else if (arguments.length == 2) return jLsvxStream.ep_generateThumbnail(width, height); else return false; } return false; } this.getThumbnail = function(index) { if (this.isOpen()) { if (arguments.length == 0) // when index is 0, it means the latest thumbnail return jLsvxStream.ep_getThumbnail(0); else if (index < 1 && index > 3) return null; else return jLsvxStream.ep_getThumbnail(index); } return null; } this.getThumbnailSize = function(index) { if (this.isOpen()) { if (arguments.length == 0) // when index is 0, it means the size of the latest thumbnail return jLsvxStream.ep_getThumbnailSize(0); else if (index < 1 && index > 3) return null; else return jLsvxStream.ep_getThumbnailSize(index); } return null; } this.getRawStream = function() {return jLsvxStream;} this.setPrimary = function(){ this.isPrimary = true; if(this.isOpen()){ jLsvxStream.ep_setPrimary(); } } this.setSecondary = function(){ this.isPrimary = false; if(this.isOpen()){ jLsvxStream.ep_setSecondary(); } } this.queueAt = function(_percentage){ if(Stream.IsNumeric(_percentage) && _percentage >=0 && _percentage <=100){ this.queueAtPercentage = _percentage; if(this.isOpen()){ jLsvxStream.ep_queueAt(_percentage); } } else { loggerJObject.error(" Invalid percentage value : " + _percentage); } } this.getProductionInfo = function(){ var _status = 0; if(this.isOpen()){ _status = jLsvxStream.ep_getProductionInfo(); } else{ loggerJObject.warn(" LSVX Stream is not open. ---- getProductionInfo() method deferred until stream is open"); return false; } if(_status != 0){ ErrorCode.log("ep_getProductionInfo()", _status, ErrorCode.ERROR); return false; } return true; } this.requestStreamInfo = function(){ var _status = 0; if(this.isOpen()){ _status = jLsvxStream.ep_getProductionInfo(); } else{ loggerJObject.warn(" LSVX Stream is not open. ---- getProductionInfo() method deferred until stream is open"); return false; } if(_status != 0){ ErrorCode.log("ep_getProductionInfo()", _status, ErrorCode.ERROR); return false; } return true; } } /** * @ignore */ LSVXStream.COUNTER = 0; LSVXStream.LIMIT = 10; /**when multiplied by 1 sec, it gives a 10 second try and quit trying.*/ function EventRouter() { var id = EventRouter.instances.length; var eventuser; EventRouter.instances[id] = this; this.getRouteId = function (instance) { eventuser = instance; return id; } this.routeEvent = function (event) { setTimeout("EventRouter.getInstance(" + id + ").routeLater('" + event + "')",10); } this.routeRawEvent = function (event) { setTimeout("EventRouter.getInstance(" + id + ").routeRawLater('" + event + "')",10); } this.routeLater = function (event) { eventuser.handleEvent(unescape(event)); } this.routeRawLater = function (event) { eventuser.handleRawEvent(event); } } EventRouter.instances = new Array(); EventRouter.getInstance = function(id){ return EventRouter.instances[id]; } function AppletManager() { var that = this; var queue = new Array(); var state = 'blocked' ; var loggerJObject = null; //Logger Java Object var JSInterfaceObject = JSInterface.theInstance(); var processqueuetimeout = null; var appletlist = new Array(); this.eventapplets = new Array(); this.appfolder = 'LiveService'; if("undefined" == typeof AppletManager.instance) { AppletManager.instance = this; // define the singleton } if(this != AppletManager.instance) return AppletManager.instance; // return the singleton if it already exists this.PMgr = ParameterManager; // From ParameterManager.js (JavaScript file) this.PMgr("applets"); this.setState = function (_state) { state = _state; } this.setAppFolder = function (path) { this.appfolder = path; } this.startApplet = function() { var appletSpecInstance; var callbackMethod; var target = null; if (arguments.length == 2) { appletSpecInstance = arguments[0]; callbackMethod = arguments[1]; } else if (arguments.length == 3) { appletSpecInstance = arguments[0]; callbackMethod = arguments[1]; target = arguments[2]; } else { return false; } if ((typeof(appletSpecInstance.getParameter("APP_FOLDER")) == 'undefined') || appletSpecInstance.getParameter("APP_FOLDER") == null){ appletSpecInstance.addParameter("APP_FOLDER",this.appfolder); } var name = appletSpecInstance.getParameter("applet","name"); appletlist[appletlist.length] = name; this.defineParameter("applets", name, "value", ""); this.setProperty("applets",name,"callback",callbackMethod); this.setProperty("applets",name,"appletspec",appletSpecInstance); if (target != null) { this.setProperty("applets",name,"targetTag",target); } queue.push(name); if (processqueuetimeout == null) { setTimeout(function() { processQueue(); },100); // TODO: Research this problem that requires this timeout. Falied on R-Systems machines. } return true; } this.destroyApplet = function(_name) { try { if (typeof this.getProperty("applets",_name,"targetTag") != "undefined") { var parent = document.getElementById(this.getProperty("applets",_name,"targetTag")); } else { var parent = document.body; } var child = document.getElementById(this.getProperty("applets",_name,"containerElement")); if (child !== null) { child.style.display = "none"; parent.removeChild(child); } this.removeParameter("applets",_name); } catch (err) { //alert("AppletManager.destroyApplet EXCEPTION: " + err.message); loggerJObject.info("AppletManager.destroyApplet EXCEPTION: " + err.message + '\n _name: ' + _name); return false; } return true; } this.getTempDivStyle = function(style) { if (state == "blocked") return false; var tempParent = document.createElement("DIV"); tempParent.id = "tempParent"; tempParent.style.display = "none"; document.body.appendChild(tempParent); var tempDiv = document.createElement("DIV"); tempDiv.id = "tempDiv"; if (style) { tempDiv.style.cssText = style; } tempParent.appendChild(tempDiv); return (tempDiv.style); } this.getContainerElement = function(name) { if (typeof that.getProperty("applets",name,"containerElement") != "undefined") { var appspec1 = this.getProperty("applets",name,"appletspec"); var docwindow = appspec1.getProperty("util","dom","window"); return docwindow.document.getElementById(that.getProperty("applets",name,"containerElement")); } } this.resize = function(applet_name, width, height) { this.setProperty("applets",applet_name,"height",height); this.setProperty("applets",applet_name,"width",width); this.getApplet(applet_name).ep_setSize(width.replace("px",""),height.replace("px","")); } this.setBackgroundColor = function(applet_name, bgcolor) { // alert(this.getApplet(applet_name).toString()); try {this.getApplet(applet_name).ep_setBackground(convertColorString(bgcolor));} catch (e) {directorTrace('AppletManager.setBackgroundColor EXCEPTION: ' + e.description);} } function processQueue() { //debugger; processqueuetimeout = null; if (state == 'blocked') { processqueuetimeout = setTimeout(function() { processQueue() },50); return; } else if (state == 'busy') { processqueuetimeout = setTimeout(function() { processQueue() },50); return; } else if (queue.length == 0) { state = 'idle'; return; } var name = queue.shift(); var appspec1 = that.getProperty("applets",name,"appletspec"); var embed = true; if (appspec1.getParameter("applet","embedApplet") == "false") { that.setState('busy'); embed = false; } //that.setState('busy'); // TODO: GLM back out jun changes var docwindow = appspec1.getProperty("util","dom","window"); that.setProperty("applets",name,"containerElement",that.getUniqueElementID(docwindow.document)); var show = that.getProperty("applets",name,"appletspec").getParameter("applet","visible"); if (show == "true") { that.setProperty("applets",name,"visible",true); } else { that.setProperty("applets",name,"visible",false); } that.setProperty("applets",name,"height",appspec1.getParameter("height")); that.setProperty("applets",name,"width",appspec1.getParameter("width")); //var containerElement = document.createElement("DIV"); var containerElement = docwindow.document.createElement("DIV"); containerElement.id = that.getProperty("applets",name,"containerElement"); containerElement.style.visibility = "visible"; try { //TryCatch to avoid using duplicate html id's var targetTagName = that.getProperty("applets",name,"targetTag"); if (typeof targetTagName != "undefined") { var targetElement = docwindow.document.getElementById(that.getProperty("applets",name,"targetTag")); if (targetElement !== null) { targetElement.appendChild(containerElement); } else { EspreLive.trace('AppletManager.processQueue UNDEFINED APPLET ELEMENT: ' + targetTagName); } } else { docwindow.document.body.appendChild(containerElement); } } catch(err) { //alert("AppletManager.startApplet EXCEPTION: " + err.message); loggerJObject.info("AppletManager.startApplet EXCEPTION: " + err.message); } if (show == "false") { containerElement.style.cssText = containerElement.style.cssText + "position: absolute;left: -1px;top: -1px"; } //var bgcolor = quirksStyle(containerElement,"backgroundColor"); //var bgcolor = quirksStyle(containerElement.id,"background-color"); var bgcolor = ""; if (typeof appspec1.getParameter("user","bgcolor") != "undefined") { bgcolor = appspec1.getParameter("user","bgcolor"); appspec1.setParameter("user","bgcolor",convertColorString(bgcolor)); appspec1.setParameter("user", "boxfgcolor", bgcolor); appspec1.setParameter("user", "boxbgcolor", bgcolor); } else { var bgcolor = getStyleTest(containerElement,"backgroundColor"); appspec1.setParameter("user", "boxfgcolor", bgcolor); appspec1.setParameter("user", "boxbgcolor", bgcolor); } if (navigator.userAgent.toLowerCase().indexOf('firefox') != -1) { if (embed) { that.getProperty("applets", name, "appletspec").startAppletWithAppletTag(that.getProperty("applets", name, "containerElement")); } else { that.getProperty("applets",name,"appletspec").startApplet(that.getProperty("applets",name,"containerElement")); } } else { that.getProperty("applets",name,"appletspec").startApplet(that.getProperty("applets",name,"containerElement")); } } this.handleLifeCycle = function(appletID, name, elementType) { if (typeof this.getParameter(name) != "undefined") { this.setProperty("applets",name,"appletID",appletID); this.setProperty("applets",name,"elementType",elementType); if (this.getProperty("applets",name,"visible") == true) { this.getContainerElement(name).style.visibility = "visible"; } setTimeout("AppletManager.theInstance().doCallback('" + name + "');",100); this.setState('idle'); if (processqueuetimeout == null) { setTimeout(function() { processQueue()},100);} } else { //Error Condition } } this.doCallback = function(name) { if (name == "liveapplet") { JSInterfaceObject.getLogger("AppletManager",callbackForAppletManagerLogger);//Call to Java Script Interface Object for AppletManager Logger } if (this.getProperty("applets",name,"callback") !== null) { this.getProperty("applets",name,"callback")(this.getApplet(name),name); } } function callbackForAppletManagerLogger(loggerObject) { loggerJObject = loggerObject; } this.getApplet = function (name) { var id = this.getProperty("applets",name,"appletID"); var appspec1 = this.getProperty("applets",name,"appletspec"); var docwindow = appspec1.getProperty("util","dom","window"); if (id != '') { //if((instance = eval("document." + id))) { // return instance; //} else if (document.all) { if (docwindow.document.all) { // TODO: Need to make work for Mac instance = docwindow.document.all(id); } else if (docwindow.document.getElementById) { instance = docwindow.document.getElementById(id); } return instance; } else { return false; } } this.getUniqueElementID = function (doc) { var tmp = ""; do { tm = new Date(); //hex_md5() - From md5.js (JavaScript File) tmp = "div" + hex_md5(String((Math.random()) * tm.getTime())); } while(doc.getElementById(tmp)); return tmp; } function quirksStyle(el,styleProp) { var x = document.getElementById(el); if (x.currentStyle) var y = x.currentStyle[styleProp]; else if (window.getComputedStyle) var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); return y; } function getStyleTest(el, prop) { var y; while (el && el.nodeType == 1) { if (document.defaultView && document.defaultView.getComputedStyle) { y = document.defaultView.getComputedStyle(el, null)[prop]; } else if (el.currentStyle) { y = el.currentStyle[prop]; } else { y = el.style[prop]; } if (y == "inherit" || y == "transparent") { el = el.parentNode; } else { el = null; } if(y == "transparent") { y = "white"; } } return convertColorString(y); } function convertColorString(color) { if(color.indexOf("rgb(") >= 0 || color.indexOf("rgba(") >= 0 ) { color = color.replace(")",""); color = color.replace("rgba(",""); color = color.replace("rgb(",""); color = color.split(","); return RGBtoHex(color[0],color[1],color[2]); } if (typeof(wordToHex(color)) != "undefined") { return wordToHex(color); } return color; } function wordToHex(color) { var colors = {"maroon" : "#800000", "red" : "#FF0000", "orange" : "#FFA500", "yellow" : "#FFFF00", "olive" : "#808000", "purple" : "#800000", "fuchsia" : "#FF00FF", "white" : "#FFFFFF", "lime" : "#00FF00", "green" : "#008000", "navy" : "#000080", "blue" : "#0000FF", "aqua" : "#00FFFF", "teal" : "#008080", "black" : "#000000", "silver" : "#C0C0C0", "gray" : "#808080"} return colors[color]; } function RGBtoHex(R,G,B) {return toHex(R)+toHex(G)+toHex(B)} function toHex(N) { if (N==null) return "00"; N = parseInt(N); if (N == 0 || isNaN(N)) return "00"; N = Math.max(0,N); N = Math.min(N,255); N = Math.round(N); return "0123456789ABCDEF".charAt((N-N%16)/16)+ "0123456789ABCDEF".charAt(N%16); } } // End of AppletManager AppletManager.theInstance = function(){ if("undefined" == typeof AppletManager.instance){ return new AppletManager(); } return AppletManager.instance; } MeAddEvent(window, 'load', function() { AppletManager.theInstance().setState('idle');}); // Copyright © 2001 by Apple Computer, Inc., All Rights Reserved. // // You may incorporate this Apple sample code into your own code // without restriction. This Apple sample code has been provided "AS IS" // and the responsibility for its operation is yours. You may redistribute // this code, but you are not permitted to redistribute it as // "Apple sample code" after having made changes. // ugly workaround for missing support for selectorText in Netscape6/Mozilla // call onLoad() or before you need to do anything you would have otherwise used // selectorText for. var ugly_selectorText_workaround_flag = false; var allStyleRules; // code developed using the following workaround (CVS v1.15) as an example. // http://lxr.mozilla.org/seamonkey/source/extensions/xmlterm/ui/content/XMLTermCommands.js function ugly_selectorText_workaround() { if((navigator.userAgent.indexOf("Gecko") == -1) || (ugly_selectorText_workaround_flag)) { return; // we've already been here or shouldn't be here } var styleElements = document.getElementsByTagName("style"); for(var i = 0; i < styleElements.length; i++) { var styleText = styleElements[i].firstChild.data; // this should be using match(/\b[\w-.]+(?=\s*\{)/g but ?= causes an // error in IE5, so we include the open brace and then strip it allStyleRules = styleText.match(/\b[\w-.]+(\s*\{)/g); } for(var i = 0; i < allStyleRules.length; i++) { // probably insufficient for people who like random gobs of // whitespace in their styles allStyleRules[i] = allStyleRules[i].substr(0, (allStyleRules[i].length - 2)); } ugly_selectorText_workaround_flag = true; } // setStyleById: given an element id, style property and // value, apply the style. // args: // i - element id // p - property // v - value // function setStyleById(i, p, v) { var n = document.getElementById(i); n.style[p] = v; } // getStyleById: given an element ID and style property // return the current setting for that property, or null. // args: // i - element id // p - property function getStyleById(i, p) { var n = document.getElementById(i); var s = eval("n.style." + p); // try inline if((s != "") && (s != null)) { return s; } // try currentStyle if(n.currentStyle) { var s = eval("n.currentStyle." + p); if((s != "") && (s != null)) { return s; } } // try styleSheets var sheets = document.styleSheets; if(sheets.length > 0) { // loop over each sheet for(var x = 0; x < sheets.length; x++) { // grab stylesheet rules var rules = sheets[x].cssRules; if(rules.length > 0) { // check each rule for(var y = 0; y < rules.length; y++) { var z = rules[y].style; // selectorText broken in NS 6/Mozilla: see // http://bugzilla.mozilla.org/show_bug.cgi?id=51944 ugly_selectorText_workaround(); if(allStyleRules) { if(allStyleRules[y] == i) { return z[p]; } } else { // use the native selectorText and style stuff if(((z[p] != "") && (z[p] != null)) || (rules[y].selectorText == i)) { return z[p]; } } } } } } return null; } // setStyleByClass: given an element type and a class selector, // style property and value, apply the style. // args: // t - type of tag to check for (e.g., SPAN) // c - class name // p - CSS property // v - value var ie = (document.all) ? true : false; function setStyleByClass(t,c,p,v){ var elements; if(t == '*') { // '*' not supported by IE/Win 5.5 and below elements = (ie) ? document.all : document.getElementsByTagName('*'); } else { elements = document.getElementsByTagName(t); } for(var i = 0; i < elements.length; i++){ var node = elements.item(i); for(var j = 0; j < node.attributes.length; j++) { if(node.attributes.item(j).nodeName == 'class') { if(node.attributes.item(j).nodeValue == c) { eval('node.style.' + p + " = '" +v + "'"); } } } } } // getStyleByClass: given an element type, a class selector and a property, // return the value of the property for that element type. // args: // t - element type // c - class identifier // p - CSS property function getStyleByClass(t, c, p) { // first loop over elements, because if they've been modified they // will contain style data more recent than that in the stylesheet var elements; if(t == '*') { // '*' not supported by IE/Win 5.5 and below elements = (ie) ? document.all : document.getElementsByTagName('*'); } else { elements = document.getElementsByTagName(t); } for(var i = 0; i < elements.length; i++){ var node = elements.item(i); for(var j = 0; j < node.attributes.length; j++) { if(node.attributes.item(j).nodeName == 'class') { if(node.attributes.item(j).nodeValue == c) { var theStyle = eval('node.style.' + p); if((theStyle != "") && (theStyle != null)) { return theStyle; } } } } } // if we got here it's because we didn't find anything // try styleSheets var sheets = document.styleSheets; if(sheets.length > 0) { // loop over each sheet for(var x = 0; x < sheets.length; x++) { // grab stylesheet rules var rules = sheets[x].cssRules; if(rules.length > 0) { // check each rule for(var y = 0; y < rules.length; y++) { var z = rules[y].style; // selectorText broken in NS 6/Mozilla: see // http://bugzilla.mozilla.org/show_bug.cgi?id=51944 ugly_selectorText_workaround(); if(allStyleRules) { if((allStyleRules[y] == c) || (allStyleRules[y] == (t + "." + c))) { return z[p]; } } else { // use the native selectorText and style stuff if(((z[p] != "") && (z[p] != null)) && ((rules[y].selectorText == c) || (rules[y].selectorText == (t + "." + c)))) { return z[p]; } } } } } } return null; } // setStyleByTag: given an element type, style property and // value, and whether the property should override inline styles or // just global stylesheet preferences, apply the style. // args: // e - element type or id // p - property // v - value // g - boolean 0: modify global only; 1: modify all elements in document function setStyleByTag(e, p, v, g) { if(g) { var elements = document.getElementsByTagName(e); for(var i = 0; i < elements.length; i++) { elements.item(i).style[p] = v; } } else { var sheets = document.styleSheets; if(sheets.length > 0) { for(var i = 0; i < sheets.length; i++) { var rules = sheets[i].cssRules; if(rules.length > 0) { for(var j = 0; j < rules.length; j++) { var s = rules[j].style; // selectorText broken in NS 6/Mozilla: see // http://bugzilla.mozilla.org/show_bug.cgi?id=51944 ugly_selectorText_workaround(); if(allStyleRules) { if(allStyleRules[j] == e) { s[p] = v; } } else { // use the native selectorText and style stuff if(((s[p] != "") && (s[p] != null)) && (rules[j].selectorText == e)) { s[p] = v; } } } } } } } } // getStyleByTag: given an element type and style property, return // the property's value // args: // e - element type // p - property function getStyleByTag(e, p) { var sheets = document.styleSheets; if(sheets.length > 0) { for(var i = 0; i < sheets.length; i++) { var rules = sheets[i].cssRules; if(rules.length > 0) { for(var j = 0; j < rules.length; j++) { var s = rules[j].style; // selectorText broken in NS 6/Mozilla: see // http://bugzilla.mozilla.org/show_bug.cgi?id=51944 ugly_selectorText_workaround(); if(allStyleRules) { if(allStyleRules[j] == e) { return s[p]; } } else { // use the native selectorText and style stuff if(((s[p] != "") && (s[p] != null)) && (rules[j].selectorText == e)) { return s[p]; } } } } } } // if we don't find any style sheets, return the value for the first // element of this type we encounter without a CLASS or STYLE attribute var elements = document.getElementsByTagName(e); var sawClassOrStyleAttribute = false; for(var i = 0; i < elements.length; i++) { var node = elements.item(i); for(var j = 0; j < node.attributes.length; j++) { if((node.attributes.item(j).nodeName == 'class') || (node.attributes.item(j).nodeName == 'style')){ sawClassOrStyleAttribute = true; } } if(! sawClassOrStyleAttribute) { return elements.item(i).style[p]; } } } function HostingAgent() { var that = this; if("undefined" == typeof HostingAgent.instance) { HostingAgent.instance = this; // define the singleton } if(this != HostingAgent.instance) return HostingAgent.instance; // return the singleton if it already exists var tm = null; //var state = "blocked"; var queue = new Array(); var uploadRequest = null; // in process upload request holder var url = EVME_HOSTING_PATH; var namespace = "default"; var error = ""; var maxSize = 0; var progess = 0; var hostSize = 0; var nsCount = 0; var nsProCount = 0; var ProResCount = 0; this.errorThrown = false; //Private - To make sure that error message from events is thrown only once var uploaderJObject = null; //File Util Java Object var uploaderState = "blocked"; // use this to track uploaderObject // states are: initialized, uploading, completed, errored var loggerJObject = null; var JSInterfaceObject = JSInterface.theInstance(); this.http = HttpRequest; this.http(); this.Event = EventManager; this.Event(); JSInterfaceObject.getInterface("Upload",callbackfromInterface); //Call to Java Script Interface Object JSInterfaceObject.getLogger("Upload",callbackForUploadLogger);//Call to Java Script Interface Object for Upload Logger function callbackfromInterface(InterfaceObject) { uploaderState = "idle"; uploaderJObject = InterfaceObject; that.setJavaInterface(InterfaceObject); } function callbackForUploadLogger(loggerObject) { loggerJObject = loggerObject; } this.isInitialized = function(){ if((uploaderJObject == null) && (loggerJObject == null)){return false;} if((uploaderJObject != null) && (loggerJObject != null)){ return true;} return false; }; // *** function getHostURL for testing this.getHostURL = function () { return url; } // *** function setHostURL this.setHostURL = function (_url) { if (this.isValidURL(_url)) { url = _url; return true; } else { return false; } } // *** function getNamespace for testing this.getNamespace = function () { return namespace; } // *** function setNamespace this.setNamespace = function (_namespace) { namespace = _namespace; return true; } // *** function createNamespace (nameSpace, callbackMethod) this.createNamespace = function (_namespace, callback) { if (url != null) { this.sendRequest("GET", url, Array("action=createNamespace","name=" + _namespace), true, callback); } else { return false; } } // *** function renameNamespace (currentName,newName,callbackMethod) this.renameNamespace = function () { var curName; var newName; if (arguments.length == 2) { curName = namespace; newName = arguments[0]; callback = arguments[1]; } else if (arguments.length == 3) { curName = arguments[0]; newName = arguments[1]; callback = arguments[2]; } else { return false; } if (url != null) { var nurl = url + curName; this.sendRequest("GET", nurl , Array("action=renameNamespace","newName=" + newName), true, callback); } else { return false; } } // *** function deleteNamespace (nameSpace, callbackMethod) this.deleteNamespace = function () { var ns = ""; if (arguments.length == 2) { ns = arguments[0]; callback = arguments[1]; } else if (arguments.length == 1) { ns = this.getNamespace(); callback = arguments[1]; } else { return false; } if (url != null) { var nurl = url + ns; this.sendRequest("GET", nurl, Array("action=deleteNamespace","name=" + ns), true, callback); } else { return false; } } // TODO: NOT YET IMPELMENTED this.getMaxPostSize = function () { return maxSize; } // TODO: NOT YET IMPELMENTED this.setMaxPostSize = function (_size) { if (isNaN(_size) || (_size > 1024)) { return false; } else { maxSize = _size; return true; } } //function deleteProject(nameSpace, path, callbackMethod) this.deleteProject = function () { var _path = ''; var ns = ''; if (arguments.length == 2) { _path = arguments[0]; callback = arguments[1]; ns = this.getNamespace(); } else if (arguments.length == 3) { ns = arguments[0]; _path = arguments[1]; callback = arguments[2]; } else { return false; } if ((url != null) && (ns != "") && (_path != "") && (callback !="")) { target = url + ns + "/" + _path + "/"; this.sendRequest("GET", target, Array("action=deleteProject"), true, callback); return true; } else { return false; } } // function renameProject(nameSpace, oldPath, newPath, callbackMethod) this.renameProject = function () { var ns = ''; var newPath = ''; var oldPath = ''; if (arguments.length == 3) { oldPath = arguments[0]; newPath = arguments[1]; callback = arguments[2]; ns = this.getNamespace(); } else if (arguments.length == 4) { ns = arguments[0]; oldPath = arguments[1]; newPath = arguments[2]; callback = arguments[3]; } else { return false; } if (url != null) { target = url + ns + "/" + oldPath + "/"; this.sendRequest("GET", target, Array("action=renameProject","newpath=" + newPath), true, callback); } else { return false; } } // **********Added to support copyAsset(Project) and projectSize functionalities- 2/22/08 *********************** // function copyProject(fromPath, toPath, callbackMethod) //fromPath Should be NAMESPACE/GROUP //toPath Should be either relative ( NAMESAPCE/GROUP) or absolute path ( http://SERVERPATH/NAMESPACE/GROUP) this.copyProject = function () { var fromPath = ''; var toPath = ''; var target = ''; if (arguments.length == 3) { fromPath = arguments[0]; toPath = arguments[1]; callback = arguments[2]; } else { return false; } if ((url != null) && (fromPath != "") && (toPath != "") && (callback !="")){ if ((fromPath.length-1) != fromPath.lastIndexOf("/")) { target = url + fromPath + "/"; } else { target = url + fromPath; } if (toPath.indexOf("http://") == -1) { if ((toPath.length-1) != toPath.lastIndexOf("/")) { toPath = url + toPath + "/"; } } else { if ((toPath.length-1) != toPath.lastIndexOf("/")) { toPath = toPath + "/"; } } toPath = toPath.replace(/\//g,"%2f"); //debugger; this.sendRequest("GET", target, Array("action=copyProject","to=" + toPath), true, callback); } else { return false; } return true; } // function getProjectSize(nameSpace, path, callbackMethod) this.getProjectSize = function () { var ns = ""; var path = ""; var callback = ""; if (arguments.length == 2) { path = arguments[0]; callback = arguments[1]; ns = this.getNamespace(); } else if (arguments.length == 3) { ns = arguments[0]; path = arguments[1]; callback = arguments[2]; } else { return false; } if ((url != null) && (ns != "") && (path != "") && (callback !="")) { var target = url + ns + "/" + path + "/"; this.sendRequest("GET", target, Array("action=getProjectSize"), true, callback); } else { return false; } return true; } this.upload = function (_uploadRequest) { meLogger.write("Hosting Agent upload called."); //debugger; if (!_uploadRequest) {return false;}; // empty upload request rejected!! if(!this.isInitialized()){return false}; //uploaderJObject not initialized if (url != null) { meLogger.write("Url valid."); queue.push(_uploadRequest); //will get progress if (tm == null) { tm = setTimeout(processQueue, 50); } return true; // successfully posted request } else { return false; // unable to post request } } // **********SUPPORT FOR CANCEL UPLOAD FUNCTIONALITY*********** this.cancelUpload = function(){ if(!this.isInitialized() || uploadRequest === null) return false; if(tm !== null) { // cancel any pending request window.clearTimeout(tm); tm = null; } if(uploadTimeout !== null){ //cancel any active request window.clearTimeout(uploadTimeout); uploadTimeout = null; } if(uploaderState === "uploading"){ uploaderJObject.ep_abort(); loggerJObject.info("Upload Cancelled"); } setState("idle"); uploadRequest = null; return; } function processQueue() { tm = null; that.errorThrown = false; meLogger.write("ProcessQueue: " + uploaderState); if (uploaderState == 'blocked') { tm = setTimeout(processQueue,50); return; } else if (uploaderState == 'busy') { tm = setTimeout(processQueue,50); return; } else if (queue.length == 0) { setState('idle'); return; } // must be idle and queue.length > 0; so process a request setState('busy'); uploadRequest = queue.shift(); var params = "action,upload,default," + uploadRequest.getMappedName(); var mfiles = uploadRequest.getManifestFiles(); meLogger.write("Number of files to be read :" + mfiles.length); for (var i = 0; i < mfiles.length; i++) { var buffer = mfiles[i].split('|'); if(i == 0) { tmp = buffer[0]; } else { tmp += "," + buffer[0]; } } files = tmp; target = url + escape(uploadRequest.getNameSpace()) + "/" + escape(uploadRequest.getName()) + "/"; meLogger.write("Target: " + target + " File: " + files + " Params: " + params); //alert("Target: " + target + " File: " + files + " Params: " + params); //Events listened by Hosting Agent that.addEventListener("uploadresponse",uploadResponseCallback); that.addEventListener("uploadprocesserror",uploadErrorCallback); loggerJObject.info("Added event listner : uploadresponse"); loggerJObject.info("Added event listner : uploadprocesserror"); setState("uploading"); uploaderJObject.ep_upload(target,files,params); loggerJObject.info("Upload Started"); //meLogger.write('Upload started ....'); queryState(); } function uploadResponseCallback(evt) { try { if (that.errorThrown === false) { var error = null; var data = JSON.parse(evt.response); if (data !== false) { //If JSON returns "false" //When there is a blank or null response if(evt.response === "NULL_RESPONSE") { loggerJObject.info("NULL_RESPONSE from Server"); that.cancelUpload(); var info = "src=uploader&type=uploaderror&error=No Response Body"; // Triggering an "uploaderror" event that.handleEvent(info); that.errorThrown = true; } if ((data['ACTIONSTATUS'] === 'false') ||(data['ACTIONSTATUS'] === false)) { that.cancelUpload(); if (data['ERROR']) { error = data['ERROR'].ExceptionMsg; } else if (data['Error']) { error = data['Error'].ExceptionMsg; } else if (data['RESPONSEDATA'][0].error) { error = data['RESPONSEDATA'][0].error; error = error.replace(/\+/g," "); //Removing "+" from the error message } loggerJObject.info("Upload Error from Server : "+error); var info = "src=uploader&type=uploaderror&error="+error; // Triggering an "uploaderror" event that.handleEvent(info); that.errorThrown = true; } } else if (data === false) { loggerJObject.info("Unrecognizable Error from Server(uploadResponseCallback): JSON retuned false"); that.cancelUpload(); var info = "src=uploader&type=uploaderror&error=Unrecognizable Error from Server"; // Triggering an "uploaderror" event that.handleEvent(info); that.errorThrown = true; } } } catch (err) { loggerJObject.info("Unrecognizable Error from Server(uploadResponseCallback):" + err); that.cancelUpload(); var info = "src=uploader&type=uploaderror&error=Unrecognizable Error from Server"; // Triggering an "uploaderror" event that.handleEvent(info); that.errorThrown = true; } } function uploadErrorCallback(evt) { try { if (that.errorThrown === false) { that.cancelUpload(); //To hide the "Socket Closed" error (JAVA fires an error when upload cancel command is issued) from the user if (((evt.error.indexOf("Socket") === -1) && (evt.error.indexOf("closed") === -1))|| ((evt.error.indexOf("socket") === -1) && (evt.error.indexOf("closed") === -1))) { if (evt.error.indexOf(":") > -1) { //To remove the "java.net.Exception" part from the Error Message var error_array = evt.error.split(":"); if ((error_array[0].indexOf("java") > -1) && (error_array[0].indexOf("Exception") > -1)) { evt.error = error_array[1]; } } var error = evt.error.replace(/\+/g," "); //Removing "+" from the error message loggerJObject.info("Upload Error from Server : "+error); var data = "src=uploader&type=uploaderror&error="+error; // Triggering an "uploaderror" event that.handleEvent(data); that.errorThrown = true; } } } catch (err) { loggerJObject.info("Unrecognizable Error from Server(uploadErrorCallback):" + err); that.cancelUpload(); var info = "src=uploader&type=uploaderror&error=Unrecognizable Error from Server"; // Triggering an "uploaderror" event that.handleEvent(info); that.errorThrown = true; } } // add callback functions for status, progress, etc. function queryState() { uploadTimeout = null; var currentState = String(uploaderJObject.ep_getUploadState()); loggerJObject.info("Current State: " + currentState); //meLogger.write("Query State: " + currentState + " " + that.getProgress() + "%"); //alert("currentState : "+currentState); if (currentState == "uploading") { uploadRequest.updateProgress(that.getProgress()); uploadTimeout = window.setTimeout(queryState,500); return; } if (currentState == "ready") { uploadTimeout = window.setTimeout(queryState,500); return; } if (currentState == "completed") { uploadRequest.updateProgress(that.getProgress()); setState(currentState); uploadRequest = null; } if (currentState == "errored") { //uploadRequest.setErrors(that.getErrors()); //uploadRequest.updateProgress(that.getProgress()); setState(currentState); uploadRequest = null; } } this.getProgress = function(){ if(!this.isInitialized()){return false}; //uploaderJObject not initialized if(uploaderState == "uploading") { var progress = uploaderJObject.ep_getProgress(); loggerJObject.info("Progress: " + progress); return progress; } if(uploaderState == "completed") return 100; return 0; } this.getErrors = function(){ if(!this.isInitialized()){return false}; //uploaderJObject not initialized if(uploaderState == "errored") { var error = uploaderJObject.ep_getErrors(); loggerJObject.info("Error: " + error); return error; } return ""; } this.isCompleted = function(){ if(uploadRequest == null && uploaderState == "completed") return true; return false; } this.isUploading = function(){ if(uploadRequest != null && uploaderState == "uploading") return true; return false; } this.isError = function(){ if(uploaderState == "errored") return true; return false; } //function getNamespaceList( ) this.getNamespaceList = function () { callback = arguments[0]; if (url === null) return false; this.sendRequest("GET", url, Array("action=query","ns.columns=name"), true, callback); } //function getDefaultFile(nameSpace, groupName, callbackMethod) this.getDefaultFile = function () { var _namespace = this.getNamespace(); var _groupname; if(arguments.length == 2) { _groupname = arguments[0]; callback = arguments[1]; } else if (arguments.length == 3){ _namespace = arguments[0]; _groupname = arguments[1]; callback = arguments[2]; } else return false; var requestUrl = url; if (url === null) return ""; requestUrl += _namespace + "/" + _groupname + "/"; var param = new Array(""); this.sendRequest("GET", requestUrl, param, true, callback, "getDefaultFile"); //return this.responseText; } //function getProjectList(nameSpace, callbackMethod) this.getProjectList = function () { var ns = ''; if (arguments.length == 1) { ns = this.getNamespace(); callback = arguments[0]; } else if (arguments.length == 2) { ns = arguments[0]; callback = arguments[1]; } else { return false; } if (url === null) return false; target = url + ns + "/"; this.sendRequest("GET", target, Array("action=query","ns.columns=*","ns.where.name=='" + ns + "'","group.columns=*"), true, callback); } //function getMatchingProjectList(nameSpace, pattern, callbackMethod) this.getMatchingProjectList = function () { var ns = ''; var path = ''; if (arguments.length == 2) { ns = this.getNamespace(); path = arguments[0]; callback = arguments[1]; } else if (arguments.length == 3) { ns = arguments[0]; path = arguments[1]; callback = arguments[2]; } else { return false; } if (url === null) return false; target = url + ns + "/" + path + "/"; this.sendRequest("GET", target, Array("action=query","ns.where.name=='" + ns +"'","group.where.fqpath=LIKE '" + path + "'","group.columns=*"), true, callback); } //function getProjectResourceList(nameSpace, path, callbackMethod) this.getProjectResourceList = function () { var ns = ''; var path = ''; if (arguments.length == 2) { ns = this.getNamespace(); path = arguments[0]; callback = arguments[1]; } else if (arguments.length == 3) { ns = arguments[0]; path = arguments[1]; callback = arguments[2]; } else { return false; } if (url === null) return false; target = url + ns + "/" + path + "/"; this.sendRequest("GET", url, Array("action=query","ns.where.name=='" + ns + "'","group.where.fqpath=='" + path + "'","resource.columns=name"), true, callback); } function setState(_state){ var oldState = uploaderState; if (_state != uploaderState){ uploaderState = _state; if(uploadRequest != null){ uploadRequest.updateState(uploaderState); } meLogger.write('HostingAgent: '+ oldState + ' -> ' + uploaderState); } } } // End of Hosting Agent HostingAgent.theInstance = function(){ if("undefined" == typeof HostingAgent.instance){ new HostingAgent(); } return HostingAgent.instance; } //Java Script Interafce Object that creates and starts the Interface Applet. function JSInterface() { var that = this; //Let the private functions access the object instance. if(JSInterface.Instance == null) { JSInterface.Instance = this; // define the singleton } if (this != JSInterface.Instance) return JSInterface.Instance; // return the singleton if it already exists var InterfaceAppletState = "NotReady"; // State of the Interface Applet; States are - Ready, NotReady, Initializing var InterfaceApplet = null; // Interface Applet var requestedInterface = new Array(); var requestedLogger = new Array(); var callbackmethodForLogger = new Array(); // CallBackMethod from User ( Core Components/Streams) for Logger Object var callbackmethodForInterface = new Array(); // CallBackMethod from User ( Core Components/Streams) for Interface Object var callbackForLiveService = null; if ((InterfaceAppletState == "NotReady") && (InterfaceApplet == null)) { startInterfaceApplet(); //To start the Live Espre Service Interface Applet by default } this.getLiveService = function(callbackmethod) { //Get an Instance of Live Service/Interface Applet callbackForLiveService = callbackmethod; callInterfaceApplet(); return; } this.isLiveServiceReady = function() { // To check whether Live Service/Interface Applet is Ready to use if ((InterfaceAppletState == "NotReady") && (InterfaceApplet == null)) { return false; } if ((InterfaceAppletState == "Ready") && (InterfaceApplet != null)) { return true; } } this.getInterface = function(_requestedInterface,_callbackmethod) { requestedInterface.push(_requestedInterface); callbackmethodForInterface.push(_callbackmethod); callInterfaceApplet(); return; } this.getLogger = function(_requestedLogger, _callbackmethod) { if (typeof _callbackmethod === 'undefined') { _callbackmethod = function() {alert('JSInterface.getLogger' + ' requestedLogger: ' + _requestedLogger + ' callbackmethod UNDEFINED');} } requestedLogger.push(_requestedLogger); callbackmethodForLogger.push(_callbackmethod); callInterfaceApplet(); return; } //Private Methods function callInterfaceApplet() { if (startTimeout != null) return; var startTimeout = null; if ((InterfaceAppletState == "Ready") && (InterfaceApplet != null)) { activateCallBackMethods(); return; } if (InterfaceAppletState == "Initializing") { startTimeout = window.setTimeout(callInterfaceApplet,500); return; } if (InterfaceAppletState == "NotReady") { startInterfaceApplet(); return; } } function startInterfaceApplet() { if (InterfaceAppletState == "NotReady") { InterfaceAppletState = "Initializing"; var appspec = new AppletSpec(EVME_PRODUCT_TYPE); appspec.setParameter("name",EVME_PRODUCT_TYPE); appspec.addParameter("RUNNING_MODE",EVME_PRODUCT_TYPE); appspec.setParameter("visible","false"); appspec.setParameter("APP_FOLDER",EVME_PRODUCT_FOLDER); appspec.addParameter("clean","true"); // TODO: GLM REVIEW for killing on start up appspec.setParameter("applet", "embedApplet", "false"); appspec.setProperty("util","dom","window",window); AppletManager.theInstance().startApplet(appspec,callbackFromInterfaceApplet); if (false && (EVME_PRODUCT_TYPE != "UNSIGNED_PLAYER") && (new ComponentFactory()).getAppletInformation("EMMS")) { var appspec2 = new AppletSpec("EMMS"); appspec2.setParameter("name","EMMS"); appspec2.setParameter("embedApplet", "true"); appspec2.setProperty("util","dom","window",window); AppletManager.theInstance().startApplet(appspec2,callbackFromEmms); } } } function callbackFromEmms(applet) { // TODO: GLM ? } function callbackFromInterfaceApplet(applet) { InterfaceApplet = applet; InterfaceAppletState = "Ready"; activateCallBackMethods(applet); return; } function activateCallBackMethods(applet) { if (requestedInterface.length > 0) { for(var i = 0; i < requestedInterface.length; i++) { var callback = callbackmethodForInterface.pop(); callback(getInterfaceObject(requestedInterface.pop())); return; } } if (requestedLogger.length > 0) { for(var i = 0; i < requestedLogger.length; i++) { var callback = callbackmethodForLogger.pop(); callback(getLoggerObject(requestedLogger.pop())); return; } } if(callbackForLiveService != null) { callbackForLiveService(applet); callbackForLiveService = null; return; } } function getInterfaceObject(Interface) { var JavaInterfaceObject = null; if (Interface == "FileUtil") { JavaInterfaceObject = InterfaceApplet.ep_getFileUtil(); } else if (Interface == "Encoder") { JavaInterfaceObject = InterfaceApplet.ep_getEncoder(); } else if (Interface == "Upload") { JavaInterfaceObject = InterfaceApplet.ep_getUploader(); } else if (Interface == "AVDevice") { JavaInterfaceObject = InterfaceApplet.ep_newAVDevice(); } else if (Interface == "LSVXStream") { JavaInterfaceObject = InterfaceApplet.ep_newLSVXStream(); } else if (Interface == "DeviceStream") { JavaInterfaceObject = InterfaceApplet.ep_newAVDeviceStream(); } else if (Interface == "IRTPStream") { JavaInterfaceObject = InterfaceApplet.ep_newiRTPStream(); } else if (Interface == "ORTPStream") { JavaInterfaceObject = InterfaceApplet.ep_newoRTPStream(); } else if (Interface == "OAVIStream") { JavaInterfaceObject = InterfaceApplet.ep_newoAVIStream(); } else if (Interface == "AVIStream") { JavaInterfaceObject = InterfaceApplet.ep_newAVIStream(); } //Begin: Fix for Bug 706 else if (Interface == "SdlWriter") { JavaInterfaceObject = InterfaceApplet.ep_getSdlWriter(); } //End: Fix for Bug 706 else if (Interface == "URLRequestService") { JavaInterfaceObject = InterfaceApplet.ep_getURLRequestService(); } else { return false; } return JavaInterfaceObject; } function getLoggerObject(logger) { var loggerObject = InterfaceApplet.ep_getLogger("JavaScript-"+logger); return loggerObject; } } //End of JSInterface JSInterface.Instance = null; JSInterface.theInstance = function(){ if (JSInterface.Instance == null){ JSInterface.Instance = new JSInterface(); } return JSInterface.Instance; } MeAddEvent(window, 'load',JSInterface); function ClipDirector() { var that = this; if (typeof ClipDirector.instance === 'undefined') { ClipDirector.instance = this; } this.ep_invoke = function(invokeString,async) { async = (typeof async === 'undefined') ? true : async; var args = invokeString.split(','); var arg; var index = (isNaN(parseInt(args[0]))) ? null : parseInt(args[0]); var tag = args[1]; var method = args[2]; // must be 'ep_' format var optionalArgs = ''; var len = args.length; var streamType = null; var result = null; var exception = false; var rebuildInvokeString = false; var i; if ((index === null) && (typeof tag !== 'undefined')) { if (typeof tag !== 'undefined') { var actor = Actor.getActorByTag(tag); if (actor === null) { if (!async) { directorTrace("ClipDirector.ep_invoke UNABLE TO FIND ACTOR BY TAG. tag: " + tag); } else { directorTrace("ClipDirector.ep_invoke unable to find actor by tag. tag: " + tag + " retrying..."); setTimeout(function() {that.ep_invoke(invokeString);},100); } return null; } index = actor.getContextIndex(); if (index === Actor.INVALID_CONTEXT_INDEX) { if (!async) { directorTrace("ClipDirector.ep_invoke UNABLE TO GET ACTOR CONTEXT INDEX. tag: " + tag); } else { directorTrace("ClipDirector.ep_invoke unable to get actor context index. tag: " + tag + " retrying..."); setTimeout(function() {that.ep_invoke(invokeString);},100); } return null; } tag = ''; args[1] = ''; rebuildInvokeString = true; } else { directorTrace("ClipDirector.ep_invoke invalid index and tag." + " index: " + index + " tag: " + tag); return null; } } for (i = 3; i < len; i++) { arg = args[i]; // quote string args try {eval(arg);} catch (e0) { arg = "'" + arg + "'"; } optionalArgs += arg; if (i < (len-1)) {optionalArgs += ',';} } var stream = (index !== null) ? Actor.getStreamByIndex(index) : Actor.getStreamByTag(tag); if ((stream !== null) && (typeof stream.getRawStream !== 'undefined') && (stream.getRawStream() !== null)) { // try to use mediaengine support first var evalMethod = 'stream.' + method.substring(3) + "(" + optionalArgs + ");"; //directorTrace('ClipDirector.ep_invoke found stream.' + ' streamType: ' + stream.getStreamType() + ' index: ' + index + ' evalMethod: ' + evalMethod); try {result = eval(evalMethod);} catch (e1) { // only use this approach if no mediaengine support if (rebuildInvokeString) { invokeString = '' + index + ',,' + method + ','; for (i = 3; i < len; i++) { invokeString += args[i]; if (i < (len-1)) {invokeString += ',';} } } evalMethod = "stream.getRawStream().ep__invoke('" + invokeString + "',async);"; try {result = eval(evalMethod);} // will cause exception if ep__invoke is not supported by the raw stream. catch (e2) { directorTrace("ClipDirector.ep_invoke EXCEPTION: " + e2.description + '\n evalMethod: ' + evalMethod + '\n streamType: ' + stream.getStreamType()); result = null; } } } else { directorTrace('ClipDirector.ep_invoke unable to find stream.' + ' index: ' + index + ' tag: ' + tag); //alert('ClipDirector.ep_invoke unable to find stream.' + ' index: ' + index + ' tag: ' + tag); // TODO GLM REMOVE AFTER TESTING setTimeout(function() {that.ep_invoke(invokeString);},100); } if (false) directorTrace('ClipDirector.ep_invoke' + ' async: ' + async + ' invokeString: ' + invokeString + ' args: ' + args + '\n index: ' + index + ' tag: ' + tag + ' method: ' + method + ' optionalArgs: ' + optionalArgs + '\n result: ' + result + ' exception: ' + exception); if (typeof result === 'undefined') result = null; return (result === null) ? 'null' : result.toString(); }; this.ep_invokeAndWait = function(invokeString) { return this.ep_invoke(invokeString,false); }; } ClipDirector.theInstance = function() { if (typeof clipDirector === 'undefined') { new ClipDirector(); } return ClipDirector.instance; }; var clipDirector = ClipDirector.theInstance(); function ParameterManager (common) { var that = this; // let the private functions access the object. //acquire ParameterMap capabilities this.PMap = ParameterMap; this.PMap(common); this.normalizeArgs = function(args) { var inputs = (args.length < args.callee.length)? [null] : []; inputs = inputs.concat (that.asArray(args)); return inputs; } this.setParameter = function (group, name, value) { var inputs = this.normalizeArgs(arguments); var _group = inputs[0]; var _name = inputs[1]; var _value = inputs[2]; if(typeof inputs[2] == "string"){ _value = _value.replace(/^\s+|\s+$/g,""); //trim whitespace on strings } var setter = this.getProperty (_group, _name, 'setter'); if ('function' == typeof setter) { return setter (_group, _name, _value); } var validator = this.getProperty (_group, _name, 'validator'); if ('function' == typeof validator) { if (validator(_group, _name, _value)) { return this._setParameter (_group, _name, _value); } else { // throw new Error ('Invalid input: ' + _group + ":" + _name + ":" + _value); return false; } } return this._setParameter (_group, _name, _value); } this.getParameter = function (group, name) { var inputs = this.normalizeArgs(arguments); var _group = inputs[0]; var _name = inputs[1]; var getter = this.getProperty (_group, _name, 'getter'); if ('function' == typeof getter) { return getter (_group, _name); } var value = this._getParameter (_group, _name); if ('undefined' == typeof value) { value = this.getProperty (_group, _name, 'defaultValue'); } return value; } this.removeParameter = function (group, name) { var inputs = this.normalizeArgs(arguments); var _group = inputs[0]; var _name = inputs[1]; var defaultValue = this.getProperty(_group, _name, 'defaultValue'); if('undefined' != typeof value) return true; return this._removeParameter(_group, _name); } this.resetParameter = function (group, name) { var inputs = this.normalizeArgs(arguments); var _group = inputs[0]; var _name = inputs[1]; var defaultValue = this.getProperty(_group, _name, 'defaultValue'); if('undefined' == typeof defaultValue) return false; return this.setParameter(_group, _name, defaultValue); } this.getActiveParameters = function (group) { return this._getActiveParameters.apply (this, this.normalizeArgs(arguments)); } this._toXPath = function(prePend){ prePend = prePend || ""; var result = ""; var groups = this.getSupportedGroups(); if(groups.length == 0)return result; for (gindex in groups){ var group = groups[gindex]; var parameters = this.getActiveParameters(group); if(parameters.length == 0) continue; for (pindex in parameters){ var parameter = parameters[pindex]; result = result.concat (prePend + "/"+group + "/"+parameter + ":" + this.getParameter(group,parameter) + "\n"); } } return result; } } function FileUtil() { var that = this; //Let the private functions access the object instance. if("undefined" == typeof FileUtil.instance) { FileUtil.instance = this; // define the singleton } if(this != FileUtil.instance) return FileUtil.instance; // return the singleton if it already exists var fileUtilJObject = null; //File Util Java Object var JSInterfaceObject = JSInterface.theInstance(); JSInterfaceObject.getInterface("FileUtil",callbackForFileutilInterface); //Call to Java Script Interface Object JSInterfaceObject.getLogger("Utilities",callbackForFileutilLogger);//Call to Java Script Interface Object for Encoder Logger function callbackForFileutilInterface(InterfaceObject) { fileUtilJObject = InterfaceObject; } function callbackForFileutilLogger(loggerObject) { EspreLiveLogger = loggerObject; //loggerJObject.info("JS Initialized " + fileUtilJObject); } this.isInitialized = function(){ if((fileUtilJObject == null) && (EspreLiveLogger == null)){return false;} if((fileUtilJObject != null) && (EspreLiveLogger != null)){ return true;} return false; }; this.fileDelete = function(_file) { if(!this.isInitialized()) return false; var result = fileUtilJObject.ep_fileDelete(_file); //return (result == "1"? true: false); return result; }; this.getUserHome = function() { if(!this.isInitialized()) return ""; return (new String(fileUtilJObject.ep_getUserHome())).toString(); }; this.getUserSandBox = function(){ if(!this.isInitialized()) return ""; return (new String(fileUtilJObject.ep_getUserSandBox())).toString(); }; this.getUserSandbox = this.getUserSandBox; this.writeToFilePath = function(fileAsAString,filePathName, overwrite) { if(!this.isInitialized()) return false; var re = /\\[^\\]+$/; var base = filePathName.replace(re,""); var _folderExists = this.doesFolderExist(base) ; return fileUtilJObject.ep_writeToFilePath(fileAsAString.replace(/"/g, "'"),filePathName); }; this.saveImageAs = function(_uri,_path){ if(!this.isInitialized()) return false; return fileUtilJObject.ep_saveImageAs(_uri,_path); } this.expandPath = function(_shortPath){ if(!this.isInitialized()) return ""; return (new String(fileUtilJObject.ep_expandPath(_shortPath))).toString(); }; this.writeToFile = function(fileAsAString,base, projRelPath, fileName, overwrite) { if(!this.isInitialized()) return false; //alert (fileAsAString.replace(/\"/g, "\'")); return fileUtilJObject.ep_writeToFile(fileAsAString.replace(/"/g, "'"),base, projRelPath, fileName, overwrite); }; this.fileExists = function(fileName) { if(!this.isInitialized()) return false; //return ((fileUtilJObject.ep_fileExists(fileName) == '1')? true : false); return (fileUtilJObject.ep_fileExists(fileName)); }; this.doesFolderExist = function(dirName) { if(!this.isInitialized()) return false; //return ((fileUtilJObject.ep_folderExists(dirName) == '1')? true : false); return (fileUtilJObject.ep_folderExists(dirName)); }; this.getManifestAttributes = function(fileName) { if(!this.isInitialized()) return ""; return (new String(fileUtilJObject.ep_getManifestAttributes(fileName))).toString(); }; this.getFileSize = function(fileName) { if(!this.isInitialized()) return ""; return (new String(fileUtilJObject.ep_getFileSize(fileName))).toString(); }; this.getFileBase64 = function(fileName) { if(!this.isInitialized()) return ""; return (new String(fileUtilJObject.ep_getFileBase64(fileName))).toString(); }; this.transferZone = function(fileName) { if(!this.isInitialized()) return ""; return fileUtilJObject.ep_transferZone(fileName); }; this.getProjectSize = function(projectPath){ if(!this.isInitialized()) return ""; return (fileUtilJObject.ep_getProjectSize(projectPath)); } this.deleteFile = function(fileName) { if(!this.isInitialized()) return false; //return ((fileUtilJObject.ep_fileDelete(fileName) == '1')? true : false); return (fileUtilJObject.ep_fileDelete(fileName)); }; this.copyFile = function(sourceFile, destPath) { if(!this.isInitialized()) return false; //return ((fileUtilJObject.ep_fileCopy(sourceFile, destPath) == '1')? true : false); return (fileUtilJObject.ep_fileCopy(sourceFile, destPath)); }; this.getBase = function(fileName) { if(!this.isInitialized()) return ""; return (new String(fileUtilJObject.ep_getBase(fileName))).toString(); }; this.doesFileExist = function(fileName){ if(!this.isInitialized()) return false; //return ((fileUtilJObject.ep_fileExists(fileName) == '1')? true : false); return (fileUtilJObject.ep_fileExists(fileName)); }; this.readFile = function(fileName){ if(!this.isInitialized()) return ""; return (new String(fileUtilJObject.ep_readFile(fileName))).toString(); }; //auto start the instance; //return FileUtil.instance; } FileUtil.theInstance = function(){ if("undefined" == typeof FileUtil.instance){ new FileUtil(); } return FileUtil.instance; }; FileUtil.isInitialized = function(){ return FileUtil.theInstance().isInitialized(); }; if (!meLogger){ var meLogger = new Object(); } var EspreLiveLogger = null; meLogger.write = function (){ // jstracer.write.apply(jstracer,arguments); if((EspreLiveLogger == null)|| (arguments.length ==0)) return; if(typeof arguments[0] !== 'string'){ arguments[0] = (arguments[0]).toString(); } if (arguments.length > 1) { if (arguments[1] == 3) { EspreLiveLogger.error(arguments[0]); } else if (arguments[1] == 2) { EspreLiveLogger.warn(arguments[0]); } else if (arguments[1] == 0) { EspreLiveLogger.trace(arguments[0]); } else { EspreLiveLogger.info(arguments[0]); } } else { EspreLiveLogger.info(arguments[0]); } }; FileUtil.deleteProject = function (_projectPath) { var result = false; var tempFile = ""; try{ if(FileUtil.doesFolderExist(_projectPath)){ // Handle Project.xml var filePath = FileUtil.toPath(_projectPath, "Project.xml") ; if(FileUtil.doesFileExist(filePath)){ result = FileUtil.fileDelete(filePath); } result = true; // success if we delete the Project.xml // Handle Encode.xml filePath = FileUtil.toPath(_projectPath, "Encode.xml"); if(FileUtil.doesFileExist(filePath)){ result = result && FileUtil.fileDelete(filePath); } //Delete idx/dat files audio_s1.dat var audioF= "audio_s"; var videoF = "video_s"; var counter = 1; // debugger; while(true) { tempFile = audioF + counter + ".idx"; filePath = FileUtil.toPath(_projectPath, tempFile ); if(FileUtil.doesFileExist(filePath)){ result = result && FileUtil.fileDelete(filePath); } else { //Looks like all the idx/dat files are cleaned up break; } tempFile = audioF + counter + ".dat"; filePath = FileUtil.toPath(_projectPath, tempFile); if(FileUtil.doesFileExist(filePath)){ result = result && FileUtil.fileDelete(filePath); } tempFile = videoF + counter + ".idx"; filePath = FileUtil.toPath(_projectPath, tempFile); if(FileUtil.doesFileExist(filePath)){ result = result && FileUtil.fileDelete(filePath); } tempFile = videoF + counter + ".dat"; filePath = FileUtil.toPath(_projectPath, tempFile); if(FileUtil.doesFileExist(filePath)){ result = result && FileUtil.fileDelete(filePath); } counter++; } //Delete SDL File tempFile = "video_s1.dat.sdl"; filePath = FileUtil.toPath(_projectPath, tempFile); if(FileUtil.doesFileExist(filePath)){ result = result && FileUtil.fileDelete(filePath); } if (!result) { meLogger.write("Some files could not be deleted.", 3); } // Handle scene files //TBD return result; } return true; } catch(e) { alert("Utilities.deleteProject EXCEPTION: " + e.message); meLogger.write(e.name + " :->>>>>" + e.message, 3); } return result; } FileUtil.fileDelete = function (_file) { return FileUtil.theInstance().fileDelete(_file); } //This is a stub FileUtil.toPath = function (t1, t2) { if((t1.charAt(t1.length - 1) == "\\") && (t2.charAt(0) == "\\")){ t1 = t1.substring(0,t1.length - 1) ; //Removing the last \ } if((t1.charAt(t1.length - 1) == "\\") || (t2.charAt(0) == "\\")){ return t1 + t2 ; } return t1 +"\\" + t2 ; } FileUtil.getHome = function () { return FileUtil.theInstance().getHome(); } FileUtil.getUserSandBox = function (){ return FileUtil.theInstance().getUserSandBox(); } FileUtil.expandPath = function (_shortPath){ return FileUtil.theInstance().expandPath(_shortPath); } FileUtil.writeToFilePath = function (fileAsAString,filePathName, overwrite) { return FileUtil.theInstance().writeToFilePath(fileAsAString, filePathName, overwrite); } FileUtil.saveImageAs = function(_uri, _path){ return FileUtil.theInstance().saveImageAs(_uri, _path); } FileUtil.writeToFile = function (fileAsAString, base, projRelPath, fileName, overwrite) { return FileUtil.theInstance().writeToFile(fileAsAString, base, projRelPath, fileName, overwrite); } FileUtil.fileExists = function (fileName) { return FileUtil.theInstance().fileExists(fileName); } FileUtil.doesFolderExist = function (dirName) { return FileUtil.theInstance().doesFolderExist(dirName); } FileUtil.getManifestAttributes = function (fileName) { return FileUtil.theInstance().getManifestAttributes(fileName); } FileUtil.deleteFile = function (fileName) { return FileUtil.theInstance().deleteFile(fileName); } FileUtil.copyFile = function (sourceFile, destPath) { return FileUtil.theInstance().copyFile(sourceFile, destPath); } FileUtil.getBase = function (fileName) { return FileUtil.theInstance().getBase(fileName); } FileUtil.doesFileExist = function (fileName){ return FileUtil.theInstance().doesFileExist(fileName); } FileUtil.getFileSize = function (fileName){ return FileUtil.theInstance().getFileSize(fileName); } FileUtil.getFileBase64 = function (fileName){ return FileUtil.theInstance().getFileBase64(fileName); } FileUtil.getProjectSize = function (projectPath){ return FileUtil.theInstance().getProjectSize(projectPath); } FileUtil.transferZone = function (fileName){ return FileUtil.theInstance().transferZone(fileName); } FileUtil.readFile = function (fileName){ return FileUtil.theInstance().readFile(fileName); } function loadXML(sourceFile) { var xmlDoc; // alert(sourceFile); if (window.ActiveXObject) { //I don't know what the difference would be between these two implementations... xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); ///xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0"); } else if (document.implementation && document.implementation.createDocument) { xmlDoc = document.implementation.createDocument("", "", null); //Day:The first parameter, "", defines the namespace used for the XML document. //The second parameter, "", is the XML root element in the XML file. //The third parameter, null, is always null because it is not implemented yet. } else { throw new MeException("Your browser can\'t handle this script"); //return; } try{ xmlDoc.async=false; xmlDoc.load(sourceFile); //we might need to escape } catch (e){ alert("Utilities.loadXML EXCEPTION: " + e.message); if (window.ActiveXObject && xmlDoc.parseError.errorCode !== 0) { alert("Error code: " + xmlDoc.parseError.errorCode + " Error Reason: " + xmlDoc.parseError.reason + +" Error Line: " + xmlDoc.parseError.line); } return null; } return(xmlDoc); } var xutil = {}; xutil._is_IE = (document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1); xutil._is_MOZ = (document.implementation && document.implementation.createDocument && document.implementation.hasFeature); xutil.getDomDocument = function (nspace, nodeName) { var oDomDoc = null; if (xutil._is_IE) { oDomDoc = new ActiveXObject("Microsoft.XMLDOM"); oDomDoc.loadXML('<' + nodeName + " />"); } else if (xutil._is_MOZ) { oDomDoc = document.implementation.createDocument(nspace, nodeName, null); } else { throw new Error("This browser is not supported."); } if (oDomDoc && (nspace || nodeName) && !oDomDoc.documentElement){ oDomDoc.appendChild(oDomDoc.createElementNS(nspace, nodeName)); } return oDomDoc; }; xutil.serializeToString = function(node) { var xmlString = null; if (xutil._is_IE) { xmlString = node.xml; return xmlString; } else if (xutil._is_MOZ) { xmlString = new XMLSerializer().serializeToString(node); return xmlString; } else { throw new MeException("This browser is not supported."); } }; // Parse an XML string xutil.parseFromString = function (text) { var doc = null; if (window.ActiveXObject) { // code for IE doc = new ActiveXObject("Microsoft.XMLDOM"); doc.async = false; doc.loadXML(text); } else { // code for Mozilla, Firefox, Opera, etc. var parser = new DOMParser(); doc = parser.parseFromString(text,"text/xml"); } // var x = doc.documentElement; return doc; }; // Load XML file xutil.load = function () { var forReading = 1, forWriting = 2, forAppending = 8; var xmlDoc = null; if (window.ActiveXObject) { // code for IE xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); } else if (document.implementation && document.implementation.createDocument) { // code for Mozilla, Firefox, Opera, etc. xmlDoc = document.implementation.createDocument("","",null); xmlDoc.loadXML = xmlDoc.load; //CHEAT!! } else { throw new Error("This browser is not supported."); } try{ xmlDoc.async = false; if ((arguments.length == 2) && (arguments[1] == 'SERVER')){ xmlDoc.load(arguments[0]); } else{ //alert("About to readFile: " + arguments[0]); var file = FileUtil.readFile(arguments[0]); // alert("file: " + file); if(file != "-1"){ // xmlDoc.loadXML(file.replace(/\"/g, "\'")); xmlDoc = xutil.parseFromString(file.replace(/\"/g, "\'")); } else { throw new MeException(arguments[0] + " File is empty."); } } } catch(e) { alert("Utilities.xutil.load EXCEPTION: " + e.message); meLogger.write(e.name + " :_[ " + e.message + "]", 3); } return xmlDoc; }; // return xml string xutil.xslt = function (documentFrom, filenameXSL, xmlDocument) { xmlDocument = xmlDocument || xutil.getDomDocument(); var _filenameXSL = (typeof EVME_XSL_PATH == "undefined")? filenameXSL : EVME_XSL_PATH + filenameXSL; var xsl = xutil.load(_filenameXSL,"SERVER"); //fromServer is set to true if (xutil._is_IE) { return documentFrom.transformNode(xsl); } else if (xutil._is_MOZ) { var processor = new XSLTProcessor(); processor.importStylesheet(xsl); var frag = processor.transformToFragment(documentFrom, xmlDocument); return xutil.serializeToString(frag); } }; if (!MeFactory) { var MeFactory = new Object(); } MeFactory.CreateCollection = function(ClassName) { var obj=new Array(); eval("var t=new "+ClassName+"()"); for(_item in t) { eval("obj."+_item+"=t."+_item); } return obj; }; MeFactory.sortByOrder = function (clip1, clip2) { if (clip1 instanceof Clip && clip2 instanceof Clip) { if(clip1.getOrder() > clip2.getOrder()){ return 1; } if(clip1.getOrder() < clip2.getOrder()){ return -1; } if(clip1.getOrder() == clip2.getOrder()){ return 0; } } throw new MeException("Could not compare Clips."); }; function MeCollection(){ this.add=function(obj) { this.push(obj); }; this.remove = function (obj) { var i = this.indexOf(obj); if (i != -1) { this.splice(i, 1); } }; this.indexOf = function (obj, fromIndex) { if (!fromIndex) { fromIndex = 0; } else if (fromIndex < 0) { fromIndex = Math.max(0, this.length + fromIndex); } for (var i = fromIndex; i < this.length; i++) { if((this[i]).getParameter('general','name') == obj.getParameter('general','name')){ return i; } } return -1; }; //Other collection functions go here var _createDocumentFragment = function (_xmlDocument) { var xmlDocument = _xmlDocument || xutil.getDomDocument(); var fragment = xmlDocument.createDocumentFragment(); for (var i = 0, item; item = this[i]; i++) { var node = item.createDocumentFragment(xmlDocument); fragment.appendChild(node); } return fragment; }; this.createDocumentFragment = _createDocumentFragment; // test code this.toXML = function (_xmlDocument) { xmlDocument = _xmlDocument || xutil.getDomDocument(); var xmlString = xutil.serializeToString(this.createDocumentFragment(xmlDocument)); return xmlString; }; } //isString() global method to check whether the given input is a String function isString(o) { return ((o != null) && (typeof o == 'string')); } //MeAddEvent() global method to Add events to different browsers (IE, FF etc...) function MeAddEvent(obj, evType, fn){ if (obj.addEventListener) { //if(evType == "propertychange") { //obj.addEventListener("propertychange", fn, false); //} obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } //Include this script to use selectNodes in IE, NS & FF: /* Prefix-correcting evaluate statement from http://www.faqts.com/knowledge_base/view.phtml/aid/34022/fid/119 */ if( document.implementation.hasFeature("XPath", "3.0") ){ XMLDocument.prototype.selectNodes = function(cXPathString, xNode){ if( !xNode ) { xNode = this; } var defaultNS = this.defaultNS; var aItems = this.evaluate(cXPathString, xNode,{ normalResolver: this.createNSResolver(this.documentElement), lookupNamespaceURI : function (prefix) { switch (prefix) { case "dflt": return defaultNS; default: return this.normalResolver.lookupNamespaceURI(prefix); } } },XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null); var aResult = []; for( var i = 0; i < aItems.snapshotLength; i++){ aResult[i] = aItems.snapshotItem(i); } return aResult; } Element.prototype.selectNodes = function(cXPathString){ if(this.ownerDocument.selectNodes){ return this.ownerDocument.selectNodes(cXPathString, this); }else{ throw "For XML Elements Only"; } } /* set the SelectionNamespaces property the same for NN or IE: */ XMLDocument.prototype.setProperty = function(p,v){ if(p=="SelectionNamespaces" && v.indexOf("xmlns:dflt")==0){ this.defaultNS = v.replace(/^.*=\'(.+)\'/,"$1"); } } XMLDocument.prototype.defaultNS; } /** * @ignore * @fileoverview This file has been coded to provide the comman utilities to various client side JavaScript API(s) * For using the class functions, first create an object of class. Then callthe necessary function(s) with the needed arguments/Parameters * Class Name : DojoUtility * * * @author Espre Team * @version 0.1 */ /** * member functions of class DojoUtility */ DojoUtility.prototype.sendRequest=sendRequest; DojoUtility.prototype.setSync = setSync; DojoUtility.prototype.setMimeType = setMimeType; DojoUtility.prototype.setTransport = setTransport; DojoUtility.prototype.setError = setError; DojoUtility.prototype.setHandler=setHandler; DojoUtility.prototype.setUrl=setUrl; DojoUtility.prototype.prepareBindObject=prepareBindObject; DojoUtility.prototype.setLoad=setLoad; DojoUtility.prototype.setContent=setContent; DojoUtility.prototype.setTimeoutFun=setTimeoutFun; DojoUtility.prototype.setMethod=setMethod; DojoUtility.prototype.setContentType=setContentType; /** * @constructor * sets the fields of class DojoUtility * @param {Array} attributeList */ function DojoUtility(bindObject){ this.serverUrl = "http://localhost/"; this.projectUrl ="Project/"; if( bindObject){ // an important JSON object, bindObject, would be passed to dojo.io.bind, this.bindObject = bindObject; } else{ this.bindObject = null; } this.url=''; // a default url can be there this.content=null; this.sync = false; // synchronous or asynchronous request this.mimeType = ''; this.transport = ''; this.handler = null; // callback response handler this.error = null; // error handler, invoked when error come this.load = ''; // response handler this.timeoutSeconds=10000; // seconds,waiting for response this.timeoutFun=null; // called in case of time out this.method='POST'; // //added-SK this.contentType=''; } //added-SK function setMethod(method) { this.method = method; } //added-SK function setContentType(contentType) { this.contentType = contentType; } /** * Set the timeoutFun, the timeout callback function * @param {String} handler * @return {String} handler */ function setTimeoutFun(timeoutFun){ this.timeoutFun = timeoutFun; } /** * Set the handler, the callback function * @param {String} handler * @return {String} handler */ function setHandler(handler){ this.handler = handler; } /** * Set the content, to be sent to the server * @param {String} content * @return {String} content */ function setContent(content){ this.content= content; } /** * Set the url, of the server * @param {String} url * @return {String} url */ function setUrl(url){ this.url = url; } /** * Set the Mimetype, which is used to decide the type of response (like JSON, Text, XMl) for the dojo.io.bind menthod * @param {String} mimetype * @return {String} mimetype */ function setMimeType(mimeType){ this.mimeType = mimeType; } /** * Set the Transport, which is used to decide the transport type for the request(like HTTPRequest, XMLHTTPRequest) for the dojo.io.bind menthod * @param {String} mimetype * @return {String} mimetype */ function setTransport(sytransportnc){ this.transport = transport; } /** * Set the error, Method defined in this will be called once an error will accured while exexuting the request * @param {String} error (Method Name) */ function setError(error){ this.error = error; } /** * Method defined in this will called, once the user gets the response from the dojo.io.bind. * @param {String} mimetype * @return {String} mimetype */ function setLoad(load){ this.load = load; } /** * Set the syncronous and asyncronous request as true and false respectively */ function setSync(sync){ this.sync = sync; } /** * Send request to the requested URL using dojo.io.bind method.Function can load the data, handle the error and * can call the callback methods.You can make the sync and async call to the server.Mimtype will be to decide the * return type from the server. */ function sendRequest(bindObject)//requestedURL, callback, actionName) { if(bindObject){ // user have freedom to set bindObject through senRequest function this.bindObject = bindObject // it will override any previously defined bindObject dojo.io.bind(this.bindObject); } if(!this.bindObject){ // if bindObject is not set either dojo.io.bind({ url: this.url, handler: this.handler, load: this.load, sync : this.sync, content: this.content, error: this.error, timeoutSeconds: this.timeoutSeconds, timeout: this.timeoutFun, //added-SK method: this.method, transport: this.transport, mimetype: this.mimeType, contentType: this.contentType }); }// dojo.io.bind(this.bindObject); } /** * prepares bindObject from DojoUtility attributes */ function prepareBindObject(){ /* var strJson='{'; var bindProperties = ['sync', 'mimetype', 'transport', 'error', 'load', 'timeoutSeconds', 'timeout', 'method']; var propUtil; for(property in bindProperties){ propUtil = eval('this.'+bindProperties[property]) if( propUtil && propUtil!='' && propUtil!=null){ // if property is set already strJson=strJson+ bindProperties[property] + ":" + "'"+propUtil+"'"+","; } } strJson+='}'; strJson=strJson.replace(/,}/g,"}"); // chop the last comma //this.bindObject = this.bindObjec strJson="{name: 'value2'}"; alert(typeof(strJson)); this.bindObject = eval(strJson); alert(this.bindObject); //for(i in this.bindObject) //alert(i+"::"+this.bindObject.i); */ } /** * return string representation of json * this version don't convert nested jsons or arrays */ function jsonToString(jsonstr){ var requestStr='{'; for(key in jsonstr) requestStr = requestStr + key +":'" + jsonstr[key]+"',"; requestStr =requestStr +"}"; requestStr = requestStr.replace(',}','}'); return requestStr; } function addServerAction(paramList,MethodName,serverAction){ if(paramList) return "{" + paramList + ", ACTIONID: ' " + serverAction +"'}"; else return; } // delay execution for millis milliseconds function wait(millis) { var date = new Date(); var curDate = null; do { curDate = new Date(); } while(curDate-date < millis); } /* * This function has been used to made the visibility of element/div to visible */ function showDiv(d){ if($(d)){ // this condition check's whether the objects exists $(d).style.visibility = 'visible'; $(d).style.display = 'block'; } } /* * This function has been used to made the display of element/div to None */ function hideDiv(d){ if($(d)){ // this condition check's whether the objects exists $(d).style.display = 'none'; } } /* * This function will return object, after fetching it from the document on the basis of its id */ function $(e){ return document.getElementById(e); } /** * prepares Json object from result xml string * @param {Sring} resultXML, a formated xml string * @return josn object */ function resultXMLToJson( resultXML ) { var xmlDom = parseXml(resultXML); // parse the input xml var jsonText = xml2json.parser(xmlDom, ""); // get Json Text from xmlDom var objJson = eval('(' + jsonText + ')'); response = { "actionstatus": objJson.RESPONSE.ACTIONSTATUS }; // create global response object if (objJson.RESPONSE.ACTIONSTATUS == "false") throw new Error(objJson.RESPONSE.Error.ExceptionMsg); return objJson; } function Actor(){ var that = this; var errString = null; this.getErrString = function() {return errString;}; this.setErrString = function(_errString) {errString = _errString;}; var errNo = 0; this.getErrNo = function() {return errNo;}; this.setErrNo = function(_errNo) {errNo = _errNo;}; var defaultWidth = '320'; var defaultHeight = '240'; var defaultName = ""; var defaultTag = ""; var defaultGestures = 'true'; var defaultControlsVisible = 'false'; // var defaultStreamIndex = -1; var actorApplet = null; this.currentInputStream = null; this.currentOutputStream = null; this.height = defaultHeight; this.width = defaultWidth; this.name = defaultName; this.tag = defaultTag; this.streamIndex = defaultStreamIndex; //For future use this.containerElement = null; if(arguments[0]) { if (typeof Actor.getActorInstance(arguments[0]) != "undefined") { this.setErrString('DUPLICATE ACTOR. name: ' + arguments[0]); directorTrace('Actor. ' + this.getErrString()); throw(this.getErrString()); return null; //To Avoid duplicate Actor names } } if (arguments.length == 1) { this.name = arguments[0]; this.style = new Style(arguments[0]); this.docwindow = window; } else if (arguments.length == 2) { this.name = arguments[0]; if (typeof arguments[1] != null) { this.tag = arguments[1]; } this.style = new Style(arguments[0]); this.docwindow = window; } else if (arguments.length == 3) { this.name = arguments[0]; if (typeof arguments[1] != null) { this.tag = arguments[1]; } this.style = new Style(arguments[0]); if (typeof arguments[2] != null) { this.style.cssText(arguments[2]); } this.docwindow = window; } else if (arguments.length == 4) { this.name = arguments[0]; this.tag = arguments[1]; this.style = new Style(arguments[0]); this.style.cssText(arguments[2]); this.docwindow = arguments[3]; } else { //TODO: } this.Event = EventManager; this.Event(this.docwindow); directorTrace('Actor constructor: this.routeid=' + this.routeid + ' name: ' + this.name); if (this.style.height() == "") { this.style.height('240px'); } if (this.style.width() == "") { this.style.width('320px'); } Actor.actorArray[this.name] = this; this.setInputStream = function(_uri){ EspreLive.trace('Actor.setInputStream' + ' _uri: ' + _uri); if (Stream.IsAStreamInstance(_uri)) { this.currentInputStream = _uri; if (this.currentInputStream.isOpen()) { this.currentInputStream.assignActor(this.getName()); } } else { var tempStream = new Stream(_uri, true, this.docwindow); /*true means it is an input stream */ if (tempStream === null) { directorTrace("Actor.setInputStream UNABLE TO CREATE STREAM." + " _uri: " + _uri); //TODO: log return null; } if ((this.currentInputStream != null) && (this.currentInputStream.getStreamType() == tempStream.getStreamType())&& (tempStream.getStreamType() != "AVIStream")) { if (('undefined' != typeof this.currentInputStream.setUri) && ('undefined' != typeof tempStream.getUri)) { this.currentInputStream.setUri(tempStream.getUri()); tempStream = null; } } else { if(this.currentInputStream != null && this.currentInputStream.isOpen()){ this.currentInputStream.close(); } this.currentInputStream = tempStream; } } this.syncActorStreamEvents(); this.currentInputStream.associatedActor = this; return this.currentInputStream; } this.getInputStream = function(){ return this.currentInputStream; } this.openInputStream = function(){ if(arguments.length >= 1){ this.setInputStream(arguments[0]); } if(this.currentInputStream === null) { directorTrace('Actor.openInputStream : currentInputStream is NULL'); return; } if(this.currentInputStream.isOpen()){ return; } if (this.currentInputStream.getStreamType() == "LSVXStream"){ this.currentInputStream.assignActor(this.getName()); this.currentInputStream.open(); return; } EspreLive.trace('Actor.openInputStream' + ' name: ' + this.name); _openInputStream(); } this.TriesToConnect = 0; var _openInputStream = function(){ if (!that.isInitialized()){ if (that.TriesToConnect < 10) { that.TriesToConnect++; EspreLive.trace('Actor._openInputStream' + ' name: ' + that.name + ' WAITING FOR INIT... ' + that.TriesToConnect); setTimeout(function(){ _openInputStream(); }, 1000); return; } else{ //TODO: log Add error event saying that the stream could not be opened. //alert('Input Stream can not be opened'); return false; } } that.TriesToConnect = 0; if (that.currentInputStream != null) { if (!that.currentInputStream.isOpen()) { that.currentInputStream.assignActor(that.getName()); return that.currentInputStream.open(); } else { if (that.currentInputStream.getStreamType() == "IRTPStream") { that.currentInputStream.setChannel(null); // TODO GLM review -- force lookup in case channels need to change that.currentInputStream.acquireChannels(); return true; } } } else { directorTrace('Actor._openInputStream UNABLE TO OPEN. currentInputStream is NULL'); } return false; } this.closeInputStream = function(){ if (this.currentInputStream === null) { return true; } // Some cleanup here... return this.currentInputStream.close(); } this.releaseInputStream = function(){ //TODO: if the stream is open, disassociate the stream from the actor if (this.currentInputStream.isOpen()) { this.currentInputStream.unassignActor(this.name); //new method } var instream = this.currentInputStream; this.currentInputStream = null; return instream; } this.setOutputStream = function(_uri){ EspreLive.trace('Actor.setOutputStream' + ' _uri: ' + _uri); if (this.currentInputStream === null) { EspreLive.trace('Actor.setOutputStream' + ' currentInputStream is NULL'); //TODO: log There is no input stream return null; } if (this.currentOutputStream !== null) { var oip = false; try {oip = this.currentOutputStream.isOpenInProgress();} catch (e) {EspreLive.trace('Actor.setOutputStream' + ' openInProgress not supported');}; if (oip) { EspreLive.trace('Actor.setOutputStream open in progress'); return this.currentOutputStream; } } if (Stream.IsAStreamInstance(_uri)) { this.currentOutputStream = _uri; if (this.currentOutputStream.isOpen()) { this.currentInputStream.assignOutputStreamId(this.currentOutputStream.getStreamId()); } } else { this.currentOutputStream = new Stream(_uri, false); /*false means it is not input stream */ if (this.currentOutputStream === null) { //TODO: log return null; } } return this.currentOutputStream; } this.getOutputStream = function(){ return this.currentOutputStream; } this.openOutputStream = function(){ EspreLive.trace('Actor.openOutputStream'); if (isGuardEnabled('openOutputStream')) { EspreLive.trace('Actor.openOutputStream BLOCKED'); return true; } if (this.currentOutputStream !== null) { var oip = false; try {oip = this.currentOutputStream.isOpenInProgress();} catch (e) {EspreLive.trace('Actor.openOutputStream' + ' openInProgress not supported');}; if (oip) { EspreLive.trace('Actor.openOutputStream in progress'); return true; } } enableGuard('openOutputStream'); if(arguments.length >= 1){ this.setOutputStream(arguments[0]); } return true; } this.openOutputStream2 = function() { if ((this.currentOutputStream !== null) && (!this.currentOutputStream.isOpen())) { var oip = false; try {oip = this.currentOutputStream.isOpenInProgress();} catch (e) {EspreLive.trace('Actor.openOutputStream2' + ' openInProgress not supported');}; if (oip) { EspreLive.trace('Actor.openOutputStream2 in progress'); return true; } this.currentOutputStream.open(); } //TODO Need to look at what errors could be returned from this. Need to return a Boolean value. this.currentInputStream.assignOutputStreamId(this.currentOutputStream.getStreamId()); EspreLive.trace('Actor.openOutputStream2' + ' streamType: ' + this.currentOutputStream.getStreamType()); return true; } this.closeOutputStream = function(){ if (this.currentOutputStream === null) return false; // Some cleanup here... this.currentOutputStream.close(); } this.releaseOutputStream = function(){ var outstream = this.currentOutputStream; this.currentOutputStream = null; return outstream; } this.getName = function(){ return this.name; } this.setName = function(_name){ var oldname = this.name; this.name = _name; return oldname; } this.hide = function(){ this.style.visibility('hidden'); //document.getElementById(this.getTag()).style.visibility = 'hidden'; } this.show = function(){ this.style.visibility('visible'); //document.getElementById(this.getTag()).style.visibility = 'visible'; } this.setWidth = function(_width){ _width = parseInt(_width) + 'px'; this.style.width(_width); this.width = _width; } this.getWidth = function(){ return this.style.width(); } this.setHeight = function(_height){ _height = parseInt(_height) + 'px'; this.style.height(_height); this.height = _height; } this.getHeight = function(){ return this.style.height(); } //TODO: check return value // TODO: GLM if deferred, return value is not valid. this.setTag = function(_tag){ if (isSetTagBlocked()) { setTimeout(function() {that.setTag(_tag);},getDefaultGuardTime()); return -1; } else { EspreLive.trace('Actor.setTag' + ' _tag: ' + _tag); enableGuard('setTag'); if (!this.isInitialized()) { if (typeof _tag == "string") { // TODO: GLM can the div tag be validated here? this.tag = _tag; } else { //TODO: log Invalid tag; EspreLive.trace('Actor.setTag' + ' INVALID TAG: ' + _tag); return null; } this.init(); } return this.tag; } } this.getTag = function(){ return this.tag; } this.play = function(){ if (isGuardEnabled('play')) { EspreLive.trace('Actor.play blocked'); return; } enableGuard('play'); EspreLive.trace('Actor.play' + ' name: ' + this.name); if (arguments.length > 0) { this.currentInputStream = this.setInputStream(arguments[0]); } //if stream is not playable, return if (((this.currentInputStream === null) || (typeof this.currentInputStream.play == 'undefined'))) { // log and return EspreLive.trace('Actor.play function not supported'); return false; } // TODO: Open the current stream if (!this.currentInputStream.isOpen()) { this.openInputStream(); } else { if (this.currentInputStream.getStreamType() == "IRTPStream") { this.currentInputStream.setChannel(null); // TODO GLM review -- force lookup in case channels need to change this.currentInputStream.acquireChannels(); } } if(this.currentInputStream.assignedActor != this.getName()){ this.currentInputStream.assignActor(this.getName()); } if (this.currentInputStream.getStreamType() == "IRTPStream") { this.currentInputStream.addEventListener("player_resize",playerResizeEvent); } EspreLive.trace('Actor.play streamType: ' + this.currentInputStream.getStreamType()); this.currentInputStream.play(); //TODO: return true; } // this.playerResizeEvent = function(evt) {playerResizeEvent(evt);} // TODO: GLM review for use when switching between LSVX and RTP streams function playerResizeEvent(evt) { return; var pw = that.style.width(); var ph = that.style.height(); var nw = evt.width + 'px'; var nh = evt.height + 'px'; if ((pw != nw) || (ph != nh)) { EspreLive.trace('Actor.playerResizeEvent' + ' name: ' + that.name + ' previousWidth: ' + pw + ' previousHeight: ' + ph + ' newWidth: ' + nw + ' newHeight: ' + nh); that.style.width(nw); that.style.height(nh); //that.stop(); //setTimeout(function() {that.play();},5000); } else { EspreLive.trace('Actor.playerResizeEvent' + ' name: ' + that.name + ' no change.' + ' previousWidth: ' + pw + ' previousHeight: ' + ph + ' newWidth: ' + nw + ' newHeight: ' + nh); } //that.notifyDependents('player_resize',evt); } this.stop = function(){ if ((this.currentInputStream === null) || (typeof this.currentInputStream.stop == 'undefined')) { // log and return return true; } return this.currentInputStream.stop(); } this.pause = function(){ if ((this.currentInputStream === null) || (typeof this.currentInputStream.pause == 'undefined')) { EspreLive.trace('Actor.pause' + ' name: ' + that.name + ' unimplemented function.' + ' streamType: ' + this.currentInputStream.getStreamType()); return false; } return this.currentInputStream.pause(); } this.resume = function(){ if ((this.currentInputStream === null) || (typeof this.currentInputStream.resume == 'undefined')) { EspreLive.trace('Actor.resume' + ' name: ' + that.name + ' unimplemented function.' + ' streamType: ' + this.currentInputStream.getStreamType()); return false; } return this.currentInputStream.resume(); } this.publish = function(){ if (isPublishBlocked()) { EspreLive.trace('Actor.publish deferred.' + ' name: ' + this.name); var outputStream = arguments[0]; var publishRetryTicks = 1200; if (outputStream) { setTimeout(function() {that.publish(outputStream);},publishRetryTicks); } else { setTimeout(function() {that.publish();},publishRetryTicks); } return; } enableGuard('publish'); EspreLive.trace('Actor.publish' + ' name: ' + this.name); //debugger; if (arguments.length > 0) { this.setOutputStream(arguments[0]); } // TODO: Open the current stream if ((this.currentOutputStream !== null) && (!this.currentOutputStream.isOpen())) { this.openOutputStream2(); //Check..... } //if stream is not publishable, return if ((this.currentInputStream === null) || (typeof this.currentInputStream.publish == 'undefined')) { // log and return EspreLive.trace('Actor.publish unsupported request'); return false; } if (false && this.currentOutputStream.getStreamType() == "ORTPStream") { var w = parseInt(this.style.width()); var h = parseInt(this.style.height()); EspreLive.trace('Actor.publish' + ' width: ' + w + ' height: ' + h); this.currentOutputStream.setFrameWidth(w); this.currentOutputStream.setFrameHeight(h); } return this.currentInputStream.publish(); } this.forward = function(_rate){ if ((this.currentInputStream === null) || (typeof this.currentInputStream.forward == 'undefined')) { // log and return return false; } return this.currentInputStream.forward(_rate); } this.reverse = function(_rate){ if ((this.currentInputStream === null) || (typeof this.currentInputStream.reverse == 'undefined')) { // log and return return false; } return this.currentInputStream.reverse(_rate); } this.unpublish = function(){ if (true) { var oStream = this.currentOutputStream; if ((oStream !== null) && (oStream.getStreamType() == "ORTPStream")) { return this.closeOutputStream(); } } if ((this.currentInputStream === null) || (typeof this.currentInputStream.unpublish == 'undefined')) { // log and return return false; } return this.currentInputStream.unpublish(); } this.setMute = function(_mute){ if ((this.currentInputStream === null) || (typeof this.currentInputStream.setMute == 'undefined')) { // log and return return false; } this.currentInputStream.setMute(_mute); } this.mute = function(){ return this.setMute(true); } this.unmute = function(){ return this.setMute(false); } this.generateThumbnail = function(width, height) { if ((this.currentInputStream === null) || (typeof this.currentInputStream.generateThumbnail == 'undefined')) { // no input stream or the function is not supported return false; } if (arguments.length == 0 || arguments[0] == "undefined" || arguments[0] == "") return this.currentInputStream.generateThumbnail(); else if (arguments.length == 2) return this.currentInputStream.generateThumbnail(width, height); else return false; } this.getThumbnail = function() { if ((this.currentInputStream === null) || (typeof this.currentInputStream.getThumbnail == 'undefined')) { // no input stream or the function is not supported return null; } if (arguments.length == 0 || arguments[0] == "undefined" || arguments[0] == "") return this.currentInputStream.getThumbnail(0); else return this.currentInputStream.getThumbnail(arguments[0]); } this.getThumbnailSize = function() { if ((this.currentInputStream === null) || (typeof this.currentInputStream.getThumbnailSize == 'undefined')) { // no input stream or the function is not supported return false; } if (arguments.length == 0 || arguments[0] == "undefined" || arguments[0] == "") return this.currentInputStream.getThumbnailSize(0); else return this.currentInputStream.getThumbnailSize(arguments[0]); } this.init = function(){ if (!this.style.isTempDiv()) { setTimeout('Actor.getActorInstance(\"' + this.name + '\").init()', 200); return; } if (this.getTag() != "") { //Applet can start only when the Tag is set thru setTag method or Actor constructor var vPlay; vPlay = new AppletSpec(EVME_ACTOR_TYPE); vPlay.setParameter("name", this.getName()); if (this.style.width() != "") { vPlay.setParameter("width", this.style.width()); } else { vPlay.setParameter("width", this.width); //defaultWidth this.style.width(this.width); } if (this.style.height() != "") { vPlay.setParameter("height", this.style.height()); } else { vPlay.setParameter("height", this.height); //defaultHeight this.style.height(this.height); } vPlay.setParameter("pels", this.style.width()); //TODO: these two params seem to be used only by netscape and firefox vPlay.setParameter("lines", this.style.height()); vPlay.setParameter("embedApplet", "true"); if (this.style.backgroundColor() != "") { vPlay.setParameter("user", "bgcolor", this.style.backgroundColor()) vPlay.setParameter("user", "boxbgcolor", this.style.backgroundColor()); vPlay.setParameter("user", "boxfgcolor", this.style.backgroundColor()); } vPlay.setProperty("util","dom","window",this.docwindow); AppletManager.theInstance().startApplet(vPlay, actorCallback, this.getTag()); } } function actorCallback(applet, name){ actorApplet = applet; that.setJavaInterface(applet); //from Eventmanager class that.containerElement = AppletManager.theInstance().getContainerElement(Actor.getActorInstance(that.name).getName()); that.style.setContainerDiv(that.containerElement); if (true && (that.currentInputStream !== null)) { that.currentInputStream.assignActor(that.getName()); } } //TODO: This has to be looked again. Issues with setter methods....too late to use them? this.init(); this.isInitialized = function(){ if (actorApplet !== null) { return true; } else { return false; } } this.setEventRuleGroupName = function(name) { this._setEventRuleGroupName(name); if (this.currentInputStream !== null) { this.currentInputStream._setEventRuleGroupName(name); } } this.resetEventRuleGroupName = function() { this._resetEventRuleGroupName(); if (this.currentInputStream !== null) { this.currentInputStream._resetEventRuleGroupName(); } } this.addEventRule = function(event,action) { this._addEventRule(event,action); if (this.currentInputStream !== null) { this.currentInputStream._addEventRule(event,action); } } this.addEventRuleToGroup = function(group,event,action) { this._addEventRuleToGroup(group,event,action); if (this.currentInputStream !== null) { this.currentInputStream._addEventRuleToGroup(group,event,action); } } this.removeEventRule = function(event,action) { this._removeEventRule(event,action); if (this.currentInputStream !== null) { this.currentInputStream._removeEventRule(event,action); } } this.removeEventRuleFromGroup = function(group,event,action) { this._removeEventRuleFromGroup(group,event,action); if (this.currentInputStream !== null) { this.currentInputStream._removeEventRuleFromGroup(group,event,action); } } this.syncActorStreamEvents = function() { this.currentInputStream._setEventRuleGroupName(this.getEventRuleGroupName()); var grps = this._eventRuleGroups; for (var group in grps) { //directorTrace('Actor.syncActorStreamEvents' + ' group: ' + group); for (var event in grps[group]) { //directorTrace('Actor.syncActorStreamEvents' + ' event: ' + event); for (var action in grps[group][event]) { //directorTrace('Actor.syncActorStreamEvents' + ' action: ' + action); this.currentInputStream._addEventRuleToGroup(group,event,action); } } } } function dropReference() { actorApplet = null; } this.destroy = function () { if (isDestroyBlocked()) { setTimeout(function() {that.destroy();},getDefaultGuardTime()); } else { enableGuard('destroy'); EspreLive.trace('Actor.destroy' + ' name: ' + this.getName()); dropReference(); this.tag = ""; AppletManager.theInstance().destroyApplet(this.getName()); } }; function getDefaultGuardTime() { return 1000; } function isGuardEnabled(functionName) { //var status = eval('that.'+functionName+'Guard'); //EspreLive.trace('Actor.isGuardEnabled' + ' name: ' + that.name + ' functionName: ' + functionName + ' status: ' + status); //return status; return eval('that.'+functionName+'Guard'); } function enableGuard(functionName,timeout) { timeout = (typeof timeout !== 'undefined') ? timeout : getDefaultGuardTime(); //EspreLive.trace('Actor.enableGuard' + ' name: ' + that.name + ' functionName: ' + functionName + ' timeout: ' + timeout); eval('that.'+functionName+'Guard=true'); if (functionName != 'destroy') { eval("setTimeout(function() {that." + functionName + "Guard=false;}," + timeout + ");"); } else { Actor.destroyCtr++; eval("setTimeout(function() {that." + functionName + "Guard=false;Actor.destroyCtr--;}," + timeout + ");"); } } function isPublishBlocked() { if ((that.currentOutputStream !== null) && (that.currentOutputStream.getStreamType() == "ORTPStream")) { var w = parseInt(that.style.width()); var h = parseInt(that.style.height()); if (isNaN(w) || isNaN(h)) { debugger; EspreLive.trace('Actor.isPublishBlocked WIDTH: ' + w + ' HEIGHT: ' + h + ' style.width: ' + that.style.width() + ' style.height: ' + that.style.height()); return true; } } return isGuardEnabled('publish') || isGuardEnabled('play') || isGuardEnabled('openOutputStream'); } function isSetTagBlocked() { return (Actor.destroyCtr > 0) || isGuardEnabled('setTag') || isGuardEnabled('destroy'); // TODO: GLM had this line in before AppletManager+216 change from Don //return isGuardEnabled('setTag') || isGuardEnabled('destroy'); } function isDestroyBlocked() { return (Actor.destroyCtr > 0) || isGuardEnabled('setTag') || isGuardEnabled('destroy'); // TODO: GLM had this line in before AppletManager+216 change from Don //return isGuardEnabled('setTag') || isGuardEnabled('destroy'); } } Actor.getActorInstance = function(_name){ return Actor.actorArray[_name]; } Actor.removeActorInstance = function (_name) { delete Actor.actorArray[_name]; } Actor.actorArray = new Array(); // // backward compatibility patches. // function PlayerPatches() {} Actor.setAppletType = function(arg) {}; Actor.setVideoMessagesEnabled = function(arg) {}; Function.prototype._bind = function(o) { var _this = this; return function() {return _this.apply(o,arguments);}; }; Actor.prototype.setClipWidth = function(arg) {this.setWidth(arg);}; Actor.prototype.setClipHeight = function(arg) {this.setHeight(arg);}; Actor.prototype.setSecondary = function(arg) {}; Actor.prototype.setPrimary = function(arg) {}; Actor.prototype.configureChatRemoteView = function() {}; Actor.prototype.configureChatSelfView = function() {}; Actor.prototype.addHtmlParam = function(key,value) { var that = this; if (that.getInputStream() === null) { setTimeout(function() {that.addHtmlParam(key,value);},100); } else { eval('that.getInputStream().set' + key.charAt(0).toUpperCase() + key.substr(1) + '(' + value + ');'); } }; Actor.prototype.setHasView = function(arg) {}; Actor.prototype.buffer = function(arg) { //directorTrace('Patches actor.buffer' + ' name: ' + this.getName() + ' arg: ' + arg); this.openInputStream(arg); this.getInputStream().buffer(arg); }; Actor.prototype.getContextIndex = function() { var index = Actor.INVALID_CONTEXT_INDEX; var inputStream = this.getInputStream(); if ((inputStream !== null) && (inputStream.getStreamId() !== -1)) { index = inputStream.getStreamId(); } return index; }; Actor.prototype.setGestures = function(state) { var that = this; var stream = that.getInputStream(); if (stream === null) { directorTrace('PlayerPatches actor.setGestures deferred.' + ' state: ' + state); setTimeout(function() {that.setGestures(state);},1000); } else { //directorTrace('PlayerPatches actor.setGestures' + ' state: ' + state); stream.setGestures(state); } }; // BEGIN DIRECTOR TRACE DEFINITION PlayerPatches.logger = null; PlayerPatches.loggerRequested = false; PlayerPatches.loggerCallback = function(logger) {PlayerPatches.logger = logger;}; PlayerPatches.EspreLiveServiceReady = true; function directorTrace(traceText,traceTag) { traceTag = (typeof traceTag !== 'undefined') ? traceTag : 'PlayerPatches.directorTrace'; var that = this; var e; if (PlayerPatches.EspreLiveServiceReady) { if (PlayerPatches.logger === null) { if (!PlayerPatches.loggerRequested) { JSInterface.theInstance().getLogger("PlayerPatches",PlayerPatches.loggerCallback); PlayerPatches.loggerRequested = true; } try {setTimeout("directorTrace('" + traceText + "')",1000);} catch (e) {}; } else { try {PlayerPatches.logger.info(traceTag + " " + traceText);} catch (e) {}; } } else { try {setTimeout("directorTrace('" + traceText + "')",1000);} catch (e) {}; } } // END DIRECTOR TRACE DEFINITION PlayerPatches.fireMeEvent = function(event,eventDescriptor) { for (var actorName in Actor.actorArray) { var actor = Actor.actorArray[actorName]; if (typeof actor.name !== 'undefined') { actor.invoke(event,eventDescriptor); } } }; function getActorByName(name) { var actor = Actor.actorArray[name]; if (typeof actor === 'undefined') { directorTrace('PlayerPatches.getActorByName ACTOR NOT FOUND. name: ' + name); actor = null; } return actor; } Actor.getActorByStreamIndex = function(index) { var actorInstance = null; for (var actorName in Actor.actorArray) { var candidate = Actor.actorArray[actorName]; if (typeof candidate.name !== 'undefined') { var stream = candidate.getInputStream(); if (stream !== null) { if (stream.getStreamId() === index) { actorInstance = candidate; break; } } } } if (actorInstance === null) directorTrace('PlayerPatches Actor.getActorByStreamIndex unable to find actor.' + ' index: ' + index); return actorInstance; }; Actor.getStreamByIndex = function(index) // private { var streamInstance = null; for (var actorName in Actor.actorArray) { var actor = Actor.actorArray[actorName]; if (typeof actor.name !== 'undefined') { var candidateStream = actor.getInputStream(); if (candidateStream !== null) { if (candidateStream.getStreamId() === index) { streamInstance = candidateStream; break; } } } } if (streamInstance === null) directorTrace('PlayerPatches Actor.getStreamByIndex unable to find stream.' + ' index: ' + index); return streamInstance; }; Actor.getStreamByTag = function(tag) // private { var streamInstance = null; for (var actorName in Actor.actorArray) { var actor = Actor.actorArray[actorName]; if ((typeof actor.name !== 'undefined') && (actor.getTag() === tag)) { streamInstance = actor.getInputStream(); break; } } if (streamInstance === null) directorTrace('PlayerPatches Actor.getStreamByTag unable to find stream.' + ' tag: ' + tag); return streamInstance; }; Actor.getActorByTag = function(tag) // private { var actorInstance = null; for (var actorName in Actor.actorArray) { var candidateActor = Actor.actorArray[actorName]; if ((typeof candidateActor.name !== 'undefined') && (candidateActor.getTag() === tag)) { actorInstance = candidateActor; break; } } if (actorInstance === null) directorTrace('PlayerPatches Actor.getActorByTag unable to find actor.' + ' tag: ' + tag); return actorInstance; }; Actor.INVALID_CONTEXT_INDEX = -2; // // BEGIN promote support // Actor.prototype.promote = function(anActor,clipHandle,position) { position = position || Actor.getPosition(this.getContextIndex(),''); anActor.updateHistoryList(); this.pause(); anActor.playClipFromTo(position.split(',')[0],position.split(',')[1],-1,-1,true,clipHandle); }; Actor.prototype.restore = function(clipHandle) { var position = this.historyList[clipHandle]; this.playClipFromTo(position.split(',')[0],position.split(',')[1],-1,-1,true,clipHandle); }; Actor.prototype.playClipFromTo = function(fromSeg,fromFrame,toSeg,toFrame,pauseAtEnd,clipHandle) { var that = this; var stream = that.getInputStream(); if (stream === null) { stream = this.setInputStream(clipHandle); if (stream !== null) { this.openInputStream(); } } if (stream === null) { directorTrace('PlayerPatches actor.playClipFromTo deferred.' + ' fromSeg: ' + fromSeg + ' fromFrame: ' + fromFrame + ' toSeg: ' + toSeg + ' toFrame: ' + toFrame + ' pauseAtEnd: ' + pauseAtEnd + ' clipHandle: ' + clipHandle); setTimeout(function() {that.playClipFromTo(fromSeg,fromFrame,toSeg,toFrame,pauseAtEnd,clipHandle);},1000); } else { //directorTrace('PlayerPatches actor.playClipFromTo' + ' fromSeg: ' + fromSeg + ' fromFrame: ' + fromFrame + ' toSeg: ' + toSeg + ' toFrame: ' + toFrame + ' pauseAtEnd: ' + pauseAtEnd + ' clipHandle: ' + clipHandle); stream.play(fromSeg,fromFrame,toSeg,toFrame,pauseAtEnd,clipHandle); } }; Actor.prototype.historyList = null; // private Actor.prototype.updateHistoryList = function() // private { if (this.historyList === null) {this.historyList = new Object();} var stream = this.currentInputStream; if (stream !== null) { this.historyList[stream.getUri()] = Actor.getPosition(this.getContextIndex(),''); } }; Actor.getPosition = function(ctxId,tag) { // TODO GLM this is actually the clip position (e.g., 'segment,frame' as in '2,404'); return clipDirector.ep_invokeAndWait(ctxId + ',' + tag + ',ep_getPosition'); }; // // END promote support // Actor.prototype.playPause = function() {// if playing, toggle between play and pause. if stopped, play. var stream = this.getInputStream(); var name = this.getName(); var tag = this.getTag(); if (stream !== null) { if (stream.getStreamId() !== -1) { if (stream.isPaused()) { stream.resume(); } else { if (stream.isPlaying()) { stream.pause(); } else { this.playClipFromTo(1,0,-1,-1,true,stream.getUri()); // here if player is stopped. force a play from the beginning. } } } else { directorTrace('PlayerPatches actor.playPause failed -- streamId is -1.' + ' name: ' + name + ' tag: ' + tag); } } else { directorTrace('PlayerPatches actor.playPause failed -- stream is NULL.' + ' name: ' + name + ' tag: ' + tag); } }; Actor.prototype.displayImage = function(imageUrl) { var ctxId = this.getContextIndex(); if (ctxId > 0) { clipDirector.ep_invoke(ctxId + ',,ep_displayImage,' + imageUrl); } else { directorTrace('Patches Actor.displayImage invalid ctxId: ' + ctxId); } }; // // BEGIN onFrameEvent support // Actor.prototype.addOnFrameEvent = function(mode,segment,frame,eventName,optionalArgs) { this.onFrameEventCommon('ep_addOnFrameEvent',mode,segment,frame,eventName,optionalArgs); }; Actor.prototype.removeOnFrameEvent = function(mode,segment,frame,eventName,optionalArgs) { this.onFrameEventCommon('ep_removeOnFrameEvent',mode,segment,frame,eventName,optionalArgs); }; Actor.prototype.onFrameEventCommon = function(methodName,mode,segment,frame,eventName,optionalArgs) { var invokeString = ' ,' + this.getTag() + ',' + methodName + ',' + mode + ',' + segment + ',' + frame + ',' + eventName; if (typeof optionalArgs !== 'undefined') invokeString += ',' + optionalArgs; clipDirector.ep_invoke(invokeString); }; Actor.prototype.clearOnFrameEvent = function() { clipDirector.ep_invoke(' ,' + this.getTag() + ',ep_clearOnFrameEvent'); }; // // END onFrameEvent support // EspreLive.trace = function(traceStr) {directorTrace(traceStr,'EspreLive.trace');}; Actor.destroyCtr = 0; Actor.prototype.playFromTo = function(fromSegment,fromRecNum,toSegment,toRecNum) { clipDirector.ep_invoke('' + this.getContextIndex() + ',,ep_playFromTo,' + fromSegment + ',' + fromRecNum + ',' + toSegment + ',' + toRecNum + ',true,true'); }; // // BEGIN scene support // Actor.prototype.previousSceneClipHandle = null; Actor.prototype.playScene = function(scene,clipHandle) // 'sceneName;fromSegment,fromRecNum:toSegment,toRecNum' { var sceneName = this.getSceneName(scene); var fromSegment = this.getSceneFromSegment(scene); var fromRecNum = this.getSceneFromRecNum(scene); var toSegment = this.getSceneToSegment(scene); var toRecNum = this.getSceneToRecNum(scene); if (clipHandle !== null) { if (clipHandle != this.previousSceneClipHandle) { this.previousSceneClipHandle = clipHandle; this.playClipFromTo(fromSegment,fromRecNum,toSegment,toRecNum,true,clipHandle); } else { this.playFromTo(fromSegment,fromRecNum,toSegment,toRecNum); } } else { EspreLive.trace('[ERROR] Actor.playScene NULL clipHandle'); } }; Actor.prototype.getSceneName = function(scene) { var sceneName = null; if (scene && (scene.length > 0)) { sceneName = scene.split(';')[0]; } return sceneName; }; Actor.prototype.getSceneFromSegment = function(scene) {// 'sceneName;fromSegment,fromRecNum:toSegment,toRecNum' var segment = 1; if (scene && (scene.length > 0)) { segment = scene.split(';')[1].split(':')[0].split(',')[0]; } return parseInt(segment); }; Actor.prototype.getSceneFromRecNum = function(scene) {// 'sceneName;fromSegment,fromRecNum:toSegment,toRecNum' var recNum = 0; if (scene && (scene.length > 0)) { recNum = scene.split(';')[1].split(':')[0].split(',')[1]; } return parseInt(recNum); }; Actor.prototype.getSceneToSegment = function(scene) {// 'sceneName;fromSegment,fromRecNum:toSegment,toRecNum' var segment = 1; if (scene && (scene.length > 0)) { segment = scene.split(';')[1].split(':')[1].split(',')[0]; } return parseInt(segment); }; Actor.prototype.getSceneToRecNum = function(scene) {// 'sceneName;fromSegment,fromRecNum:toSegment,toRecNum' var recNum = 0; if (scene && (scene.length > 0)) { recNum = scene.split(';')[1].split(':')[1].split(',')[1]; } return parseInt(recNum); }; // // END scene support // Actor.prototype.playExInProgress = false; Actor.prototype.playExStepTicks = 500; Actor.prototype.playEx = function(iStream,iArgs,oStream,oArgs,publishIt) { // [i|o]Args e.g., 'w=320&h=240&bw=400&svbw=200&rvbw=200&fr=15&kfr=3&rc=13&iqp=9&t=0&minQ=2&maxQ=31' var that = this; publishIt = (typeof publishIt !== 'undefined') ? publishIt : false; EspreLive.trace("Actor.playEx" + ' iStream: ' + iStream + ' iArgs: ' + iArgs + ' oStream: ' + oStream + ' oArgs: ' + oArgs + ' publishIt: ' + publishIt); if ((typeof iStream !== 'undefined') && (iStream !== null)) { this.openInputStream(iStream); var is = this.getInputStream(); if (is !== null) { if ((typeof iArgs !== 'undefined') && (iArgs !== null)) { var w = Actor.getArg(iArgs,'w'); if (w !== null) {is.setWidth(w);} var h = Actor.getArg(iArgs,'h'); if (h !== null) {is.setHeight(h);} } else { EspreLive.trace('Actor.playEx no input args specified'); } this.playExInProgress = true; //this.play(); setTimeout(function() {that.playEx_b(iStream,iArgs,oStream,oArgs,publishIt);},this.playExStepTicks); } else { debugger; // unable to open input stream } } else { EspreLive.trace('Actor.playEx no input stream specified'); } }; Actor.prototype.playEx_b = function(iStream,iArgs,oStream,oArgs,publishIt) { var that = this; if ((typeof oStream !== 'undefined') && (oStream !== null)) { this.openOutputStream(oStream); this.openOutputStream2(); var os = this.getOutputStream(); if (os !== null) { if ((typeof oArgs !== 'undefined') && (oArgs !== null)) { var defaultFrameRate = 15; var defaultRateControl = 13; var defaultTurbo = 0; var defaultMinQuant = 2; var defaultMaxQuant = 31; var defaultFirstFrameQuality = 9; var defaultSkipFrameEnabled = 0; // 0 == off; 1 == on var defaultSearch8x8 = 0; var defaultAnnex = 0; var defaultAudFmt = 0; var defaultAutoKey = 0; var defaultMeterBitRate = 0; var w = Actor.getArg(oArgs,'w'); if (w !== null) {os.setFrameWidth(w);} var h = Actor.getArg(oArgs,'h'); if (h !== null) {os.setFrameHeight(h);} var bw = Actor.getArg(oArgs,'bw'); if (bw !== null) {os.setTotalBandWidth(bw);} var svbw = Actor.getArg(oArgs,'svbw'); if (svbw !== null) {os.setSendVideoBandWidth(svbw);} var rvbw = Actor.getArg(oArgs,'rvbw'); if (rvbw !== null) {os.setReceiveVideoBandWidth(rvbw);} var fr = Actor.getArg(oArgs,'fr'); if (fr === null) {fr = defaultFrameRate;} os.setFrameRate(fr); var kfr = Actor.getArg(oArgs,'kfr'); if (kfr !== null) {os.setKeyFrameRate(fr*kfr);} var rc = Actor.getArg(oArgs,'rc'); if (rc === null) {rc = defaultRateControl;} if (rc > 31) rc = 31; var t = Actor.getArg(oArgs,'t'); if (t === null) {t = defaultTurbo;} if (t > 9) t = 9; var minQ = Actor.getArg(oArgs,'minQ'); if (minQ === null) {minQ = defaultMinQuant;} if (minQ > 30) minQ = 30; var maxQ = Actor.getArg(oArgs,'maxQ'); if (maxQ === null) {maxQ = defaultMaxQuant;} if (maxQ > 31) maxQ = 31; var sfe = Actor.getArg(oArgs,'sfe'); if (sfe === null) {sfe = defaultSkipFrameEnabled;} if (sfe > 1) sfe = 1; var s8 = Actor.getArg(oArgs,'s8'); if (s8 === null) {s8 = defaultSearch8x8;} if (s8 > 1) s8 = 1; var annex = Actor.getArg(oArgs,'annex'); if (annex === null) {annex = defaultAnnex;} if (annex > 1) annex = 1; var audFmt = Actor.getArg(oArgs,'audFmt'); if (audFmt === null) {audFmt = defaultAudFmt;} if (audFmt > 1) audFmt = 1; var autoKey = Actor.getArg(oArgs,'autoKey'); if (autoKey === null) {autoKey = defaultAutoKey;} if (autoKey > 1) autoKey = 1; var mbr = Actor.getArg(oArgs,'mbr'); if (mbr === null) {mbr = defaultMeterBitRate;} if (mbr > 1) mbr = 1; var iRCMode = (t<<24) | (sfe<<23) | (s8<<22) | (annex<<21) | (minQ<<16) | (audFmt<<15) | (autoKey<<14) | (mbr<<13) | (maxQ<<8) | rc; os.setiRCMode(iRCMode); var iqp = Actor.getArg(oArgs,'iqp'); if (iqp === null) {iqp = defaultFirstFrameQuality;} os.setIQP(iqp); } else { EspreLive.trace('Actor.playEx no output args specified'); } } else { debugger; // unable to open output stream } } else { EspreLive.trace('Actor.playEx_b no output stream specified'); } setTimeout(function() {that.playEx2(publishIt);},this.playExStepTicks); }; Actor.prototype.playEx2 = function(publishIt) { var that = this; var retry = true; var is = this.getInputStream(); if (is !== null) { if (is.isOpen()) { var os = this.getOutputStream(); if (os !== null) { if (os.isOpen()) { EspreLive.trace('Actor.playEx2 play'); this.play(); setTimeout(function() {that.playExInProgress = false;},this.playExStepTicks); if (publishIt) { EspreLive.trace('Actor.playEx2 publish'); setTimeout(function() {that.publishEx();},1100); } retry = false; } else { EspreLive.trace('Actor.playEx2 OUTPUT stream is NOT open -- retry'); } } else { debugger; // output stream is null } } else { EspreLive.trace('Actor.playEx2 INPUT stream is NOT open -- retry'); } } else { debugger; // input stream is null } if (retry) { setTimeout(function() {that.playEx2(publishIt);},this.playExStepTicks); } }; Actor.prototype.publishEx = function() { var that = this; if (!this.playExInProgress) { EspreLive.trace('Actor.publishEx publish'); this.publish(); } else { EspreLive.trace('Actor.publishEx retry'); setTimeout(function() {that.publishEx();},this.playExStepTicks); } }; Actor.prototype.stopEx = function() { this.unpublish(); this.stop(); this.closeInputStream(); // order sensitive. close input before output to block preview mode. this.closeOutputStream(); }; Actor.getArg = function(args,p) { var arg = null; if ((typeof args != 'undefined') && (args != null)) { var k = p + "="; var ps = args.split("&"); for (var i = 0; i < ps.length; i++) { if (ps[i].indexOf(k) === 0) { arg = ps[i].substring(k.length); break; } } } return arg; }; Actor.sessionStartTicks = (new Date()).getTime(); Actor.getTicks = function() { return (new Date()).getTime() - Actor.sessionStartTicks; }; var JSON = function () { var m = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' }, s = { 'boolean': function (x) { return String(x); }, number: function (x) { return isFinite(x) ? String(x) : 'null'; }, string: function (x) { if (/["\\\x00-\x1f]/.test(x)) { x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) { var c = m[b]; if (c) { return c; } c = b.charCodeAt(); return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); }); } return '"' + x + '"'; }, object: function (x) { if (x) { var a = [], b, f, i, l, v; if (x instanceof Array) { a[0] = '['; l = x.length; for (i = 0; i < l; i += 1) { v = x[i]; f = s[typeof v]; if (f) { v = f(v); if (typeof v == 'string') { if (b) { a[a.length] = ','; } a[a.length] = v; b = true; } } } a[a.length] = ']'; } else if (x instanceof Object) { a[0] = '{'; for (i in x) { v = x[i]; f = s[typeof v]; if (f) { v = f(v); if (typeof v == 'string') { if (b) { a[a.length] = ','; } a.push(s.string(i), ':', v); b = true; } } } a[a.length] = '}'; } else { return; } return a.join(''); } return 'null'; } }; return { copyright: '(c)2005 JSON.org', license: 'http://www.JSON.org/license.html', /* Stringify a JavaScript value, producing a JSON text. */ stringify: function (v) { var f = s[typeof v]; if (f) { v = f(v); if (typeof v == 'string') { return v; } } return null; }, /* Parse a JSON text, producing a JavaScript value. It returns false if there is a syntax error. */ parse: function (text) { try { return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')'); } catch (e) { meLogger.write("JSON.parse EXCEPTION: " + e.message, 3); //alert("JSON.parse EXCEPTION: " + e.message); return false; } } }; }(); if(!ErrorCode){ var ErrorCode = new Object(); var INFO = 0; var WARN = 1; var ERROR = 2; } var MS_ERROR_CODE_BASE = 1; var SA_ERROR_CODE_BASE = 500; var RTP_ERRORCODE_START = 2000; var LS_ERROR_CODE_BASE = 1000; var AVI_ERRORCODE_START = 3000; var AV_ERROR_CODE_BASE = 4000; if (!JErrorCodes) { // the following group is for MediaStream type of error. var JErrorCodes = { 'NO_ERROR': 0, 'MS_ERROR_DUPLICATED_ID': MS_ERROR_CODE_BASE, 'MS_ERROR_DUPLICATED_NAME': MS_ERROR_CODE_BASE + 2, 'MS_ACTOR_NOT_FOUND': MS_ERROR_CODE_BASE + 3, 'MS_STREAM_NOT_FOUND': MS_ERROR_CODE_BASE + 4, 'MS_NO_OR_INCOMPATIBLE_STREAM': MS_ERROR_CODE_BASE + 5, 'MS_UNSUPPORTED_STREAM_ASSIGNMENT': MS_ERROR_CODE_BASE + 6, 'MS_ACTOR_UNDEFINED': MS_ERROR_CODE_BASE + 7, 'MS_NO_STREAM_ASSIGNED': MS_ERROR_CODE_BASE + 8, 'MS_NOT_ASSIGNED_STREAM': MS_ERROR_CODE_BASE + 9, 'MS_COMMAND_TIMEOUT': MS_ERROR_CODE_BASE + 10, // the following group is for StreamActor type of error. 'SA_ERROR_DUPLICATE_NAME': SA_ERROR_CODE_BASE, 'SA_ERROR_MAX_ACTOR_REACHED': SA_ERROR_CODE_BASE + 1, 'SA_ERROR_COLOR_STRING_FORMAT': SA_ERROR_CODE_BASE + 2, // the following group is for LSVXStream type of error. 'LS_ERROR_MALFORM_URL': LS_ERROR_CODE_BASE, 'LS_ERROR_INTERNAL': LS_ERROR_CODE_BASE + 1, 'LS_ERROR_CONTEXT_HAS_NO_VIEW': LS_ERROR_CODE_BASE + 2, 'LS_ERROR_STEAM_PLAYING_STATE_NOT_CHANGE': LS_ERROR_CODE_BASE + 3, 'LS_ERROR_PARAM_NAME_NULL': LS_ERROR_CODE_BASE + 4, 'LS_ERROR_STREAM_HAS_NO_NAME': LS_ERROR_CODE_BASE + 5, 'LS_ERROR_INVALID_CACHE_SIZE': LS_ERROR_CODE_BASE + 6, 'LS_ERROR_STREAM_NOT_PAUSED': LS_ERROR_CODE_BASE + 7, 'LS_ERROR_STREAM_NOT_BUFFERED': LS_ERROR_CODE_BASE + 8, 'LS_ERROR_STREAM_PLAYING': LS_ERROR_CODE_BASE + 9, 'LS_ERROR_STREAM_ALREADY_BUFFERED': LS_ERROR_CODE_BASE + 10, 'RTP_OPEN_FAILED_CONN_EXISTS': RTP_ERRORCODE_START + 2, 'RTP_OPEN_FAILED': RTP_ERRORCODE_START + 3, 'RTP_OPEN_TIMEDOUT': RTP_ERRORCODE_START + 4, 'RTP_NO_SERVER_CONNECTION': RTP_ERRORCODE_START + 5, 'RTP_MULTICASE_CHANNEL_OPEN_FAILED': RTP_ERRORCODE_START + 6, 'RTP_MULTICASE_CHANNEL_CLOSE_FAILED': RTP_ERRORCODE_START + 7, 'RTP_FAILED_TO_SET_WINHANDLE': RTP_ERRORCODE_START + 8, 'RTP_FAILED_TO_PLAY': RTP_ERRORCODE_START + 9, 'RTP_RTP_PORT_UNDEFINED': RTP_ERRORCODE_START + 10, 'AVI_ILLEGAL_SESSION': AVI_ERRORCODE_START + 2, 'AVI_DIRECTX_FAILURE': AVI_ERRORCODE_START + 3, 'AVI_RESOURCE_ERR': AVI_ERRORCODE_START + 4, 'AVI_FAIL_UNKNOWN': AVI_ERRORCODE_START + 5, 'AVI_ACTOR_UNDEFINED': AVI_ERRORCODE_START + 6, 'AVI_OPENED_FILE_EXISTS': AVI_ERRORCODE_START + 7, 'AVI_OPERATION_ERROR': AVI_ERRORCODE_START + 8, 'AVI_SESSION_NOT_EXISTS': AVI_ERRORCODE_START + 9, 'AVI_CANNOT_DETERMINE_CURFRAMENUM ': AVI_ERRORCODE_START + 10, 'AVI_NO_FILENAME_SPECIFIED ': AVI_ERRORCODE_START + 11, 'AVI_INVALID_FILENAME_SPECIFIED ': AVI_ERRORCODE_START + 12, 'AV_COMMAND_FAILED': AV_ERROR_CODE_BASE, 'AV_AUDIODEVICE_NOT_PRESENT': AV_ERROR_CODE_BASE + 1, 'AV_VIDEODEVICE_NOT_PRESENT': AV_ERROR_CODE_BASE + 2, 'AV_VIDEODEVICE_NOT_SUPPORTED': AV_ERROR_CODE_BASE + 3, 'AV_AUDIODEVICE_NOT_SUPPORTED': AV_ERROR_CODE_BASE + 4, 'AV_VIDEODEVICE_NOT_SELECTED': AV_ERROR_CODE_BASE + 5, 'AV_AUDIODEVICE_NOT_SELECTED': AV_ERROR_CODE_BASE + 6 }; } if (!JSErrorCodes) { var JSErrorCodes = { 'NO_ERROR': 'NO ERROR', // the following group is for MediaStream type of error. 'MS_ACTOR_NOT_FOUND': 'ACTOR NOT FOUND', 'MS_STREAM_NOT_FOUND': 'STREAM NOT FOUND', 'MS_NO_OR_INCOMPATIBLE_STREAM': 'INCOMPATIBLE OR NO STREAM', 'MS_UNSUPPORTED_STREAM_ASSIGNMENT': 'UNSUPPORTED STREAM ASSIGNMENT', 'MS_ACTOR_UNDEFINED': ' UNDEFINED ACTOR', 'MS_NO_STREAM_ASSIGNED': 'NO STREAM ASSIGNED', 'MS_NOT_ASSIGNED_STREAM': 'STREAM NOT ASSIGNED', 'MS_COMMAND_TIMEOUT': 'COMMAND TIMEOUT', // the following group is for StreamActor type of error. 'SA_ERROR_DUPLICATE_NAME': 'SA ERROR DUPLICATE NAME', 'SA_ERROR_MAX_ACTOR_REACHED': 'MAXIMUM NUMBER OF ACTOR REACHED', 'SA_ERROR_COLOR_STRING_FORMAT': 'ERROR WITH COLOR STRING FORMAT', // the following group is for LSVXStream type of error. 'LS_ERROR_MALFORM_URL': 'LS ERROR MALFORM URL', 'LS_ERROR_INTERNAL': 'LS INTERNAL ERROR', 'LS_ERROR_CONTEXT_HAS_NO_VIEW': 'LS ERROR CONTEXT HAS NO VIEW', 'LS_ERROR_STEAM_PLAYING_STATE_NOT_CHANGE': 'LS ERROR STREAM PLAYING STATE NOT CHANGE', 'LS_ERROR_PARAM_NAME_NULL': 'LS ERROR PARAM NAME NULL', 'LS_ERROR_STREAM_HAS_NO_NAME': 'LS ERROR STREAM HAS NO NAME', 'LS_ERROR_INVALID_CACHE_SIZE': 'LS ERROR INVALID CACHE SIZE', 'LS_ERROR_STREAM_NOT_PAUSED': 'LS ERROR STREAM NOT PAUSED', 'LS_ERROR_STREAM_NOT_BUFFERED': 'LS ERROR STREAM NOT BUFFERED', 'LS_ERROR_STREAM_PLAYING': 'LS ERROR STREAM PLAYING', 'LS_ERROR_STREAM_ALREADY_BUFFERED': 'LS ERROR STREAM ALREADY BUFFERED', // the following group is for RTPStream type of errors. 'RTP_OPEN_SUCCESS': 'RTP OPEN SUCCESS', 'RTP_OPEN_FAILED_CONN_EXISTS': 'RTP OPEN FAILED CONN EXISTS', 'RTP_OPEN_FAILED': 'RTP OPEN FAILED ', 'RTP_OPEN_TIMEDOUT': 'RTP OPEN TIMEDOUT ', 'RTP_NO_SERVER_CONNECTION': 'RTP NO SERVER CONNECTION', 'RTP_MULTICASE_CHANNEL_OPEN_FAILED': 'RTP MULTICASE CHANNEL OPEN FAILED', 'RTP_MULTICASE_CHANNEL_CLOSE_FAILED': 'RTP MULTICASE CHANNEL CLOSE FAILED', 'RTP_FAILED_TO_SET_WINHANDLE': 'RTP FAILED TO SET WINHANDLE', 'RTP_FAILED_TO_PLAY': 'RTP FAILED TO PLAY ', 'RTP_RTP_PORT_UNDEFINED': 'RTP RTP PORT UNDEFINED ', // the following group is for AVIStream type of errors 'AVI_ILLEGAL_SESSION': 'AVI ILLEGAL SESSION ', 'AVI_DIRECTX_FAILURE': 'AVI DIRECTX FAILURE ', 'AVI_RESOURCE_ERR': 'AVI RESOURCE ERR ', 'AVI_FAIL_UNKNOWN': 'AVI FAIL UNKNOWN ', 'AVI_ACTOR_UNDEFINED': 'AVI ACTOR UNDEFINED ', 'AVI_OPENED_FILE_EXISTS': 'AVI OPENED FILE EXISTS ', 'AVI_OPERATION_ERROR': 'AVI OPERATION ERROR ', 'AVI_SESSION_NOT_EXISTS': 'AVI SESSION NOT EXISTS ', 'AVI_CANNOT_DETERMINE_CURFRAMENUM': 'AVI CANNOT DETERMINE CURFRAMENUM ', 'AVI_NO_FILENAME_SPECIFIED': 'AVI NO FILENAME SPECIFIED ', 'AVI_INVALID_FILENAME_SPECIFIED': 'AVI INVALID FILENAME SPECIFIED ', // the following group is for AVDeviceStream type of error. 'AV_COMMAND_FAILED': ' COMMAND FAILED', 'AV_AUDIODEVICE_NOT_PRESENT': 'AUDIO DEVICE NOT PRESENT', 'AV_VIDEODEVICE_NOT_PRESENT': 'VIDEO DEVICE NOT PRESENT', 'AV_VIDEODEVICE_NOT_SUPPORTED': 'VIDEO DEVICE NOT SUPPORTED', 'AV_AUDIODEVICE_NOT_SUPPORTED': 'AUDIO DEVICE NOT SUPPORTED', 'AV_VIDEODEVICE_NOT_SELECTED': 'VIDEO DEVICE NOT SELECTED', 'AV_AUDIODEVICE_NOT_SELECTED': 'AUDIO DEVICE NOT SELECTED' }; } ErrorCode.log = function (_callingMethod, errorCd,level){ var found = false; var key = null; for (i in JErrorCodes) { if (JErrorCodes[i] == errorCd) { found = true; key = i; break; } } if(found){ if('undefined' != typeof loggerJObject && loggerJObject != null){ if(arguments.length > 2){ if(level == ERROR){ loggerJObject.error(_callingMethod + "..." + JSErrorCodes[key]); } else if(level == WARN){ loggerJObject.warn(_callingMethod + "..." + JSErrorCodes[key]); } else { loggerJObject.info(_callingMethod + "..." + JSErrorCodes[key]); } return; } else { loggerJObject.info(_callingMethod + "..." + JSErrorCodes[key]); return; } } loggerJObject.info(_callingMethod + "..." + JSErrorCodes[key]); } } ErrorCode.logError = ErrorCode.log; function HttpRequest () { var client; var requestCallback = null; var queryAction; var loggerJObject = null; //Logger Java Object var JSInterfaceObject = JSInterface.theInstance(); JSInterfaceObject.getLogger("HTTPRequest",callbackForHTTPRequestLogger);//Call to Java Script Interface Object for HTTPRequest Logger function callbackForHTTPRequestLogger(loggerObject) { loggerJObject = loggerObject; } this.dojoUtility = new DojoUtility(); this.sendRequest = function () { if (arguments.length == 5) { var type = arguments[0]; var url = arguments[1]; var param = arguments[2]; var isAsync = arguments[3]; requestCallback = arguments[4]; } else if (arguments.length == 6) { var type = arguments[0]; var url = arguments[1]; var param = arguments[2]; var isAsync = arguments[3]; requestCallback = arguments[4]; queryAction = arguments[5]; } else { return false; } this.dojoUtility.setMethod(type); this.dojoUtility.setSync(isAsync); this.dojoUtility.setLoad(responseFromServer); this.dojoUtility.setError(errorFromServer); this.dojoUtility.setTimeoutFun(timeoutFromServer); this.dojoUtility.setMimeType("text/plain"); this.dojoUtility.setContentType("application/x-www-form-urlencoded"); if (type == "GET") { var qs = param.join('&'); if (qs.length > 0) { url += "?" + qs; } this.dojoUtility.setUrl(url); } else { this.dojoUtility.setUrl(url); this.dojoUtility.setContent(param.join(',')); } this.dojoUtility.sendRequest(); } function responseFromServer(type,serverdata,event) { var data = null; var response = null; if (queryAction == "getDefaultFile") { response = serverdata; } else if ((queryAction == "sendAndRegister") || (queryAction == "sendAndLookUp") || (queryAction == "sendAndDelete")) { response = JSON.parse(serverdata); } else { data = JSON.parse(serverdata); if (data !== false) { if (((data['ACTIONSTATUS'] == 'true') ||(data['ACTIONSTATUS'] == true)) && (data['REQUESTDATA'].action == "upload")) { response = data['ACTIONSTATUS']; } else if (((data['ACTIONSTATUS'] == 'true') ||(data['ACTIONSTATUS'] == true))&& (data['RESPONSEDATA'] != "") && (data['RESPONSEDATA'] != null)) { response = data['RESPONSEDATA']; } else if (((data['ACTIONSTATUS'] == 'true') ||(data['ACTIONSTATUS'] == true))&& ((data['RESPONSEDATA'] == "") || (data['RESPONSEDATA'] == null))) { response = data['ACTIONSTATUS']; } else if (((data['ACTIONSTATUS'] == 'false') ||(data['ACTIONSTATUS'] == false))&& (data['ERROR'])) { response = data['ERROR'].ExceptionMsg; } else if (((data['ACTIONSTATUS'] == 'false') ||(data['ACTIONSTATUS'] == false))&& (data['Error'])) { response = data['Error'].ExceptionMsg; } } else if (data === false) { // If JSON.parse returns false. //meLogger.write("Unrecognizable Error from Server", 3); loggerJObject.info("Unrecognizable Error from Server-JSON.parse() Error"); } } if(response === null) { loggerJObject.info("NULL RESPONSE from Server"); } else { loggerJObject.info("RESPONSE from Server : "+response); } if(requestCallback !== null) { requestCallback(response); } } function errorFromServer(type,Error,event) { //meLogger.write("Error from Server: "+Error, 3); //alert("System Error : "+ Error); loggerJObject.info("HTTP Request Server System Error"); } function timeoutFromServer() { //meLogger.write("Request TimedOut", 3); loggerJObject.info("HTTP Request Timedout"); //alert("Request TimedOut"); } this.isValidURL = function (urlIn) { var urlregex = /https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?/; //var checkSpace = urlIn.value; if (urlregex.test(urlIn)) { for (var i = 0; i < urlIn.length; i++) { ch = urlIn.charAt(i); if (ch == " ") { return (false); break; } } return (true); } else { return (false); } } } function AppletSpec(appletType) { var that = this; this.PMgr = ParameterManager; // From ParameterManager.js (JavaScript file) this.PMgr("applet"); var componentFactory = new ComponentFactory(); var type = appletType; this.setParameter("type",type); if (appletType != "undefined" || appletType !== "") { //AppletFactory for getting Parameter Information for Ecoder and Upload Applets //An Array of Applet Information (Encoder, Capture, and Upload Applets) var appletInfo = componentFactory.getAppletInformation(appletType); } if (!appletInfo) { appletInfo = new Array(); appletInfo['code'] = ''; appletInfo['archive'] = ''; } appletInfo['codebase'] = componentFactory.codebase; if (appletInfo['package_spec']) { this.setParameter("user","PACKAGE_SPEC",appletInfo['package_spec']); } if("undefined" == typeof appletInfo['cache_version']){ appletInfo['cache_version'] = ''; } this.setParameter("objectclassid","clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"); this.setParameter("objectcodebase", "http://java.sun.com/update/1.5.0/jinstall-1_5_0_11-windows-i586.cab"); this.setParameter("name", ""); this.setParameter("code", appletInfo['code'] !== '' ? appletInfo['code'] : ''); this.setParameter("codebase", appletInfo['codebase'] !== '' ? appletInfo['codebase'] : ''); this.setParameter("cache_archive", appletInfo['cache_archive'] !== '' ? appletInfo['cache_archive'] : ''); this.setParameter("cache_version", appletInfo['cache_version'] !== '' ? appletInfo['cache_version'] : ''); this.setParameter("width", "1"); this.setParameter("height", "1"); this.setParameter("hspace", ""); this.setParameter("vspace", ""); this.setParameter("align", ""); //this.setParameter("embedtype", "application/x-java-applet:;version=1.4"); // ** TO BE RESOLVED: NOT WORKING IN FOREFOX ** this.setParameter("embedtype", "application/x-java-applet;version=1.5"); this.setParameter("embedpluginspage", "http://www.java.com"); this.setParameter("scriptable", "true"); this.setParameter("mayscript", "true"); this.setParameter("visible", "true"); this.setParameter("embedApplet", "false"); this.setParameter("style", ""); this.setParameter("user", "boxfgcolor", ""); this.setParameter("user", "boxbgcolor", ""); this.setParameter("user", "image", ""); this.startApplet = function (target) { var tmpStr=""; tmpStr = this.appletToString(); if(tmpStr !== ""){ this.write(tmpStr, target); } else{ //alert("StartApplet tags empty"); }; }; this.startAppletWithAppletTag = function (target) { var tmpStr=""; tmpStr = this.appletTagOnlyToString(); if(tmpStr !== ""){ this.write(tmpStr, target); } else { //alert("StartAppletWithAppletTag tags empty"); }; }; this.addParameter = function (name, value) { switch (name.toUpperCase()) { case "NAME": return false; break; case "ID": return false; break; default: break; }; this.setParameter("user",name, value); return true; }; this.getUserParameters = function (type) { var tmpStr=""; var params = this.getActiveParameters("user"); var i; switch(type) { case "OBJECT": for(i = 0;i < params.length;i++) { tmpStr += '\n'; } break; case "EMBED": for(i = 0;i < params.length;i++) { tmpStr += params[i] + ' = \"' + this.getParameter("user",params[i]) + '\"\n'; } break; case "APPLET": for(i = 0;i < params.length;i++) { tmpStr += '\n'; } break; default: break; } return tmpStr; }; this.write = function (strhtml, tagid) { var htmlElement; //alert("AppletSpec.write : strhtml " + strhtml + " tagid " + tagid); var docwindow = this.getProperty("util","dom","window"); if (docwindow.document.layers && (docwindow.document.layers[tagid].document !== null)) { htmlElement = docwindow.document.layers[tagid].document; htmlElement.open(); htmlElement.write(strhtml); htmlElement.close(); } else if (docwindow.document.all && (docwindow.document.all(tagid) !== null)) { htmlElement = docwindow.document.all(tagid); htmlElement.innerHTML = strhtml; } else if (docwindow.document.documentElement && (docwindow.document.getElementById(tagid) !== null)) { htmlElement = docwindow.document.getElementById(tagid); htmlElement.innerHTML = strhtml; } }; this.appletToString = function () { var tmpStr = ""; //added Object ID var objid = this.getUniqueElementID(); var embedid = this.getUniqueElementID(); tmpStr = '\n'; if(this.getParameter("applet","cache_version") !== null && this.getParameter("applet","cache_version") !== ''){ tmpStr += '\n'; tmpStr += '\n'; } else{ tmpStr += '\n'; } tmpStr += '\n'; tmpStr += '\n'; if (this.getParameter("applet", "codebase") !== "") { tmpStr += '\n'; } tmpStr += '\n'; //added eval_start_exit for OBJECT tmpStr += '\n'; tmpStr += this.getUserParameters("OBJECT"); tmpStr += '\n'; tmpStr += '\n'; tmpStr += '\n'; //added eval_start_exit for APPLET tmpStr += '\n'; tmpStr += '> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); c = md5_ff(c, d, a, b, x[i+10], 17, -42063); b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } return Array(a, b, c, d); } /* * These functions implement the four basic operations the algorithm uses. */ function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); } function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); } function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); } function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); } function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); } /* * Calculate the HMAC-MD5, of a key and some data */ function core_hmac_md5(key, data) { var bkey = str2binl(key); if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); return core_md5(opad.concat(hash), 512 + 128); } /* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } /* * Bitwise rotate a 32-bit number to the left. */ function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } /* * Convert a string to an array of little-endian words * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. */ function str2binl(str) { var bin = Array(); var mask = (1 << chrsz) - 1; for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); return bin; } /* * Convert an array of little-endian words to a string */ function binl2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); return str; } /* * Convert an array of little-endian words to a hex string. */ function binl2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); } return str; } /* * Convert an array of little-endian words to a base-64 string */ function binl2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } } return str; } function _EspreLive() { if("undefined" == typeof _EspreLive.instance) { _EspreLive.instance = this; // define the singleton } if(this != _EspreLive.instance) return _EspreLive.instance; var that = this; this.Event = EventManager; this.Event(); this.state = 'none'; //this.numofcallback = 0; // TODO: GLM back out jun changes this.hack = function () { callback(); } function callback() { /* TODO: GLM back out jun changes if (that.numofcallback > 0) { return; } that.numofcallback = 1; */ that.state = 'ready'; that.handleEvent("src=EspreLive&type=onload"); for (var i = 0;i < EspreLive.loadevents.length;i++) { that.handleEvent("src=EspreLive&type=" + EspreLive.loadevents[i]); } } function init() { if(!JSInterface) { setTimeout(init,50); } else { JSInterface.theInstance().getLiveService(callback); } } init(); } _EspreLive.Instance = null; _EspreLive.theInstance = function(){ if (_EspreLive.Instance == null){ _EspreLive.Instance = new _EspreLive(); } return _EspreLive.Instance; } function EspreLive() {}; EspreLive.loadevents = []; EspreLive.addEventListener = function(evt,func) { EspreLive.loadevents[EspreLive.loadevents.length] = evt; _EspreLive.theInstance().addEventListener(evt,func,true,window) };