if(typeofGENTICS=="undefined"||!GENTICS){varGENTICS={}}if(typeofGENTICS.Utils=="undefined"||!GENTICS){GENTICS.Utils={}}GENTICS.Utils.RangeObject=function(param){this.startContainer;this.startOffset;this.endContainer;this.endOffset;this.startParents=[];this.endParents=[];this.rangeTree=[];if(typeofparam==="object"){if(param.startContainer!==undefined){this.startContainer=param.startContainer}if(param.startOffset!==undefined){this.startOffset=param.startOffset}if(param.endContainer!==undefined){this.endContainer=param.endContainer}if(param.endOffset!==undefined){this.endOffset=param.endOffset}}else{if(param===true){this.initializeFromUserSelection()}}};GENTICS.Utils.RangeObject.prototype.log=function(message,obj){if(GENTICS&&GENTICS.Aloha&&GENTICS.Aloha.Log){GENTICS.Aloha.Log.debug(this,message);returnfalse}if(console){console.log(message);if(obj){console.log(obj)}}};GENTICS.Utils.RangeObject.prototype.isCollapsed=function(){return(!this.endContainer||(this.startContainer===this.endContainer&&this.startOffset===this.endOffset))};GENTICS.Utils.RangeObject.prototype.getCommonAncestorContainer=function(){if(this.commonAncestorContainer){returnthis.commonAncestorContainer}this.updateCommonAncestorContainer();returnthis.commonAncestorContainer};GENTICS.Utils.RangeObject.prototype.getContainerParents=function(limit,fromEnd){varcontainer=fromEnd?this.endContainer:this.startContainer;varparentStore=fromEnd?this.endParents:this.startParents;if(!container){returnfalse}if(typeoflimit=="undefined"){limit=jQuery("body")}if(!parentStore[limit.get(0)]){varparents;if(container.nodeType==3){parents=jQuery(container).parents()}else{parents=jQuery(container).parents();for(vari=parents.length;i>0;--i){parents[i]=parents[i-1]}parents[0]=container}varlimitIndex=parents.index(limit);if(limitIndex>=0){parents=parents.slice(0,limitIndex)}parentStore[limit.get(0)]=parents}returnparentStore[limit.get(0)]};GENTICS.Utils.RangeObject.prototype.getStartContainerParents=function(limit){returnthis.getContainerParents(limit,false)};GENTICS.Utils.RangeObject.prototype.getEndContainerParents=function(limit){returnthis.getContainerParents(limit,true)};GENTICS.Utils.RangeObject.prototype.updateCommonAncestorContainer=function(commonAncestorContainer){varparentsStartContainer=this.getStartContainerParents();varparentsEndContainer=this.getEndContainerParents();if(!commonAncestorContainer){if(!(parentsStartContainer.length>0&&parentsEndContainer.length>0)){GENTICS.Utils.RangeObject.prototype.log("could not find commonAncestorContainer");returnfalse}for(vari=0;i<parentsStartContainer.length;i++){if(parentsEndContainer.index(parentsStartContainer[i])!=-1){this.commonAncestorContainer=parentsStartContainer[i];break}}}else{this.commonAncestorContainer=commonAncestorContainer}GENTICS.Utils.RangeObject.prototype.log(commonAncestorContainer?"commonAncestorContainer was set successfully":"commonAncestorContainer was calculated successfully");returntrue};GENTICS.Utils.RangeObject.prototype.getCollapsedIERange=function(container,offset){varieRange=document.body.createTextRange();varleft=this.searchElementToLeft(container,offset);if(left.element){vartmpRange=document.body.createTextRange();tmpRange.moveToElementText(left.element);ieRange.setEndPoint("StartToEnd",tmpRange);if(left.characters!=0){ieRange.moveStart("character",left.characters)}else{ieRange.moveStart("character",1);ieRange.moveStart("character",-1)}}else{varright=this.searchElementToRight(container,offset);if(false&&right.element){vartmpRange=document.body.createTextRange();tmpRange.moveToElementText(right.element);ieRange.setEndPoint("StartToStart",tmpRange);if(right.characters!=0){ieRange.moveStart("character",-right.characters)}else{ieRange.moveStart("character",-1);ieRange.moveStart("character",1)}}else{varparent=container.nodeType==3?container.parentNode:container;vartmpRange=document.body.createTextRange();tmpRange.moveToElementText(parent);ieRange.setEndPoint("StartToStart",tmpRange);if(left.characters!=0){ieRange.moveStart("character",left.characters)}}}ieRange.collapse();r
if(typeofGENTICS=="undefined"||!GENTICS){varGENTICS={}}GENTICS.Aloha=function(){};GENTICS.Aloha.setAutobase=function(){varscriptTags=jQuery("script");varpath=scriptTags[scriptTags.length-1].src.split("?")[0];path=path.split("/");varsubstitute=1;if("core"===path[path.length-2]){substitute=2}GENTICS.Aloha.prototype.autobase=path.slice(0,substitute*-1).join("/")+"/"};GENTICS.Aloha.setAutobase();GENTICS.Aloha.prototype.version="nightly";GENTICS.Aloha.prototype.editables=[];GENTICS.Aloha.prototype.activeEditable=null;GENTICS.Aloha.prototype.ready=false;GENTICS.Aloha.prototype.dictionaries={};GENTICS.Aloha.prototype.settings={};GENTICS.Aloha.prototype.OSName="Unknown";GENTICS.Aloha.prototype.readyCallbacks=[];GENTICS.Aloha.prototype.init=function(){if(jQuery.browser.webkit&&parseFloat(jQuery.browser.version)<532.5||jQuery.browser.mozilla&&parseFloat(jQuery.browser.version)<1.9||jQuery.browser.msie&&jQuery.browser.version<7||jQuery.browser.opera){alert("Sorry, your browser is not supported at the moment.");return}varthat=this;jQuery("html").mousedown(function(){if(that.activeEditable&&!that.isMessageVisible()){that.activeEditable.blur();that.FloatingMenu.setScope("GENTICS.Aloha.empty");that.activeEditable=null}});if(typeofthis.settings.base=="undefined"||!this.settings.base){this.settings.base=GENTICS.Aloha.autobase;if(typeofGENTICS_Aloha_base!="undefined"){this.settings.base=GENTICS_Aloha_base}}this.Log.init();if(!(this.settings.errorhandling==false)){window.onerror=function(msg,url,linenumber){GENTICS.Aloha.Log.error(GENTICS.Aloha,"Error message: "+msg+"\nURL: "+url+"\nLine Number: "+linenumber);returntrue}}if(navigator.appVersion.indexOf("Win")!=-1){this.OSName="Win"}if(navigator.appVersion.indexOf("Mac")!=-1){this.OSName="Mac"}if(navigator.appVersion.indexOf("X11")!=-1){this.OSName="Unix"}if(navigator.appVersion.indexOf("Linux")!=-1){this.OSName="Linux"}this.initI18n();this.PluginRegistry.init();this.RepositoryManager.init();this.Ribbon.init();this.FloatingMenu.init();Ext.MessageBox.buttonText.yes=GENTICS.Aloha.i18n(this,"yes");Ext.MessageBox.buttonText.no=GENTICS.Aloha.i18n(this,"no");Ext.MessageBox.buttonText.cancel=GENTICS.Aloha.i18n(this,"cancel");Ext.ux.AlohaAttributeField.prototype.listEmptyText=GENTICS.Aloha.i18n(GENTICS.Aloha,"repository.no_item_found");Ext.ux.AlohaAttributeField.prototype.loadingText=GENTICS.Aloha.i18n(GENTICS.Aloha,"repository.loading")+"...";this.ready=true;for(vari=0;i<this.editables.length;i++){if(!this.editables[i].ready){this.editables[i].init()}}GENTICS.Aloha.EventRegistry.trigger(newGENTICS.Aloha.Event("ready",GENTICS.Aloha,null))};GENTICS.Aloha.prototype.activateEditable=function(editable){for(vari=0;i<this.editables.length;i++){if(this.editables[i]!=editable&&this.editables[i].isActive){varoldActive=this.editables[i];this.editables[i].blur()}}this.activeEditable=editable};GENTICS.Aloha.prototype.getActiveEditable=function(){returnthis.activeEditable};GENTICS.Aloha.prototype.deactivateEditable=function(){if(typeofthis.activeEditable=="undefined"||this.activeEditable==null){return}this.activeEditable.blur();this.FloatingMenu.setScope("GENTICS.Aloha.empty");this.activeEditable=null};GENTICS.Aloha.prototype.getEditableById=function(id){for(vari=0;i<GENTICS.Aloha.editables.length;i++){if(GENTICS.Aloha.editables[i].getId()==id){returnGENTICS.Aloha.editables[i]}}returnnull};GENTICS.Aloha.prototype.log=function(level,component,message){GENTICS.Aloha.Log.log(level,component,message)};GENTICS.Aloha.prototype.identStr=function(object){if(objectinstanceofjQuery){object=object[0]}if(!(objectinstanceofHTMLElement)){GENTICS.Aloha.Log.warn(this,"{"+object.toString()+"} provided is not an HTML element");returnobject.toString()}varout=object.tagName.toLowerCase();if(object.id){returnout+"#"+object.id}if(object.className){returnout+"."+object.className}returnout};GENTICS.Aloha.prototype.trim=function(str){str=str.replace(/^\s+/,"");for(vari=str.length-1;i>=0;i--){if(/\S/.test(str.charAt(i))){str=str.substring(0,i+1);break}}returnstr};GENTICS.Aloha.prototype.initI18n=function(){
GENTICS.Aloha.PluginRegistry=function(){this.plugins=[]};GENTICS.Aloha.PluginRegistry.prototype.register=function(plugin){if(plugininstanceofGENTICS.Aloha.Plugin){this.plugins.push(plugin)}};GENTICS.Aloha.PluginRegistry.prototype.init=function(){for(vari=0;i<this.plugins.length;i++){varplugin=this.plugins[i];if(GENTICS.Aloha.settings.plugins==undefined){GENTICS.Aloha.settings.plugins={}}plugin.settings=GENTICS.Aloha.settings.plugins[plugin.prefix];if(plugin.settings==undefined){plugin.settings={}}if(plugin.settings.enabled==undefined){plugin.settings.enabled=true}varactualLanguage=plugin.languages?GENTICS.Aloha.getLanguage(GENTICS.Aloha.settings.i18n.current,plugin.languages):null;if(!actualLanguage){GENTICS.Aloha.Log.warn(this,"Could not determine actual language, no languages available for plugin "+plugin)}else{varfileUrl=GENTICS.Aloha.settings.base+"plugins/"+plugin.basePath+"/i18n/"+actualLanguage+".dict";GENTICS.Aloha.loadI18nFile(fileUrl,plugin)}if(plugin.settings.enabled==true){this.plugins[i].init()}}};GENTICS.Aloha.PluginRegistry.prototype.makeClean=function(obj){for(vari=0;i<this.plugins.length;i++){varplugin=this.plugins[i];if(GENTICS.Aloha.Log.isDebugEnabled()){GENTICS.Aloha.Log.debug(this,"Passing contents of HTML Element with id { "+obj.attr("id")+" } for cleaning to plugin { "+plugin.prefix+" }")}plugin.makeClean(obj)}};GENTICS.Aloha.PluginRegistry=newGENTICS.Aloha.PluginRegistry();GENTICS.Aloha.PluginRegistry.toString=function(){return"com.gentics.aloha.PluginRegistry"};GENTICS.Aloha.Plugin=function(pluginPrefix,basePath){this.prefix=pluginPrefix;this.basePath=basePath?basePath:pluginPrefix;GENTICS.Aloha.PluginRegistry.register(this)};GENTICS.Aloha.Plugin.prototype.settings=null;GENTICS.Aloha.Plugin.prototype.init=function(){};GENTICS.Aloha.Plugin.prototype.getEditableConfig=function(obj){varconfig=[];varconfigSpecified=false;if(this.settings.editables){jQuery.each(this.settings.editables,function(selector,selectorConfig){if(obj.is(selector)){configSpecified=true;config=jQuery.merge(config,selectorConfig)}})}if(!configSpecified){if(typeofthis.settings.config=="undefined"||!this.settings.config){config=this.config}else{config=this.settings.config}}returnconfig};GENTICS.Aloha.Plugin.prototype.makeClean=function(obj){};GENTICS.Aloha.Plugin.prototype.getUID=function(id){returnthis.prefix+"."+id};GENTICS.Aloha.Plugin.prototype.i18n=function(key,replacements){returnGENTICS.Aloha.i18n(this,key,replacements)};GENTICS.Aloha.Plugin.prototype.toString=function(){returnthis.prefix};GENTICS.Aloha.Plugin.prototype.log=function(level,message){GENTICS.Aloha.Log.log(level,this,message)};
jQuery.fn.zap=function(){returnthis.each(function(){jQuery(this.childNodes).insertBefore(this)}).remove()};jQuery.fn.textNodes=function(excludeBreaks,includeEmptyTextNodes){varret=[];(function(el){if((el.nodeType==3&&jQuery.trim(el.data)!=""&&!includeEmptyTextNodes)||(el.nodeType==3&&includeEmptyTextNodes)||(el.nodeName=="BR"&&!excludeBreaks)){ret.push(el)}else{for(vari=0;i<el.childNodes.length;++i){arguments.callee(el.childNodes[i])}}})(this[0]);returnjQuery(ret)};GENTICS.Aloha.Selection=function(){this.rangeObject={};this.tagHierarchy={textNode:[],abbr:["textNode"],b:["textNode","b","i","em","sup","sub","br","span","img","a","del","ins","u","cite","q","code","abbr","strong"],pre:["textNode","b","i","em","sup","sub","br","span","img","a","del","ins","u","cite","q","code","abbr","code"],blockquote:["textNode","b","i","em","sup","sub","br","span","img","a","del","ins","u","cite","q","code","abbr","p","h1","h2","h3","h4","h5","h6"],ins:["textNode","b","i","em","sup","sub","br","span","img","a","u","p","h1","h2","h3","h4","h5","h6"],ul:["li"],ol:["li"],li:["textNode","b","i","em","sup","sub","br","span","img","ul","ol","h1","h2","h3","h4","h5","h6","del","ins","u"],tr:["td","th"],table:["tr"],div:["textNode","b","i","em","sup","sub","br","span","img","ul","ol","table","h1","h2","h3","h4","h5","h6","del","ins","u","p","div","pre","blockquote"],h1:["textNode","b","i","em","sup","sub","br","span","img","a","del","ins","u"]};this.tagHierarchy={textNode:this.tagHierarchy.textNode,abbr:this.tagHierarchy.abbr,br:this.tagHierarchy.textNode,img:this.tagHierarchy.textNode,b:this.tagHierarchy.b,strong:this.tagHierarchy.b,code:this.tagHierarchy.b,q:this.tagHierarchy.b,blockquote:this.tagHierarchy.blockquote,cite:this.tagHierarchy.b,i:this.tagHierarchy.b,em:this.tagHierarchy.b,sup:this.tagHierarchy.b,sub:this.tagHierarchy.b,span:this.tagHierarchy.b,del:this.tagHierarchy.del,ins:this.tagHierarchy.ins,u:this.tagHierarchy.b,p:this.tagHierarchy.b,pre:this.tagHierarchy.pre,a:this.tagHierarchy.b,ul:this.tagHierarchy.ul,ol:this.tagHierarchy.ol,li:this.tagHierarchy.li,td:this.tagHierarchy.li,div:this.tagHierarchy.div,h1:this.tagHierarchy.h1,h2:this.tagHierarchy.h1,h3:this.tagHierarchy.h1,h4:this.tagHierarchy.h1,h5:this.tagHierarchy.h1,h6:this.tagHierarchy.h1,table:this.tagHierarchy.table};this.replacingElements={h1:["p","h1","h2","h3","h4","h5","h6","pre"],blockquote:["blockquote"]};this.replacingElements={h1:this.replacingElements.h1,h2:this.replacingElements.h1,h3:this.replacingElements.h1,h4:this.replacingElements.h1,h5:this.replacingElements.h1,h6:this.replacingElements.h1,pre:this.replacingElements.h1,p:this.replacingElements.h1,blockquote:this.replacingElements.blockquote};this.allowedToStealElements={h1:["textNode"]};this.allowedToStealElements={h1:this.allowedToStealElements.h1,h2:this.allowedToStealElements.h1,h3:this.allowedToStealElements.h1,h4:this.allowedToStealElements.h1,h5:this.allowedToStealElements.h1,h6:this.allowedToStealElements.h1,p:this.tagHierarchy.b}};GENTICS.Aloha.Selection.prototype.SelectionTree=function(){this.domobj={};this.selection;this.children=[]};GENTICS.Aloha.Selection.prototype.onChange=function(objectClicked,event){if(this.updateSelectionTimeout){window.clearTimeout(this.updateSelectionTimeout);this.updateSelectionTimeout=undefined}this.updateSelectionTimeout=window.setTimeout(function(){GENTICS.Aloha.Selection.updateSelection(event)},5)};GENTICS.Aloha.Selection.prototype.updateSelection=function(event){varrangeObject=this.rangeObject=newGENTICS.Aloha.Selection.SelectionRange(true);rangeObject.update();GENTICS.Aloha.FloatingMenu.setScope("GENTICS.Aloha.continuoustext");GENTICS.Aloha.EventRegistry.trigger(newGENTICS.Aloha.Event("selectionChanged",GENTICS.Aloha,[rangeObject,event]));returntrue};GENTICS.Aloha.Selection.prototype.getSelectionTree=function(rangeObject){if(!rangeObject){returnthis.rangeObject.getSelectionTree()}if(!rangeObject.commonAncestorContainer){GENTICS.Aloha.Log.error(this,"the rangeObject is missing the commonAncestorContainer");returnfalse}this.inselection=false;if(GENTICS.Uti
GENTICS.Aloha.RepositoryManager=function(){this.repositories=[]};GENTICS.Aloha.RepositoryManager.prototype.openCallbacks=[];GENTICS.Aloha.RepositoryManager.prototype.init=function(){if(GENTICS.Aloha.settings.repositories==undefined){GENTICS.Aloha.settings.repositories={}}for(vari=0;i<this.repositories.length;i++){varrepository=this.repositories[i];if(repository.settings==undefined){repository.settings={}}if(GENTICS.Aloha.settings.repositories[repository.repositoryId]){jQuery.extend(repository.settings,GENTICS.Aloha.settings.repositories[repository.repositoryId])}repository.init()}};GENTICS.Aloha.RepositoryManager.prototype.register=function(repository){if(repositoryinstanceofGENTICS.Aloha.Repository){if(!this.getRepository(repository.repositoryId)){this.repositories.push(repository)}else{GENTICS.Aloha.Log.warn(this,"A repository with name { "+repository.repositoryId+" } already registerd. Ignoring this.")}}else{GENTICS.Aloha.Log.error(this,"Trying to register a repository which is not an instance of GENTICS.Aloha.Repository.")}};GENTICS.Aloha.RepositoryManager.prototype.getRepository=function(repositoryId){for(vari=0;i<this.repositories.length;i++){if(this.repositories[i].repositoryId==repositoryId){returnthis.repositories[i]}}returnnull};GENTICS.Aloha.RepositoryManager.prototype.query=function(params,callback){varthat=this;varallitems=[];varrepositories=[];this.openCallbacks=[];vartimer=setTimeout(function(){that.openCallbacks=[];that.queryCallback(callback,allitems,timer)},5000);if(params.repositoryId){repositories.push(this.getRepository(params.repositoryId))}else{repositories=this.repositories}for(vari=0;i<repositories.length;i++){this.openCallbacks.push(repositories[i].repositoryId);try{varnotImplemented=repositories[i].query(params,function(items){varid=that.openCallbacks.indexOf(this.repositoryId);if(id!=-1){that.openCallbacks.splice(id,1)}if(!items.length==0&&!items[0].repositoryId){for(varj=0;j<items.length;j++){items[j].repositoryId=this.repositoryId}}jQuery.merge(allitems,items);that.queryCallback(callback,allitems,timer)})}catch(e){notImplemented=true}if(notImplemented){varid=that.openCallbacks.indexOf(repositories[i].repositoryId);if(id!=-1){this.openCallbacks.splice(id,1);if(i==repositories.length-1){this.queryCallback(callback,allitems,timer)}}}}};GENTICS.Aloha.RepositoryManager.prototype.queryCallback=function(cb,items,timer){if(this.openCallbacks.length==0){clearTimeout(timer);items.sort(function(a,b){returnb.weight-a.weight});varresult={results:items.length,items:items};cb.call(this,result)}};GENTICS.Aloha.RepositoryManager.prototype.getChildren=function(params,callback){varthat=this;varallitems=[];varrepositories=[];this.openChildrenCallbacks=[];if(params.inFolderId=="aloha"&&this.repositories.length>0){varrepos=[];for(vari=0;i<this.repositories.length;i++){repos.push(newGENTICS.Aloha.Repository.Folder({id:this.repositories[i].repositoryId,name:this.repositories[i].repositoryName,repositoryId:this.repositories[i].repositoryId,type:"repository",hasMoreItems:true}))}that.getChildrenCallback(callback,repos,null);return}vartimer=setTimeout(function(){that.openChildrenCallbacks=[];that.getChildrenCallback(callback,allitems,timer)},5000);if(params.repositoryId){repositories.push(this.getRepository(params.repositoryId))}else{repositories=this.repositories}for(vari=0;i<repositories.length;i++){this.openChildrenCallbacks.push(repositories[i].repositoryId);try{varnotImplemented=repositories[i].getChildren(params,function(items){varid=that.openChildrenCallbacks.indexOf(this.repositoryId);if(id!=-1){that.openChildrenCallbacks.splice(id,1)}jQuery.merge(allitems,items);that.getChildrenCallback(callback,allitems,timer)})}catch(e){notImplemented=true}if(notImplemented){varid=that.openChildrenCallbacks.indexOf(repositories[i].repositoryId);if(id!=-1){this.openChildrenCallbacks.splice(id,1);if(i==repositories.length-1){this.getChildrenCallback(callback,allitems,timer)}}}}};GENTICS.Aloha.RepositoryManager.prototype.getChildrenCallback=function(cb,items,timer){if(this.openChildrenCallbacks.le