From 7710a2184565993a5704e56cca5426165153edee Mon Sep 17 00:00:00 2001 From: Luis Merino Date: Mon, 2 May 2011 11:30:07 +0200 Subject: [PATCH] Google app engine runner integration --- client/ext/noderunner/noderunner.js | 1 + client/ext/run/run.js | 8 +- client/ext/run/run.xml | 27 +- client/js/apf_release.js | 9305 ++++++++++++++++- config.js | 3 +- .../chromedebugproxy.js | 0 .../ext/{debugger => run-node}/index.js | 27 +- .../{debugger => run-node}/nodedebugproxy.js | 0 .../ext/{debugger => run-node}/package.json | 0 server/cloud9/ext/run-python/index.js | 137 + server/cloud9/ext/run-python/package.json | 6 + server/cloud9/ide.js | 5 +- 12 files changed, 8919 insertions(+), 600 deletions(-) rename server/cloud9/ext/{debugger => run-node}/chromedebugproxy.js (100%) rename server/cloud9/ext/{debugger => run-node}/index.js (93%) rename server/cloud9/ext/{debugger => run-node}/nodedebugproxy.js (100%) rename server/cloud9/ext/{debugger => run-node}/package.json (100%) create mode 100644 server/cloud9/ext/run-python/index.js create mode 100644 server/cloud9/ext/run-python/package.json diff --git a/client/ext/noderunner/noderunner.js b/client/ext/noderunner/noderunner.js index 64fd2107f34..276e7b88d7a 100644 --- a/client/ext/noderunner/noderunner.js +++ b/client/ext/noderunner/noderunner.js @@ -139,6 +139,7 @@ return ext.register("ext/noderunner/noderunner", { var command = { "command" : debug ? "RunDebugBrk" : "Run", "file" : path.replace(/^\/+/, ""), + "runner" : ddRunnerSelector.value, // Explicit addition; trying to affect as less logic as possible for now... "args" : args || "", "env" : { "C9_SELECTED_FILE": page ? page.getAttribute("path").slice(ide.davPrefix.length) : "" diff --git a/client/ext/run/run.js b/client/ext/run/run.js index 46f25669030..8c61bb4dbf6 100644 --- a/client/ext/run/run.js +++ b/client/ext/run/run.js @@ -82,19 +82,21 @@ return ext.register("ext/run/run", { addConfig : function() { var file = ide.getActivePageModel(); + var extension = ""; - if (!file || (file.getAttribute("contenttype") || "").indexOf("application/javascript") != 0) { + if (!file || (file.getAttribute("contenttype") || "").indexOf("application/javascript") != 0 && (file.getAttribute("contenttype") || "").indexOf("text/x-script.python") != 0) { var path = ""; var name = "server"; } else { - path = file.getAttribute("path").slice(ide.davPrefix.length + 1); - name = file.getAttribute("name").replace(/\.js$/, ""); + path = file.getAttribute("path").slice(ide.davPrefix.length + 1); + name = file.getAttribute("name").replace(/\.(js|py)$/, function(full, ext){ extension = ext; return ""; }); } var cfg = apf.n("") .attr("path", path) .attr("name", name) + .attr("extension", extension) .attr("args", "").node(); mdlRunConfigurations.appendXml(cfg); diff --git a/client/ext/run/run.xml b/client/ext/run/run.xml index 2019586af06..dff120125e1 100644 --- a/client/ext/run/run.xml +++ b/client/ext/run/run.xml @@ -62,14 +62,35 @@ disabled="{!lstRunCfg.selected}"/> - - JavaScript file + + File path + + + + + + + + + Runner + + + + + + + + Command line arguments - + diff --git a/client/js/apf_release.js b/client/js/apf_release.js index 32ca73ad920..cac7e38229c 100644 --- a/client/js/apf_release.js +++ b/client/js/apf_release.js @@ -1,4 +1,4 @@ -var apf={VERSION:"3.0beta",CDN:"",READY:false,NODE_HIDDEN:101,NODE_VISIBLE:102,NODE_O3:103,KEYBOARD:2,KEYBOARD_MOUSE:true,SUCCESS:1,TIMEOUT:2,ERROR:3,OFFLINE:4,debug:false,includeStack:[],initialized:false,AppModules:[],autoLoadSkin:false,started:false,crypto:{},config:{},_GET:{},$asyncObjects:{"apf.oHttp":1,"apf.ajax":1},basePath:"",ns:{apf:"http://ajax.org/2005/aml",aml:"http://ajax.org/2005/aml",xsd:"http://www.w3.org/2001/XMLSchema",xhtml:"http://www.w3.org/1999/xhtml",xslt:"http://www.w3.org/1999/XSL/Transform",xforms:"http://www.w3.org/2002/xforms",ev:"http://www.w3.org/2001/xml-events"},xPathAxis:{self:1,"following-sibling":1,ancestor:1},hasRequireJS:window.require&&typeof require.def=="function",availHTTP:[],releaseHTTP:function(http){if(apf.brokenHttpAbort){return; +var apf={VERSION:"3.0beta",CDN:"",READY:false,NODE_HIDDEN:101,NODE_VISIBLE:102,NODE_O3:103,KEYBOARD:2,KEYBOARD_MOUSE:true,SUCCESS:1,TIMEOUT:2,ERROR:3,OFFLINE:4,debug:true,debugType:"Memory",debugFilter:"!teleport",includeStack:[],initialized:false,AppModules:[],autoLoadSkin:false,started:false,crypto:{},config:{},_GET:{},$asyncObjects:{"apf.oHttp":1,"apf.ajax":1},basePath:"",ns:{apf:"http://ajax.org/2005/aml",aml:"http://ajax.org/2005/aml",xsd:"http://www.w3.org/2001/XMLSchema",xhtml:"http://www.w3.org/1999/xhtml",xslt:"http://www.w3.org/1999/XSL/Transform",xforms:"http://www.w3.org/2002/xforms",ev:"http://www.w3.org/2001/xml-events"},xPathAxis:{self:1,"following-sibling":1,ancestor:1},hasRequireJS:window.require&&typeof require.def=="function",availHTTP:[],releaseHTTP:function(http){if(apf.brokenHttpAbort){return; }if(self.XMLHttpRequestUnSafe&&http.constructor==XMLHttpRequestUnSafe){return;}http.onreadystatechange=function(){}; http.abort();this.availHTTP.push(http);},browserDetect:function(){if(this.$bdetect){return; }this.$bdetect=true;var sAgent=navigator.userAgent.toLowerCase()||"",b=(typeof/./)[0]=="f"?+"1\0"?3:2:+"1\0"?5:1-"\0"?1:+{valueOf:function(x){return !x; @@ -18,22 +18,22 @@ var found;this.isIE=b===1;if(this.isIE){this.isIE=parseFloat(sAgent.match(/msie }this.isIE8=this.isIE==8&&(found=true);this.isIE7=!found&&this.isIE==7&&(found=true); if(document.documentMode==7){apf.isIE7=true;apf.isIE8=false;apf.isIE7Emulate=true; apf.isIE=7;}this.isIE6=!found&&this.isIE==6&&(found=true);var os=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(); -this.isWin=(os=="win");this.isMac=(os=="mac");this.isLinux=(os=="linux");},setCompatFlags:function(){this.TAGNAME=apf.isIE?"baseName":"localName"; -this.styleSheetRules=apf.isIE?"rules":"cssRules";this.brokenHttpAbort=apf.isIE6; -this.canUseHtmlAsXml=apf.isIE;this.supportNamespaces=!apf.isIE;this.cannotSizeIframe=apf.isIE; -this.hasConditionCompilation=apf.isIE;this.supportOverflowComponent=apf.isIE;this.hasFlexibleBox=apf.versionGecko>2||apf.webkitRev>2; -this.hasEventSrcElement=apf.isIE;this.canHaveHtmlOverSelects=!apf.isIE6&&!apf.isIE5; -this.hasInnerText=apf.isIE;this.hasMsRangeObject=apf.isIE;this.descPropJs=apf.isIE; -this.hasClickFastBug=apf.isIE;this.hasExecScript=window.execScript?true:false;this.canDisableKeyCodes=apf.isIE; -this.hasTextNodeWhiteSpaceBug=apf.isIE||apf.isIE>=8;this.hasCssUpdateScrollbarBug=apf.isIE; -this.canUseInnerHtmlWithTables=!apf.isIE;this.hasSingleResizeEvent=!apf.isIE;this.hasStyleFilters=apf.isIE; -this.supportOpacity=!apf.isIE||apf.isIE>=9;this.supportPng24=!apf.isIE6&&!apf.isIE5; -this.cantParseXmlDefinition=apf.isIE50;this.hasDynamicItemList=!apf.isIE||apf.isIE>=7; -this.canImportNode=apf.isIE;this.hasSingleRszEvent=!apf.isIE;this.hasXPathHtmlSupport=!apf.isIE; -this.hasFocusBug=apf.isIE;this.hasHeightAutoDrawBug=apf.isIE&&apf.isIE<8;this.hasReadyStateBug=apf.isIE50; -this.dateSeparator=apf.isIE?"-":"/";this.canCreateStyleNode=!apf.isIE;this.supportFixedPosition=!apf.isIE||apf.isIE>=7; -this.hasHtmlIdsInJs=apf.isIE&&apf.isIE<8||apf.isWebkit;this.needsCssPx=!apf.isIE; -this.hasCSSChildOfSelector=!apf.isIE||apf.isIE>=8;this.hasStyleAnchors=!apf.isIE||apf.isIE>=8; +this.isWin=(os=="win");this.isMac=(os=="mac");this.isLinux=(os=="linux");try{}catch(e){this.isDeskrun=false; +}},setCompatFlags:function(){this.TAGNAME=apf.isIE?"baseName":"localName";this.styleSheetRules=apf.isIE?"rules":"cssRules"; +this.brokenHttpAbort=apf.isIE6;this.canUseHtmlAsXml=apf.isIE;this.supportNamespaces=!apf.isIE; +this.cannotSizeIframe=apf.isIE;this.hasConditionCompilation=apf.isIE;this.supportOverflowComponent=apf.isIE; +this.hasFlexibleBox=apf.versionGecko>2||apf.webkitRev>2;this.hasEventSrcElement=apf.isIE; +this.canHaveHtmlOverSelects=!apf.isIE6&&!apf.isIE5;this.hasInnerText=apf.isIE;this.hasMsRangeObject=apf.isIE; +this.descPropJs=apf.isIE;this.hasClickFastBug=apf.isIE;this.hasExecScript=window.execScript?true:false; +this.canDisableKeyCodes=apf.isIE;this.hasTextNodeWhiteSpaceBug=apf.isIE||apf.isIE>=8; +this.hasCssUpdateScrollbarBug=apf.isIE;this.canUseInnerHtmlWithTables=!apf.isIE; +this.hasSingleResizeEvent=!apf.isIE;this.hasStyleFilters=apf.isIE;this.supportOpacity=!apf.isIE||apf.isIE>=9; +this.supportPng24=!apf.isIE6&&!apf.isIE5;this.cantParseXmlDefinition=apf.isIE50; +this.hasDynamicItemList=!apf.isIE||apf.isIE>=7;this.canImportNode=apf.isIE;this.hasSingleRszEvent=!apf.isIE; +this.hasXPathHtmlSupport=!apf.isIE;this.hasFocusBug=apf.isIE;this.hasHeightAutoDrawBug=apf.isIE&&apf.isIE<8; +this.hasReadyStateBug=apf.isIE50;this.dateSeparator=apf.isIE?"-":"/";this.canCreateStyleNode=!apf.isIE; +this.supportFixedPosition=!apf.isIE||apf.isIE>=7;this.hasHtmlIdsInJs=apf.isIE&&apf.isIE<8||apf.isWebkit; +this.needsCssPx=!apf.isIE;this.hasCSSChildOfSelector=!apf.isIE||apf.isIE>=8;this.hasStyleAnchors=!apf.isIE||apf.isIE>=8; this.styleAttrIsObj=apf.isIE<8;this.hasAutocompleteXulBug=apf.isGecko;this.loadsLocalFilesSync=apf.isIE||apf.isGecko; this.mouseEventBuffer=apf.isIE?20:6;this.hasComputedStyle=typeof document.defaultView!="undefined"&&typeof document.defaultView.getComputedStyle!="undefined"; this.w3cRange=Boolean(window.getSelection);this.locale=(apf.isIE?navigator.userLanguage:navigator.language).toLowerCase(); @@ -51,14 +51,18 @@ this.supportHashChange=("onhashchange" in self)&&(!apf.isIE||apf.isIE>=8);if(sel this.hasXhrProgress=!!xhr.upload;if(this.hasXhrBinary=!!(xhr.sendAsBinary||xhr.upload)){this.hasHtml5File=!!(File&&File.prototype.getAsDataURL); this.hasHtml5FileSlice=!!(File&&File.prototype.slice);}}else{this.hasXhrProgress=this.hasXhrBinary=this.hasHtml5File=this.hasHtml5FileSlice=false; }this.windowHorBorder=this.windowVerBorder=apf.isIE8&&(!self.frameElement||parseInt(self.frameElement.frameBorder))?4:0; -this.enableAnim=!apf.isIE||apf.isIE>8;this.animSteps=apf.isIE?0.3:1;this.animInterval=apf.isIE?7:1; -this.CSSFLOAT=apf.isIE?"styleFloat":"cssFloat";this.CSSPREFIX=apf.isGecko?"Moz":(apf.isWebkit?"webkit":""); +t=document.createElement("input");var _self=this;(function(props){for(var i in props){t.setAttribute("type",i); +_self["hasInput"+i.charAt(0).toUpperCase()+i.substr(1).replace("-l","L")]=!!(t.type!=="text"); +}})({search:1,tel:1,url:1,email:1,datetime:1,date:1,month:1,week:1,time:1,"datetime-local":1,number:1,range:1,color:1}); +t=null;delete t;this.enableAnim=!apf.isIE||apf.isIE>8;this.animSteps=apf.isIE?0.3:1; +this.animInterval=apf.isIE?7:1;this.CSSFLOAT=apf.isIE?"styleFloat":"cssFloat";this.CSSPREFIX=apf.isGecko?"Moz":(apf.isWebkit?"webkit":""); this.CSSPREFIX2=apf.isGecko?"-moz":(apf.isWebkit?"-webkit":"");this.INLINE=apf.isIE&&apf.isIE<8?"inline":"inline-block"; this.needZoomForLayout=apf.isIE&&apf.isIE<8;this.maxHttpRetries=apf.isOpera?0:3; this.percentageMatch=new RegExp();this.percentageMatch.compile("([\\-\\d\\.]+)\\%","g"); this.reMatchXpath=new RegExp();this.reMatchXpath.compile("(^|\\|)(?!\\@|[\\w-]+::)","g"); -},hasGeoLocation:function(){return false;},extend:function(dest,src){var prop,i,x=!dest.notNull; -if(arguments.length==2){for(prop in src){if(x||src[prop]){dest[prop]=src[prop]; +apf.isGears=!!apf.initGears()||0;},hasGeoLocation:function(){return typeof apf.geolocation!="undefined"&&apf.geolocation.init(); +},reboot:function(){apf.console.info("Restarting application...");location.href=location.href; +},extend:function(dest,src){var prop,i,x=!dest.notNull;if(arguments.length==2){for(prop in src){if(x||src[prop]){dest[prop]=src[prop]; }}return dest;}for(i=1;i"); +var p=node.parentNode.parentNode.parentNode,el=node.parentNode.parentNode;if(p.scrollTop+p.offsetHeight");for(var i=0;i["+date+"] ":"")+String(msg).replace(/(<[^>]+>)| /g,function(m,tag,sp){if(tag){return tag; +}return" ";}).replace(/\t/g,"   ");var sPath=apf.$debugwin&&apf.$debugwin.resPath?apf.$debugwin.resPath:apf.basePath+"core/debug/resources/"; +if(data){msg+="
More information
"; +}msg="
"+msg+"
";if(!subtype){subtype="default"; +}this.history.push([this.typeLut[type]||type,msg]);if(this.win&&!this.win.closed){this.showWindow(msg); +}this.debugInfo.push(msg);if(self.console&&(!document.all||apf.config.debug)){console[type=="warn"?"warn":(type=="error"?"error":"log")](apf.html_entity_decode(msg.replace(/<[^>]*>/g,""))); +}if(apf.dispatchEvent){apf.dispatchEvent("debug",{message:msg,type:type});}},clear:function(){this.history=[]; +},getAll:function(err,wrn,log){var hash={error:err,warn:wrn,log:log,custom:1};var out=[]; +for(var i=0,l=this.history.length;i"),"log",subtype,data); +},info:function(msg,subtype,data){this.log(apf.htmlentities(msg).replace(/\n/g,"
"),subtype,data); +},warn:function(msg,subtype,data){this.write(apf.htmlentities(msg).replace(/\n/g,"
"),"warn",subtype,data); +},error:function(msg,subtype,data){this.write(msg.replace(/\n/g,"
"),"error",subtype,data); +},dir:function(obj){var s=apf.$debugwin.$serializeObject(obj,"Inspected via apf.console.dir"); if(typeof s=="string"){this.write(s,"custom",null,null,null,true);}else{this.write(obj?"Could not serialize object: "+s.message:obj,"error",null,null,null,true); +}},debugInfo:[],debugType:"",showWindow:function(msg){if(!this.win||this.win.closed){this.win=window.open("","debug"); +this.win.document.write(''); +}if(!this.win){if(!this.haspopupkiller){alert("Could not open debug window, please check your popupkiller"); +}this.haspopupkiller=true;}else{this.win.document.write((msg||this.debugInfo.join("")).replace(/\{imgpath\}/g,apf.debugwin?apf.debugwin.resPath:apf.basePath+"core/debug/resources/")); }}},html_entity_decode:function(s){return s;},htmlentities:function(s){return s; -},formatErrorString:function(number,control,process,message,amlContext,outputname,output){apf.lastErrorMessage=message; -return message;},getDirname:function(url){return((url||"").match(/^([^#]*\/)[^\/]*(?:$|\#)/)||{})[1]; +},formatErrorString:function(number,control,process,message,amlContext,outputname,output){var str=[]; +if(amlContext&&amlContext.ownerDocument){if(amlContext.nodeType==9){amlContext=amlContext.documentElement; +}if(amlContext.ownerDocument.documentElement){var file=amlContext.ownerDocument.documentElement.getAttribute("filename"); +if(!file&&amlContext.ownerDocument.documentElement.tagName=="html"){file=location.href; +}file=file?apf.removePathContext(apf.hostPath,file):"Unkown filename";}else{file="Unknown filename"; +}if(apf.$debugwin){var amlStr=apf.$debugwin.$serializeObject(amlContext);}else{var amlStr=(amlContext.outerHTML||amlContext.xml||amlContext.serialize()).replace(/\<\?xml\:namespace prefix = j ns = "http\:\/\/ajax.org\/2005\/aml" \/\>/g,"").replace(/xmlns:a="[^"]*"\s*/g,""); +}var diff,linenr=0,w=amlContext.previousSibling||amlContext.parentNode&&amlContext.parentNode.previousSibling; +while(w&&w[apf.TAGNAME]!="body"){diff=(w.outerHTML||w.xml||w.serialize()).split("\n").length; +linenr+=diff-1;w=w.previousSibling||w.parentNode&&w.parentNode.previousSibling; +}if(w&&w[apf.TAGNAME]!="body"){linenr="unknown";}else{if(amlContext.ownerDocument&&amlContext.ownerDocument.documentElement.tagName=="html"){linenr+=apf.lineBodyStart; +}}str.push("aml file: [line: "+linenr+"] "+file);}if(control){str.push("Element: "+(apf.$debugwin&&!apf.isDebugWindow?apf.$debugwin.$serializeObject(control):"'"+(control.name||(control.$aml?control.getAttribute("id"):null)||"{Anonymous}")+"' ["+control.tagName+"]")); +}if(process){str.push("Process: "+process.replace(/ +/g," "));}if(message){str.push("Message: ["+number+"] "+message.replace(/ +/g," ")); +}if(outputname){str.push(outputname+": "+output);}if(amlContext&&amlStr){str.push("Related Markup: "+amlStr); +}return(apf.lastErrorMessage=str.join("\n"));},getDirname:function(url){return((url||"").match(/^([^#]*\/)[^\/]*(?:$|\#)/)||{})[1]; },getFilename:function(url){return((url||"").split("?")[0].match(/(?:\/|^)([^\/]+)$/)||{})[1]; },getAbsolutePath:function(base,url){return url&&url.charAt(0)=="/"?url:(!url||!base||url.match(/^\w+\:\/\//)?url:base.replace(/\/$/,"")+"/"+url.replace(/^\//,"")); -},include:function(sourceFile,doBase,type,text,callback){var sSrc=doBase?apf.getAbsolutePath(apf.basePath||"",sourceFile):sourceFile; -var head=document.getElementsByTagName("head")[0],elScript=document.createElement("script"); +},include:function(sourceFile,doBase,type,text,callback){if(apf.started){apf.console.info("including js file: "+sourceFile); +}var sSrc=doBase?apf.getAbsolutePath(apf.basePath||"",sourceFile):sourceFile;var head=document.getElementsByTagName("head")[0],elScript=document.createElement("script"); if(type){elScript.setAttribute("_apf_type",type);}if(text){if(apf.isIE){window.execScript(text); }else{elScript.text=text;}}else{elScript.src=sSrc;}head.appendChild(elScript);if(callback){elScript[apf.isIE?"onreadystatechange":"onload"]=callback; }return elScript;},$required:[],require:function(){var dir=apf.getDirname(location.href),i=0,l=arguments.length; @@ -110,9 +163,11 @@ i".replace(/(\w+)\s*=\s*([^\>="'\s ]+)( |\s|\>|\/\>)/g,'$1="$2"$3').replace(/ disabled /g," disabled='true' ").replace(/\]\]\>/g,"]]>").replace(/<(\w+)(\s[^>]*[^\/])?>/g,function(m,tag,c){if(tags[tag]){return"<"+tag+(c||"")+"/>"; -}else{return m;}});}catch(e){return;}var xmlNode=apf.getAmlDocFromString("
"+strXml+"
").documentElement; +}for(var i=0;i$/)){throw new Error("Cannot have self closing elements!\n"+htmlNode.outerHTML); +}try{var tags={IMG:1,LINK:1,META:1,INPUT:1,BR:1,HR:1,AREA:1,BASEFONT:1},regex=new RegExp(htmlNode.outerHTML.replace(/([\(\)\|\\\.\^\$\{\}\[\]])/g,"\\$1")+".*"+htmlNode.tagName),match=htmlNode.parentNode.outerHTML.replace(/\n/g,"").match(regex),strXml=match[0]+">".replace(/(\w+)\s*=\s*([^\>="'\s ]+)( |\s|\>|\/\>)/g,'$1="$2"$3').replace(/ disabled /g," disabled='true' ").replace(/\]\]\>/g,"]]>").replace(/<(\w+)(\s[^>]*[^\/])?>/g,function(m,tag,c){if(tags[tag]){return"<"+tag+(c||"")+"/>"; +}else{return m;}});}catch(e){throw new Error(apf.formatErrorString(0,null,"Parsing inline aml (without xmlns on root node)","Could not parse inline aml. This happens when the htmlis mangled too much by Internet Explorer. Either you are using a cdata section or javascript containing symbols that throw off the browser. Please put this aml in a seperate file and load it using an include element.")); +return;}var xmlNode=apf.getAmlDocFromString("
"+strXml+"
").documentElement; while(xmlNode.childNodes.length>1){xmlNode.removeChild(xmlNode.lastChild);}apf.AppNode.appendChild(xmlNode); };}else{findAml=function(htmlNode){var strXml=htmlNode.outerHTML.replace(/ _moz-userdefined=""/g,""),xmlNode=apf.getAmlDocFromString("
"+strXml+"
").documentElement; while(xmlNode.childNodes.length>1){xmlNode.removeChild(xmlNode.lastChild);}if(apf.isWebkit){xmlNode=apf.AppNode.ownerDocument.importNode(xmlNode,true); @@ -136,19 +191,21 @@ apf.amlParts.push([node.parentNode,node.nextSibling]);}}}if(!isPrefix&&node.firs }else{node=node.nextSibling;}}else{do{node=node.parentNode;if(node.tagName=="BODY"){node=null; }}while(node&&!node.nextSibling);if(node){node=node.nextSibling;}}}if(temp){temp.parentNode.removeChild(temp); }},parseAppMarkup:function(docElement){var isEmptyDocument=false;if(this.parseStrategy==1||!this.parseStrategy&&!docElement&&document.documentElement.outerHTML.split(">",1)[0].indexOf(apf.ns.aml)==-1){this.parsePartialAml(docElement); -if(this.parseStrategy==1||apf.amlParts.length){apf.isParsingPartial=true;apf.loadAmlIncludes(apf.AppNode); -if(!self.ERROR_HAS_OCCURRED){apf.initialize();}return;}else{isEmptyDocument=true; -}}if(isEmptyDocument&&document.documentElement.outerHTML.split(">",1)[0].indexOf(apf.ns.aml)==-1){return false; -}if(this.parseStrategy==21||!this.parseStrategy&&!docElement){return apf.oHttp.get((apf.alternativeAml||document.body&&document.body.getAttribute("xmlurl")||location.href).split(/#/)[0],{callback:function(xmlString,state,extra){if(state!=apf.SUCCESS){var oError=new Error(apf.formatErrorString(0,null,"Loading XML application data","Could not load XML from remote source: "+extra.message)); +if(this.parseStrategy==1||apf.amlParts.length){if(apf.amlParts.length){apf.console.warn("Aml found, parsing..."); +}apf.isParsingPartial=true;apf.loadAmlIncludes(apf.AppNode);if(!self.ERROR_HAS_OCCURRED){apf.initialize(); +}return;}else{apf.console.warn("No aml found.");isEmptyDocument=true;}}if(isEmptyDocument&&document.documentElement.outerHTML.split(">",1)[0].indexOf(apf.ns.aml)==-1){apf.console.warn("The aml namespace declaration wasn't found. No aml elements were found in the body. Exiting"); +return false;}if(this.parseStrategy==21||!this.parseStrategy&&!docElement){return apf.oHttp.get((apf.alternativeAml||document.body&&document.body.getAttribute("xmlurl")||location.href).split(/#/)[0],{type:"markup",callback:function(xmlString,state,extra){if(state!=apf.SUCCESS){var oError=new Error(apf.formatErrorString(0,null,"Loading XML application data","Could not load XML from remote source: "+extra.message)); if(extra.tpModule.retryTimeout(extra,state,null,oError)===true){return true;}throw oError; -}var str=xmlString.replace(/\<\!DOCTYPE[^>]*>/,"").replace(/^[\r\n\s]*/,"");if(!apf.supportNamespaces){str=str.replace(/xmlns\=\"[^"]*\"/g,""); +}apf.lineBodyStart=(xmlString.replace(/\n/g,"\\n").match(/(.*)]*>/,"").replace(/^[\r\n\s]*/,"");if(!apf.supportNamespaces){str=str.replace(/xmlns\=\"[^"]*\"/g,""); }if(self.ERROR_HAS_OCCURRED){return;}if(apf.isIE){document.body.innerHTML="";}else{var nodes=document.body.childNodes; for(var i=nodes.length-1;i>=0;i--){nodes[i].parentNode.removeChild(nodes[i]);}}document.documentElement.style.display="block"; document.body.style.display="block";apf.initialize(str);},ignoreOffline:true}); }else{document.body.style.display="block";if(!self.ERROR_HAS_OCCURRED){apf.initialize(docElement.outerHTML||docElement.xml); }}},namespaces:{},setNamespace:function(namespaceURI,oNamespace){this.namespaces[namespaceURI]=oNamespace; -oNamespace.namespaceURI=namespaceURI;},initialize:function(xmlStr){apf.console.info("Initializing..."); -clearInterval(apf.Init.interval);apf.Init.run();var bodyMarginTop=parseFloat(apf.getStyle(document.body,"marginTop")); +oNamespace.namespaceURI=namespaceURI;},initialize:function(xmlStr){if(apf.initialized){return; +}apf.initialized=true;apf.console.info("Initializing...");clearInterval(apf.Init.interval); +apf.Init.run();var bodyMarginTop=parseFloat(apf.getStyle(document.body,"marginTop")); apf.doesNotIncludeMarginInBodyOffset=(document.body.offsetTop!==bodyMarginTop); if(apf.isParsingPartial){apf.config.setDefaults();apf.hasSingleRszEvent=true;var pHtmlNode=document.body; var lastChild=pHtmlNode.lastChild;apf.AmlParser.parseMoreAml(apf.AppNode,pHtmlNode,null,true,false); @@ -177,11 +234,11 @@ if(old_onload){old_onload();}};}}}}}},fireEvent:function(el,type,e,capture){if(e }else{if(el.detachEvent){el.detachEvent("on"+type,fn);}}return this;},stopEvent:function(e){this.stopPropagation(e).preventDefault(e); return false;},stopPropagation:function(e){if(e.stopPropagation){e.stopPropagation(); }else{e.cancelBubble=true;}return this;},preventDefault:function(e){if(e.preventDefault){e.preventDefault(); -}else{e.returnValue=false;}return this;},unload:function(exclude){this.isDestroying=true; -this.popup.destroy();var node,i=0,l=this.all.length;for(;i-1||exclNr==3){options={xpathmode:2};}else{if(exclNr==2){options={nostring:true}; -}else{if(exclNr===0){options={parsecode:true};}}}if(this.liveedit){(options||(options={})).liveedit=true; +}else{if(exclNr===0){options={parsecode:true,nothrow:this.target.match(/-debug$/)?true:false}; +}}}if(this.liveedit){(options||(options={})).liveedit=true;}if(apf.config.debugLm){(options||(options={})).nothrow=true; }if(pValue&&pValue.dataType==apf.FUNCTION){var fParsed=pValue;pValue="";}else{var fParsed=apf.lm.compile(pValue,options); -}if(prop==MODEL){(this.$modelParsed=fParsed).instruction=pValue;}if(fParsed.type==2){this[prop]=!pValue; -return this.setProperty(prop,fParsed.str,null,null,10);}var check=1;if(exclNr==2||fParsed.xpaths.length&&exclNr!=1){if(!this.hasFeature(apf.__DATABINDING__)){this.implement(apf.StandardBinding); +}if(prop==MODEL){(this.$modelParsed=fParsed).instruction=pValue;}else{if(exclNr===0){this.$lastFParsed=fParsed; +}}if(fParsed.type==2){this[prop]=!pValue;return this.setProperty(prop,fParsed.str,null,null,10); +}var check=1;if(exclNr==2||fParsed.xpaths.length&&exclNr!=1){if(!this.hasFeature(apf.__DATABINDING__)){this.implement(apf.StandardBinding); if(this.$attrExcludePropBind[prop]==1){check=0;}}if(check){this.$addAttrBind(prop,fParsed,pValue); }}var matches=exclNr&&exclNr!=3&&prop!=MODEL?{}:fParsed.props,found=false,_self=this,o,node,bProp,p; -for(p in matches){o=p.split(".");if(o.length>2){bProp=o.pop();try{node=eval(o.join(".")); -}catch(e){if(arguments[2]){apf.console.warn("[287] Could not execute binding test : "+pValue.replace(/2){bProp=o.pop(); +try{node=eval(o.join("."));}catch(e){if(arguments[2]){apf.console.warn("[287] Could not execute binding test : "+pValue.replace(/=0;i--){if(nodes[i].destroy){nodes[i].destroy(true,clean&&this.localName=="col }else{if(this.ownerElement&&!this.ownerElement.$amlDestroyed){this.ownerElement.removeAttributeNode(this); }}if(this.$focussable&&this.focussable){apf.window.$removeFocus(this);}if(this.attributes){var attr=this.attributes; for(var i=attr.length-1;i>=0;i--){this.$clearDynamicProperty(attr[i].nodeName); -attr[i].destroy();}}try{if(this.id||this.name){self[this.id||this.name]=null;}}catch(ex){}apf.nameserver.remove(this.localName,this); +attr[i].destroy();}}if(deep!==false&&this.childNodes&&this.childNodes.length){apf.console.warn("You have destroyed an Aml Node without destroying it's children. Please be aware that if you don't maintain a reference, memory might leak"); +}try{if(this.id||this.name){self[this.id||this.name]=null;}}catch(ex){}apf.nameserver.remove(this.localName,this); };})();apf.extend(apf,new apf.Class().$init());apf.Init.run("class");apf.color={colorshex:{aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgrey:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,grey:8421504,green:32768,greenyellow:11403055,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgrey:13882323,lightgreen:9498256,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662680,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14184595,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},fixHSB:function(hsb){return{h:Math.min(360,Math.max(0,hsb.h)),s:Math.min(100,Math.max(0,hsb.s)),b:Math.min(100,Math.max(0,hsb.b))}; },fixRGB:function(rgb){return{r:Math.min(255,Math.max(0,rgb.r)),g:Math.min(255,Math.max(0,rgb.g)),b:Math.min(255,Math.max(0,rgb.b))}; },fixHex:function(hex){var len=6-hex.length;if(len>0){var o=[],i=0;for(;i=0){var replacement=arguments[i++]||" ";str=str.substr(0,inx)+replacement+str.substr(inx+2); inx=str.indexOf("%s");}return str;};if(!Date.now){Date.now=function now(){return +new Date(); -};}apf.hotkeys={};(function(){var keyMods={ctrl:1,alt:2,option:2,shift:4,meta:8,command:8}; +};}apf.flash=(function(){function getControlVersion(){var version,axo;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); +version=axo.GetVariable("$version");}catch(e){}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); +version="WIN 6,0,21,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$version"); +}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); +version=axo.GetVariable("$version");}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); +version="WIN 3,0,18,0";}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); +version="WIN 2,0,0,11";}catch(e){version=-1;}}return version;}function getSwfVersion(){var flashVer=-1,sAgent=navigator.userAgent.toLowerCase(); +if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var swVer2=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"",swfDescr=navigator.plugins["Shockwave Flash"+swVer2].description,aDescr=swfDescr.split(" "),aTempMaj=aDescr[2].split("."),nMajor=aTempMaj[0],nMinor=aTempMaj[1],sRev=aDescr[3]; +if(sRev==""){sRev=aDescr[4];}if(sRev[0]=="d"){sRev=sRev.substring(1);}else{if(sRev[0]=="r"){sRev=sRev.substring(1); +if(sRev.indexOf("d")>0){sRev=sRev.substring(0,sRev.indexOf("d"));}}}flashVer=nMajor+"."+nMinor+"."+sRev; +}}else{if(sAgent.indexOf("webtv/2.6")!=-1){flashVer=4;}else{if(sAgent.indexOf("webtv/2.5")!=-1){flashVer=3; +}else{if(sAgent.indexOf("webtv")!=-1){flashVer=2;}else{if(apf.isIE&&!apf.isOpera){flashVer=getControlVersion(); +}}}}}return flashVer;}function detectFlashVersion(reqMajorVer,reqMinorVer,reqRevision){var versionStr=getSwfVersion(); +if(versionStr==-1){return false;}if(versionStr!=0){var aVersions;if(apf.isIE&&!apf.isOpera){var aTemp=versionStr.split(" "),sTemp=aTemp[1]; +aVersions=sTemp.split(",");}else{aVersions=versionStr.split(".");}var nMajor=aVersions[0],nMinor=aVersions[1],sRev=aVersions[2]; +if(nMajor>parseFloat(reqMajorVer)){return true;}if(nMajor==parseFloat(reqMajorVer)){if(nMinor>parseFloat(reqMinorVer)){return true; +}if(nMinor==parseFloat(reqMinorVer)&&sRev>=parseFloat(reqRevision)){return true; +}}return false;}}function generateObj(objAttrs,params,embedAttrs,stdout){if(stdout=="undefined"){stdout=false; +}var i,str=[];if(apf.isIE&&!apf.isOpera){str.push("");for(i in params){str.push(''); +}str.push("");}else{str.push("");}var sOut=str.join("");if(stdout===true){document.write(sOut); +}return sOut;}function AC_FL_RunContent(options){var ret=AC_GetArgs(options,"movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash"); +return generateObj(ret.objAttrs,ret.params,ret.embedAttrs);}function buildContent(options){var v=isEightAvailable(); +if(isAvailable()&&!v){return buildInstaller(options||{});}if(v){return AC_FL_RunContent(options); +}return'This content requires the Adobe Flash Player.'; +}function embed(options){var obj=options.context,node=options.htmlNode,prop=options.property||"$player"; +delete options.context,delete options.htmlNode,delete options.property;var content=buildContent(options),cb=function(){$setTimeout(function(){node.innerHTML=content; +obj[prop]=getElement(options.id);$setTimeout(function(){var fail=null;if(!obj[prop]){fail="The Flash movie failed to load. Please check if you're loading the movie on a website running through http://."; +}else{if(!obj[prop].parentNode){fail="The movie has to be enabled manually because of Flashblock. No browser refresh is required."; +}else{if(obj[prop].style.display=="none"){fail="Adblock Plus blocks or hides the movie. Please enable it and refresh your browser."; +}else{if(!obj[prop].offsetWidth){fail="The Flash movie failed to load. Please check if the file exists and the path is correct."; +}}}}if(fail){apf.console.error(fail,"flash");if(options.onError){options.onError({message:fail}); +}else{obj.dispatchEvent("error",{message:fail});}}},1000);},200);};return apf.loaded?cb():apf.addEventListener("load",cb); +}function buildInstaller(options){if(!options){options={};}var ret=AC_GetArgs(options,"movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash"),MMPlayerType=(apf.isIE==true)?"ActiveX":"PlugIn",MMredirectURL=window.location; +document.title=document.title.slice(0,47)+" - Flash Player Installation";var MMdoctitle=document.title; +return AC_FL_RunContent({src:"playerProductInstall",FlashVars:"MMredirectURL="+MMredirectURL+"&MMplayerType="+MMPlayerType+"&MMdoctitle="+MMdoctitle+"",width:"100%",height:"100%",align:"middle",id:ret.embedAttrs.name,quality:"high",bgcolor:"#000000",name:ret.embedAttrs.name,allowScriptAccess:"always",type:"application/x-shockwave-flash",pluginspage:"http://www.adobe.com/go/getflashplayer"}); +}var sSrc="src|movie",sObj="onafterupdate|onbeforeupdate|onblur|oncellchange|onclick|ondblclick|ondrag|ondragend|ondragenter|ondragleave|ondragover|ondrop|onfinish|onfocus|onhelp|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup|onload|onlosecapture|onpropertychange|onreadystatechange|onrowsdelete|onrowenter|onrowexit|onrowsinserted|onstart|onscroll|onbeforeeditfocus|onactivate|onbeforedeactivate|ondeactivate|type|codebase|id",sEmb="width|height|align|vspace|hspace|class|title|accesskey|name|tabindex"; +function AC_GetArgs(options,srcParamName,classid,mimeType){var i,name,ret={embedAttrs:{},params:{},objAttrs:{}}; +for(i in options){name=i.toLowerCase();if(name=="classid"){continue;}if(name=="pluginspage"){ret.embedAttrs[i]=options[i]; +}else{if(sSrc.indexOf(name)>-1){ret.embedAttrs.src=options[i];ret.params[srcParamName]=options[i]; +}else{if(sObj.indexOf(name)>-1){ret.objAttrs[i]=options[i];}else{if(sEmb.indexOf(name)>-1){ret.embedAttrs[i]=ret.objAttrs[i]=options[i]; +}else{ret.embedAttrs[i]=ret.params[i]=options[i];}}}}}ret.objAttrs.classid=classid; +if(mimeType){ret.embedAttrs.type=mimeType;}return ret;}function getElement(id){var elem; +if(typeof id=="object"){return id;}if(apf.isIE){return self[id];}else{elem=document[id]?document[id]:document.getElementById(id); +if(!elem){elem=apf.lookup(id);}return elem;}}var hash={},uniqueID=1;function addPlayer(player){hash[++uniqueID]=player; +return uniqueID;}function getPlayer(id){return hash[id];}function callMethod(id,methodName){var player=hash[id]; +if(player==null){throw new Error(apf.formatErrorString(0,this,"Player with id: "+id+" not found")); +}if(player[methodName]==null){throw new Error(apf.formatErrorString(0,this,"Method "+methodName+" Not found")); +}apf.console.info("[FLASH] received method call for player '"+id+"', '"+methodName+"'"); +var args=[],i=2,l=arguments.length;for(;i'+__flash__argumentsToXML(arguments,2)+""); +return eval(rs);}function encode(data){if(!data||typeof data!="string"){return data; +}return data.replace(/\&([^;]*)\;/g,"&$1;").replace(//g,">").replace("\\","&custom_backslash;").replace(/\0/g,"\\0").replace(/\"/g,"""); +}function decode(data){if(data&&data.length&&typeof data!="string"){data=data[0]; +}if(!data||typeof data!="string"){return data;}return data.replace(/\&custom_lt\;/g,"<").replace(/\&custom_gt\;/g,">").replace(/\&custom_backslash\;/g,"\\").replace(/\\0/g,"\0"); +}var aIsAvailable={};function isAvailable(sVersion){if(typeof sVersion!="string"){sVersion="6.0.65"; +}var aVersion=sVersion.split(".");while(aVersion.length<3){aVersion.push("0");}if(typeof aIsAvailable[sVersion]=="undefined"){aIsAvailable[sVersion]=detectFlashVersion(parseInt(aVersion[0]),parseInt(aVersion[1]),parseInt(aVersion[2])); +}return aIsAvailable[sVersion];}function isEightAvailable(){return isAvailable("8.0.0"); +}var oSandboxTypes={remote:"remote (domain-based) rules",localwithfile:"local with file access (no internet access)",localwithnetwork:"local with network (internet access only, no local access)",localtrusted:"local, trusted (local + internet access)"}; +function getSandbox(sType){var oSandbox={type:null,description:null,noRemote:false,noLocal:false,error:null}; +oSandbox.type=sType.toLowerCase();oSandbox.description=oSandboxTypes[(typeof oSandboxTypes[oSandbox.type]!="undefined"?oSandbox.type:"unknown")]; +if(oSandbox.type=="localwithfile"){oSandbox.noRemote=true;oSandbox.noLocal=false; +oSandbox.error="Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html"; +}else{if(oSandbox.type=="localwithnetwork"){oSandbox.noRemote=false;oSandbox.noLocal=true; +}else{if(oSandbox.type=="localtrusted"){oSandbox.noRemote=false;oSandbox.noLocal=false; +}}}return oSandbox;}return{isAvailable:isAvailable,isEightAvailable:isEightAvailable,buildContent:buildContent,embed:embed,encode:encode,decode:decode,getElement:getElement,addPlayer:addPlayer,getPlayer:getPlayer,callMethod:callMethod,getSandbox:getSandbox,remote:remote}; +})();apf.hotkeys={};(function(){var keyMods={ctrl:1,alt:2,option:2,shift:4,meta:8,command:8}; this.keyNames={"8":"Backspace","9":"Tab","13":"Enter","27":"Esc","32":"Space","33":"PageUp","34":"PageDown","35":"End","36":"Home","37":"Left","38":"Up","39":"Right","40":"Down","45":"Insert","46":"Del","107":"+","112":"F1","113":"F2","114":"F3","115":"F4","116":"F5","117":"F6","118":"F7","119":"F8","120":"F9","121":"F10","122":"F11","123":"F12","188":",","219":"[","221":"]"}; var macUnicode={meta:"\u2318",command:"\u2318",alt:"\u2325",option:"\u2325",shift:"\u21E7",esc:"\u238B",control:"\u2303",backspace:"\u232B",del:"\u2326",enter:"\u21A9"}; var macUnicodeHtml={meta:"⌘",command:"⌘",alt:"⌥",option:"⌥",shift:"⇧",esc:"⎋",control:"ࣿ",backspace:"èB;",del:"ख",enter:"A9;"}; this.$keys={};var _self=this,trace=0;function register(hotkey,handler){var key,hashId=0,keys=hotkey.splitSafe("\\-",null,true),i=0,l=keys.length; for(;i46&&code!=91?String.fromCharCode(code):null); @@ -426,8 +568,18 @@ if(apf.canDisableKeyCodes){try{e.keyCode=0;}catch(e){}}return false;}var keys=[] if(e.altKey){keys.push("Alt");}if(e.ctrlKey){keys.push("Ctrl");}if(e.shiftKey){keys.push("Shift"); }if(e.metaKey){keys.push("Meta");}if(_self.keyNames[e.keyCode]){keys.push(_self.keyNames[e.keyCode]); }if(keys.length){if(e.keyCode>46&&!_self.keyNames[e.keyCode]){keys.push(String.fromCharCode(e.keyCode)); -}apf.setProperty("hotkey",keys.join("-"));}});}).call(apf.hotkeys);apf.json2xml_Obj={}; -apf.json2xml_Attr={};apf.json2xml_ObjByAttr={};apf.json2Xml=(function(){var jsonToXml=function(v,name,xml,notag){var i,n,m,t; +}apf.setProperty("hotkey",keys.join("-"));}});}).call(apf.hotkeys);apf.iepngfix=(function(){var sNodes=null,aNodes=null,applyPositioning=true,shim,fnLoadPngs=function(){if(!shim){shim=apf.skins.skins["default"].mediaPath+"/blank.gif"; +}if(aNodes===null){if(sNodes){aNodes=sNodes.splitSafe(",");}else{aNodes=[document]; +}}function fixMe(obj){if(obj.currentStyle.backgroundImage.match(/\.png/i)!==null){bg_fnFixPng(obj); +}if(obj.tagName=="IMG"&&obj.src.match(/\.png$/i)!==null){el_fnFixPng(obj);}if(applyPositioning&&(obj.tagName=="A"||obj.tagName=="INPUT")&&obj.style.position===""){obj.style.position="relative"; +}}for(var j=0,l=aNodes.length,node;j/g,">"); }if(!notag){if(name!=(m=name.replace(/[^a-zA-Z0-9_-]/g,"_"))){apf.console.warn("Json2XML, invalid characters found in JSON tagname '"+name,"json2Xml"); }name=m;}if(apf.isArray(v)){for(i=0,n=v.length;i3){actualVerArray.pop();}while(actualVerArray.length<4){actualVerArray.push(0); +}var reqVerArray=version.split(".");while(reqVerArray.length>4){reqVerArray.pop(); +}var requiredVersionPart;var actualVersionPart;var index=0;do{requiredVersionPart=parseInt(reqVerArray[index]); +actualVersionPart=parseInt(actualVerArray[index]);index++;}while(index");delete slProperties.id;delete slProperties.width;delete slProperties.height; +for(var name in slProperties){if(slProperties[name]){htmlBuilder.push(''); +}}htmlBuilder.push("");return htmlBuilder.join("");}function createObjectEx(params){var parameters=params; +var html=createObject(parameters.source,parameters.parentElement,parameters.id,parameters.properties,parameters.events,parameters.initParams,parameters.context); +if(parameters.parentElement==null){return html;}}function buildPromptHTML(slPluginHelper){var slPluginHTML=""; +var urlRoot=fwlinkRoot;var version=slPluginHelper.version;if(slPluginHelper.alt){slPluginHTML=slPluginHelper.alt; +}else{if(!version){version="";}slPluginHTML="Get Microsoft Silverlight"; +slPluginHTML=slPluginHTML.replace("{1}",version);slPluginHTML=slPluginHTML.replace("{2}",urlRoot+"108181"); +}return slPluginHTML;}function getSilverlight(version){if(onGetSilverlight){onGetSilverlight(); +}var shortVer="";var reqVerArray=String(version).split(".");if(reqVerArray.length>1){var majorNum=parseInt(reqVerArray[0]); +if(isNaN(majorNum)||majorNum<2){shortVer="1.0";}else{shortVer=reqVerArray[0]+"."+reqVerArray[1]; +}}var verArg="";if(shortVer.match(/^\d+\056\d+$/)){verArg="&v="+shortVer;}followFWLink("114576"+verArg); +}function followFWLink(linkid){top.location=fwlinkRoot+String(linkid);}function HtmlAttributeEncode(strInput){var c; +var retVal="";if(strInput==null){return null;}for(var cnt=0;cnt96)&&(c<123))||((c>64)&&(c<91))||((c>43)&&(c<58)&&(c!=47))||(c==95)){retVal=retVal+String.fromCharCode(c); +}else{retVal=retVal+"&#"+c+";";}}return retVal;}function default_error_handler(sender,args){var iErrorCode; +var errorType=args.ErrorType;iErrorCode=args.ErrorCode;var errMsg=["\nSilverlight error message \n ErrorCode: ",iErrorCode,"\n ErrorType: ",errorType," \n Message: ",args.ErrorMessage," \n"]; +if(errorType=="ParserError"){errMsg.push("XamlFile: ",args.xamlFile," \n Line: ",args.lineNumber," \n Position: ",args.charPosition," \n"); +}else{if(errorType=="RuntimeError"){if(args.lineNumber!=0){errMsg.push("Line: ",args.lineNumber," \n Position: ",args.charPosition," \n"); +}errMsg.push("MethodName: ",args.methodName," \n");}}throw new Error(apf.formatErrorString(0,this,errMsg.join(""))); +}function __cleanup(){for(var i=silverlightCount-1;i>=0;i--){window["__slEvent"+i]=null; +}silverlightCount=0;if(window.removeEventListener){window.removeEventListener("unload",__cleanup,false); +}else{window.detachEvent("onunload",__cleanup);}}function __getHandlerName(handler){var handlerName=""; +if(typeof handler=="string"){handlerName=handler;}else{if(typeof handler=="function"){if(silverlightCount==0){if(window.addEventListener){window.addEventListener("onunload",__cleanup,false); +}else{window.attachEvent("onunload",__cleanup);}}var count=silverlightCount++;handlerName="__slEvent"+count; +window[handlerName]=handler;}else{handlerName=null;}}return handlerName;}function onRequiredVersionAvailable(){}function onRestartRequired(){}function onUpgradeRequired(){}function onInstallRequired(){}function IsVersionAvailableOnError(sender,args){var retVal=false; +try{if(args.ErrorCode==8001&&!__installationEventFired){onUpgradeRequired();__installationEventFired=true; +}else{if(args.ErrorCode==8002&&!__installationEventFired){onRestartRequired();__installationEventFired=true; +}else{if(args.ErrorCode==5014||args.ErrorCode==2106){if(__verifySilverlight2UpgradeSuccess(args.getHost())){retVal=true; +}}else{retVal=true;}}}}catch(e){}return retVal;}function IsVersionAvailableOnLoad(sender){var retVal=false; +try{if(__verifySilverlight2UpgradeSuccess(sender.getHost())){retVal=true;}}catch(e){}return retVal; +}function __verifySilverlight2UpgradeSuccess(host){var retVal=false,version="2.0.31005",installationEvent=null; +try{if(host.IsVersionSupported(version+".99")){installationEvent=onRequiredVersionAvailable; +retVal=true;}else{if(host.IsVersionSupported(version+".0")){installationEvent=onRestartRequired; +}else{installationEvent=onUpgradeRequired;}}if(installationEvent&&!__installationEventFired){installationEvent(); +__installationEventFired=true;}}catch(e){}return retVal;}var aIsAvailable={};function isAvailable(sVersion){if(typeof sVersion=="undefined"){sVersion="1.0"; +}if(typeof aIsAvailable[sVersion]=="undefined"){aIsAvailable[sVersion]=isInstalled(sVersion); +}return aIsAvailable[sVersion];}return{onGetSilverlight:null,isBrowserRestartRequired:false,startup:startup,createObject:createObject,createObjectEx:createObjectEx,getSilverlight:getSilverlight,default_error_handler:default_error_handler,isAvailable:isAvailable}; +})();apf.setStyleRule=function(name,type,value,stylesheet,win){name=name.toLowerCase(); if(!stylesheet){var sheets=(win||self).document.styleSheets;for(var j=sheets.length-1; j>=0;j--){try{var rules=sheets[j][apf.styleSheetRules];for(var i=0;i"+cssString+""); +var htmlNode=doc.getElementsByTagName("head")[0];if(!apf.supportOpacity){cssString=cssString.replace(/opacity[ \s]*\:[ \s]*([\d\.]+)/g,function(m,m1){return"filter:progid:DXImageTransform.Microsoft.Alpha(opacity="+(m1*100)+")"; +});}if(apf.canCreateStyleNode){var style=doc.createElement("style");style.appendChild(doc.createTextNode(cssString)); +if(media){style.setAttribute("media",media);}htmlNode.appendChild(style);}else{htmlNode.insertAdjacentHTML("beforeend","."); }};apf.getStyleRecur=function(el,prop){var value=apf.hasComputedStyle?document.defaultView.getComputedStyle(el,"").getPropertyValue(prop.replace(/([A-Z])/g,function(m,m1){return"-"+m1.toLowerCase(); })):el.currentStyle[prop];return((!value||value=="transparent"||value=="inherit")&&el.parentNode&&el.parentNode.nodeType==1)?this.getStyleRecur(el.parentNode,prop):value; };apf.importStylesheet=function(def,win){if(!def.length){return;}var re=new RegExp("^"+document.domain,"g"); @@ -637,8 +869,328 @@ ht-=o.parentNode.scrollTop;}o=o.offsetParent;}return[wt,ht];};apf.getHorBorders= };apf.getHtmlInnerHeight=function(oHtml){return(oHtml.offsetHeight-(parseInt(apf.getStyle(oHtml,"borderTopWidth"))||0)-(parseInt(apf.getStyle(oHtml,"borderBottomWidth"))||0)); };apf.getViewPort=function(win){win=win||window;var doc=(!win.document.compatMode||win.document.compatMode=="CSS1Compat")?win.document.html||win.document.documentElement:win.document.body; return{x:win.pageXOffset||doc.scrollLeft,y:win.pageYOffset||doc.scrollTop,width:win.innerWidth||doc.clientWidth,height:win.innerHeight||doc.clientHeight}; -};apf.pasteWindow=function(str){var win=window.open("about:blank");win.document.write(str); -};apf.xmlEntityMap={quot:"34",amp:"38",apos:"39",lt:"60",gt:"62",nbsp:"160",iexcl:"161",cent:"162",pound:"163",curren:"164",yen:"165",brvbar:"166",sect:"167",uml:"168",copy:"169",ordf:"170",laquo:"171",not:"172",shy:"173",reg:"174",macr:"175",deg:"176",plusmn:"177",sup2:"178",sup3:"179",acute:"180",micro:"181",para:"182",middot:"183",cedil:"184",sup1:"185",ordm:"186",raquo:"187",frac14:"188",frac12:"189",frac34:"190",iquest:"191",agrave:"192",aacute:"193",acirc:"194",atilde:"195",auml:"196",aring:"197",aelig:"198",ccedil:"199",egrave:"200",eacute:"201",ecirc:"202",euml:"203",igrave:"204",iacute:"205",icirc:"206",iuml:"207",eth:"208",ntilde:"209",ograve:"210",oacute:"211",ocirc:"212",otilde:"213",ouml:"214",times:"215",oslash:"216",ugrave:"217",uacute:"218",ucirc:"219",uuml:"220",yacute:"221",thorn:"222",szlig:"223",agrave:"224",aacute:"225",acirc:"226",atilde:"227",auml:"228",aring:"229",aelig:"230",ccedil:"231",egrave:"232",eacute:"233",ecirc:"234",euml:"235",igrave:"236",iacute:"237",icirc:"238",iuml:"239",eth:"240",ntilde:"241",ograve:"242",oacute:"243",ocirc:"244",otilde:"245",ouml:"246",divide:"247",oslash:"248",ugrave:"249",uacute:"250",ucirc:"251",uuml:"252",yacute:"253",thorn:"254",yuml:"255",oelig:"338",oelig:"339",scaron:"352",scaron:"353",yuml:"376",fnof:"402",circ:"710",tilde:"732",alpha:"913",beta:"914",gamma:"915",delta:"916",epsilon:"917",zeta:"918",eta:"919",theta:"920",iota:"921",kappa:"922",lambda:"923",mu:"924",nu:"925",xi:"926",omicron:"927",pi:"928",rho:"929",sigma:"931",tau:"932",upsilon:"933",phi:"934",chi:"935",psi:"936",omega:"937",alpha:"945",beta:"946",gamma:"947",delta:"948",epsilon:"949",zeta:"950",eta:"951",theta:"952",iota:"953",kappa:"954",lambda:"955",mu:"956",nu:"957",xi:"958",omicron:"959",pi:"960",rho:"961",sigmaf:"962",sigma:"963",tau:"964",upsilon:"965",phi:"966",chi:"967",psi:"968",omega:"969",thetasym:"977",upsih:"978",piv:"982",ensp:"8194",emsp:"8195",thinsp:"8201",zwnj:"8204",zwj:"8205",lrm:"8206",rlm:"8207",ndash:"8211",mdash:"8212",lsquo:"8216",rsquo:"8217",sbquo:"8218",ldquo:"8220",rdquo:"8221",bdquo:"8222",dagger:"8224",dagger:"8225",bull:"8226",hellip:"8230",permil:"8240",prime:"8242",prime:"8243",lsaquo:"8249",rsaquo:"8250",oline:"8254",frasl:"8260",euro:"8364",image:"8465",weierp:"8472",real:"8476",trade:"8482",alefsym:"8501",larr:"8592",uarr:"8593",rarr:"8594",darr:"8595",harr:"8596",crarr:"8629",larr:"8656",uarr:"8657",rarr:"8658",darr:"8659",harr:"8660",forall:"8704",part:"8706",exist:"8707",empty:"8709",nabla:"8711",isin:"8712",notin:"8713",ni:"8715",prod:"8719",sum:"8721",minus:"8722",lowast:"8727",radic:"8730",prop:"8733",infin:"8734",ang:"8736",and:"8743",or:"8744",cap:"8745",cup:"8746","int":"8747",there4:"8756",sim:"8764",cong:"8773",asymp:"8776",ne:"8800",equiv:"8801",le:"8804",ge:"8805",sub:"8834",sup:"8835",nsub:"8836",sube:"8838",supe:"8839",oplus:"8853",otimes:"8855",perp:"8869",sdot:"8901",lceil:"8968",rceil:"8969",lfloor:"8970",rfloor:"8971",lang:"9001",rang:"9002",loz:"9674",spades:"9824",clubs:"9827",hearts:"9829",diams:"9830"}; +};apf.highlightXml=apf.highlightCode=function(strCode){var lines=strCode.split(/\n\r?/); +for(var min=1000,i=0,l=lines.length;i||<\?([\w\-]+)([\s\S]+?)\?>|<\!\[CDATA\[([\s\S]*?)\]\]>|<(\w+:)?script([\s\S]*?)>([\s\S]*?)<\/(?:\w+:)?script>|<([\/\w\:\-]+)([\s\S]*?)(\/?)>/g,function(m,doctype,comment,ptarget,pcontents,cdata,sprefix,sattr,scontent,tagName,attrs,bl){if(doctype){return'<!doctype'+doctype.replace(/"; +}else{if(comment){return'<!--'+comment.replace(/"; +}else{if(ptarget){return'<?'+ptarget+""+apf.highlightJs(pcontents,true)+'?>'; +}else{if(cdata){return'<![CDATA['+cdata+"]]>"; +}else{if(sprefix){return'<'+sprefix+"script"+(attrs?""+attrs.replace(/("[\s\S]*?")|([\w\-\:]+)/g,function(m,s,w){if(s){return s; +}return''+w+"";})+'>':">")+apf.highlightJs(scontent,true)+'</'+sprefix+"script>"; +}else{if(tagName){return'<'+(tagName.substr(0,2)=="a:"?""+tagName+"":tagName)+(attrs?""+attrs.replace(/("[\s\S]*?")|([\w\-\:]+)/g,function(m,s,w){if(s){return s; +}return''+w+"";})+''+bl+">":">"); +}}}}}}});return strCode;};apf.removeStartWhitespaces=function(strCode){var lines=strCode.split(/\n\r?/); +for(var min=1000,i=0,l=lines.length;i"+strCode+"",null,true); +var script=[],bool={"true":1,"false":1};var x=(function recur(nodes,depth,paout){var pre=new Array(depth+2).join(" "),output=[]; +for(var node,i=0,l=nodes.length;i'+f+""+fws; +}else{if(co||colong){return''+(co||colong)+""; +}else{if(str1||str2){return''+(str1||str2)+""; +}else{if(nw){return nw+''+kw+""+nw2;}}}}});}; +apf.highlightCode2=function(strCode){var comment=[],str=[];return strCode.replace(/(\/\*[\s\S]*?\*\/|\/\/.*)/g,function(a){comment.push(a); +return"###n"+(comment.length-1)+"###";}).replace(/\"([\s\S]*?)\"/g,function(a,b){str.push(b); +return"###s"+(str.length-1)+"###";}).replace(/\'([\s\S]*?)\'/g,function(a,b){str.push(b); +return"###q"+(str.length-1)+"###";}).replace(/(\<)|(\>)/g,function(n,a,b){return""+(a?"@lt@":"@gt@")+""; +}).replace(/(\W)-?([\d\.]+)(\W)/g,"$1$2$3").replace(/([\|\&\=\;\,\:\?\+\*\-]+)/g,"$1").replace(/(\W)(break|continue|do|for|import|new|this|void|case|default|else|function|in|return|typeof|while|comment|delete|export|if|label|switch|var|with|abstract|implements|protected|boolean|instanceOf|public|byte|int|short|char|interface|static|double|long|synchronized|false|native|throws|final|null|transient|float|package|true|goto|private|catch|enum|throw|class|extends|try|const|finally|debugger|super)(\W)/g,"$1$2$3").replace(/([\(\)\{\}\[\]])/g,"$1").replace(/###n(\d+)###/g,function(a,b){return""+comment[b].escapeHTML()+""; +}).replace(/###s(\d+)###/g,function(a,b){return'"'+str[b].escapeHTML()+'"'; +}).replace(/###q(\d+)###/g,function(a,b){return"'"+str[b].escapeHTML()+"'"; +}).replace(/stylecolor(.*?)\>/g,"style='color:$1'>").replace(/@(.*?)@/g,"&$1;"); +};apf.formatJS=function(strJs){var d=0,r=0;var comment=[],str=[];return strJs.replace(/(\/\*[\s\S]*?\*\/|\/\/.*)/g,function(a){comment.push(a); +return"###n"+(comment.length-1)+"###";}).replace(/\"([\s\S]*?)\"/g,function(a,b){str.push(b); +return"###s"+(str.length-1)+"###";}).replace(/\'([\s\S]*?)\'/g,function(a,b){str.push(b); +return"###q"+(str.length-1)+"###";}).replace(/;+/g,";").replace(/{;/g,"{").replace(/({)|(})|(\()|(\))|(;)/g,function(m,co,cc,ro,rc,e){if(co){d++; +}if(cc){d--;}if(ro){r++;return ro;}if(rc){r--;return rc;}var o="";for(var i=0;i0)?e:(";\n"+o); +}}).replace(/;\s*\n\s*\n/g,";\n").replace(/}var/g,"}\nvar").replace(/([\n\s]*)###n(\d+)###[\n\s]*/g,function(a,b,c){return b+comment[c]+b; +}).replace(/###s(\d+)###/g,function(a,b,c){return'"'+str[b]+'"';}).replace(/###q(\d+)###/g,function(a,b,c){return"'"+str[b]+"'"; +});};apf.diff_match_patch=new (function(){this.diffTimeout=1;this.diffEditCost=4; +this.diffDualThreshold=32;this.matchThreshold=0.5;this.matchDistance=1000;this.patchDeleteThreshold=0.5; +this.patchMargin=4;var DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0,getMaxBits=function(){var maxbits=0,oldi=1,newi=2; +while(oldi!=newi){maxbits++;oldi=newi;newi=newi<<1;}return maxbits;},patch_obj=function(){this.diffs=[]; +this.start1=null;this.start2=null;this.length1=0;this.length2=0;},opMap=[];opMap[DIFF_INSERT]="+"; +opMap[DIFF_DELETE]="-";opMap[DIFF_EQUAL]=" ";patch_obj.prototype.toString=function(){var coords1=(this.length1===0)?this.start1+",0":(this.length1==1)?this.start1+1:(this.start1+1)+","+this.length1,coords2=(this.length2===0)?this.start2+",0":(this.length2==1)?this.start2+1:(this.start2+1)+","+this.length2,text=["@@ -"+coords1+" +"+coords2+" @@\n"],x=0,l=this.diffs.length; +for(;xtext2.length?text1:text2,shorttext=text1.length>text2.length?text2:text1,i=longtext.indexOf(shorttext); +if(i!=-1){diffs=[[DIFF_INSERT,longtext.substring(0,i)],[DIFF_EQUAL,shorttext],[DIFF_INSERT,longtext.substring(i+shorttext.length)]]; +if(text1.length>text2.length){diffs[0][0]=diffs[2][0]=DIFF_DELETE;}return diffs; +}longtext=shorttext=null;var a,linearray,hm=this.diff_halfMatch(text1,text2);if(hm){return this.diff_main(hm[0],hm[2],checklines).concat([[DIFF_EQUAL,hm[4]]],this.diff_main(hm[1],hm[3],checklines)); +}if(checklines&&(text1.length<100||text2.length<100)){checklines=false;}if(checklines){a=this.diff_linesToChars(text1,text2); +text1=a[0];text2=a[1];linearray=a[2];}diffs=this.diff_map(text1,text2);if(!diffs){diffs=[[DIFF_DELETE,text1],[DIFF_INSERT,text2]]; +}if(checklines){this.diff_charsToLines(diffs,linearray);this.diff_cleanupSemantic(diffs); +diffs.push([DIFF_EQUAL,""]);var pointer=0,count_delete=0,count_insert=0,text_delete="",text_insert=""; +while(pointer=1&&count_insert>=1){a=this.diff_main(text_delete,text_insert,false); +diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert);pointer=pointer-count_delete-count_insert; +for(var j=a.length-1;j>=0;j--){diffs.splice(pointer,0,a[j]);}pointer=pointer+a.length; +}count_insert=0;count_delete=0;text_delete="";text_insert="";break;}pointer++;}diffs.pop(); +}return diffs;};this.diff_linesToChars=function(text1,text2){var lineArray=[""],lineHash={}; +function diff_linesToCharsMunge(text){var chars="",lineStart=0,lineEnd=-1,lineArrayLength=lineArray.length; +while(lineEnd0&&(new Date()).getTime()>ms_end){return null; +}v_map1[d]={};for(k=-d;k<=d;k+=2){if(k==-d||k!=d&&v1[k-1]=0;d--){while(1){if(v_map[d].hasOwnProperty?v_map[d].hasOwnProperty((x-1)+","+y):(v_map[d][(x-1)+","+y]!==undefined)){x--; +if(last_op===DIFF_DELETE){path[0][1]=text1.charAt(x)+path[0][1];}else{path.unshift([DIFF_DELETE,text1.charAt(x)]); +}last_op=DIFF_DELETE;break;}else{if(v_map[d].hasOwnProperty?v_map[d].hasOwnProperty(x+","+(y-1)):(v_map[d][x+","+(y-1)]!==undefined)){y--; +if(last_op===DIFF_INSERT){path[0][1]=text2.charAt(y)+path[0][1];}else{path.unshift([DIFF_INSERT,text2.charAt(y)]); +}last_op=DIFF_INSERT;break;}else{x--;y--;if(last_op===DIFF_EQUAL){path[0][1]=text1.charAt(x)+path[0][1]; +}else{path.unshift([DIFF_EQUAL,text1.charAt(x)]);}last_op=DIFF_EQUAL;}}}}return path; +};this.diff_path2=function(v_map,text1,text2){var path=[],pathLength=0,x=text1.length,y=text2.length,last_op=null,d=v_map.length-2; +for(;d>=0;d--){while(1){if(v_map[d].hasOwnProperty?v_map[d].hasOwnProperty((x-1)+","+y):(v_map[d][(x-1)+","+y]!==undefined)){x--; +if(last_op===DIFF_DELETE){path[pathLength-1][1]+=text1.charAt(text1.length-x-1); +}else{path[pathLength++]=[DIFF_DELETE,text1.charAt(text1.length-x-1)];}last_op=DIFF_DELETE; +break;}else{if(v_map[d].hasOwnProperty?v_map[d].hasOwnProperty(x+","+(y-1)):(v_map[d][x+","+(y-1)]!==undefined)){y--; +if(last_op===DIFF_INSERT){path[pathLength-1][1]+=text2.charAt(text2.length-y-1); +}else{path[pathLength++]=[DIFF_INSERT,text2.charAt(text2.length-y-1)];}last_op=DIFF_INSERT; +break;}else{x--;y--;if(last_op===DIFF_EQUAL){path[pathLength-1][1]+=text1.charAt(text1.length-x-1); +}else{path[pathLength++]=[DIFF_EQUAL,text1.charAt(text1.length-x-1)];}last_op=DIFF_EQUAL; +}}}}return path;};this.diff_commonPrefix=function(text1,text2){if(!text1||!text2||text1.charCodeAt(0)!==text2.charCodeAt(0)){return 0; +}var pointermin=0,pointermax=Math.min(text1.length,text2.length),pointermid=pointermax,pointerstart=0; +while(pointermintext2.length?text1:text2,shorttext=text1.length>text2.length?text2:text1,_self=this; +if(longtext.length<10||shorttext.length<1){return null;}function diff_halfMatchI(longtext,shorttext,i){var seed=longtext.substring(i,i+Math.floor(longtext.length/4)),j=-1,best_common="",best_longtext_a,best_longtext_b,best_shorttext_a,best_shorttext_b,prefixLength,suffixLength; +while((j=shorttext.indexOf(seed,j+1))!=-1){prefixLength=_self.diff_commonPrefix(longtext.substring(i),shorttext.substring(j)); +suffixLength=_self.diff_commonSuffix(longtext.substring(0,i),shorttext.substring(0,j)); +if(best_common.length=longtext.length/2){return[best_longtext_a,best_longtext_b,best_shorttext_a,best_shorttext_b,best_common]; +}else{return null;}}var hm1=diff_halfMatchI(longtext,shorttext,Math.ceil(longtext.length/4)),hm2=diff_halfMatchI(longtext,shorttext,Math.ceil(longtext.length/2)),hm; +if(!hm1&&!hm2){return null;}else{if(!hm2){hm=hm1;}else{if(!hm1){hm=hm2;}else{hm=hm1[4].length>hm2[4].length?hm1:hm2; +}}}var text1_a,text1_b,text2_a,text2_b;if(text1.length>text2.length){text1_a=hm[0]; +text1_b=hm[1];text2_a=hm[2];text2_b=hm[3];}else{text2_a=hm[0];text2_b=hm[1];text1_a=hm[2]; +text1_b=hm[3];}return[text1_a,text1_b,text2_a,text2_b,hm[4]];};this.diff_cleanupSemantic=function(diffs){var changes=false,equalities=[],equalitiesLength=0,lastequality=null,pointer=0,length_changes1=0,length_changes2=0; +while(pointer0?equalities[equalitiesLength-1]:-1;length_changes1=0; +length_changes2=0;lastequality=null;changes=true;}}pointer++;}if(changes){this.diff_cleanupMerge(diffs); +}this.diff_cleanupSemanticLossless(diffs);};this.diff_cleanupSemanticLossless=function(diffs){var punctuation=/[^a-zA-Z0-9]/,whitespace=/\s/,linebreak=/[\r\n]/,blanklineEnd=/\n\r?\n$/,blanklineStart=/^\r?\n\r?\n/; +function diff_cleanupSemanticScore(one,two){if(!one||!two){return 5;}var score=0; +if(one.charAt(one.length-1).match(punctuation)||two.charAt(0).match(punctuation)){score++; +if(one.charAt(one.length-1).match(whitespace)||two.charAt(0).match(whitespace)){score++; +if(one.charAt(one.length-1).match(linebreak)||two.charAt(0).match(linebreak)){score++; +if(one.match(blanklineEnd)||two.match(blanklineStart)){score++;}}}}return score; +}var pointer=1,equality1,edit,equality2,commonOffset,commonString,bestEquality1,bestEdit,bestEquality2,bestScore,score; +while(pointer=bestScore){bestScore=score;bestEquality1=equality1;bestEdit=edit;bestEquality2=equality2; +}}if(diffs[pointer-1][1]!=bestEquality1){if(bestEquality1){diffs[pointer-1][1]=bestEquality1; +}else{diffs.splice(pointer-1,1);pointer--;}diffs[pointer][1]=bestEdit;if(bestEquality2){diffs[pointer+1][1]=bestEquality2; +}else{diffs.splice(pointer+1,1);pointer--;}}}pointer++;}};this.diff_cleanupEfficiency=function(diffs){var changes=false,equalities=[],equalitiesLength=0,lastequality="",pointer=0,pre_ins=false,pre_del=false,post_ins=false,post_del=false; +while(pointer0?equalities[equalitiesLength-1]:-1;post_ins=post_del=false; +}changes=true;}}pointer++;}if(changes){this.diff_cleanupMerge(diffs);}};this.diff_cleanupMerge=function(diffs){diffs.push([DIFF_EQUAL,""]); +var pointer=0,count_delete=0,count_insert=0,text_delete="",text_insert="",commonlength; +while(pointer0&&diffs[pointer-count_delete-count_insert-1][0]==DIFF_EQUAL){diffs[pointer-count_delete-count_insert-1][1]+=text_insert.substring(0,commonlength); +}else{diffs.splice(0,0,[DIFF_EQUAL,text_insert.substring(0,commonlength)]);pointer++; +}text_insert=text_insert.substring(commonlength);text_delete=text_delete.substring(commonlength); +}commonlength=this.diff_commonSuffix(text_insert,text_delete);if(commonlength!==0){diffs[pointer][1]=text_insert.substring(text_insert.length-commonlength)+diffs[pointer][1]; +text_insert=text_insert.substring(0,text_insert.length-commonlength);text_delete=text_delete.substring(0,text_delete.length-commonlength); +}}if(count_delete===0){diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert,[DIFF_INSERT,text_insert]); +}else{if(count_insert===0){diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert,[DIFF_DELETE,text_delete]); +}else{diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert,[DIFF_DELETE,text_delete],[DIFF_INSERT,text_insert]); +}}pointer=pointer-count_delete-count_insert+(count_delete?1:0)+(count_insert?1:0)+1; +}else{if(pointer!==0&&diffs[pointer-1][0]==DIFF_EQUAL){diffs[pointer-1][1]+=diffs[pointer][1]; +diffs.splice(pointer,1);}else{pointer++;}}count_insert=0;count_delete=0;text_delete=""; +text_insert="";break;}}if(diffs[diffs.length-1][1]===""){diffs.pop();}var changes=false; +pointer=1;while(pointerloc){break;}last_chars1=chars1;last_chars2=chars2;}if(diffs.length!=x&&diffs[x][0]===DIFF_DELETE){return last_chars2; +}return last_chars2+(loc-last_chars1);};this.diff_prettyHtml=function(diffs){var html=[],i=0,x=0,l=diffs.length,op,data,text; +for(;x/g,">").replace(/\n/g,"¶
"); +switch(op){case DIFF_INSERT:html[x]=''+text+""; +break;case DIFF_DELETE:html[x]=''+text+""; +break;case DIFF_EQUAL:html[x]=''+text+"";break;}if(op!==DIFF_DELETE){i+=data.length; +}}return html.join("");};this.diff_text1=function(diffs){var text=[],x=0,l=diffs.length; +for(;xthis.matchMaxBits){throw new Error("Pattern too long for this browser."); +}var s=this.match_alphabet(pattern),_self=this;function match_bitapScore(e,x){var accuracy=e/pattern.length,proximity=Math.abs(loc-x); +if(!_self.matchDistance){return proximity?1:accuracy;}return accuracy+(proximity/_self.matchDistance); +}var score_threshold=this.matchThreshold,best_loc=text.indexOf(pattern,loc);if(best_loc!=-1){score_threshold=Math.min(match_bitapScore(0,best_loc),score_threshold); +}best_loc=text.lastIndexOf(pattern,loc+pattern.length);if(best_loc!=-1){score_threshold=Math.min(match_bitapScore(0,best_loc),score_threshold); +}best_loc=-1;var matchmask=1<<(pattern.length-1),bin_max=pattern.length+text.length,d=0,l=pattern.length,bin_min,bin_mid,last_rd,start,finish,rd,j,charMatch,score; +for(;d=start;j--){charMatch=s[text.charAt(j-1)]; +if(d===0){rd[j]=((rd[j+1]<<1)|1)&charMatch;}else{rd[j]=((rd[j+1]<<1)|1)&charMatch|(((last_rd[j+1]|last_rd[j])<<1)|1)|last_rd[j+1]; +}if(rd[j]&matchmask){score=match_bitapScore(d,j-1);if(score<=score_threshold){score_threshold=score; +best_loc=j-1;if(best_loc>loc){start=Math.max(1,2*loc-best_loc);}else{break;}}}}if(match_bitapScore(d+1,loc)>score_threshold){break; +}last_rd=rd;}return best_loc;};this.match_alphabet=function(pattern){var s={},i=0,l=pattern.length; +for(;i2){this.diff_cleanupSemantic(diffs); +this.diff_cleanupEfficiency(diffs);}}else{if(typeof a=="object"&&typeof opt_b=="undefined"&&typeof opt_c=="undefined"){diffs=a; +text1=this.diff_text1(diffs);}else{if(typeof a=="string"&&typeof opt_b=="object"&&typeof opt_c=="undefined"){text1=a; +diffs=opt_b;}else{if(typeof a=="string"&&typeof opt_b=="string"&&typeof opt_c=="object"){text1=a; +diffs=opt_c;}else{throw new Error("Unknown call format to patch_make.");}}}}if(diffs.length===0){return[]; +}var patches=[],patch=new patch_obj(),patchDiffLength=0,char_count1=0,char_count2=0,prepatch_text=text1,postpatch_text=text1,x=0,l=diffs.length,diff_type,diff_text; +for(;x=2*this.patchMargin){if(patchDiffLength){this.patch_addContext(patch,prepatch_text); +patches.push(patch);patch=new patch_obj();patchDiffLength=0;prepatch_text=postpatch_text; +char_count1=char_count2;}}}break;}if(diff_type!==DIFF_INSERT){char_count1+=diff_text.length; +}if(diff_type!==DIFF_DELETE){char_count2+=diff_text.length;}}if(patchDiffLength){this.patch_addContext(patch,prepatch_text); +patches.push(patch);}return patches;};var patch_deepCopy=function(patches){var patchesCopy=[],x=0,l=patches.length,patch,patchCopy,y; +for(;xthis.matchMaxBits){start_loc=this.match_main(text,text1.substring(0,this.matchMaxBits),expected_loc); +if(start_loc!=-1){end_loc=this.match_main(text,text1.substring(text1.length-this.matchMaxBits),expected_loc+text1.length-this.matchMaxBits); +if(end_loc==-1||start_loc>=end_loc){start_loc=-1;}}}else{start_loc=this.match_main(text,text1,expected_loc); +}if(start_loc==-1){results[x]=false;delta-=patch.length2-patch.length1;}else{results[x]=true; +delta=start_loc-expected_loc;if(end_loc==-1){text2=text.substring(start_loc,start_loc+text1.length); +}else{text2=text.substring(start_loc,end_loc+this.matchMaxBits);}if(text1==text2){text=text.substring(0,start_loc)+this.diff_text2(patch.diffs)+text.substring(start_loc+text1.length); +}else{diffs=this.diff_main(text1,text2,false);if(text1.length>this.matchMaxBits&&this.diff_levenshtein(diffs)/text1.length>this.patchDeleteThreshold){results[x]=false; +}else{this.diff_cleanupSemanticLossless(diffs);index1=0;for(y=0,l2=patch.diffs.length; +ydiffs[0][1].length){extraLength=paddingLength-diffs[0][1].length; +diffs[0][1]=nullPadding.substring(diffs[0][1].length)+diffs[0][1];patch.start1-=extraLength; +patch.start2-=extraLength;patch.length1+=extraLength;patch.length2+=extraLength; +}}patch=patches[patches.length-1];diffs=patch.diffs;if(diffs.length==0||diffs[diffs.length-1][0]!=DIFF_EQUAL){diffs.push([DIFF_EQUAL,nullPadding]); +patch.length1+=paddingLength;patch.length2+=paddingLength;}else{if(paddingLength>diffs[diffs.length-1][1].length){extraLength=paddingLength-diffs[diffs.length-1][1].length; +diffs[diffs.length-1][1]+=nullPadding.substring(0,extraLength);patch.length1+=extraLength; +patch.length2+=extraLength;}}return nullPadding;};this.patch_splitMax=function(patches){var x=0,bigpatch,patch_size,start1,start2,precontext,patch,empty,diff_type,diff_text,postcontext; +for(;x2*patch_size){patch.length1+=diff_text.length; +start1+=diff_text.length;empty=false;patch.diffs.push([diff_type,diff_text]);bigpatch.diffs.shift(); +}else{diff_text=diff_text.substring(0,patch_size-patch.length1-this.patchMargin); +patch.length1+=diff_text.length;start1+=diff_text.length;if(diff_type===DIFF_EQUAL){patch.length2+=diff_text.length; +start2+=diff_text.length;}else{empty=false;}patch.diffs.push([diff_type,diff_text]); +if(diff_text==bigpatch.diffs[0][1]){bigpatch.diffs.shift();}else{bigpatch.diffs[0][1]=bigpatch.diffs[0][1].substring(diff_text.length); +}}}}precontext=this.diff_text2(patch.diffs).substring(precontext.length-this.patchMargin); +postcontext=this.diff_text1(bigpatch.diffs).substring(0,this.patchMargin);if(postcontext!==""){patch.length1+=postcontext.length; +patch.length2+=postcontext.length;if(patch.diffs.length!==0&&patch.diffs[patch.diffs.length-1][0]===DIFF_EQUAL){patch.diffs[patch.diffs.length-1][1]+=postcontext; +}else{patch.diffs.push([DIFF_EQUAL,postcontext]);}}if(!empty){patches.splice(++x,0,patch); +}}}};this.patch_toText=function(patches){var text=[],x=0,l=patches.length;for(; +x").replace(/&/g,"&").replace(/ /g," "); };apf.isCharacter=function(charCode){return(charCode<112||charCode>122)&&(charCode==32||charCode>42||charCode==8); @@ -648,7 +1200,8 @@ apf.htmlentities=function(str){return str.escapeHTML();};apf.xmlentities=functio if(test>0){this.seed=test;}else{this.seed=test+this.M;}return(this.seed*this.oneOverM); }};apf.getNoCacheUrl=function(url){return url+(url.indexOf("?")==-1?"?":"&")+"nocache="+new Date().getTime(); };apf.parseExpression=function(str){if(!apf.parseExpression.regexp.test(str)){return str; -}return eval(RegExp.$1);};apf.parseExpression.regexp=/^\{([\s\S]*)\}$/;apf.formatNumber=function(num,prefix){var nr=parseFloat(num); +}try{return eval(RegExp.$1);}catch(e){throw new Error(apf.formatErrorString(0,null,"Parsing Expression","Invalid expression given '"+str+"'")); +}};apf.parseExpression.regexp=/^\{([\s\S]*)\}$/;apf.formatNumber=function(num,prefix){var nr=parseFloat(num); if(!nr){return num;}var str=new String(Math.round(nr*100)/100).replace(/(\.\d?\d?)$/,function(m1){return m1.pad(3,"0",apf.PAD_RIGHT); });if(str.indexOf(".")==-1){str+=".00";}return prefix+str;};apf.jsexec=function(str,win){if(!str){return str; }if(!win){win=self;}if(apf.isO3){eval(str,self);}else{if(apf.hasExecScript){win.execScript(str); @@ -676,8 +1229,12 @@ x[2]=x[0];x[3]=x[0];break;case 2:x[2]=x[0];x[3]=x[1];break;case 3:x[3]=x[1];brea }return x;};apf.getNode=function(data,tree){var nc=0;if(data!=null){for(var i=0; i1){tree.shift();data=this.getNode(data,tree);}return data;}nc++; -}}}return null;};apf.getFirstElement=function(xmlNode){return xmlNode.firstChild.nodeType==1?xmlNode.firstChild:xmlNode.firstChild.nextSibling; -};apf.getLastElement=function(xmlNode){return xmlNode.lastChild.nodeType==1?xmlNode.lastChild:xmlNode.lastChild.previousSibling; +}}}return null;};apf.getFirstElement=function(xmlNode){try{xmlNode.firstChild.nodeType==1?xmlNode.firstChild:xmlNode.firstChild.nextSibling; +}catch(e){throw new Error(apf.formatErrorString(1052,null,"Xml Selection","Could not find element:\n"+(xmlNode?xmlNode.xml:"null"))); +}return xmlNode.firstChild.nodeType==1?xmlNode.firstChild:xmlNode.firstChild.nextSibling; +};apf.getLastElement=function(xmlNode){try{xmlNode.lastChild.nodeType==1?xmlNode.lastChild:xmlNode.lastChild.nextSibling; +}catch(e){throw new Error(apf.formatErrorString(1053,null,"Xml Selection","Could not find last element:\n"+(xmlNode?xmlNode.xml:"null"))); +}return xmlNode.lastChild.nodeType==1?xmlNode.lastChild:xmlNode.lastChild.previousSibling; };apf.selectTextHtml=function(oHtml){if(!apf.hasMsRangeObject){return;}var r=document.selection.createRange(); try{r.moveToElementText(oHtml);}catch(e){}r.select();};apf.visibilitymanager=function(){var tree={}; var _self=this;var inited=false;this.check=function(amlNode,type,callback){if(amlNode.$ext.offsetHeight||amlNode.$ext.offsetWidth){return true; @@ -738,7 +1295,9 @@ undoObj.xmlNode=xmlNode;if(xpath){xmlNode=apf.createNodeFromXpath(xmlNode,xpath, }var oldValue=xmlNode.nodeValue;xmlNode.nodeValue=apf.isNot(nodeValue)?"":nodeValue; if(undoObj){undoObj.name=xmlNode.nodeName;}if(xmlNode.$triggerUpdate){xmlNode.$triggerUpdate(null,oldValue); }if(applyChanges){apf.xmldb.applyChanges(xmlNode.nodeType==2?"attribute":"text",xmlNode.parentNode||xmlNode.ownerElement||xmlNode.selectSingleNode(".."),undoObj); -}}};apf.setQueryValue=function(xmlNode,xpath,value,local){var node=apf.createNodeFromXpath(xmlNode,xpath); +}}if(applyChanges){var node;if(xpath){var node=undoObj.xmlNode;if(node.nodeType==9){node=node.documentElement; +xpath=xpath.replace(/^[^\/]*\//,"");}}else{node=xmlNode;}apf.xmldb.applyRDB(["setValueByXpath",node,nodeValue,xpath,options&&options.forceNew],undoObj||{xmlNode:xmlNode}); +}};apf.setQueryValue=function(xmlNode,xpath,value,local){var node=apf.createNodeFromXpath(xmlNode,xpath); if(!node){return null;}apf.setNodeValue(node,value,!local);return node;};apf.removeQueryNode=function(xmlNode,xpath,local){var node=apf.queryNode(xmlNode,xpath); if(!node){return false;}if(local){node.parentNode.removeChild(node);}else{apf.xmldb.removeNode(node); }return node;};apf.queryValue=function(xmlNode,xpath){if(!xmlNode){return"";}if(xmlNode.nodeType==2){return xmlNode.nodeValue; @@ -756,8 +1315,9 @@ if(xml.nodeType!=1){xml=xml.parentNode;}while(xml&&(xml.nodeType!=1||!(result=at }var len=paths.length-1;if(forceNew){if(paths[len].trim().match(/^\@(.*)$|^text\(\)$/)){len--; }}if(!paths[0]){contextNode=contextNode.ownerDocument.documentElement;paths.shift(); paths.shift();len--;len--;}for(var addedNode,isAdding=false,i=0;i":item[2].nodeValue)+" to <"+item[1].localName+"> ["+item[1].$uniqueId+"]"); +}if(!item[1].canHaveChildren){item[1].$aml=item[2].parentNode;if(item[1].$redraw){item[1].$redraw(); +}continue;}if(item[1].render!="runtime"){var xml=item[1].parentNode;while(xml&&xml.nodeType==1&&!xml.getAttribute("render")){xml=xml.parentNode; +}if(xml&&xml.render){if(xml.$amlList){xml.$amlList.push(item);}else{xml.$amlList=[item]; +xml.addEventListener("beforerender",function(e){var nodes=this.$amlList;this.$amlList=null; +for(var item,i=0,l=nodes.length;i":item[1].nodeValue)+" ["+item[1].$uniqueId+"] "); +}if((node=item[1]).destroy){node.destroy(true,true);}else{if(node.parentNode){node.parentNode.removeChild(node); +}else{node.ownerElement.removeAttributeNode(node);}}break;case SETATTRIBUTE:if(debug){apf.console.log("XmlDiff: ATTRIBUTE <"+item[1].localName+"> ["+item[1].$uniqueId+"] "+item[2].nodeName+'="'+item[2].nodeValue+'"'); +}item[1].setAttribute((item=item[2]).nodeName,item.nodeValue);break;}}for(var node,pnode,next,nr,tonr,i=0; +i=0;i--){if(d[i][0]==prop){return d[i][1]; }}},$handlePropSet:function(name,value){this[name.replace(/-(\w)/g,function(m,m1){return m1.toUpperCase(); })]=this[name]=value;(this.$propHandlers&&this.$propHandlers[name]||apf.GuiElement.propHandlers[name]||apf.K).call(this,value); },$inheritProperties:{},$propHandlers:{baseurl:function(value){this.baseurl=apf.parseExpression(value); -},language:function(value){},"resource-path":function(value){this.resourcePath=apf.parseExpression(value||"").replace(/resources\/?|\/$/g,""); -},skinset:function(value){if(this.$amlLoaded){apf.skins.changeSkinset(value);}},outline:function(value){this.dragOutline=this.resizeOutline=this.outline=apf.isTrue(value); +},language:function(value){apf.addEventListener("load",function(){apf.setModel(apf.config.language,apf.language); +});},"resource-path":function(value){this.resourcePath=apf.parseExpression(value||"").replace(/resources\/?|\/$/g,""); +},iepngfix:function(value,x){this.iePngFix=(!apf.supportPng24&&(apf.isTrue(value)||x.getAttribute("iepngfix-elements"))); +if(this.iePngFix){$setTimeout(function(){apf.iepngfix.limitTo(x.getAttribute("iepngfix-elements")||"").run(); +});}},skinset:function(value){if(this.$amlLoaded){apf.skins.changeSkinset(value); +}},outline:function(value){this.dragOutline=this.resizeOutline=this.outline=apf.isTrue(value); },"drag-outline":function(value){this.dragOutline=value?apf.isTrue(value):false; },"resize-outline":function(value){this.resizeOutline=value?!apf.isFalse(value):false; -},login:function(value,x){apf.auth.init(x);},debug:function(value){apf.debug=value; -}}});if(apf.history){apf.addEventListener("load",function(){apf.history.init(apf.config.defaultPage,"page"); -});}apf.offline={onLine:true};apf.saveData=apf.getData=function(instruction,options){if(!instruction){return false; -}var result,chr=instruction.charAt(0),callback=options.callback;var gCallback=function(data,state,extra){var callback=options.callback; +},login:function(value,x){apf.auth.init(x);},storage:function(value){if(value){apf.storage.init(value); +}},offline:function(value){if(value&&typeof apf.offline!="undefined"){apf.offline.init(value); +}},"disable-f5":function(value){if(apf.isDeskrun&&value){shell.norefresh=true;}},showgrid:function(value){this.$setGridSize(); +},gridsize:function(value){this.$setGridSize(value);},debug:function(value){if(value){apf.$debugwin.activate(); +apf.addEventListener("load",function(){apf.removeEventListener("load",arguments.callee); +});}apf.debug=value;}}});if(apf.history){apf.addEventListener("load",function(){apf.history.init(apf.config.defaultPage,"page"); +});}apf.offline={enabled:false,onLine:-1,resources:["application","models","transactions","queue","state"],autoInstall:false,storage:null,inited:false,rdbTimeout:600000,init:function(aml){apf.makeClass(this); +if(aml){this.$aml=aml;if(typeof aml=="string"){}else{if(aml.nodeType){if(aml.getAttribute("resources")){this.providers=aml.getAttribute("resources").split("|"); +}if(aml.getAttribute("rdb-timeout")){this.rdbTimeout=parseInt(aml.getAttribute("rdb-timeout")); +}var a,i,attr=aml.attributes;for(i=0;i=0;i--){if(!this[this.resources[i]]){this.resources.removeIndex(i);}else{this[this.resources[i]].init(this.$aml); +}}this.enabled=true;this.detector.init(this.$aml);this.offlineTime=parseInt(this.storage.get("offlinetime",this.namespace)); +if(this.offlineTime){this.goOffline();}else{this.goOnline();}apf.offline.dispatchEvent("load"); +},$destroy:function(){apf.console.info("Cleaning offline");if(this.provider&&this.provider.destroy){this.provider.destroy(); +}if(this.storage&&this.storage.destroy){this.storage.destroy();}for(var i=this.resources.length-1; +i>=0;i--){if(this[this.resources[i]]&&this[this.resources[i]].destroy){this[this.resources[i]].destroy(); +}}},IDLE:0,TO_OFFLINE:1,TO_ONLINE:2,STOPPING:3,inProcess:0,$supportedProperties:["syncing","position","length","progress","onLine"],handlePropSet:function(prop,value,force){this[prop]=value; +},goOffline:function(){if(!this.enabled||this.onLine===false||this.inProcess==this.TO_OFFLINE){return false; +}if(this.inProcess){this.inProcess=this.STOPPING;return false;}if(this.dispatchEvent("beforeoffline")===false){return false; +}this.setProperty("onLine",false);this.inProcess=this.TO_OFFLINE;if(!this.offlineTime){this.offlineTime=new Date().getTime(); +this.storage.put("offlinetime",this.offlineTime,this.namespace);}if(this.detector.enabled&&this.detector.detection!="manual"){this.detector.start(); +}if(!this.initial){this.initial={disableRDB:apf.xmldb.disableRDB};}apf.xmldb.disableRDB=true; +this.inProcess=this.IDLE;this.dispatchEvent("afteroffline");apf.console.info("The application is now working offline."); +return true;},goOnline:function(){if(!this.enabled||this.onLine===true||this.inProcess==this.TO_ONLINE){return false; +}if(this.dispatchEvent("beforeonline")===false){return false;}this.setProperty("onLine",true); +this.inProcess=this.TO_ONLINE;this.onlineTime=new Date().getTime();this.reloading=false; +apf.console.info("Trying to go online.");if(this.detector.enabled&&this.detector.detection=="error"){this.detector.stop(); +}this.$checkRsbTimeout();if(this.initial){apf.xmldb.disableRDB=this.initial.disableRDB; +}var callback=function(){this.startSync();this.dispatchEvent("afteronline");};var auth=apf.document.getElementsByTagNameNS(apf.ns.apf,"auth")[0]; +if(!auth){return;}if(auth.needsLogin&&auth.loggedIn){auth.authRequired({object:this,retry:callback}); +}else{callback.call(this);}return true;},$checkRsbTimeout:function(){if(!this.rdbTimeout){return; +}var i,j,k,rdbs=apf.nameserver.getAll("remote");for(i=0;ithis.rdbTimeout){if(!this.reloading){if(this.dispatchEvent("beforereload")===false){apf.console.warn("Warning, potential data corruption because you've cancelled reloading the data of all remote databinding synchronized models."); +break;}this.reloading=true;}rdb.discardBefore=this.onlineTime;for(j=0;k=0;i--){if(this[this.resources[i]].clear){this[this.resources[i]].clear(); +}}},startSync:function(){if(this.syncing){return;}this.setProperty("syncing",true); +apf.console.info("Start syncing offline changes.");var syncResources=[],syncLength=0,syncPos=0,syncRes=null,len,i; +for(i=this.resources.length-1;i>=0;i--){if(this[this.resources[i]].sync){len=this[this.resources[i]].getSyncLength(); +if(len){syncResources.push(this[this.resources[i]]);syncLength+=len;}}}var fln=apf.offline; +var callback=function(extra){if(fln.inProcess==fln.STOPPING){if(!extra.finished&&extra.length-1!=extra.position){syncRes.stopSync(function(){fln.$goOnlineDone(false); +});}else{fln.$goOnlineDone(false);}return;}if(extra.finished){if(syncResources.length){syncRes=syncResources.pop(); +syncRes.sync(callback);}else{fln.$goOnlineDone(true);}return;}if(!extra.start){syncPos++; +}fln.setProperty("progress",parseInt(syncPos/syncLength*100));fln.setProperty("position",syncPos); +fln.setProperty("length",syncLength);fln.dispatchEvent("sync",apf.extend(extra,{position:syncPos,length:syncLength})); +};if(syncLength){callback({start:true});callback({finished:true});}else{apf.console.info("Nothing to synchronize."); +this.$goOnlineDone(true);}var nodes=apf.all;for(i=0;i-1&&url.indexOf("http://"+location.host)==-1){return; +}this.urls.pushUnique(url.replace(/\#.*$/,""));},remove:function(url){this.urls.remove(url); +},refresh:function(callback){var storage=apf.offline.storage;if(this.versionGet){var oldVersion=storage.get("oldVersion",this.namespace); +var newVersion=null;var _self=this;apf.getData(this.versionGet,{callback:function(newVersion,state,extra){if(state==apf.TIMEOUT){return extra.tpModule.retryTimeout(extra,state,apf.offline); +}if(state==apf.OFFLINE){return;}if(state==apf.ERROR){storage.remove("oldVersion",_self.namespace); +}if(apf.debug||!newVersion||!oldVersion||oldVersion!=newVersion){apf.console.info("Refreshing offline file list"); +if(apf.offline.state.enabled){apf.offline.state.clear();if(apf.offline.state.realtime){apf.offline.state.search(); +}}_self.search();_self.provider.store(_self.urls,callback,newVersion);}else{apf.console.info("No need to refresh offline file list"); +callback({finished:true});}}});}else{apf.console.info("Refreshing offline file list"); +this.search();this.provider.store(this.urls,callback);}},search:function(){this.cache(window.location.href); +var i,nodes=document.getElementsByTagName("script");for(i=0;i=listOfURLs.length){_self.cancelID=null;_self.refreshing=false; +if(newVersion){apf.storage.put("oldVersion",newVersion,null,apf.offline.application.storeName); +}if(callback){callback({finished:true});}}});},abort:function(){if(!this.refreshing){return; +}this.lastStore.abortCapture(this.cancelID);this.refreshing=false;}};apf.offline.detector={detectUrl:apf.basePath+"core/lib/offline/network_check.txt",detection:"auto",interval:5000,init:function(aml){if(aml.nodeType){if(aml.getAttribute("detect-url")){this.detectUrl=aml.getAttribute("detect-url"); +}else{this.detectUrl=(apf.config.resourcePath||apf.basePath)+"resources/network_check.txt"; +}this.detection=apf.isTrue(aml.getAttribute("detection"))?"auto":aml.getAttribute("detection")||"auto"; +if(aml.getAttribute("interval")){this.interval=parseInt(aml.getAttribute("interval")); +}}if("error|auto".indexOf(this.detection)>-1){apf.addEventListener("error",function(e){if(e.state==apf.TIMEOUT){return !apf.offline.goOffline(); +}});}this.oHttp=new apf.http();this.oHttp.timeout=this.interval;this.isSiteAvailable(); +if(this.detection=="auto"){this.start();}},isSiteAvailable:function(callback){this.oHttp.get(apf.getNoCacheUrl(this.detectUrl),{callback:function(data,state,extra){if(state!=apf.SUCCESS||!window.navigator.onLine){apf.offline.goOffline(callback); +}else{apf.offline.goOnline(callback);}},ignoreOffline:true,hideLogMessage:true}); +},start:function(){clearInterval(this.timer);apf.console.info("Automatic detection of network state is activated"); +var _self=this;this.timer=setInterval(function(){_self.isSiteAvailable();},this.interval); +},stop:function(){clearInterval(this.timer);apf.console.info("Detection of network state is deactivated"); +}};apf.offline.models={enabled:false,timer:null,models:{},initQueue:[],realtime:true,init:function(aml){this.namespace=apf.config.name+".apf.offline.models"; +if(aml.nodeType&&aml.getAttribute("realtime")){this.realtime=!apf.isFalse(aml.getAttribute("realtime")); +}if(!this.realtime){apf.addEventListener("exit",function(){apf.offline.models.search(); +});}this.enabled=true;},markForUpdate:function(model){this.models[model.$uniqueId]=model; +if(!this.timer){var _self=this;this.timer=$setTimeout(function(){_self.timer=null; +var models=_self.models;for(var mId in models){_self.updateModel(models[mId]);}_self.models={}; +},2000);}},clear:function(){apf.offline.storage.clear(this.namespace);},removeModel:function(model){var name=model.name||model.$uniqueId+".model"; +apf.offline.storage.remove(name,this.namespace);this.initQueue.remove(model);},updateModel:function(model){var name=model.name||model.$uniqueId+".model"; +apf.console.info("Updating model '"+name+"'");var docId=model.data.getAttribute(apf.xmldb.xmlDocTag); +model.data.setAttribute(apf.xmldb.xmlDocTag+"_length",apf.xmldb.nodeCount[docId]); +apf.offline.storage.put(name,model.data.xml||model.data.serialize(),this.namespace); +},loadModel:function(model){var name=model.name||model.$uniqueId+".model";var data=apf.offline.storage.get(name,this.namespace); +if(!data){return false;}apf.console.info("Loading model '"+name+"' from local storage"); +var xmlNode=apf.getXmlDom(data).documentElement;var docId=xmlNode.getAttribute(apf.xmldb.xmlDocTag); +apf.xmldb.nodeCount[docId]=parseInt(xmlNode.getAttribute(apf.xmldb.xmlDocTag+"_length")); +model.load(xmlNode);return true;},search:function(){var done={},models=apf.nameserver.getAll("model"); +for(var i=0;i=start;j--){qItem=apf.unserialize(lookup[j]);qItem.undoObj=new apf.UndoData(qItem.undoObj,at).$import(); +stack.unshift(qItem);}}else{for(j=len-1;j>=start;j--){qItem=apf.unserialize(lookup[j]); +stack.unshift(new apf.UndoData(qItem,at).$import());}}at.$loadQueue(stack,type); +apf.offline.sLookup=null;}},clearActions:function(at,type){apf.offline.storage.clear(this.namespace+"."+at.name+"."+type); +},clear:function(queues){if(!queues){queues="undo|redo|queue";}var storage=apf.offline.storage; +var namespaces=storage.getNamespaces();var re=new RegExp(this.namespace+"\\.([^\\.]*)\\.("+queues+")"); +for(var i=0;i=len-1){return false;}if(last){qNr=len; +}callback({position:++qNr,length:len});if(qNr>=len-1){callback({finished:true}); +}});}}}};apf.offline.canTransact=function(){if(!apf.offline.enabled||this.onLine||this.transactions.enabled){return true; +}if(this.dispatchEvent("transactioncancel",{message:"Could not execute transaction whilst being offline, silently doing nothing",bubbles:true})===true){return true; +}return false;};apf.saveData=apf.getData=function(instruction,options){if(!instruction){return false; +}var result,chr=instruction.charAt(0),callback=options.callback;var gCallback=function(data,state,extra){var _self=this; +$setTimeout(function(){s2.call(_self,data,state,extra);});};var s2=function(data,state,extra){var callback=options.callback; if(state!=apf.SUCCESS){return callback(data,state,extra||{});}return callback(data,state,extra||{}); };if(!options){options={};}var fParsed=options.fParsed||(instruction.indexOf("{")>-1||instruction.indexOf("[")>-1?apf.lm.compile(instruction,{withopt:true,precall:options.precall,alwayscb:true,simplexpath:true}):{str:instruction,type:2}); if(options.precall&&!options._pc){options.asyncs=fParsed.asyncs;options._pc=1;}if(fParsed.type==3){if(fParsed.xpaths[0]){var model=fParsed.xpaths[0],xpath=fParsed.xpaths[1]; @@ -1032,7 +1823,9 @@ if(model=="#"||xpath=="#"){var m=(apf.lm.compile(instruction,{xpathmode:5}))(); if(typeof m!="string"){model=m.model&&m.model.$isModel&&m.model;if(model){xpath=m.xpath; }else{if(m.model){model=apf.xmldb.findModel(m.model);xpath=apf.xmlToXpath(m.model,model.data)+(m.xpath?"/"+m.xpath:""); }else{return;}}}else{model=null;}}else{model=apf.nameserver.get("model",model); -}return gCallback(model.data.selectSingleNode(xpath),apf.SUCCESS,{});}else{return gCallback(options.xmlNode.data.selectSingleNode(fParsed.xpaths[1]),apf.SUCCESS,{}); +}if(!model){throw new Error("Could not find model '"+model+"' in "+instruction); +}return gCallback(model.data.selectSingleNode(xpath),apf.SUCCESS,{});}else{if(!options.xmlNode){return apf.console.error(apf.formatErrorString(0,null,"Loading data","Xpath found without model and no xmlNode specified"+instruction)); +}return gCallback(options.xmlNode.data.selectSingleNode(fParsed.xpaths[1]),apf.SUCCESS,{}); }}if(chr=="<"){if(fParsed.type==2){result=fParsed.str;}else{return fParsed(options.xmlNode,gCallback,options); }}else{if((chr=="["||chr=="{")){return fParsed(options.xmlNode,gCallback,options); }else{if(fParsed.type==1||fParsed.type==3){var callback2=callback;callback=options.callback=function(data,state,extra){if(options._pc===true){return; @@ -1046,8 +1839,11 @@ url=url.join(" ");}else{url=instruction;}apf.oHttp.exec(method,[url.replace(/\\/ }}};apf.setModel=function(instruction,amlNode){if(!instruction){return;}var fParsed=instruction.indexOf("{")>-1||instruction.indexOf("[")>-1?apf.lm.compile(instruction,{alwayscb:true}):{type:2,str:instruction}; if(instruction=="@default"||fParsed.type==2){var model=apf.nameserver.get("model",instruction); if(model){return model.register(amlNode);}else{if(instruction=="@default"){return; -}}if(instruction.indexOf(".")==-1&&instruction.indexOf("/")==-1){return;}}if(fParsed.type==3){if(fParsed.models){if(fParsed.xpaths.length==2&&fParsed.xpaths[0]!="#"&&fParsed.xpaths[1]!="#"){apf.nameserver.get("model",fParsed.xpaths[0]).register(amlNode,fParsed.xpaths[1]); -return;}}}if(amlNode.clear){amlNode.clear("loading");}apf.getData(instruction,{parsed:fParsed,xmlNode:amlNode&&amlNode.xmlRoot,callback:function(data,state,extra){if(state!=apf.SUCCESS){throw new Error(apf.formatErrorString(0,null,"Loading new data","Could not load data into model. \nMessage: "+extra.message+" \nInstruction: '"+instruction+"'")); +}}if(instruction.indexOf(".")==-1&&instruction.indexOf("/")==-1){apf.console.warn("Could not find model '"+instruction+"'"); +return;}}if(fParsed.type==3){if(fParsed.models){if(fParsed.xpaths.length==2&&fParsed.xpaths[0]!="#"&&fParsed.xpaths[1]!="#"){if(!apf.nameserver.get("model",fParsed.xpaths[0])){throw new Error("Could not find model '"+fParsed.xpaths[0]+"' in "+instruction); +}apf.nameserver.get("model",fParsed.xpaths[0]).register(amlNode,fParsed.xpaths[1]); +return;}}else{apf.console.warn("Xpath found without model. This might fail if no context is specified using local(): "+instruction); +}}if(amlNode.clear){amlNode.clear("loading");}apf.getData(instruction,{parsed:fParsed,xmlNode:amlNode&&amlNode.xmlRoot,callback:function(data,state,extra){if(state!=apf.SUCCESS){throw new Error(apf.formatErrorString(0,null,"Loading new data","Could not load data into model. \nMessage: "+extra.message+" \nInstruction: '"+instruction+"'")); }if(!data){return amlNode.clear&&amlNode.clear();}if(typeof data=="string"){if(data.charAt(0)=="<"){data=apf.getXml(data); }else{if(data.indexOf("http://")==0){return apf.setModel(data,amlNode);}else{throw new Error("Invalid data from server"); }}}if(data.nodeFunc){data.register(amlNode);return;}var model=apf.xmldb.findModel(data); @@ -1139,7 +1935,552 @@ case"dd":return p(x.getDate());case"d":return x.getDate();case"MMMM":return $C.m case"MMM":return $C.abbreviatedMonthNames[x.getMonth()];case"MM":return p((x.getMonth()+1)); case"M":return x.getMonth()+1;case"t":return x.h()<12?$C.amDesignator.substring(0,1):$C.pmDesignator.substring(0,1); case"tt":return x.h()<12?$C.amDesignator:$C.pmDesignator;case"S":return ord(x.getDate()); -default:return m;}}):this._toString();};}());apf.htmlCleaner=(function(){var prepareRE=null,exportRE=null,noMarginTags={table:1,TABLE:1},selfClosing={br:1,img:1,input:1,hr:1}; +default:return m;}}):this._toString();};}());apf.draw={initDriver:function(){if(!this.initLayer){var k,o=apf.supportVML?apf.draw.vml:apf.draw.canvas; +for(k in o){this[k]=o[k];}}},basevars:function(){return["var _math_,v,t=0,n=(new Date()).getTime()*0.001",",e=Math.E, p=Math.PI, p2=2*p, p12=0.5*p",",x, y, z, _x,_y,_z, zt, i, j, k, _opt_;"].join(""); +},vars:function(ml,mt,mr,mb){return["var _math_,vx1 = v.vx1, vy1 = v.vy1,_rseed=1",",vx2 = v.vx2, vy2 = v.vy2, vw = vx2-vx1, vh = vy1-vy2",",vz2 = v.vz2, vz1 = v.vz1, vd = vz2-vz1",",zoom = 1/v.zoom",",a=v.a,b=v.b,c=v.c,d=v.d",",dw = l.dw",ml?"-"+(ml+mr):"",",dh = l.dh",mt?"-"+(mt+mb):"",",dw12 = dw*0.5, dh12 = dh*0.5",",dzw = dw/v.zoomx, dzh = -dh/v.zoomy",",dx = ",ml?ml:0,",dy = ",mt?mt:0,",mx = m&&m.x, my = m&&m.y",",db = dy+dh, dr = dx+dw",",tw = dw/vw, th = dh/vh, ty = -vy2*th+dy, tx = -vx1*tw+dx",",v,t=0,nt=0,n=(new Date()).getTime()*0.001, dt=-(l._n?l._n:n)+(l._n=n)",",e=Math.E, p=Math.PI, p2=2*p, p12=0.5*p",",x, y = 0, z = 0, _x,_y,_z, zt, i, j, k, _opt_, _anim = 0,","_storelut,_storelist,_translut,_speedlut,_overlaylut;"].join(""); +},defCamVec:function(){return"var inv=1/m00*(m11*m22-m12*m21)-m01*(m10*m22-m12*m20)+m02*(m10*m21-m11*m20);var mcx = inv*(m11*m22-m12*m21)*m03 + inv*(m02*m21-m01*m22)*m13 + inv*(m01*m12-m02*m11)*m23, mcy = inv*(m12*m20-m10*m22)*m03 + inv*(m00*m22-m02*m20)*m13 + inv*(m02*m10-m00*m12)*m23, mcz = inv*(m10*m21-m11*m20)*m03 + inv*(m01*m20-m00*m21)*m13 + inv*(m00*m11-m01*m10)*m23;"; +},setMatrix3D:function(m){var l=this.l;var s=["var m00=",m[0],",m01=",m[1],",m02=",m[2],",m03=",m[3],",m10=",m[4],",m11=",m[5],",m12=",m[6],",m13=",m[7],",m20=",m[8],",m21=",m[9],",m22=",m[10],",m23=",m[11],";"]; +if(l.p3d<0){this.ortho=1;s.push("var persp = dw / v.p3d/-v.tz, perspd = persp / ",l.ds,";"); +}else{this.ortho=0;s.push("var persp = dw / v.p3d, perspd = persp / ",l.ds,";"); +}return s.join("");},sincos3:function(pre,rx,ry,rz){return["var ",pre,"cx = __cos(",rx,"),",pre,"sx = __sin(",rx,"),",pre,"cy = __cos(",ry,"),",pre,"sy = __sin(",ry,"),",pre,"cz = __cos(",rz,"),",pre,"sz = __sin(",rz,");"].join(""); +},matrix4S:function(sx,sy,sz){return[sx,0,0,0,0,sy,0,0,0,0,sz,0,0,0,0,1];},matrix4T:function(tx,ty,tz){return[1,0,0,tx,0,1,0,ty,0,0,1,tz,0,0,0,1]; +},matrix4RP:function(pre){return this.matrix4R(pre+"cx",pre+"sx",pre+"cy",pre+"sy",pre+"cz",pre+"sz"); +},matrix4R:function(cx,sx,cy,sy,cz,sz){return[[cy,"*",cz].join(""),["(-",sz,"*",cy,")"].join(""),sy,0,["(",cz,"*",sx,"*",sy,"+",sz,"*",cx,")"].join(""),["(-",sx,"*",sy,"*",sz,"+",cx,"*",cz,")"].join(""),["(-",sx,"*",cy,")"].join(""),0,["(-",cx,"*",sy,"*",cz,"+",sx,"*",sz,")"].join(""),["(",cx,"*",sy,"*",sz,"+",cz,"*",sx,")"].join(""),["(",cx,"*",cy,")"].join(""),0,0,0,0,1]; +},matrixMul:function(){var m=arguments[arguments.length-1];for(var i=arguments.length-2; +i>=0;i--){m=this.matrixAB(m,arguments[i]);}return m;},matrixAB:function(a,b){var out=[],x,y,i,j,t,v; +for(y=0;y<16;y+=4){for(x=0;x<4;x++){v=[];if((i=a[y])&&(j=b[x])){v[v.length]=i==1?j:(j==1?i:(i+"*"+j)); +}if((i=a[y+1])&&(j=b[x+4])){v[v.length]=i==1?j:(j==1?i:(i+"*"+j));}if((i=a[y+2])&&(j=b[x+8])){v[v.length]=i==1?j:(j==1?i:(i+"*"+j)); +}if((i=a[y+3])&&(j=b[x+12])){v[v.length]=i==1?j:(j==1?i:(i+"*"+j));}out[out.length]=v.length?((v.length>1)?"("+v.join("+")+")":v[0]):0; +}}return out;},backface3D:function(pts,cm,zmode){var a=pts[0],b=pts[1],c=pts[2],x=0,y=1,z=2; +if(cm){x=cm[0],y=cm[1],z=cm[2];}return this.ortho?["-((m00*",b[x],"+m01*",b[y],"+m02*",b[z],"+m03)-(__ax=m00*",a[x],"+m01*",a[y],"+m02*",a[z],"+m03))*","((m10*",c[x],"+m11*",c[y],"+m12*",c[z],"+m13)-(__ay=m10*",a[x],"+m11*",a[y],"+m12*",a[z],"+m13))+","((m10*",b[x],"+m11*",b[y],"+m12*",b[z],"+m13)-__ay)*((m00*",c[x],"+m01*",c[y],"+m02*",c[z],"+m03)-__ax)"].join(""):["(((__by=m10*",b[x],"+m11*",b[y],"+m12*",b[z],"+m13) - (__ay=m10*",a[x],"+m11*",a[y],"+m12*",a[z],"+m13)) *","((__cz=m20*",c[x],"+m21*",c[y],"+m22*",c[z],"+m23) - (__az=m20*",a[x],"+m21*",a[y],"+m22*",a[z],"+m23)) -","((__bz=m20*",b[x],"+m21*",b[y],"+m22*",b[z],"+m23) - __az) * ((__cy=m10*",c[x],"+m11*",c[y],"+m12*",c[z],"+m13) - __ay) ) * ","(__ax=m00*",a[x],"+m01*",a[y],"+m02*",a[z],"+m03) + ","((__bz - __az) * ((__cx=m00*",c[x],"+m01*",c[y],"+m02*",c[z],"+m03) - __ax) -","((__bx=m00*",b[x],"+m01*",b[y],"+m02*",b[z],"+m03) - __ax) * (__cz - __az) ) * __ay + ","((__bx - __ax) * (__cy - __ay) - (__by - __ay) * (__cx - __ax) ) * __az "].join(""); +},text3D:function(p,cm,zc,text){var i=0,d,pt,q,s=["__n=0;"],x=0,y=1,z=2,sx,sy,vx,vy,vxi,vyi; +if(cm){x=cm[0],y=cm[1],z=cm[2];}return["if((__z = m20*",p[x],"+m21*",p[y],"+m22*",p[z],"+m23) < ",zc,"){",this.text(["dw12+(m00*",p[x],"+m01*",p[y],"+m02*",p[z],"+m03)*",this.ortho?"persp":"(persp/__z)"].join(""),["dh12+(m10*",p[x],"+m11*",p[y],"+m12*",p[z],"+m13)*",this.ortho?"persp":"(persp/__z)"].join(""),text),"}"].join(""); +},poly3DClip:function(idx,pt,cm,zc,open){var i=0,d,p,pt,q,s=["__n=0;"],x=0,y=1,z=2,sx,sy,vx,vy,vxi,vyi; +if(cm){x=cm[0],y=cm[1],z=cm[2];}for(var i=0;i=0){cc[d]++;}}for(i=0;i1){cc[i]=j++; +}else{cc[i]=0;}}for(var i=0;i=0){pt=pts[d]; +q=[this.ortho?"":"zt = persp / ((zt=(m20*"+pt[f0]+"+m21*"+pt[f1]+"+m22*"+pt[f2]+"+m23)<-0.01)?zt:-0.01);","dw12+(m00*"+pt[f0]+"+m01*"+pt[f1]+"+m02*"+pt[f2]+"+m03)*"+(this.ortho?"persp":"zt"),"dh12+(m10*"+pt[f0]+"+m11*"+pt[f1]+"+m12*"+pt[f2]+"+m13)*"+(this.ortho?"persp":"zt")]; +d=f?0:i;if(cc[d]){q[1]="__t"+cc[d]+(cf[d]?"":"="+q[1]),q[2]="__t"+cc[d]+(cf[d]++?"":"="+q[2]); +}}switch(d){case -1:f=1;s.push(this.close());break;case 0:f=0;s.push(q[0],this.moveTo(q[1],q[2])); +break;case indices.length-1:s.push(q[0],this.lineTo(q[1],q[2]),this.close());break; +default:s.push(q[0],this.lineTo(q[1],q[2]));break;}}return s.join("").replace(/m\d\d\*\(?0\)?\+/g,""); +},lineTo3D:function(x,y,z,sx,sy,fl){return this.$do3D("lineTo",x,y,z,sx,sy,fl); +},moveTo3D:function(x,y,z,sx,sy,fl){return this.$do3D("moveTo",x,y,z,sx,sy,fl); +},$store3D:function(x,y){return x+";"+y+";";},store3D:function(x,y,z,sx,sy,fl){return this.$do3D("$store3D",x,y,z,sx,sy,fl); +},$do3D:function(f,x,y,z,sx,sy,fl){var _x,_y,_z;if(typeof x=="string"&&x.match(/[\[\]\*\+\-\/]/)){x="(_x="+x+")",_x="_x"; +}else{x="("+x+")",_x=x;}if(typeof y=="string"&&y.match(/[\[\]\*\+\-\/]/)){y="(_y="+y+")",_y="_y"; +}else{y="("+y+")",_y=y;}if(typeof z=="string"&&z.match(/[\[\]\*\+\-\/]/)){z="(_z="+z+")",_z="_z"; +}else{z="("+z+")",_z=z;}if(fl){var v=[x,y,z],_v=[_x,_y,_z];x=v[_x=fl[0]],y=v[_y=fl[1]],z=v[_z=fl[2]]; +_x=_v[_x],_y=_v[_y],_z=_v[_z];}var r=[];if(!this.ortho){r.push("zt =persp/((zt=m20*"+x+"+m21*"+y+"+m22*"+z+"+m23)<-0.01?zt:-0.01);"); +}r.push(this[f]((sx===undefined?"":sx)+"dw12+(m00*"+_x+"+m01*"+_y+"+m02*"+_z+"+m03)*"+(this.ortho?"persp":"zt"),(sy===undefined?"":sy)+"dh12+(m10*"+_x+"+m11*"+_y+"+m12*"+_z+"+m13)*"+(this.ortho?"persp":"zt"))); +return r.join("").replace(/m\d\d\*\(?0\)?\+/g,"");},parseStyle:function(def,ovl,err){var style={},o,v,k,s,t,i,j,n,m; +var _self=this;if(!(t=_self.stateTransition)[262145]){s={};for(v in t){for(i=0; +i<32;i++){s[v|i]=t[v]|i;}}_self.stateTransition=s;}ovl=ovl?this.parseJSS(ovl.item?ovl.join(""):ovl,err):{}; +function stylecopy(dst,src,key){var t,k,v,o;for(k in src){if(dst[k]===undefined){dst[k]=_self.isDynamic(v=src[k])?_self.parseJSS(v):v; +}}if(t=src.inherit){stylecopy(dst,def[t]||_self["$"+t],t);}if(o=ovl[key]){for(k in o){dst[k]=o[k]; +}}}for(k in def){if(typeof(v=def[k])=="object"&&v!==null&&v["$"]==1){stylecopy(style[k]={},v,k); +}}function styleinherit(dst,b,c,s){var o,v,k;do{if(!c&&!s){o=style[b];}else{o=ovl[b+(c?"."+c:"")+(s?":"+s:"")]; +}if(typeof(o)=="object"){for(k in o){if(k.indexOf("$")==-1&&dst[k]===undefined){dst[k]=o[k]; +}}}if(s){s=_self.$stateInherit[v];}}while(s);}for(k in ovl){if(typeof(v=ovl[k])=="object"){t=k.match(/([\w\_-]+)\.?([\w\_-]+)?\:?([\w\_-]+)?/); +var base=t[1],cls=t[2],state=t[3];if(cls||state){o=style[k]={};if(state){if(cls){styleinherit(o,base,cls,state); +}styleinherit(o,base,0,state);}if(cls){styleinherit(o,base,cls,0);}styleinherit(o,base,0,0); +o.$cls=cls?cls:"",o.$state=state?state:"";o.$base=s=style[base];if(!s){alert("ERROR, baseless style found: "+base); +return;}(s.$stylelist?s.$stylelist:(s.$stylelist=[])).push(o);if(!cls){(s.$baselist?s.$baselist:(s.$baselist={}))[state]=1; +}else{(s.$clslist?s.$clslist:(s.$clsc=1,s.$clslist={}))[cls]=s.$clsc++;}}}}function initShape(s){if(s.stroke===null||s.stroke=="null"||s.stroke==0){delete s.stroke; +}if(s.fill===null||s.fill=="null"||s.fill==0){delete s.fill;}if(s.family===null||s.family=="null"||s.family==0){delete s.family; +}if((s.isshape&&s.fill===undefined&&s.stroke===undefined&&s.tile===undefined)||(s.isfont&&s.family===undefined)){return false; +}if(s.isshape){s.opacity=s.opacity!==undefined?s.opacity:1;s.fillopacity=s.fillopacity!==undefined?s.fillopacity:s.opacity; +s.gradopacity=s.gradopacity!==undefined?s.gradopacity:s.fillopacity;s.strokeopacity=s.strokeopacity!==undefined?s.strokeopacity:s.opacity; +s.angle=s.angle!==undefined?s.angle:0;s.weight=s.weight!==undefined?s.weight:1; +}return true;}for(k in style){if(typeof(s=style[k])=="object"){if(s.$baselist&&s.$clslist){delete s.$clsc; +for(i in s.$clslist){for(j in s.$baselist){if(!style[t=k+"."+i+":"+j]){if((m=style[k+":"+j])&&m.overlay){(m.$clsovl?m.$clsovl:m.$clsovl=[]).push(i); +}else{style[t]=o={};for(v in (t=style[k+"."+i])){o[v]=t[v];}for(v in (t=ovl[k+":"+j])){o[v]=t[v]; +}o.$cls=i,o.$state=j,o.$base=s;initShape(o);s.$stylelist.push(o);}}}}}if(s.$stylelist){s.$storelut={}; +s.$speedlut={};s.$overlaylut={};var cls,state,ovl,idx;j=s.$stylelist;for(i=0;i=0;m--){cls=s.$clslist?(s.$clslist[o.$clsovl[m]]||0):0; +s.$storelut[state|cls]=i;s.$speedlut[state|cls]=o.speed||1;if(ovl){s.$overlaylut[state|cls]=(ovl==268435456)?cls:ovl; +}}}}}if(!initShape(s)){delete style[k];}}}return style;},stateBit:{0:0,init:16777216,hidden:65536,deinit:33554432,hover:131072,hoverin:16908288,hoverout:33685504,select:196608,selectin:16973824,selectout:33751040,selecthover:262144,selecthoverin:17039360,selecthoverout:33816576,animating:50659328},stateTransition:{16777216:0,33554432:65536,16908288:131072,33685504:0,16973824:196608,33751040:0,17039360:262144,33816576:196608,17104896:17104896},stateMask:{selected:16777216|8388608|2097152|1048576|524288,normal:536870912|134217728|67108864|33554432|262144,dynamic:536870912|268435456|67108864|33554432|8388608|4194304|1048576|524288|262144,hover:134217728|67108864|2097152|1048576},$stateInherit:{hidden:0,init:0,deinit:0,hover:0,hoverin:"hover",hoverout:"hover",select:0,selectin:"select",selectout:"select",selecthover:"hover",selecthoverin:"selecthover",selecthoverout:"selecthover",animating:0},$stateFallback:{init:1,hover:1,hoverin:"hover",hoverout:1,select:1,selectin:"select",selectout:1,selecthover:"hover",selecthoverin:"selecthover",selecthoverout:"select",hidden:1},getXYWH:function(m,p,noflatten){var t; +if(!((t=this.$getXYWH_NT[p])||(p=this.$getXYWH_TN[t=p]))){return"0";}if(m==null){return"0"; +}if(typeof(m)=="object"){if(m.sort){return --p>=m.length?"0":((t=m[p])&&t.sort&&!noflatten?t.join(""):t); +}return(t=m[t])===undefined||p>1?"0":(t&&t.sort&&!noflatten?t.join(""):t);}return p==1?m:"0"; +},$getXYWH_NT:{1:"x",2:"y",3:"z",4:"w"},$getXYWH_TN:{x:1,y:2,z:3,w:4},getTRBL:function(m,p,noflatten){var t; +if(!((t=this.$getTRBL_NT[p])||(p=this.$getTRBL_TN[t=p]))){return"0";}if(m==null){return"0"; +}if(typeof(m)=="object"){if(m.sort){return --p>=m.length?"0":((t=m[p])&&t.sort&&!noflatten?t.join(""):t); +}return(t=m[t])===undefined||p>1?"0":(t&&t.sort&&!noflatten?t.join(""):t);}return p==1?m:"0"; +},$getTRBL_NT:{1:"t",2:"r",3:"b",4:"l"},$getTRBL_TN:{t:1,y1:1,r:2,x2:2,b:3,y2:3,l:4,x1:4},getFlat:function(m){if(typeof(m)=="object"&&m.sort){return m.join(""); +}return m;},getColor:function(a){if(a.match(/\(/)){return a;}if(a.match(/^#/)){return"'"+a+"'"; +}var b=a.toLowerCase();return(this.colors[b])?"'"+this.colors[b]+"'":a;},getX:function(s,pre,val,post,def){var v; +return(typeof(v=s[val+"-x"])=="undefined"&&(typeof(v=s[val])!="object"||typeof(v=v[0])=="undefined"))?(typeof(def)!="undefined"?def:""):(pre+v+post); +},getY:function(s,pre,val,post,def,ovl){var v;return(typeof(v=s[val+"-y"])=="undefined"&&(typeof(v=s[val])!="object"||typeof(v=v[1])=="undefined"))?(typeof(def)!="undefined"?def:""):(pre+v+post); +},checkX:function(s,val,ovl,no){var v;return(typeof(v=s[val+"-x"])=="undefined"&&(typeof(v=s[val])!="object"||typeof(v=v[0])=="undefined"))?(typeof(no)=="undefined"?"":no):ovl; +},checkY:function(s,val,ovl,no){var v;return(typeof(v=s[val+"-y"])=="undefined"&&(typeof(v=s[val])!="object"||typeof(v=v[1])=="undefined"))?(typeof(no)=="undefined"?"":no):ovl; +},isDynamic:function(a){return a&&typeof(a)=="string"&&!(a.indexOf(".")!=-1&&a.match(/^[\s:a-zA-Z0-9\/\\\._-]+$/))&&a.match(/[\(+*\/-]/)!=null; +},baseMacro:function(code){for(var j=code.length,i=0,v;i\=*+\%@&\/]\s*|\s*\-\s+)|([,\s]+)|(;)|$/g,function(m,str,exp,openobj,openval,openmac,hexobj,numobj,open,close,skip,sep,split,pos){if(skip||hexobj){return m; +}if(sm||str){if(str&&!sm){sm=str;}else{if(sm==str){sm=0;}}return m;}if(sep){ac.push(s.slice(lp,pos)); +arg.push(ac.join(""));lp=pos+sep.length,ac=[];return m;}if(openval){if(ln>=5){ln=6,prop=openval,lp=pos+m.length; +arg=[],ac=[];}return m;}if(numobj){ac.push(s.slice(lp,pos));t=m.match(/(\d\.?\d*)(.+)/); +ac.push(t[1],"*",t[2]);lp=pos+m.length;return m;}if(openmac){sn.push(ln=4);if(pos>lp){ac.push(s.slice(lp,pos)); +}if(ac.length&&ac[ac.length-1].match(/\)\s*$/)){ac.push("*");}if(t=openmac.match(/(\d\.?\d*)(.+)/)){ac.push(t[1]+"*"); +openmac=t[2];}sac.push(ac);sarg.push(arg);sfn.push(fn);fn=openmac;arg=[],ac=[],lp=pos+m.length; +return m;}if(openobj){if(ln<5){throw ({t:"JSS Error - object scope found inside macro",p:pos}); +}lp=pos+m.length;sn.push(ln=5);(openobj=openobj.replace(/^\s*/,"").replace(/\s*$/,"").split(" ")).length>1?(openobj=openobj[1]+"@"+openobj[0]):openobj=openobj[0]; +sobj.push(obj);obj=(typeof(t=obj[openobj])=="object")?t:(obj[openobj]={});return m; +}if(open){sn.push(ln=rn[open]);if(ln==1&&prop){sn.pop();lp=pos+m.length;sn.push(ln=5); +sobj.push(obj);obj=(typeof(t=obj[prop])=="object")?t:(obj[prop]={});}else{if(ln==3){if(pos>lp){ac.push(s.slice(lp,pos)); +}sac.push(ac);sarg.push(arg);arg=[],ac=[],lp=pos+open.length;}}return m;}if(close){if(!sn.length||mn[ln=sn.pop()]!=close){throw ({t:"JSS Error - closed "+ln+" with "+close,p:pos}); +log();}switch(ln){case 3:ac.push(s.slice(lp,pos));arg.push(ac.join(""));if(sarg.length!=1){(ac=sac.pop()).push("[",arg.join(","),"]"); +arg=sarg.pop();}else{sac.pop();t=sarg.pop();ac=[];for(i=0,len=arg.length;i1?arg:arg[0];}arg=[],prop=null,obj=sobj.pop(); +break;}if(!sarg.length){ln=6;}return m;}if(ln>=5){ac.push(s.slice(lp,pos));if((t=ac.join("")).length){arg.push(t); +}lp=pos+m.length,ac=[];if(prop){obj[prop]=arg.length>1?arg:arg[0];}else{if(t&&sn.length==0){obj=arg.length>1?arg:arg[0]; +}}arg=[],prop=null;}return m;});if(sm){throw ({t:"JSS Error - Unclosed string found "+sm,p:lp}); +}if(sn.length>0){throw ({t:"JSS Error - Unclosed object found "+sn[sn.length-1],p:lp}); +}}catch(e){apf.alert_r(e);if(err){err.v=e.p>=0?e.t+" at: "+e.p+" ->"+s.slice((t=e.p-4)<0?0:t,7)+"<-":e.t; +}return null;}return obj;},sin:function(a){return"__sin("+a+")";},cos:function(a){return"__cos("+a+")"; +},tan:function(a){return"__tan("+a+")";},asin:function(a){return"__asin("+a+")"; +},acos:function(a){return"__acos("+a+")";},atan:function(a){return"__atan("+a+")"; +},atan2:function(a){return"__atan2("+a+")";},floor:function(a){return"__floor("+a+")"; +},exp:function(a){return"__exp("+a+")";},log:function(a){return"__log("+a+")";},pow:function(a,b){return"__pow("+a+","+b+")"; +},random:function(a){return"__random("+a+")";},round:function(a){return"__round("+a+")"; +},sqrt:function(a){return"__sqrt("+a+")";},$pal:function(imode,n){var s=["'#'+('000000'+(__round(","((__a=parseInt((__t=["]; +for(var i=2,len=arguments.length;i2?",":""); +if(apf.draw.colors[t]){s.push("'",apf.draw.colors[t],"'");}else{if(t.match(/\(/)){s.push(t); +}else{if(t.match(/^#/)){s.push("'",t,"'");}else{s.push(t);}}}}if(imode&2){s.push("])[ (__g=__floor( __c=(__f=(",n,")",(imode&1)?"*"+(len-3):"",")<0?0:__f))>",len-3,"?",len-3,":__g].slice(1),16))&0xff)","*(__d=1-(__c-__floor(__c)))","+((__b=parseInt(__t[ (__g=__ceil(__c))>",len-3,"?",len-3,":__g","].slice(1),16))&0xff)*(__e=1-__d) )","+(__round(__d*(__a&0xff00)+__e*(__b&0xff00))&0xff00)","+(__round(__d*(__a&0xff0000)+__e*(__b&0xff0000))&0xff0000)",").toString(16)).slice(-6)"); +}else{s.push("])[ __floor( __c=(__f=(",n,")",imode?"*"+(len-3):"",")<0?-__f:__f)%",len-2,"].slice(1),16))&0xff)","*(__d=1-(__c-__floor(__c)))","+((__b=parseInt(__t[ __ceil(__c)%",len-2,"].slice(1),16))&0xff)*(__e=1-__d) )","+(__round(__d*(__a&0xff00)+__e*(__b&0xff00))&0xff00)","+(__round(__d*(__a&0xff0000)+__e*(__b&0xff0000))&0xff0000)",").toString(16)).slice(-6)"); +}return s.join("");},$lut:function(imode,n){var s=["(["],a,i=2,len=arguments.length; +for(;i2?",":"");if(typeof(a)=="string"&&a.match(/\(/)||a.match(/^['"]/)){s.push(a); +}else{s.push("'",a,"'");}}s.push("])[__floor((__b=((",n,")",imode?"*"+(len-3):"",")%",len-2,")<0?-__b:__b)]"); +return s.join("");},$lin:function(imode,n){var s=["((__t=["],a,i=2,len=arguments.length; +for(;i2?",":"");if(typeof(a)=="string"&&a.match(/\(/)||a.match(/^['"]/)){s.push(a); +}else{s.push("'",a,"'");}}s.push("])[__floor( __c=(__f=(",n,")",imode?"*"+(len-3):"",")<0?-__f:__f)%",len-2,"]","*(__d=1-(__c-__floor(__c)))","+__t[ __ceil(__c)%",len-2,"]*(__e=1-__d) )"); +return s.join("");},fixed:function(a,v,nz){v="parseFloat(("+a+").toFixed("+v+"))"; +return parseInt(nz)?this.nozero(a,v):v;},padded:function(a,v,nz){v="("+a+").toFixed("+v+")"; +return parseInt(nz)?this.nozero(a,v):v;},abs:function(a){if(parseFloat(a)==a){return Math.abs(a); +}if(typeof(a)=="number"||a.match(/$[a-z0-9_]+^/)){return"("+a+"<0?-"+a+":"+a+")"; +}return"((__t="+a+")<0?-__t:__t)";},min:function(a,b){if(b===null){return a;}if(parseFloat(a)==a&&parseFloat(b)==b){return Math.min(a,b); +}var a1=a,b1=b,a2=a,b2=b;if(typeof(a)=="string"&&!a.match(/$-?[a-z0-9\_]+^/)){a1="(__a="+a+")",a2="__a"; +}if(typeof(b)=="string"&&!b.match(/$-?[a-z0-9\_]+^/)){b1="(__b="+b+")",b2="__b"; +}return"(("+a1+")<("+b1+")?"+a2+":"+b2+")";},max:function(a,b){if(b===null){return a; +}if(parseFloat(a)==a&&parseFloat(b)==b){return Math.max(a,b);}var a1=a,b1=b,a2=a,b2=b; +if(typeof(a)=="string"&&!a.match(/$-?[a-z0-9\_]+^/)){a1="(__c="+a+")",a2="__c"; +}if(typeof(b)=="string"&&!b.match(/$-?[a-z0-9\_]+^/)){b1="(__d="+b+")",b2="__d"; +}return"(("+a1+")>("+b1+")?"+a2+":"+b2+")";},clamp:function(a,b,c){if(b===null||c==null){return a; +}return this.max(this.min(a,c),b);},pal:function(){var arg=Array.prototype.slice.call(arguments,0); +arg.unshift(1);return this.$pal.apply(this,arg);},pali:function(){var arg=Array.prototype.slice.call(arguments,0); +arg.unshift(0);return this.$pal.apply(this,arg);},palc:function(){var arg=Array.prototype.slice.call(arguments,0); +arg.unshift(3);return this.$pal.apply(this,arg);},palci:function(){var arg=Array.prototype.slice.call(arguments,0); +arg.unshift(2);return this.$pal.apply(this,arg);},lin:function(){var arg=Array.prototype.slice.call(arguments,0); +arg.unshift(1);return this.$lin.apply(this,arg);},lini:function(){var arg=Array.prototype.slice.call(arguments,0); +arg.unshift(0);return this.$lin.apply(this,arg);},lut:function(){var arg=Array.prototype.slice.call(arguments,0); +arg.unshift(1);return this.$lut.apply(this,arg);},luti:function(){var arg=Array.prototype.slice.call(arguments,0); +arg.unshift(0);return this.$lut.apply(this,arg);},$rgbpack:function(r,g,b){return a; +},rgb:function(r,g,b){if(parseFloat(r)==r&&parseFloat(g)==g&&parseFloat(b)==b){return this.$rgbpack(r,g,b); +}return["('#'+('000000'+(",(parseFloat(r)==r?((r<0?0:(r>255?255:parseInt(r)))<<16):"(((__t="+r+")<0?0:(__t>255?255:parseInt(__t)))<<16)"),"+",(parseFloat(g)==g?((g<0?0:(g>255?255:parseInt(g)))<<8):"(((__t="+g+")<0?0:(__t>255?255:parseInt(__t)))<<8)+"),"+",(parseFloat(b)==b?((b<0?0:(b>255?255:parseInt(b)))):"(((__t="+b+")<0?0:(__t>255?255:parseInt(__t))))"),").toString(16)).slice(-6))"].join(""); +},$hsvpack:function(h,s,v){var i,m=v*(1-s),n=v*(1-s*((i=Math.floor(((h<0?-h:h)%1)*6))?h-i:1-(h-i))); +switch(i){case 6:case 0:return this.$rgbpack(v,n,m);case 1:return this.$rgbpack(n,v,m); +case 2:return this.$rgbpack(m,v,n);case 3:return this.$rgbpack(m,n,v);case 4:return this.$rgbpack(n,m,v); +default:case 5:return this.$rgbpack.rgb(v,m,n);}},hsv:function(h,s,v){if(parseFloat(r)==r&&parseFloat(g)==g&&parseFloat(b)==b){return this.$hsvpack(r,g,b); +}return"apf.draw.$hsvpack("+h+","+s+","+v+");";},rgbf:function(r,g,b){return this.rgb(parseFloat(r)==r?r*255:"255*("+r+")",parseFloat(g)==g?g*255:"255*("+g+")",parseFloat(b)==b?b*255:"255*("+b+")"); +},nozero:function(a,v,z){return"(("+a+")>-0.0000000001 && ("+a+")<0.0000000001)?"+(z!==undefined?z:"''")+":("+(v!==undefined?v:a)+")"; +},$rndtab:null,rnd:function(a){if(a){if(!this.$rndtab){var i,t=this.$rndtab=Array(256); +for(i=-256;i<256;i++){t[i]=Math.random();}}return"_rndtab[__round(("+a+")*255)%255]"; +}return"((_rseed=(_rseed * 16807)%2147483647)/2147483647)";},ang:function(a){if(a==parseFloat(a)){return a*(Math.PI/180); +}return"(("+a+")*p/180)";},snap:function(a,b){return"(__round(("+a+")/(__t=("+b+")))*__t)"; +},rnds:function(a,b){return this.rnd(this.snap(a,b));},tsin:function(a){return"(0.5+0.5*__sin("+a+"))"; +},tcos:function(a){return"(0.5+0.5*__cos("+a+"))";},usin:function(a){return"(0.5-0.5*__sin("+a+"))"; +},ucos:function(a){return"(0.5-0.5*__cos("+a+"))";},two:function(a){return"(0.5+0.5*("+a+"))"; +},easein:function(t,pow){if(!pow){pow="3";}return["__pow(",t,",",pow,")"].join(""); +},easeout:function(t,pow){if(!pow){pow="3";}return["(1-__pow(1-(",t,"),",pow,"))"].join(""); +},ease:function(t,powin,powout){if(!powin){powin="3";}if(!powout){powout=powin; +}return["(0.5*((__a=2*(",t,"))<1?","__pow(__a,",powin,"):","(2-__pow(2-__a,",powout,"))))"].join(""); +},fontz:function(a,b){return(-a/b)+(this.ortho?"*perspd":"*(perspd/__z)");},$canJoin:function(a,b){if(a.isfont&&b.isfont){return a.join!=null&&b.join!=null&&a.family===b.family&&a.join===b.join&&a.height==b.height&&a.width==b.width&&a.align===b.align&&a.color===b.color&&a.size===b.size&&a.style===b.style; +}if(a.isshape&&b.isshape){return a.join!=null&&b.join!=null&&a.stroke===b.stroke&&a.join===b.join&&a.weight==b.weight&&a.fill===b.fill&&a.fillopacity===b.fillopacity&&a.strokeopacity===b.strokeopacity&&a.angle===b.angle; +}return false;},$shape:{isshape:true,stroke:null,fill:null,tilex:"(this.$tilex)",tiley:"(this.$tiley)"},$font:{isfont:true,height:12,family:"verdana",weight:"normal",color:"#00000",size:10},draw3D:function(x,y,z,w,h,d){return""; +},beginMouseState:function(style,sthis,func,nargs){var s=[],l=this.l;this.mousestyle=style; +this.mousethis=sthis;this.mousefunc=func;this.mousestates=[];var v=style.$statelist,i,j,t,u; +if(!v||!v.length){return"";}v=this.mousestates=v.slice(0);if(v[0]!=style){v.unshift(style); +}if(!l._mousestyles){l._mousestyles=[];}for(i=0,j=v.length;i","((_y2=(",rw,")%p2)<0?(_y2=p2-_y2):_y2) ){","if(_x1 >= _x2 || _x1<=_y2 )return x;","}else{","if(_x1 >= _x2 && _x1<=_y2 )return x;","}","}"].join(""); +}else{return[this.moveTo(x,y),this.ellipse("_x6","_y6",w,h,rs,rw,1),this.close()].join(""); +}}},shapedRect:function(x,y,w,h,m){var t=this.style;var gx=this.getX,gy=this.getY,cx=this.checkX,cy=this.checkY; +function rect(){if(gx(t,"","scale","","1")!="1"){x=[gx(t,"dzw*(","offset",")+"),"(",x,")","+",gx(t,"(","center",")","0.5"),"*(_x3=",w,")",gx(t,"*(1-(_x4=","scale","))"),gx(t,"+_x3*(","move",")")].join(""); +w="_x3*_x4";}else{x=[gx(t,"dzw*(","offset",")+"),"(",x,")",gx(t,"+(_x3="+w+")*(","move",")")].join(""); +w=cx(t,"move","_x3",w);}if(gy(t,"","scale","","1")!="1"){y=[gy(t,"dzh*(","offset",")+"),"(",y,")","+",gy(t,"(","center",")","0.5"),"*(_y3=",h,")",gy(t,"*(1-(_y4=","scale","))"),gy(t,"+_y3*(","move",")")].join(""); +h="_y3*_y4";}else{y=[gy(t,"dzh*(","offset",")+"),"(",y,")",gy(t,"+(_y3="+h+")*(","move",")")].join(""); +h=cy(t,"move","_y3",h);}}switch(t.shape){case"rect":default:if(!t.rotate){rect(); +if(m){return["if( (_x9 = mx - (",x,"))>=0 && _x9<(",w,")&&"," (_y9 = my - (",y,"))>=0 && _y9<(",h,")) return x;",].join(""); +}return this.rect(x,y,w,h);}else{return["_x9=(_x8=(_x6=",gx(t,"(","center",")","0.5"),"*(_x3=",w,"))*(",gx(t,"(1-(_x4=","scale","))","0"),"-1))+_x3",cx(t,"scale","*_x4"),";","_y9=(_y8=(_y6=",gy(t,"(","center",")","0.5"),"*(_y3=",h,"))*(",gy(t,"(1-(_y4=","scale","))","0"),"-1))+_y3",cy(t,"scale","*_y4"),";",this.moveTo("(_cr=__cos(_t="+t.rotate+"))*_x8-(_sr=__sin(_t))*_y8+(_x5="+gx(t,"(","offset",")+")+x+"+_x6)","_sr*_x8+_cr*_y8+(_y5="+gy(t,"(","offset",")+")+y+"+_y6)"),this.lineTo("_cr*_x9-_sr*_y8+_x5","_sr*_x9+_cr*_y8+_y5"),this.lineTo("_cr*_x9-_sr*_y9+_x5","_sr*_x9+_cr*_y9+_y5"),this.lineTo("_cr*_x8-_sr*_y9+_x5","_sr*_x8+_cr*_y9+_y5"),this.close()].join(""); +}case"circle":rect();if(m){return["if( (_x9 = mx - (",x,"))>=0 && _x9<(",w,")&&"," (_y9 = my - (",y,"))>=0 && _y9<(",h,")) return x;",].join(""); +}return t.pie?[this.moveTo("_x6="+x+"+(_x5=0.5*("+w+"))","_y6="+y+"+(_y5=0.5*("+h+"))"),this.ellipse("_x6","_y6","_x5","_y5",gx(t,"","range",""),gy(t,"","range","")),this.close()].join(""):[this.ellipse(x+"+(_x5=0.5*("+w+"))",y+"+(_y5=0.5*("+h+"))","_x5","_y5",gx(t,"","range",""),gy(t,"","range","")),this.close()].join(""); +break;case"polygon":if(t.frames){}else{return["_x3=((_x2=",gy(t,"","range","","2*p"),")-(_x1=",gx(t,"","range","","0"),"))/(",t.steps||10,");v=_x1;",this.moveTo("(_x4="+x+")+__sin(_x1)*(_x5="+w+")","(_y4="+y+")+__cos(_x1)*(_y5="+h+")"),"for(v=_x1+_x3;v<_x2;v+=_x3){",this.lineTo("_x4+__sin(_x1)*_x5","_y4+__cos(_x1)*_y5"),"}",this.close()].join(""); +}break;case"math":if(t.frames){}else{rect();return["_x7=((_x6=",gy(t,"","range","","2*p"),")-(_x5=",gx(t,"","range","","0"),"))/(",t.steps||10,");v=_x5;",this.moveTo("(_x8="+x+")+"+gx(t,"(","path",")","0")+"*(_x9="+w+")","(_y8="+y+")+"+gy(t,"(","path",")","0")+"*(_y9="+h+")"),"for(v=_x5+_x7;v<_x6;v+=_x7){",this.lineTo("_x8"+gx(t,"+(","path",")*_x9"),"_y8"+gy(t,"+(","path",")*_y9")),"}",this.close()].join(""); +}break;}return"";},$endDraw:function(){if(this.mousemode){return this.$endMouse(); +}if(this.statemode){return this.$endState();}var t=this.style;if(t){if(t.isshape){return this.$endShape(); +}if(t.isfont){return this.$endFont();}}return"";},serializeStyleState:function(style){var s=[],h,v,k,f; +if(!style.$stylelist){return"";}s.push("$storelist:_n=[",Array(style.$stylelist.length).join("[],"),"[]]"); +s.push(",$storelut:{");h=style.$storelut;f=1;for(k in h){s.push(--f?",":"","0x",parseInt(k).toString(16),":_n[",h[k],"]"); +}s.push("},$speedlut:{");h=style.$speedlut;f=1;for(k in h){s.push(--f?",":"","0x",parseInt(k).toString(16),":",h[k]); +}s.push("},$overlaylut:{");h=style.$overlaylut;f=1;for(k in h){s.push(--f?",":"","0x",parseInt(k).toString(16),":0x",parseInt(h[k]).toString(16)); +}s.push("}");return s.join("");},beginState:function(style,sthis,func,nargs,dyns){var s=[this.beginShape(style.$shadow||style)]; +this.statemode=1;this.statethis=sthis;this.stateargs=nargs;this.statefunc=func; +this.statedyns=dyns||[];this.statedyns.push("t","x");var v=style.$stylelist,i,n; +if(!v||!v.length){return s.join("");}s.push("_storelut = _s.$storelut, _storelist = _s.$storelist,_overlaylut = _s.$overlaylut,","_translut = apf.draw.stateTransition, _speedlut = _s.$speedlut ;\n"); +for(i=0,n=v.length;i1){","_t=",state,"=_translut[_t],",time,"=n,t=0;","}","if(_t&0x0f000000)_anim=1,nt=1-t;","}"]; +for(i=2,j=arguments.length;i0){","_sv=0,",d,";",this.beginShape(style),"for(_sv=0;_sv<_st;_sv+=",n,"){",d,",nt = 1-t;",this.statefunc.apply(this.statethis,a),"}",this.$endDraw(),"}else _styles[",style._id,"]._path=[];\n"].join(""); +}return s.join("");},beginFont:function(style,needed,ml,mt,mr,mb){if(!style||needed===undefined){return"document.title='beginFont Failed';"; +}var l=this.l,html=l._htmljoin,s=[this.$endDraw()];this.style=style;style._id=l._styles.push(style)-1; +ml=ml!==undefined?ml/l.ds:0;mt=mt!==undefined?mt/l.ds:0;mr=mr!==undefined?mr/l.ds:0; +mb=mb!==undefined?mb/l.ds:0;if(parseInt(style.left)!=style.left){this.mx="+("+style.left+")"+(ml?"-"+ml:""); +}else{this.mx="+"+(style.left-ml);}if(parseInt(style.top)!=style.top){this.my="+("+style.top+")"+(mt?"-"+mt:""); +}else{this.my="+"+(style.top-mt);}this.dynsize=(parseInt(style.size)!=style.size); +style._txtdiv=["
-
"].join(""); +html.push("
"); +s.push("_s=_styles[",style._id,"],_tn=_s._txtnodes,_tc = 0;\n");s.push("if((_l=(",needed,")) > _tn.length-_tc)apf.draw.$allocText(_s,_l);"); +return s.join("");},text:function(x,y,text){var t=((this.l.ds>1)?"/"+this.l.ds:""); +return["if( (_t=_tn[_tc++]).s!=(_v=",text,") )_t.v.nodeValue=_t.s=_v;","if(_t.x!=(_v=__round(",x,")))_t.n.style.left=_t.x=(_v",t,this.mx,")+'px';","if(_t.y!=(_v=__round(",y,")))_t.n.style.top=_t.y=(_v",t,this.my,")+'px';",this.dynsize?["if(_t.sz!=(_v=__round(",this.style.size,"))&&_v>0)_t.n.style.fontSize=_t.sz=_v+'px';"].join(""):""].join(""); +},$allocText:function(style,needed){var t,tn=style._domnode,ts=style._txtnodes; +if(!ts.length){tn.innerHTML=Array(needed+1).join(style._txtdiv);}else{tn.insertAdjacentHTML("beforeend",Array(needed+1).join(style._txtdiv)); +}while(needed-->0){t=tn.childNodes[ts.length];ts.push({x:-10000000000,y:-10000000000,n:t,v:t.firstChild,sz:-1,s:null}); +}},$endFont:function(){this.last=this.style._id;this.style=0;this.mx="",this.my=""; +return"_s._txtcount = _tc;";},$finalizeFont:function(style){var s=["if((_lc=(_s=_styles[",style._id,"])._txtused)>","(_tc=_s._txtcount)){_tn=_s._txtnodes;","for(;_lc>_tc;)_tn[--_lc].n.style.display='none';","_s._txtused=_tc;","} else if(_lc<_tc) {_tn=_s._txtnodes;","for(;_lc<_tc;)_tn[_lc++].n.style.display='block';","_s._txtused=_tc;","}\n"]; +return s.join("");},colors:apf.color.colors};apf.flow={isMoved:false,objCanvases:{},connectionsTemp:null,connectionsManager:null,sSize:7,fsSize:15,init:function(){document.body.onmousedown=function(e){e=(e||event); +var target=e.target||e.srcElement,isDragged=false;if(target.tagName=="HTML"){return; +}while(target!=document.body&&!apf.flow.findBlock(target.id)){target=target.parentNode||target.parentElement; +}var objBlock=apf.flow.isBlock(target);if(!objBlock){return;}if(!objBlock.draggable){return; +}var sx=e.clientX,sy=e.clientY,dx=0,dy=0,l=parseInt(target.style.left),t=parseInt(target.style.top),newTop,newLeft; +var snap=objBlock.canvas.snap,gridW=objBlock.canvas.gridW,gridH=objBlock.canvas.gridH; +if(e.preventDefault){e.preventDefault();}document.body.onmousemove=function(e){e=(e||event); +isDragged=true;dx=e.clientX-sx;dy=e.clientY-sy;newTop=t+dy;newLeft=l+dx;if(snap){target.style.left=Math.round(newLeft/gridW)*gridW+"px"; +target.style.top=Math.round(newTop/gridH)*gridH+"px";}else{target.style.left=newLeft+"px"; +target.style.top=newTop+"px";}objBlock.onMove();apf.flow.onblockmove();return false; +};document.body.onmouseup=function(e){document.body.onmousemove=null;if(apf.flow.onaftermove&&isDragged){apf.flow.onaftermove(dy,dx); +isDragged=false;}};};}};apf.flow.canvas=function(htmlElement){if(!htmlElement.getAttribute("id")){apf.setUniqueHtmlId(htmlElement); +}this.id=htmlElement.getAttribute("id");this.htmlElement=htmlElement;this.htmlBlocks={}; +this.htmlConnectors={};this.scrollPointer=null;this.lastTop=0;this.lastLeft=0;this.mode="normal"; +this.disableremove=false;this.snap=false;this.gridW=48;this.gridH=48;this.initCanvas=function(){apf.flow.objCanvases[this.htmlElement.getAttribute("id")]=this; +};this.removeConnector=function(id){var c=this.htmlConnectors[id];c.htmlElement.parentNode.removeChild(c.htmlElement); +this.htmlConnectors[id]=c=null;delete this.htmlConnectors[id];};this.deselectConnections=function(){for(var id in this.htmlConnectors){var con=this.htmlConnectors[id]; +if(con.selected){con.deselect("selected");con.deselectInputs("Selected");con.selected=false; +}}};this.setMode=function(mode){this.mode=mode;};this.getMode=function(){return this.mode; +};this.getWindowScrollLeft=function(){return document.documentElement.scrollLeft||document.body.scrollLeft; +};this.getWindowScrollTop=function(){return document.documentElement.scrollTop||document.body.scrollTop; +};this.scrollLeft=function(){this.htmlElement.scrollLeft=9999;};this.scrollTop=function(){this.htmlElement.scrollTop=9999; +};this.getScrollLeft=function(){return this.htmlElement.scrollLeft;};this.getScrollTop=function(){return this.htmlElement.scrollTop; +};this.addScrollPointer=function(){this.scrollPointer=this.htmlElement.appendChild(document.createElement("div")); +this.scrollPointer.className="scrollPointer";};this.moveLeftScrollPointer=function(left){var value=parseInt(left)+150; +this.scrollPointer.style.left=value+"px";this.lastLeft=parseInt(left);};this.moveTopScrollPointer=function(top){var value=parseInt(top)+150; +this.scrollPointer.style.top=value+"px";this.lastTop=parseInt(top);};this.getWidth=function(){return this.htmlElement.offsetWidth; +};this.getHeight=function(){return this.htmlElement.offsetHeight;};};apf.flow.block=function(htmlElement,objCanvas,other){this.canvas=objCanvas; +this.htmlElement=htmlElement;this.id=htmlElement.getAttribute("id");this.moveListeners=new Array(); +this.draggable=true;this.htmlOutputs={};this.image=null;this.other=other;var _self=this; +this.destroy=function(){this.htmlElement.onmouseover=this.htmlElement.onmouseout=this.htmlElement.onclick=null; +for(var i=this.moveListeners.length-1;i>=0;i--){this.moveListeners[i].destroy(); +this.moveListeners.removeIndex(i);}delete this.canvas.htmlBlocks[this.id];};this.initBlock=function(){this.canvas.htmlBlocks[this.id]=this; +var tag,dChilds,j,l2,bChilds=this.htmlElement.childNodes,i=0,l=bChilds.length;for(; +ithis.canvas.getHeight()-100){this.canvas.moveTopScrollPointer(top); +this.canvas.scrollTop();}if(this.canvas.lastLeftthis.canvas.getWidth()-100){this.canvas.moveLeftScrollPointer(left); +this.canvas.scrollLeft();}}};this.resize=function(width,height){var w=parseInt(this.htmlElement.style.width),h=parseInt(this.htmlElement.style.height); +if(w!==width||h!==height){this.htmlElement.style.width=this.imageContainer.style.width=width+"px"; +this.htmlElement.style.height=this.imageContainer.style.height=height+"px";this.image.style.height=height+"px"; +this.image.style.width=width+"px";this.image.style.filter="";}};this.changeRotation=function(rotation,fliph,flipv,init){var o=this.other,prev=[o.rotation,o.fliph,o.flipv]; +if(!o.type){return;}o.rotation=parseInt(rotation)%360||0;o.fliph=String(fliph)=="true"?true:false; +o.flipv=String(flipv)=="true"?true:false;var flip=(o.fliph&&!o.flipv?"horizontal":(!o.fliph&&o.flipv?"vertical":"none")); +this.repaintImage(flip,o.rotation,"rel");};this.repaintImage=function(flip,angle,whence){var p=this.image; +if(p.style.display=="none"){return;}p.style.display="block";p.angle=!whence?((p.angle==undefined?0:p.angle)+angle)%360:angle; +var canvas,rotation=Math.PI*(p.angle>=0?p.angle:360+p.angle)/180,costheta=Math.cos(rotation),sintheta=Math.sin(rotation); +if(document.all&&!window.opera){canvas=document.createElement("img");canvas.src=p.src; +canvas.style.height=p.height+"px";canvas.style.width=p.width+"px";canvas.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+costheta+",M12="+(-sintheta)+",M21="+sintheta+",M22="+costheta+",SizingMethod='auto expand')"; +if(flip!=="none"){canvas.style.filter+="progid:DXImageTransform.Microsoft.BasicImage("+(flip=="horizontal"?"mirror=1":"rotation=2, mirror=1")+")"; +}}else{canvas=document.createElement("canvas");if(!p.oImage){canvas.oImage=new Image(); +canvas.oImage.src=p.src;}else{canvas.oImage=p.oImage;}canvas.style.width=canvas.width=Math.abs(costheta*canvas.oImage.width)+Math.abs(sintheta*canvas.oImage.height); +canvas.style.height=canvas.height=Math.abs(costheta*canvas.oImage.height)+Math.abs(sintheta*canvas.oImage.width); +var context=canvas.getContext("2d");context.save();switch(flip){case"vertical":context.translate(0,canvas.oImage.height); +context.scale(1,-1);break;case"horizontal":context.translate(canvas.oImage.height,0); +context.scale(-1,1);break;}if(rotation<=Math.PI/2){context.translate(sintheta*canvas.oImage.height,0); +}else{if(rotation<=Math.PI){context.translate(canvas.width,-costheta*canvas.oImage.height); +}else{if(rotation<=1.5*Math.PI){context.translate(-costheta*canvas.oImage.width,canvas.height); +}else{context.translate(0,-sintheta*canvas.oImage.width);}}}context.rotate(rotation); +try{context.drawImage(canvas.oImage,0,0,canvas.oImage.width,canvas.oImage.height); +context.restore();}catch(e){}}canvas.angle=p.angle;this.imageContainer.replaceChild(canvas,p); +this.image=canvas;};this.onMove=function(){for(var i=0,ml=this.moveListeners,l=ml.length; +idt+dh*1.5){ior="top"; +}else{if(sl>dl+dw/2){ior="left";}else{if(sld[0]?(s[1]>d[1]?"TL":(s[1]d[1]?"TR":(s[1]d[1]?"TM":(s[1]=0;i--){htmlSegmentsTemp[i][0].style.display="none"; +}if(this.other.label){this.htmlLabel=apf.flow.label(this);}if(this.other.type){var _type=this.other.type.split("-"); +if(_type[0]!=="none"){this.htmlStart=apf.flow.connectorsEnds(this,"start",_type[0]); +}if(_type[1]!=="none"){this.htmlEnd=apf.flow.connectorsEnds(this,"end",_type[1]); +}}};this.createSegment=function(coor,lines,startSeg){var or=lines[1],l=lines[0],sX=coor[0]||0,sY=coor[1]||0,_temp=htmlSegmentsTemp.shift(),_self=this,segment=_temp?_temp[0]:null,plane=(or=="top"||or=="bottom")?"ver":"hor"; +if(!segment){segment=htmlElement.appendChild(document.createElement("div"));apf.setUniqueHtmlId(segment); +apf.setStyleClass(segment,"segment");if(_self.selected){_self.select("selected"); +}var canvas=this.objSource.canvas;segment.onmouseover=function(e){if(!apf.flow.isMoved&&((canvas.mode=="connection-change"&&_self.selected)||canvas.mode=="connection-add")){_self.select("hover"); +}};segment.onmouseout=function(e){_self.deselect("hover");};segment.onmousedown=function(e){e=e||event; +e.cancelBubble=true;_self.deselect("selected");_self.select("clicked");};segment.onmouseup=function(e){e=(e||event); +e.cancelBubble=true;var ctrlKey=e.ctrlKey,temp=_self.selected;if(!ctrlKey){_self.objSource.canvas.deselectConnections(); +}_self.selected=temp?false:_self.selected?false:true;if(_self.selected){_self.selectInputs("Selected"); +_self.deselect("clicked");_self.select("selected");canvas.setMode("connection-change"); +}else{_self.deselectInputs("Selected");_self.deselect("clicked");_self.deselect("selected"); +canvas.setMode("normal");}};}segment.plane=plane;var w=plane=="ver"?sSize:l,h=plane=="ver"?l:sSize,className="segment seg_"+plane; +if(_self.virtualSegment){className+=" seg_"+plane+"_virtual";}segment.className=className; +if(or=="top"){sY-=l;}if(or=="left"){sX-=l;}segment.style.display="block";segment.style.left=sX+(plane=="hor"&&!startSeg||(or=="left"&&startSeg)?3:0)+"px"; +segment.style.top=sY+(plane=="ver"?3:0)+"px";segment.style.width=w+(or=="left"&&startSeg?-3:(or=="right"&&startSeg?3:0))+"px"; +segment.style.height=h+"px";if(or=="bottom"){sY+=h;}if(or=="right"){sX+=w;}this.htmlSegments.push([segment,or]); +return[sX,sY];};this.deselect=function(type){var segments=this.htmlElement.childNodes,i=0,l=segments.length; +for(;i|]+)>/gi,/<(\/?)em>|]+)>/gi,/'/g,/(<(\/?)(span|strong|em|u|i|b|a|strike|sup|sub|font|img)(?:\s+[\s\S]*?)?>)|()|(<(\/?)([\w\-]+)(?:\s+[\s\S]*?)?>)|([^<>]*)/gi,/(]*href=)([^\s^>]+)*([^>]*>)/gi,/

<\/p>/gi,/]+)\/>|/gi]; }if(apf.isGecko){html=html.replace(prepareRE[0],"<$1b$2>").replace(prepareRE[1],"<$1i$2>"); }else{if(apf.isIE){html=html.replace(prepareRE[2],"'").replace(prepareRE[4],"$1$2 _apf_href=$2$3"); @@ -1171,7 +2512,26 @@ strP=[];capture=false;}}else{str.push("

 

");}}else{if(block){if(bclos strP=[];}else{str.push("

",(s||strP.join("").trim()||" ").replace(/
[\s\r\n]*$/,""),"

"); strP=[];}}bdepth.push(btag);}str.push(block);capture=false;}}}}});if(strP.length){str.push("

"+strP.join("").replace(/
[\s\r\n]*$/,"")+"

"); }html=str.join("");}else{html=html.replace(/]*_apf_marker="1"[^>]*>/gi,"
"); -}return html;}};})();apf.layout={compile:function(oHtml){var l=this.layouts[oHtml.getAttribute("id")]; +}try{apf.getXml(""+html.replace(/&.{3,5};/g,"")+"");}catch(ex){apf.console.error(ex.message+"\n"+html.escapeHTML()); +}return html;}};})();apf.language={automatch:false,loaded:false,prefix:"sub.main.",words:{},texts:{},elements:{},bindings:{},count:0,load:function(xmlNode,prefix){if(!xmlNode){return; +}if(typeof xmlNode=="string"){if(xmlNode.charAt(0)=="<"){xmlNode=apf.getXmlDom(xmlNode).documentElement; +}else{return this.loadFrom(xmlNode);}}this.parseSection(xmlNode,prefix);this.redraw(); +this.loaded=true;},loadFrom:function(instruction){apf.getData(instruction,{callback:function(xmlNode){if(!xmlNode){return; +}if(!xmlNode){throw new Error(apf.formatErrorString(0,null,"Loading language","Could not find language symbols using processing instruction: '"+instruction+"'")); +return;}apf.language.load(xmlNode);}});},parseSection:function(xmlNode,prefix){if(!prefix){prefix=xmlNode.getAttribute("id")||""; +}if(xmlNode.tagName=="key"){prefix+="/"+xmlNode.getAttribute("id");this.words[prefix]=xmlNode.firstChild?xmlNode.firstChild.nodeValue:""; +return;}if(xmlNode.tagName=="group"){prefix+=(prefix?"/":"")+xmlNode.getAttribute("id"); +}var nodes=xmlNode.childNodes;for(var i=0;i*{display:none}":"body #print_content, body #print_content *{display:block} body *{display:none}",document,"print"); +if(aml){var a,i,attr=aml.attributes;for(i=0;i0){var fn=timeouts.shift();fn();}}}apf.addListener(window,"message",handleMessage,true); @@ -1265,7 +2643,118 @@ width=Math.max(dw,width);height=Math.max(dh,height);}if(snap){left=Math.floor(le top=Math.floor(top/gridH)*gridH;width=Math.ceil(width/gridW)*gridW;height=Math.ceil(height/gridH)*gridH; }if(objResize.onresize){objResize.onresize(block,top,left,width,height);}objResize.show(); resized=true;};document.onmouseup=function(e){document.onmousemove=null;if(objResize.onresizedone&&resized){objResize.onresizedone(width,height,top,left); -objBlock.other.ratio=width/height;resized=false;}};};};apf.skins={skins:{},css:[],events:["onmousemove","onmousedown","onmouseup","onmouseout","onclick","ondragcopy","ondragstart","ondblclick"],Init:function(xmlNode,refNode,path){var name=(refNode?refNode.getAttribute("id"):null)||xmlNode.getAttribute("id"); +objBlock.other.ratio=width/height;resized=false;}};};};apf.selection=function(oWin,oDoc,editor){oWin=oWin||window; +oDoc=oDoc||window.document;this.current=null;var FUNC="function",UNDEF="undefined",CHAR="character",TEXT="Text",CTRL="Control",NONE="None",csLock,vfocus=(editor&&typeof editor.$visualFocus==FUNC),_self=this; +this.get=function(){return apf.w3cRange?oWin.getSelection():oDoc.selection;};this.set=function(){if(!this.current){return null; +}if(apf.w3cRange){this.moveToBookmark(this.current);return this.current;}try{if(vfocus){editor.$visualFocus(); +}else{oWin.focus();}this.current.select();}catch(ex){}if(vfocus){editor.$visualFocus(); +}else{oWin.focus();}return this.current;};this.cache=function(w3cToo){if(apf.w3cRange){if(w3cToo){this.current=this.getBookmark(); +}return this;}var oSel=oDoc.selection;this.current=oSel.createRange();this.current.type=oSel.type; +if(this.current.type==TEXT&&this.current.text==""&&!csLock){csLock=$setTimeout(this.cache,0); +}else{clearTimeout(csLock);csLock=null;}return this;};this.getRange=function(){var oSel=this.get(),range; +try{if(oSel){range=oSel.rangeCount>0?oSel.getRangeAt(0):(oSel.createRange?oSel.createRange():oDoc.createRange()); +}}catch(ex){}if(!range){range=apf.w3cRange?oDoc.createRange():oDoc.body.createTextRange(); +}return range;};this.setRange=function(range){if(apf.w3cRange){var oSel=this.get(); +if(oSel){oSel.removeAllRanges();oSel.addRange(range);}}else{try{range.select(); +}catch(ex){}}return this;};var activeEl,_inline="BR|IMG|HR|INPUT",_block="P|BUTTON|TEXTAREA|SELECT|DIV|H[1-6]|ADDRESS|PRE|OL|UL|LI|TABLE|TBODY|TR|DT|DE|TD|SUB|SUP",_form="SELECT|BUTTON|TEXTAREA",reBlock=new RegExp("^(?:"+_block+")$","i"),reForm=new RegExp("^(?:"+_form+")$","i"),reInline=new RegExp("^(?:"+_inline+")$","i"); +this.inline=_inline;this.block=_block;this.form=_form;function trimNl(str){return(apf.isOpera||apf.isIE)?str:str.replace(/\r\n/g," "); +}function getText(node){return String(apf.isIE?node.nodeType==3?node.nodeValue:node.innerText:node.textContent); +}function getHtml(node){return String(node.nodeType==3?apf.isIE?node.nodeValue:node.textContent:node.innerHTML); +}function textContent(node,o){var cn,sp=0,str="",i=0,l=node.childNodes.length;for(; +i"+(apf.isIE?"":trimNl(getText(cn)).replace(/./gi," "))+""; +}else{if(reBlock.test(cn.nodeName)){str+="<+>"+(apf.isIE?"":trimNl(getText(cn)).replace(/./gi," "))+""; +}else{if(reInline.test(cn.nodeName)){str+="<>";}else{if(cn.nodeName=="SPAN"&&(sp=_4.attr(cn,"scaytid"))){str+="<"+sp+">"+trimNl(getHtml(cn))+""; +}else{str+=trimNl(getHtml(cn));}}}}}return str;}function getParent(node,eltype,attr,root){var k; +root=root||this.containerNode;eltype=eltype?new RegExp("^(?:"+eltype+")$"):null; +while(node&&node!=root){if(eltype&&eltype.test(node.nodeName.toUpperCase())){return node; +}if(attr){for(k in attr){if(node.getAttribute(k)!==null&&attr[k]===null){return node; +}if((attr[k]!==null&&node.getAttribute(k)!==null&&!(node.getAttribute(k)===false))?!attr[k]:attr[k]){return node; +}}}node=node.parentNode;}return false;}this.getBookmark=function(type,callback){var ch=-16777215,range=this.getRange(),vp=apf.getViewPort(oWin),c=oDoc.body,o={scrollX:vp.x,scrollY:vp.y,collapse:0,start:0},sel=this.get(); +activeEl=null;if(type=="simple"){o.rng=range;return o;}if(!apf.w3cRange){if(range.item){var e=range.item(0),n=c.getElementsByTagName(e.nodeName),i=0,l=n.length; +for(;i=sp){par=getParent(n,_block)||c; +}if(p==sp){k=par==b.block?1:0;}if(k==-1&&p>sp||k==1){d.endNode=d.startNode=n;d.endOffset=d.startOffset=sp-(p-nvl); +return d;}}else{if(p>=sp&&!d.startNode){o=sp-(p-nvl);d.startNode=n;d.startOffset=sp-(p-nvl); +}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-nvl);return d;}}}return null;}if(!b){return false; +}if(!apf.w3cRange){oDoc.body.setActive();if(crt=b.rng){try{crt.select();}catch(ex){}return true; +}if(b.tag){crt=c.createControlRange();var n=oDoc.getElementsByTagName(b.tag),i=0,l=n.length; +for(;i_'; +range.deleteContents();range.insertNode(this.getRange().createContextualFragment(html)); +var oCaret=oDoc.getElementById("__caret");var htmlNode=oCaret.previousSibling;range=oDoc.createRange(); +range.setStartBefore(oCaret);range.setEndAfter(oCaret);this.setRange(range);oDoc.execCommand("Delete",false,null); +if(oCaret&&oCaret.parentNode){oCaret.parentNode.removeChild(oCaret);}return htmlNode; +}else{if(range.item){this.remove();range=this.getRange();}html=html.replace(/^<(\w+)/,'<$1 id="__caret"'); +range.pasteHTML(html);var htmlNode=oDoc.getElementById("__caret");if(htmlNode){htmlNode.removeAttribute("id"); +return htmlNode;}}};var styleObjNodes={img:1,hr:1,li:1,table:1,tr:1,td:1,embed:1,object:1,ol:1,ul:1}; +this.getType=function(){var oSel=this.get();if(apf.isIE){return oSel.type;}else{var type="Text"; +if(oSel&&oSel.rangeCount==1){var range=oSel.getRangeAt(0);if(range.startContainer==range.endContainer&&(range.endOffset-range.startOffset)==1&&range.startContainer.nodeType==1&&styleObjNodes[range.startContainer.childNodes[range.startOffset].nodeName.toLowerCase()]){type=CTRL; +}}return type;}};this.getSelectedNode=function(){var range=this.getRange();if(!apf.isIE){if(!range){return oDoc; +}var oSel=this.get(),oNode=range.commonAncestorContainer;if(!range.collapsed){if(apf.isWebkit&&oSel.anchorNode&&oSel.anchorNode.nodeType==1){return oSel.anchorNode.childNodes[oSel.anchorOffset]; +}if(range.startContainer==range.endContainer){if(range.startOffset-range.endOffset<2){if(range.startContainer.hasChildNodes()){oNode=range.startContainer.childNodes[range.startOffset]; +}}}}return oNode;}return range.item?range.item(0):range.parentElement();};this.getParentNode=function(){switch(this.getType()){case CTRL:if(apf.isIE){return this.getSelectedNode().parentElement; +}else{return this.getSelectedNode().parentNode;}case NONE:return;default:var oSel=this.get(); +if(apf.isIE){return oSel.createRange().parentElement();}else{if(oSel){var oNode=oSel.anchorNode; +while(oNode&&oNode.nodeType!=1){oNode=oNode.parentNode;}return oNode;}}break;}}; +this.selectNode=function(node){var oSel,range;while(node.nodeType==1&&node.firstChild){node=node.firstChild; +}if(apf.isIE){oSel=this.get();if(!node){node=oSel.createRange().parentElement(); +}try{oSel.empty();}catch(e){}try{range=oDoc.body.createControlRange();range.addElement(node); +}catch(e){range=oDoc.body.createTextRange();try{range.moveToElementText(node.nodeType!=1?node.parentNode:node); +}catch(e2){if(node.nodeValue){range.findText(node.nodeValue);}}}try{range.select(); +}catch(e){}}else{range=this.getRange();if(node){range.selectNode(node);}oSel=this.get(); +oSel.removeAllRanges();oSel.addRange(range);}return this;};this.collapse=function(toEnd){var range=this.getRange(),n; +if(range.item){n=range.item(0);range=oDoc.body.createTextRange();range.moveToElementText(n); +}range.collapse(!!toEnd);this.setRange(range);return this;};this.isCollapsed=function(){var range=this.getRange(),oSel=this.get(); +if(!range||range.item){return false;}return !oSel||range.boundingWidth==0||range.collapsed; +};this.hasAncestorNode=function(nodeTagName){var oContainer,range=this.getRange(); +if(this.getType()==CTRL||!apf.isIE){oContainer=this.getSelectedNode();if(!oContainer&&!apf.isIE){try{oContainer=range.startContainer; +}catch(e){}}}else{oContainer=range.parentElement();}while(oContainer){if(apf.isIE){if(oContainer.tagName==nodeTagName){return true; +}else{if(oContainer.nodeType==1&&oContainer.tagName==nodeTagName){return true;}}}oContainer=oContainer.parentNode; +}return false;};this.moveToAncestorNode=function(nodeTagName){var oNode,i,range=this.getRange(); +nodeTagName=nodeTagName.toUpperCase();if(apf.isIE){if(this.getType()==CTRL){for(i=0; +i=start;i--){f(end-i-1,end,sa[i].xmlNode,sa[i].v);}}}else{var res=[]; if(settings.ascending){for(i=start;i=start;i--){res[res.length]=sa[i].xmlNode;}}return res;}};if(xmlNode){this.parseXml(xmlNode); -}};apf.tween=(function(apf){var modules={left:function(oHtml,value){oHtml.style.left=value+PX; +}};apf.storage={modules:{},init:function(name){if(!name||name=="autodetect"){name=this.autodetect(); +}var provider=this.getProvider(name);apf.storage=apf.extend(this,provider);apf.storage.init=null; +apf.console.info("Installed storage provider '"+name+"'");return provider;},getProvider:function(name){var provider=apf.storage.modules[name]; +if(!provider||typeof provider!="object"){apf.console.warn("Could not find storage provider '"+name+"'"); +return false;}if(!provider.isAvailable()){apf.console.warn("Storage provider '"+name+"' is not available"); +return false;}if(!provider.initialized&&(!provider.init||provider.init()===false)){apf.console.warn("Could not install storage provider '"+name+""); +return false;}provider.name=name;apf.extend(provider,this.base);return provider; +},autodetect:function(){for(var name in this.modules){if("memory|cookie".indexOf(name)>-1){continue; +}if(this.modules[name].isAvailable()){return name;}}return !location.host&&this.modules.cookie?"cookie":(this.modules.memory?"memory":null); +},base:{namespace:"default",isValidKeyArray:function(keys){return(!keys||!keys.join)?false:/^[0-9A-Za-z_\.\-]*$/.test(keys.join("")); +},isValidKey:function(keyName){return(keyName===null||keyName===undefined)?false:/^[0-9A-Za-z_\.\-]*$/.test(keyName); +},getAllPairs:function(namespace,store){var keys=this.getKeys(namespace);if(!keys||!keys.length){return; +}var values=this.getMultiple(keys,namespace);for(var i=0;i100){info.$int=oHtml.$int;oHtml=oHtml.$ext;}try{if("fixed|absolute|relative".indexOf(apf.getStyle(oHtml,"position"))==-1){oHtml.style.position="relative"; }}catch(e){}var useCSSAnim=(apf.supportCSSAnim&&apf.supportCSSTransition&&CSSPROPS[info.type]),isTransform=(info.type==TRANSFORM); info.method=useCSSAnim?info.type:isTransform?modules[TRANSFORM+(info.subType||SCALE)]:modules[info.type]?modules[info.type]:(info.needsPx=needsPix[info.type]||false)?modules.htmlcss:modules.htmlcss; -if(useCSSAnim){var type=CSSPROPS[info.type];if(type===false){return apf.tween;}info.type=type||info.type; -if(isTransform){if(!info.subType){info.subType=SCALE;}info.type=apf.supportCSSAnim; -}var transform=(isTransform)?modules[TRANSVAL+(info.subType||SCALE)]:null;oHtml.style[info.type]=isTransform?transform(info.from):info.from+(needsPix[info.type]?PX:""); +if(!info.method){throw new Error(apf.formatErrorString(0,this,"Single Value Tween","Could not find method for tweening operation '"+info.type+"'")); +}if(useCSSAnim){var type=CSSPROPS[info.type];if(type===false){return apf.tween; +}info.type=type||info.type;if(isTransform){if(!info.subType){info.subType=SCALE; +}info.type=apf.supportCSSAnim;}var transform=(isTransform)?modules[TRANSVAL+(info.subType||SCALE)]:null; +oHtml.style[info.type]=isTransform?transform(info.from):info.from+(needsPix[info.type]?PX:""); $setTimeout(function(){oHtml.style[info.type]=isTransform?transform(info.to):info.to+(needsPix[info.type]?PX:""); oHtml.offsetTop;oHtml.style[apf.cssPrefix+"Transition"]=info.type+" "+((info.steps*info.interval)/1000)+"s "+CSSTIMING[info.anim||0]; var f=function(){if(info.onfinish){info.onfinish(oHtml,info.userdata);}oHtml.style[apf.cssPrefix+"Transition"]=""; @@ -1398,7 +2910,8 @@ for(;i100){da data.oHtml=data.oHtml.$ext;}animCSS=(useCSSAnim&&CSSPROPS[data.type]);isTransform=(data.type==TRANSFORM); if(isTransform){if(!data.subType){data.subType=SCALE;}data.type=apf.supportCSSAnim; }data.method=animCSS?data.type:isTransform?modules[TRANSFORM+(data.subType)]:modules[data.type]?modules[data.type]:(data.needsPx=needsPix[data.type]||false)?modules.htmlcss:modules.htmlcss; -if(animCSS){var type=isTransform?data.type:CSSPROPS[data.type];data.type=type||data.type; +if(!data.method){throw new Error(apf.formatErrorString(0,this,"Multi Value Tween","Could not find method for tweening operation '"+data.type+"'")); +}if(animCSS){var type=isTransform?data.type:CSSPROPS[data.type];data.type=type||data.type; var transform=modules[TRANSVAL+(data.subType)];oHtml.style[data.type]=isTransform?transform(data.from):data.from+(needsPix[data.type]?PX:""); stepsTo.push([data.type,isTransform?transform(data.to):data.to+(needsPix[data.type]?PX:"")]); steps.push(data.type+" "+cssDuration+"s "+cssAnim+" 0");hasCSSAnims=true;}else{steps.push(data.color?calcColorSteps(info.anim,data.from,data.to,info.steps):calcSteps(info.anim,parseFloat(data.from),parseFloat(data.to),info.steps)); @@ -1491,12 +3004,12 @@ while(htmlNode&&htmlNode.nodeType==1&&(htmlNode.tagName.toLowerCase()!="body"&&! };this.getXml=apf.getXml;this.nodeConnect=function(documentId,xmlNode,htmlNode,o){if(!this.$nodeCount[documentId]){this.$nodeCount[documentId]=0; }var xmlId;xmlId=xmlNode.getAttribute(this.xmlIdTag)||xmlNode.setAttribute(this.xmlIdTag,(xmlId=documentId+"|"+ ++this.$nodeCount[documentId]))||xmlId; if(!o){return xmlId;}var htmlId=xmlId+"|"+o.$uniqueId;if(htmlNode){htmlNode.setAttribute(this.htmlIdTag,htmlId); -}return htmlId;};this.$listeners=[null];this.addNodeListener=function(xmlNode,o,uId){var id,listen=String(xmlNode.getAttribute(this.xmlListenTag)||""); -if(!uId){uId=String(o.$uniqueId);}if(uId.charAt(0)=="p"){var sUId=uId.split("|"); -id=this.$listeners.push(function(args){var amlNode=apf.all[sUId[1]];if(amlNode){var model=apf.all[sUId[3]]; -if(!model){return;}var xpath=model.$propBinds[sUId[1]][sUId[2]].listen;var node=xpath?apf.queryNode(model.data,xpath):xmlNode; -if(node){amlNode.$execProperty(sUId[2],node,args[3]);}}})-1;this.$listeners[uId]=id; -}else{id="e"+uId;if(!this.$listeners[id]){this.$listeners[id]=function(args){var amlNode=apf.all[uId]; +}return htmlId;};this.$listeners=[null];this.addNodeListener=function(xmlNode,o,uId){if(!o||(!o.$xmlUpdate&&!o.setProperty)){throw new Error(apf.formatErrorString(1040,null,"Adding Node listener","Interface not supported.")); +}var id,listen=String(xmlNode.getAttribute(this.xmlListenTag)||"");if(!uId){uId=String(o.$uniqueId); +}if(uId.charAt(0)=="p"){var sUId=uId.split("|");id=this.$listeners.push(function(args){var amlNode=apf.all[sUId[1]]; +if(amlNode){var model=apf.all[sUId[3]];if(!model){return;}var xpath=model.$propBinds[sUId[1]][sUId[2]].listen; +var node=xpath?apf.queryNode(model.data,xpath):xmlNode;if(node){amlNode.$execProperty(sUId[2],node,args[3]); +}}})-1;this.$listeners[uId]=id;}else{id="e"+uId;if(!this.$listeners[id]){this.$listeners[id]=function(args){var amlNode=apf.all[uId]; if(amlNode){amlNode.$xmlUpdate.apply(amlNode,args);}};}if(xmlNode.$regbase){var lut={DOMCharacterDataModified:"text",DOMAttrModified:"attribute",DOMNodeInserted:"add",DOMNodeRemoved:"remove"}; var rFn=this.$listeners[id].rFn||(this.$listeners[id].rFn=function(e){var node=e.relatedNode&&e.relatedNode.nodeType!=1?e.relatedNode:e.currentTarget; if(node.nodeName&&node.nodeName.substr(0,2)=="a_"){return;}var action=lut[e.name]; @@ -1516,40 +3029,48 @@ if(xpath){tNode=pNode.selectSingleNode(xpath);if(!tNode){return;}pNode=tNode.nod if(!tNode){tNode=pNode.appendChild(pNode.ownerDocument.createTextNode(""));}}}if(undoObj&&!undoObj.$filled){undoObj.extra.oldValue=tNode.nodeValue; undoObj.$filled=true;}if(range){undoObj.extra.range=range;}else{tNode.nodeValue=value; if(tNode.$regbase){tNode.$setValue(value);}}this.applyChanges("text",tNode.parentNode,undoObj); -};this.setAttribute=apf.setAttribute=function(xmlNode,name,value,xpath,undoObj,range){if(undoObj&&!undoObj.$filled){undoObj.name=name; +this.applyRDB(["setTextNode",pNode,value,xpath],undoObj||{xmlNode:pNode});};this.setAttribute=apf.setAttribute=function(xmlNode,name,value,xpath,undoObj,range){if(undoObj&&!undoObj.$filled){undoObj.name=name; undoObj.$filled=true;}if(range){undoObj.extra.range=range;}else{(xpath?xmlNode.selectSingleNode(xpath):xmlNode).setAttribute(name,value); -}this.applyChanges("attribute",xmlNode,undoObj);};this.removeAttribute=apf.removeAttribute=function(xmlNode,name,xpath,undoObj){if(undoObj&&!undoObj.$filled){undoObj.name=name; +}this.applyChanges("attribute",xmlNode,undoObj);this.applyRDB(["setAttribute",xmlNode,name,value,xpath],undoObj||{xmlNode:xmlNode}); +};this.removeAttribute=apf.removeAttribute=function(xmlNode,name,xpath,undoObj){if(undoObj&&!undoObj.$filled){undoObj.name=name; undoObj.$filled=true;}(xpath?xmlNode.selectSingleNode(xpath):xmlNode).removeAttribute(name); -this.applyChanges("attribute",xmlNode,undoObj);};this.replaceNode=apf.replaceNode=function(newNode,oldNode,xpath,undoObj){if(xpath){oldNode=oldNode.selectSingleNode(xpath); +this.applyChanges("attribute",xmlNode,undoObj);this.applyRDB(["removeAttribute",xmlNode,name,xpath],undoObj||{xmlNode:xmlNode}); +};this.replaceNode=apf.replaceNode=function(newNode,oldNode,xpath,undoObj){if(xpath){oldNode=oldNode.selectSingleNode(xpath); }if(oldNode.ownerDocument.importNode&&newNode.ownerDocument!=oldNode.ownerDocument){newNode=oldNode.ownerDocument.importNode(newNode,true); -}if(undoObj&&!undoObj.$filled){undoObj.$filled=true;undoObj.oldNode=oldNode;undoObj.xmlNode=newNode; +}this.applyRDB(["replaceNode",oldNode,this.cleanXml(newNode.xml),xpath],undoObj||{xmlNode:oldNode}); +if(undoObj&&!undoObj.$filled){undoObj.$filled=true;undoObj.oldNode=oldNode;undoObj.xmlNode=newNode; }this.cleanNode(newNode);var parentNode=oldNode.parentNode;if(!parentNode){return; }parentNode.replaceChild(newNode,oldNode);this.copyConnections(oldNode,newNode); this.applyChanges("replacenode",newNode,undoObj);return newNode;};this.addChildNode=apf.addChildNode=function(pNode,tagName,attr,beforeNode,undoObj){var xmlNode=pNode.insertBefore(pNode.ownerDocument.createElement(tagName),beforeNode); for(var i=0;i-1){this.notifyQueued(); }var listen,uId,uIds,i,j,hash,info,amlNode,runTimer,found,done={};while(loopNode&&loopNode.nodeType==1){listen=loopNode.getAttribute(this.xmlListenTag); if(listen){uIds=listen.split(";");for(i=0;i<"); };this.cleanNode=function(xmlNode){try{var i,nodes=xmlNode.selectNodes("descendant-or-self::node()[@"+this.xmlListenTag+"]"); @@ -1583,35 +3111,540 @@ for(var nListen=[],j=0;j>16)&0xff),","',',((_q>>8)&0xff),',',(_q&0xff),',',","(",i/(len-1),"*_o+",1-(i/(len-1)),"*_r)",",')'].join(''))",")_t[",i,"]=_l,_m=1;"); +}else{var t=parseInt((this.colors[fill[len-i-1].toLowerCase()]||fill[len-i-1]).slice(1),16); +s.push("if(_t[",i,"]!=(_l=","['rgba(",(t>>16)&255,",",(t>>8)&255,",",t&255,",',","(",i/(len-1),"*_o+",1-(i/(len-1)),"*_r),')'].join(''))",")_t[",i,"]=_l,_m=1;"); +}}s.push("if(_s._angle!=(_u=(",style.angle,")*2*p) || _m){","_s._grad=_q=_c.createLinearGradient(","dtx+(__sin(_s._angle=_u)*0.5+0.5)*dw,","dty+(__cos(_u)*0.5+0.5)*dh,","dtx+(__sin(p+_u)*0.5+0.5)*dw,","dty+(__cos(p+_u)*0.5+0.5)*dh);"); +for(i=0;i>16)&255)+","+((a>>8)&255)+","+((a)&255)+","+(u*o+(1-u)*r)+")"); +}style._gradient=g;s.push("_c.fillStyle=_styles[",style._id,"]._gradient;");}}else{if(this.isDynamic(fill)||pstyle.fill!=fill){s.push("_c.fillStyle=",this.getColor(fill),";"); +}}}}if(style.stroke!==undefined){fillmode|=2;if(this.isDynamic(style.stroke)||pstyle.stroke!=style.stroke){s.push("_c.strokeStyle=",this.getColor(style.stroke),";"); +}if(this.isDynamic(style.weight)||pstyle.weight!=style.weight){s.push("_c.lineWidth=",style.weight,";"); +}}this.fillopacity="";this.strokeopacity="";this.fillmode=fillmode;switch(fillmode){case 3:if(style.fillopacity!=style.strokeopacity){this.fillopacity="_c.globalAlpha="+style.fillopacity+";"; +this.strokeopacity="_c.globalAlpha="+style.strokeopacity+";";}else{if(this.isDynamic(style.fillopacity)||style.fillopacity!=pstyle.fillopacity){s.push("_c.globalAlpha=",style.fillopacity,";"); +}}break;case 2:if(this.isDynamic(style.strokeopacity)||style.strokeopacity!=pstyle.strokeopacity){s.push("_c.globalAlpha=",style.strokeopacity,";"); +}break;case 1:if(this.isDynamic(style.fillopacity)||style.fillopacity!=pstyle.fillopacity){s.push("_c.globalAlpha=",style.fillopacity,";"); +}break;}return s.join("");},moveTo:function(x,y){return"_c.moveTo("+x+this.mx+","+y+this.my+");\n"; +},lineTo:function(x,y){this.dodraw=1;return"_c.lineTo("+x+this.mx+","+y+this.my+");\n"; +},lineH:function(x,y,w){this.dodraw=1;return["_c.moveTo(",x,this.mx,",",y,this.my,");","_c.lineTo(",x,this.mx,"+",w,",",y,this.my,");\n"].join(""); +},lineV:function(x,y,h){this.dodraw=1;return["_c.moveTo(",x,this.mx,",",y,this.my,");","_c.lineTo(",x,this.mx,",",y,this.my,"+",h,");\n"].join(""); +},dot:function(x,y){this.dodraw=1;return["_c.moveTo(",x,this.mx,",",y,this.my,");","_c.lineTo(",x,this.mx,",",y,this.my,");\n"].join(""); +},circle:function(x,y,r,s,e,c){this.dodraw=1;if(!s){s="0";}if(!e){e="p";}c=c?1:0; +return["_c.arc(",x,",",y,",",r,",",s,",",e,",",c,");"].join("");},ellipse:function(x,y,w,h,s,e,c){this.dodraw=1; +if(!s){s="0";}if(!e){e="p2";}c=c?1:0;return["if((_x2=(",w,"))!=0 && (_y2=-(",h,"))!=0){_c.translate(_x1=(",x,"),_y1=(",y,"));_c.scale(_x2,_y2);","_c.arc(0,0,1,(",s,")-1.5707965,(",e,")-1.5707965,",!c,");_c.scale(1/_x2,1/_y2);_c.translate(-_x1,-_y1);}"].join(""); +},rect:function(x,y,w,h){switch(this.fillmode){case 3:return this.fillopacity+"_c.fillRect(_x1="+x+this.mx+",_y1="+y+this.my+",_x2="+w+",_y2="+h+");"+this.strokeopacity+"_c.strokeRect(_x1,_y1,_x2,_y2);"; +case 2:return"_c.strokeRect("+x+this.mx+","+y+this.my+","+w+","+h+");\n";case 1:return"_c.fillRect("+x+this.mx+","+y+this.my+","+w+","+h+");\n"; +}},close:function(){return["_c.closePath();",this.$dodraw()].join("");},$dodraw:function(){this.dodraw=0; +switch(this.fillmode){case 3:return this.fillopacity+"_c.fill();"+this.strokeopacity+"_c.stroke();_c.beginPath();\n"; +case 2:return"_c.stroke();_c.beginPath();\n";case 1:return"_c.fill();_c.beginPath();\n"; +}},$endShape:function(){var s=this.dodraw?[this.$dodraw()]:[];this.mx="",this.my=""; +this.last=this.style._id;this.style=0;if(this.tiletrans){s.push("_c.restore();"); +}this.tiletrans=0;if(this._clip){s.push("_c.restore();");}this._clip=0;return s.join(""); +},$finalizeShape:function(){return"";}};apf.chart_draw={_axis2D:{margin:{left:30,top:30,right:30,bottom:30,$:1},layout:{pow:10,step:4,onsidex:0,onaxisx:0,onsidey:1,onaxisy:0,$:1},plane:{inherit:"shape",stroke:"#cfcfcf",fill:"#e6f1f8",$:1},plane2:{inherit:"shape",$:1},label:{inherit:"font",join:"label",left:0,top:0,format:"fixed(v,1)",$:0},labelx:{inherit:"label",width:40,top:5,left:-19,side:0,axis:0,edgeclip:2,align:"center",$:1},labely:{inherit:"label",left:-110,top:-6,width:100,side:1,edgeclip:0,align:1?"right":"left",$:1},grid:{inherit:"shape",join:"grid",extend:0,$:0},hgrid:{inherit:"grid",$:1},vgrid:{inherit:"grid",$:1},tiles:{inherit:"shape",join:"tiles",fill:"#dfe7f5",$:1},bar:{inherit:"shape",join:"bar",$:0},hbar:{inherit:"bar",$:1},vbar:{inherit:"bar",$:1},axis:{inherit:"shape",join:"grid",stroke:"black",weight:1,extend:2,$:0},axisx:{inherit:"axis",$:1},axisy:{inherit:"axis",$:1},tick:{inherit:"shape",join:"grid",steps:5,left:0,top:0,size:4,stroke:"#000000",$:0},tickx:{inherit:"tick",$:1},ticky:{inherit:"tick",$:1},tickgx:{inherit:"tick",weight:2,size:6,$:1},tickgy:{inherit:"tick",weight:2,size:6,$:1}},axis2D:function(l,s){var e=apf.draw; +if(!s.margin||!s.layout){return new Function("");}var ml=s.margin.left*l.ds,mt=s.margin.top*l.ds,mr=s.margin.right*l.ds,mb=s.margin.bottom*l.ds; +var c=e.optimize([e.beginLayer(l),e.vars(ml,mt,mr,mb),e.clear(),"var v,d,u,h,","vcx = 0.5*__pow(",s.layout.pow,", __round(__log(__abs(vw)/",s.layout.pow,")/__log(",s.layout.pow,")))*",s.layout.step,",","vcy = 0.5*__pow(",s.layout.pow,", __round(__log(__abs(vh)/",s.layout.pow,")/__log(",s.layout.pow,")))*",s.layout.step,",","vbx = __ceil(vx1/vcx) * vcx,","vby = __ceil(vy1/vcy) * vcy,","vex = __floor(vx2/vcx) * vcx,","vey = __floor(vy2/vcy) * vcy,","dcx = vcx*tw, dcy = vcy*th,","dbx = vbx*tw+tx, dby = vby*th+ty,","dex = vex*tw+tx, dey = vey*th+ty,","dcx2 = dcx*2, dcy2 = dcy*2,","dbx2 = __ceil(vx1/(2*vcx))*2*vcx*tw+tx,","dex2 = __floor(vx2/(2*vcx))*2*vcx*tw+tx,","dby2 = __floor(vy1/(2*vcy))*2*vcy*th+ty,","dey2 = __floor(vy2/(2*vcy))*2*vcy*th+ty;","var xmaxstep = __ceil( (dex-dbx)/dcx )+4,","ymaxstep = __ceil( (dey-dby)/dcy )+4;",s.plane?[e.beginShape(s.plane),e.rect(ml,mt,"dw","dh")].join(""):"",s.tiles?[e.rectInv?[e.beginShape(s.tiles),"if((u=dbx2-dcx-",ml,")>0){",e.rectInv(ml,mt,"u","dh"),"}","for( v = dbx2, u = dex-dcx; v < u; v += dcx2){",e.rectInv("v",mt,"dcx","dh"),"};","if((u=dr-v)>0){",e.rectInv("v",mt,"__min(dcx,u)","dh"),"}","if((u=dey2+dcy-",mt,")>0){",e.rectInv(ml,mt,"dw","u"),"}","for( v = dey2,u = dby+dcy; v < u; v -= dcy2){",e.rectInv(ml,"v","dw","-dcy"),"};","if((u=db-v)>0){",e.rectInv(ml,"v","dw","__min(-dcy,u)"),"}"].join(""):[e.beginShape(s.tiles,ml,mt,mr,mb),"for( u = dey2+dcy2, t = dby2-dcy2; u <= t; u -= dcy2){","for( v = dbx2-dcx2, d = dex2+dcx2; v <= d; v += dcx2){",e.rect("v+dcx","u","dcx","-dcy"),e.rect("v","u-dcy","dcx","-dcy"),"};","}"].join("")].join(""):"",s.vbar?[e.beginShape(s.vbar),"if((u=dbx2-dcx-",ml,")>0){",e.rect(ml,mt,"u","dh"),"}","for( v = dbx2, u = dex-dcx; v < u; v += dcx2){",e.rect("v",mt,"dcx","dh"),"};","if((u=dr-v)>0){",e.rect("v",mt,"__min(dcx,u)","dh"),"}"].join(""):"",s.hbar?[e.beginShape(s.hbar),"if((u=dey2+dcy-",mt,")>0){",e.rect(ml,mt,"dw","u"),"}","for( v = dey2, u = dby+dcy; v < u; v -= dcy2){",e.rect(ml,"v","dw","-dcy"),"};","if((u=db-v)>0){",e.rect(ml,"v","dw","__min(-dcy,u)"),"}"].join(""):"",s.tickx?[e.beginShape(s.tickx),"u = ",s.layout.onaxisx?("ty+"+(s.tickx.top*l.ds)):(s.layout.onsidex?s.tickx.size*-l.ds+ml:("db")),";","t = dcx/",s.tickx.steps,";","h = ",s.tickx.size*l.ds,";",s.layout.onaxisx?["if(u+h>",mt," && udb)h=db-u;"].join(""):"","x = dbx-dcx;while(xdx && udr)h=dr-u;"].join(""):"","y = dey+dcy;while(y= dy; y += dcy){",e.lineH("u","y","t"),"};"].join(""):"",s.vgrid?[e.beginShape(s.vgrid),"t=dh+",s.vgrid.extend*l.ds,";","u=",(s.vgrid.extend*l.ds*-s.layout.onsidex)+mt,";","for(x = dbx; x <= dr; x += dcx){",e.lineV("x","u","t"),"};"].join(""):"",s.tickgx?[e.beginShape(s.tickgx),"u = ",s.layout.onaxisx?("ty+"+s.tickgx.top*l.ds):(s.layout.onsidex?s.tickgx.size*-l.ds+ml:("db")),";","h = ",s.tickgx.size*l.ds,";",s.layout.onaxisx?["if(u+h>dy && udb)h=db-u;"].join(""):"","for(v=dbx; v <= dr; v += dcx){",e.lineV("v","u","h"),"};",s.layout.onaxisx?"}":"",].join(""):"",s.tickgy?[e.beginShape(s.tickgy),"u = ",s.layout.onaxisy?("tx+"+s.tickgy.left*l.ds):(s.layout.onsidey?s.tickgy.size*-l.ds+mt:"dr"),";","h = ",s.tickgy.size*l.ds,";",s.layout.onaxisy?["if(u+h>dx && udr)h=dr-u;"].join(""):"","for(v=dby; v >= dy; v += dcy){",e.lineH("u","v","h"),"};",s.layout.onaxisy?"}":"",].join(""):"",s.axisx?[e.beginShape(s.axisx),"if(ty>=dy && ty<=dy+dh){","t=dw+",s.axisx.extend*l.ds,";","u=dx+",(s.axisx.extend*l.ds*-s.layout.onsidey),";",e.lineH("u","ty","t"),"}"].join(""):"",s.axisy?[e.beginShape(s.axisy),"if(tx>=dx && tx<=dx+dw){","t=dh+",s.axisy.extend*l.ds,";","u=dy+",(s.axisy.extend*l.ds*-s.layout.onsidex),";",e.lineV("tx","u","t"),"}"].join(""):"",s.plane2?[e.beginShape(s.plane2),e.rect(ml,mt,"dw","dh")].join(""):"",s.labelx?[s.layout.onaxisx?e.beginFont(s.labelx,"xmaxstep",ml,mt,mr,mb):e.beginFont(s.labelx,"xmaxstep",ml-s.labelx.edgeclip*l.ds,0,mr-s.labelx.edgeclip*l.ds,0),"for( v = vbx, u = vex,d = dbx; v <= u; v+= vcx, d+= dcx ){",e.text("d",s.layout.onaxisx?"ty":(s.layout.onsidex?"dy":"db"),s.labelx.format),"}"].join(""):"",s.labely?[s.layout.onaxisy?e.beginFont(s.labely,"ymaxstep",ml,mt,mr,mb):e.beginFont(s.labely,"ymaxstep",0,mt-s.labely.edgeclip*l.ds,0,mb-s.labely.edgeclip*l.ds),"for( v = vby, u = vey,d = dby;v<= u; v+= vcy, d+= dcy ){;",e.text(s.layout.onaxisy?"tx":(s.layout.onsidey?"dx":"dr"),"d",s.labelx.format),"}"].join(""):"",e.endLayer()]); +try{return new Function("l","v","m",c);}catch(x){alert("Failed to compile:\n"+x.message+"\n"+c); +return 0;}},_axis3D:{layout:{pow:10,step:4,$:1},plane:{inherit:"shape",side:1,oneside:0,fill:"#e6f1f8",$:0},plane2:{inherit:"shape",$:1},planexy:{inherit:"plane",$:1},planexz:{inherit:"plane",$:1},planeyz:{inherit:"plane",$:1},bar:{inherit:"shape",join:"bar",oneside:0,$:0},hbar:{side:1,inherit:"bar",stroke:"#cfcfcf",$:0},vbar:{side:1,inherit:"bar",stroke:"#cfcfcf",fill:"blue",opacity:0.25,$:0},hbarxy:{inherit:"hbar",$:1},vbarxy:{inherit:"vbar",$:1},hbarxz:{inherit:"hbar",stroke:"black",opacity:0.25,$:1},vbarxz:{inherit:"vbar",fill:"#e6f1f8",stroke:"black",$:1},hbaryz:{inherit:"hbar",fill:"#blue",opacity:0.25,$:1},vbaryz:{inherit:"vbar",stroke:"black",opacity:0.25,fill:null,$:1},axis:{inherit:"shape",join:"grid",stroke:"black",opacity:0.5,weight:3,$:0},axisx:{inherit:"axis",$:1},axisy:{inherit:"axis",$:1},axisz:{inherit:"axis",$:1},tick:{inherit:"shape",join:"grid",steps:5,size:4,scale:0.1,angle:"ang(180)",stroke:"#000000",$:0},tickx:{inherit:"tick",angle:"ang(90+f1*90)",$:1},ticky:{inherit:"tick",angle:"ang(90+f2*90)",$:1},tickz:{inherit:"tick",$:1},label:{inherit:"font",join:"label",width:40,height:40,left:-20,top:"fontz(-5,200)",size:"fontz(10,200)",scale:0.2,stroke:null,angle:"ang(180)",format:"fixed(v,1)",$:0},labelx:{inherit:"label",angle:"ang(90+f1*90)",align:"center",$:1},labely:{inherit:"label",angle:"ang(90+f2*90)",align:"center",$:1},labelz:{inherit:"label",align:"center",$:1},$:0},chartView3D:function(l,e){return["var s3x=v.x3d/vw,s3xi=1/s3x,s3y=v.y3d/vh,s3yi=1/s3y,s3z=v.z3d/vd,s3zi=1/s3z;",e.sincos3("_m","v.rx","v.ry","v.rz"),e.setMatrix3D(e.matrixMul(e.matrix4T("(-0.5*vx1-0.5*vx2)","(-0.5*vy1-0.5*vy2)","(-0.5*vz1-0.5*vz2)"),e.matrix4S("s3x","s3y","s3z"),e.matrix4RP("_m"),e.matrix4T("v.tx","v.ty","v.tz")))].join(""); +},axis3D:function(l,s){if(!s.layout){return new Function("");}var e=apf.draw;var dt=(new Date()).getTime(); +var zclip=-0.01;function drawPlane(pr,fl,z1,z2,side,vx1,vx2,vbx,vex,vbx2,vex2,vcx,vcx2,vy1,vy2,vby,vey,vby2,vey2,vcy,vcy2){function plane(z){return e.poly3DClip([0,1,2,3],[[vx1,vy1,z],[vx1,vy2,z],[vx2,vy2,z],[vx2,vy1,z]],fl,zclip); +}function hbar(z){return["if((u=(",vbx2,"-",vcx,")-",vx1,")<",vcx," && u>0){",e.poly3DClip([0,1,2,3],[[vx1,vy1,z],["("+vx1+"+u)",vy1,z],["("+vx1+"+u)",vy2,z],[vx1,vy2,z]],fl,zclip),"}","for( v = ",vbx2,", u = ",vex2,"-0.000001; v < u; v += ",vcx2,"){",e.poly3DClip([0,1,2,3],[["v",vy1,z],["(v+"+vcx+")",vy1,z],["(v+"+vcx+")",vy2,z],["v",vy2,z]],fl,zclip),"};","if( v<",vx2," ){",e.poly3DClip([0,1,2,3],[["v",vy1,z],["(u="+e.min("v+"+vcx,vx2)+")",vy1,z],["u",vy2,z],["v",vy2,z]],fl,zclip),"}"].join(""); +}function vbar(z){return["if((u=(",vby2,"-",vcy,")-",vy1,")<",vcy," && u>0){",e.poly3DClip([0,1,2,3],[[vx1,vy1,z],[vx1,"("+vy1+"+u)",z],[vx2,"("+vy1+"+u)",z],[vx2,vy1,z]],fl,zclip),"}","for( v = ",vby2,", u = ",vey2,"-0.000001; v < u; v += ",vcy2,"){",e.poly3DClip([0,1,2,3],[[vx1,"v",z],[vx1,"(v+"+vcy+")",z],[vx2,"(v+"+vcy+")",z],[vx2,"v",z]],fl,zclip),"};","if( v<",vy2," ){",e.poly3DClip([0,1,2,3],[[vx1,"v",z],[vx1,"(u="+e.min("v+"+vcy,vy2)+")",z],[vx2,"u",z],[vx2,"v",z]],fl,zclip),"}"].join(""); +}return["s1=-(",e.backface3D([[vx1,vy1,z1],[vx1,vy2,z1],[vx2,vy1,z1]],fl),");","s2=",e.backface3D([[vx1,vy1,z2],[vx1,vy2,z2],[vx2,vy1,z2]],fl),";","s",pr,"=s1*",side,">=s2*",side,";",s["plane"+pr]?[e.beginShape(s["plane"+pr]),"sa = s1*",e.style.side*side,";","sb = s2*",e.style.side*side,";",e.style.oneside?"if(sa>=sb)sb = -1;if(sb>=sa)sa = -1;":"","for(i=1;i>=0;i--){if((i?sa:sb)>=0){z=i?",z1,":",z2,";",plane("z"),"}};",].join(""):"",s["hbar"+pr]?[e.beginShape(s["hbar"+pr]),"sa = s1*",e.style.side*side,";","sb = s2*",e.style.side*side,";",e.style.oneside?"if(sa>=sb)sb = -1;if(sb>=sa)sa = -1;":"","for(i=1;i>=0;i--){if((i?sa:sb)>=0){z=i?",z1,":",z2,";",hbar("z"),"}};"].join(""):"",s["vbar"+pr]?[e.beginShape(s["vbar"+pr]),"sa = s1*",e.style.side*side,";","sb = s2*",e.style.side*side,";",e.style.oneside?"if(sa>=sb)sb = -1;if(sb>=sa)sa = -1;":"","for(i=1;i>=0;i--){if((i?sa:sb)>=0){z=i?",z1,":",z2,";",vbar("z"),"}};"].join(""):"",s["plane2"+pr]?[e.beginShape(s["plane2"+pr]),e.poly3DClip([0,1,2,3],[[vx1,vy1,z1],[vx2,vy1,z1],[vx2,vy2,z1],[vx1,vy2,z1]],fl,zclip),].join(""):""].join(""); +}function drawAxis(pr,fl,z1,z2,side1,side2,us,ws,wind,vx1,vx2,vbx,vex,vbx2,vex2,vcx,vcx2,vy1,vy2,vby,vey,vby2,vey2,vcy,vcy2){var zclip=-1,sider,sd; +if(s["axis"+pr]){if((sd=s["axis"+pr].side1)!==undefined){side1=sd;}if((sd=s["axis"+pr].side2)!==undefined){side2=sd; +}}var sideloop=["for(i=0;i<4;i++)if((i&2?(",side2,"?((f1=0,c=1,y=",vy1,"),1):0):(",side2,"?0:((f1=1,c=-1,y=",vy2,"),1)))&&","(i&1?(",side1,"?((f2=0,d=1,z=",z1,"),1):0):(",side1,"?0:((f2=1,d=-1,z=",z2,"),1))))"].join(""); +return[s["axis"+pr]?[e.beginShape(s["axis"+pr]),sideloop,"{",e.poly3DClip([0,1],[[vx1,"y","z"],[vx2,"y","z"]],fl,zclip,true),"};"].join(""):"",s["tick"+pr]?[e.beginShape(s["tick"+pr]),sideloop,"{",";u=y+",us,"*__sin(f=(",e.style.angle,")*",wind,")*(",e.style.scale,")*c;w=z+",ws,"*__cos(f)*(",e.style.scale,")*d;","for(v=",vbx,";v<=",vex,";v+=",vcx,"){",e.poly3DClip([0,1],[["v","y","z"],["v","u","w"]],fl,zclip,true),"};","};"].join(""):"",s["label"+pr]?[e.beginFont(s["label"+pr],["__ceil(((",vex,")-(",vbx,"))/(",vcx,"))*2"].join("")),sideloop,"{",";u=y+",us,"*__sin(f=(",e.style.angle,")*",wind,")*(",e.style.scale,")*c;w=z+",ws,"*__cos(f)*(",e.style.scale,")*d;","for(v=",vbx,";v<=",vex,";v+=",vcx,"){",e.text3D(["v","u","w"],fl,zclip,e.style.format),"}","}"].join(""):"",].join(""); +}var c=e.optimize([e.beginLayer(l),e.vars(),this.chartView3D(l,e),e.defCamVec(),e.clear(),"var v,d,c,u,h,w,f1,f2,","vcx = 0.5*__pow(",s.layout.pow,", __round(__log(__abs(vw)/",s.layout.pow,")/__log(",s.layout.pow,")))*",s.layout.step,",","vcy = 0.5*__pow(",s.layout.pow,", __round(__log(__abs(vh)/",s.layout.pow,")/__log(",s.layout.pow,")))*",s.layout.step,",","vcz = 0.5*__pow(",s.layout.pow,", __round(__log(__abs(vd)/",s.layout.pow,")/__log(",s.layout.pow,")))*",s.layout.step,",","vbx = __ceil(vx1/vcx) * vcx,","vby = __ceil(vy1/vcy) * vcy,","vbz = __ceil(vz1/vcz) * vcz,","vex = __floor(vx2/vcx) * vcx,","vey = __floor(vy2/vcy) * vcy,","vez = __floor(vz2/vcz) * vcz,","vcx2 = vcx*2, vcy2 = vcy*2, vcz2 = vcz*2,","vbx2 = __ceil(vx1/vcx2)*vcx2,","vex2 = __floor(vx2/vcx2)*vcx2,","vby2 = __ceil(vy1/vcy2)*vcy2,","vey2 = __floor(vy2/vcy2)*vcy2,","vbz2 = __ceil(vz1/vcz2)*vcz2,","vez2 = __floor(vz2/vcz2)*vcz2,","s1, s2, sa, sb, sxy, sxz, syz;","var xmaxstep = __ceil( (vex-vbx)/vcx )+4,","ymaxstep = __ceil( (vey-vby)/vcy )+4,","zmaxstep = __ceil( (vez-vbz)/vcz )+4;",drawPlane("xy",[0,1,2],"vz1","vz2",1,"vx1","vx2","vbx","vex","vbx2","vex2","vcx","vcx2","vy1","vy2","vby","vey","vby2","vey2","vcy","vcy2"),drawPlane("xz",[0,2,1],"vy1","vy2",-1,"vx1","vx2","vbx","vex","vbx2","vex2","vcx","vcx2","vz1","vz2","vbz","vez","vbz2","vez2","vcz","vcz2"),drawPlane("yz",[2,0,1],"vx1","vx2",1,"vy1","vy2","vby","vey","vby2","vey2","vcy","vcy2","vz1","vz2","vbz","vez","vbz2","vez2","vcz","vcz2"),drawAxis("x",[0,1,2],"vz1","vz2","sxy","sxz","s3yi","s3zi",1,"vx1","vx2","vbx","vex","vbx2","vex2","vcx","vcx2","vy1","vy2","vby","vey","vby2","vey2","vcy","vcy2"),drawAxis("y",[1,0,2],"vz1","vz2","sxy","syz","s3xi","s3zi",-1,"vy1","vy2","vby","vey","vby2","vey2","vcy","vcy2","vx1","vx2","vbx","vex","vbx2","vex2","vcx","vcx2"),drawAxis("z",[2,1,0],"vx1","vx2","syz","sxz","s3yi","s3xi",1,"vz1","vz2","vbz","vez","vbz2","vez2","vcz","vcz2","vy1","vy2","vby","vey","vby2","vey2","vcy","vcy2"),e.endLayer()]); +try{var f=new Function("l","v","m",c);return f;}catch(x){alert("Failed to compile:\n"+x.message+"\n"+c); +return 0;}},_line2D:{graph:{inherit:"shape",stroke:"#000000",weight:1,$:1}},line2D:function(l,d,s){if(!s.graph){return new Function(""); +}var wrap=s.graph.weight*8,e=apf.draw;var clipy=s.graph.fillout?"db":"ty";var c=e.optimize([e.vars(),"if(m){","return -1;","}",e.beginLayer(l),d.vars,d.stats,e.beginShape(s.graph),"var x1=",d.x1,",x2=",d.x2,",xs=",d.xs,",x = x1,xw=x2-x1,idx=xw/xs;",d.begin,"var xfirst = x,dx=-vx1*tw,dy=-vy1*th;",d.seek,d.ifdraw,"{",s.graph.fill?[e.moveTo(d.x+"*tw+tx",clipy),e.lineTo(d.x+"*tw+tx",d.y+"*th+ty"),].join(""):e.moveTo(d.x+"*tw+tx",d.y+"*th+ty"),"for(x+=idx;x0)?"":["for(x=x1;xl.mipthres && _mt1?__pow(_ms,_mt-2):0;var _yv = l.v_yvalmip[_mt-1],_i;",vx1:0,vx2:"_yv.length",vy1:-1,vy2:1,vz1:0,vz2:1,state:"0",time:"0",sum:"l.v_sum",min:"l.v_min",max:"l.v_max",avg:"l.v_avg",seek:"",stats:"",ifdraw:"if((!l.mipmin || _mt>l.mipmin) && (!l.mipmax || _mt=0;--i)j+=((m=_yv[i])<_mi?_mi=m:m)>_ma?_ma=m:m;l.v_avg=(l.v_sum=j)/_yv.length;l.v_min=_mi;l.v_max=_ma;}",x1:"__max(__floor(vx1),0)",x2:"__min(__ceil(vx2)+1,_yv.length)",x1c:"__max(__floor(vx1),0)",x2c:"__min(__ceil(vx2)+1,_yv.length)",xs:"x2-x1",x:"x",y:"_yv[x]"}; +},dt_series2X:function(l){var len=l.yvalue.length;return{type:"series2X",vx1:0,vx2:len,vy1:-1,vy2:1,vz1:0,vz2:1,vars:"var _vx = l.xvalue, _vy = l.yvalue, _len = _vy.length;",x1:0,x2:"_len",xs:"_len",x:"_vx[x]",y:"_vy[x]"}; +},$:0};apf.chart_draw.height2D=apf.chart_draw.line2D;apf.chart_draw._height2D=apf.chart_draw._line2D; +apf.draw.vml={initRoot:function(r){if(!apf.isIE8){apf.importCssString("v\\:fill {behavior: url(#default#VML);display:inline-block} v\\:stroke {behavior: url(#default#VML);} v\\:shape {behavior: url(#default#VML);} v\\:path {behavior: url(#default#VML);}"); +r.$ext.innerHTML="
"; +r.vmlroot=r.$ext.lastChild;}else{r.$ext.innerHTML="
"; +r.vmliframe=r.$ext.lastChild;r.vmliframe.allowTransparency=true;var doc=r.vmliframe.contentWindow.document; +doc.open();doc.writeln("
"); +doc.close();r.vmlroot=doc.body.firstChild;}return this;},resizeRoot:function(r){var t=r.vmliframe||r.vmlroot; +t.style.width=r.width;t.style.height=r.height;t=t.previousSibling;t.style.width=r.width,t.style.height=r.height; +if(r.vmliframe){t=r.vmlroot;t.style.width=r.width;t.style.height=r.height;}},initLayer:function(l,r){l.ds=1; +l.dx=0,l.dy=0;l.dw=parseFloat(l.width)*l.ds;l.dh=parseFloat(l.height)*l.ds;l._styles=[]; +l._htmljoin=[];l._vmlroot=r.vmlroot;},resizeLayer:function(l,r){var lx,ly,lw,lh,t; +l.dx=0,l.dy=0;l.dw=parseFloat(lw=l.width)*l.ds;l.dh=parseFloat(lh=l.height)*l.ds; +var coord=(l.dw+1)+","+(l.dh+1);if(l._vmlgroup){(t=l._vmlgroup).style.left=lx=l.left,t.style.top=ly=l.top,t.style.width=lw,t.style.height=lh; +for(var n=l._vmlgroup.childNodes,l=n.length,i=0;i\",",'"',l._htmljoin.join(""),'",',"\"\"].join(''));","l._vmlgroup = l._vmlroot.lastChild;","var _n, _styles = l._styles = [];",p.join(""),"};"].join("")); +l._styles=null;this.l=null;return s.join("");},beginShape:function(style){if(!style){return"document.title='beginShape Failed';"; +}var l=this.l,html=l._htmljoin,i,t,shape=[],path=[],child=[],opacity="",s=[this.$endDraw()]; +style._path=[];if(style._id===undefined){style._id=l._styles.push(style)-1;}this.style=style; +for(i=l._styles.length-2;i>=0;i--){if(!l._styles[i]._prev&&this.$canJoin(t=l._styles[i],style)){style._prev=(t._prev!==undefined)?t._prev:i; +break;}}if(style._prev===undefined){s.push("_p=(_s=_styles[",style._id,"])._path=[];"); +if(typeof style.tile!="undefined"){var fillopacity=style.fillopacity;if(this.isDynamic(fillopacity)){fillopacity="1"; +s.push("_s._vmlfill.opacity=",style.fillopacity,";");}if(this.isDynamic(style.tile)){s.push("if(_s._vmlimg!=(_t=",style.tile,"))_s._vmlfill.src=_t;"); +child.push(""); +}else{child.push(""); +if(style.tilex||style.tiley){style._img=new Image();style._img.src=style.tile;if(style.tilex){s.push("_s._vmlfill.origin.x=((_t=((",style.tilex,")/(_s._img.width))%1)<0?1+_t:_t);"); +}if(style.tiley){s.push("_s._vmlfill.origin.y=((_t=((",style.tiley,")/_s._img.height)%1)<0?1+_t:_t);"); +}}}s.push("_p.push('m',_dx=-_s._img.width*100,' ',_dy=-_s._img.height*100,","',l',_dx,' ',_dy);"); +}else{if(style.fill!==undefined){var fill=style.fill,fillopacity=style.fillopacity,angle=style.angle,gradopacity=style.gradopacity; +if(!fill.sort){fill=[fill];}var len=fill.length;var color="black",colors,color2,getColorors; +if(len>2){for(i=1;i1?'+",':'"',Math.round((i/(len-1))*100),'% "+',this.getColor(fill[i])); +}colors=t.join("");getColorors=1;}else{for(t=[],i=1;i1?",":"",Math.round((i/(len-1))*100),"% ",fill[i]); +}colors=t.join("");}}if(len>1){if(this.isDynamic(gradopacity)||this.isDynamic(fillopacity)){if(gradopacity==fillopacity){fillopacity="_t="+fillopacity,gradopacity="_t"; +}if(len>2){t=gradopacity,gradopacity=fillopacity,fillopacity=t;}s.push("if(_s._vmldata!=(_t=",'["\"].join(''))){","_s._domnode.removeChild(_s._vmlfill);","_s._domnode.insertAdjacentHTML( 'beforeend',_s._vmldata=_t);","_s._vmlfill = _s._domnode.lastChild;};"); +child.push("");}else{if(len>2){t=gradopacity,gradopacity=fillopacity,fillopacity=t; +}if(this.isDynamic(fill[0])){s.push("_s._vmlfill.color=",this.getColor(fill[0]),";"); +}else{color=fill[0];}if(this.isDynamic(fill[len-1])){s.push("_s._vmlfill.color2=",this.getColor(fill[len-1]),";"); +}else{color2=fill[len-1];}if(getColorors){s.push("_s._vmlfill.colors.value=",colors,";"); +}if(this.isDynamic(angle)){angle="0";s.push("_s._vmlfill.angle=(((",style.angle,")+180)*360)%360;"); +}if(this.isDynamic(fillopacity)){fillopacity="1";s.push("_s._vmlfill.opacity=",style.fillopacity,";"); +}child.push(""); +}}else{if(this.isDynamic(fillopacity)){fillopacity="1";s.push("_s._vmlfill.opacity=",style.fillopacity,";"); +}if(this.isDynamic(fill[0])){s.push("_s._vmlfill.color=",this.getColor(fill[0]),";"); +}else{color=fill[0];}child.push(""); +}shape.push("fill='t'"),path.push("fillok='t'");}else{shape.push("fill='f'"),path.push("fillok='f'"); +}}if(style.stroke!==undefined){var weight=style.weight,opacity=style.strokeopacity,stroke=style.stroke; +if(this.isDynamic(opacity)){opacity="1";s.push("_s._vmlstroke.opacity=",style.opacity,";"); +}if(this.isDynamic(weight)){weight="1";s.push("_t=",style.weight,";_s._vmlstroke.weight=_t;if(_t<",opacity,")_s._vmlstroke.opacity=_t;"); +}if(this.isDynamic(stroke)){stroke="black";s.push("_s._vmlstroke.color=",this.getColor(style.stroke),";"); +}child.push(""); +}else{shape.push("stroke='f'"),path.push("strokeok='f'");}html.push(["",child.join(" "),""].join("")); +}else{if(style._prev!==undefined){if(this.last!==style._prev){s.push("_p=(_s=_styles[",style._prev,"])._path;"); +}}}return s.join("");},moveTo:function(x,y){return["_p.push('m',__round(",x,")",",' ',__round(",y+"),'l');\n"].join(""); +},lineTo:function(x,y){return["_p.push(__round(",x,")",",' ',__round("+y+"));\n"].join(""); +},lineH:function(x,y,w){return["_p.push('m',__round(",x,")",",' ',__round(",y,")",",'r',__round(",w,"),' 0');"].join(""); +},lineV:function(x,y,h){return["_p.push('m',__round(",x,")",",' ',__round(",y,")",",'r0 ',__round(",h,"));"].join(""); +},dot:function(x,y){return["_p.push('m',__round(",x,")",",' ',__round(",y,")",",'r0 0');"].join(""); +},rect:function(x,y,w,h,inv){return["_u=",x,";if((_t=__round(",w,"))>0)_p.push('m',__round(_u),' ',__round(",y,")",",'r',_t,' 0r0 ',__round(",h,inv?"),'r-'+_t,' 0x');":"),'r-'+_t,' 0xe');"].join(""); +},ellipse:function(x,y,w,h,s,e,c){if(!s){return["_p.push('at ',(_x1=__round(",x,"))-(_x2=__round(",w,")),' ',(_y1=__round(",y,"))-(_y2=__round(",h,")),' ',","_x1+_x2,' ',_y1+_y2,' 0 0 0 0');"].join(""); +}else{return["if( (_t=",s,")+0.000001<(_u=",e,")){","_p.push('",c?"wa":"at"," ',(_x1=__round(",x,"))-(_x2=__round(",w,")),' ',(_y1=__round(",y,"))-(_y2=__round(",h,")),' ',_x1+_x2,' ',_y1+_y2,' ',","__round(_x1+__sin(_t)*_x2*4000),' ',","__round(_y1+__cos(_t)*_y2*4000),' ',","__round(_x1+__sin(_u)*_x2*4000),' ',","__round(_y1+__cos(_u)*_y2*4000),'x');}else{","_p.push('l',__round((",x,")+__sin(_t)*(",w,")),' ',__round((",y,")+__cos(_t)*(",h,")),'x');","}",].join(""); +}},rectInv:function(x,y,w,h){return this.rect(x,y,w,h,1);},close:function(){return"_p.push('xe');"; +},$endShape:function(){this.mx="",this.my="";this.last=this.style._id;this.style=0; +return"";},$finalizeShape:function(style){return["if((_s=_styles[",style._id,"])._pathstr!=(_t=","(_p=_s._path).length?_p.join(' '):'m'))_s._domnode.path=_t;\n"].join(""); +}};apf.storage.modules["air.file"]={initialized:false,init:function(){this.File=window.runtime.flash.filesystem.File; +this.FileStream=window.runtime.flash.filesystem.FileStream;this.FileMode=window.runtime.flash.filesystem.FileMode; +this.storagePath="__APF_"+(apf.config.name?apf.config.name.toUpperCase():"STORAGE")+"/"; +try{var dir=this.File.applicationStorageDirectory.resolvePath(this.storagePath); +if(!dir.exists){dir.createDirectory();}this.initialized=true;}catch(e){apf.console.warn(e.message); +return false;}},isAvailable:function(){return apf.isAIR;},put:function(key,value,namespace){if(this.isValidKey(key)==false){throw new Error(apf.formatErrorString(0,null,"Setting name/value pair","Invalid key given: "+key)); +}if(!namespace){namespace=this.namespace;}if(this.isValidKey(namespace)==false){throw new Error(apf.formatErrorString(0,null,"Setting name/value pair","Invalid namespace given: "+namespace)); +}try{this.remove(key,namespace);var dir=this.File.applicationStorageDirectory.resolvePath(this.storagePath+namespace); +if(!dir.exists){dir.createDirectory();}var file=dir.resolvePath(key);var stream=new this.FileStream(); +stream.open(file,this.FileMode.WRITE);stream.writeObject(value);stream.close(); +}catch(e){throw new Error(apf.formatErrorString(0,null,"Setting name/value pair","Error writing file: "+e.message)); +return false;}return true;},get:function(key,namespace){if(this.isValidKey(key)==false){throw new Error(apf.formatErrorString(0,null,"Getting name/value pair","Invalid key given: "+key)); +}if(!namespace){namespace=this.namespace;}if(this.isValidKey(namespace)==false){throw new Error(apf.formatErrorString(0,null,"Getting name/value pair","Invalid namespace given: "+namespace)); +}var file=this.File.applicationStorageDirectory.resolvePath(this.storagePath+namespace+"/"+key); +if(!file.exists||file.isDirectory){return false;}var stream=new this.FileStream(); +stream.open(file,this.FileMode.READ);var results=stream.readObject();stream.close(); +return results;},getNamespaces:function(){var results=[this.namespace];var dir=this.File.applicationStorageDirectory.resolvePath(this.storagePath); +var files=dir.getDirectoryListing();for(var i=0;i=0;i--){if(namespaceTester.test(myStorage.key(i))==true){myStorage.removeItem(myStorage.key(i)); +}}},remove:function(key,namespace){key=this.getFullKey(key,namespace);var myStorage=this.storage[this.domain]; +myStorage.removeItem(key);},isPermanent:function(){return true;},getMaximumSize:function(){return 0; +},hasSettingsUI:function(){return false;},showSettingsUI:function(){throw new Error(apf.formatErrorString(0,null,this.declaredClass+" does not support a storage settings user-interface")); +},hideSettingsUI:function(){throw new Error(apf.formatErrorString(0,null,this.declaredClass+" does not support a storage settings user-interface")); +},getFullKey:function(key,namespace){if(!namespace){namespace=this.namespace;}if(this.isValidKey(namespace)==false){throw new Error(apf.formatErrorString(0,null,"Clearing storage","Invalid namespace given: "+namespace)); +}return namespace==this.namespace?key:"__"+namespace+"_"+key;}};apf.storage.modules.memory={initialized:true,store:{},isAvailable:function(){return true; +},put:function(key,value,namespace){if(this.isValidKey(key)==false){throw new Error(apf.formatErrorString(0,null,"Setting name/value pair","Invalid key given: "+key)); +}if(!namespace){namespace=this.namespace;}if(this.isValidKey(namespace)==false){throw new Error(apf.formatErrorString(0,null,"Setting name/value pair","Invalid namespace given: "+namespace)); +}value=apf.serialize(value);if(!this.store[namespace]){this.store[namespace]={}; +}this.store[namespace][key]=value;},get:function(key,namespace){if(this.isValidKey(key)==false){throw new Error(apf.formatErrorString(0,null,"Getting name/value pair","Invalid key given: "+key)); +}if(!namespace){namespace=this.namespace;}if(this.isValidKey(namespace)==false){throw new Error(apf.formatErrorString(0,null,"Getting name/value pair","Invalid namespace given: "+namespace)); +}if(!this.store[namespace]||!this.store[namespace][key]){return null;}return apf.unserialize(this.store[namespace][key]); +},getNamespaces:function(){var results=[this.namespace];for(var ns in this.store){results.push(ns); +}return results;},getKeys:function(namespace){if(!namespace){namespace=this.namespace; +}if(this.isValidKey(namespace)==false){throw new Error(apf.formatErrorString(0,null,"Clearing storage","Invalid namespace given: "+namespace)); +}var results=[];for(var prop in this.store[namespace]){results.push(prop);}return results; +},clear:function(namespace){if(!namespace){namespace=this.namespace;}if(this.isValidKey(namespace)==false){throw new Error(apf.formatErrorString(0,null,"Clearing storage","Invalid namespace given: "+namespace)); +}delete this.store[namespace];},remove:function(key,namespace){if(!namespace){namespace=this.namespace; +}if(this.isValidKey(namespace)==false){throw new Error(apf.formatErrorString(0,null,"Removing key","Invalid namespace given: "+namespace)); +}if(this.store[namespace]){delete this.store[namespace][key];}},putMultiple:function(keys,values,namespace){if(this.isValidKeyArray(keys)===false||!values instanceof Array||keys.length!=values.length){throw new Error(apf.formatErrorString(0,null,"Setting multiple name/value pairs","Invalid arguments: keys = ["+keys+"], values = ["+values+"]")); +}if(!namespace){namespace=this.namespace;}if(this.isValidKey(namespace)==false){throw new Error(apf.formatErrorString(0,null,"Setting multiple name/value pairs","Invalid namespace given: "+namespace)); +}if(!this.store[namespace]){this.store[namespace]={};}for(var i=0;i_self.timeout){_self.$timeout(id);return;}if(_self.queue[id].http.readyState==4){clearInterval(_self.queue[id].timer); +_self.receive(id);}},20);}else{http.onreadystatechange=function(){if(!_self.queue[id]||http.readyState!=4){return; }if(async&&arguments.callee.caller){setTimeout(function(){_self.receive(id);}); -}else{_self.receive(id);}};}var autoroute=this.autoroute&&apf.isOpera?true:(options.autoroute||this.shouldAutoroute),httpUrl=autoroute?this["route-server"]:url; -var headers=[];function setRequestHeader(name,value){http.setRequestHeader(name,value); -}var errorFound=false;try{if(options.nocache){httpUrl=apf.getNoCacheUrl(httpUrl); +}else{_self.receive(id);}};}}var autoroute=this.autoroute&&apf.isOpera?true:(options.autoroute||this.shouldAutoroute),httpUrl=autoroute?this["route-server"]:url; +if(!options.hideLogMessage){apf.console.teleport(this.queue[id].log=new apf.teleportLog({id:id,tp:this,type:options.type,method:this.method||options.method||"GET",url:url,route:autoroute?httpUrl:"",data:new String(data&&data.xml?data.xml:data),start:new Date()})); +}var headers=[];function setRequestHeader(name,value){headers.push(name+": "+value); +http.setRequestHeader(name,value);}var errorFound=false;try{if(options.nocache){httpUrl=apf.getNoCacheUrl(httpUrl); }if(apf.config.queryAppend){httpUrl+=(httpUrl.indexOf("?")==-1?"?":"&")+apf.config.queryAppend; -}if(apf.hasHtml5XDomain&&httpUrl.match(/^http:\/\//)&&!new apf.url(httpUrl).isSameLocation()){throw new Error(apf.formatErrorString(0,this,"Communication error","Url: "+httpUrl+"\nReason: Same origin policy in effect")); -}http.open(this.method||options.method||"GET",httpUrl,async);if(options.username){setRequestHeader("Authorization","Basic "+apf.crypto.Base64.encode(options.username+":"+options.password)); +}try{if(apf.isGecko){netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); +}}catch(e){if(apf.hasHtml5XDomain&&httpUrl.match(/^http:\/\//)&&!new apf.url(httpUrl).isSameLocation()){throw new Error(apf.formatErrorString(0,this,"Communication error","Url: "+httpUrl+"\nReason: Same origin policy in effect")); +}}http.open(this.method||options.method||"GET",httpUrl,async);if(options.username){setRequestHeader("Authorization","Basic "+apf.crypto.Base64.encode(options.username+":"+options.password)); }setRequestHeader("X-Requested-With","XMLHttpRequest");if(!options.headers||!options.headers["Content-type"]){setRequestHeader("Content-type",options.contentType||this.contentType||(this.useXML||options.useXML?"text/xml":"text/plain")); }if(autoroute){setRequestHeader("X-Route-Request",url);setRequestHeader("X-Proxy-Request",url); setRequestHeader("X-Compress-Response","gzip");}if(binary){setRequestHeader("Cache-Control","no-cache"); setRequestHeader("X-File-Name",binary.filename);setRequestHeader("X-File-Size",binary.filesize); setRequestHeader("Content-Type","application/octet-stream");}}catch(e){errorFound=e.message; -}if(errorFound){var useOtherXH=false;if(!useOtherXH&&this.autoroute&&!autoroute){this.shouldAutoroute=true; -options.autoroute=true;return this.get(url,options);}if(!useOtherXH){var noClear=options.callback?options.callback(null,apf.ERROR,{userdata:options.userdata,http:http,url:url,tpModule:this,id:id,message:"Permission denied accessing remote resource: "+url+"\nMessage: "+errorFound}):false; +}if(errorFound){var useOtherXH=false;if(!useOtherXH&&this.autoroute&&!autoroute){if(!apf.isNot(id)){clearInterval(this.queue[id].timer); +}this.shouldAutoroute=true;options.autoroute=true;return this.get(url,options); +}if(!useOtherXH){var noClear=options.callback?options.callback(null,apf.ERROR,{userdata:options.userdata,http:http,url:url,tpModule:this,id:id,message:"Permission denied accessing remote resource: "+url+"\nMessage: "+errorFound}):false; if(!noClear){this.clearQueueItem(id);}return;}}if(this.$headerHook){this.$headerHook(http); }if(options.headers){for(var name in options.headers){setRequestHeader(name,options.headers[name]); -}}function handleError(){var msg=self.navigator&&self.navigator.onLine?"File or Resource not available "+url:"Browser is currently working offline"; -var state=self.navigator&&navigator.onLine?apf.ERROR:apf.TIMEOUT;var noClear=options.callback?options.callback(null,state,{userdata:options.userdata,http:http,url:url,tpModule:_self,id:id,message:msg}):false; +}}if(!options.hideLogMessage){this.queue[id].log.request(headers);}function handleError(){var msg=self.navigator&&self.navigator.onLine?"File or Resource not available "+url:"Browser is currently working offline"; +apf.console.warn(msg,"teleport");if(!options.hideLogMessage){_self.queue[id].log.response({end:new Date(),message:msg,http:http}); +}var state=self.navigator&&navigator.onLine?apf.ERROR:apf.TIMEOUT;var noClear=options.callback?options.callback(null,state,{userdata:options.userdata,http:http,url:url,tpModule:_self,id:id,message:msg}):false; if(!noClear){_self.clearQueueItem(id);}}function send(isLocal){var hasError;if(apf.isIE&&isLocal){var oldWinOnerror=window.onerror; window.onerror=function(){if(arguments.caller&&arguments.caller.callee==send){window.onerror=oldWinOnerror; return true;}else{window.onerror=oldWinOnerror;if(oldWinOnerror){return oldWinOnerror.apply(window,arguments); @@ -1628,9 +3661,10 @@ if(binary.multipart){http.setRequestHeader("Content-Type","multipart/form-data; multipartBlob+=dashdash+boundary+crlf+'Content-Disposition: form-data; name="'+(binary.filedataname||binary.filename)+'"; filename="'+binary.filename+'"'+crlf+"Content-Type: application/octet-stream"+crlf+crlf+data+crlf+dashdash+boundary+dashdash+crlf; multipartSize=multipartBlob.length-data.length;data=multipartBlob;}return{size:multipartSize,data:data}; }this.receive=function(id){if(!this.queue[id]){return false;}var qItem=this.queue[id],http=qItem.http,callback=qItem.callback; -if(self.navigator&&navigator.onLine===false&&(location.protocol!="file:"||qItem.url.indexOf("http://")>-1)){return false; +clearInterval(qItem.timer);if(self.navigator&&navigator.onLine===false&&(location.protocol!="file:"||qItem.url.indexOf("http://")>-1)){return false; }if(qItem.async){try{if(http.status){}}catch(e){var _self=this;return $setTimeout(function(){_self.receive(id); -},10);}}var errorMessage=[],extra={tpModule:this,http:http,status:http.status,url:qItem.url,callback:callback,id:id,retries:qItem.retries||0,userdata:qItem.options.userdata}; +},10);}}if(!qItem.options.hideLogMessage){apf.console.info("[HTTP] Receiving ["+id+"]"+(http.isCaching?"[cached]":"")+" from "+qItem.url,"teleport",http.responseText); +}var errorMessage=[],extra={end:new Date(),tpModule:this,http:http,status:http.status,url:qItem.url,callback:callback,id:id,retries:qItem.retries||0,userdata:qItem.options.userdata}; if(http.status>600){return this.$timeout(id);}extra.data=qItem.options.useJSON?eval("("+http.responseText+")"):http.responseText; if(http.status>=400&&http.status<600||http.status<10&&(http.status!=0||!apf.isIE&&!http.responseText)){if(http.status==401){var auth=apf.document.getElementsByTagNameNS(apf.ns.apf,"auth")[0]; if(auth){var wasDelayed=qItem.isAuthDelayed;qItem.isAuthDelayed=true;if(auth.authRequired(extra,wasDelayed)===true){return; @@ -1639,19 +3673,24 @@ if(auth){var wasDelayed=qItem.isAuthDelayed;qItem.isAuthDelayed=true;if(auth.aut }else{try{var xmlDoc=(http.responseXML&&http.responseXML.documentElement)?apf.xmlParseError(http.responseXML):apf.getXmlDom(http.responseText); if(!apf.supportNamespaces){xmlDoc.setProperty("SelectionLanguage","XPath");}extra.data=xmlDoc.documentElement; }catch(e){errorMessage.push("Received invalid XML\n\n"+e.message);}}}if(errorMessage.length){extra.message=errorMessage.join("\n"); -if(!callback||!callback(extra.data,apf.ERROR,extra)){this.clearQueueItem(id);}return; +if(qItem.log){qItem.log.response(extra);}if(!callback||!callback(extra.data,apf.ERROR,extra)){this.clearQueueItem(id); +}return;}if(qItem.options.caching){if(!this.cache[qItem.url]){this.cache[qItem.url]={}; +}this.cache[qItem.url][qItem.options.data]=http.responseText;}if(qItem.log){qItem.log.response(extra); }if(!callback||!callback(extra.data,apf.SUCCESS,extra)){this.clearQueueItem(id); }return extra.data;};this.$timeout=function(id){if(!this.queue[id]){return false; -}var qItem=this.queue[id],http=qItem.http;try{if(http.status){}}catch(e){var _self=this; +}var qItem=this.queue[id],http=qItem.http;clearInterval(qItem.timer);try{if(http.status){}}catch(e){var _self=this; return $setTimeout(function(){_self.$timeout(id);},10);}var callback=qItem.callback; -http.abort();var extra;var noClear=callback?callback(null,apf.TIMEOUT,extra={userdata:qItem.options.userdata,http:http,url:qItem.url,tpModule:this,id:id,message:"HTTP Call timed out",retries:qItem.retries||0}):false; -if(!noClear){this.clearQueueItem(id);}};this.retryTimeout=function(extra,state,amlNode,oError,maxRetries){if(state==apf.TIMEOUT&&extra.retries<(maxRetries||apf.maxHttpRetries)){return extra.tpModule.retry(extra.id); +http.abort();apf.console.info("HTTP Timeout ["+id+"]","teleport");var extra;var noClear=callback?callback(null,apf.TIMEOUT,extra={end:new Date(),userdata:qItem.options.userdata,http:http,url:qItem.url,tpModule:this,id:id,message:"HTTP Call timed out",retries:qItem.retries||0}):false; +if(qItem.log){qItem.log.response(extra);}if(!noClear){this.clearQueueItem(id);}}; +this.retryTimeout=function(extra,state,amlNode,oError,maxRetries){if(state==apf.TIMEOUT&&extra.retries<(maxRetries||apf.maxHttpRetries)){return extra.tpModule.retry(extra.id); }oError=oError||new Error(apf.formatErrorString(0,this,"Communication "+(state==apf.TIMEOUT?"timeout":"error"),"Url: "+extra.url+"\nInfo: "+extra.message)); if((amlNode||apf).dispatchEvent("error",apf.extend({error:oError,state:state,extra:extra,bubbles:true},extra))===false){return 2; -}};this.clearQueueItem=function(id){if(!this.queue[id]){return false;}if(apf.releaseHTTP&&!apf.isGecko){apf.releaseHTTP(this.queue[id].http); -}this.queue[id]=null;delete this.queue[id];return true;};this.retry=function(id){if(!this.queue[id]){return false; -}var qItem=this.queue[id];qItem.retries++;qItem.options.id=id;this.get(qItem.url,qItem.options); -return true;};this.cancel=function(id){if(id===null){id=this.queue.length-1;}if(!this.queue[id]){return false; +}};this.clearQueueItem=function(id){if(!this.queue[id]){return false;}clearInterval(this.queue[id].timer); +if(apf.releaseHTTP&&!apf.isGecko){apf.releaseHTTP(this.queue[id].http);}this.queue[id]=null; +delete this.queue[id];return true;};this.retry=function(id){if(!this.queue[id]){return false; +}var qItem=this.queue[id];clearInterval(qItem.timer);apf.console.info("[HTTP] Retrying request ["+id+"]","teleport"); +qItem.retries++;qItem.options.id=id;this.get(qItem.url,qItem.options);return true; +};this.cancel=function(id){if(id===null){id=this.queue.length-1;}if(!this.queue[id]){return false; }if(apf.isGecko){this.queue[id].http.abort();}this.clearQueueItem(id);};if(!this.$loadAml&&!this.instantiate&&!this.call){this.$loadAml=function(x){var receive=this["receive"]; for(var i=0,l=this.childNodes.length;i)/); +if(t.length<=1){return;}data=t[0]+t[1];qItem.received=t[2];if(qItem.options.useXML||this.useXML){if((data||"").replace(/^[\s\n\r]+|[\s\n\r]+$/g,"")==""){errorMessage.push("Received an empty XML document (0 bytes)"); +}else{try{var xmlDoc=apf.getXmlDom(data);if(!apf.supportNamespaces){xmlDoc.setProperty("SelectionLanguage","XPath"); +}extra.data=xmlDoc.documentElement;}catch(e){errorMessage.push("Received invalid XML\n\n"+e.message); +}}}if(errorMessage.length){extra.message=errorMessage.join("\n");if(callback){callback(extra.data,apf.ERROR,extra); +}return;}if(callback){callback(extra.data,apf.SUCCESS,extra);}return extra.data; +};this.$timeout=function(id){if(!this.pool[id]){return false;}var qItem=this.pool[id],socket=qItem.socket; +try{if(socket.status){}}catch(e){var _self=this;return $setTimeout(function(){_self.$timeout(id); +},10);}var callback=qItem.callback;socket.abort();apf.console.info("Socket Timeout ["+id+"]","teleport"); +var extra;var noClear=callback?callback(null,apf.TIMEOUT,extra={end:new Date(),userdata:qItem.options.userdata,socket:socket,url:qItem.url,tpModule:this,id:id,message:"HTTP Call timed out",retries:qItem.retries||0}):false; +};this.retryTimeout=function(extra,state,amlNode,oError,maxRetries){if(state==apf.TIMEOUT&&extra.retries<(maxRetries||apf.maxHttpRetries)){return extra.tpModule.retry(extra.id); +}oError=oError||new Error(apf.formatErrorString(0,this,"Communication "+(state==apf.TIMEOUT?"timeout":"error"),"Url: "+extra.url+"\nInfo: "+extra.message)); +if((amlNode||apf).dispatchEvent("error",apf.extend({error:oError,state:state,bubbles:true},extra))===false){return true; +}};this.clearQueueItem=function(id){return;};this.retry=function(id){if(!this.pool[id]){return false; +}var qItem=this.pool[id];apf.console.info("[Socket] Retrying request ["+id+"]","teleport"); +qItem.retries++;qItem.options.id=id;this.get(qItem.url,qItem.options);return true; +};this.cancel=function(id){if(id===null){id=this.pool.length-1;}if(!this.pool[id]){return false; +}};if(!this.$loadAml&&!this.instantiate&&!this.call){this.$loadAml=function(x){var receive=this["receive"]; +for(var i=0,l=this.childNodes.length;i]*>/,/ /g,/<\s*\/?\s*(?:\w+:\s*)[\w-]*[\s>\/]/g],XPATH="//@*[not(contains(local-name(), '.')) and not(translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = local-name())]"; this.parseFromString=function(xmlStr,mimeType,options){var xmlNode;if(this.caseInsensitive){var str=xmlStr.replace(RE[0],"").replace(RE[2],function(m){return m.toLowerCase(); });if(!this.supportNamespaces){str=str.replace(/xmlns\=\"[^"]*\"/g,"");}xmlNode=apf.getXmlDom(str,null,this.preserveWhiteSpace||apf.debug).documentElement; @@ -1700,8 +3813,11 @@ if(!--this.$callCount&&!options.delay){apf.queue.empty();}if(options.callback){o switch(nodeType){case 1:var id,prefix;if(xmlNode){if((namespaceURI=xmlNode.namespaceURI||apf.ns.xhtml)&&!(prefix=doc.$prefixes[namespaceURI])){doc.$prefixes[prefix=xmlNode.prefix||xmlNode.scopeName||""]=namespaceURI; doc.$namespaceURIs[namespaceURI]=prefix;if(!doc.namespaceURI&&!prefix){doc.namespaceURI=namespaceURI; doc.prefix=prefix;}}nodeName=xmlNode.baseName||xmlNode.localName||xmlNode.tagName.split(":").pop(); -}else{prefix=doc.$prefixes[namespaceURI]||"";}var els=apf.namespaces[namespaceURI].elements; -o=new (els[nodeName]||els["@default"])(null,nodeName);o.prefix=prefix||"";o.namespaceURI=namespaceURI; +}else{prefix=doc.$prefixes[namespaceURI]||"";}if(!namespaceURI){throw new Error("Missing namespace definition."); +}if(!apf.namespaces[namespaceURI]){if(this.allowAnyElement){namespaceURI=apf.ns.xhtml; +}else{throw new Error("Missing namespace handler for '"+namespaceURI+"'");}}var els=apf.namespaces[namespaceURI].elements; +if(!(els[nodeName]||els["@default"])){throw new Error("Missing element constructor: "+nodeName); +}o=new (els[nodeName]||els["@default"])(null,nodeName);o.prefix=prefix||"";o.namespaceURI=namespaceURI; o.tagName=prefix?prefix+":"+nodeName:nodeName;if(xmlNode){if(id=xmlNode.getAttribute("id")){o.$propHandlers.id.call(o,o.id=id); }var attr=xmlNode.attributes,n;for(var a,i=0,l=attr.length;i"));}});if(tagName){$init.call(this,tagName,apf.NODE_HIDDEN,struct); -}};(function(){this.nodeType=this.NODE_ELEMENT;this.canHaveChildren=true;this.$propHandlers={id:function(value){if(this.name==value){return; -}if(self[this.name]==this){self[this.name]=null;}if(!self[value]||!self[value].hasFeature){try{self[value]=this; -}catch(ex){}}apf.nameserver.register(this.localName,value,this);this.name=value; -}};this.$booleanProperties={};this.$inheritProperties={};this.$supportedProperties=[]; -this.getElementsByTagName=function(tagName,norecur){tagName=tagName.toLowerCase(); +}};(function(){this.nodeType=this.NODE_ELEMENT;this.canHaveChildren=true;this.$propHandlers={id:function(value){if(value=="apf"){throw new Error(apf.formatErrorString(0,this,"Setting Name of Element","Cannot set name of element to 'apf'")); +}if(this.name==value){return;}if(self[this.name]==this){self[this.name]=null;}if(!self[value]||!self[value].hasFeature){try{self[value]=this; +}catch(ex){var error=true;}}if(error&&value in self){apf.console.warn("trying to set a value in the global scope with a reserved name '"+value+"'.\nNothing wrong with that, except that you will not be able to reference\nthe object from the global scope in JS."); +}apf.nameserver.register(this.localName,value,this);this.name=value;}};this.$booleanProperties={}; +this.$inheritProperties={};this.$supportedProperties=[];this.getElementsByTagName=function(tagName,norecur){tagName=tagName.toLowerCase(); var node,i,l,nodes=this.childNodes,result=[];for(i=0,l=nodes.length;i=0;i--){var oItem=this.childNodes[i];if(oItem.destroy){oItem.destroy(true);}if(oItem.$ext!=this.$int){apf.destroyHtmlNode(oItem.$ext); +this.replaceMarkup=function(amlDefNode,options){apf.console.info("Remove all children from element"); +if(!options){options={};}if(!options.$intAML){options.$intAML=this.$aml;}if(!options.$int){options.$int=this.$int; +}options.clear=true;for(var i=this.childNodes.length-1;i>=0;i--){var oItem=this.childNodes[i]; +if(oItem.destroy){oItem.destroy(true);}if(oItem.$ext!=this.$int){apf.destroyHtmlNode(oItem.$ext); }}this.childNodes.length=0;this.$int.innerHTML="
loading...
"; -this.insertMarkup(amlDefNode,options);};this.insertMarkup=function(amlDefNode,options){var _self=this; +this.insertMarkup(amlDefNode,options);};this.insertMarkup=function(amlDefNode,options){apf.console.info("Loading sub markup from external source"); +if(typeof apf.offline!="undefined"&&!apf.offline.onLine){return false;}var _self=this; var include=new apf.XiInclude();if(amlDefNode.trim().charAt(0)=="<"){amlDefNode=apf.getXml(amlDefNode); }include.setAttribute("href",amlDefNode);if(options&&options.clear){include.setAttribute("clear",true); }include.options=options;include.callback=options&&options.callback||function(){_self.dispatchEvent("afteramlinserted",{src:amlDefNode}); @@ -1837,13 +3959,16 @@ for(i=0,l=nodes.length;i(charNode[refNode.nodeType]?refNode.nodeValue.length:refNode.childNodes.length)){return; +}if(charNode[this.startContainer.nodeType]){this.startContainer.removeEventListener("DOMCharacterDataModified",this.$domCharModS); +}else{this.startContainer.removeEventListener("DOMNodeInserted",this.$domNodeInsS); +this.startContainer.removeEventListener("DOMNodeRemoved",this.$domNodeRemS);}this.startContainer=refNode; +this.startOffset=offset;this.collapsed=this.startContainer==this.endContainer&&this.startOffset==this.endOffset; +if(charNode[refNode.nodeType]){refNode.addEventListener("DOMCharacterDataModified",this.$domCharModS); +}else{refNode.addEventListener("DOMNodeInserted",this.$domNodeInsS);refNode.addEventListener("DOMNodeRemoved",this.$domNodeRemS); +}if(!noEvent){this.dispatchEvent("update");}};this.setStartBefore=function(refNode){this.setStart(this.endContainer.parentNode,apf.getChildNumber(refNode)); +};this.setStartAfter=function(refNode){this.setStart(this.endContainer.parentNode,apf.getChildNumber(refNode)+1); +};this.setEnd=function(refNode,offset,noEvent){if(!refNode){return;}if(offset<0||offset>(charNode[refNode.nodeType]?refNode.nodeValue.length:refNode.childNodes.length)){return; +}if(charNode[this.endContainer.nodeType]){this.endContainer.removeEventListener("DOMCharacterDataModified",this.$domCharModE); +}else{this.endContainer.removeEventListener("DOMNodeInserted",this.$domNodeInsE); +this.endContainer.removeEventListener("DOMNodeRemoved",this.$domNodeRemE);}this.endContainer=refNode; +this.endOffset=offset;this.collapsed=this.startContainer==this.endContainer&&this.startOffset==this.endOffset; +if(charNode[refNode.nodeType]){refNode.addEventListener("DOMCharacterDataModified",this.$domCharModE); +}else{refNode.addEventListener("DOMNodeInserted",this.$domNodeInsE);refNode.addEventListener("DOMNodeRemoved",this.$domNodeRemE); +}if(!noEvent){this.dispatchEvent("update");}};this.setEndBefore=function(refNode){this.setEnd(this.endContainer.parentNode,apf.getChildNumber(refNode)); +};this.setEndAfter=function(refNode){this.setEnd(this.endContainer.parentNode,apf.getChildNumber(refNode)+1); +};this.collapse=function(toStart){if(toStart){this.setEnd(this.startContainer,this.startOffset,true); +}else{this.setStart(this.endContainer,this.endOffset,true);}this.dispatchEvent("update"); +};this.selectNode=function(refNode){this.setStart(refNode.parentNode,apf.getChildNumber(refNode),true); +this.setEnd(refNode.parentNode,this.startOffset+1);};this.selectNodeContents=function(refNode){this.setStart(refNode,0,true); +this.setEnd(refNode,refNode.childNodes.length);};this.$contents=function(clone){var s=this.startContainer,e=this.endContainer,cA=e.childNodes[this.endOffset],last,simple=s==e; +while(cA&&!apf.isChildOf(cA,s,true)){cA=(last=cA).parentNode;}if(!cA){return;}var collection=[]; +var node=s.childNodes[this.startOffset];var doc=this.startContainer.ownerDocument; +var frag=doc.createDocumentFragment();if(s!=e&&s!=cA){var pNode=s.cloneNode(false); +while(node.parentNode!=cA){pNode.appendChild(clone?node.cloneNode(true):node);if(!node.nextSibling){do{node=node.parentNode; +pNode=node.cloneNode(false).appendChild(pNode).parentNode;}while(!node.nextSibling); +if(node.parentNode==cA){break;}}node=node.nextSibling;}frag.appendChild(pNode); +}while(node!=last){node=node.nextSibling;frag.appendChild(clone?node.cloneNode(true):node); +}if(s!=e&&e!=cA){var pNode=e.cloneNode(false);var node=last.previousSibling||last.parentNode; +while(node.parentNode!=cA){pNode.appendChild(clone?node.cloneNode(true):node);if(!node.previousSibling){do{node=node.parentNode; +pNode=node.cloneNode(false).appendChild(pNode).parentNode;}while(!node.previousSibling); +if(node.parentNode==cA){break;}}node=node.previousSibling;}frag.appendChild(pNode); +}return frag;};this.compareBoundaryPoints=function(how,sourceRange){var d;switch(how){case this.START_TO_START:d=this.startOffset-sourceRange.startOffset; +break;case this.START_TO_END:d=this.startOffset-sourceRange.endOffset;break;case this.END_TO_START:d=this.endOffset-sourceRange.startOffset; +break;case this.END_TO_END:d=this.endOffset-sourceRange.endOffset;break;}return d<0?-1:(d>0?1:0); +};this.deleteContents=function(){this.$contents().destroy();this.collapse();};this.extractContents=function(){var frag=this.$contents(); +this.collapse();return frag;};this.cloneContents=function(){return this.$contents(true); +};this.insertNode=function(newNode){this.collapsed=false;};this.surroundContents=function(newParent){this.setStart(newParent,newParent.childNodes.length,true); +newParent.appendChild(this.$contents());this.setEnd(newParent,newParent.childNodes.length); +};this.cloneRange=function(){var range=new apf.AmlRange();range.setStart(this.startContainer,this.startOffset,true); +range.setEnd(this.endContainer,this.endOffset);return range;};this.detach=function(){this.startContainer=this.endContainer=null; +function detachError(){}for(var prop in this){if(typeof this[prop]=="function"&&this[prop]!=apf.Class.prototype[prop]){this[prop]=detachError; +}}this.$ownerDocument.removeEventListener("DOMNodeRemoved",this.$domNodeRemDoc); +if(this.startContainer){if(charNode[this.startContainer.nodeType]){this.startContainer.removeEventListener("DOMCharacterDataModified",this.$domCharModS); +}else{this.startContainer.removeEventListener("DOMNodeInserted",this.$domNodeInsS); +this.startContainer.removeEventListener("DOMNodeRemoved",this.$domNodeRemS);}if(charNode[this.endContainer.nodeType]){this.endContainer.removeEventListener("DOMCharacterDataModified",this.$domCharModE); +}else{this.endContainer.removeEventListener("DOMNodeInserted",this.$domNodeInsE); +this.endContainer.removeEventListener("DOMNodeRemoved",this.$domNodeRemE);}}};}).call(apf.AmlRange.prototype=new apf.Class()); apf.AmlSelection=function(doc){this.$init();this.$ownerDocument=doc;var _self=this; var monitor=false;this.$monitorRange=function(){apf.queue.add("selrange"+this.$uniqueId,function(){var range=_self.$ranges[0]; _self.anchorNode=range.startContainer;_self.anchorOffset=range.startOffset;range=_self.$ranges[_self.rangeCount-1]; @@ -1951,8 +4158,9 @@ range.detach();}var range;this.$ranges=[range=new apf.AmlRange(this.ownerDocumen range.addEventListener("update",this.$monitorRange);range.setStart(parentNode,offset); range.setEnd(parentNode,offset);this.rangeCount=1;this.focusNode=this.anchorNode=parentNode; this.anchorOffset=this.focusOffset=offset;if(!noEvent){this.dispatchEvent("update"); -}};this.collapseToStart=function(){var range=this.$ranges[0];this.collapse(range.startContainer,range.startOffset); -};this.collapseToEnd=function(){var range=this.$ranges[this.rangeCount-1];this.collapse(range.endContainer,range.endOffset); +}};this.collapseToStart=function(){if(!this.rangeCount){return;}var range=this.$ranges[0]; +this.collapse(range.startContainer,range.startOffset);};this.collapseToEnd=function(){if(!this.rangeCount){return; +}var range=this.$ranges[this.rangeCount-1];this.collapse(range.endContainer,range.endOffset); };this.selectAllChildren=function(parentNode){this.collapse(parentNode,0,true); var range=this.$ranges[0];range.selectNodeContents(parseNode);this.focusNode=this.anchorNode=parentNode; this.anchorOffset=0;this.focusOffset=range.endOffset;this.$update();};this.deleteFromDocument=function(){for(var i=0,l=this.$ranges.length; @@ -1986,7 +4194,8 @@ var _self=this;this.$de=function(e){_self.dispatchEvent(e.type,null,e);};};(func this.$xae=function(type,fn){this.$xoe.apply(this,arguments);if(excludedEvents[type]>(this.editable?0:1)||type.substr(0,5)=="prop."){return; }if(this.$ext){if(type.substr(0,2)=="on"){type=type.substr(2);}apf.addListener(this.$ext,type,this.$de); }};this.$xre=function(type,fn){apf.AmlElement.prototype.removeEventListener.apply(this,arguments); -if(this.$ext){apf.removeListener(this.$ext,type,this.$de);}};this.$handlePropSet=function(name,value,force,inherit){if(this.$booleanProperties[name]){value=apf.isTrue(value); +if(this.editable&&"contextmenu|keydown|keypress|keyup".indexOf(type)>-1){return; +}if(this.$ext){apf.removeListener(this.$ext,type,this.$de);}};this.$handlePropSet=function(name,value,force,inherit){if(this.$booleanProperties[name]){value=apf.isTrue(value); }this[name]=value;var handler=this.$propHandlers&&this.$propHandlers[name]||apf.GuiElement.propHandlers[name]; if(handler){handler.call(this,value,null,name);}else{if(this.$int&&(force||this.$amlLoaded)){this.$int.setAttribute(apf.isIE&&apf.isIE<8&&name=="class"?"className":name,value); }}};this.addEventListener("DOMNodeInsertedIntoDocument",function(e){var pHtmlNode; @@ -2001,11 +4210,12 @@ apf.Init.addConditional(function(){if(apf.isO3){return;}var prot=apf.XhtmlElemen prot.implement(apf.Anchoring);prot.$drawn=true;prot.$setLayout=apf.GuiElement.prototype.$setLayout; prot.addEventListener("DOMNodeInserted",function(e){if(e.currentTarget==this&&"vbox|hbox|table".indexOf(this.parentNode.localName)==-1){this.$setLayout(); }});},null,["interactive"]);apf.xhtml.setElement("@default",apf.XhtmlElement);apf.XhtmlBodyElement=function(struct,tagName){this.$init(tagName||"body",apf.NODE_VISIBLE,struct); -};(function(){this.addEventListener("DOMNodeInsertedIntoDocument",function(e){if(!this.ownerDocument.body){this.ownerDocument.body=this; +};(function(){this.$coreHtml=true;this.addEventListener("DOMNodeInsertedIntoDocument",function(e){if(!this.ownerDocument.body){this.ownerDocument.body=this; }this.$ext=this.$int=document.body;},true);}).call(apf.XhtmlBodyElement.prototype=new apf.AmlElement()); apf.Init.addConditional(function(){if(apf.isO3){return;}var prot=apf.XhtmlBodyElement.prototype; -},null,["interactive"]);apf.xhtml.setElement("body",apf.XhtmlBodyElement);apf.XhtmlHtmlElement=function(struct,tagName){this.$init(tagName||"html",apf.NODE_VISIBLE,struct); -this.$ext=document.documentElement;this.$ext.host=this;this.$int=document.body; +prot.implement(apf.ContentEditable);},null,["interactive"]);apf.xhtml.setElement("body",apf.XhtmlBodyElement); +apf.XhtmlHtmlElement=function(struct,tagName){this.$init(tagName||"html",apf.NODE_VISIBLE,struct); +this.$coreHtml=true;this.$ext=document.documentElement;this.$ext.host=this;this.$int=document.body; this.$tabList=[];this.$focussable=apf.KEYBOARD;this.focussable=true;this.visible=true; this.$isWindowContainer=true;this.implement(apf.Focussable);apf.window.$addFocus(this); this.addEventListener("DOMNodeInsertedIntoDocument",function(e){var i,l,n,a,c,attr=this.attributes,doc=this.ownerDocument; @@ -2088,8 +4298,91 @@ return true;};apf.xsd.checkType=function(type,xmlNode){var value=typeof xmlNode= if(type.indexOf(":")>-1){var split=type.split(":"),prefix=split[0],name=split[1],doc=apf.document,ns=doc.$prefixes[prefix]; if(prefix=="xsd"){ns="http://www.w3.org/2001/XMLSchema";}if(!ns){ns=doc.namespaceURI||apf.ns.xhtml; }var c=this.typeHandlers[ns];if(c&&c[name]){return c[name](value);}}if(this.custumTypeHandlers[type]){return this.custumTypeHandlers[type](value); -}else{}};apf.html5=new apf.AmlNamespace();apf.setNamespace("",apf.html5);apf.HTML5INPUT={email:"textbox",url:"textbox",password:"textbox",datetime:"spinner",date:"calendar",month:"spinner",week:"spinner",time:"spinner",number:"spinner",range:"slider",checkbox:"checkbox",radio:"radiobutton",file:"upload",submit:"submit",image:"submit",reset:"button"}; +}else{}};apf.XsdElement=function(struct,tagName){this.$init(true);this.addEventListener("DOMNodeInserted",function(){if(!this.parentNode.$compile){this.$compile(); +}});this.addEventListener("DOMNodeRemoved",function(){if(!this.parentNode.$compile){this.$compile(); +}});this.addEventListener("DOMNodeInsertedIntoDocument",function(e){if(this.parentNode.$compile){return; +}var _self=this;apf.queue.add("compile"+this.$uniqueId,function(){_self.$compile(); +});});};apf.XsdElement.prototype=new apf.AmlElement();apf.XsdElement.prototype.$recompile=function(stack){if(!this.$amlLoaded){return; +}if(this.parentNode.$recompile){this.parentNode.$recompile();}else{this.$compile(); +}};apf.XsdEnumeration=function(struct,tagName){this.$init(tagName||"enumeration",apf.NODE_HIDDEN,struct); +};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile(); +};this.$compile=function(stack){if(stack.enumDone){return;}stack.enumDone=true; +var k,l,re=[],nodes=this.parentNode.getElementsByTagNameNS(this.namespaceURI,"enumeration"); +for(k=0,l=nodes.length;k "+this.value+") return false;"); +};}).call(apf.XsdMaxInclusive.prototype=new apf.XsdElement());apf.xsd.setElement("maxinclusive",apf.XsdMaxInclusive); +apf.XsdMaxLength=function(struct,tagName){this.$init(tagName||"maxlength",apf.NODE_HIDDEN,struct); +};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile(); +};this.$compile=function(stack){stack.push("if (value.length > "+this.value+") return false;"); +};}).call(apf.XsdMaxLength.prototype=new apf.XsdElement());apf.xsd.setElement("maxlength",apf.XsdMaxLength); +apf.XsdMaxScale=function(struct,tagName){this.$init(tagName||"maxscale",apf.NODE_HIDDEN,struct); +};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile(); +};this.$compile=function(stack){};}).call(apf.XsdMaxScale.prototype=new apf.XsdElement()); +apf.xsd.setElement("maxscale",apf.XsdMaxScale);apf.XsdMinExclusive=function(struct,tagName){this.$init(tagName||"minexclusive",apf.NODE_HIDDEN,struct); +};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile(); +};this.$compile=function(stack){stack.push("if (parseFloat(value) => "+this.value+") return false;"); +};}).call(apf.XsdMinExclusive.prototype=new apf.XsdElement());apf.xsd.setElement("minexclusive",apf.XsdMinExclusive); +apf.XsdMinInclusive=function(struct,tagName){this.$init(tagName||"mininclusive",apf.NODE_HIDDEN,struct); +};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile(); +};this.$compile=function(stack){stack.push("if (parseFloat(value) < "+this.value+") return false;"); +};}).call(apf.XsdMinInclusive.prototype=new apf.XsdElement());apf.xsd.setElement("mininclusive",apf.XsdMinInclusive); +apf.XsdMinLength=function(struct,tagName){this.$init(tagName||"minlength",apf.NODE_HIDDEN,struct); +};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile(); +};this.$compile=function(stack){stack.push("if (value.length < "+this.value+") return false;"); +};}).call(apf.XsdMinLength.prototype=new apf.XsdElement());apf.xsd.setElement("minlength",apf.XsdMinLength); +apf.XsdMinScale=function(struct,tagName){this.$init(tagName||"minscale",apf.NODE_HIDDEN,struct); +};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile(); +};this.$compile=function(stack){};}).call(apf.XsdMinScale.prototype=new apf.XsdElement()); +apf.xsd.setElement("minscale",apf.XsdMinScale);apf.XsdPattern=function(struct,tagName){this.$init(tagName||"pattern",apf.NODE_HIDDEN,struct); +};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile(); +};this.$compile=function(stack){stack.push("if (!/^"+this.value.replace(/(\/|\^|\$)/g,"\\$1")+"$/.test(value)) return false;"); +};}).call(apf.XsdPattern.prototype=new apf.XsdElement());apf.xsd.setElement("pattern",apf.XsdPattern); +apf.XsdRestriction=function(struct,tagName){this.$init(tagName||"restriction",apf.NODE_HIDDEN,struct); +};(function(){this.$propHandlers.base=function(){this.parentNode.$recompile();}; +this.$compile=function(stack){stack.push("if (!apf.xsd.matchType(value, '"+this.base+"')) return false;"); +var i,l,node,nodes=this.childNodes;for(i=0,l=nodes.length;i]*>/,"").replace(/^[\r\n\s]*/,""); if(!apf.supportNamespaces){xmlString=xmlString.replace(/xmlns\=\"[^"]*\"/g,""); }if(xmlString.indexOf(""+xmlString+""; }var xmlNode=apf.getXml(xmlString,null,true);if(!xmlNode){throw new Error(apf.formatErrorString(0,null,"Loading include","Could not parse include file. Maybe the file does not exist?",xmlNode)); -}xmlNode.setAttribute("filename",extra.url);finish.call(_self,xmlNode);},async:true,ignoreOffline:true})); -}}).call(apf.XiInclude.prototype=new apf.AmlElement());apf.__LIVEEDIT__=1<<23;apf.__ANCHORING__=1<<13; -apf.Anchoring=function(){this.$regbase=this.$regbase|apf.__ANCHORING__;this.$anchors=[]; -var VERTICAL=1;var HORIZONTAL=2;this.$updateQueue=0;this.$inited=this.$parsed=this.$anchoringEnabled=false; +}xmlNode.setAttribute("filename",extra.url);apf.console.info("Loading of "+xmlNode[apf.TAGNAME].toLowerCase()+" include done from file: "+extra.url); +finish.call(_self,xmlNode);},async:true,ignoreOffline:true}));}}).call(apf.XiInclude.prototype=new apf.AmlElement()); +apf.runXslt=function(){apf.XSLTProcessor=function(){this.templates={};this.p={"value-of":function(context,xslNode,childStack,result){var value,xmlNode=apf.XPath.selectNodes(xslNode.getAttribute("select"),context)[0]; +if(!xmlNode){value="";}else{if(xmlNode.nodeType==1){value=xmlNode.firstChild?xmlNode.firstChild.nodeValue:""; +}else{value=typeof xmlNode=="object"?xmlNode.nodeValue:xmlNode;}}result.appendChild(this.xmlDoc.createTextNode(value)); +},"copy-of":function(context,xslNode,childStack,result){var xmlNode=apf.XPath.selectNodes(xslNode.getAttribute("select"),context)[0]; +if(xmlNode){result.appendChild(apf.canImportNode?result.ownerDocument.importNode(xmlNode,true):xmlNode.cloneNode(true)); +}},"if":function(context,xslNode,childStack,result){if(apf.XPath.selectNodes(xslNode.getAttribute("test"),context)[0]){this.parseChildren(context,xslNode,childStack,result); +}},"for-each":function(context,xslNode,childStack,result){var i,l,nodes=apf.XPath.selectNodes(xslNode.getAttribute("select"),context); +for(i=0,l=nodes.length;i=0;i--){if(nodes[i].nodeType==3||nodes[i].nodeType==4){continue; +}if(!nodes[i].nodeType==1){continue;}var n=nodes[i];for(tName in this.templates){if(tName=="/"){continue; +}t=this.templates[tName];var snodes=n.selectNodes("self::"+tName);for(var j=snodes.length-1; +j>=0;j--){var s=snodes[j];p=s.parentNode;this.parseChildren(s,t[0],t[1],nres);if(nres.childNodes){for(k=nres.childNodes.length-1; +k>=0;k--){p.insertBefore(nres.childNodes[k],s);}}p.removeChild(s);}}if(n.parentNode){p=n.parentNode; +this.p["apply-templates"].call(this,n,xslNode,childStack,nres);if(nres.childNodes){for(k=nres.childNodes.length-1; +k>=0;k--){p.insertBefore(nres.childNodes[k],n);}}p.removeChild(n);}}for(i=ncontext.childNodes.length-1; +i>=0;i--){result.insertBefore(ncontext.childNodes[i],result.firstChild);}}}}},cache:{},"import":function(context,xslNode,childStack,result){var file=xslNode.getAttribute("href"); +if(!this.cache[file]){var data=apf.oHttp.get(file);this.cache[file]=data;}},include:function(context,xslNode,childStack,result){},when:function(){},otherwise:function(){},"copy-clone":function(context,xslNode,childStack,result){result=result.appendChild(apf.canImportNode?result.ownerDocument.importNode(xslNode,false):xslNode.cloneNode(false)); +if(result.nodeType==1){for(var value,i=0,l=result.attributes.length;i=0;i--){if((nodes[i].className||"").indexOf("liveEdit")>-1){oNode=nodes[i]; +break;}}}createEditor.call(this,oNode||(this.$tabStack||initTabStack.call(this))[0]); +if(this.$activeNode){this.$activeNode.focus();this.$selection.selectNode(this.$activeNode); +this.$selection.collapse();try{this.$activeDocument.execCommand("SelectAll",false,true); +}catch(e){}}}return;}if(code==13){isDone=e.ctrlKey||(apf.isMac&&e.metaKey);if(!isDone){isDone=!apf.isTrue(this.$activeNode.getAttribute("multiline")); +}e.returnValue=true;}this.$visualFocus();if(code==9||isDone){if(!this.$tabStack){initTabStack.call(this); +}var idx,bShift=e.shiftKey;oNode=this.$activeNode;removeEditor.call(this,this.$activeNode,true)||initTabStack.call(this)[this.$activeIndex]; +oNode=this.$tabStack[this.$activeIndex+(bShift?-1:1)];if(oNode){createEditor.call(this,oNode); +if(this.$lastEditor){this.$lastEditor[0].focus();}else{if(oNode.parentNode){oNode.focus(); +try{this.$activeDocument.execCommand("SelectAll",false,true);}catch(e){}}}found=true; +}}else{if(code==27){removeEditor.call(this);found=true;}else{if(apf.isIE&&e.ctrlKey&&commandKeys[code]){found=true; +}}}if(!e.ctrlKey&&!e.altKey&&!e.metaKey&&(code<112||code>122)&&(code<33&&code>31||code>42||code==8||code==13)){if(this.realtime&&this.$changeTimer===null&&this.$bStandalone){var _self=this; +this.$changeTimer=$setTimeout(function(){clearTimeout(_self.$changeTimer);_self.change(_self.getValue()); +_self.$changeTimer=null;},200);}if(apf.w3cRange&&!this.$selection.isCollapsed()&&apf.isCharacter(code)){if(this.$activeNode.innerHTML.trim()!=""){this.$selection.remove(); +}}}if(found){return apf.stopEvent(e);}else{if(this.$activeNode){e.returnValue=-1; +}}}function createEditor(oHtml){if(!oHtml||oHtml.nodeType!=1||this.$activeNode==oHtml||!this.xmlRoot){return; +}var _self=this;var hasRule=getOptions(oHtml);var rule=hasRule&&apf.unserialize(hasRule.replace(/"/g,'"').unescapeHTML())||{}; +oHtml.setAttribute("multiline",rule.multiline||"false");if(!this.$selection){this.$selection=new apf.selection(); +}if(this.$activeNode){var lastPos=initTabStack.call(this).indexOf(oHtml);removeEditor.call(this,this.$activeNode,true); +oHtml=initTabStack.call(this)[lastPos];$setTimeout(function(){oHtml.focus();},10); +}if(this.hasFocus&&!this.hasFocus()){this.$skipFocusOnce=true;}this.$activeNode=oHtml; +this.$activeIndex=(this.$tabStack||initTabStack.call(this)).indexOf(oHtml);apf.setStyleClass(oHtml,"liveEditActive",["liveEditOver","liveEditInitial"]); +if(oHtml.innerHTML==rule.initial){oHtml.innerHTML="";}this.$lastValue=oHtml.innerHTML; +var handler=this.$editors[rule.editor||"default"]||this.$editors.custom;handler.create.call(this,oHtml,rule,getXpath(oHtml)); +if(apf.hasFocusBug){apf.sanitizeTextbox(oHtml);}this.dispatchEvent("$createEditor",rule); +}function getXpath(node){return node.getAttribute("xpath").replace(/\\([\[\{\]\}])/g,"$1"); +}function getOptions(node){return(node.getAttribute("options")||"").replace(/\\([\[\{\]\}])/g,"$1"); +}function removeEditor(oHtml,bProcess,callback){if(!oHtml){oHtml=this.$activeNode; +}if(!oHtml||oHtml.nodeType!=1){return false;}var xpath=getXpath(oHtml),xmlNode=this.xmlRoot.ownerDocument.selectSingleNode(xpath),hasRule=getOptions(oHtml),rule=hasRule&&apf.unserialize(hasRule.replace(/"/g,'"').unescapeHTML())||{}; +this.$activeNode=null;apf.setStyleClass(oHtml,null,["liveEditOver","liveEditActive"]); +this.$selection.collapse(true);var handler=this.$editors[rule.editor||"default"]||this.$editors.custom; +var execChange=handler.remove.call(this,oHtml,rule,xpath);if(execChange!==false){if(!bProcess||this.$lastValue&&oHtml.innerHTML.toLowerCase().replace(/[\r\n]/g,"")==(this.$lastValue.dataType==apf.ARRAY?this.$lastValue[0]:this.$lastValue).toLowerCase().replace(/[\r\n]/g,"")){oHtml.innerHTML=this.$lastValue.dataType==apf.ARRAY?this.$lastValue[1]:this.$lastValue; +}else{if(apf.queryValue(this.xmlRoot.ownerDocument,xpath)!=oHtml.innerHTML){rule.htmlNode=oHtml; +var res=this.getValue(oHtml);var valid;if(this.validityState){this.validityState.$reset(); +}if(hasRule){apf.validator.compile(rule).call(this,res,false,this.validityState||(this.validityState=new apf.validator.validityState())); +this.invalidmsg=valid?"":rule.invalidmsg||"";valid=this.validityState.valid;if(!valid){this.validityState.$errorHtml=oHtml; +this.dispatchEvent("invalid",this.validityState);this.setError();}else{this.clearError(); +}}if(valid!==false){this.$executeAction("setValueByXpath",[this.xmlRoot,res,xpath],"setValueByXpath",xmlNode); +}}}if(!oHtml.innerHTML&&rule.initial){oHtml.innerHTML=rule.initial;apf.setStyleClass(oHtml,"liveEditInitial"); +}}if(callback){$setTimeout(callback);}this.dispatchEvent("$removeEditor",rule); +}this.$editors={"default":{create:function(oHtml,rule){this.getValue=function(){var html=oHtml.innerHTML.replace(//g,"\n"); +if(apf.isIE){html=html.replace(/]*>/gi,"").replace(/<\/P>/g,"").replace(/<\/p>/g,"\n"); +}return apf.html_entity_decode(html);};if(apf.hasContentEditable){oHtml.contentEditable=true; +}else{document.body.setAttribute("spellcheck","false");document.designMode="on"; +}if(apf.isGecko){try{document.execCommand("insertBrOnReturn",false,true);}catch(e){}}},remove:function(oHtml,rule){oHtml.blur(); +if(apf.hasContentEditable){oHtml.contentEditable=false;}else{document.designMode="off"; +}}},custom:{create:function(oHtml,rule,xpath){if(this.$isWindowContainer!=-1){this.$isWindowContainer=-1; +apf.window.$removeFocus(this);apf.window.$addFocus(this,this.tabindex);}delete this.getValue; +oHtml.innerHTML="";var editParent=oHtml;var oEditor,editor=rule.editor;if(editor.charAt(0)=="<"){}else{if(self[editor]){oEditor=self[editor]; +oHtml.appendChild(oEditor.$ext);}else{if(apf.namespaces[apf.ns.aml].elements[editor]){var cacheId=apf.serialize(rule); +if(!this.$editorCache){this.$editorCache={};}if(!this.$editorCache[cacheId]){if(!this.id){apf.setReference(this.id=(this.localName||"liveedit")+String(this.$uniqueId),this); +}var _self=this;var constr=apf.namespaces[apf.ns.aml].elements[editor];var isTextbox="textarea|textbox|secret".indexOf(editor)>-1; +var info=apf.extend({htmlNode:editParent,style:"position:relative;",value:"[{"+this.id+".root}::"+xpath+"]",focussable:false,realtime:"{"+this.id+".realtime}",onbeforeselect:function(){_self.$skipChange=true; +},onafterselect:function(){delete _self.$skipChange;},onkeydown:function(e){keydownHandler.call(_self,e); +}},rule);if(info.initial){info["initial-message"]=info.initial;delete info.initial; +}if(isTextbox){info.focusselect=true;info.onkeydown=function(e){if(e.keyCode==13){this.change(this.getValue()); +}};}else{if(editor=="checkbox"&&!info.values){info.values="true|false";}}oEditor=this.$editorCache[cacheId]=new constr(info); +oEditor.parentNode=this;oEditor.$focusParent=this;oEditor.setAttribute("focussable","true"); +oEditor.$parentId=editParent.getAttribute("id");oEditor.$parentRsz=editParent.onresize; +oEditor.$executeAction=function(atAction,args,action,xmlNode,noevent,contextNode,multiple){if(atAction=="setAttribute"&&!args[2]){atAction="removeAttribute"; +}this.parentNode.$executeAction.call(this.parentNode,atAction,args,action,xmlNode,noevent,contextNode,multiple); +};}else{oEditor=this.$editorCache[cacheId];oEditor.setAttribute("value","[{"+this.id+".root}::"+xpath+"]"); +oEditor.setProperty("visible",true);if(oEditor.$ext.parentNode&&oEditor.$ext.parentNode.nodeType==1&&!apf.hasSingleResizeEvent){if(!oEditor.$parentRsz){oEditor.$parentRsz=oEditor.$ext.parentNode.onresize; +}oEditor.$ext.parentNode.removeAttribute("id");delete oEditor.$ext.parentNode.onresize; +}editParent.appendChild(oEditor.$ext);if(editParent.$parentId){editParent.setAttribute("id",editParent.$parentId); +}if(oEditor.$parentRsz&&!apf.hasSingleResizeEvent){editParent.onresize=oEditor.$parentRsz; +editParent.onresize();}}}else{throw new Error("Unkown editor: "+editor);}}}this.$lastEditor=[oEditor]; +},remove:function(oHtml,rule,xpath){var el=this.$lastEditor[0].$ext;if(el.parentNode){el.parentNode.removeChild(el); +}delete this.$lastEditor;oHtml.innerHTML=apf.queryValue(this.xmlRoot.ownerDocument,xpath); +this.focus();return false;}}};this.isValid=function(checkRequired){return true; +};function initTabStack(){this.$tabStack=[];var aNodes=this.$ext.getElementsByTagName("*"); +for(var i=0,l=aNodes.length;i\?@\[\\\]\^_\{\|\}\~]+/g; +this.$supportedProperties.push("state","plugins","language");this.$propHandlers.state=function(value){this.state=parseInt(value); +var _self=this;$setTimeout(function(){_self.$notifyAllButtons(value);if(_self.$pluginsActive=="code"){_self.$notifyButton("code",apf.SELECTED); +}});};this.$propHandlers.plugins=function(value){this.$pluginsOn=value&&value.splitSafe(",")||null; +if(this.$pluginsOn&&this.$pluginsOn.length){for(var i=0,l=this.$pluginsOn.length; +i/g,function(m,tag){return !disallowed[tag]?m:""; +});if(apf.isIE){var htmlNode=this.$selection.setContent("
"+c+"
");this.$selection.selectNode(htmlNode); +htmlNode.removeNode(false);return;}else{this.$selection.setContent(c);}}this.$activeDocument.execCommand(name,false,param); +name=name.toLowerCase();var bNoSel=(name=="selectall");if(apf.isIE){if((name=="insertunorderedlist"||name=="insertorderedlist")&&this.$queryCommandState(name)==apf.OFF){bNoSel=true; +}else{if(name=="outdent"){bNoSel=true;if(this.$plugins.bullist&&this.$plugins.numlist){if(this.$plugins.bullist.queryState(this)!=apf.OFF&&this.$plugins.numlist.queryState(this)!=apf.OFF){bNoSel=false; +}}var oNode=this.$selection.getSelectedNode();if(bNoSel&&oNode&&oNode.tagName=="BLOCKQUOTE"){bNoSel=false; +}}}if(bNoSel){var el=this.$bStandalone?this.$activeDocument.body:this.$activeNode; +el.innerHTML=apf.htmlCleaner.prepare(el.innerHTML);this.$controlAgentBehavior(el); +}var r=this.$selection.getRange();if(r){r.scrollIntoView();}}this.$notifyAllButtons(); +if(this.$bStandalone){this.change(this.getValue());}var _self=this;$setTimeout(function(){if(!bNoSel){_self.$selection.set(); +}if(apf.isIE){_self.focus();$setTimeout(function(){_self.$visualFocus();});}else{_self.$visualFocus(); +}_self.dispatchEvent("execcommand",{name:name,param:param});});};this.$addPlugin=function(sPlugin){if(this.$plugins[sPlugin]){return this.$plugins[sPlugin]; +}if(!apf.LiveEdit.plugin[sPlugin]){return null;}var plugin=new apf.LiveEdit.plugin[sPlugin](sPlugin); +this.$plugins[plugin.name]=plugin;if(plugin.type){if(!this.$pluginsTypes[plugin.type]){this.$pluginsTypes[plugin.type]=[]; +}this.$pluginsTypes[plugin.type].push(plugin);}if(plugin.subType){if(!this.$pluginsTypes[plugin.subType]){this.$pluginsTypes[plugin.subType]=[]; +}this.$pluginsTypes[plugin.subType].push(plugin);}if(plugin.hook){plugin.hook=plugin.hook.toLowerCase(); +if(!this.$pluginsHooks[plugin.hook]){this.$pluginsHooks[plugin.hook]=[];}this.$pluginsHooks[plugin.hook].push(plugin); +}if(typeof plugin.keyBinding=="string"){plugin.keyBinding={meta:(plugin.keyBinding.indexOf("meta")>-1),control:(plugin.keyBinding.indexOf("ctrl")>-1),alt:(plugin.keyBinding.indexOf("alt")>-1),shift:(plugin.keyBinding.indexOf("shift")>-1),key:plugin.keyBinding.charAt(plugin.keyBinding.length-1).toLowerCase()}; +plugin.keyHash=createKeyHash(plugin.keyBinding);if(!this.$pluginsKeys[plugin.keyHash]){this.$pluginsKeys[plugin.keyHash]=[]; +}this.$pluginsKeys[plugin.keyHash].push(plugin);}return plugin;};this.$notifyPlugin=function(name,hook){var item=this.$plugins[name]; +if(item&&item.hook==hook&&!item.busy){return item.execute(this,arguments);}return null; +};this.$notifyAllPlugins=function(hook,e){var res=[];if(!this.$pluginsHooks){return res; +}var coll=this.$pluginsHooks[hook];for(var i in coll){if(!coll[i].busy&&coll[i].execute){res.push(coll[i].execute(this,e)); +}}return res;};this.$notifyKeyBindings=function(keyMap){var hash=createKeyHash(keyMap); +if(!this.$pluginsKeys[hash]||!this.$pluginsKeys[hash].length){return false;}var coll=this.$pluginsKeys[hash]; +for(var i=0,j=coll.length;i=0;i--){nodes[i].setAttribute("unselectable","On");}}};var wasVisible; +this.$editors.richtext={create:function(oHtml,rule){this.getValue=function(){return apf.htmlCleaner.parse(oHtml.innerHTML); +};oHtml.setAttribute("richtext","true");if(apf.isGecko){try{document.execCommand("insertBrOnReturn",false,true); +document.execCommand("enableObjectResizing",false,false);document.execCommand("enableInlineTableEditing",false,false); +}catch(ex){}}if(!this.$docklet){this.$editable();}if(this.$docklet){this.$docklet.show(); +var pos=apf.getAbsolutePosition(oHtml);var w=this.$docklet.$ext.offsetWidth;var h=this.$docklet.$ext.offsetHeight; +if(pos[0]+oHtml.offsetWidth+w+5>apf.getWindowWidth()){pos[0]=apf.getWindowWidth()-w-5; +}else{pos[0]+=oHtml.offsetWidth+5;}if(pos[1]-h-5<0){if(pos[1]+oHtml.offsetHeight+5+h]*>/gi,"").replace(/<\/P>/g,"").replace(/<\/p>/g,"

")); +if(this.$lastValue[1]!=this.$lastValue[0]){var obm=this.$selection.getBookmark(); +oHtml.innerHTML=this.$lastValue[0];this.$controlAgentBehavior(oHtml);this.$selection.moveToBookmark(obm); +}this.addEventListener("keydown",keydownHandler,true);this.addEventListener("keyup",keyupHandler,true); +},remove:function(oHtml,rule){oHtml.blur();if(apf.hasContentEditable){oHtml.contentEditable=false; +}else{document.designMode="off";}oHtml.setAttribute("richtext","false");this.removeEventListener("keydown",keydownHandler,true); +this.removeEventListener("keyup",keyupHandler,true);}};this.addEventListener("$createEditor",function(e){if(e.editor!="richtext"&&this.$docklet){setTimeout(function(){wasVisible=false; +});this.$docklet.hide();}});this.addEventListener("$removeEditor",function(e){if(e.editor=="richtext"&&this.$docklet){setTimeout(function(){wasVisible=false; +});this.$docklet.hide();}});this.$editable=function(callback){if(this.getAttribute("plugins")){this.$propHandlers.plugins.call(this,this.getAttribute("plugins")); +}if(this.getAttribute("language")){this.$propHandlers.language.call(this,this.getAttribute("language")); +}if(!this.$ext){this.$docklet=this;this.$bStandalone=true;this.$ext=this.$getExternal("main",null,function(oExt){var o=this.$getLayoutNode("main","toolbar"); +this.$drawToolbars(o);});this.$toolbar=this.$getLayoutNode("main","toolbar",this.$ext); +this.addEventListener("keydown",keydownHandler,true);this.addEventListener("keyup",keyupHandler,true); +}else{if(!this.$docklet&&!(apf.LiveEdit.toolwin=this.$docklet)){var _self=this; +this.$docklet=apf.LiveEdit.toolwin=new apf.modalwindow({htmlNode:document.body,skinset:apf.getInheritedAttribute(this.parentNode,"skinset"),buttons:"",title:"Format",icon:"application.png",resizable:false,draggable:true,focussable:true,modal:false,left:500,top:100,width:275,zindex:100000,onfocus:function(){_self.focus(); +}},"toolwindow");var aNodes=this.$docklet.$ext.getElementsByTagName("div");for(var j=0,l=aNodes.length; +j=0;i--){item=btns[i].getAttribute("type");if(!item){continue;}this.$buttons[item]=btns[i]; +plugin=this.$plugins[item];if(!plugin){continue;}plugin.buttonNode=btns[i];if(plugin.init){plugin.init(this); +}}}};this.$getPluginOption=function(node){return this.$docklet.$getOption(node); +};this.$showPopup=function(oPlugin,sCacheId,oRef,iWidth,iHeight){if(apf.popup.last&&apf.popup.last!=sCacheId){var o=apf.lookup(apf.popup.last); +if(o){o.state=apf.OFF;this.$notifyPlugin(o.name,o.state);}}this.$selection.set(); +if(this.$visualFocus){this.$visualFocus();}oPlugin.state=apf.ON;this.$notifyPlugin(oPlugin.name,apf.ON); +if(apf.popup.isShowing(sCacheId)){return;}$setTimeout(function(){apf.popup.show(sCacheId,{x:0,y:22,animate:false,ref:oRef,width:iWidth,height:iHeight,callback:function(oPopup){if(oPopup.onkeydown){return; +}oPopup.onkeydown=function(e){e=e||window.event;var key=e.which||e.keyCode;if(key==13&&typeof oPlugin.submit=="function"){return oPlugin.submit(new apf.AbstractEvent(e)); +}};}});});};this.$translate=function(key,bIsPlugin){if((!bIsPlugin&&!apf.LiveEdit.i18n[this.language][key])||(bIsPlugin&&!apf.LiveEdit.i18n[this.language]["plugins"][key])){apf.console.error("Translation does not exist"+(bIsPlugin?" for plugin":"")+": "+key); +}return bIsPlugin?apf.LiveEdit.i18n[this.language]["plugins"][key]:apf.LiveEdit.i18n[this.language][key]; +};this.$insertHtml=function(html,bNoParse,bNoFocus){if(!bNoFocus){this.$selection.set(); +}this.$visualFocus(true);html=bNoParse?html:apf.htmlCleaner.prepare(html);this.$selection.setContent(html,true); +if(this.$bStandalone){this.change(this.getValue());}if(!bNoFocus){this.$restoreFocus(); +}};this.$paste=function(e){var _self=this;$setTimeout(function(){var s=_self.$activeDocument.body.innerHTML; +if(s.match(/mso[a-zA-Z]+/i)){var o=_self.$plugins.pasteword;if(o){_self.$propHandlers.value.call(_self,o.parse(s)); +}}if(_self.realtime){_self.change(_self.getValue());}});};this.$controlAgentBehavior=function(oParent){if(apf.isGecko){var oNode; +while(oParent.childNodes.length){oNode=oParent.firstChild;if(oNode.nodeType==1){if(oNode.nodeName=="BR"&&oNode.getAttribute("_moz_editor_bogus_node")=="TRUE"){this.$selection.selectNode(oNode); +this.$selection.remove();this.$selection.collapse(false);break;}}oParent=oNode; +}}else{if(apf.isWebkit){this.$activeDocument.designMode="on";}else{if(apf.isIE){var s,aLinks=oParent.getElementsByTagName("a"); +for(var i=0,j=aLinks.length;i'); +this.editor.$selection.collapse(false);};this.createPanelBody=function(){panelBody=document.body.appendChild(document.createElement("div")); +panelBody.className="editor_popup";panelBody.style.display="none";var idName="editor_"+this.$uniqueId+"_anchor_url",idButton="editor_"+this.$uniqueId+"_anchor_button"; +panelBody.innerHTML='
'; +new apf.toolbar({htmlNode:document.getElementById(idButton),skinset:apf.getInheritedAttribute(this.editor.parentNode,"skinset"),childNodes:[new apf.bar({childNodes:[new apf.button({caption:this.editor.$translate("insert"),onclick:"apf.lookup("+this.$uniqueId+").submit(event)"})]})]}); +this.oName=document.getElementById(idName);apf.sanitizeTextbox(this.oName);return panelBody; +};this.destroy=function(){panelBody=this.editor=this.oName=null;delete panelBody; +delete this.editor;delete this.oName;};});apf.LiveEdit.plugin("blockquote",function(){this.name="blockquote"; +this.icon="blockquote";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON; +this.hook="ontoolbar";this.keyBinding="ctrl+shift+b";this.buttonBuilt=false;this.state=apf.OFF; +this.execute=function(editor){editor.$execCommand("FormatBlock","BLOCKQUOTE");editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +};this.queryState=function(editor){return editor.$queryCommandState("FormatBlock"); +};});apf.LiveEdit.plugin("charmap",function(){this.name="charmap";this.icon="charmap"; +this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.buttonNode=null; +this.state=apf.OFF;this.colspan=20;var panelBody;this.init=function(editor,btn){this.buttonNode.className=this.buttonNode.className+" dropdown_small"; +var oArrow=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]); +oArrow.className="selectarrow";};this.execute=function(editor){if(!panelBody){this.editor=editor; +apf.popup.setContent(this.$uniqueId,this.createPanelBody());}editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,apf.isIE6?469:466,318); +return{id:this.name,action:null};};this.queryState=function(){return this.state; +};var chars=["!",""","#","$","%","&","\\'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","Œ","œ","Š","š","Ÿ","ƒ","ˆ","˜","Α","Β","Γ","Δ","Ε","Ζ","Η","Θ","Ι","Κ","Λ","Μ","Ν","Ξ","Ο","Π","Ρ","Σ","Τ","Υ","Φ","Χ","Ψ","Ω","α","β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","ς","σ","τ","υ","φ","χ","ψ","ω","ϑ","ϒ","ϖ"," ","–","—","‘","’","‚","“","”","„","†","‡","•","…","‰","′","″","‹","›","‾","⁄","€","ℑ","℘","ℜ","™","ℵ","←","↑","→","↓","↔","↵","⇐","⇑","⇒","⇓","⇔","∀","∂","∃","∅","∇","∈","∉","∋","∏","∑","−","∗","√","∝","∞","∠","∧","∨","∩","∪","∫","∴","∼","≅","≈","≠","≡","≤","≥","⊂","⊃","⊄","⊆","⊇","⊕","⊗","⊥","⋅","⌈","⌉","⌊","⌋","〈","〉","◊","♠","♣","♥","♦"]; +this.submit=function(e){var el=e.target||e.srcElement;while(el.tagName.toLowerCase()!="a"&&el.className!="editor_popup"){el=el.parentNode; +}var sCode=el.getAttribute("rel");if(sCode){apf.popup.forceHide();this.editor.$insertHtml(sCode,true); +var _self=this;$setTimeout(function(){_self.editor.change(_self.editor.getValue()); +});}};this.createPanelBody=function(){panelBody=document.body.appendChild(document.createElement("div")); +panelBody.className="editor_popup";panelBody.style.display="none";var aHtml=[]; +var rowLen=this.colspan-1;for(var i=0;i'); +}aHtml.push(' ',chars[i]," "); +if(i%this.colspan==rowLen){aHtml.push("");}}panelBody.innerHTML=aHtml.join(""); +return panelBody;};this.destroy=function(){panelBody=null;delete panelBody;};}); +apf.LiveEdit.pasteDialog=function(sName){this.name=sName;this.icon=sName=="pasteworddialog"?"pasteword":sName; +this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.keyBinding=sName=="pastetext"?"ctrl+shift+v":"ctrl+shift+w"; +this.state=apf.OFF;var panelBody;this.init=function(){this.buttonNode.className=this.buttonNode.className+" dropdown_small"; +this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]).className="selectarrow"; +};this.execute=function(editor){if(!panelBody){this.editor=editor;apf.popup.setContent(this.$uniqueId,this.createPanelBody()); +}editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,300,270); +if(panelBody.style.visibility=="hidden"){panelBody.style.visibility="visible";}var _self=this; +$setTimeout(function(){try{_self.oArea.focus();}catch(ex){}},100);return{id:this.name,action:null}; +};this.queryState=function(editor){return this.state;};this.submit=function(e){apf.popup.forceHide(); +var sContent=this.oArea.value;if(!sContent||sContent.length==0){return;}if(this.name=="pastetext"){var rl=["\u2122","TM","\u2026","...","\u201c|\u201d",'"',"\u2019,'","\u2013|\u2014|\u2015|\u2212","-"]; +sContent=sContent.replace(/\u2122/gi,"TM").replace(/\u2026/gi,"...").replace(/\u201c|\u201d/gi,'"').replace(/\u2019,'/gi,"'").replace(/\u2013|\u2014|\u2015|\u2212/gi,"-").replace(/\r\n/g,"
").replace(/\r/g,"
").replace(/\n/g,"
"); +}else{sContent=this.editor.$plugins.pasteword.parse(sContent);}this.editor.$insertHtml(sContent); +apf.stopEvent(e);return false;};this.createPanelBody=function(){panelBody=document.body.appendChild(document.createElement("div")); +panelBody.className="editor_popup";panelBody.style.display="none";var idArea="editor_"+this.$uniqueId+"_input",idBtns="editor_"+this.$uniqueId+"_btns"; +panelBody.innerHTML='
'; +this.oArea=document.getElementById(idArea);apf.sanitizeTextbox(this.oArea);if(apf.isIE){this.oArea.onselectstart=this.oArea.onpaste=function(e){e=e||window.event; +e.cancelBubble=true;};}new apf.toolbar({htmlNode:document.getElementById(idBtns),skinset:apf.getInheritedAttribute(this.editor.parentNode,"skinset"),childNodes:[new apf.bar({childNodes:[new apf.button({caption:this.editor.$translate("insert"),onclick:"apf.lookup("+this.$uniqueId+").submit(event)"})]})]}); +return panelBody;};this.destroy=function(){panelBody=this.oArea=null;delete panelBody; +delete this.oArea;};};apf.LiveEdit.plugin("pasteworddialog",apf.LiveEdit.pasteDialog); +apf.LiveEdit.plugin("pastetext",apf.LiveEdit.pasteDialog);apf.LiveEdit.plugin("pasteword",function(){this.name="pasteword"; +this.icon="pasteword";this.type=apf.CMDMACRO;this.hook="onpaste";this.keyBinding="ctrl+shift+v"; +this.state=apf.OFF;this.parse=function(sContent){var bull=String.fromCharCode(8226),middot=String.fromCharCode(183); +sContent=sContent.replace(new RegExp("

(.*?)

","gi"),"

$1

").replace(new RegExp('tab-stops: list [0-9]+.0pt">',"gi"),'">--list--').replace(new RegExp(bull+"(.*?)
","gi"),"

"+middot+"$1

").replace(new RegExp('',"gi"),""+bull).replace(new RegExp('
\s*<\/o:p>/g,"").replace(/[\s\S]*?<\/o:p>/g," ").replace(/\s*mso-[^:]+:[^;"]+;?/gi,"").replace(/\s*MARGIN: 0(?:cm|in) 0(?:cm|in) 0pt\s*;/gi,"").replace(/\s*MARGIN: 0(?:cm|in) 0(?:cm|in) 0pt\s*"/gi,'"').replace(/\s*TEXT-INDENT: 0cm\s*;/gi,"").replace(/\s*TEXT-INDENT: 0cm\s*"/gi,'"').replace(/\s*TEXT-ALIGN: [^\s;]+;?"/gi,'"').replace(/\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi,'"').replace(/\s*FONT-VARIANT: [^\s;]+;?"/gi,'"').replace(/\s*tab-stops:[^;"]*;?/gi,"").replace(/\s*tab-stops:[^"]*/gi,"").replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3").replace(/-- page break --\s*

 <\/p>/gi,"").replace(/-- page break --/gi,"").replace(/<\/p>/gi,"

").replace(/]*cellPadding=[^>]*>/gi,'').replace(/]*vAlign=[^>]*>/gi,""); +}aOut.push("");}aOut.push("
"); +if(true){sContent=sContent.replace(/\s*face="[^"]*"/gi,"").replace(/\s*face=[^ >]*/gi,"").replace(/\s*FONT-FAMILY:[^;"]*;?/gi,""); +}if(true){sContent=sContent.replace(/<(\w[^>]*) style="([^\"]*)"([^>]*)/gi,"<$1$3"); +}sContent=sContent.replace(/]*>[\s\S]*?<\/STYLE[^>]*>/gi,"").replace(/<(?:META|LINK)[^>]*>\s*/gi,"").replace(/\s*style="\s*"/gi,"").replace(/]*>\s* \s*<\/SPAN>/gi," ").replace(/]*><\/SPAN>/gi,"").replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3").replace(/([\s\S]*?)<\/SPAN>/gi,"$1").replace(/([\s\S]*?)<\/FONT>/gi,"$1").replace(/<\\?\?xml[^>]*>/gi,"").replace(/]*>[\s\S]*?<\/w:[^>]*>/gi,"").replace(/<\/?\w+:[^>]*>/gi,"").replace(/<(U|I|STRIKE)> <\/\1>/g," ").replace(/\s*<\/H\d>/gi,"").replace(/<(\w+)[^>]*\sstyle="[^"]*DISPLAY\s?:\s?none[\s\S]*?<\/\1>/ig,"").replace(/<(\w[^>]*) language=([^ |>]*)([^>]*)/gi,"<$1$3").replace(/<(\w[^>]*) onmouseover="([^\"]*)"([^>]*)/gi,"<$1$3").replace(/<(\w[^>]*) onmouseout="([^\"]*)"([^>]*)/gi,"<$1$3").replace(/]*)>/gi,"").replace(/<(H\d)>]*>([\s\S]*?)<\/FONT><\/\1>/gi,"<$1>$2").replace(/<(H\d)>([\s\S]*?)<\/EM><\/\1>/gi,"<$1>$2"); +var div=document.createElement("div");div.innerHTML=sContent;while(this._convertMiddots(div,"--list--")){}while(this._convertMiddots(div,middot,"unIndentedList")){}while(this._convertMiddots(div,bull)){}sContent=div.innerHTML; +return sContent.replace(/--list--/gi,"");};this._convertMiddots=function(div,search,class_name){var mdot=String.fromCharCode(183),bull=String.fromCharCode(8226),nodes,prevul,i,p,ul,li,np,cp; +nodes=div.getElementsByTagName("p");for(i=0;i/gi,"

").replace(/\n/g,"")); +try{apf.getXml(""+html.replace(/&.{3,5};/g,"")+"");}catch(e){if(confirm("Er zit een fout in de html. Klik op OK om deze te corrigeren, of op Cancel om door te gaan")){return false; +}}if(lastLoaded==oPreview.value||_self.editor.$value.replace(/[\r\n]/g,"")==html.replace(/[\r\n]/g,"")){_self.editor.$value=""; +_self.editor.$propHandlers.value.call(_self.editor,html);}else{_self.editor.change(html); +}return true;}var changeTimer=null;function resumeChangeTimer(){if(!_self.editor.realtime||changeTimer!==null){return; +}changeTimer=$setTimeout(function(){clearTimeout(changeTimer);_self.editor.change(oPreview.value); +changeTimer=null;},200);}function onKeydown(e){e=e||window.event;var code=e.which||e.keyCode; +if(!e.ctrlKey&&!e.altKey&&(code<112||code>122)&&(code==32||code>42||code==8||code==13)){resumeChangeTimer(); +}}this.drawPreview=function(editor){this.editor=editor;oCont=editor.$getExternal("code",editor.$ext); +oToolbar=oCont.getElementsByTagName("div")[0];this.editor.$drawToolbars(oToolbar,"codetoolbar","apf.all["+this.$uniqueId+"].$buttonClick(event, this);",true); +oToolbar.innerHTML=oToolbar.innerHTML;var btns=oToolbar.getElementsByTagName("div"); +for(var item,i=btns.length-1;i>=0;i--){item=btns[i].getAttribute("type");if(!item){continue; +}oButtons[item]=btns[i];apf.setStyleClass(btns[i],"editor_enabled",["editor_selected","editor_disabled"]); +btns[i].disabled=false;}oPreview=oCont.getElementsByTagName("textarea")[0];if(apf.isIE){oPreview.onselectstart=function(e){e=e||window.event; +e.cancelBubble=true;};}oPreview.onkeydown=onKeydown;this.setSize(editor);oCont.style.display="none"; +apf.sanitizeTextbox(oPreview);};this.setSize=function(editor){if(!oPreview||!editor){return; +}var w=editor.$ext.offsetWidth-2;var h=editor.$ext.offsetHeight-editor.$toolbar.offsetHeight-4; +oCont.style.top=editor.$toolbar.offsetHeight+"px";oCont.style.width=oToolbar.style.width=w+"px"; +oPreview.style.width=w-(apf.isIE?2:0)+"px";oCont.style.height=h+(apf.isIE?2:3)+"px"; +oPreview.style.height=h-(apf.isIE?26:24)+"px";};var elements={bullist:["
    ","
"],numlist:["
    ","
"],listitem:["
  • ","
  • "],nbsp:[" ",null],"break":["
    ",null],paragraph:["

    ","

    "]}; +this.$buttonClick=function(e,oButton){apf.setStyleClass(oButton,"active");var item=oButton.getAttribute("type"); +if(elements[item]){insertElement.apply(this,elements[item]);}this.editor.$visualFocus(); +oPreview.focus();apf.setStyleClass(oButton,"",["active"]);};function insertElement(sStart,sEnd){if(!sStart){return; +}var range,val,end;if(!sEnd){if(apf.hasMsRangeObject){range=document.selection.createRange(); +range.collapse();range.text=sStart;range.moveEnd("character",sStart.length);range.collapse(); +if(apf.document.activeElement==this.editor){range.select();}}else{val=oPreview.value; +end=oPreview.selectionEnd;oPreview.selectionStart=end;oPreview.value=val.substr(0,end)+sStart+val.substr(end); +oPreview.selectionStart=oPreview.selectionEnd=end+sStart.length;}}else{if(apf.hasMsRangeObject){range=document.selection.createRange(); +val=range.text;range.text=sStart+val+sEnd;range.moveStart("character",-(val.length+sEnd.length)); +range.moveEnd("character",-sEnd.length);if(apf.document.activeElement==this.editor){range.select(); +}}else{var start=oPreview.selectionStart;val=oPreview.value;end=oPreview.selectionEnd; +oPreview.value=val.substr(0,start)+sStart+val.substr(start,end-start)+sEnd+val.substr(end); +oPreview.selectionStart=start+sStart.length;oPreview.selectionEnd=end+sEnd.length-1; +}}}function protect(outer,opener,data,closer){return opener+"apf.___APFpd___"+protectedData.push(data)+closer; +}function format(sHtml){if(!this.regex){setupRegex.call(this);}protectedData=[]; +var sFmt=sHtml.replace(this.regex.protectedTags,protect);sFmt=sFmt.replace(this.regex.blocksOpener,"\n$&").replace(this.regex.blocksCloser,"$&\n").replace(this.regex.newLineTags,"$&\n").replace(this.regex.mainTags,"\n$&\n"); +var i,j,sIdt="",asLines=sFmt.split(this.regex.lineSplitter);sFmt="";for(i=0,j=asLines.length; +i]*\>/gi,blocksCloser:/\<\/(P|DIV|H1|H2|H3|H4|H5|H6|ADDRESS|PRE|OL|UL|LI|TITLE|META|LINK|BASE|SCRIPT|LINK|TD|TH|AREA|OPTION)[^\>]*\>/gi,newLineTags:/\<(BR|HR)[^\>]*\>/gi,mainTags:/\<\/?(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR)[^\>]*\>/gi,lineSplitter:/\s*\n+\s*/g,increaseIndent:/^\<(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ \/\>]/i,decreaseIndent:/^\<\/(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ \>]/i,protectedTags:/(]*>)([\s\S]*?)(<\/PRE>)/gi,formatIndentatorRemove:/^ /}; +}this.queryState=function(editor){if(editor.$pluginsActive==this.name){return apf.SELECTED; +}return apf.OFF;};this.destroy=function(){oPreview=this.regex=null;delete oPreview; +delete this.regex;};});apf.LiveEdit.colorPlugin=function(sName){this.name=sName; +this.icon=sName;this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar"; +this.buttonNode=null;this.state=apf.OFF;this.colspan=18;var panelBody;var colorAtoms=["00","33","66","99","CC","FF"]; +function generatePalette(){apf.LiveEdit.colorPlugin.palette=[];var r,g,b,iCol;for(r=0; +r0){var tmp=[];var ch1=c.charAt(0); +var ch2=c.charAt(4);tmp[0]=ch2;tmp[4]=ch1;ch1=c.charAt(1);ch2=c.charAt(5);tmp[1]=ch2; +tmp[5]=ch1;return tmp[0]+tmp[1]+c.charAt(2)+c.charAt(3)+tmp[4]+tmp[5];}return c; +}function int2Color(intVal){var colorVal=(intVal&16777215).toString(16);return("000000").substring(0,6-colorVal.length)+colorVal; +}this.init=function(editor,btn){this.buttonNode.className=this.buttonNode.className+" dropdown_small"; +var oArrow=this.buttonNode.getElementsByTagName("div")[0];this.colorPreview=this.buttonNode.insertBefore(document.createElement("div"),oArrow); +this.colorPreview.className="colorpreview";var colorArrow=this.buttonNode.insertBefore(document.createElement("span"),oArrow); +colorArrow.className="selectarrow";};this.execute=function(editor){if(!panelBody){this.editor=editor; +apf.popup.setContent(this.$uniqueId,this.createPanelBody());}editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,apf.isIE6?296:292,167); +return{id:this.name,action:null};};this.setStyleMethod=function(useSpan){if(typeof useSpan=="undefined"){useSpan=true; +}try{this.editor.$activeDocument.execCommand("styleWithCSS",false,useSpan);}catch(ex){this.editor.$activeDocument.execCommand("useCSS",false,!useSpan); +}};this.queryState=function(editor){var cmdName=this.name=="forecolor"?"ForeColor":apf.isIE?"BackColor":"HiliteColor"; +this.state=editor.$queryCommandState(cmdName);var currValue="";try{currValue=editor.$queryCommandValue(cmdName); +}catch(ex){}if(apf.isIE){currValue="#"+RGBToBGRToRGB(int2Color(currValue));}if(currValue!=this.colorPreview.style.backgroundColor){this.colorPreview.style.backgroundColor=currValue; +}};this.submit=function(e){var el=e.target||e.srcElement;while(el.tagName.toLowerCase()!="a"&&el.className!="editor_popup"){el=el.parentNode; +}var sColor=el.getAttribute("rel");if(sColor){apf.popup.forceHide();this.editor.$execCommand(this.name=="forecolor"?"ForeColor":apf.isIE?"BackColor":"HiliteColor","#"+sColor); +}};this.createPanelBody=function(){if(!apf.LiveEdit.colorPlugin.palette){generatePalette(); +}panelBody=document.body.appendChild(document.createElement("div"));panelBody.className="editor_popup"; +panelBody.style.display="none";var aHtml=[];var row,col,colorCode,palette=apf.LiveEdit.colorPlugin.palette; +for(row=0;row'); +for(col=0;col  '); +}aHtml.push("");}panelBody.innerHTML=aHtml.join("");return panelBody;};this.destroy=function(){panelBody=this.colorPreview=null; +delete panelBody;delete this.colorPreview;};};apf.LiveEdit.colorPlugin.palette=null; +apf.LiveEdit.plugin("forecolor",apf.LiveEdit.colorPlugin);apf.LiveEdit.plugin("backcolor",apf.LiveEdit.colorPlugin); +apf.LiveEdit.dateTimePlugin=function(sName){this.name=sName;this.icon=sName;this.type=apf.TOOLBARITEM; +this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding=sName=="insertdate"?"ctrl+shift+d":"ctrl+shift+t"; +this.state=apf.OFF;this.i18n={date_format:"%Y-%m-%d",time_format:"%H:%M:%S",months_long:"January,February,March,April,May,June,July,August,September,October,November,December",months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",days_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"}; +this.execute=function(editor){if(typeof this.i18n.months_long=="string"){this.i18n.months_long=this.i18n.months_long.split(","); +this.i18n.months_short=this.i18n.months_short.split(",");this.i18n.days_long=this.i18n.days_long.split(","); +this.i18n.days_short=this.i18n.days_short.split(",");}var d=new Date();var fmt=(this.name=="insertdate")?this.i18n.date_format:this.i18n.time_format; +fmt=fmt.replace("%D","%m/%d/%y").replace("%r","%I:%M:%S %p").replace("%Y",""+d.getFullYear()).replace("%y",""+d.getYear()).replace("%m",(""+d.getMonth()+1).pad(2,"0")).replace("%d",(""+d.getDate()).pad(2,"0")).replace("%H",(""+d.getHours()).pad(2,"0")).replace("%M",(""+d.getMinutes()).pad(2,"0")).replace("%S",(""+d.getSeconds()).pad(2,"0")).replace("%I",""+(d.getHours()+11)%12+1).replace("%p",""+(d.getHours()<12?"AM":"PM")).replace("%B",""+this.i18n.months_long[d.getMonth()]).replace("%b",""+this.i18n.months_short[d.getMonth()]).replace("%A",""+this.i18n.days_long[d.getDay()]).replace("%a",""+this.i18n.days_short[d.getDay()]).replace("%%","%"); +editor.$insertHtml(fmt,true);editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +};this.queryState=function(){return this.state;};};apf.LiveEdit.plugin("insertdate",apf.LiveEdit.dateTimePlugin); +apf.LiveEdit.plugin("inserttime",apf.LiveEdit.dateTimePlugin);apf.LiveEdit.directionPlugin=function(sName){this.name=sName; +this.icon=sName;this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar"; +this.state=apf.OFF;this.execute=function(editor){editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +};this.queryState=function(editor){return this.state;};};apf.LiveEdit.plugin("ltr",apf.LiveEdit.directionPlugin); +apf.LiveEdit.plugin("rtl",apf.LiveEdit.directionPlugin);apf.LiveEdit.plugin("emotions",function(){this.name="emotions"; +this.icon="emotions";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar"; +this.buttonNode=null;this.state=apf.OFF;this.colspan=4;this.emotions=[];var panelBody; +this.init=function(editor,btn){this.buttonNode.className=this.buttonNode.className+" dropdown_small"; +var oArrow=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]); +oArrow.className="selectarrow";};this.execute=function(editor){if(!panelBody){this.editor=editor; +var node,oNode=editor.$getPluginOption("emotions"),i=0,l=oNode.childNodes.length; +for(;i',true); +};this.createPanelBody=function(){panelBody=document.body.appendChild(document.createElement("div")); +panelBody.className="editor_popup";panelBody.style.display="none";var aHtml=[],emotions=this.emotions,path=this.emotionsPath,rowLen=this.colspan-1,i=0,l=emotions.length; +for(;i'); +}aHtml.push(''); +if(i%this.colspan==rowLen){aHtml.push("");}}panelBody.innerHTML=aHtml.join(""); +return panelBody;};this.destroy=function(){panelBody=null;delete panelBody;};}); +apf.LiveEdit.plugin("fonts",function(){this.name="fonts";this.icon="fonts";this.type=apf.TOOLBARITEM; +this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.buttonNode=null;this.state=apf.OFF; +this.colspan=1;this.fontNames={};var panelBody;this.init=function(editor){this.buttonNode.className=this.buttonNode.className+" fontpicker"; +this.fontPreview=this.buttonNode.getElementsByTagName("span")[0];this.fontPreview.className+=" fontpreview"; +var fontArrow=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]); +fontArrow.className="selectarrow";this.editor=editor;var l,j,font,fonts,node;var oNode=editor.$getPluginOption("fonts").childNodes[0]; +while(oNode){fonts=oNode.nodeValue.splitSafe("(?:;|=)");if(fonts[0]){for(j=0,l=fonts.length; +j',i,""); +}panelBody.innerHTML=aHtml.join("");return panelBody;};this.destroy=function(){panelBody=this.fontPreview=null; +delete panelBody;delete this.fontPreview;};});apf.LiveEdit.plugin("fontsize",function(){this.name="fontsize"; +this.icon="fontsize";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar"; +this.buttonNode=null;this.state=apf.OFF;var panelBody;var sizeMap={"1":"8","2":"10","3":"12","4":"14","5":"18","6":"24","7":"36"}; +this.init=function(editor){this.buttonNode.className=this.buttonNode.className+" fontsizepicker"; +this.sizePreview=this.buttonNode.getElementsByTagName("span")[0];this.sizePreview.className+=" fontsizepreview"; +var sizeArrow=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]); +sizeArrow.className="selectarrow";this.queryState(editor);};this.execute=function(editor){if(!panelBody){this.editor=editor; +var i,node,oNode=editor.$getPluginOption("fontsizes");for(i=0;i',aSizes[i]," (",sizeMap[aSizes[i]],"pt)"); +}panelBody.innerHTML=aHtml.join("");return panelBody;};this.destroy=function(){panelBody=this.sizePreview=null; +delete panelBody;delete this.sizePreview;};});apf.LiveEdit.plugin("fontstyle",function(){this.name="fontstyle"; +this.icon="fontstyle";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar"; +this.buttonNode=null;this.state=apf.OFF;var panelBody,oStyles=null,oEditor=null; +function getStyles(editor){if(!oStyles){var node,aCss,bCss,oNode=editor.$getPluginOption("fontstyles"); +if(!oNode||!oNode.childNodes){throw new Error(apf.formatErrorString(0,editor,"Initializing plugin: fontstyle","No fontstyle block found in skin definition")); +}for(var i=0,j=oNode.childNodes.length;i-1){oCurrent=oStyles[i];oCurrent.node=oNode; +}}oNode=oNode.parentNode;}return oCurrent;}this.submit=function(e,sStyle){if(!sStyle){el=e.target||e.srcElement; +while(el.tagName.toLowerCase()!="a"&&el.className!="editor_popup"){el=el.parentNode; +}sStyle=el.getAttribute("rel");}if(sStyle){apf.popup.forceHide();var sel=oEditor.$selection; +sel.set();oEditor.$visualFocus();var o=getCurrentStyle(oEditor);if(o&&sStyle=="normal"){var n=o.node.childNodes,p=o.node.parentNode; +while(n.length){p.insertBefore(n[0],o.node);}p.removeChild(o.node);this.queryState(oEditor); +}else{if(o&&(sel.isCollapsed()||sel.getContent("text")==o.node.innerHTML)&&apf.isChildOf(o.node,sel.getSelectedNode(),true)){if(o.cname==sStyle){return; +}apf.setStyleClass(o.node,sStyle,[o.cname]);}else{if(sel.isCollapsed()){if(apf.isIE){var oNode=sel.getRange().parentElement(); +var p=oEditor.$activeDocument.createElement("span");p.className=sStyle;p.innerHTML=oNode.innerHTML; +if(oNode.tagName=="BODY"){oNode.innerHTML="";oNode.appendChild(p);}else{oNode.parentNode.insertBefore(p,oNode); +oNode.parentNode.removeChild(oNode);}sel.selectNode(p);}else{var range=sel.getRange(); +var oCaret=range.commonAncestorContainer;range.setStartBefore(oCaret);range.setEndAfter(oCaret); +sel.setRange(range);var htmlNode=sel.setContent(''+sel.getContent()+""); +sel.selectNode(htmlNode);}}else{var s=sel.getContent().trim();var shouldPrefixSpan=s.substr(0,5)=="|<\/SPAN>/gi,"");if(s.charAt(0)=="<"){s=s.replace(/<(normal|pre|p|address|h1|h2|h3|h4|h5|h6)(?:\s.*?|)>(.+?)<\/(normal|pre|p|address|h1|h2|h3|h4|h5|h6)>/gi,'<$1>$2').replace(/^([\s\S]*?)(<(?:normal|pre|p|address|h1|h2|h3|h4|h5|h6)[\s\S]*<\/(?:normal|pre|p|address|h1|h2|h3|h4|h5|h6)>)([\s\S]*?)$/gi,function(m,m1,m2,m3){return(m1?''+m1+"":"")+m2+(m3?''+m3+"":""); +}).replace(/^\s*<(?:normal|pre|p|address|h1|h2|h3|h4|h5|h6)(?:\s.*?|)>|<\/(?:normal|pre|p|address|h1|h2|h3|h4|h5|h6)>\s*$/gi,""); +if(apf.isIE){s=s.replace(/<\/P>/,"");}}else{s=''+s+""; +}if(shouldPrefixSpan){s=""+s.replace(/<\/SPAN>$/i,"");}var htmlNode=sel.setContent(s,true); +sel.selectNode(htmlNode);}}}oEditor.$restoreFocus();oEditor.change(oEditor.getValue()); +}};this.queryState=function(){var o=getCurrentStyle();if(o){if(this.stylePreview.innerHTML!=o.caption){this.stylePreview.innerHTML=o.caption; +}this.state=apf.ON;}else{this.stylePreview.innerHTML="Style";this.state=apf.OFF; +}return this.state;};this.createPanelBody=function(editor){panelBody=document.body.appendChild(document.createElement("div")); +panelBody.className="editor_popup";panelBody.style.display="none";getStyles(editor); +var aHtml=['Normal']; +for(var i in oStyles){aHtml.push('',oStyles[i].caption,""); +}panelBody.innerHTML=aHtml.join("");return panelBody;};this.destroy=function(){panelBody=this.stylePreview=oEditor=null; +delete panelBody;delete this.stylePreview;delete oEditor;};});apf.LiveEdit.plugin("blockformat",function(){this.name="blockformat"; +this.icon="blockformat";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL; +this.hook="ontoolbar";this.buttonNode=null;this.state=apf.OFF;this.node=null;var panelBody,oEditor,blocksMap={normal:"Normal",p:"Paragraph",pre:"Preformatted",address:"Address",h1:"Header 1",h2:"Header 2",h3:"Header 3",h4:"Header 4",h5:"Header 5",h6:"Header 6"},blocksRE,blocksRE2,blocksRE3,blocksRE4,blockFormats; +function getFormats(editor){if(!blockFormats){var i,j,node,oNode=editor.$getPluginOption("blockformats"); +if(!oNode||!oNode.childNodes){throw new Error(apf.formatErrorString(0,editor,"Initializing plugin: Blockformat","No block formats found in skin definition")); +}for(i=0,j=oNode.childNodes.length;i","gi");blocksRE3=new RegExp("<\\/?("+blockFormats.join("|")+"|p)>","gi"); +blocksRE4=new RegExp("^("+blockFormats.join("|")+"|p)$","gi");}return blockFormats; +}this.init=function(editor){oEditor=editor;this.buttonNode.className=this.buttonNode.className+" blockformatpicker"; +this.blockPreview=this.buttonNode.getElementsByTagName("span")[0];this.blockPreview.className+=" blockformatpreview"; +var blockArrow=this.buttonNode.appendChild(document.createElement("span"));blockArrow.className="selectarrow"; +this.queryState(editor);};this.execute=function(editor){if(!panelBody){oEditor=editor; +apf.popup.setContent(this.$uniqueId,this.createPanelBody(editor));}oEditor.$showPopup(this,this.$uniqueId,this.buttonNode,203); +return{id:this.name,action:null};};this.queryState=function(){var oNode=oEditor.$selection.getSelectedNode(),aFormats=getFormats(oEditor),tagName=oNode.nodeType==1?oNode.tagName.toLowerCase():""; +while(tagName&&!tagName.match(blocksRE)&&tagName!="body"){oNode=oNode.parentNode; +tagName=(oNode.tagName||"").toLowerCase();}if(tagName.match(blocksRE)){var sBlock=blocksMap[tagName]; +if(this.blockPreview.innerHTML!=sBlock){this.blockPreview.innerHTML=sBlock;}this.state=apf.ON; +this.node=oNode;}else{this.blockPreview.innerHTML="Normal";this.state=apf.OFF;this.node=null; +}return this.state;};this.submit=function(e,sBlock){if(!sBlock){var el=e.target||e.srcElement; +while(el.tagName.toLowerCase()!="a"&&el.className!="editor_popup"){el=el.parentNode; +}sBlock=el.getAttribute("rel");}if(sBlock){apf.popup.forceHide();var oNode,sel=oEditor.$selection; +sel.set();oEditor.$visualFocus();var s=sel.getContent();if(sBlock=="normal"&&this.queryState(oEditor)==apf.ON){var n=this.node.childNodes,p=this.node.parentNode; +if(apf.isIE){var l=p.insertBefore(p.ownerDocument.createElement("p"),this.node); +while(n.length){l.insertBefore(n[0],l.firstChild);}p.removeChild(this.node);sel.selectNode(l); +if(l.previousSibling&&l.previousSibling.tagName=="P"){if(l.previousSibling.innerHTML==""){l.parentNode.removeChild(l.previousSibling); +}}}else{while(n.length){p.insertBefore(n[0],this.node);}p.removeChild(this.node); +}this.state=apf.OFF;this.node=null;this.blockPreview.innerHTML="Normal";}else{if(sel.isCollapsed()||s.trim()==""){if(apf.isIE){var startNode,oNode; +oNode=startNode=sel.getRange().parentElement();while(!oNode.tagName.match(blocksRE4)&&oNode.tagName!="BODY"){oNode=oNode.parentNode; +}if(oNode&&oNode.tagName=="BODY"){if(startNode!=oNode){oNode=startNode;}else{}}var p=oEditor.$activeDocument.createElement(sBlock); +p.innerHTML=oNode.innerHTML;if(oNode.tagName=="BODY"){oNode.innerHTML="";oNode.appendChild(p); +}else{oNode.parentNode.insertBefore(p,oNode);oNode.parentNode.removeChild(oNode); +}sel.selectNode(p);}else{oEditor.$execCommand("FormatBlock",sBlock);}this.blockPreview.innerHTML=blocksMap[sBlock]; +}else{oNode=sel.getSelectedNode();while(oNode.nodeType!=1){oNode=oNode.parentNode; +}if(oNode.tagName.match(blocksRE4)&&s.length==oNode[apf.hasInnerText?"innerText":"textContent"].length){var p=oEditor.$activeDocument.createElement(sBlock); +p.innerHTML=oNode.innerHTML;oNode.parentNode.insertBefore(p,oNode);oNode.parentNode.removeChild(oNode); +sel.selectNode(p);}else{while(!oNode.tagName.match(blocksRE4)&&oNode.tagName!="BODY"){oNode=oNode.parentNode; +}if(oNode&&oNode.tagName!="BODY"){var s2;if(oNode.tagName=="P"&&apf.isIE){s2="<"+sBlock+">"+s.trim().replace(blocksRE3,"")+""; +addedNode=sel.setContent(s2);}else{s2='

    '+s+"

    ";sel.setContent(s2); +var sBlock2=oNode.tagName;var html=[],first,last;var strHtml=oNode.innerHTML.replace(s2,function(m,pos){return(pos!=0?(first=true)&&"":"")+"<"+sBlock+' __apf_placeholder="true">'+s.replace(blocksRE3,"")+""+(pos":""); +});if(first){html.push("<"+sBlock2+">");}html.push(strHtml);if(last){html.push(""); +}oNode.innerHTML=html.join("");var addedNode,n=oNode.getElementsByTagName(sBlock); +for(var i=0;i"+s.replace(/

    (.*?)<\/p>(.)/gi,"$1
    $2").replace(blocksRE3,"")+""); +if(apf.isIE){var prev=addedNode.previousSibling;if(prev&&prev.tagName=="P"&&prev.innerHTML==" "){prev.parentNode.removeChild(prev); +}}sel.selectNode(addedNode);}}this.blockPreview.innerHTML=blocksMap[sBlock];}}oEditor.$restoreFocus(); +oEditor.change(oEditor.getValue());}};this.createPanelBody=function(editor){panelBody=document.body.appendChild(document.createElement("div")); +panelBody.className="editor_popup";panelBody.style.display="none";var aHtml=[],aFormats=getFormats(editor); +for(var i=0,j=aFormats.length;i<',aFormats[i],">",blocksMap[aFormats[i]],""); +}panelBody.innerHTML=aHtml.join("");return panelBody;};this.destroy=function(){panelBody=oEditor=this.blockPreview=this.node=null; +delete panelBody;delete oEditor;delete this.blockPreview;delete this.node;};}); +apf.LiveEdit.plugin("help",function(){this.name="help";this.icon="help";this.type=apf.TOOLBARITEM; +this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+h";this.state=apf.OFF; +this.execute=function(editor){editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +};this.queryState=function(editor){return this.state;};});apf.LiveEdit.plugin("hr",function(){this.name="hr"; +this.icon="hr";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar"; +this.keyBinding="ctrl+h";this.state=apf.OFF;this.execute=function(editor){if(apf.isGecko||apf.isIE){editor.$insertHtml("


    ",true); +}else{editor.$execCommand("InsertHorizontalRule");}editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +};this.queryState=function(editor){return this.state;};});apf.LiveEdit.plugin("image",function(){this.name="image"; +this.icon="image";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar"; +this.keyBinding="ctrl+alt+i";this.state=apf.OFF;var panelBody;this.init=function(editor){this.buttonNode.className=this.buttonNode.className+" dropdown_small"; +var oArrow=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]); +oArrow.className="selectarrow";};this.execute=function(editor){if(!panelBody){this.editor=editor; +apf.popup.setContent(this.$uniqueId,this.createPanelBody());}editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,218,47);var _self=this; +$setTimeout(function(){_self.oUrl.focus();});return{id:this.name,action:null};}; +this.queryState=function(editor){return this.state;};this.submit=function(e){var sUrl=this.oUrl.value; +if(sUrl){apf.popup.forceHide();var oUrl=new apf.url(sUrl);if(!oUrl.protocol||!oUrl.host||!oUrl.file){alert("Please enter a valid URL"); +}else{this.editor.$insertHtml('',true);}}};this.createPanelBody=function(){panelBody=document.body.appendChild(document.createElement("div")); +panelBody.className="editor_popup";panelBody.style.display="none";var idUrl="editor_"+this.$uniqueId+"_input"; +var idBtns="editor_"+this.$uniqueId+"_btns";panelBody.innerHTML='
    '; +this.oUrl=document.getElementById(idUrl);this.appendAmlNode(' ',document.getElementById(idBtns)); +if(apf.hasFocusBug){apf.sanitizeTextbox(this.oUrl);this.oUrl.onselectstart=function(e){e=e||window.event; +e.cancelBubble=true;};}return panelBody;};this.destroy=function(){panelBody=this.oUrl=null; +delete panelBody;delete this.oUrl;};});apf.LiveEdit.plugin("imagespecial",function(){this.name="imagespecial"; +this.icon="image";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar"; +this.keyBinding="ctrl+alt+j";this.state=apf.OFF;var winHandle;this.execute=function(editor){if(!winHandle){var s=(editor.getAttribute("imagewindow")||"").trim(); +if(s){winHandle=self[s];}}if(winHandle&&winHandle.show){winHandle.show();}editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +};this.queryState=function(editor){return this.state;};});apf.LiveEdit.plugin("link",function(){this.name="link"; +this.icon="link";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar"; +this.keyBinding="ctrl+shift+l";this.state=apf.OFF;var panelBody;this.init=function(editor,btn){this.buttonNode.className=this.buttonNode.className+" dropdown_small"; +var oArrow=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]); +oArrow.className="selectarrow";};this.execute=function(editor){if(!panelBody){this.editor=editor; +apf.popup.setContent(this.$uniqueId,this.createPanelBody());}editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +this.oUrl.value="http://";this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,218,95); +if(panelBody.style.visibility=="hidden"){panelBody.style.visibility="visible";}var _self=this; +$setTimeout(function(){_self.oUrl.focus();});return{id:this.name,action:null};}; +this.queryState=function(editor){if(editor.$selection.isCollapsed()||editor.$selection.getSelectedNode().tagName=="A"){return apf.DISABLED; +}return this.state;};this.submit=function(e){apf.popup.forceHide();if(!this.oUrl.value.replace("http://","")){return; +}this.editor.$execCommand("CreateLink","javascript:apftmp(0);");var oLink,oEditor=this.editor,aLinks=oEditor.$activeDocument.getElementsByTagName("a"),i=0,l=aLinks.length; +for(;iLink URL
    '; +this.oUrl=document.getElementById(idUrl);this.oTarget=document.getElementById(idTarget); +this.oTitle=document.getElementById(idTitle);if(apf.hasFocusBug){apf.sanitizeTextbox(this.oUrl); +apf.sanitizeTextbox(this.oTarget);apf.sanitizeTextbox(this.oTitle);this.oUrl.onselectstart=this.oTarget.onselectstart=this.oTitle.onselectstart=function(e){e=e||window.event; +e.cancelBubble=true;};}new apf.toolbar({htmlNode:document.getElementById(idBtns),skinset:apf.getInheritedAttribute(this.editor.parentNode,"skinset"),childNodes:[new apf.bar({childNodes:[new apf.button({caption:this.editor.$translate("insert"),onclick:"apf.lookup("+this.$uniqueId+").submit(event)"})]})]}); +return panelBody;};this.destroy=function(){panelBody=this.oUrl=this.oTarget=this.oTitle=null; +delete panelBody;delete this.oUrl;delete this.oTarget;delete this.oTitle;};});apf.LiveEdit.plugin("unlink",function(){this.name="unlink"; +this.icon="unlink";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar"; +this.keyBinding="ctrl+shift+l";this.state=apf.OFF;this.execute=function(editor){if(this.queryState(editor)==apf.DISABLED){return; +}if(apf.isIE){editor.$execCommand("Unlink");}else{var sel=editor.$selection;sel.set(); +var oNode=sel.getSelectedNode();if(oNode.tagName=="A"){var txt=oNode.innerHTML; +sel.selectNode(oNode);sel.remove();sel.collapse();editor.$insertHtml(txt);}}};this.queryState=function(editor){if(editor.$selection.getSelectedNode().tagName=="A"){return apf.OFF; +}return apf.DISABLED;};});apf.LiveEdit.listPlugin=function(sName){this.name=sName; +this.icon=sName;this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar"; +this.keyBinding=sName=="bullist"?"ctrl+shift+u":"ctrl+shift+o";this.state=apf.OFF; +var emptyRegex=apf.isIE?/^( )?]*_apf_placeholder(="1"> )?<\/DIV>$/gi:/^( )?$/gi; +this.execute=function(editor){editor.$execCommand(this.name=="bullist"?"InsertUnorderedList":"InsertOrderedList"); +this.correctLists(editor);editor.$visualFocus();editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +};function moveListItems(from,to){var i,oNode,oLastNode,listNode=(this.name=="bullist")?"OL":"UL"; +for(i=from.childNodes.length;i>=0;i--){oNode=from.childNodes[i];if(!oNode){continue; +}if(oNode.tagName==listNode){break;}if(!oLastNode){to.appendChild(oNode);}else{to.insertBefore(oNode,oLastNode); +}oLastNode=oNode;}from.parentNode.removeChild(from);}function getEmptyLi(oParent){if(!oParent||oParent.nodeType!=1){return; +}var sHtml,aNodes=oParent.getElementsByTagName("li");for(var i=0,j=aNodes.length; +i0){alert(found+" occurences found and replaced with '"+this.oReplace.value+"'"); +}else{alert("No occurences found for '"+val+"'");}};this.replace=function(){var sRepl=this.oReplace.value; +if(apf.isIE){this.editor.$selection.getRange().duplicate().pasteHTML(sRepl);}else{this.editor.$activeDocument.execCommand("InsertHTML",false,sRepl); +}};this.createPanelBody=function(){panelBody=document.body.appendChild(document.createElement("div")); +panelBody.className="editor_popup";panelBody.style.display="none";var idSearch="editor_"+this.$uniqueId+"_input",idReplace="editor_"+this.$uniqueId+"_replace",idCase="editor_"+this.$uniqueId+"_case",idBtns="editor_"+this.$uniqueId+"_btns"; +panelBody.innerHTML='
    '+(this.name=="replace"?'
    ':"")+'
    '; +this.oSearch=document.getElementById(idSearch);this.oCase=document.getElementById(idCase); +new apf.toolbar({htmlNode:document.getElementById(idBtns),skinset:apf.getInheritedAttribute(this.editor.parentNode,"skinset"),childNodes:[new apf.bar({childNodes:this.name=="search"?[new apf.button({caption:this.editor.$translate("findnext"),onclick:"apf.lookup("+this.$uniqueId+").submit(event)"})]:[new apf.button({caption:this.editor.$translate("findnext"),onclick:"apf.lookup("+this.$uniqueId+").submit(event)"}),(this.oReplBtn=new apf.button({caption:this.editor.$translate("doreplace"),onclick:"apf.lookup("+this.$uniqueId+").onDoReplClick(event)"})),(this.oReplAllBtn=new apf.button({caption:this.editor.$translate("replaceall"),onclick:"apf.lookup("+this.$uniqueId+").onReplAllClick(event)"}))]})]}); +if(this.name=="replace"){this.oReplace=document.getElementById(idReplace);this.oReplBtn.disable(); +}if(apf.hasFocusBug){var fSel=function(e){e=e||window.event;e.cancelBubble=true; +};apf.sanitizeTextbox(this.oSearch);this.oSearch.onselectstart=fSel;if(this.oReplace){apf.sanitizeTextbox(this.oReplace); +this.oReplace.onselectstart=fSel;}apf.sanitizeTextbox(this.oCase);}return panelBody; +};this.destroy=function(){panelBody=this.oSearch=this.oCase=null;delete panelBody; +delete this.oSearch;delete this.oCase;if(this.oReplace){this.oReplace=this.oReplBtn=this.oReplAllBtn=null; +delete this.oReplace;delete this.oReplBtn;delete this.oReplAllBtn;}};};apf.LiveEdit.plugin("search",apf.LiveEdit.searchPlugin); +apf.LiveEdit.plugin("replace",apf.LiveEdit.searchPlugin);apf.LiveEdit.plugin("spell",function(){this.name="spell"; +this.icon="spell";this.type=apf.TEXTMACRO;this.hook="typing";this.state=apf.OFF; +var engine,lastVal,crtLang=null,basepath=null,canCheck=false;this.execute=function(editor){apf.console.log("spell active..."+typeof editor); +var _self=this;if(basepath===null){basepath=(apf.config.resourcePath||apf.basePath)+"resources/"; +}if(crtLang===null||editor.language!=crtLang){crtLang=editor.language;canCheck=false; +engine=BJSpell(basepath+crtLang+".js",function(){canCheck=true;});}if(canCheck){lastVal=editor.getValue().replace(/]+underline[^>]+>(.*)<\/span>/gi,"$1"); +var html=engine.replace(lastVal,function(word){return""+word+""; +});if(lastVal.replace(/[\r\n]/g,"")!=html.replace(/[\r\n]/g,"")){editor.$value=""; +var oBm=editor.$selection.getBookmark();editor.$propHandlers.value.call(editor,html); +setTimeout(function(){editor.$selection.moveToBookmark(oBm);});}}editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +};this.suggest=function(){apf.console.log("suggestions to be delivered here..."); +};this.queryState=function(editor){return this.state;}; +/* + * BJSpell JavaScript Library v0.0.1 + * http://code.google.com/p/bjspell/ + * + * Copyright (c) 2009 Andrea Giammarchi + * Licensed under the Lesser GPL licenses. + * + * Date: 2009-02-05 23:50:01 +0000 (Wed, 05 Feb 2009) + * Revision: 1 + * ToDo: better suggestion (at least one that make more sense) + */ +BJSpell=apf.LiveEdit.spell=function(){function BJSpell(dic,callback){if(this instanceof BJSpell){var lang=/^.*?([a-zA-Z]{2}_[a-zA-Z]{2}).*$/.exec(dic)[1],self=this; +if(!callback){callback=empty;}if(BJSpell[lang]){if(BJSpell[lang] instanceof BJSpell){self=BJSpell[lang]; +}else{BJSpell[lang]=sync(self,BJSpell[lang]);}self.checked={};var keys=self.keys=[],words=self.words,i=0,key; +for(key in words){keys[i++]=key;}keys.indexOf=indexOf;setTimeout(function(){callback.call(self); +},1);}else{apf.console.log("loading dic script: "+dic);var script=document.createElement("script"); +BJSpell[lang]=self;script.src=dic;script.type="text/javascript";script.onload=function(){apf.console.log("incoming script..."); +script.onload=script.onreadystatechange=empty;script.parentNode.removeChild(script); +BJSpell.call(self,dic,callback);};script.onreadystatechange=function(){apf.console.log("script readyState change..."); +if(/loaded|completed/i.test(script.readyState)){script.onload();}};(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(script); +}return self;}else{return new BJSpell(dic,callback);}}BJSpell.prototype.check=function(word){var checked=this.checked[word=word.toLowerCase()]; +return typeof checked==="boolean"?checked:this.parse(word);};BJSpell.prototype.parse=function(word){if(/^[0-9]+$/.test(word)){return this.checked[word]=true; +}var result=!!this.words[word],parsed,rules,len,length,i,rule,str,seek,re,add;if(!result){for(parsed=word,rules=this.rules.PFX,length=rules.length,i=0; +i>0);ceil=indexOf+1+Math.ceil(i/2); +words=keys.slice(many,indexOf).concat(keys.slice(indexOf+1,ceil));while(words.length']; +for(;i");for(k=0,l=oSize[1];k",(apf.isIE?"":' 
    '),"
    ");oEditor.$insertHtml(aOut.join(""),true); +oEditor.$selection.collapse(false);};var bMorphing=false,oMorphCurrent,iMorphXCount,iMorphYCount; +function mouseDown(e){bMorphing=true;oMorphCurrent=e.client;iMorphXCount=iMorphYCount=0; +document.onmousemove=function(e){if(!bMorphing){return;}e=new apf.AbstractEvent(e||window.event); +if(e.client.x>oTablePos[0]+oTable.offsetWidth||e.client.y>oTablePos[1]+oTable.offsetHeight){morphTable(e); +}e.stop();return false;};document.onmouseup=function(e){e=new apf.AbstractEvent(e||window.event); +mouseUp.call(_self,e);e.stop();return false;};return false;}function mouseUp(e){if(bMorphing){bMorphing=false,oMorphCurrent=document.onmousemove=document.onmouseup=null,iMorphXCount=iMorphYCount=0; +}mouseOver.call(this,e);if(iCurrentX>0&&iCurrentY>0){this.submit([iCurrentY,iCurrentX]); +}e.stop();return false;}function morphTable(e){oMorphCurrent=e.client;iMorphXCount=(Math.floor((oMorphCurrent.x-oTablePos[0])/CELL_SIZE)*CELL_SIZE)+CELL_SIZE; +if(iMorphXCount>oTable.offsetWidth){panelBody.style.width=(iMorphXCount+(BUTTON_SIZE/2))+"px",oTableCont.style.width=(iMorphXCount+GUTTER_SIZE)+"px",oTable.style.width=(iMorphXCount)+"px",oTableSel.style.width=(iMorphXCount)+"px"; +}iMorphYCount=(Math.floor((oMorphCurrent.y-oTablePos[1])/CELL_SIZE)*CELL_SIZE)+CELL_SIZE; +if(iMorphYCount>oTable.offsetHeight){panelBody.style.height=(iMorphYCount+BUTTON_SIZE)+"px",oTableCont.style.height=(iMorphYCount+GUTTER_SIZE)+"px",oTable.style.height=(iMorphYCount)+"px",oTableSel.style.height=(iMorphYCount)+"px"; +}}function resetTableMorph(){oTableCont.style.width=oTableCont.style.height=TABLE_SIZE+"px",oTableSel.style.width=oTableSel.style.height="0px",oTable.style.width=oTable.style.height=TABLE_SIZE-GUTTER_SIZE+"px"; +}var sCurrentCaption="";function mouseOver(e){if(typeof oTablePos=="undefined"){return; +}iCurrentX=Math.ceil((e.page.x-oTablePos[0])/CELL_SIZE);iCurrentY=Math.ceil((e.page.y-oTablePos[1])/CELL_SIZE); +if(iCurrentX>0&&iCurrentY>0){oTableSel.style.width=Math.min((iCurrentX*CELL_SIZE),oTable.offsetWidth)+"px"; +oTableSel.style.height=Math.min((iCurrentY*CELL_SIZE),oTable.offsetHeight)+"px"; +var sCaption=iCurrentY+" x "+iCurrentX+" "+_self.editor.$translate("table_noun"); +if(sCurrentCaption!=sCaption){oStatus.innerHTML=sCurrentCaption=sCaption;}}else{iCurrentX=iCurrentY=0; +}}function mouseOut(e){if(bMorphing){return;}oTableSel.style.width=oTableSel.style.height="0px"; +iCurrentX=iCurrentY=0;oStatus.innerHTML=sCurrentCaption=_self.editor.$translate("cancel"); +}function statusClick(e){mouseOut.call(this,e);apf.popup.forceHide();}this.createPanelBody=function(){panelBody=document.body.appendChild(document.createElement("div")); +panelBody.className="editor_popup editor_tablepopup";panelBody.style.display="none"; +var idTableCont="editor_"+this.$uniqueId+"_tablecont",idTableSel="editor_"+this.$uniqueId+"_tablesel",idTable="editor_"+this.$uniqueId+"_table",idStatus="editor_"+this.$uniqueId+"_table_status"; +panelBody.innerHTML='

    '+this.editor.$translate("cancel")+"
    "; +oTableCont=document.getElementById(idTableCont),oTableSel=document.getElementById(idTableSel),oTable=document.getElementById(idTable),oTable.onmousedown=mouseDown.bindWithEvent(this,true),oTable.onmouseup=mouseUp.bindWithEvent(this,true),oTable.onmousemove=mouseOver.bindWithEvent(this,true),oTable.onmouseout=mouseOut.bindWithEvent(this,true),oStatus=document.getElementById(idStatus),oStatus.onmousedown=statusClick.bindWithEvent(this,true),panelBody.onselectstart=function(){return false; +},resetTableMorph();return panelBody;};this.destroy=function(){panelBody=oTableCont=oTableSel=oTable=oStatus=oTablePos=oDoc=null; +delete panelBody,delete oTableCont,delete oTableSel,delete oTable,delete oStatus,delete oTablePos,delete oDoc; +};});apf.LiveEdit.plugin("tablewizard",function(){this.name="tablewizard";this.icon="tablewizard"; +this.type=apf.CONTEXTPANEL;this.hook="context";this.state=apf.OFF;this.oTable=null; +this.oRow=null;this.oCell=null;var activeNode,oDoc,_self=this;this.execute=function(editor,e){if(this.queryState(editor)!=apf.ON){return; +}this.oTable=this.oRow=this.oCell=null;while(activeNode.tagName!="TABLE"){if(activeNode.tagName=="TD"){this.oCell=activeNode; +}else{if(activeNode.tagName=="TR"){this.oRow=activeNode;}}activeNode=activeNode.parentNode; +}this.oTable=activeNode;if(!this.editor){this.editor=editor;}if(!apf.editor.oMenu){this.createContextMenu(); +}if(!oDoc){oDoc=editor.useIframe?document:editor.$activeDocument;}apf.editor.oMenu.tablePlugin=this; +var pos=apf.getAbsolutePosition(editor.iframe);if(!e.client){e=new apf.AbstractEvent(e); +}apf.editor.oMenu.display(e.client.x+pos[0],e.client.y+pos[1],true);e.stop();editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this}); +return false;};this.queryState=function(editor){var oNode=editor.$selection.getSelectedNode(); +while(oNode.nodeType!=1||oNode.tagName!="BODY"){if(oNode.tagName=="TABLE"||oNode.tagName=="TBODY"||oNode.tagName=="TR"||oNode.tagName=="TD"){activeNode=oNode; +return apf.ON;}oNode=oNode.parentNode;}return apf.OFF;};function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1; +var trNext=nextElm(tr_elm,["TR"]);for(var i=1;i Insert row before Insert row after Delete row Insert column before Insert column after Delete column Split merged table cells Merge table cells ',document.body); +var oMenu=apf.editor.oMenu=self[idMenu];oMenu.addEventListener("onitemclick",function(e){if(this.tablePlugin!=_self){return; +}var oRow,i,j,idx=0,oEditor=_self.editor;if(_self.oCell){for(i=0,j=_self.oRow.cells.length; +i1||rowspan>1){_self.oCol.colSpan=1; +for(i=1;i'; +}_self.oRow.insertBefore(newTD,nextElm(_self.oCell,["TD","TH"]));if(rowspan>1){addRows(newTD,_self.oRow,rowspan); +}}addRows(_self.oCell,_self.oRow,rowspan);}break;case"mergecells":var rows=[],cells=[],oSel=oEditor.$selection.get(),grid=getTableGrid(_self.oTable),oCellPos,aRows,aRowCells,aBrs,oTd,k; +if(apf.isIE||oSel.rangeCount==1){var numRows=1;var numCols=1;oCellPos=getCellPos(grid,_self.oCell); +aRows=_self.oTable.rows;for(i=oCellPos.rowindex;i0){rows[rows.length]=aRowCells;}oTd=getCell(grid,oCellPos.rowindex,oCellPos.cellindex); +aBrs=oTd.getElementsByTagName("br");if(aBrs.length>1){for(j=aBrs.length;j>=1;j--){if(aBrs[j].getAttribute("_apf_placeholder")){aBrs[j].parentNode.removeChild(aBrs[j]); +}}}}}else{var x1=-1,y1=-1,x2,y2;if(oSel.rangeCount<2){return true;}for(i=0;i0){rows.push(aRowCells);}}for(i=0;icolSpan){colSpan=rowColSpan; +}lastRowSpan=-1;}var lastColSpan=-1;for(j=0;jrowSpan){rowSpan=colRowSpan; +}lastColSpan=-1;}_self.oCell=rows[0][0];_self.oCell.rowSpan=rowSpan;_self.oCell.colSpan=colSpan; +for(i=0;i0)){_self.oCell.innerHTML+=html; +}if(rows[i][j]==_self.oCell&&rows[i][j]._deleted){continue;}oCellPos=getCellPos(grid,rows[i][j]); +var tr=rows[i][j].parentNode;tr.removeChild(rows[i][j]);rows[i][j]._deleted=true; +if(tr.hasChildNodes()){continue;}tr.parentNode.removeChild(tr);var cellElm,lastCell=null; +for(k=0;cellElm=getCell(grid,oCellPos.rowindex,k);k++){if(cellElm!=lastCell&&cellElm.rowSpan>1){cellElm.rowSpan--; +}lastCell=cellElm;}if(_self.oCell.rowSpan>1){_self.oCell.rowSpan--;}}}aBrs=_self.oCell.getElementsByTagName("br"); +if(aBrs.length>1){for(i=aBrs.length;i>=1;i--){if(aBrs[i]&&aBrs[i].getAttribute("_apf_placeholder")){aBrs[i].parentNode.removeChild(aBrs[i]); +}}}break;}oEditor.$restoreFocus();oEditor.change(_self.editor.getValue());});}; +});apf.LiveEdit.plugin("visualaid",function(){this.name="visualaid";this.icon="visualaid"; +this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar"; +this.keyBinding="ctrl+shift+v";this.state=apf.OFF;this.execute=function(editor){var state=this.queryState(editor); +editor.$activeDocument.body.className=(state==apf.ON)?"":"visualAid";editor.$notifyButton(this.name); +apf.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(editor){this.state=apf[editor.$activeDocument.body.className=="visualAid"?"ON":"OFF"]; +return this.state;};});apf.__ANCHORING__=1<<13;apf.Anchoring=function(){this.$regbase=this.$regbase|apf.__ANCHORING__; +this.$anchors=[];var VERTICAL=1;var HORIZONTAL=2;this.$updateQueue=0;this.$inited=this.$parsed=this.$anchoringEnabled=false; this.$hordiff=this.$verdiff=0;this.$rule_v=this.$rule_h=this.$rule_header="";var l=apf.layout; this.$supportedProperties.push("anchors");var propHandlers={right:function(value,prop){if(!this.$anchoringEnabled&&!this.$setLayout("anchoring")){return; }if(!value&&value!==0){this.$ext.style[prop]="";}if(!this.$updateQueue){l.queue(this.$pHtmlNode,this); @@ -2182,10 +5479,89 @@ rules.push("oHtml.style.height = Math.max("+(this.minheight-this.$verdiff)+", Ma }else{l.removeRule(this.$pHtmlNode,this.$uniqueId+"_anchors");}this.$updateQueue=0; if(this.$box&&!apf.hasFlexibleBox){apf.layout.forceResize(this.$ext);}};this.addEventListener("DOMNodeInsertedIntoDocument",function(e){}); this.addEventListener("DOMNodeRemovedFromDocument",function(e){this.$disableAnchoring(); -});};apf.__CONTENTEDITABLE__=1<<24;apf.__GUIELEMENT__=1<<15;apf.__VALIDATION__=1<<6; -apf.GuiElement=function(){this.$init(true);};(function(){this.$regbase=this.$regbase|apf.__GUIELEMENT__; -this.$focussable=apf.KEYBOARD_MOUSE;this.visible=2;this.$booleanProperties["disable-keyboard"]=true; -this.$booleanProperties.visible=true;this.$booleanProperties.focussable=true;this.$supportedProperties.push("draggable","resizable"); +});};apf.__CONTENTEDITABLE__=1<<24;apf.addEventListener("load",function(){var lastShift; +apf.window.undoManager.addEventListener("afterchange",function(){apf.layout.processQueue(); +apf.document.$getVisualSelect().updateGeo();});var sel=apf.document.getSelection(); +sel.addEventListener("update",function(){});apf.addEventListener("keydown",function(e){var key=e.keyCode; +if(!apf.document.activeElement||!apf.document.activeElement.editable){return;}if(apf.document.queryCommandState("rename")){if(apf.hasSingleResizeEvent){$setTimeout(function(){apf.document.$getVisualSelect().updateGeo(); +});}if(key==27||key==13){apf.document.execCommand("rename",false,key==13);window.focus(); +apf.stopPropagation(e);return false;}else{if(apf.hasContentEditableContainerBug&&key==8&&document.getElementById("txt_rename").innerHTML=="
    "){e.preventDefault(); +}}return;}switch(key){case 27:if(apf.dragMode){var sel=apf.document.$getVisualSelect().getLastSelection(); +(apf.document.activeElement||sel[0]).$cancelInteractive();}break;case 113:apf.document.execCommand("rename",true); +return false;case 16:if(!this.dragMode&&(apf.document.documentElement.editable||self.app&&self.app.editable)){if(e.ctrlKey){apf.document.execCommand("mode",null,"select"); +}else{apf.document.execCommand("mode",null,{mode:"connect",timeout:1000,event:e.htmlEvent}); +}}break;case 17:if(!lastShift||new Date()-lastShift>500||e.htmlEvent.repeat){lastShift=new Date().getTime(); +}else{var isShowingConnections=(apf.document.queryCommandState("mode")||"").substr(0,8)=="connect-"; +apf.document.execCommand("mode",null,{mode:isShowingConnections?"arrow":"connect-element",timeout:1000,event:e.htmlEvent}); +lastShift=null;}break;}});apf.addEventListener("keyup",function(e){if(e.keyCode==16&&"select|connect".indexOf(apf.document.queryCommandState("mode"))>-1){apf.document.execCommand("mode",null,"arrow"); +}});var recursion,$focus,lastFocussed;apf.document.addEventListener("focus",$focus=function(e){if(recursion){return; +}recursion=true;var node=e.currentTarget,isSelected;if(node.editable){if(sel.rangeCount){isSelected=sel.$getNodeList().indexOf(node)>-1; +if(!e.ctrlKey){if(isSelected){recursion=false;return;}sel.removeAllRanges();}else{if(sel.getRangeAt(0).startContainer!=node.parentNode){delete e.currentTarget; +e.fromElement&&e.fromElement.focus(null,e);recursion=false;return;}if(isSelected){recursion=false; +return;}}}sel.addRange(this.createRange()).selectNode(node);lastFocussed=node;}recursion=false; +});if(apf.document.activeElement&&apf.document.activeElement.editable){sel.addRange(apf.document.createRange()).selectNode(apf.document.activeElement); +}var lastPos=[-1000,-1000];apf.addEventListener("mousedown",function(e){lastPos=[e.htmlEvent.clientX,e.htmlEvent.clientY]; +});apf.addEventListener("mouseup",function(e){if((apf.document.queryCommandState("mode")||"").indexOf("connect-")>-1){apf.document.execCommand("mode",null,"arrow"); +}if(Math.abs(lastPos[0]-e.htmlEvent.clientX)>2||Math.abs(lastPos[1]-e.htmlEvent.clientY)>2){return; +}var o=apf.document.$getVisualSelect().$getOutline();if(!o){return;}var lastTop=o.style.top; +o.style.top="-10000px";var hOutline=document.getElementById("apf_outline");if(hOutline){hOutline.style.top="-10000px"; +}var node=apf.findHost(document.elementFromPoint(e.htmlEvent.clientX,e.htmlEvent.clientY)); +o.style.top=lastTop;if(lastFocussed==node){lastFocussed=null;return;}if(!node.editable){return; +}if(sel.rangeCount>1){var idx,list=sel.$getNodeList();if(e.htmlEvent.ctrlKey&&(idx=list.indexOf(node))>-1){sel.removeRange(sel.getRangeAt(idx)); +delete e.currentTarget;var r=sel.getRangeAt(sel.rangeCount-1);recursion=true;r.startContainer.childNodes[r.startOffset].focus(); +recursion=false;return;}else{sel.removeAllRanges();sel.addRange(apf.document.createRange()).selectNode(node); +}}});});apf.ContentEditable=function(){this.$regbase=this.$regbase|apf.__CONTENTEDITABLE__; +this.editable=false;this.$canEdit=true;this.$booleanProperties.editable=true;this.$propHandlers.editable=function(value,prop){if(this.nomk){this.editable=false; +return false;}if(value){if(this.$canEdit&&this.$ext&&!this.$coreHtml){this.dragOutline=true; +(this.$propHandlers.draggable||apf.GuiElement.propHandlers.draggable).call(this,true); +(this.$propHandlers.resizable||apf.GuiElement.propHandlers.resizable).call(this,true); +this.$lastFocussable=[this.$focussable,this.focussable];if(!this.$focussable||!this.focussable){apf.GuiElement.propHandlers.focussable.call(this,true); +}this.$focussable=this.focussable=true;if(this.$blur){this.$blur();}if(this.$propHandlers.visible){this.$propHandlers.visible_original=this.$propHandlers.visible; +}this.$propHandlers.visible=function(value){apf.setOpacity(this.$ext,value?1:0.5); +this.$ext.onmouseover=value?null:function(){apf.setOpacity(this,1);};this.$ext.onmouseout=value?null:function(e){if(!e){e=event; +}if(!e.toElement||e.toElement.host!==false){apf.setOpacity(this,0.5);}};};if(this.visible===false){if(this.$propHandlers.visible_original){this.$propHandlers.visible_original.call(this,true); +}this.$propHandlers.visible.call(this,false);}this.$lastDisabled=this.disabled; +this.disabled=-1;if(this.$isWindowContainer){this.$isWindowContainer=-2;}var rInfo; +if(rInfo=this.ownerDocument.queryCommandEnabled("rename",false,this)){var htmlNode=!rInfo[0]?this.$ext:(rInfo[0].nodeType==1?rInfo[0]:rInfo[0].parentNode); +if(apf.isIE){htmlNode.ondblclick=apf.ContentEditable.$renameStart;}else{apf.addListener(htmlNode,"mousedown",apf.ContentEditable.$renameStart); +}this.addEventListener("$skinchange",apf.ContentEditable.$renameSkinChange);}this.addEventListener("contextmenu",apf.ContentEditable.$contextMenu); +apf.ContentEditable.addInteraction(this);}this.isContentEditable=true;if(!this.parentNode.editable){var curfoc,vsel,lsel=(vsel=this.ownerDocument.$getVisualSelect()).getLastSelection(); +if(!(curfoc=apf.window.getLastActiveElement())&&lsel.length||curfoc&&lsel.indexOf(curfoc)>-1){vsel.show(); +}else{if(curfoc&&curfoc.editable){this.ownerDocument.getSelection().$selectList([curfoc]); +}}}apf.setStyleClass(this.$ext,"editable");}else{if(this.$canEdit&&this.$ext&&!this.$coreHtml){var n; +if(n=this.getAttributeNode("draggable")){apf.removeListener(this.$ext,"mousedown",this.$dragStart); +n.$triggerUpdate();}else{apf.removeListener(this.$ext,"mousedown",this.$dragStart); +(this.$propHandlers.draggable||apf.GuiElement.propHandlers.draggable).call(this,this.localName=="window"||false); +}delete this.dragOutline;delete this.$showDrag;delete this.$showResize;delete this.realtime; +if(n=this.getAttributeNode("resizable")){n.$triggerUpdate();}else{(this.$propHandlers.resizable||apf.GuiElement.propHandlers.resizable).call(this,false); +}if(this.$lastFocussable){this.$focussable=this.$lastFocussable[0];this.focussable=this.$lastFocussable[0]&&this.$lastFocussable[1]; +if(!this.focussable){apf.GuiElement.propHandlers.focussable.call(this,this.focussable); +}delete this.$lastFocussable;}if(this.hasFocus&&this.hasFocus()){this.$focus(); +}this.disabled=this.$lastDisabled;delete this.$lastDisabled;if(this.visible===false){if(this.$propHandlers.visible_original){this.$propHandlers.visible_original.call(this,false); +}this.$propHandlers.visible.call(this,true);}if(this.$propHandlers.visible_original){this.$propHandlers.visible=this.$propHandlers.visible_original; +delete this.$propHandlers.visible_original;}delete this.$isWindowContainer;var rInfo; +if(rInfo=this.ownerDocument.queryCommandEnabled("rename",false,this)){var htmlNode=!rInfo[0]?this.$ext:(rInfo[0].nodeType==1?rInfo[0]:rInfo[0].parentNode); +if(apf.isIE){htmlNode.ondblclick=null;}else{apf.removeListener(htmlNode,"mousedown",apf.ContentEditable.$renameStart); +}this.removeEventListener("$skinchange",apf.ContentEditable.$renameSkinChange); +}this.removeEventListener("contextmenu",apf.ContentEditable.$contextMenu);apf.ContentEditable.removeInteraction(this); +var sel=this.ownerDocument.$getVisualSelect().getLastSelection();if(sel.indexOf(this)>-1){this.ownerDocument.$getVisualSelect().hide(); +}}this.isContentEditable=false;apf.setStyleClass(this.$ext,"",["editable"]);}}; +this.addEventListener("DOMNodeInsertedIntoDocument",function(e){if(!this.editable){this.editable=apf.isTrue(apf.getInheritedAttribute(this,"editable")); +if(this.editable){this.$propHandlers.editable.call(this,true);this.dispatchEvent("prop.editable",{value:true}); +this.$inheritProperties.editable=2;}}});this.addEventListener("DOMNodeRemovedFromDocument",function(e){}); +};apf.ContentEditable.$contextMenu=function(e){this.ownerDocument.execCommand("contextmenu",true,{amlNode:this,htmlEvent:e}); +apf.stopEvent(e);return false;};(function(){var time;apf.ContentEditable.$renameStart=apf.isIE?function(){e=event; +if(e.srcElement!=this){return;}apf.findHost(e.srcElement).ownerDocument.execCommand("rename",true); +apf.stopPropagation(e);}:function(e){if(e.target!=this){return;}if(!time||new Date()-time[0]>500||time[1]!=e.target){time=[new Date().getTime(),e.target]; +}else{if(time){apf.findHost(e.target).ownerDocument.execCommand("rename",true); +apf.stopPropagation(e);time=null;}}};})();apf.ContentEditable.$renameSkinChange=function(e){var rInfo=this.ownerDocument.queryCommandEnabled("rename",false,this); +var htmlNode=!rInfo[0]?this.$ext:(rInfo[0].nodeType==1?rInfo[0]:rInfo[0].parentNode); +if(apf.isIE){htmlNode.ondblclick=apf.ContentEditable.$renameStart;}else{apf.addListener(htmlNode,"mousedown",apf.ContentEditable.$renameStart); +}};apf.XhtmlElement.prototype.implement(apf.ContentEditable);apf.config.$inheritProperties.editable=2; +apf.__GUIELEMENT__=1<<15;apf.__VALIDATION__=1<<6;apf.GuiElement=function(){this.$init(true); +};(function(){this.$regbase=this.$regbase|apf.__GUIELEMENT__;this.$focussable=apf.KEYBOARD_MOUSE; +this.visible=2;this.$booleanProperties["disable-keyboard"]=true;this.$booleanProperties.visible=true; +this.$booleanProperties.focussable=true;this.$supportedProperties.push("draggable","resizable"); this.$supportedProperties.push("focussable","zindex","disabled","tabindex","disable-keyboard","contextmenu","visible","autosize","loadaml","actiontracker","alias","width","left","top","height","tooltip"); this.$setLayout=function(type,insert){if(!this.$drawn||!this.$pHtmlNode){return false; }if(this.parentNode){if(this.parentNode.localName=="table"){if(this.$disableCurrentLayout){this.$disableCurrentLayout(); @@ -2195,7 +5571,7 @@ this.$setLayout=function(type,insert){if(!this.$drawn||!this.$pHtmlNode){return }}}if(!this.$anchoringEnabled){if(this.$disableCurrentLayout){this.$disableCurrentLayout(); }this.$enableAnchoring();this.$disableCurrentLayout=this.$disableAnchoring;}return type=="anchoring"; };this.addEventListener("DOMNodeInserted",function(e){if(e.currentTarget==this&&"vbox|hbox|table".indexOf(this.parentNode.localName)==-1){this.$setLayout(); -}});this.implement(apf.Anchoring);this.setWidth=function(value){this.setProperty("width",value,false,true); +}});this.implement(apf.Anchoring,apf.ContentEditable,apf.LiveEdit);this.setWidth=function(value){this.setProperty("width",value,false,true); return this;};this.setHeight=function(value){this.setProperty("height",value,false,true); return this;};this.setLeft=function(value){this.setProperty("left",value,false,true); return this;};this.setTop=function(value){this.setProperty("top",value,false,true); @@ -2213,25 +5589,32 @@ return this;};this.hasFocus=function(){};this.addEventListener("DOMNodeInsertedI if(this.parentNode){if(this.localName=="item"&&this.parentNode.hasFeature(apf.__MULTISELECT__)){this.$pHtmlNode=this.parentNode.$container; }else{this.$pHtmlNode=this.parentNode.$int;}}if(!this.$pHtmlNode){return;}this.$pHtmlDoc=this.$pHtmlNode.ownerDocument||document; if(this.$initSkin){this.$initSkin(x);}if(this.$draw){this.$draw();}if(e.id){this.$ext.setAttribute("id",e.id); -}if(typeof this.visible=="undefined"){this.visible=true;}if(this.$focussable&&typeof this.focussable=="undefined"){apf.GuiElement.propHandlers.focussable.call(this); +}if(typeof this.visible=="undefined"){this.visible=true;}if(apf.debug&&this.$ext&&this.$ext.nodeType){this.$ext.setAttribute("uniqueId",this.$uniqueId); +}if(this.$focussable&&typeof this.focussable=="undefined"){apf.GuiElement.propHandlers.focussable.call(this); }this.$drawn=true;},true);var f=function(e){if(!this.$pHtmlNode){return;}this.$setLayout(); if(this.$ext){var hasPres=(this.hasFeature(apf.__PRESENTATION__))||false;var type=this.$isLeechingSkin?this.localName:"main"; if(this.minwidth==undefined){this.minwidth=apf.getCoord(hasPres&&parseInt(this.$getOption(type,"minwidth")),0); }if(this.minheight==undefined){this.minheight=apf.getCoord(hasPres&&parseInt(this.$getOption(type,"minheight")),0); }if(this.maxwidth==undefined){this.maxwidth=apf.getCoord(hasPres&&parseInt(this.$getOption(type,"maxwidth")),10000); }if(this.maxheight==undefined){this.maxheight=apf.getCoord(hasPres&&parseInt(this.$getOption(type,"maxheight")),10000); -}}if(this.$loadAml){this.$loadAml(this.$aml);}};this.addEventListener("DOMNodeInsertedIntoDocument",f); -this.addEventListener("$skinchange",f);var f;this.addEventListener("$event.resize",f=function(c){apf.layout.setRules(this.$ext,"resize","var o = apf.all["+this.$uniqueId+"]; if (o) o.dispatchEvent('resize');",true); -apf.layout.queue(this.$ext);this.removeEventListener("$event.resize",f);});this.addEventListener("contextmenu",function(e){if(!this.contextmenus){return; -}if(this.hasFeature(apf.__DATABINDING__)){var contextmenu;var xmlNode=this.hasFeature(apf.__MULTISELECT__)?this.selected:this.xmlRoot; -var i,l,m,isRef,sel,menuId,cm,result;for(i=0,l=this.contextmenus.length;i-1){var model,pNode=this; +if(model.queryNode(xpath)!=value){throw new Error("xml data node is not attached to model ("+xpath+") : "+value+":"+(value&&value.xml)); +}model.register(this,xpath);return;}}}else{if(value.indexOf("[::")>-1){var model,pNode=this; do{pNode=pNode.parentNode;model=pNode.getAttribute("model");}while(pNode.parentNode&&pNode.parentNode.nodeType==1&&(!model||model==value)); if(model&&typeof model=="object"){model=model.id;}this.$inheritProperties.model=3; if(model){value=value.replace(/\[\:\:/g,"["+model+"::");}else{apf.console.warn("No found model on any of the parents for this element while trying to overload model: "+value); @@ -2517,10 +5915,13 @@ this.resort=function(options,clear,noReload){if(!this.$sort){this.$sort=new apf. }this.$sort.set(options,clear);if(this.clearAllCache){this.clearAllCache();}if(noReload){return; }var _self=this;(function sortNodes(xmlNode,htmlParent){if(!xmlNode){return;}var sNodes=_self.$sort.apply(apf.getArrayFromNodelist(xmlNode.selectNodes(_self.each))); for(var i=0;i-1){var model=value.split("::");if(!apf.xPathAxis[model[0 this.each=model[1];}else{this.each=value;}}else{this.each=value;}if(this.each==this.$lastEach){return; }this.$lastEach=value;if(!this.$model&&!this.$initingModel){this.$initingModel=true; this.$setInheritedAttribute("model");return;}if(this.$checkLoadQueue()!==false){return; -}}if(this.xmlRoot&&!this.$bindRuleTimer&&this.$amlLoaded){var _self=this;apf.queue.add("reload"+this.$uniqueId,function(){_self.reload(); -});}};this.$select=function(o){if(this.renaming){this.stopRename(null,true);}if(!o||!o.style){return; -}return this.$setStyleClass(o,"selected");};this.$deselect=function(o){if(this.renaming){this.stopRename(null,true); +}}if(this.xmlRoot&&!this.$bindRuleTimer&&this.$amlLoaded){var _self=this;apf.queue.add("reload"+this.$uniqueId,function(){apf.console.log("Reloading multiselect based on attribute '"+prop+"' bind change to value '"+value+"'\n\n"+_self.serialize(true)); +_self.reload();});}};this.$select=function(o){if(this.renaming){this.stopRename(null,true); +}if(!o||!o.style){return;}return this.$setStyleClass(o,"selected");};this.$deselect=function(o){if(this.renaming){this.stopRename(null,true); if(this.ctrlselect){return false;}}if(!o){return;}return this.$setStyleClass(o,"",["selected","indicate"]); };this.$indicate=function(o){if(this.renaming){this.stopRename(null,true);}if(!o){return; }return this.$setStyleClass(o,"indicate");};this.$deindicate=function(o){if(this.renaming){this.stopRename(null,true); @@ -2634,9 +6044,10 @@ value=bRule.value||bRule.match;this.$clearDynamicProperty(lrule);if(value.indexO }else{if(this.setProperty){this.setProperty(lrule,value,true);}}}}}if(this.errBox&&this.isValid&&this.isValid()){this.clearError(); }};this.$xmlUpdate=function(action,xmlNode,listenNode,UndoObj){if(action=="redo-remove"){var retreatToListenMode=false,model=this.getModel(true); if(model){var xpath=model.getXpathByAmlNode(this);if(xpath){xmlNode=model.data.selectSingleNode(xpath); -if(xmlNode!=this.xmlRoot){retreatToListenMode=true;}}}if(retreatToListenMode||this.xmlRoot==xmlNode){return model.$waitForXml(this); -}}if(UndoObj&&!UndoObj.xmlNode){UndoObj.xmlNode=this.xmlRoot;}var b,lrule,rule,bRules,bRule,value; -if(b=this.$bindings){for(rule in b){lrule=rule.toLowerCase();if(this.$supportedProperties.indexOf(lrule)>-1){bRule=(bRules=b[lrule]).length==1?bRules[0]:this.$getBindRule(lrule,xmlNode); +if(xmlNode!=this.xmlRoot){retreatToListenMode=true;}}}if(retreatToListenMode||this.xmlRoot==xmlNode){if(!model){throw new Error(apf.formatErrorString(0,this,"Setting change notifier on component","Component without a model is listening for changes",this.$aml)); +}return model.$waitForXml(this);}}if(UndoObj&&!UndoObj.xmlNode){UndoObj.xmlNode=this.xmlRoot; +}var b,lrule,rule,bRules,bRule,value;if(b=this.$bindings){for(rule in b){lrule=rule.toLowerCase(); +if(this.$supportedProperties.indexOf(lrule)>-1){bRule=(bRules=b[lrule]).length==1?bRules[0]:this.$getBindRule(lrule,xmlNode); value=bRule.value||bRule.match;this.$clearDynamicProperty(lrule);if(value.indexOf("{")>-1||value.indexOf("[")>-1){this.$setDynamicProperty(lrule,value); }else{if(this.setProperty){this.setProperty(lrule,value);}}}}}if(this.errBox&&this.isValid&&this.isValid()){this.clearError(); }this.dispatchEvent("xmlupdate",{action:action,xmlNode:xmlNode,UndoObj:UndoObj}); @@ -2647,6 +6058,7 @@ this.$selectedList=[];});};(function(){this.$regbase=this.$regbase|apf.__MULTISE this.sellength=0;this.selected=null;this.$selected=null;this.caret=null;this.$caret=null; this.useindicator=true;this.remove=function(nodeList){if(!nodeList){nodeList=this.$valueList; }if(nodeList.nodeType){nodeList=[nodeList];}if(!nodeList||!nodeList.length){return; +}if(nodeList.contains(this.xmlRoot)){throw new Error(apf.formatErrorString(0,"Removing nodes","You are trying to delete the xml root of this element. This is not allowed.")); }var changes=[];for(var i=0;i1?nodeList:null); @@ -2654,7 +6066,9 @@ this.useindicator=true;this.remove=function(nodeList){if(!nodeList){nodeList=thi }else{if(typeof xmlNode=="string"){if(xmlNode.trim().charAt(0)=="<"){xmlNode=apf.getXml(xmlNode); rule=this.$actions.getRule("add",xmlNode);}else{var rules=this.$actions.add;for(var i=0,l=rules.length; i-1){return; }if(this.dispatchEvent("beforeselect",{selected:xmlNode,htmlNode:htmlNode,ctrlKey:ctrlKey,shiftKey:shiftKey,force:force,captureOnly:noEvent})===false){return false; @@ -2714,10 +6131,10 @@ this.$caret=this.$indicate(htmlNode);}if(!noEvent){this.dispatchEvent("aftersele }var htmlNode,xmlNode=xmlNodeList[i];if(typeof xmlNode!="object"){xmlNode=apf.xmldb.getNodeById(xmlNode); }if(!(typeof(xmlNode.style||"")=="object")){htmlNode=this.$pHtmlDoc.getElementById(xmlNode.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId); }else{htmlNode=xmlNode;xmlNode=apf.xmldb.getNodeById(htmlNode.getAttribute(apf.xmldb.htmlIdTag)); -}if(!xmlNode){continue;}if(htmlNode){if(!sel&&selected==htmlNode){sel=htmlNode; -}this.$select(htmlNode,xmlNode);this.$selectedList.push(htmlNode);}this.$valueList.push(xmlNode); -}this.$selected=sel||this.$selectedList[0];this.selected=selected||this.$valueList[0]; -this.dispatchEvent("afterselect",{selection:this.$valueList,selected:this.selected,caret:this.caret,captureOnly:noEvent}); +}if(!xmlNode){apf.console.warn("Component : "+this.name+" ["+this.localName+"]\nMessage : xmlNode whilst selecting a list of xmlNodes could not be found. Ignoring."); +continue;}if(htmlNode){if(!sel&&selected==htmlNode){sel=htmlNode;}this.$select(htmlNode,xmlNode); +this.$selectedList.push(htmlNode);}this.$valueList.push(xmlNode);}this.$selected=sel||this.$selectedList[0]; +this.selected=selected||this.$valueList[0];this.dispatchEvent("afterselect",{selection:this.$valueList,selected:this.selected,caret:this.caret,captureOnly:noEvent}); };this.setCaret=function(xmlNode){if(!xmlNode){if(this.$caret){this.$deindicate(this.$caret); }this.caret=this.$caret=null;return;}var htmlNode;if(typeof xmlNode!="object"){xmlNode=apf.xmldb.getNodeById(xmlNode); }if(!(typeof(xmlNode.style||"")=="object")){htmlNode=this.$findHtmlNode(xmlNode.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId); @@ -2766,13 +6183,15 @@ this.$supportedProperties.push("selectable","ctrlselect","multiselect","autosele this.$propHandlers.value=function(value){if(this.$lastValue==value){delete this.$lastValue; return;}if(!this.$attrBindings.eachvalue&&!this.$amlLoaded&&this.getAttribute("eachvalue")){var _self=this; return apf.queue.add("value"+this.$uniqueId,function(){_self.$propHandlers.value.call(_self,value); -});}if(value||value===0||this["default"]){this.select(String(value)||this["default"]); +});}var rule=this.$getBindRule("value",this.xmlRoot);if(rule){if(rule.models[0]==this.$model&&rule.cvalue.xpaths[0]!="#"){throw new Error(apf.formatErrorString(0,this,"Setting value attribute",'Value should not point to the same model where the items are loaded from. Please use value="[mdlName::xpath]" to specify the value. Use selected="[xpath]" to just select a node without making a databinding to it.')); +}}if(value||value===0||this["default"]){this.select(String(value)||this["default"]); }else{this.clearSelection();}};this.$propHandlers["default"]=function(value,prop){if(!this.value||!this.$amlLoaded&&!(this.getAttribute("value")||this.getAttribute("selected")||this.getAttribute("selection"))){this.$propHandlers.value.call(this,""); }};this.$propHandlers.caret=function(value,prop){if(value){this.setCaret(value); }};this.$propHandlers.selection=this.$propHandlers.selected=function(value,prop){if(!value){value=this[prop]=null; }if(prop=="selected"&&typeof value!="string"){if(value&&value.nodeType!=1){value=value.nodeValue; -}else{return;}}if(this.$isSelecting){this.selection=this.$valueList;return false; -}var nodes,bindSet,getValue,i,j,c,d;if(prop=="selection"){if(typeof value=="object"&&value==this.$valueList){var pNode; +}else{return;}}if(prop=="selection"&&(this.getAttribute("selection")||"*").substr(0,1)!="*"){apf.console.warn("Selection attribute ("+this.getAttributeNode("selection")+") should select multiple nodes. Please prefix xpath query with a * (ex.: *[item])."); +}if(this.$isSelecting){this.selection=this.$valueList;return false;}var nodes,bindSet,getValue,i,j,c,d; +if(prop=="selection"){if(typeof value=="object"&&value==this.$valueList){var pNode; if((c=this.$attrBindings[prop])&&c.cvalue.models){this.$isSelecting=true;bindSet=this.$attrBindings.eachvalue&&"eachvalue"||this.$bindings.value&&"value"||this.$hasBindRule("caption")&&"caption"; if(!bindSet){throw new Error("Missing bind rule set: eachvalue, value or caption"); }var selNodes=this.$getDataNode(prop,this.xmlRoot);nodes=value;getValue=(d=this.$attrBindings["selection-unique"])&&d.cvalue; @@ -2817,9 +6236,11 @@ $setTimeout(function(){if(_self.selected==e.selected){_self.setProperty("selecte }delete _self.$chained;},10);}else{this.setProperty("selected",combinedvalue||e.selected); delete this.$chained;}var valueRule=this.$attrBindings.eachvalue&&"eachvalue"||this.$bindings.value&&"value"||this.$hasBindRule("caption")&&"caption"; if(valueRule){this.$lastValue=this.$applyBindRule(valueRule,e.selected);if(this.$lastValue!=(valueRule!="value"&&(this.xmlRoot&&this.$applyBindRule("value",this.xmlRoot,null,true))||this.value)){if(valueRule=="eachvalue"||this.xmlRoot!=this){this.change(this.$lastValue); -}else{this.setProperty("value",this.$lastValue);}}delete this.$lastValue;}}},true); -}).call(apf.MultiSelect.prototype=new apf.MultiselectBinding());apf.__CHILDVALUE__=1<<27; -apf.ChildValue=function(){if(!this.$childProperty){this.$childProperty="value"; +}else{this.setProperty("value",this.$lastValue);}}delete this.$lastValue;}}if(typeof apf.offline!="undefined"&&apf.offline.state.enabled&&apf.offline.state.realtime){for(var sel=[],i=0; +i(<\?lm)?([\s\S]*?)(?:\?>)?<[^>]*?>$/; this.addEventListener("DOMCharacterDataModified",f=function(e){if(e&&(e.currentTarget==this||e.currentTarget.nodeType==2&&e.relatedNode==this)||this.$amlDestroyed){return; }if(this.getAttribute(this.$childProperty)){return;}var m=this.serialize().match(re),v=m&&m[2]||""; @@ -2836,24 +6257,40 @@ if(m&&m[1]){v="{"+v+"}";}if(v.indexOf("{")>-1||v.indexOf("[")>-1){this.$setDynam this.getActionTracker=function(ignoreMe){if(!apf.AmlNode){return apf.window.$at; }var pNode=this,tracker=ignoreMe?null:this.$at;if(!tracker&&this.dataParent){tracker=this.dataParent.parent.$at; }while(!tracker){if(!pNode.parentNode&&!pNode.$parentNode){var model;return(model=this.getModel&&this.getModel(true))&&model.$at||apf.window.$at; -}tracker=(pNode=pNode.parentNode||pNode.$parentNode).$at;}return tracker;};this.$actionsLog={}; -this.$actions=false;this.$startAction=function(name,xmlContext,fRollback){if(this.disabled||this.liveedit&&name!="edit"){return false; -}var actionRule=this.$actions&&this.$actions.getRule(name,xmlContext);if(!actionRule&&apf.config.autoDisableActions&&this.$actions){return false; -}var bHasOffline=typeof apf.offline!="undefined";if(this.dispatchEvent(name+"start",{xmlContext:xmlContext})===false){return false; -}this.$actionsLog[name]=xmlContext;return true;};this.$stopAction=function(name,isCancelled,curLock){delete this.$actionsLog[name]; -};this.$executeAction=function(atAction,args,action,xmlNode,noevent,contextNode,multiple){var rule=this.$actions&&this.$actions.getRule(action,xmlNode); -if(!rule&&this.$actions&&apf.config.autoDisableActions&&"action|change".indexOf(action)==-1){apf.console.warn("Could not execute action '"+action+"'. No valid action rule was found and auto-disable-actions is enabled"); -return false;}var newMultiple;if(multiple){newMultiple=[];for(var k=multiple.length-1; -k>=0;k--){newMultiple.unshift({xmlActionNode:rule&&rule[4],amlNode:this,selNode:multiple[k],xmlNode:multiple[k]}); -}}var ev=new apf.AmlEvent("before"+action.toLowerCase(),{action:atAction,args:args,xmlActionNode:rule,amlNode:this,selNode:contextNode,multiple:newMultiple||false}); +}tracker=(pNode=pNode.parentNode||pNode.$parentNode).$at;}return tracker;};this.$lock={}; +this.$actionsLog={};this.$actions=false;this.$startAction=function(name,xmlContext,fRollback){if(this.disabled||this.liveedit&&name!="edit"){return false; +}var actionRule=this.$actions&&this.$actions.getRule(name,xmlContext);if(!actionRule&&apf.config.autoDisableActions&&this.$actions){if(!xmlContext){apf.console.warn("Tried starting new action but no xml context was specified."); +}else{apf.console.warn("Tried starting new action but no '"+name+"' action rule was found."); +}return false;}var bHasOffline=typeof apf.offline!="undefined";if(bHasOffline&&!apf.offline.canTransact()){return false; +}if(this.dispatchEvent(name+"start",{xmlContext:xmlContext})===false){return false; +}if(this.$lock[name]&&!this.$lock[name].stopped){apf.console.warn("Starting new action whilst previous action wasn't terminated:"+name); +this.$stopAction();}var lockInstruction=actionRule?actionRule.lock:null;if((bHasOffline&&(!apf.offline.enabled||!apf.offline.onLine))&&lockInstruction){var curLock=this.$lock[name]={start:bHasOffline&&!apf.offline.onLine?apf.offline.offlineTime:new Date().getISOTime(),stopped:false,xmlContext:xmlContext,instr:lockInstruction,rollback:fRollback},_self=this; +apf.saveData(lockInstruction,{xmlNode:xmlContext,unlock:false,callback:function(data,state,extra){if(state==apf.TIMEOUT&&extra.retries=0;k--){newMultiple.unshift({xmlActionNode:rule&&rule[4],amlNode:this,selNode:multiple[k],xmlNode:multiple[k]}); +}}var ev=new apf.AmlEvent("before"+action.toLowerCase(),{action:atAction,args:args,xmlActionNode:rule,amlNode:this,selNode:contextNode,multiple:newMultiple||false,timestamp:curLock?curLock.start:new Date().getUTCTime()}); if(!noevent){if(this.dispatchEvent(ev.name,null,ev)===false){return false;}delete ev.currentTarget; }var at=this.getActionTracker();if(!at){return UndoObj;}var UndoObj=at.execute(ev); ev.xmlNode=UndoObj.xmlNode;ev.undoObj=UndoObj;if(!noevent){ev.name="after"+action.toLowerCase(); ev.cancelBubble=false;delete ev.returnValue;delete ev.currentTarget;this.dispatchEvent(ev.name,null,ev); }return UndoObj;};this.$executeSingleValue=function(atName,setName,xmlNode,value,getArgList){var xpath,args,rule=this.$getBindRule(setName,xmlNode); -if(!rule){return false;}var compiled;["valuematch","match","value"].each(function(type){if(!rule[type]||compiled){return; +if(!rule){if(this.$getBindRule(setName)){throw new Error("There is no rule that matches the xml node for this operation. Please make sure you are matching a node and using the value to specify it's value : "+xmlNode.xml); +}else{return false;}}var compiled;["valuematch","match","value"].each(function(type){if(!rule[type]||compiled){return; }compiled=rule["c"+type];if(!compiled){compiled=rule.compile(type);}if(compiled.type!=3){compiled=null; -}});var atAction,model,node,sel=compiled.xpaths,shouldLoad=false;if(sel[0]=="#"||sel[1]=="#"){var m=(rule.cvalue3||(rule.cvalue3=apf.lm.compile(rule.value,{xpathmode:5})))(xmlNode); +}});if(!compiled){throw new Error("Cannot create from rule that isn't a single xpath"); +}var atAction,model,node,sel=compiled.xpaths,shouldLoad=false;if(sel[0]=="#"||sel[1]=="#"){var m=(rule.cvalue3||(rule.cvalue3=apf.lm.compile(rule.value,{xpathmode:5})))(xmlNode); model=m.model&&m.model.$isModel&&m.model;if(model){node=model.queryNode(m.xpath); xmlNode=model.data;}else{model=apf.xmldb.findModel(m.model);node=m.model.selectSingleNode(m.xpath); xmlNode=m.model;}sel[1]=m.xpath;}else{model=sel[0]&&apf.nameserver.get("model",sel[0])||this.$model,node=model?model.queryNode(sel[1]):(xmlNode||this.xmlRoot).selectSingleNode(sel[1]); @@ -2962,9 +6399,25 @@ return;}var r=document.selection.createRange();try{r.moveToElementText(this);if( }}catch(e){}r.select();};if(apf.hasFocusBug){this.$txt.onfocus=function(){if(apf.window){apf.window.$focusfix2(); }};}this.$txt.onblur=function(){if(apf.hasFocusBug){apf.window.$blurfix();}if(this.host.$autocomplete){return; }this.host.stopRename(null,true);};}this.$txt.refCount++;};apf.__ALIGNMENT__=1<<29; +apf.A11y=function(){this.setRole=function(oNode,sRole){if(!oNode){throw new Error(); +}if(!apf.A11y.ROLES[sRole]){throw new Error();}oNode.setAttribute("role",sRole); +};this.setWidgetAttr=function(oNode,sAttr,mValue){var rel=apf.A11y.ATTR_WIDGETS[sAttr]; +if(!rel){throw new Error("attr does not exist");}if((typeof rel=="boolean"&&typeof mValue!="boolean")||(typeof rel=="number"&&typeof mValue!="number")||((typeof rel=="string"||apf.isArray(rel))&&typeof mValue!="string")){throw new Error("invalid type"); +}oNode.setAttribute("aria-"+sAttr,mValue);};this.updateLiveRegion=function(oNode,sAttr,mValue){var rel=apf.A11y.ATTR_LIVEREGION[sAttr]; +if(!rel){throw new Error("attr does not exist");}if((typeof rel=="boolean"&&typeof mValue!="boolean")||(apf.isArray(rel)&&typeof mValue!="string")){throw new Error("invalid type"); +}if(oNode){oNode.setAttribute("aria-"+sAttr,mValue);}else{}};this.setDragDropAttr=function(oNode,sAttr,mValue){var rel=apf.A11y.ATTR_LIVEREGION[sAttr]; +if(!rel){throw new Error("attr does not exist");}if((typeof rel=="boolean"&&typeof mValue!="boolean")||(apf.isArray(rel)&&typeof mValue!="string")){throw new Error("invalid type"); +}oNode.setAttribute("aria-"+sAttr,mValue);};this.setRelationAttr=function(){var args=Array.prototype.slice.call(arguments),oNode=args.shift(),sAttr=args.shift(),sVal=args.join(" "); +if(!apf.A11y.ATTR_RELATIONS[sAttr]){throw new Error();}oNode.setAttribute("aria-"+sAttr,sVal); +};};apf.A11y.ROLES={alert:1,alertdialog:1,application:1,article:1,banner:1,button:1,checkbox:1,columnheader:1,combobox:1,complementary:1,contentinfo:1,definition:1,dialog:1,directory:1,grid:1,gridcell:1,"group:":1,heading:1,img:1,link:1,list:1,listbox:1,listitem:1,log:1,main:1,marquee:1,math:1,menu:1,menubar:1,menuitem:1,menuitemcheckbox:1,menuitemradio:1,navigation:1,note:1,option:1,presentation:1,progressbar:1,radio:1,radiogroup:1,region:1,row:1,rowheader:1,search:1,seperator:1,slider:1,slinbutton:1,status:1,tab:1,tablist:1,tabpanel:1,textbox:1,timer:1,toolbar:1,tooltip:1,tree:1,treegrid:1,treeitem:1}; +apf.A11y.ATTR_WIDGETS={autocomplete:true,checked:true,disabled:true,expanded:true,haspopup:true,hidden:true,invalid:["grammar","false","spelling","true"],level:1,multiline:true,multiselectable:true,pressed:["true","false","pressed"],readonly:true,required:true,selected:true,sort:["ascending","descending","none","other"],valuemax:1,valuemin:1,valuenow:1,valuetext:"string"}; +apf.A11y.ATTR_LIVEREGION={atomic:true,busy:true,live:["off","polite","assertive"],relevant:["additions","removals","text","all","additions text"]}; +apf.A11y.ATTR_DRAGDROP={dropeffect:["copy","move","reference","execute","popup","none"],grabbed:true}; +apf.A11y.ATTR_RELATIONS={activedescendant:{},controls:{},describedby:{},flowto:{},label:"1",labelledby:{},owns:{},posinset:1,setsize:1}; apf.BaseButton=function(){this.$init(true);};(function(){this.implement(apf.ChildValue); this.$refKeyDown=this.$refMouseDown=0;this.$mouseOver=this.$mouseLeft=false;this.$propHandlers.background=function(value){var oNode=this.$getLayoutNode("main","background",this.$ext); -if(!oNode){return;}if(value){var b=value.split("|");this.$background=b.concat(["vertical",2,16].slice(b.length-1)); +if(!oNode){return apf.console.warn("No background defined in the Button skin","button"); +}if(value){var b=value.split("|");this.$background=b.concat(["vertical",2,16].slice(b.length-1)); oNode.style.backgroundImage="url("+this.mediaPath+b[0]+")";oNode.style.backgroundRepeat="no-repeat"; }else{oNode.style.backgroundImage="";oNode.style.backgroundRepeat="";this.$background=null; }};this.addEventListener("keydown",function(e){var key=e.keyCode;switch(key){case 13:if(this.localName!="checkbox"){this.$ext.onmouseup(e.htmlEvent,true); @@ -2987,7 +6440,8 @@ if(_self.$notfromext&&(e.srcElement||e.target)==this){return;}_self.$mouseOver=t if(!_self.disabled){_self.$updateState(e,"mouseover");}}};this.$ext.onmouseout=function(e){e=e||window.event; var tEl=e.explicitOriginalTarget||e.toElement;if(apf.isChildOf(this,tEl)){return; }_self.$mouseOver=false;_self.$refMouseDown=0;_self.$mouseLeft=true;if(!_self.disabled){_self.$updateState(e,"mouseout"); -}};if(apf.hasClickFastBug){this.$ext.ondblclick=this.$ext.onmouseup;}};this.$doBgSwitch=function(nr){if(this.background&&(this.$background[2]>=nr||nr==4)){if(nr==4){nr=this.$background[2]+1; +}};if(apf.isIphone){apf.iphone.linkEvents(this.$ext,true);}if(apf.hasClickFastBug){this.$ext.ondblclick=this.$ext.onmouseup; +}};this.$doBgSwitch=function(nr){if(this.background&&(this.$background[2]>=nr||nr==4)){if(nr==4){nr=this.$background[2]+1; }var strBG=this.$background[1]=="vertical"?"0 -"+(parseInt(this.$background[3])*(nr-1))+"px":"-"+(parseInt(this.$background[3])*(nr-1))+"px 0"; this.$getLayoutNode("main","background",this.$ext).style.backgroundPosition=strBG; }};this.$focus=function(){if(!this.$ext){return;}this.$setStyleClass(this.$ext,this.$baseCSSname+"Focus"); @@ -3071,10 +6525,12 @@ elSelect.setAttribute("onmouseup","if (!this.hasPassedDown) return; }else{elSelect.setAttribute("onmouseout","apf.setStyleClass(this, '', ['hover']);"); elSelect.setAttribute("ondblclick","var o = apf.lookup("+this.$uniqueId+"); o.choose(null, true)"); elSelect.setAttribute(this.itemSelectEvent||"onmousedown","var o = apf.lookup("+this.$uniqueId+"); o.select(this, event.ctrlKey, event.shiftKey, -1)"); +}if(this.$listGrid){oItem.setAttribute("onmouseover",oItem.getAttribute("onmouseover")+"var o = apf.lookup("+this.$uniqueId+");o.$selectSeries(event);"); }if(this.$mode){var elCheck=this.$getLayoutNode("item","check");if(elCheck){elCheck.setAttribute("onmousedown","var o = apf.lookup("+this.$uniqueId+"); o.checkToggle(this, true);o.$skipSelect = true;"); if(apf.isTrue(this.$applyBindRule("checked",xmlNode))){this.$checkedList.push(xmlNode); this.$setStyleClass(oItem,"checked");}else{if(this.isChecked(xmlNode)){this.$setStyleClass(oItem,"checked"); -}}}else{return false;}}if(elIcon){if(elIcon.nodeType==1){elIcon.setAttribute("style","background-image:url("+apf.getAbsolutePath(this.iconPath,this.$applyBindRule("icon",xmlNode))+")"); +}}}else{throw new Error(apf.formatErrorString(0,this,"Could not find check attribute",'Maybe the attribute check is missing from your skin file:
    ')); +return false;}}if(elIcon){if(elIcon.nodeType==1){elIcon.setAttribute("style","background-image:url("+apf.getAbsolutePath(this.iconPath,this.$applyBindRule("icon",xmlNode))+")"); }else{elIcon.nodeValue=apf.getAbsolutePath(this.iconPath,this.$applyBindRule("icon",xmlNode)); }}else{if(elImage){if(elImage.nodeType==1){if((elImage.tagName||"").toLowerCase()=="img"){elImage.setAttribute("src",apf.getAbsolutePath(apf.hostPath,this.$applyBindRule("image",xmlNode))); }else{elImage.setAttribute("style","background-image:url("+apf.getAbsolutePath(apf.hostPath,this.$applyBindRule("image",xmlNode))+")"); @@ -3101,7 +6557,8 @@ if(elCaption){apf.setNodeValue(elCaption,this.more.match(/caption:(.*)(;|$)/i)[1 this.listNodes.length=0;if(this.more&&!this.moreItem){this.moreItem=this.$container.lastChild; }};this.startMore=function(o,userAction){if(userAction&&this.disabled){return;}this.$setStyleClass(o,"",["more_down"]); var xmlNode;if(!this.$actions.add){if(this.each&&!this.each.match(/[\/\[]/)){xmlNode="<"+this.each+(this.each.match(/^a:/)?" xmlns:a='"+apf.ns.aml+"'":"")+" custom='1' />"; -}else{xmlNode="";}}this.add(xmlNode,null,null,function(addedNode){this.select(addedNode,null,null,null,null,true); +}else{apf.console.warn("No add action rule is defined for element while more='true'."); +xmlNode="";}}this.add(xmlNode,null,null,function(addedNode){this.select(addedNode,null,null,null,null,true); if(this.morePos=="begin"){this.$container.insertBefore(this.moreItem,this.$container.firstChild); }else{this.$container.appendChild(this.moreItem);}var undoLastAction=function(){this.getActionTracker().undo(this.autoselect?2:1); this.removeEventListener("stoprename",undoLastAction);this.removeEventListener("beforerename",removeSetRenameEvent); @@ -3196,8 +6653,8 @@ if(styleClass.length==1){styleClass.unshift("");}if(this.btnedit){oButtons.edit. }if(o.edit){this.dispatchEvent("prop.visible",{value:true});if(_self.oSettings){apf.layout.forceResize(_self.oSettings); }}if(!o.maximized||!this.animate||lastState.maximized&&_self.animate){_self.dispatchEvent("afterstatechange",{from:lastState,to:o}); }this.$lastState=o;if(this.aData&&!o.maximized){this.$purgeAlignment();}if(!this.animate&&apf.hasSingleRszEvent&&apf.layout){apf.layout.forceResize(_self.$int); -}}};var marginBox,hordiff,verdiff,oButtons={};this.$propHandlers.buttons=function(value){if(!this.$hasLayoutNode("button")){return; -}var buttons=value&&(value=value.replace(/(\|)\||\|$/,"$1")).split("|")||[],nodes=this.$buttons.childNodes,re=value&&new RegExp("("+value+")"),found={},idleNodes=[]; +}}};var marginBox,hordiff,verdiff,oButtons={};this.$propHandlers.buttons=function(value){if(apf.isIphone){return; +}if(!this.$hasLayoutNode("button")){return;}var buttons=value&&(value=value.replace(/(\|)\||\|$/,"$1")).split("|")||[],nodes=this.$buttons.childNodes,re=value&&new RegExp("("+value+")"),found={},idleNodes=[]; for(var i=0;i20){this.$getNewConte apf.insertHtmlNode(this.$getLayoutNode("loading"),container);}};this.$removeLoading=function(htmlNode){if(!htmlNode){return; }this.$getLayoutNode("item","container",htmlNode).innerHTML="";};this.$extend=function(xmlNode,container,immediate,callback){if(!this.$hasLoadStatus(xmlNode,"potential")){return; }var rule=this.$getBindRule("insert",xmlNode),xmlContext=rule&&rule.match?(rule.cmatch||rule.compile("match"))(xmlNode):xmlNode; -if(rule&&xmlContext){this.$setLoadStatus(xmlNode,"loading");if(rule.get){this.getModel().$insertFrom(rule.getAttribute("get"),{xmlNode:xmlContext,insertPoint:xmlContext,amlNode:this,callback:callback}); +if(rule&&xmlContext){this.$setLoadStatus(xmlNode,"loading");if(rule.get){if(!apf.offline.onLine){apf.offline.transactions.actionNotAllowed(); +this.slideClose(container,xmlNode);return;}this.getModel().$insertFrom(rule.getAttribute("get"),{xmlNode:xmlContext,insertPoint:xmlContext,amlNode:this,callback:callback}); }else{if(this.$applyBindRule("insert",xmlNode)){this.insert(data,{insertPoint:xmlContext}); }}}else{if(!this.prerender){this.$setLoadStatus(xmlNode,"loaded");this.$removeLoading(apf.xmldb.getHtmlNode(xmlNode,this)); xmlUpdateHandler.call(this,{action:"insert",xmlNode:xmlNode,result:this.$addNodes(xmlNode,container,true),anim:!immediate}); @@ -3624,11 +7084,13 @@ this.$dragInited=false;this.copy=function(nodeList,pNode,beforeNode,isMove){if(n }if(this.$actions[(isMove?"movegroup":"copygroup")]){exec=this.$executeAction("multicall",changes,(isMove?"movegroup":"copygroup"),nodeList[0]); }else{exec=this.$executeAction("multicall",changes,(isMove?"move":"copy"),nodeList[0],null,null,nodeList.length>1?nodeList:null); }if(exec!==false){return nodeList;}return false;};this.move=function(nodeList,pNode,beforeNode){return this.copy(nodeList,pNode,beforeNode,true); -};this.isDragAllowed=function(x,data){if(this.disabled||!x||!x.length||!x[0]){return false; -}if(this.drag||this.dragcopy){if(data){data.merge(x);}return true;}var d,ruleList=[],j=0,l=x.length; -for(;j=_self.progress){value=_self.progress-0.05; +}var isPlaying=!_self.paused;if(isPlaying){_self.pause();}if(value<0){value=0;}else{if(value>1){value=1; +}}_self.seek(Math.round(value*_self.duration));_self.setProperty("paused",!isPlaying); +});};this.$propHandlers.currentTime=function(value){if(value>=0&&this.seek){this.seek(value); +}};this.$propHandlers.volume=function(value){if(!this.player){return;}if(value<0){throw this.MediaError("Attempt to set the volume to a negative value '"+value+"'"); +}if(value<1&&value>0){value=value*100;}if(this.setVolume){this.setVolume(value); +}if(value>0&&this.muted){this.setProperty("muted",false);}};this.oldVolume=null; +this.$propHandlers.muted=function(value){if(!this.player||!this.setVolume){return; +}if(value){this.oldVolume=this.volume;this.setVolume(0);}else{this.setVolume(this.oldVolume||20); +}};this.$propHandlers.paused=function(value){if(!this.player){return;}this.paused=apf.isTrue(value); +if(this.paused){this.player.pause();}else{this.player.play();}};this.$propHandlers.type=function(value){if(this.$loadTimer){return; +}var _self=this;this.$loadTimer=window.setTimeout(function(){reload.call(_self); +});};this.$propHandlers.src=function(value){if(this.$loadTimer||!value){return; +}var oUrl=new apf.url(value);this.src=oUrl.uri;if(oUrl.protocol=="file"){apf.console.warn("Media player: the medium with URL '"+this.src+"'\nwill be loaded through the 'file://' protocol.\nThis can cause the medium to not load and/ or play.","media"); +}else{if(!oUrl.isSameLocation()){apf.console.warn("Media player: the medium with URL '"+this.src+"'\ndoes not have the same origin as your web application.\nThis can cause the medium to not load and/ or play.","media"); +}}if(this.src!=this.currentSrc&&this.networkState!==apf.Media.LOADING){var type=this.$guessType(this.src); +if(type==this.type){reset.call(this);this.loadMedia();}else{this.type=type;var _self=this; +this.$loadTimer=window.setTimeout(function(){reload.call(_self);});}}};this.$propHandlers.ID3=function(value){if(!this.player){return; +}if(typeof this.player.setID3=="function"){this.player.setID3(value);}};this.addEventListener("AMLRemove",function(doOnlyAdmin){apf.console.log("Media: removing node..."); +reset.call(this);});this.addEventListener("AMLReparent",function(beforeNode,pNode,withinParent){if(!this.$amlLoaded){return; +}apf.console.log("Media: reparenting - "+beforeNode+", "+pNode);this.$draw();reload.call(this,true); +});function reset(){this.setProperty("networkState",apf.Media.NETWORK_EMPTY);this.setProperty("ready",false); +this.buffered={start:0,end:0,length:0};this.bufferedBytes={start:0,end:0,length:0}; +this.totalBytes=0;this.setProperty("progress",0);this.setProperty("seeking",false); +this.setProperty("paused",true);this.setProperty("position",0);this.currentTime=this.duration=0; +this.played=this.seekable=null;this.ended=false;this.start=this.end=this.loopStart=this.loopEnd=this.playCount=this.currentLoop=0; +this.controls=this.muted=false;}function reload(bNoReset){apf.console.log("Media: reloading medium with mimetype '"+this.type+"'"); +window.clearTimeout(this.$loadTimer);this.$loadTimer=null;if(!bNoReset){reset.call(this); +}this.$destroy(true);this.playerType=this.$getPlayerType(this.type);if(!this.playerType||!this.$isSupported()){this.$ext.innerHTML=this.notSupported; +return;}this.$initPlayer();}this.MediaError=function(sMsg){return new Error(apf.formatErrorString(0,this,"Media",sMsg)); +};this.src=this.currentSrc=null;this.networkState=apf.Media.NETWORK_EMPTY;this.bufferingRate=0; +this.bufferingThrottled=false;this.buffered={start:0,end:0,length:0};this.bufferedBytes={start:0,end:0,length:0}; +this.totalBytes=0;this.volume=100;this.loadMedia=function(){};this.readyState=apf.Media.HAVE_NOTHING; +this.seeking=false;this.currentTime=this.duration=0;this.paused=true;this.defaultPlaybackRate=this.playbackRate=0; +this.played=null;this.seekable=null;this.ended=this.autoplay=false;this.canPlayType=function(sType){if(this.$getPlayerType){var sPlayer=this.$getPlayerType(sType); +if(!sPlayer||!this.$isSupported(sPlayer)){return"no";}if(sPlayer.indexOf("Wmp")!=-1){return"maybe"; +}return"probably";}return"no";};this.play=function(){this.setProperty("paused",false); +};this.pause=function(){this.setProperty("paused",true);};this.start=this.end=this.loopStart=this.loopEnd=this.playCount=this.currentLoop=0; +this.addCueRange=function(sClassName,sId,iStart,iEnd,bPauseOnExit,fEnterCallback,fExitCallback){}; +this.removeCueRanges=function(sClassName){};this.getCounter=function(iMillis,sFormat,bReverse){if(bReverse){iMillis=iMillis-this.duration; +}var iSeconds=Math.round(Math.abs(iMillis/1000)),sHours=String(Math.round(Math.abs(iSeconds/60/60))).pad(2,"0"),sMinutes=String(Math.round(Math.abs(iSeconds/60))).pad(2,"0"),sSeconds=String(iSeconds).pad(2,"0"),sMillis=String(Math.round(Math.abs(iMillis%1000))).pad(3,"0"); +return(bReverse?"- ":"")+sFormat.replace(/\%T/g,"%H:%M:%S").replace(/\%[a-zA-Z\%]/g,function(sMatch){switch(sMatch){case"%H":return sHours; +case"%M":return sMinutes;case"%S":return sSeconds;case"%Q":return sMillis;case"%n":return"\n"; +case"%t":return"\t";case"%%":return"%";}});};this.setSource=function(){if(!this.src){var src,type,oSources=this.$sources; +for(var i=0,j=oSources.length;i]*>/g,""); +});}).call(apf.nomedia.prototype=new apf.AmlElement());apf.aml.setElement("nomedia",apf.nomedia); +apf.Media.NETWORK_EMPTY=0;apf.Media.NETWORK_IDLE=1;apf.Media.NETWORK_LOADING=2; +apf.Media.NETWORK_LOADED=3;apf.Media.HAVE_NOTHING=0;apf.Media.HAVE_METADATA=1;apf.Media.HAVE_SOME_DATA=2; +apf.Media.HAVE_CURRENT_DATA=3;apf.Media.HAVE_FUTURE_DATA=4;apf.Media.HAVE_ENOUGH_DATA=5; +apf.__MULTICHECK__=1<<22;apf.MultiCheck=function(){this.$regbase=this.$regbase|apf.__MULTICHECK__; this.multicheck=true;this.checklength=0;this.$checkedList=[];this.check=function(xmlNode,userAction){if(userAction&&this.disabled||this.$checkedList.indexOf(xmlNode)>-1){return; }if(userAction&&this.$executeSingleValue("check","checked",xmlNode,"true")!==false){return; }if(this.dispatchEvent("beforecheck",{xmlNode:xmlNode})===false){return false;}if(!this.multicheck&&this.$checkedList.length){this.clearChecked(true); @@ -3967,40 +7512,55 @@ this.$propHandlers.url=function(value){var url=new apf.url(value);if(!url.protoc }else{this.implement(apf.socket);}}else{if(!apf.http){error="HTTP";}else{this.implement(apf.http); }}if(error){throw new Error(apf.formatErrorString(1024,null,"Teleport baseclass","Could not find Ajax.org Teleport "+error+" Component",this.$aml)); }if(this.id){apf.$asyncObjects[this.id]=1;}});}).call(apf.Teleport.prototype=new apf.AmlElement()); -apf.Init.run("teleport");apf.__TRANSACTION__=1<<3;apf.Transaction=function(){this.$regbase=this.$regbase|apf.__TRANSACTION__; +apf.teleportLog=function(extra){var xml,request=extra.method+" "+extra.url+" HTTP/1.1\n\n"+extra.data; +this.setXml=function(pNode){if(!xml){var doc=pNode.ownerDocument;xml=doc.createElement(extra.tp.localName||extra.type||"http"); +xml.appendChild(doc.createElement("request")).appendChild(doc.createTextNode(request||"-")); +xml.appendChild(doc.createElement("response")).appendChild(doc.createTextNode(response||"-")); +}apf.xmldb.appendChild(pNode,xml);};this.request=function(headers){request=request.replace(/\n\n/,"\n"+headers.join("\n")+"\n\n"); +if(xml){apf.setQueryValue(xml,"request/text()",request);}this.request=function(){}; +};var response="";this.response=function(extra){try{var headers=extra.http.getAllResponseHeaders(); +response="HTTP/1.1 "+extra.status+" "+extra.statusText+"\n"+(headers?headers+"\n":"\n")+extra.http.responseText; +if(xml){apf.setQueryValue(xml,"response/text()",response);}}catch(ex){}};};apf.Init.run("teleport"); +apf.__TRANSACTION__=1<<3;apf.Transaction=function(){this.$regbase=this.$regbase|apf.__TRANSACTION__; this.$addParent=this.$transactionNode=this.$transactionSubject=this.$originalNode=this.$inTransaction=this.$lastAction=null; this.$supportedProperties.push("autoshow");this.$booleanProperties.autoshow=true; this.commit=function(repeat){if(!this.$inTransaction){return false;}if(!this.$validgroup&&this.validgroup){this.$validgroup=self[this.validgroup]; }if(this.$validgroup&&!this.$validgroup.isValid()){return false;}var returnValue=true; if(!this.$at.undolength){if(repeat){return false;}this.$at.purge();this.$inTransaction=false; -this.load(this.$originalNode);this.$helperModel.reset();returnValue=false;}else{this.$at.reset(); -this.$inTransaction=false;this.$transactionNode.removeAttribute(apf.xmldb.xmlListenTag); +this.load(this.$originalNode);this.$helperModel.reset();returnValue=false;}else{apf.console.info("Committing transaction on "+this.localName+"["+this.name+"]"); +this.$at.reset();this.$inTransaction=false;this.$transactionNode.removeAttribute(apf.xmldb.xmlListenTag); if(this.$lastAction=="add"){if(this.$transactionSubject.$executeAction("appendChild",[this.$addParent,this.$transactionNode],"add",this.$transactionNode)&&this.$transactionSubject.hasFeature(apf.__MULTISELECT__)){this.$transactionSubject.select(this.$transactionNode); }this.$transactionSubject=null;}else{var at=this.$at;this.$at=this.dataParent?this.dataParent.parent.getActionTracker():null; this.$transactionSubject.$executeAction("replaceNode",[this.$originalNode,this.$transactionNode],"update",this.$transactionNode); this.$at=at;}}this.$transactionNode=null;this.$addParent=null;this.$originalNode=null; if(this.autoshow){if(this.autoshow==-1){this.autoshow=true;}else{this.hide();}}return returnValue; -};this.rollback=function(noLoad){if(!this.$inTransaction){return;}if(this.$at){if(this.rpcMode=="realtime"){this.$at.undo(-1); -}this.$at.reset();}this.$transactionNode=null;this.$addParent=null;if(!noLoad){this.load(this.$originalNode); -}this.$helperModel.reset();this.$stopAction(this.$lastAction,true);this.$originalNode=null; -this.$inTransaction=false;if(this.autoshow){if(this.autoshow==-1){this.autoshow=true; -}else{this.hide();}}};this.begin=function(strAction,xmlNode,parentXmlNode,dataParent){if(this.$inTransaction){if(this.autoshow){this.autoshow=-1; -}this.rollback();}var _self=this;this.$lastAction=strAction;if(!this.$lastAction){this.$lastAction=this.xmlRoot&&"update"||"add"; +};this.rollback=function(noLoad){if(!this.$inTransaction){return;}apf.console.info("Rolling back transaction on "+this.localName+"["+this.name+"]"); +if(this.$at){if(this.rpcMode=="realtime"){this.$at.undo(-1);}this.$at.reset();}this.$transactionNode=null; +this.$addParent=null;if(!noLoad){this.load(this.$originalNode);}this.$helperModel.reset(); +this.$stopAction(this.$lastAction,true);this.$originalNode=null;this.$inTransaction=false; +if(this.autoshow){if(this.autoshow==-1){this.autoshow=true;}else{this.hide();}}}; +this.begin=function(strAction,xmlNode,parentXmlNode,dataParent){if(this.$inTransaction){apf.console.warn("Rolling back transaction, while starting a new one"); +if(this.autoshow){this.autoshow=-1;}this.rollback();}apf.console.info("Beginning transaction on "+this.localName+"["+this.name+"]"); +var _self=this;this.$lastAction=strAction;if(!this.$lastAction){this.$lastAction=this.xmlRoot&&"update"||"add"; +}if(!this.$lastAction){throw new Error(apf.formatErrorString(0,this,"Starting Transaction","Could not determine whether to add or update.")); }if(dataParent){this.$setDynamicProperty("model","["+dataParent.id+".selected]"); }if(xmlNode&&this.$lastAction=="update"){this.xmlRoot=xmlNode;}if(!this.$at){this.$at=new apf.actiontracker(); var propListen=function(e){_self.setProperty(e.prop,e.value);};this.$at.addEventListener("prop.undolength",propListen); this.setProperty("undolength",0);this.$at.addEventListener("prop.redolength",propListen); this.setProperty("redolength",0);}if(!this.$helperModel){this.$helperModel=new apf.model(); this.$helperModel["save-original"]=true;this.$helperModel.load("");}this.$transactionNode=null; -this.$addParent=null;this.$originalNode=this.xmlRoot;this.$inTransaction=true;function begin(){this.$inTransaction=-1; -this.$helperModel.data.appendChild(this.$transactionNode);this.load(this.$helperModel.data.firstChild); -this.$inTransaction=true;if(this.disabled){this.enable();}if(this.autoshow){if(this.autoshow==-1){this.autoshow=true; -}else{this.show();}}}dataParent=this.dataParent&&this.dataParent.parent;if(!dataParent||!dataParent.$actions||!dataParent.$actions[this.$lastAction]){dataParent=this; +this.$addParent=null;this.$originalNode=this.xmlRoot;if(typeof apf.offline!="undefined"&&!apf.offline.canTransact()){return false; +}this.$inTransaction=true;function begin(){if(!this.$transactionNode){throw new Error(apf.formatErrorString(0,this,"Starting transaction","Missing transaction node. Cannot start transaction. This error is unrecoverable.")); +}this.$inTransaction=-1;this.$helperModel.data.appendChild(this.$transactionNode); +this.load(this.$helperModel.data.firstChild);this.$inTransaction=true;if(this.disabled){this.enable(); +}if(this.autoshow){if(this.autoshow==-1){this.autoshow=true;}else{this.show();}}}dataParent=this.dataParent&&this.dataParent.parent; +if(!dataParent||!dataParent.$actions||!dataParent.$actions[this.$lastAction]){dataParent=this; }if(this.$lastAction=="add"){var rule,actionRules=dataParent.$actions;if(actionRules){if(xmlNode&&xmlNode.nodeType){rule=actionRules.getRule("add",xmlNode); }else{if(typeof xmlNode=="string"){if(xmlNode.trim().charAt(0)=="<"){xmlNode=apf.getXml(xmlNode); rule=actionRules.getRule("add",xmlNode);}else{var rules=actionRules.$rules.add; for(var i=0,l=rules.length;i")); +}mdl.$insertFrom(rule.getAttribute("get"),{ascending:this.$sort?this.$sort.get().ascending:true,xmlNode:loadNode,documentId:this.documentId,marker:marker,start:start,length:length,insertPoint:this.xmlRoot,amlNode:this,callback:function(xmlNode){_self.setProperty("root",_self.xmlRoot); var length=parseInt(apf.queryValue(xmlNode,rule.getAttribute("total")));if(_self.viewport.length!=length){_self.viewport.length=length; this.$createVirtualDataset(_self.xmlRoot,_self.viewport.length,_self.documentId); }}});}};function fillList(len,list,from){for(var i=0;i"); +amlNode.appendChild(addType.cloneNode(true));}else{var amlNode=apf.getXml(""); +}if(options.skinset&&options.skinset!="default"){amlNode.firstChild.setAttribute("skinset",options.skinset); +}var htmlNode=options.htmlNode,parentNode=options.parentNode;if(!parentNode){parentNode=(apf.document.activeElement||apf.document.documentElement); +if(parentNode.getPage){parentNode=parentNode.getPage();}else{while(parentNode&&!parentNode.canHaveChildren){parentNode=parentNode.parentNode; +}}options.parentNode=parentNode;}var domParser=apf.document.$domParser;amlNode=domParser.parseFromXml(amlNode,{doc:this}).firstChild.firstChild; +if(!options.ignorePos){var pos=apf.getAbsolutePosition(parentNode.$int,null,true); +amlNode.setAttribute("left",htmlNode.offsetLeft-pos[0]);amlNode.setAttribute("top",htmlNode.offsetTop-pos[1]); +}if(amlNode.$getOption){var minwidth=amlNode.minwidth||parseInt(amlNode.$getOption("main","minwidth"))||5,minheight=amlNode.minheight||parseInt(amlNode.$getOption("main","minheight"))||5,maxwidth=amlNode.maxwidth||parseInt(amlNode.$getOption("main","maxwidth"))||10000,maxheight=amlNode.maxheight||parseInt(amlNode.$getOption("main","maxheight"))||10000; +}if(!options.ignorePos){amlNode.setAttribute("width",Math.min(maxwidth,Math.max(minwidth,htmlNode.offsetWidth))); +amlNode.setAttribute("height",Math.min(maxheight,Math.max(minheight,htmlNode.offsetHeight))); +}else{if(options.left||options.left===0){amlNode.setAttribute("left",options.left); +amlNode.setAttribute("top",options.top);}if(options.width||options.width===0){amlNode.setAttribute("width",options.width); +}if(options.height||options.height===0){amlNode.setAttribute("height",options.height); +}}var name,n=amlNode.localName.uCaseFirst(),i=0;do{name=n+ ++i;}while(self[name]); +amlNode.setAttribute("id",name);var hasProp=rename.getEditableProp(amlNode);if(hasProp){var prop=hasProp[1]; +amlNode.setAttribute(prop,name);}if(options.userInteraction){amlNode.$adding=true; +}parentNode.insertBefore(amlNode,options.beforeNode);amlNode.setProperty("editable",true); +apf.layout.processQueue();if(!options.userInteraction){apf.document.getSelection().$selectList([amlNode]); +}options.addedNode=amlNode;};commands.contextmenu=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}if(options.amlNode.ownerDocument.dispatchEvent("contextmenu",{x:options.htmlEvent.x,y:options.htmlEvent.y,currentTarget:options.amlNode,bubbles:true})!==false&&showUI){mnuContentEditable.display(options.htmlEvent.x,options.htmlEvent.y,null,options.amlNode); +}};var rename={getInput:function(){apf.Rename.initEditableArea.call(this);var txt=this.$txt; +txt.className="editable";txt.style.height="auto";txt.onscroll=function(){return false; +};txt.host=this;return txt;},stopRename:function(n,success){if(success&&this.renaming){var doc=this.$renameElement.ownerDocument; +commands.begin.call(doc);this.stop(null,true);commands.commit.call(doc);}else{this.stop(); +}},getEditableProp:function(el){var htmlNode,prop;if(el.$childProperty){prop=el.$childProperty; +}else{if(el.$editableCaption){prop=el.$editableCaption[0];}else{if(el.$getEditableCaption){var info=el.$getEditableCaption(); +if(!info){return;}prop=info[1];htmlNode=info[0];}else{return;}}}if(!htmlNode){htmlNode=el.$getLayoutNode("main",prop,el.$ext); +}return[htmlNode,prop];},start:function(el){var info=this.getEditableProp(el);if(!info){return; +}htmlNode=info[0];this.$editableProp=info[1];if(!htmlNode){if(el.getPage){this.start(el.getPage()); +}return;}this.$renameHtml=htmlNode;this.$renameElement=el;this.$renameContents=(htmlNode.nodeType==1?htmlNode.innerHTML:htmlNode.nodeValue); +var txt=this.getInput();if(htmlNode.nodeType==1){htmlNode.innerHTML="";htmlNode.appendChild(txt); +}else{htmlNode.parentNode.replaceChild(txt,htmlNode);}if(apf.hasContentEditable){txt.innerHTML=this.$renameContents.replace(/"||""; +}else{txt.value=this.$renameContents;}txt.unselectable="Off";var f=function(){try{txt.focus(); +txt.select();}catch(e){}};if(apf.isIE){f();}else{setTimeout(f);}this.renaming=true; +},stop:function(x,success){if(!this.renaming){return;}this.renaming=false;var htmlNode=this.$renameHtml; +if(htmlNode.nodeType==1){htmlNode.removeChild(this.$txt);}else{this.$txt.parentNode.replaceChild(htmlNode,this.$txt); +}var value=typeof success=="string"?success:(apf.hasContentEditable?this.$txt.innerText:this.$txt.value).replace(/<.*?nobr>/gi,"").replace(/\n$/,""); +var el=this.$renameElement;var prop=this.$editableProp;if(success&&el[prop]!=value){el.setAttribute(prop,value); +}else{if(htmlNode.nodeType==1){htmlNode.innerHTML=this.$renameContents;}else{htmlNode.nodeValue=this.$renameContents; +}}htmlNode.parentNode.scrollLeft=0;this.$editableProp=this.$renameHtml=this.$renameElement=this.$renameContents=null; +}};commands.rename=function(sel,showUI,value,query){switch(query){case STATE:return rename.renaming; +case VALUE:return String(rename.renaming);case ENABL:return rename.getEditableProp(value||sel[0]); +case INDET:return false;}if(showUI){if(sel.length){rename.start(sel[0]);}}else{rename.stop(null,value); +}};var mode,vcinited;commands.mode=function(sel,showUI,value,query){switch(query){case STATE:return mode||"default"; +case VALUE:return mode||"default";case ENABL:return true;case INDET:return false; +}if(value=="select"){mode=value;this.$getSelectRect().activate();}else{if(value&&value.mode=="connect"){mode="connect"; +var vc=this.$getVisualConnect();vc.setMode("draw");vc.activate(value.event,value.timeout); +if(!vcinited){this.$getVisualConnect().onchangemode=function(e){if(e.mode!=mode){if(e.mode=="element"){mode="connect-element"; +}else{if(e.mode=="all"){mode="connect-all";}else{if(e.mode=="draw"){mode="connect"; +}else{if(e.mode=="draw-started"){mode="connecting";}}}}}};}}else{if(value&&value.mode=="connect-element"){mode=value.mode; +var vc=this.$getVisualConnect();vc.setMode("element");vc.activate(value.event,value.timeout); +}else{if(value&&value.mode=="connect-all"){mode=value.mode;var vc=this.$getVisualConnect(); +vc.setMode("all");vc.activate(value.event,value.timeout);}else{if(value&&value.mode=="add"){mode="add"; +var e=value.ev;var pos=apf.getAbsolutePosition(e.indicator);(value.dragserver||apf.DragServer).stop(null,true); +addType=value.value;var opt={userInteraction:true,ignorePos:true,parentNode:value.parent||apf.document.body,skinset:apf.getInheritedAttribute(value.parent||apf.document.body,"skinset")}; +commands.begin.call(this);commands.add.call(this,null,null,opt);var amlNode=opt.addedNode; +amlNode.$adding=true;if(value.parent){var ppos=apf.getAbsolutePosition(value.parent.$int); +pos[0]-=ppos[0];pos[1]-=ppos[1];}amlNode.$ext.style.left=(amlNode.left=pos[0])+"px"; +amlNode.$ext.style.top=(amlNode.top=pos[1])+"px";amlNode.$ext.style.position="absolute"; +amlNode.dragOutline=false;amlNode.$dragStart({reappend:true,clientX:e.htmlEvent.clientX,clientY:e.htmlEvent.clientY},true,true); +addType=null;}else{mode=value.mode||value;this.$getSelectRect().deactivate();this.$getVisualConnect().deactivate(); +}}}}}};commands.select=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}var htmlNode=options.htmlNode,parentNode=options.parentNode; +if(!parentNode){parentNode=(apf.document.$getVisualSelect().getLastSelection()[0]||apf.document.documentElement); +if(parentNode.getPage){parentNode=parentNode.getPage();}else{while(parentNode&&!parentNode.canHaveChildren){parentNode=parentNode.parentNode; +}}options.parentNode=parentNode;}var nodes=apf.document.getElementsByTagName("*"); +var htmlParent=htmlNode.parentNode;var left=apf.getHtmlLeft(htmlNode);var top=apf.getHtmlTop(htmlNode); +var right=left+htmlNode.offsetWidth;var bottom=top+htmlNode.offsetHeight;var first=true,ext,selList=[]; +var refParent;for(var i=0;ileft&&pos[0]+ext.offsetWidthtop&&pos[1]+ext.offsetHeight0;case INDET:return false;}um.undo(parseInt(value)||null); +};commands.redo=function(sel,showUI,value,query){var um=apf.window.undoManager; +switch(query){case STATE:return um.redolength;case VALUE:return String(um.redolength); +case ENABL:return um.redolength>0;case INDET:return false;}um.redo(parseInt(value)||null); +};commands.cut=function(sel,showUI,value,query){switch(query){case STATE:return apf.clipboard.store?true:false; +case VALUE:return apf.clipboard.store;case ENABL:return true;case INDET:return false; +}commands.copy.call(this,sel,showUI);commands.remove.call(this,sel,showUI);};commands.copy=function(sel,showUI,value,query){switch(query){case STATE:return apf.clipboard.store?true:false; +case VALUE:return apf.clipboard.store;case ENABL:return true;case INDET:return false; +}var nodes=[];sel.each(function(item){nodes.push(item.cloneNode(true));});apf.clipboard.put(nodes); +};commands.paste=function(sel,showUI,value,query){switch(query){case STATE:return apf.clipboard.store?true:false; +case VALUE:return apf.clipboard.store;case ENABL:return true;case INDET:return false; +}var content=apf.clipboard.get();if(!content){return;}var pNode=sel.length>1?sel[0].parentNode:sel[0]; +if(typeof content=="string"){sel.insertMarkup(content);}else{if(content.dataType==apf.ARRAY){if(pNode.localName=="table"){command.resetgeo.call(this,sel,showUI); +}var docsel=this.getSelection();docsel.removeAllRanges();var _self=this;content.each(function(item){docsel.addRange(new apf.AmlRange(_self)).selectNode(pNode.appendChild(item.cloneNode(true))); +});}else{if(content.$regbase){sel.appendChild(content.cloneNode(true));}else{alert("Could not paste content"); +}}}apf.layout.processQueue();};commands.duplicate=function(sel,showUI,value,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}var docsel=this.getSelection(); +docsel.removeAllRanges();sel.each(function(item){docsel.addRange(new apf.AmlRange(item)).selectNode(item.parentNode.appendChild(apf.getCleanCopy(item))); +});apf.layout.processQueue();};commands.resetgeo=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}if(!sel.length){return; +}var props=["left","top","right","bottom","anchors"];if("vbox|hbox|table".indexOf(sel[0].parentNode.localName)==-1){props.push("align"); +}if(!options||!options.keepwidth){props.push("width");}if(!options||!options.keepheight){props.push("height"); +}sel.each(function(sel){props.each(function(item){if(sel[item]){sel.setAttribute(item,""); +}});sel.$ext.style.position="";});sel[0].ownerDocument.$getVisualSelect().updateGeo(); +};commands.property=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}sel.each(function(sel){sel.setAttribute(options.name,options.value); +});sel[0].ownerDocument.$getVisualSelect().updateGeo();};commands.back=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}sel.each(function(sel){if(sel.zindex!=0){sel.setAttribute("zindex",0); +}});};commands.backward=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}sel.each(function(sel){if(sel.zindex!=0){sel.setAttribute("zindex",(sel.zindex||1)-1); +}});};commands.front=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}sel.each(function(sel){if(sel.zindex!=100000){sel.setAttribute("zindex",100000); +}});};commands.forward=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}sel.each(function(sel){if(sel.zindex!=100000){sel.setAttribute("zindex",(sel.zindex||0)+1); +}});};commands.align=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}apf.ContentEditable.execCommand("property",{name:"align",value:options.to}); +if("left|middle|right".indexOf(options.to)>-1){apf.ContentEditable.execCommand("property",{name:"height",value:""}); +}if("top|middle|bottom".indexOf(options.to)>-1){apf.ContentEditable.execCommand("property",{name:"width",value:""}); +}sel[0].ownerDocument.$getVisualSelect().updateGeo();};var sortFn={hbox:function(a,b){return(a.$ext.offsetLeft-b.$ext.offsetLeft); +},vbox:function(a,b){return(a.$ext.offsetTop-b.$ext.offsetTop);},table:function(a,b){var dH=a.$ext.offsetTop-b.$ext.offsetTop; +if(Math.abs(dH)/b.$ext.offsetHeight<0.9){return(a.$ext.offsetLeft-b.$ext.offsetLeft); +}return dH;}};commands.surround=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}var pNode=sel[0].parentNode; +var pos=[100000,100000,0,0];for(var i=0;ipos[2]){pos[2]=opos[0]+oEl.offsetWidth; +}if(opos[1]+oEl.offsetHeight>pos[3]){pos[3]=opos[1]+oEl.offsetHeight;}}pos[2]-=pos[0]; +pos[3]-=pos[1];addType=options.to;sel.sort(sortFn[addType]);var isInLayout="vbox|hbox|table".indexOf(pNode.localName)>-1; +commands.resetgeo.call(this,sel,false,{keepwidth:!isInLayout&&options.to=="hbox",keepheight:!isInLayout&&options.to=="vbox"}); +var opt={parentNode:pNode,beforeNode:sel[0],ignorePos:true,left:pos[0],top:pos[1]}; +if(pNode.localName!="table"){if(pNode.localName!="vbox"){opt.width=pos[2];}if(pNode.localName!="hbox"){opt.height=pos[3]; +}}commands.add.call(this,null,false,opt);if(isInLayout&&options.to!="table"){sel.each(function(sel){if(isInLayout){if(options.to=="hbox"&&pNode.localName=="vbox"){sel.setAttribute("width",sel.height); +}if(options.to=="vbox"&&pNode.localName=="hbox"){sel.setAttribute("height",sel.width); +}}});}sel.each(function(sel){opt.addedNode.appendChild(sel);});this.getSelection().$selectList([opt.addedNode]); +apf.layout.processQueue();};commands.convert=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}};commands.lock=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}};commands.unlock=function(sel,showUI,options,query){switch(query){case STATE:return false; +case VALUE:return"false";case ENABL:return true;case INDET:return false;}};commands.begin=function(sel,showUI,bClear){apf.window.undoManager.begin(this.documentElement,bClear); +};commands.rollback=function(){apf.window.undoManager.rollback(this.documentElement); +};commands.commit=function(){apf.window.undoManager.commit(this.documentElement); +};commands.pause=function(sel,showUI,bContinue){apf.window.undoManager.pause(this.documentElement,bContinue); +};apf.AmlDocument.prototype.$commands=apf.extend(apf.AmlDocument.prototype.$commands,commands); +})();(function(){function isCoord(n){return n||n===0;}function coord(n,other){return n||n===0?n:other; +}var dragIndicator1,dragIndicator2,dragIndicator3,dragIndicator4,dragIndicator5,inited=false,indicators=[],outline,dragOutline; +function init(){var div,classes=[null,"dragindicate","dragindicate indicate_common indicate_horizontal","dragindicate indicate_common","dragindicate indicate_common indicate_horizontal","dragindicate dragreparent","dragindicate dragelsort","dragindicate dragelsort"]; +for(var i=1;i<8;i++){div=document.body.appendChild(document.createElement("div")); +div.style.position="absolute";div.className=classes[i];div.style.zIndex=1000000; +div.style.display="none";div.host=false;eval("dragIndicator"+i+" = indicators["+(i-1)+"] = div;"); +}outline=dragOutline=document.getElementById("apf_outline");inited=true;}var lastReparent,movePosition; +function doReparentDrag(el,amlNode,e){if(lastReparent==amlNode){return;}var htmlNode=el.dragOutline?outline:el.$ext; +var pHtmlNode=amlNode.$int;var isBody=pHtmlNode.tagName=="BODY";var pos1=isBody?[0,0]:apf.getAbsolutePosition(pHtmlNode); +pos1[2]=isBody?apf.getWindowWidth():pHtmlNode.offsetWidth;pos1[3]=isBody?apf.getWindowHeight():pHtmlNode.offsetHeight; +var lastPHtmlNode=lastReparent?lastReparent.$int:el.$ext.parentNode;var pos2=lastPHtmlNode.tagName=="BODY"?[0,0]:apf.getAbsolutePosition(lastPHtmlNode,null,true); +amlNode.$int.appendChild(htmlNode);hideIndicators();dragIndicator5.style.left=pos1[0]+"px"; +dragIndicator5.style.top=pos1[1]+"px";var diff=apf.getDiff(dragIndicator5);dragIndicator5.style.width=(pos1[2]-diff[0])+"px"; +dragIndicator5.style.height=(pos1[3]-diff[1])+"px";dragIndicator5.style.display="block"; +apf.tween.single(dragIndicator5,{type:"fade",from:0,to:1,anim:apf.tween.easeInSine,steps:5}); +htmlNode.style.left=(apf.getHtmlLeft(htmlNode)-(pos1[0]-pos2[0]))+"px";htmlNode.style.top=(apf.getHtmlTop(htmlNode)-(pos1[1]-pos2[1]))+"px"; +lastReparent=amlNode;el.$dragStart(e,true);}var lastAmlNode;var showDrag={vbox:function(l,t,htmlNode,e){if(e){var prevTop=htmlNode.style.top; +var el=this,plane=apf.plane.get();plane.plane.style.top=htmlNode.style.top="-2000px"; +var amlNode=apf.findHost(document.elementFromPoint(e.clientX,e.clientY));plane.plane.style.top=0; +htmlNode.style.top=prevTop;if(amlNode&&amlNode!=el&&(amlNode.parentNode==(lastReparent||el.parentNode))){var ext1=amlNode.$altExt||amlNode.$ext; +var ext2=el.$altExt||el.$ext;var h=ext1.offsetHeight;var pos=apf.getAbsolutePosition(ext1); +if(pos[1]+(h/2)>e.clientY){if(ext1.previousSibling!=ext2){dragIndicator1.style.display="block"; +dragIndicator1.style.top=(pos[1]-dragIndicator1.offsetHeight)+"px";dragIndicator1.style.left=(pos[0])+"px"; +dragIndicator1.style.width=(ext1.offsetWidth-apf.getWidthDiff(dragIndicator1))+"px"; +dragIndicator1.style.height=amlNode.parentNode.padding+"px";movePosition={where:"before",amlNode:amlNode}; +}else{dragIndicator1.style.display="none";movePosition=null;}}else{if(ext1.nextSibling!=ext2){dragIndicator1.style.display="block"; +dragIndicator1.style.top=(pos[1]+h)+"px";dragIndicator1.style.left=(pos[0])+"px"; +dragIndicator1.style.width=(ext1.offsetWidth-apf.getWidthDiff(dragIndicator1))+"px"; +dragIndicator1.style.height=amlNode.parentNode.padding+"px";movePosition={where:"after",amlNode:amlNode}; +}else{dragIndicator1.style.display="none";movePosition=null;}}}else{dragIndicator1.style.display="none"; +}}},hbox:function(l,t,htmlNode,e){if(e){var prevTop=htmlNode.style.top;var el=this,plane=apf.plane.get(); +plane.plane.style.top=htmlNode.style.top="-2000px";var amlNode=apf.findHost(document.elementFromPoint(e.clientX,e.clientY)); +plane.plane.style.top=0;htmlNode.style.top=prevTop;showDrag.reparent.call(this,amlNode,el,e); +if(amlNode&&amlNode!=el&&(amlNode.parentNode==(lastReparent||el.parentNode))){var ext1=amlNode.$altExt||amlNode.$ext; +var ext2=el.$altExt||el.$ext;var h=ext1.offsetWidth;var pos=apf.getAbsolutePosition(ext1); +if(pos[0]+(h/2)>e.clientX){if(ext1.previousSibling!=ext2){dragIndicator1.style.display="block"; +dragIndicator1.style.top=(pos[1])+"px";dragIndicator1.style.left=(pos[0]-dragIndicator1.offsetWidth)+"px"; +dragIndicator1.style.width=amlNode.parentNode.padding+"px";dragIndicator1.style.height=(ext1.offsetHeight-apf.getHeightDiff(dragIndicator1))+"px"; +movePosition={where:"before",amlNode:amlNode};}else{dragIndicator1.style.display="none"; +movePosition=null;}}else{if(ext1.nextSibling!=ext2){dragIndicator1.style.display="block"; +dragIndicator1.style.top=(pos[1])+"px";dragIndicator1.style.left=(pos[0]+h)+"px"; +dragIndicator1.style.width=amlNode.parentNode.padding+"px";dragIndicator1.style.height=(ext1.offsetHeight-apf.getHeightDiff(dragIndicator1))+"px"; +movePosition={where:"after",amlNode:amlNode};}else{dragIndicator1.style.display="none"; +movePosition=null;}}}else{dragIndicator1.style.display="none";movePosition=null; +}}},table:function(l,t,htmlNode,e){if(e){var prevTop=htmlNode.style.top,plane=apf.plane.get(); +var el=this;dragIndicator1.style.top=plane.plane.style.top=htmlNode.style.top="-2000px"; +var amlNode=apf.findHost(document.elementFromPoint(e.clientX,e.clientY));plane.plane.style.top=0; +htmlNode.style.top=prevTop;showDrag.reparent.call(this,amlNode,el,e);if(amlNode&&amlNode!=el&&(amlNode.parentNode==(lastReparent||el.parentNode))){var ext1=amlNode.$altExt||amlNode.$ext; +var ext2=el.$altExt||el.$ext;var pos=apf.getAbsolutePosition(ext1);if(ext1.previousSibling!=ext2){dragIndicator1.style.display="block"; +dragIndicator1.style.top=pos[1]+"px";dragIndicator1.style.left=pos[0]+"px";dragIndicator1.style.width=(amlNode.$ext.offsetWidth-apf.getWidthDiff(dragIndicator1))+"px"; +dragIndicator1.style.height=(amlNode.$ext.offsetHeight-apf.getHeightDiff(dragIndicator1))+"px"; +movePosition={where:"before",amlNode:amlNode};}else{dragIndicator1.style.display="none"; +movePosition=null;}}else{dragIndicator1.style.display="none";}}},reparent:function(amlNode,el,e){var htmlNode=el.dragOutline?outline:el.$ext; +while(amlNode&&!amlNode.$int){amlNode=amlNode.parentNode;}if(!amlNode.editable){return; +}if(lastAmlNode&&lastAmlNode[0]==amlNode&&Math.abs(e.clientX-lastAmlNode[2])<2&&Math.abs(e.clientY-lastAmlNode[3])<2){}else{if(lastAmlNode){clearTimeout(lastAmlNode[4]); +}var plane=apf.plane.get();if(el&&amlNode!=el&&amlNode.$int&&htmlNode.parentNode!=amlNode.$int&&(htmlNode.parentNode!=plane.plane||amlNode.$int!=document.body)&&!apf.isChildOf(el.$ext,amlNode.$int,true)){var ev={clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey}; +lastAmlNode=[amlNode,new Date().getTime(),e.clientX,e.clientY,setTimeout(function(){doReparentDrag(el,amlNode,ev); +},300)];}else{lastAmlNode=[];}}},common:function(l,t,htmlNode,e,change,snapDiff){var oOutline=this.$ext; +var prevTop=htmlNode.style.top;var el=this,plane=apf.plane.get();dragIndicator1.style.top=plane.plane.style.top=htmlNode.style.top="-2000px"; +var amlNode=apf.findHost(document.elementFromPoint(e.clientX,e.clientY));plane.plane.style.top=0; +htmlNode.style.top=prevTop;showDrag.reparent.call(this,amlNode,el,e);var d=dragInfo; +showDrag.common_resize.call(this,l,t,d.width,d.height,e,change,true,true,true,true,true); +apf.config.setProperty("x",change.l||(change.l===0?0:apf.getHtmlLeft(oOutline))); +apf.config.setProperty("y",change.t||(change.t===0?0:apf.getHtmlTop(oOutline))); +apf.config.setProperty("w",d.width);apf.config.setProperty("h",d.height);},common_resize:function(l,t,w,h,e,change,we,no,ea,so,isDrag,sd){var snapDiff=sd||8; +var lpos=false,tpos=false,loffset=0,toffset=0;var wpos=false,hpos=false;var force,d=dragInfo; +if(e.ctrlKey){hideIndicators(null,true);return;}if(isDrag&&e.shiftKey){var dt=d.top-t; +var dl=d.left-l;var corner=(Math.atan(Math.abs(dt)/Math.abs(dl))*2)/Math.PI;if(corner<1/3){change.st=t=d.top; +}else{if(corner<2/3){if(l>d.left&&td.top){var min=Math.min(Math.abs(dl),Math.abs(dt)); +change.l=d.left+(dl<0?1:-1)*min;change.t=d.top+(dt<0?1:-1)*min;}else{var min=Math.min(Math.abs(dl),Math.abs(dt)); +change.l=d.left+(dl<0?1:-1)*min;change.t=d.top+(dt<0?1:-1)*min;}dragIndicator1.style.display="none"; +dragIndicator2.style.display="none";return;}else{change.sl=l=d.left;}}force=true; +}if(apf.config.snapcontainer){var c=d.container;if(Math.abs(l)0.5?gs:0); +}if(lpos===false){change.l=l-(r=l%gs)+(r/gs>0.5?gs:0);}if(!we&&hpos===false){change.w=w-(r=w%gs)+(r/gs>0.5?gs:0); +}if(!no&&wpos===false){change.h=h-(r=h%gs)+(r/gs>0.5?gs:0);}}if(lpos!==false&&(olpos===false||change.or)){dragIndicator1.style.left=(lpos+loffset+d.container[0])+"px"; +dragIndicator1.style.top=d.container[1]+"px";dragIndicator1.style.height=(d.container[3])+"px"; +dragIndicator1.style.display="block";dragIndicator1.style.borderWidth="0 0 0 2px"; +}else{dragIndicator1.style.display="none";}if(tpos!==false&&(otpos===false||change.ob)){dragIndicator2.style.left=(d.container[0])+"px"; +dragIndicator2.style.top=(tpos+toffset+d.container[1])+"px";dragIndicator2.style.width=(d.container[2])+"px"; +dragIndicator2.style.display="block";dragIndicator2.style.borderWidth="2px 0 0"; +}else{dragIndicator2.style.display="none";}if(wpos!==false){dragIndicator3.style.left=(wpos+d.container[0])+"px"; +dragIndicator3.style.top=d.container[1]+"px";dragIndicator3.style.height=(d.container[3])+"px"; +dragIndicator3.style.display="block";dragIndicator3.style.borderWidth="0 0 0 2px"; +}else{dragIndicator3.style.display="none";}if(hpos!==false){dragIndicator4.style.left=(d.container[0])+"px"; +dragIndicator4.style.top=(hpos+d.container[1])+"px";dragIndicator4.style.width=(d.container[2])+"px"; +dragIndicator4.style.display="block";dragIndicator4.style.borderWidth="2px 0 0"; +}else{dragIndicator4.style.display="none";}if(olpos!==false){dragIndicator6.style.left=(olpos+oloffset+d.container[0])+"px"; +dragIndicator6.style.top=d.container[1]+"px";dragIndicator6.style.height=(d.container[3])+"px"; +dragIndicator6.style.display="block";dragIndicator6.style.borderWidth="0 0 0 "+oppDiff+"px"; +}else{dragIndicator6.style.display="none";}if(otpos!==false){dragIndicator7.style.left=(d.container[0])+"px"; +dragIndicator7.style.top=(otpos+otoffset+d.container[1])+"px";dragIndicator7.style.width=(d.container[2])+"px"; +dragIndicator7.style.display="block";dragIndicator7.style.borderWidth=oppDiff+"px 0 0"; +}else{dragIndicator7.style.display="none";}if(!isDrag){if(!we){change.l=l;}if(!no){change.t=t; +}if(we){if(change.ol!=undefined){change.w=d.width+(d.left-change.ol);change.l=change.ol; +}else{if(change.l!=undefined){change.w=d.width+(d.left-change.l);}}}else{if(ea&&change.or!=undefined){change.w=olpos-d.left; +}}if(no){if(change.ot!=undefined){change.h=d.height+(d.top-change.ot);change.t=change.ot; +}else{if(change.t!=undefined){change.h=d.height+(d.top-change.t);}}}else{if(so&&change.ob!=undefined){change.h=otpos-d.top; +}}}else{if(olpos!=false){change.l=change.ol||change.or;}if(otpos!=false){change.t=change.ot||change.ob; +}}if(isDrag&&e.shiftKey){if(change.sl){change.l=change.sl;}if(change.st){change.t=change.st; +}}}};var dragInfo;function setDragInfo(el,pEl,isDrag){apf.setStyleClass(dragIndicator1,"indicate_common",["indicate_vbox","indicate_hbox","indicate_table","indicate_common"]); +if(pEl.localName=="html"){pEl=pEl.ownerDocument.body;}var container=pEl.$int;var isBody=pEl.$int.tagName=="BODY"; +var htmlEl=isDrag&&el.dragOutline?outline:el.$ext;var d=dragInfo={left:apf.getHtmlLeft(htmlEl),top:apf.getHtmlTop(htmlEl),width:htmlEl.offsetWidth,height:htmlEl.offsetHeight}; +d.cwidth=Math.round(d.width/2);d.cheight=Math.round(d.height/2);d.container=isBody?[0,0]:apf.getAbsolutePosition(container,null,true); +if(isBody){var m=apf.getMargin(container);}d.container.push((isBody?apf.getWindowWidth():apf.getHtmlInnerWidth(container)),(isBody?apf.getWindowHeight():apf.getHtmlInnerHeight(container))); +var els=pEl.getElementsByTagName("*",true);var xl=d.xl=[],yl=d.yl=[],curel;var xm=d.xm=[],ym=d.ym=[]; +var xr=d.xr=[],yr=d.yr=[],dels=d.els=[];if(apf.config.snapcontainer){xl.push(10); +xr.push(d.container[2]-10);yl.push(10);yr.push(d.container[3]-10);dels.push(d.container); +}if(apf.config.snapelement){var selected=apf.document.$getVisualSelect().getLastSelection(); +var q=apf.getBorderOffset(container);var bLeft=q[0];var bTop=q[1];for(var l,t,h,w,i=0,il=els.length; +i-1||!curel.$ext){continue;}l=curel.$ext.offsetLeft-bLeft; +xl.push(l);xm.push(l+Math.round((w=curel.$ext.offsetWidth)/2));xr.push(l+w);t=curel.$ext.offsetTop-bTop; +yl.push(t);ym.push(t+Math.round((h=curel.$ext.offsetHeight)/2));yr.push(t+h);dels.push(curel); +}}}function setStickyEdges(el,extra){var s=el.$stick,d=dragInfo,t=el.$stuck||(el.$stuck=[false,false,false,false]); +var setOpp=false;if(!apf.config.snapcontainer){return;}if(isCoord(s.orpos)&&!s.orEl.left){if(!t[1]&&!isCoord(el.right)){t[1]=true; +}el.setAttribute("right",s.orpos);setOpp=true;}else{if(isCoord(s.w)&&s.rsticky){if(!isCoord(el.right)){el.setAttribute("right",d.container[2]-coord(s.l,d.left)-s.w); +t[1]=true;}setOpp=true;}}if(isCoord(s.l)){if(isCoord(s.olpos)&&!s.olEl.right){el.setAttribute("left",s.olpos); +t[3]=true;}else{if(s.lsticky&&!isCoord(el.left)){el.setAttribute("left",s.l);t[3]=true; +}}if(!setOpp){if(s.rsticky){if(!t[1]&&!isCoord(el.right)){t[1]=true;}el.setAttribute("right",d.container[2]-s.l-coord(s.w,d.width)); +setOpp=true;}else{if(t[1]&&isCoord(el.right)&&(isCoord(s.l)||s.lsticky)){if(!isCoord(el.left)){el.setAttribute("left",s.l); +t[3]=true;}el.removeAttribute("right");el.setAttribute("width",extra&&extra.w||el.$ext.offsetWidth); +t[1]=false;}}}}if(t[1]&&isCoord(el.left)&&(setOpp||isCoord(el.right))&&!(s.rsticky||(isCoord(s.orpos)&&!s.orEl.left))){el.removeAttribute("right"); +el.setAttribute("width",extra&&extra.w||el.$ext.offsetWidth);t[1]=false;}else{if(t[3]&&isCoord(el.left)&&(setOpp||isCoord(el.right))&&!(s.lsticky||(isCoord(s.olpos)&&!s.olEl.right))){el.removeAttribute("left"); +el.setAttribute("width",extra&&extra.w||el.$ext.offsetWidth);t[3]=false;}else{if(t[1]&&(setOpp||isCoord(el.right))&&!(s.rsticky||(isCoord(s.orpos)&&!s.orEl.left))){el.setAttribute("left",extra&&extra.l||el.$ext.offsetLeft); +t[3]=true;el.removeAttribute("right");el.setAttribute("width",extra&&extra.w||el.$ext.offsetWidth); +t[1]=false;}}}var setOpp=false;if(isCoord(s.obpos)&&!s.obEl.top){if(!t[2]&&!isCoord(el.bottom)){t[2]=true; +}el.setAttribute("bottom",s.obpos);setOpp=true;}else{if(isCoord(s.h)&&s.bsticky){if(!isCoord(el.bottom)){el.setAttribute("bottom",d.container[3]-coord(s.t,d.top)-s.h); +t[2]=true;}setOpp=true;}}if(isCoord(s.t)){if(isCoord(s.otpos)&&!s.otEl.bottom){el.setAttribute("top",s.otpos); +t[0]=true;}else{if(s.tsticky&&!isCoord(el.top)){el.setAttribute("top",s.t);t[0]=true; +}}if(!setOpp){if(s.bsticky){if(!t[2]&&!isCoord(el.bottom)){t[2]=true;}el.setAttribute("bottom",d.container[3]-s.t-coord(s.h,d.height)); +setOpp=true;}else{if(t[2]&&isCoord(el.bottom)&&(isCoord(s.t)||s.tsticky)){if(!isCoord(el.top)){el.setAttribute("top",s.t); +t[0]=true;}el.removeAttribute("bottom");el.setAttribute("height",extra&&extra.h||el.$ext.offsetHeight); +t[2]=false;}}}}if(t[2]&&isCoord(el.top)&&(setOpp||isCoord(el.bottom))&&!(s.bsticky||(isCoord(s.obpos)&&!s.obEl.top))){el.removeAttribute("bottom"); +el.setAttribute("height",extra&&extra.h||el.$ext.offsetHeight);t[2]=false;}else{if(t[0]&&isCoord(el.top)&&(setOpp||isCoord(el.bottom))&&!(s.tsticky||(isCoord(s.otpos)&&!s.otEl.bottom))){el.removeAttribute("top"); +el.setAttribute("height",extra&&extra.h||el.$ext.offsetHeight);t[0]=false;}else{if(t[2]&&(setOpp||isCoord(el.bottom))&&!(s.bsticky||(isCoord(s.obpos)&&!s.obEl.top))){el.setAttribute("top",extra&&extra.t||el.$ext.offsetTop); +t[0]=true;el.removeAttribute("bottom");el.setAttribute("height",extra&&extra.h||el.$ext.offsetHeight); +t[2]=false;}}}}var control={stop:apf.K};function hideIndicators(animate,exclude5){if(!dragIndicator1){return; +}if(animate){control={};var tweens=[];for(var i=0;i1&&!e.htmlEvent.ctrlKey?apf.document.$getVisualSelect().$getOutline():dragOutline; +this.$setOutline(outline);}function beforedrag(e,reparent,add){var name,pEl;var selection=apf.document.$getVisualSelect().getLastSelection(); +if((this.$multidrag=selection.length>1)&&selection.indexOf(this)==-1){return false; +}if(outline!=(selection.length>1?apf.document.$getVisualSelect().$getOutline():dragOutline)){return false; +}control.stop();if(lastReparent&&!add){pEl=lastReparent;name=pEl.localName;}else{if(!e){e=event; +}name=(pEl=this.parentNode).localName;}if(!lastPos){lastPos=apf.getAbsolutePosition(outline,pEl.localName=="table"?pEl.$ext:outline.offsetParent); +}if("vbox|hbox|table".indexOf(name)>-1){this.realtime=true;apf.setStyleClass(dragIndicator1,"indicate_"+name,["indicate_vbox","indicate_hbox","indicate_table","indicate_common"]); +dragIndicator1.style.borderWidth="";this.$showDrag=showDrag[pEl.localName];}else{if(pEl.editable||add||this.$adding){this.realtime=true; +setDragInfo(this,pEl,true);this.$showDrag=showDrag.common;}else{this.realtime=false; +}}this.ownerDocument.execCommand("begin");}function afterdrag(e){if(lastAmlNode){clearTimeout(lastAmlNode[4]); +lastAmlNode=null;}lastReparent=null;var el=this;var htmlNode=el.dragOutline?outline:el.$ext; +delete this.$multidrag;var l,t,w,h,selected,prevParent,pNode;if(el.$adding){selected=[el]; +prevParent=pNode=apf.findHost(htmlNode.parentNode);}else{selected=apf.document.$getVisualSelect().getLastSelection(); +prevParent=selected[0].parentNode;pNode=apf.findHost(htmlNode.parentNode);}if(selected.length>1&&lastPos&&"vbox|hbox|table".indexOf(pNode.localName)==-1){var deltaX=apf.getHtmlLeft(htmlNode)-lastPos[0]; +var deltaY=apf.getHtmlTop(htmlNode)-lastPos[1];var pWidth=outline.parentNode.tagName=="BODY"?apf.getWindowWidth():apf.getHtmlInnerWidth(outline.parentNode); +var pHeight=outline.parentNode.tagName=="BODY"?apf.getWindowHeight():apf.getHtmlInnerHeight(outline.parentNode); +if(deltaX||deltaY||"vbox|hbox|table".indexOf(prevParent.localName)>-1){var isTable=prevParent.localName=="table"; +for(var n,i=0;i-1){for(var i=0; +i-1){return; +}var dirX=0,dirY=0;switch(e.keyCode){case 38:dirY=-1;break;case 40:dirY=1;break; +case 39:dirX=1;break;case 37:dirX=-1;break;default:return;}control.stop();var l,t,w,h,n=selected[0],ext,d; +n.ownerDocument.execCommand("begin");for(var i=0,il=selected.length;i1){var vOutline=n.ownerDocument.$getVisualSelect().$getOutline(); +l=apf.getHtmlLeft(vOutline);t=apf.getHtmlTop(vOutline);w=vOutline.offsetWidth;h=vOutline.offsetheight; +}setDragInfo(n,n.parentNode,true);showDrag.common_resize.call(n,l,t,w,h,{},{},true,true,true,true,true,1); +hideIndicators(true);}apf.addEventListener("keydown",keydown);function setDefaultStuck(amlNode){amlNode.$stuck=[amlNode.$adding||amlNode.top&&!amlNode.bottom||amlNode.top==10||amlNode.top===0,amlNode.right&&!amlNode.left||amlNode.right==10||amlNode.right===0,amlNode.bottom&&!amlNode.top||amlNode.bottom==10||amlNode.bottom===0,amlNode.$adding||amlNode.left&&!amlNode.right||amlNode.left==10||amlNode.left===0]; +var s=amlNode.$stuck;if(s[0]&&s[1]&&s[2]&&s[3]){amlNode.$stuck=[false,false,false,false]; +}}apf.ContentEditable.addInteraction=function(amlNode){if(!inited){init();}amlNode.addEventListener("beforedragstart",beforedragstart); +amlNode.addEventListener("beforedrag",beforedrag);amlNode.addEventListener("beforeresize",beforeresize); +amlNode.addEventListener("afterdrag",afterdrag);amlNode.addEventListener("afterresize",afterresize); +amlNode.addEventListener("resizecancel",cancel);amlNode.addEventListener("dragcancel",cancel); +setDefaultStuck(amlNode);};apf.ContentEditable.removeInteraction=function(amlNode){amlNode.removeEventListener("beforedragstart",beforedragstart); +amlNode.removeEventListener("beforedrag",beforedrag);amlNode.removeEventListener("beforeresize",beforeresize); +amlNode.removeEventListener("afterdrag",afterdrag);amlNode.removeEventListener("afterresize",afterresize); +amlNode.removeEventListener("resizecancel",cancel);amlNode.removeEventListener("dragcancel",cancel); +delete amlNode.$stuck;};})();apf.selectrect=function(){var active;var p1=document.body.appendChild(document.createElement("div")),p2=document.body.appendChild(document.createElement("div")),q=document.body.appendChild(document.createElement("div")),_self=this,startX,startY; +p1.className="pointer_left";p2.className="pointer_right";q.className="new_element"; +this.activate=function(){if(active){return;}active=true;document.onmousemove=function(e){if(!e){e=event; +}p1.style.width=(Math.abs(e.clientX)||1)+"px";p1.style.height=(Math.abs(e.clientY)||1)+"px"; +p2.style.width=(Math.abs(document.documentElement.offsetWidth-e.clientX-5)||1)+"px"; +p2.style.height=(Math.abs(document.documentElement.offsetHeight-e.clientY-5)||1)+"px"; +if(q.style.display=="block"){var wt=e.clientX-startX-1,ht=e.clientY-startY-1,min=Math.min(wt,ht); +q.style.width=(wt<0?-1*(wt-1):(wt||1))+"px";q.style.height=(ht<0?-1*(ht-1):(ht||1))+"px"; +q.style.left=wt<0?"":(startX)+"px";q.style.right=wt<0?(document.documentElement.offsetWidth-startX-4)+"px":""; +q.style.bottom=ht<0?(document.documentElement.offsetHeight-startY-4)+"px":"";q.style.top=ht<0?"":(startY)+"px"; +apf.config.setProperty("x",apf.getHtmlLeft(q));apf.config.setProperty("y",apf.getHtmlTop(q)); +apf.config.setProperty("w",q.offsetWidth);apf.config.setProperty("h",q.offsetHeight); +}else{apf.config.setProperty("x",e.clientX);apf.config.setProperty("y",e.clientY); +apf.config.setProperty("w","");apf.config.setProperty("h","");}};document.onmousedown=function(e){if(!e){e=event; +}p1.style.top="-2000px";p2.style.top="-2000px";var el=document.elementFromPoint(e.clientX,e.clientY); +var amlNode=apf.findHost(el);p1.style.top="";p2.style.top="";if(amlNode){while(amlNode&&!amlNode.$int){amlNode=amlNode.parentNode; +}}if(!amlNode){amlNode=apf.document.documentElement;}if(!amlNode.editable){return; +}q.style.display="block";q.style.left=(startX=event.clientX)+"px";q.style.top=(startY=event.clientY)+"px"; +q.style.width=q.style.height="1px";apf.dragMode=true;};document.onmouseup=function(){if(q.offsetWidth>10&&q.offsetHeight>10){if(apf.document.queryCommandValue("mode")=="select"){apf.document.execCommand("select",false,{htmlNode:q}); +}else{apf.document.execCommand("add",false,{htmlNode:q});}_self.deactivate();}q.style.display="none"; +startX=false;startY=false;apf.dragMode=false;};p1.style.display=p2.style.display="block"; +document.body.style.cursor=document.documentElement.style.cursor="crosshair";}; +this.deactivate=function(){active=false;document.onmousemove=null;document.onmousedown=null; +document.onmouseup=null;p1.style.display=p2.style.display=q.style.display="none"; +document.body.style.cursor=document.documentElement.style.cursor="";};};apf.visualConnect=function(sel){var lineMode="draw"; +var active,div,cTemplate;var fromEl,toEl;var fromAtt,toAtt;var connections;var attMenu; +var ignoreFromAtts=["id"];var ignoreToAtts=["for"];var _self=this;var prevSelection; +var width=document.body.clientWidth;var height=800;var paintGroup=apf.vector.group({w:width,h:height,z:1000}); +var paintRect=paintGroup.rect({sw:1,s:"#24a3f4",f:"#24a3f4",o:0.2});var paintLine=paintGroup.shape({p:"",sw:1.5,s:"#24a3f4",f:"#24a3f4"}); +var paintConnections=paintGroup.shape({p:"",sw:1.5,s:"#24a3f4",f:"#24a3f4"});this.setMode=function(mode){lineMode=mode; +if(this.onchangemode){this.onchangemode({mode:mode});}};this.activate=function(e,timeout){if(active){return; +}active=true;var _self=this;var drawPath=[],connectionPath=[],hNode,pos,selection=sel.$getNodeList(),lines=[]; +var timer,lastTime;var isDrawing=false;apf.addEventListener("vcpropchange",function(e){if(connections[e.obj.fromEl.id]&&connections[e.obj.fromEl.id][e.obj.toEl.id]){var el1=e.obj.fromEl.id,el2=e.obj.toEl.id; +}else{var el1=e.obj.toEl.id,el2=e.obj.fromEl.id;}for(var maxBoxWidth=0,maxLeftWidth=0,i=0,l=connections[el1][el2].length; +imaxLeftWidth){maxLeftWidth=c.getMaxLeftWidth(); +}if(c.getMaxBoxWidth()>maxBoxWidth){maxBoxWidth=c.getMaxBoxWidth();}}for(i=0,l=connections[el1][el2].length; +i-1){continue; +}attList.push(new apf.item({caption:name}));}attMenu=new apf.menu({htmlNode:div,id:"attMenu",childNodes:attList}); +setTimeout(function(e){attMenu.display(x,y,true);});attMenu.addEventListener("mousedown",function(e){(e||event).cancelBubble=true; +});attMenu.addEventListener("mouseup",function(e){(e||event).cancelBubble=true; +});attMenu.addEventListener("itemclick",function(e){sel.$selectList(selection=[fromEl]); +apf.dragMode=true;toAtt=e.value;attMenu.setProperty("visible",false);fromEl.setAttribute(fromAtt,"{"+toEl.id+"."+toAtt+"}"); +paintLine.style({p:""});if(createConnections([fromEl])){showConnections();}});}isDrawing=false; +}function updateDraw(e){apf.plane.hide();paintGroup.style({v:0});paintGroup.repaint(); +var htmlNode=document.elementFromPoint(e.clientX,e.clientY);var amlNode=apf.findHost(htmlNode); +if(amlNode&&amlNode.editable&&selection.indexOf(amlNode)==-1){htmlNode=amlNode.$ext; +var pos=apf.getAbsolutePosition(htmlNode);paintRect.style({x:pos[0],y:pos[1],w:htmlNode.offsetWidth,h:htmlNode.offsetHeight}); +}else{paintRect.style({w:0,h:0});}var drawPath=[];for(var i=0,il=selection.length; +i-1){continue; +}attList.push(new apf.item({caption:name}));}attMenu=new apf.menu({htmlNode:div,id:"attMenu",childNodes:attList}); +setTimeout(function(e){attMenu.display(x,y,true);});attMenu.addEventListener("itemclick",function(e){sel.$selectList(selection=[fromEl]); +fromAtt=e.value;attMenu.setProperty("visible",false);isDrawing=true;});}_self.setMode("draw-started"); +apf.plane.show();}else{if(attMenu.visible){attMenu.setProperty("visible",false); +}if(fromEl){stopDraw(e);}}}};document.onmouseup=function(e){};function createConnection(el1,at1,targetList){if(!(el1.id&&at1&&targetList.length)){return; +}var pos,x,y,w,h;if(targetList.length==1){var el2=targetList[0].el;var at2=targetList[0].at; +var from={x:(x=(pos=apf.getAbsolutePosition((hNode=el1.$ext)))[0]),y:(y=pos[1]),w:(w=hNode.offsetWidth),h:(h=hNode.offsetHeight),t:[Math.round(x+w/2),y],b:[Math.round(x+w/2),y+h],l:[x,Math.round(y+h/2)],r:[x+w,Math.round(y+h/2)],c:[Math.round(x+w/2),Math.round(y+h/2)]}; +var to={x:(x=(pos=apf.getAbsolutePosition((hNode=el2.$ext)))[0]),y:(y=pos[1]),w:(w=hNode.offsetWidth),h:(h=hNode.offsetHeight),t:[Math.round(x+w/2),y],b:[Math.round(x+w/2),y+h],l:[x,Math.round(y+h/2)],r:[x+w,Math.round(y+h/2)],c:[Math.round(x+w/2),Math.round(y+h/2)]}; +var conn={from:{el:el1,at:at1,pos:from.c},to:{el:el2,at:at2,pos:to.c}};var val; +if(val=el2.getAttribute(at2)){conn.val=val;}else{conn.val="{"+el2.id+"."+at2+"}"; +conn.readonly=true;}var fromId,toId;if(!connections){connections={};}if(!connections[(fromId=el1.id)]){connections[fromId]={}; +}if(!connections[fromId][toId]){connections[fromId][toId]=[conn];}else{connections[fromId][toId].push(conn); +}}else{return;}}function drawConnections(){connectionPath=[];if(div){document.body.removeChild(div); +}div=document.body.appendChild(document.createElement("div"));div.style.display="block"; +div.style.position="absolute";div.style.left="0px";div.style.top="0px";div.style.width=width+"px"; +div.style.height=height+"px";div.style.zIndex=100000001;for(var id in connections){for(var id2 in connections[id]){var curConnections=connections[id][id2]; +for(var c,cType,connEdit,connDivs=[],maxBoxWidth=0,maxLeftWidth=0,centerPos,pos1,pos2,i=0,l=curConnections.length; +imaxLeftWidth){maxLeftWidth=connEdit.getMaxLeftWidth(); +}if(connEdit.getMaxBoxWidth()>maxBoxWidth){maxBoxWidth=connEdit.getMaxBoxWidth(); +}connDivs.push(connEdit);var linePadding=4;centerPos=(l%2==0)?[centerPos[0]-(connEdit.$box.offsetWidth+10)/2,centerPos[1]-l/2*connEdit.$box.offsetHeight*i]:centerPos=[centerPos[0]-(connEdit.$box.offsetWidth+10)/2,centerPos[1]-(l+1)/2*connEdit.$box.offsetHeight*(i+0.5)]; +centerPos[0]=(centerPos[0]>0)?centerPos[0]:0;centerPos[1]=(centerPos[1]>0)?centerPos[1]:0; +connEdit.$ext.style.display="none";connEdit.$ext.style.top=centerPos[1]+"px";connEdit.$ext.style.left=centerPos[0]+"px"; +connectionPath.push("M",pos1[0],pos1[1],"L",pos2[0],pos2[1],paintGroup.circlePath(pos2[0],pos2[1],1,1)); +}for(var c,container,spans,cDiv,i=0,l=connDivs.length;i"||""; +}else{txt.value=value;}txt.unselectable="Off";var f=function(){try{txt.focus(); +txt.select();}catch(e){}};if(apf.isIE){f();}else{setTimeout(f);}this.renaming=true; +},this.stopRename=this.stopEdit=function(x,success){if(!this.renaming){return;}this.renaming=false; +var htmlNode=this.$value;htmlNode.removeChild(this.$txt);var value=typeof success=="string"?success:(apf.hasContentEditable?this.$txt.innerText:this.$txt.value).replace(/<.*?nobr>/gi,"").replace(/\n$/,""); +if(success&&this.value!=value){this.setPropValue(value);}else{if(htmlNode.nodeType==1){htmlNode.innerHTML=this.value; +}else{htmlNode.nodeValue=this.value;}}htmlNode.parentNode.scrollLeft=0;};this.setPropName=function(name){this.fromAt=name; +this.$lblAttMenu.innerHTML=this.fromAt;};this.setPropValue=function(value){this.value=value; +this.$lblVal.innerHTML=this.value;};this.draw=function(name,prop,value){var _self=this; +this.$ext=document.createElement("div");this.$ext.setAttribute("class","atchart_box"); +this.$ext.setAttribute("style","width:285px;color:#000000;font-family:Tahoma;font-size:12px;height:29px;min-width:30px;min-height:29px;max-height:29px;overflow:hidden;cursor:default;position:absolute;"); +this.$ext.innerHTML='
    Button.caption
    =""
    '; +this.$ext.onmousedown=this.$ext.onmouseup=function(e){(e||event).cancelBubble=true; +};var divs,spans;this.$delBtn=(divs=this.$ext.getElementsByTagName("div"))[1];if(this.type=="readonly"){this.$delBtn.style.display="none"; +}this.$box=divs[3];this.$fromBox=this.$box.getElementsByTagName("div")[0];this.$lblFromEl=(spans=this.$fromBox.getElementsByTagName("span"))[0]; +this.$lblFromEl.innerHTML=this.fromEl.id+".";this.$attMenu=spans[1];this.$lblAttMenu=this.$attMenu.firstChild; +this.setPropName(this.fromAt);if(this.type!="readonly"){this.$delBtn.onmousedown=function(e){(e||event).cancelBubble=true; +};this.$delBtn.onmouseup=function(e){_self.fromEl.setAttribute(_self.fromAt,""); +apf.dispatchEvent("vcdelete",{el:_self.$ext});(e||event).cancelBubble=true;};this.$attMenu.onmousedown=function(e){(e||event).cancelBubble=true; +};this.$attMenu.onmouseup=function(e){var e=e||event;for(var name,attList=[],ai=0,al=_self.fromEl.attributes.length; +ai-1){continue; +}attList.push(new apf.item({caption:name}));}attMenu=new apf.menu({htmlNode:_self.$ext,id:"attMenu",childNodes:attList}); +var pos=apf.getAbsolutePosition(this);var x=pos[0],y=pos[1]+this.offsetHeight;setTimeout(function(){attMenu.display(x,y,true); +attMenu.$ext.style.left=x;attMenu.$ext.style.zIndex=100000002;apf.popup.cache[apf.popup.last].content.onmousedown=function(e){var newAt=attMenu.$selected.caption; +if(_self.fromAt==newAt){return;}attMenu.setProperty("visible",false);_self.fromEl.setAttribute(_self.fromAt,""); +_self.setPropName(newAt);_self.fromEl.setAttribute(newAt,_self.value);(e||event).cancelBubble=true; +_self.container.onmousedown=_self.container.onmouseup=function(e){_self.container.onmousedown=_self.container.onmouseup=null; +apf.dispatchEvent("vcpropchange",{obj:_self});(e||event).cancelBubble=true;};}; +});(e||event).cancelBubble=true;};}this.$lblVal=this.$box.getElementsByTagName("label")[0]; +this.setPropValue(this.value);if(this.type!="readonly"){this.$inputVal=this.createInput(); +}if(this.type=="readonly"){this.$ext.onmousedown=function(e){apf.dispatchEvent("vcmoveselection",{target:_self.toEl}); +(e||event).cancelBubble=true;};this.$ext.onmouseup=function(e){(e||event).cancelBubble=true; +};}};this.createInput=function(){var inputVal=document.createElement("input");inputVal.setAttribute("type","text"); +inputVal.setAttribute("class","section5");inputVal.setAttribute("value",this.$lblVal.innerHTML); +inputVal.style.width=(this.$lblVal.offsetWidth-2>0?this.$lblVal.offsetWidth-2:0)+"px"; +inputVal.onkeydown=inputVal.onkeypress=inputVal.onmousedown=inputVal.onmouseup=function(e){(e||event).cancelBubble=true; +};inputVal.onblur=function(){this.hasFocus=false;this.onkeydown=this.onkeypress=this.onkeyup=null; +_self.$lblVal.setAttribute("value",this.value);_self.$lblVal.getAttribute("el").setAttribute(lblVal.getAttribute("at"),this.value); +if(createConnections(selection)){showConnections();}(e||event).cancelBubble=true; +};inputVal.onkeyup=function(e){if((e||event).keyCode==13){_self.$lblVal.setAttribute("value","x"+this.value); +_self.$lblVal.getAttribute("el").setAttribute(lblVal.getAttribute("at"),this.value); +if(createConnections(selection)){showConnections();}}(e||event).cancelBubble=true; +};inputVal.onfocus=function(e){this.hasFocus=true;};inputVal.onmouseout=function(e){if(this.hasFocus){return; +}$this.inputVal.replaceNode(lblVal,inputVal);};return inputVal;};this.getMaxLeftWidth=function(){return this.$lblFromEl.offsetWidth+this.$lblAttMenu.offsetWidth; +};this.getMaxBoxWidth=function(){return this.$lblFromEl.offsetWidth+this.$lblAttMenu.offsetWidth+this.$lblVal.offsetWidth; +};}).call(connectEdit.prototype=new apf.Class());apf.visualSelect=function(selection){this.$init(); +var _self=this;selection.addEventListener("update",function(){_self.updateSelection(); +});this.$selection=selection;};(function(){var nodes=[],pos=["n","ne","e","se","s","sw","w","nw"],div,oOutline,inited=false; +function init(){while(nodes.length!=8){div=document.body.appendChild(document.createElement("div")); +div.className="idegrabber";div.style.display="none";div.onmousedown=mousedown;div.self=this; +div.host=false;nodes.push(div);nodes[(div.type=pos.pop())]=div;}oOutline=document.body.appendChild(document.createElement("div")); +oOutline.className="multiselect_container";oOutline.host=false;oOutline.self=this; +oOutline.onmouseup=oOutline.onmousedown=function(e){if(!e){e=event;}var prevTop=this.style.top; +this.style.top="-10000px";var el=document.elementFromPoint(e.clientX,e.clientY); +this.style.top=prevTop;apf.fireEvent(el,(e.type||e.name),e);e.cancelBubble=true; +};inited=true;}this.$getOutline=function(){return oOutline;};var selected=[],anchors,size=7,margin=-1; +this.show=function(){if(!inited){init.call(this);}this.visible=true;for(var i=0; +i1){oOutline.innerHTML=Array(nodes.length+1).join("
    "); +}}this.updateGeo();if(!this.visible){this.show();}};this.getLastSelection=function(){return lastSelection; +};var lastPos,txt,recursion;this.updateGeo=function(force,onlyUpdateAnchors){if(recursion){return; +}var selection=lastSelection;if(!selection.length){return;}recursion=true;if(selection.length==1){var sel=selection[0]; +if(!sel.parentNode){sel.$focusParent.focus();return(recursion=false);}if(sel.$adding){return(recursion=false); +}var anchors=selection.length==1?(sel.$anchors&&sel.$anchors.length?sel.$anchors:[sel.top,sel.right,sel.bottom,sel.left]):[]; +if(anchors&&!resizing&&!this.renaming){var pel=sel.parentNode;var name=pel.localName; +var exclPNode="table|vbox|hbox".indexOf(name)>-1;var fullDisabled=name=="vbox"&&String(sel.height).indexOf("%")>-1||name=="hbox"&&String(sel.width).indexOf("%")>-1; +var pack=sel.align||pel.pack;apf.setStyleClass(nodes.n,fullDisabled||name=="table"||name=="vbox"&&pack=="start"||name=="hbox"?"idegrabber_disabled":(!exclPNode&&(anchors[0]||anchors[0]===0)?"idegrabber_selected":""),["idegrabber_selected","idegrabber_disabled"]); +apf.setStyleClass(nodes.e,fullDisabled||name=="table"||name=="hbox"&&pack=="end"?"idegrabber_disabled":(!exclPNode&&(anchors[1]||anchors[1]===0)?"idegrabber_selected":""),["idegrabber_selected","idegrabber_disabled"]); +apf.setStyleClass(nodes.s,fullDisabled||name=="vbox"&&pack=="end"?"idegrabber_disabled":(!exclPNode&&(anchors[2]||anchors[2]===0)?"idegrabber_selected":""),["idegrabber_selected","idegrabber_disabled"]); +apf.setStyleClass(nodes.w,fullDisabled||name=="table"||name=="vbox"||name=="hbox"&&pack=="start"?"idegrabber_disabled":(!exclPNode&&(anchors[3]||anchors[3]===0)?"idegrabber_selected":""),["idegrabber_selected","idegrabber_disabled"]); +apf.setStyleClass(nodes.nw,fullDisabled||name=="table"||name=="vbox"&&pack=="start"||name=="hbox"?"idegrabber_disabled":"",["idegrabber_disabled"]); +apf.setStyleClass(nodes.ne,fullDisabled||name=="table"||name=="hbox"&&pack=="end"?"idegrabber_disabled":"",["idegrabber_disabled"]); +apf.setStyleClass(nodes.sw,fullDisabled||name=="vbox"&&pack=="end"?"idegrabber_disabled":"",["idegrabber_disabled"]); +apf.setStyleClass(nodes.se,fullDisabled?"idegrabber_disabled":"",["idegrabber_disabled"]); +this.$selection.dispatchEvent("update-content",{sel:sel});}var oHtml=sel.$ext;oOutline.style.display="none"; +if(!oHtml.offsetParent||onlyUpdateAnchors){return(recursion=false);}if(apf.isIE){oHtml.parentNode.appendChild(txt||(txt=document.createTextNode(""))); +}var pos=apf.getAbsolutePosition(oHtml);pos.push(oHtml.offsetWidth,oHtml.offsetHeight); +}else{var oHtml,opos,pos=[100000,100000,0,0];for(var i=0;ipos[2]){pos[2]=opos[0]+oHtml.offsetWidth; +}if(opos[1]+oHtml.offsetHeight>pos[3]){pos[3]=opos[1]+oHtml.offsetHeight;}}if(!oHtml.offsetParent){return(recursion=false); +}oHtml.offsetParent.appendChild(oOutline);pos[2]-=pos[0];pos[3]-=pos[1];for(i=0,l=nodes.length; +i1){var ext,html,epos;for(i=0,l=selection.length; +i1){return;}var sel=docsel.$getFirstNode(); +var doc=docsel.$ownerDocument;var name=sel.parentNode.localName;var type=this.type; +doc.$commands.begin.call(doc);if(e.ctrlKey&&type.length==1){if(sel.$anchors&&sel.$anchors.length){var anchors=sel.$anchors; +sel.setAttribute("anchors",null);sel.setAttribute("top",anchors[0]);sel.setAttribute("right",anchors[1]); +sel.setAttribute("bottom",anchors[2]);sel.setAttribute("left",anchors[3]);}var value=sel[map[type]]; +apf.setStyleClass(this,!value&&value!==0?"idegrabber_selected":"",["idegrabber_selected"]); +var pHtmlNode=sel.$ext.offsetParent;if(pHtmlNode.tagName=="BODY"){pHtmlNode=document.documentElement; +}var curWidth=sel.$ext.offsetWidth;var curHeight=sel.$ext.offsetHeight;var prop=map[type]; +if(sel[prop]||sel[prop]===0){if(prop=="right"&&!sel.left&&sel.left!==0){sel.setAttribute("left",apf.getHtmlLeft(sel.$ext)); +}else{if(prop=="bottom"&&!sel.top&&sel.top!==0){sel.setAttribute("top",apf.getHtmlTop(sel.$ext)); +}else{if(prop=="left"&&!sel.right&&sel.right!==0){sel.setAttribute("right",apf.getHtmlRight(sel.$ext)); +}else{if(prop=="top"&&!sel.bottom&&sel.bottom!==0){sel.setAttribute("bottom",apf.getHtmlBottom(sel.$ext)); +}}}}sel.removeAttribute(prop);}else{switch(type){case"e":sel.setAttribute("right",apf.getHtmlRight(sel.$ext)); +break;case"w":sel.setAttribute("left",apf.getHtmlLeft(sel.$ext));break;case"n":sel.setAttribute("top",apf.getHtmlTop(sel.$ext)); +break;case"s":sel.setAttribute("bottom",apf.getHtmlBottom(sel.$ext));break;}}if(!sel.left&&sel.left!==0||!sel.right&&sel.right!==0){sel.setAttribute("width",curWidth); +}else{sel.removeAttribute("width");}if(!sel.top&&sel.right!==0||!sel.bottom&&sel.bottom!==0){sel.setAttribute("height",curHeight); +}else{sel.removeAttribute("height");}doc.$commands.commit.call(doc);this.self.updateGeo(); +}else{sel.$resizeStart(e||event,{resizeType:type,nocursor:true});resizing=this; +apf.setStyleClass(this,"idegrabber_resizing");}}}).call(apf.visualSelect.prototype=new apf.Class()); +apf.window=function(){this.$uniqueId=apf.all.push(this);this.apf=apf;this.toString=function(){return"[apf.window]"; +};this.getActionTracker=function(){return this.$at;};this.loadCodeFile=function(url){if(self[url]){apf.importClass(self[url],true,this.win); +}else{apf.include(url);}};this.flash=function(){if(apf.window.hasFocus()||apf.isIphone){return; +}if(apf.isDeskrun){jdwin.Flash();}else{if(apf.isIE){if(!this.popup){this.popup=window.createPopup(); +}if(apf.window.stopFlash){return;}state+="x";function doFlash(nopopup){if(apf.window.hasFocus()){return; +}window.focus();function doPopup(){if(apf.window.hasFocus()){return;}this.popup.hide(); +this.popup.show(0,0,0,0,document.body);this.popup.document.write("