new static files.
Signed-off-by: rscnt <rascnt@gmail.com>
							
								
								
									
										159
									
								
								static/cms/js/jstree/_lib/_all.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,159 @@
 | 
			
		|||
// all, but without jquery !! (modified by Peter Cicman)
 | 
			
		||||
 | 
			
		||||
// css.js
 | 
			
		||||
 | 
			
		||||
function get_css(rule_name,stylesheet,delete_flag){if(!document.styleSheets)return false;rule_name=rule_name.toLowerCase();stylesheet=stylesheet||0;for(var i=stylesheet;i<document.styleSheets.length;i++){var styleSheet=document.styleSheets[i];css_rules=document.styleSheets[i].cssRules||document.styleSheets[i].rules;if(!css_rules)continue;var j=0;do{if(css_rules[j].selectorText.toLowerCase()==rule_name){if(delete_flag==true){if(document.styleSheets[i].removeRule)document.styleSheets[i].removeRule(j);if(document.styleSheets[i].deleteRule)document.styleSheets[i].deleteRule(j);return true;}
 | 
			
		||||
else return css_rules[j];}}
 | 
			
		||||
while(css_rules[++j]);}
 | 
			
		||||
return false;}
 | 
			
		||||
function add_css(rule_name,stylesheet){rule_name=rule_name.toLowerCase();stylesheet=stylesheet||0;if(!document.styleSheets||get_css(rule_name,stylesheet))return false;(document.styleSheets[stylesheet].addRule)?document.styleSheets[stylesheet].addRule(rule_name,null,0):document.styleSheets[stylesheet].insertRule(rule_name+' { }',0);return get_css(rule_name);}
 | 
			
		||||
function get_sheet_num(href_name){if(!document.styleSheets)return false;for(var i=0;i<document.styleSheets.length;i++){if(document.styleSheets[i].href&&document.styleSheets[i].href.toString().match(href_name))return i;}
 | 
			
		||||
return false;}
 | 
			
		||||
function remove_css(rule_name,stylesheet){return get_css(rule_name,stylesheet,true);}
 | 
			
		||||
function add_sheet(url){if(document.createStyleSheet){document.createStyleSheet(url);}
 | 
			
		||||
else{var styles="@import url(' "+url+" ');";var newSS=document.createElement('link');newSS.rel='stylesheet';newSS.href='data:text/css,'+escape(styles);document.getElementsByTagName("head")[0].appendChild(newSS);}}
 | 
			
		||||
 | 
			
		||||
// jquery.listen.js
 | 
			
		||||
;(function($){var a='indexer',h=$.event,j=h.special,k=$.listen=function(c,d,e,f){if(typeof d!='object'){f=e;e=d;d=document}o(c.split(/\s+/),function(a){a=k.fixes[a]||a;var b=m(d,a)||m(d,a,new n(a,d));b.append(e,f);b.start()})},m=function(b,c,d){return $.data(b,c+'.'+a,d)};$.fn[a]=function(a){return this[0]&&m(this[0],a)||null};$[a]=function(a){return m(document,a)};$.extend(k,{regex:/^((?:\w*?|\*))(?:([#.])([\w-]+))?$/,fixes:{focus:'focusin',blur:'focusout'},cache:function(a){this.caching=a}});$.each(k.fixes,function(a,b){j[b]={setup:function(){if($.browser.msie)return!1;this.addEventListener(a,j[b].handler,!0)},teardown:function(){if($.browser.msie)return!1;this.removeEventListener(a,j[b].handler,!0)},handler:function(e){arguments[0]=e=h.fix(e);e.type=b;return h.handle.apply(this,arguments)}}});$.fn.listen=function(a,b,c){return this.each(function(){k(a,this,b,c)})};function n(a,b){$.extend(this,{ids:{},tags:{},listener:b,event:a});this.id=n.instances.push(this)};n.instances=[];n.prototype={constructor:n,handle:function(e){var a=e.stopPropagation;e.stopPropagation=function(){e.stopped=1;a.apply(this,arguments)};m(this,e.type).parse(e);e.stopPropagation=a;a=e.data=null},on:0,bubbles:0,start:function(){var a=this;if(!a.on){h.add(a.listener,a.event,a.handle);a.on=1}},stop:function(){var a=this;if(a.on){h.remove(a.listener,a.event,a.handle);a.on=0}},cache:function(a,b){return $.data(a,'listenCache_'+this.id,b)},parse:function(e){var z=this,c=e.data||e.target,d=arguments,f;if(!k.caching||!(f=z.cache(c))){f=[];if(c.id&&z.ids[c.id])p(f,z.ids[c.id]);o([c.nodeName,'*'],function(a){var b=z.tags[a];if(b)o((c.className+' *').split(' '),function(a){if(a&&b[a])p(f,b[a])})});if(k.caching)z.cache(c,f)}if(f[0]){o(f,function(a){if(a.apply(c,d)===!1){e.preventDefault();e.stopPropagation()}})}if(!e.stopped&&(c=c.parentNode)&&(c.nodeName=='A'||z.bubbles&&c!=z.listener)){e.data=c;z.parse(e)}f=d=c=null},append:function(f,g){var z=this;o(f.split(/\s*,\s*/),function(a){var b=k.regex.exec(a);if(!b)throw'$.listen > "'+a+'" is not a supported selector.';var c=b[2]=='#'&&b[3],d=b[1].toUpperCase()||'*',e=b[3]||'*';if(c)(z.ids[c]||(z.ids[c]=[])).push(g);else if(d){d=z.tags[d]=z.tags[d]||{};(d[e]||(d[e]=[])).push(g)}})}};function o(a,b,c){for(var i=0,l=a.length;i<l;i++)b.call(c,a[i],i)};function p(a,b){a.push.apply(a,b);return a};$(window).unload(function(){if(typeof n=='function')o(n.instances,function(b){b.stop();$.removeData(b.listener,b.event+'.'+a);b.ids=b.names=b.listener=null})})})(jQuery);
 | 
			
		||||
 | 
			
		||||
// sarissa.js
 | 
			
		||||
 | 
			
		||||
function Sarissa(){}
 | 
			
		||||
Sarissa.VERSION="0.9.9.4";Sarissa.PARSED_OK="Document contains no parsing errors";Sarissa.PARSED_EMPTY="Document is empty";Sarissa.PARSED_UNKNOWN_ERROR="Not well-formed or other error";Sarissa.IS_ENABLED_TRANSFORM_NODE=false;Sarissa.REMOTE_CALL_FLAG="gr.abiss.sarissa.REMOTE_CALL_FLAG";Sarissa._lastUniqueSuffix=0;Sarissa._getUniqueSuffix=function(){return Sarissa._lastUniqueSuffix++;};Sarissa._SARISSA_IEPREFIX4XSLPARAM="";Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION=document.implementation&&true;Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT=Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.createDocument;Sarissa._SARISSA_HAS_DOM_FEATURE=Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.hasFeature;Sarissa._SARISSA_IS_MOZ=Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT&&Sarissa._SARISSA_HAS_DOM_FEATURE;Sarissa._SARISSA_IS_SAFARI=navigator.userAgent.toLowerCase().indexOf("safari")!=-1||navigator.userAgent.toLowerCase().indexOf("konqueror")!=-1;Sarissa._SARISSA_IS_SAFARI_OLD=Sarissa._SARISSA_IS_SAFARI&&(parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1],10)<420);Sarissa._SARISSA_IS_IE=document.all&&window.ActiveXObject&&navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1;Sarissa._SARISSA_IS_OPERA=navigator.userAgent.toLowerCase().indexOf("opera")!=-1;if(!window.Node||!Node.ELEMENT_NODE){Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};}
 | 
			
		||||
if(Sarissa._SARISSA_IS_SAFARI_OLD){HTMLHtmlElement=document.createElement("html").constructor;Node=HTMLElement={};HTMLElement.prototype=HTMLHtmlElement.__proto__.__proto__;HTMLDocument=Document=document.constructor;var x=new DOMParser();XMLDocument=x.constructor;Element=x.parseFromString("<Single />","text/xml").documentElement.constructor;x=null;}
 | 
			
		||||
if(typeof XMLDocument=="undefined"&&typeof Document!="undefined"){XMLDocument=Document;}
 | 
			
		||||
if(Sarissa._SARISSA_IS_IE){Sarissa._SARISSA_IEPREFIX4XSLPARAM="xsl:";var _SARISSA_DOM_PROGID="";var _SARISSA_XMLHTTP_PROGID="";var _SARISSA_DOM_XMLWRITER="";Sarissa.pickRecentProgID=function(idList){var bFound=false,e;var o2Store;for(var i=0;i<idList.length&&!bFound;i++){try{var oDoc=new ActiveXObject(idList[i]);o2Store=idList[i];bFound=true;}catch(objException){e=objException;}}
 | 
			
		||||
if(!bFound){throw"Could not retrieve a valid progID of Class: "+idList[idList.length-1]+". (original exception: "+e+")";}
 | 
			
		||||
idList=null;return o2Store;};_SARISSA_DOM_PROGID=null;_SARISSA_THREADEDDOM_PROGID=null;_SARISSA_XSLTEMPLATE_PROGID=null;_SARISSA_XMLHTTP_PROGID=null;XMLHttpRequest=function(){if(!_SARISSA_XMLHTTP_PROGID){_SARISSA_XMLHTTP_PROGID=Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"]);}
 | 
			
		||||
return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);};Sarissa.getDomDocument=function(sUri,sName){if(!_SARISSA_DOM_PROGID){_SARISSA_DOM_PROGID=Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"]);}
 | 
			
		||||
var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);if(sName){var prefix="";if(sUri){if(sName.indexOf(":")>1){prefix=sName.substring(0,sName.indexOf(":"));sName=sName.substring(sName.indexOf(":")+1);}else{prefix="a"+Sarissa._getUniqueSuffix();}}
 | 
			
		||||
if(sUri){oDoc.loadXML('<'+prefix+':'+sName+" xmlns:"+prefix+"=\""+sUri+"\""+" />");}else{oDoc.loadXML('<'+sName+" />");}}
 | 
			
		||||
return oDoc;};Sarissa.getParseErrorText=function(oDoc){var parseErrorText=Sarissa.PARSED_OK;if(oDoc&&oDoc.parseError&&oDoc.parseError.errorCode&&oDoc.parseError.errorCode!=0){parseErrorText="XML Parsing Error: "+oDoc.parseError.reason+"\nLocation: "+oDoc.parseError.url+"\nLine Number "+oDoc.parseError.line+", Column "+
 | 
			
		||||
oDoc.parseError.linepos+":\n"+oDoc.parseError.srcText+"\n";for(var i=0;i<oDoc.parseError.linepos;i++){parseErrorText+="-";}
 | 
			
		||||
parseErrorText+="^\n";}
 | 
			
		||||
else if(oDoc.documentElement===null){parseErrorText=Sarissa.PARSED_EMPTY;}
 | 
			
		||||
return parseErrorText;};Sarissa.setXpathNamespaces=function(oDoc,sNsSet){oDoc.setProperty("SelectionLanguage","XPath");oDoc.setProperty("SelectionNamespaces",sNsSet);};XSLTProcessor=function(){if(!_SARISSA_XSLTEMPLATE_PROGID){_SARISSA_XSLTEMPLATE_PROGID=Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0","MSXML2.XSLTemplate.3.0"]);}
 | 
			
		||||
this.template=new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);this.processor=null;};XSLTProcessor.prototype.importStylesheet=function(xslDoc){if(!_SARISSA_THREADEDDOM_PROGID){_SARISSA_THREADEDDOM_PROGID=Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0","MSXML2.FreeThreadedDOMDocument.3.0"]);}
 | 
			
		||||
xslDoc.setProperty("SelectionLanguage","XPath");xslDoc.setProperty("SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");var converted=new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);try{converted.resolveExternals=true;converted.setProperty("AllowDocumentFunction",true);}
 | 
			
		||||
catch(e){}
 | 
			
		||||
if(xslDoc.url&&xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']")!=null){converted.async=false;converted.load(xslDoc.url);}
 | 
			
		||||
else{converted.loadXML(xslDoc.xml);}
 | 
			
		||||
converted.setProperty("SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");var output=converted.selectSingleNode("//xsl:output");if(output){this.outputMethod=output.getAttribute("method");}
 | 
			
		||||
else{delete this.outputMethod;}
 | 
			
		||||
this.template.stylesheet=converted;this.processor=this.template.createProcessor();this.paramsSet=[];};XSLTProcessor.prototype.transformToDocument=function(sourceDoc){var outDoc;if(_SARISSA_THREADEDDOM_PROGID){this.processor.input=sourceDoc;outDoc=new ActiveXObject(_SARISSA_DOM_PROGID);this.processor.output=outDoc;this.processor.transform();return outDoc;}
 | 
			
		||||
else{if(!_SARISSA_DOM_XMLWRITER){_SARISSA_DOM_XMLWRITER=Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0","Msxml2.MXXMLWriter.3.0","MSXML2.MXXMLWriter","MSXML.MXXMLWriter","Microsoft.XMLDOM"]);}
 | 
			
		||||
this.processor.input=sourceDoc;outDoc=new ActiveXObject(_SARISSA_DOM_XMLWRITER);this.processor.output=outDoc;this.processor.transform();var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);oDoc.loadXML(outDoc.output+"");return oDoc;}};XSLTProcessor.prototype.transformToFragment=function(sourceDoc,ownerDoc){this.processor.input=sourceDoc;this.processor.transform();var s=this.processor.output;var f=ownerDoc.createDocumentFragment();var container;if(this.outputMethod=='text'){f.appendChild(ownerDoc.createTextNode(s));}else if(ownerDoc.body&&ownerDoc.body.innerHTML){container=ownerDoc.createElement('div');container.innerHTML=s;while(container.hasChildNodes()){f.appendChild(container.firstChild);}}
 | 
			
		||||
else{var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);if(s.substring(0,5)=='<?xml'){s=s.substring(s.indexOf('?>')+2);}
 | 
			
		||||
var xml=''.concat('<my>',s,'</my>');oDoc.loadXML(xml);container=oDoc.documentElement;while(container.hasChildNodes()){f.appendChild(container.firstChild);}}
 | 
			
		||||
return f;};XSLTProcessor.prototype.setParameter=function(nsURI,name,value){value=value?value:"";if(nsURI){this.processor.addParameter(name,value,nsURI);}else{this.processor.addParameter(name,value);}
 | 
			
		||||
nsURI=""+(nsURI||"");if(!this.paramsSet[nsURI]){this.paramsSet[nsURI]=[];}
 | 
			
		||||
this.paramsSet[nsURI][name]=value;};XSLTProcessor.prototype.getParameter=function(nsURI,name){nsURI=""+(nsURI||"");if(this.paramsSet[nsURI]&&this.paramsSet[nsURI][name]){return this.paramsSet[nsURI][name];}else{return null;}};XSLTProcessor.prototype.clearParameters=function(){for(var nsURI in this.paramsSet){for(var name in this.paramsSet[nsURI]){if(nsURI!=""){this.processor.addParameter(name,"",nsURI);}else{this.processor.addParameter(name,"");}}}
 | 
			
		||||
this.paramsSet=[];};}else{if(Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT){Sarissa.__handleLoad__=function(oDoc){Sarissa.__setReadyState__(oDoc,4);};_sarissa_XMLDocument_onload=function(){Sarissa.__handleLoad__(this);};Sarissa.__setReadyState__=function(oDoc,iReadyState){oDoc.readyState=iReadyState;oDoc.readystate=iReadyState;if(oDoc.onreadystatechange!=null&&typeof oDoc.onreadystatechange=="function"){oDoc.onreadystatechange();}};Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);if(!oDoc.onreadystatechange){oDoc.onreadystatechange=null;}
 | 
			
		||||
if(!oDoc.readyState){oDoc.readyState=0;}
 | 
			
		||||
oDoc.addEventListener("load",_sarissa_XMLDocument_onload,false);return oDoc;};if(window.XMLDocument){}
 | 
			
		||||
else if(Sarissa._SARISSA_HAS_DOM_FEATURE&&window.Document&&!Document.prototype.load&&document.implementation.hasFeature('LS','3.0')){Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);return oDoc;};}
 | 
			
		||||
else{Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);if(oDoc&&(sUri||sName)&&!oDoc.documentElement){oDoc.appendChild(oDoc.createElementNS(sUri,sName));}
 | 
			
		||||
return oDoc;};}}}
 | 
			
		||||
if(!window.DOMParser){if(Sarissa._SARISSA_IS_SAFARI){DOMParser=function(){};DOMParser.prototype.parseFromString=function(sXml,contentType){var xmlhttp=new XMLHttpRequest();xmlhttp.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(sXml),false);xmlhttp.send(null);return xmlhttp.responseXML;};}else if(Sarissa.getDomDocument&&Sarissa.getDomDocument()&&Sarissa.getDomDocument(null,"bar").xml){DOMParser=function(){};DOMParser.prototype.parseFromString=function(sXml,contentType){var doc=Sarissa.getDomDocument();doc.loadXML(sXml);return doc;};}}
 | 
			
		||||
if((typeof(document.importNode)=="undefined")&&Sarissa._SARISSA_IS_IE){try{document.importNode=function(oNode,bChildren){var tmp;if(oNode.nodeName=='#text'){return document.createTextNode(oNode.data);}
 | 
			
		||||
else{if(oNode.nodeName=="tbody"||oNode.nodeName=="tr"){tmp=document.createElement("table");}
 | 
			
		||||
else if(oNode.nodeName=="td"){tmp=document.createElement("tr");}
 | 
			
		||||
else if(oNode.nodeName=="option"){tmp=document.createElement("select");}
 | 
			
		||||
else{tmp=document.createElement("div");}
 | 
			
		||||
if(bChildren){tmp.innerHTML=oNode.xml?oNode.xml:oNode.outerHTML;}else{tmp.innerHTML=oNode.xml?oNode.cloneNode(false).xml:oNode.cloneNode(false).outerHTML;}
 | 
			
		||||
return tmp.getElementsByTagName("*")[0];}};}catch(e){}}
 | 
			
		||||
if(!Sarissa.getParseErrorText){Sarissa.getParseErrorText=function(oDoc){var parseErrorText=Sarissa.PARSED_OK;if((!oDoc)||(!oDoc.documentElement)){parseErrorText=Sarissa.PARSED_EMPTY;}else if(oDoc.documentElement.tagName=="parsererror"){parseErrorText=oDoc.documentElement.firstChild.data;parseErrorText+="\n"+oDoc.documentElement.firstChild.nextSibling.firstChild.data;}else if(oDoc.getElementsByTagName("parsererror").length>0){var parsererror=oDoc.getElementsByTagName("parsererror")[0];parseErrorText=Sarissa.getText(parsererror,true)+"\n";}else if(oDoc.parseError&&oDoc.parseError.errorCode!=0){parseErrorText=Sarissa.PARSED_UNKNOWN_ERROR;}
 | 
			
		||||
return parseErrorText;};}
 | 
			
		||||
Sarissa.getText=function(oNode,deep){var s="";var nodes=oNode.childNodes;for(var i=0;i<nodes.length;i++){var node=nodes[i];var nodeType=node.nodeType;if(nodeType==Node.TEXT_NODE||nodeType==Node.CDATA_SECTION_NODE){s+=node.data;}else if(deep===true&&(nodeType==Node.ELEMENT_NODE||nodeType==Node.DOCUMENT_NODE||nodeType==Node.DOCUMENT_FRAGMENT_NODE)){s+=Sarissa.getText(node,true);}}
 | 
			
		||||
return s;};if(!window.XMLSerializer&&Sarissa.getDomDocument&&Sarissa.getDomDocument("","foo",null).xml){XMLSerializer=function(){};XMLSerializer.prototype.serializeToString=function(oNode){return oNode.xml;};}
 | 
			
		||||
Sarissa.stripTags=function(s){return s?s.replace(/<[^>]+>/g,""):s;};Sarissa.clearChildNodes=function(oNode){while(oNode.firstChild){oNode.removeChild(oNode.firstChild);}};Sarissa.copyChildNodes=function(nodeFrom,nodeTo,bPreserveExisting){if(Sarissa._SARISSA_IS_SAFARI&&nodeTo.nodeType==Node.DOCUMENT_NODE){nodeTo=nodeTo.documentElement;}
 | 
			
		||||
if((!nodeFrom)||(!nodeTo)){throw"Both source and destination nodes must be provided";}
 | 
			
		||||
if(!bPreserveExisting){Sarissa.clearChildNodes(nodeTo);}
 | 
			
		||||
var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE?nodeTo:nodeTo.ownerDocument;var nodes=nodeFrom.childNodes;var i;if(typeof(ownerDoc.importNode)!="undefined"){for(i=0;i<nodes.length;i++){nodeTo.appendChild(ownerDoc.importNode(nodes[i],true));}}else{for(i=0;i<nodes.length;i++){nodeTo.appendChild(nodes[i].cloneNode(true));}}};Sarissa.moveChildNodes=function(nodeFrom,nodeTo,bPreserveExisting){if((!nodeFrom)||(!nodeTo)){throw"Both source and destination nodes must be provided";}
 | 
			
		||||
if(!bPreserveExisting){Sarissa.clearChildNodes(nodeTo);}
 | 
			
		||||
var nodes=nodeFrom.childNodes;if(nodeFrom.ownerDocument==nodeTo.ownerDocument){while(nodeFrom.firstChild){nodeTo.appendChild(nodeFrom.firstChild);}}else{var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE?nodeTo:nodeTo.ownerDocument;var i;if(typeof(ownerDoc.importNode)!="undefined"){for(i=0;i<nodes.length;i++){nodeTo.appendChild(ownerDoc.importNode(nodes[i],true));}}else{for(i=0;i<nodes.length;i++){nodeTo.appendChild(nodes[i].cloneNode(true));}}
 | 
			
		||||
Sarissa.clearChildNodes(nodeFrom);}};Sarissa.xmlize=function(anyObject,objectName,indentSpace){indentSpace=indentSpace?indentSpace:'';var s=indentSpace+'<'+objectName+'>';var isLeaf=false;if(!(anyObject instanceof Object)||anyObject instanceof Number||anyObject instanceof String||anyObject instanceof Boolean||anyObject instanceof Date){s+=Sarissa.escape(""+anyObject);isLeaf=true;}else{s+="\n";var isArrayItem=anyObject instanceof Array;for(var name in anyObject){s+=Sarissa.xmlize(anyObject[name],(isArrayItem?"array-item key=\""+name+"\"":name),indentSpace+"   ");}
 | 
			
		||||
s+=indentSpace;}
 | 
			
		||||
return(s+=(objectName.indexOf(' ')!=-1?"</array-item>\n":"</"+objectName+">\n"));};Sarissa.escape=function(sXml){return sXml.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");};Sarissa.unescape=function(sXml){return sXml.replace(/'/g,"'").replace(/"/g,"\"").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&");};Sarissa.updateCursor=function(oTargetElement,sValue){if(oTargetElement&&oTargetElement.style&&oTargetElement.style.cursor!=undefined){oTargetElement.style.cursor=sValue;}};Sarissa.updateContentFromURI=function(sFromUrl,oTargetElement,xsltproc,callback,skipCache){try{Sarissa.updateCursor(oTargetElement,"wait");var xmlhttp=new XMLHttpRequest();xmlhttp.open("GET",sFromUrl,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){try{var oDomDoc=xmlhttp.responseXML;if(oDomDoc&&Sarissa.getParseErrorText(oDomDoc)==Sarissa.PARSED_OK){Sarissa.updateContentFromNode(xmlhttp.responseXML,oTargetElement,xsltproc);if(callback){callback(sFromUrl,oTargetElement);}}
 | 
			
		||||
else{throw Sarissa.getParseErrorText(oDomDoc);}}
 | 
			
		||||
catch(e){if(callback){callback(sFromUrl,oTargetElement,e);}
 | 
			
		||||
else{throw e;}}}};if(skipCache){var oldage="Sat, 1 Jan 2000 00:00:00 GMT";xmlhttp.setRequestHeader("If-Modified-Since",oldage);}
 | 
			
		||||
xmlhttp.send("");}
 | 
			
		||||
catch(e){Sarissa.updateCursor(oTargetElement,"auto");if(callback){callback(sFromUrl,oTargetElement,e);}
 | 
			
		||||
else{throw e;}}};Sarissa.updateContentFromNode=function(oNode,oTargetElement,xsltproc){try{Sarissa.updateCursor(oTargetElement,"wait");Sarissa.clearChildNodes(oTargetElement);var ownerDoc=oNode.nodeType==Node.DOCUMENT_NODE?oNode:oNode.ownerDocument;if(ownerDoc.parseError&&ownerDoc.parseError.errorCode!=0){var pre=document.createElement("pre");pre.appendChild(document.createTextNode(Sarissa.getParseErrorText(ownerDoc)));oTargetElement.appendChild(pre);}
 | 
			
		||||
else{if(xsltproc){oNode=xsltproc.transformToDocument(oNode);}
 | 
			
		||||
if(oTargetElement.tagName.toLowerCase()=="textarea"||oTargetElement.tagName.toLowerCase()=="input"){oTargetElement.value=new XMLSerializer().serializeToString(oNode);}
 | 
			
		||||
else{try{oTargetElement.appendChild(oTargetElement.ownerDocument.importNode(oNode,true));}
 | 
			
		||||
catch(e){oTargetElement.innerHTML=new XMLSerializer().serializeToString(oNode);}}}}
 | 
			
		||||
catch(e){throw e;}
 | 
			
		||||
finally{Sarissa.updateCursor(oTargetElement,"auto");}};Sarissa.formToQueryString=function(oForm){var qs="";for(var i=0;i<oForm.elements.length;i++){var oField=oForm.elements[i];var sFieldName=oField.getAttribute("name")?oField.getAttribute("name"):oField.getAttribute("id");if(sFieldName&&((!oField.disabled)||oField.type=="hidden")){switch(oField.type){case"hidden":case"text":case"textarea":case"password":qs+=sFieldName+"="+encodeURIComponent(oField.value)+"&";break;case"select-one":qs+=sFieldName+"="+encodeURIComponent(oField.options[oField.selectedIndex].value)+"&";break;case"select-multiple":for(var j=0;j<oField.length;j++){var optElem=oField.options[j];if(optElem.selected===true){qs+=sFieldName+"[]"+"="+encodeURIComponent(optElem.value)+"&";}}
 | 
			
		||||
break;case"checkbox":case"radio":if(oField.checked){qs+=sFieldName+"="+encodeURIComponent(oField.value)+"&";}
 | 
			
		||||
break;}}}
 | 
			
		||||
return qs.substr(0,qs.length-1);};Sarissa.updateContentFromForm=function(oForm,oTargetElement,xsltproc,callback){try{Sarissa.updateCursor(oTargetElement,"wait");var params=Sarissa.formToQueryString(oForm)+"&"+Sarissa.REMOTE_CALL_FLAG+"=true";var xmlhttp=new XMLHttpRequest();var bUseGet=oForm.getAttribute("method")&&oForm.getAttribute("method").toLowerCase()=="get";if(bUseGet){xmlhttp.open("GET",oForm.getAttribute("action")+"?"+params,true);}
 | 
			
		||||
else{xmlhttp.open('POST',oForm.getAttribute("action"),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.setRequestHeader("Content-length",params.length);xmlhttp.setRequestHeader("Connection","close");}
 | 
			
		||||
xmlhttp.onreadystatechange=function(){try{if(xmlhttp.readyState==4){var oDomDoc=xmlhttp.responseXML;if(oDomDoc&&Sarissa.getParseErrorText(oDomDoc)==Sarissa.PARSED_OK){Sarissa.updateContentFromNode(xmlhttp.responseXML,oTargetElement,xsltproc);if(callback){callback(oForm,oTargetElement);}}
 | 
			
		||||
else{throw Sarissa.getParseErrorText(oDomDoc);}}}
 | 
			
		||||
catch(e){if(callback){callback(oForm,oTargetElement,e);}
 | 
			
		||||
else{throw e;}}};xmlhttp.send(bUseGet?"":params);}
 | 
			
		||||
catch(e){Sarissa.updateCursor(oTargetElement,"auto");if(callback){callback(oForm,oTargetElement,e);}
 | 
			
		||||
else{throw e;}}
 | 
			
		||||
return false;};Sarissa.FUNCTION_NAME_REGEXP=new RegExp("");Sarissa.getFunctionName=function(oFunc,bForce){var name;if(!name){if(bForce){name="SarissaAnonymous"+Sarissa._getUniqueSuffix();window[name]=oFunc;}
 | 
			
		||||
else{name=null;}}
 | 
			
		||||
if(name){window[name]=oFunc;}
 | 
			
		||||
return name;};Sarissa.setRemoteJsonCallback=function(url,callback,callbackParam){if(!callbackParam){callbackParam="callback";}
 | 
			
		||||
var callbackFunctionName=Sarissa.getFunctionName(callback,true);var id="sarissa_json_script_id_"+Sarissa._getUniqueSuffix();var oHead=document.getElementsByTagName("head")[0];var scriptTag=document.createElement('script');scriptTag.type='text/javascript';scriptTag.id=id;scriptTag.onload=function(){};if(url.indexOf("?")!=-1){url+=("&"+callbackParam+"="+callbackFunctionName);}
 | 
			
		||||
else{url+=("?"+callbackParam+"="+callbackFunctionName);}
 | 
			
		||||
scriptTag.src=url;oHead.appendChild(scriptTag);return id;};
 | 
			
		||||
 | 
			
		||||
// sarissa_ieemu_xpath.js
 | 
			
		||||
 | 
			
		||||
if(Sarissa._SARISSA_HAS_DOM_FEATURE&&document.implementation.hasFeature("XPath","3.0")){SarissaNodeList=function(i){this.length=i;};SarissaNodeList.prototype=[];SarissaNodeList.prototype.constructor=Array;SarissaNodeList.prototype.item=function(i){return(i<0||i>=this.length)?null:this[i];};SarissaNodeList.prototype.expr="";if(window.XMLDocument&&(!XMLDocument.prototype.setProperty)){XMLDocument.prototype.setProperty=function(x,y){};}
 | 
			
		||||
Sarissa.setXpathNamespaces=function(oDoc,sNsSet){oDoc._sarissa_useCustomResolver=true;var namespaces=sNsSet.indexOf(" ")>-1?sNsSet.split(" "):[sNsSet];oDoc._sarissa_xpathNamespaces=[];for(var i=0;i<namespaces.length;i++){var ns=namespaces[i];var colonPos=ns.indexOf(":");var assignPos=ns.indexOf("=");if(colonPos>0&&assignPos>colonPos+1){var prefix=ns.substring(colonPos+1,assignPos);var uri=ns.substring(assignPos+2,ns.length-1);oDoc._sarissa_xpathNamespaces[prefix]=uri;}else{throw"Bad format on namespace declaration(s) given";}}};XMLDocument.prototype._sarissa_useCustomResolver=false;XMLDocument.prototype._sarissa_xpathNamespaces=[];XMLDocument.prototype.selectNodes=function(sExpr,contextNode,returnSingle){var nsDoc=this;var nsresolver;if(this._sarissa_useCustomResolver){nsresolver=function(prefix){var s=nsDoc._sarissa_xpathNamespaces[prefix];if(s){return s;}
 | 
			
		||||
else{throw"No namespace URI found for prefix: '"+prefix+"'";}};}
 | 
			
		||||
else{nsresolver=this.createNSResolver(this.documentElement);}
 | 
			
		||||
var result=null;if(!returnSingle){var oResult=this.evaluate(sExpr,(contextNode?contextNode:this),nsresolver,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var nodeList=new SarissaNodeList(oResult.snapshotLength);nodeList.expr=sExpr;for(var i=0;i<nodeList.length;i++){nodeList[i]=oResult.snapshotItem(i);}
 | 
			
		||||
result=nodeList;}
 | 
			
		||||
else{result=this.evaluate(sExpr,(contextNode?contextNode:this),nsresolver,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}
 | 
			
		||||
return result;};Element.prototype.selectNodes=function(sExpr){var doc=this.ownerDocument;if(doc.selectNodes){return doc.selectNodes(sExpr,this);}
 | 
			
		||||
else{throw"Method selectNodes is only supported by XML Elements";}};XMLDocument.prototype.selectSingleNode=function(sExpr,contextNode){var ctx=contextNode?contextNode:null;return this.selectNodes(sExpr,ctx,true);};Element.prototype.selectSingleNode=function(sExpr){var doc=this.ownerDocument;if(doc.selectSingleNode){return doc.selectSingleNode(sExpr,this);}
 | 
			
		||||
else{throw"Method selectNodes is only supported by XML Elements";}};Sarissa.IS_ENABLED_SELECT_NODES=true;}
 | 
			
		||||
 | 
			
		||||
// jquery.xslt.js
 | 
			
		||||
 | 
			
		||||
var xslTransform={version:20071203,debug:false,init:function(){try{parseFloat(jQuery.fn.jquery)>=1;}catch(e){alert('xslTransform requires jQuery 1.0.4 or greater ... please load it prior to xslTransform');}
 | 
			
		||||
try{Sarissa;}catch(e){alert('Missing Sarissa ... please load it prior to xslTransform');}
 | 
			
		||||
if(!jQuery.log){jQuery.log=function(){};jQuery.fn.debug=function(){};}
 | 
			
		||||
if(this.debug)jQuery.log('xslTransform:init(): version '+xslTransform.version);},XMLSerializer:new XMLSerializer(),serialize:function(data){if(this.debug)jQuery.log('serialize(): received '+typeof(data));if(typeof(data)=='string'){return data;}
 | 
			
		||||
return this.XMLSerializer.serializeToString(data);},load:function(xml,meth){if(this.debug)jQuery.log('load(): received '+typeof(xml));var r;if(typeof(xml)=='object'){return xml;}
 | 
			
		||||
if(xml.substring(0,1)=='<'){r=this.loadString(xml);}else{r=this.loadFile(xml,meth);}
 | 
			
		||||
if(r){r.setProperty('SelectionNamespaces','xmlns:xsl="http://www.w3.org/1999/XSL/Transform"');r.setProperty('SelectionLanguage','XPath');return r;}else{if(this.debug)$.log('Unable to load '+xml);return false;}},loadString:function(str){if(this.debug)jQuery.log('loadString(): '+str+'::'+typeof(str));var p=new DOMParser();var xml=p.parseFromString(str,'text/xml');if(!xml){if(this.debug)jQuery.log('loadString(): parseFromString() failed');return false;}
 | 
			
		||||
return xml;},loadFile:function(url,meth){if(this.debug)jQuery.log('loadFile(): '+url+'::'+typeof(url));if(!url){if(this.debug)jQuery.log('ERROR: loadFile() missing url');return false;}
 | 
			
		||||
var doc;this.xhrsuccess=function(data,str){if(this.debug)jQuery.log('loadFile() completed successfully ('+str+')');doc=data;return true;};this.xhrerror=function(xhr,err){window.DEBUG=true;if(this.debug)jQuery.log('loadFile() failed to load the requested file: ('+err+') - xml: '+xhr.responseXML+' - text: '+xhr.responseText);doc=null;return false;};if(!meth)meth="GET";$.ajax({type:meth,url:url,async:false,success:this.xhrsuccess,error:this.xhrerror});if(!doc){if(this.debug)jQuery.log('ERROR: document '+url+' not found (404), or unable to load');return false;}
 | 
			
		||||
if(doc.length==0){if(this.debug)jQuery.log('ERROR: document '+url+' loaded in loadFile() has no data');return false;}
 | 
			
		||||
return doc;},transform:function(xsl,xml,options){var log={'xsl':xsl,'xml':xml,'options':options};if(this.debug)jQuery.log('transform(): '+xsl+'::'+xml+'::'+options.toString());options=options||{};var xml={'request':xml,'doc':this.load(xml,options.meth)};if(options.xpath&&xml.doc&&!jQuery.browser.msie){xml.doc=xml.doc.selectSingleNode(options.xpath.toString());if(this.debug)$.log('transform(): xpath has been run...resulting doc: '+(this.serialize(xml.doc)));}
 | 
			
		||||
var result={'xsl':this.load(xsl,options.meth)};result.json=false;if(options.json&&xml.doc){result.json=xml.doc.selectSingleNode(options.json.toString());}
 | 
			
		||||
var processor=new XSLTProcessor();processor.importStylesheet(result.xsl);if(options.params&&processor){if(this.debug)jQuery.log('transform(): received xsl params: '+options.params.toString());for(key in options.params){processor.setParameter(null,key.toString(),options.params[key].toString());}}
 | 
			
		||||
result.doc=processor.transformToDocument(xml.doc);var errorTxt=Sarissa.getParseErrorText(result.doc);if(this.debug)jQuery.log('transform(): Sarissa parse text: '+errorTxt);if(errorTxt!=Sarissa.PARSED_OK){result.string=Sarissa.getParseErrorText(result.doc)+' :: using '+xsl+' => '+xml.request;if(this.debug)jQuery.log('transform(): error in transformation: '+Sarissa.getParseErrorText(result.doc));return result;}
 | 
			
		||||
result.string=this.serialize(result.doc);result.scripts=jQuery('script',result.doc).text();return result;}};xslTransform.init();jQuery.fn.getTransform=function(xsl,xml,options){var settings={append:false,params:{},xpath:'',eval:true,callback:'',json:false,meth:"GET"};jQuery.extend(settings,options);if(xslTransform.debug)jQuery.log('getTransform: '+xsl+'::'+xml+'::'+settings.toString());if(!xsl||!xml){if(xslTransform.debug)jQuery.log('getTransform: missing xsl or xml');return;}
 | 
			
		||||
return this.each(function(){var trans=xslTransform.transform(xsl,xml,settings);var re=trans.string.match(/<\?xml.*?\?>/);if(re){trans.string=trans.string.replace(re,'');if(xslTransform.debug)jQuery.log('getTransform(): found an xml declaration and removed it');}
 | 
			
		||||
try{if(settings.append)$(this).append(trans.string);else if(settings.repl)$(this).replaceWith(trans.string);else $(this).html(trans.string);}catch(e){if(xslTransform.debug)$.log('getTransform: error placing results of transform into element, falling back to innerHTML: '+e.toString());$(this)[0].innerHTML=trans.string;}
 | 
			
		||||
if(settings.eval&&trans.scripts){if(trans.scripts.length>0){if(xslTransform.debug)jQuery.log('Found text/javascript in transformed result');eval.call(window,trans.scripts);}}
 | 
			
		||||
if(settings.callback&&jQuery.isFunction(settings.callback)){var json=false;if(settings.json&&trans.json)eval("json = "+trans.json.firstChild.data);settings.callback.apply(window,[trans.string,json]);}});};
 | 
			
		||||
 | 
			
		||||
// jquery.metadata.js
 | 
			
		||||
 | 
			
		||||
(function($){$.extend({metadata:{defaults:{type:'class',name:'metadata',cre:/({.*})/,single:'metadata'},setType:function(type,name){this.defaults.type=type;this.defaults.name=name;},get:function(elem,opts){var settings=$.extend({},this.defaults,opts);if(!settings.single.length)settings.single='metadata';var data=$.data(elem,settings.single);if(data)return data;data="{}";if(settings.type=="class"){var m=settings.cre.exec(elem.className);if(m)
 | 
			
		||||
data=m[1];}else if(settings.type=="elem"){if(!elem.getElementsByTagName)
 | 
			
		||||
return undefined;var e=elem.getElementsByTagName(settings.name);if(e.length)
 | 
			
		||||
data=$.trim(e[0].innerHTML);}else if(elem.getAttribute!=undefined){var attr=elem.getAttribute(settings.name);if(attr)
 | 
			
		||||
data=attr;}
 | 
			
		||||
if(data.indexOf('{')<0)
 | 
			
		||||
data="{"+data+"}";data=eval("("+data+")");$.data(elem,settings.single,data);return data;}}});$.fn.metadata=function(opts){return $.metadata.get(this[0],opts);};})(jQuery);
 | 
			
		||||
 | 
			
		||||
// jquery.cookie.js
 | 
			
		||||
 | 
			
		||||
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
 | 
			
		||||
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
 | 
			
		||||
expires='; expires='+date.toUTCString();}
 | 
			
		||||
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
 | 
			
		||||
return cookieValue;}};
 | 
			
		||||
							
								
								
									
										46
									
								
								static/cms/js/jstree/_lib/css.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,46 @@
 | 
			
		|||
function get_css(rule_name, stylesheet, delete_flag) {
 | 
			
		||||
	if (!document.styleSheets) return false;
 | 
			
		||||
	rule_name = rule_name.toLowerCase(); stylesheet = stylesheet || 0;
 | 
			
		||||
	for (var i = stylesheet; i < document.styleSheets.length; i++) { 
 | 
			
		||||
		var styleSheet = document.styleSheets[i]; css_rules = document.styleSheets[i].cssRules || document.styleSheets[i].rules;
 | 
			
		||||
		if(!css_rules) continue;
 | 
			
		||||
		var j = 0;
 | 
			
		||||
		do {
 | 
			
		||||
			if(css_rules[j].selectorText.toLowerCase() == rule_name) {
 | 
			
		||||
				if(delete_flag == true) {
 | 
			
		||||
					if(document.styleSheets[i].removeRule) document.styleSheets[i].removeRule(j);
 | 
			
		||||
					if(document.styleSheets[i].deleteRule) document.styleSheets[i].deleteRule(j);
 | 
			
		||||
					return true;
 | 
			
		||||
				}
 | 
			
		||||
				else return css_rules[j];
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		while (css_rules[++j]);
 | 
			
		||||
	}
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
function add_css(rule_name, stylesheet) {
 | 
			
		||||
	rule_name = rule_name.toLowerCase(); stylesheet = stylesheet || 0;
 | 
			
		||||
	if (!document.styleSheets || get_css(rule_name, stylesheet)) return false;
 | 
			
		||||
	(document.styleSheets[stylesheet].addRule) ? document.styleSheets[stylesheet].addRule(rule_name, null, 0) : document.styleSheets[stylesheet].insertRule(rule_name+' { }', 0);
 | 
			
		||||
	return get_css(rule_name);
 | 
			
		||||
}
 | 
			
		||||
function get_sheet_num (href_name) {
 | 
			
		||||
	if (!document.styleSheets) return false;
 | 
			
		||||
	for (var i = 0; i < document.styleSheets.length; i++) { if(document.styleSheets[i].href && document.styleSheets[i].href.toString().match(href_name)) return i; } 
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
function remove_css(rule_name, stylesheet) { return get_css(rule_name, stylesheet, true); }
 | 
			
		||||
 | 
			
		||||
function add_sheet(url) {
 | 
			
		||||
	if(document.createStyleSheet) {
 | 
			
		||||
		document.createStyleSheet(url);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		var styles	= "@import url(' " + url + " ');";
 | 
			
		||||
		var newSS	= document.createElement('link');
 | 
			
		||||
		newSS.rel	='stylesheet';
 | 
			
		||||
		newSS.href	='data:text/css,'+escape(styles);
 | 
			
		||||
		document.getElementsByTagName("head")[0].appendChild(newSS);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										96
									
								
								static/cms/js/jstree/_lib/jquery.cookie.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,96 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Cookie plugin
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 | 
			
		||||
 * Dual licensed under the MIT and GPL licenses:
 | 
			
		||||
 * http://www.opensource.org/licenses/mit-license.php
 | 
			
		||||
 * http://www.gnu.org/licenses/gpl.html
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Create a cookie with the given name and value and other optional parameters.
 | 
			
		||||
 *
 | 
			
		||||
 * @example $.cookie('the_cookie', 'the_value');
 | 
			
		||||
 * @desc Set the value of a cookie.
 | 
			
		||||
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 | 
			
		||||
 * @desc Create a cookie with all available options.
 | 
			
		||||
 * @example $.cookie('the_cookie', 'the_value');
 | 
			
		||||
 * @desc Create a session cookie.
 | 
			
		||||
 * @example $.cookie('the_cookie', null);
 | 
			
		||||
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 | 
			
		||||
 *       used when the cookie was set.
 | 
			
		||||
 *
 | 
			
		||||
 * @param String name The name of the cookie.
 | 
			
		||||
 * @param String value The value of the cookie.
 | 
			
		||||
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 | 
			
		||||
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 | 
			
		||||
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 | 
			
		||||
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 | 
			
		||||
 *                             when the the browser exits.
 | 
			
		||||
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 | 
			
		||||
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 | 
			
		||||
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 | 
			
		||||
 *                        require a secure protocol (like HTTPS).
 | 
			
		||||
 * @type undefined
 | 
			
		||||
 *
 | 
			
		||||
 * @name $.cookie
 | 
			
		||||
 * @cat Plugins/Cookie
 | 
			
		||||
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get the value of a cookie with the given name.
 | 
			
		||||
 *
 | 
			
		||||
 * @example $.cookie('the_cookie');
 | 
			
		||||
 * @desc Get the value of a cookie.
 | 
			
		||||
 *
 | 
			
		||||
 * @param String name The name of the cookie.
 | 
			
		||||
 * @return The value of the cookie.
 | 
			
		||||
 * @type String
 | 
			
		||||
 *
 | 
			
		||||
 * @name $.cookie
 | 
			
		||||
 * @cat Plugins/Cookie
 | 
			
		||||
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 | 
			
		||||
 */
 | 
			
		||||
jQuery.cookie = function(name, value, options) {
 | 
			
		||||
    if (typeof value != 'undefined') { // name and value given, set cookie
 | 
			
		||||
        options = options || {};
 | 
			
		||||
        if (value === null) {
 | 
			
		||||
            value = '';
 | 
			
		||||
            options.expires = -1;
 | 
			
		||||
        }
 | 
			
		||||
        var expires = '';
 | 
			
		||||
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
 | 
			
		||||
            var date;
 | 
			
		||||
            if (typeof options.expires == 'number') {
 | 
			
		||||
                date = new Date();
 | 
			
		||||
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
 | 
			
		||||
            } else {
 | 
			
		||||
                date = options.expires;
 | 
			
		||||
            }
 | 
			
		||||
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
 | 
			
		||||
        }
 | 
			
		||||
        // CAUTION: Needed to parenthesize options.path and options.domain
 | 
			
		||||
        // in the following expressions, otherwise they evaluate to undefined
 | 
			
		||||
        // in the packed version for some reason...
 | 
			
		||||
        var path = options.path ? '; path=' + (options.path) : '';
 | 
			
		||||
        var domain = options.domain ? '; domain=' + (options.domain) : '';
 | 
			
		||||
        var secure = options.secure ? '; secure' : '';
 | 
			
		||||
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
 | 
			
		||||
    } else { // only name given, get cookie
 | 
			
		||||
        var cookieValue = null;
 | 
			
		||||
        if (document.cookie && document.cookie != '') {
 | 
			
		||||
            var cookies = document.cookie.split(';');
 | 
			
		||||
            for (var i = 0; i < cookies.length; i++) {
 | 
			
		||||
                var cookie = jQuery.trim(cookies[i]);
 | 
			
		||||
                // Does this cookie string begin with the name we want?
 | 
			
		||||
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
 | 
			
		||||
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return cookieValue;
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										121
									
								
								static/cms/js/jstree/_lib/jquery.hotkeys.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,121 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @ Original code by by Binny V A, Original version: 2.00.A 
 | 
			
		||||
 * @ http://www.openjs.com/scripts/events/keyboard_shortcuts/
 | 
			
		||||
 * @ Original License : BSD
 | 
			
		||||
 * @ jQuery Plugin by Tzury Bar Yochay 
 | 
			
		||||
        tzury.by@gmail.com
 | 
			
		||||
        evalinux.wordpress.com
 | 
			
		||||
        facebook.com/profile.php?id=513676303
 | 
			
		||||
 * @ jQuery Plugin version Beta (0.0.2)
 | 
			
		||||
 * @ License: Whatever feats in between jQuery-License + BSD-License
 | 
			
		||||
 | 
			
		||||
TODO:
 | 
			
		||||
    add queue support (as in gmail) e.g. 'x' then 'y', etc.
 | 
			
		||||
    add mouse + mouse wheel events.
 | 
			
		||||
 | 
			
		||||
Usage:
 | 
			
		||||
    jQuery.hotkeys.add('Ctrl+c', function(){ alert('copy anyone?');});
 | 
			
		||||
    jQuery.hotkeys.add('Ctrl+c', {target:'div#editor', type:'keyup', propagate: true},function(){ alert('copy anyone?');});
 | 
			
		||||
    jQuery.hotkeys.remove('Ctrl+c'); 
 | 
			
		||||
    */
 | 
			
		||||
    
 | 
			
		||||
(function (jQuery){
 | 
			
		||||
    this.version = '(beta)(0.0.2)';
 | 
			
		||||
	this.all = {};
 | 
			
		||||
    this.special_keys = {
 | 
			
		||||
        27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', 20: 'capslock', 
 | 
			
		||||
        144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',35:'end', 33: 'pageup', 
 | 
			
		||||
        34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', 112:'f1',113:'f2', 114:'f3', 
 | 
			
		||||
        115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12'};
 | 
			
		||||
        
 | 
			
		||||
    this.shift_nums = { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", 
 | 
			
		||||
        "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<", 
 | 
			
		||||
        ".":">",  "/":"?",  "\\":"|" };
 | 
			
		||||
 | 
			
		||||
    this.add = function(combi, options, callback) {
 | 
			
		||||
        if (jQuery.isFunction(options)){
 | 
			
		||||
            callback = options;
 | 
			
		||||
            options = {};
 | 
			
		||||
        }
 | 
			
		||||
        var opt = {},
 | 
			
		||||
            defaults = {type: 'keydown', propagate: false, disableInInput: false, target: jQuery('html')[0]},
 | 
			
		||||
            that = this;
 | 
			
		||||
        opt = jQuery.extend( opt , defaults, options || {} );
 | 
			
		||||
        combi = combi.toLowerCase();        
 | 
			
		||||
        
 | 
			
		||||
        // inspect if key keystroke matches 
 | 
			
		||||
        var inspector = function(event) {
 | 
			
		||||
            event = jQuery.event.fix(event); // jQuery event normalization.
 | 
			
		||||
            var element = event.target;
 | 
			
		||||
            // @ TextNode -> nodeType == 3
 | 
			
		||||
            element = (element.nodeType==3) ? element.parentNode : element;
 | 
			
		||||
            
 | 
			
		||||
            if(opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields
 | 
			
		||||
                var target = jQuery(element);
 | 
			
		||||
                if( target.is("input") || target.is("textarea")){
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            var code = event.which,
 | 
			
		||||
                type = event.type,
 | 
			
		||||
                character = String.fromCharCode(code).toLowerCase(),
 | 
			
		||||
                special = that.special_keys[code],
 | 
			
		||||
                shift = event.shiftKey,
 | 
			
		||||
                ctrl = event.ctrlKey,
 | 
			
		||||
                alt= event.altKey,
 | 
			
		||||
                propagate = true, // default behaivour
 | 
			
		||||
                mapPoint = null;
 | 
			
		||||
            
 | 
			
		||||
            // in opera + safari, the event.target is unpredictable.
 | 
			
		||||
            // for example: 'keydown' might be associated with HtmlBodyElement 
 | 
			
		||||
            // or the element where you last clicked with your mouse.
 | 
			
		||||
            if (jQuery.browser.opera || jQuery.browser.safari){
 | 
			
		||||
                while (!that.all[element] && element.parentNode){
 | 
			
		||||
                    element = element.parentNode;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            var cbMap = that.all[element].events[type].callbackMap;
 | 
			
		||||
            if(!shift && !ctrl && !alt) { // No Modifiers
 | 
			
		||||
                mapPoint = cbMap[special] ||  cbMap[character]
 | 
			
		||||
			}
 | 
			
		||||
            // deals with combinaitons (alt|ctrl|shift+anything)
 | 
			
		||||
            else{
 | 
			
		||||
                var modif = '';
 | 
			
		||||
                if(alt) modif +='alt+';
 | 
			
		||||
                if(ctrl) modif+= 'ctrl+';
 | 
			
		||||
                if(shift) modif += 'shift+';
 | 
			
		||||
                // modifiers + special keys or modifiers + characters or modifiers + shift characters
 | 
			
		||||
                mapPoint = cbMap[modif+special] || cbMap[modif+character] || cbMap[modif+that.shift_nums[character]]
 | 
			
		||||
            }
 | 
			
		||||
            if (mapPoint){
 | 
			
		||||
                mapPoint.cb(event);
 | 
			
		||||
                if(!mapPoint.propagate) {
 | 
			
		||||
                    event.stopPropagation();
 | 
			
		||||
                    event.preventDefault();
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
		};        
 | 
			
		||||
        // first hook for this element
 | 
			
		||||
        if (!this.all[opt.target]){
 | 
			
		||||
            this.all[opt.target] = {events:{}};
 | 
			
		||||
        }        
 | 
			
		||||
        if (!this.all[opt.target].events[opt.type]){
 | 
			
		||||
            this.all[opt.target].events[opt.type] = {callbackMap: {}}
 | 
			
		||||
            jQuery.event.add(opt.target, opt.type, inspector);
 | 
			
		||||
        }        
 | 
			
		||||
        this.all[opt.target].events[opt.type].callbackMap[combi] =  {cb: callback, propagate:opt.propagate};                
 | 
			
		||||
        return jQuery;
 | 
			
		||||
	};    
 | 
			
		||||
    this.remove = function(exp, opt) {
 | 
			
		||||
        opt = opt || {};
 | 
			
		||||
        target = opt.target || jQuery('html')[0];
 | 
			
		||||
        type = opt.type || 'keydown';
 | 
			
		||||
		exp = exp.toLowerCase();        
 | 
			
		||||
        delete this.all[target].events[type].callbackMap[exp]        
 | 
			
		||||
        return jQuery;
 | 
			
		||||
	};
 | 
			
		||||
    jQuery.hotkeys = this;
 | 
			
		||||
    return jQuery;    
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										32
									
								
								static/cms/js/jstree/_lib/jquery.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										9
									
								
								static/cms/js/jstree/_lib/jquery.listen.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
/**
 | 
			
		||||
 * jQuery.Listen - Light and fast event handling, using event delegation.
 | 
			
		||||
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 | 
			
		||||
 * Dual licensed under MIT and GPL.
 | 
			
		||||
 * Date: 3/7/2008
 | 
			
		||||
 * http://flesler.blogspot.com/2007/10/jquerylisten.html
 | 
			
		||||
 * @version 1.0.3
 | 
			
		||||
 */
 | 
			
		||||
;(function($){var a='indexer',h=$.event,j=h.special,k=$.listen=function(c,d,e,f){if(typeof d!='object'){f=e;e=d;d=document}o(c.split(/\s+/),function(a){a=k.fixes[a]||a;var b=m(d,a)||m(d,a,new n(a,d));b.append(e,f);b.start()})},m=function(b,c,d){return $.data(b,c+'.'+a,d)};$.fn[a]=function(a){return this[0]&&m(this[0],a)||null};$[a]=function(a){return m(document,a)};$.extend(k,{regex:/^((?:\w*?|\*))(?:([#.])([\w-]+))?$/,fixes:{focus:'focusin',blur:'focusout'},cache:function(a){this.caching=a}});$.each(k.fixes,function(a,b){j[b]={setup:function(){if($.browser.msie)return!1;this.addEventListener(a,j[b].handler,!0)},teardown:function(){if($.browser.msie)return!1;this.removeEventListener(a,j[b].handler,!0)},handler:function(e){arguments[0]=e=h.fix(e);e.type=b;return h.handle.apply(this,arguments)}}});$.fn.listen=function(a,b,c){return this.each(function(){k(a,this,b,c)})};function n(a,b){$.extend(this,{ids:{},tags:{},listener:b,event:a});this.id=n.instances.push(this)};n.instances=[];n.prototype={constructor:n,handle:function(e){var a=e.stopPropagation;e.stopPropagation=function(){e.stopped=1;a.apply(this,arguments)};m(this,e.type).parse(e);e.stopPropagation=a;a=e.data=null},on:0,bubbles:0,start:function(){var a=this;if(!a.on){h.add(a.listener,a.event,a.handle);a.on=1}},stop:function(){var a=this;if(a.on){h.remove(a.listener,a.event,a.handle);a.on=0}},cache:function(a,b){return $.data(a,'listenCache_'+this.id,b)},parse:function(e){var z=this,c=e.data||e.target,d=arguments,f;if(!k.caching||!(f=z.cache(c))){f=[];if(c.id&&z.ids[c.id])p(f,z.ids[c.id]);o([c.nodeName,'*'],function(a){var b=z.tags[a];if(b)o((c.className+' *').split(' '),function(a){if(a&&b[a])p(f,b[a])})});if(k.caching)z.cache(c,f)}if(f[0]){o(f,function(a){if(a.apply(c,d)===!1){e.preventDefault();e.stopPropagation()}})}if(!e.stopped&&(c=c.parentNode)&&(c.nodeName=='A'||z.bubbles&&c!=z.listener)){e.data=c;z.parse(e)}f=d=c=null},append:function(f,g){var z=this;o(f.split(/\s*,\s*/),function(a){var b=k.regex.exec(a);if(!b)throw'$.listen > "'+a+'" is not a supported selector.';var c=b[2]=='#'&&b[3],d=b[1].toUpperCase()||'*',e=b[3]||'*';if(c)(z.ids[c]||(z.ids[c]=[])).push(g);else if(d){d=z.tags[d]=z.tags[d]||{};(d[e]||(d[e]=[])).push(g)}})}};function o(a,b,c){for(var i=0,l=a.length;i<l;i++)b.call(c,a[i],i)};function p(a,b){a.push.apply(a,b);return a};$(window).unload(function(){if(typeof n=='function')o(n.instances,function(b){b.stop();$.removeData(b.listener,b.event+'.'+a);b.ids=b.names=b.listener=null})})})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/jstree/_lib/jquery.log.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
(function($){ // block scope
 | 
			
		||||
	jQuery.fn.log = function (msg) {
 | 
			
		||||
		if (!window.console || !console) return;
 | 
			
		||||
		if (window.console || console.firebug){
 | 
			
		||||
			msg = msg || '';
 | 
			
		||||
			if(msg !== '') msg += ': ';
 | 
			
		||||
			console.log("%s%o", msg, this);
 | 
			
		||||
		}
 | 
			
		||||
		return this;
 | 
			
		||||
	};
 | 
			
		||||
	$.extend({
 | 
			
		||||
		log : function (msg) {
 | 
			
		||||
			if (!window.console || !console) return;
 | 
			
		||||
			if (window.console || console.firebug) {
 | 
			
		||||
				console.log("%s", msg);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										122
									
								
								static/cms/js/jstree/_lib/jquery.metadata.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,122 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Metadata - jQuery plugin for parsing metadata from elements
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2006 John Resig, Yehuda Katz, J<EFBFBD>örn Zaefferer, Paul McLanahan
 | 
			
		||||
 *
 | 
			
		||||
 * Dual licensed under the MIT and GPL licenses:
 | 
			
		||||
 *   http://www.opensource.org/licenses/mit-license.php
 | 
			
		||||
 *   http://www.gnu.org/licenses/gpl.html
 | 
			
		||||
 *
 | 
			
		||||
 * Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer $
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
 | 
			
		||||
 * in the JSON will become a property of the element itself.
 | 
			
		||||
 *
 | 
			
		||||
 * There are three supported types of metadata storage:
 | 
			
		||||
 *
 | 
			
		||||
 *   attr:  Inside an attribute. The name parameter indicates *which* attribute.
 | 
			
		||||
 *          
 | 
			
		||||
 *   class: Inside the class attribute, wrapped in curly braces: { }
 | 
			
		||||
 *   
 | 
			
		||||
 *   elem:  Inside a child element (e.g. a script tag). The
 | 
			
		||||
 *          name parameter indicates *which* element.
 | 
			
		||||
 *          
 | 
			
		||||
 * The metadata for an element is loaded the first time the element is accessed via jQuery.
 | 
			
		||||
 *
 | 
			
		||||
 * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
 | 
			
		||||
 * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
 | 
			
		||||
 * 
 | 
			
		||||
 * @name $.metadata.setType
 | 
			
		||||
 *
 | 
			
		||||
 * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
 | 
			
		||||
 * @before $.metadata.setType("class")
 | 
			
		||||
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 | 
			
		||||
 * @desc Reads metadata from the class attribute
 | 
			
		||||
 * 
 | 
			
		||||
 * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
 | 
			
		||||
 * @before $.metadata.setType("attr", "data")
 | 
			
		||||
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 | 
			
		||||
 * @desc Reads metadata from a "data" attribute
 | 
			
		||||
 * 
 | 
			
		||||
 * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
 | 
			
		||||
 * @before $.metadata.setType("elem", "script")
 | 
			
		||||
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 | 
			
		||||
 * @desc Reads metadata from a nested script element
 | 
			
		||||
 * 
 | 
			
		||||
 * @param String type The encoding type
 | 
			
		||||
 * @param String name The name of the attribute to be used to get metadata (optional)
 | 
			
		||||
 * @cat Plugins/Metadata
 | 
			
		||||
 * @descr Sets the type of encoding to be used when loading metadata for the first time
 | 
			
		||||
 * @type undefined
 | 
			
		||||
 * @see metadata()
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
(function($) {
 | 
			
		||||
 | 
			
		||||
$.extend({
 | 
			
		||||
	metadata : {
 | 
			
		||||
		defaults : {
 | 
			
		||||
			type: 'class',
 | 
			
		||||
			name: 'metadata',
 | 
			
		||||
			cre: /({.*})/,
 | 
			
		||||
			single: 'metadata'
 | 
			
		||||
		},
 | 
			
		||||
		setType: function( type, name ){
 | 
			
		||||
			this.defaults.type = type;
 | 
			
		||||
			this.defaults.name = name;
 | 
			
		||||
		},
 | 
			
		||||
		get: function( elem, opts ){
 | 
			
		||||
			var settings = $.extend({},this.defaults,opts);
 | 
			
		||||
			// check for empty string in single property
 | 
			
		||||
			if ( !settings.single.length ) settings.single = 'metadata';
 | 
			
		||||
			
 | 
			
		||||
			var data = $.data(elem, settings.single);
 | 
			
		||||
			// returned cached data if it already exists
 | 
			
		||||
			if ( data ) return data;
 | 
			
		||||
			
 | 
			
		||||
			data = "{}";
 | 
			
		||||
			
 | 
			
		||||
			if ( settings.type == "class" ) {
 | 
			
		||||
				var m = settings.cre.exec( elem.className );
 | 
			
		||||
				if ( m )
 | 
			
		||||
					data = m[1];
 | 
			
		||||
			} else if ( settings.type == "elem" ) {
 | 
			
		||||
				if( !elem.getElementsByTagName )
 | 
			
		||||
					return undefined;
 | 
			
		||||
				var e = elem.getElementsByTagName(settings.name);
 | 
			
		||||
				if ( e.length )
 | 
			
		||||
					data = $.trim(e[0].innerHTML);
 | 
			
		||||
			} else if ( elem.getAttribute != undefined ) {
 | 
			
		||||
				var attr = elem.getAttribute( settings.name );
 | 
			
		||||
				if ( attr )
 | 
			
		||||
					data = attr;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			if ( data.indexOf( '{' ) <0 )
 | 
			
		||||
			data = "{" + data + "}";
 | 
			
		||||
			
 | 
			
		||||
			data = eval("(" + data + ")");
 | 
			
		||||
			
 | 
			
		||||
			$.data( elem, settings.single, data );
 | 
			
		||||
			return data;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Returns the metadata object for the first member of the jQuery object.
 | 
			
		||||
 *
 | 
			
		||||
 * @name metadata
 | 
			
		||||
 * @descr Returns element's metadata object
 | 
			
		||||
 * @param Object opts An object contianing settings to override the defaults
 | 
			
		||||
 * @type jQuery
 | 
			
		||||
 * @cat Plugins/Metadata
 | 
			
		||||
 */
 | 
			
		||||
$.fn.metadata = function( opts ){
 | 
			
		||||
	return $.metadata.get( this[0], opts );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										352
									
								
								static/cms/js/jstree/_lib/jquery.xslt.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,352 @@
 | 
			
		|||
/**
 | 
			
		||||
 * xslTransform
 | 
			
		||||
 * Tools for XSLT transformations; jQuery wrapper for Sarissa <http://sarissa.sourceforge.net/>.
 | 
			
		||||
 * See jQuery.fn.log below for documentation on $.log().
 | 
			
		||||
 * See jQuery.fn.getTransform below for documention on the $.getTransform().
 | 
			
		||||
 * See var DEBUG below for turning debugging/logging on and off.
 | 
			
		||||
 *
 | 
			
		||||
 * @version   20071203
 | 
			
		||||
 * @since     2006-07-05
 | 
			
		||||
 * @copyright Copyright (c) 2006 Glyphix Studio, Inc. http://www.glyphix.com
 | 
			
		||||
 * @author    Brad Brizendine <brizbane@gmail.com>, Matt Antone <antone@glyphix.com>
 | 
			
		||||
 * @license   MIT http://www.opensource.org/licenses/mit-license.php
 | 
			
		||||
 * @requires  >= jQuery 1.0.3			http://jquery.com/
 | 
			
		||||
 * @requires  jquery.debug.js			http://jquery.glyphix.com/
 | 
			
		||||
 * @requires  >= sarissa.js 0.9.7.6		http://sarissa.sourceforge.net/
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * var r = xslTransform.transform('path-to-xsl.xsl','path-to-xml.xml');
 | 
			
		||||
 * @desc Perform a transformation and place the results in var r
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * var r = xslTransform.transform('path-to-xsl.xsl','path-to-xml.xml');
 | 
			
		||||
 * var str = xslTransform.serialize( r );
 | 
			
		||||
 * @desc Perform a transformation, then turn the result into a string
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * var doc = xslTransform.load('path-to-xml.xml');
 | 
			
		||||
 * @desc Load an xml file and return a parsed xml object
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * var xml = '<xmldoc><foo>bar</foo></xmldoc>';
 | 
			
		||||
 * var doc = xslTransform.load(xml);
 | 
			
		||||
 * @desc Load an xml string and return a parsed xml object
 | 
			
		||||
 */
 | 
			
		||||
var xslTransform = {
 | 
			
		||||
 | 
			
		||||
	version: 20071203,
 | 
			
		||||
	debug: false,
 | 
			
		||||
 | 
			
		||||
	// init ... test for requirements
 | 
			
		||||
	init: function(){
 | 
			
		||||
		// check for v1.0.4 / v1.1 or later of jQuery
 | 
			
		||||
		try{
 | 
			
		||||
			parseFloat(jQuery.fn.jquery) >= 1;
 | 
			
		||||
		}catch(e){
 | 
			
		||||
			alert('xslTransform requires jQuery 1.0.4 or greater ... please load it prior to xslTransform');
 | 
			
		||||
		}
 | 
			
		||||
		// check for Sarissa
 | 
			
		||||
		try{
 | 
			
		||||
			Sarissa;
 | 
			
		||||
		}catch(e){
 | 
			
		||||
			alert('Missing Sarissa ... please load it prior to xslTransform');
 | 
			
		||||
		}
 | 
			
		||||
		// if no log function, create a blank one
 | 
			
		||||
		if( !jQuery.log ){
 | 
			
		||||
			jQuery.log = function(){};
 | 
			
		||||
			jQuery.fn.debug = function(){};
 | 
			
		||||
		}
 | 
			
		||||
		// log the version
 | 
			
		||||
		if(this.debug) jQuery.log( 'xslTransform:init(): version ' + xslTransform.version );
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	// initialize Sarissa's serializer
 | 
			
		||||
	XMLSerializer: new XMLSerializer(),
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * serialize
 | 
			
		||||
	 * Turns the provided object into a string and returns it.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param data Mixed
 | 
			
		||||
	 * @returns String
 | 
			
		||||
	 */
 | 
			
		||||
	serialize: function( data ){
 | 
			
		||||
		if(this.debug) jQuery.log( 'serialize(): received ' + typeof(data) );
 | 
			
		||||
		// if it's already a string, no further processing required
 | 
			
		||||
		if( typeof(data) == 'string' ){
 | 
			
		||||
			return data;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return this.XMLSerializer.serializeToString( data );
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * load
 | 
			
		||||
	 * Attempts to load xml data by automatically sensing the type of the provided data.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param xml Mixed the xml data
 | 
			
		||||
	 * @returns Object
 | 
			
		||||
	 */
 | 
			
		||||
	load: function( xml, meth ){
 | 
			
		||||
		if(this.debug) jQuery.log( 'load(): received ' + typeof(xml) );
 | 
			
		||||
		// the result
 | 
			
		||||
		var r;
 | 
			
		||||
 | 
			
		||||
		// if it's an object, assume it's already an XML object, so just return it
 | 
			
		||||
		if( typeof(xml) == 'object' ){
 | 
			
		||||
			return xml;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// if it's a string, determine if it's xml data or a path
 | 
			
		||||
		// assume that the first character is an opening caret if it's XML data
 | 
			
		||||
		if( xml.substring(0,1) == '<' ){
 | 
			
		||||
			r = this.loadString( xml );
 | 
			
		||||
		}else{
 | 
			
		||||
			r = this.loadFile( xml , meth );
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if( r ){
 | 
			
		||||
			// the following two lines are needed to get IE (msxml3) to run xpath ... set it on all xml data
 | 
			
		||||
			r.setProperty( 'SelectionNamespaces', 'xmlns:xsl="http://www.w3.org/1999/XSL/Transform"' );
 | 
			
		||||
			r.setProperty( 'SelectionLanguage', 'XPath' );
 | 
			
		||||
			return r;
 | 
			
		||||
		}else{
 | 
			
		||||
			if(this.debug) $.log( 'Unable to load ' + xml );
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * loadString
 | 
			
		||||
	 * Parses an XML string and returns the result.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param str String the xml string to turn into a parsed XML object
 | 
			
		||||
	 * @returns Object
 | 
			
		||||
	 */
 | 
			
		||||
	loadString: function( str ){
 | 
			
		||||
		if(this.debug) jQuery.log( 'loadString(): ' + str + '::' + typeof(str) );
 | 
			
		||||
 | 
			
		||||
		// use Sarissa to generate an XML doc
 | 
			
		||||
		var p = new DOMParser();
 | 
			
		||||
		var xml = p.parseFromString( str, 'text/xml' );
 | 
			
		||||
		if( !xml ){
 | 
			
		||||
			if(this.debug) jQuery.log( 'loadString(): parseFromString() failed' );
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		return xml;
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * loadFile
 | 
			
		||||
	 * Attempts to retrieve the requested path, specified by url.
 | 
			
		||||
	 * If url is an object, it's assumed it's already loaded, and just returns it.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param url Mixed
 | 
			
		||||
	 * @returns Object
 | 
			
		||||
	 */
 | 
			
		||||
	loadFile: function( url, meth ){
 | 
			
		||||
		if(this.debug) jQuery.log( 'loadFile(): ' + url + '::' + typeof(url) );
 | 
			
		||||
 | 
			
		||||
		if( !url ){
 | 
			
		||||
			if(this.debug) jQuery.log( 'ERROR: loadFile() missing url' );
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// variable to hold ajax results
 | 
			
		||||
		var doc;
 | 
			
		||||
		// function to receive data on successful download ... semicolon after brace is necessary for packing
 | 
			
		||||
		this.xhrsuccess = function(data,str){
 | 
			
		||||
			if(this.debug) jQuery.log( 'loadFile() completed successfully (' + str + ')' );
 | 
			
		||||
			doc = data;
 | 
			
		||||
			return true;
 | 
			
		||||
		};
 | 
			
		||||
		// function to handle downloading error ... semicolon after brace is necessary for packing
 | 
			
		||||
		this.xhrerror = function(xhr,err){
 | 
			
		||||
			// set debugging to true in order to force the display of this error
 | 
			
		||||
			window.DEBUG = true;
 | 
			
		||||
			if(this.debug) jQuery.log( 'loadFile() failed to load the requested file: (' + err + ') - xml: ' + xhr.responseXML + ' - text: ' + xhr.responseText );
 | 
			
		||||
			doc = null;
 | 
			
		||||
			return false;
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		// make asynchronous ajax call and call functions defined above on success/error
 | 
			
		||||
		if(!meth) meth = "GET";
 | 
			
		||||
		$.ajax({
 | 
			
		||||
			type:		meth,
 | 
			
		||||
			url:		url,
 | 
			
		||||
			async:		false,
 | 
			
		||||
			success:	this.xhrsuccess,
 | 
			
		||||
			error:		this.xhrerror
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		// check for total failure
 | 
			
		||||
		if( !doc ){
 | 
			
		||||
			if(this.debug) jQuery.log( 'ERROR: document ' + url + ' not found (404), or unable to load' );
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		// check for success but no data
 | 
			
		||||
		if( doc.length == 0 ){
 | 
			
		||||
			if(this.debug) jQuery.log( 'ERROR: document ' + url + ' loaded in loadFile() has no data' );
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		return doc;
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * transform
 | 
			
		||||
	 * Central transformation function: takes an xml doc and an xsl doc.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param xsl Mixed the xsl transformation document
 | 
			
		||||
	 * @param xml Mixed the xml document to be transformed
 | 
			
		||||
	 * @param options Object various switches you can send to this function
 | 
			
		||||
	 * 		+ params: an object of key/value pairs to be sent to xsl as parameters
 | 
			
		||||
	 * 		+ xpath: defines the root node within the provided xml file
 | 
			
		||||
	 * @returns Object the results of the transformation
 | 
			
		||||
	 * 		+ xsl: the raw xsl doc
 | 
			
		||||
	 * 		+ doc: the raw results of the transform
 | 
			
		||||
	 * 		+ string: the serialized doc
 | 
			
		||||
	 */
 | 
			
		||||
	transform: function( xsl, xml, options ){
 | 
			
		||||
		var log = { 'xsl':xsl, 'xml':xml, 'options':options };
 | 
			
		||||
		if(this.debug) jQuery.log( 'transform(): ' + xsl + '::' + xml + '::' + options.toString() );
 | 
			
		||||
 | 
			
		||||
		// initialize options hash
 | 
			
		||||
		options = options || {};
 | 
			
		||||
 | 
			
		||||
		// initialize the xml object and store it in xml.doc
 | 
			
		||||
		var xml = { 'request':xml, 'doc':this.load(xml, options.meth) };
 | 
			
		||||
		// if we have an xpath, replace xml.doc with the results of running it
 | 
			
		||||
		// as of 2007-12-03, IE throws a "msxml6: the parameter is incorrect" error, so removing this
 | 
			
		||||
		if( options.xpath && xml.doc && !jQuery.browser.msie ){
 | 
			
		||||
			// run the xpath
 | 
			
		||||
			xml.doc = xml.doc.selectSingleNode( options.xpath.toString() );
 | 
			
		||||
			if(this.debug) $.log( 'transform(): xpath has been run...resulting doc: ' + (this.serialize(xml.doc)) );
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// initialize the result object ... store the primary steps of the transform in result
 | 
			
		||||
		var result = { 'xsl':this.load(xsl, options.meth) };
 | 
			
		||||
 | 
			
		||||
		result.json = false;
 | 
			
		||||
		if( options.json && xml.doc ) {
 | 
			
		||||
			result.json = xml.doc.selectSingleNode( options.json.toString() );
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		var processor = new XSLTProcessor();
 | 
			
		||||
		// stylesheet must be imported before parameters can be added
 | 
			
		||||
		processor.importStylesheet( result.xsl );
 | 
			
		||||
		// add parameters to the processor
 | 
			
		||||
		if( options.params && processor ){
 | 
			
		||||
			if(this.debug) jQuery.log( 'transform(): received xsl params: ' + options.params.toString() );
 | 
			
		||||
			for( key in options.params ){
 | 
			
		||||
				// name and value must be strings
 | 
			
		||||
				// first parameter is namespace
 | 
			
		||||
				processor.setParameter( null, key.toString(), options.params[key].toString() );
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// perform the transformation
 | 
			
		||||
		result.doc = processor.transformToDocument( xml.doc );
 | 
			
		||||
		// handle transform error
 | 
			
		||||
		var errorTxt = Sarissa.getParseErrorText(result.doc);
 | 
			
		||||
		if(this.debug) jQuery.log( 'transform(): Sarissa parse text: ' + errorTxt );
 | 
			
		||||
		if( errorTxt != Sarissa.PARSED_OK ){
 | 
			
		||||
			// return the error text as the string
 | 
			
		||||
			result.string = Sarissa.getParseErrorText(result.doc) + ' :: using ' + xsl + ' => ' + xml.request;
 | 
			
		||||
			if(this.debug) jQuery.log( 'transform(): error in transformation: ' + Sarissa.getParseErrorText(result.doc) );
 | 
			
		||||
			return result;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// if we made it this far, the transformation was successful
 | 
			
		||||
		result.string = this.serialize( result.doc );
 | 
			
		||||
		// store reference to all scripts found in the doc (not result.string)
 | 
			
		||||
		result.scripts = jQuery('script',result.doc).text();
 | 
			
		||||
 | 
			
		||||
		return result;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// create the xslTransform object
 | 
			
		||||
// this creates a single object for the page, allowing re-use of the XSL processor
 | 
			
		||||
xslTransform.init();
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * JQuery XSLT transformation plugin.
 | 
			
		||||
 * Replaces all matched elements with the results of an XSLT transformation.
 | 
			
		||||
 * See xslTransform above for more documentation.
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * @desc See the xslTransform-example/index.html
 | 
			
		||||
 *
 | 
			
		||||
 * @param xsl String the url to the xsl file
 | 
			
		||||
 * @param xml String the url to the xml file
 | 
			
		||||
 * @param options Object various switches you can send to this function
 | 
			
		||||
 * 		+ params: an object of key/value pairs to be sent to xsl as parameters
 | 
			
		||||
 * 		+ xpath: defines the root node within the provided xml file
 | 
			
		||||
 * 		+ eval: if true, will attempt to eval javascript found in the transformed result
 | 
			
		||||
 *		+ callback: if a Function, evaluate it when transformation is complete
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
jQuery.fn.getTransform = function( xsl, xml, options ){
 | 
			
		||||
	var settings = {
 | 
			
		||||
		append: false,
 | 
			
		||||
		params: {},		// object of key/value pairs ... parameters to send to the XSL stylesheet
 | 
			
		||||
		xpath: '',		// xpath, used to send only a portion of the XML file to the XSL stylesheet
 | 
			
		||||
		eval: true,		// evaluate <script> blocks found in the transformed result
 | 
			
		||||
		callback: '',	// callback function, to be run on completion of the transformation
 | 
			
		||||
		json: false,
 | 
			
		||||
		meth : "GET"
 | 
			
		||||
	};
 | 
			
		||||
	// initialize options hash; override the defaults with supplied options
 | 
			
		||||
	jQuery.extend( settings, options );
 | 
			
		||||
	if(xslTransform.debug) jQuery.log( 'getTransform: ' + xsl + '::' + xml + '::' + settings.toString() );
 | 
			
		||||
 | 
			
		||||
	// must have both xsl and xml
 | 
			
		||||
	if( !xsl || !xml ){
 | 
			
		||||
		if(xslTransform.debug) jQuery.log( 'getTransform: missing xsl or xml' );
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// run the jquery magic on all matched elements
 | 
			
		||||
	return this.each( function(){
 | 
			
		||||
		// perform the transformation
 | 
			
		||||
		var trans = xslTransform.transform( xsl, xml, settings );
 | 
			
		||||
 | 
			
		||||
		// ie can fail if there's an xml declaration line in the returned result
 | 
			
		||||
		var re = trans.string.match(/<\?xml.*?\?>/);
 | 
			
		||||
		if( re ){
 | 
			
		||||
			trans.string = trans.string.replace( re, '' );
 | 
			
		||||
			if(xslTransform.debug) jQuery.log( 'getTransform(): found an xml declaration and removed it' );
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// place the result in the element
 | 
			
		||||
		// 20070202: jquery 1.1.1 can get a "a.appendChild is not a function" error using html() sometimes ...
 | 
			
		||||
		//		no idea why yet, so adding a fallback to innerHTML
 | 
			
		||||
		//		::warning:: ie6 has trouble with javascript events such as onclick assigned statically within the html when using innerHTML
 | 
			
		||||
		try {
 | 
			
		||||
			if(settings.append)			$(this).append( trans.string );
 | 
			
		||||
			else if(settings.repl)		$(this).replaceWith( trans.string );
 | 
			
		||||
			else						$(this).html( trans.string );
 | 
			
		||||
		} catch(e) {
 | 
			
		||||
			if(xslTransform.debug) $.log( 'getTransform: error placing results of transform into element, falling back to innerHTML: ' + e.toString() );
 | 
			
		||||
			$(this)[0].innerHTML = trans.string;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// there might not be a scripts property
 | 
			
		||||
		if( settings.eval && trans.scripts ){
 | 
			
		||||
			if( trans.scripts.length > 0 ){
 | 
			
		||||
				if(xslTransform.debug) jQuery.log( 'Found text/javascript in transformed result' );
 | 
			
		||||
				eval.call( window, trans.scripts );
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// run the callback if it's a native function
 | 
			
		||||
		if( settings.callback && jQuery.isFunction(settings.callback) ){
 | 
			
		||||
			var json = false;
 | 
			
		||||
			if(settings.json && trans.json) eval("json = " + trans.json.firstChild.data);
 | 
			
		||||
			settings.callback.apply(window, [trans.string, json]);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										110
									
								
								static/cms/js/jstree/_lib/sarissa.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,110 @@
 | 
			
		|||
 | 
			
		||||
/* * ====================================================================
 | 
			
		||||
 * About: This a a compressed JS file from the Sarissa library. 
 | 
			
		||||
 * see http://dev.abiss.gr/sarissa
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright: Manos Batsis, http://dev.abiss.gr
 | 
			
		||||
 * 
 | 
			
		||||
 * Licence:
 | 
			
		||||
 * Sarissa is free software distributed under the GNU GPL version 2 
 | 
			
		||||
 * or higher, GNU LGPL version 2.1 or higher and Apache Software 
 | 
			
		||||
 * License 2.0 or higher. The licenses are available online see: 
 | 
			
		||||
 * http://www.gnu.org  
 | 
			
		||||
 * http://www.apache.org
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 
 | 
			
		||||
 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
 | 
			
		||||
 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 
 | 
			
		||||
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
 | 
			
		||||
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
 | 
			
		||||
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 | 
			
		||||
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 * ====================================================================*/
 | 
			
		||||
 | 
			
		||||
function Sarissa(){}
 | 
			
		||||
Sarissa.VERSION="0.9.9.4";Sarissa.PARSED_OK="Document contains no parsing errors";Sarissa.PARSED_EMPTY="Document is empty";Sarissa.PARSED_UNKNOWN_ERROR="Not well-formed or other error";Sarissa.IS_ENABLED_TRANSFORM_NODE=false;Sarissa.REMOTE_CALL_FLAG="gr.abiss.sarissa.REMOTE_CALL_FLAG";Sarissa._lastUniqueSuffix=0;Sarissa._getUniqueSuffix=function(){return Sarissa._lastUniqueSuffix++;};Sarissa._SARISSA_IEPREFIX4XSLPARAM="";Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION=document.implementation&&true;Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT=Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.createDocument;Sarissa._SARISSA_HAS_DOM_FEATURE=Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.hasFeature;Sarissa._SARISSA_IS_MOZ=Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT&&Sarissa._SARISSA_HAS_DOM_FEATURE;Sarissa._SARISSA_IS_SAFARI=navigator.userAgent.toLowerCase().indexOf("safari")!=-1||navigator.userAgent.toLowerCase().indexOf("konqueror")!=-1;Sarissa._SARISSA_IS_SAFARI_OLD=Sarissa._SARISSA_IS_SAFARI&&(parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1],10)<420);Sarissa._SARISSA_IS_IE=document.all&&window.ActiveXObject&&navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1;Sarissa._SARISSA_IS_OPERA=navigator.userAgent.toLowerCase().indexOf("opera")!=-1;if(!window.Node||!Node.ELEMENT_NODE){Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};}
 | 
			
		||||
if(Sarissa._SARISSA_IS_SAFARI_OLD){HTMLHtmlElement=document.createElement("html").constructor;Node=HTMLElement={};HTMLElement.prototype=HTMLHtmlElement.__proto__.__proto__;HTMLDocument=Document=document.constructor;var x=new DOMParser();XMLDocument=x.constructor;Element=x.parseFromString("<Single />","text/xml").documentElement.constructor;x=null;}
 | 
			
		||||
if(typeof XMLDocument=="undefined"&&typeof Document!="undefined"){XMLDocument=Document;}
 | 
			
		||||
if(Sarissa._SARISSA_IS_IE){Sarissa._SARISSA_IEPREFIX4XSLPARAM="xsl:";var _SARISSA_DOM_PROGID="";var _SARISSA_XMLHTTP_PROGID="";var _SARISSA_DOM_XMLWRITER="";Sarissa.pickRecentProgID=function(idList){var bFound=false,e;var o2Store;for(var i=0;i<idList.length&&!bFound;i++){try{var oDoc=new ActiveXObject(idList[i]);o2Store=idList[i];bFound=true;}catch(objException){e=objException;}}
 | 
			
		||||
if(!bFound){throw"Could not retrieve a valid progID of Class: "+idList[idList.length-1]+". (original exception: "+e+")";}
 | 
			
		||||
idList=null;return o2Store;};_SARISSA_DOM_PROGID=null;_SARISSA_THREADEDDOM_PROGID=null;_SARISSA_XSLTEMPLATE_PROGID=null;_SARISSA_XMLHTTP_PROGID=null;XMLHttpRequest=function(){if(!_SARISSA_XMLHTTP_PROGID){_SARISSA_XMLHTTP_PROGID=Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"]);}
 | 
			
		||||
return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);};Sarissa.getDomDocument=function(sUri,sName){if(!_SARISSA_DOM_PROGID){_SARISSA_DOM_PROGID=Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"]);}
 | 
			
		||||
var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);if(sName){var prefix="";if(sUri){if(sName.indexOf(":")>1){prefix=sName.substring(0,sName.indexOf(":"));sName=sName.substring(sName.indexOf(":")+1);}else{prefix="a"+Sarissa._getUniqueSuffix();}}
 | 
			
		||||
if(sUri){oDoc.loadXML('<'+prefix+':'+sName+" xmlns:"+prefix+"=\""+sUri+"\""+" />");}else{oDoc.loadXML('<'+sName+" />");}}
 | 
			
		||||
return oDoc;};Sarissa.getParseErrorText=function(oDoc){var parseErrorText=Sarissa.PARSED_OK;if(oDoc&&oDoc.parseError&&oDoc.parseError.errorCode&&oDoc.parseError.errorCode!=0){parseErrorText="XML Parsing Error: "+oDoc.parseError.reason+"\nLocation: "+oDoc.parseError.url+"\nLine Number "+oDoc.parseError.line+", Column "+
 | 
			
		||||
oDoc.parseError.linepos+":\n"+oDoc.parseError.srcText+"\n";for(var i=0;i<oDoc.parseError.linepos;i++){parseErrorText+="-";}
 | 
			
		||||
parseErrorText+="^\n";}
 | 
			
		||||
else if(oDoc.documentElement===null){parseErrorText=Sarissa.PARSED_EMPTY;}
 | 
			
		||||
return parseErrorText;};Sarissa.setXpathNamespaces=function(oDoc,sNsSet){oDoc.setProperty("SelectionLanguage","XPath");oDoc.setProperty("SelectionNamespaces",sNsSet);};XSLTProcessor=function(){if(!_SARISSA_XSLTEMPLATE_PROGID){_SARISSA_XSLTEMPLATE_PROGID=Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0","MSXML2.XSLTemplate.3.0"]);}
 | 
			
		||||
this.template=new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);this.processor=null;};XSLTProcessor.prototype.importStylesheet=function(xslDoc){if(!_SARISSA_THREADEDDOM_PROGID){_SARISSA_THREADEDDOM_PROGID=Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0","MSXML2.FreeThreadedDOMDocument.3.0"]);}
 | 
			
		||||
xslDoc.setProperty("SelectionLanguage","XPath");xslDoc.setProperty("SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");var converted=new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);try{converted.resolveExternals=true;converted.setProperty("AllowDocumentFunction",true);}
 | 
			
		||||
catch(e){}
 | 
			
		||||
if(xslDoc.url&&xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']")!=null){converted.async=false;converted.load(xslDoc.url);}
 | 
			
		||||
else{converted.loadXML(xslDoc.xml);}
 | 
			
		||||
converted.setProperty("SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");var output=converted.selectSingleNode("//xsl:output");if(output){this.outputMethod=output.getAttribute("method");}
 | 
			
		||||
else{delete this.outputMethod;}
 | 
			
		||||
this.template.stylesheet=converted;this.processor=this.template.createProcessor();this.paramsSet=[];};XSLTProcessor.prototype.transformToDocument=function(sourceDoc){var outDoc;if(_SARISSA_THREADEDDOM_PROGID){this.processor.input=sourceDoc;outDoc=new ActiveXObject(_SARISSA_DOM_PROGID);this.processor.output=outDoc;this.processor.transform();return outDoc;}
 | 
			
		||||
else{if(!_SARISSA_DOM_XMLWRITER){_SARISSA_DOM_XMLWRITER=Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0","Msxml2.MXXMLWriter.3.0","MSXML2.MXXMLWriter","MSXML.MXXMLWriter","Microsoft.XMLDOM"]);}
 | 
			
		||||
this.processor.input=sourceDoc;outDoc=new ActiveXObject(_SARISSA_DOM_XMLWRITER);this.processor.output=outDoc;this.processor.transform();var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);oDoc.loadXML(outDoc.output+"");return oDoc;}};XSLTProcessor.prototype.transformToFragment=function(sourceDoc,ownerDoc){this.processor.input=sourceDoc;this.processor.transform();var s=this.processor.output;var f=ownerDoc.createDocumentFragment();var container;if(this.outputMethod=='text'){f.appendChild(ownerDoc.createTextNode(s));}else if(ownerDoc.body&&ownerDoc.body.innerHTML){container=ownerDoc.createElement('div');container.innerHTML=s;while(container.hasChildNodes()){f.appendChild(container.firstChild);}}
 | 
			
		||||
else{var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);if(s.substring(0,5)=='<?xml'){s=s.substring(s.indexOf('?>')+2);}
 | 
			
		||||
var xml=''.concat('<my>',s,'</my>');oDoc.loadXML(xml);container=oDoc.documentElement;while(container.hasChildNodes()){f.appendChild(container.firstChild);}}
 | 
			
		||||
return f;};XSLTProcessor.prototype.setParameter=function(nsURI,name,value){value=value?value:"";if(nsURI){this.processor.addParameter(name,value,nsURI);}else{this.processor.addParameter(name,value);}
 | 
			
		||||
nsURI=""+(nsURI||"");if(!this.paramsSet[nsURI]){this.paramsSet[nsURI]=[];}
 | 
			
		||||
this.paramsSet[nsURI][name]=value;};XSLTProcessor.prototype.getParameter=function(nsURI,name){nsURI=""+(nsURI||"");if(this.paramsSet[nsURI]&&this.paramsSet[nsURI][name]){return this.paramsSet[nsURI][name];}else{return null;}};XSLTProcessor.prototype.clearParameters=function(){for(var nsURI in this.paramsSet){for(var name in this.paramsSet[nsURI]){if(nsURI!=""){this.processor.addParameter(name,"",nsURI);}else{this.processor.addParameter(name,"");}}}
 | 
			
		||||
this.paramsSet=[];};}else{if(Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT){Sarissa.__handleLoad__=function(oDoc){Sarissa.__setReadyState__(oDoc,4);};_sarissa_XMLDocument_onload=function(){Sarissa.__handleLoad__(this);};Sarissa.__setReadyState__=function(oDoc,iReadyState){oDoc.readyState=iReadyState;oDoc.readystate=iReadyState;if(oDoc.onreadystatechange!=null&&typeof oDoc.onreadystatechange=="function"){oDoc.onreadystatechange();}};Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);if(!oDoc.onreadystatechange){oDoc.onreadystatechange=null;}
 | 
			
		||||
if(!oDoc.readyState){oDoc.readyState=0;}
 | 
			
		||||
oDoc.addEventListener("load",_sarissa_XMLDocument_onload,false);return oDoc;};if(window.XMLDocument){}
 | 
			
		||||
else if(Sarissa._SARISSA_HAS_DOM_FEATURE&&window.Document&&!Document.prototype.load&&document.implementation.hasFeature('LS','3.0')){Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);return oDoc;};}
 | 
			
		||||
else{Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);if(oDoc&&(sUri||sName)&&!oDoc.documentElement){oDoc.appendChild(oDoc.createElementNS(sUri,sName));}
 | 
			
		||||
return oDoc;};}}}
 | 
			
		||||
if(!window.DOMParser){if(Sarissa._SARISSA_IS_SAFARI){DOMParser=function(){};DOMParser.prototype.parseFromString=function(sXml,contentType){var xmlhttp=new XMLHttpRequest();xmlhttp.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(sXml),false);xmlhttp.send(null);return xmlhttp.responseXML;};}else if(Sarissa.getDomDocument&&Sarissa.getDomDocument()&&Sarissa.getDomDocument(null,"bar").xml){DOMParser=function(){};DOMParser.prototype.parseFromString=function(sXml,contentType){var doc=Sarissa.getDomDocument();doc.loadXML(sXml);return doc;};}}
 | 
			
		||||
if((typeof(document.importNode)=="undefined")&&Sarissa._SARISSA_IS_IE){try{document.importNode=function(oNode,bChildren){var tmp;if(oNode.nodeName=='#text'){return document.createTextNode(oNode.data);}
 | 
			
		||||
else{if(oNode.nodeName=="tbody"||oNode.nodeName=="tr"){tmp=document.createElement("table");}
 | 
			
		||||
else if(oNode.nodeName=="td"){tmp=document.createElement("tr");}
 | 
			
		||||
else if(oNode.nodeName=="option"){tmp=document.createElement("select");}
 | 
			
		||||
else{tmp=document.createElement("div");}
 | 
			
		||||
if(bChildren){tmp.innerHTML=oNode.xml?oNode.xml:oNode.outerHTML;}else{tmp.innerHTML=oNode.xml?oNode.cloneNode(false).xml:oNode.cloneNode(false).outerHTML;}
 | 
			
		||||
return tmp.getElementsByTagName("*")[0];}};}catch(e){}}
 | 
			
		||||
if(!Sarissa.getParseErrorText){Sarissa.getParseErrorText=function(oDoc){var parseErrorText=Sarissa.PARSED_OK;if((!oDoc)||(!oDoc.documentElement)){parseErrorText=Sarissa.PARSED_EMPTY;}else if(oDoc.documentElement.tagName=="parsererror"){parseErrorText=oDoc.documentElement.firstChild.data;parseErrorText+="\n"+oDoc.documentElement.firstChild.nextSibling.firstChild.data;}else if(oDoc.getElementsByTagName("parsererror").length>0){var parsererror=oDoc.getElementsByTagName("parsererror")[0];parseErrorText=Sarissa.getText(parsererror,true)+"\n";}else if(oDoc.parseError&&oDoc.parseError.errorCode!=0){parseErrorText=Sarissa.PARSED_UNKNOWN_ERROR;}
 | 
			
		||||
return parseErrorText;};}
 | 
			
		||||
Sarissa.getText=function(oNode,deep){var s="";var nodes=oNode.childNodes;for(var i=0;i<nodes.length;i++){var node=nodes[i];var nodeType=node.nodeType;if(nodeType==Node.TEXT_NODE||nodeType==Node.CDATA_SECTION_NODE){s+=node.data;}else if(deep===true&&(nodeType==Node.ELEMENT_NODE||nodeType==Node.DOCUMENT_NODE||nodeType==Node.DOCUMENT_FRAGMENT_NODE)){s+=Sarissa.getText(node,true);}}
 | 
			
		||||
return s;};if(!window.XMLSerializer&&Sarissa.getDomDocument&&Sarissa.getDomDocument("","foo",null).xml){XMLSerializer=function(){};XMLSerializer.prototype.serializeToString=function(oNode){return oNode.xml;};}
 | 
			
		||||
Sarissa.stripTags=function(s){return s?s.replace(/<[^>]+>/g,""):s;};Sarissa.clearChildNodes=function(oNode){while(oNode.firstChild){oNode.removeChild(oNode.firstChild);}};Sarissa.copyChildNodes=function(nodeFrom,nodeTo,bPreserveExisting){if(Sarissa._SARISSA_IS_SAFARI&&nodeTo.nodeType==Node.DOCUMENT_NODE){nodeTo=nodeTo.documentElement;}
 | 
			
		||||
if((!nodeFrom)||(!nodeTo)){throw"Both source and destination nodes must be provided";}
 | 
			
		||||
if(!bPreserveExisting){Sarissa.clearChildNodes(nodeTo);}
 | 
			
		||||
var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE?nodeTo:nodeTo.ownerDocument;var nodes=nodeFrom.childNodes;var i;if(typeof(ownerDoc.importNode)!="undefined"){for(i=0;i<nodes.length;i++){nodeTo.appendChild(ownerDoc.importNode(nodes[i],true));}}else{for(i=0;i<nodes.length;i++){nodeTo.appendChild(nodes[i].cloneNode(true));}}};Sarissa.moveChildNodes=function(nodeFrom,nodeTo,bPreserveExisting){if((!nodeFrom)||(!nodeTo)){throw"Both source and destination nodes must be provided";}
 | 
			
		||||
if(!bPreserveExisting){Sarissa.clearChildNodes(nodeTo);}
 | 
			
		||||
var nodes=nodeFrom.childNodes;if(nodeFrom.ownerDocument==nodeTo.ownerDocument){while(nodeFrom.firstChild){nodeTo.appendChild(nodeFrom.firstChild);}}else{var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE?nodeTo:nodeTo.ownerDocument;var i;if(typeof(ownerDoc.importNode)!="undefined"){for(i=0;i<nodes.length;i++){nodeTo.appendChild(ownerDoc.importNode(nodes[i],true));}}else{for(i=0;i<nodes.length;i++){nodeTo.appendChild(nodes[i].cloneNode(true));}}
 | 
			
		||||
Sarissa.clearChildNodes(nodeFrom);}};Sarissa.xmlize=function(anyObject,objectName,indentSpace){indentSpace=indentSpace?indentSpace:'';var s=indentSpace+'<'+objectName+'>';var isLeaf=false;if(!(anyObject instanceof Object)||anyObject instanceof Number||anyObject instanceof String||anyObject instanceof Boolean||anyObject instanceof Date){s+=Sarissa.escape(""+anyObject);isLeaf=true;}else{s+="\n";var isArrayItem=anyObject instanceof Array;for(var name in anyObject){s+=Sarissa.xmlize(anyObject[name],(isArrayItem?"array-item key=\""+name+"\"":name),indentSpace+"   ");}
 | 
			
		||||
s+=indentSpace;}
 | 
			
		||||
return(s+=(objectName.indexOf(' ')!=-1?"</array-item>\n":"</"+objectName+">\n"));};Sarissa.escape=function(sXml){return sXml.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");};Sarissa.unescape=function(sXml){return sXml.replace(/'/g,"'").replace(/"/g,"\"").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&");};Sarissa.updateCursor=function(oTargetElement,sValue){if(oTargetElement&&oTargetElement.style&&oTargetElement.style.cursor!=undefined){oTargetElement.style.cursor=sValue;}};Sarissa.updateContentFromURI=function(sFromUrl,oTargetElement,xsltproc,callback,skipCache){try{Sarissa.updateCursor(oTargetElement,"wait");var xmlhttp=new XMLHttpRequest();xmlhttp.open("GET",sFromUrl,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){try{var oDomDoc=xmlhttp.responseXML;if(oDomDoc&&Sarissa.getParseErrorText(oDomDoc)==Sarissa.PARSED_OK){Sarissa.updateContentFromNode(xmlhttp.responseXML,oTargetElement,xsltproc);if(callback){callback(sFromUrl,oTargetElement);}}
 | 
			
		||||
else{throw Sarissa.getParseErrorText(oDomDoc);}}
 | 
			
		||||
catch(e){if(callback){callback(sFromUrl,oTargetElement,e);}
 | 
			
		||||
else{throw e;}}}};if(skipCache){var oldage="Sat, 1 Jan 2000 00:00:00 GMT";xmlhttp.setRequestHeader("If-Modified-Since",oldage);}
 | 
			
		||||
xmlhttp.send("");}
 | 
			
		||||
catch(e){Sarissa.updateCursor(oTargetElement,"auto");if(callback){callback(sFromUrl,oTargetElement,e);}
 | 
			
		||||
else{throw e;}}};Sarissa.updateContentFromNode=function(oNode,oTargetElement,xsltproc){try{Sarissa.updateCursor(oTargetElement,"wait");Sarissa.clearChildNodes(oTargetElement);var ownerDoc=oNode.nodeType==Node.DOCUMENT_NODE?oNode:oNode.ownerDocument;if(ownerDoc.parseError&&ownerDoc.parseError.errorCode!=0){var pre=document.createElement("pre");pre.appendChild(document.createTextNode(Sarissa.getParseErrorText(ownerDoc)));oTargetElement.appendChild(pre);}
 | 
			
		||||
else{if(xsltproc){oNode=xsltproc.transformToDocument(oNode);}
 | 
			
		||||
if(oTargetElement.tagName.toLowerCase()=="textarea"||oTargetElement.tagName.toLowerCase()=="input"){oTargetElement.value=new XMLSerializer().serializeToString(oNode);}
 | 
			
		||||
else{try{oTargetElement.appendChild(oTargetElement.ownerDocument.importNode(oNode,true));}
 | 
			
		||||
catch(e){oTargetElement.innerHTML=new XMLSerializer().serializeToString(oNode);}}}}
 | 
			
		||||
catch(e){throw e;}
 | 
			
		||||
finally{Sarissa.updateCursor(oTargetElement,"auto");}};Sarissa.formToQueryString=function(oForm){var qs="";for(var i=0;i<oForm.elements.length;i++){var oField=oForm.elements[i];var sFieldName=oField.getAttribute("name")?oField.getAttribute("name"):oField.getAttribute("id");if(sFieldName&&((!oField.disabled)||oField.type=="hidden")){switch(oField.type){case"hidden":case"text":case"textarea":case"password":qs+=sFieldName+"="+encodeURIComponent(oField.value)+"&";break;case"select-one":qs+=sFieldName+"="+encodeURIComponent(oField.options[oField.selectedIndex].value)+"&";break;case"select-multiple":for(var j=0;j<oField.length;j++){var optElem=oField.options[j];if(optElem.selected===true){qs+=sFieldName+"[]"+"="+encodeURIComponent(optElem.value)+"&";}}
 | 
			
		||||
break;case"checkbox":case"radio":if(oField.checked){qs+=sFieldName+"="+encodeURIComponent(oField.value)+"&";}
 | 
			
		||||
break;}}}
 | 
			
		||||
return qs.substr(0,qs.length-1);};Sarissa.updateContentFromForm=function(oForm,oTargetElement,xsltproc,callback){try{Sarissa.updateCursor(oTargetElement,"wait");var params=Sarissa.formToQueryString(oForm)+"&"+Sarissa.REMOTE_CALL_FLAG+"=true";var xmlhttp=new XMLHttpRequest();var bUseGet=oForm.getAttribute("method")&&oForm.getAttribute("method").toLowerCase()=="get";if(bUseGet){xmlhttp.open("GET",oForm.getAttribute("action")+"?"+params,true);}
 | 
			
		||||
else{xmlhttp.open('POST',oForm.getAttribute("action"),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.setRequestHeader("Content-length",params.length);xmlhttp.setRequestHeader("Connection","close");}
 | 
			
		||||
xmlhttp.onreadystatechange=function(){try{if(xmlhttp.readyState==4){var oDomDoc=xmlhttp.responseXML;if(oDomDoc&&Sarissa.getParseErrorText(oDomDoc)==Sarissa.PARSED_OK){Sarissa.updateContentFromNode(xmlhttp.responseXML,oTargetElement,xsltproc);if(callback){callback(oForm,oTargetElement);}}
 | 
			
		||||
else{throw Sarissa.getParseErrorText(oDomDoc);}}}
 | 
			
		||||
catch(e){if(callback){callback(oForm,oTargetElement,e);}
 | 
			
		||||
else{throw e;}}};xmlhttp.send(bUseGet?"":params);}
 | 
			
		||||
catch(e){Sarissa.updateCursor(oTargetElement,"auto");if(callback){callback(oForm,oTargetElement,e);}
 | 
			
		||||
else{throw e;}}
 | 
			
		||||
return false;};Sarissa.FUNCTION_NAME_REGEXP=new RegExp("");Sarissa.getFunctionName=function(oFunc,bForce){var name;if(!name){if(bForce){name="SarissaAnonymous"+Sarissa._getUniqueSuffix();window[name]=oFunc;}
 | 
			
		||||
else{name=null;}}
 | 
			
		||||
if(name){window[name]=oFunc;}
 | 
			
		||||
return name;};Sarissa.setRemoteJsonCallback=function(url,callback,callbackParam){if(!callbackParam){callbackParam="callback";}
 | 
			
		||||
var callbackFunctionName=Sarissa.getFunctionName(callback,true);var id="sarissa_json_script_id_"+Sarissa._getUniqueSuffix();var oHead=document.getElementsByTagName("head")[0];var scriptTag=document.createElement('script');scriptTag.type='text/javascript';scriptTag.id=id;scriptTag.onload=function(){};if(url.indexOf("?")!=-1){url+=("&"+callbackParam+"="+callbackFunctionName);}
 | 
			
		||||
else{url+=("?"+callbackParam+"="+callbackFunctionName);}
 | 
			
		||||
scriptTag.src=url;oHead.appendChild(scriptTag);return id;};
 | 
			
		||||
							
								
								
									
										34
									
								
								static/cms/js/jstree/_lib/sarissa_ieemu_xpath.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,34 @@
 | 
			
		|||
 | 
			
		||||
/* * ====================================================================
 | 
			
		||||
 * About: This a a compressed JS file from the Sarissa library. 
 | 
			
		||||
 * see http://dev.abiss.gr/sarissa
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright: Manos Batsis, http://dev.abiss.gr
 | 
			
		||||
 * 
 | 
			
		||||
 * Licence:
 | 
			
		||||
 * Sarissa is free software distributed under the GNU GPL version 2 
 | 
			
		||||
 * or higher, GNU LGPL version 2.1 or higher and Apache Software 
 | 
			
		||||
 * License 2.0 or higher. The licenses are available online see: 
 | 
			
		||||
 * http://www.gnu.org  
 | 
			
		||||
 * http://www.apache.org
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 
 | 
			
		||||
 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
 | 
			
		||||
 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 
 | 
			
		||||
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
 | 
			
		||||
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
 | 
			
		||||
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 | 
			
		||||
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 * ====================================================================*/
 | 
			
		||||
 | 
			
		||||
if(Sarissa._SARISSA_HAS_DOM_FEATURE&&document.implementation.hasFeature("XPath","3.0")){SarissaNodeList=function(i){this.length=i;};SarissaNodeList.prototype=[];SarissaNodeList.prototype.constructor=Array;SarissaNodeList.prototype.item=function(i){return(i<0||i>=this.length)?null:this[i];};SarissaNodeList.prototype.expr="";if(window.XMLDocument&&(!XMLDocument.prototype.setProperty)){XMLDocument.prototype.setProperty=function(x,y){};}
 | 
			
		||||
Sarissa.setXpathNamespaces=function(oDoc,sNsSet){oDoc._sarissa_useCustomResolver=true;var namespaces=sNsSet.indexOf(" ")>-1?sNsSet.split(" "):[sNsSet];oDoc._sarissa_xpathNamespaces=[];for(var i=0;i<namespaces.length;i++){var ns=namespaces[i];var colonPos=ns.indexOf(":");var assignPos=ns.indexOf("=");if(colonPos>0&&assignPos>colonPos+1){var prefix=ns.substring(colonPos+1,assignPos);var uri=ns.substring(assignPos+2,ns.length-1);oDoc._sarissa_xpathNamespaces[prefix]=uri;}else{throw"Bad format on namespace declaration(s) given";}}};XMLDocument.prototype._sarissa_useCustomResolver=false;XMLDocument.prototype._sarissa_xpathNamespaces=[];XMLDocument.prototype.selectNodes=function(sExpr,contextNode,returnSingle){var nsDoc=this;var nsresolver;if(this._sarissa_useCustomResolver){nsresolver=function(prefix){var s=nsDoc._sarissa_xpathNamespaces[prefix];if(s){return s;}
 | 
			
		||||
else{throw"No namespace URI found for prefix: '"+prefix+"'";}};}
 | 
			
		||||
else{nsresolver=this.createNSResolver(this.documentElement);}
 | 
			
		||||
var result=null;if(!returnSingle){var oResult=this.evaluate(sExpr,(contextNode?contextNode:this),nsresolver,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var nodeList=new SarissaNodeList(oResult.snapshotLength);nodeList.expr=sExpr;for(var i=0;i<nodeList.length;i++){nodeList[i]=oResult.snapshotItem(i);}
 | 
			
		||||
result=nodeList;}
 | 
			
		||||
else{result=this.evaluate(sExpr,(contextNode?contextNode:this),nsresolver,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}
 | 
			
		||||
return result;};Element.prototype.selectNodes=function(sExpr){var doc=this.ownerDocument;if(doc.selectNodes){return doc.selectNodes(sExpr,this);}
 | 
			
		||||
else{throw"Method selectNodes is only supported by XML Elements";}};XMLDocument.prototype.selectSingleNode=function(sExpr,contextNode){var ctx=contextNode?contextNode:null;return this.selectNodes(sExpr,ctx,true);};Element.prototype.selectSingleNode=function(sExpr){var doc=this.ownerDocument;if(doc.selectSingleNode){return doc.selectSingleNode(sExpr,this);}
 | 
			
		||||
else{throw"Method selectNodes is only supported by XML Elements";}};Sarissa.IS_ENABLED_SELECT_NODES=true;}
 | 
			
		||||
							
								
								
									
										80
									
								
								static/cms/js/jstree/flat.xsl
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,80 @@
 | 
			
		|||
<?xml 
 | 
			
		||||
	version="1.0" 
 | 
			
		||||
	encoding="utf-8" 
 | 
			
		||||
	?>
 | 
			
		||||
<xsl:stylesheet 
 | 
			
		||||
	version="1.0" 
 | 
			
		||||
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 | 
			
		||||
	>
 | 
			
		||||
<xsl:output 
 | 
			
		||||
	method="html" 
 | 
			
		||||
	encoding="utf-8" 
 | 
			
		||||
	omit-xml-declaration="yes" 
 | 
			
		||||
	standalone="no" 
 | 
			
		||||
	indent="no" 
 | 
			
		||||
	media-type="text/xml" 
 | 
			
		||||
	/>
 | 
			
		||||
 | 
			
		||||
<xsl:param name="theme_name" />
 | 
			
		||||
<xsl:param name="theme_path" />
 | 
			
		||||
 | 
			
		||||
<xsl:template match="/">
 | 
			
		||||
	<ul>
 | 
			
		||||
	<xsl:if test="$theme_name"><xsl:attribute name="class"><xsl:value-of select="$theme_name" /></xsl:attribute></xsl:if>
 | 
			
		||||
	<xsl:for-each select="//item[not(@parent_id) or @parent_id=0]">
 | 
			
		||||
		<xsl:call-template name="nodes">
 | 
			
		||||
			<xsl:with-param name="node" select="." />
 | 
			
		||||
			<xsl:with-param name="theme_path" select="$theme_path" />
 | 
			
		||||
		</xsl:call-template>
 | 
			
		||||
	</xsl:for-each>
 | 
			
		||||
	</ul>
 | 
			
		||||
</xsl:template>
 | 
			
		||||
 | 
			
		||||
<xsl:template name="nodes">
 | 
			
		||||
	<xsl:param name="node" />
 | 
			
		||||
	<xsl:param name="theme_path" />
 | 
			
		||||
 | 
			
		||||
	<xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) > 0" />
 | 
			
		||||
	
 | 
			
		||||
	<li>
 | 
			
		||||
	<xsl:attribute name="class">
 | 
			
		||||
		<xsl:if test="position() = last()"> last </xsl:if>
 | 
			
		||||
		<xsl:choose>
 | 
			
		||||
			<xsl:when test="@state = 'open'"> open </xsl:when>
 | 
			
		||||
			<xsl:when test="$children or @hasChildren"> closed </xsl:when>
 | 
			
		||||
			<xsl:otherwise> leaf </xsl:otherwise>
 | 
			
		||||
		</xsl:choose>
 | 
			
		||||
		<xsl:value-of select="@class" />
 | 
			
		||||
	</xsl:attribute>
 | 
			
		||||
	<xsl:for-each select="@*">
 | 
			
		||||
		<xsl:if test="name() != 'parent_id' and name() != 'hasChildren' and name() != 'class' and name() != 'state'">
 | 
			
		||||
			<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
 | 
			
		||||
		</xsl:if>
 | 
			
		||||
	</xsl:for-each>
 | 
			
		||||
	<xsl:for-each select="content/name">
 | 
			
		||||
		<a href="#">
 | 
			
		||||
		<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>
 | 
			
		||||
		<xsl:attribute name="style">
 | 
			
		||||
			<xsl:value-of select="@style" />
 | 
			
		||||
			<xsl:if test="string-length(attribute::icon) > 0">background-image:url(<xsl:if test="not(contains(@icon,'/'))"><xsl:value-of select="$theme_path" /></xsl:if><xsl:value-of select="@icon" />);</xsl:if>
 | 
			
		||||
		</xsl:attribute>
 | 
			
		||||
		<xsl:for-each select="@*">
 | 
			
		||||
			<xsl:if test="name() != 'style' and name() != 'class'">
 | 
			
		||||
				<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
 | 
			
		||||
			</xsl:if>
 | 
			
		||||
		</xsl:for-each>
 | 
			
		||||
		<xsl:value-of select="." /></a>
 | 
			
		||||
	</xsl:for-each>
 | 
			
		||||
	<xsl:if test="$children or @hasChildren">
 | 
			
		||||
		<ul>
 | 
			
		||||
			<xsl:for-each select="//item[@parent_id=$node/attribute::id]">
 | 
			
		||||
				<xsl:call-template name="nodes">
 | 
			
		||||
					<xsl:with-param name="node" select="." />
 | 
			
		||||
					<xsl:with-param name="theme_path" select="$theme_path" />
 | 
			
		||||
				</xsl:call-template>
 | 
			
		||||
			</xsl:for-each>
 | 
			
		||||
		</ul>
 | 
			
		||||
	</xsl:if>
 | 
			
		||||
	</li>
 | 
			
		||||
</xsl:template>
 | 
			
		||||
</xsl:stylesheet>
 | 
			
		||||
							
								
								
									
										79
									
								
								static/cms/js/jstree/nested.xsl
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,79 @@
 | 
			
		|||
<?xml
 | 
			
		||||
	version="1.0"
 | 
			
		||||
	encoding="utf-8"
 | 
			
		||||
	?>
 | 
			
		||||
<xsl:stylesheet
 | 
			
		||||
	version="1.0"
 | 
			
		||||
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 | 
			
		||||
	>
 | 
			
		||||
<xsl:output
 | 
			
		||||
	method="html"
 | 
			
		||||
	encoding="utf-8"
 | 
			
		||||
	omit-xml-declaration="yes"
 | 
			
		||||
	standalone="no"
 | 
			
		||||
	indent="no"
 | 
			
		||||
	media-type="text/html"
 | 
			
		||||
	/>
 | 
			
		||||
 | 
			
		||||
<xsl:param name="theme_name" />
 | 
			
		||||
<xsl:param name="theme_path" />
 | 
			
		||||
 | 
			
		||||
<xsl:template match="/">
 | 
			
		||||
	<xsl:call-template name="nodes">
 | 
			
		||||
		<xsl:with-param name="node" select="/root" />
 | 
			
		||||
		<xsl:with-param name="theme_name" select="$theme_name" />
 | 
			
		||||
		<xsl:with-param name="theme_path" select="$theme_path" />
 | 
			
		||||
	</xsl:call-template>
 | 
			
		||||
</xsl:template>
 | 
			
		||||
 | 
			
		||||
<xsl:template name="nodes">
 | 
			
		||||
	<xsl:param name="node" />
 | 
			
		||||
	<xsl:param name="theme_name" />
 | 
			
		||||
	<xsl:param name="theme_path" />
 | 
			
		||||
 | 
			
		||||
	<ul>
 | 
			
		||||
	<xsl:if test="$theme_name"><xsl:attribute name="class"><xsl:value-of select="$theme_name" /></xsl:attribute></xsl:if>
 | 
			
		||||
	<xsl:for-each select="$node/item">
 | 
			
		||||
		<xsl:variable name="children" select="count(./item) > 0" />
 | 
			
		||||
		<li>
 | 
			
		||||
		<xsl:attribute name="class">
 | 
			
		||||
			<xsl:if test="position() = last()"> last </xsl:if>
 | 
			
		||||
			<xsl:choose>
 | 
			
		||||
				<xsl:when test="@state = 'open'"> open </xsl:when>
 | 
			
		||||
				<xsl:when test="$children or @hasChildren"> closed </xsl:when>
 | 
			
		||||
				<xsl:otherwise> leaf </xsl:otherwise>
 | 
			
		||||
			</xsl:choose>
 | 
			
		||||
			<xsl:value-of select="@class" />
 | 
			
		||||
		</xsl:attribute>
 | 
			
		||||
		<xsl:for-each select="@*">
 | 
			
		||||
			<xsl:if test="name() != 'class' and name() != 'state' and name() != 'hasChildren'">
 | 
			
		||||
				<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
 | 
			
		||||
			</xsl:if>
 | 
			
		||||
		</xsl:for-each>
 | 
			
		||||
		<xsl:for-each select="content/name">
 | 
			
		||||
			<a href="#">
 | 
			
		||||
			<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>
 | 
			
		||||
			<xsl:attribute name="style">
 | 
			
		||||
				<xsl:value-of select="@style" />
 | 
			
		||||
				<xsl:if test="string-length(attribute::icon) > 0">background-image:url(<xsl:if test="not(contains(@icon,'/'))"><xsl:value-of select="$theme_path" /></xsl:if><xsl:value-of select="@icon" />);</xsl:if>
 | 
			
		||||
			</xsl:attribute>
 | 
			
		||||
			<xsl:for-each select="@*">
 | 
			
		||||
				<xsl:if test="name() != 'style' and name() != 'class'">
 | 
			
		||||
					<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
 | 
			
		||||
				</xsl:if>
 | 
			
		||||
			</xsl:for-each>
 | 
			
		||||
			<xsl:value-of select="current()" /></a>
 | 
			
		||||
		</xsl:for-each>
 | 
			
		||||
 | 
			
		||||
		<xsl:if test="$children or @hasChildren">
 | 
			
		||||
			<xsl:call-template name="nodes">
 | 
			
		||||
				<xsl:with-param name="node" select="current()" />
 | 
			
		||||
				<xsl:with-param name="theme_path" select="$theme_path" />
 | 
			
		||||
			</xsl:call-template>
 | 
			
		||||
		</xsl:if>
 | 
			
		||||
		</li>
 | 
			
		||||
	</xsl:for-each>
 | 
			
		||||
	</ul>
 | 
			
		||||
</xsl:template>
 | 
			
		||||
 | 
			
		||||
</xsl:stylesheet>
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/classic/folder.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 365 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/classic/folderopen.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 370 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/classic/minus.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 80 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/classic/plus.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 82 B  | 
							
								
								
									
										48
									
								
								static/cms/js/jstree/themes/classic/style.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
.tree .tree-classic li.open {
 | 
			
		||||
	background:url("minus.gif") 2px 5px no-repeat;
 | 
			
		||||
}
 | 
			
		||||
.tree .tree-classic li.closed {
 | 
			
		||||
	background:url("plus.gif") 2px 5px no-repeat;
 | 
			
		||||
}
 | 
			
		||||
.tree .tree-classic #dragged li.open {
 | 
			
		||||
	background:url("plus.gif") 2px 5px no-repeat;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.tree .tree-classic li.open a {
 | 
			
		||||
	background-image:url("folderopen.gif");
 | 
			
		||||
}
 | 
			
		||||
.tree .tree-classic li.closed a {
 | 
			
		||||
	background-image:url("folder.gif");
 | 
			
		||||
}
 | 
			
		||||
.tree .tree-classic li.leaf a {
 | 
			
		||||
	background-image:url("folder.gif");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.tree .tree-classic li a {
 | 
			
		||||
	-moz-border-radius:0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.tree .tree-classic li a:hover {
 | 
			
		||||
	background-color:white;
 | 
			
		||||
	border-color:white;
 | 
			
		||||
}
 | 
			
		||||
.tree .tree-classic li a.clicked,
 | 
			
		||||
.tree .tree-classic li span.clicked {
 | 
			
		||||
	background-color:navy;
 | 
			
		||||
	border-color:navy;
 | 
			
		||||
	color:white;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.rtl .tree-classic li.open {
 | 
			
		||||
	background-position:right 5px;
 | 
			
		||||
	margin-right:-3px;
 | 
			
		||||
	padding-right:19px;
 | 
			
		||||
}
 | 
			
		||||
.rtl .tree-classic li.closed {
 | 
			
		||||
	background-position:right 5px;
 | 
			
		||||
	margin-right:-3px;
 | 
			
		||||
	padding-right:19px;
 | 
			
		||||
}
 | 
			
		||||
.rtl .tree-classic #dragged li.open {
 | 
			
		||||
	background-position: right 5px;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/context.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 35 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/create.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 3.3 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/dot.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 43 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/f.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 3.2 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/fminus.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 93 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/fminus_rtl.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 59 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/fplus.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 104 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/fplus_rtl.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 108 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/lastli.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 67 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/lastli_rtl.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 54 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/li.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 47 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/marker.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 85 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/marker_rtl.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 62 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/plus.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 73 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/remove.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 606 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/remove.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 720 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/rename.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 3.8 KiB  | 
							
								
								
									
										112
									
								
								static/cms/js/jstree/themes/default/style.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,112 @@
 | 
			
		|||
/* DOTS */
 | 
			
		||||
.tree .tree-default, 
 | 
			
		||||
.tree .tree-default ul {
 | 
			
		||||
	background-image:url("dot.gif");
 | 
			
		||||
}
 | 
			
		||||
.tree .tree-default li {
 | 
			
		||||
	background-image:url("li.gif");
 | 
			
		||||
}
 | 
			
		||||
.tree .tree-default li.last {
 | 
			
		||||
	background-image:url("lastli.gif");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* OPEN or CLOSED */
 | 
			
		||||
.tree .tree-default li.open {
 | 
			
		||||
	background:url("fminus.gif") 0px 0px no-repeat;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.tree .tree-default li.closed {
 | 
			
		||||
	background:url("fplus.gif") 0px 0px no-repeat;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.tree .tree-default #dragged li.open {
 | 
			
		||||
	background:url("fplus.gif") 5px 5px no-repeat;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* RIGHT TO LEFT SUPPORT */
 | 
			
		||||
.rtl .tree-default li {
 | 
			
		||||
	margin-right:1px;
 | 
			
		||||
}
 | 
			
		||||
.rtl .tree-default li.last {
 | 
			
		||||
	background-image:url("lastli_rtl.gif");
 | 
			
		||||
	margin-right:0;
 | 
			
		||||
	padding-right:16px;
 | 
			
		||||
}
 | 
			
		||||
.rtl .tree-default li.open {
 | 
			
		||||
	background:url("fminus_rtl.gif") right 6px no-repeat;
 | 
			
		||||
	margin-right:0;
 | 
			
		||||
	padding-right:16px;
 | 
			
		||||
}
 | 
			
		||||
.rtl .tree-default li.closed {
 | 
			
		||||
	background:url("fplus_rtl.gif") right 4px no-repeat;
 | 
			
		||||
	margin-right:0;
 | 
			
		||||
	padding-right:16px;
 | 
			
		||||
}
 | 
			
		||||
.rtl .tree-default #dragged li.open {
 | 
			
		||||
	background-position: right 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* DEFAULT ICON */
 | 
			
		||||
.tree .tree-default li a.title{
 | 
			
		||||
	background-image:url("f.png");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* CONTEXT MENU 
 | 
			
		||||
.tree .tree-default .context {
 | 
			
		||||
	width:160px;
 | 
			
		||||
	background:#F0F0F0 url("context.gif") 22px 0 repeat-y;
 | 
			
		||||
	border:1px solid silver;
 | 
			
		||||
}
 | 
			
		||||
.tree .tree-default .context a, 
 | 
			
		||||
.tree .tree-default .context a:hover {
 | 
			
		||||
	text-decoration:none;
 | 
			
		||||
	color:black;
 | 
			
		||||
	text-indent:26px;
 | 
			
		||||
	line-height:20px;
 | 
			
		||||
	background-repeat: no-repeat;
 | 
			
		||||
	background-position: 3px center;
 | 
			
		||||
	padding:1px 0;
 | 
			
		||||
}
 | 
			
		||||
.tree .tree-default .context a:hover {
 | 
			
		||||
	background-color: #e7f4f9;
 | 
			
		||||
	border:1px solid #d8f0fa;
 | 
			
		||||
	background-position: 2px center;
 | 
			
		||||
	padding:0;
 | 
			
		||||
	text-indent:25px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.tree .tree-default .context .separator {
 | 
			
		||||
	background:#FFFFFF;;
 | 
			
		||||
	border-top:1px solid #E0E0E0;
 | 
			
		||||
	font-size:1px;
 | 
			
		||||
	height:1px;
 | 
			
		||||
	line-height:1px;
 | 
			
		||||
	margin:0 2px 0 24px;
 | 
			
		||||
	min-height:1px;
 | 
			
		||||
	display:block;
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
.tree .tree-default a:hover{
 | 
			
		||||
	background-color:transparent;
 | 
			
		||||
	border-color:#fff;
 | 
			
		||||
	
 | 
			
		||||
}*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#sitemap li div{display:inline;}
 | 
			
		||||
#sitemap li .cont{
 | 
			
		||||
	display:block;
 | 
			
		||||
	height:28px;
 | 
			
		||||
	border:1px solid #DEDEDC;
 | 
			
		||||
	border-top:none;
 | 
			
		||||
	border-right:none;
 | 
			
		||||
	overflow:hidden;
 | 
			
		||||
}
 | 
			
		||||
#sitemap li .col1{	
 | 
			
		||||
	float:left;
 | 
			
		||||
}
 | 
			
		||||
#sitemap li .col2{
 | 
			
		||||
	float:right;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/jstree/themes/default/throbber.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.8 KiB  | 
							
								
								
									
										236
									
								
								static/cms/js/jstree/tree_component.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,236 @@
 | 
			
		|||
/* TREE LAYOUT */
 | 
			
		||||
.tree ul {
 | 
			
		||||
	margin:0 0 0 5px;
 | 
			
		||||
	padding:0;
 | 
			
		||||
	list-style-type:none;
 | 
			
		||||
}
 | 
			
		||||
.tree li {
 | 
			
		||||
	display:block;
 | 
			
		||||
	min-height:18px;
 | 
			
		||||
	line-height:18px;
 | 
			
		||||
	padding:0 0 0 15px;
 | 
			
		||||
	margin:0 0 0 0;
 | 
			
		||||
	clear:both;
 | 
			
		||||
}
 | 
			
		||||
.tree li ul {
 | 
			
		||||
	display:none;
 | 
			
		||||
	clear:both;
 | 
			
		||||
}
 | 
			
		||||
/*
 | 
			
		||||
.tree li a,
 | 
			
		||||
.tree li span {
 | 
			
		||||
	display:inline;
 | 
			
		||||
	float:left;
 | 
			
		||||
	line-height:16px;
 | 
			
		||||
	height:16px;
 | 
			
		||||
	padding:1px 4px 1px 23px !important;
 | 
			
		||||
	color:black;
 | 
			
		||||
	white-space:nowrap;
 | 
			
		||||
	text-decoration:none;
 | 
			
		||||
	background-color:transparent;
 | 
			
		||||
	background-repeat:no-repeat;
 | 
			
		||||
	background-position:4px 1px; 
 | 
			
		||||
	-moz-border-radius:3px;
 | 
			
		||||
	border:0;
 | 
			
		||||
	margin:0;
 | 
			
		||||
}*/
 | 
			
		||||
/*
 | 
			
		||||
.tree li a:hover, 
 | 
			
		||||
.tree li a.hover {
 | 
			
		||||
	background-color: #e7f4f9;
 | 
			
		||||
	border:1px solid #d8f0fa;
 | 
			
		||||
	padding:0px 3px 0px 22px !important;
 | 
			
		||||
	background-position:3px 0px; 
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
.tree li a.clicked,
 | 
			
		||||
.tree li a.clicked:hover,
 | 
			
		||||
.tree li span.clicked {
 | 
			
		||||
	background-color: #beebff;
 | 
			
		||||
	border:1px solid #99defd;
 | 
			
		||||
	padding:0px 3px 0px 22px !important;
 | 
			
		||||
	background-position:3px 0px; 
 | 
			
		||||
}*/
 | 
			
		||||
.tree li span.clicked {
 | 
			
		||||
	padding:0px 3px 0px 20px !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.tree li a input,
 | 
			
		||||
.tree li span input {
 | 
			
		||||
	margin:0;
 | 
			
		||||
	padding:0 0;
 | 
			
		||||
	display:block;
 | 
			
		||||
	height:12px !important;
 | 
			
		||||
	border:1px solid white;
 | 
			
		||||
	background:white;
 | 
			
		||||
	font-size:10px;
 | 
			
		||||
	font-family:Verdana;
 | 
			
		||||
}
 | 
			
		||||
.tree li a input:not([class="xxx"]),
 | 
			
		||||
.tree li span input:not([class="xxx"]) {
 | 
			
		||||
	padding:1px 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.locked li a {
 | 
			
		||||
	color:gray;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* FOR DOTS */
 | 
			
		||||
.tree ul {
 | 
			
		||||
	background-position:6px 1px;
 | 
			
		||||
	background-repeat:repeat-y;
 | 
			
		||||
}
 | 
			
		||||
.tree li {
 | 
			
		||||
	background-position:7px center;
 | 
			
		||||
	background-repeat:no-repeat;
 | 
			
		||||
}
 | 
			
		||||
.tree li.last {
 | 
			
		||||
	background-position:5px top;
 | 
			
		||||
	background-repeat:no-repeat;
 | 
			
		||||
}
 | 
			
		||||
/* NO DOTS */
 | 
			
		||||
.no_dots ul {
 | 
			
		||||
	background:transparent;
 | 
			
		||||
}
 | 
			
		||||
.no_dots li {
 | 
			
		||||
	background:transparent;
 | 
			
		||||
}
 | 
			
		||||
.no_dots li.last {
 | 
			
		||||
	background:transparent;
 | 
			
		||||
	background-color:transparent !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* OPEN OR CLOSE */
 | 
			
		||||
.tree li.open ul {
 | 
			
		||||
	display:block;
 | 
			
		||||
	clear:both;
 | 
			
		||||
}
 | 
			
		||||
.tree li.closed ul {
 | 
			
		||||
	display:none !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* FOR DRAGGING */
 | 
			
		||||
.tree #dragged {
 | 
			
		||||
	padding:0 3px;
 | 
			
		||||
	margin:0;
 | 
			
		||||
	background:white;
 | 
			
		||||
	opacity: .85;
 | 
			
		||||
	filter: alpha(opacity=85);
 | 
			
		||||
 | 
			
		||||
	position:absolute;
 | 
			
		||||
	top:-10px;
 | 
			
		||||
	left:-10px;
 | 
			
		||||
}
 | 
			
		||||
.tree #dragged.last,
 | 
			
		||||
.tree #dragged:last-child {
 | 
			
		||||
	background:white;
 | 
			
		||||
}
 | 
			
		||||
.tree #dragged ul ul {
 | 
			
		||||
	display:none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* HACKY-HACKY */
 | 
			
		||||
/* EXPLORER 7 */
 | 
			
		||||
*:first-child+html .tree li {
 | 
			
		||||
	margin-bottom:-2px;
 | 
			
		||||
} 
 | 
			
		||||
*:first-child+html .tree li ul {
 | 
			
		||||
	padding-bottom:2px;
 | 
			
		||||
}
 | 
			
		||||
/* EXPLORER 6 */
 | 
			
		||||
 | 
			
		||||
.tree li {
 | 
			
		||||
	/*_width:50%;*/
 | 
			
		||||
	_margin-bottom:-2px;
 | 
			
		||||
}
 | 
			
		||||
.tree li ul {
 | 
			
		||||
	_padding-bottom:2px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
 * FF & OPERA FIXES
 | 
			
		||||
.tree li:not([class="xxx"]) {
 | 
			
		||||
	margin-bottom:0px;
 | 
			
		||||
}
 | 
			
		||||
html:first-child .tree li {
 | 
			
		||||
	margin-bottom:0px;
 | 
			
		||||
}
 | 
			
		||||
.tree li ul:not([class="xxx"]) {
 | 
			
		||||
	padding-bottom:0;
 | 
			
		||||
}
 | 
			
		||||
html:first-child .tree ul {
 | 
			
		||||
	padding-bottom:0;
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* RTL modification */
 | 
			
		||||
.rtl * {
 | 
			
		||||
	direction:rtl;
 | 
			
		||||
}
 | 
			
		||||
.rtl ul {
 | 
			
		||||
	margin:0 5px 0 0;
 | 
			
		||||
}
 | 
			
		||||
.rtl li {
 | 
			
		||||
	padding:0 15px 0 0;
 | 
			
		||||
}
 | 
			
		||||
.rtl li.last {
 | 
			
		||||
	background-position:right top;
 | 
			
		||||
}
 | 
			
		||||
.rtl li a,
 | 
			
		||||
.rtl li span {
 | 
			
		||||
	float:right;
 | 
			
		||||
	padding:1px 23px 1px 4px !important;
 | 
			
		||||
	background-position:right 1px; 
 | 
			
		||||
	margin-right:1px;
 | 
			
		||||
}
 | 
			
		||||
.rtl li a:hover, 
 | 
			
		||||
.rtl li a.hover {
 | 
			
		||||
	background-color: #e7f4f9;
 | 
			
		||||
	border:1px solid #d8f0fa;
 | 
			
		||||
	padding:0px 23px 0px 3px !important;
 | 
			
		||||
	background-position:right 0px; 
 | 
			
		||||
	margin-right:0px;
 | 
			
		||||
}
 | 
			
		||||
.rtl li a.clicked,
 | 
			
		||||
.rtl li a.clicked:hover,
 | 
			
		||||
.rtl li span.clicked {
 | 
			
		||||
	background-color: #beebff;
 | 
			
		||||
	border:1px solid #99defd;
 | 
			
		||||
	padding:0px 23px 0px 3px !important;
 | 
			
		||||
	background-position:right 0px; 
 | 
			
		||||
	margin-right:0px;
 | 
			
		||||
}
 | 
			
		||||
.rtl li span.clicked {
 | 
			
		||||
	padding:0px 21px 0px 3px !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.rtl ul {
 | 
			
		||||
	background-position:right 1px;
 | 
			
		||||
}
 | 
			
		||||
.rtl li {
 | 
			
		||||
	background-position:right center;
 | 
			
		||||
}
 | 
			
		||||
.rtl #dragged li.open {
 | 
			
		||||
	background-position: right 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* CONTEXT MENU */
 | 
			
		||||
.tree .context {
 | 
			
		||||
	display:none;
 | 
			
		||||
	position:absolute;
 | 
			
		||||
	list-style-type:none;
 | 
			
		||||
	margin:0;
 | 
			
		||||
	padding:0;
 | 
			
		||||
}
 | 
			
		||||
.tree .context .separator {
 | 
			
		||||
	display:none;
 | 
			
		||||
}
 | 
			
		||||
.tree .context a {
 | 
			
		||||
	display:block;
 | 
			
		||||
	margin:0;
 | 
			
		||||
	padding:0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1761
									
								
								static/cms/js/jstree/tree_component.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										6
									
								
								static/cms/js/libs/class.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
/*!
 | 
			
		||||
 * @author      Angelo Dini
 | 
			
		||||
 * @version     1.0
 | 
			
		||||
 * @copyright	Distributed under the BSD License.
 | 
			
		||||
 */
 | 
			
		||||
(function(){var d="1.0";var c=window.Class;var b=window.Class=function(n){n=n||{};var m=function(){return(this.initialize)?this.initialize.apply(this,arguments):j};if(n.implement){var j=window===this?g(m.prototype):this;var l=n.implement;a(n,"implement");n=f(n,e(l))}m.prototype=g(n);m.constructor=m;m._parent=g(n);for(var k=0,h=["extend","implement","getOptions","setOptions"];k<h.length;k++){m[h[k]]=b[h[k]]}return m};b.extend=function(j){var h=this;if(j.implement){this.prototype=f(this.prototype,e(j.implement));a(j,"implement")}for(var i in j){j[i]=typeof j[i]==="function"&&/parent/.test(j[i].toString())?(function(l,k){return function(){this.parent=h._parent[k];return l.apply(this,arguments)}})(j[i],i):j[i]}this._parent=f(this._parent,j,true);this.prototype=f(this.prototype,j);return this};b.implement=function(h){return this.prototype=f(this.prototype,e(h))};b.getOptions=function(){return this.prototype.options||{}};b.setOptions=function(h){return this.prototype.options=f(this.prototype.options,h)};b.noConflict=function(){window.Class=c;return b};b.version=d;function g(i){var h=function(){};h.prototype=i.prototype||i;return new h()}function a(l,i,k){if(k){var h={};for(var j in l){if(j!==i){h[j]=l[j]}}}else{delete l[i]}return h||l}function f(h,i,k){if(!h||!i){return h||i||{}}h=g(h);i=g(i);for(var j in i){if(Object.prototype.toString.call(i[j])==="[object Object]"){f(h[j],i[j])}else{h[j]=(k&&h[j])?h[j]:i[j]}}return h}function e(l){var k={};for(var h=0;h<l.length;h++){if(typeof(l[h])==="function"){l[h]=l[h].prototype}var j=a(l[h],"initialize",true);if(j.implement){k=e(j.implement)}else{k=f(k,j)}}return k}})();
 | 
			
		||||
							
								
								
									
										4
									
								
								static/cms/js/libs/jquery.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										4
									
								
								static/cms/js/libs/swfobject.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										79
									
								
								static/cms/js/modules/cms.app_hook_select.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,79 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS.API# */
 | 
			
		||||
/* global apphooks_configuration */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
 | 
			
		||||
	var appHooks = $('#application_urls'),
 | 
			
		||||
		selected = appHooks.find('option:selected'),
 | 
			
		||||
		appNsRow = $('.form-row.application_namespace'),
 | 
			
		||||
		appNs = appNsRow.find('#id_application_namespace'),
 | 
			
		||||
		appCfgsRow = $('.form-row.application_configs'),
 | 
			
		||||
		appCfgs = appCfgsRow.find('#application_configs'),
 | 
			
		||||
		appCfgsAdd = appCfgsRow.find('#add_application_configs'),
 | 
			
		||||
		original_ns = appNs.val();
 | 
			
		||||
 | 
			
		||||
	// Shows / hides namespace / config selection widgets depending on the user input
 | 
			
		||||
	appHooks.setupNamespaces = function() {
 | 
			
		||||
		var opt = $(this).find('option:selected');
 | 
			
		||||
 | 
			
		||||
		if($(appCfgs).length > 0 && apphooks_configuration[opt.val()]){
 | 
			
		||||
			appCfgs.html('');
 | 
			
		||||
			for(var i=0; i < apphooks_configuration[opt.val()].length; i++) {
 | 
			
		||||
				selectedCfgs = '';
 | 
			
		||||
				if(apphooks_configuration[opt.val()][i][0] == apphooks_configuration_value) {
 | 
			
		||||
					selectedCfgs = 'selected="selected"';
 | 
			
		||||
				}
 | 
			
		||||
				appCfgs.append('<option ' + selectedCfgs + ' value="' + apphooks_configuration[opt.val()][i][0] + '">' + apphooks_configuration[opt.val()][i][1] + '</option>')
 | 
			
		||||
			}
 | 
			
		||||
			appCfgsAdd.attr('href', apphooks_configuration_url[opt.val()]);
 | 
			
		||||
			appCfgsRow.removeClass('hidden');
 | 
			
		||||
			appNsRow.addClass('hidden');
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			appCfgsRow.addClass('hidden');
 | 
			
		||||
			if(opt.data('namespace')) {
 | 
			
		||||
				appNsRow.removeClass('hidden');
 | 
			
		||||
			}
 | 
			
		||||
			else {
 | 
			
		||||
				appNsRow.addClass('hidden');
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	// Hide the namespace widgets if its not required.
 | 
			
		||||
	appHooks.setupNamespaces();
 | 
			
		||||
 | 
			
		||||
	// Show it if we change to an app_hook that requires a namespace
 | 
			
		||||
	appHooks.on('change', function(){
 | 
			
		||||
		var self = $(this),
 | 
			
		||||
			opt = self.find('option:selected');
 | 
			
		||||
 | 
			
		||||
		appHooks.setupNamespaces();
 | 
			
		||||
 | 
			
		||||
		// If we clear the app_hook, clear out the app_namespace too
 | 
			
		||||
		if (!self.val()) {
 | 
			
		||||
			appNs.val('');
 | 
			
		||||
			appNs.removeAttr('value');
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// When selecting back the original apphook we try
 | 
			
		||||
		// to restore the original configuration
 | 
			
		||||
		if(selected.val() == opt.val()) {
 | 
			
		||||
			if(original_ns) {
 | 
			
		||||
				appNs.val(original_ns);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// If new apphook has a namespace, suggest the default
 | 
			
		||||
		else if (opt.data('namespace')) {
 | 
			
		||||
			appNs.val(opt.data('namespace'));
 | 
			
		||||
		}
 | 
			
		||||
		// Cleanup the whole thing
 | 
			
		||||
		else {
 | 
			
		||||
			appNs.val('');
 | 
			
		||||
			appNs.removeAttr('value');
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
							
								
								
									
										242
									
								
								static/cms/js/modules/cms.base.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,242 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS# */
 | 
			
		||||
 | 
			
		||||
// ensuring django namespace is set correctly
 | 
			
		||||
window.django = window.django || undefined;
 | 
			
		||||
 | 
			
		||||
// ensuring jQuery namespace is set correctly
 | 
			
		||||
window.jQuery = (django && django.jQuery) ? django.jQuery : window.jQuery || undefined;
 | 
			
		||||
 | 
			
		||||
// ensuring Class namespace is set correctly
 | 
			
		||||
window.Class = window.Class || undefined;
 | 
			
		||||
 | 
			
		||||
// ensuring CMS namespace is set correctly
 | 
			
		||||
var CMS = {
 | 
			
		||||
	'$': (typeof jQuery === 'function') ? jQuery : undefined,
 | 
			
		||||
	'Class': (typeof Class === 'function') ? Class : undefined,
 | 
			
		||||
	'API': {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*##################################################|*/
 | 
			
		||||
/* #CMS.API# */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
	/*!
 | 
			
		||||
	 * CNS.API.Helpers
 | 
			
		||||
	 * Multiple helpers used accross all CMS features
 | 
			
		||||
	 */
 | 
			
		||||
	CMS.API.Helpers = {
 | 
			
		||||
 | 
			
		||||
		// redirects to a specific url or reloads browser
 | 
			
		||||
		reloadBrowser: function (url, timeout, ajax) {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			// is there a parent window?
 | 
			
		||||
			var parent = (window.parent) ? window.parent : window;
 | 
			
		||||
 | 
			
		||||
			// if there is an ajax reload, prioritize
 | 
			
		||||
			if(ajax) {
 | 
			
		||||
				parent.CMS.API.locked = true;
 | 
			
		||||
				// check if the url has changed, if true redirect to the new path
 | 
			
		||||
				// this requires an ajax request
 | 
			
		||||
				$.ajax({
 | 
			
		||||
					'async': false,
 | 
			
		||||
					'type': 'GET',
 | 
			
		||||
					'url': parent.CMS.config.request.url,
 | 
			
		||||
					'data': {
 | 
			
		||||
						'model': parent.CMS.config.request.model,
 | 
			
		||||
						'pk': parent.CMS.config.request.pk
 | 
			
		||||
					},
 | 
			
		||||
					'success': function (response) {
 | 
			
		||||
						parent.CMS.API.locked = false;
 | 
			
		||||
 | 
			
		||||
						if(response === '' && !url) {
 | 
			
		||||
							// cancel if response is empty
 | 
			
		||||
							return false;
 | 
			
		||||
						} else if(parent.location.pathname !== response) {
 | 
			
		||||
							// api call to the backend to check if the current path is still the same
 | 
			
		||||
							that.reloadBrowser(response);
 | 
			
		||||
						} else if(url === 'REFRESH_PAGE') {
 | 
			
		||||
							// if on_close provides REFRESH_PAGE, only do a reload
 | 
			
		||||
							that.reloadBrowser();
 | 
			
		||||
						} else if(url) {
 | 
			
		||||
							// on_close can also provide a url, reload to the new destination
 | 
			
		||||
							that.reloadBrowser(url);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				// cancel further operations
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// add timeout if provided
 | 
			
		||||
			parent.setTimeout(function () {
 | 
			
		||||
				if (url && url != parent.location.href) {
 | 
			
		||||
					// location.reload() takes precedence over this, so we
 | 
			
		||||
					// don't want to reload the page if we need a redirect
 | 
			
		||||
					parent.location.href = url;
 | 
			
		||||
				}
 | 
			
		||||
				else {
 | 
			
		||||
					// ensure page is always reloaded #3413
 | 
			
		||||
					parent.location.reload()
 | 
			
		||||
				}
 | 
			
		||||
			}, timeout || 0);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// disable multiple form submissions
 | 
			
		||||
		preventSubmit: function () {
 | 
			
		||||
			var forms = $('#cms_toolbar').find('form');
 | 
			
		||||
				forms.submit(function () {
 | 
			
		||||
					// show loader
 | 
			
		||||
					CMS.API.Toolbar._loader(true);
 | 
			
		||||
					// we cannot use disabled as the name action will be ignored
 | 
			
		||||
					$('input[type="submit"]').bind('click', function (e) {
 | 
			
		||||
						e.preventDefault();
 | 
			
		||||
					}).css('opacity', 0.5);
 | 
			
		||||
				});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// fixes csrf behaviour
 | 
			
		||||
		csrf: function (csrf_token) {
 | 
			
		||||
			$.ajaxSetup({
 | 
			
		||||
				beforeSend: function (xhr) {
 | 
			
		||||
					// set csrf_token
 | 
			
		||||
					xhr.setRequestHeader("X-CSRFToken", csrf_token);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// handles the tooltip for the plugins
 | 
			
		||||
		showTooltip: function (name, id) {
 | 
			
		||||
			var tooltip = $('.cms_tooltip');
 | 
			
		||||
 | 
			
		||||
			// change css and attributes
 | 
			
		||||
			tooltip.css('visibility', 'visible')
 | 
			
		||||
				.data('plugin_id', id || null)
 | 
			
		||||
				.show()
 | 
			
		||||
				.find('span').html(name);
 | 
			
		||||
 | 
			
		||||
			// attaches move event
 | 
			
		||||
			// this sets the correct position for the edit tooltip
 | 
			
		||||
			$('body').bind('mousemove.cms', function (e) {
 | 
			
		||||
				// so lets figure out where we are
 | 
			
		||||
				var offset = 20;
 | 
			
		||||
				var relX = e.pageX - $(tooltip).offsetParent().offset().left;
 | 
			
		||||
				var relY = e.pageY - $(tooltip).offsetParent().offset().top;
 | 
			
		||||
				var bound = $(tooltip).offsetParent().width();
 | 
			
		||||
				var pos = relX + tooltip.outerWidth(true) + offset;
 | 
			
		||||
 | 
			
		||||
				tooltip.css({
 | 
			
		||||
					'left': (pos >= bound) ? relX - tooltip.outerWidth(true) - offset : relX + offset,
 | 
			
		||||
					'top': relY - 12
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// attach tooltip event for touch devices
 | 
			
		||||
			tooltip.bind('touchstart.cms', function () {
 | 
			
		||||
				$('.cms_plugin-' + $(this).data('plugin_id')).trigger('dblclick');
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		hideTooltip: function () {
 | 
			
		||||
			var tooltip = $('.cms_tooltip');
 | 
			
		||||
 | 
			
		||||
			// change css
 | 
			
		||||
			tooltip.css('visibility', 'hidden').hide();
 | 
			
		||||
 | 
			
		||||
			// unbind events
 | 
			
		||||
			$('body').unbind('mousemove.cms');
 | 
			
		||||
			tooltip.unbind('touchstart.cms');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// sends or retrieves a JSON from localStorage or the session if local storage is not available
 | 
			
		||||
		setSettings: function (settings) {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			// merge settings
 | 
			
		||||
			settings = JSON.stringify($.extend({}, CMS.config.settings, settings));
 | 
			
		||||
			// set loader
 | 
			
		||||
			if(CMS.API.Toolbar) CMS.API.Toolbar._loader(true);
 | 
			
		||||
 | 
			
		||||
			// use local storage or session
 | 
			
		||||
			if(window.localStorage) {
 | 
			
		||||
				// save within local storage
 | 
			
		||||
				localStorage.setItem('cms_cookie', settings);
 | 
			
		||||
				if(CMS.API.Toolbar) CMS.API.Toolbar._loader(false);
 | 
			
		||||
			} else {
 | 
			
		||||
				// save within session
 | 
			
		||||
				CMS.API.locked = true;
 | 
			
		||||
 | 
			
		||||
				$.ajax({
 | 
			
		||||
					'async': false,
 | 
			
		||||
					'type': 'POST',
 | 
			
		||||
					'url': CMS.config.urls.settings,
 | 
			
		||||
					'data': {
 | 
			
		||||
						'csrfmiddlewaretoken': this.config.csrf,
 | 
			
		||||
						'settings': settings
 | 
			
		||||
					},
 | 
			
		||||
					'success': function (data) {
 | 
			
		||||
						CMS.API.locked = false;
 | 
			
		||||
						// determine if logged in or not
 | 
			
		||||
						settings = (data) ? JSON.parse(data) : CMS.config.settings;
 | 
			
		||||
						if(CMS.API.Toolbar) CMS.API.Toolbar._loader(false);
 | 
			
		||||
					},
 | 
			
		||||
					'error': function (jqXHR) {
 | 
			
		||||
						that.showError(jqXHR.response + ' | ' + jqXHR.status + ' ' + jqXHR.statusText);
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// save settings
 | 
			
		||||
			CMS.settings = JSON.parse(settings);
 | 
			
		||||
 | 
			
		||||
			// ensure new settings are returned
 | 
			
		||||
			return CMS.settings;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		getSettings: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var settings;
 | 
			
		||||
			// set loader
 | 
			
		||||
			if(CMS.API.Toolbar) CMS.API.Toolbar._loader(true);
 | 
			
		||||
 | 
			
		||||
			// use local storage or session
 | 
			
		||||
			if(window.localStorage) {
 | 
			
		||||
				// get from local storage
 | 
			
		||||
				settings = JSON.parse(localStorage.getItem('cms_cookie'));
 | 
			
		||||
				if(CMS.API.Toolbar) CMS.API.Toolbar._loader(false);
 | 
			
		||||
			} else {
 | 
			
		||||
				CMS.API.locked = true;
 | 
			
		||||
				// get from session
 | 
			
		||||
				$.ajax({
 | 
			
		||||
					'async': false,
 | 
			
		||||
					'type': 'GET',
 | 
			
		||||
					'url': CMS.config.urls.settings,
 | 
			
		||||
					'success': function (data) {
 | 
			
		||||
						CMS.API.locked = false;
 | 
			
		||||
						// determine if logged in or not
 | 
			
		||||
						settings = (data) ? JSON.parse(data) : CMS.config.settings;
 | 
			
		||||
						if(CMS.API.Toolbar) CMS.API.Toolbar._loader(false);
 | 
			
		||||
					},
 | 
			
		||||
					'error': function (jqXHR) {
 | 
			
		||||
						that.showError(jqXHR.response + ' | ' + jqXHR.status + ' ' + jqXHR.statusText);
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if(settings === null) settings = this.setSettings(CMS.config.settings);
 | 
			
		||||
 | 
			
		||||
			// save settings
 | 
			
		||||
			CMS.settings = settings;
 | 
			
		||||
 | 
			
		||||
			// ensure new settings are returned
 | 
			
		||||
			return CMS.settings;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	// autoinits
 | 
			
		||||
	CMS.API.Helpers.preventSubmit();
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
							
								
								
									
										67
									
								
								static/cms/js/modules/cms.changeform.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,67 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS# */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
 | 
			
		||||
	// set local variables
 | 
			
		||||
	var title= $('#id_title');
 | 
			
		||||
	var slug = $('#id_slug');
 | 
			
		||||
	var changed = false;
 | 
			
		||||
	var prefill = false;
 | 
			
		||||
 | 
			
		||||
	// hide rows when hidden input fields are added
 | 
			
		||||
	$('input[type="hidden"]').each(function () {
 | 
			
		||||
		$(this).parent('.form-row').hide()
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	// determine if slug is empty
 | 
			
		||||
	if(slug.val() === '') prefill = true;
 | 
			
		||||
 | 
			
		||||
	// always bind the title > slug generation and do the validation inside for better ux
 | 
			
		||||
	title.bind('keyup', function() {
 | 
			
		||||
		var value = title.val();
 | 
			
		||||
		// international language handling
 | 
			
		||||
		if(window.UNIHANDECODER) value = UNIHANDECODER.decode(value);
 | 
			
		||||
		// if slug is empty, prefill again
 | 
			
		||||
		if(prefill === false && slug.val() === '') prefill = true;
 | 
			
		||||
		// urlify
 | 
			
		||||
		var urlified = URLify(value, 64);
 | 
			
		||||
		if(prefill) slug.val(urlified);
 | 
			
		||||
	});
 | 
			
		||||
	// autocall
 | 
			
		||||
	title.trigger('keyup');
 | 
			
		||||
 | 
			
		||||
	// set focus to title
 | 
			
		||||
	title.focus();
 | 
			
		||||
 | 
			
		||||
	// all permissions and page states loader
 | 
			
		||||
	$('div.loading').each(function () {
 | 
			
		||||
		$(this).load($(this).attr('rel'));
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	// add changed data bindings to elements
 | 
			
		||||
	slug.add(title).bind('change', function () {
 | 
			
		||||
		$(this).data('changed', true);
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	// public api for changing the language tabs
 | 
			
		||||
	// used in admin/cms/page/change_form.html
 | 
			
		||||
	CMS.API.changeLanguage = function (url) {
 | 
			
		||||
		// also make sure that we will display the confirm dialog
 | 
			
		||||
		// in case users switch tabs while editing plugins
 | 
			
		||||
		var answer = true;
 | 
			
		||||
		if(slug.length) {
 | 
			
		||||
			// check if the slug has the changed attribute
 | 
			
		||||
			if(slug.data('changed') || title.data('changed')) changed = true;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(changed) {
 | 
			
		||||
			var question = gettext("Are you sure you want to change tabs without saving the page first?");
 | 
			
		||||
			answer = confirm(question);
 | 
			
		||||
		}
 | 
			
		||||
		if(answer) window.location.href = url;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
							
								
								
									
										779
									
								
								static/cms/js/modules/cms.changelist.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,779 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS# */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
	/*!
 | 
			
		||||
	 * TreeManager
 | 
			
		||||
	 * Handles treeview
 | 
			
		||||
	 * TODO this will be refactored in 3.1
 | 
			
		||||
	 */
 | 
			
		||||
	CMS.TreeManager = new CMS.Class({
 | 
			
		||||
 | 
			
		||||
		options: {
 | 
			
		||||
			'lang': {}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		initialize: function (options) {
 | 
			
		||||
			this.options = $.extend(true, {}, this.options, options);
 | 
			
		||||
 | 
			
		||||
			// load internal functions
 | 
			
		||||
			if(!this.options.settings.filtered) {
 | 
			
		||||
				this.setupFunctions();
 | 
			
		||||
				this.setupTreePublishing();
 | 
			
		||||
				this.setupUIHacks();
 | 
			
		||||
				this.setupGlobals();
 | 
			
		||||
				this.setupTree();
 | 
			
		||||
 | 
			
		||||
				// init tree component
 | 
			
		||||
				initTree();
 | 
			
		||||
			} else {
 | 
			
		||||
				// when filtered is active, prevent tree actions
 | 
			
		||||
				this.setupUIHacks();
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		setupFunctions: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			$.syncCols = function(){
 | 
			
		||||
				$('#sitemap .col-softroot').syncWidth(0);
 | 
			
		||||
				$('#sitemap .col-apphook').syncWidth(0);
 | 
			
		||||
				$('#sitemap .col-language').syncWidth(0);
 | 
			
		||||
				$('#sitemap .col-navigation').syncWidth(0);
 | 
			
		||||
				$('#sitemap .col-actions').syncWidth(0);
 | 
			
		||||
				$('#sitemap .col-info').syncWidth(0);
 | 
			
		||||
 | 
			
		||||
				that.refreshColumns.call($('ul.tree-default li'));
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			/* Colums width sync */
 | 
			
		||||
			$.fn.syncWidth = function(max) {
 | 
			
		||||
				var visible = false;
 | 
			
		||||
 | 
			
		||||
				$(this).each(function() {
 | 
			
		||||
					if($(this).is(':visible')) {
 | 
			
		||||
						visible = true;
 | 
			
		||||
						var val= $(this).width();
 | 
			
		||||
						if(val > max){
 | 
			
		||||
							max = val;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
				if (visible && max > 0) {
 | 
			
		||||
					$(this).each(function() {
 | 
			
		||||
						$(this).css('width', max);
 | 
			
		||||
					});
 | 
			
		||||
				}
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			// jquery.functional
 | 
			
		||||
			$.curry = function(fn) {
 | 
			
		||||
				if (arguments.length < 2) return fn;
 | 
			
		||||
				args = $.makeArray(arguments).slice(1, arguments.length);
 | 
			
		||||
				return function() {
 | 
			
		||||
					return fn.apply(this, args.concat($.makeArray(arguments)));
 | 
			
		||||
				}
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			$.__callbackPool = {};
 | 
			
		||||
 | 
			
		||||
			$.callbackRegister = function(name, fn /*, arg0, arg1, ..*/){
 | 
			
		||||
				if (arguments.length > 2) {
 | 
			
		||||
					// create curried function
 | 
			
		||||
					fn = $.curry.apply(this, $.makeArray(arguments).slice(1, arguments.length));
 | 
			
		||||
				}
 | 
			
		||||
				$.__callbackPool[name] = fn;
 | 
			
		||||
				return name;
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			$.callbackCall = function(name/*, extra arg0, extra arg1, ..*/){
 | 
			
		||||
				if (!name || !name in $.__callbackPool) {
 | 
			
		||||
					throw "No callback registered with name: " + name;
 | 
			
		||||
				}
 | 
			
		||||
				$.__callbackPool[name].apply(this, $.makeArray(arguments).slice(1, arguments.length));
 | 
			
		||||
				$.callbackRemove(name);
 | 
			
		||||
				return name;
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			$.callbackRemove = function(name) {
 | 
			
		||||
				delete $.__callbackPool[name];
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			// very simple yellow fade plugin..
 | 
			
		||||
			$.fn.yft = function(){
 | 
			
		||||
				this.effect("highlight", {}, 1000);
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			// jquery replace plugin :)
 | 
			
		||||
			$.fn.replace = function(o) {
 | 
			
		||||
				return this.after(o).remove().end();
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		setupTreePublishing: function () {
 | 
			
		||||
			// ADD DIRECT PUBLISHING
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var tree = $('.tree');
 | 
			
		||||
			var langTrigger = '.col-language .trigger-tooltip span';
 | 
			
		||||
			var langTooltips = '.language-tooltip';
 | 
			
		||||
			var langTimer = function () {};
 | 
			
		||||
			var langDelay = 100;
 | 
			
		||||
			var langFadeDuration = 200;
 | 
			
		||||
 | 
			
		||||
			// show the tooltip
 | 
			
		||||
			tree.delegate(langTrigger, 'mouseenter', function () {
 | 
			
		||||
				var el = $(this).closest('.col-language').find('.language-tooltip');
 | 
			
		||||
				var anchors = el.find('a');
 | 
			
		||||
				var span = $(this);
 | 
			
		||||
 | 
			
		||||
				// clear timer
 | 
			
		||||
				clearTimeout(langTimer);
 | 
			
		||||
 | 
			
		||||
				// cancel if tooltip already visible
 | 
			
		||||
				if(el.is(':visible')) return false;
 | 
			
		||||
 | 
			
		||||
				// set correct position
 | 
			
		||||
				el.css('right', 20 + $(this).position().left);
 | 
			
		||||
 | 
			
		||||
				// figure out what should be shown
 | 
			
		||||
				anchors.hide();
 | 
			
		||||
				if(span.hasClass('unpublished') || span.hasClass('unpublishedparent')) anchors.eq(1).show();
 | 
			
		||||
				if(span.hasClass('published')) anchors.eq(0).show();
 | 
			
		||||
				if(span.hasClass('dirty')) anchors.show().parent().addClass('language-tooltip-multiple');
 | 
			
		||||
 | 
			
		||||
				// hide all elements
 | 
			
		||||
				$(langTooltips).fadeOut(langDelay);
 | 
			
		||||
 | 
			
		||||
				// use a timeout to display the tooltip
 | 
			
		||||
				langTimer = setTimeout(function () {
 | 
			
		||||
					el.stop(true, true).fadeIn(langFadeDuration);
 | 
			
		||||
				}, langDelay);
 | 
			
		||||
			});
 | 
			
		||||
			// hide the tooltip when leaving the area
 | 
			
		||||
			tree.delegate(langTrigger, 'mouseleave', function () {
 | 
			
		||||
				// clear timer
 | 
			
		||||
				clearTimeout(langTimer);
 | 
			
		||||
				// hide all elements
 | 
			
		||||
				langTimer = setTimeout(function () {
 | 
			
		||||
					$(langTooltips).fadeOut(langFadeDuration);
 | 
			
		||||
				}, langDelay * 2);
 | 
			
		||||
			});
 | 
			
		||||
			// reset hiding when entering the tooltip itself
 | 
			
		||||
			tree.delegate(langTooltips, 'mouseover', function () {
 | 
			
		||||
				// clear timer
 | 
			
		||||
				clearTimeout(langTimer);
 | 
			
		||||
			});
 | 
			
		||||
			tree.delegate(langTooltips, 'mouseleave', function () {
 | 
			
		||||
				// hide all elements
 | 
			
		||||
				langTimer = setTimeout(function () {
 | 
			
		||||
					$(langTooltips).fadeOut(langFadeDuration);
 | 
			
		||||
				}, langDelay * 2);
 | 
			
		||||
			});
 | 
			
		||||
			// attach double check event if publish or unpublish should be triggered
 | 
			
		||||
			tree.delegate('.language-tooltip a', 'click', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
 | 
			
		||||
				// cancel if not confirmed
 | 
			
		||||
				if(!confirm(that.options.lang.publish.replace('§', $(this).text().toLowerCase()))) return false;
 | 
			
		||||
 | 
			
		||||
				// publish page and update
 | 
			
		||||
				window.location.href = $(this).attr('href');
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		setupUIHacks: function () {
 | 
			
		||||
			// enables tab click on title entry to open in new window
 | 
			
		||||
			$('.tree').delegate('.col1 .title', 'click', function (e) {
 | 
			
		||||
				if(!e.metaKey) {
 | 
			
		||||
					window.top.location.href = $(this).attr('href');
 | 
			
		||||
				} else {
 | 
			
		||||
					window.open($(this).attr('href'), '_blank');
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// adds functionality to the filter
 | 
			
		||||
			$('#changelist-filter-button').bind('click', function () {
 | 
			
		||||
				$("#changelist-filter").toggle();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// set correct active entry
 | 
			
		||||
			if(window.parent && window.parent.CMS && window.parent.CMS.config) {
 | 
			
		||||
				var page_id = window.parent.CMS.config.request.page_id;
 | 
			
		||||
 | 
			
		||||
				$('div[data-page_id="'+page_id+'"]').addClass('cont-active');
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		setupGlobals: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var msg = '';
 | 
			
		||||
			var parent = null;
 | 
			
		||||
 | 
			
		||||
			window.moveSuccess = function(node){
 | 
			
		||||
				$.syncCols();
 | 
			
		||||
 | 
			
		||||
				msg = $('<span class="success">'+that.options.lang.success+'</span>');
 | 
			
		||||
				parent = window.parent;
 | 
			
		||||
 | 
			
		||||
				node.after(msg);
 | 
			
		||||
				node.parent().find('.col2').hide();
 | 
			
		||||
				msg.fadeOut(1000, function () {
 | 
			
		||||
					node.parent().find('.col2').show()
 | 
			
		||||
				});
 | 
			
		||||
				// check for reload changes
 | 
			
		||||
				if(window.self !== window.top) {
 | 
			
		||||
					window.parent.CMS.API.Helpers.reloadBrowser(false, false, true);
 | 
			
		||||
					window.parent.CMS.API.Toolbar.openMessage(that.options.lang.changes, false, 0);
 | 
			
		||||
				}
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			window.moveError = function(node,message){
 | 
			
		||||
				if(message && message !== 'error') {
 | 
			
		||||
					msg = $('<span class="success">'+message+'</span>');
 | 
			
		||||
				}
 | 
			
		||||
				else {
 | 
			
		||||
					msg = $('<span class="success">'+that.options.lang.error+'</span>');
 | 
			
		||||
				}
 | 
			
		||||
				node.parent().find('.col2').hide();
 | 
			
		||||
				node.after(msg);
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		setupTree: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var tree;
 | 
			
		||||
			// global initTree function
 | 
			
		||||
			initTree = function(){
 | 
			
		||||
				tree = new tree_component();
 | 
			
		||||
				var options = {
 | 
			
		||||
					rules: {
 | 
			
		||||
						clickable: "all",
 | 
			
		||||
						renameable: "none",
 | 
			
		||||
						deletable: "all",
 | 
			
		||||
						creatable: "all",
 | 
			
		||||
						draggable: "all",
 | 
			
		||||
						dragrules: "all",
 | 
			
		||||
						droppable: "all",
 | 
			
		||||
						metadata : "mdata",
 | 
			
		||||
						use_inline: true
 | 
			
		||||
						//droppable : ["tree_drop"]
 | 
			
		||||
					},
 | 
			
		||||
					path: false,
 | 
			
		||||
					ui: {
 | 
			
		||||
						dots: true,
 | 
			
		||||
						rtl: false,
 | 
			
		||||
						animation: 0,
 | 
			
		||||
						hover_mode: true,
 | 
			
		||||
						//theme_path: script_url_path() + "/../jstree/themes/",
 | 
			
		||||
						a_class: "title"
 | 
			
		||||
					},
 | 
			
		||||
					cookies : {
 | 
			
		||||
						prefix: "djangocms_nodes"
 | 
			
		||||
					},
 | 
			
		||||
					callback: {
 | 
			
		||||
						beforemove  : function(what, where, position) {
 | 
			
		||||
							item_id = what.id.split("page_")[1];
 | 
			
		||||
							target_id = where.id.split("page_")[1];
 | 
			
		||||
							old_node = what;
 | 
			
		||||
 | 
			
		||||
							if($(what).parent().children("li").length > 1){
 | 
			
		||||
								if($(what).next("li").length){
 | 
			
		||||
									old_target = $(what).next("li")[0];
 | 
			
		||||
									old_position = "right";
 | 
			
		||||
								}
 | 
			
		||||
								if($(what).prev("li").length){
 | 
			
		||||
									old_target = $(what).prev("li")[0];
 | 
			
		||||
									old_position = "left";
 | 
			
		||||
								}
 | 
			
		||||
							}else{
 | 
			
		||||
								if($(what).attr("rel") != "topnode"){
 | 
			
		||||
									old_target = $(what).parent().parent()[0];
 | 
			
		||||
									old_position = "inside";
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
 | 
			
		||||
							addUndo(what, where, position);
 | 
			
		||||
							return true;
 | 
			
		||||
						},
 | 
			
		||||
						onmove: function(what, where, position){
 | 
			
		||||
							item_id = what.id.split("page_")[1];
 | 
			
		||||
							target_id = where.id.split("page_")[1];
 | 
			
		||||
 | 
			
		||||
							if (position == "before") {
 | 
			
		||||
								position = "left";
 | 
			
		||||
							}else if (position == "after") {
 | 
			
		||||
								position = "right";
 | 
			
		||||
							}else if(position == "inside"){
 | 
			
		||||
								position = "last-child";
 | 
			
		||||
							}
 | 
			
		||||
							moveTreeItem(what, item_id, target_id, position, false);
 | 
			
		||||
						},
 | 
			
		||||
 | 
			
		||||
						onload: function () {
 | 
			
		||||
							setTimeout(function () {
 | 
			
		||||
								reCalc();
 | 
			
		||||
							}, 250);
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
					}
 | 
			
		||||
				};
 | 
			
		||||
 | 
			
		||||
				if (!$($("div.tree").get(0)).hasClass('root_allow_children')){
 | 
			
		||||
					// disalow possibility for adding subnodes to main tree, user doesn't
 | 
			
		||||
					// have permissions for this
 | 
			
		||||
					options.rules.dragrules = ["node inside topnode", "topnode inside topnode", "node * node"];
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				tree.init($("div.tree"), options);
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			selected_page = false;
 | 
			
		||||
			action = false;
 | 
			
		||||
 | 
			
		||||
			var _oldAjax = $.ajax;
 | 
			
		||||
 | 
			
		||||
			$.ajax = function(s){
 | 
			
		||||
				// just override ajax function, so the loader message gets displayed
 | 
			
		||||
				// always
 | 
			
		||||
				$('#loader-message').show();
 | 
			
		||||
 | 
			
		||||
				callback = s.success || false;
 | 
			
		||||
				s.success = function(data, status){
 | 
			
		||||
					if (callback) {
 | 
			
		||||
						callback(data, status);
 | 
			
		||||
					}
 | 
			
		||||
					$('#loader-message').hide();
 | 
			
		||||
				};
 | 
			
		||||
 | 
			
		||||
				// just for debuging!!
 | 
			
		||||
				/*s.complete = function(xhr, status) {
 | 
			
		||||
					if (status == "error" && that.options.settings.debug) {
 | 
			
		||||
						$('body').before(xhr.responseText);
 | 
			
		||||
					}
 | 
			
		||||
				}*/
 | 
			
		||||
				// end just for debuging
 | 
			
		||||
 | 
			
		||||
				// TODO: add error state!
 | 
			
		||||
				return _oldAjax(s);
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			function refresh(){
 | 
			
		||||
				window.location = window.location.href;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			function refreshIfChildren(pageId){
 | 
			
		||||
				return $('#page_' + pageId).find('li[id^=page_]').length ? refresh : function(){ return true; };
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/**
 | 
			
		||||
			 * Loads remote dialog to dialogs div.
 | 
			
		||||
			 *
 | 
			
		||||
			 * @param {String} url
 | 
			
		||||
			 * @param {Object} data Data to be send over post
 | 
			
		||||
			 * @param {Function} noDialogCallback Gets called when response is empty.
 | 
			
		||||
			 * @param {Function} callback Standard callback function.
 | 
			
		||||
			 */
 | 
			
		||||
			function loadDialog(url, data, noDialogCallback, callback){
 | 
			
		||||
				if (data === undefined) data = {};
 | 
			
		||||
				$.post(url, data, function(response) {
 | 
			
		||||
					if (response == '' && noDialogCallback) noDialogCallback();
 | 
			
		||||
					$('#dialogs').empty().append(response);
 | 
			
		||||
					if (callback) callback(response);
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// let's start event delegation
 | 
			
		||||
			$('#changelist li').click(function(e) {
 | 
			
		||||
				// I want a link to check the class
 | 
			
		||||
				if(e.target.tagName == 'IMG' || e.target.tagName == 'SPAN') {
 | 
			
		||||
					target = e.target.parentNode;
 | 
			
		||||
				} else {
 | 
			
		||||
					target = e.target;
 | 
			
		||||
				}
 | 
			
		||||
				var jtarget = $(target);
 | 
			
		||||
				if(jtarget.hasClass("move")) {
 | 
			
		||||
					// prepare tree for move / cut paste
 | 
			
		||||
					var id = e.target.id.split("move-link-")[1];
 | 
			
		||||
					if(id==null){
 | 
			
		||||
						id = e.target.parentNode.id.split("move-link-")[1];
 | 
			
		||||
					}
 | 
			
		||||
					var page_id = id;
 | 
			
		||||
					selected_page = page_id;
 | 
			
		||||
					action = "move";
 | 
			
		||||
					$('span.move-target-container, span.line, a.move-target').show();
 | 
			
		||||
					$('#page_'+page_id).addClass("selected");
 | 
			
		||||
					$('#page_'+page_id+' span.move-target-container').hide();
 | 
			
		||||
					e.stopPropagation();
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if(jtarget.hasClass("copy")) {
 | 
			
		||||
					// prepare tree for copy
 | 
			
		||||
					id = e.target.id.split("copy-link-")[1];
 | 
			
		||||
					if(id==null){
 | 
			
		||||
						id = e.target.parentNode.id.split("copy-link-")[1];
 | 
			
		||||
					}
 | 
			
		||||
					selected_page = id;
 | 
			
		||||
					action = mark_copy_node(id);
 | 
			
		||||
					e.stopPropagation();
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if(jtarget.hasClass("viewpage")) {
 | 
			
		||||
					var view_page_url = $('#' + target.id + '-select').val();
 | 
			
		||||
					if(view_page_url){
 | 
			
		||||
						window.open(view_page_url);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if(jtarget.hasClass("addlink")) {
 | 
			
		||||
					if (!/#$/g.test(jtarget.attr('href'))) {
 | 
			
		||||
						// if there is url instead of # inside href, follow this url
 | 
			
		||||
						// used if user haves add_page
 | 
			
		||||
						return true;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					$("tr").removeClass("target");
 | 
			
		||||
					$("#changelist table").removeClass("table-selected");
 | 
			
		||||
					page_id = target.id.split("add-link-")[1];
 | 
			
		||||
					selected_page = page_id;
 | 
			
		||||
					action = "add";
 | 
			
		||||
					$('tr').removeClass("selected");
 | 
			
		||||
					$('#page-row-'+page_id).addClass("selected");
 | 
			
		||||
					$('.move-target-container').hide();
 | 
			
		||||
					$('a.move-target, span.line, #move-target-'+page_id).show();
 | 
			
		||||
					e.stopPropagation();
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// don't assume admin site is root-level
 | 
			
		||||
				// grab base url to construct full absolute URLs
 | 
			
		||||
				admin_base_url = document.URL.split("/cms/page/")[0] + "/";
 | 
			
		||||
 | 
			
		||||
				// in navigation
 | 
			
		||||
				if(jtarget.hasClass('navigation-checkbox')) {
 | 
			
		||||
					e.stopPropagation();
 | 
			
		||||
 | 
			
		||||
					var pageId = jtarget.attr('name').split('navigation-')[1];
 | 
			
		||||
					var language = jtarget.closest('.cont').find('a[lang]').attr('lang') || '';
 | 
			
		||||
 | 
			
		||||
					// if I don't put data in the post, django doesn't get it
 | 
			
		||||
					reloadItem(jtarget, admin_base_url + 'cms/page/' + pageId + '/change-navigation/?language=' + language, { 1:1 });
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				 // lazy load descendants on tree open
 | 
			
		||||
				if(jtarget.hasClass("closed")) {
 | 
			
		||||
					// only load them once
 | 
			
		||||
					if(jtarget.find('ul > li').length == 0 && !jtarget.hasClass("loading")) {
 | 
			
		||||
						// keeps this event from firing multiple times before
 | 
			
		||||
						// the dom as changed. it still needs to propagate for
 | 
			
		||||
						// the other click event on this element to fire
 | 
			
		||||
						jtarget.addClass("loading");
 | 
			
		||||
						var pageId = $(jtarget).attr("id").split("page_")[1];
 | 
			
		||||
						var language = $(jtarget).children('div.cont').children('div.col1').children('.title').attr('lang')
 | 
			
		||||
						$.get(admin_base_url + "cms/page/" + pageId + "/" + language + "/descendants/", {}, function(r, status) {
 | 
			
		||||
							jtarget.children('ul').append(r);
 | 
			
		||||
							// show move targets if needed
 | 
			
		||||
							if($('span.move-target-container:visible').length > 0) {
 | 
			
		||||
								jtarget.children('ul').find('a.move-target, span.move-target-container, span.line').show();
 | 
			
		||||
							}
 | 
			
		||||
							reCalc();
 | 
			
		||||
						});
 | 
			
		||||
					} else{
 | 
			
		||||
						reCalc();
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if(jtarget.hasClass("move-target")) {
 | 
			
		||||
					if(jtarget.hasClass("left")){
 | 
			
		||||
						position = "left";
 | 
			
		||||
					}
 | 
			
		||||
					if(jtarget.hasClass("right")){
 | 
			
		||||
						position = "right";
 | 
			
		||||
					}
 | 
			
		||||
					if(jtarget.hasClass("last-child")){
 | 
			
		||||
						position = "last-child";
 | 
			
		||||
					}
 | 
			
		||||
					target_id = target.parentNode.id.split("move-target-")[1];
 | 
			
		||||
 | 
			
		||||
					if(action=="move") {
 | 
			
		||||
						moveTreeItem(null, selected_page, target_id, position, tree);
 | 
			
		||||
						$('.move-target-container').hide();
 | 
			
		||||
					}else if(action=="copy") {
 | 
			
		||||
						site = $('#site-select')[0].value;
 | 
			
		||||
						copyTreeItem(selected_page, target_id, position, site);
 | 
			
		||||
						$('.move-target-container').hide();
 | 
			
		||||
					}else if(action=="add") {
 | 
			
		||||
						site = $('#site-select')[0].value;
 | 
			
		||||
						window.location.href = window.location.href.split("?")[0].split("#")[0] + 'add/?target='+target_id+"&position="+position+"&site="+site;
 | 
			
		||||
					}
 | 
			
		||||
					e.stopPropagation();
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
				return true;
 | 
			
		||||
			});
 | 
			
		||||
			$("div#sitemap").show();
 | 
			
		||||
 | 
			
		||||
			function reCalc(){
 | 
			
		||||
				$.syncCols();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			$(window).bind('resize', reCalc);
 | 
			
		||||
			/* Site Selector */
 | 
			
		||||
			$('#site-select').change(function(){
 | 
			
		||||
				var form = $(this).closest('form');
 | 
			
		||||
				// add correct value for copy
 | 
			
		||||
				if(action === 'copy') $('#site-copy').val(selected_page);
 | 
			
		||||
				// submit form
 | 
			
		||||
				form.submit();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			//
 | 
			
		||||
			// If an A element has a data-attribute 'alt-class'. At this time,
 | 
			
		||||
			// this is only the edit button in the page-tree, but could be
 | 
			
		||||
			// more in future. It is important that the CSS be written in such
 | 
			
		||||
			// a manner that the alt-class is defined after the normal class,
 | 
			
		||||
			// so that it can be overridden when the alt-key is depressed.
 | 
			
		||||
			//
 | 
			
		||||
			// NOTE: This 'preview' part of the 'alt-click to [alternative
 | 
			
		||||
			// function]' feature may not work in some environments (Windows
 | 
			
		||||
			// in a some virtual machine environments, notably), but is only a
 | 
			
		||||
			// nice-'extra', not a requirement for the feature.
 | 
			
		||||
			//
 | 
			
		||||
			$(document).on('keydown keyup', function(evt){
 | 
			
		||||
				if (evt.which === 18) {
 | 
			
		||||
					$('a[data-alt-class]').each(function(){
 | 
			
		||||
						var self = $(this);
 | 
			
		||||
						self.toggleClass(self.data('alt-class'), evt.type === 'keydown');
 | 
			
		||||
					})
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			//
 | 
			
		||||
			// If the A-element has a data-attribute 'alt-href', then this
 | 
			
		||||
			// click-handler uses that instead of the normal href attribute as
 | 
			
		||||
			// the click-destination. Again, currently this is only on the
 | 
			
		||||
			// edit button, but could be more in future.
 | 
			
		||||
			//
 | 
			
		||||
			$('a[data-alt-href]').on('click', function(evt){
 | 
			
		||||
				var href;
 | 
			
		||||
				evt.preventDefault();
 | 
			
		||||
				if (evt.shiftKey) {
 | 
			
		||||
					href = $(this).data('alt-href');
 | 
			
		||||
				}
 | 
			
		||||
				else {
 | 
			
		||||
					href = $(this).attr('href');
 | 
			
		||||
				}
 | 
			
		||||
				window.location = href;					
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			var copy_splits = window.location.href.split("copy=");
 | 
			
		||||
			if(copy_splits.length > 1){
 | 
			
		||||
				var id = copy_splits[1].split("&")[0];
 | 
			
		||||
				var action = mark_copy_node(id);
 | 
			
		||||
				selected_page = id;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			function copyTreeItem(item_id, target_id, position, site){
 | 
			
		||||
				if (that.options.settings.permission) {
 | 
			
		||||
					return loadDialog('./' + item_id + '/dialog/copy/', {
 | 
			
		||||
						position:position,
 | 
			
		||||
						target:target_id,
 | 
			
		||||
						site:site,
 | 
			
		||||
						callback: $.callbackRegister("_copyTreeItem", _copyTreeItem, item_id, target_id, position, site)
 | 
			
		||||
					});
 | 
			
		||||
				}
 | 
			
		||||
				return _copyTreeItem(item_id, target_id, position, site);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			function _copyTreeItem(item_id, target_id, position, site, options) {
 | 
			
		||||
				var data = {
 | 
			
		||||
					position:position,
 | 
			
		||||
					target:target_id,
 | 
			
		||||
					site:site
 | 
			
		||||
				};
 | 
			
		||||
				data = $.extend(data, options);
 | 
			
		||||
 | 
			
		||||
				$.post("./" + item_id + "/copy-page/", data, function(decoded) {
 | 
			
		||||
					response = decoded.content;
 | 
			
		||||
					status = decoded.status;
 | 
			
		||||
					if(status==200) {
 | 
			
		||||
						// reload tree
 | 
			
		||||
						window.location = window.location.href;
 | 
			
		||||
					}else{
 | 
			
		||||
						alert(response);
 | 
			
		||||
						moveError($('#page_'+item_id + " div.col1:eq(0)"),response);
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			function mark_copy_node(id){
 | 
			
		||||
				$('a.move-target, span.move-target-container, span.line').show();
 | 
			
		||||
				$('#page_'+id).addClass("selected");
 | 
			
		||||
				$('#page_'+id).parent().parent().children('div.cont').find('a.move-target.first-child, span.second').hide();
 | 
			
		||||
				$('#page_'+id).parent().parent().children('ul').children('li').children('div.cont').find('a.move-target.left, a.move-target.right, span.first, span.second').hide();
 | 
			
		||||
				return "copy";
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/**
 | 
			
		||||
			 * Reloads tree item (one line). If some filtering is found, adds
 | 
			
		||||
			 * filtered variable into posted data.
 | 
			
		||||
			 *
 | 
			
		||||
			 * @param {HTMLElement} el Any child element of tree item
 | 
			
		||||
			 * @param {String} url Requested url
 | 
			
		||||
			 * @param {Object} data Optional posted data
 | 
			
		||||
			 * @param {Function} callback Optional calback function
 | 
			
		||||
			 */
 | 
			
		||||
			function reloadItem(el, url, data, callback, errorCallback) {
 | 
			
		||||
				if (data === undefined) data = {};
 | 
			
		||||
 | 
			
		||||
				if (/\/\?/ig.test(window.location.href)) {
 | 
			
		||||
					// probably some filter here, tell backend, we need a filtered
 | 
			
		||||
					// version of item
 | 
			
		||||
					data['fitlered'] = 1;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				function onSuccess(response, textStatus) {
 | 
			
		||||
					var status = true;
 | 
			
		||||
					var target = null;
 | 
			
		||||
 | 
			
		||||
					if(callback) status = callback(response, textStatus);
 | 
			
		||||
					if(status) {
 | 
			
		||||
						if (/page_\d+/.test($(el).attr('id'))) {
 | 
			
		||||
							// one level higher
 | 
			
		||||
							target = $(el).find('div.cont:first');
 | 
			
		||||
						} else {
 | 
			
		||||
							target = $(el).parents('div.cont:first');
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
						var parent = target.parent();
 | 
			
		||||
 | 
			
		||||
						// remove the element if something went wrong
 | 
			
		||||
						if(response == 'NotFound') return parent.remove();
 | 
			
		||||
 | 
			
		||||
						var origin = $('.messagelist');
 | 
			
		||||
						target.replace(response);
 | 
			
		||||
 | 
			
		||||
						var messages = $(parent).find('.messagelist');
 | 
			
		||||
						if(messages.length) {
 | 
			
		||||
							origin.remove();
 | 
			
		||||
							messages.insertAfter('.breadcrumbs');
 | 
			
		||||
						}
 | 
			
		||||
						parent.find('div.cont:first').yft();
 | 
			
		||||
 | 
			
		||||
						// ensure after removal everything is aligned again
 | 
			
		||||
						$(window).trigger('resize');
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				$.ajax({
 | 
			
		||||
					'type': 'POST',
 | 
			
		||||
					'data': data,
 | 
			
		||||
					'url': url,
 | 
			
		||||
					'success': onSuccess,
 | 
			
		||||
					'error': function (XMLHttpRequest, textStatus, errorThrown) {
 | 
			
		||||
						// errorCallback is passed through the reloadItem function
 | 
			
		||||
						if(errorCallback) errorCallback(XMLHttpRequest, textStatus, errorThrown);
 | 
			
		||||
					},
 | 
			
		||||
					'xhr': (window.ActiveXObject) ? function(){try {return new window.ActiveXObject("Microsoft.XMLHTTP");} catch(e) {}} : function() {return new window.XMLHttpRequest();}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			function moveTreeItem(jtarget, item_id, target_id, position, tree){
 | 
			
		||||
				reloadItem(
 | 
			
		||||
					jtarget, "./" + item_id + "/move-page/",
 | 
			
		||||
 | 
			
		||||
					{ position: position, target: target_id },
 | 
			
		||||
 | 
			
		||||
					// on success
 | 
			
		||||
					function(decoded,textStatus){
 | 
			
		||||
						response = decoded.content;
 | 
			
		||||
						status = decoded.status;
 | 
			
		||||
						if(status==200) {
 | 
			
		||||
							if (tree) {
 | 
			
		||||
								var tree_pos = {'left': 'before', 'right': 'after'}[position] || 'inside';
 | 
			
		||||
								tree.moved("#page_" + item_id, $("#page_" + target_id + " a.title")[0], tree_pos, false, false);
 | 
			
		||||
							} else {
 | 
			
		||||
								moveSuccess($('#page_'+item_id + " div.col1:eq(0)"));
 | 
			
		||||
							}
 | 
			
		||||
							return false;
 | 
			
		||||
						}
 | 
			
		||||
						else {
 | 
			
		||||
							moveError($('#page_'+item_id + " div.col1:eq(0)"),response);
 | 
			
		||||
							return false;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			var undos = [];
 | 
			
		||||
 | 
			
		||||
			function addUndo(node, target, position){
 | 
			
		||||
				undos.push({node:node, target:target, position:position});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		refreshColumns: function () {
 | 
			
		||||
			$('div.col2').children('div').each(function(index, item){
 | 
			
		||||
				$(item).css('display', 'block');
 | 
			
		||||
			});
 | 
			
		||||
			var min_width = 100000;
 | 
			
		||||
			var max_col2_width = 0;
 | 
			
		||||
			var max_col2 = null;
 | 
			
		||||
			$(this).each(function() {
 | 
			
		||||
				var cont = $(this).children('div.cont');
 | 
			
		||||
				if (!cont.is(':visible')) {
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
				var col1 = cont.children('div.col1');
 | 
			
		||||
				var col2 = cont.children('div.col2');
 | 
			
		||||
				var col1_width = col1.outerWidth(true);
 | 
			
		||||
				var col2_width = col2.outerWidth(true);
 | 
			
		||||
				var total_width = cont.outerWidth(true);
 | 
			
		||||
 | 
			
		||||
				var dif = total_width - col1_width;
 | 
			
		||||
				if(dif < min_width){
 | 
			
		||||
				   min_width = dif;
 | 
			
		||||
				}
 | 
			
		||||
				if(col2_width > max_col2_width){
 | 
			
		||||
					max_col2_width = col2_width;
 | 
			
		||||
					max_col2 = col2
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			var offset = 50;
 | 
			
		||||
			var w = 0;
 | 
			
		||||
			var hidden_count = 0;
 | 
			
		||||
			var max_reached = false;
 | 
			
		||||
			if(max_col2){
 | 
			
		||||
				max_col2.children('div').each(function(){
 | 
			
		||||
					if(!max_reached){
 | 
			
		||||
						w += $(this).outerWidth(true);
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if(max_reached || w > (min_width - offset)){
 | 
			
		||||
						hidden_count = hidden_count + 1;
 | 
			
		||||
						max_reached = true
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				if(hidden_count){
 | 
			
		||||
					$(this).each(function() {
 | 
			
		||||
						$(this).children('div.cont').children('div.col2').children('div').slice(-hidden_count).each(function(){
 | 
			
		||||
							$(this).css('display', 'none');
 | 
			
		||||
						})
 | 
			
		||||
					});
 | 
			
		||||
					$('div#sitemap ul.header div.col2').children().slice(-hidden_count).each(function(){
 | 
			
		||||
						$(this).css('display','none');
 | 
			
		||||
					})
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
							
								
								
									
										107
									
								
								static/cms/js/modules/cms.clipboard.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,107 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS# */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
	/*!
 | 
			
		||||
	 * Clipboard
 | 
			
		||||
	 * Handles copy & paste
 | 
			
		||||
	 */
 | 
			
		||||
	CMS.Clipboard = new CMS.Class({
 | 
			
		||||
 | 
			
		||||
		implement: [CMS.API.Helpers],
 | 
			
		||||
 | 
			
		||||
		options: {
 | 
			
		||||
			'position': 220, // offset to top
 | 
			
		||||
			'speed': 100,
 | 
			
		||||
			'id': null,
 | 
			
		||||
			'url': ''
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		initialize: function (options) {
 | 
			
		||||
			this.clipboard = $('.cms_clipboard');
 | 
			
		||||
			this.options = $.extend(true, {}, this.options, options);
 | 
			
		||||
			this.config = CMS.config;
 | 
			
		||||
			this.settings = CMS.settings;
 | 
			
		||||
 | 
			
		||||
			// elements
 | 
			
		||||
			this.containers = this.clipboard.find('.cms_clipboard-containers > .cms_draggable');
 | 
			
		||||
			this.triggers = this.clipboard.find('.cms_clipboard-triggers a');
 | 
			
		||||
			this.triggerRemove = this.clipboard.find('.cms_clipboard-empty a');
 | 
			
		||||
 | 
			
		||||
			// states
 | 
			
		||||
			this.click = (document.ontouchstart !== null) ? 'click.cms' : 'touchend.cms click.cms';
 | 
			
		||||
			this.timer = function () {};
 | 
			
		||||
 | 
			
		||||
			// setup initial stuff
 | 
			
		||||
			this._setup();
 | 
			
		||||
 | 
			
		||||
			// setup events
 | 
			
		||||
			this._events();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// initial methods
 | 
			
		||||
		_setup: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			// attach visual events
 | 
			
		||||
			this.triggers.bind('mouseenter mouseleave', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				// clear timeout
 | 
			
		||||
				clearTimeout(that.timer);
 | 
			
		||||
 | 
			
		||||
				if(e.type === 'mouseleave' && !that.containers.has(e.toElement).length) hide();
 | 
			
		||||
 | 
			
		||||
				var index = that.clipboard.find('.cms_clipboard-triggers a').index(this);
 | 
			
		||||
				var el = that.containers.eq(index);
 | 
			
		||||
				// cancel if element is already open
 | 
			
		||||
				if(el.data('open') === true) return false;
 | 
			
		||||
 | 
			
		||||
				// show element
 | 
			
		||||
				that.containers.stop().css({ 'margin-left': -that.options.position }).data('open', false);
 | 
			
		||||
				el.stop().animate({ 'margin-left': 0 }, that.options.speed);
 | 
			
		||||
				el.data('open', true);
 | 
			
		||||
			});
 | 
			
		||||
			that.containers.bind('mouseover mouseleave', function (e) {
 | 
			
		||||
				// clear timeout
 | 
			
		||||
				clearTimeout(that.timer);
 | 
			
		||||
 | 
			
		||||
				// cancel if we trigger mouseover
 | 
			
		||||
				if(e.type === 'mouseover') return false;
 | 
			
		||||
 | 
			
		||||
				// we need a little timer to detect if we should hide the menu
 | 
			
		||||
				hide();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			function hide() {
 | 
			
		||||
				that.timer = setTimeout(function () {
 | 
			
		||||
					that.containers.stop().css({ 'margin-left': -that.options.position }).data('open', false);
 | 
			
		||||
				}, that.options.speed);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_events: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			// add remove event
 | 
			
		||||
			this.triggerRemove.bind(this.click, function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				that.clear(function () {
 | 
			
		||||
				    // remove element on success
 | 
			
		||||
				    that.clipboard.hide();
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// public methods
 | 
			
		||||
		clear: function (callback) {
 | 
			
		||||
			// post needs to be a string, it will be converted using JSON.parse
 | 
			
		||||
			var post = '{ "csrfmiddlewaretoken": "' + this.config.csrf + '" }';
 | 
			
		||||
			// redirect to ajax
 | 
			
		||||
			CMS.API.Toolbar.openAjax(this.config.clipboard.url, post, '', callback);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
							
								
								
									
										638
									
								
								static/cms/js/modules/cms.modal.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,638 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS# */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
	/*!
 | 
			
		||||
	 * Modal
 | 
			
		||||
	 * Controls a cms specific modal
 | 
			
		||||
	 */
 | 
			
		||||
	CMS.Modal = new CMS.Class({
 | 
			
		||||
 | 
			
		||||
		implement: [CMS.API.Helpers],
 | 
			
		||||
 | 
			
		||||
		options: {
 | 
			
		||||
			'onClose': false,
 | 
			
		||||
			'minHeight': 400,
 | 
			
		||||
			'minWidth': 800,
 | 
			
		||||
			'modalDuration': 300,
 | 
			
		||||
			'newPlugin': false,
 | 
			
		||||
			'urls': {
 | 
			
		||||
				'css_modal': 'cms/css/cms.toolbar.modal.css'
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		initialize: function (options) {
 | 
			
		||||
			this.options = $.extend(true, {}, this.options, options);
 | 
			
		||||
			this.config = CMS.config;
 | 
			
		||||
 | 
			
		||||
			// elements
 | 
			
		||||
			this.body = $('html');
 | 
			
		||||
			this.modal = $('.cms_modal');
 | 
			
		||||
			this.toolbar = $('.cms_toolbar');
 | 
			
		||||
 | 
			
		||||
			// states
 | 
			
		||||
			this.click = (document.ontouchstart !== null) ? 'click.cms' : 'touchend.cms click.cms';
 | 
			
		||||
			this.maximized = false;
 | 
			
		||||
			this.minimized = false;
 | 
			
		||||
			this.triggerMaximized = false;
 | 
			
		||||
			this.saved = false;
 | 
			
		||||
 | 
			
		||||
			// if the modal is initialized the first time, set the events
 | 
			
		||||
			if(!this.modal.data('ready')) this._events();
 | 
			
		||||
 | 
			
		||||
			// ready modal
 | 
			
		||||
			this.modal.data('ready', true);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// initial methods
 | 
			
		||||
		_events: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			// attach events to window
 | 
			
		||||
			this.modal.find('.cms_modal-collapse').bind(this.click, function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				that._minimize();
 | 
			
		||||
			});
 | 
			
		||||
			this.modal.find('.cms_modal-title').bind('mousedown.cms', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				that._startMove(e);
 | 
			
		||||
			});
 | 
			
		||||
			this.modal.find('.cms_modal-title').bind('dblclick.cms', function () {
 | 
			
		||||
				that._maximize();
 | 
			
		||||
			});
 | 
			
		||||
			this.modal.find('.cms_modal-resize').bind('mousedown.cms', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				that._startResize(e);
 | 
			
		||||
			});
 | 
			
		||||
			this.modal.find('.cms_modal-maximize').bind(this.click, function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				that._maximize();
 | 
			
		||||
			});
 | 
			
		||||
			this.modal.find('.cms_modal-breadcrumb-items').on(this.click, 'a', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				that._changeContent($(this));
 | 
			
		||||
			});
 | 
			
		||||
			this.modal.find('.cms_modal-close, .cms_modal-cancel').bind(this.click, function (e) {
 | 
			
		||||
				that.options.onClose = null;
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				that.close();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// stopper events
 | 
			
		||||
			$(document).bind('mouseup.cms', function (e) {
 | 
			
		||||
				that._endMove(e);
 | 
			
		||||
				that._endResize(e);
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// public methods
 | 
			
		||||
		open: function (url, name, breadcrumb) {
 | 
			
		||||
			// cancel if another lightbox is already being opened
 | 
			
		||||
			if(CMS.API.locked) {
 | 
			
		||||
				CMS.API.locked = false;
 | 
			
		||||
				return false
 | 
			
		||||
			} else {
 | 
			
		||||
				CMS.API.locked = true;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// because a new instance is called, we have to ensure minimized state is removed #3620
 | 
			
		||||
			if(this.modal.is(':visible') && this.modal.find('.cms_modal-collapsed').length) {
 | 
			
		||||
				this.minimized = true;
 | 
			
		||||
				this._minimize();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// show loader
 | 
			
		||||
			CMS.API.Toolbar._loader(true);
 | 
			
		||||
 | 
			
		||||
			// hide tooltip
 | 
			
		||||
			this.hideTooltip();
 | 
			
		||||
 | 
			
		||||
			// reset breadcrumb
 | 
			
		||||
			this.modal.find('.cms_modal-breadcrumb').hide();
 | 
			
		||||
			this.modal.find('.cms_modal-breadcrumb-items').html('');
 | 
			
		||||
 | 
			
		||||
			// empty buttons
 | 
			
		||||
			this.modal.find('.cms_modal-buttons').html('');
 | 
			
		||||
 | 
			
		||||
			var contents = this.modal.find('.cms_modal-body, .cms_modal-foot');
 | 
			
		||||
				contents.show();
 | 
			
		||||
 | 
			
		||||
			this._loadContent(url, name);
 | 
			
		||||
 | 
			
		||||
			// insure modal is not maximized
 | 
			
		||||
			if(this.modal.find('.cms_modal-collapsed').length) this._minimize();
 | 
			
		||||
 | 
			
		||||
			// reset styles
 | 
			
		||||
			this.modal.css({
 | 
			
		||||
				'left': '50%',
 | 
			
		||||
				'top': '50%',
 | 
			
		||||
				'mergin-left': 0,
 | 
			
		||||
				'margin-right': 0
 | 
			
		||||
			});
 | 
			
		||||
			// lets set the modal width and height to the size of the browser
 | 
			
		||||
			var widthOffset = 300; // adds margin left and right
 | 
			
		||||
			var heightOffset = 350; // adds margin top and bottom;
 | 
			
		||||
			var screenWidth = $(window).width(); // it has to be the height of the window not computer screen
 | 
			
		||||
			var screenHeight = $(window).height(); // it has to be the height of the window and not computer screen
 | 
			
		||||
 | 
			
		||||
			var width = (screenWidth >= this.options.minWidth + widthOffset) ? screenWidth - widthOffset : this.options.minWidth;
 | 
			
		||||
			var height = (screenHeight >= this.options.minHeight + heightOffset) ? screenHeight - heightOffset : this.options.minHeight;
 | 
			
		||||
			this.modal.find('.cms_modal-body').css({
 | 
			
		||||
				'width': width,
 | 
			
		||||
				'height': height
 | 
			
		||||
			});
 | 
			
		||||
			this.modal.find('.cms_modal-body').removeClass('cms_loader');
 | 
			
		||||
			this.modal.find('.cms_modal-maximize').removeClass('cms_modal-maximize-active');
 | 
			
		||||
			this.maximized = false;
 | 
			
		||||
			// in case, the window is larger than the windows height, we trigger fullscreen mode
 | 
			
		||||
			if(height >= screenHeight) this.triggerMaximized = true;
 | 
			
		||||
 | 
			
		||||
			// we need to render the breadcrumb
 | 
			
		||||
			this._setBreadcrumb(breadcrumb);
 | 
			
		||||
 | 
			
		||||
			// display modal
 | 
			
		||||
			this._show(this.options.modalDuration);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		close: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			// handle remove option when plugin is new
 | 
			
		||||
			if(this.options.newPlugin) {
 | 
			
		||||
				var data = this.options.newPlugin;
 | 
			
		||||
				var post = '{ "csrfmiddlewaretoken": "' + this.config.csrf + '" }';
 | 
			
		||||
				var text = this.config.lang.confirm;
 | 
			
		||||
 | 
			
		||||
				// trigger an ajax request
 | 
			
		||||
				CMS.API.Toolbar.openAjax(data['delete'], post, text, function () {
 | 
			
		||||
					that._hide(100);
 | 
			
		||||
				});
 | 
			
		||||
			} else {
 | 
			
		||||
				this._hide(100);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// handle refresh option
 | 
			
		||||
			if(this.options.onClose) this.reloadBrowser(this.options.onClose, false, true);
 | 
			
		||||
 | 
			
		||||
			// reset maximize or minimize states for #3111
 | 
			
		||||
			setTimeout(function () {
 | 
			
		||||
				if(that.minimized) { that._minimize(); }
 | 
			
		||||
				if(that.maximized) { that._maximize(); }
 | 
			
		||||
			}, 300);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// private methods
 | 
			
		||||
		_show: function (speed) {
 | 
			
		||||
			// we need to position the modal in the center
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var width = this.modal.width();
 | 
			
		||||
			var height = this.modal.height();
 | 
			
		||||
 | 
			
		||||
			// animates and sets the modal
 | 
			
		||||
			this.modal.show().css({
 | 
			
		||||
				'width': 0,
 | 
			
		||||
				'height': 0,
 | 
			
		||||
				'margin-left': 0,
 | 
			
		||||
				'margin-top': 0
 | 
			
		||||
			}).stop(true, true).animate({
 | 
			
		||||
				'width': width,
 | 
			
		||||
				'height': height,
 | 
			
		||||
				'margin-left': -(width / 2),
 | 
			
		||||
				'margin-top': -(height / 2)
 | 
			
		||||
			}, speed, function () {
 | 
			
		||||
				$(this).removeAttr('style');
 | 
			
		||||
 | 
			
		||||
				that.modal.css({
 | 
			
		||||
					'margin-left': -(width / 2),
 | 
			
		||||
					'margin-top': -(height / 2)
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				// fade in modal window
 | 
			
		||||
				that.modal.show();
 | 
			
		||||
 | 
			
		||||
				// hide loader
 | 
			
		||||
				CMS.API.Toolbar._loader(false);
 | 
			
		||||
 | 
			
		||||
				// check if we should maximize
 | 
			
		||||
				if(that.triggerMaximized) that._maximize();
 | 
			
		||||
 | 
			
		||||
				// changed locked status to allow other modals again
 | 
			
		||||
				CMS.API.locked = false;
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// add esc close event
 | 
			
		||||
			$(document).bind('keydown.cms', function (e) {
 | 
			
		||||
				if(e.keyCode === 27) that.close();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// set focus to modal
 | 
			
		||||
			this.modal.focus();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_hide: function (speed) {
 | 
			
		||||
			this.modal.fadeOut(speed);
 | 
			
		||||
			this.modal.find('.cms_modal-frame iframe').remove();
 | 
			
		||||
			this.modal.find('.cms_modal-body').removeClass('cms_loader');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_minimize: function () {
 | 
			
		||||
			var trigger = this.modal.find('.cms_modal-collapse');
 | 
			
		||||
			var maximize = this.modal.find('.cms_modal-maximize');
 | 
			
		||||
			var contents = this.modal.find('.cms_modal-body, .cms_modal-foot');
 | 
			
		||||
			var title = this.modal.find('.cms_modal-title');
 | 
			
		||||
 | 
			
		||||
			// cancel action if maximized
 | 
			
		||||
			if(this.maximized) return false;
 | 
			
		||||
 | 
			
		||||
			if(this.minimized === false) {
 | 
			
		||||
				// ensure toolbar is shown
 | 
			
		||||
				CMS.API.Toolbar.toggleToolbar(true);
 | 
			
		||||
 | 
			
		||||
				// minimize
 | 
			
		||||
				trigger.addClass('cms_modal-collapsed');
 | 
			
		||||
				contents.hide();
 | 
			
		||||
 | 
			
		||||
				// save initial state
 | 
			
		||||
				this.modal.data('css', {
 | 
			
		||||
					'left': this.modal.css('left'),
 | 
			
		||||
					'top': this.modal.css('top'),
 | 
			
		||||
					'margin': this.modal.css('margin')
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				this.modal.css({
 | 
			
		||||
					'left': this.toolbar.find('.cms_toolbar-left').outerWidth(true) + 50,
 | 
			
		||||
					'top': (this.config.debug) ? 6 : 1,
 | 
			
		||||
					'margin': 0
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				// enable scrolling
 | 
			
		||||
				this.body.css('overflow', '');
 | 
			
		||||
 | 
			
		||||
				// ensure maximize element is hidden #3111
 | 
			
		||||
				maximize.hide();
 | 
			
		||||
				// set correct cursor when maximized #3111
 | 
			
		||||
				title.css('cursor', 'default');
 | 
			
		||||
 | 
			
		||||
				this.minimized = true;
 | 
			
		||||
			} else {
 | 
			
		||||
				// minimize
 | 
			
		||||
				trigger.removeClass('cms_modal-collapsed');
 | 
			
		||||
				contents.show();
 | 
			
		||||
 | 
			
		||||
				// reattach css
 | 
			
		||||
				this.modal.css(this.modal.data('css'));
 | 
			
		||||
 | 
			
		||||
				// disable scrolling
 | 
			
		||||
				this.body.css('overflow', 'hidden');
 | 
			
		||||
 | 
			
		||||
				// ensure maximize element is shown #3111
 | 
			
		||||
				maximize.show();
 | 
			
		||||
				// set correct cursor when maximized #3111
 | 
			
		||||
				title.css('cursor', 'move');
 | 
			
		||||
 | 
			
		||||
				this.minimized = false;
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_maximize: function () {
 | 
			
		||||
			var debug = (this.config.debug) ? 5 : 0;
 | 
			
		||||
			var container = this.modal.find('.cms_modal-body');
 | 
			
		||||
			var minimize = this.modal.find('.cms_modal-collapse');
 | 
			
		||||
			var trigger = this.modal.find('.cms_modal-maximize');
 | 
			
		||||
			var title = this.modal.find('.cms_modal-title');
 | 
			
		||||
 | 
			
		||||
			// cancel action when minimized
 | 
			
		||||
			if(this.minimized) return false;
 | 
			
		||||
 | 
			
		||||
			if(this.maximized === false) {
 | 
			
		||||
				// maximize
 | 
			
		||||
				this.maximized = true;
 | 
			
		||||
				trigger.addClass('cms_modal-maximize-active');
 | 
			
		||||
 | 
			
		||||
				this.modal.data('css', {
 | 
			
		||||
					'left': this.modal.css('left'),
 | 
			
		||||
					'top': this.modal.css('top'),
 | 
			
		||||
					'margin-left': this.modal.css('margin-left'),
 | 
			
		||||
					'margin-top': this.modal.css('margin-top')
 | 
			
		||||
				});
 | 
			
		||||
				container.data('css', {
 | 
			
		||||
					'width': container.width(),
 | 
			
		||||
					'height': container.height()
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				// reset
 | 
			
		||||
				this.modal.css({
 | 
			
		||||
					'left': 0,
 | 
			
		||||
					'top': debug,
 | 
			
		||||
					'margin': 0
 | 
			
		||||
				});
 | 
			
		||||
				// bind resize event
 | 
			
		||||
				$(window).bind('resize.cms.modal', function () {
 | 
			
		||||
					container.css({
 | 
			
		||||
						'width': $(window).width(),
 | 
			
		||||
						'height': $(window).height() - 60 - debug
 | 
			
		||||
					});
 | 
			
		||||
				});
 | 
			
		||||
				$(window).trigger('resize.cms.modal');
 | 
			
		||||
 | 
			
		||||
				// ensure maximize element is hidden #3111
 | 
			
		||||
				minimize.hide();
 | 
			
		||||
				// set correct cursor when maximized #3111
 | 
			
		||||
				title.css('cursor', 'default');
 | 
			
		||||
			} else {
 | 
			
		||||
				// minimize
 | 
			
		||||
				this.maximized = false;
 | 
			
		||||
				trigger.removeClass('cms_modal-maximize-active');
 | 
			
		||||
 | 
			
		||||
				$(window).unbind('resize.cms.modal');
 | 
			
		||||
 | 
			
		||||
				// reattach css
 | 
			
		||||
				this.modal.css(this.modal.data('css'));
 | 
			
		||||
				container.css(container.data('css'));
 | 
			
		||||
 | 
			
		||||
				// ensure maximize element is shown #3111
 | 
			
		||||
				minimize.show();
 | 
			
		||||
				// set correct cursor when maximized #3111
 | 
			
		||||
				title.css('cursor', 'move');
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_startMove: function (initial) {
 | 
			
		||||
			// cancel if maximized
 | 
			
		||||
			if(this.maximized) return false;
 | 
			
		||||
			// cancel action when minimized
 | 
			
		||||
			if(this.minimized) return false;
 | 
			
		||||
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var position = that.modal.position();
 | 
			
		||||
 | 
			
		||||
			this.modal.find('.cms_modal-shim').show();
 | 
			
		||||
 | 
			
		||||
			$(document).bind('mousemove.cms', function (e) {
 | 
			
		||||
				var left = position.left - (initial.pageX - e.pageX);
 | 
			
		||||
				var top = position.top - (initial.pageY - e.pageY);
 | 
			
		||||
 | 
			
		||||
				that.modal.css({
 | 
			
		||||
					'left': left,
 | 
			
		||||
					'top': top
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_endMove: function () {
 | 
			
		||||
			this.modal.find('.cms_modal-shim').hide();
 | 
			
		||||
 | 
			
		||||
			$(document).unbind('mousemove.cms');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_startResize: function (initial) {
 | 
			
		||||
			// cancel if in fullscreen
 | 
			
		||||
			if(this.maximized) return false;
 | 
			
		||||
			// continue
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var container = this.modal.find('.cms_modal-body');
 | 
			
		||||
			var width = container.width();
 | 
			
		||||
			var height = container.height();
 | 
			
		||||
			var modalLeft = this.modal.position().left;
 | 
			
		||||
			var modalTop = this.modal.position().top;
 | 
			
		||||
 | 
			
		||||
			this.modal.find('.cms_modal-shim').show();
 | 
			
		||||
 | 
			
		||||
			$(document).bind('mousemove.cms', function (e) {
 | 
			
		||||
				var mvX = initial.pageX - e.pageX;
 | 
			
		||||
				var mvY = initial.pageY - e.pageY;
 | 
			
		||||
 | 
			
		||||
				var w = width - (mvX * 2);
 | 
			
		||||
				var h = height - (mvY * 2);
 | 
			
		||||
				var max = 680;
 | 
			
		||||
 | 
			
		||||
				// add some limits
 | 
			
		||||
				if(w <= max || h <= 100) return false;
 | 
			
		||||
 | 
			
		||||
				// set centered animation
 | 
			
		||||
				container.css({
 | 
			
		||||
					'width': width - (mvX * 2),
 | 
			
		||||
					'height': height - (mvY * 2)
 | 
			
		||||
				});
 | 
			
		||||
				that.modal.css({
 | 
			
		||||
					'left': modalLeft + mvX,
 | 
			
		||||
					'top': modalTop + mvY
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_endResize: function () {
 | 
			
		||||
			this.modal.find('.cms_modal-shim').hide();
 | 
			
		||||
 | 
			
		||||
			$(document).unbind('mousemove.cms');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_setBreadcrumb: function (breadcrumb) {
 | 
			
		||||
			var bread = this.modal.find('.cms_modal-breadcrumb');
 | 
			
		||||
			var crumb = '';
 | 
			
		||||
 | 
			
		||||
			// cancel if there is no breadcrumb)
 | 
			
		||||
			if(!breadcrumb || breadcrumb.length <= 0) return false;
 | 
			
		||||
			if(!breadcrumb[0].title) return false;
 | 
			
		||||
 | 
			
		||||
			// load breadcrumb
 | 
			
		||||
			$.each(breadcrumb, function (index, item) {
 | 
			
		||||
				// check if the item is the last one
 | 
			
		||||
				var last = (index >= breadcrumb.length - 1) ? 'cms_modal-breadcrumb-last' : '';
 | 
			
		||||
				// render breadcrumb
 | 
			
		||||
				crumb += '<a href="' + item.url + '" class="' + last + '"><span>' + item.title + '</span></a>';
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// attach elements
 | 
			
		||||
			bread.find('.cms_modal-breadcrumb-items').html(crumb);
 | 
			
		||||
 | 
			
		||||
			// show breadcrumb
 | 
			
		||||
			bread.show();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_setButtons: function (iframe) {
 | 
			
		||||
			var djangoSuit = iframe.contents().find('.suit-columns').length > 0;
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var row;
 | 
			
		||||
			if (!djangoSuit) {
 | 
			
		||||
				row = iframe.contents().find('.submit-row:eq(0)');
 | 
			
		||||
			} else {
 | 
			
		||||
				row = iframe.contents().find('.save-box:eq(0)');
 | 
			
		||||
			}
 | 
			
		||||
			// hide all submit-rows
 | 
			
		||||
			iframe.contents().find('.submit-row').hide();
 | 
			
		||||
			var buttons = row.find('input, a, button');
 | 
			
		||||
			var render = $('<span />'); // seriously jquery...
 | 
			
		||||
 | 
			
		||||
			// if there are no given buttons within the submit-row area
 | 
			
		||||
			// scan deeper within the form itself
 | 
			
		||||
			if(!buttons.length) {
 | 
			
		||||
				row = iframe.contents().find('body:not(.change-list) #content form:eq(0)');
 | 
			
		||||
				buttons = row.find('input[type="submit"], button[type="submit"]');
 | 
			
		||||
				buttons.addClass('deletelink')
 | 
			
		||||
					.hide();
 | 
			
		||||
			}
 | 
			
		||||
			// attach relation id
 | 
			
		||||
			buttons.each(function (index, item) {
 | 
			
		||||
				$(item).attr('data-rel', '_' + index);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// loop over input buttons
 | 
			
		||||
			buttons.each(function (index, item) {
 | 
			
		||||
				item = $(item);
 | 
			
		||||
 | 
			
		||||
				// cancel if item is a hidden input
 | 
			
		||||
				if(item.attr('type') === 'hidden') return false;
 | 
			
		||||
 | 
			
		||||
				// create helper variables
 | 
			
		||||
				var title = item.attr('value') || item.text();
 | 
			
		||||
				var cls = 'cms_btn';
 | 
			
		||||
 | 
			
		||||
				// set additional special css classes
 | 
			
		||||
				if(item.hasClass('default')) cls = 'cms_btn cms_btn-action';
 | 
			
		||||
				if(item.hasClass('deletelink')) cls = 'cms_btn cms_btn-caution';
 | 
			
		||||
 | 
			
		||||
				// create the element and attach events
 | 
			
		||||
				var el = $('<div class="'+cls+' '+item.attr('class')+'">'+title+'</div>');
 | 
			
		||||
					el.bind(that.click, function () {
 | 
			
		||||
						if(item.is('input') || item.is('button')) item[0].click();
 | 
			
		||||
						if(item.is('a')) that._loadContent(item.prop('href'), title);
 | 
			
		||||
 | 
			
		||||
						// trigger only when blue action buttons are triggered
 | 
			
		||||
						if(item.hasClass('default') || item.hasClass('deletelink')) {
 | 
			
		||||
 							that.options.newPlugin = null;
 | 
			
		||||
 							// reset onClose when delete is triggered
 | 
			
		||||
							if(item.hasClass('deletelink')) that.options.onClose = null;
 | 
			
		||||
							// hide iframe
 | 
			
		||||
							that.modal.find('.cms_modal-frame iframe').hide();
 | 
			
		||||
							// page has been saved or deleted, run checkup
 | 
			
		||||
							that.saved = true;
 | 
			
		||||
						}
 | 
			
		||||
					});
 | 
			
		||||
 | 
			
		||||
				// append element
 | 
			
		||||
				render.append(el);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// manually add cancel button at the end
 | 
			
		||||
			var cancel = $('<div class="cms_btn">'+that.config.lang.cancel+'</div>');
 | 
			
		||||
				cancel.bind(that.click, function () {
 | 
			
		||||
					that.options.onClose = false;
 | 
			
		||||
					that.close();
 | 
			
		||||
				});
 | 
			
		||||
			render.append(cancel);
 | 
			
		||||
 | 
			
		||||
			// render buttons
 | 
			
		||||
			this.modal.find('.cms_modal-buttons').html(render);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_loadContent: function (url, name) {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			// FIXME: A better fix is needed for '&' being interpreted as the
 | 
			
		||||
			// start of en entity by jQuery. See #3404
 | 
			
		||||
			url = url.replace('&', '&');
 | 
			
		||||
			// now refresh the content
 | 
			
		||||
			var iframe = $('<iframe src="'+url+'" class="" frameborder="0" />');
 | 
			
		||||
				iframe.css('visibility', 'hidden');
 | 
			
		||||
			var holder = this.modal.find('.cms_modal-frame');
 | 
			
		||||
 | 
			
		||||
			// set correct title
 | 
			
		||||
			var title = this.modal.find('.cms_modal-title');
 | 
			
		||||
				title.html(name || ' ');
 | 
			
		||||
 | 
			
		||||
			// ensure previous iframe is hidden
 | 
			
		||||
			holder.find('iframe').css('visibility', 'hidden');
 | 
			
		||||
 | 
			
		||||
			// attach load event for iframe to prevent flicker effects
 | 
			
		||||
			iframe.bind('load', function () {
 | 
			
		||||
				// check if iframe can be accessed
 | 
			
		||||
				try {
 | 
			
		||||
					iframe.contents();
 | 
			
		||||
				} catch (error) {
 | 
			
		||||
					CMS.API.Toolbar.showError('<strong>' + error + '</strong>');
 | 
			
		||||
					that.close();
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// show messages in toolbar if provided
 | 
			
		||||
				var messages = iframe.contents().find('.messagelist li');
 | 
			
		||||
					if(messages.length) CMS.API.Toolbar.openMessage(messages.eq(0).text());
 | 
			
		||||
					messages.remove();
 | 
			
		||||
				var contents = iframe.contents();
 | 
			
		||||
 | 
			
		||||
				// determine if we should close the modal or reload
 | 
			
		||||
				if(messages.length && that.enforceReload) that.reloadBrowser();
 | 
			
		||||
				if(messages.length && that.enforceClose) {
 | 
			
		||||
					that.close();
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// after iframe is loaded append css
 | 
			
		||||
				contents.find('head').append($('<link rel="stylesheet" type="text/css" href="' + that.config.urls.static + that.options.urls.css_modal + '" />'));
 | 
			
		||||
 | 
			
		||||
				// adding django hacks
 | 
			
		||||
				contents.find('.viewsitelink').attr('target', '_top');
 | 
			
		||||
 | 
			
		||||
				// set modal buttons
 | 
			
		||||
				that._setButtons($(this));
 | 
			
		||||
 | 
			
		||||
				// when an error occurs, reset the saved status so the form can be checked and validated again
 | 
			
		||||
				if(iframe.contents().find('.errornote').length || iframe.contents().find('.errorlist').length) {
 | 
			
		||||
					that.saved = false;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// when the window has been changed pressing the blue or red button, we need to run a reload check
 | 
			
		||||
				// also check that no delete-confirmation is required
 | 
			
		||||
				if(that.saved && !contents.find('.delete-confirmation').length) {
 | 
			
		||||
					that.reloadBrowser(window.location.href, false, true);
 | 
			
		||||
				} else {
 | 
			
		||||
					iframe.show();
 | 
			
		||||
					// set title of not provided
 | 
			
		||||
					var innerTitle = iframe.contents().find('#content h1:eq(0)');
 | 
			
		||||
					if(name === undefined) title.html(innerTitle.text());
 | 
			
		||||
					innerTitle.remove();
 | 
			
		||||
 | 
			
		||||
					// than show
 | 
			
		||||
					iframe.css('visibility', 'visible');
 | 
			
		||||
 | 
			
		||||
					// append ready state
 | 
			
		||||
					iframe.data('ready', true);
 | 
			
		||||
 | 
			
		||||
					// attach close event
 | 
			
		||||
					contents.find('body').bind('keydown.cms', function (e) {
 | 
			
		||||
						if(e.keyCode === 27) that.close();
 | 
			
		||||
					});
 | 
			
		||||
					contents.find('body').addClass('cms_modal-window');
 | 
			
		||||
 | 
			
		||||
					// figure out if .object-tools is available
 | 
			
		||||
					if(contents.find('.object-tools').length) {
 | 
			
		||||
						contents.find('#content').css('padding-top', 38);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// inject
 | 
			
		||||
			setTimeout(function () {
 | 
			
		||||
				that.modal.find('.cms_modal-body').addClass('cms_loader');
 | 
			
		||||
				holder.html(iframe);
 | 
			
		||||
			}, this.options.modalDuration);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_changeContent: function (el) {
 | 
			
		||||
			if(el.hasClass('cms_modal-breadcrumb-last')) return false;
 | 
			
		||||
 | 
			
		||||
			var parents = el.parent().find('a');
 | 
			
		||||
				parents.removeClass('cms_modal-breadcrumb-last');
 | 
			
		||||
 | 
			
		||||
			el.addClass('cms_modal-breadcrumb-last');
 | 
			
		||||
 | 
			
		||||
			this._loadContent(el.attr('href'));
 | 
			
		||||
 | 
			
		||||
			// update title
 | 
			
		||||
			this.modal.find('.cms_modal-title').text(el.text());
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
							
								
								
									
										775
									
								
								static/cms/js/modules/cms.plugins.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,775 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS# */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
	/*!
 | 
			
		||||
	 * Plugins
 | 
			
		||||
	 * for created plugins or generics (static content)
 | 
			
		||||
	 */
 | 
			
		||||
	CMS.Plugin = new CMS.Class({
 | 
			
		||||
 | 
			
		||||
		implement: [CMS.API.Helpers],
 | 
			
		||||
 | 
			
		||||
		options: {
 | 
			
		||||
			'type': '', // bar, plugin or generic
 | 
			
		||||
			'placeholder_id': null,
 | 
			
		||||
			'plugin_type': '',
 | 
			
		||||
			'plugin_id': null,
 | 
			
		||||
			'plugin_language': '',
 | 
			
		||||
			'plugin_parent': null,
 | 
			
		||||
			'plugin_order': null,
 | 
			
		||||
			'plugin_breadcrumb': [],
 | 
			
		||||
			'plugin_restriction': [],
 | 
			
		||||
			'urls': {
 | 
			
		||||
				'add_plugin': '',
 | 
			
		||||
				'edit_plugin': '',
 | 
			
		||||
				'move_plugin': '',
 | 
			
		||||
				'copy_plugin': '',
 | 
			
		||||
				'delete_plugin': ''
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		initialize: function (container, options) {
 | 
			
		||||
			this.container = $('.' + container);
 | 
			
		||||
			this.options = $.extend(true, {}, this.options, options);
 | 
			
		||||
 | 
			
		||||
			// elements
 | 
			
		||||
			this.body = $(document);
 | 
			
		||||
 | 
			
		||||
			// states
 | 
			
		||||
			this.csrf = CMS.config.csrf;
 | 
			
		||||
			this.timer = function () {};
 | 
			
		||||
			this.timeout = 250;
 | 
			
		||||
			this.focused = false;
 | 
			
		||||
			this.click = (document.ontouchstart !== null) ? 'click.cms' : 'tap.cms click.cms';
 | 
			
		||||
 | 
			
		||||
			// bind data element to the container
 | 
			
		||||
			this.container.data('settings', this.options);
 | 
			
		||||
 | 
			
		||||
			// determine type of plugin
 | 
			
		||||
			switch(this.options.type) {
 | 
			
		||||
				case 'placeholder': // handler for placeholder bars
 | 
			
		||||
					this._setPlaceholder();
 | 
			
		||||
					this._collapsables();
 | 
			
		||||
					break;
 | 
			
		||||
				case 'plugin': // handler for all plugins
 | 
			
		||||
					this._setPlugin();
 | 
			
		||||
					this._collapsables();
 | 
			
		||||
					break;
 | 
			
		||||
				default: // handler for static content
 | 
			
		||||
					this._setGeneric();
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// initial methods
 | 
			
		||||
		_setPlaceholder: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var title = '.cms_dragbar-title';
 | 
			
		||||
			var expanded = 'cms_dragbar-title-expanded';
 | 
			
		||||
			var dragbar = $('.cms_dragbar-' + this.options.placeholder_id);
 | 
			
		||||
 | 
			
		||||
			// register the subnav on the placeholder
 | 
			
		||||
			this._setSubnav(dragbar.find('.cms_submenu'));
 | 
			
		||||
 | 
			
		||||
			// enable expanding/collapsing globally within the placeholder
 | 
			
		||||
			dragbar.find(title).bind(this.click, function () {
 | 
			
		||||
				($(this).hasClass(expanded)) ? that._collapseAll($(this)) : that._expandAll($(this));
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_setPlugin: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var timer = function () {};
 | 
			
		||||
 | 
			
		||||
			// adds double click to edit
 | 
			
		||||
			this.container.bind('dblclick', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
				that.editPlugin(that.options.urls.edit_plugin, that.options.plugin_name, that.options.plugin_breadcrumb);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// adds edit tooltip
 | 
			
		||||
			this.container.bind('mouseover.cms mouseout.cms', function (e) {
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
				var name = that.options.plugin_name;
 | 
			
		||||
				var id = that.options.plugin_id;
 | 
			
		||||
				(e.type === 'mouseover') ? that.showTooltip(name, id) : that.hideTooltip();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// adds listener for all plugin updates
 | 
			
		||||
			this.container.bind('cms.plugins.update', function (e) {
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
				that.movePlugin();
 | 
			
		||||
			});
 | 
			
		||||
			// adds listener for copy/paste updates
 | 
			
		||||
			this.container.bind('cms.plugin.update', function (e) {
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
 | 
			
		||||
				var el = $(e.delegateTarget);
 | 
			
		||||
				var dragitem = $('.cms_draggable-' + el.data('settings').plugin_id);
 | 
			
		||||
				var placeholder_id = that._getId(dragitem.parents('.cms_draggables').last().prevAll('.cms_dragbar').first());
 | 
			
		||||
 | 
			
		||||
				// if placeholder_id is empty, cancel
 | 
			
		||||
				if(!placeholder_id) return false;
 | 
			
		||||
 | 
			
		||||
				var data = el.data('settings');
 | 
			
		||||
					data.target = placeholder_id;
 | 
			
		||||
					data.parent= that._getId(dragitem.parent().closest('.cms_draggable'));
 | 
			
		||||
 | 
			
		||||
				that.copyPlugin(data);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// variables for dragitems
 | 
			
		||||
			var draggable = $('.cms_draggable-' + this.options.plugin_id);
 | 
			
		||||
			var dragitem = draggable.find('> .cms_dragitem');
 | 
			
		||||
			var submenu = draggable.find('.cms_submenu:eq(0)');
 | 
			
		||||
			var submenus = $('.cms_draggables').find('.cms_submenu');
 | 
			
		||||
 | 
			
		||||
			// attach event to the plugin menu
 | 
			
		||||
			this._setSubnav(draggable.find('> .cms_dragitem .cms_submenu'));
 | 
			
		||||
 | 
			
		||||
			// adds event for hiding the subnav
 | 
			
		||||
			draggable.bind('mouseenter mouseleave mouseover', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
 | 
			
		||||
				if(that.focused) return false;
 | 
			
		||||
 | 
			
		||||
				if(e.type === 'mouseenter' || e.type === 'mouseover') $(this).data('active', true);
 | 
			
		||||
				if(e.type === 'mouseleave') {
 | 
			
		||||
					$(this).data('active', false);
 | 
			
		||||
					submenus.hide();
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// add timeout to determine if we should hide the element
 | 
			
		||||
				setTimeout(function () {
 | 
			
		||||
					if(!$(e.currentTarget).data('active')) {
 | 
			
		||||
						$(e.currentTarget).find('.cms_submenu:eq(0)').hide();
 | 
			
		||||
					}
 | 
			
		||||
				}, 100);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// adds event for showing the subnav
 | 
			
		||||
			dragitem.bind('mouseenter', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
 | 
			
		||||
				submenus.hide();
 | 
			
		||||
				submenu.show();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// adds double click to edit
 | 
			
		||||
			dragitem.bind('dblclick', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
				that.editPlugin(that.options.urls.edit_plugin, that.options.plugin_name, that.options.plugin_breadcrumb);
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_setGeneric: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			// adds double click to edit
 | 
			
		||||
			this.container.bind('dblclick', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
				that.editPlugin(that.options.urls.edit_plugin, that.options.plugin_name, []);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// adds edit tooltip
 | 
			
		||||
			this.container.bind('mouseover.cms mouseout.cms', function (e) {
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
				var name = that.options.plugin_name;
 | 
			
		||||
				var id = that.options.plugin_id;
 | 
			
		||||
				(e.type === 'mouseover') ? that.showTooltip(name, id) : that.hideTooltip();
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// public methods
 | 
			
		||||
		addPlugin: function (type, name, parent) {
 | 
			
		||||
			// cancel request if already in progress
 | 
			
		||||
			if(CMS.API.locked) return false;
 | 
			
		||||
			CMS.API.locked = true;
 | 
			
		||||
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var data = {
 | 
			
		||||
				'placeholder_id': this.options.placeholder_id,
 | 
			
		||||
				'plugin_type': type,
 | 
			
		||||
				'plugin_parent': parent || '',
 | 
			
		||||
				'plugin_language': this.options.plugin_language,
 | 
			
		||||
				'csrfmiddlewaretoken': this.csrf
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			$.ajax({
 | 
			
		||||
				'type': 'POST',
 | 
			
		||||
				'url': this.options.urls.add_plugin,
 | 
			
		||||
				'data': data,
 | 
			
		||||
				'success': function (data) {
 | 
			
		||||
					CMS.API.locked = false;
 | 
			
		||||
					that.newPlugin = data;
 | 
			
		||||
					that.editPlugin(data.url, name, data.breadcrumb);
 | 
			
		||||
				},
 | 
			
		||||
				'error': function (jqXHR) {
 | 
			
		||||
					CMS.API.locked = false;
 | 
			
		||||
					var msg = CMS.config.lang.error;
 | 
			
		||||
					// trigger error
 | 
			
		||||
					that._showError(msg + jqXHR.responseText || jqXHR.status + ' ' + jqXHR.statusText);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		editPlugin: function (url, name, breadcrumb) {
 | 
			
		||||
			// trigger modal window
 | 
			
		||||
			var modal = new CMS.Modal({
 | 
			
		||||
				'newPlugin': this.newPlugin || false,
 | 
			
		||||
				'onClose': this.options.onClose || false,
 | 
			
		||||
				'redirectOnClose': this.options.redirectOnClose || false
 | 
			
		||||
			});
 | 
			
		||||
			modal.open(url, name, breadcrumb);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		copyPlugin: function (options, source_language) {
 | 
			
		||||
			// cancel request if already in progress
 | 
			
		||||
			if(CMS.API.locked) return false;
 | 
			
		||||
			CMS.API.locked = true;
 | 
			
		||||
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var move = (options || source_language) ? true : false;
 | 
			
		||||
			// set correct options
 | 
			
		||||
			options = options || this.options;
 | 
			
		||||
			if(source_language) {
 | 
			
		||||
				options.target = options.placeholder_id;
 | 
			
		||||
				options.plugin_id = '';
 | 
			
		||||
				options.parent = '';
 | 
			
		||||
			}
 | 
			
		||||
			else {
 | 
			
		||||
				source_language = options.plugin_language
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			var data = {
 | 
			
		||||
				'source_placeholder_id': options.placeholder_id,
 | 
			
		||||
				'source_plugin_id': options.plugin_id || '',
 | 
			
		||||
				'source_language': source_language,
 | 
			
		||||
				'target_plugin_id': options.parent || '',
 | 
			
		||||
				'target_placeholder_id': options.target || CMS.config.clipboard.id,
 | 
			
		||||
				'target_language': options.page_language || source_language,
 | 
			
		||||
				'csrfmiddlewaretoken': this.csrf
 | 
			
		||||
			};
 | 
			
		||||
			var request = {
 | 
			
		||||
				'type': 'POST',
 | 
			
		||||
				'url': options.urls.copy_plugin,
 | 
			
		||||
				'data': data,
 | 
			
		||||
				'success': function () {
 | 
			
		||||
					CMS.API.Toolbar.openMessage(CMS.config.lang.success);
 | 
			
		||||
					// reload
 | 
			
		||||
					CMS.API.Helpers.reloadBrowser();
 | 
			
		||||
				},
 | 
			
		||||
				'error': function (jqXHR) {
 | 
			
		||||
					CMS.API.locked = false;
 | 
			
		||||
					var msg = CMS.config.lang.error;
 | 
			
		||||
					// trigger error
 | 
			
		||||
					that._showError(msg + jqXHR.responseText || jqXHR.status + ' ' + jqXHR.statusText);
 | 
			
		||||
				}
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			if(move) {
 | 
			
		||||
				$.ajax(request);
 | 
			
		||||
			} else {
 | 
			
		||||
				// ensure clipboard is cleaned
 | 
			
		||||
				CMS.API.Clipboard.clear(function () {
 | 
			
		||||
					$.ajax(request);
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		cutPlugin: function () {
 | 
			
		||||
			// if cut is once triggered, prevend additional actions
 | 
			
		||||
			if(CMS.API.locked) return false;
 | 
			
		||||
			CMS.API.locked = true;
 | 
			
		||||
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var data = {
 | 
			
		||||
				'placeholder_id': CMS.config.clipboard.id,
 | 
			
		||||
				'plugin_id': this.options.plugin_id,
 | 
			
		||||
				'plugin_parent': '',
 | 
			
		||||
				'plugin_language': this.options.page_language,
 | 
			
		||||
				'plugin_order': [this.options.plugin_id],
 | 
			
		||||
				'csrfmiddlewaretoken': this.csrf
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			// ensure clipboard is cleaned
 | 
			
		||||
			CMS.API.Clipboard.clear(function () {
 | 
			
		||||
				// cancel request if already in progress
 | 
			
		||||
				if(CMS.API.locked) return false;
 | 
			
		||||
				CMS.API.locked = true;
 | 
			
		||||
 | 
			
		||||
				// move plugin
 | 
			
		||||
				$.ajax({
 | 
			
		||||
					'type': 'POST',
 | 
			
		||||
					'url': that.options.urls.move_plugin,
 | 
			
		||||
					'data': data,
 | 
			
		||||
					'success': function (response) {
 | 
			
		||||
						CMS.API.Toolbar.openMessage(CMS.config.lang.success);
 | 
			
		||||
						// if response is reload
 | 
			
		||||
						CMS.API.Helpers.reloadBrowser();
 | 
			
		||||
					},
 | 
			
		||||
					'error': function (jqXHR) {
 | 
			
		||||
						CMS.API.locked = false;
 | 
			
		||||
						var msg = CMS.config.lang.error;
 | 
			
		||||
						// trigger error
 | 
			
		||||
						that._showError(msg + jqXHR.responseText || jqXHR.status + ' ' + jqXHR.statusText);
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		movePlugin: function (options) {
 | 
			
		||||
			// cancel request if already in progress
 | 
			
		||||
			if(CMS.API.locked) return false;
 | 
			
		||||
			CMS.API.locked = true;
 | 
			
		||||
 | 
			
		||||
			var that = this;
 | 
			
		||||
			// set correct options
 | 
			
		||||
			options = options || this.options;
 | 
			
		||||
 | 
			
		||||
			var plugin = $('.cms_plugin-' + options.plugin_id);
 | 
			
		||||
			var dragitem = $('.cms_draggable-' + options.plugin_id);
 | 
			
		||||
 | 
			
		||||
			// SETTING POSITION
 | 
			
		||||
			this._setPosition(options.plugin_id, plugin, dragitem);
 | 
			
		||||
 | 
			
		||||
			// SAVING POSITION
 | 
			
		||||
			var placeholder_id = this._getId(dragitem.parents('.cms_draggables').last().prevAll('.cms_dragbar').first());
 | 
			
		||||
			var plugin_parent = this._getId(dragitem.parent().closest('.cms_draggable'));
 | 
			
		||||
			var plugin_order = this._getIds(dragitem.siblings('.cms_draggable').andSelf());
 | 
			
		||||
 | 
			
		||||
			// cancel here if we have no placeholder id
 | 
			
		||||
			if(placeholder_id === false) return false;
 | 
			
		||||
 | 
			
		||||
			// gather the data for ajax request
 | 
			
		||||
			var data = {
 | 
			
		||||
				'placeholder_id': placeholder_id,
 | 
			
		||||
				'plugin_id': options.plugin_id,
 | 
			
		||||
				'plugin_parent': plugin_parent || '',
 | 
			
		||||
				 // this is a hack: when moving to different languages use the global language
 | 
			
		||||
				'plugin_language': options.page_language,
 | 
			
		||||
				'plugin_order': plugin_order,
 | 
			
		||||
				'csrfmiddlewaretoken': this.csrf
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			$.ajax({
 | 
			
		||||
				'type': 'POST',
 | 
			
		||||
				'url': options.urls.move_plugin,
 | 
			
		||||
				'data': data,
 | 
			
		||||
				'success': function (response) {
 | 
			
		||||
					// if response is reload
 | 
			
		||||
					if(response.reload) CMS.API.Helpers.reloadBrowser();
 | 
			
		||||
 | 
			
		||||
					// enable actions again
 | 
			
		||||
					CMS.API.locked = false;
 | 
			
		||||
 | 
			
		||||
					// TODO: show only if(response.status)
 | 
			
		||||
					that._showSuccess(dragitem);
 | 
			
		||||
				},
 | 
			
		||||
				'error': function (jqXHR) {
 | 
			
		||||
					CMS.API.locked = false;
 | 
			
		||||
					var msg = CMS.config.lang.error;
 | 
			
		||||
					// trigger error
 | 
			
		||||
					that._showError(msg + jqXHR.responseText || jqXHR.status + ' ' + jqXHR.statusText);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// show publish button
 | 
			
		||||
			$('.cms_btn-publish').addClass('cms_btn-publish-active').parent().show();
 | 
			
		||||
 | 
			
		||||
			// enable revert to live
 | 
			
		||||
			$('.cms_toolbar-revert').removeClass('cms_toolbar-item-navigation-disabled');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		deletePlugin: function (url, name, breadcrumb) {
 | 
			
		||||
			// trigger modal window
 | 
			
		||||
			var modal = new CMS.Modal({
 | 
			
		||||
				'newPlugin': this.newPlugin || false,
 | 
			
		||||
				'onClose': this.options.onClose || false,
 | 
			
		||||
				'redirectOnClose': this.options.redirectOnClose || false
 | 
			
		||||
			});
 | 
			
		||||
			modal.open(url, name, breadcrumb);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// private methods
 | 
			
		||||
		_setPosition: function (id, plugin, dragitem) {
 | 
			
		||||
			// after we insert the plugin onto its new place, we need to figure out where to position it
 | 
			
		||||
			var prevItem = dragitem.prev('.cms_draggable');
 | 
			
		||||
			var nextItem = dragitem.next('.cms_draggable');
 | 
			
		||||
			var parent = dragitem.parent().closest('.cms_draggable');
 | 
			
		||||
			var child = $('.cms_plugin-' + this._getId(parent));
 | 
			
		||||
			var placeholder = dragitem.closest('.cms_dragarea');
 | 
			
		||||
 | 
			
		||||
			// determine if there are other plugins within the same level, this makes the move easier
 | 
			
		||||
			if(prevItem.length) {
 | 
			
		||||
				plugin.insertAfter($('.cms_plugin-' + this._getId(prevItem)));
 | 
			
		||||
			} else if(nextItem.length) {
 | 
			
		||||
				plugin.insertBefore($('.cms_plugin-' + this._getId(nextItem)));
 | 
			
		||||
			} else if(parent.length) {
 | 
			
		||||
				// if we can't find a plugin on the same level, we need to travel higher
 | 
			
		||||
				// for this we need to find the deepest child
 | 
			
		||||
				while(child.children().length) {
 | 
			
		||||
					child = child.children();
 | 
			
		||||
				}
 | 
			
		||||
				child.append(plugin);
 | 
			
		||||
			} else if(placeholder.length) {
 | 
			
		||||
				// we also need to cover the case if we move the plugin to an empty placeholder
 | 
			
		||||
				plugin.append($('.cms_plugin-' + this._getId(placeholder)));
 | 
			
		||||
			} else {
 | 
			
		||||
				// if we did not found a match, reload
 | 
			
		||||
				CMS.API.Helpers.reloadBrowser();
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		editPluginPostAjax: function(caller, toolbar, response){
 | 
			
		||||
			if (typeof toolbar == 'undefined' || typeof response == 'undefined') {
 | 
			
		||||
				return function(toolbar, response) {
 | 
			
		||||
					var that = caller;
 | 
			
		||||
					that.editPlugin(response['url'], that.options.plugin_name, response['breadcrumb']);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			that.editPlugin(response['url'], that.options.plugin_name, response['breadcrumb']);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_setSubnav: function (nav) {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			nav.bind('mouseenter mouseleave tap.cms', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
				(e.type === 'mouseenter') ? that._showSubnav($(this)) : that._hideSubnav($(this));
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			nav.find('a').bind('click.cms tap.cms', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
 | 
			
		||||
				// show loader and make sure scroll doesn't jump
 | 
			
		||||
				CMS.API.Toolbar._loader(true);
 | 
			
		||||
 | 
			
		||||
				var el = $(this);
 | 
			
		||||
 | 
			
		||||
				// set switch for subnav entries
 | 
			
		||||
				switch(el.attr('data-rel')) {
 | 
			
		||||
					case 'add':
 | 
			
		||||
						that.addPlugin(el.attr('href').replace('#', ''), el.text(), that._getId(el.closest('.cms_draggable')));
 | 
			
		||||
						break;
 | 
			
		||||
					case 'ajax_add':
 | 
			
		||||
						CMS.API.Toolbar.openAjax(el.attr('href'), JSON.stringify(el.data('post')), el.data('text'), that.editPluginPostAjax(that), el.data('on-success'));
 | 
			
		||||
						break;
 | 
			
		||||
					case 'edit':
 | 
			
		||||
						that.editPlugin(that.options.urls.edit_plugin, that.options.plugin_name, that.options.plugin_breadcrumb);
 | 
			
		||||
						break;
 | 
			
		||||
					case 'copy-lang':
 | 
			
		||||
						that.copyPlugin(this.options, el.attr('data-language'));
 | 
			
		||||
						break;
 | 
			
		||||
					case 'copy':
 | 
			
		||||
						that.copyPlugin();
 | 
			
		||||
						break;
 | 
			
		||||
					case 'cut':
 | 
			
		||||
						that.cutPlugin();
 | 
			
		||||
						break;
 | 
			
		||||
					case 'delete':
 | 
			
		||||
						that.deletePlugin(that.options.urls.delete_plugin, that.options.plugin_name, that.options.plugin_breadcrumb);
 | 
			
		||||
						break;
 | 
			
		||||
					default:
 | 
			
		||||
						CMS.API.Toolbar._loader(false);
 | 
			
		||||
						CMS.API.Toolbar._delegate(el);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			nav.find('input').bind('keyup keydown focus blur click', function (e) {
 | 
			
		||||
				if(e.type === 'focus') that.focused = true;
 | 
			
		||||
				if(e.type === 'blur' && !that.traverse) {
 | 
			
		||||
					that.focused = false;
 | 
			
		||||
					that._hideSubnav(nav);
 | 
			
		||||
				}
 | 
			
		||||
				if(e.type === 'keyup') {
 | 
			
		||||
					clearTimeout(that.timer);
 | 
			
		||||
					// keybound is not required
 | 
			
		||||
					that.timer = setTimeout(function () {
 | 
			
		||||
						that._searchSubnav(nav, $(e.currentTarget).val());
 | 
			
		||||
					}, 100);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// set data attributes for original top positioning
 | 
			
		||||
			nav.find('.cms_submenu-dropdown').each(function () {
 | 
			
		||||
				$(this).data('top', $(this).css('top'))
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// prevent propagnation
 | 
			
		||||
			nav.bind(this.click, function (e) {
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_showSubnav: function (nav) {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var dropdown = nav.find('.cms_submenu-dropdown');
 | 
			
		||||
			var offset = parseInt(dropdown.data('top'));
 | 
			
		||||
 | 
			
		||||
			// clearing
 | 
			
		||||
			clearTimeout(this.timer);
 | 
			
		||||
 | 
			
		||||
			// add small delay before showing submenu
 | 
			
		||||
			this.timer = setTimeout(function () {
 | 
			
		||||
				// reset z indexes
 | 
			
		||||
				var reset = $('.cms_submenu').parentsUntil('.cms_dragarea');
 | 
			
		||||
				var scrollHint = nav.find('.cms_submenu-scroll-hint');
 | 
			
		||||
 | 
			
		||||
				reset.css('z-index', 0);
 | 
			
		||||
 | 
			
		||||
				var parents = nav.parentsUntil('.cms_dragarea');
 | 
			
		||||
					parents.css('z-index', 999);
 | 
			
		||||
 | 
			
		||||
				// show subnav
 | 
			
		||||
				nav.find('.cms_submenu-quicksearch').show();
 | 
			
		||||
 | 
			
		||||
				// set visible states
 | 
			
		||||
				nav.find('> .cms_submenu-dropdown').show().on('scroll', function () {
 | 
			
		||||
					scrollHint.fadeOut(100);
 | 
			
		||||
					$(this).off('scroll');
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				// show scrollHint for FF on OSX
 | 
			
		||||
				window.console.log(nav[0], nav[0].scrollHeight);
 | 
			
		||||
				if(nav[0].scrollHeight > 245) scrollHint.show();
 | 
			
		||||
 | 
			
		||||
			}, 100);
 | 
			
		||||
 | 
			
		||||
			// add key events
 | 
			
		||||
			$(document).unbind('keydown.cms');
 | 
			
		||||
			$(document).bind('keydown.cms', function (e) {
 | 
			
		||||
				var anchors = nav.find('.cms_submenu-item:visible a');
 | 
			
		||||
				var index = anchors.index(anchors.filter(':focus'));
 | 
			
		||||
 | 
			
		||||
				// bind arrow down and tab keys
 | 
			
		||||
				if(e.keyCode === 40 || e.keyCode === 9) {
 | 
			
		||||
					that.traverse = true;
 | 
			
		||||
					e.preventDefault();
 | 
			
		||||
					if(index >= 0 && index < anchors.length - 1) {
 | 
			
		||||
						anchors.eq(index + 1).focus();
 | 
			
		||||
					} else {
 | 
			
		||||
						anchors.eq(0).focus();
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// bind arrow up keys
 | 
			
		||||
				if(e.keyCode === 38) {
 | 
			
		||||
					e.preventDefault();
 | 
			
		||||
					if(anchors.is(':focus')) {
 | 
			
		||||
						anchors.eq(index - 1).focus();
 | 
			
		||||
					} else {
 | 
			
		||||
						anchors.eq(anchors.length).focus();
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// hide subnav when hitting enter or escape
 | 
			
		||||
				if(e.keyCode === 13 || e.keyCode === 27) {
 | 
			
		||||
					that.traverse = false;
 | 
			
		||||
					nav.find('input').blur();
 | 
			
		||||
					that._hideSubnav(nav);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// calculate subnav bounds
 | 
			
		||||
			if($(window).height() + $(window).scrollTop() - nav.offset().top - dropdown.height() <= 10 && nav.offset().top - dropdown.height() >= 0) {
 | 
			
		||||
				dropdown.css('top', 'auto');
 | 
			
		||||
				dropdown.css('bottom', offset);
 | 
			
		||||
				// if parent is within a plugin, add additional offset
 | 
			
		||||
				if(dropdown.closest('.cms_draggable').length) dropdown.css('bottom', offset - 1);
 | 
			
		||||
			} else {
 | 
			
		||||
				dropdown.css('top', offset);
 | 
			
		||||
				dropdown.css('bottom', 'auto');
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_hideSubnav: function (nav) {
 | 
			
		||||
			clearTimeout(this.timer);
 | 
			
		||||
 | 
			
		||||
			var that = this;
 | 
			
		||||
			// cancel if quicksearch is focues
 | 
			
		||||
			if(this.focused) return false;
 | 
			
		||||
 | 
			
		||||
			// set correct active state
 | 
			
		||||
			nav.closest('.cms_draggable').data('active', false);
 | 
			
		||||
 | 
			
		||||
			this.timer = setTimeout(function () {
 | 
			
		||||
				// set visible states
 | 
			
		||||
				nav.find('> .cms_submenu-dropdown').hide();
 | 
			
		||||
				nav.find('.cms_submenu-quicksearch').hide();
 | 
			
		||||
				// reset search
 | 
			
		||||
				nav.find('input').val('');
 | 
			
		||||
				that._searchSubnav(nav, '');
 | 
			
		||||
			}, this.timeout);
 | 
			
		||||
 | 
			
		||||
			// reset relativity
 | 
			
		||||
			$('.cms_dragbar').css('position', '');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_searchSubnav: function (nav, value) {
 | 
			
		||||
			var items = nav.find('.cms_submenu-item');
 | 
			
		||||
			var titles = nav.find('.cms_submenu-item-title');
 | 
			
		||||
 | 
			
		||||
			// cancel if value is zero
 | 
			
		||||
			if(value === '') {
 | 
			
		||||
				items.add(titles).show();
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// loop through items and figure out if we need to hide items
 | 
			
		||||
			items.find('a, span').each(function (index, item) {
 | 
			
		||||
				item = $(item);
 | 
			
		||||
				var text = item.text().toLowerCase();
 | 
			
		||||
				var search = value.toLowerCase();
 | 
			
		||||
 | 
			
		||||
				(text.indexOf(search) >= 0) ? item.parent().show() : item.parent().hide();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// check if a title is matching
 | 
			
		||||
			titles.filter(':visible').each(function (index, item) {
 | 
			
		||||
				titles.hide();
 | 
			
		||||
				$(item).nextUntil('.cms_submenu-item-title').show();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// always display title of a category
 | 
			
		||||
			items.filter(':visible').each(function (index, item) {
 | 
			
		||||
				if($(item).prev().hasClass('cms_submenu-item-title')) {
 | 
			
		||||
					$(item).prev().show();
 | 
			
		||||
				} else {
 | 
			
		||||
					$(item).prevUntil('.cms_submenu-item-title').last().prev().show();
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// if there is no element visible, show only first categoriy
 | 
			
		||||
			nav.find('.cms_submenu-dropdown').show();
 | 
			
		||||
			if(items.add(titles).filter(':visible').length <= 0) {
 | 
			
		||||
				nav.find('.cms_submenu-dropdown').hide();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// hide scrollHint
 | 
			
		||||
			nav.find('.cms_submenu-scroll-hint').hide();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_collapsables: function () {
 | 
			
		||||
			// one time setup
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var settings = CMS.settings;
 | 
			
		||||
			var draggable = $('.cms_draggable-' + this.options.plugin_id);
 | 
			
		||||
 | 
			
		||||
			// check which button should be shown for collapsemenu
 | 
			
		||||
			this.container.each(function (index, item) {
 | 
			
		||||
				var els = $(item).find('.cms_dragitem-collapsable');
 | 
			
		||||
				var open = els.filter('.cms_dragitem-expanded');
 | 
			
		||||
				if(els.length === open.length && (els.length + open.length !== 0)) {
 | 
			
		||||
					$(item).find('.cms_dragbar-title').addClass('cms_dragbar-title-expanded');
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
			// cancel here if its not a draggable
 | 
			
		||||
			if(!draggable.length) return false;
 | 
			
		||||
 | 
			
		||||
			// attach events to draggable
 | 
			
		||||
			draggable.find('> .cms_dragitem-collapsable').bind(this.click, function () {
 | 
			
		||||
				var el = $(this);
 | 
			
		||||
				var id = that._getId($(this).parent());
 | 
			
		||||
 | 
			
		||||
				var settings = CMS.settings;
 | 
			
		||||
					settings.states = settings.states || [];
 | 
			
		||||
 | 
			
		||||
				// collapsable function and save states
 | 
			
		||||
				if(el.hasClass('cms_dragitem-expanded')) {
 | 
			
		||||
					settings.states.splice($.inArray(id, settings.states), 1);
 | 
			
		||||
					el.removeClass('cms_dragitem-expanded').parent().find('> .cms_draggables').hide();
 | 
			
		||||
				} else {
 | 
			
		||||
					settings.states.push(id);
 | 
			
		||||
					el.addClass('cms_dragitem-expanded').parent().find('> .cms_draggables').show();
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// save settings
 | 
			
		||||
				CMS.API.Toolbar.setSettings(settings);
 | 
			
		||||
			});
 | 
			
		||||
			// adds double click event
 | 
			
		||||
			draggable.bind('dblclick', function (e) {
 | 
			
		||||
				e.stopPropagation();
 | 
			
		||||
				$('.cms_plugin-' + that._getId($(this))).trigger('dblclick');
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// only needs to be excecuted once
 | 
			
		||||
			if(CMS.Toolbar.ready) return false;
 | 
			
		||||
 | 
			
		||||
			// removing dublicate entries
 | 
			
		||||
			var sortedArr = settings.states.sort();
 | 
			
		||||
			var filteredArray = [];
 | 
			
		||||
			for(var i = 0; i < sortedArr.length; i++) {
 | 
			
		||||
				if(sortedArr[i] !== sortedArr[i + 1]) {
 | 
			
		||||
					filteredArray.push(sortedArr[i]);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			settings.states = filteredArray;
 | 
			
		||||
 | 
			
		||||
			// loop through the items
 | 
			
		||||
			$.each(CMS.settings.states, function (index, id) {
 | 
			
		||||
				var el = $('.cms_draggable-' + id);
 | 
			
		||||
				// only add this class to elements which have a draggable area
 | 
			
		||||
				if(el.find('.cms_draggables').length) {
 | 
			
		||||
					el.find('> .cms_draggables').show();
 | 
			
		||||
					el.find('> .cms_dragitem').addClass('cms_dragitem-expanded');
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// set global setup
 | 
			
		||||
			CMS.Toolbar.ready = true;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_expandAll: function (el) {
 | 
			
		||||
			var items = el.closest('.cms_dragarea').find('.cms_dragitem-collapsable');
 | 
			
		||||
			// cancel if there are no items
 | 
			
		||||
			if(!items.length) return false;
 | 
			
		||||
			items.each(function () {
 | 
			
		||||
				if(!$(this).hasClass('cms_dragitem-expanded')) $(this).trigger('click.cms');
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			el.addClass('cms_dragbar-title-expanded');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_collapseAll: function (el) {
 | 
			
		||||
			var items = el.closest('.cms_dragarea').find('.cms_dragitem-collapsable');
 | 
			
		||||
			items.each(function () {
 | 
			
		||||
				if($(this).hasClass('cms_dragitem-expanded')) $(this).trigger('click.cms');
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			el.removeClass('cms_dragbar-title-expanded');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_getId: function (el) {
 | 
			
		||||
			return CMS.API.StructureBoard.getId(el);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_getIds: function (els) {
 | 
			
		||||
			return CMS.API.StructureBoard.getIds(els);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_showError: function (msg) {
 | 
			
		||||
			return CMS.API.Toolbar.showError(msg, true);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_showSuccess: function (el) {
 | 
			
		||||
			var tpl = $('<div class="cms_dragitem-success"></div>');
 | 
			
		||||
			el.append(tpl);
 | 
			
		||||
			// start animation
 | 
			
		||||
			tpl.fadeOut(function () {
 | 
			
		||||
				$(this).remove()
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
							
								
								
									
										366
									
								
								static/cms/js/modules/cms.sideframe.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,366 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS# */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
	/*!
 | 
			
		||||
	 * Sideframe
 | 
			
		||||
	 * Controls a cms specific sideframe
 | 
			
		||||
	 */
 | 
			
		||||
	CMS.Sideframe = new CMS.Class({
 | 
			
		||||
 | 
			
		||||
		implement: [CMS.API.Helpers],
 | 
			
		||||
 | 
			
		||||
		options: {
 | 
			
		||||
			'onClose': false,
 | 
			
		||||
			'sideframeDuration': 300,
 | 
			
		||||
			'sideframeWidth': 320,
 | 
			
		||||
			'urls': {
 | 
			
		||||
				'css_sideframe': 'cms/css/cms.toolbar.sideframe.css'
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		initialize: function (options) {
 | 
			
		||||
			this.options = $.extend(true, {}, this.options, options);
 | 
			
		||||
			this.config = CMS.config;
 | 
			
		||||
			this.settings = CMS.settings;
 | 
			
		||||
 | 
			
		||||
			// elements
 | 
			
		||||
			this.sideframe = $('.cms_sideframe');
 | 
			
		||||
			this.body = $('html');
 | 
			
		||||
 | 
			
		||||
			// states
 | 
			
		||||
			this.click = (document.ontouchstart !== null) ? 'click.cms' : 'touchend.cms click.cms';
 | 
			
		||||
			this.enforceReload = false;
 | 
			
		||||
 | 
			
		||||
			// if the modal is initialized the first time, set the events
 | 
			
		||||
			if(!this.sideframe.data('ready')) this._events();
 | 
			
		||||
 | 
			
		||||
			// ready sideframe
 | 
			
		||||
			this.sideframe.data('ready', true);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// initial methods
 | 
			
		||||
		_events: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			// attach close event
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-close').bind(this.click, function () {
 | 
			
		||||
				that.close(true);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// attach hide event
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-hide').bind(this.click, function () {
 | 
			
		||||
				if($(this).hasClass('cms_sideframe-hidden')) {
 | 
			
		||||
					that.settings.sideframe.hidden = false;
 | 
			
		||||
					that._show(that.settings.sideframe.position || that.options.sideframeWidth, true);
 | 
			
		||||
				} else {
 | 
			
		||||
					that.settings.sideframe.hidden = true;
 | 
			
		||||
					that._hide();
 | 
			
		||||
				}
 | 
			
		||||
				that.settings = that.setSettings(that.settings);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// attach maximize event
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-maximize').bind(this.click, function () {
 | 
			
		||||
				if($(this).hasClass('cms_sideframe-minimize')) {
 | 
			
		||||
					that.settings.sideframe.maximized = false;
 | 
			
		||||
					that._minimize();
 | 
			
		||||
				} else {
 | 
			
		||||
					that.settings.sideframe.maximized = true;
 | 
			
		||||
					that.settings.sideframe.hidden = false;
 | 
			
		||||
					that._maximize();
 | 
			
		||||
				}
 | 
			
		||||
				that.settings = that.setSettings(that.settings);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-resize').bind('mousedown', function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				that._startResize();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// stopper events
 | 
			
		||||
			$(document).bind('mouseup.cms', function () {
 | 
			
		||||
				that._stopResize();
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// public methods
 | 
			
		||||
		open: function (url, animate) {
 | 
			
		||||
			// prepare iframe
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var language = 'language=' + CMS.config.request.language;
 | 
			
		||||
			var page_id = 'page_id=' + CMS.config.request.page_id;
 | 
			
		||||
			var holder = this.sideframe.find('.cms_sideframe-frame');
 | 
			
		||||
			var initialized = false;
 | 
			
		||||
 | 
			
		||||
			// push required params if defined
 | 
			
		||||
			// only apply params on tree view
 | 
			
		||||
			if(url.indexOf(CMS.config.request.tree) >= 0) {
 | 
			
		||||
				var params = [];
 | 
			
		||||
				if(CMS.config.request.language) params.push(language);
 | 
			
		||||
				if(CMS.config.request.page_id) params.push(page_id);
 | 
			
		||||
				url = this._url(url, params);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			var iframe = $('<iframe src="'+url+'" class="" frameborder="0" />');
 | 
			
		||||
				iframe.hide();
 | 
			
		||||
			var width = this.settings.sideframe.position || this.options.sideframeWidth;
 | 
			
		||||
 | 
			
		||||
			// attach load event to iframe
 | 
			
		||||
			iframe.bind('load', function () {
 | 
			
		||||
				var contents = iframe.contents();
 | 
			
		||||
 | 
			
		||||
				// after iframe is loaded append css
 | 
			
		||||
				contents.find('head').append($('<link rel="stylesheet" type="text/css" href="' + that.config.urls.static + that.options.urls.css_sideframe + '" />'));
 | 
			
		||||
				// remove loader
 | 
			
		||||
				that.sideframe.find('.cms_sideframe-frame').removeClass('cms_loader');
 | 
			
		||||
				// than show
 | 
			
		||||
				iframe.show();
 | 
			
		||||
 | 
			
		||||
				// add debug infos
 | 
			
		||||
				if(that.config.debug) iframe.contents().find('body').addClass('cms_debug');
 | 
			
		||||
 | 
			
		||||
				// save url in settings
 | 
			
		||||
				that.settings.sideframe.url = iframe.get(0).contentWindow.location.href;
 | 
			
		||||
				that.settings = that.setSettings(that.settings);
 | 
			
		||||
 | 
			
		||||
				// bind extra events
 | 
			
		||||
				contents.find('body').bind(that.click, function () {
 | 
			
		||||
					$(document).trigger(that.click);
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				// attach reload event
 | 
			
		||||
				if(initialized) that.reloadBrowser(false, false, true);
 | 
			
		||||
				initialized = true;
 | 
			
		||||
 | 
			
		||||
				// adding django hacks
 | 
			
		||||
				contents.find('.viewsitelink').attr('target', '_top');
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// cancel animation if sideframe is already shown
 | 
			
		||||
			if(this.sideframe.is(':visible')) {
 | 
			
		||||
				// sideframe is already open
 | 
			
		||||
				insertHolder(iframe);
 | 
			
		||||
				// reanimate the frame
 | 
			
		||||
				if(this.sideframe.outerWidth() < width) {
 | 
			
		||||
					// The user has performed an action that requires the
 | 
			
		||||
					// sideframe to be shown, this intent outweighs any
 | 
			
		||||
					// previous intent to minimize the frame.
 | 
			
		||||
					this.settings.sideframe.hidden = false;
 | 
			
		||||
					this._show(width, animate);
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				// load iframe after frame animation is done
 | 
			
		||||
				setTimeout(function () {
 | 
			
		||||
					insertHolder(iframe);
 | 
			
		||||
				}, this.options.sideframeDuration);
 | 
			
		||||
				// display the frame
 | 
			
		||||
				this._show(width, animate);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			function insertHolder(iframe) {
 | 
			
		||||
				// show iframe after animation
 | 
			
		||||
				that.sideframe.find('.cms_sideframe-frame').addClass('cms_loader');
 | 
			
		||||
				holder.html(iframe);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		close: function () {
 | 
			
		||||
			this._hide(true);
 | 
			
		||||
 | 
			
		||||
			// remove url in settings
 | 
			
		||||
			this.settings.sideframe = {
 | 
			
		||||
				'url': null,
 | 
			
		||||
				'hidden': false,
 | 
			
		||||
				'maximized': false,
 | 
			
		||||
				'width': this.options.sideframeWidth
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			// resets
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-maximize').removeClass('cms_sideframe-minimize');
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-hide').show();
 | 
			
		||||
 | 
			
		||||
			// update settings
 | 
			
		||||
			this.settings = this.setSettings(this.settings);
 | 
			
		||||
 | 
			
		||||
			// handle refresh option
 | 
			
		||||
			this.reloadBrowser(this.options.onClose, false, true);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// private methods
 | 
			
		||||
		_show: function (width, animate) {
 | 
			
		||||
			// add class
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-hide').removeClass('cms_sideframe-hidden');
 | 
			
		||||
			
 | 
			
		||||
			// make sure the close / hide / maximize controls appear, regardless of hidden / maximized state
 | 
			
		||||
			this.sideframe.show();
 | 
			
		||||
 | 
			
		||||
			// check if sideframe should be hidden
 | 
			
		||||
			if(this.settings.sideframe.hidden) this._hide();
 | 
			
		||||
 | 
			
		||||
			// check if sideframe should be maximized
 | 
			
		||||
			if(this.settings.sideframe.maximized) this._maximize();
 | 
			
		||||
 | 
			
		||||
			// otherwise do normal behaviour
 | 
			
		||||
			if(!this.settings.sideframe.hidden && !this.settings.sideframe.maximized) {
 | 
			
		||||
				if(animate) {
 | 
			
		||||
					this.sideframe.animate({ 'width': width }, this.options.sideframeDuration);
 | 
			
		||||
					this.body.animate({ 'margin-left': width }, this.options.sideframeDuration);
 | 
			
		||||
				} else {
 | 
			
		||||
					this.sideframe.animate({ 'width': width }, 0);
 | 
			
		||||
					this.body.animate({ 'margin-left': width }, 0);
 | 
			
		||||
					// reset width if larger than available space
 | 
			
		||||
					if(width >= $(window).width()) {
 | 
			
		||||
						this.sideframe.animate({ 'width': $(window).width() - 20 }, 0);
 | 
			
		||||
						this.body.animate({ 'margin-left': $(window).width() - 20 }, 0);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				this.sideframe.find('.cms_sideframe-btn').css('right', -20);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// lock toolbar, set timeout to make sure CMS.API is ready
 | 
			
		||||
			setTimeout(function () {
 | 
			
		||||
				CMS.API.Toolbar._lock(true);
 | 
			
		||||
				CMS.API.Toolbar._showToolbar(true);
 | 
			
		||||
			}, 100);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_hide: function (close) {
 | 
			
		||||
			// add class
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-hide').addClass('cms_sideframe-hidden');
 | 
			
		||||
 | 
			
		||||
			var duration = this.options.sideframeDuration;
 | 
			
		||||
			// remove the iframe
 | 
			
		||||
			if(close && this.sideframe.width() <= 0) duration = 0;
 | 
			
		||||
			if(close) this.sideframe.find('iframe').remove();
 | 
			
		||||
			this.sideframe.animate({ 'width': 0 }, duration, function () {
 | 
			
		||||
				if(close) $(this).hide();
 | 
			
		||||
			});
 | 
			
		||||
			this.body.animate({ 'margin-left': 0 }, duration);
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-frame').removeClass('cms_loader');
 | 
			
		||||
 | 
			
		||||
			// lock toolbar, set timeout to make sure CMS.API is ready
 | 
			
		||||
			setTimeout(function () {
 | 
			
		||||
				CMS.API.Toolbar._lock(false);
 | 
			
		||||
			}, 100);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_minimize: function (noPositionReset) {
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-maximize').removeClass('cms_sideframe-minimize');
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-hide').show();
 | 
			
		||||
 | 
			
		||||
			// reset to first state
 | 
			
		||||
			if(!noPositionReset) {
 | 
			
		||||
				this._show(this.settings.sideframe.position || this.options.sideframeWidth, true);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// remove event
 | 
			
		||||
			$(window).unbind('resize.cms.sideframe');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_maximize: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-maximize').addClass('cms_sideframe-minimize');
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-hide').hide();
 | 
			
		||||
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-hide').removeClass('cms_sideframe-hidden').hide();
 | 
			
		||||
			// do custom animation
 | 
			
		||||
			this.sideframe.animate({ 'width': $(window).width() }, 0);
 | 
			
		||||
			this.body.animate({ 'margin-left': 0 }, 0);
 | 
			
		||||
			// invert icon position
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-btn').css('right', -2);
 | 
			
		||||
			// attach resize event
 | 
			
		||||
			$(window).bind('resize.cms.sideframe', function () {
 | 
			
		||||
				that.sideframe.css('width', $(window).width());
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_startResize: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var outerOffset = 20;
 | 
			
		||||
			var timer = function () {};
 | 
			
		||||
			// this prevents the iframe from being focusable
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-shim').css('z-index', 20);
 | 
			
		||||
			this._minimize(true);
 | 
			
		||||
 | 
			
		||||
			$(document).bind('mousemove.cms', function (e) {
 | 
			
		||||
				if(e.clientX <= 320) e.clientX = 320;
 | 
			
		||||
				if(e.clientX >= $(window).width() - outerOffset) e.clientX = $(window).width() - outerOffset;
 | 
			
		||||
 | 
			
		||||
				that.sideframe.css('width', e.clientX);
 | 
			
		||||
				that.body.css('margin-left', e.clientX);
 | 
			
		||||
 | 
			
		||||
				// update settings
 | 
			
		||||
				that.settings.sideframe.position = e.clientX;
 | 
			
		||||
 | 
			
		||||
				// trigger the resize event
 | 
			
		||||
				$(window).trigger('resize.sideframe');
 | 
			
		||||
 | 
			
		||||
				// save position
 | 
			
		||||
				clearTimeout(timer);
 | 
			
		||||
				timer = setTimeout(function () {
 | 
			
		||||
					that.settings = that.setSettings(that.settings);
 | 
			
		||||
				}, 500);
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_stopResize: function () {
 | 
			
		||||
			this.sideframe.find('.cms_sideframe-shim').css('z-index', 1);
 | 
			
		||||
 | 
			
		||||
			$(document).unbind('mousemove.cms');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_url: function (url, params) {
 | 
			
		||||
			var arr = [];
 | 
			
		||||
			var keys = [];
 | 
			
		||||
			var values = [];
 | 
			
		||||
			var tmp = '';
 | 
			
		||||
			var urlArray = [];
 | 
			
		||||
			var urlParams = [];
 | 
			
		||||
			var origin = url;
 | 
			
		||||
 | 
			
		||||
			// return url if there is no param
 | 
			
		||||
			if(!(url.split('?').length <= 1 || window.JSON === undefined)) {
 | 
			
		||||
				// setup local vars
 | 
			
		||||
				urlArray = url.split('?');
 | 
			
		||||
				urlParams = urlArray[1].split('&');
 | 
			
		||||
				origin = urlArray[0];
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// loop through the available params
 | 
			
		||||
			$.each(urlParams, function (index, param) {
 | 
			
		||||
				arr.push({ 'param': param.split('=')[0], 'value': param.split('=')[1] });
 | 
			
		||||
			});
 | 
			
		||||
			// loop through the new params
 | 
			
		||||
			$.each(params, function (index, param) {
 | 
			
		||||
				arr.push({ 'param': param.split('=')[0], 'value': param.split('=')[1] });
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// merge manually because jquery...
 | 
			
		||||
			$.each(arr, function (index, item) {
 | 
			
		||||
				var i = $.inArray(item.param, keys);
 | 
			
		||||
 | 
			
		||||
				if(i === -1) {
 | 
			
		||||
					keys.push(item.param);
 | 
			
		||||
					values.push(item.value);
 | 
			
		||||
				} else {
 | 
			
		||||
					values[i] = item.value;
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// merge new url
 | 
			
		||||
			$.each(keys, function (index, key) {
 | 
			
		||||
				tmp += '&' + key + '=' + values[index];
 | 
			
		||||
			});
 | 
			
		||||
			tmp = tmp.replace('&', '?');
 | 
			
		||||
			url = origin + tmp;
 | 
			
		||||
 | 
			
		||||
			return url;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
							
								
								
									
										493
									
								
								static/cms/js/modules/cms.structureboard.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,493 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS# */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
	/*!
 | 
			
		||||
	 * StructureBoard
 | 
			
		||||
	 * handles drag & drop, mode switching and
 | 
			
		||||
	 */
 | 
			
		||||
	CMS.StructureBoard = new CMS.Class({
 | 
			
		||||
 | 
			
		||||
		implement: [CMS.API.Helpers],
 | 
			
		||||
 | 
			
		||||
		options: {
 | 
			
		||||
			'speed': 300
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		initialize: function (options) {
 | 
			
		||||
			this.container = $('.cms_structure');
 | 
			
		||||
			this.options = $.extend(true, {}, this.options, options);
 | 
			
		||||
			this.config = CMS.config;
 | 
			
		||||
			this.settings = CMS.settings;
 | 
			
		||||
 | 
			
		||||
			// elements
 | 
			
		||||
			this.toolbar = $('#cms_toolbar');
 | 
			
		||||
			this.sortables = $('.cms_draggables'); // use global scope
 | 
			
		||||
			this.plugins = $('.cms_plugin');
 | 
			
		||||
			this.render_model = $('.cms_render_model');
 | 
			
		||||
			this.placeholders = $('.cms_placeholder');
 | 
			
		||||
			this.dragitems = $('.cms_draggable');
 | 
			
		||||
			this.dragareas = $('.cms_dragarea');
 | 
			
		||||
			this.dropareas = $('.cms_droppable');
 | 
			
		||||
			this.dimmer = this.container.find('.cms_structure-dimmer');
 | 
			
		||||
			this.clipboard = $('.cms_clipboard');
 | 
			
		||||
 | 
			
		||||
			// states
 | 
			
		||||
			this.click = (document.ontouchstart !== null) ? 'click.cms' : 'tap.cms click.cms';
 | 
			
		||||
			this.timer = function () {};
 | 
			
		||||
			this.interval = function () {};
 | 
			
		||||
			this.state = false;
 | 
			
		||||
			this.dragging = false;
 | 
			
		||||
 | 
			
		||||
			// setup initial stuff
 | 
			
		||||
			this._setup();
 | 
			
		||||
 | 
			
		||||
			// setup events
 | 
			
		||||
			this._events();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// initial methods
 | 
			
		||||
		_setup: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			// cancel if there are no dragareas
 | 
			
		||||
			if(!this.dragareas.length) return false;
 | 
			
		||||
 | 
			
		||||
			// cancel if there is no structure / content switcher
 | 
			
		||||
			if(!this.toolbar.find('.cms_toolbar-item-cms-mode-switcher').length) return false;
 | 
			
		||||
 | 
			
		||||
			// setup toolbar mode
 | 
			
		||||
			if(this.settings.mode === 'structure') setTimeout(function () { that.show(true); }, 100);
 | 
			
		||||
 | 
			
		||||
			// check if modes should be visible
 | 
			
		||||
			if(this.placeholders.length) {
 | 
			
		||||
				this.toolbar.find('.cms_toolbar-item-cms-mode-switcher').show();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// add drag & drop functionality
 | 
			
		||||
			this._drag();
 | 
			
		||||
			// prevent click events to detect double click
 | 
			
		||||
			// this.preventEvents(this.plugins);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_events: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var modes = this.toolbar.find('.cms_toolbar-item-cms-mode-switcher a');
 | 
			
		||||
 | 
			
		||||
			// show edit mode
 | 
			
		||||
			modes.eq(1).bind(this.click, function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				// cancel if already active
 | 
			
		||||
				if(that.settings.mode === 'edit') return false;
 | 
			
		||||
				// otherwise hide
 | 
			
		||||
				that.hide();
 | 
			
		||||
			});
 | 
			
		||||
			// show structure mode
 | 
			
		||||
			modes.eq(0).bind(this.click, function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				// cancel if already active
 | 
			
		||||
				if(that.settings.mode === 'structure') return false;
 | 
			
		||||
				// otherwise show
 | 
			
		||||
				that.show();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// keyboard handling
 | 
			
		||||
			$(document).bind('keydown', function (e) {
 | 
			
		||||
				// check if we have an important focus
 | 
			
		||||
				var fields = $('*:focus');
 | 
			
		||||
				// 32 = space
 | 
			
		||||
				if(e.keyCode === 32 && that.settings.mode === 'structure' && !fields.length) {
 | 
			
		||||
					// cancel if there is no structure / content switcher
 | 
			
		||||
					if(!that.toolbar.find('.cms_toolbar-item-cms-mode-switcher').length) return false;
 | 
			
		||||
					e.preventDefault();
 | 
			
		||||
					that.hide();
 | 
			
		||||
				} else if(e.keyCode === 32 && that.settings.mode === 'edit' && !fields.length) {
 | 
			
		||||
					// cancel if there is no structure / content switcher
 | 
			
		||||
					if(!that.toolbar.find('.cms_toolbar-item-cms-mode-switcher').length) return false;
 | 
			
		||||
					e.preventDefault();
 | 
			
		||||
					that.show();
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// public methods
 | 
			
		||||
		show: function (init) {
 | 
			
		||||
			// cancel show if live modus is active
 | 
			
		||||
			if(CMS.config.mode === 'live') return false;
 | 
			
		||||
 | 
			
		||||
			// set active item
 | 
			
		||||
			var modes = this.toolbar.find('.cms_toolbar-item-cms-mode-switcher a');
 | 
			
		||||
				modes.removeClass('cms_btn-active').eq(0).addClass('cms_btn-active');
 | 
			
		||||
 | 
			
		||||
			// show clipboard
 | 
			
		||||
			this.clipboard.css('opacity', 1).fadeIn(this.options.speed);
 | 
			
		||||
 | 
			
		||||
			// apply new settings
 | 
			
		||||
			this.settings.mode = 'structure';
 | 
			
		||||
			if(!init) this.settings = this.setSettings(this.settings);
 | 
			
		||||
 | 
			
		||||
			// ensure all elements are visible
 | 
			
		||||
			this.dragareas.show();
 | 
			
		||||
 | 
			
		||||
			// show canvas
 | 
			
		||||
			this._showBoard();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		hide: function (init) {
 | 
			
		||||
			// cancel show if live modus is active
 | 
			
		||||
			if(CMS.config.mode === 'live') return false;
 | 
			
		||||
 | 
			
		||||
			// set active item
 | 
			
		||||
			var modes = this.toolbar.find('.cms_toolbar-item-cms-mode-switcher a');
 | 
			
		||||
				modes.removeClass('cms_btn-active').eq(1).addClass('cms_btn-active');
 | 
			
		||||
 | 
			
		||||
			// hide clipboard if in edit mode
 | 
			
		||||
			this.container.find('.cms_clipboard').hide();
 | 
			
		||||
 | 
			
		||||
			// hide clipboard
 | 
			
		||||
			this.clipboard.hide();
 | 
			
		||||
 | 
			
		||||
			this.settings.mode = 'edit';
 | 
			
		||||
			if(!init) this.settings = this.setSettings(this.settings);
 | 
			
		||||
 | 
			
		||||
			// hide canvas
 | 
			
		||||
			this._hideBoard();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		getId: function (el) {
 | 
			
		||||
			// cancel if no element is defined
 | 
			
		||||
			if(el === undefined || el === null || el.length <= 0) return false;
 | 
			
		||||
 | 
			
		||||
			var id = null;
 | 
			
		||||
			var cls = el.attr('class').split(' ')[1];
 | 
			
		||||
 | 
			
		||||
			if(el.hasClass('cms_plugin')) {
 | 
			
		||||
				id = cls.replace('cms_plugin-', '');
 | 
			
		||||
			} else if(el.hasClass('cms_draggable')) {
 | 
			
		||||
				id = cls.replace('cms_draggable-', '');
 | 
			
		||||
			} else if(el.hasClass('cms_placeholder')) {
 | 
			
		||||
				id = cls.replace('cms_placeholder-', '');
 | 
			
		||||
			} else if(el.hasClass('cms_dragbar')) {
 | 
			
		||||
				id = cls.replace('cms_dragbar-', '');
 | 
			
		||||
			} else if(el.hasClass('cms_dragarea')) {
 | 
			
		||||
				id = cls.replace('cms_dragarea-', '');
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return id;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		getIds: function (els) {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var array = [];
 | 
			
		||||
			els.each(function () {
 | 
			
		||||
				array.push(that.getId($(this)));
 | 
			
		||||
			});
 | 
			
		||||
			return array;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		setActive: function (id, state) {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			// resets
 | 
			
		||||
			this.dragitems.removeClass('cms_draggable-selected');
 | 
			
		||||
			this.plugins.removeClass('cms_plugin-active');
 | 
			
		||||
 | 
			
		||||
			// only reset if no id is provided
 | 
			
		||||
			if(id === false) return false;
 | 
			
		||||
 | 
			
		||||
			// attach active class to current element
 | 
			
		||||
			var dragitem = $('.cms_draggable-' + id);
 | 
			
		||||
			var plugin = $('.cms_plugin-' + id);
 | 
			
		||||
 | 
			
		||||
			// if we switch from content to edit, show only a single plcaeholder
 | 
			
		||||
			if(state) {
 | 
			
		||||
				// quick show
 | 
			
		||||
				this._showBoard();
 | 
			
		||||
 | 
			
		||||
				// show clipboard
 | 
			
		||||
				this.clipboard.show().css('opacity', 0.2);
 | 
			
		||||
 | 
			
		||||
				// prevent default visibility
 | 
			
		||||
				this.dragareas.css('opacity', 0.2);
 | 
			
		||||
 | 
			
		||||
				// show single placeholder
 | 
			
		||||
				dragitem.closest('.cms_dragarea').show().css('opacity', 1);
 | 
			
		||||
 | 
			
		||||
			// otherwise hide and reset the board
 | 
			
		||||
			} else {
 | 
			
		||||
				this.hide();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// collapse all previous elements
 | 
			
		||||
			var collapsed = dragitem.parentsUntil('.cms_dragarea').siblings().not('.cms_dragitem-expanded');
 | 
			
		||||
				collapsed.trigger(this.click);
 | 
			
		||||
 | 
			
		||||
			// set new classes
 | 
			
		||||
			dragitem.addClass('cms_draggable-selected');
 | 
			
		||||
			plugin.addClass('cms_plugin-active');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		preventEvents: function (elements) {
 | 
			
		||||
			var clicks = 0;
 | 
			
		||||
			var delay = 500;
 | 
			
		||||
			var timer = function () {};
 | 
			
		||||
 | 
			
		||||
			// unbind click event if already initialized
 | 
			
		||||
			elements.find('a').bind(this.click, function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
 | 
			
		||||
				// increment
 | 
			
		||||
				clicks++;
 | 
			
		||||
 | 
			
		||||
				// single click
 | 
			
		||||
				if(clicks === 1) {
 | 
			
		||||
					timer = setTimeout(function () {
 | 
			
		||||
						clicks = 0;
 | 
			
		||||
						// cancel if link contains a hash
 | 
			
		||||
						if($(e.currentTarget).attr('href').indexOf('#') === 0) return false;
 | 
			
		||||
						// we need to redirect to the default behaviours
 | 
			
		||||
						// all events will be lost in edit mode, use '#' if href should not be triggered
 | 
			
		||||
						window.location.href = $(e.currentTarget).attr('href');
 | 
			
		||||
					}, delay);
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// double click
 | 
			
		||||
				if(clicks === 2) {
 | 
			
		||||
					clearTimeout(timer);
 | 
			
		||||
					clicks = 0;
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// private methods
 | 
			
		||||
		_showBoard: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var timer = function () {};
 | 
			
		||||
 | 
			
		||||
			// show container
 | 
			
		||||
			this.container.show();
 | 
			
		||||
			this.dimmer.fadeIn(100);
 | 
			
		||||
			this.dragareas.css('opacity', 1);
 | 
			
		||||
 | 
			
		||||
			// add dimmer close
 | 
			
		||||
			this.dimmer.bind('mousedown mouseup', function (e) {
 | 
			
		||||
				// cancel on rightclick
 | 
			
		||||
				if(e.which === 3 || e.button === 2) return false;
 | 
			
		||||
				// proceed
 | 
			
		||||
				clearTimeout(timer);
 | 
			
		||||
				timer = setTimeout(function () {
 | 
			
		||||
					that.hide();
 | 
			
		||||
				}, 500);
 | 
			
		||||
 | 
			
		||||
				if(e.type === 'mouseup') clearTimeout(timer);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			this.plugins.not(this.render_model).hide();
 | 
			
		||||
			this.placeholders.show();
 | 
			
		||||
 | 
			
		||||
			// attach event
 | 
			
		||||
			$(window).bind('resize.sideframe', function () {
 | 
			
		||||
				that._resizeBoard();
 | 
			
		||||
			}).trigger('resize.sideframe');
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_hideBoard: function () {
 | 
			
		||||
			// hide elements
 | 
			
		||||
			this.container.hide();
 | 
			
		||||
			this.plugins.show();
 | 
			
		||||
			this.placeholders.hide();
 | 
			
		||||
			this.dimmer.hide();
 | 
			
		||||
 | 
			
		||||
			// detach event
 | 
			
		||||
			$(window).unbind('resize.sideframe');
 | 
			
		||||
 | 
			
		||||
			// clear interval
 | 
			
		||||
			clearInterval(this.interval);
 | 
			
		||||
 | 
			
		||||
			$(window).trigger('structureboard_hidden.sideframe');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_resizeBoard: function () {
 | 
			
		||||
			// calculate placeholder position
 | 
			
		||||
			var id = null;
 | 
			
		||||
			var area = null;
 | 
			
		||||
			var min = null;
 | 
			
		||||
			var areaParentOffset = null;
 | 
			
		||||
 | 
			
		||||
			// start calculating
 | 
			
		||||
			this.placeholders.each(function (index, item) {
 | 
			
		||||
				item = $(item);
 | 
			
		||||
				id = item.data('settings').placeholder_id;
 | 
			
		||||
				area = $('.cms_dragarea-' + id);
 | 
			
		||||
				// to calculate the correct offset, we need to set the
 | 
			
		||||
				// placeholders correct heights and than set the according position
 | 
			
		||||
				item.height(area.outerHeight(true));
 | 
			
		||||
				// set min width
 | 
			
		||||
				min = (item.width()) ? 0 : 150;
 | 
			
		||||
				// as area is "css positioned" and jquery offset function is relative to the
 | 
			
		||||
				// document (not the first relative/absolute parent) we need to substract
 | 
			
		||||
				// first relative/absolute parent offset.
 | 
			
		||||
				areaParentOffset = $(area).offsetParent().offset();
 | 
			
		||||
				area.css({
 | 
			
		||||
					'top': item.offset().top - areaParentOffset.top - 5,
 | 
			
		||||
					'left': item.offset().left - areaParentOffset.left - min,
 | 
			
		||||
					'width': item.width() + min
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_drag: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var dropped = false;
 | 
			
		||||
			var droparea = null;
 | 
			
		||||
			var dropzone = null;
 | 
			
		||||
 | 
			
		||||
			this.sortables.nestedSortable({
 | 
			
		||||
				'items': '.cms_draggable',
 | 
			
		||||
				'handle': '.cms_dragitem',
 | 
			
		||||
				'placeholder': 'cms_droppable',
 | 
			
		||||
				'connectWith': this.sortables,
 | 
			
		||||
				'tolerance': 'pointer',
 | 
			
		||||
				'toleranceElement': '> div',
 | 
			
		||||
				'dropOnEmpty': true,
 | 
			
		||||
				'forcePlaceholderSize': true,
 | 
			
		||||
				'helper': 'clone',
 | 
			
		||||
				'appendTo': 'body',
 | 
			
		||||
				'cursor': 'move',
 | 
			
		||||
				'opacity': 0.4,
 | 
			
		||||
				'zIndex': 9999999,
 | 
			
		||||
				'delay': 100,
 | 
			
		||||
				'refreshPositions': true,
 | 
			
		||||
				// nestedSortable
 | 
			
		||||
				'listType': 'div.cms_draggables',
 | 
			
		||||
				'doNotClear': true,
 | 
			
		||||
				//'disableNestingClass': 'cms_draggable-disabled',
 | 
			
		||||
				//'errorClass': 'cms_draggable-disallowed',
 | 
			
		||||
				//'hoveringClass': 'cms_draggable-hover',
 | 
			
		||||
				// methods
 | 
			
		||||
				'start': function (e, ui) {
 | 
			
		||||
					that.dragging = true;
 | 
			
		||||
					// show empty
 | 
			
		||||
					$('.cms_dragbar-empty-wrapper').show();
 | 
			
		||||
					// ensure all menus are closed
 | 
			
		||||
					$('.cms_dragitem .cms_submenu').hide();
 | 
			
		||||
					// remove classes from empty dropzones
 | 
			
		||||
					$('.cms_dragbar-empty').removeClass('cms_draggable-disallowed');
 | 
			
		||||
					// fixes placeholder height
 | 
			
		||||
					ui.placeholder.height(ui.item.height());
 | 
			
		||||
					// show placeholder without entries
 | 
			
		||||
					$('.cms_draggables').each(function () {
 | 
			
		||||
						if($(this).children().length === 0) {
 | 
			
		||||
							$(this).show();
 | 
			
		||||
						}
 | 
			
		||||
					});
 | 
			
		||||
				},
 | 
			
		||||
 | 
			
		||||
				'stop': function (event, ui) {
 | 
			
		||||
					that.dragging = false;
 | 
			
		||||
					// hide empty
 | 
			
		||||
					$('.cms_dragbar-empty-wrapper').hide();
 | 
			
		||||
 | 
			
		||||
					// cancel if isAllowed returns false
 | 
			
		||||
					if(!that.state) return false;
 | 
			
		||||
 | 
			
		||||
					// handle dropped event
 | 
			
		||||
					if(dropped) {
 | 
			
		||||
						droparea.prepend(ui.item);
 | 
			
		||||
						dropped = false;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					// we pass the id to the updater which checks within the backend the correct place
 | 
			
		||||
					//var id = ui.item.attr('class').replace('cms_draggable cms_draggable-', '');
 | 
			
		||||
					var id = that.getId(ui.item);
 | 
			
		||||
					var plugin = $('.cms_plugin-' + id);
 | 
			
		||||
 | 
			
		||||
					// check if we copy/paste a plugin or not
 | 
			
		||||
					if(plugin.closest('.cms_clipboard').length) {
 | 
			
		||||
						plugin.trigger('cms.plugin.update');
 | 
			
		||||
					} else {
 | 
			
		||||
						plugin.trigger('cms.plugins.update');
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					// reset placeholder without entries
 | 
			
		||||
					$('.cms_draggables').each(function () {
 | 
			
		||||
						if($(this).children().length === 0) {
 | 
			
		||||
							$(this).hide();
 | 
			
		||||
						}
 | 
			
		||||
					});
 | 
			
		||||
				},
 | 
			
		||||
				'isAllowed': function(placeholder, placeholderParent, originalItem) {
 | 
			
		||||
					// cancel if action is excecuted
 | 
			
		||||
					if(CMS.API.locked) return false;
 | 
			
		||||
					// getting restriction array
 | 
			
		||||
					var bounds = [];
 | 
			
		||||
					// save original state events
 | 
			
		||||
					var original = $('.cms_plugin-' + that.getId(originalItem));
 | 
			
		||||
					// cancel if item has no settings
 | 
			
		||||
					if(original.length === 0 || original.data('settings') === null) return false;
 | 
			
		||||
					var type = original.data('settings').plugin_type;
 | 
			
		||||
					// prepare variables for bound
 | 
			
		||||
					var holderId = that.getId(placeholder.closest('.cms_dragarea'));
 | 
			
		||||
					var holder = $('.cms_placeholder-' + holderId);
 | 
			
		||||
					var plugin = $('.cms_plugin-' + that.getId(placeholder.closest('.cms_draggable')));
 | 
			
		||||
 | 
			
		||||
					// now set the correct bounds
 | 
			
		||||
					if(holder.length) bounds = holder.data('settings').plugin_restriction;
 | 
			
		||||
					if(plugin.length) bounds = plugin.data('settings').plugin_restriction;
 | 
			
		||||
					if(dropzone) bounds = dropzone.data('settings').plugin_restriction;
 | 
			
		||||
 | 
			
		||||
					// if parent has class disabled, dissalow drop
 | 
			
		||||
					if(placeholder.parent().hasClass('cms_draggable-disabled')) return false;
 | 
			
		||||
 | 
			
		||||
					// if restrictions is still empty, proceed
 | 
			
		||||
					that.state = (bounds.length <= 0 || $.inArray(type, bounds) !== -1) ? true : false;
 | 
			
		||||
 | 
			
		||||
					return that.state;
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// attach escape event to cancel dragging
 | 
			
		||||
			$(document).bind('keyup.cms', function(e, cancel){
 | 
			
		||||
				if(e.keyCode === 27 || cancel) {
 | 
			
		||||
					that.state = false;
 | 
			
		||||
					that.sortables.sortable('cancel');
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// define droppable helpers
 | 
			
		||||
			this.dropareas.droppable({
 | 
			
		||||
				'greedy': true,
 | 
			
		||||
				'accept': '.cms_draggable',
 | 
			
		||||
				'tolerance': 'pointer',
 | 
			
		||||
				'activeClass': 'cms_draggable-allowed',
 | 
			
		||||
				'hoverClass': 'cms_draggable-hover-allowed',
 | 
			
		||||
				'over': function (event) {
 | 
			
		||||
					dropzone = $('.cms_placeholder-' + that.getId($(event.target).parent().prev()));
 | 
			
		||||
					timer = setInterval(function () {
 | 
			
		||||
						// reset other empty placeholders
 | 
			
		||||
						$('.cms_dragbar-empty').removeClass('cms_draggable-disallowed');
 | 
			
		||||
						if(that.state) {
 | 
			
		||||
							$(event.target).removeClass('cms_draggable-disallowed');
 | 
			
		||||
						} else {
 | 
			
		||||
							$(event.target).addClass('cms_draggable-disallowed');
 | 
			
		||||
						}
 | 
			
		||||
					}, 10);
 | 
			
		||||
				},
 | 
			
		||||
				'out': function (event) {
 | 
			
		||||
					dropzone = null;
 | 
			
		||||
					$(event.target).removeClass('cms_draggable-disallowed');
 | 
			
		||||
					clearInterval(timer);
 | 
			
		||||
				},
 | 
			
		||||
				'drop': function (event) {
 | 
			
		||||
					dropped = true;
 | 
			
		||||
					droparea = $(event.target).parent().nextAll('.cms_draggables').first();
 | 
			
		||||
					clearInterval(timer);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
							
								
								
									
										512
									
								
								static/cms/js/modules/cms.toolbar.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,512 @@
 | 
			
		|||
/*##################################################|*/
 | 
			
		||||
/* #CMS# */
 | 
			
		||||
(function($) {
 | 
			
		||||
// CMS.$ will be passed for $
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
	/*!
 | 
			
		||||
	 * Toolbar
 | 
			
		||||
	 * Handles all features related to the toolbar
 | 
			
		||||
	 */
 | 
			
		||||
	CMS.Toolbar = new CMS.Class({
 | 
			
		||||
 | 
			
		||||
		implement: [CMS.API.Helpers],
 | 
			
		||||
 | 
			
		||||
		options: {
 | 
			
		||||
			'preventSwitch': false,
 | 
			
		||||
			'preventSwitchMessage': 'Switching is disabled.',
 | 
			
		||||
			'messageDelay': 2000
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		initialize: function (options) {
 | 
			
		||||
			this.container = $('#cms_toolbar');
 | 
			
		||||
			this.options = $.extend(true, {}, this.options, options);
 | 
			
		||||
			this.config = CMS.config;
 | 
			
		||||
			this.settings = CMS.settings;
 | 
			
		||||
 | 
			
		||||
			// elements
 | 
			
		||||
			this.body = $('html');
 | 
			
		||||
			this.toolbar = this.container.find('.cms_toolbar').hide();
 | 
			
		||||
			this.toolbarTrigger = this.container.find('.cms_toolbar-trigger');
 | 
			
		||||
			this.navigations = this.container.find('.cms_toolbar-item-navigation');
 | 
			
		||||
			this.buttons = this.container.find('.cms_toolbar-item-buttons');
 | 
			
		||||
			this.switcher = this.container.find('.cms_toolbar-item_switch');
 | 
			
		||||
			this.messages = this.container.find('.cms_messages');
 | 
			
		||||
			this.screenBlock = this.container.find('.cms_screenblock');
 | 
			
		||||
 | 
			
		||||
			// states
 | 
			
		||||
			this.click = 'click.cms';
 | 
			
		||||
			this.timer = function () {};
 | 
			
		||||
			this.lockToolbar = false;
 | 
			
		||||
 | 
			
		||||
			// setup initial stuff
 | 
			
		||||
			this._setup();
 | 
			
		||||
 | 
			
		||||
			// setup events
 | 
			
		||||
			this._events();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// initial methods
 | 
			
		||||
		_setup: function () {
 | 
			
		||||
			// setup toolbar visibility, we need to reverse the options to set the correct state
 | 
			
		||||
			(this.settings.toolbar === 'expanded') ? this._showToolbar(0, true) : this._hideToolbar(0, true);
 | 
			
		||||
 | 
			
		||||
			// hide publish button
 | 
			
		||||
			var publishBtn = $('.cms_btn-publish').parent();
 | 
			
		||||
				publishBtn.hide();
 | 
			
		||||
			if($('.cms_btn-publish-active').length) publishBtn.show();
 | 
			
		||||
 | 
			
		||||
			// check if debug is true
 | 
			
		||||
			if(CMS.config.debug) this._debug();
 | 
			
		||||
 | 
			
		||||
			// check if there are messages and display them
 | 
			
		||||
			if(CMS.config.messages) this.openMessage(CMS.config.messages);
 | 
			
		||||
 | 
			
		||||
			// check if there are error messages and display them
 | 
			
		||||
			if(CMS.config.error) this.showError(CMS.config.error);
 | 
			
		||||
 | 
			
		||||
			// enforce open state if user is not logged in but requests the toolbar
 | 
			
		||||
			if(!CMS.config.auth || CMS.config.settings.version !== this.settings.version) {
 | 
			
		||||
				this.toggleToolbar(true);
 | 
			
		||||
				this.settings = this.setSettings(CMS.config.settings);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// should switcher indicate that there is an unpublished page?
 | 
			
		||||
			if(CMS.config.publisher) {
 | 
			
		||||
				this.openMessage(CMS.config.publisher, 'right');
 | 
			
		||||
				setInterval(function () {
 | 
			
		||||
					CMS.$('.cms_toolbar-item_switch').toggleClass('cms_toolbar-item_switch-highlight');
 | 
			
		||||
				}, this.options.messageDelay);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// open sideframe if it was previously opened
 | 
			
		||||
			if(this.settings.sideframe.url) {
 | 
			
		||||
				var sideframe = new CMS.Sideframe();
 | 
			
		||||
					sideframe.open(this.settings.sideframe.url, false);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// if there is a screenblock, do some resize magic
 | 
			
		||||
			if(this.screenBlock.length) this._screenBlock();
 | 
			
		||||
 | 
			
		||||
			// add toolbar ready class to body and fire event
 | 
			
		||||
			this.body.addClass('cms-ready');
 | 
			
		||||
			$(document).trigger('cms-ready');
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_events: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			// attach event to the trigger handler
 | 
			
		||||
			this.toolbarTrigger.bind(this.click, function (e) {
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				that.toggleToolbar();
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// attach event to the navigation elements
 | 
			
		||||
			this.navigations.each(function () {
 | 
			
		||||
				var item = $(this);
 | 
			
		||||
				var lists = item.find('li');
 | 
			
		||||
				var root = 'cms_toolbar-item-navigation';
 | 
			
		||||
				var hover = 'cms_toolbar-item-navigation-hover';
 | 
			
		||||
				var disabled = 'cms_toolbar-item-navigation-disabled';
 | 
			
		||||
				var children = 'cms_toolbar-item-navigation-children';
 | 
			
		||||
 | 
			
		||||
				// remove events from first level
 | 
			
		||||
				item.find('a').bind(that.click, function (e) {
 | 
			
		||||
					e.preventDefault();
 | 
			
		||||
					if($(this).attr('href') !== ''
 | 
			
		||||
						&& $(this).attr('href') !== '#'
 | 
			
		||||
						&& !$(this).parent().hasClass(disabled)
 | 
			
		||||
						&& !$(this).parent().hasClass(disabled)) {
 | 
			
		||||
						that._delegate($(this));
 | 
			
		||||
						reset();
 | 
			
		||||
						return false;
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				// handle click states
 | 
			
		||||
				lists.bind(that.click, function (e) {
 | 
			
		||||
					e.stopPropagation();
 | 
			
		||||
					var el = $(this);
 | 
			
		||||
 | 
			
		||||
					// close if el is first item
 | 
			
		||||
					if(el.parent().hasClass(root) && el.hasClass(hover) || el.hasClass(disabled)) {
 | 
			
		||||
						reset();
 | 
			
		||||
						return false;
 | 
			
		||||
					} else {
 | 
			
		||||
						reset();
 | 
			
		||||
						el.addClass(hover);
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					// activate hover selection
 | 
			
		||||
					item.find('> li').bind('mouseenter', function () {
 | 
			
		||||
						// cancel if item is already active
 | 
			
		||||
						if($(this).hasClass(hover)) return false;
 | 
			
		||||
						$(this).trigger(that.click);
 | 
			
		||||
					});
 | 
			
		||||
 | 
			
		||||
					// create the document event
 | 
			
		||||
					$(document).bind(that.click, reset);
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				// attach hover
 | 
			
		||||
				lists.find('li').bind('mouseenter mouseleave', function () {
 | 
			
		||||
					var el = $(this);
 | 
			
		||||
					var parent = el.closest('.cms_toolbar-item-navigation-children').add(el.parents('.cms_toolbar-item-navigation-children'));
 | 
			
		||||
					var hasChildren = el.hasClass(children) || parent.length;
 | 
			
		||||
 | 
			
		||||
					// do not attach hover effect if disabled
 | 
			
		||||
					// cancel event if element has already hover class
 | 
			
		||||
					if(el.hasClass(disabled) || el.hasClass(hover)) return false;
 | 
			
		||||
 | 
			
		||||
					// reset
 | 
			
		||||
					lists.find('li').removeClass(hover);
 | 
			
		||||
 | 
			
		||||
					// add hover effect
 | 
			
		||||
					el.addClass(hover);
 | 
			
		||||
 | 
			
		||||
					// handle children elements
 | 
			
		||||
					if(hasChildren) {
 | 
			
		||||
						el.find('> ul').show();
 | 
			
		||||
						// add parent class
 | 
			
		||||
						parent.addClass(hover);
 | 
			
		||||
					} else {
 | 
			
		||||
						lists.find('ul ul').hide();
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					// Remove stale submenus
 | 
			
		||||
					el.siblings().find('> ul').hide();
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				// fix leave event
 | 
			
		||||
				lists.find('> ul').bind('mouseleave', function () {
 | 
			
		||||
					lists.find('li').removeClass(hover);
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				// removes classes and events
 | 
			
		||||
				function reset() {
 | 
			
		||||
					lists.removeClass(hover);
 | 
			
		||||
					lists.find('ul ul').hide();
 | 
			
		||||
					item.find('> li').unbind('mouseenter');
 | 
			
		||||
					$(document).unbind(that.click);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// attach event to the switcher elements
 | 
			
		||||
			this.switcher.each(function () {
 | 
			
		||||
				$(this).bind(that.click, function (e) {
 | 
			
		||||
					e.preventDefault();
 | 
			
		||||
					that._setSwitcher($(e.currentTarget));
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			// attach event for first page publish
 | 
			
		||||
			this.buttons.each(function () {
 | 
			
		||||
				var btn = $(this);
 | 
			
		||||
 | 
			
		||||
				// in case the button has a data-rel attribute
 | 
			
		||||
				if(btn.find('a').attr('data-rel')) {
 | 
			
		||||
					btn.on('click', function (e) {
 | 
			
		||||
						e.preventDefault();
 | 
			
		||||
						that._delegate($(this).find('a'));
 | 
			
		||||
					})
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// in case of the publish button
 | 
			
		||||
				btn.find('.cms_publish-page').bind(that.click, function (e) {
 | 
			
		||||
					if(!confirm(that.config.lang.publish)) e.preventDefault();
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// public methods
 | 
			
		||||
		toggleToolbar: function (show) {
 | 
			
		||||
			// overwrite state when provided
 | 
			
		||||
			if(show) this.settings.toolbar = 'collapsed';
 | 
			
		||||
			// toggle bar
 | 
			
		||||
			(this.settings.toolbar === 'collapsed') ? this._showToolbar(200) : this._hideToolbar(200);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		openMessage: function (msg, dir, delay, error) {
 | 
			
		||||
			// set toolbar freeze
 | 
			
		||||
			this._lock(true);
 | 
			
		||||
 | 
			
		||||
			// add content to element
 | 
			
		||||
			this.messages.find('.cms_messages-inner').html(msg);
 | 
			
		||||
 | 
			
		||||
			// clear timeout
 | 
			
		||||
			clearTimeout(this.timer);
 | 
			
		||||
 | 
			
		||||
			// determine width
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var width = 320;
 | 
			
		||||
			var height = this.messages.outerHeight(true);
 | 
			
		||||
			var top = this.toolbar.outerHeight(true);
 | 
			
		||||
			var close = this.messages.find('.cms_messages-close');
 | 
			
		||||
				close.hide();
 | 
			
		||||
				close.bind(this.click, function () {
 | 
			
		||||
					that.closeMessage();
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
			// set top to 0 if toolbar is collapsed
 | 
			
		||||
			if(this.settings.toolbar === 'collapsed') top = 0;
 | 
			
		||||
 | 
			
		||||
			// do we need to add debug styles?
 | 
			
		||||
			if(this.config.debug) top = top + 5;
 | 
			
		||||
 | 
			
		||||
			// set correct position and show
 | 
			
		||||
			this.messages.css('top', -height).show();
 | 
			
		||||
 | 
			
		||||
			// error handling
 | 
			
		||||
			this.messages.removeClass('cms_messages-error');
 | 
			
		||||
			if(error) this.messages.addClass('cms_messages-error');
 | 
			
		||||
 | 
			
		||||
			// dir should be left, center, right
 | 
			
		||||
			dir = dir || 'center';
 | 
			
		||||
			// set correct direction and animation
 | 
			
		||||
			switch(dir) {
 | 
			
		||||
				case 'left':
 | 
			
		||||
					this.messages.css({
 | 
			
		||||
						'top': top,
 | 
			
		||||
						'left': -width,
 | 
			
		||||
						'right': 'auto',
 | 
			
		||||
						'margin-left': 0
 | 
			
		||||
					});
 | 
			
		||||
					this.messages.animate({ 'left': 0 });
 | 
			
		||||
					break;
 | 
			
		||||
				case 'right':
 | 
			
		||||
					this.messages.css({
 | 
			
		||||
						'top': top,
 | 
			
		||||
						'right': -width,
 | 
			
		||||
						'left': 'auto',
 | 
			
		||||
						'margin-left': 0
 | 
			
		||||
					});
 | 
			
		||||
					this.messages.animate({ 'right': 0 });
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					this.messages.css({
 | 
			
		||||
						'left': '50%',
 | 
			
		||||
						'right': 'auto',
 | 
			
		||||
						'margin-left': -(width / 2)
 | 
			
		||||
					});
 | 
			
		||||
					this.messages.animate({ 'top': top });
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// cancel autohide if delay is 0
 | 
			
		||||
			if(delay === 0) {
 | 
			
		||||
				close.show();
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			// add delay to hide
 | 
			
		||||
			this.timer = setTimeout(function () {
 | 
			
		||||
				that.closeMessage();
 | 
			
		||||
			}, delay || this.options.messageDelay);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		closeMessage: function () {
 | 
			
		||||
			this.messages.fadeOut(300);
 | 
			
		||||
			// unlock toolbar
 | 
			
		||||
			this._lock(false);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		openAjax: function (url, post, text, callback, onSuccess) {
 | 
			
		||||
			var that = this;
 | 
			
		||||
 | 
			
		||||
			// check if we have a confirmation text
 | 
			
		||||
			var question = (text) ? confirm(text) : true;
 | 
			
		||||
			// cancel if question has been denied
 | 
			
		||||
			if(!question) return false;
 | 
			
		||||
 | 
			
		||||
			// set loader
 | 
			
		||||
			this._loader(true);
 | 
			
		||||
 | 
			
		||||
			$.ajax({
 | 
			
		||||
				'type': 'POST',
 | 
			
		||||
				'url': url,
 | 
			
		||||
				'data': (post) ? JSON.parse(post) : {},
 | 
			
		||||
				'success': function (response) {
 | 
			
		||||
					CMS.API.locked = false;
 | 
			
		||||
 | 
			
		||||
					if(callback) {
 | 
			
		||||
						callback(that, response);
 | 
			
		||||
						that._loader(false);
 | 
			
		||||
					} else if(onSuccess) {
 | 
			
		||||
						CMS.API.Helpers.reloadBrowser(onSuccess, false, true);
 | 
			
		||||
					} else {
 | 
			
		||||
						// reload
 | 
			
		||||
						CMS.API.Helpers.reloadBrowser(false, false, true);
 | 
			
		||||
					}
 | 
			
		||||
				},
 | 
			
		||||
				'error': function (jqXHR) {
 | 
			
		||||
					CMS.API.locked = false;
 | 
			
		||||
					that.showError(jqXHR.response + ' | ' + jqXHR.status + ' ' + jqXHR.statusText);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		showError: function (msg, reload) {
 | 
			
		||||
			this.openMessage(msg, 'center', 0, true);
 | 
			
		||||
			// force reload if param is passed
 | 
			
		||||
			if(reload) CMS.API.Helpers.reloadBrowser(false, this.options.messageDelay);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// private methods
 | 
			
		||||
		_showToolbar: function (speed, init) {
 | 
			
		||||
			this.toolbarTrigger.addClass('cms_toolbar-trigger-expanded');
 | 
			
		||||
			this.toolbar.slideDown(speed);
 | 
			
		||||
			// animate html
 | 
			
		||||
			this.body.animate({ 'margin-top': (this.config.debug) ? 35 : 30 }, (init) ? 0 : speed, function () {
 | 
			
		||||
			    $(this).addClass('cms-toolbar-expanded')
 | 
			
		||||
			});
 | 
			
		||||
			// set messages top to toolbar height
 | 
			
		||||
			this.messages.css('top', 31);
 | 
			
		||||
			// set new settings
 | 
			
		||||
			this.settings.toolbar = 'expanded';
 | 
			
		||||
			if(!init) this.settings = this.setSettings(this.settings);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_hideToolbar: function (speed, init) {
 | 
			
		||||
			// cancel if sideframe is active
 | 
			
		||||
			if(this.lockToolbar) return false;
 | 
			
		||||
 | 
			
		||||
			this.toolbarTrigger.removeClass('cms_toolbar-trigger-expanded');
 | 
			
		||||
			this.toolbar.slideUp(speed);
 | 
			
		||||
			// animate html
 | 
			
		||||
			this.body.removeClass('cms-toolbar-expanded').animate({ 'margin-top': (this.config.debug) ? 5 : 0 }, speed);
 | 
			
		||||
			// set messages top to 0
 | 
			
		||||
			this.messages.css('top', 0);
 | 
			
		||||
			// set new settings
 | 
			
		||||
			this.settings.toolbar = 'collapsed';
 | 
			
		||||
			if(!init) this.settings = this.setSettings(this.settings);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_setSwitcher: function (el) {
 | 
			
		||||
			// save local vars
 | 
			
		||||
			var active = el.hasClass('cms_toolbar-item_switch-active');
 | 
			
		||||
			var anchor = el.find('a');
 | 
			
		||||
			var knob = el.find('.cms_toolbar-item_switch-knob');
 | 
			
		||||
			var duration = 300;
 | 
			
		||||
 | 
			
		||||
			// prevent if switchopstion is passed
 | 
			
		||||
			if(this.options.preventSwitch) {
 | 
			
		||||
				this.openMessage(this.options.preventSwitchMessage, 'right');
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// determin what to trigger
 | 
			
		||||
			if(active) {
 | 
			
		||||
				knob.animate({
 | 
			
		||||
					'right': anchor.outerWidth(true) - (knob.outerWidth(true) + 2)
 | 
			
		||||
				}, duration);
 | 
			
		||||
				// move anchor behind the knob
 | 
			
		||||
				anchor.css('z-index', 1).animate({
 | 
			
		||||
					'padding-top': 6,
 | 
			
		||||
					'padding-right': 14,
 | 
			
		||||
					'padding-bottom': 4,
 | 
			
		||||
					'padding-left': 28
 | 
			
		||||
				}, duration);
 | 
			
		||||
			} else {
 | 
			
		||||
				knob.animate({
 | 
			
		||||
					'left': anchor.outerWidth(true) - (knob.outerWidth(true) + 2)
 | 
			
		||||
				}, duration);
 | 
			
		||||
				// move anchor behind the knob
 | 
			
		||||
				anchor.css('z-index', 1).animate({
 | 
			
		||||
					'padding-top': 6,
 | 
			
		||||
					'padding-right': 28,
 | 
			
		||||
					'padding-bottom': 4,
 | 
			
		||||
					'padding-left': 14
 | 
			
		||||
				}, duration);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// reload
 | 
			
		||||
			setTimeout(function () {
 | 
			
		||||
				window.location.href = anchor.attr('href');
 | 
			
		||||
			}, duration);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_delegate: function (el) {
 | 
			
		||||
			// save local vars
 | 
			
		||||
			var target = el.data('rel');
 | 
			
		||||
 | 
			
		||||
			switch(target) {
 | 
			
		||||
				case 'modal':
 | 
			
		||||
					var modal = new CMS.Modal({'onClose': el.data('on-close')});
 | 
			
		||||
						modal.open(el.attr('href'), el.data('name'));
 | 
			
		||||
					break;
 | 
			
		||||
				case 'message':
 | 
			
		||||
					this.openMessage(el.data('text'));
 | 
			
		||||
					break;
 | 
			
		||||
				case 'sideframe':
 | 
			
		||||
					var sideframe = new CMS.Sideframe({'onClose': el.data('on-close')});
 | 
			
		||||
						sideframe.open(el.attr('href'), true);
 | 
			
		||||
					break;
 | 
			
		||||
				case 'ajax':
 | 
			
		||||
					this.openAjax(el.attr('href'), JSON.stringify(el.data('post')), el.data('text'), null, el.data('on-success'));
 | 
			
		||||
					break;
 | 
			
		||||
				default:
 | 
			
		||||
					window.location.href = el.attr('href');
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_lock: function (lock) {
 | 
			
		||||
			if(lock) {
 | 
			
		||||
				this.lockToolbar = true;
 | 
			
		||||
				// make button look disabled
 | 
			
		||||
				this.toolbarTrigger.css('opacity', 0.2);
 | 
			
		||||
			} else {
 | 
			
		||||
				this.lockToolbar = false;
 | 
			
		||||
				// make button look disabled
 | 
			
		||||
				this.toolbarTrigger.css('opacity', 1);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_loader: function (loader) {
 | 
			
		||||
			if(loader) {
 | 
			
		||||
				this.toolbarTrigger.addClass('cms_toolbar-loader');
 | 
			
		||||
			} else {
 | 
			
		||||
				this.toolbarTrigger.removeClass('cms_toolbar-loader');
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_debug: function () {
 | 
			
		||||
			var that = this;
 | 
			
		||||
			var timeout = 1000;
 | 
			
		||||
			var timer = function () {};
 | 
			
		||||
 | 
			
		||||
			// bind message event
 | 
			
		||||
			var debug = this.container.find('.cms_debug-bar');
 | 
			
		||||
				debug.bind('mouseenter mouseleave', function (e) {
 | 
			
		||||
					clearTimeout(timer);
 | 
			
		||||
 | 
			
		||||
					if(e.type === 'mouseenter') {
 | 
			
		||||
						timer = setTimeout(function () {
 | 
			
		||||
							that.openMessage(that.config.lang.debug);
 | 
			
		||||
						}, timeout);
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_screenBlock: function () {
 | 
			
		||||
			var interval = 20;
 | 
			
		||||
			var blocker = this.screenBlock;
 | 
			
		||||
			var sideframe = $('.cms_sideframe');
 | 
			
		||||
 | 
			
		||||
			// automatically resize screenblock window according to given attributes
 | 
			
		||||
			$(window).on('resize.cms.screenblock', function () {
 | 
			
		||||
				var width = $(this).width() - sideframe.width();
 | 
			
		||||
 | 
			
		||||
				blocker.css({
 | 
			
		||||
					'width': width,
 | 
			
		||||
					'height': $(window).height()
 | 
			
		||||
				});
 | 
			
		||||
			}).trigger('resize');
 | 
			
		||||
 | 
			
		||||
			// set update interval
 | 
			
		||||
			setInterval(function () {
 | 
			
		||||
				$(window).trigger('resize.cms.screenblock');
 | 
			
		||||
			}, interval);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
})(CMS.$);
 | 
			
		||||
							
								
								
									
										14
									
								
								static/cms/js/modules/jquery.ui.custom.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										613
									
								
								static/cms/js/modules/jquery.ui.nestedsortable.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,613 @@
 | 
			
		|||
/*
 | 
			
		||||
 * jQuery UI Nested Sortable
 | 
			
		||||
 * v 2.0 / 29 oct 2012
 | 
			
		||||
 * http://mjsarfatti.com/sandbox/nestedSortable
 | 
			
		||||
 *
 | 
			
		||||
 * Depends on:
 | 
			
		||||
 *	 jquery.ui.sortable.js 1.10+
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2010-2013 Manuele J Sarfatti
 | 
			
		||||
 * Licensed under the MIT License
 | 
			
		||||
 * http://www.opensource.org/licenses/mit-license.php
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
(function($) {
 | 
			
		||||
 | 
			
		||||
	function isOverAxis( x, reference, size ) {
 | 
			
		||||
		return ( x > reference ) && ( x < ( reference + size ) );
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$.widget("mjs.nestedSortable", $.extend({}, $.ui.sortable.prototype, {
 | 
			
		||||
 | 
			
		||||
		options: {
 | 
			
		||||
			doNotClear: false,
 | 
			
		||||
			expandOnHover: 700,
 | 
			
		||||
			isAllowed: function(placeholder, placeholderParent, originalItem) { return true; },
 | 
			
		||||
			isTree: false,
 | 
			
		||||
			listType: 'ol',
 | 
			
		||||
			maxLevels: 0,
 | 
			
		||||
			protectRoot: false,
 | 
			
		||||
			rootID: null,
 | 
			
		||||
			rtl: false,
 | 
			
		||||
			startCollapsed: false,
 | 
			
		||||
			tabSize: 20,
 | 
			
		||||
 | 
			
		||||
			branchClass: 'mjs-nestedSortable-branch',
 | 
			
		||||
			collapsedClass: 'mjs-nestedSortable-collapsed',
 | 
			
		||||
			disableNestingClass: 'mjs-nestedSortable-no-nesting',
 | 
			
		||||
			errorClass: 'mjs-nestedSortable-error',
 | 
			
		||||
			expandedClass: 'mjs-nestedSortable-expanded',
 | 
			
		||||
			hoveringClass: 'mjs-nestedSortable-hovering',
 | 
			
		||||
			leafClass: 'mjs-nestedSortable-leaf'
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_create: function() {
 | 
			
		||||
			this.element.data('ui-sortable', this.element.data('mjs-nestedSortable'));
 | 
			
		||||
 | 
			
		||||
			// mjs - prevent browser from freezing if the HTML is not correct
 | 
			
		||||
			if (!this.element.is(this.options.listType))
 | 
			
		||||
				throw new Error('nestedSortable: Please check that the listType option is set to your actual list type');
 | 
			
		||||
 | 
			
		||||
			// mjs - force 'intersect' tolerance method if we have a tree with expanding/collapsing functionality
 | 
			
		||||
			if (this.options.isTree && this.options.expandOnHover) {
 | 
			
		||||
				this.options.tolerance = 'intersect';
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			$.ui.sortable.prototype._create.apply(this, arguments);
 | 
			
		||||
 | 
			
		||||
			// mjs - prepare the tree by applying the right classes (the CSS is responsible for actual hide/show functionality)
 | 
			
		||||
			if (this.options.isTree) {
 | 
			
		||||
				var self = this;
 | 
			
		||||
				$(this.items).each(function() {
 | 
			
		||||
					var $li = this.item;
 | 
			
		||||
					if ($li.children(self.options.listType).length) {
 | 
			
		||||
						$li.addClass(self.options.branchClass);
 | 
			
		||||
						// expand/collapse class only if they have children
 | 
			
		||||
						if (self.options.startCollapsed) $li.addClass(self.options.collapsedClass);
 | 
			
		||||
						else $li.addClass(self.options.expandedClass);
 | 
			
		||||
					} else {
 | 
			
		||||
						$li.addClass(self.options.leafClass);
 | 
			
		||||
					}
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_destroy: function() {
 | 
			
		||||
			this.element
 | 
			
		||||
				.removeData("mjs-nestedSortable")
 | 
			
		||||
				.removeData("ui-sortable");
 | 
			
		||||
			return $.ui.sortable.prototype._destroy.apply(this, arguments);
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_mouseDrag: function(event) {
 | 
			
		||||
			var i, item, itemElement, intersection,
 | 
			
		||||
				o = this.options,
 | 
			
		||||
				scrolled = false;
 | 
			
		||||
 | 
			
		||||
			//Compute the helpers position
 | 
			
		||||
			this.position = this._generatePosition(event);
 | 
			
		||||
			this.positionAbs = this._convertPositionTo("absolute");
 | 
			
		||||
 | 
			
		||||
			if (!this.lastPositionAbs) {
 | 
			
		||||
				this.lastPositionAbs = this.positionAbs;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			//Do scrolling
 | 
			
		||||
			if(this.options.scroll) {
 | 
			
		||||
				if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
 | 
			
		||||
 | 
			
		||||
					if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
 | 
			
		||||
						this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
 | 
			
		||||
					} else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
 | 
			
		||||
						this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
 | 
			
		||||
						this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
 | 
			
		||||
					} else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
 | 
			
		||||
						this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
				} else {
 | 
			
		||||
 | 
			
		||||
					if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
 | 
			
		||||
						scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
 | 
			
		||||
					} else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
 | 
			
		||||
						scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
 | 
			
		||||
						scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
 | 
			
		||||
					} else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
 | 
			
		||||
						scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
 | 
			
		||||
					$.ui.ddmanager.prepareOffsets(this, event);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			//Regenerate the absolute position used for position checks
 | 
			
		||||
			this.positionAbs = this._convertPositionTo("absolute");
 | 
			
		||||
 | 
			
		||||
			// mjs - find the top offset before rearrangement,
 | 
			
		||||
			var previousTopOffset = this.placeholder.offset().top;
 | 
			
		||||
 | 
			
		||||
			//Set the helper position
 | 
			
		||||
			if(!this.options.axis || this.options.axis !== "y") {
 | 
			
		||||
				this.helper[0].style.left = this.position.left+"px";
 | 
			
		||||
			}
 | 
			
		||||
			if(!this.options.axis || this.options.axis !== "x") {
 | 
			
		||||
				this.helper[0].style.top = this.position.top+"px";
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// mjs - check and reset hovering state at each cycle
 | 
			
		||||
			this.hovering = this.hovering ? this.hovering : null;
 | 
			
		||||
			this.mouseentered = this.mouseentered ? this.mouseentered : false;
 | 
			
		||||
 | 
			
		||||
			// mjs - let's start caching some variables
 | 
			
		||||
			var parentItem = (this.placeholder[0].parentNode.parentNode &&
 | 
			
		||||
							 $(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length)
 | 
			
		||||
				       			? $(this.placeholder[0].parentNode.parentNode)
 | 
			
		||||
				       			: null,
 | 
			
		||||
			    level = this._getLevel(this.placeholder),
 | 
			
		||||
			    childLevels = this._getChildLevels(this.helper);
 | 
			
		||||
 | 
			
		||||
			var newList = document.createElement(o.listType);
 | 
			
		||||
 | 
			
		||||
			//Rearrange
 | 
			
		||||
			for (i = this.items.length - 1; i >= 0; i--) {
 | 
			
		||||
 | 
			
		||||
				//Cache variables and intersection, continue if no intersection
 | 
			
		||||
				item = this.items[i];
 | 
			
		||||
				itemElement = item.item[0];
 | 
			
		||||
				intersection = this._intersectsWithPointer(item);
 | 
			
		||||
				if (!intersection) {
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// Only put the placeholder inside the current Container, skip all
 | 
			
		||||
				// items form other containers. This works because when moving
 | 
			
		||||
				// an item from one container to another the
 | 
			
		||||
				// currentContainer is switched before the placeholder is moved.
 | 
			
		||||
				//
 | 
			
		||||
				// Without this moving items in "sub-sortables" can cause the placeholder to jitter
 | 
			
		||||
				// beetween the outer and inner container.
 | 
			
		||||
				if (item.instance !== this.currentContainer) {
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// cannot intersect with itself
 | 
			
		||||
				// no useless actions that have been done before
 | 
			
		||||
				// no action if the item moved is the parent of the item checked
 | 
			
		||||
				if (itemElement !== this.currentItem[0] &&
 | 
			
		||||
					this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
 | 
			
		||||
					!$.contains(this.placeholder[0], itemElement) &&
 | 
			
		||||
					(this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
 | 
			
		||||
				) {
 | 
			
		||||
 | 
			
		||||
					// mjs - we are intersecting an element: trigger the mouseenter event and store this state
 | 
			
		||||
					if (!this.mouseentered) {
 | 
			
		||||
						$(itemElement).mouseenter();
 | 
			
		||||
						this.mouseentered = true;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					// mjs - if the element has children and they are hidden, show them after a delay (CSS responsible)
 | 
			
		||||
					if (o.isTree && $(itemElement).hasClass(o.collapsedClass) && o.expandOnHover) {
 | 
			
		||||
						if (!this.hovering) {
 | 
			
		||||
							$(itemElement).addClass(o.hoveringClass);
 | 
			
		||||
							var self = this;
 | 
			
		||||
							this.hovering = window.setTimeout(function() {
 | 
			
		||||
								$(itemElement).removeClass(o.collapsedClass).addClass(o.expandedClass);
 | 
			
		||||
								self.refreshPositions();
 | 
			
		||||
								self._trigger("expand", event, self._uiHash());
 | 
			
		||||
							}, o.expandOnHover);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					this.direction = intersection == 1 ? "down" : "up";
 | 
			
		||||
 | 
			
		||||
					// mjs - rearrange the elements and reset timeouts and hovering state
 | 
			
		||||
					if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
 | 
			
		||||
						$(itemElement).mouseleave();
 | 
			
		||||
						this.mouseentered = false;
 | 
			
		||||
						$(itemElement).removeClass(o.hoveringClass);
 | 
			
		||||
						this.hovering && window.clearTimeout(this.hovering);
 | 
			
		||||
						this.hovering = null;
 | 
			
		||||
 | 
			
		||||
						// mjs - do not switch container if it's a root item and 'protectRoot' is true
 | 
			
		||||
						// or if it's not a root item but we are trying to make it root
 | 
			
		||||
						if (o.protectRoot
 | 
			
		||||
							&& ! (this.currentItem[0].parentNode == this.element[0] // it's a root item
 | 
			
		||||
								  && itemElement.parentNode != this.element[0]) // it's intersecting a non-root item
 | 
			
		||||
						) {
 | 
			
		||||
							if (this.currentItem[0].parentNode != this.element[0]
 | 
			
		||||
							   	&& itemElement.parentNode == this.element[0]
 | 
			
		||||
							) {
 | 
			
		||||
 | 
			
		||||
								if ( ! $(itemElement).children(o.listType).length) {
 | 
			
		||||
									itemElement.appendChild(newList);
 | 
			
		||||
									o.isTree && $(itemElement).removeClass(o.leafClass).addClass(o.branchClass + ' ' + o.expandedClass);
 | 
			
		||||
								}
 | 
			
		||||
 | 
			
		||||
								var a = this.direction === "down" ? $(itemElement).prev().children(o.listType) : $(itemElement).children(o.listType);
 | 
			
		||||
								if (a[0] !== undefined) {
 | 
			
		||||
									this._rearrange(event, null, a);
 | 
			
		||||
								}
 | 
			
		||||
 | 
			
		||||
							} else {
 | 
			
		||||
								this._rearrange(event, item);
 | 
			
		||||
							}
 | 
			
		||||
						} else if ( ! o.protectRoot) {
 | 
			
		||||
							this._rearrange(event, item);
 | 
			
		||||
						}
 | 
			
		||||
					} else {
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					// Clear emtpy ul's/ol's
 | 
			
		||||
					this._clearEmpty(itemElement);
 | 
			
		||||
 | 
			
		||||
					this._trigger("change", event, this._uiHash());
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// mjs - to find the previous sibling in the list, keep backtracking until we hit a valid list item.
 | 
			
		||||
			var previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null;
 | 
			
		||||
			if (previousItem != null) {
 | 
			
		||||
				while (previousItem[0].nodeName.toLowerCase() != $(o.listType)[0].nodeName.toLowerCase() || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) {
 | 
			
		||||
					if (previousItem[0].previousSibling) {
 | 
			
		||||
						previousItem = $(previousItem[0].previousSibling);
 | 
			
		||||
					} else {
 | 
			
		||||
						previousItem = null;
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// mjs - to find the next sibling in the list, keep stepping forward until we hit a valid list item.
 | 
			
		||||
			var nextItem = this.placeholder[0].nextSibling ? $(this.placeholder[0].nextSibling) : null;
 | 
			
		||||
			if (nextItem != null) {
 | 
			
		||||
				while (nextItem[0].nodeName.toLowerCase() != $(o.listType)[0].nodeName.toLowerCase() || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) {
 | 
			
		||||
					if (nextItem[0].nextSibling) {
 | 
			
		||||
						nextItem = $(nextItem[0].nextSibling);
 | 
			
		||||
					} else {
 | 
			
		||||
						nextItem = null;
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			this.beyondMaxLevels = 0;
 | 
			
		||||
 | 
			
		||||
			// mjs - if the item is moved to the left, send it one level up but only if it's at the bottom of the list
 | 
			
		||||
			if (parentItem != null
 | 
			
		||||
				&& nextItem == null
 | 
			
		||||
				&& ! (o.protectRoot && parentItem[0].parentNode == this.element[0])
 | 
			
		||||
				&&
 | 
			
		||||
					(o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth())
 | 
			
		||||
					 || ! o.rtl && (this.positionAbs.left < parentItem.offset().left))
 | 
			
		||||
			) {
 | 
			
		||||
 | 
			
		||||
				parentItem.after(this.placeholder[0]);
 | 
			
		||||
				if (o.isTree && parentItem.children(o.listItem).children(o.listItem + ':visible:not(.ui-sortable-helper)').length < 1) {
 | 
			
		||||
					parentItem.removeClass(this.options.branchClass + ' ' + this.options.expandedClass)
 | 
			
		||||
							  .addClass(this.options.leafClass);
 | 
			
		||||
				}
 | 
			
		||||
				this._clearEmpty(parentItem[0]);
 | 
			
		||||
				this._trigger("change", event, this._uiHash());
 | 
			
		||||
			}
 | 
			
		||||
			// mjs - if the item is below a sibling and is moved to the right, make it a child of that sibling
 | 
			
		||||
			else if (previousItem != null
 | 
			
		||||
					 && ! previousItem.hasClass(o.disableNestingClass)
 | 
			
		||||
					 &&
 | 
			
		||||
						(previousItem.children(o.listType).length && previousItem.children(o.listType).is(':visible')
 | 
			
		||||
						 || ! previousItem.children(o.listType).length)
 | 
			
		||||
					 && ! (o.protectRoot && this.currentItem[0].parentNode == this.element[0])
 | 
			
		||||
					 &&
 | 
			
		||||
						(o.rtl && (this.positionAbs.left + this.helper.outerWidth() < previousItem.offset().left + previousItem.outerWidth() - o.tabSize)
 | 
			
		||||
						 || ! o.rtl && (this.positionAbs.left > previousItem.offset().left + o.tabSize))
 | 
			
		||||
			) {
 | 
			
		||||
 | 
			
		||||
				this._isAllowed(previousItem, level, level+childLevels+1);
 | 
			
		||||
 | 
			
		||||
				if (!previousItem.children(o.listType).length) {
 | 
			
		||||
					previousItem[0].appendChild(newList);
 | 
			
		||||
					o.isTree && previousItem.removeClass(o.leafClass).addClass(o.branchClass + ' ' + o.expandedClass);
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
		        // mjs - if this item is being moved from the top, add it to the top of the list.
 | 
			
		||||
		        if (previousTopOffset && (previousTopOffset <= previousItem.offset().top)) {
 | 
			
		||||
		        	previousItem.children(o.listType).prepend(this.placeholder);
 | 
			
		||||
		        }
 | 
			
		||||
		        // mjs - otherwise, add it to the bottom of the list.
 | 
			
		||||
		        else if(previousItem.children(o.listType).length) {
 | 
			
		||||
					previousItem.children(o.listType)[0].appendChild(this.placeholder[0]);
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				this._trigger("change", event, this._uiHash());
 | 
			
		||||
			}
 | 
			
		||||
			else {
 | 
			
		||||
				this._isAllowed(parentItem, level, level+childLevels);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			//Post events to containers
 | 
			
		||||
			this._contactContainers(event);
 | 
			
		||||
 | 
			
		||||
			//Interconnect with droppables
 | 
			
		||||
			if($.ui.ddmanager) {
 | 
			
		||||
				$.ui.ddmanager.drag(this, event);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			//Call callbacks
 | 
			
		||||
			this._trigger('sort', event, this._uiHash());
 | 
			
		||||
 | 
			
		||||
			this.lastPositionAbs = this.positionAbs;
 | 
			
		||||
			return false;
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_mouseStop: function(event, noPropagation) {
 | 
			
		||||
 | 
			
		||||
			// mjs - if the item is in a position not allowed, send it back
 | 
			
		||||
			if (this.beyondMaxLevels) {
 | 
			
		||||
 | 
			
		||||
				this.placeholder.removeClass(this.options.errorClass);
 | 
			
		||||
 | 
			
		||||
				if (this.domPosition.prev) {
 | 
			
		||||
					$(this.domPosition.prev).after(this.placeholder);
 | 
			
		||||
				} else {
 | 
			
		||||
					$(this.domPosition.parent).prepend(this.placeholder);
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				this._trigger("revert", event, this._uiHash());
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			// mjs - clear the hovering timeout, just to be sure
 | 
			
		||||
			$('.'+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass);
 | 
			
		||||
			this.mouseentered = false;
 | 
			
		||||
			this.hovering && window.clearTimeout(this.hovering);
 | 
			
		||||
			this.hovering = null;
 | 
			
		||||
 | 
			
		||||
			$.ui.sortable.prototype._mouseStop.apply(this, arguments);
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// mjs - this function is slightly modified to make it easier to hover over a collapsed element and have it expand
 | 
			
		||||
		_intersectsWithSides: function(item) {
 | 
			
		||||
 | 
			
		||||
			var half = this.options.isTree ? .8 : .5;
 | 
			
		||||
 | 
			
		||||
			var isOverBottomHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height*half), item.height),
 | 
			
		||||
				isOverTopHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top - (item.height*half), item.height),
 | 
			
		||||
				isOverRightHalf = isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
 | 
			
		||||
				verticalDirection = this._getDragVerticalDirection(),
 | 
			
		||||
				horizontalDirection = this._getDragHorizontalDirection();
 | 
			
		||||
 | 
			
		||||
			if (this.floating && horizontalDirection) {
 | 
			
		||||
				return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
 | 
			
		||||
			} else {
 | 
			
		||||
				return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && isOverTopHalf));
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_contactContainers: function(event) {
 | 
			
		||||
 | 
			
		||||
			if (this.options.protectRoot && this.currentItem[0].parentNode == this.element[0] ) {
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			$.ui.sortable.prototype._contactContainers.apply(this, arguments);
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_clear: function(event, noPropagation) {
 | 
			
		||||
 | 
			
		||||
			$.ui.sortable.prototype._clear.apply(this, arguments);
 | 
			
		||||
 | 
			
		||||
			// mjs - clean last empty ul/ol
 | 
			
		||||
			for (var i = this.items.length - 1; i >= 0; i--) {
 | 
			
		||||
				var item = this.items[i].item[0];
 | 
			
		||||
				this._clearEmpty(item);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		serialize: function(options) {
 | 
			
		||||
 | 
			
		||||
			var o = $.extend({}, this.options, options),
 | 
			
		||||
				items = this._getItemsAsjQuery(o && o.connected),
 | 
			
		||||
			    str = [];
 | 
			
		||||
 | 
			
		||||
			$(items).each(function() {
 | 
			
		||||
				var res = ($(o.item || this).attr(o.attribute || 'id') || '')
 | 
			
		||||
						.match(o.expression || (/(.+)[-=_](.+)/)),
 | 
			
		||||
				    pid = ($(o.item || this).parent(o.listType)
 | 
			
		||||
						.parent(o.items)
 | 
			
		||||
						.attr(o.attribute || 'id') || '')
 | 
			
		||||
						.match(o.expression || (/(.+)[-=_](.+)/));
 | 
			
		||||
 | 
			
		||||
				if (res) {
 | 
			
		||||
					str.push(((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']')
 | 
			
		||||
						+ '='
 | 
			
		||||
						+ (pid ? (o.key && o.expression ? pid[1] : pid[2]) : o.rootID));
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			if(!str.length && o.key) {
 | 
			
		||||
				str.push(o.key + '=');
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return str.join('&');
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		toHierarchy: function(options) {
 | 
			
		||||
 | 
			
		||||
			var o = $.extend({}, this.options, options),
 | 
			
		||||
				sDepth = o.startDepthCount || 0,
 | 
			
		||||
			    ret = [];
 | 
			
		||||
 | 
			
		||||
			$(this.element).children(o.items).each(function () {
 | 
			
		||||
				var level = _recursiveItems(this);
 | 
			
		||||
				ret.push(level);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			return ret;
 | 
			
		||||
 | 
			
		||||
			function _recursiveItems(item) {
 | 
			
		||||
				var id = ($(item).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
 | 
			
		||||
				if (id) {
 | 
			
		||||
					var currentItem = {"id" : id[2]};
 | 
			
		||||
					if ($(item).children(o.listType).children(o.items).length > 0) {
 | 
			
		||||
						currentItem.children = [];
 | 
			
		||||
						$(item).children(o.listType).children(o.items).each(function() {
 | 
			
		||||
							var level = _recursiveItems(this);
 | 
			
		||||
							currentItem.children.push(level);
 | 
			
		||||
						});
 | 
			
		||||
					}
 | 
			
		||||
					return currentItem;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		toArray: function(options) {
 | 
			
		||||
 | 
			
		||||
			var o = $.extend({}, this.options, options),
 | 
			
		||||
				sDepth = o.startDepthCount || 0,
 | 
			
		||||
			    ret = [],
 | 
			
		||||
			    left = 1;
 | 
			
		||||
 | 
			
		||||
			if (!o.excludeRoot) {
 | 
			
		||||
				ret.push({
 | 
			
		||||
					"item_id": o.rootID,
 | 
			
		||||
					"parent_id": null,
 | 
			
		||||
					"depth": sDepth,
 | 
			
		||||
					"left": left,
 | 
			
		||||
					"right": ($(o.items, this.element).length + 1) * 2
 | 
			
		||||
				});
 | 
			
		||||
				left++
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			$(this.element).children(o.items).each(function () {
 | 
			
		||||
				left = _recursiveArray(this, sDepth + 1, left);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			ret = ret.sort(function(a,b){ return (a.left - b.left); });
 | 
			
		||||
 | 
			
		||||
			return ret;
 | 
			
		||||
 | 
			
		||||
			function _recursiveArray(item, depth, left) {
 | 
			
		||||
 | 
			
		||||
				var right = left + 1,
 | 
			
		||||
				    id,
 | 
			
		||||
				    pid;
 | 
			
		||||
 | 
			
		||||
				if ($(item).children(o.listType).children(o.items).length > 0) {
 | 
			
		||||
					depth ++;
 | 
			
		||||
					$(item).children(o.listType).children(o.items).each(function () {
 | 
			
		||||
						right = _recursiveArray($(this), depth, right);
 | 
			
		||||
					});
 | 
			
		||||
					depth --;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/));
 | 
			
		||||
 | 
			
		||||
				if (depth === sDepth + 1) {
 | 
			
		||||
					pid = o.rootID;
 | 
			
		||||
				} else {
 | 
			
		||||
					var parentItem = ($(item).parent(o.listType)
 | 
			
		||||
											 .parent(o.items)
 | 
			
		||||
											 .attr(o.attribute || 'id'))
 | 
			
		||||
											 .match(o.expression || (/(.+)[-=_](.+)/));
 | 
			
		||||
					pid = parentItem[2];
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if (id) {
 | 
			
		||||
						ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right});
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				left = right + 1;
 | 
			
		||||
				return left;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_clearEmpty: function(item) {
 | 
			
		||||
			var o = this.options;
 | 
			
		||||
 | 
			
		||||
			var emptyList = $(item).children(o.listType);
 | 
			
		||||
 | 
			
		||||
			if (emptyList.length && !emptyList.children().length && !o.doNotClear) {
 | 
			
		||||
				o.isTree && $(item).removeClass(o.branchClass + ' ' + o.expandedClass).addClass(o.leafClass);
 | 
			
		||||
				emptyList.remove();
 | 
			
		||||
			} else if (o.isTree && emptyList.length && emptyList.children().length && emptyList.is(':visible')) {
 | 
			
		||||
				$(item).removeClass(o.leafClass).addClass(o.branchClass + ' ' + o.expandedClass);
 | 
			
		||||
			} else if (o.isTree && emptyList.length && emptyList.children().length && !emptyList.is(':visible')) {
 | 
			
		||||
				$(item).removeClass(o.leafClass).addClass(o.branchClass + ' ' + o.collapsedClass);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_getLevel: function(item) {
 | 
			
		||||
 | 
			
		||||
			var level = 1;
 | 
			
		||||
 | 
			
		||||
			if (this.options.listType) {
 | 
			
		||||
				var list = item.closest(this.options.listType);
 | 
			
		||||
				while (list && list.length > 0 &&
 | 
			
		||||
                    	!list.is('.ui-sortable')) {
 | 
			
		||||
					level++;
 | 
			
		||||
					list = list.parent().closest(this.options.listType);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return level;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_getChildLevels: function(parent, depth) {
 | 
			
		||||
			var self = this,
 | 
			
		||||
			    o = this.options,
 | 
			
		||||
			    result = 0;
 | 
			
		||||
			depth = depth || 0;
 | 
			
		||||
 | 
			
		||||
			$(parent).children(o.listType).children(o.items).each(function (index, child) {
 | 
			
		||||
					result = Math.max(self._getChildLevels(child, depth + 1), result);
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			return depth ? result + 1 : result;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		_isAllowed: function(parentItem, level, levels) {
 | 
			
		||||
			var o = this.options,
 | 
			
		||||
				maxLevels = this.placeholder.closest('.ui-sortable').nestedSortable('option', 'maxLevels'); // this takes into account the maxLevels set to the recipient list
 | 
			
		||||
 | 
			
		||||
			// mjs - is the root protected?
 | 
			
		||||
			// mjs - are we nesting too deep?
 | 
			
		||||
			if ( ! o.isAllowed(this.placeholder, parentItem, this.currentItem)) {
 | 
			
		||||
					this.placeholder.addClass(o.errorClass);
 | 
			
		||||
					if (maxLevels < levels && maxLevels != 0) {
 | 
			
		||||
						this.beyondMaxLevels = levels - maxLevels;
 | 
			
		||||
					} else {
 | 
			
		||||
						this.beyondMaxLevels = 1;
 | 
			
		||||
					}
 | 
			
		||||
			} else {
 | 
			
		||||
				if (maxLevels < levels && maxLevels != 0) {
 | 
			
		||||
					this.placeholder.addClass(o.errorClass);
 | 
			
		||||
					this.beyondMaxLevels = levels - maxLevels;
 | 
			
		||||
				} else {
 | 
			
		||||
					this.placeholder.removeClass(o.errorClass);
 | 
			
		||||
					this.beyondMaxLevels = 0;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}));
 | 
			
		||||
 | 
			
		||||
	$.mjs.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.mjs.nestedSortable.prototype.options);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										18
									
								
								static/cms/js/select2/LICENSE
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
Copyright 2014 Igor Vaynberg
 | 
			
		||||
 | 
			
		||||
Version: @@ver@@ Timestamp: @@timestamp@@
 | 
			
		||||
 | 
			
		||||
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
 | 
			
		||||
General Public License version 2 (the "GPL License"). You may choose either license to govern your
 | 
			
		||||
use of this software only upon the condition that you accept all of the terms of either the Apache
 | 
			
		||||
License or the GPL License.
 | 
			
		||||
 | 
			
		||||
You may obtain a copy of the Apache License and the GPL License at:
 | 
			
		||||
 | 
			
		||||
http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
http://www.gnu.org/licenses/gpl-2.0.html
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software distributed under the Apache License
 | 
			
		||||
or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 | 
			
		||||
either express or implied. See the Apache License and the GPL License for the specific language governing
 | 
			
		||||
permissions and limitations under the Apache License and the GPL License.
 | 
			
		||||
							
								
								
									
										99
									
								
								static/cms/js/select2/README.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,99 @@
 | 
			
		|||
Select2
 | 
			
		||||
=======
 | 
			
		||||
 | 
			
		||||
Select2 is a jQuery-based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.
 | 
			
		||||
 | 
			
		||||
To get started, checkout examples and documentation at http://ivaynberg.github.com/select2
 | 
			
		||||
 | 
			
		||||
Use cases
 | 
			
		||||
---------
 | 
			
		||||
 | 
			
		||||
* Enhancing native selects with search.
 | 
			
		||||
* Enhancing native selects with a better multi-select interface.
 | 
			
		||||
* Loading data from JavaScript: easily load items via ajax and have them searchable.
 | 
			
		||||
* Nesting optgroups: native selects only support one level of nested. Select2 does not have this restriction.
 | 
			
		||||
* Tagging: ability to add new items on the fly.
 | 
			
		||||
* Working with large, remote datasets: ability to partially load a dataset based on the search term.
 | 
			
		||||
* Paging of large datasets: easy support for loading more pages when the results are scrolled to the end.
 | 
			
		||||
* Templating: support for custom rendering of results and selections.
 | 
			
		||||
 | 
			
		||||
Browser compatibility
 | 
			
		||||
---------------------
 | 
			
		||||
* IE 8+
 | 
			
		||||
* Chrome 8+
 | 
			
		||||
* Firefox 10+
 | 
			
		||||
* Safari 3+
 | 
			
		||||
* Opera 10.6+
 | 
			
		||||
 
 | 
			
		||||
Usage
 | 
			
		||||
-----
 | 
			
		||||
You can source Select2 directly from a [CDN like JSDliver](http://www.jsdelivr.com/#!select2), [download it from this GitHub repo](https://github.com/ivaynberg/select2/tags), or use one of the integrations below.
 | 
			
		||||
 | 
			
		||||
Integrations
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
* [Wicket-Select2](https://github.com/ivaynberg/wicket-select2) (Java / [Apache Wicket](http://wicket.apache.org))
 | 
			
		||||
* [select2-rails](https://github.com/argerim/select2-rails) (Ruby on Rails)
 | 
			
		||||
* [AngularUI](http://angular-ui.github.com/#directives-select2) ([AngularJS](http://angularjs.org))
 | 
			
		||||
* [Django](https://github.com/applegrew/django-select2)
 | 
			
		||||
* [Symfony](https://github.com/19Gerhard85/sfSelect2WidgetsPlugin)
 | 
			
		||||
* [Symfony2](https://github.com/avocode/FormExtensions)
 | 
			
		||||
* [Bootstrap 2](https://github.com/t0m/select2-bootstrap-css) and [Bootstrap 3](https://github.com/t0m/select2-bootstrap-css/tree/bootstrap3) (CSS skins)
 | 
			
		||||
* [Meteor](https://github.com/nate-strauser/meteor-select2) (modern reactive JavaScript framework; + [Bootstrap 3 skin](https://github.com/esperadomedia/meteor-select2-bootstrap3-css/))
 | 
			
		||||
* [Meteor](https://jquery-select2.meteor.com)
 | 
			
		||||
* [Yii 2.x](http://demos.krajee.com/widgets#select2)
 | 
			
		||||
* [Yii 1.x](https://github.com/tonybolzan/yii-select2)
 | 
			
		||||
* [AtmosphereJS](https://atmospherejs.com/package/jquery-select2)
 | 
			
		||||
 | 
			
		||||
### Example Integrations
 | 
			
		||||
 | 
			
		||||
* [Knockout.js](https://github.com/ivaynberg/select2/wiki/Knockout.js-Integration)
 | 
			
		||||
* [Socket.IO](https://github.com/ivaynberg/select2/wiki/Socket.IO-Integration)
 | 
			
		||||
* [PHP](https://github.com/ivaynberg/select2/wiki/PHP-Example)
 | 
			
		||||
* [.Net MVC] (https://github.com/ivaynberg/select2/wiki/.Net-MVC-Example)
 | 
			
		||||
 | 
			
		||||
Internationalization (i18n)
 | 
			
		||||
---------------------------
 | 
			
		||||
 | 
			
		||||
Select2 supports multiple languages by simply including the right language JS
 | 
			
		||||
file (`select2_locale_it.js`, `select2_locale_nl.js`, etc.) after `select2.js`.
 | 
			
		||||
 | 
			
		||||
Missing a language? Just copy `select2_locale_en.js.template`, translate
 | 
			
		||||
it, and make a pull request back to Select2 here on GitHub.
 | 
			
		||||
 | 
			
		||||
Bug tracker
 | 
			
		||||
-----------
 | 
			
		||||
 | 
			
		||||
Have a bug? Please create an issue here on GitHub!
 | 
			
		||||
 | 
			
		||||
https://github.com/ivaynberg/select2/issues
 | 
			
		||||
 | 
			
		||||
Mailing list
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
Have a question? Ask on our mailing list!
 | 
			
		||||
 | 
			
		||||
select2@googlegroups.com
 | 
			
		||||
 | 
			
		||||
https://groups.google.com/d/forum/select2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Copyright and license
 | 
			
		||||
---------------------
 | 
			
		||||
 | 
			
		||||
Copyright 2012 Igor Vaynberg
 | 
			
		||||
 | 
			
		||||
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
 | 
			
		||||
General Public License version 2 (the "GPL License"). You may choose either license to govern your
 | 
			
		||||
use of this software only upon the condition that you accept all of the terms of either the Apache
 | 
			
		||||
License or the GPL License.
 | 
			
		||||
 | 
			
		||||
You may obtain a copy of the Apache License and the GPL License in the LICENSE file, or at:
 | 
			
		||||
 | 
			
		||||
http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
http://www.gnu.org/licenses/gpl-2.0.html
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software distributed under the Apache License
 | 
			
		||||
or the GPL License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 | 
			
		||||
either express or implied. See the Apache License and the GPL License for the specific language governing
 | 
			
		||||
permissions and limitations under the Apache License and the GPL License.
 | 
			
		||||
							
								
								
									
										87
									
								
								static/cms/js/select2/select2-bootstrap.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,87 @@
 | 
			
		|||
.form-control .select2-choice {
 | 
			
		||||
    border: 0;
 | 
			
		||||
    border-radius: 2px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.form-control .select2-choice .select2-arrow {
 | 
			
		||||
    border-radius: 0 2px 2px 0;   
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.form-control.select2-container {
 | 
			
		||||
    height: auto !important;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.form-control.select2-container.select2-dropdown-open {
 | 
			
		||||
    border-color: #5897FB;
 | 
			
		||||
    border-radius: 3px 3px 0 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.form-control .select2-container.select2-dropdown-open .select2-choices {
 | 
			
		||||
    border-radius: 3px 3px 0 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.form-control.select2-container .select2-choices {
 | 
			
		||||
    border: 0 !important;
 | 
			
		||||
    border-radius: 3px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.control-group.warning .select2-container .select2-choice,
 | 
			
		||||
.control-group.warning .select2-container .select2-choices,
 | 
			
		||||
.control-group.warning .select2-container-active .select2-choice,
 | 
			
		||||
.control-group.warning .select2-container-active .select2-choices,
 | 
			
		||||
.control-group.warning .select2-dropdown-open.select2-drop-above .select2-choice,
 | 
			
		||||
.control-group.warning .select2-dropdown-open.select2-drop-above .select2-choices,
 | 
			
		||||
.control-group.warning .select2-container-multi.select2-container-active .select2-choices {
 | 
			
		||||
    border: 1px solid #C09853 !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.control-group.warning .select2-container .select2-choice div {
 | 
			
		||||
    border-left: 1px solid #C09853 !important;
 | 
			
		||||
    background: #FCF8E3 !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.control-group.error .select2-container .select2-choice,
 | 
			
		||||
.control-group.error .select2-container .select2-choices,
 | 
			
		||||
.control-group.error .select2-container-active .select2-choice,
 | 
			
		||||
.control-group.error .select2-container-active .select2-choices,
 | 
			
		||||
.control-group.error .select2-dropdown-open.select2-drop-above .select2-choice,
 | 
			
		||||
.control-group.error .select2-dropdown-open.select2-drop-above .select2-choices,
 | 
			
		||||
.control-group.error .select2-container-multi.select2-container-active .select2-choices {
 | 
			
		||||
    border: 1px solid #B94A48 !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.control-group.error .select2-container .select2-choice div {
 | 
			
		||||
    border-left: 1px solid #B94A48 !important;
 | 
			
		||||
    background: #F2DEDE !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.control-group.info .select2-container .select2-choice,
 | 
			
		||||
.control-group.info .select2-container .select2-choices,
 | 
			
		||||
.control-group.info .select2-container-active .select2-choice,
 | 
			
		||||
.control-group.info .select2-container-active .select2-choices,
 | 
			
		||||
.control-group.info .select2-dropdown-open.select2-drop-above .select2-choice,
 | 
			
		||||
.control-group.info .select2-dropdown-open.select2-drop-above .select2-choices,
 | 
			
		||||
.control-group.info .select2-container-multi.select2-container-active .select2-choices {
 | 
			
		||||
    border: 1px solid #3A87AD !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.control-group.info .select2-container .select2-choice div {
 | 
			
		||||
    border-left: 1px solid #3A87AD !important;
 | 
			
		||||
    background: #D9EDF7 !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.control-group.success .select2-container .select2-choice,
 | 
			
		||||
.control-group.success .select2-container .select2-choices,
 | 
			
		||||
.control-group.success .select2-container-active .select2-choice,
 | 
			
		||||
.control-group.success .select2-container-active .select2-choices,
 | 
			
		||||
.control-group.success .select2-dropdown-open.select2-drop-above .select2-choice,
 | 
			
		||||
.control-group.success .select2-dropdown-open.select2-drop-above .select2-choices,
 | 
			
		||||
.control-group.success .select2-container-multi.select2-container-active .select2-choices {
 | 
			
		||||
    border: 1px solid #468847 !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.control-group.success .select2-container .select2-choice div {
 | 
			
		||||
    border-left: 1px solid #468847 !important;
 | 
			
		||||
    background: #DFF0D8 !important;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/select2/select2-spinner.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.8 KiB  | 
							
								
								
									
										704
									
								
								static/cms/js/select2/select2.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,704 @@
 | 
			
		|||
/*
 | 
			
		||||
Version: @@ver@@ Timestamp: @@timestamp@@
 | 
			
		||||
*/
 | 
			
		||||
.select2-container {
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    position: relative;
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    /* inline-block for ie7 */
 | 
			
		||||
    zoom: 1;
 | 
			
		||||
    *display: inline;
 | 
			
		||||
    vertical-align: middle;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container,
 | 
			
		||||
.select2-drop,
 | 
			
		||||
.select2-search,
 | 
			
		||||
.select2-search input {
 | 
			
		||||
  /*
 | 
			
		||||
    Force border-box so that % widths fit the parent
 | 
			
		||||
    container without overlap because of margin/padding.
 | 
			
		||||
    More Info : http://www.quirksmode.org/css/box.html
 | 
			
		||||
  */
 | 
			
		||||
  -webkit-box-sizing: border-box; /* webkit */
 | 
			
		||||
     -moz-box-sizing: border-box; /* firefox */
 | 
			
		||||
          box-sizing: border-box; /* css3 */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container .select2-choice {
 | 
			
		||||
    display: block;
 | 
			
		||||
    height: 26px;
 | 
			
		||||
    padding: 0 0 0 8px;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
    position: relative;
 | 
			
		||||
 | 
			
		||||
    border: 1px solid #aaa;
 | 
			
		||||
    white-space: nowrap;
 | 
			
		||||
    line-height: 26px;
 | 
			
		||||
    color: #444;
 | 
			
		||||
    text-decoration: none;
 | 
			
		||||
 | 
			
		||||
    border-radius: 4px;
 | 
			
		||||
 | 
			
		||||
    background-clip: padding-box;
 | 
			
		||||
 | 
			
		||||
    -webkit-touch-callout: none;
 | 
			
		||||
      -webkit-user-select: none;
 | 
			
		||||
         -moz-user-select: none;
 | 
			
		||||
          -ms-user-select: none;
 | 
			
		||||
              user-select: none;
 | 
			
		||||
 | 
			
		||||
    background-color: #fff;
 | 
			
		||||
    background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.5, #fff));
 | 
			
		||||
    background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 50%);
 | 
			
		||||
    background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 50%);
 | 
			
		||||
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#eeeeee', GradientType = 0);
 | 
			
		||||
    background-image: linear-gradient(to top, #eee 0%, #fff 50%);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html[dir="rtl"] .select2-container .select2-choice {
 | 
			
		||||
    padding: 0 8px 0 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container.select2-drop-above .select2-choice {
 | 
			
		||||
    border-bottom-color: #aaa;
 | 
			
		||||
 | 
			
		||||
    border-radius: 0 0 4px 4px;
 | 
			
		||||
 | 
			
		||||
    background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.9, #fff));
 | 
			
		||||
    background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 90%);
 | 
			
		||||
    background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 90%);
 | 
			
		||||
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
 | 
			
		||||
    background-image: linear-gradient(to bottom, #eee 0%, #fff 90%);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container.select2-allowclear .select2-choice .select2-chosen {
 | 
			
		||||
    margin-right: 42px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container .select2-choice > .select2-chosen {
 | 
			
		||||
    margin-right: 26px;
 | 
			
		||||
    display: block;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
 | 
			
		||||
    white-space: nowrap;
 | 
			
		||||
 | 
			
		||||
    text-overflow: ellipsis;
 | 
			
		||||
    float: none;
 | 
			
		||||
    width: auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html[dir="rtl"] .select2-container .select2-choice > .select2-chosen {
 | 
			
		||||
    margin-left: 26px;
 | 
			
		||||
    margin-right: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container .select2-choice abbr {
 | 
			
		||||
    display: none;
 | 
			
		||||
    width: 12px;
 | 
			
		||||
    height: 12px;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    right: 24px;
 | 
			
		||||
    top: 8px;
 | 
			
		||||
 | 
			
		||||
    font-size: 1px;
 | 
			
		||||
    text-decoration: none;
 | 
			
		||||
 | 
			
		||||
    border: 0;
 | 
			
		||||
    background: url('select2.png') right top no-repeat;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
    outline: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container.select2-allowclear .select2-choice abbr {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container .select2-choice abbr:hover {
 | 
			
		||||
    background-position: right -11px;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop-mask {
 | 
			
		||||
    border: 0;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
    position: fixed;
 | 
			
		||||
    left: 0;
 | 
			
		||||
    top: 0;
 | 
			
		||||
    min-height: 100%;
 | 
			
		||||
    min-width: 100%;
 | 
			
		||||
    height: auto;
 | 
			
		||||
    width: auto;
 | 
			
		||||
    opacity: 0;
 | 
			
		||||
    z-index: 9998;
 | 
			
		||||
    /* styles required for IE to work */
 | 
			
		||||
    background-color: #fff;
 | 
			
		||||
    filter: alpha(opacity=0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    margin-top: -1px;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    z-index: 9999;
 | 
			
		||||
    top: 100%;
 | 
			
		||||
 | 
			
		||||
    background: #fff;
 | 
			
		||||
    color: #000;
 | 
			
		||||
    border: 1px solid #aaa;
 | 
			
		||||
    border-top: 0;
 | 
			
		||||
 | 
			
		||||
    border-radius: 0 0 4px 4px;
 | 
			
		||||
 | 
			
		||||
    -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
 | 
			
		||||
            box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop.select2-drop-above {
 | 
			
		||||
    margin-top: 1px;
 | 
			
		||||
    border-top: 1px solid #aaa;
 | 
			
		||||
    border-bottom: 0;
 | 
			
		||||
 | 
			
		||||
    border-radius: 4px 4px 0 0;
 | 
			
		||||
 | 
			
		||||
    -webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
 | 
			
		||||
            box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop-active {
 | 
			
		||||
    border: 1px solid #5897fb;
 | 
			
		||||
    border-top: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop.select2-drop-above.select2-drop-active {
 | 
			
		||||
    border-top: 1px solid #5897fb;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop-auto-width {
 | 
			
		||||
    border-top: 1px solid #aaa;
 | 
			
		||||
    width: auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop-auto-width .select2-search {
 | 
			
		||||
    padding-top: 4px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container .select2-choice .select2-arrow {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    width: 18px;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    right: 0;
 | 
			
		||||
    top: 0;
 | 
			
		||||
 | 
			
		||||
    border-left: 1px solid #aaa;
 | 
			
		||||
    border-radius: 0 4px 4px 0;
 | 
			
		||||
 | 
			
		||||
    background-clip: padding-box;
 | 
			
		||||
 | 
			
		||||
    background: #ccc;
 | 
			
		||||
    background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
 | 
			
		||||
    background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
 | 
			
		||||
    background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
 | 
			
		||||
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc', GradientType = 0);
 | 
			
		||||
    background-image: linear-gradient(to top, #ccc 0%, #eee 60%);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html[dir="rtl"] .select2-container .select2-choice .select2-arrow {
 | 
			
		||||
    left: 0;
 | 
			
		||||
    right: auto;
 | 
			
		||||
 | 
			
		||||
    border-left: none;
 | 
			
		||||
    border-right: 1px solid #aaa;
 | 
			
		||||
    border-radius: 4px 0 0 4px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container .select2-choice .select2-arrow b {
 | 
			
		||||
    display: block;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    background: url('select2.png') no-repeat 0 1px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html[dir="rtl"] .select2-container .select2-choice .select2-arrow b {
 | 
			
		||||
    background-position: 2px 1px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-search {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    min-height: 26px;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    padding-left: 4px;
 | 
			
		||||
    padding-right: 4px;
 | 
			
		||||
 | 
			
		||||
    position: relative;
 | 
			
		||||
    z-index: 10000;
 | 
			
		||||
 | 
			
		||||
    white-space: nowrap;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-search input {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: auto !important;
 | 
			
		||||
    min-height: 26px;
 | 
			
		||||
    padding: 4px 20px 4px 5px;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
 | 
			
		||||
    outline: 0;
 | 
			
		||||
    font-family: sans-serif;
 | 
			
		||||
    font-size: 1em;
 | 
			
		||||
 | 
			
		||||
    border: 1px solid #aaa;
 | 
			
		||||
    border-radius: 0;
 | 
			
		||||
 | 
			
		||||
    -webkit-box-shadow: none;
 | 
			
		||||
            box-shadow: none;
 | 
			
		||||
 | 
			
		||||
    background: #fff url('select2.png') no-repeat 100% -22px;
 | 
			
		||||
    background: url('select2.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
 | 
			
		||||
    background: url('select2.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
 | 
			
		||||
    background: url('select2.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
 | 
			
		||||
    background: url('select2.png') no-repeat 100% -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html[dir="rtl"] .select2-search input {
 | 
			
		||||
    padding: 4px 5px 4px 20px;
 | 
			
		||||
 | 
			
		||||
    background: #fff url('select2.png') no-repeat -37px -22px;
 | 
			
		||||
    background: url('select2.png') no-repeat -37px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
 | 
			
		||||
    background: url('select2.png') no-repeat -37px -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
 | 
			
		||||
    background: url('select2.png') no-repeat -37px -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
 | 
			
		||||
    background: url('select2.png') no-repeat -37px -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop.select2-drop-above .select2-search input {
 | 
			
		||||
    margin-top: 4px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-search input.select2-active {
 | 
			
		||||
    background: #fff url('select2-spinner.gif') no-repeat 100%;
 | 
			
		||||
    background: url('select2-spinner.gif') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
 | 
			
		||||
    background: url('select2-spinner.gif') no-repeat 100%, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
 | 
			
		||||
    background: url('select2-spinner.gif') no-repeat 100%, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
 | 
			
		||||
    background: url('select2-spinner.gif') no-repeat 100%, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container-active .select2-choice,
 | 
			
		||||
.select2-container-active .select2-choices {
 | 
			
		||||
    border: 1px solid #5897fb;
 | 
			
		||||
    outline: none;
 | 
			
		||||
 | 
			
		||||
    -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
 | 
			
		||||
            box-shadow: 0 0 5px rgba(0, 0, 0, .3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-dropdown-open .select2-choice {
 | 
			
		||||
    border-bottom-color: transparent;
 | 
			
		||||
    -webkit-box-shadow: 0 1px 0 #fff inset;
 | 
			
		||||
            box-shadow: 0 1px 0 #fff inset;
 | 
			
		||||
 | 
			
		||||
    border-bottom-left-radius: 0;
 | 
			
		||||
    border-bottom-right-radius: 0;
 | 
			
		||||
 | 
			
		||||
    background-color: #eee;
 | 
			
		||||
    background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #fff), color-stop(0.5, #eee));
 | 
			
		||||
    background-image: -webkit-linear-gradient(center bottom, #fff 0%, #eee 50%);
 | 
			
		||||
    background-image: -moz-linear-gradient(center bottom, #fff 0%, #eee 50%);
 | 
			
		||||
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
 | 
			
		||||
    background-image: linear-gradient(to top, #fff 0%, #eee 50%);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-dropdown-open.select2-drop-above .select2-choice,
 | 
			
		||||
.select2-dropdown-open.select2-drop-above .select2-choices {
 | 
			
		||||
    border: 1px solid #5897fb;
 | 
			
		||||
    border-top-color: transparent;
 | 
			
		||||
 | 
			
		||||
    background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(0.5, #eee));
 | 
			
		||||
    background-image: -webkit-linear-gradient(center top, #fff 0%, #eee 50%);
 | 
			
		||||
    background-image: -moz-linear-gradient(center top, #fff 0%, #eee 50%);
 | 
			
		||||
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
 | 
			
		||||
    background-image: linear-gradient(to bottom, #fff 0%, #eee 50%);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-dropdown-open .select2-choice .select2-arrow {
 | 
			
		||||
    background: transparent;
 | 
			
		||||
    border-left: none;
 | 
			
		||||
    filter: none;
 | 
			
		||||
}
 | 
			
		||||
html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow {
 | 
			
		||||
    border-right: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-dropdown-open .select2-choice .select2-arrow b {
 | 
			
		||||
    background-position: -18px 1px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow b {
 | 
			
		||||
    background-position: -16px 1px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-hidden-accessible {
 | 
			
		||||
    border: 0;
 | 
			
		||||
    clip: rect(0 0 0 0);
 | 
			
		||||
    height: 1px;
 | 
			
		||||
    margin: -1px;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    width: 1px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* results */
 | 
			
		||||
.select2-results {
 | 
			
		||||
    max-height: 200px;
 | 
			
		||||
    padding: 0 0 0 4px;
 | 
			
		||||
    margin: 4px 4px 4px 0;
 | 
			
		||||
    position: relative;
 | 
			
		||||
    overflow-x: hidden;
 | 
			
		||||
    overflow-y: auto;
 | 
			
		||||
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html[dir="rtl"] .select2-results {
 | 
			
		||||
    padding: 0 4px 0 0;
 | 
			
		||||
    margin: 4px 0 4px 4px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results ul.select2-result-sub {
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    padding-left: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results li {
 | 
			
		||||
    list-style: none;
 | 
			
		||||
    display: list-item;
 | 
			
		||||
    background-image: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results li.select2-result-with-children > .select2-result-label {
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results .select2-result-label {
 | 
			
		||||
    padding: 3px 7px 4px;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
 | 
			
		||||
    min-height: 1em;
 | 
			
		||||
 | 
			
		||||
    -webkit-touch-callout: none;
 | 
			
		||||
      -webkit-user-select: none;
 | 
			
		||||
         -moz-user-select: none;
 | 
			
		||||
          -ms-user-select: none;
 | 
			
		||||
              user-select: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results-dept-1 .select2-result-label { padding-left: 20px }
 | 
			
		||||
.select2-results-dept-2 .select2-result-label { padding-left: 40px }
 | 
			
		||||
.select2-results-dept-3 .select2-result-label { padding-left: 60px }
 | 
			
		||||
.select2-results-dept-4 .select2-result-label { padding-left: 80px }
 | 
			
		||||
.select2-results-dept-5 .select2-result-label { padding-left: 100px }
 | 
			
		||||
.select2-results-dept-6 .select2-result-label { padding-left: 110px }
 | 
			
		||||
.select2-results-dept-7 .select2-result-label { padding-left: 120px }
 | 
			
		||||
 | 
			
		||||
.select2-results .select2-highlighted {
 | 
			
		||||
    background: #3875d7;
 | 
			
		||||
    color: #fff;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results li em {
 | 
			
		||||
    background: #feffde;
 | 
			
		||||
    font-style: normal;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results .select2-highlighted em {
 | 
			
		||||
    background: transparent;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results .select2-highlighted ul {
 | 
			
		||||
    background: #fff;
 | 
			
		||||
    color: #000;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results .select2-no-results,
 | 
			
		||||
.select2-results .select2-searching,
 | 
			
		||||
.select2-results .select2-ajax-error,
 | 
			
		||||
.select2-results .select2-selection-limit {
 | 
			
		||||
    background: #f4f4f4;
 | 
			
		||||
    display: list-item;
 | 
			
		||||
    padding-left: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
disabled look for disabled choices in the results dropdown
 | 
			
		||||
*/
 | 
			
		||||
.select2-results .select2-disabled.select2-highlighted {
 | 
			
		||||
    color: #666;
 | 
			
		||||
    background: #f4f4f4;
 | 
			
		||||
    display: list-item;
 | 
			
		||||
    cursor: default;
 | 
			
		||||
}
 | 
			
		||||
.select2-results .select2-disabled {
 | 
			
		||||
  background: #f4f4f4;
 | 
			
		||||
  display: list-item;
 | 
			
		||||
  cursor: default;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results .select2-selected {
 | 
			
		||||
    display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-more-results.select2-active {
 | 
			
		||||
    background: #f4f4f4 url('select2-spinner.gif') no-repeat 100%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-results .select2-ajax-error {
 | 
			
		||||
    background: rgba(255, 50, 50, .2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-more-results {
 | 
			
		||||
    background: #f4f4f4;
 | 
			
		||||
    display: list-item;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* disabled styles */
 | 
			
		||||
 | 
			
		||||
.select2-container.select2-container-disabled .select2-choice {
 | 
			
		||||
    background-color: #f4f4f4;
 | 
			
		||||
    background-image: none;
 | 
			
		||||
    border: 1px solid #ddd;
 | 
			
		||||
    cursor: default;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container.select2-container-disabled .select2-choice .select2-arrow {
 | 
			
		||||
    background-color: #f4f4f4;
 | 
			
		||||
    background-image: none;
 | 
			
		||||
    border-left: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container.select2-container-disabled .select2-choice abbr {
 | 
			
		||||
    display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* multiselect */
 | 
			
		||||
 | 
			
		||||
.select2-container-multi .select2-choices {
 | 
			
		||||
    height: auto !important;
 | 
			
		||||
    height: 1%;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    padding: 0 5px 0 0;
 | 
			
		||||
    position: relative;
 | 
			
		||||
 | 
			
		||||
    border: 1px solid #aaa;
 | 
			
		||||
    cursor: text;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
 | 
			
		||||
    background-color: #fff;
 | 
			
		||||
    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eee), color-stop(15%, #fff));
 | 
			
		||||
    background-image: -webkit-linear-gradient(top, #eee 1%, #fff 15%);
 | 
			
		||||
    background-image: -moz-linear-gradient(top, #eee 1%, #fff 15%);
 | 
			
		||||
    background-image: linear-gradient(to bottom, #eee 1%, #fff 15%);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html[dir="rtl"] .select2-container-multi .select2-choices {
 | 
			
		||||
    padding: 0 0 0 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-locked {
 | 
			
		||||
  padding: 3px 5px 3px 5px !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container-multi .select2-choices {
 | 
			
		||||
    min-height: 26px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container-multi.select2-container-active .select2-choices {
 | 
			
		||||
    border: 1px solid #5897fb;
 | 
			
		||||
    outline: none;
 | 
			
		||||
 | 
			
		||||
    -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
 | 
			
		||||
            box-shadow: 0 0 5px rgba(0, 0, 0, .3);
 | 
			
		||||
}
 | 
			
		||||
.select2-container-multi .select2-choices li {
 | 
			
		||||
    float: left;
 | 
			
		||||
    list-style: none;
 | 
			
		||||
}
 | 
			
		||||
html[dir="rtl"] .select2-container-multi .select2-choices li
 | 
			
		||||
{
 | 
			
		||||
    float: right;
 | 
			
		||||
}
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-field {
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
    white-space: nowrap;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-field input {
 | 
			
		||||
    padding: 5px;
 | 
			
		||||
    margin: 1px 0;
 | 
			
		||||
 | 
			
		||||
    font-family: sans-serif;
 | 
			
		||||
    font-size: 100%;
 | 
			
		||||
    color: #666;
 | 
			
		||||
    outline: 0;
 | 
			
		||||
    border: 0;
 | 
			
		||||
    -webkit-box-shadow: none;
 | 
			
		||||
            box-shadow: none;
 | 
			
		||||
    background: transparent !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
 | 
			
		||||
    background: #fff url('select2-spinner.gif') no-repeat 100% !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-default {
 | 
			
		||||
    color: #999 !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-choice {
 | 
			
		||||
    padding: 3px 5px 3px 18px;
 | 
			
		||||
    margin: 3px 0 3px 5px;
 | 
			
		||||
    position: relative;
 | 
			
		||||
 | 
			
		||||
    line-height: 13px;
 | 
			
		||||
    color: #333;
 | 
			
		||||
    cursor: default;
 | 
			
		||||
    border: 1px solid #aaaaaa;
 | 
			
		||||
 | 
			
		||||
    border-radius: 3px;
 | 
			
		||||
 | 
			
		||||
    -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
 | 
			
		||||
            box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
 | 
			
		||||
 | 
			
		||||
    background-clip: padding-box;
 | 
			
		||||
 | 
			
		||||
    -webkit-touch-callout: none;
 | 
			
		||||
      -webkit-user-select: none;
 | 
			
		||||
         -moz-user-select: none;
 | 
			
		||||
          -ms-user-select: none;
 | 
			
		||||
              user-select: none;
 | 
			
		||||
 | 
			
		||||
    background-color: #e4e4e4;
 | 
			
		||||
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0);
 | 
			
		||||
    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee));
 | 
			
		||||
    background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
 | 
			
		||||
    background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
 | 
			
		||||
    background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
 | 
			
		||||
}
 | 
			
		||||
html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice
 | 
			
		||||
{
 | 
			
		||||
    margin: 3px 5px 3px 0;
 | 
			
		||||
    padding: 3px 18px 3px 5px;
 | 
			
		||||
}
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
 | 
			
		||||
    cursor: default;
 | 
			
		||||
}
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-choice-focus {
 | 
			
		||||
    background: #d4d4d4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-search-choice-close {
 | 
			
		||||
    display: block;
 | 
			
		||||
    width: 12px;
 | 
			
		||||
    height: 13px;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    right: 3px;
 | 
			
		||||
    top: 4px;
 | 
			
		||||
 | 
			
		||||
    font-size: 1px;
 | 
			
		||||
    outline: none;
 | 
			
		||||
    background: url('select2.png') right top no-repeat;
 | 
			
		||||
}
 | 
			
		||||
html[dir="rtl"] .select2-search-choice-close {
 | 
			
		||||
    right: auto;
 | 
			
		||||
    left: 3px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container-multi .select2-search-choice-close {
 | 
			
		||||
    left: 3px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
 | 
			
		||||
    left: auto;
 | 
			
		||||
    right: 2px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
 | 
			
		||||
  background-position: right -11px;
 | 
			
		||||
}
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close {
 | 
			
		||||
    background-position: right -11px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* disabled styles */
 | 
			
		||||
.select2-container-multi.select2-container-disabled .select2-choices {
 | 
			
		||||
    background-color: #f4f4f4;
 | 
			
		||||
    background-image: none;
 | 
			
		||||
    border: 1px solid #ddd;
 | 
			
		||||
    cursor: default;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice {
 | 
			
		||||
    padding: 3px 5px 3px 5px;
 | 
			
		||||
    border: 1px solid #ddd;
 | 
			
		||||
    background-image: none;
 | 
			
		||||
    background-color: #f4f4f4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close {    display: none;
 | 
			
		||||
    background: none;
 | 
			
		||||
}
 | 
			
		||||
/* end multiselect */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.select2-result-selectable .select2-match,
 | 
			
		||||
.select2-result-unselectable .select2-match {
 | 
			
		||||
    text-decoration: underline;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-offscreen, .select2-offscreen:focus {
 | 
			
		||||
    clip: rect(0 0 0 0) !important;
 | 
			
		||||
    width: 1px !important;
 | 
			
		||||
    height: 1px !important;
 | 
			
		||||
    border: 0 !important;
 | 
			
		||||
    margin: 0 !important;
 | 
			
		||||
    padding: 0 !important;
 | 
			
		||||
    overflow: hidden !important;
 | 
			
		||||
    position: absolute !important;
 | 
			
		||||
    outline: 0 !important;
 | 
			
		||||
    left: 0px !important;
 | 
			
		||||
    top: 0px !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-display-none {
 | 
			
		||||
    display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-measure-scrollbar {
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    top: -10000px;
 | 
			
		||||
    left: -10000px;
 | 
			
		||||
    width: 100px;
 | 
			
		||||
    height: 100px;
 | 
			
		||||
    overflow: scroll;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Retina-ize icons */
 | 
			
		||||
 | 
			
		||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 2dppx)  {
 | 
			
		||||
    .select2-search input,
 | 
			
		||||
    .select2-search-choice-close,
 | 
			
		||||
    .select2-container .select2-choice abbr,
 | 
			
		||||
    .select2-container .select2-choice .select2-arrow b {
 | 
			
		||||
        background-image: url('select2x2.png') !important;
 | 
			
		||||
        background-repeat: no-repeat !important;
 | 
			
		||||
        background-size: 60px 40px !important;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .select2-search input {
 | 
			
		||||
        background-position: 100% -21px !important;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3508
									
								
								static/cms/js/select2/select2.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								static/cms/js/select2/select2.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 613 B  | 
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_ar.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Arabic translation.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Adel KEDJOUR <adel@kedjour.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['ar'] = {
 | 
			
		||||
        formatNoMatches: function () { return "لم يتم العثور على مطابقات"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; if (n == 1){ return "الرجاء إدخال حرف واحد على الأكثر"; } return n == 2 ? "الرجاء إدخال حرفين على الأكثر" : "الرجاء إدخال " + n + " على الأكثر"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; if (n == 1){ return "الرجاء إدخال حرف واحد على الأقل"; } return n == 2 ? "الرجاء إدخال حرفين على الأقل" : "الرجاء إدخال " + n + " على الأقل "; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { if (n == 1){ return "يمكنك أن تختار إختيار واحد فقط"; } return n == 2 ? "يمكنك أن تختار إختيارين فقط" : "يمكنك أن تختار " + n + " إختيارات فقط"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "تحميل المزيد من النتائج…"; },
 | 
			
		||||
        formatSearching: function () { return "البحث…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['ar']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										20
									
								
								static/cms/js/select2/select2_locale_az.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Azerbaijani translation.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Farhad Safarov <farhad.safarov@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
     $.fn.select2.locales['az'] = {
 | 
			
		||||
        formatMatches: function (matches) { return matches + " nəticə mövcuddur, hərəkət etdirmək üçün yuxarı və aşağı düymələrindən istifadə edin."; },
 | 
			
		||||
        formatNoMatches: function () { return "Nəticə tapılmadı"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return n + " simvol daxil edin"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return n + " simvol silin"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Sadəcə " + limit + " element seçə bilərsiniz"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Daha çox nəticə yüklənir…"; },
 | 
			
		||||
        formatSearching: function () { return "Axtarılır…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['az']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										20
									
								
								static/cms/js/select2/select2_locale_bg.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Bulgarian translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * @author  Lubomir Vikev <lubomirvikev@gmail.com>
 | 
			
		||||
 * @author  Uriy Efremochkin <efremochkin@uriy.me>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['bg'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Няма намерени съвпадения"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Моля въведете още " + n + " символ" + (n > 1 ? "а" : ""); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Моля въведете с " + n + " по-малко символ" + (n > 1 ? "а" : ""); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Можете да направите до " + limit + (limit > 1 ? " избора" : " избор"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Зареждат се още…"; },
 | 
			
		||||
        formatSearching: function () { return "Търсене…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['bg']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_ca.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Catalan translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * Author: David Planella <david.planella@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['ca'] = {
 | 
			
		||||
        formatNoMatches: function () { return "No s'ha trobat cap coincidència"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Introduïu " + n + " caràcter" + (n == 1 ? "" : "s") + " més"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Introduïu " + n + " caràcter" + (n == 1? "" : "s") + "menys"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Només podeu seleccionar " + limit + " element" + (limit == 1 ? "" : "s"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "S'estan carregant més resultats…"; },
 | 
			
		||||
        formatSearching: function () { return "S'està cercant…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['ca']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										51
									
								
								static/cms/js/select2/select2_locale_cs.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Czech translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * Author: Michal Marek <ahoj@michal-marek.cz>
 | 
			
		||||
 * Author - sklonovani: David Vallner <david@vallner.net>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
    // use text for the numbers 2 through 4
 | 
			
		||||
    var smallNumbers = {
 | 
			
		||||
        2: function(masc) { return (masc ? "dva" : "dvě"); },
 | 
			
		||||
        3: function() { return "tři"; },
 | 
			
		||||
        4: function() { return "čtyři"; }
 | 
			
		||||
    }
 | 
			
		||||
    $.fn.select2.locales['cs'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Nenalezeny žádné položky"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) {
 | 
			
		||||
            var n = min - input.length;
 | 
			
		||||
            if (n == 1) {
 | 
			
		||||
                return "Prosím zadejte ještě jeden znak";
 | 
			
		||||
            } else if (n <= 4) {
 | 
			
		||||
                return "Prosím zadejte ještě další "+smallNumbers[n](true)+" znaky";
 | 
			
		||||
            } else {
 | 
			
		||||
                return "Prosím zadejte ještě dalších "+n+" znaků";
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        formatInputTooLong: function (input, max) {
 | 
			
		||||
            var n = input.length - max;
 | 
			
		||||
            if (n == 1) {
 | 
			
		||||
                return "Prosím zadejte o jeden znak méně";
 | 
			
		||||
            } else if (n <= 4) {
 | 
			
		||||
                return "Prosím zadejte o "+smallNumbers[n](true)+" znaky méně";
 | 
			
		||||
            } else {
 | 
			
		||||
                return "Prosím zadejte o "+n+" znaků méně";
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        formatSelectionTooBig: function (limit) {
 | 
			
		||||
            if (limit == 1) {
 | 
			
		||||
                return "Můžete zvolit jen jednu položku";
 | 
			
		||||
            } else if (limit <= 4) {
 | 
			
		||||
                return "Můžete zvolit maximálně "+smallNumbers[limit](false)+" položky";
 | 
			
		||||
            } else {
 | 
			
		||||
                return "Můžete zvolit maximálně "+limit+" položek";
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Načítají se další výsledky…"; },
 | 
			
		||||
        formatSearching: function () { return "Vyhledávání…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
	$.extend($.fn.select2.defaults, $.fn.select2.locales['cs']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_da.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Danish translation.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Anders Jenbo <anders@jenbo.dk>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['da'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Ingen resultater fundet"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Angiv venligst " + n + " tegn mere"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Angiv venligst " + n + " tegn mindre"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Du kan kun vælge " + limit + " emne" + (limit === 1 ? "" : "r"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Indlæser flere resultater…"; },
 | 
			
		||||
        formatSearching: function () { return "Søger…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['da']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										18
									
								
								static/cms/js/select2/select2_locale_de.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 German translation
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['de'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Keine Übereinstimmungen gefunden"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Bitte " + n + " Zeichen mehr eingeben"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Bitte " + n + " Zeichen weniger eingeben"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Sie können nur " + limit + " Eintr" + (limit === 1 ? "ag" : "äge") + " auswählen"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Lade mehr Ergebnisse…"; },
 | 
			
		||||
        formatSearching: function () { return "Suche…"; },
 | 
			
		||||
        formatMatches: function (matches) { return matches + " Ergebnis " + (matches > 1 ? "se" : "") + " verfügbar, zum Navigieren die Hoch-/Runter-Pfeiltasten verwenden."; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['de']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_el.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Greek translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * @author  Uriy Efremochkin <efremochkin@uriy.me>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['el'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Δεν βρέθηκαν αποτελέσματα"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Παρακαλούμε εισάγετε " + n + " περισσότερο" + (n > 1 ? "υς" : "") + " χαρακτήρ" + (n > 1 ? "ες" : "α"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Παρακαλούμε διαγράψτε " + n + " χαρακτήρ" + (n > 1 ? "ες" : "α"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Μπορείτε να επιλέξετε μόνο " + limit + " αντικείμεν" + (limit > 1 ? "α" : "ο"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Φόρτωση περισσότερων…"; },
 | 
			
		||||
        formatSearching: function () { return "Αναζήτηση…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['el']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										20
									
								
								static/cms/js/select2/select2_locale_en.js.template
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 <Language> translation.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Your Name <your@email>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['en'] = {
 | 
			
		||||
        formatMatches: function (matches) { if (matches === 1) { return "One result is available, press enter to select it."; } return matches + " results are available, use up and down arrow keys to navigate."; },
 | 
			
		||||
        formatNoMatches: function () { return "No matches found"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1 ? "" : "s"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1 ? "" : "s"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Loading more results…"; },
 | 
			
		||||
        formatSearching: function () { return "Searching…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['en']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										17
									
								
								static/cms/js/select2/select2_locale_es.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Spanish translation
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['es'] = {
 | 
			
		||||
        formatNoMatches: function () { return "No se encontraron resultados"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Por favor, introduzca " + n + " car" + (n == 1? "ácter" : "acteres"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Por favor, elimine " + n + " car" + (n == 1? "ácter" : "acteres"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Sólo puede seleccionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Cargando más resultados…"; },
 | 
			
		||||
        formatSearching: function () { return "Buscando…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['es']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_et.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Estonian translation.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Kuldar Kalvik <kuldar@kalvik.ee>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['et'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Tulemused puuduvad"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Sisesta " + n + " täht" + (n == 1 ? "" : "e") + " rohkem"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Sisesta " + n + " täht" + (n == 1? "" : "e") + " vähem"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Saad vaid " + limit + " tulemus" + (limit == 1 ? "e" : "t") + " valida"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Laen tulemusi.."; },
 | 
			
		||||
        formatSearching: function () { return "Otsin.."; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['et']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										45
									
								
								static/cms/js/select2/select2_locale_eu.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Basque translation.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Julen Ruiz Aizpuru <julenx at gmail dot com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['eu'] = {
 | 
			
		||||
        formatNoMatches: function () {
 | 
			
		||||
          return "Ez da bat datorrenik aurkitu";
 | 
			
		||||
        },
 | 
			
		||||
        formatInputTooShort: function (input, min) {
 | 
			
		||||
          var n = min - input.length;
 | 
			
		||||
          if (n === 1) {
 | 
			
		||||
            return "Idatzi karaktere bat gehiago";
 | 
			
		||||
          } else {
 | 
			
		||||
            return "Idatzi " + n + " karaktere gehiago";
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        formatInputTooLong: function (input, max) {
 | 
			
		||||
          var n = input.length - max;
 | 
			
		||||
          if (n === 1) {
 | 
			
		||||
            return "Idatzi karaktere bat gutxiago";
 | 
			
		||||
          } else {
 | 
			
		||||
            return "Idatzi " + n + " karaktere gutxiago";
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        formatSelectionTooBig: function (limit) {
 | 
			
		||||
          if (limit === 1 ) {
 | 
			
		||||
            return "Elementu bakarra hauta dezakezu";
 | 
			
		||||
          } else {
 | 
			
		||||
            return limit + " elementu hauta ditzakezu soilik";
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        formatLoadMore: function (pageNumber) {
 | 
			
		||||
          return "Emaitza gehiago kargatzen…";
 | 
			
		||||
        },
 | 
			
		||||
        formatSearching: function () {
 | 
			
		||||
          return "Bilatzen…";
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['eu']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										21
									
								
								static/cms/js/select2/select2_locale_fa.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Persian translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * Author: Ali Choopan <choopan@arsh.co>
 | 
			
		||||
 * Author: Ebrahim Byagowi <ebrahim@gnu.org>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['fa'] = {
 | 
			
		||||
        formatMatches: function (matches) { return matches + " نتیجه موجود است، کلیدهای جهت بالا و پایین را برای گشتن استفاده کنید."; },
 | 
			
		||||
        formatNoMatches: function () { return "نتیجهای یافت نشد."; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "لطفاً " + n + " نویسه بیشتر وارد نمایید"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "لطفاً " + n + " نویسه را حذف کنید."; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "شما فقط میتوانید " + limit + " مورد را انتخاب کنید"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "در حال بارگیری موارد بیشتر…"; },
 | 
			
		||||
        formatSearching: function () { return "در حال جستجو…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['fa']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										30
									
								
								static/cms/js/select2/select2_locale_fi.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Finnish translation
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
    $.fn.select2.locales['fi'] = {
 | 
			
		||||
        formatNoMatches: function () {
 | 
			
		||||
            return "Ei tuloksia";
 | 
			
		||||
        },
 | 
			
		||||
        formatInputTooShort: function (input, min) {
 | 
			
		||||
            var n = min - input.length;
 | 
			
		||||
            return "Ole hyvä ja anna " + n + " merkkiä lisää";
 | 
			
		||||
        },
 | 
			
		||||
        formatInputTooLong: function (input, max) {
 | 
			
		||||
            var n = input.length - max;
 | 
			
		||||
            return "Ole hyvä ja anna " + n + " merkkiä vähemmän";
 | 
			
		||||
        },
 | 
			
		||||
        formatSelectionTooBig: function (limit) {
 | 
			
		||||
            return "Voit valita ainoastaan " + limit + " kpl";
 | 
			
		||||
        },
 | 
			
		||||
        formatLoadMore: function (pageNumber) {
 | 
			
		||||
            return "Ladataan lisää tuloksia…";
 | 
			
		||||
        },
 | 
			
		||||
        formatSearching: function () {
 | 
			
		||||
            return "Etsitään…";
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['fi']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										18
									
								
								static/cms/js/select2/select2_locale_fr.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 French translation
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['fr'] = {
 | 
			
		||||
        formatMatches: function (matches) { return matches + " résultats sont disponibles, utilisez les flèches haut et bas pour naviguer."; },
 | 
			
		||||
        formatNoMatches: function () { return "Aucun résultat trouvé"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Saisissez " + n + " caractère" + (n == 1? "" : "s") + " supplémentaire" + (n == 1? "" : "s") ; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Supprimez " + n + " caractère" + (n == 1? "" : "s"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Vous pouvez seulement sélectionner " + limit + " élément" + (limit == 1 ? "" : "s"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Chargement de résultats supplémentaires…"; },
 | 
			
		||||
        formatSearching: function () { return "Recherche en cours…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['fr']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										45
									
								
								static/cms/js/select2/select2_locale_gl.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Galician translation
 | 
			
		||||
 * 
 | 
			
		||||
 * Author: Leandro Regueiro <leandro.regueiro@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['gl'] = {
 | 
			
		||||
        formatNoMatches: function () {
 | 
			
		||||
            return "Non se atoparon resultados";
 | 
			
		||||
        },
 | 
			
		||||
        formatInputTooShort: function (input, min) {
 | 
			
		||||
            var n = min - input.length;
 | 
			
		||||
            if (n === 1) {
 | 
			
		||||
                return "Engada un carácter";
 | 
			
		||||
            } else {
 | 
			
		||||
                return "Engada " + n + " caracteres";
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        formatInputTooLong: function (input, max) {
 | 
			
		||||
            var n = input.length - max;
 | 
			
		||||
            if (n === 1) {
 | 
			
		||||
                return "Elimine un carácter";
 | 
			
		||||
            } else {
 | 
			
		||||
                return "Elimine " + n + " caracteres";
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        formatSelectionTooBig: function (limit) {
 | 
			
		||||
            if (limit === 1 ) {
 | 
			
		||||
                return "Só pode seleccionar un elemento";
 | 
			
		||||
            } else {
 | 
			
		||||
                return "Só pode seleccionar " + limit + " elementos";
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        formatLoadMore: function (pageNumber) {
 | 
			
		||||
            return "Cargando máis resultados…";
 | 
			
		||||
        },
 | 
			
		||||
        formatSearching: function () {
 | 
			
		||||
            return "Buscando…";
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['gl']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_he.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
* Select2 Hebrew translation.
 | 
			
		||||
*
 | 
			
		||||
* Author: Yakir Sitbon <http://www.yakirs.net/>
 | 
			
		||||
*/
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['he'] = {
 | 
			
		||||
        formatNoMatches: function () { return "לא נמצאו התאמות"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "נא להזין עוד " + n + " תווים נוספים"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "נא להזין פחות " + n + " תווים"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "ניתן לבחור " + limit + " פריטים"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "טוען תוצאות נוספות…"; },
 | 
			
		||||
        formatSearching: function () { return "מחפש…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['he']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										24
									
								
								static/cms/js/select2/select2_locale_hr.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Croatian translation.
 | 
			
		||||
 *
 | 
			
		||||
 * @author  Edi Modrić <edi.modric@gmail.com>
 | 
			
		||||
 * @author  Uriy Efremochkin <efremochkin@uriy.me>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['hr'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Nema rezultata"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { return "Unesite još" + character(min - input.length); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { return "Unesite" + character(input.length - max) + " manje"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Maksimalan broj odabranih stavki je " + limit; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Učitavanje rezultata…"; },
 | 
			
		||||
        formatSearching: function () { return "Pretraga…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['hr']);
 | 
			
		||||
 | 
			
		||||
    function character (n) {
 | 
			
		||||
        return " " + n + " znak" + (n%10 < 5 && n%10 > 0 && (n%100 < 5 || n%100 > 19) ? n%10 > 1 ? "a" : "" : "ova");
 | 
			
		||||
    }
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										17
									
								
								static/cms/js/select2/select2_locale_hu.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Hungarian translation
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['hu'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Nincs találat."; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Túl rövid. Még " + n + " karakter hiányzik."; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Túl hosszú. " + n + " karakterrel több, mint kellene."; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Csak " + limit + " elemet lehet kiválasztani."; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Töltés…"; },
 | 
			
		||||
        formatSearching: function () { return "Keresés…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['hu']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_id.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Indonesian translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * Author: Ibrahim Yusuf <ibrahim7usuf@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['id'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Tidak ada data yang sesuai"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Masukkan " + n + " huruf lagi" + (n == 1 ? "" : "s"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Hapus " + n + " huruf" + (n == 1 ? "" : "s"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Anda hanya dapat memilih " + limit + " pilihan" + (limit == 1 ? "" : "s"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Mengambil data…"; },
 | 
			
		||||
        formatSearching: function () { return "Mencari…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['id']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										17
									
								
								static/cms/js/select2/select2_locale_is.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Icelandic translation.
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['is'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Ekkert fannst"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Vinsamlegast skrifið " + n + " staf" + (n > 1 ? "i" : "") + " í viðbót"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Vinsamlegast styttið texta um " + n + " staf" + (n > 1 ? "i" : ""); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Þú getur aðeins valið " + limit + " atriði"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Sæki fleiri niðurstöður…"; },
 | 
			
		||||
        formatSearching: function () { return "Leita…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['is']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										17
									
								
								static/cms/js/select2/select2_locale_it.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Italian translation
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['it'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Nessuna corrispondenza trovata"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Inserisci ancora " + n + " caratter" + (n == 1? "e" : "i"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Inserisci " + n + " caratter" + (n == 1? "e" : "i") + " in meno"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Puoi selezionare solo " + limit + " element" + (limit == 1 ? "o" : "i"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Caricamento in corso…"; },
 | 
			
		||||
        formatSearching: function () { return "Ricerca…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['it']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										17
									
								
								static/cms/js/select2/select2_locale_ja.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Japanese translation.
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['ja'] = {
 | 
			
		||||
        formatNoMatches: function () { return "該当なし"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "後" + n + "文字入れてください"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "検索文字列が" + n + "文字長すぎます"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "最多で" + limit + "項目までしか選択できません"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "読込中・・・"; },
 | 
			
		||||
        formatSearching: function () { return "検索中・・・"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['ja']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_ka.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Georgian (Kartuli) translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * Author: Dimitri Kurashvili dimakura@gmail.com
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['ka'] = {
 | 
			
		||||
        formatNoMatches: function () { return "ვერ მოიძებნა"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "გთხოვთ შეიყვანოთ კიდევ " + n + " სიმბოლო"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "გთხოვთ წაშალოთ " + n + " სიმბოლო"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "თქვენ შეგიძლიათ მხოლოდ " + limit + " ჩანაწერის მონიშვნა"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "შედეგის ჩატვირთვა…"; },
 | 
			
		||||
        formatSearching: function () { return "ძებნა…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['ka']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_ko.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Korean translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * @author  Swen Mun <longfinfunnel@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['ko'] = {
 | 
			
		||||
        formatNoMatches: function () { return "결과 없음"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "너무 짧습니다. "+n+"글자 더 입력해주세요."; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "너무 깁니다. "+n+"글자 지워주세요."; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "최대 "+limit+"개까지만 선택하실 수 있습니다."; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "불러오는 중…"; },
 | 
			
		||||
        formatSearching: function () { return "검색 중…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['ko']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										26
									
								
								static/cms/js/select2/select2_locale_lt.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,26 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Lithuanian translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * @author  CRONUS Karmalakas <cronus dot karmalakas at gmail dot com>
 | 
			
		||||
 * @author  Uriy Efremochkin <efremochkin@uriy.me>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['lt'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Atitikmenų nerasta"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { return "Įrašykite dar" + character(min - input.length); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { return "Pašalinkite" + character(input.length - max); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) {
 | 
			
		||||
        	return "Jūs galite pasirinkti tik " + limit + " element" + ((limit%100 > 9 && limit%100 < 21) || limit%10 == 0 ? "ų" : limit%10 > 1 ? "us" : "ą");
 | 
			
		||||
        },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Kraunama daugiau rezultatų…"; },
 | 
			
		||||
        formatSearching: function () { return "Ieškoma…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['lt']);
 | 
			
		||||
 | 
			
		||||
    function character (n) {
 | 
			
		||||
        return " " + n + " simbol" + ((n%100 > 9 && n%100 < 21) || n%10 == 0 ? "ių" : n%10 > 1 ? "ius" : "į");
 | 
			
		||||
    }
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_lv.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Latvian translation.
 | 
			
		||||
 *
 | 
			
		||||
 * @author  Uriy Efremochkin <efremochkin@uriy.me>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['lv'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Sakritību nav"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Lūdzu ievadiet vēl " + n + " simbol" + (n == 11 ? "us" : n%10 == 1 ? "u" : "us"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Lūdzu ievadiet par " + n + " simbol" + (n == 11 ? "iem" : n%10 == 1 ? "u" : "iem") + " mazāk"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Jūs varat izvēlēties ne vairāk kā " + limit + " element" + (limit == 11 ? "us" : limit%10 == 1 ? "u" : "us"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Datu ielāde…"; },
 | 
			
		||||
        formatSearching: function () { return "Meklēšana…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['lv']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_mk.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Macedonian translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * Author: Marko Aleksic <psybaron@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['mk'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Нема пронајдено совпаѓања"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Ве молиме внесете уште " + n + " карактер" + (n == 1 ? "" : "и"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Ве молиме внесете " + n + " помалку карактер" + (n == 1? "" : "и"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Можете да изберете само " + limit + " ставк" + (limit == 1 ? "а" : "и"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Вчитување резултати…"; },
 | 
			
		||||
        formatSearching: function () { return "Пребарување…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['mk']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_ms.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Malay translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * Author: Kepoweran <kepoweran@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['ms'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Tiada padanan yang ditemui"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Sila masukkan " + n + " aksara lagi"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Sila hapuskan " + n + " aksara"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Anda hanya boleh memilih " + limit + " pilihan"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Sedang memuatkan keputusan…"; },
 | 
			
		||||
        formatSearching: function () { return "Mencari…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['ms']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										17
									
								
								static/cms/js/select2/select2_locale_nl.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Dutch translation
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['nl'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Geen resultaten gevonden"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Vul nog " + n + " karakter" + (n == 1? "" : "s") + " in"; },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Haal " + n + " karakter" + (n == 1? "" : "s") + " weg"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Maximaal " + limit + " item" + (limit == 1 ? "" : "s") + " toegestaan"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Meer resultaten laden…"; },
 | 
			
		||||
        formatSearching: function () { return "Zoeken…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['nl']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										20
									
								
								static/cms/js/select2/select2_locale_no.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Norwegian translation.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Torgeir Veimo <torgeir.veimo@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['no'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Ingen treff"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Vennligst skriv inn " + n + (n>1 ? " flere tegn" : " tegn til"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Vennligst fjern " + n + " tegn"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Du kan velge maks " + limit + " elementer"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Laster flere resultater…"; },
 | 
			
		||||
        formatSearching: function () { return "Søker…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['no']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										25
									
								
								static/cms/js/select2/select2_locale_pl.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Polish translation.
 | 
			
		||||
 * 
 | 
			
		||||
 * @author  Jan Kondratowicz <jan@kondratowicz.pl>
 | 
			
		||||
 * @author  Uriy Efremochkin <efremochkin@uriy.me>
 | 
			
		||||
 * @author  Michał Połtyn <mike@poltyn.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['pl'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Brak wyników"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { return "Wpisz co najmniej" + character(min - input.length, "znak", "i"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { return "Wpisana fraza jest za długa o" + character(input.length - max, "znak", "i"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Możesz zaznaczyć najwyżej" + character(limit, "element", "y"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Ładowanie wyników…"; },
 | 
			
		||||
        formatSearching: function () { return "Szukanie…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['pl']);
 | 
			
		||||
 | 
			
		||||
    function character (n, word, pluralSuffix) {
 | 
			
		||||
        return " " + n + " " + word + (n == 1 ? "" : n%10 < 5 && n%10 > 1 && (n%100 < 5 || n%100 > 20) ? pluralSuffix : "ów");
 | 
			
		||||
    }
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										17
									
								
								static/cms/js/select2/select2_locale_pt-BR.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Brazilian Portuguese translation
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['pt-BR'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Nenhum resultado encontrado"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Digite mais " + n + " caracter" + (n == 1? "" : "es"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + " caracter" + (n == 1? "" : "es"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Só é possível selecionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Carregando mais resultados…"; },
 | 
			
		||||
        formatSearching: function () { return "Buscando…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['pt-BR']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										17
									
								
								static/cms/js/select2/select2_locale_pt-PT.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Portuguese (Portugal) translation
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['pt-PT'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Nenhum resultado encontrado"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Introduza " + n + " car" + (n == 1 ? "ácter" : "acteres"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + " car" + (n == 1 ? "ácter" : "acteres"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Só é possível selecionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "A carregar mais resultados…"; },
 | 
			
		||||
        formatSearching: function () { return "A pesquisar…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['pt-PT']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										17
									
								
								static/cms/js/select2/select2_locale_ro.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Romanian translation.
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['ro'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Nu a fost găsit nimic"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Vă rugăm să introduceți incă " + n + " caracter" + (n == 1 ? "" : "e"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Vă rugăm să introduceți mai puțin de " + n + " caracter" + (n == 1? "" : "e"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Aveți voie să selectați cel mult " + limit + " element" + (limit == 1 ? "" : "e"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Se încarcă…"; },
 | 
			
		||||
        formatSearching: function () { return "Căutare…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['ro']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_rs.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Serbian translation.
 | 
			
		||||
 *
 | 
			
		||||
 * @author  Limon Monte <limon.monte@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['rs'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Ništa nije pronađeno"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Ukucajte bar još " + n + " simbol" + (n % 10 == 1 && n % 100 != 11 ? "" : "a"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Obrišite " + n + " simbol" + (n % 10 == 1 && n % 100 != 11	 ? "" : "a"); },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Možete izabrati samo " + limit + " stavk" + (limit % 10 == 1 && limit % 100 != 11	 ? "u" : (limit % 10 >= 2 && limit % 10 <= 4 && (limit % 100 < 12 || limit % 100 > 14)? "e" : "i")); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Preuzimanje još rezultata…"; },
 | 
			
		||||
        formatSearching: function () { return "Pretraga…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['rs']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										23
									
								
								static/cms/js/select2/select2_locale_ru.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Russian translation.
 | 
			
		||||
 *
 | 
			
		||||
 * @author  Uriy Efremochkin <efremochkin@uriy.me>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['ru'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Совпадений не найдено"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { return "Пожалуйста, введите еще хотя бы" + character(min - input.length); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { return "Пожалуйста, введите на" + character(input.length - max) + " меньше"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Вы можете выбрать не более " + limit + " элемент" + (limit%10 == 1 && limit%100 != 11 ? "а" : "ов"); },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Загрузка данных…"; },
 | 
			
		||||
        formatSearching: function () { return "Поиск…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['ru']);
 | 
			
		||||
 | 
			
		||||
    function character (n) {
 | 
			
		||||
        return " " + n + " символ" + (n%10 < 5 && n%10 > 0 && (n%100 < 5 || n%100 > 20) ? n%10 > 1 ? "a" : "" : "ов");
 | 
			
		||||
    }
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										50
									
								
								static/cms/js/select2/select2_locale_sk.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Slovak translation.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: David Vallner <david@vallner.net>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
    // use text for the numbers 2 through 4
 | 
			
		||||
    var smallNumbers = {
 | 
			
		||||
        2: function(masc) { return (masc ? "dva" : "dve"); },
 | 
			
		||||
        3: function() { return "tri"; },
 | 
			
		||||
        4: function() { return "štyri"; }
 | 
			
		||||
    };
 | 
			
		||||
    $.fn.select2.locales['sk'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Nenašli sa žiadne položky"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) {
 | 
			
		||||
            var n = min - input.length;
 | 
			
		||||
            if (n == 1) {
 | 
			
		||||
                return "Prosím, zadajte ešte jeden znak";
 | 
			
		||||
            } else if (n <= 4) {
 | 
			
		||||
                return "Prosím, zadajte ešte ďalšie "+smallNumbers[n](true)+" znaky";
 | 
			
		||||
            } else {
 | 
			
		||||
                return "Prosím, zadajte ešte ďalších "+n+" znakov";
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        formatInputTooLong: function (input, max) {
 | 
			
		||||
            var n = input.length - max;
 | 
			
		||||
            if (n == 1) {
 | 
			
		||||
                return "Prosím, zadajte o jeden znak menej";
 | 
			
		||||
            } else if (n <= 4) {
 | 
			
		||||
                return "Prosím, zadajte o "+smallNumbers[n](true)+" znaky menej";
 | 
			
		||||
            } else {
 | 
			
		||||
                return "Prosím, zadajte o "+n+" znakov menej";
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        formatSelectionTooBig: function (limit) {
 | 
			
		||||
            if (limit == 1) {
 | 
			
		||||
                return "Môžete zvoliť len jednu položku";
 | 
			
		||||
            } else if (limit <= 4) {
 | 
			
		||||
                return "Môžete zvoliť najviac "+smallNumbers[limit](false)+" položky";
 | 
			
		||||
            } else {
 | 
			
		||||
                return "Môžete zvoliť najviac "+limit+" položiek";
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Načítavajú sa ďalšie výsledky…"; },
 | 
			
		||||
        formatSearching: function () { return "Vyhľadávanie…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
	$.extend($.fn.select2.defaults, $.fn.select2.locales['sk']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||
							
								
								
									
										19
									
								
								static/cms/js/select2/select2_locale_sv.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Select2 Swedish translation.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Jens Rantil <jens.rantil@telavox.com>
 | 
			
		||||
 */
 | 
			
		||||
(function ($) {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    $.fn.select2.locales['sv'] = {
 | 
			
		||||
        formatNoMatches: function () { return "Inga träffar"; },
 | 
			
		||||
        formatInputTooShort: function (input, min) { var n = min - input.length; return "Var god skriv in " + n + (n>1 ? " till tecken" : " tecken till"); },
 | 
			
		||||
        formatInputTooLong: function (input, max) { var n = input.length - max; return "Var god sudda ut " + n + " tecken"; },
 | 
			
		||||
        formatSelectionTooBig: function (limit) { return "Du kan max välja " + limit + " element"; },
 | 
			
		||||
        formatLoadMore: function (pageNumber) { return "Laddar fler resultat…"; },
 | 
			
		||||
        formatSearching: function () { return "Söker…"; }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $.extend($.fn.select2.defaults, $.fn.select2.locales['sv']);
 | 
			
		||||
})(jQuery);
 | 
			
		||||