EVME_HOSTING_PATH = "http://www.esprelive.com/sales/eagle/evme2.3.0/hosting/"; EVME_XSL_PATH = "http://www.esprelive.com/sales/eagle/evme2.3.0/mediaengine/"; EVME_HOST_DOMAIN = "www.esprelive.com"; EVME_CHAT_PATH = "http://esprelive.com/sales/parrot/evme2.2.4/chat/ChannelManager.php"; EVME_VXN_ADDR = "67.19.80.130"; EVME_VXN_PORT = "443"; //Actor.sdlPathType = "absolute"; function ComponentFactory(){ this.codebase = "http://www.esprelive.com/sales/eagle/evme2.3.0/mediaengine/components/"; var componentdata = eval({"components":{"encoder":{"code":"es.me.driver.encoder.AppletEncoder","cache_archive":"evpa_signed.jar,evmResources.jar,eVChat.jar,commons-codec-1.2.jar,commons-httpclient-3.0.1.jar,commons-logging-api-1.1.jar,json-2.0.jar,me-common_signed.jar,me-driver_signed.jar,messaging_signed.jar,me-core_signed.jar,evme-installer_signed.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0","package_spec":""},"capture":{"code":"es.me.driver.capture.AppletCapture","cache_archive":"evpa_signed.jar,evmResources.jar,eVChat.jar,commons-codec-1.2.jar,commons-httpclient-3.0.1.jar,commons-logging-api-1.1.jar,json-2.0.jar,me-common_signed.jar,me-driver_signed.jar,messaging_signed.jar,me-core_signed.jar,evme-installer_signed.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0","package_spec":""},"uploader":{"code":"es.me.driver.upload.AppletUpload","cache_archive":"evpa_signed.jar,evmResources.jar,eVChat.jar,commons-codec-1.2.jar,commons-httpclient-3.0.1.jar,commons-logging-api-1.1.jar,json-2.0.jar,me-common_signed.jar,me-driver_signed.jar,messaging_signed.jar,me-core_signed.jar,evme-installer_signed.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0"},"director":{"code":"es.theater.ClipContextApplet","cache_archive":"evpa_signed.jar,evmResources.jar,eVChat.jar,commons-codec-1.2.jar,commons-httpclient-3.0.1.jar,commons-logging-api-1.1.jar,json-2.0.jar,me-common_signed.jar,me-driver_signed.jar,messaging_signed.jar,me-core_signed.jar,evme-installer_signed.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0"},"actor":{"code":"es.theater.ClipActorApplet","cache_archive":"evpa_signed.jar,evmResources.jar,eVChat.jar,commons-codec-1.2.jar,commons-httpclient-3.0.1.jar,commons-logging-api-1.1.jar,json-2.0.jar,me-common_signed.jar,me-driver_signed.jar,messaging_signed.jar,me-core_signed.jar,evme-installer_signed.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0"},"sdlWriter":{"code":"es.theater.ClipContextApplet","cache_archive":"evpa_signed.jar,evmResources.jar,eVChat.jar,commons-codec-1.2.jar,commons-httpclient-3.0.1.jar,commons-logging-api-1.1.jar,json-2.0.jar,me-common_signed.jar,me-driver_signed.jar,messaging_signed.jar,me-core_signed.jar,evme-installer_signed.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0"},"clipViewer":{"cache_archive":"evpa.jar,me-common.jar,evmResources.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0"},"clipViewerSigned":{"cache_archive":"evpa_signed.jar,me-common_signed.jar,evmResources.jar,eVChat.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0"},"fileUtil":{"code":"es.me.espre.util.FileUtilityApplet","cache_archive":"me-fso_signed.jar,messaging_signed.jar,me-common_signed.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0"},"evcInstaller":{"code":"es.installer.AppletUpgrade","cache_archive":"EvcInstaller.jar","\/\/cache_version":"1.0.0.0","package_spec":"conf\/EVC\/"},"evChat":{"code":"espre.eVChat.JChatApplet","cache_archive":"evpa_signed.jar,evmResources.jar,eVChat.jar,commons-codec-1.2.jar,commons-httpclient-3.0.1.jar,commons-logging-api-1.1.jar,json-2.0.jar,me-common_signed.jar,me-driver_signed.jar,messaging_signed.jar,me-core_signed.jar,evme-installer_signed.jar","\/\/cache_version":"1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0,1.0.0.0","package_spec":"conf\/EVC\/"}}}); this.getAppletInformation = function (appletType) { if (componentdata['components'][appletType] != "" || componentdata['components'][appletType] != "undefined") { return componentdata['components'][appletType]; } else { return false; } } } // $Id$ function EncodeRequest() { var that = this; //Let the private functions access the object instance. //acquire ParameterManager capabilities this.PMgr = ParameterManager; this.PMgr("general"); var encoder = Encoder.theInstance(); // get the singleton. var requestState = "idle"; // use this to track the request // states are: idle, encoding, completed, errored, cancelled this.integerStringValidator = function (group, name, _value) { //meLogger.write('Integer String Validator Called', 1); if(isNaN(parseInt(_value)))return false; return true; } // define the progress parameters this.defineParameter("general","xmlFile"); this.defineParameter("general","sdlFile"); this.defineParameter("general","videoProgress","defaultValue","0","validator",this.integerStringValidator); this.defineParameter("general","audioProgress","defaultValue","0","validator",this.integerStringValidator); //API functions this.startEncode = function(){ if(requestState == "encoding") return false; var _xmlFile = this.getParameter('xmlFile'); var _sdlFile = this.getParameter('sdlFile'); if((_xmlFile === null) || (_sdlFile === null)) return false; // must have an xml file. _xmlFile = _xmlFile.replace(/\\/g, "/"); _sdlFile = _sdlFile.replace(/\\/g, "/"); this.setParameter("general","xmlFile",_xmlFile); this.setParameter("general","sdlFile",_sdlFile); meLogger.write(_xmlFile, 2); var result = encoder.startEncode(this); if(result == true){ setRequestState("encoding"); } else{ setRequestState("errored"); this.setParameter("errors","Encoder busy with another request"); } return result; // true indicates that the request has been posted } this.start = this.startEncode; this.cancelEncode = function(){ if(requestState == "encoding") encoder.cancelEncode(this); setRequestState("cancelled") return; } this.cancel = this.cancelEncode; this.getProgress = function(){ if(requestState == "encoding") { return (this.getParameter("videoProgress") + this.getParameter("audioProgress"))/2; } if(requestState == "completed") return 100; return 0; } this.getVideoProgress = function(){ if(requestState == "encoding") return this.getParameter("videoProgress"); if(requestState == "completed") return 100; return 0; } this.getAudioProgress = function(){ if(requestState == "encoding") return this.getParameter("audioProgress"); if(requestState == "completed") return 100; return 0; } this.getErrors = function(){ if(requestState == "errored") return this.getParameter("errors"); return ""; } this.isCompleted = function(){ if(requestState == "completed" || requestState == "cancelled") return true; return false; } this.isEncoding = function(){ if(requestState == "encoding") return true; return false; } this.isError = function(){ if(requestState == "errored") return true; return false; } this.getState = function(){ return requestState; } // Private functions function setRequestState(_state){ var oldState = requestState; if (_state != requestState){ requestState = _state; meLogger.write('EncodeRequest: '+ oldState + ' -> ' + requestState); } } // add public callback functions for status, progress, etc. this.updateVideoProgress = function(_value) { this.setParameter("videoProgress",_value); } this.updateAudioProgress = function(_value) { this.setParameter("audioProgress",_value); } this.updateState = function(_state){ if(_state == "initializing" || _state == "ready") return; if(_state == "errored"){ this.setParameter("errors",encoder.getErrors()); meLogger.write(encoder.getErrors(), 3); } setRequestState(_state); } } function Clip(_name, _file, _ctx) { var that = this; // acquire parametermanager this.PMgr = ParameterManager; this.PMgr("general"); // if (typeof Clip.counter == 'undefined') { // Clip.counter = 1; // } var order = 0; // should be updated when added to a collection var container = _ctx; this.setOrder = setOrder; this.getOrder = getOrder; this.equals = equals; this.getContainer = getContainer; this.prepare4Encoding = prepare4Encoding; this.revertFromEncoding = revertFromEncoding; function getContainer(){ return container; } this.remove = function() { if((container)&&(ControlData == container.constructor)) { return container.removeClip(this); } return false; }; this.rename = function(_name) { var oldName = this.getParameter('general','name'); this.setParameter('general','name',_name); container.update('renameClip',oldName,_name); }; this.changeFile = function(_value){ this.setParameter('general','file',_value); }; this.fileValidator = function(_group,_name,_value) { if(_value.indexOf('.avi') > 0){ if(container.getClipByFile(_value)) { var ex = new MeException('File =>' + _value + '<= is already associated with another clip.'); throw ex; } else { meLogger.write('valid file name used.=> ' + _value, 1); return true; } } else { meLogger.write(_value + ' is not a valid file name. Name = '+_name + ' Group='+ _group, 2); throw new MeException('File =>' + _value + '<= is not a valid file name.'); } return false; }; this.nameValidator = function (group, _name, _value) { meLogger.write('Name Validator Called on ' + _value, 1); if(_value === null || _value === ""){ //return false; var ex = new MeException('Clip => '+ _value + '<= is not a valid clip name'); throw ex; } if(container){ if(ControlData == container.constructor) { if(container.getClip(_value)) { throw new MeException('Clip =>' + _value + '<= already exists'); } } else { return false; } meLogger.write('Valid clip name is used=>' + _value, 2); return true; } throw new MeException('name can not be validated. '); }; /** * X.equals(y) = 1 if x > y, -1 if X < Y and 0 if x = y **/ function equals(anotherClip) { if (anotherClip instanceof Clip) { if(order > anotherClip.getOrder()){ return 1; } if(order < anotherClip.getOrder()){ return -1; } if(order == anotherClip.getOrder()){ return 0; } } throw new MeException("Could not compare Clips."); } function setOrder(_order) { order = _order; } function getOrder() { return order; } function prepare4Encoding(_base){ meLogger.write('updating clip information.'); var success = true; //assume success // delete any existing artifacts deleteFile(toPath(_base,'video_s' + this.getOrder() + '.dat'),true); deleteFile(toPath(_base,'video_s' + this.getOrder() + '.idx'),true); deleteFile(toPath(_base,'audio_s' + this.getOrder() + '.dat'),true); deleteFile(toPath(_base,'audio_s' + this.getOrder() + '.idx'),true); if(!success) return false; //Unable to delete sdl file this.setParameter('video','dataOut', toPath(_base,'video_s'+ this.getOrder() + '.dat')); this.setParameter('video','indexOut', toPath(_base,'video_s'+ this.getOrder() + '.idx')); this.setParameter('audio','dataOut', toPath(_base,'audio_s'+ this.getOrder() + '.dat')); this.setParameter('audio','indexOut', toPath(_base,'audio_s'+ this.getOrder() + '.idx')); return success; } function revertFromEncoding(){ try{ this.removeParameter('video','dataOut'); this.removeParameter('video','indexOut'); this.removeParameter('audio','dataOut'); this.removeParameter('audio','indexOut'); } catch(e) { alert("Clip.revertFromEncoding EXCEPTION: " + e.message); meLogger.write(e.name + ':- ' + e.message); } } function init(){ if((container)&&(ControlData == container.constructor)) { if(container.getClipByFile(_file)) { var ex = new MeException('File =>' + _file + '<= already associated with another clip in this project.'); throw ex; } if(container.getClip(_name)) { throw new MeException('Clip =>' + _name + '<= already exists'); } else { that.setProperty('general', 'name', 'validator', that.nameValidator,container); that.setProperty('general', 'file', 'validator', that.fileValidator,container); that.setParameter('general','name', _name); that.setParameter('general','file', _file); //order = Clip.counter++; //return; } } else { throw new MeException('Error initializing Clip object.'); } } this.createDocumentFragment = function (xmlDocument) { xmlDocument = xmlDocument || xutil.getDomDocument(); var fragment = xmlDocument.createDocumentFragment(); var node = xmlDocument.createElement('subclip'); node.appendChild(this._createDocumentFragment(xmlDocument)); fragment.appendChild(node); return fragment; }; this.toXML = null; this.toXML = function (xmlDocument) { xmlDocument = xmlDocument || xutil.getDomDocument(); var xmlString = xutil.serializeToString(this.createDocumentFragment(xmlDocument)); return xmlString; }; this.getSDL = function(_base){ return toPath(_base,'video_s'+ this.getOrder() + '.dat.sdl'); //assumes this is the first clip in the sequence }; init(); } // supporting classes /** * **/ function ClipCollection(){ this.Col = MeCollection; this.Col(); this.add=function(obj) { this.push(obj); obj.setOrder(this.length); }; // the purpose of this method is to adjust the order of each clip after a clip deletion this.adjustOrder = function(){ for (var i = 0; i < this.length; i++) { (this[i]).setOrder(i+1); } }; } /* 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.*"); // $Id: ParameterMap.js 50 2007-01-24 21:47:47Z plin $ 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; } 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; } var meInitialized = false; var meInitInProgress = false; var jds = null; function meInit() { var status = false; if (true) // (!meInitInProgress) { meInitInProgress = true; if (!meInitialized) { if (!dr || (dr === null)) { dr = jDirectorInit(); } //alert('meSupport.meInit actorInstanceCtr: ' + actorInstanceCtr); var i; for (i = 1; i <= actorInstanceCtr; i++) { //debugger; var anActor = actorInstanceMap[i]; if (anActor.isDeferred()) { setTimeout('meInit()',1000); return; } anActor.init(); } if (jds === null) { //if (document.getElementById('director') == null) //{ //alert('meSupport.meInit DIRECTOR DIV NOT FOUND'); //} jds = jDirStart(dr,'director'); } if (!clipDirector || (clipDirector === null)) { // COMMENTED OUT BY DON SMITH -- Replacing with callback from AppletManager //setClipDirector(dr.getInstance()); } nbrOfContexts = contextIdx; if (ctxReady === null) ctxReady = new Object(); if (ctxPlaying === null) ctxPlaying = new Object(); waitForClipDirectorInitialized(); for (i = 1; i <= contextIdx; i++) { ctxReady[i] = false; ctxPlaying[i] = contextDefinitionMap[i].getClipDescriptor().getAutoplay(); } meInitialized = true; status = true; } meInitInProgress = false; } return status; } 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(); this.registerChannels = function(name){ var response = HTTPRequestObj.sendRequest("GET", url, Array("name=" + name, "mode=sendAndRegister","docbase=" + docbase), false); if (response != "" && response != null) { return JSON.parse(response); } else { return null; } } this.lookupChannels = function(name){ var response = HTTPRequestObj.sendRequest("GET", url, Array("name=" + name, "mode=sendAndLookUp","docbase=" + docbase), false); if (response != "" && response != null) { return JSON.parse(response); } else { return null; } } this.deregisterChannels = function(name){ var response = HTTPRequestObj.sendRequest("GET", url, Array("name=" + name, "mode=sendAndDelete","docbase=" + docbase), false); if (response != "" && response != null) { return JSON.parse(response); } else { return null; } } } function AVDevice(audio, video) { if(AVDevice.deviceAppletState === null || AVDevice.isInitializing()) return null; // must have supporting applet running var that = this; this.PMgr = ParameterManager; // From ParameterManager.js (JavaScript file) this.PMgr("device"); // this.eventManager = EventManager; //support events // this.eventManager(); //Device Object Array and Object ID to track the Device Objects that are Created this.objectID = AVDevice.AVDeviceObjectArray.length; AVDevice.AVDeviceObjectArray[this.objectID] = this; var captureTimeout = null; // define validators for parameter management this.integerStringValidator = function (group, name, _value) { if(isNaN(_value)) return false; return true; }; this.audioIndexValidator = function (group, name, _value) { if(isNaN(_value)) return false; // must be an integer var value = parseInt(_value); if(value < -1) return false; // range from -1 to return true; }; this.videoIndexValidator = function (group, name, _value) { if(isNaN(_value)) return false; // must be an integer var value = parseInt(_value); if(value < -1) return false; // range from -1 to return true; }; this.audioNameValidator = function (group, name, _value) { if(typeof _value != "string") return false; return true; }; this.videoNameValidator = function (group, name, _value) { if(typeof _value != "string") return false; return true; }; //Parameters Allowed for each device object this.defineParameter("device","audioIndex","defaultValue",-1,"validator",this.audioIndexValidator); //Index from the Audio Devices Array this.defineParameter("device","videoIndex","defaultValue",-1,"validator",this.videoIndexValidator); //Index from the Video Devices Array this.defineParameter("device","audioName","defaultValue","","validator",this.audioNameValidator); //Name from the Audio Devices Array this.defineParameter("device","videoName","defaultValue","","validator",this.videoNameValidator); //Name from the Video Devices Array //User Defined Device Parameters this.defineParameter("device","framerate","defaultValue",30); //Frame Rate this.defineParameter("device","height","defaultValue",240); //Resolution Height this.defineParameter("device","width","defaultValue",320); //Resolution Width this.defineParameter("device","timelimit","defaultValue",120); //Timelimit for Capture Process this.defineParameter("device","outputfile","defaultValue","./default.avi"); // File name for the captured (AVI) file (Path is optional and the default path is User's Home Directory) //To Retrieve Capture Progress this.defineParameter("device","captureProgress","defaultValue","0","validator",this.integerStringValidator); //instance state model properties. this.setProperty("device","captureStateModel","captureState",false); this.setProperty("device","captureStateModel","completedState",false); this.setProperty("device","captureStateModel","erroredState",false); this.setProperty("device","previewStateModel","previewState",false); //Public Method to Start the Preview Process this.startPreview = function() { if (AVDevice.deviceAppletState === null || AVDevice.deviceAppletState == "initializing") return false; if(!this.isActive() && AVDevice.deviceAppletState == "busy"){ if(AVDevice.theActiveInstance().isCapturing()) return false; // don't disturb a capture if(AVDevice.theActiveInstance().isPreviewing()) AVDevice.theActiveInstance().stopPreview(); } if(!this.isCapturing()){ // Assert current parameters if(!declareActive()) return false; // couldn't find an AVDevice pair AVDevice.deviceApplet.ep_setCaptureParams(this.getParameter("outputfile"), this.getParameter("height"), this.getParameter("width"), this.getParameter("timelimit"), this.getParameter("framerate")); AVDevice.deviceApplet.ep_setActiveDevice(AVDevice.activeAudio,AVDevice.activeVideo); //must follow ep_setCaptureParams } AVDevice.deviceApplet.ep_setPreview(true); setAppletState("busy"); this.setProperty("device","previewStateModel","previewState",true); return true; }; //Public Method to Stop the Preview Process this.stopPreview = function() { if (!this.isActive() || !this.isPreviewing()) return true; //nothing to do AVDevice.deviceApplet.ep_setPreview(false); if(!this.isCapturing()) setAppletState("ready"); this.setProperty("device","previewStateModel","previewState",false); return true; }; //Public Method to determine whether the Preview Process is in Progress this.isPreviewing = function() { return this.getProperty("device","previewStateModel","previewState"); }; //Public Method to Start the Capture Process this.startCapture = function(_timelimit) { //timelimit optional if (AVDevice.deviceAppletState === null || AVDevice.deviceAppletState == "initializing") return false; if(this.isCapturing()) return true; // already capturing, do nothing if(!this.isActive() && AVDevice.deviceAppletState == "busy"){ if(AVDevice.theActiveInstance().isCapturing()) return false; // don't disturb a capture if(AVDevice.theActiveInstance().isPreviewing()) AVDevice.theActiveInstance().stopPreview(); } //alert("We are capturing using AVDevice!!!"); var timelimit = this.getParameter("timelimit"); if(!(typeof _timelimit == "undefined") && !isNaN(_timelimit)) timelimit = _timelimit; if(!declareActive()) return false; // couldn't find an AVDevice pair AVDevice.deviceApplet.ep_setActiveDevice(AVDevice.activeAudio,AVDevice.activeVideo); AVDevice.deviceApplet.ep_startCapture(this.getParameter("outputfile"), this.getParameter("height"), this.getParameter("width"), timelimit, this.getParameter("framerate")); setAppletState("busy"); this.setProperty("device","captureStateModel","captureState",true); this.setProperty("device","captureStateModel","completedState",false); this.setProperty("device","captureStateModel","erroredState",false); setTimeout(queryCaptureState,500); return true; }; //Public Method to Stop the Capture Process this.stopCapture = function() { if (this.isCapturing()) { AVDevice.deviceApplet.ep_stopCapture(); //State update will be driven by queryCaptureState return true; } return false; }; //Public Method to query for Capture Progress this.getCaptureProgress = function() { if (this.isCapturing() || this.isCompleted()) { return that.getParameter("captureProgress"); } return 0; }; //Public Method to query for errors this.getErrors = function() { if(that.isError()){ var errors = that.getParameter("errors"); if(errors !== null) return errors; } return ""; }; //Public Method to determine whether the Capture Process is in Progress this.isCapturing = function() { return this.getProperty("device","captureStateModel","captureState"); }; //Public Method to determine whether the Capture Process is Completed this.isCompleted = function() { return this.getProperty("device","captureStateModel","completedState"); }; //Public Method to determine whether an Error occurred during the Capture Process this.isError = function() { return this.getProperty("device","captureStateModel","erroredState"); }; this.isErrored = this.isError; // deprecated function //Public Method to determine which Device Object is Active (Previewing or Capturing) this.isActive = function() { if (AVDevice.activeDeviceObjectID == this.objectID) return true; return false; }; // Private method to initialize instance var init = function(audio, video){ // To populate the devices Array if ((AVDevice.audioDevicesArray === null) && (AVDevice.videoDevicesArray === null)) { AVDevice.getAudioDeviceList(); AVDevice.getVideoDeviceList(); } // To set the default device (per default selection algorithm) as Active Device if ((AVDevice.activeVideo == -1) && (AVDevice.videoDevicesArray[0] !== null)) { AVDevice.activeVideo = getDefaultDeviceIndex(AVDevice.videoDevicesArray); } if ((AVDevice.activeAudio == -1) && (AVDevice.audioDevicesArray[0] !== null)) { AVDevice.activeAudio = getDefaultDeviceIndex(AVDevice.videoDevicesArray); } // To set the Audio Index and Name Parameter if (audio) { that.setParameter("audioName",audio); that.setParameter("audioIndex",resolveNameToIndex(audio,AVDevice.audioDevicesArray)); } else { that.setParameter("audioName","defaultDevice"); that.setParameter("audioIndex","-1"); } // To set the Video Index and Name Parameter // Assume defaults, then correct with supplied if possible if (video) { that.setParameter("videoName",video); that.setParameter("videoIndex",resolveNameToIndex(video,AVDevice.videoDevicesArray)); } else { that.setParameter("videoName","defaultDevice"); that.setParameter("videoIndex","-1"); } }; //Private Method to Query the State while the Capturing Process is in Progress. var queryCaptureState = function() { captureTimeout = null; var currentState = "ready"; var progress = that.getParameter("captureProgress"); if(that.isActive()){ currentState = AVDevice.deviceApplet.ep_getCapturingState(); //Current State from the Device Applet progress = AVDevice.deviceApplet.ep_getCaptureProgress(); } var captureProgress = progress >= 0 ? progress : 0; // Current State from Device Applet are: Ready, Started, Errored if (currentState == "started"){ setAppletState("busy"); that.setParameter("captureProgress",captureProgress); captureTimeout = window.setTimeout(queryCaptureState,500); return; } if (currentState == "errored"){ that.setProperty("device","captureStateModel","erroredState",true); that.setParameter("captureProgress",captureProgress); that.setParameter("errors",AVDevice.deviceApplet.ep_getErrors()); if(!that.isPreviewing()) setAppletState("ready"); } if (currentState == "ready"){ that.setProperty("device","captureStateModel","captureState",false); that.setProperty("device","captureStateModel","completedState",true); that.setParameter("captureProgress",captureProgress); if(!that.isPreviewing()) setAppletState("ready"); } }; //Private Function to set the Applet State var setAppletState = function(_state){ var oldState = AVDevice.deviceAppletState; if (_state != AVDevice.deviceAppletState){ AVDevice.deviceAppletState = _state; that.setParameter("state",_state); } }; //Private Function to get the default device index var getDefaultDeviceIndex = function(deviceArray) { if(deviceArray === null || typeof deviceArray.length == "undefined" || deviceArray.length === 0) return -1; // no devices available //Prefer first Logitech device //or first Labtec device //or first device for (var deviceIndex = 0; deviceIndex < deviceArray.length; deviceIndex++) { var aDevice = deviceArray[deviceIndex].toLowerCase(); if (aDevice.indexOf("logitech") != -1) return deviceIndex; if (aDevice.indexOf("labtec") != -1) return deviceIndex; } return 0; // use first in list }; var resolveNameToIndex = function(_name,_deviceArray){ if(_deviceArray === null || typeof _deviceArray.length == "undefined" || _deviceArray.length === 0) return -1; // no devices available for (var index = 0; index < _deviceArray.length; index++) { if (_deviceArray[index] == _name) { return index; } } return -1; }; var resolveIndexToName = function(_index,_deviceArray){ if(_deviceArray === null || typeof _deviceArray.length == "undefined" || _deviceArray.length === 0 || _index < 0 || _index > (_deviceArray.length - 1)) return ""; // no device at that index available return _deviceArray[_index]; }; // declare me the active device... var declareActive = function(){ //take this opportunity to adjust name<->index relationships. //if name is set then it is king. index is adjusted to match. //if name is not set then index is used to update name and then name becomes king again // if the index does not match to a name, both are set to temporarily defaults var videoDevice = that.getParameter("videoIndex"); var audioDevice = that.getParameter("audioIndex"); var audioName = that.getParameter("audioName"); var videoName = that.getParameter("videoName"); if(videoName !== ""){ videoDevice = resolveNameToIndex(videoName,AVDevice.videoDevicesArray); that.setParameter("videoIndex",videoDevice); }else{ //no name present try index if(videoDevice != -1){ videoName = resolveIndexToName(videoDevice,AVDevice.videoDevicesArray); if(videoName !== ""){ //name found that.setParameter("videoName",videoName); }else{ //no name found, temporarily default both videoDevice = -1; } } } if(audioName !== ""){ audioDevice = resolveNameToIndex(audioName,AVDevice.audioDevicesArray); that.setParameter("audioIndex",audioDevice); }else{ //no name present try index if(audioDevice != -1){ audioName = resolveIndexToName(audioDevice,AVDevice.audioDevicesArray); if(audioName !== ""){ //name found that.setParameter("audioName",audioName); }else{ //no name found, temporarily default both audioDevice = -1; } } } // go active with devices as specified, or use defaults if(videoDevice == -1) videoDevice = getDefaultDeviceIndex(AVDevice.videoDevicesArray); if(videoDevice == -1) return false; // no video devices available if(audioDevice == -1) audioDevice = getDefaultDeviceIndex(AVDevice.audioDevicesArray); if(audioDevice == -1) return false; // no audio devices available AVDevice.activeVideo = videoDevice; AVDevice.activeAudio = audioDevice; AVDevice.activeDeviceObjectID = that.objectID; return true; }; // execute the init after all functions are defined init(audio, video); } // End of AVDevice class //Static Public Variables ( *** Not Part of the User API ***[Should not be accessed by the User] ) AVDevice.appspec = null; // Holds appspec information for AVDevice AVDevice.deviceApplet = null; // Device Applet ( *** SHOULD be CREATED even before creating Device Objects or Querying for Devices) //*** DEVICE APPLET STATES ( AVDevice.deviceAppletState ) are: initializing, ready, busy *** AVDevice.deviceAppletState = null; // The STATUS of Device Applet (Updated and Maintained by the Device Class) AVDevice.activeVideo = -1; // To track the Active Video Device AVDevice.activeAudio = -1; // To track the Active Audio Device AVDevice.activeDeviceObjectID = null; // To track the Device Object that's Active AVDevice.audioDevicesArray = null; // List of Audio Devices AVDevice.videoDevicesArray = null; // List of Video Devices AVDevice.AVDeviceObjectArray = new Array(); // List (ID) of Device Object Created AVDevice.callbackAfterInstallation = null; // User CallBack Function After Installation //Static Public functions //Static Public method to Install and Start the Device Applet using AppSpec and AppletManager AVDevice.setDefaultAppspec = function() { if(AVDevice.appspec === null){ AVDevice.appspec = new AppletSpec("capture"); AVDevice.appspec.setParameter("name","captureApplet"); AVDevice.appspec.setParameter("visible","true"); AVDevice.appspec.addParameter("disableInstall","false"); AVDevice.appspec.setParameter("width","320"); AVDevice.appspec.setParameter("height","240"); } return AVDevice.appspec; } //Static Public method to cause installation/initialization of the AVDevice Class //Part of User API AVDevice.Install = function(callbackmethod) { if ((AVDevice.deviceApplet === null) && (AVDevice.deviceAppletState === null)) { AVDevice.callbackAfterInstallation = callbackmethod; AVDevice.deviceAppletState = "initializing"; if(AVDevice.appspec === null){ AVDevice.setDefaultAppspec(); } AppletManager.theInstance().startApplet(AVDevice.appspec, AVDevice.installCallbackmethod, 'captureAppletElement'); } } //Callback for the Device Applet (once its loaded and started) AVDevice.installCallbackmethod = function(applet) { AVDevice.deviceApplet = applet; AVDevice.deviceAppletState = "ready"; cameraCaptureDocument = applet; //TODO EAO live or die? - leave it to keep Actor happy for now if (AVDevice.callbackAfterInstallation !== null) { AVDevice.callbackAfterInstallation(applet); AVDevice.callbackAfterInstallation = null; } // Only when the callback method is provided by the User } //Static Public method to check for Installation // Installation will be invoked if necessary AVDevice.isInstalled = function(callbackmethod) { if (AVDevice.deviceAppletState === null){ if(typeof callbackmethod != "undefined" && callbackmethod !== null){ AVDevice.Install(callbackmethod); } else{ AVDevice.Install(); } } return !AVDevice.isInitializing(); } //Static Public State queries AVDevice.isInitializing = function() { return (AVDevice.deviceAppletState == "initializing"); } AVDevice.isReady = function() { return (AVDevice.deviceAppletState == "ready"); } AVDevice.isPreviewing = function() { var activeInstance = AVDevice.theActiveInstance(); return (activeInstance === null) ? false : activeInstance.isPreviewing(); } AVDevice.isCapturing = function() { var activeInstance = AVDevice.theActiveInstance(); return (activeInstance === null) ? false : activeInstance.isCapturing(); } AVDevice.isCompleted = function() { var activeInstance = AVDevice.theActiveInstance(); return (activeInstance === null) ? false : activeInstance.isCompleted(); } AVDevice.isError = function() { var activeInstance = AVDevice.theActiveInstance(); return (activeInstance === null) ? false : activeInstance.isError(); } AVDevice.getErrors = function() { if(AVDevice.isError()){ return AVDevice.theActiveInstance().getErrors(); } return ""; } //Static Public method to query for the list of Video Devices in Users System AVDevice.getVideoDeviceList = function() { if(AVDevice.isInstalled()){ var videoDevicesList = String(AVDevice.deviceApplet.ep_getVideoDevices()); AVDevice.videoDevicesArray = videoDevicesList.split(";"); return AVDevice.videoDevicesArray; } return new Array(); } //Static Public method to query for the list of Audio Devices in Users System AVDevice.getAudioDeviceList = function() { if(AVDevice.isInstalled()){ var audioDevicesList = String(AVDevice.deviceApplet.ep_getAudioDevices()); AVDevice.audioDevicesArray = audioDevicesList.split(";"); return AVDevice.audioDevicesArray; } return new Array(); } //Static Public method to query for the Active Audio Device AVDevice.getActiveAudio = function() { if(AVDevice.isInstalled() && AVDevice.activeAudio != -1){ return AVDevice.audioDevicesArray[AVDevice.activeAudio]; }else{ return ""; } } //Static Public method to query for the Active Video Device AVDevice.getActiveVideo = function() { if(AVDevice.isInstalled() && AVDevice.activeVideo != -1){ return AVDevice.videoDevicesArray[AVDevice.activeVideo]; }else{ return ""; } } //Static Public method to retrieve the currently active avDevice instance AVDevice.theActiveInstance = function(){ if(AVDevice.activeDeviceObjectID === null) return null; return AVDevice.AVDeviceObjectArray[AVDevice.activeDeviceObjectID]; } // meActorUtil.js var reconfigurationInProgress = false; var reconfigurationComplete = true; var reconfigureMpcs = null; var waitForStopAll_ = null; var reconfigureMpcs2 = null; var reconfigureRetryCtr = 0; var reconfigureRetryCtrMax = 60; var reconfigureStartTicks = 0; var override = false; function getActorByIndex(index) { return (contextDefinitionMap[index] && contextDefinitionMap[index].getActor()) ? contextDefinitionMap[index].getActor() : null; } function getActorByName(name) { return (actorNameMap[name]) ? actorNameMap[name]['instance'] : null; } function isMsgActor(ctxId) { var anActor = getActorByIndex(ctxId); return (anActor !== null) ? anActor.areMsgsEnabled() : false; } function stopAll() { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { getActorByIndex(i).hide(); stopContext(i); displayImage(i,stoppedImageSpec); } transitionInProgress(); } } function auditAllActors() { if ((actorInstanceMap !== null) && (actorInstanceCtr > 1)) { for (var i = 1; i <= actorInstanceCtr; i++) { status |= actorInstanceMap[i].auditBackgroundContexts(); } } return status; } function reconfigureMpcsClosure(method,arg) {return (function() {requestMpcReconfiguration(method,arg);});} function waitForStopAllClosure(method,arg) {return (function() {waitForStopAll(method,arg);});} function reconfigureMpcsClosure2(method,arg) {return (function() {requestMpcReconfiguration2(method,arg);});} function requestMpcReconfiguration(method,arg) { if ((!reconfigurationComplete || areContextsActive()) && !override) { directorTrace('meActorUtil.requestMpcReconfiguration REQUEST BLOCKED'); displayContextStateSummary(); beep(); return; } if (reconfigurationInProgress) { directorTrace('meActorUtil.requestMpcReconfiguration DEFERRING REQUEST method: ' + method + ' arg: ' + arg); reconfigureMpcs = reconfigureMpcsClosure(method,arg); setTimeout(reconfigureMpcs,5000); return; } reconfigureStartTicks = getTicks(); enableHourGlass(); allContextsReady = false; ctxReady = new Object(); reconfigurationInProgress = true; reconfigurationComplete = false; clearAllInvokeQueues(); stopAll(); waitForStopAll_ = waitForStopAllClosure(method,arg); setTimeout(waitForStopAll_,1000); setTimeout('monitorAllContextsReady()',1100); } function waitForStopAll(method,arg) { var contextsStopped = areContextsStopped(); var contextsActive = areContextsActive(); if (contextsStopped && !contextsActive) { reconfigureMpcs2 = reconfigureMpcsClosure2(method,arg); setTimeout(reconfigureMpcs2,1000); } else { directorTrace('meActorUtil.waitForStopAll REISSUE' + ' stopped: ' + contextsStopped + ' active: ' + contextsActive); displayContextStateSummary(); if (!contextsStopped) { stopAll(); } waitForStopAll_ = waitForStopAllClosure(method,arg); setTimeout(waitForStopAll_,500); } } function requestMpcReconfiguration2(method,arg) { eval(method + '(\'' + arg + '\')'); setTimeout('waitForAllContextsReady()',100); } function monitorAllContextsReady() { if (allContextsReady) { setTimeout('actorsReady()',100); } else { reconfigureRetryCtr++; if (reconfigureRetryCtr > reconfigureRetryCtrMax) { alert('meActorUtil.monitorAllContextsReady reset state'); directorTrace('meActorUtil.monitorAllContextsReady reset state'); allContextsReady = true; reconfigureRetryCtr = 0; resetAllContexts(); override = true; actorsReady(); } else { setTimeout('monitorAllContextsReady()',1000); } } } function waitCursor() { document.body.style.cursor = 'wait'; } function autoCursor() { document.body.style.cursor = 'auto'; } function enableHourGlass() { return; } function disableHourGlass() { return; } function areContextsStopped() { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { var stopped = isContextStopped(i); if (!stopped) return false; } } return true; } function areContextsIdle() { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { if (!isContextIdle(i)) { return false; } } } return true; } function abortAll() { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { abortContext(i); } resetAllClips(); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (i = 1; i <= contextIdx; i++) { clearEventQueue(i); } } } } function clearAllInvokeQueues() { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { clearInvokeQueue(i); } } } function areContextsRestarting() { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { if (isContextRestarting(i)) { return true; } } } return false; } function areContextsSwitching() { directorTrace('meActorUtil.areContextSwitching'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { if (isContextSwitching(i)) return true; } } return false; } function isTransitionActive() { var ticks = getTicks(); var isActive = ticks < transitionTicks; if (isActive) { } return isActive; } var statusClockEnabled = false; function setStatusClockEnabled(state) { statusClockEnabled = state; if (statusClockEnabled) { statusClockCtr = 0; statusClock(); } } var statusClockCtr = 0; function statusClock() { if (statusClockEnabled) { waitCursor(); windowStatus(statusClockCtr); setTimeout('statusClock()',1000); statusClockCtr++; } } function isBackground(ctxId) { return !isForeground(ctxId); } function isForeground(ctxId) { return foregroundMap[ctxId]; } // assumes elements start off hidden var elementShowState = null; function initElementShowState(element) { if (elementShowState == null) { elementShowState = new Object(); } if (elementShowState[element] == undefined) { elementShowState[element] = false; } } function isElementShowing(element) { initElementShowState(element); return elementShowState[element]; } function isElementHidden(element) { return !isElementShowing(element); } function showElement(element) { if (isElementHidden(element)) { document.getElementById(element).style.visibility = "visible"; elementShowState[element] = true; } } function hideElement(element) { initElementShowState(element); document.getElementById(element).style.visibility = "hidden"; elementShowState[element] = false; } function actorsReady() { if (areContextsActive() && !override) { directorTrace('meActorUtil.actorsReady almost ready...'); displayContextStateSummary(); setTimeout('actorsReady()',1000); } else { fireMeEvent('allActorsReady','allActorsReady;meActorUtil.actorsReady'); directorTrace('ready'); reconfigurationComplete = true; reconfigurationInProgress = false; reconfigureRetryCtr = 0; override = false; disableHourGlass(); } } function resetAllContexts() { directorTrace('meActorUtil.resetAll'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { resetContext(i); } } } function areContextsActive() { var transitionActive = isTransitionActive(); var contextsRestarting = areContextsRestarting(); var restartAtInProgress = isRestartAtInProgress(); var contextsIdle = areContextsIdle(); var backgroundContextsPlaying = false; // areBackgroundContextsPlaying(); var contextsActive = transitionActive || contextsRestarting || restartAtInProgress || !contextsIdle || backgroundContextsPlaying; if (false && contextsActive) { alert('meActorUtil.areContextsActive ACTIVE' + '\n transitionActive: ' + transitionActive + '\n contextsRestarting: ' + contextsRestarting + '\n restartAtInProgress: ' + restartAtInProgress + '\n contextsIdle: ' + contextsIdle + '\n backgroundContextsPlaying: ' + backgroundContextsPlaying); } return contextsActive; } var transitionTicks = 0; var transitionInterval = 2000; function transitionInProgress() { transitionTicks = getTicks() + transitionInterval; // directorTrace('meActorUtil.transitionInProgress transitionTicks: ' + transitionTicks); } function displayContextStateSummary() { if (false) { var transitionActive = isTransitionActive(); var contextsRestarting = areContextsRestarting(); var restartAtInProgress = isRestartAtInProgress(); var contextsStopped = areContextsStopped(); var contextsIdle = areContextsIdle(); var backgroundPlaying = areBackgroundContextsPlaying(); directorTrace('\n meActorUtil.displayContextStateSummary' + ' transition: ' + transitionActive + ' restarting: ' + contextsRestarting + ' restartAtInProgress: ' + restartAtInProgress + ' stopped: ' + contextsStopped + ' idle: ' + contextsIdle + ' backgroundPlaying: ' + backgroundPlaying + ' override: ' + override); } } function areBackgroundContextsPlaying() { // directorTrace('meActorUtil.areBackgroundContextsPlaying'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { if (isBackground(i) && isContextPlaying(i)) { directorTrace('meActorUtil.areBackgroundContextsPlaying' + ' name: ' + getActorNameByIndex(i) + ' index: ' + i); return true; } } } return false; } function getCtxIdByName(actorName) { return getViewCtxId(actorName); } function isAuditPlayState(ctxId) { var auditPlayState = false; if (contextDefinitionMap[ctxId]) { var ctxDef = contextDefinitionMap[ctxId]; if (ctxDef != null) { auditPlayState = ctxDef.getClipDescriptor().getAuditPlayState(); } } return auditPlayState; } String.prototype.trim = function() { return this.replace(/^\s*|\s*$/g,''); } function isArray(array) { return ((array != null) && (typeof array == "object") && (array.constructor == Array)); } function dumpStringArray(array) { directorTrace(array); if (isArray(array)) { for (var i = 0; i < array.length; i++) { if (isArray(array[i])) { dumpStringArray(array[i]); } else { directorTrace(array[i]); } } } } function dumpStringList(list) { for (var e1 in list) { directorTrace('e1: ' + e1 + ' typeof e1: ' + (typeof e1) + ' typeof list: ' + (typeof list)); if (list[e1] && (typeof list[e1] == 'object')) { dumpStringList(list[e1]); } } } var onClickTicks = 0; var onClickInterval = 1000; function isOnClickAllowed() { var clickAllowed = false; var ticks = getTicks(); var onClickInProgress = ticks < onClickTicks; if (!onClickInProgress) { var contextsActive = areContextsActive(); clickAllowed = allContextsReady && reconfigurationComplete && !contextsActive; // if (!clickAllowed) // { // directorTrace('meActorUtil.isOnClickAllowed onClick NOT allowed' + // '\n allContextsReady: ' + allContextsReady + // ' reconfigurationComplete: ' + reconfigurationComplete + // ' contextsActive: ' + contextsActive); // } } else { // directorTrace('meActorUtil.isOnClickAllowed onClick IN PROGRESS' + // ' ticks: ' + ticks + // ' onClickTicks: ' + onClickTicks); } return clickAllowed; } var onClickBusy = false; function onClickClosure(method,arg) {return (function() {onClickClosureTarget(method,arg);});} var onClickClosureRequest = null; var onClickRequestCtr = 0; function onClickWdtClosure(method,arg) {return (function() {onClickWdtClosureTarget(method,arg);});} function retryOnClickRequest(method,arg) { var status = false; if (!onClickBusy) { onClickBusy = true; status = true; enableHourGlass(); onClickClosureRequest = onClickClosure(method,arg); setTimeout(onClickClosureRequest,200); onClickWdtRequest = onClickWdtClosure(method,arg); setTimeout(onClickWdtRequest,5000); } return status; } function onClickClosureTarget(method,arg) { if (onClickBusy) { onClickRequestCtr++; if (isOnClickAllowed()) { eval(method + '(\'' + arg + '\')'); resetOnClick(); } else { enableHourGlass(); // directorTrace('onClick.onClickClosureTarget RETRY'); onClickClosureRequest = onClickClosure(method,arg); setTimeout(onClickClosureRequest,200); } } else { // directorTrace('onClick.onClickClosureTarget onClickBusy CLEARED'); } } function onClickWdtClosureTarget(method,arg) { if (onClickBusy && (onClickClosureRequest !== null)) { // directorTrace('onClick.onClickWdtClosureTarget WDT TIMEDOUT'); resetOnClick(); } } function resetOnClick() { onClickRequestCtr = 0; onClickClosureRequest = null; onClickBusy = false; disableHourGlass(); } function requestOnClick(method,arg) { var status; if (isOnClickAllowed()) { if (eval(method + '(\'' + arg + '\')')) { resetOnClick(); } status = 1; // method executed onClickTicks = getTicks() + onClickInterval; } else { if (retryOnClickRequest(method,arg)) { status = 0; // method queued for a retry (i.e., in-progress) onClickTicks = getTicks() + onClickInterval; } else { status = -1; // method blocked } } return status; } var pacifyToggle = false; var pacifyCtr = 0; var actorsStarted = false; function startActors() { if (!actorsStarted) { if (videoChat && !jChatInstallationComplete) { pacifyToggle = !pacifyToggle; if (pacifyToggle) { windowStatus("[" + pacifyCtr + "] PLEASE WAIT... INITIALIZING"); pacifyCtr += 2; } else { windowStatus(" "); } setTimeout("startActors();",2000); return; } actorsStarted = true; startActors2(); } } function isAuditPointer(ctxId) { return auditPointerMap[ctxId]; } function pauseAll() { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { pauseContext(i); } transitionInProgress(); } } function fireMeEvent(event,eventDescriptor) { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { getActorByIndex(i).invoke(event,eventDescriptor); } } } String.prototype.startsWith = function(aString) { return this.indexOf(aString) == 0; } function isString(o) { return typeof o == 'string'; } function windowStatus(text) { //return; window.status = text; } /** * @fileoverview This file provides all the functionalities to communicate with server by AJAX request * * @author Espre Team * @version 0.1 * * @param {String} script_filename * @constructor */ function AjaxClient() {} AjaxClient.prototype = { requestType:"POST", // type GET,POST passed to open isAsync:false, // when set to true, async calls are made xmlhttp:false, // where an XMLHttpRequest instance is stored callback:false, // what is called when a successful async call is made /* method to initialize an xmlhttpclient */ init:function() { if (window.XMLHttpRequest) this.xmlhttp = new XMLHttpRequest(); else if (window.ActiveXObject) this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); else alert("AjaxClient. Cannot create XMLHTTPRequest object"); /* try { this.xmlhttp = new XMLHttpRequest(); // Mozilla / Safari } catch (e) { // IE //alert("AjaxClient.init EXCEPTION: " + e.message); var XMLHTTP_IDS = new Array("MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"); var success = false; for (var i=0;i < XMLHTTP_IDS.length && !success; i++) { try { this.xmlhttp = new ActiveXObject(XMLHTTP_IDS[i]); success = true; } catch (e) {alert("AjaxClient.init EXCEPTION: " + e.message);} } if (!success) { } } */ }, /** method to make a page request * @param string url The page to make the request to * @param string payload What you’re sending if this is a POST request */ makeRequest: function(url,payload) { if (!this.xmlhttp) { this.init(); } this.xmlhttp.open(this.requestType,url,this.isAsync); this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); // set onreadystatechange here since it will be reset after a //completed call in Mozilla var self = this; if(this.isAsync){ this.xmlhttp.onreadystatechange = function() { self._readyStateChangeCallback(); } } try { this.xmlhttp.send(payload); if (!this.isAsync) { return this.xmlhttp.responseText; } } catch(e) { alert("AjaxClient.init EXCEPTION: " + e.message); return null; } }, /* internal method used to handle ready state changes */ _readyStateChangeCallback:function() { switch(this.xmlhttp.readyState) { case 2: break; case 4: if (this.xmlhttp.status == 200) { this.callback(this.xmlhttp.responseText); } else { this.callback(null); } break; } } } // $Id$ function EventManager() { var that = this; //Let the private functions access the object instance. 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; } this.addEventRule = function(event,action) { 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; //alert('group: ' + group + ' event: ' + event + ' action: ' + action); //this.dumpEventRuleGroup(group); } 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[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) { var actionFound = false; for (var action in actions) { if (!actionFound) this.invokeEvent(event,eventDescriptor); actionFound = true; if (this.isExcludedEvent(event)) { //text = '[1]Actor.invoke' + ' eventDescriptor: ' + eventDescriptor + ' event: ' + event + ' action: ' + action; //directorTrace(text); //alert(text); } //alert('action: ' + action + ' typeof: ' + (typeof action)); if (action.indexOf('(') !== -1) { //directorTrace('EventManager.invoke action: ' + action + ' typeof action: ' + (typeof action)); if (typeof EventManager.noTryCatch == 'undefined') { if (true && !eventDescriptor.startsWith('playing_stopped') && !eventDescriptor.startsWith('firstFrameReady') ) directorTrace('EventManager.invoke' + ' ruleGroupName: ' + this._eventRuleGroupName + ' eventDescriptor: ' + eventDescriptor + ' action: ' + action); try {eval(action);} catch(err) { alert('EventManager.invoke EXCEPTION: ' + err.description + '\n action: ' + action + '\n event: ' + event + '\n eventDescriptor: ' + eventDescriptor); } } else { if (true && !eventDescriptor.startsWith('playing_stopped') && !eventDescriptor.startsWith('firstFrameReady') ) directorTrace('EventManager.invoke' + ' ruleGroupName: ' + this._eventRuleGroupName + ' eventDescriptor: ' + eventDescriptor + ' action: ' + action); 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 != '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); } } // meClipDescriptor.js //var clipDescriptorList = null; //var clipDescriptorArray = null; var _clipDescriptor = new ClipDescriptor(); ClipDescriptor.cdaIndex = 0; ClipDescriptor.clipDescriptorArray = null; ClipDescriptor.clipDescriptorList = null; ClipDescriptor.sdlList = null; function ClipDescriptor(sdlBase, sdlPrefix, sdl, width, height, autoplay, noAudio, convertSegments, volume, foreground, scenes, vdc, vic, adc, aic, auditPlayState, auditPointer, autoBandwidth, syncBandwidth, codeBaseOverride) { if (!sdl || (sdl === null)) return; this._sdlBase = sdlBase; this._sdlPrefix = sdlPrefix; this._sdl = sdl; this._width = width; this._height = height; this._autoplay = autoplay; this._noAudio = noAudio; this._convertSegments = convertSegments; this._volume = volume; this._foreground = foreground; this._scenes = scenes; this._vdc = vdc; this._vic = vic; this._adc = adc; this._aic = aic; this._auditPlayState = auditPlayState; this._auditPointer = auditPointer; this._autoBandwidth = autoBandwidth; this._syncBandwidth = syncBandwidth; this._codeBaseOverride = codeBaseOverride; this.setSdlBase = function(sdlBase) {this._sdlBase = sdlBase;} this.getSdlBase = function() {return this._sdlBase;} this.setSdlPrefix = function(sdlPrefix) {this._sdlPrefix = sdlPrefix;} this.getSdlPrefix = function() {return this._sdlPrefix;} this.setSdl = function(sdl) {this._sdl = sdl;} this.getSdl = function() {return this.getSdlBase() + this.getSdlPrefix() + this._sdl;} this.setWidth = function(width) {this._width = width;} this.getWidth = function() {return this._width;} this.setHeight = function(height) {this._height = height;} this.getHeight = function() {return this._height;} this.setAutoplay = function(autoplay) { this._autoplay = (isString(autoplay)) ? (autoplay.toLowerCase() == 'true') : autoplay; directorTrace('meClipDescriptor.setAutoplay' + ' autoplay: ' + autoplay); //alert('meClipDescriptor.setAutoplay' + ' autoplay: ' + autoplay); } this.getAutoplay = function() {return this._autoplay;} this.setNoAudio = function(noAudio) { this._noAudio = (isString(noAudio)) ? (noAudio.toLowerCase() == 'true') : noAudio;; } this.getNoAudio = function() {return this._noAudio;} this.setConvertSegments = function(ConvertSegments) {this._convertSegments = convertSegments;} this.getConvertSegments = function() {return this._convertSegments;} this.setVolume = function(volume) {this._volume = volume;} this.getVolume = function() {return this._volume;} this.setForeground = function(foreground) {this._foreground = foreground;} this.isForeground = function() {return this._foreground;} this.setScenes = function(scenes) {this._scenes = scenes;} this.getScenes = function() {return this._scenes;} this.setVideoDataCacheSize = function(vdc) {this._vdc = vdc;} this.getVideoDataCacheSize = function() {return this._vdc;} this.setVideoIndexCacheSize = function(vic) {this._vic = vic;} this.getVideoIndexCacheSize = function() {return this._vic;} this.setAudioDataCacheSize = function(adc) {this._adc = adc;} this.getAudioDataCacheSize = function() {return this._adc;} this.setAudioIndexCacheSize = function(aic) {this._aic = aic;} this.getAudioIndexCacheSize = function() {return this._aic;} this.setAuditPlayState = function(auditPlayState) {this._auditPlayState = auditPlayState;} this.getAuditPlayState = function() {return this._auditPlayState;} this.setAuditPointer = function(auditPointer) {this._auditPointer = auditPointer;} this.getAuditPointer = function() {return this._auditPointer;} this.isAuditPointer = function() {return this._auditPointer;} this.setAutoBandwidth = function(autoBandwidth) {this._autoBandwidth = autoBandwidth;} this.getAutoBandwidth = function() {return this._autoBandwidth;} this.setSyncBandwidth = function(syncBandwidth) {this._syncBandwidth = syncBandwidth;} this.getSyncBandwidth = function() {return this._syncBandwidth;} this.setCodeBaseOverride = function(codeBaseOverride) {this._codeBaseOverride = codeBaseOverride;} this.getCodeBaseOverride = function() {return this._codeBaseOverride;} if (ClipDescriptor.clipDescriptorList == null) { ClipDescriptor.clipDescriptorList = new Object(); } var subscript = ''; if (ClipDescriptor.clipDescriptorArray == null) { ClipDescriptor.clipDescriptorArray = new Array(); ClipDescriptor.cdaIndex = 0; } var listEntry = ''; if (this.getSdlPrefix().indexOf('/') != -1) { var path = this.getSdlPrefix().split('/'); for (var i = 0; i < path.length; i++) { if (path[i].length > 0) { subscript += '[\'' + path[i] + '\']'; if (!eval('ClipDescriptor.clipDescriptorList' + subscript) && (i < (path.length-2))) { listEntry = 'ClipDescriptor.clipDescriptorList' + subscript + '=new Object()'; eval(listEntry); ClipDescriptor.clipDescriptorArray[ClipDescriptor.cdaIndex++] = listEntry; } } } } else { subscript += '[\'' + this.getSdlPrefix() + '\']'; } listEntry = 'ClipDescriptor.clipDescriptorList' + subscript + '=this'; eval(listEntry); ClipDescriptor.clipDescriptorArray[ClipDescriptor.cdaIndex++] = listEntry; this.getExtendedClipHandle = function() { return '/' + this.getSdlPrefix().substring(0,this.getSdlPrefix().length); } this.toString = function() { return (' ClipDescriptor' + '\n location.href: ' + location.href + '\n sdlBase: ' + this._sdlBase + ' sdlPrefix: ' + this._sdlPrefix + '\n sdl: ' + this._sdl + ' volume: ' + this._volume + ' width: ' + this._width + ' height: ' + this._height + '\n codeBaseOverride: ' + this._codeBaseOverride + '\n autoplay: ' + this._autoplay + ' noAudio: ' + this._noAudio + ' convertSegments: ' + this._convertSegments + ' foreground: ' + this._foreground + '\n vdc: ' + this._vdc + ' vic: ' + this._vic + ' adc: ' + this._adc + ' aic: ' + this._aic + '\n auditPlayState: ' + this._auditPlayState + ' auditPointer: ' + this._auditPointer + ' autoBandwidth: ' + this._autoBandwidth + ' syncBandwidth: ' + this._syncBandwidth + '\n scenes: ' + this._scenes); } if (ClipDescriptor.sdlList === null) { ClipDescriptor.sdlList = new Object(); } ClipDescriptor.sdlList[this.getSdl()] = this; this.cloneBasicParameters = function(aCd) { //this._width = aCd._width; //this._height = aCd._height; //this._autoplay = aCd._autoplay; this._noAudio = aCd._noAudio; this._convertSegments = aCd._convertSegments; this._volume = aCd._volume; this._foreground = aCd._foreground; this._scenes = aCd._scenes; this._vdc = aCd._vdc; this._vic = aCd._vic; this._adc = aCd._adc; this._aic = aCd._aic; this._auditPlayState = aCd._auditPlayState; this._auditPointer = aCd._auditPointer; this._autoBandwidth = aCd._autoBandwidth; this._syncBandwidth = aCd._syncBandwidth; //this._codeBaseOverride = aCd._codeBaseOverride; } } function getClipDescriptorList() { return ClipDescriptor.clipDescriptorList; } function getClipDescriptorListAsString() { return 'ClipDescriptor.clipDescriptorList'; } function dumpCda() { return; for (var i = 0; i < ClipDescriptor.clipDescriptorArray.length; i++) { directorTrace('i: ' + i + ' ' + ClipDescriptor.clipDescriptorArray[i]); } } ClipDescriptor.findClipDescriptor = function(anSdl) { //alert('meClipDescriptor.findClipDescriptor anSdl: ' + anSdl); var cd = null; if ((ClipDescriptor.sdlList !== null) && (ClipDescriptor.sdlList[anSdl])) { cd = ClipDescriptor.sdlList[anSdl]; } return cd; } // meChat.js function Chat(chatApplet) { var url = EVME_CHAT_PATH; var cm = new ChannelManager(url); if (!chatApplet) { chatApplet = vChatDocument; } this.chatApplet = chatApplet; this.videoRTP = 0; this.videoRTCP = 0; this.audioRTP = 0; this.audioRTCP = 0; this.callId = -1; this.openChannel = function(userName,direction) // USER API { // direction == 0 == Chat.incoming; // direction > 0 == Chat.outgoing (selfview, too) if (this.callId !== -1) { this.closeChannel(); } this.direction = direction; if (userName && isString(userName) && (userName.length > 0)) { var channels = this.acquireChannelsFor(userName); if (channels === null) { directorTrace('Chat.openChannel UNABLE TO GET CHANNELS FOR userName: ' + userName); return null; } this.videoRTP = channels.videoRTP; this.videoRTCP = channels.videoRTCP; this.audioRTP = channels.audioRTP; this.audioRTCP = channels.audioRTCP; } else { directorTrace('Chat.openChannel INVALID userName: ' + userName); return null; } this.callId = this.chatApplet.ep_openMulticastChannel(direction, this.videoRTP,this.videoRTCP, this.audioRTP,this.audioRTCP); directorTrace('Chat.openChannel' + this); return this.callId; } this.closeChannel = function() // USER API { if (this.callId > -1) { directorTrace('Chat.closeChannel' + this); this.chatApplet.ep_closeMulticastChannel(this.callId); this.callId = -1; this.releaseChannels(); } } this.toString = function() { return ('\n userName: ' + this.userName + ' callId: ' + this.callId + ' direction: ' + ((this.direction == Chat.outgoing)? 'outgoing' : 'incoming') + '\n audioRTP: ' + this.audioRTP + ' [0x' + this.d2h(this.audioRTP) + ']' + ' audioRTCP: ' + this.audioRTCP + ' [0x' + this.d2h(this.audioRTCP) + ']' + '\n videoRTP: ' + this.videoRTP + ' [0x' + this.d2h(this.videoRTP) + ']' + ' videoRTCP: ' + this.videoRTCP + ' [0x' + this.d2h(this.videoRTCP) + ']'); } this.userName = ''; this.acquireChannelsFor = function(userName) { var channels = null; if (userName && isString(userName) && (userName.length > 0)) { this.userName = userName; if (this.resolvedChannels[this.userName] && (this.resolvedChannels[this.userName] !== null)) { channels = this.resolvedChannels[this.userName]; } else { channels = cm.registerChannels(this.userName); if (!channels) { channels = null; } else { this.resolvedChannels[this.userName] = channels; } } } return channels; } this.releaseChannels = function() { var response = null; if (this.userName.length > 0) { //var myHttpRequest = new HttpRequest(); //myHttpRequest.sendRequest("GET",url,new Array("name="+this.userName,"mode=sendAndDelete"),false); //response = myHttpRequest.responseText.parseJSON(); //response = cm.deregisterChannels(this.userName); this.userName = ''; } return response; } this.d2h = function(d) { var hD="0123456789ABCDEF"; var h = hD.substr(d&15,1); while(d>15) {d>>=4;h=hD.substr(d&15,1)+h;} return h; } this.startChat = function(disableAudio, vxnServerAddress, vxnServerPort) // USER API { this.disableAudio = (disableAudio) ? disableAudio : Chat.defaultDisableAudio; this.vxnServerAddress = (vxnServerAddress) ? vxnServerAddress : Chat.defaultVxnServerAddress; this.vxnServerPort = (vxnServerPort) ? vxnServerPort : Chat.defaultVxnServerPort; directorTrace('Chat.startChat ' + this.vxnServerAddress + ':' + this.vxnServerPort); this.chatApplet.ep_startup(this.disableAudio,this.vxnServerAddress,this.vxnServerPort); } this.resolvedChannels = new Array(); this.startAudio = function() {this.chatApplet.ep_startAudioCapture();}; this.stopAudio = function() {this.chatApplet.ep_stopAudioCapture();}; this.setAudioRate = function(bytesPerSecond) {this.chatApplet.ep_setAudioCaptureRate(bytesPerSecond);}; this.configureAudioRate = function(bytesPerSecond,audioOn) { if (typeof audioOn == 'undefined') audioOn = true; if (audioOn) this.stopAudio(); this.setAudioRate(bytesPerSecond); if (audioOn) this.startAudio(); }; } Chat.outgoing = 1; Chat.incoming = 0; Chat.remoteView = new Array(); Chat.selfView = null; Chat.defaultDisableAudio = false; Chat.defaultVxnServerAddress = '64.62.211.155'; Chat.defaultVxnServerPort = 443; Chat.play = function(chatActor,member) { if (chatActor) { //directorTrace('Chat.play' + ' chatActor._name: ' + chatActor._name + ' member: ' + member); chatActor.setChatApplet(vChatDocument); chatActor.play(member); } else { directorTrace('Chat.play chatActor NOT DEFINED'); } } Chat.publish = function(member) { if (Chat.selfView != null) { //directorTrace('Chat.publish' + ' Chat.selfView._name: ' + Chat.selfView._name + ' member: ' + member); Chat.selfView.setChatApplet(vChatDocument); Chat.selfView.publish(member); } else { directorTrace('Chat.publish Chat.selfView NULL'); } } Chat.allocateView = function(viewType,maxRemoteViewsAllocated) { //directorTrace('meChat.allocateView remoteView ' + Chat.remoteView + ' viewType: ' + viewType); maxRemoteViewsAllocated = maxRemoteViewsAllocated || Chat.maxRemoteViewsAllocated; if ((typeof Chat.remoteView[viewType] != 'undefined') && !Chat.areMaxRemoteViewsAllocated(maxRemoteViewsAllocated)) { for (var actorName in Chat.remoteView[viewType]) { var actor = Chat.remoteView[viewType][actorName]; if ((typeof actor.chatViewAllocated == 'undefined') || !actor.chatViewAllocated) { actor.chatViewAllocated = true; return actor; } } } else { directorTrace('Chat.allocateView no views available for viewType: ' + viewType); } return null; } Chat.releaseView = function(actorName,viewType) { var actor = getActorByName(actorName); viewType = (viewType != null) ? viewType : '' + actor.getClipWidth() + 'x' + actor.getClipHeight(); if (typeof Chat.remoteView[viewType] != 'undefined') { if (typeof Chat.remoteView[viewType][actorName] != 'undefined') { Chat.remoteView[viewType][actorName].chatViewAllocated = false; Chat.remoteView[viewType][actorName].chatProxy.callId = -1; } } else { directorTrace('Chat.releaseView viewType not found: ' + viewType); } } Chat.getSelfView = function() { return Chat.selfView; } Chat.getRemoteView = function(viewId) { return Chat.remoteView[viewId]; } Chat.isRemoteActive = function() { for (var viewId in Chat.remoteView) { var view = Chat.remoteView[viewId]; if ((typeof view.chatViewAllocated != 'undefined') && view.chatViewAllocated) { return true; } } return false; } Chat.maxRemoteViewsAllocated = 3; Chat.areMaxRemoteViewsAllocated = function(maxRemoteViewsAllocated) { var currentAllocated = 0; for (var viewType in Chat.remoteView) { for (var actorName in Chat.remoteView[viewType]) { var actor = Chat.remoteView[viewType][actorName]; if (actor.chatViewAllocated) { currentAllocated++; } } } return currentAllocated >= maxRemoteViewsAllocated; } Chat.startAudioCapture = function() { if (Chat.selfView != null) { Chat.selfView.getChatProxy().startAudio(); } else { directorTrace('Chat.startAudioCapture Chat.selfView NULL'); } } Chat.stopAudioCapture = function() { if (Chat.selfView != null) { Chat.selfView.getChatProxy().stopAudio(); } else { directorTrace('Chat.stopAudioCapture Chat.selfView NULL'); } } Chat.setAudioCaptureRate = function(bytesPerSecond) { if (Chat.selfView != null) { Chat.selfView.getChatProxy().setAudioRate(bytesPerSecond); } else { directorTrace('Chat.setAudioCaptureRate Chat.selfView NULL'); } } Chat.configureAudioCaptureRate = function(bytesPerSecond) { if (Chat.selfView != null) { Chat.selfView.getChatProxy().configureAudioRate(bytesPerSecond); } else { directorTrace('Chat.configureAudioCaptureRate Chat.selfView NULL'); } } function MeException(_message) { this.message = _message; this.name = "MeException"; } CameraCapture.useAVDevice = true; function CameraCapture(captureApplet) { if(CameraCapture.instance != null) return CameraCapture.instance; // Singleton only if(CameraCapture.useAVDevice) { //alert('meCameraCapture.CameraCapture captureApplet: ' + captureApplet + '\n cameraCaptureDocument: ' + cameraCaptureDocument); // if ((!captureApplet || (captureApplet == null)) && cameraCaptureDocument) // { // captureApplet = cameraCaptureDocument; // } this.captureApplet = captureApplet; //we don't use this, but its in the interface this.setCaptureApplet = function(applet) { // alert('meCameraCapture.setCaptureApplet' + '\n applet: ' + applet + '\n cameraCaptureDocument: ' + cameraCaptureDocument); this.captureApplet = applet; } var avDevice = new AVDevice(); //uses default video and audio devices var pendingAVDevice = null; // used to hold new device while current device is capturing or previewing. // avDevice can be changed if not capturing and not previewing var updateAVDevice = function(){ if(pendingAVDevice !== null){ avDevice = pendingAVDevice; pendingAVDevice = null; } } this.startCapture = function() // USER API { avDevice.startCapture(); } this.stopCapture = function() // USER API { avDevice.stopCapture(); updateAVDevice(); } this.startPreview = function() // USER API { avDevice.startPreview(); } this.stopPreview = function() // USER API { avDevice.stopPreview(); updateAVDevice(); } this.getCapturePath = function() // USER API { var path = null; try {path = avDevice.getParameter("outputfile");} catch (e) { alert('CameraCapture.getCapturePath EXCEPTION: ' + e.message); path = null; } if ((path != null) && isString(path) && (path.length > 0)) { path = path.replace(/\\/g,"/"); } else { path = null; } return path; } this.setCapturePath = function(aPath) // USER API { avDevice.setParameter("outputfile", aPath); } this.getCaptureApplet = function() { return this.captureApplet; } this.getAVDevice = function() { return avDevice; } this.setAVDevice = function(anAVDevice) { if(anAVDevice === null) return; if(! anAVDevice instanceof AVDevice) return; if(avDevice.isCapturing() || avDevice.isPreviewing()){ pendingDevice = anAVDevice; } else{ avDevice = anAVDevice; } } } else //old style direct access { //alert('meCameraCapture.CameraCapture captureApplet: ' + captureApplet + '\n cameraCaptureDocument: ' + cameraCaptureDocument); if ((!captureApplet || (captureApplet == null)) && cameraCaptureDocument) { captureApplet = cameraCaptureDocument; } this.captureApplet = captureApplet; this.setCaptureApplet = function(applet) { // alert('meCameraCapture.setCaptureApplet' + '\n applet: ' + applet + '\n cameraCaptureDocument: ' + cameraCaptureDocument); this.captureApplet = applet; } this.startCapture = function() // USER API { //camCapApp.getInstance().startCapture(); this.getCaptureApplet().ep_startCapture(120); // TODO GLM need to restore previously working method } this.stopCapture = function() // USER API { this.getCaptureApplet().ep_stopCapture(); } this.startPreview = function() // USER API { this.getCaptureApplet().ep_setPreview(true); } this.stopPreview = function() // USER API { this.getCaptureApplet().ep_setPreview(false); } this.getCapturePath = function() // USER API { var path = null; try {path = this.getCaptureApplet().ep_getCapturePath();} catch (e) { alert('CameraCapture.getCapturePath EXCEPTION: ' + e.message); path = null; } if ((path != null) && isString(path) && (path.length > 0)) { path = path.replace(/\\/g,"/"); } else { path = null; } return path; } this.setCapturePath = function(aPath) // USER API { this.getCaptureApplet().ep_setCapturePath(aPath); } this.getCaptureApplet = function() { //alert('meCameraCapture.getCaptureApplet applet: ' + camCapApp.getInstance()); return this.captureApplet; //return camCapApp.getInstance(); } } //alert('meCameraCapture. this: ' + this); CameraCapture.instance = this; } CameraCapture.instance = null; CameraCapture.startCapture = function() { if (CameraCapture.instance != null) { CameraCapture.instance.startCapture(); } else { directorTrace('CameraCapture.startCapture NO INSTANCE'); alert('CameraCapture.startCapture NO INSTANCE'); } } CameraCapture.stopCapture = function() { if (CameraCapture.instance != null) { CameraCapture.instance.stopCapture(); } else { directorTrace('CameraCapture.stopCapture NO INSTANCE'); alert('CameraCapture.stopCapture NO INSTANCE'); } } CameraCapture.startPreview = function() { if (CameraCapture.instance != null) { CameraCapture.instance.startPreview(); } else { directorTrace('CameraCapture.startPreview NO INSTANCE'); alert('CameraCapture.startPreview NO INSTANCE'); } } CameraCapture.stopPreview = function() { if (CameraCapture.instance != null) { CameraCapture.instance.stopPreview(); } else { directorTrace('CameraCapture.stopPreview NO INSTANCE'); alert('CameraCapture.stopPreview NO INSTANCE'); } } CameraCapture.getCapturePath = function() // USER API { if (CameraCapture.instance != null) { return CameraCapture.instance.getCapturePath(); } else { directorTrace('CameraCapture.getCapturePath NO INSTANCE'); alert('CameraCapture.getCapturePath NO INSTANCE'); } } CameraCapture.setCapturePath = function(aPath) // USER API { if (CameraCapture.instance != null) { CameraCapture.instance.setCapturePath(aPath); } else { directorTrace('CameraCapture.stopPreview NO INSTANCE'); alert('CameraCapture.stopPreview NO INSTANCE'); } } CameraCapture.setCaptureApplet = function(applet) { if (CameraCapture.instance != null) { CameraCapture.instance.setCaptureApplet(applet); } else { directorTrace('CameraCapture.setCaptureApplet NO INSTANCE'); alert('CameraCapture.setCaptureApplet NO INSTANCE'); } } function Scene() { var that = this; // acquire parametermanager capabilites this.PMgr = ParameterManager; this.PMgr("general"); var ctx = arguments[0]; this.container = ctx; if( this.container){ if(ControlData == this.container.constructor) { var pLen = arguments.length; var sName,cFromName,ctx,cToName,fromFrame,toFrame; this.nameValidator = function (group, name, _value) { meLogger.write('Scene name Validator Called', 1); if(_value == null || _value == ""){ //return false; var ex = new MeException('Scene => '+ _value + '<= is not a valid scene name'); throw ex; } if(ctx.getScene(_value)) { //meLogger.write('Scene =>' + _value + '<= already exists',3); //return false; var ex = new MeException('Scene =>' + _value + '<= already exists'); throw ex; } else { //meLogger.write('adding scene...' + _value); } meLogger.write('valid scene name is used=>' + _value, 2); return true; } this.fromToClipValidator = function (_group,_name,_value) { if((_name == 'fromClip') || (_name == 'toClip')){ var currentClip = ctx.getClip(_value); if(!(currentClip)) { var ex = new MeException('Clip =>' + _value + '<= does not exist'); throw ex; } try{ var tempToClip = that.getParameter(_group,'toClip'); var tempFromClip = that.getParameter(_group,'fromClip'); if(_name == 'fromClip'){ if ((tempToClip) && (_value != tempToClip)){ if ((currentClip.equals(ctx.getClip(tempToClip))) > 0) { throw new MeException('Clip =>' + _value + ' is after clip =>'+ tempToClip); } } } else if (_name == 'toClip'){ if ((tempFromClip) && (_value != tempFromClip)){ if ((currentClip.equals(ctx.getClip(tempFromClip))) < 0) { throw new MeException('Clip =>' + _value + ' is before clip =>'+ tempFromClip); } } } } catch(e) { //meLogger.write(e.name + ':= ' + e.message, 3); alert("Scene.fromToClipValidator EXCEPTION: " + e.message); throw(e); //return false; } meLogger.write('valid clip name is used=>' + _value, 2); return true; } return false; } //addScene(ctx,name, clipName) //addScene(ctx,name, startingClipName, endingClipName) //addScene(ctx,name, startingClipName, startingFrame, endingClipName,endingFrame) if (pLen == 6) { sName = arguments[1]; cFromName = arguments[2]; fromFrame =arguments[3]; cToName = arguments[4]; toFrame = arguments[5]; try{ this.setProperty('general', 'name', 'validator', this.nameValidator); this.setProperty('general', 'fromClip', 'validator', this.fromToClipValidator); this.setProperty('general', 'toClip', 'validator', this.fromToClipValidator); this.setParameter('general','name', sName); this.setParameter('general','fromClip',cFromName); this.setParameter('general','toClip',cToName); this.setParameter('general','fromFrame', fromFrame); this.setParameter('general','toFrame', toFrame); } catch(e) { meLogger.write(e.name + ':= ' + e.message, 3); throw(e); } } else { throw new MeException('Error initializing Scene object.'); } this.remove = function() { (this.container).removeScene(this); } this.rename = function(_name) { this.setParameter('general','name',_name); } } else { throw new MeException('Scene can not be initialized outside of ControlData context. Error initializing.'); } } else { throw new MeException('Attempting to initialize scene: Error initializing Scene object.'); } this.encodeScene = function () { ; //TODO } this.createDocumentFragment = function (xmlDocument) { xmlDocument = xmlDocument || xutil.getDomDocument(); var fragment = xmlDocument.createDocumentFragment(); var node = xmlDocument.createElement('scene'); node.appendChild(this._createDocumentFragment(xmlDocument)); fragment.appendChild(node); return fragment; }; this.toXML = null; this.toXML = function (xmlDocument) { xmlDocument = xmlDocument || xutil.getDomDocument(); var xmlString = xutil.serializeToString(this.createDocumentFragment(xmlDocument)); return xmlString; } ; } // Supporting classes /** * **/ function SceneCollection(){ this.Col = MeCollection; this.Col(); //Other collection functions go here } function Sdl() { if (typeof Sdl.instance == 'undefined') { Sdl.instance = this; } this.start = function(encoder) { this.encoder = encoder; this.encodeRequest = encoder.getEncodeRequest(); if (Sdl.writer == null) { Sdl.writer = Actor.getSdlWriterActor(); Sdl.writer.addDependent(this); Sdl.writer.addEventRule('sdlWriteComplete','Sdl.writeComplete()'); } if (Sdl.writer.isWriteInProgress()) { directorTrace('Sdl.start write in progress'); this.encoder.setAppletState2('errored'); } else { Sdl.writer.setVideoFile(this.encodeRequest.getParameter('sdlFile')); Sdl.writer.startSdlWriter(); } } } Sdl.writer = null; Sdl.writeComplete = function() { //directorTrace('Sdl.writeComplete'); if (typeof Sdl.instance != 'undefined') { Sdl.instance.encoder.setAppletState2('completed'); } else { directorTrace('Sdl.writeComplete NO INSTANCE'); alert('Sdl.writeComplete NO INSTANCE'); } } Sdl.theInstance = function() { if (typeof Sdl.instance == 'undefined') { new Sdl(); } return Sdl.instance; } var nbrOfContexts = 0; var ctxReady = null; var ctxPlaying = null; var allContextsReady = false; var clipMsgLocalVideo = false; var clipDirectorInitialized = false; function waitForClipDirectorInitialized() { if (clipDirectorInitialized) return; if (!clipDirector || (clipDirector == null)) { // COMMENTED OUT BY DON SMITH -- Replacing with callback from AppletManager //setClipDirector(dr.getInstance()); //alert('meMgmt.waitForClipDirectorInitialized clipDirector: ' + clipDirector); setTimeout('waitForClipDirectorInitialized()',2000); return; } // alert('meMgmt.waitForClipDirectorInitialized clipDirector DEFINED'); // directorTrace('meMgmt.waitForClipDirectorInitialized clipDirector DEFINED'); var tmp; var i = 0; try { if (nbrOfContexts == 0) { tmp = parseInt(clipDirector.ep_invokeAndWait('1,,ep_getMaxContextIndex')); if ((typeof tmp == "undefined") || (tmp === 0)) { setTimeout('waitForClipDirectorInitialized()',500); return; } directorTrace('meMgmt.waitForClipDirectorInitialized nbrOfContexts: ' + tmp); nbrOfContexts = tmp; } if (ctxReady === null) ctxReady = new Array(nbrOfContexts+1); if (ctxPlaying === null) ctxPlaying = new Array(nbrOfContexts+1); //setTimeout('waitForAllContextsReady()',1000); } catch(err) { alert('waitForClipDirectorInitialized EXCEPTION: ' + err.description); setTimeout('waitForClipDirectorInitialized()',1000); } clipDirectorInitialized = true; // directorTrace('meMgmt.waitForClipDirectorInitialized INITIALIZED'); } var monitorsStarted = false; function waitForAllContextsReady() { if (!clipDirectorInitialized) { directorTrace('meMgmt.waitForAllContextsReady clipDirector not initialized'); setTimeout('waitForAllContextsReady()',2000); return; } //try { waitForAllContextsReady2(); } //catch(err) //{ //directorTrace('waitForAllContextsReady EXCEPTION: ' + err.description); //setTimeout('waitForAllContextsReady()',1000); //} } function waitForAllContextsReady2() { var actorName = ""; var isPrimary = ""; var ctxIsPlaying = ""; var waitForView = ""; var isAutoplay = ""; var allSegmentsReady = ""; var i = 0; var allReady = true; for (i = 1; i <= nbrOfContexts; i++) { if (!ctxReady[i]) { isPrimary = clipDirector.ep_invokeAndWait(i.toString() + ',,ep_isPrimary'); ctxIsPlaying = isPlaying(i) ? 'true' : 'false'; waitForView = clipDirector.ep_invokeAndWait(i.toString() + ',,ep_isWaitForView'); isAutoplay = clipDirector.ep_invokeAndWait(i.toString() + ',,ep_isAutoplay'); allSegmentsReady = clipDirector.ep_invokeAndWait(i.toString() + ',,ep_areAllSegmentsReady'); if (false) { directorTrace('meMgmt.waitForAllContextsReady2' + '\n i: ' + i + '\n isPrimary: ' + isPrimary + '\n ctxIsPlaying: ' + ctxIsPlaying + '\n waitForView: ' + waitForView + '\n isAutoplay: ' + isAutoplay + '\n allSegmentsReady: ' + allSegmentsReady); } // check status of primaries if (isPrimary == 'true') { if ((ctxIsPlaying == 'true') || ((isAutoplay == 'false') && (allSegmentsReady == 'true'))) { if (waitForView == 'true') { // if (!isMsgActor(i)) { //directorTrace('waitForAllContextsReady make primary actor visible. Context:' + i); getActorByIndex(i).invoke('readyToPlay','readyToPlay;meMgmt'); // actorName = clipDirector.ep_invokeAndWait(i.toString() + ',,ep_getActorName'); // document.getElementById(actorName).style.visibility = "visible"; } } ctxReady[i] = true; } else { allReady = false; } continue; } // check status of secondaries if ( (ctxIsPlaying == 'true') || ((waitForView == 'false') && (allSegmentsReady == 'true')) || ((waitForView == 'true') && (allSegmentsReady == 'true') && (isAutoplay == 'false')) ) { // if (waitForView == 'true') // { // if (!isMsgActor(i)) // { // getActorByIndex(i).invoke('readyToPlay','readyToPlay;meMgmt'); // directorTrace('waitForAllContextsReady make secondary actor visible. Context: ' + i + ' actor: ' + actorName); // actorName = clipDirector.ep_invokeAndWait(i.toString() + ',,ep_getActorName'); // document.getElementById(actorName).style.visibility = "visible"; // } // } ctxReady[i] = true; if (chatOnly) allReady = true; continue; } allReady = false; } // if (!ctxReady[i]) } // for if (!allReady) { setTimeout('waitForAllContextsReady()',1000); return; } if ((typeof processMainMouseClicksEnabled === 'undefined') ||processMainMouseClicksEnabled) { // directorTrace('meMgmt.waitForAllContextsReady enable mouse click events'); for (i = 1; i <= nbrOfContexts; i++) { enableMouseClickEvents(i,'true'); // clipDirector.ep_invoke(i + ',,ep_enableMouseClickEvents,true'); } } for (i = 1; i <= nbrOfContexts; i++) { if (clipDirector.ep_invokeAndWait(i.toString() + ',,ep_isSecondary')) { getActorByIndex(i).invoke('readyToPlay','readyToPlay;meMgmt'); } } allContextsReady = true; //directorTrace('allContextsReady: ' + allContextsReady); if (!monitorsStarted) { // directorTrace('meMgmt.waitForAllContextsReady start monitors'); setTimeout('clipMonitor()',250); setTimeout('auditCtxPlaying()',5000); setTimeout('checkForMsgWaiting()',2000); monitorsStarted = true; } clipMsgLocalVideo = isClipLocal(); // directorTrace('meMgmt.waitForAllContextsReady READY'); // dumpStringList(getClipDescriptorList()); dumpCda(); } var lastSeg = 0; function clipMonitor() { var eventDescriptor = ''; // try // { for (var i = 1; i <= nbrOfContexts; i++) { while ((eventDescriptor = clipDirector.ep_invokeAndWait(i.toString() + ',,ep_removeEvent')) != 'null') { invoke(eventDescriptor.split(";",1),i,eventDescriptor); } } setTimeout('clipMonitor2()',200); // } // catch(err) // { // directorTrace('clipMonitor EXCEPTION: ' + err.description + '\n eventDescriptor: ' + eventDescriptor); // setTimeout('clipMonitor()',1000); // } } function clipMonitor2() { var eventDescriptor; var eventFound = true; var eventCtr = 0; while (eventFound) { eventFound = false; for (var i = 1; i <= nbrOfContexts; i++) { eventDescriptor = clipDirector.ep_invokeAndWait(i.toString() + ',,ep_removeEvent'); if (eventDescriptor != 'null') { //directorTrace('meMgmt.clipMonitor2 eventDescriptor: ' + eventDescriptor); eventFound = true; eventCtr++; invoke(eventDescriptor.split(";",1),i,eventDescriptor); } } } //if (eventCtr > 0) directorTrace('clipMonitor2' + ' eventCtr: ' + eventCtr); setTimeout('clipMonitor2()',200); } var eventDescriptorSplit = ''; var segFrameSplit = ''; var transitionRequested = true; function auditCtxPlaying() { var status = false; if (allContextsReady) { if (transitionRequested) { setTransitionRequested(false); } else { try { for (var i = 1; i <= nbrOfContexts; i++) { if (isAuditPlayState(i)) { status |= coerceCtxPlayState(i); } } } catch(err) { directorTrace('auditCtxPlaying EXCEPTION: ' + err.description); } if (!status) { status = auditAllActors(); } if (status) setTransitionRequested(true); } } setTimeout('auditCtxPlaying()',2000); } function coerceCtxPlayState(ctxId) { var status = false; if (allContextsReady) { // if (!isMsgActor(ctxId)) if (isAuditPlayState(ctxId)) { if (isContextIdle(ctxId)) { if (isContextPlaying(ctxId)) { if (!ctxPlaying[ctxId]) { pauseContext(ctxId); status = true; } } else { if (ctxPlaying[ctxId]) { if (!isPlayFromToStarting(ctxId)) { // directorTrace('meMgmt.coerceCtxPlayState play: ' + ctxId); playContext(ctxId); status = true; } } } } else { // directorTrace('meMgmt.coerceCtxPlayState ctxId not idle: ' + ctxId); } } } return status; } function isContextPlaying(ctxId) { if (!isPlaying(ctxId)) { return false; } return (clipDirector.ep_invokeAndWait(ctxId + ',,ep_isPaused') == 'false'); } function playActor(ctxId,actorName) { if (allContextsReady) { clipDirector.ep_invoke(',' + actorName + ',ep_requestPlay'); setCtxPlaying(ctxId,true); } else { directorTrace('meMgmt.playActor ctxId: ' + ctxId + ' actorName: ' + actorName + ' BLOCKED'); } } function pauseActor(ctxId,actorName) { clipDirector.ep_invoke(',' + actorName + ',ep_requestPause'); setCtxPlaying(ctxId,false); } function switchContext(actorName,fromCtx,toCtx) { clipDirector.ep_invoke(',' + actorName + ',ep_switchContext,' + toCtx); setCtxPlaying(toCtx,true); setCtxPlaying(fromCtx,false); } function playClip(ctxId,vUrl,aUrl) { // directorTrace('meMgmt.playClip' + '\n ctxId: ' + ctxId + '\n vUrl: ' + vUrl + '\n aUrl: ' + aUrl); try { clipDirector.ep_invoke(ctxId + ',,ep_playClip,' + vUrl + ',' + aUrl); setCtxPlaying(ctxId,true); } catch(err) { directorTrace('playClip EXCEPTION: ' + err.description); } } function playClipWithSdl(ctxId,vUrl,aUrl,anSdl) { try { playClipFromTo(ctxId,1,0,-1,-1,false,anSdl); setCtxPlaying(ctxId,true); } catch(err) { directorTrace('playClip EXCEPTION: ' + err.description); } } function playClipFromTo(ctxId,fromSeg,fromFrame,toSeg,toFrame,pauseAtEnd,sdl) { try { clipDirector.ep_invoke(ctxId + ',,ep_playClipFromTo,' + fromSeg + ',' + fromFrame + ',' + toSeg + ',' + toFrame + ',' + pauseAtEnd + ',' + sdl); setCtxPlaying(ctxId,true); } catch(err) { directorTrace('playClipFromTo EXCEPTION: ' + err.description); } } function bufferClipFromTo(ctxId,fromSeg,fromFrame,toSeg,toFrame,pauseAtEnd,sdl) { try { clipDirector.ep_invoke(ctxId + ',,ep_bufferClipFromTo,' + fromSeg + ',' + fromFrame + ',' + toSeg + ',' + toFrame + ',' + pauseAtEnd + ',' + sdl); setCtxPlaying(ctxId,false); } catch(err) { directorTrace('bufferClipFromTo EXCEPTION: ' + err.description); } } function pauseContext(ctxId) { clipDirector.ep_invoke(ctxId + ',,ep_requestPause'); if (!isMsgActor(ctxId)) { setCtxPlaying(ctxId,false); } setTransitionRequested(true); } function playContext(ctxId) { if (allContextsReady) { // directorTrace('meMgmt.playContext ctxId: ' + ctxId); clipDirector.ep_invoke(ctxId + ',,ep_requestPlay'); if (!isMsgActor(ctxId)) { setCtxPlaying(ctxId,true); } setTransitionRequested(true); } else { directorTrace('meMgmt.playContext ctxId: ' + ctxId + ' BLOCKED'); } } function stopContext(ctxId) { clipDirector.ep_invoke(ctxId + ',,ep_stop'); if (!isMsgActor(ctxId)) { setCtxPlaying(ctxId,false); } setTransitionRequested(true); } function isPlayFromToStarting(ctxId) { return false; //return (clipDirector.ep_invokeAndWait(ctxId + ',,ep_isPlayFromToStarting') == 'true'); } function directorTrace(traceText) { if (_TRACE && clipDirector && (clipDirector != null)) { try {clipDirector.ep_invoke('1,,ep_trace,' + '[JAVASCRIPT][' + getTicks() + '] ' + traceText);} //try {clipDirector.ep_trace_('[JAVASCRIPT][' + getTicks() + '] ' + traceText);} catch(err) { alert('directorTrace EXCEPTION: ' + err.description + '\n traceText: ' + traceText + '\n clipDirector: ' + clipDirector); } } } var nextMsgClip = ''; var makeMsgDivVisible = true; var msgImageDisplayed = false; function checkForMsgWaiting() { if (msgsEnabled) { if (!ctxFullScreenMode && allContextsReady) { var actorName = ''; if (isMsgWaiting()) { // if (makeMsgDivVisible && msgImageDisplayed) if (msgImageDisplayed) { // actorName = clipDirector.ep_invokeAndWait(cidMsg + ',,ep_getActorName'); // document.getElementById(actorName).style.visibility = "visible"; getActorByIndex(cidMsg).show(); makeMsgDivVisible = false; } if (isContextPlaying(cidMsg)) { showMsgDiv(); } else { hideMsgDiv(); displayImage(cidMsg,msgWaitingImageSpec); } } else { if (!isContextPlaying(cidMsg)) { hideMsgDiv(); displayImage(cidMsg,stoppedImageSpec); } } } setTimeout('checkForMsgWaiting()',2000); } } function deleteMsg() { directorTrace('deleteMsg segmentNumber: ' + cidMsgSegmentNumber); stopMsg(); db_delete(cidMsgSegmentNumber); nextMsgClip = ''; } var cidMsgSegmentNumber = 1; function isMsgWaiting() { if ((nextMsgClip.length == 0) || clipMsgLocalVideo) { if (clipMsgLocalVideo && (clipMsgDefaultNextMsg.length > 0)) { if (doesUrlExist(cidMsg,clipMsgDefaultNextMsg + "video_s1.dat")) { nextMsgClip = clipMsgDefaultNextMsg; } else { nextMsgClip = ''; } } } return (nextMsgClip.length > 0); } function showMsgDiv() { if (!clipMsgLocalVideo) { hide('recordstartdiv'); show('deletemsgdiv'); } if (isMsgWaiting()) { // var actorName = clipDirector.ep_invokeAndWait(cidMsg + ',,ep_getActorName'); // document.getElementById(actorName).style.visibility = "visible"; getActorByIndex(cidMsg).show(); makeMsgDivVisible = false; } } function hideMsgDiv() { return; if (!clipMsgLocalVideo) { hide('deletemsgdiv'); show('recordstartdiv'); } if (!isMsgWaiting()) { // var actorName = clipDirector.ep_invokeAndWait(cidMsg + ',,ep_getActorName'); // document.getElementById(actorName).style.visibility = "hidden"; getActorByIndex(cidMsg).hide(); makeMsgDivVisible = true; change_message(''); } else { change_message('Video Messaging'); } } function getNbrOfSegments(ctxId) { return parseInt(clipDirector.ep_invokeAndWait(ctxId + ',,ep_getNbrOfSegments')); } function setCtxPlaying(ctxId,state) { setTransitionRequested(true); ctxPlaying[ctxId] = state; } function stopMsg() { stopContext(cidMsg); hideMsgDiv(); } function coerceAfterStop(ctxId) { return; directorTrace('meMgmt.coerceAfterStop ctxId: ' + ctxId); eval('restartAfterStop=restartClosure(' + ctxId + '); setTimeout(restartAfterStop,1000)'); setTransitionRequested(true); } function setTransitionRequested(state) { transitionRequested = state; //directorTrace('setTransitionRequested: ' + transitionRequested); } var ctxFullScreenMode = false; function isCtxFullScreenMode() {return ctxFullScreenMode;} var restartAtInProgressTicks = 0; var restartAtStatus = false; function restartAtInProgress(ctxId,eventDescriptor) { restartAtInProgressTicks = getTicks() + 5000; restartAtStatus = true; } function restartAtComplete(ctxId,eventDescriptor) { restartAtStatus = false; restartAtInProgressTicks = 0; } function isRestartAtInProgress() { if (getTicks() > restartAtInProgressTicks) { restartAtStatus = false; } return restartAtStatus; } var msbStartTicks = (new Date()).getTime(); function getTicks() { var time = new Date(); var ticks = time.getTime(); if (msbStartTicks == 0) { msbStartTicks = ticks; } return ticks - msbStartTicks; } function restartClosure(ctxId) {return (function() {coerceCtxPlayState(ctxId);});} var restartAfterStop = null; function isMousePresent(ctxId) { return (clipDirector.ep_invokeAndWait(ctxId + ',,ep_isMousePresent') == 'true'); } function doesUrlExist(ctxId, urlSpec) { return (clipDirector.ep_invokeAndWait(ctxId + ',,ep_doesUrlExist,' + urlSpec) == 'true'); } function invoke(event,ctxId,eventDescriptor) { // try // { var anActor = getActorByIndex(ctxId); if ((anActor !== null) && (event != 'invoke')) { anActor.invoke(event,eventDescriptor); } // } // catch(err) // { // directorTrace('meMgmt.invoke EXCEPTION: ' + err.description + '\n event: ' + event + ' ctxId: ' + ctxId + ' eventDescriptor: ' + eventDescriptor); // } } function displayImage(ctxId,imageUrl) { clipDirector.ep_invoke(ctxId + ',,ep_displayImage,' + imageUrl); } function switchClip(actorName,fromHandle,toHandle) { var anActor = getActorByName(actorName); if (anActor !== null) { anActor.switchClip(actorName,fromHandle,toHandle); } } function getViewCtxId(actorName) { return (clipDirector !== null) ? (clipDirector.ep_invokeAndWait(',' + actorName + ',ep_getCurrentCtxId')) : 0; } function enableMouseClickEvents(ctxId,state) { clipDirector.ep_invoke(ctxId.toString() + ',,ep_enableMouseClickEvents,' + state); } function getPosition(ctxId,actorName) { return (clipDirector.ep_invokeAndWait(ctxId + ',' + actorName + ',ep_getPosition')); } function getLastSliderPosition(ctxId,actorName) { return (clipDirector.ep_invokeAndWait(ctxId + ',' + actorName + ',ep_getLastSliderPosition')); } function preload() { jActorInit(0,'preload',0,0,'preload'); } function beep() { if (clipDirector !== null) { clipDirector.ep_invoke('1,,ep_beep'); } } function clearEventQueue(ctxId) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_clearEventQueue'); } function abortContext(ctxId) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_abort'); if (!isMsgActor(ctxId)) { setCtxPlaying(ctxId,false); } setTransitionRequested(true); } function resetAllClips() { clipDirector.ep_invokeAndWait('1,,ep_resetAllClips'); } function isContextIdle(ctxId) { return (clipDirector != null) ? (clipDirector.ep_invokeAndWait(ctxId + ',,ep_isTransitionInProgress') == 'false') : true; } function clearInvokeQueue(ctxId) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_clearInvokeQueue'); } function isContextRestarting(ctxId) { return (clipDirector != null) ? (clipDirector.ep_invokeAndWait(ctxId + ',,ep_isRestarting') == 'true') : false; } function isContextSwitching(ctxId) { return (clipDirector.ep_invokeAndWait(ctxId + ',,ep_isContextSwitching') == 'true'); } function isPlaying(ctxId) { return (clipDirector.ep_invokeAndWait(ctxId + ',,ep_isPlaying') == 'true'); } function playing(ctxId) { return (clipDirector.ep_invokeAndWait(ctxId + ',,ep_playing') == 'true'); } function clearBackground(ctxId) { clipDirector.ep_invoke(ctxId + ',,ep_clearBackground'); } function resetContext(ctxId) { if (clipDirector != null) { clipDirector.ep_invoke(ctxId + ',,ep_reset'); } } function isContextStopped(ctxId) { return (clipDirector != null) ? (clipDirector.ep_invokeAndWait(ctxId + ',,ep_isStopped') == 'true') : true; } function getVideoFps(ctxId) { return parseInt(clipDirector.ep_invokeAndWait(ctxId + ',,ep_getVideoFps')); } function getLastRawRecNum(ctxId,segment) { var lrn = clipDirector.ep_invokeAndWait(ctxId + ',,ep_getLastRawRecNum,' + segment); // directorTrace('meMgmt.getLastRawRecNum' + // ' ctxId: ' + ctxId + // ' segment: ' + segment + // ' lastRawRecNum: ' + lrn); return parseInt(lrn); } function getLastRecNum(ctxId,segment) { return clipDirector.ep_invokeAndWait(ctxId + ',,ep_getLastRecNum,' + segment); } function getRecNumRatio(ctxId,segment) { var actualAndRawRecNum = getLastRecNum(ctxId,segment); // directorTrace('meMgmt.getRecNumRatio' + ' ctxId: ' + ctxId + ' segment: ' + segment + ' actualAndRaw: ' + actualAndRawRecNum); var actualRecNum = parseInt(actualAndRawRecNum.split(',')[0]); var rawRecNum = parseInt(actualAndRawRecNum.split(',')[1]); var ratio = 1; if (actualRecNum > 0) { ratio = rawRecNum/actualRecNum; } // directorTrace('meMgmt.getRecNumRatio' + ' ctxId: ' + ctxId + ' segment: ' + segment + ' actualAndRaw: ' + actualAndRawRecNum + ' actual: ' + actualRecNum + ' raw: ' + rawRecNum + ' ratio: ' + ratio); return ratio; } function isClipLocal() { return (location.href.indexOf('file:') != -1); //alert('meMgmt.isClipLocal clipDirector: ' + clipDirector); //return (clipDirector != null) ? (clipDirector.ep_invokeAndWait('1,,ep_isClipLocal') == 'true') : false; } function AppletManager() { var that = this; var queue = new Array(); var state = "blocked" ; var processqueuetimeout = null; var appletlist = new Array(); this.eventapplets = new Array(); this.appfolder = 'EspreLive'; 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")); var child = document.getElementById(this.getProperty("applets",_name,"positionElement")); parent.removeChild(child); } var container = document.getElementById(this.getProperty("applets",_name,"containerElement")); document.body.removeChild(container); if(typeof that.getProperty("applets",_name,"validator") != "undefined") { clearInterval(that.getProperty("applets",_name,"validator")); } this.removeParameter("applets",_name); } catch (err) { alert("AppletManager.destroyApplet EXCEPTION: " + err.message); return false; } return true; } this.setDisplay = function(applet_name, display) { this.setProperty("applets",applet_name,"display",display); } this.getDisplay = function(applet_name) { return this.getProperty("applets",applet_name,"display"); } this.setVisibility = function(applet_name, visible) { this.setProperty("applets",applet_name,"visible",visible); } this.getVisibility = function(applet_name) { return this.getProperty("applets",applet_name,"visible"); } 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).height = height; //this.getApplet(applet_name).width = width; this.getApplet(applet_name).ep_setSize(width,height); this.validateLater(applet_name); } this.setHeight = function(applet_name, height) { //this.setProperty("applets",applet_name,"height",height); //this.getApplet(applet_name).height = height; this.resize(applet_name,this.getProperty("applets",applet_name,"width"),height); } this.setWidth = function(applet_name, width) { //this.setProperty("applets",applet_name,"width",width); //this.getApplet(applet_name).width = width; this.resize(applet_name,width, this.getProperty("applets",applet_name,"height")); } //Function to retrieve the height this.getHeight = function(applet_name) { return this.getProperty("applets",applet_name,"height"); } //Function to retrieve the Width this.getWidth = function(applet_name) { return this.getProperty("applets",applet_name,"width"); } function processQueue() { 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; } state = 'busy'; var name = queue.shift(); var appspec1 = that.getProperty("applets",name,"appletspec"); that.setProperty("applets",name,"positionElement",that.getUniqueElementID()); that.setProperty("applets",name,"containerElement",that.getUniqueElementID()); 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("metag"); containerElement.id = that.getProperty("applets",name,"containerElement"); document.body.appendChild(containerElement); containerElement.style.position = "absolute"; containerElement.style.top = -(that.getHeight(name) - 1); containerElement.style.left = -(that.getWidth(name) -1); if (typeof that.getProperty("applets",name,"targetTag") != "undefined") { if (document.getElementById(that.getProperty("applets",name,"targetTag")) == null) {alert('AppletManager.processQueue cannot find element name: ' + name);return;} var positionElement = document.createElement("div"); positionElement.id = that.getProperty("applets",name,"positionElement"); document.getElementById(that.getProperty("applets",name,"targetTag")).appendChild(positionElement); if (that.getDisplay(name)) { positionElement.style.height = that.getHeight(name) + "px"; positionElement.style.width = that.getWidth(name) + "px"; } else { positionElement.style.height = "0px"; positionElement.style.width = "0px"; } } 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); setTimeout("AppletManager.theInstance().doCallback('" + name + "');",100); this.getApplet(name).height = this.getHeight(name); this.getApplet(name).width = this.getWidth(name); var containerElement = document.getElementById(that.getProperty("applets",name,"containerElement")); var appspec1 = that.getProperty("applets",name,"appletspec"); containerElement.style.top = -(appspec1.getParameter("height") + 10); containerElement.style.left = -(appspec1.getParameter("width") + 10); if (typeof that.getProperty("applets",name,"targetTag") != "undefined") { MeAddEvent(window, 'resize', function() { AppletManager.theInstance().validateLater(name);}); var positionElement = document.getElementById(that.getProperty("applets",name,"positionElement")); setEvents(positionElement,name); this.eventapplets[this.eventapplets.length] = name; this.setProperty("applets",name,"validatestatus",false); /* if (containerElement.style.setExpression) { var positionElement = document.getElementById(that.getProperty("applets",name,"positionElement")); positionElement.onmove = "AppletManager.theInstance().validate('" + name + "');"; positionElement.onpropertychange = "AppletManager.theInstance().validate('" + name + "');"; positionElement.onlayoutcomplete = "AppletManager.theInstance().validate('" + name + "');"; } else { var tm = setInterval("AppletManager.theInstance().validate('" + name + "')",1000); that.setProperty("applets",name,"validator",tm); } */ } state = "idle"; if (processqueuetimeout == null) { setTimeout(function() { processQueue()},100);} } else { //Error Condition } } this.doCallback = function(name) { if (this.getProperty("applets",name,"callback") !== null) { this.getProperty("applets",name,"callback")(this.getApplet(name)); } } this.getApplet = function (name) { var id = this.getProperty("applets",name,"appletID"); if (id != '') { if((instance = eval("document." + id))) { } else if (document.all) { instance = document.all(id); } else if (document.getElementById) { instance = document.getElementById(id); } return instance; } else { return false; } } this.getUniqueElementID = function () { var tmp = ""; do { tm = new Date(); //hex_md5() - From md5.js (JavaScript File) tmp = "div" + hex_md5(String((Math.random()) * tm.getTime())); } while(document.getElementById(tmp)); return tmp; } this.getAbsoluteLeft = function(objectId) { // Get an object left position from the upper left viewport corner // Tested with relative and nested objects o = document.getElementById(objectId) oLeft = o.offsetLeft // Get left position from the parent object if (o.offsetParent !== null) { while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element oParent = o.offsetParent // Get parent object reference if (o.clientLeft) { oLeft += oParent.offsetLeft + o.clientLeft; } else { oLeft += oParent.offsetLeft // Add parent left position } o = oParent } // Return left postion return oLeft; } else { return "error"; } } this.getAbsoluteTop = function(objectId) { // Get an object top position from the upper left viewport corner // Tested with relative and nested objects o = document.getElementById(objectId) oTop = o.offsetTop // Get top position from the parent object if (o.offsetParent !== null) { while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element oParent = o.offsetParent // Get parent object reference if (o.clientTop) { oTop += oParent.offsetTop + o.clientTop // Add parent top position } else { oTop += oParent.offsetTop // Add parent top position } o = oParent } // Return top position return oTop; } else { } return "error"; } this.validate = function() { var applet_name; if (arguments.length == 1) { applet_name = arguments[0]; if (typeof this.getParameter(applet_name) != "undefined") { var positionElementID = this.getProperty("applets",applet_name,"positionElement"); var containerElementID = this.getProperty("applets",applet_name,"containerElement"); var positionElement = document.getElementById(positionElementID); var containerElement = document.getElementById(containerElementID); var state = 'visible'; if (this.getDisplay(applet_name) == false) { state = 'hidden'; } else if (this.getVisibility(applet_name) == false) { state = 'none'; } else if (getElementDisplay(positionElement) == false) { state = 'none'; } else if (getStyle(positionElement,"visibility") != "visible") { state = 'hidden'; } //debugout("AppletManager.validate('" + applet_name + "')","","state: " + state); if (state == 'visible') { var positionElement = document.getElementById(positionElementID); var containerElement = document.getElementById(containerElementID); positionElement.style.height = this.getHeight(applet_name) + "px"; positionElement.style.width = this.getWidth(applet_name) + "px"; var atop = this.getAbsoluteTop(positionElementID); var aleft = this.getAbsoluteLeft(positionElementID); if (!isNaN(atop)) { containerElement.style.top = atop; } if (!isNaN(aleft)) { containerElement.style.left = aleft; } positionElement.style.height = this.getHeight(applet_name) + "px"; positionElement.style.width = this.getWidth(applet_name) + "px"; } else if (state == 'hidden') { containerElement.style.top = -(this.getHeight(applet_name) + 10); containerElement.style.left = -(this.getWidth(applet_name) + 10); positionElement.style.height = this.getHeight(applet_name) + "px"; positionElement.style.width = this.getWidth(applet_name) + "px"; } else if (state == 'none') { containerElement.style.top = -(this.getHeight(applet_name) + 10); containerElement.style.left = -(this.getWidth(applet_name) + 10); positionElement.style.height = "0px"; positionElement.style.width = "0px"; } setTimeout("AppletManager.theInstance().setValidateStatus('" + applet_name + "',false)",1); } } else { //alert(this.eventapplets.join('|')); /* try { for(var i = 0;i < this.eventapplets.length - 1;i++) { setTimeout("AppletManager.theInstance().validateLater('" + this.eventapplets[i] + "')",500); } return true; } catch(e) { return false; } */ } } function getStyle(el,styleProp) { var x = el; if (x.currentStyle) var y = x.currentStyle[styleProp]; else if (window.getComputedStyle) var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); //window.status = styleProp + ' = ' + y; if (y == "inherit") { y = getStyle(x.parentNode,styleProp); } return y; } function getElementDisplay(el) { var display = true; while(el.parentNode) { if (el.currentStyle) { if (el.currentStyle['display'] == 'none') { display = false; } } else if (window.getComputedStyle) { if (document.defaultView.getComputedStyle(el,null).getPropertyValue('display')){ display = false; } } if (!display) { break; } el = el.parentNode; } return display; } function setEvents(el,name) { while(el.parentNode) { // Parse the parent hierarchy up to the document element MeAddEvent(el, 'propertychange', function() { AppletManager.theInstance().validateLater(name); } ); if (el.onresizeend) { MeAddEvent(el, 'resizeend', function() { AppletManager.theInstance().validateLater(name); } ); } else { MeAddEvent(el, 'resize', function() { AppletManager.theInstance().validateLater(name); } ); } var sib = el.nextSibling; while(sib) { MeAddEvent(sib, 'propertychange', function() { AppletManager.theInstance().validateLater(name); } ); if (el.onresizeend) { MeAddEvent(el, 'resizeend', function() { AppletManager.theInstance().validateLater(name); } ); } else { MeAddEvent(el, 'resize', function() { AppletManager.theInstance().validateLater(name); } ); } sib = sib.nextSibling; } elParent = el.parentNode // Get parent object reference el = elParent } return true; } this.validateLater = function(name) { if (this.getDisplay(name) == true || this.getVisibility(name) == true) { if (this.getValidateStatus(name) === false) { this.setValidateStatus(name,true); setTimeout("AppletManager.theInstance().validate('" + name + "');",1); } } } this.getValidateStatus = function(name) { return this.getProperty("applets",name,"validatestatus"); } this.setValidateStatus = function(name,status) { this.setProperty("applets",name,"validatestatus",status); } } // 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');}); 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.http = HttpRequest; this.http(); var uploadApplet = null; // *** 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 this.createNamespace = function (_namespace) { if (url != null) { var response = this.sendRequest("GET", url, Array("action=createNamespace","name=" + _namespace), false); if (response != "" && response != null) { try { return JSON.parse(response)['ACTIONSTATUS']; } catch(err) { alert("HostingAgent.createNamespace EXCEPTION: " + err.message); return false; } } else { return false; } } else { return false; } } // function renameNamespace (currentName,newName) this.renameNamespace = function () { var curName; var newName; if (arguments.length == 1) { curName = namespace; newName = arguments[0]; } else if (arguments.length == 2) { curName = arguments[0]; newName = arguments[1]; } else { return false; } if (url != null) { var response = this.sendRequest("GET", url, Array("action=renameNamespace","name=" + curName,"newname=" + newName), false); if (response != "" && response != null) { try { return JSON.parse(response)['ACTIONSTATUS']; } catch(err) { alert("HostingAgent.renameNamespace EXCEPTION: " + err.message); return false; } } else { return false; } } else { return false; } } // function deleteNamespace this.deleteNamespace = function () { var ns = ""; if (arguments.length == 1) { ns = arguments[0]; } else if (arguments.length == 0) { ns = this.getNamespace(); } if (url != null) { var response = this.sendRequest("GET", url,Array("action=deleteNamespace","name=" + ns), false); if (response != "" && response != null) { try { return JSON.parse(response)['ACTIONSTATUS']; } catch(err) { alert("HostingAgent.deleteNamespace EXCEPTION: " + err.message); return false; } } else { return false; } } else { return false; } } // TODO: NOT YET IMPELMENTED this.getMaxPostSize = function (_size) { return maxSize; } // TODO: NOT YET IMPELMENTED this.setMaxPostSize = function (_size) { if (isNaN(_size) || (_size > 1024)) { return false; } else { maxSize = _size; } } this.deleteProject = function () { var _path = ''; var ns = ''; if (arguments.length == 1) { _path = arguments[0]; ns = this.getNamespace(); } else if (arguments.length == 2) { ns = arguments[0]; _path = arguments[1]; } else { return false; } if (url != null) { target = url + ns + "/" + _path + "/"; var response = this.sendRequest("GET", target, Array("action=deleteProject"), false); if (response != "" && response != null) { try { return JSON.parse(response)['ACTIONSTATUS']; } catch(err) { alert("HostingAgent.deleteProject EXCEPTION: " + err.message); return false; } } else { return false; } } else { return false; } } // function renameProject this.renameProject = function () { var ns = ''; var newPath = ''; var oldPath = ''; if (arguments.length == 2) { oldPath = arguments[0]; newPath = arguments[1]; ns = this.getNamespace(); } else if (arguments.length == 3) { ns = arguments[0]; oldPath = arguments[1]; newPath = arguments[2]; } else { return false; } if (url != null) { target = url + ns + "/" + oldPath + "/"; var response = this.sendRequest("GET", target, Array("action=renameProject","newpath=" + newPath), false); if (response != "" && response != null) { try { return JSON.parse(response)['ACTIONSTATUS']; } catch(err) { alert("HostingAgent.renameProject EXCEPTION: " + err.message); return false; } } else { return false; } } else { return false; } } this.upload = function (_uploadRequest) { meLogger.write("Hosting Agent upload called."); if (!_uploadRequest) {return false;}; // empty upload request rejected!! if (url != null) { if (uploadApplet == null && tm == null) { var appSpec = new AppletSpec("uploader"); appSpec.setParameter("name","uploadApplet"); appSpec.setParameter("visible",false); AppletManager.theInstance().startApplet(appSpec,setAppletReadyState); } //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 } } function setAppletReadyState(applet) { uploadApplet = applet; //alert(uploadApplet); setState('idle'); } function processQueue() { tm = null; meLogger.write("ProcessQueue: " + state); if (state == 'blocked') { tm = setTimeout(processQueue,50); return; } else if (state == '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); setState("uploading"); uploadApplet.ep_upload(target,files,params); meLogger.write('Upload started ....'); queryState(); //uploadApplet.ep_upload("http://sandbox2.espre.local:9002/hosting/test/jvo/","C:/Documents and Settings/jvo.ESPRE/eViewEngine/video.dat","action,upload"); } // add callback functions for status, progress, etc. function queryState() { uploadTimeout = null; var currentState = uploadApplet.ep_getUploadState(); meLogger.write("Query State: " + currentState + " " + that.getProgress() + "%"); if (currentState == "uploading") { uploadRequest.updateProgress(that.getProgress()); uploadTimeout = window.setTimeout(queryState,500); return; } if (currentState == "completed") { uploadRequest.updateProgress(that.getProgress()); setState(currentState); uploadRequest = null; } else if (currentState == "errored") { uploadRequest.setErrors(that.getErrors()); uploadRequest.updateProgress(that.getProgress()); setState(currentState); uploadRequest = null; } } this.getProgress = function(){ if(state == "uploading") { return (uploadApplet.ep_getProgress()); } if(state == "completed") return 100; return 0; } this.getErrors = function(){ if(state == "errored") return uploadApplet.ep_getErrors(); return ""; } this.isCompleted = function(){ if(uploadRequest == null && state == "completed") return true; return false; } this.isUploading = function(){ if(uploadRequest != null) return true; return false; } this.isError = function(){ if(uploadRequest == "errored") return true; return false; } //************************************************ /* this.getHostingInfo = function () { if (url === null) return false; param = new Array("action=query","ns.where.name==*","ns.columns=*","ns.created.show=true"); this.sendRequest("POST", url, param, "undefined", false); return this.responseText.parseJSON(); //return this.responseText; // for testing } this.getHostingInfoDetail = function () { if (url === null) return false; if (_namespace != null) { param = new Array("action=query","ns.where.name==*","ns.columns=*","ns.create.show=true","ns.detail.show=true"); } else { param = new Array("action=query","","ns.columns=*","ns.create.show=true","ns.detail.show=true"); } this.sendRequest("POST", url, param, "undefined", false); return this.responseText.parseJSON(); //return this.responseText; // for testing } */ this.getNamespaceList = function () { if (url === null) return false; var response = this.sendRequest("GET", url, Array("action=query","ns.columns=name"), false); if (response != "" && response != null) { try { var data = JSON.parse(response); if (data['ACTIONSTATUS'] == true) { return data['RESPONSEDATA']; } else { return null; } } catch(err) { alert("HostingAgent.getNamespaceList EXCEPTION: " + err.message); return null; } } else { return null; } } //getNamespaceInfo(String name) ?? should be namespace list? //the request to the server needs to look like this: //param = "action=query,ns.where.name=" + escape("=" + name) + ",ns.columns=*,ns.created.show=true"); //HTTPRequest.sendRequest("POST", url, param, "undefined", false); /* this.getNamespaceInfo = function (_namespace) { if (url === null) return false; if (_namespace != null) { param = new Array("action=query","ns.where.name==" + _namespace,"ns.columns=*","ns.create.show=true"); } else { param = new Array("action=query","ns.where.name==" + this.getNamespace(),"ns.columns=*","ns.create.show=true"); } this.sendRequest("POST", url, param, "undefined", false); return this.responseText.parseJSON(); //return this.responseText; // for testing } this.getNamespaceCount = function (_namespace) { if (url === null) return false; if (!_namespace) return false; param = new Array("action=query","","ns.name.show=false","ns.created.show=false"); this.sendRequest("POST", url, param, "undefined", false); for (var i = 0; i < this.getNamespaceList().length; i++){ nsCount++; } return nsCount; //return this.responseText; } this.getNamespaceInfoDetail = function (_namespace) { if (url === null) return false; if (_namespace != null) { param = new Array("action=query","ns.where.name==" + _namespace,"ns.columns=*","ns.create.show=true","ns.detail.show=true"); } else { param = new Array("action=query","","ns.columns=*","ns.create.show=true","ns.detail.show=true"); } this.sendRequest("POST", url, param, "undefined", false); //return this.responseText.parseJSON(); return this.responseText; // for testing } */ this.getDefaultFile = function () { var _namespace = "default"; var _groupname; if(arguments.length == 0) return ""; //BAD!! if(arguments.length == 1) { _groupname = arguments[0]; } else { _namespace = arguments[0]; _groupname = arguments[1]; } var requestUrl = url; if (url === null) return ""; requestUrl += _namespace + "/" + _groupname + "/"; var param = new Array(""); return this.sendRequest("GET", requestUrl, param, false); //return this.responseText; } /* // Don's initiative codes this.getNamespaceProjectsList = function () { if (url === null) return false; if (arguments.length == 1) { param = new Array("action=query","ns.where.name==" + arguments[0],"group.columns=*","ns.columns=*"); } else { param = new Array("action=query","ns.where.name==default","group.columns=*","ns.columns=*"); } this.sendRequest("POST", url, param, "undefined", false); return this.responseText.parseJSON(); } */ this.getProjectList = function () { var ns = ''; if (arguments.length == 0) { ns = this.getNamespace(); } else if (arguments.length == 1) { ns = arguments[0]; } else { return false; } if (url === null) return false; target = url + ns + "/"; var response = this.sendRequest("GET", target, Array("action=query","ns.columns=*","ns.where.name=='" + ns + "'","group.columns=*"), false); if (response != "" && response != null) { try { var data = JSON.parse(response); if (data['ACTIONSTATUS'] == true) { return data['RESPONSEDATA']; } else { return null; } } catch(err) { alert("HostingAgent.getProjectList EXCEPTION: " + err.message); return null; } } else { return null; } } this.getMatchingProjectList = function () { var ns = ''; var path = ''; if (arguments.length == 1) { ns = this.getNamespace(); path = arguments[0] } else if (arguments.length == 2) { ns = arguments[0]; path = arguments[1] } else { return false; } if (url === null) return false; target = url + ns + "/" + path + "/"; var response = this.sendRequest("GET", target, Array("action=query","ns.where.name=='" + ns +"'","group.where.fqpath=LIKE '" + path + "'","group.columns=*"), false); if (response != "" && response != null) { try { var data = JSON.parse(response); if (data['ACTIONSTATUS'] == true) { return data['RESPONSEDATA']; } else { return null; } } catch(err) { alert("HostingAgent.getMatchingProjectList EXCEPTION: " + err.message); return null; } } else { return null; } } /* this.getNamespaceProjectsCount = function (_namespace) { if (url === null) return false; if (_namespace != null) { param = new Array("action=query","ns.where.name==" + _namespace,"group.*.show=false","ns.*.show=false"); } else { param = new Array("action=query","ns.where.name==default","group.*.show=false","ns.*.show=false"); } this.sendRequest("POST", url, param, "undefined", false); //return this.responseText.parseJSON(); //parseJSON() gives error return this.responseText; } this.getProjectInfo = function (_project) { if (url === null) return false; if (_project != null) { param = new Array("action=query","proj.name.where==" + _proj,"ns.columns=*","proj.create.show=true"); } else { param = new Array("action=query","","proj.name.show=true","proj.create.show=true"); } this.sendRequest("POST", url, param, "undefined", false); //return this.responseText.parseJSON(); return this.responseText; // for testing } this.getProjectInfoDetail = function (_project) { if (url === null) return false; if (_project != null) { param = new Array("action=query","proj.name.where==" + _proj,"ns.columns=*","proj.create.show=true"); } else { param = new Array("action=query","","proj.name.show=true","proj.create.show=true"); } this.sendRequest("POST", url, param, "undefined", false); //return this.responseText.parseJSON(); return this.responseText; // for testing } */ this.getProjectResourceList = function () { var ns = ''; var path = ''; if (arguments.length == 1) { ns = this.getNamespace(); path = arguments[0]; } else if (arguments.length == 2) { ns = arguments[0]; path = arguments[1]; } else { return false; } if (url === null) return false; target = url + ns + "/" + path + "/"; var response = this.sendRequest("GET", url, Array("action=query","ns.where.name=='" + ns + "'","group.where.fqpath=='" + path + "'","resource.columns=name"), false); if (response != "" && response != null) { try { var data = JSON.parse(response); if (data['ACTIONSTATUS'] == true) { return data['RESPONSEDATA']; } else { return null; } } catch(err) { alert("HostingAgent.getProjectResourceList EXCEPTION: " + err.message); return null; } } else { return null; } } /* this.getProjectResourceCount = function (proPath) { if (this.isValidURL(url) == false) { return false; } else { for (var i = 0; i < proPath.length; i++) { proResCount++; } return proResCount; } } this.getResourceInfo = function (resList) { //var resList = new Array(); if (this.isValidURL(url) == false) { return false; } else { for (var i = 0; i < proj.length; i++) { resList[i] = new Array( new Array("resource", resource) ); } return resList; } } this.getResourceInfoDetail = function (resList) { //var resListDet = new Array(); if (this.isValidURL(url) == false) { return false; } else { for (var i = 0; i < resList.length; i++) { resListDetail[i] = new Array( new Array("project", resource), new Array("desc", "description"), new Array("detail", "detail") ); } return resListDetail; } } */ function setState(_state){ var oldState = state; if (_state != state){ state = _state; if(uploadRequest != null){ uploadRequest.updateState(state); } meLogger.write('HostingAgent: '+ oldState + ' -> ' + state); } } } // End of Hosting Agent HostingAgent.theInstance = function(){ if("undefined" == typeof HostingAgent.instance){ new HostingAgent(); } return HostingAgent.instance; } /** * Formerly jDirectorInit in jChatFb. * @constructor */ var clipDirector = null; var contextIdx = 0; var contextDefinitionMap = null; var nbrOfContexts = 0; //used in meMgmt.js too var ctxReady = null; var ctxPlaying = null; var allContextsReady = false; var clipDirectorInitialized = false; function Director(){ if("undefined" == typeof Director.instance) { Director.instance = this; // define the singleton } if(this != Director.instance) return Director.instance; // return the singleton if it already exists var appSpec = new AppletSpec('director'); appSpec.setParameter("name","player"); appSpec.setParameter("visible","false"); appSpec.addParameter('autoPlay','true'); appSpec.addParameter('playIcon','/images/play.gif'); appSpec.addParameter('pauseIcon','/images/pause.gif'); appSpec.addParameter('stopIcon','/images/stop.gif'); appSpec.addParameter('volumeUpIcon','/images/volumeUp.gif'); appSpec.addParameter('volumeDownIcon','/images/volumeDown.gif'); appSpec.addParameter('controlsVisible','false'); appSpec.addParameter('gestures','true'); appSpec.addParameter('autoMute','false'); appSpec.addParameter('mouseHelp','false'); appSpec.addParameter('zoomKeys',"true"); appSpec.addParameter('zoomKeysMax','2') appSpec.addParameter('primary','false'); appSpec.addParameter('waitForView','true'); appSpec.addParameter('backgroundColor','black'); appSpec.addParameter('clipActorsEnabled','true'); appSpec.addParameter('loop','true'); this.setDirCtxt = function(_context,param,value){ appSpec.addParameter('clipActorContext-'+_context+'-'+param,value); } // this.getAppletSpec = function(){ return appSpec; } /** * Start the director applet if not started already */ this.start = function(){ if (!Director.isStarted) { if (!AppletManager.theInstance().startApplet(appSpec,Director.setClipDirector)) { alert('Director.startDir ERROR RETURN FROM startApplet'); } Director.isStarted = true; return true; } } /** * initializeActorApp(contextIdx,this.getTag(),this.getClipWidth(),this.getClipHeight(), this._divId); * @param {int} context is a context id * @param {String} viewName view name of the context * @param {int} width * @param {int} height * @param {String} tag : Div tag associated with the context * @see Actor#initPlayOrBufferClip for its use */ this.initializeActorApp = function (context,viewName,width,height,tag){ var vPlay; vPlay = new AppletSpec('actor'); vPlay.setParameter("name",viewName); vPlay.setParameter("width", width); vPlay.setParameter("height", height); if (context > 0) { vPlay.addParameter('viewName',viewName); vPlay.addParameter('viewId',context); vPlay.addParameter('pels',width); vPlay.addParameter('lines',height); } AppletManager.theInstance().startApplet(vPlay,null,tag); } /** * Initialize all actors. */ this.initActors = function () { var status = false; if (!Director.actorsInited ) { Director.theInstance().start(); for (var i = 1; i <= actorInstanceCtr; i++) { var anActor = actorInstanceMap[i]; if (anActor.isDeferred()) { setTimeout('Director.theInstance().initActors()',1000); return; } anActor.init(); } nbrOfContexts = contextIdx; if (ctxReady === null) ctxReady = new Object(); if (ctxPlaying === null) ctxPlaying = new Object(); this.waitForClipDirectorInitialized(); for (i = 1; i <= contextIdx; i++) { ctxReady[i] = false; ctxPlaying[i] = contextDefinitionMap[i].getClipDescriptor().getAutoplay(); } Director.actorsInited = true; status = true; } return status; } this.waitForClipDirectorInitialized = function() { if (clipDirectorInitialized){ return; } if (!clipDirector || (clipDirector == null)) { setTimeout('Director.theInstance().waitForClipDirectorInitialized()',2000); return; } try { if (nbrOfContexts == 0) { var tmp = parseInt(clipDirector.ep_invokeAndWait('1,,ep_getMaxContextIndex')); if ((typeof tmp == "undefined") || (tmp === 0)) { setTimeout('Director.theInstance().waitForClipDirectorInitialized()',500); return; } directorTrace('Director.theInstance().waitForClipDirectorInitialized nbrOfContexts: ' + tmp); nbrOfContexts = tmp; } if (ctxReady === null) ctxReady = new Array(nbrOfContexts+1); if (ctxPlaying === null) ctxPlaying = new Array(nbrOfContexts+1); } catch(err) { alert('waitForClipDirectorInitialized EXCEPTION: ' + err.description); setTimeout('Director.theInstance().waitForClipDirectorInitialized()',1000); } clipDirectorInitialized = true; } } /** * Factory method for the Director class. */ Director.theInstance = function(){ if("undefined" == typeof Director.instance){ new Director(); } return Director.instance; } Director.setClipDirector = function (cd) { clipDirector = cd; } Director.isStarted = false; Director.actorsInited = false; // ClipDescriptor.js // var _clipDescriptor = new ClipDescriptor(); ClipDescriptor.cdaIndex = 0; ClipDescriptor.clipDescriptorArray = null; ClipDescriptor.clipDescriptorList = null; ClipDescriptor.sdlList = null; function ClipDescriptor(sdlBase, sdlPrefix, sdl, width, height, autoplay, noAudio, convertSegments, volume, foreground, scenes, vdc, vic, adc, aic, auditPlayState, auditPointer, autoBandwidth, syncBandwidth, codeBaseOverride) { if (!sdl || (sdl === null)) return; this._sdlBase = sdlBase; this._sdlPrefix = sdlPrefix; this._sdl = sdl; this._width = width; this._height = height; this._autoplay = autoplay; this._noAudio = noAudio; this._convertSegments = convertSegments; this._volume = volume; this._foreground = foreground; this._scenes = scenes; this._vdc = vdc; this._vic = vic; this._adc = adc; this._aic = aic; this._auditPlayState = auditPlayState; this._auditPointer = auditPointer; this._autoBandwidth = autoBandwidth; this._syncBandwidth = syncBandwidth; this._codeBaseOverride = codeBaseOverride; this.setSdlBase = function(sdlBase) {this._sdlBase = sdlBase;} this.getSdlBase = function() {return this._sdlBase;} this.setSdlPrefix = function(sdlPrefix) {this._sdlPrefix = sdlPrefix;} this.getSdlPrefix = function() {return this._sdlPrefix;} this.setSdl = function(sdl) {this._sdl = sdl;} this.getSdl = function() {return this.getSdlBase() + this.getSdlPrefix() + this._sdl;} this.setWidth = function(width) {this._width = width;} this.getWidth = function() {return this._width;} this.setHeight = function(height) {this._height = height;} this.getHeight = function() {return this._height;} this.setAutoplay = function(autoplay) { this._autoplay = (isString(autoplay)) ? (autoplay.toLowerCase() == 'true') : autoplay; directorTrace('meClipDescriptor.setAutoplay' + ' autoplay: ' + autoplay); } this.getAutoplay = function() {return this._autoplay;} this.setNoAudio = function(noAudio) { this._noAudio = (isString(noAudio)) ? (noAudio.toLowerCase() == 'true') : noAudio;; } this.getNoAudio = function() {return this._noAudio;} this.setConvertSegments = function(ConvertSegments) {this._convertSegments = convertSegments;} this.getConvertSegments = function() {return this._convertSegments;} this.setVolume = function(volume) {this._volume = volume;} this.getVolume = function() {return this._volume;} this.setForeground = function(foreground) {this._foreground = foreground;} this.isForeground = function() {return this._foreground;} this.setScenes = function(scenes) {this._scenes = scenes;} this.getScenes = function() {return this._scenes;} this.setVideoDataCacheSize = function(vdc) {this._vdc = vdc;} this.getVideoDataCacheSize = function() {return this._vdc;} this.setVideoIndexCacheSize = function(vic) {this._vic = vic;} this.getVideoIndexCacheSize = function() {return this._vic;} this.setAudioDataCacheSize = function(adc) {this._adc = adc;} this.getAudioDataCacheSize = function() {return this._adc;} this.setAudioIndexCacheSize = function(aic) {this._aic = aic;} this.getAudioIndexCacheSize = function() {return this._aic;} this.setAuditPlayState = function(auditPlayState) {this._auditPlayState = auditPlayState;} this.getAuditPlayState = function() {return this._auditPlayState;} this.setAuditPointer = function(auditPointer) {this._auditPointer = auditPointer;} this.getAuditPointer = function() {return this._auditPointer;} this.isAuditPointer = function() {return this._auditPointer;} this.setAutoBandwidth = function(autoBandwidth) {this._autoBandwidth = autoBandwidth;} this.getAutoBandwidth = function() {return this._autoBandwidth;} this.setSyncBandwidth = function(syncBandwidth) {this._syncBandwidth = syncBandwidth;} this.getSyncBandwidth = function() {return this._syncBandwidth;} this.setCodeBaseOverride = function(codeBaseOverride) {this._codeBaseOverride = codeBaseOverride;} this.getCodeBaseOverride = function() {return this._codeBaseOverride;} if (ClipDescriptor.clipDescriptorList == null) { ClipDescriptor.clipDescriptorList = new Object(); } var subscript = ''; if (ClipDescriptor.clipDescriptorArray == null) { ClipDescriptor.clipDescriptorArray = new Array(); ClipDescriptor.cdaIndex = 0; } var listEntry = ''; if (this.getSdlPrefix().indexOf('/') != -1) { var path = this.getSdlPrefix().split('/'); for (var i = 0; i < path.length; i++) { if (path[i].length > 0) { subscript += '[\'' + path[i] + '\']'; if (!eval('ClipDescriptor.clipDescriptorList' + subscript) && (i < (path.length-2))) { listEntry = 'ClipDescriptor.clipDescriptorList' + subscript + '=new Object()'; eval(listEntry); ClipDescriptor.clipDescriptorArray[ClipDescriptor.cdaIndex++] = listEntry; } } } } else { subscript += '[\'' + this.getSdlPrefix() + '\']'; } listEntry = 'ClipDescriptor.clipDescriptorList' + subscript + '=this'; eval(listEntry); ClipDescriptor.clipDescriptorArray[ClipDescriptor.cdaIndex++] = listEntry; this.getExtendedClipHandle = function() { return '/' + this.getSdlPrefix().substring(0,this.getSdlPrefix().length); } this.toString = function() { return (' ClipDescriptor' + '\n location.href: ' + location.href + '\n sdlBase: ' + this._sdlBase + ' sdlPrefix: ' + this._sdlPrefix + '\n sdl: ' + this._sdl + ' volume: ' + this._volume + ' width: ' + this._width + ' height: ' + this._height + '\n codeBaseOverride: ' + this._codeBaseOverride + '\n autoplay: ' + this._autoplay + ' noAudio: ' + this._noAudio + ' convertSegments: ' + this._convertSegments + ' foreground: ' + this._foreground + '\n vdc: ' + this._vdc + ' vic: ' + this._vic + ' adc: ' + this._adc + ' aic: ' + this._aic + '\n auditPlayState: ' + this._auditPlayState + ' auditPointer: ' + this._auditPointer + ' autoBandwidth: ' + this._autoBandwidth + ' syncBandwidth: ' + this._syncBandwidth + '\n scenes: ' + this._scenes); } if (ClipDescriptor.sdlList === null) { ClipDescriptor.sdlList = new Object(); } ClipDescriptor.sdlList[this.getSdl()] = this; this.cloneBasicParameters = function(aCd) { //this._width = aCd._width; //this._height = aCd._height; //this._autoplay = aCd._autoplay; this._noAudio = aCd._noAudio; this._convertSegments = aCd._convertSegments; this._volume = aCd._volume; this._foreground = aCd._foreground; this._scenes = aCd._scenes; this._vdc = aCd._vdc; this._vic = aCd._vic; this._adc = aCd._adc; this._aic = aCd._aic; this._auditPlayState = aCd._auditPlayState; this._auditPointer = aCd._auditPointer; this._autoBandwidth = aCd._autoBandwidth; this._syncBandwidth = aCd._syncBandwidth; //this._codeBaseOverride = aCd._codeBaseOverride; } } /** * */ function getClipDescriptorList() { return ClipDescriptor.clipDescriptorList; } /** * @return {string} static string 'ClipDescriptor.clipDescriptorList' */ function getClipDescriptorListAsString() { return 'ClipDescriptor.clipDescriptorList'; } /** * @deprecated * Looks like it can be used for logging purposes only */ function dumpCda() { return; for (var i = 0; i < ClipDescriptor.clipDescriptorArray.length; i++) { directorTrace('i: ' + i + ' ' + ClipDescriptor.clipDescriptorArray[i]); } } /** * @param {string} anSdl sdl file path with the protocol * @return {ClipDescriptor} matching clip descriptor */ ClipDescriptor.findClipDescriptor = function(anSdl) { //alert('meClipDescriptor.findClipDescriptor anSdl: ' + anSdl); var cd = null; if ((ClipDescriptor.sdlList !== null) && (ClipDescriptor.sdlList[anSdl])) { cd = ClipDescriptor.sdlList[anSdl]; } return cd; } // SdlWriter.js function SdlWriter(myActor) { this.myActor = (myActor) ? myActor : null; this.myName = myActor.getName(); /* this.myElementId = this.myName + 'element'; // Don Smith: Not Needed. Applet Manager will handle. this.myAppletName = this.myName + 'applet'; */ var that = this; this.appspec = null; this.applet = null; this.myAppletStarted = false; this.videoFile = null; this.audioFile = null; this.codeBase = null; this.writeInProgress = false; this.isWriteInProgress = function() { return this.writeInProgress; } this.getVideoFile = function() // USER API { return this.videoFile; } this.setVideoFile = function(videoFile) // USER API { if (this.writeInProgress) { //alert('SdlWriter already in-progress'); // Don Smith: Souldn't we return false here instead of popping an alert? return false; } this.videoFile = null; if (videoFile && isString(videoFile) && (videoFile.length > 0)) { var endOfVideoFile = videoFile.lastIndexOf('.dat'); if (endOfVideoFile != -1) { this.videoFile = videoFile.substring(0,endOfVideoFile); if (this.codeBase == null) { this.codeBase = videoFile.substring(0,videoFile.lastIndexOf('/') + 1); } if (this.audioFile == null) { this.audioFile = this.codeBase + 'audio_s1'; } } else { //alert('SdlWriter.setVideoFile videoFile INVALID:' + videoFile); // Don Smith: Souldn't we return false here instead of popping an alert? return false; } } else { //alert('SdlWriter.setVideoFile videoFile INVALID:' + videoFile); // Don Smith: Souldn't we return false here instead of popping an alert? return false; } } this.getAudioFile = function() // USER API { return this.audioFile; } this.setAudioFile = function(audioFile) // USER API { if (this.writeInProgress) { //alert('SdlWriter already in-progress'); // Don Smith: Souldn't we return false here instead of popping an alert? return false; } this.audioFile = null; if (audioFile && isString(audioFile) && (audioFile.length > 0)) { var endOfAudioFile = audioFile.lastIndexOf('.dat'); if (endOfAudioFile != -1) { this.audioFile = audioFile.substring(0,endOfAudioFile); if (this.codeBase == null) { this.codeBase = audioFile.substring(0,audioFile.lastIndexOf('/') + 1); } if (this.videoFile == null) { this.videoFile = this.codeBase + 'video_s1'; } } else { //alert('SdlWriter.setAudioFile audioFile INVALID:' + audioFile);// Don Smith: Souldn't we return false here instead of popping an alert? return false; } } else { //alert('SdlWriter.setAudioFile audioFile INVALID:' + audioFile); // Don Smith: Souldn't we return false here instead of popping an alert? return false; } } this.startSdlWriter = function() // USER API { if (this.writeInProgress) { //alert('SdlWriter already in-progress'); return false; // Don Smith: Souldn't we return false here instead of popping an alert? } //directorTrace('SdlWriter.startSdlWriter\n' + this.sdlWriterToString()); var _this = this; if (this.videoFile != null) { this.writeInProgress = true; //enableHourGlass(); /* * Don Smith: Should we continue supporting this as user feedback? * No other code does so, plus it takes control of presentation which is a no-no. */ if (!this.myAppletStarted) { this.createSdlWriterApplet(); } setTimeout(monitorSdlWriteBegin,2000); } else { //alert('SdlWriter.createSdlWriter videoFile NULL');// Don Smith: Souldn't we return false here instead of popping an alert? return false; } } this.createSdlWriterApplet = function() { //if (this.appspec !== null) { //directorTrace('SdlWriter.createSdlWriterApplet CREATING SDL APPLET'); this.appspec = new AppletSpec('sdlWriter'); //this.applet.archive = archiveList; this.appspec.setParameter('name','sdlWriter'); this.appspec.setParameter("visible", "false"); this.appspec.scriptable = 'true'; this.appspec.mayscript = 'true'; this.appspec.addParameter('autoplay','true'); this.appspec.addParameter('sdlAudio','true'); this.appspec.addParameter('initialMute','true'); this.appspec.addParameter('url',this.videoFile); this.appspec.addParameter('urlAudio',this.audioFile); this.appspec.addParameter('codeBaseOverride',this.codeBase); //} AppletManager.theInstance().startApplet(this.appspec, setSdlApplet); //this.myAppletStarted = true; // Will be set by Applet Manager once Applet is started. //directorTrace('SdlWriter.createSdlWriterApplet SDL APPLET CREATED'); } function setSdlApplet(_applet) { that.applet = _applet; that.myAppletStarted = true; } function monitorSdlWriteBegin(args) { //var _this = this; //var swa = this.getSdlWriterApplet(); if (!that.myAppletStarted) { setTimeout(monitorSdlWriteBegin,2000); return;} var swa = that.applet; if (swa.ep_getState) { if (swa.ep_isSdlReadyToWrite() == 'true') { //directorTrace('SdlWriter.monitorSdlWriteBegin SDL WRITE BEGIN'); swa.ep_updateLocalSdl(); setTimeout(monitorSdlWriteComplete,2000); return; } else { directorTrace('SdlWriter.monitorSdlWriteBegin sdl write NOT READY'); } } else { directorTrace('SdlWriter.monitorSdlWriteBegin APPLET NOT READY'); } setTimeout(monitorSdlWriteBegin,2000); } function monitorSdlWriteComplete(args) { if (!that.myAppletStarted) { setTimeout(monitorSdlWriteComplete,2000); return;} var swa = that.applet; if (swa.ep_isSdlWriteComplete() == 'true') { //directorTrace('SdlWriter.monitorSdlWriteComplete SDL WRITE COMPLETE'); swa.ep_stop(); if (that.myActor != null) { that.myActor.invoke('sdlWriteComplete','sdlWriteComplete;SdlWriter.monitorSdlWriteComplete'); } that.resetSdlWriter(); that.writeInProgress = false; //disableHourGlass(); /* * Don Smith: Should we continue supporting this as user feedback? * No other code does so, plus it takes control of presentation which is a no-no. */ return; } else { directorTrace('SdlWriter.monitorSdlWriteComplete sdl write NOT COMPLETE'); } setTimeout(monitorSdlWriteComplete,2000); } this.sdlWriterToString = function() { return (' SdlWriter' + '\n myName: ' + this.myName + '\n myElementId: ' + this.myElementId + '\n myAppletName: ' + this.myAppletName + '\n codeBase: ' + this.codeBase + '\n videoFile: ' + this.videoFile + '\n audioFile: ' + this.audioFile); } this.resetSdlWriter = function() { //directorTrace('SdlWriter.resetSdlWriter'); this.videoFile = null; this.audioFile = null; this.codeBase = null; if (AppletManager.theInstance().destroyApplet('sdlWriter')) { this.applet = null; this.writeInProgress = false; this.myAppletStarted = false; } else { return false; } //document.getElementById(this.myElementId).innerHTML = "
"; } SdlWriter.instance = this; } function setAutoplay(ctxId,state) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setAutoplay,' + state); } function setNoAudio(ctxId,state) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setNoAudio,' + state); } function setConvertSegments(ctxId,state) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setConvertSegments,' + state); } function setVolume(ctxId,volume) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setVolume,' + volume); } function setVideoDataCacheSize(ctxId,size) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setVideoDataCacheSize,' + size); } function setVideoIndexCacheSize(ctxId,size) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setVideoIndexCacheSize,' + size); } function setAudioDataCacheSize(ctxId,size) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setAudioDataCacheSize,' + size); } function setAudioIndexCacheSize(ctxId,size) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setAudioIndexCacheSize,' + size); } function getActorNameByIndex(ctxId) { return clipDirector.ep_invokeAndWait(ctxId.toString() + ',,ep_getActorName'); } var pointerNotPresent = -1; var pointerPresentNotSupported = 0; var pointerPresent = 1; function isPointerPresent(ctxId) { return pointerPresentNotSupported; //return (clipDirector != null) ? clipDirector.ep_invokeAndWait(ctxId.toString() + ',,ep_isPointerPresent') : false; } function setRgbSrcIdx(ctxId,idx) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setRgbSrcIdx,' + idx); } function setAutoBandwidth(ctxId,state) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setAutoBandwidth,' + state); } function setSyncBandwidth(ctxId,state) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setSyncBandwidth,' + state); } function setCodeBaseOverride(ctxId,path) { if (path != null) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setCodeBaseOverride,' + path); } else { directorTrace('meIntfc.setCodeBaseOverride path is NULL'); } } function setSceneMergeTmpDir(ctxId,tmpDir) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setSceneMergeTmpDir,' + tmpDir); } /* * © Copyright ESPRE Solutions, Inc., 2006. All rights are reserved. */ function ManifestFactory() { var that = this; //Let the private functions access the object instance. if("undefined" == typeof ManifestFactory.instance) { ManifestFactory.instance = this; // define the singleton } if(this != ManifestFactory.instance) return ManifestFactory.instance; // return the singleton if it already exists this.getEncodeArtifacts = function (_encodeXML) { var xmlDoc = xutil.load(_encodeXML); var vDataOutnodes = xmlDoc.selectNodes("/mediaClip/subclip/videoParameters/dataOut/text()"); //camelCase ?? subclip var vIndexOutnodes = xmlDoc.selectNodes("/mediaClip/subclip/videoParameters/indexOut/text()"); var aDataOutnodes = xmlDoc.selectNodes("/mediaClip/subclip/audioParameters/dataOut/text()"); var aIndexOutnodes = xmlDoc.selectNodes("/mediaClip/subclip/audioParameters/indexOut/text()"); var totalFiles = vDataOutnodes.length + vIndexOutnodes.length + aDataOutnodes.length + aIndexOutnodes.length ; var fileList = []; if((totalFiles % 4) == 0 && (totalFiles >= 4)) { meLogger.write('Encode file looks legit...'); meLogger.write("Root :[ " + xmlDoc.documentElement.nodeName + "] there should be a total of : " + totalFiles + " files."); //first add the required sdl file to the file list fileList.push((vDataOutnodes[0].nodeValue).replace(/\\/g, "/") + ".sdl"); for( var count =0; count < vDataOutnodes.length; count++) { fileList.push((vDataOutnodes[count].nodeValue).replace(/\\/g, "/")); } for( var count =0; count < vIndexOutnodes.length; count++) { fileList.push((vIndexOutnodes[count].nodeValue).replace(/\\/g, "/")); } for( var count =0; count < aDataOutnodes.length; count++) { fileList.push((aDataOutnodes[count].nodeValue).replace(/\\/g, "/")); } for( var count =0; count < aIndexOutnodes.length; count++) { fileList.push((aIndexOutnodes[count].nodeValue).replace(/\\/g, "/")); } //meLogger.write(fileList.join(', ')); return fileList; } else { meLogger.write("Encoding artifacts don\'t look valid.", 3); throw new MeException("Successful Encoding required before an upload "); } } } ManifestFactory.theInstance = function(){ if("undefined" == typeof ManifestFactory.instance){ return new ManifestFactory(); } return ManifestFactory.instance; }; // $Id: ParameterManager.js 50 2007-01-24 21:47:47Z plin $ 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; } } CameraCapture.useAVDevice = true; function CameraCapture(captureApplet) { if(CameraCapture.instance != null) return CameraCapture.instance; // Singleton only if(CameraCapture.useAVDevice) { //alert('meCameraCapture.CameraCapture captureApplet: ' + captureApplet + '\n cameraCaptureDocument: ' + cameraCaptureDocument); // if ((!captureApplet || (captureApplet == null)) && cameraCaptureDocument) // { // captureApplet = cameraCaptureDocument; // } this.captureApplet = captureApplet; //we don't use this, but its in the interface this.setCaptureApplet = function(applet) { // alert('meCameraCapture.setCaptureApplet' + '\n applet: ' + applet + '\n cameraCaptureDocument: ' + cameraCaptureDocument); this.captureApplet = applet; } var avDevice = new AVDevice(); //uses default video and audio devices var pendingAVDevice = null; // used to hold new device while current device is capturing or previewing. // avDevice can be changed if not capturing and not previewing var updateAVDevice = function(){ if(pendingAVDevice !== null){ avDevice = pendingAVDevice; pendingAVDevice = null; } } this.startCapture = function() // USER API { avDevice.startCapture(); } this.stopCapture = function() // USER API { avDevice.stopCapture(); updateAVDevice(); } this.startPreview = function() // USER API { avDevice.startPreview(); } this.stopPreview = function() // USER API { avDevice.stopPreview(); updateAVDevice(); } this.getCapturePath = function() // USER API { var path = null; try {path = avDevice.getParameter("outputfile");} catch (e) { alert('CameraCapture.getCapturePath EXCEPTION: ' + e.message); path = null; } if ((path != null) && isString(path) && (path.length > 0)) { path = path.replace(/\\/g,"/"); } else { path = null; } return path; } this.setCapturePath = function(aPath) // USER API { avDevice.setParameter("outputfile", aPath); } this.getCaptureApplet = function() { return this.captureApplet; } this.getAVDevice = function() { return avDevice; } this.setAVDevice = function(anAVDevice) { if(anAVDevice === null) return; if(! anAVDevice instanceof AVDevice) return; if(avDevice.isCapturing() || avDevice.isPreviewing()){ pendingDevice = anAVDevice; } else{ avDevice = anAVDevice; } } } else //old style direct access { //alert('meCameraCapture.CameraCapture captureApplet: ' + captureApplet + '\n cameraCaptureDocument: ' + cameraCaptureDocument); if ((!captureApplet || (captureApplet == null)) && cameraCaptureDocument) { captureApplet = cameraCaptureDocument; } this.captureApplet = captureApplet; this.setCaptureApplet = function(applet) { // alert('meCameraCapture.setCaptureApplet' + '\n applet: ' + applet + '\n cameraCaptureDocument: ' + cameraCaptureDocument); this.captureApplet = applet; } this.startCapture = function() // USER API { //camCapApp.getInstance().startCapture(); this.getCaptureApplet().ep_startCapture(120); // TODO GLM need to restore previously working method } this.stopCapture = function() // USER API { this.getCaptureApplet().ep_stopCapture(); } this.startPreview = function() // USER API { this.getCaptureApplet().ep_setPreview(true); } this.stopPreview = function() // USER API { this.getCaptureApplet().ep_setPreview(false); } this.getCapturePath = function() // USER API { var path = null; try {path = this.getCaptureApplet().ep_getCapturePath();} catch (e) { alert('CameraCapture.getCapturePath EXCEPTION: ' + e.message); path = null; } if ((path != null) && isString(path) && (path.length > 0)) { path = path.replace(/\\/g,"/"); } else { path = null; } return path; } this.setCapturePath = function(aPath) // USER API { this.getCaptureApplet().ep_setCapturePath(aPath); } this.getCaptureApplet = function() { //alert('meCameraCapture.getCaptureApplet applet: ' + camCapApp.getInstance()); return this.captureApplet; //return camCapApp.getInstance(); } } //alert('meCameraCapture. this: ' + this); CameraCapture.instance = this; } CameraCapture.instance = null; CameraCapture.startCapture = function() { if (CameraCapture.instance != null) { CameraCapture.instance.startCapture(); } else { directorTrace('CameraCapture.startCapture NO INSTANCE'); alert('CameraCapture.startCapture NO INSTANCE'); } } CameraCapture.stopCapture = function() { if (CameraCapture.instance != null) { CameraCapture.instance.stopCapture(); } else { directorTrace('CameraCapture.stopCapture NO INSTANCE'); alert('CameraCapture.stopCapture NO INSTANCE'); } } CameraCapture.startPreview = function() { if (CameraCapture.instance != null) { CameraCapture.instance.startPreview(); } else { directorTrace('CameraCapture.startPreview NO INSTANCE'); alert('CameraCapture.startPreview NO INSTANCE'); } } CameraCapture.stopPreview = function() { if (CameraCapture.instance != null) { CameraCapture.instance.stopPreview(); } else { directorTrace('CameraCapture.stopPreview NO INSTANCE'); alert('CameraCapture.stopPreview NO INSTANCE'); } } CameraCapture.getCapturePath = function() // USER API { if (CameraCapture.instance != null) { return CameraCapture.instance.getCapturePath(); } else { directorTrace('CameraCapture.getCapturePath NO INSTANCE'); alert('CameraCapture.getCapturePath NO INSTANCE'); } } CameraCapture.setCapturePath = function(aPath) // USER API { if (CameraCapture.instance != null) { CameraCapture.instance.setCapturePath(aPath); } else { directorTrace('CameraCapture.stopPreview NO INSTANCE'); alert('CameraCapture.stopPreview NO INSTANCE'); } } CameraCapture.setCaptureApplet = function(applet) { if (CameraCapture.instance != null) { CameraCapture.instance.setCaptureApplet(applet); } else { directorTrace('CameraCapture.setCaptureApplet NO INSTANCE'); alert('CameraCapture.setCaptureApplet NO INSTANCE'); } } function UploadRequest(_nspace,_name) { var that = this; //Let the private functions access the object instance. //acquire ParameterManager capabilities this.PMgr = ParameterManager; this.PMgr("general"); var host = HostingAgent.theInstance(); // get the singleton. var requestState = "idle"; // use this to track the request // states are: idle, uploading, completed, errored, cancelled this.integerStringValidator = function (group, name, _value) { //meLogger.write('Integer String Validator Called', 1); if(isNaN(parseInt(_value)))return false; return true; } // define the progress parameters this.defineParameter("general","progress","defaultValue","0","validator",this.integerStringValidator); var nspace = _nspace; var target = ""; var name = _name; var mappedName = ""; var manifestFiles = []; /** This will have a return type that looks like: C:\metest\anonymous\video_s1.dat| 219010| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\video_s2.dat| 219010| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\video_s3.dat| 257716| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\video_s1.idx| 18000| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\video_s2.idx| 18000| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\video_s3.idx| 18000| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\audio_s1.dat| 188308| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\audio_s2.dat| 188308| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\audio_s3.dat| 188308| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\audio_s1.idx| 6444| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\audio_s2.idx| 6444| Mon Feb 12 10:46:32 CST 2007, C:\metest\anonymous\audio_s3.idx| 6444| Mon Feb 12 10:46:32 CST 2007 The order is FileName(path)|Size|Creation Date */ this.toString = function(){ var myString = []; for(var i = 0; i < manifestFiles.length; i++){ myString.push(manifestFiles[i]); } var tempString = myString.join(', '); return tempString; } this.setManifestFiles = function(_manifestFiles){ manifestFiles = _manifestFiles; if(_manifestFiles.length>0){ // extract "map to" filename mappedName = _manifestFiles[0]; mappedName = mappedName.replace(/^.*\//,""); //meLogger.write(mappedName); } setCorrespondingAttributes(); } this.getManifestFiles = function(){ return manifestFiles; } this.setName = function(_name){ name = _name; } this.getName = function(){ return name; } this.setMappedName = function(_name){ mappedName = _name; } this.getMappedName = function(){ return mappedName; } this.setTarget = function(_target){ target = _target; } this.getTarget = function(){ return target; } this.getNameSpace = function(){ return nspace; } function setCorrespondingAttributes(){ if (manifestFiles.length > 0){ for(var mCnt = 0; mCnt < manifestFiles.length; mCnt++) { manifestFiles[mCnt] = getManifestAttributes(manifestFiles[mCnt]); } } } // Assuming the HostingAgent class have implemented the following methods. this.upload = function() { var result = host.upload(this); if(result == true) setRequestState("uploading"); return result; // true indicates that the request has been posted } this.start = this.upload; this.getProgress = function(){ if(requestState == "uploading") return this.getParameter("progress"); if(requestState == "completed") return 100; return 0; } this.getErrors = function(){ if(requestState == "errored") return this.getParameter("errors"); return ""; } this.isCompleted = function(){ if(requestState == "completed" || requestState == "cancelled") return true; return false; } this.isUploading = function(){ if(requestState == "uploading") return true; return false; } this.isError = function(){ if(requestState == "errored") return true; return false; } // Private functions function setRequestState(_state){ var oldState = requestState; if (_state != requestState){ requestState = _state; meLogger.write('UploadRequest: '+ oldState + ' -> ' + requestState); } } // add public callback functions for status, progress, etc. this.updateProgress = function(_value) { this.setParameter("progress",_value); } this.updateState = function(_state){ if(_state == "initializing" || _state == "ready" || _state == "busy" || _state == "blocked") return; if(_state == "errored"){ this.setParameter("errors",host.getErrors()); meLogger.write(host.getErrors(), 3); } setRequestState(_state); } } 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 fileUtilApplet = null; // created when needed. var appletState = null; // use this to track fso Applet // states are: initializing, ready //Continue with the singleton's construction //User API functions this.install = function(){ if(appletState === null){ startFileUtilApplet(); } }; this.isInitialized = function(){ if(appletState === null){return false;} if(appletState != "initializing") return true; return false; }; this.fileDelete = function(_file) { if(!this.isInitialized()) return false; // not yet available var result = fileUtilApplet.ep_fileDelete(_file); return (result == "1"? true: false); }; this.getHome = function() { if(!this.isInitialized()) return ""; // not yet available return (new String(fileUtilApplet.ep_getUserHome())).toString(); }; this.getUserSandBox = function(){ if(!this.isInitialized()) return ""; // not yet available return (new String(fileUtilApplet.ep_getUserSandBox())).toString(); }; this.expandPath = function(_shortPath){ if(!this.isInitialized()) return ""; // not yet available return (new String(fileUtilApplet.ep_expandPath(_shortPath))).toString(); }; this.writeToFilePath = function(fileAsAString,filePathName, overwrite) { if(!this.isInitialized()) return false; // not yet available var re = /\\[^\\]+$/; var base = filePathName.replace(re,""); var _folderExists = this.doesFolderExist(base) ; //alert("Base: " + base); return fileUtilApplet.ep_writeToFilePath(fileAsAString.replace(/"/g, "'"),filePathName); }; this.writeToFile = function(fileAsAString,base, projRelPath, fileName, overwrite) { if(!this.isInitialized()) return false; // not yet available //alert (fileAsAString.replace(/\"/g, "\'")); return fileUtilApplet.ep_writeToFile(fileAsAString.replace(/"/g, "'"),base, projRelPath, fileName, overwrite); }; this.fileExists = function(fileName) { if(!this.isInitialized()) return false; // not yet available return ((fileUtilApplet.ep_fileExists(fileName) == '1')? true : false); }; this.doesFolderExist = function(dirName) { if(!this.isInitialized()) return false; // not yet available return ((fileUtilApplet.ep_folderExists(dirName) == '1')? true : false); }; this.getManifestAttributes = function(fileName) { if(!this.isInitialized()) return ""; // not yet available return (new String(fileUtilApplet.ep_getManifestAttributes(fileName))).toString(); }; this.deleteFile = function(fileName) { if(!this.isInitialized()) return false; // not yet available return ((fileUtilApplet.ep_fileDelete(fileName) == '1')? true : false); }; this.copyFile = function(sourceFile, destPath) { if(!this.isInitialized()) return false; // not yet available return ((fileUtilApplet.ep_fileCopy(sourceFile, destPath) == '1')? true : false); }; this.getBase = function(fileName) { if(!this.isInitialized()) return ""; // not yet available return (new String(fileUtilApplet.ep_getBase(fileName))).toString(); }; this.doesFileExist = function(fileName){ if(!this.isInitialized()) return false; // not yet available return ((fileUtilApplet.ep_fileExists(fileName) == '1')? true : false); }; this.readFile = function(fileName){ if(!this.isInitialized()) return ""; // not yet available return (new String(fileUtilApplet.ep_readFile(fileName))).toString(); }; // Private functions function startFileUtilApplet(){ setAppletState("initializing"); // Start Applet Here// var fakeIt = false; // to test w/o applet if(!fakeIt){ var appspec = new AppletSpec('fileUtil'); appspec.setParameter("name","fileUtil"); appspec.setParameter("visible",false); AppletManager.theInstance().startApplet(appspec,setAppletReadyState); } else { //FakeOut Applet start meLogger.write('Faking applet start in 5 seconds!!'); window.setTimeout(setAppletReadyState,5000); } } function setAppletReadyState(applet){ fileUtilApplet = applet; setAppletState("ready"); } function setAppletState(_state){ var oldState = appletState; if (_state != appletState){ appletState = _state; meLogger.write('FileUtil: ' + oldState + " -> "+ appletState); } } //auto start the instance; startFileUtilApplet(); 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(); } meLogger.write = function (){ // jstracer.write.apply(jstracer,arguments); if(arguments.length > 1 && arguments[1] == 3) alert(arguments[0]); }; function deleteProject(_projectPath) { var result = false; var tempFile = ""; try{ if(doesFolderExist(_projectPath)){ // Handle Project.xml var filePath = toPath(_projectPath, "Project.xml") ; if(doesFileExist(filePath)){ result = fileDelete(filePath); } result = true; // success if we delete the Project.xml // Handle Encode.xml filePath = toPath(_projectPath, "Encode.xml"); if(doesFileExist(filePath)){ result = result && 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 = toPath(_projectPath, tempFile ); if(doesFileExist(filePath)){ result = result && fileDelete(filePath); } else { //Looks like all the idx/dat files are cleaned up break; } tempFile = audioF + counter + ".dat"; filePath = toPath(_projectPath, tempFile); if(doesFileExist(filePath)){ result = result && fileDelete(filePath); } tempFile = videoF + counter + ".idx"; filePath = toPath(_projectPath, tempFile); if(doesFileExist(filePath)){ result = result && fileDelete(filePath); } tempFile = videoF + counter + ".dat"; filePath = toPath(_projectPath, tempFile); if(doesFileExist(filePath)){ result = result && fileDelete(filePath); } counter++; } //Delete SDL File tempFile = "video_s1.dat.sdl"; filePath = toPath(_projectPath, tempFile); if(doesFileExist(filePath)){ result = result && 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; } function fileDelete(_file) { return FileUtil.theInstance().fileDelete(_file); } //This is a stub function toPath(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 ; } function getHome() { return FileUtil.theInstance().getHome(); } function getUserSandBox(){ return FileUtil.theInstance().getUserSandBox(); } function expandPath(_shortPath){ return FileUtil.theInstance().expandPath(_shortPath); } function writeToFilePath(fileAsAString,filePathName, overwrite) { return FileUtil.theInstance().writeToFilePath(fileAsAString, filePathName, overwrite); } function writeToFile(fileAsAString, base, projRelPath, fileName, overwrite) { return FileUtil.theInstance().writeToFile(fileAsAString, base, projRelPath, fileName, overwrite); } function fileExists(fileName) { return FileUtil.theInstance().fileExists(fileName); } function doesFolderExist(dirName) { return FileUtil.theInstance().doesFolderExist(dirName); } function getManifestAttributes(fileName) { return FileUtil.theInstance().getManifestAttributes(fileName); } function deleteFile(fileName) { return FileUtil.theInstance().deleteFile(fileName); } function copyFile(sourceFile, destPath) { return FileUtil.theInstance().copyFile(sourceFile, destPath); } function getBase(fileName) { return FileUtil.theInstance().getBase(fileName); } function doesFileExist(fileName){ return FileUtil.theInstance().doesFileExist(fileName); } function readFile(fileName){ return FileUtil.theInstance().readFile(fileName); } /** * This is a generic method that will load the xml file into a DOM Object * Loading an XML file is possible in most of the major browsers unlike writing an XML to a file. */ 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 = 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(); } /** * This Function is used to create the collection 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; }; } function MeAddEvent(obj, evType, fn){ if (obj.addEventListener) { 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; } /** * @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; } // Media Engine Actor var chatOnly = false; var actorNameMap = null; var actorInstanceMap = null; var actorInstanceCtr = 0; var foregroundMap = null; var auditPointerMap = null; var cidMsg = -1000; var cameraCaptureDocument = null; var archiveList = ''; var pointerNotPresent = -1; var pointerPresentNotSupported = 0; var pointerPresent = 1; Actor.started = false; Actor.sdlWriterActor = null; Actor.cameraCaptureActor = null; Actor.vmpEnabled = false; // VideoMessageProducer function Actor() { // args: name,tag,clipWidth, clipHeight var that = this; var name; var tag; var clipWidth; var clipHeight; if (arguments.length == 1) { name = arguments[0]; tag = ""; clipWidth = ""; clipHeight = ""; } else if (arguments.length == 2) { name = arguments[0]; tag = arguments[1]; clipWidth = ""; clipHeight = ""; } else if (arguments.length == 3) { name = arguments[0]; tag = ""; clipWidth = arguments[1]; clipHeight = arguments[2]; } else if (arguments.length == 4) { name = arguments[0]; tag = arguments[1]; clipWidth = arguments[2]; clipHeight = arguments[3]; } this.eventManager = EventManager; this.eventManager(); if (actorInstanceMap === null) { actorInstanceMap = new Object(); } actorInstanceMap[++actorInstanceCtr] = this; if (foregroundMap === null) foregroundMap = new Object(); if (auditPointerMap === null) auditPointerMap = new Object(); var defaultAutoMute = 'false'; var defaultAutoplay = 'false'; var defaultClipActorsEnabled = 'true'; var defaultControlsVisible = 'false'; var defaultGestures = 'true'; var defaultHeight = '240'; var defaultLoop = 'false'; var defaultPrimary = 'true'; var defaultVolume = '90'; var defaultWaitForView = 'true'; var defaultWidth = '320'; var defaultPauseViaStall = 'true'; var defaultConvertSegments = 'false'; var defaultMsgsEnabled = false; var defaultRgbSrcEnabled = false; var defaultRgbSrcIdx = -1; this._autoMute = defaultAutoMute; this._autoplay = defaultAutoplay; this._clipActorsEnabled = defaultClipActorsEnabled; this._controlsVisible = defaultControlsVisible; this._gestures = defaultGestures; this._height = defaultHeight; this._loop = defaultLoop; this._primary = defaultPrimary; this._volume = defaultVolume; this._waitForView = defaultWaitForView; this._width = defaultWidth; this._pauseViaStall = defaultPauseViaStall; this._convertSegments = defaultConvertSegments; this._name = name; this._mpc = null; //this._tag = tag; //DY look into the if condition arguments.length .... and get _tag this._tag = Actor.getTagPrefix() + name; this._divId = Actor.getDivIdPrefix() + name; this._currentClipHandle = null; this._previousClipHandle = null; this._msgsEnabled = defaultMsgsEnabled; this.setMsgsEnabled = function(state) { this._msgsEnabled = state; } this.areMsgsEnabled = function() {return this._msgsEnabled;} this._rgbSrcEnabled = defaultRgbSrcEnabled; this.setRgbSrcEnabled = function(state) { this._rgbSrcEnabled = state; } this.isRgbSrcEnabled = function() {return this._rgbSrcEnabled;} this._rgbSrcIdx = defaultRgbSrcIdx; this.setRgbSrcIdx = function(idx) { this._rgbSrcIdx = idx; } this.getRgbSrcIdx = function() {return this._rgbSrcIdx;} this._contextConfigured = new Object(); this.setMpc = function(mpc) { this._mpc = mpc; this.initMpc(); //DY useless as it stands now } //DY Currently does nothing! this.initMpc = function() { return; this._contextConfigured = new Object(); setTransitionRequested(true); this.resetClipHandles(); // this.stopMyContexts(); allContextsReady = false; // this.removeMyContexts(); foregroundMap = null; auditPointerMap = null; } this.getMpc = function() {return this._mpc;} this.setTag = function(tag) {this._tag = tag;} this.getTag = function() { if (this._tag == '') { return this._divId; } else { return this._tag; } } this.setDivId = function(divId) {this._divId = divId;} this.getDivId = function() {return this._divId;} this.setLoop = function(loop) {this._loop = loop;} this.setPrimary = function(primary) {this._primary = primary;} this.setSecondary = function(secondary) {this._primary = !secondary;} this.isPrimary = function() {return this.primary;} this.isSecondary = function() {return !this.primary;} this.initPlayOrBufferClip = function(clipHandle,wfv,ap) { //this.validateHtml(); //DY not being properly used. // preInit(); contextIdx++; this.addContext(contextIdx); if (this.areMsgsEnabled()) {cidMsg = contextIdx;} // TODO GLM var aClipDescriptor = ClipDescriptor.findClipDescriptor(clipHandle); if (aClipDescriptor === null) { var resolvedClip = this.resolveClip(clipHandle); if (resolvedClip !== null) { this.addSdl(resolvedClip); //alert('meActor.initPlayOrBufferClip resolvedClip: ' + resolvedClip); } } //if (!wfv && !ap) debugger; aClipDescriptor = this.processClipDescriptor(this,contextIdx,clipHandle); wfv = wfv || this.areMsgsEnabled() || aClipDescriptor.isForeground(); if (wfv) { Director.theInstance().initializeActorApp(contextIdx,this.getTag(), this.getClipWidth(),this.getClipHeight(), this._divId); } Director.theInstance().setDirCtxt(contextIdx,'waitForView' ,wfv); Director.theInstance().setDirCtxt(contextIdx,'autoplay' ,aClipDescriptor.getAutoplay()); Director.theInstance().setDirCtxt(contextIdx,'sdl' ,aClipDescriptor.getSdl()); Director.theInstance().setDirCtxt(contextIdx,'noAudio' ,aClipDescriptor.getNoAudio()); Director.theInstance().setDirCtxt(contextIdx,'convertSegments' ,aClipDescriptor.getConvertSegments()); Director.theInstance().setDirCtxt(contextIdx,'videoDataCacheSize' ,aClipDescriptor.getVideoDataCacheSize()); Director.theInstance().setDirCtxt(contextIdx,'videoIndexCacheSize',aClipDescriptor.getVideoIndexCacheSize()); Director.theInstance().setDirCtxt(contextIdx,'audioDataCacheSize' ,aClipDescriptor.getAudioDataCacheSize()); Director.theInstance().setDirCtxt(contextIdx,'audioIndexCacheSize',aClipDescriptor.getAudioIndexCacheSize()); Director.theInstance().setDirCtxt(contextIdx,'volume' ,aClipDescriptor.getVolume()); Director.theInstance().setDirCtxt(contextIdx,'codeBaseOverride' ,aClipDescriptor.getCodeBaseOverride()); Director.theInstance().setDirCtxt(contextIdx,'defined' ,'true'); Director.theInstance().setDirCtxt(contextIdx,'primary' ,this._primary); Director.theInstance().setDirCtxt(contextIdx,'autoMute' ,this._autoMute); Director.theInstance().setDirCtxt(contextIdx,'loop' ,this._loop); Director.theInstance().setDirCtxt(contextIdx,'pauseViaStall' ,this._pauseViaStall); Director.theInstance().setDirCtxt(contextIdx,'rgbSrcEnabled' ,this._rgbSrcEnabled); Director.theInstance().setDirCtxt(contextIdx,'rgbSrcIdx' ,this._rgbSrcIdx); if (this.areMsgsEnabled()) { Director.theInstance().setDirCtxt(contextIdx,'autoBandwith','false'); Director.theInstance().setDirCtxt(contextIdx,'syncBandwith','false'); Director.theInstance().setDirCtxt(contextIdx,'dumpSdl' ,'false'); } else { Director.theInstance().setDirCtxt(contextIdx,'syncBandwith',aClipDescriptor.getSyncBandwidth()); } this.processHtmlParams(contextIdx); if (this._mpc == null) { this.initMpc(); } this._contextConfigured[contextIdx] = true; } this.switchClip = function(fromHandle,toHandle) { switchContext(this.getTag(),this.getIndexOf(fromHandle),this.getIndexOf(toHandle)); transitionInProgress(); } //DY: May not be necessary function preInit() { // dr = Director.theInstance(); if (!clipDirector || (clipDirector === null)) { // COMMENTED OUT BY DON SMITH -- Replacing with callback from AppletManager //setClipDirector(dr.getInstance()); //alert('meActor.preInit clipDirector: ' + clipDirector); } return allContextsReady; } this.initialized = false; this.init = function() { if (!this.initialized) { // TODO GLM this.invoke('init',''); this.initialized = true; } } this.playInitialized = false; this.initPlay = function(clipHandle) { var aClipDescriptor = ClipDescriptor.findClipDescriptor(clipHandle); if (aClipDescriptor === null) { var resolvedClip = this.resolveClip(clipHandle); if (resolvedClip !== null) { var playCd = this.addSdl(resolvedClip); //directorTrace('meActor.initPlay resolvedClip: ' + resolvedClip); if (this._bufferClipHandle != null) { var bufferedCd = this.getClipDescriptor(this._bufferClipHandle); if (bufferedCd != null) { var ctxId = this.getContextIndex(); //directorTrace('meActor.initPlay' + ' ctxId: ' + ctxId + ' bufferedCd: \n' + bufferedCd); //alert('meActor.initPlay' + ' ctxId: ' + ctxId + ' bufferedCd: \n' + bufferedCd); playCd.cloneBasicParameters(bufferedCd); this.reconfigureContextCommon(ctxId,playCd); this._contextConfigured[ctxId] = false; // configuration finalized on first 'play' } } } } if (!this.playInitialized) { this.initPlayOrBufferClip(clipHandle,true,true); this.playInitialized = true; this.bufferInitialized = true; return true; } return false; } this.bufferInitialized = false; this.initBuffer = function(clipHandle) { if (!this.bufferInitialized || (this.getEvent() == 'init')) { //debugger; this.initPlayOrBufferClip(clipHandle,false,false); this.bufferInitialized = true; this.playInitialized = true; return true; } //debugger; return false; } this.hide = function() { // directorTrace('meActor.hide'); //hideElement(this.getTag()); //directorTrace('Actor.hide getTag: ' + this.getTag()); //AppletManager.theInstance().setVisibility(this.getTag(),false); document.getElementById(this.getTag()).style.visibility = 'hidden'; } this.show = function() { // directorTrace('meActor.show'); //showElement(this.getTag()); //directorTrace('Actor.show getTag: ' + this.getTag()); //AppletManager.theInstance().setVisibility(this.getTag(),true); document.getElementById(this.getTag()).style.visibility = 'visible'; } this.playDeferred = false; this._playClipHandle = null; this.play = function(clipHandle) { if (!Actor.started) { this.playDeferred = true; if (clipHandle) { this._playClipHandle = clipHandle; } var _this = this; setTimeout(_this.play._bind(_this,clipHandle),1000); return; } if (!clipHandle) { clipHandle = this._playClipHandle; } //debugger; if (this.chatRemoteView) { this.playChat(clipHandle); } else { var resolvedClip = this.resolveClip(clipHandle); if (resolvedClip !== null) { this.play2(resolvedClip,1,0,'-1','-1',true); } else { this.actorTrace('meActor.play UNRESOLVED CLIP: ' + clipHandle); } } this.playDeferred = false; } this.play2 = function(clipHandle,fromSegment,fromFrame,toSegment,toFrame,pauseAtEnd) { if (this.initPlay(clipHandle)) { this.trackClipHandle(clipHandle); this.playDeferred = false; // DY meInit(); Director.theInstance().initActors(); } else { // if (!reconfigurationComplete) return; var viewId = this.getContextIndex(); //this.actorTrace('meActor.play2 indexOf: ' + viewId); if ( (this._currentClipHandle !== null) && (this._currentClipHandle != clipHandle) && this._contextConfigured[viewId] && !this.isDefaultStartUp() ) { this.actorTrace('meActor.play2 switchClip' + '\n _currentClipHandle: ' + this._currentClipHandle + '\n clipHandle: ' + clipHandle); this.switchClip(this._currentClipHandle,clipHandle); this.trackClipHandle(clipHandle); } else { if (this._contextConfigured[viewId] && !this.isDefaultStartUp()) { this.actorTrace('meActor.play2 playContext' + '\n clipHandle: ' + clipHandle + '\n indexOf(clipHandle): ' + this.getIndexOf(clipHandle)); playContext(this.getIndexOf(clipHandle)); this.trackClipHandle(clipHandle); } else { // TODO GLM reprovision other html parameters // this.processClipDescriptor(this,viewId,clipHandle); this.actorTrace('meActor.play2 playClipFromTo' + '\n viewId: ' + viewId + '\n clipHandle: ' + clipHandle); this._contextConfigured[viewId] = false; this.reconfigureContext(this,viewId,clipHandle); playClipFromTo(viewId,fromSegment,fromFrame,toSegment,toFrame,pauseAtEnd,this.getClipDescriptor(clipHandle).getSdl()); this._contextConfigured[viewId] = true; this.trackClipHandle(clipHandle); } } } // this.setDefaultStartUp(false); } this.bufferDeferred = false; this._bufferClipHandle = null; var callbackbuffer = null; function callbuffer() { that.buffer(); } this.buffer = function() { var clipHandle = this._bufferClipHandle; if (arguments.length == 1) { clipHandle = arguments[0];} //alert('buffer 1:<' + clipHandle + '><' + this._bufferClipHandle + '>'); //var _this = this; if (!Actor.started || this.playDeferred) { this.bufferDeferred = true; if (clipHandle !== null) { this._bufferClipHandle = clipHandle; } setTimeout(callbuffer,1000); return; } //alert('buffer 2:<' + clipHandle + '><' + this._bufferClipHandle + '>'); var resolvedClip = this.resolveClip(clipHandle); if (resolvedClip !== null) clipHandle = resolvedClip; //directorTrace('buffer 3 clipHandle: <' + clipHandle + '>' + ' _bufferClipHandle: <' + this._bufferClipHandle + '>' + ' resolvedClip: <' + resolvedClip + '>'); this._bufferClipHandle = clipHandle; if (this.initBuffer(clipHandle)) { // TODO GLM //if (chatOnly) meInit(); this.bufferDeferred = false; } else { // if (!reconfigurationComplete) return; var ci = this.getIndexOf(clipHandle); this.processClipDescriptor(this,ci,clipHandle); bufferClipFromTo(ci,1,0,1,0,true,this.getClipDescriptor(clipHandle).getSdl()); this._contextConfigured[ci] = true; } } this.trackClipHandle = function(clipHandle) { this._previousClipHandle = this._currentClipHandle; // if (this._currentClipHandle === null) foregroundMap[this.getIndexOf(clipHandle)] = true; // foregroundMap[this.getIndexOf(clipHandle)] = (this._currentClipHandle === null); this._currentClipHandle = clipHandle; } this.resetClipHandles = function() { this._previousClipHandle = null; this._currentClipHandle = null; } this.getIndexOf = function(clipHandle) { var ctxId = 0; var ctxDef = this.getContextDefinitionByClipHandle(clipHandle); if (ctxDef != null) { ctxId = ctxDef.getIdx(); } if (ctxId == 0) directorTrace('meActor.getIndexOf' + ' clipHandle: ' + clipHandle + ' ctxId: ' + ctxId); return ctxId; } this.setAutoMute = function(autoMute) {this._autoMute = autoMute;} this.playPause = function() { // if (!reconfigurationComplete) return; var idx = (this._currentClipHandle != null) ? this.getIndexOf(this._currentClipHandle) : this.getContextIndex(); if (isContextPlaying(idx)) { pauseContext(idx); } else { // directorTrace('meActor.playPause ctxId: ' + idx); playContext(idx); } } this.stop = function() { // if (!reconfigurationComplete) return; stopContext(this.getContextIndex()); if (this.chatRemoteView || this.chatSelfView) { this.closeChat(); } } this.setMpcReference = function(mpcReference) { this._mpcReference = mpcReference; var path = mpcReference.split('/'); var i; var subscript = ''; for (i = 0; i < path.length; i++) { if (path[i].length > 0) { subscript += '[\'' + path[i] + '\']'; } } this.setMpc(eval(getClipDescriptorListAsString() + subscript)); } this.playing_stopped = function(eventDescriptor) { // var myId = eventDescriptor.split(';')[1].split(',')[0]; // if (this.areMsgsEnabled()) { // displayImage(myId,stoppedImageSpec); // hideMsgDiv(); // } // else { // // directorTrace('meActor.playing_stopped coerce: ' + myId); // // coerceAfterStop(myId); // } } this.nextSegment = function(eventDescriptor) { if (this.areMsgsEnabled()) { cidMsgSegmentNumber = eventDescriptor.split(";")[2].split(",")[0]; // directorTrace('meActor.nextSegment eventDescriptor: ' + eventDescriptor + ' cidMsgSegmentNumber:' + cidMsgSegmentNumber); var nbrOfSegments = getNbrOfSegments(this.getContextIndex()); if (nbrOfSegments === 0) nbrOfSegments = 1; if (cidMsgSegmentNumber > nbrOfSegments) nbrOfSegments = cidMsgSegmentNumber; change_message('Video Message ' + cidMsgSegmentNumber + ' of ' + nbrOfSegments); } } this.pause = function() { // if (!reconfigurationComplete) return; pauseContext(this.getContextIndex()); } this.resume = function() { // if (!reconfigurationComplete) return; // directorTrace('meActor.resume viewCtxId: ' + this.getContextIndex()); playContext(this.getContextIndex()); } this.promote = function(anActor,clipHandle) { anActor.updateHistoryList(); this.promoteRestoreCommon(anActor,clipHandle,this._eventDescriptor.split(";")[2]); } this.promoteRestoreCommon = function(anActor,clipHandle,marker) { var viewId = getViewCtxId(anActor.getTag()); // directorTrace('meActor.promoteRestoreCommon' + // ' this.name: ' + this._name + // ' anActor.name: ' + anActor._name + // ' marker: ' + marker + // ' source viewId: ' + this.getContextIndex() + // ' target viewId: ' + viewId + // ' clipHandle: ' + clipHandle + // '\n sourceFps: ' + getVideoFps(this.getContextIndex()) + // ' targetFps: ' + getVideoFps(viewId)); this.reconfigureContext(anActor,viewId,clipHandle); playClipFromTo(viewId,this.getMarkerSegment(marker),this.getMarkerRecNum(marker),'-1','-1',true,this.getClipDescriptor(clipHandle).getSdl()); transitionInProgress(); anActor.disableAudit = 2; } this.restartAtInProgress = function(eventDescriptor) {restartAtInProgress(-1,eventDescriptor);} this.restartAtComplete = function(eventDescriptor) {restartAtComplete(-1,eventDescriptor);} this.imageDisplayed = function(eventDescriptor) {msgImageDisplayed = true;} this.playMsg = function() { // if (!reconfigurationComplete) return; if (isMsgWaiting()) { var viewId = this.getContextIndex(); if (isContextPlaying(viewId)) { stopMsg(); } else { showMsgDiv(); // directorTrace('meActor.playMsg' + '\n video: ' + nextMsgClip + 'video_s1' + '\n audio: ' + nextMsgClip + 'audio_s1'); playClip(viewId,nextMsgClip+'video_s1',nextMsgClip+'audio_s1'); nextMsgClip = ''; } } } this.fullScreen = function(eventDescriptor) { // directorTrace('meActor.fullScreen'); ctxFullScreenMode = true; } this.exitFullScreen = function(eventDescriptor) { // directorTrace('meActor.exitFullScreen'); ctxFullScreenMode = false; } this.processClipDescriptor = function(anActor,index,clipHandle) { var aClipDescriptor = this.getClipDescriptor(clipHandle); //directorTrace('meActor.processClipDescriptor' + ' index: ' + index + ' clipHandle: ' + clipHandle); this._width = aClipDescriptor.getWidth(); this._height = aClipDescriptor.getHeight(); if (contextDefinitionMap === null) { contextDefinitionMap = new Object(); } var anActor = (getActorByIndex(index) != null) ? getActorByIndex(index) : this; var ctxDef = new ContextDefinition(anActor,index,clipHandle,aClipDescriptor); contextDefinitionMap[index] = ctxDef; // directorTrace('meActor.processClipDescriptor' + ' index: ' + index + ' auditPlayState: ' + ctxDef.getClipDescriptor().getAuditPlayState()); if (actorNameMap === null) { actorNameMap = new Object(); } if (!actorNameMap[this._name]) { actorNameMap[this._name] = new Object(); } // if (!actorNameMap[this._name]['instance']) // { actorNameMap[this._name]['instance'] = this; // } actorNameMap[this._name][clipHandle] = ctxDef; actorNameMap[this._name][ctxDef.getClipDescriptor().getExtendedClipHandle()] = ctxDef; if (foregroundMap === null) { foregroundMap = new Object(); } foregroundMap[index] = aClipDescriptor.isForeground(); if (auditPointerMap === null) { auditPointerMap = new Object(); } auditPointerMap[index] = aClipDescriptor.isAuditPointer(); return aClipDescriptor; } this.removeMyContexts = function() { this.myContextCtr = 0; this.myContexts = null; } this.myContextCtr = 0; this.myContexts = null; this.addContext = function(ctxId) { if (this.myContexts === null) { this.myContextCtr = 0; this.myContexts = new Object(); } this.myContexts[this.myContextCtr] = ctxId; this.myContextCtr++; } this.stopMyContexts = function() { if (this.myContexts !== null) { for (var i = 0; i < this.myContextCtr; i++) { var ctxId = this.myContexts[i]; stopContext(ctxId); //clearEventQueue(ctxId); } } } this.disableAudit = 0; this.auditBackgroundContexts = function() { var status = false; if (this.myContexts !== null) { if (this.disableAudit <= 0) { if (this.auditPointerPresent() == pointerPresentNotSupported) { for (var i = 0; i < this.myContextCtr; i++) { var ctxId = this.myContexts[i]; if (isBackground(ctxId) && isAuditPlayState(ctxId)) { var playing = isContextPlaying(ctxId); if (isMousePresent(ctxId)) { if (!playing) { directorTrace('meActor.auditBackgroundContexts mousePresent and not playing'); this.invoke('mouseEntered','audit:' + ctxId); status = true; } } else { if (playing) { directorTrace('meActor.auditBackgroundContexts mousePresent not present and playing'); this.invoke('mouseExited','audit:' + ctxId); status = true; } } } } } } } return status; } this.addEventRule('mouseExited','this.disableAudit--'); this.trackTransitions = function(event,eventDescriptor) { if (event.length > 0) { var evt = event.toString(); if ( (evt.indexOf('mouse') != -1) || (evt.indexOf('restart') != -1) ) { transitionInProgress(); // directorTrace('meActor.trackTransitions' + ' evt: ' + evt + ' ticks: ' + transitionTicks); } } } this.playRelativeScene = function(relativeSceneIndex,sourceActor,clipHandle,playToEnd) { var resolvedClip = this.resolveClip(clipHandle); if (resolvedClip !== null) clipHandle = resolvedClip; var pte = (playToEnd == undefined) ? false : playToEnd; var rsi = parseInt(relativeSceneIndex); var status = false; var sourceActorId = getCtxIdByName(sourceActor.getTag()); var ctxId = getCtxIdByName(this.getTag()); var clipHandleId = this.getIndexOf(clipHandle); var sdl = this.getClipDescriptor(clipHandle).getSdl(); var marker = getPosition(sourceActorId,''); var currentSceneIndex = this.convertMarkerToSceneIndex(sourceActorId,marker); // directorTrace('meActor.playRelativeScene' + // ' relativeSceneIndex: ' + rsi + // ' sourceActorId: ' + sourceActorId + // ' ctxId: ' + ctxId + // ' clipHandleId: ' + clipHandleId + // ' marker: ' + marker + // ' currentSceneIndex: ' + currentSceneIndex); var sceneIndex = -1; var scene = null; if (currentSceneIndex >= 0) { sceneIndex = currentSceneIndex + rsi; scene = this.getSceneByIndex(sourceActorId,sceneIndex); if (scene != null) { // directorTrace('meActor.playRelativeScene' + // '\n currentClipHandle: ' + this._currentClipHandle + // '\n clipHandle: ' + clipHandle + // '\n relativeSceneIndex: ' + rsi + // '\n marker: ' + marker + // '\n sceneIndex: ' + sceneIndex + // '\n scene: ' + scene + // '\n sourceActorId: ' + sourceActorId + // '\n ctxId: ' + ctxId + // '\n clipHandleId: ' + clipHandleId); var playId = ctxId; stopContext(playId); if ((clipHandleId != 0) && (clipHandleId != ctxId)) { this.switchClip(this._currentClipHandle,clipHandle); playId = clipHandleId; } this.playScene(playId,scene,sdl,clipHandle,pte); status = true; } } if (scene == null) { beep(); } if (!status) { directorTrace('meActor.playRelativeScene' + '\n status: ' + status + '\n currentClipHandle: ' + this._currentClipHandle + '\n clipHandle: ' + clipHandle + '\n relativeSceneIndex: ' + rsi + '\n marker: ' + marker + '\n sceneIndex: ' + sceneIndex + '\n scene: ' + scene + '\n sourceActorId: ' + sourceActorId + '\n ctxId: ' + ctxId + '\n clipHandleId: ' + clipHandleId); } return status; } this.convertMarkerToSceneIndex = function(ctxId,marker) { // marker == 'segment,recNum' var sceneIndex = -1; var sceneDatabase = this.getSceneDatabase(ctxId); if (sceneDatabase != null) { var searchSegment = this.getMarkerSegment(marker); var searchRecNum = this.getMarkerRecNum(marker); var fromSegment = 1; var fromRecNum = 0; var toSegment = 1; var toRecNum = 0; for (var i = 0; i < sceneDatabase.length; i++) { var scene = this.getScene(sceneDatabase,i); if (scene != null) { fromSegment = this.getSceneFromSegment(scene); fromRecNum = this.getSceneFromRecNum(scene); toSegment = this.getSceneToSegment(scene); toRecNum = this.getSceneToRecNum(scene); if ((searchSegment < fromSegment) || (searchSegment > toSegment)) continue; if ((searchSegment == fromSegment) && (searchRecNum < fromRecNum)) continue; if ((searchSegment == toSegment) && (searchRecNum > toRecNum)) continue; sceneIndex = i; break; } } } else { directorTrace('meActor.convertMarkerToSceneIndex' + ' ctxId: ' + ctxId + ' sceneDatabase NULL'); } // directorTrace('meActor.convertMarkerToSceneIndex' + // '\n ctxId: ' + ctxId + // '\n scene: ' + scene + // '\n sceneIndex: ' + sceneIndex + // '\n searchSegment: ' + searchSegment + // ' searchRecNum: ' + searchRecNum + // '\n fromSegment: ' + fromSegment + // ' fromRecNum: ' + fromRecNum + // '\n toSegment: ' + toSegment + // ' toRecNum: ' + toRecNum); return parseInt(sceneIndex); } this.getSceneDatabase = function(ctxId) { var sceneDatabase = null; if (contextDefinitionMap[ctxId]) { var ctxDef = contextDefinitionMap[ctxId]; if (ctxDef != null) { sceneDatabase = ctxDef.getClipDescriptor().getScenes(); } } return sceneDatabase; } this.getScene = function(sceneDatabase,sceneIndex) { return (sceneDatabase[sceneIndex]) ? sceneDatabase[sceneIndex] : null; // 'sceneName;startSegment,startRecNum:endSegment,endRecNum' } this.getSceneByIndex = function(ctxId,sceneIndex) { var sceneDatabase = this.getSceneDatabase(ctxId); return (sceneDatabase != null) ? this.getScene(sceneDatabase,sceneIndex) : null; } this.getSdlByIndex = function(ctxId) { var sdl = null; if (contextDefinitionMap[ctxId]) { var ctxDef = contextDefinitionMap[ctxId]; // directorTrace('meActor.getSdlByIndex' + ' ctxId: ' + ctxId + ' ctxDef: ' + ctxDef); if (ctxDef != null) { var cd = ctxDef.getClipDescriptor(); sdl = cd.getSdl(); } } return sdl; } this.playScene = function(ctxId,scene,sdl,clipHandle,playToEnd) { var resolvedClip = this.resolveClip(clipHandle); if (resolvedClip !== null) clipHandle = resolvedClip; var pte = (typeof playToEnd == 'undefined') ? false : playToEnd; var fromSegment = this.getSceneFromSegment(scene); var fromRecNum = this.getSceneFromRecNum(scene); var toSegment = this.getSceneToSegment(scene); var toRecNum = this.getSceneToRecNum(scene); if (pte) { toSegment = -1; toRecNum = -1; } if (sdl == null) { sdl = this.getSdlByIndex(ctxId); } if (clipHandle != null) { this.reconfigureContext(this,ctxId,clipHandle); setNoAudio(ctxId,false); } // directorTrace('meActor.playScene' + ' ctxId: ' + ctxId + ' scene: ' + scene + ' playToEnd: ' + pte + // '\n fromSegment: ' + fromSegment + ' fromRecNum: ' + fromRecNum + ' toSegment: ' + toSegment + ' toRecNum: ' + toRecNum); playClipFromTo(ctxId,fromSegment,fromRecNum,toSegment,toRecNum,true,sdl); } this.getMarkerSegment = function(marker) { var segment = 1; if (marker && (marker.length > 0)) { segment = marker.split(',')[0]; } return parseInt(segment); } this.getMarkerRecNum = function(marker) { var recNum = 0; if (marker && (marker.length > 0)) { recNum = marker.split(',')[1]; } return parseInt(recNum); } this.getSceneName = function(scene) { var sceneName = null; if (scene && (scene.length > 0)) { sceneName = scene.split(';')[0]; } return sceneName; } this.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); } this.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); } this.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); } this.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); } this.getContextIndex = function() { return getViewCtxId(this.getTag()); } this.autoRelativeRange = 0; this.relativeRanges = null; this.getRelativeRange = function(rangeNbr) { var range = null; if (this.relativeRanges != null) { range = this.relativeRanges[rangeNbr]; } return range; } this.maxRelativeRange = 9999; this.setMaxRelativeRange = function(max) { this.maxRelativeRange = max; } this.resetMaxRelativeRange = function() { this.setMaxRelativeRange(9999); } this.addRelativeRange = function(sourceActor,rangeName,rangeNbr,timeOffset) { // rangeNbr = 0-9999 or -1 if function is to auto assign. // rangeNbr = text name for range, 'auto' to auto number names // timeOffset = plus or minus seconds if (rangeNbr == -1) { rangeNbr = this.autoRelativeRange; this.autoRelativeRange++; this.autoRelativeRange = this.autoRelativeRange % this.maxRelativeRange; } if (rangeName == 'auto') { rangeName += rangeNbr; } if (this.relativeRanges == null) { this.relativeRanges = new Array(); } var range = this.createRelativeRange(sourceActor,rangeName,timeOffset); if ((range != null) && (range.length > 0)) { this.relativeRanges[rangeNbr] = range; } } this.createRelativeRange = function(sourceActor,rangeName,timeOffset,playToEnd) { var pte = (playToEnd == undefined) ? false : playToEnd; var sourceActorId = getCtxIdByName(sourceActor.getTag()); var marker = getPosition(sourceActorId,''); var sourceSegment = this.getMarkerSegment(marker); var sourceRecNum = this.getMarkerRecNum(marker); var recNumRatio = getRecNumRatio(sourceActorId,sourceSegment); var fps = getVideoFps(sourceActorId) * recNumRatio; var recNumOffset = Math.ceil(fps * timeOffset); var range = ''; if (recNumOffset < 0) { var startSegment = sourceSegment; var startRecNum = sourceRecNum + recNumOffset; while (startRecNum < 0) { if (startSegment == 1) { startRecNum = 0; } else { startSegment--; startRecNum += getLastRawRecNum(sourceActorId,startSegment); } // directorTrace('meActor.createRelativeRange' + // '\n sourceActorId: ' + sourceActorId + // '\n marker: ' + marker + // '\n sourceSegment: ' + sourceSegment + // '\n sourceRecNum: ' + sourceRecNum + // '\n recNumRatio: ' + recNumRatio + // '\n fps: ' + fps + // '\n recNumOffset: ' + recNumOffset + // '\n startSegment: ' + startSegment + // '\n startRecNum: ' + startRecNum); } range = this.constructSceneDescriptor(rangeName,startSegment,startRecNum,sourceSegment,sourceRecNum,pte); } else { var endSegment = sourceSegment; var endRecNum = sourceRecNum + recNumOffset; var lastRecNum = getLastRawRecNum(sourceActorId,endSegment); var finalSegment = getNbrOfSegments(sourceActorId); while (endRecNum > lastRecNum) { if (endSegment == finalSegment) { endRecNum = lastRecNum; } else { endSegment++; endRecNum -= lastRecNum; lastRecNum = getLastRawRecNum(sourceActorId,endSegment); } } range = this.constructSceneDescriptor(rangeName,sourceSegment,sourceRecNum,endSegment,endRecNum,pte); } // directorTrace('meActor.createRelativeRange' + ' marker: ' + marker + ' range: ' + range); return range; } this.constructSceneDescriptor = function(sceneName,startSegment,startRecNum,endSegment,endRecNum,playToEnd) { var pte = (playToEnd == undefined) ? false : playToEnd; if (pte) { endSegment = '-1'; endRecNum = '-1'; } return sceneName + ';' + startSegment + ',' + startRecNum + ':' + endSegment + ',' + endRecNum; } this.playRelativeRange = function(rangeNbr,sourceActor,clipHandle,playToEnd) { var resolvedClip = this.resolveClip(clipHandle); if (resolvedClip !== null) clipHandle = resolvedClip; var pte = (playToEnd == undefined) ? false : playToEnd; var status = false; var range = this.getRelativeRange(rangeNbr); if (range != null) { this.stop(); if (sourceActor != null) { sourceActor.pause(); } var cd = this.getClipDescriptor(clipHandle); // directorTrace('meActor.playRelativeRange' + // ' ctxIndex: ' + this.getContextIndex() + // ' clipHandle: ' + clipHandle + // ' cd: ' + cd); this.playScene(this.getContextIndex(),range,cd.getSdl(),cd.getExtendedClipHandle(),pte); status = true; } else { beep(); } return status; } this.playRelative = function(sourceActor,timeOffset,playToEnd) { var pte = (playToEnd == undefined) ? false : playToEnd; var timOff = parseInt(timeOffset); var ctxId = getCtxIdByName(this.getTag()); var range = this.createRelativeRange(sourceActor,'playRelative',timOff,pte); if (range != null) { if (this != sourceActor) { sourceActor.pause(); } // directorTrace('meActor.playRelative' + ' ctxId: ' + ctxId + ' range: ' + range + ' playToEnd: ' + pte); this.playScene(ctxId,range,null,null,pte); } else { beep(); } } this.getClipDescriptor = function(clipHandle) { var cd = null; if (clipHandle && (clipHandle.length > 0)) { clipHandle = clipHandle.trim(); if (clipHandle.indexOf('/') == 0) { var subscript = ''; var path = clipHandle.split('/'); for (i = 0; i < path.length; i++) { if (path[i].length > 0) { subscript += '[\'' + path[i] + '\']'; } } cd = eval(getClipDescriptorListAsString() + subscript); } else { if ((this._mpc !== null) && (this._mpc[clipHandle])) { cd = this._mpc[clipHandle]; } } if (cd === null) { cd = ClipDescriptor.findClipDescriptor(clipHandle); } } return cd; } this.getContextDefinitionByClipHandle = function(clipHandle) { var ctxDef = null; if (actorNameMap[this._name][clipHandle]) { ctxDef = actorNameMap[this._name][clipHandle]; } else { var cd = this.getClipDescriptor(clipHandle); if (cd != null) { if (actorNameMap[this._name][cd.getExtendedClipHandle()]) { ctxDef = actorNameMap[this._name][cd.getExtendedClipHandle()]; } } } return ctxDef; } this.getEvent = function() { return this._event; } this.reconfigureContext = function(anActor,ctxId,clipHandle) { var cd = this.processClipDescriptor(anActor,ctxId,clipHandle); this.reconfigureContextCommon(ctxId,cd); this._contextConfigured[ctxId] = false; // configuration finalized on first 'play' } this.reconfigureContextCommon = function(ctxId,cd) { setAutoplay(ctxId,cd.getAutoplay()); setNoAudio(ctxId,cd.getNoAudio()); setConvertSegments(ctxId,cd.getConvertSegments()); if (cd.getVolume() > 0) { setVolume(ctxId,cd.getVolume()); } setVideoDataCacheSize(ctxId,cd.getVideoDataCacheSize()); setVideoIndexCacheSize(ctxId,cd.getVideoIndexCacheSize()); setAudioDataCacheSize(ctxId,cd.getAudioDataCacheSize()); setAudioIndexCacheSize(ctxId,cd.getAudioIndexCacheSize()); setAutoBandwidth(ctxId,cd.getAutoBandwidth()); setSyncBandwidth(ctxId,cd.getSyncBandwidth()); setCodeBaseOverride(ctxId,cd.getCodeBaseOverride()); // directorTrace('meActor.reconfigureContextCommon\n' + cd); } this.macro = function(macroName) { if (macroName.length > 0) { if (macroName.indexOf(')') == -1) { macroName += '()'; } eval(macroName); } } this.restore = function(clipHandle) { var resolvedClip = this.resolveClip(clipHandle); if (resolvedClip !== null) clipHandle = resolvedClip; this.initHistoryList(); this.stop(); var xch = this.getClipDescriptor(clipHandle).getExtendedClipHandle(); // directorTrace('meActor.restore' + ' extendedClipHandle: ' + xch + ' marker: ' + this.historyList[xch]); this.promoteRestoreCommon(this,clipHandle,this.historyList[xch]); } this.updateHistoryList = function() { this.initHistoryList(); var marker = getPosition(this.getContextIndex(),''); var xch = this.getClipDescriptor(this._currentClipHandle).getExtendedClipHandle(); this.historyList[xch] = marker; // directorTrace('meActor.updateHistoryList' + ' extendedClipHandle: ' + xch + ' marker: ' + marker); } this.historyList = null; this.initHistoryList = function() { if (this.historyList == null) { this.historyList = new Object(); } } this.getName = function() { return this._name; } this.auditPointerPresent = function() { return pointerPresentNotSupported; var status = pointerPresentNotSupported; if (this.myContexts !== null) { for (var i = 0; i < this.myContextCtr; i++) { var ctxId = this.myContexts[i]; status = isPointerPresent(ctxId); if (status != pointerPresentNotSupported) { if ((status == pointerNotPresent) && (isBackground(ctxId)) && (isAuditPointer(ctxId)) && (isContextPlaying(ctxId))) { // directorTrace('meActor.auditPointerPresent' + ' mouseExited recovery: ' + ctxId); this.invoke('mouseExited','audit:' + ctxId); } } else { break; } } } return status; } this.displayImage = function(image) { displayImage(this.getContextIndex(),image); } this.start = function(last) { if (!this.isStartUpClipDefined()) { this.actorTrace('meActor.start name: ' + name); this.configure_default(name); } if (last && !Actor.started) { if (this.cameraCaptureMode) { //this.startCameraCaptureMode(); } Actor.configureVmp(); Actor.started = true; // DY requestMpcReconfiguration('meInit',''); requestMpcReconfiguration('Director.theInstance().initActors',''); } } this.cd_sdlBase = null; this.cd_sdlPrefix = null; this.cd_sdl = 'video_s1.dat.sdl'; this.cd_width = (clipWidth) ? clipWidth : 160; this.setClipWidth = function(width) { this.cd_width = width; } this.getClipWidth = function() { return this.cd_width; } this.cd_height = (clipHeight) ? clipHeight : 128; this.setClipHeight = function(height) { this.cd_height = height; } this.getClipHeight = function() { return this.cd_height; } this.cd_autoplay = true; this.cd_noAudio = false; this.cd_convertSegments = false; this.cd_volume = 90; this.cd_foreground = true; this.cd_scenes = null; this.cd_videoDataCacheSize = 524288; this.cd_videoIndexCacheSize = 262144; this.cd_audioDataCacheSize = 262144; this.cd_audioIndexCacheSize = 262144 this.cd_auditPlayState = false; this.cd_auditPointer = false; this.cd_autoBandwidth = false; this.cd_syncBandwidth = false; this.cd_codeBaseOverride = null; this.cdList = null; this.initCdList = function(anSdl) { var resolvedClip = this.resolveClip(anSdl); if (resolvedClip !== null) anSdl = resolvedClip; var cd = null; if (anSdl && (anSdl.length > 0)) { if (this.cdList === null) { this.cdList = new Object(); } else { cd = this.cdList[anSdl]; } if (!cd || (cd === null)) { cd = this.addSdl(anSdl); } } return cd; } this.addSdl = function(anSdl) { var cd = null; if (anSdl && (anSdl.length > 0)) { if (this.cdList === null) { this.cdList = new Object(); } if (this.cdList[anSdl]) { cd = this.cdList[anSdl]; } else { var endOfSdlBase = location.href.lastIndexOf('/')+1; var endOfSdlPrefix = anSdl.lastIndexOf('/')+1; this.cd_sdlBase = location.href.substring(0,endOfSdlBase); var differentBase = (anSdl.indexOf(this.cd_sdlBase) == -1); var absoluteSdl = this.isAbsoluteSdl() || differentBase; if (!absoluteSdl) { this.cd_sdlPrefix = anSdl.substring(endOfSdlBase,endOfSdlPrefix); } else { this.cd_sdlPrefix = ''; this.cd_sdlBase = anSdl.substring(0,endOfSdlPrefix); this.cd_codeBaseOverride = this.cd_sdlBase; } if (false) { alert('meActor.addSdl' + '\n location.href : ' + location.href + '\n anSdl : ' + anSdl + '\n isAbsoluteSdl : ' + this.isAbsoluteSdl() + '\n differentBase : ' + differentBase + '\n absoluteSdl : ' + absoluteSdl + '\n cd_sdlBase : ' + this.cd_sdlBase + '\n cd_sdlPrefix : ' + this.cd_sdlPrefix + '\n cd_codeBaseOverride: ' + this.cd_codeBaseOverride); } cd = new ClipDescriptor(this.cd_sdlBase, this.cd_sdlPrefix, anSdl.substring(endOfSdlPrefix,anSdl.length), this.cd_width, this.cd_height, this.cd_autoplay, this.cd_noAudio, this.cd_convertSegments, this.cd_volume, this.cd_foreground, this.cd_scenes, this.cd_videoDataCacheSize, this.cd_videoIndexCacheSize, this.cd_audioDataCacheSize, this.cd_audioIndexCacheSize, this.cd_auditPlayState, this.cd_auditPointer, this.cd_autoBandwidth, this.cd_syncBandwidth, this.cd_codeBaseOverride ); this.cdList[anSdl] = cd; ClipDescriptor.sdlList[anSdl] = cd; // directorTrace('meActor.addSdl ' + cd); } } return cd; } this.setSdlBase = function(anSdl,sdlBase) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setSdlBase(sdlBase); //this.cd_sdlBase = sdlBase; } } this.setSdlPrefix = function(anSdl,sdlPrefix) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setSdlPrefix(sdlPrefix); //this.cd_sdlPrefix = sdlPrefix; } } this.setWidth = function(anSdl,width) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setWidth(width); //this.cd_width = width; } } this.setHeight = function(anSdl,height) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setHeight(height); //this.cd_height = height; } } this.setAutoplay = function(anSdl,autoplay) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setAutoplay(autoplay); //this.cd_autoplay = autoplay; } } this.setNoAudio = function(anSdl,noAudio) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setNoAudio(noAudio); noAudio = cd.getNoAudio(); //this.cd_noAudio = noAudio; if (noAudio) { cd.setVolume = 0; //this.cd_volume = 0; cd.setAudioDataCacheSize = -1; //this.cd_audioDataCacheSize = -1; cd.setAudioIndexCacheSize = -1; //this.cd_audioIndexCacheSize = -1; } } } this.setConvertSegments = function(anSdl,convertSegments) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setConvertSegments(convertSegments); //this.cd_convertSegments = convertSegments; } } this.setVolume = function(anSdl,volume) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setVolume(volume); //this.cd_volume = volume; } } this.setForeground = function(anSdl,foreground) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setForeground(foreground); //this.cd_foreground = foreground; } } this.setScenes = function(anSdl,scenes) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setScenes(scenes); //this.cd_scenes = scenes; } } this.setVideoDataCacheSize = function(anSdl,videoDataCacheSize) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setVideoDataCacheSize(videoDataCacheSize); //this.cd_videoDataCacheSize = videoDataCacheSize; } } this.setVideoIndexCacheSize = function(anSdl,videoIndexCacheSize) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setVideoIndexCacheSize(videoIndexCacheSize); //this.cd_videoIndexCacheSize = videoIndexCacheSize; } } this.setAudioDataCacheSize = function(anSdl,audioDataCacheSize) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setAudioDataCacheSize(audioDataCacheSize); //this.cd_audioDataCacheSize = audioDataCacheSize; } } this.setAudioIndexCacheSize = function(anSdl,audioIndexCacheSize) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setAudioIndexCacheSize(audioIndexCacheSize); //this.cd_audioIndexCacheSize = audioIndexCacheSize; } } this.setAuditPlayState = function(anSdl,auditPlayState) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setAuditPlayState(auditPlayState); //this.cd_auditPlayState = auditPlayState; } } this.setAuditPointer = function(anSdl,auditPointer) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setAuditPointer(auditPointer); //this.cd_auditPointer = auditPointer; } } this.setAutoBandwidth = function(anSdl,autoBandwidth) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setAutoBandwidth(autoBandwidth); } } this.setSyncBandwidth = function(anSdl,syncBandwidth) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setSyncBandwidth(syncBandwidth); } } this.setCodeBaseOverride = function(anSdl,aUrl) { var cd = this.initCdList(anSdl); if (cd !== null) { cd.setCodeBaseOverride(aUrl); } } this.clips = null; this.resolveClip = function(clipHandle) { var resolvedClip = null; if (clipHandle && (clipHandle.length > 0)) { if (clipHandle.startsWith('http://') || clipHandle.startsWith('https://') || clipHandle.startsWith('file:/')) { resolvedClip = clipHandle; } else { if (this.clips === null) { this.initClips(); } // check if it is in the cache if (this.clips[clipHandle] && (this.clips[clipHandle] !== null)) { resolvedClip = this.clips[clipHandle]; } else { // resolve clip using server, then add to clips[] var i; for (i = 0; i < 10; i++) { resolvedClip = HostingAgent.theInstance().getDefaultFile(clipHandle); if ((resolvedClip == null) || (resolvedClip == "")) { continue; } if (resolvedClip.startsWith('http://') || resolvedClip.startsWith('https://') || resolvedClip.startsWith('file:/')) { break; } var eTxt = "[" + i + "]Actor.resolveClip INVALID RESOLVE: " + resolvedClip; windowStatus(eTxt); alert(eTxt); } if ((resolvedClip == "") || (resolvedClip == null)){ resolvedClip = null; if (!this.isChat()) directorTrace("meActor.resolveClip UNABLE TO RESOLVE clip: " + clipHandle); //alert("meActor.resolveClip UNABLE TO RESOLVE clip: " + clipHandle); } else{ //resolvedClip = unescape(resolvedClip); //directorTrace('meActor.resolveClip resolvedClip: ' + resolvedClip); this.clips[clipHandle] = resolvedClip; // add to cache } } } } //directorTrace('Actor.resolveClip resolvedClip: ' + resolvedClip); return resolvedClip; } this.unresolveClip = function(clipHandle) { if (clipHandle && (clipHandle.length > 0)) { if (this.clips !== null) { if (this.clips[clipHandle]) { this.clips[clipHandle] = null; } } } } this.forceClipResolve = function() { } this.initClips = function() { this.clips = new Object(); // TODO GLM TEMP hardcode clip translation until server stuff available //this.clips['MI2_TEASER'] = 'http://www.eviewworld.com/devel/test1/clips/MI2/teaser/video_s1.dat.sdl'; //this.clips['MI2_TEASER_EXPANSION'] = 'http://www.eviewworld.com/devel/test1/clips/MI2/teaserExpansion/video_s1.dat.sdl'; } this.isDeferred = function() { return this.playDeferred || this.bufferDeferred; } this.chatProxy = null; this.chatApplet = null; this.setChatApplet = function(chatApplet) { if (chatApplet) { this.chatApplet = chatApplet; } else { this.chatApplet = null; } } this.chatCaller = ''; this.publish = function(chatCaller) { var idx = (this._currentClipHandle != null) ? this.getIndexOf(this._currentClipHandle) : this.getContextIndex(); playContext(idx); this.chatCaller = chatCaller; if (this.chatApplet === null) { this.chatApplet = chatApplet; } if (this.chatProxy === null) { // this.chatProxy = new Chat(this.chatApplet); this.chatProxy = Chat.theInstance(this.chatApplet); } // var channels = this.chatProxy.acquireChannelsFor(this.chatCaller); // directorTrace('meActor.publish' + // ' userName: ' + this.chatCaller + // ' videoRTP: ' + channels.videoRTP + // ' videoRTCP: ' + channels.videoRTCP + // ' audioRTP: ' + channels.audioRTP + // ' audioRTCP: ' + channels.audioRTCP); this.chatProxy.openChannel(this.chatCaller,Chat.outgoing, this); } this.chatCallee = ''; this.chatRgbIdx = -1; this.playChat = function(chatCallee,switchSession) { this.chatCallee = chatCallee; switchSession = switchSession || false; var idx = (this._currentClipHandle != null) ? this.getIndexOf(this._currentClipHandle) : this.getContextIndex(); playContext(idx); if (this.chatApplet === null) { this.chatApplet = chatApplet; } if (this.chatProxy === null) { //this.chatProxy = new Chat(this.chatApplet); this.chatProxy = Chat.theInstance(this.chatApplet); } if (!switchSession) { //this.chatRgbIdx = this.chatProxy.openChannel(this.chatCallee,Chat.incoming); this.chatProxy.openChannel(this.chatCallee,Chat.incoming, this); } } //DY temporary workaround. this.channels = new Object(); this.channelAcquired = function(_status, _channels){ if(_channels != null){ this.channels.videoRTP = _channels.videoRTP; this.channels.videoRTCP = _channels.videoRTCP; this.channels.audioRTP = _channels.audioRTP; this.channels.audioRTCP = _channels.audioRTCP; } if(this.chatRemoteView){ this.chatRgbIdx = _status; if ((this.chatRgbIdx == null) || (this.chatRgbIdx < 0)) { directorTrace('meActor.playChat unable to open channel. chatRgbIdx: ' + this.chatRgbIdx); } else { setRgbSrcIdx(getCtxIdByName(this.getTag()),this.chatRgbIdx); } } else if(this.chatSelfView){ this.setRgbSrcIdx(0); // selfview is always 0 (zero) this.chatRgbIdx = _status; } } var meDefaultClip1 = 'meDefaultClip1'; this.getMeDefaultClip1 = function() { if (meDefaultClip1 == 'meDefaultClip1') { var componentFactory = new ComponentFactory(); meDefaultClip1 = componentFactory.codebase + "clips/meDefaultClip1/video_s1.dat.sdl"; } return meDefaultClip1; } var meDefaultClip2 = 'meDefaultClip2'; this.getMeDefaultClip2 = function() { if (meDefaultClip2 == 'meDefaultClip2') { var componentFactory = new ComponentFactory(); meDefaultClip2 = componentFactory.codebase + "clips/meDefaultClip2/video_s1.dat.sdl"; } return meDefaultClip2; } this.chatSelfView = false; this.configureChatSelfView = function(primary) { primary = (typeof primary == 'undefined') ? true : primary; this.chatSelfView = true; this.setSecondary('true'); this.setRgbSrcEnabled(true); this.setRgbSrcIdx(0); // selfview is always 0 (zero) this.buffer(this.getMeDefaultClip1()); this.setAutoplay(this.getMeDefaultClip1(),false); this.setNoAudio(this.getMeDefaultClip1(),true); if (primary) Chat.selfView = this; // primary starts first. can be swapped out for a secondary } this.chatRemoteView = false; this.configureChatRemoteView = function(primary) { primary = (typeof primary == 'undefined') ? true : primary; this.chatRemoteView = true; this.setSecondary('true'); this.setRgbSrcEnabled(true); this.setRgbSrcIdx((enableMulticast) ? -1 : 1); // starting off with -1 blocks processing until connected this.buffer(this.getMeDefaultClip2()); this.setAutoplay(this.getMeDefaultClip2(),false); // DY createViewType makes "pels X lines" as a string but the whole ChatViews // has not been used anywhere. // var viewType = ChatViews.createViewType(this.getClipWidth(),this.getClipHeight()); var viewType = this.getClipWidth() + "x" + this.getClipHeight(); if (typeof Chat.remoteView[viewType] == 'undefined') { Chat.remoteView[viewType] = new Array(); } //alert('Actor.configureChatRemoteView' + ' viewType: ' + viewType + ' name: ' + this._name); Chat.remoteView[viewType][this._name] = this; // allow multiple remote views at different resolutions } this.closeChat = function() { //directorTrace('meActor.closeChat'); if (this.chatProxy != null) { if(this.chatSelfView){ this.chatProxy.stopVideoCapture(); } this.chatProxy.closeChannel(this.chatRgbIdx); } } this.startChat = function(disableAudio,vxnServerAddress,vxnServerPort) { //directorTrace('meActor.startChat'); if (this.chatApplet === null) { this.chatApplet = chatApplet; } if (this.chatProxy === null) { // this.chatProxy = new Chat(this.chatApplet); this.chatProxy = Chat.theInstance(this.chatApplet); } this.chatProxy.startChat(disableAudio,vxnServerAddress,vxnServerPort); } this.closeChannel = function(){ if(this.chatRemoteView){ //debugger; this.chatProxy.closeChannel(this.chatRgbIdx); } } // CAMERA CAPTURE this.cameraCaptureMode = false; this.cameraCapture = null; if (cameraCaptureDocument != null) { this.captureApplet = cameraCaptureDocument; //alert('meActor.' + '\n captureApplet: [' + this.captureApplet + ']' + '\n cameraCaptureDocument: [' + cameraCaptureDocument + ']'); } else { this.captureApplet = null; } this.getCaptureHandle = function() { return this.getMeDefaultClip1(); } this.getDefaultHandle = function() { return this.getMeDefaultClip2(); } /** * @deprecated */ this.configureCameraCapture = function(name) { this.configure_capture(name); } this.configure_capture = function(name) { //alert('meActor.configure_capture' + ' name: ' + name); var handle = this.getCaptureHandle(); this.cameraCaptureMode = true; this.buffer(handle); this.setSecondary('true'); this.setAutoplay(handle,false); this.setNoAudio(handle,true); this.startCameraCaptureMode(); } // if (name && isString(name) && (name.length > 0)) // { // if (name.toLowerCase().startsWith('capture')) // { // this.configureCameraCapture(name); // } // } this.startCameraCaptureMode = function() { //alert('[1]meActor.startCameraCaptureMode' + '\n cameraCapture: ' + this.cameraCapture + '\n captureApplet: ' + this.captureApplet); if (this.cameraCapture === null) { if (this.captureApplet !== null) { //alert('[2]meActor.startCameraCaptureMode' + '\n cameraCapture: ' + this.cameraCapture + '\n captureApplet: ' + this.captureApplet); this.cameraCapture = CameraCapture; this.cameraCapture(this.captureApplet); } else { directorTrace('meActor.startCameraCaptureMode captureApplet NULL'); } } } this.setCaptureApplet = function(captureApplet) { //debugger; /* if (captureApplet) { this.captureApplet = captureApplet; AVDevice.deviceApplet = this.captureApplet; } else { this.captureApplet = null; } */ } function setAutoplay(ctxId,state) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setAutoplay,' + state); } function setNoAudio(ctxId,state) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setNoAudio,' + state); } function setConvertSegments(ctxId,state) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setConvertSegments,' + state); } function setVolume(ctxId,volume) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setVolume,' + volume); } function setVideoDataCacheSize(ctxId,size) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setVideoDataCacheSize,' + size); } function setVideoIndexCacheSize(ctxId,size) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setVideoIndexCacheSize,' + size); } function setAudioDataCacheSize(ctxId,size) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setAudioDataCacheSize,' + size); } function setAudioIndexCacheSize(ctxId,size) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setAudioIndexCacheSize,' + size); } function getActorNameByIndex(ctxId) { return clipDirector.ep_invokeAndWait(ctxId.toString() + ',,ep_getActorName'); } function isPointerPresent(ctxId) { return (clipDirector != null) ? clipDirector.ep_invokeAndWait(ctxId.toString() + ',,ep_isPointerPresent') : false; } function setRgbSrcIdx(ctxId,idx) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setRgbSrcIdx,' + idx); } function setAutoBandwidth(ctxId,state) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setAutoBandwidth,' + state); } function setSyncBandwidth(ctxId,state) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setSyncBandwidth,' + state); } function setCodeBaseOverride(ctxId,path) { if (path != null) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setCodeBaseOverride,' + path); } else { directorTrace('meIntfc.setCodeBaseOverride path is NULL'); } } function setSceneMergeTmpDir(ctxId,tmpDir) { clipDirector.ep_invokeAndWait(ctxId + ',,ep_setSceneMergeTmpDir,' + tmpDir); } this.defaultStartUp = false; this.isDefaultStartUp = function () { return this.defaultStartUp; } this.setDefaultStartUp = function(state) { this.defaultStartUp = state; } /** * @deprecated */ this.configure_meutil = function(name) { this.configure_default(name); } this.configure_default = function(name) { this.actorTrace('meActor.configure_default name: ' + name); var handle = this.getDefaultHandle(); this.cd_convertSegments = false; this.buffer(handle); this.setDefaultStartUp(true); this.setSecondary(true); this.setAutoplay(handle,false); this.setAutoBandwidth(handle,false); this.setSyncBandwidth(handle,false); } this.configure_sdlwriter = function(name) { var handle = this.getDefaultHandle(); this.cd_convertSegments = false; this.buffer(handle); this.setDefaultStartUp(true); this.setSecondary('true'); this.setAutoplay(handle,false); this.setAutoBandwidth(handle,false); this.setSyncBandwidth(handle,false); this.sdlWriter = SdlWriter; this.sdlWriter(this); } this.configure_scenemerge = function(name) { var handle = this.getDefaultHandle(); this.cd_convertSegments = false; this.buffer(handle); this.setDefaultStartUp(true); this.setSecondary('true'); this.setAutoplay(handle,false); this.setAutoBandwidth(handle,false); this.setSyncBandwidth(handle,false); this.addEventRule('videoMergeClipComplete','SceneMerge.instance.mergeClipComplete(SceneMerge.instance.getContextIndex(),SceneMerge.instance.getEventDescriptor())'); this.addEventRule('audioMergeClipComplete','SceneMerge.instance.mergeClipComplete(SceneMerge.instance.getContextIndex(),SceneMerge.instance.getEventDescriptor())'); this.scenemerge = SceneMerge; this.scenemerge(this); } this.validateHtml = function() { if (document.getElementById(this._divId) === null) { alert('meActor.validateHtml' + '\n CANNOT FIND HTML ELEMENT FOR ACTOR: ' + this._name); } } this.isChat = function() { return this.chatSelfView || this.chatRemoteView; } this.isAbsoluteSdl = function() { return ((typeof Actor.sdlPathType !== 'undefined') && isString(Actor.sdlPathType) && (Actor.sdlPathType.toLower() == 'absolute')) } this.isStartUpClipDefined = function() { this.actorTrace('meActor.isStartUpClipDefined' + '\n bufferDeferred: ' + this.bufferDeferred + '\n bufferInitialized: ' + this.bufferInitialized + '\n playDeferred: ' + this.playDeferred + '\n playInitialized: ' + this.playInitialized); return (this.bufferDeferred || this.bufferInitialized || this.playDeferred || this.playInitialized); } this.actorTrace = function(text) { var msg = '[' + this.getContextIndex() + '][' + this.getName() + '][' + this.getTag() + '][' + this.getDivId() + ']\n'; directorTrace(msg + text); } this.ep_invoke = function(args) { try {clipDirector.ep_invoke(args);} catch (err) {directorTrace('Actor.ep_invoke args: ' + args + ' EXCEPTION: ' + err.description);} } this.ep_invokeAndWait = function(args) { try {clipDirector.ep_invokeAndWait(args);} catch (err) {directorTrace('Actor.ep_invokeAndWait args: ' + args + ' EXCEPTION: ' + err.description);} } var htmlParams = new Array(); var htmlParamDelimiter = '|'; this.addHtmlParam = function(name,value) { htmlParams[htmlParams.length] = '' + name + htmlParamDelimiter + value; } this.processHtmlParams = function(ctxId) { try { for (var i = 0; i < htmlParams.length; i++) { var args = htmlParams[i].split(htmlParamDelimiter); Director.theInstance().setDirCtxt(ctxId,args[0],args[1]); } } catch (err) {directorTrace('Actor.processHtmlParams dr: ' + Director.theInstance() + ' ctxId: ' + ctxId + ' args: ' + args + ' EXCEPTION: ' + err.description);} } // 'sceneName;fromSegment,fromRecNum:toSegment,toRecNum' var previousSceneClipHandle = null; this.playScene2 = function(scene,clipHandle) { 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); var resolvedClip = this.resolveClip(clipHandle); this.actorTrace('Actor.playScene2' + ' scene: ' + scene + ' clipHandle: ' + clipHandle + '\n resolvedClip: ' + resolvedClip + '\n sceneName: ' + sceneName + ' fromSegment: ' + fromSegment + ' fromRecNum: ' + fromRecNum + ' toSegment: ' + toSegment + ' toRecNum: ' + toRecNum); if (resolvedClip !== null) { if (clipHandle != previousSceneClipHandle) { previousSceneClipHandle = clipHandle; this.play2(resolvedClip,fromSegment,fromRecNum,toSegment,toRecNum,true); } else { this.playFromTo(fromSegment,fromRecNum,toSegment,toRecNum); } } else { this.actorTrace('meActor.playScene2 UNRESOLVED CLIP: ' + clipHandle); } return true; } this.playFromTo = function(fromSegment,fromRecNum,toSegment,toRecNum) // must be preceded by an actor.play(...) { this.actorTrace('Actor.playFromTo' + ' fromSegment: ' + fromSegment + ' fromRecNum: ' + fromRecNum + ' toSegment: ' + toSegment + ' toRecNum: ' + toRecNum + '\n clipHandle: ' + previousSceneClipHandle); if (clipDirector != null) { clipDirector.ep_invoke('' + this.getContextIndex() + ',,ep_playFromTo,' + fromSegment + ',' + fromRecNum + ',' + toSegment + ',' + toRecNum + ',true,true'); } else { alert('Actor.playFromTo clipDirector NULL'); } } this.fullScreen = function() { if (clipDirector != null) { clipDirector.ep_invoke('' + this.getContextIndex() + ',,ep_fullScreen'); } else { alert('Actor.fullScreen clipDirector NULL'); } } this.refresh = function() { if (clipDirector != null) { clipDirector.ep_invoke('' + this.getContextIndex() + ',,ep_refresh') } else { alert('Actor.refresh clipDirector NULL'); } } this.resize = function(width,height) { if (clipDirector != null) { AppletManager.theInstance().resize(this.getTag(),width,height); //clipDirector.ep_invoke('' + this.getContextIndex() + ',,ep_setSize,' + width + ',' + height); } else { alert('Actor.fullScreen clipDirector NULL'); } } this.switchChatSession = function(fromActor, toActor) { if (fromActor.chatRgbIdx != -1) { if (fromActor.chatProxy != null) { if (fromActor.chatCallee != '') { toActor.chatRgbIdx = fromActor.chatRgbIdx; toActor.chatProxy = fromActor.chatProxy; toActor.chatReceiveName = fromActor.chatCallee; toActor.chatCallee = fromActor.chatCallee; fromActor.stop(); setRgbSrcIdx(getCtxIdByName(fromActor.getTag()),-1); Chat.releaseView(fromActor.getName()); this.playChat(toActor.chatCallee,true); setTimeout(fromActor.getName() + '.stop()',5000); } else { directorTrace('Actor.switchChat chat not active. chatCallee: ' + fromActor.chatCallee); alert('Actor.switchChat chat not active. chatCallee: ' + fromActor.chatCallee); } } else { directorTrace('Actor.switchChat chat not active. chatProxy: ' + fromActor.chatProxy); alert('Actor.switchChat chat not active. chatProxy: ' + fromActor.chatProxy); } } else { directorTrace('Actor.switchChat chat not active. chatRgbIxd: ' + fromActor.chatRgxIdx); alert('Actor.switchChat chat not active. chatRgbIxd: ' + fromActorChatRgxIdx); } } // ***************************************************** // *****always keep this section of code at the end***** // ***************************************************** if (name && isString(name) && (name.length > 0)) { var lcName = name.toLowerCase(); if (eval('this.configure_' + lcName)) { eval('this.configure_' + lcName + "(\'" + name + "\')"); } } // ***************************************************** // ***************************************************** } Function.prototype._bind = function(o) { var _this = this; return function() {return _this.apply(o,arguments);}; } Actor.getTagPrefix = function() { return ''; //(typeof Actor.tagPrefix === 'undefined') ? 'et.' : Actor.tagPrefix; } Actor.setTagPrefix = function(prefix) { Actor.tagPrefix = prefix; } Actor.getDivIdPrefix = function() { return ''; //(typeof Actor.divIdPrefix === 'undefined') ? 'ed.' : Actor.divIdPrefix; } Actor.setDivIdPrefix = function(prefix) { Actor.divIdPrefix = prefix; } /* Actor.setAppletType = function(appletType) { if (typeof ComponentFactory !== 'undefined') { var cf = new ComponentFactory(); var parameters = cf.getAppletInformation(appletType); if (parameters && parameters['cache_archive']) { archiveList = parameters['cache_archive']; } Actor.setTagPrefix('et'); Actor.setDivIdPrefix('ed'); } } */ Actor.getSdlWriterActor = function() { return Actor.sdlWriterActor; } Actor.getCameraCaptureActor = function() { return Actor.cameraCaptureActor; } Actor.setVideoMessagesEnabled = function(state) { Actor.vmpEnabled = state; } Actor.configureVmp = function() { if (Actor.vmpEnabled) { Actor.sdlWriterActor = Actor.sdlWriterActor == null ? new Actor('sdlwriter') : Actor.sdlWriterActor; Actor.cameraCaptureActor = Actor.cameraCaptureActor == null ? new Actor('capture') : Actor.cameraCaptureActor; } } 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) { alert("JSON.parse EXCEPTION: " + e.message); return false; } } }; }(); // meActorUtil.js function getActorByIndex(index) { return (contextDefinitionMap[index] && contextDefinitionMap[index].getActor()) ? contextDefinitionMap[index].getActor() : null; } function getActorByName(name) { return (actorNameMap[name]) ? actorNameMap[name]['instance'] : null; //return (actorNameMap[name]) ? actorNameMap[name]['instance'].getActor() : null; } function isMsgActor(ctxId) { var anActor = getActorByIndex(ctxId); return (anActor !== null) ? anActor.areMsgsEnabled() : false; } function stopAll() { // directorTrace('meActorUtil.stopAll'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { getActorByIndex(i).hide(); stopContext(i); displayImage(i,stoppedImageSpec); //clearEventQueue(i); } transitionInProgress(); } } function auditAllActors() { // directorTrace('meActorUtil.auditAllActors'); var status = false; if ((actorInstanceMap !== null) && (actorInstanceCtr > 1)) { for (var i = 1; i <= actorInstanceCtr; i++) { status |= actorInstanceMap[i].auditBackgroundContexts(); } } return status; } var reconfigurationInProgress = false; var reconfigurationComplete = true; function reconfigureMpcsClosure(method,arg) {return (function() {requestMpcReconfiguration(method,arg);});} var reconfigureMpcs = null; function waitForStopAllClosure(method,arg) {return (function() {waitForStopAll(method,arg);});} var waitForStopAll_ = null; function reconfigureMpcsClosure2(method,arg) {return (function() {requestMpcReconfiguration2(method,arg);});} var reconfigureMpcs2 = null; var reconfigureRetryCtr = 0; var reconfigureRetryCtrMax = 60; var reconfigureStartTicks = 0; function requestMpcReconfiguration(method,arg) { if ((!reconfigurationComplete || areContextsActive()) && !override) { directorTrace('meActorUtil.requestMpcReconfiguration REQUEST BLOCKED'); displayContextStateSummary(); beep(); return; } if (reconfigurationInProgress) { directorTrace('meActorUtil.requestMpcReconfiguration DEFERRING REQUEST method: ' + method + ' arg: ' + arg); reconfigureMpcs = reconfigureMpcsClosure(method,arg); setTimeout(reconfigureMpcs,5000); return; } reconfigureStartTicks = getTicks(); enableHourGlass(); allContextsReady = false; ctxReady = new Object(); reconfigurationInProgress = true; reconfigurationComplete = false; clearAllInvokeQueues(); stopAll(); waitForStopAll_ = waitForStopAllClosure(method,arg); setTimeout(waitForStopAll_,1000); setTimeout('monitorAllContextsReady()',1100); } function waitForStopAll(method,arg) { // if (reconfigurationComplete) return; //if (!clipDirector || (clipDirector === null)) //{ //waitForStopAll_ = waitForStopAllClosure(method,arg); //setTimeout(waitForStopAll_,500); //return; //} var contextsStopped = areContextsStopped(); var contextsActive = areContextsActive(); if (contextsStopped && !contextsActive) { // directorTrace('meActorUtil.waitForStopAll ALL STOPPED AND IDLE'); //abortAll(); reconfigureMpcs2 = reconfigureMpcsClosure2(method,arg); setTimeout(reconfigureMpcs2,1000); } else { directorTrace('meActorUtil.waitForStopAll REISSUE' + ' stopped: ' + contextsStopped + ' active: ' + contextsActive); displayContextStateSummary(); if (!contextsStopped) { stopAll(); } waitForStopAll_ = waitForStopAllClosure(method,arg); setTimeout(waitForStopAll_,500); } } function requestMpcReconfiguration2(method,arg) { // directorTrace('meActorUtil.requestMpcReconfiguration2 EVAL REQUEST method: ' + method + ' arg: ' + arg); //if (method && (method !== null)) //{ eval(method + '(\'' + arg + '\')'); //} setTimeout('waitForAllContextsReady()',100); // setTimeout('monitorAllContextsReady()',1000); } var override = false; function monitorAllContextsReady() { if (allContextsReady) { // directorTrace('meActorUtil.monitorAllContextsReady RECONFIGURATION COMPLETE: ' + (getTicks() - reconfigureStartTicks)); setTimeout('actorsReady()',100); } else { reconfigureRetryCtr++; if (reconfigureRetryCtr > reconfigureRetryCtrMax) { alert('meActorUtil.monitorAllContextsReady reset state'); directorTrace('meActorUtil.monitorAllContextsReady reset state'); allContextsReady = true; reconfigureRetryCtr = 0; resetAllContexts(); override = true; actorsReady(); } else { setTimeout('monitorAllContextsReady()',1000); } } } function waitCursor() { document.body.style.cursor = 'wait'; } function autoCursor() { document.body.style.cursor = 'auto'; } function enableHourGlass() { return; waitCursor(); setStatusClockEnabled(true); } function disableHourGlass() { return; hourGlassActive = false; autoCursor(); setStatusClockEnabled(false); } function areContextsStopped() { // directorTrace('meActorUtil.areContextsStopped'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { var stopped = isContextStopped(i); // directorTrace('meActorUtil.areContextsStopped' + ' i: ' + i + ' stopped: ' + stopped); if (!stopped) return false; } } return true; } function areContextsIdle() { // directorTrace('meActorUtil.areContextsIdle'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { if (!isContextIdle(i)) { // transitionInProgress(); return false; } } } return true; } function abortAll() { // directorTrace('meActorUtil.abortAll'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { abortContext(i); } resetAllClips(); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (i = 1; i <= contextIdx; i++) { clearEventQueue(i); } } } } function clearAllInvokeQueues() { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { clearInvokeQueue(i); } } // directorTrace('meActorUtil.clearAllInvokeQueues'); } function areContextsRestarting() { // directorTrace('meActorUtil.areContextRestarting'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { if (isContextRestarting(i)) { // transitionInProgress(); return true; } } } return false; } function areContextsSwitching() { directorTrace('meActorUtil.areContextSwitching'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { if (isContextSwitching(i)) return true; } } return false; } function isTransitionActive() { var ticks = getTicks(); var isActive = ticks < transitionTicks; if (isActive) { // directorTrace('meActorUtil.isTransitionActive' + // ' ticks: ' + ticks + // ' transitionTicks: ' + transitionTicks); } return isActive; } var statusClockEnabled = false; function setStatusClockEnabled(state) { statusClockEnabled = state; if (statusClockEnabled) { statusClockCtr = 0; statusClock(); } } var statusClockCtr = 0; function statusClock() { if (statusClockEnabled) { waitCursor(); windowStatus(statusClockCtr); setTimeout('statusClock()',1000); statusClockCtr++; } } function isBackground(ctxId) { return !isForeground(ctxId); } function isForeground(ctxId) { return foregroundMap[ctxId]; } // assumes elements start off hidden var elementShowState = null; function initElementShowState(element) { if (elementShowState == null) { elementShowState = new Object(); } if (typeof elementShowState[element] == 'undefined') { elementShowState[element] = false; } } function isElementShowing(element) { initElementShowState(element); // directorTrace('meActorUtil.isElementShowing' + ' element: ' + element + ' state: ' + elementShowState[element]); return elementShowState[element]; } function isElementHidden(element) { return !isElementShowing(element); } function showElement(element) { var el = document.getElementById(element); if ((el != null) && isElementHidden(element)) { el.style.visibility = "visible"; elementShowState[element] = true; } } function hideElement(element) { var el = document.getElementById(element); if (el != null) { initElementShowState(element); el.style.visibility = "hidden"; elementShowState[element] = false; } } function actorsReady() { if (areContextsActive() && !override) { directorTrace('meActorUtil.actorsReady almost ready...'); displayContextStateSummary(); setTimeout('actorsReady()',1000); } else { // directorTrace('meActorUtil.actorsReady RECONFIGURATION COMPLETE: ' + (getTicks() - reconfigureStartTicks) + ' override: ' + override); fireMeEvent('allActorsReady','allActorsReady;meActorUtil.actorsReady'); directorTrace('ready'); reconfigurationComplete = true; reconfigurationInProgress = false; reconfigureRetryCtr = 0; override = false; disableHourGlass(); } } function resetAllContexts() { directorTrace('meActorUtil.resetAll'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { resetContext(i); } } } function areContextsActive() { var transitionActive = isTransitionActive(); var contextsRestarting = areContextsRestarting(); var restartAtInProgress = isRestartAtInProgress(); var contextsIdle = areContextsIdle(); var backgroundContextsPlaying = false; // areBackgroundContextsPlaying(); var contextsActive = transitionActive || contextsRestarting || restartAtInProgress || !contextsIdle || backgroundContextsPlaying; if (false && contextsActive) { alert('meActorUtil.areContextsActive ACTIVE' + '\n transitionActive: ' + transitionActive + '\n contextsRestarting: ' + contextsRestarting + '\n restartAtInProgress: ' + restartAtInProgress + '\n contextsIdle: ' + contextsIdle + '\n backgroundContextsPlaying: ' + backgroundContextsPlaying); } return contextsActive; } var transitionTicks = 0; var transitionInterval = 2000; function transitionInProgress() { transitionTicks = getTicks() + transitionInterval; // directorTrace('meActorUtil.transitionInProgress transitionTicks: ' + transitionTicks); } function displayContextStateSummary() { if (false) { var transitionActive = isTransitionActive(); var contextsRestarting = areContextsRestarting(); var restartAtInProgress = isRestartAtInProgress(); var contextsStopped = areContextsStopped(); var contextsIdle = areContextsIdle(); var backgroundPlaying = areBackgroundContextsPlaying(); directorTrace('\n meActorUtil.displayContextStateSummary' + ' transition: ' + transitionActive + ' restarting: ' + contextsRestarting + ' restartAtInProgress: ' + restartAtInProgress + ' stopped: ' + contextsStopped + ' idle: ' + contextsIdle + ' backgroundPlaying: ' + backgroundPlaying + ' override: ' + override); } } function areBackgroundContextsPlaying() { // directorTrace('meActorUtil.areBackgroundContextsPlaying'); if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { if (isBackground(i) && isContextPlaying(i)) { directorTrace('meActorUtil.areBackgroundContextsPlaying' + ' name: ' + getActorNameByIndex(i) + ' index: ' + i); return true; } } } return false; } function getCtxIdByName(actorName) { return getViewCtxId(actorName); } function isAuditPlayState(ctxId) { var auditPlayState = false; if (contextDefinitionMap[ctxId]) { var ctxDef = contextDefinitionMap[ctxId]; if (ctxDef != null) { auditPlayState = ctxDef.getClipDescriptor().getAuditPlayState(); } } return auditPlayState; } String.prototype.trim = function() { return this.replace(/^\s*|\s*$/g,''); } function isArray(array) { return ((array != null) && (typeof array == "object") && (array.constructor == Array)); } function dumpStringArray(array) { directorTrace(array); if (isArray(array)) { for (var i = 0; i < array.length; i++) { if (isArray(array[i])) { dumpStringArray(array[i]); } else { directorTrace(array[i]); } } } } function dumpStringList(list) { for (var e1 in list) { directorTrace('e1: ' + e1 + ' typeof e1: ' + (typeof e1) + ' typeof list: ' + (typeof list)); if (list[e1] && (typeof list[e1] == 'object')) { dumpStringList(list[e1]); } } } var onClickTicks = 0; var onClickInterval = 1000; function isOnClickAllowed() { var clickAllowed = false; var ticks = getTicks(); var onClickInProgress = ticks < onClickTicks; if (!onClickInProgress) { var contextsActive = areContextsActive(); clickAllowed = allContextsReady && reconfigurationComplete && !contextsActive; // if (!clickAllowed) // { // directorTrace('meActorUtil.isOnClickAllowed onClick NOT allowed' + // '\n allContextsReady: ' + allContextsReady + // ' reconfigurationComplete: ' + reconfigurationComplete + // ' contextsActive: ' + contextsActive); // } } else { // directorTrace('meActorUtil.isOnClickAllowed onClick IN PROGRESS' + // ' ticks: ' + ticks + // ' onClickTicks: ' + onClickTicks); } return clickAllowed; } var onClickBusy = false; function onClickClosure(method,arg) {return (function() {onClickClosureTarget(method,arg);});} var onClickClosureRequest = null; var onClickRequestCtr = 0; function onClickWdtClosure(method,arg) {return (function() {onClickWdtClosureTarget(method,arg);});} function retryOnClickRequest(method,arg) { var status = false; if (!onClickBusy) { onClickBusy = true; status = true; enableHourGlass(); onClickClosureRequest = onClickClosure(method,arg); setTimeout(onClickClosureRequest,200); onClickWdtRequest = onClickWdtClosure(method,arg); setTimeout(onClickWdtRequest,5000); } return status; } function onClickClosureTarget(method,arg) { if (onClickBusy) { onClickRequestCtr++; if (isOnClickAllowed()) { eval(method + '(\'' + arg + '\')'); resetOnClick(); } else { enableHourGlass(); // directorTrace('onClick.onClickClosureTarget RETRY'); onClickClosureRequest = onClickClosure(method,arg); setTimeout(onClickClosureRequest,200); } } else { // directorTrace('onClick.onClickClosureTarget onClickBusy CLEARED'); } } function onClickWdtClosureTarget(method,arg) { if (onClickBusy && (onClickClosureRequest !== null)) { // directorTrace('onClick.onClickWdtClosureTarget WDT TIMEDOUT'); resetOnClick(); } } function resetOnClick() { onClickRequestCtr = 0; onClickClosureRequest = null; onClickBusy = false; disableHourGlass(); } function requestOnClick(method,arg) { var status; if (isOnClickAllowed()) { if (eval(method + '(\'' + arg + '\')')) { resetOnClick(); } status = 1; // method executed onClickTicks = getTicks() + onClickInterval; } else { if (retryOnClickRequest(method,arg)) { status = 0; // method queued for a retry (i.e., in-progress) onClickTicks = getTicks() + onClickInterval; } else { status = -1; // method blocked } } return status; } var pacifyToggle = false; var pacifyCtr = 0; var actorsStarted = false; function startActors() { if (!actorsStarted) { if (videoChat && !jChatInstallationComplete) { pacifyToggle = !pacifyToggle; if (pacifyToggle) { windowStatus("[" + pacifyCtr + "] PLEASE WAIT... INITIALIZING"); pacifyCtr += 2; } else { windowStatus(" "); } setTimeout("startActors();",2000); return; } actorsStarted = true; startActors2(); } } function isAuditPointer(ctxId) { return auditPointerMap[ctxId]; } function pauseAll() { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { pauseContext(i); } transitionInProgress(); } } function fireMeEvent(event,eventDescriptor) { if ((contextDefinitionMap !== null) && (contextIdx > 0)) { for (var i = 1; i <= contextIdx; i++) { getActorByIndex(i).invoke(event,eventDescriptor); } } } String.prototype.startsWith = function(aString) { return this.indexOf(aString) == 0; } function isString(o) { return typeof o == 'string'; } function windowStatus(text) { //return; window.status = text; } // ContextDefinition.js function ContextDefinition(actor,idx,clipHandle,clipDescriptor) { this._actor = actor; // actor instance this._idx = idx; // context index (e.g., 1 - 100) this._clipHandle = clipHandle; // clip handle (e.g., 'teaser') this._clipDescriptor = clipDescriptor; this.getActor = function() { return this._actor; } this.getIdx = function() { return this._idx; } this.getClipHandle = function() { return this._clipHandle; } this.getClipDescriptor = function() { return this._clipDescriptor; } } function HttpRequest () { var client; this.sendRequest = function () { if (arguments.length == 4) { var type = arguments[0]; var url = arguments[1]; var param = arguments[2]; var isAsync = arguments[3]; var files = null; } else if (arguments.length == 5) { var type = arguments[0]; var url = arguments[1]; var param = arguments[2]; var files = arguments[3]; var isAsync = arguments[4]; } else { return null; } if (files === null) { client = new AjaxClient(); client.init(); client.requestType = type; client.isAsync = isAsync; if (type == "GET") { var qs = param.join('&'); if (qs.length > 0) { url += "?" + qs; } return client.makeRequest(url,null); } else { return client.makeRequest(url,param.join(',')); } } else { return null; meLogger.write("HttpRequest Called."); } } 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); } } }// ContextEventDescriptor.js function ContextEventDescriptor() { // example format 'mergeFinalized;1,et.main;success' // 'event;ctxId,htmlElementName;optionalArgs } ContextEventDescriptor.getEvent = function(eventDescriptor) { var event = null; if (ContextEventDescriptor.validate(eventDescriptor)) { event = eventDescriptor.split(';')[0]; } return event; } ContextEventDescriptor.getCtxId = function(eventDescriptor) { var ctxId = null; if (ContextEventDescriptor.validate(eventDescriptor)) { ctxId = eventDescriptor.split(';')[1].split(',')[0]; } return ctxId; } ContextEventDescriptor.getHtmlElement = function(eventDescriptor) { var element = null; if (ContextEventDescriptor.validate(eventDescriptor)) { element = eventDescriptor.split(';')[1].split(',')[1]; } return element; } ContextEventDescriptor.getOptionalArgs = function(eventDescriptor) { var args = null; if (ContextEventDescriptor.validate(eventDescriptor)) { args = eventDescriptor.split(';')[2]; } return args; } ContextEventDescriptor.validate = function(eventDescriptor) { var status = (eventDescriptor && isString(eventDescriptor) && (eventDescriptor.length > 0)); if (!status) { directorTrace('ContextEventDescriptor.validate INVALID DESCRIPTOR: ' + eventDescriptor); } return status; } ContextEventDescriptor.create = function(event,ctxId,actorName,optionalArgs) { var descriptor = null; if (typeof event != 'undefined') { if (typeof ctxId == 'undefined') { ctxId = 'null'; } if (typeof actorName == 'undefined') { actorName = 'null'; } if (typeof optionalArgs == 'undefined') { optionalArgs = 'null'; } descriptor = event + ';' + ctxId + ',' + actorName + ';' + optionalArgs; } return descriptor; } /** * © Copyright ESPRE Solutions, Inc., 2007. All rights are reserved. * @author __USER__ * @version 2.0 */ Project.projectDefaultBasePath = ".\\meprojects\\"; function Project() { try{ FileUtil.theInstance(); var that = this; var projectBasePath = Project.projectDefaultBasePath; var projectLocalPath = ""; // i.e. thisProject(as provided by user) var projectFullPath = ""; //i.e. c:\myproject\thisProject var projectXMLPath = ""; // c:\myproject\thisProject\Project.xml var encodeXMLPath = ""; // c:\myproject\thisProject\Encode.xml var model = null; var encodeRequest = null; //is null an encode is requested then holds the request object var uploadRequest = null; //is null until an upload is requested then holds the request object //Private API var initialize = function(){ projectLocalPath = ""; projectFullPath = ""; projectXMLPath = ""; encodeXMLPath = ""; model = null; encodeRequest = null; uploadRequest = null; }; var createProjectPaths = function(){ if(arguments.length > 0){ projectLocalPath = arguments[0]; } // check if projectBasePath needs resolving and can be resolved projectLocalPath = Project.TrimPath(projectLocalPath); projectFullPath = Project.CreateFullProjectPath(FileUtil.theInstance().expandPath(projectBasePath),projectLocalPath); projectXMLPath = toPath(projectFullPath,"Project.xml"); encodeXMLPath = toPath(projectFullPath,"Encode.xml"); }; //Public API this.setProjectBasePath = function(_path){ if((_path !== null) && (typeof _path == "string")){ // check is a valid path style (i.e. n:\xx) var re = /^([a-z|A-Z]:){1}/; // pattern to find e.g. C: if(_path.search(re) != -1){ projectBasePath = _path; return true; } } return false; }; this.getProjectBasePath = function(){ return projectBasePath; }; this.resetProjectBasePath = function(){ projectBasePath = Project.projectDefaultBasePath; return true; }; this.isOpen = function() { if(model !== null) {return true;} return false; }; this.create = function () { if(this.isOpen()) return null; // don't disturb an open project if(arguments.length > 0){ projectLocalPath = arguments[0]; } // Check filesystem createProjectPaths(); try { if((projectLocalPath === "") || !FileUtil.theInstance().doesFileExist(projectXMLPath)){ model = new ControlData(this,projectLocalPath); //projectLocalPath is default or temp name this.save(); return this; } else { meLogger.write("Project [" + projectLocalPath + "] exists." , 3); this.close(); //force reinit return null; } } catch(e) { // meLogger.write(e.name + ' : ' + e.message, 3); alert("Project.create EXCEPTION: " + e.message); meLogger.write("Project [" + projectLocalPath + "] may not be saved as this browser doesn\'t support this functionality.", 2); if (!model) model = new ControlData(this, projectLocalPath); return this; } }; //Usage: aProject.open("location") this.open = function() { if(this.isOpen()) return null; // don't disturb an open project var _projectLocation = (arguments.length === 0) ? "" : arguments[0]; createProjectPaths(_projectLocation); if (!doesFileExist(projectXMLPath)){ meLogger.write("open: Project not found",2); this.close(); //force reinit return null; //throw new MeException("Project not found."); } model = new ControlData(this); if (model.populate(projectXMLPath)){ return this; } else{ this.close(); //force reinit meLogger.write("open: Unable to populate project",2); return null; } }; this.remove = function() { if(!this.isOpen()) return true; // not open, nothing to be done. var myLocation = projectFullPath; this.close(); //force reinit return Project.RemoveProject(myLocation); }; /** * */ this.addClip = function () { if ((!model) || (arguments.length === 0)){ return null; } return model.addClip.apply(model,arguments); }; this.reorderClips = function () {return ((model) ? model.reorderClips(arguments[0]) : false);};//TODO:; this.reOrderClips = this.reorderClips;//TODO: Deprecated function, documented as reorderClips(); this.removeClip = function () {return ((model) ? model.removeClipByName(arguments[0]) : false);};//TODO:; this.removeScene = function () {return ((model) ? model.removeSceneByName(arguments[0]) : false);};//TODO:; this.getClip = function () {return ((model) ? model.getClip(arguments[0]) : null);};//TODO:; this.getScene = function () {return ((model) ? model.getScene(arguments[0]) : null);};//TODO:; this.getName = function () {return ((model) ? model.getParameter('general', 'name') : null);};//TODO:; this.addScene = function () { if ((!model) || (arguments.length === 0)){ return null; } return model.addScene.apply(model,arguments); }; this.getClipNames = function () {return ((model) ? model.getClipNames(arguments) : []);};//TODO: this.getSceneNames = function () {return ((model) ? model.getSceneNames(arguments) : []);};//TODO: this.saveAs = function () { if(!this.isOpen()){ return false ;// Nothing TODO } if(arguments.length >0 && arguments[0] !== "") { var curName = model.getParameter('general','name'); var curPath = projectLocalPath; try{ meLogger.write("saveAs: current name = " + curName); if(curName === ""){ model._setParameter('general','name',arguments[0]); } projectLocalPath = arguments[0]; createProjectPaths(); return saveTo(projectXMLPath); } catch (e) { //revert changes alert("Project.saveAs EXCEPTION: " + e.message); model._setParameter('general','name',curName); createProjectPaths(curPath); meLogger.write(e.name + ' :' + e.message,3); return false; } } else { //TODO: This may not be quite right meLogger.write("saveAs: No valid location provided",3); } return false; }; this.save = function () { try{ return saveTo(projectXMLPath); } catch(e){ alert("Project.save EXCEPTION: " + e.message); return false; }; }; var saveTo = function (_XMLPath) { if(!that.isOpen()) { return false ; //nothing TODO; } try{ if (FileUtil.theInstance().writeToFilePath(model.toXML(),_XMLPath ,true)) { meLogger.write('Control XML Saved to ' + _XMLPath) ; } } catch (e) { alert("Project.saveTo EXCEPTION: " + e.message); meLogger.write(e.name + ' :' + e.message,3); throw(e); } return true; }; this.close = function() { if(this.isOpen()){meLogger.write('Project is now closed.');}; initialize(); return true; }; // Manage encoding process this.prepare4Encoding = function(){ meLogger.write('Preparing to encode....'); var success = true; //assume success if(!this.isOpen()) return false; if(!model.hasClips()) return false; if(encodeRequest !== null && encodeRequest.isEncoding()) return false; // don't step on current encode.xml this.save(); success &= model.prepare4Encoding(projectFullPath); if(success){ saveTo(encodeXMLPath); } model.revertFromEncoding(); return success; }; this.executeEncoding = function(){ if(!this.isOpen()) return false; if(encodeRequest !== null && encodeRequest.isEncoding()) return false; //don't step on a current encoding if(!FileUtil.theInstance().doesFileExist(encodeXMLPath)) return false; encodeRequest = new EncodeRequest(); encodeRequest.setParameter('xmlFile',encodeXMLPath); encodeRequest.setParameter('sdlFile',this.getSDL()); return encodeRequest.start(); }; this.encode = function() { //TODO meLogger.write("Inside Encode....."); if(!this.prepare4Encoding()) return false; if(!this.executeEncoding()) return false; return true; }; this.encodeScene = function() { //TODO: return false; }; this.cancelEncode = function(){ if(encodeRequest === null || encodeRequest.isCompleted()) return true; encodeRequest.cancel(); return true; }; this.getEncodeProgress = function(){ if(encodeRequest === null)return 0; return encodeRequest.getProgress(); }; this.getEncodeVideoProgress = function(){ if(encodeRequest === null)return 0; return encodeRequest.getVideoProgress(); }; this.getEncodeAudioProgress = function(){ if(encodeRequest === null)return 0; return encodeRequest.getAudioProgress(); }; this.getEncodeErrors = function(){ if(encodeRequest === null)return ""; return encodeRequest.getErrors(); }; this.isEncodeCompleted = function(){ if(encodeRequest === null)return false; return encodeRequest.isCompleted(); }; this.isEncoding = function(){ if(encodeRequest === null)return false; return encodeRequest.isEncoding(); }; this.isEncodeError = function(){ if(encodeRequest === null)return false; return encodeRequest.isError(); }; this.getSDL = function() { if(!this.isOpen()) return ""; var anSDL = model.getSDL("file:/" + projectFullPath); // fix back slashes to forward slashes anSDL = anSDL.replace(/\\/g,"/"); return anSDL; }; this.getSdlPath = function() { if(!this.isOpen()) return ""; return model.getSDL(projectFullPath);; }; //Manage upload process this.uploadAs = function (_name){ meLogger.write("UploadAs called....."); if(!this.isOpen()) return false; if(_name === null || _name === ""){return false;}; //fail if name not supplied if(uploadRequest !== null && uploadRequest.isUploading()){return false;}; //meLogger.write(encoderXML); var _manifestFiles = ManifestFactory.theInstance().getEncodeArtifacts(encodeXMLPath); meLogger.write("Number of files to be uploaded: " + _manifestFiles.length); for (i=0;i<_manifestFiles.length;i++){ if(!FileUtil.theInstance().doesFileExist(_manifestFiles[i])){ //fail if all files not present meLogger.write("Upload request failed: file not found - " + _manifestFiles[i]); return false; } } var _nspace = model.getParameter('general', 'nameSpace'); uploadRequest = new UploadRequest(_nspace,_name); meLogger.write("Upload object created....."); uploadRequest.setManifestFiles(_manifestFiles); meLogger.write(uploadRequest.toString()); var result = uploadRequest.start(); //TODO: uploadRequest is the object that Don may be interested // uploadRequest can be queried: getName(), getTarget(), getNSpace(), getManifestFiles() //where the return type of the last one being an array and the rest be a regular string. return result; }; this.upload = function () { meLogger.write("Upload called....."); if(!this.isOpen()) return false; var _name = model.getParameter('general', 'name'); meLogger.write("upload: Trying to upload " + _name); if(_name === ""){return false;}; return this.uploadAs(_name); }; this.getUploadProgress = function(){ if(uploadRequest === null)return 0; return uploadRequest.getProgress(); }; this.getUploadErrors = function(){ if(uploadRequest === null)return ""; return uploadRequest.getErrors(); }; this.isUploadCompleted = function(){ if(uploadRequest === null)return false; return uploadRequest.isCompleted(); }; this.isUploading = function(){ if(uploadRequest === null)return false; return uploadRequest.isUploading(); }; this.isUploadError = function(){ if(uploadRequest === null)return false; return uploadRequest.isError(); }; this.getProjectFullPath = function(){ return projectFullPath; } // For Test purpose only this.getModel = function() { return ((model) ? model : null); }; } catch(e) { alert("Project. EXCEPTION: " + e.message); meLogger.write(e.name + ':= ' + e.message, 3); }; // Delegate the Parameter management to ControlData this.getSupportedGroups = function () {return ((model) ? model.getSupportedGroups() : []);};//TODO: this.getActiveParameters = function () {return ((model) ? model.getActiveParameters.apply(model,arguments): []);};//TODO: this.setParameter = function () {return ((model) ? model.setParameter.apply(model,arguments): false);};//TODO: this.resetParameter = function () {return ((model) ? model.resetParameter.apply(model,arguments): false);};//TODO: this.getParameter = function () {return ((model) ? model.getParameter.apply(model,arguments): null);};//TODO: this.removeParameter = function () {return ((model) ? model.removeParameter.apply(model,arguments): false);};//TODO: // End of Parameter management API }; //Class methods Project.CreateProject = function () { var result = null; var project = new Project(); if(arguments.length > 0){ result = project.create(arguments[0]); } else { result = project.create(); } if(!result)meLogger.write("Error Creating Project.", 3); return result; }; Project.OpenProject = function () { var result = null; var project = new Project(); try { if(arguments.length > 0){ result = project.open(arguments[0]); } else{ result = project.open(); } } catch(e) { alert("Project.OpenProject EXCEPTION: " + e.message); meLogger.write(e.name + ' : ' + e.message, 3); return null; } if(result === null){ meLogger.write("Error Opening Project.", 3); } return result; }; Project.RemoveProject = function (_projectLocation) { if(_projectLocation === null || _projectLocation === ""){ return false; }; // remove the project's files (and directories?????) we may need to remove other artifacts too. try{ var myLocation = Project.TrimPath(_projectLocation); var fullPath = Project.CreateFullProjectPath(Project.projectDefaultBasePath, myLocation); return deleteProject(fullPath); } catch(e) { alert("Project.RemoveProject EXCEPTION: " + e.message); meLogger.write(e.name + ":- " + e.message, 3); } return true ; }; Project.TrimPath = function(_location){ //Trim any beginning or ending whitespace var re = /(^\s*)|(\s*$)/g; _location = _location.replace(re,""); // fix forward slashs to back slashs re = /\//g; _location = _location.replace(re,"\\"); //if xml filename provided, trim it re = /\\project.xml$|\\encode.xml$/i; _location = _location.replace(re,"\\"); // remove trailing backslash re = /\\$/; return _location.replace(re,""); }; Project.CreateFullProjectPath = function(_basePath,_location){ //if projectLocalPath is absolute, just use it var re = /^([a-z|A-Z]:){1}/; // pattern to find e.g. C: if(_location.search(re) != -1){ // found drive letter return _location; } else{ return toPath(_basePath, _location); } }; Project.SetProjectDefaultBasePath = function(_path){ if(_path !== null && (typeof _path == "string")){ // check is a valid path style (i.e. n:\xx) var re = /^([a-z|A-Z]:){1}/; // pattern to find e.g. C: if(_path.search(re) != -1){ Project.projectDefaultBasePath = _path; return true; } } return false; }; Project.Install = function(){ var anEncoder = Encoder.theInstance(); anEncoder.install(); }; Project.isInstalled = function(){ var anEncoder = Encoder.theInstance(); return anEncoder.isInitialized(); }; // Media Engine Actor var chatOnly = false; var dr = null; // Don Smith: This will become the new AppletSpec. var clipDirector = null; var contextIdx = 0; var contextDefinitionMap = null; var actorNameMap = null; var actorInstanceMap = null; var actorPrimary = null; var actorInstanceCtr = 0; var foregroundMap = null; var auditPointerMap = null; var cidMsg = -1000; var cameraCaptureDocument = null; var videoChat = false; var videoMessage = false; var msgsEnabled = false; var _TRACE = false; function Actor() { // args: name,tag,clipWidth, clipHeight var that = this; var name; var tag; var clipWidth; var clipHeight; if (arguments.length == 1) { name = arguments[0]; tag = ""; clipWidth = ""; clipHeight = ""; } else if (arguments.length == 2) { name = arguments[0]; tag = arguments[1]; clipWidth = ""; clipHeight = ""; } else if (arguments.length == 3) { name = arguments[0]; tag = ""; clipWidth = arguments[1]; clipHeight = arguments[2]; } else if (arguments.length == 4) { name = arguments[0]; tag = arguments[1]; clipWidth = arguments[2]; clipHeight = arguments[3]; } this.eventManager = EventManager; this.eventManager(); if (dr === null) dr = jDirectorInit(); if (actorInstanceMap === null) { actorInstanceMap = new Object(); } actorInstanceMap[++actorInstanceCtr] = this; if (foregroundMap === null) foregroundMap = new Object(); if (auditPointerMap === null) auditPointerMap = new Object(); var defaultAutoMute = 'false'; var defaultAutoplay = 'false'; var defaultClipActorsEnabled = 'true'; var defaultControlsVisible = 'false'; var defaultGestures = 'true'; var defaultHeight = '240'; var defaultLoop = 'false'; var defaultPrimary = 'true'; var defaultVolume = '90'; var defaultWaitForView = 'true'; var defaultWidth = '320'; var defaultPauseViaStall = 'true'; var defaultConvertSegments = 'false'; var defaultMsgsEnabled = false; var defaultRgbSrcEnabled = false; var defaultRgbSrcIdx = -1; this._autoMute = defaultAutoMute; this._autoplay = defaultAutoplay; this._clipActorsEnabled = defaultClipActorsEnabled; this._controlsVisible = defaultControlsVisible; this._gestures = defaultGestures; this._height = defaultHeight; this._loop = defaultLoop; this._primary = defaultPrimary; this._volume = defaultVolume; this._waitForView = defaultWaitForView; this._width = defaultWidth; this._pauseViaStall = defaultPauseViaStall; this._convertSegments = defaultConvertSegments; this._name = name; this._mpc = null; //this._tag = tag; this._tag = Actor.getTagPrefix() + name; this._divId = Actor.getDivIdPrefix() + name; this._currentClipHandle = null; this._previousClipHandle = null; this._msgsEnabled = defaultMsgsEnabled; this.setMsgsEnabled = function(state) { this._msgsEnabled = state; } this.areMsgsEnabled = function() {return this._msgsEnabled;} this._rgbSrcEnabled = defaultRgbSrcEnabled; this.setRgbSrcEnabled = function(state) { this._rgbSrcEnabled = state; } this.isRgbSrcEnabled = function() {return this._rgbSrcEnabled;} this._rgbSrcIdx = defaultRgbSrcIdx; this.setRgbSrcIdx = function(idx) { this._rgbSrcIdx = idx; } this.getRgbSrcIdx = function() {return this._rgbSrcIdx;} this._contextConfigured = new Object(); this.setMpc = function(mpc) { this._mpc = mpc; this.initMpc(); } this.initMpc = function() { return; this._contextConfigured = new Object(); setTransitionRequested(true); this.resetClipHandles(); // this.stopMyContexts(); allContextsReady = false; // this.removeMyContexts(); foregroundMap = null; auditPointerMap = null; } this.getMpc = function() {return this._mpc;} this.setTag = function(tag) {this._tag = tag;} this.getTag = function() { if (this._tag == '') { return this._divId; } else { return this._tag; } } this.setDivId = function(divId) {this._divId = divId;} this.getDivId = function() {return this._divId;} this.setLoop = function(loop) {this._loop = loop;} this.setPrimary = function(primary) {this._primary = primary;} this.setSecondary = function(secondary) {this._primary = !secondary;} this.isPrimary = function() {return this.primary;} this.isSecondary = function() {return !this.primary;} this.initPlayOrBufferClip = function(clipHandle,wfv,ap) { //this.validateHtml(); preInit(); contextIdx++; this.addContext(contextIdx); if (this.areMsgsEnabled()) {cidMsg = contextIdx;} // TODO GLM var aClipDescriptor = ClipDescriptor.findClipDescriptor(clipHandle); if (aClipDescriptor === null) { var resolvedClip = this.resolveClip(clipHandle); if (resolvedClip !== null) { aClipDescriptor = this.addSdl(resolvedClip); if (aClipDescriptor != null) { aClipDescriptor.setForeground(wfv || hasView); } //alert('meActor.initPlayOrBufferClip resolvedClip: ' + resolvedClip); } } //if (!wfv && !ap) debugger; aClipDescriptor = this.processClipDescriptor(this,contextIdx,clipHandle); wfv = wfv || this.areMsgsEnabled() || aClipDescriptor.isForeground() || hasView; if (wfv) { jActorInit(contextIdx, this.getTag(), this.getClipWidth(), //aClipDescriptor.getWidth(), this.getClipHeight(), //aClipDescriptor.getHeight(), this._divId, this.isChat()); } jDirCtxt(dr,contextIdx,'waitForView' ,wfv); jDirCtxt(dr,contextIdx,'autoplay' ,(hasView ? false : aClipDescriptor.getAutoplay())); jDirCtxt(dr,contextIdx,'sdl' ,aClipDescriptor.getSdl()); jDirCtxt(dr,contextIdx,'noAudio' ,aClipDescriptor.getNoAudio()); jDirCtxt(dr,contextIdx,'convertSegments' ,aClipDescriptor.getConvertSegments()); jDirCtxt(dr,contextIdx,'videoDataCacheSize' ,aClipDescriptor.getVideoDataCacheSize()); jDirCtxt(dr,contextIdx,'videoIndexCacheSize',aClipDescriptor.getVideoIndexCacheSize()); jDirCtxt(dr,contextIdx,'audioDataCacheSize' ,aClipDescriptor.getAudioDataCacheSize()); jDirCtxt(dr,contextIdx,'audioIndexCacheSize',aClipDescriptor.getAudioIndexCacheSize()); jDirCtxt(dr,contextIdx,'volume' ,aClipDescriptor.getVolume()); jDirCtxt(dr,contextIdx,'codeBaseOverride' ,aClipDescriptor.getCodeBaseOverride()); jDirCtxt(dr,contextIdx,'defined' ,'true'); jDirCtxt(dr,contextIdx,'primary' ,this._primary); jDirCtxt(dr,contextIdx,'autoMute' ,this._autoMute); jDirCtxt(dr,contextIdx,'loop' ,this._loop); jDirCtxt(dr,contextIdx,'pauseViaStall' ,this._pauseViaStall); jDirCtxt(dr,contextIdx,'rgbSrcEnabled' ,this._rgbSrcEnabled); jDirCtxt(dr,contextIdx,'rgbSrcIdx' ,this._rgbSrcIdx); if (this.areMsgsEnabled()) { jDirCtxt(dr,contextIdx,'autoBandwith','false'); jDirCtxt(dr,contextIdx,'syncBandwith','false'); jDirCtxt(dr,contextIdx,'dumpSdl' ,'false'); } else { jDirCtxt(dr,contextIdx,'syncBandwith',aClipDescriptor.getSyncBandwidth()); } this.processHtmlParams(dr,contextIdx); if (this._mpc == null) { this.initMpc(); } this._contextConfigured[contextIdx] = true; //alert('meActor.initPlayOrBufferClip' + ' contextIdx: ' + contextIdx + ' tag: ' + this.getTag() + ' foreground: ' + wfv); } this.switchClip = function(fromHandle,toHandle) { switchContext(this.getTag(),this.getIndexOf(fromHandle),this.getIndexOf(toHandle)); transitionInProgress(); } function preInit() { if (dr === null) { dr = jDirectorInit(); } if (!clipDirector || (clipDirector === null)) { // COMMENTED OUT BY DON SMITH -- Replacing with callback from AppletManager //setClipDirector(dr.getInstance()); //alert('meActor.preInit clipDirector: ' + clipDirector); } return allContextsReady; } this.initialized = false; this.init = function() { if (!this.initialized) { // TODO GLM this.invoke('init',''); this.initialized = true; } } this.playInitialized = false; this.initPlay = function(clipHandle) { var aClipDescriptor = ClipDescriptor.findClipDescriptor(clipHandle); if (aClipDescriptor === null) { var resolvedClip = this.resolveClip(clipHandle); if (resolvedClip !== null) { var playCd = this.addSdl(resolvedClip); //directorTrace('meActor.initPlay resolvedClip: ' + resolvedClip); if (this._bufferClipHandle != null) { var bufferedCd = this.getClipDescriptor(this._bufferClipHandle); if (bufferedCd != null) { var ctxId = this.getContextIndex(); //directorTrace('meActor.initPlay' + ' ctxId: ' + ctxId + ' bufferedCd: \n' + bufferedCd); //alert('meActor.initPlay' + ' ctxId: ' + ctxId + ' bufferedCd: \n' + bufferedCd); playCd.cloneBasicParameters(bufferedCd); this.reconfigureContextCommon(ctxId,playCd); this._contextConfigured[ctxId] = false; // configuration finalized on first 'play' } } } } if (!this.playInitialized && !this.bufferInitialized) { this.initPlayOrBufferClip(clipHandle,true,true); this.playInitialized = true; //this.bufferInitialized = true; return true; } return false; } this.bufferInitialized = false; this.initBuffer = function(clipHandle) { if (!this.bufferInitialized || (this.getEvent() == 'init')) { //debugger; this.initPlayOrBufferClip(clipHandle,false,false); this.bufferInitialized = true; //this.playInitialized = true; return true; } //debugger; return false; } this.hide = function() { // directorTrace('meActor.hide'); //hideElement(this.getTag()); //directorTrace('Actor.hide getTag: ' + this.getTag()); //AppletManager.theInstance().setVisibility(this.getTag(),false); document.getElementById(this.getTag()).style.visibility = 'hidden'; } this.show = function() { // directorTrace('meActor.show'); //showElement(this.getTag()); //directorTrace('Actor.show getTag: ' + this.getTag()); //AppletManager.theInstance().setVisibility(this.getTag(),true); document.getElementById(this.getTag()).style.visibility = 'visible'; } this.playDeferred = false; this._playClipHandle = null; this.play = function(clipHandle) { if (!Actor.started) { this.playDeferred = true; if (clipHandle) { this._playClipHandle = cli