/*
-
Aloha Editor
-
Author & Copyright © 2010 Gentics Software GmbH
-
aloha-sales@gentics.com
-
Licensed unter the terms of www.aloha-editor.com/license.html
*/ if(!GENTICS.Aloha.Repositories){GENTICS.Aloha.Repositories={}}GENTICS.Aloha.Repositories.LinkList=new GENTICS.Aloha.Repository(“com.gentics.aloha.repositories.LinkList”);GENTICS.Aloha.Repositories.LinkList.settings.data=[{name:“Aloha Editor - The HTML5 Editor”,url:“aloha-editor.com”,type:“website”},{name:“Aloha Logo”,url:“www.aloha-editor.com/images/aloha-editor-logo.png”,type:“image”}];GENTICS.Aloha.Repositories.LinkList.folder=[];GENTICS.Aloha.Repositories.LinkList.init=function(){for(var i=0;i<this.settings.data.length;i++){var e=this.settings.data;e.repositoryId=this.repositoryId;e.id=e.id?e.id:e.url;var u=e.uri=this.parseUri(e.url);var path=this.addFolder(“”,u.host);var pathparts=u.path.split(“/”);for(j=0;j<pathparts.length;j++){if(pathparts&&pathparts.lastIndexOf(“.”)<0){path=this.addFolder(path,pathparts)}}e.parentId=path;this.settings.data=new GENTICS.Aloha.Repository.Document(e)}this.repositoryName=“Linklist”};GENTICS.Aloha.Repositories.LinkList.addFolder=function(path,name){var type=path?“folder”:“hostname”;var p=path?path+“/”+name:name;if(name&&!this.folder){this.folder=new GENTICS.Aloha.Repository.Folder({id:p,name:(name)?name:p,parentId:path,type:“host”,repositoryId:this.repositoryId})}return p};GENTICS.Aloha.Repositories.LinkList.query=function(p,callback){var d=this.settings.data.filter(function(e,i,a){var r=new RegExp(p.queryString,“i”);var ret=false;return((!p.queryString||e.name.match®||e.url.match®)&&(!p.objectTypeFilter||jQuery.inArray(e.type,p.objectTypeFilter)>-1)&&(!p.inFolderId||p.inFolderId==e.parentId))});callback.call(this,d)};GENTICS.Aloha.Repositories.LinkList.getChildren=function(p,callback){var d=[];for(e in this.folder){var l=this.folder.parentId;if(typeof this.folder!=“function”&&(this.folder.parentId==p.inFolderId||(!this.folder.parentId&&p.inFolderId==this.repositoryId))){d.push(this.folder)}}callback.call(this,d)};GENTICS.Aloha.Repositories.LinkList.parseUri=function(str){var o={strictMode:false,key:,q:{name:“queryKey”,parser:/(?:^|&)(*)=?([^&]*)/g},parser:{strict:/^(?:(+):)?(?://((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(d*))?))?((((?:[^?#/]/))([^?#]*))(?:?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?!+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(d*))?)(((/(?:[^?#](?![^?#/]*.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:?([^#]*))?(?:#(.*))?)/}},m=o.parser.exec(str),uri={},i=14;while(i–){uri[o.key]=m||“”}uri={};uri[o.key].replace(o.q.parser,function($0,$1,$2){if($1){uri[$1]=$2}});return uri};