new static files.
Signed-off-by: rscnt <rascnt@gmail.com>
96
static/cms/PIE.htc
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<!--
|
||||
PIE: CSS3 rendering for IE
|
||||
Version 1.0beta5
|
||||
http://css3pie.com
|
||||
Dual-licensed for use under the Apache License Version 2.0 or the General Public License (GPL) Version 2.
|
||||
-->
|
||||
<PUBLIC:COMPONENT lightWeight="true">
|
||||
<!-- saved from url=(0014)about:internet -->
|
||||
<PUBLIC:ATTACH EVENT="oncontentready" FOR="element" ONEVENT="init()" />
|
||||
<PUBLIC:ATTACH EVENT="ondocumentready" FOR="element" ONEVENT="init()" />
|
||||
<PUBLIC:ATTACH EVENT="ondetach" FOR="element" ONEVENT="cleanup()" />
|
||||
|
||||
<script type="text/javascript">
|
||||
var doc = element.document;var f=window.PIE;
|
||||
if(!f){f=window.PIE={Q:"-pie-",nb:"Pie",La:"pie_",Ac:{TD:1,TH:1},cc:{TABLE:1,THEAD:1,TBODY:1,TFOOT:1,TR:1,INPUT:1,TEXTAREA:1,SELECT:1,OPTION:1,IMG:1,HR:1},fc:{A:1,INPUT:1,TEXTAREA:1,SELECT:1,BUTTON:1},Gd:{submit:1,button:1,reset:1},aa:function(){}};try{doc.execCommand("BackgroundImageCache",false,true)}catch(aa){}for(var X=4,Y=doc.createElement("div"),ca=Y.getElementsByTagName("i"),Z;Y.innerHTML="<!--[if gt IE "+ ++X+"]><i></i><![endif]--\>",ca[0];);f.V=X;if(X===6)f.Q=f.Q.replace(/^-/,"");f.Ba=doc.documentMode||
|
||||
f.V;Y.innerHTML='<v:shape adj="1"/>';Z=Y.firstChild;Z.style.behavior="url(#default#VML)";f.zc=typeof Z.adj==="object";(function(){var a,b=0,c={};f.p={Za:function(d){if(!a){a=doc.createDocumentFragment();a.namespaces.add("css3vml","urn:schemas-microsoft-com:vml")}return a.createElement("css3vml:"+d)},Aa:function(d){return d&&d._pieId||(d._pieId="_"+ ++b)},Eb:function(d){var e,g,i,j,h=arguments;e=1;for(g=h.length;e<g;e++){j=h[e];for(i in j)if(j.hasOwnProperty(i))d[i]=j[i]}return d},Rb:function(d,e,
|
||||
g){var i=c[d],j,h;if(i)Object.prototype.toString.call(i)==="[object Array]"?i.push([e,g]):e.call(g,i);else{h=c[d]=[[e,g]];j=new Image;j.onload=function(){i=c[d]={i:j.width,f:j.height};for(var k=0,n=h.length;k<n;k++)h[k][0].call(h[k][1],i);j.onload=null};j.src=d}}}})();f.Na={gc:function(a,b,c,d){function e(){k=i>=90&&i<270?b:0;n=i<180?c:0;l=b-k;q=c-n}function g(){for(;i<0;)i+=360;i%=360}var i=d.ra;d=d.zb;var j,h,k,n,l,q,s,m;if(d){d=d.coords(a,b,c);j=d.x;h=d.y}if(i){i=i.jd();g();e();if(!d){j=k;h=n}d=
|
||||
f.Na.tc(j,h,i,l,q);a=d[0];d=d[1]}else if(d){a=b-j;d=c-h}else{j=h=a=0;d=c}s=a-j;m=d-h;if(i===void 0){i=!s?m<0?90:270:!m?s<0?180:0:-Math.atan2(m,s)/Math.PI*180;g();e()}return{ra:i,xc:j,yc:h,td:a,ud:d,Vd:k,Wd:n,rd:l,sd:q,kd:s,ld:m,rc:f.Na.dc(j,h,a,d)}},tc:function(a,b,c,d,e){if(c===0||c===180)return[d,b];else if(c===90||c===270)return[a,e];else{c=Math.tan(-c*Math.PI/180);a=c*a-b;b=-1/c;d=b*d-e;e=b-c;return[(d-a)/e,(c*d-b*a)/e]}},dc:function(a,b,c,d){a=c-a;b=d-b;return Math.abs(a===0?b:b===0?a:Math.sqrt(a*
|
||||
a+b*b))}};f.ea=function(){this.Gb=[];this.oc={}};f.ea.prototype={ba:function(a){var b=f.p.Aa(a),c=this.oc,d=this.Gb;if(!(b in c)){c[b]=d.length;d.push(a)}},Ha:function(a){a=f.p.Aa(a);var b=this.oc;if(a&&a in b){delete this.Gb[b[a]];delete b[a]}},wa:function(){for(var a=this.Gb,b=a.length;b--;)a[b]&&a[b]()}};f.Oa=new f.ea;f.Oa.Qd=function(){var a=this;if(!a.Rd){setInterval(function(){a.wa()},250);a.Rd=1}};(function(){function a(){f.K.wa();window.detachEvent("onunload",a);window.PIE=null}f.K=new f.ea;
|
||||
window.attachEvent("onunload",a);f.K.sa=function(b,c,d){b.attachEvent(c,d);this.ba(function(){b.detachEvent(c,d)})}})();f.Qa=new f.ea;f.K.sa(window,"onresize",function(){f.Qa.wa()});(function(){function a(){f.mb.wa()}f.mb=new f.ea;f.K.sa(window,"onscroll",a);f.Qa.ba(a)})();(function(){function a(){c=f.kb.md()}function b(){if(c){for(var d=0,e=c.length;d<e;d++)f.attach(c[d]);c=0}}var c;f.K.sa(window,"onbeforeprint",a);f.K.sa(window,"onafterprint",b)})();f.lb=new f.ea;f.K.sa(doc,"onmouseup",function(){f.lb.wa()});
|
||||
f.ge=function(){function a(h){this.Y=h}var b=doc.createElement("length-calc"),c=doc.documentElement,d=b.style,e={},g=["mm","cm","in","pt","pc"],i=g.length,j={};d.position="absolute";d.top=d.left="-9999px";for(c.appendChild(b);i--;){b.style.width="100"+g[i];e[g[i]]=b.offsetWidth/100}c.removeChild(b);b.style.width="1em";a.prototype={Kb:/(px|em|ex|mm|cm|in|pt|pc|%)$/,ic:function(){var h=this.Id;if(h===void 0)h=this.Id=parseFloat(this.Y);return h},yb:function(){var h=this.$d;if(!h)h=this.$d=(h=this.Y.match(this.Kb))&&
|
||||
h[0]||"px";return h},a:function(h,k){var n=this.ic(),l=this.yb();switch(l){case "px":return n;case "%":return n*(typeof k==="function"?k():k)/100;case "em":return n*this.xb(h);case "ex":return n*this.xb(h)/2;default:return n*e[l]}},xb:function(h){var k=h.currentStyle.fontSize,n,l;if(k.indexOf("px")>0)return parseFloat(k);else if(h.tagName in f.cc){l=this;n=h.parentNode;return f.n(k).a(n,function(){return l.xb(n)})}else{h.appendChild(b);k=b.offsetWidth;b.parentNode===h&&h.removeChild(b);return k}}};
|
||||
f.n=function(h){return j[h]||(j[h]=new a(h))};return a}();f.Ja=function(){function a(e){this.X=e}var b=f.n("50%"),c={top:1,center:1,bottom:1},d={left:1,center:1,right:1};a.prototype={zd:function(){if(!this.ac){var e=this.X,g=e.length,i=f.v,j=i.pa,h=f.n("0");j=j.ma;h=["left",h,"top",h];if(g===1){e.push(new i.ob(j,"center"));g++}if(g===2){j&(e[0].k|e[1].k)&&e[0].d in c&&e[1].d in d&&e.push(e.shift());if(e[0].k&j)if(e[0].d==="center")h[1]=b;else h[0]=e[0].d;else if(e[0].W())h[1]=f.n(e[0].d);if(e[1].k&
|
||||
j)if(e[1].d==="center")h[3]=b;else h[2]=e[1].d;else if(e[1].W())h[3]=f.n(e[1].d)}this.ac=h}return this.ac},coords:function(e,g,i){var j=this.zd(),h=j[1].a(e,g);e=j[3].a(e,i);return{x:j[0]==="right"?g-h:h,y:j[2]==="bottom"?i-e:e}}};return a}();f.Ka=function(){function a(b,c){this.i=b;this.f=c}a.prototype={a:function(b,c,d,e,g){var i=this.i,j=this.f,h=c/d;e=e/g;if(i==="contain"){i=e>h?c:d*e;j=e>h?c/e:d}else if(i==="cover"){i=e<h?c:d*e;j=e<h?c/e:d}else if(i==="auto"){j=j==="auto"?g:j.a(b,d);i=j*e}else{i=
|
||||
i.a(b,c);j=j==="auto"?i/e:j.a(b,d)}return{i:i,f:j}}};a.Kc=new a("auto","auto");return a}();f.Ec=function(){function a(b){this.Y=b}a.prototype={Kb:/[a-z]+$/i,yb:function(){return this.ad||(this.ad=this.Y.match(this.Kb)[0].toLowerCase())},jd:function(){var b=this.Vc,c;if(b===undefined){b=this.yb();c=parseFloat(this.Y,10);b=this.Vc=b==="deg"?c:b==="rad"?c/Math.PI*180:b==="grad"?c/400*360:b==="turn"?c*360:0}return b}};return a}();f.Jc=function(){function a(c){this.Y=c}var b={};a.Pd=/\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d+|\d*\.\d+)\s*\)\s*/;
|
||||
a.Fb={aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"000",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9A9A9",darkgreen:"006400",darkkhaki:"BDB76B",darkmagenta:"8B008B",
|
||||
darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"696969",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DCDCDC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"808080",green:"008000",greenyellow:"ADFF2F",honeydew:"F0FFF0",
|
||||
hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgreen:"90EE90",lightgrey:"D3D3D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"0F0",limegreen:"32CD32",linen:"FAF0E6",magenta:"F0F",
|
||||
maroon:"800000",mediumauqamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370D8",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"688E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",
|
||||
palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0C0C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",
|
||||
violet:"EE82EE",wheat:"F5DEB3",white:"FFF",whitesmoke:"F5F5F5",yellow:"FF0",yellowgreen:"9ACD32"};a.prototype={parse:function(){if(!this.Ua){var c=this.Y,d;if(d=c.match(a.Pd)){this.Ua="rgb("+d[1]+","+d[2]+","+d[3]+")";this.Yb=parseFloat(d[4])}else{if((d=c.toLowerCase())in a.Fb)c="#"+a.Fb[d];this.Ua=c;this.Yb=c==="transparent"?0:1}}},T:function(c){this.parse();return this.Ua==="currentColor"?c.currentStyle.color:this.Ua},fa:function(){this.parse();return this.Yb}};f.ha=function(c){return b[c]||(b[c]=
|
||||
new a(c))};return a}();f.v=function(){function a(c){this.$a=c;this.ch=0;this.X=[];this.Ga=0}var b=a.pa={Ia:1,Wb:2,B:4,Lc:8,Xb:16,ma:32,J:64,na:128,oa:256,Ra:512,Tc:1024,URL:2048};a.ob=function(c,d){this.k=c;this.d=d};a.ob.prototype={Ca:function(){return this.k&b.J||this.k&b.na&&this.d==="0"},W:function(){return this.Ca()||this.k&b.Ra}};a.prototype={ce:/\s/,Jd:/^[\+\-]?(\d*\.)?\d+/,url:/^url\(\s*("([^"]*)"|'([^']*)'|([!#$%&*-~]*))\s*\)/i,nc:/^\-?[_a-z][\w-]*/i,Xd:/^("([^"]*)"|'([^']*)')/,Bd:/^#([\da-f]{6}|[\da-f]{3})/i,
|
||||
ae:{px:b.J,em:b.J,ex:b.J,mm:b.J,cm:b.J,"in":b.J,pt:b.J,pc:b.J,deg:b.Ia,rad:b.Ia,grad:b.Ia},fd:{rgb:1,rgba:1,hsl:1,hsla:1},next:function(c){function d(q,s){q=new a.ob(q,s);if(!c){k.X.push(q);k.Ga++}return q}function e(){k.Ga++;return null}var g,i,j,h,k=this;if(this.Ga<this.X.length)return this.X[this.Ga++];for(;this.ce.test(this.$a.charAt(this.ch));)this.ch++;if(this.ch>=this.$a.length)return e();i=this.ch;g=this.$a.substring(this.ch);j=g.charAt(0);switch(j){case "#":if(h=g.match(this.Bd)){this.ch+=
|
||||
h[0].length;return d(b.B,h[0])}break;case '"':case "'":if(h=g.match(this.Xd)){this.ch+=h[0].length;return d(b.Tc,h[2]||h[3]||"")}break;case "/":case ",":this.ch++;return d(b.oa,j);case "u":if(h=g.match(this.url)){this.ch+=h[0].length;return d(b.URL,h[2]||h[3]||h[4]||"")}}if(h=g.match(this.Jd)){j=h[0];this.ch+=j.length;if(g.charAt(j.length)==="%"){this.ch++;return d(b.Ra,j+"%")}if(h=g.substring(j.length).match(this.nc)){j+=h[0];this.ch+=h[0].length;return d(this.ae[h[0].toLowerCase()]||b.Lc,j)}return d(b.na,
|
||||
j)}if(h=g.match(this.nc)){j=h[0];this.ch+=j.length;if(j.toLowerCase()in f.Jc.Fb||j==="currentColor"||j==="transparent")return d(b.B,j);if(g.charAt(j.length)==="("){this.ch++;if(j.toLowerCase()in this.fd){g=function(q){return q&&q.k&b.na};h=function(q){return q&&q.k&(b.na|b.Ra)};var n=function(q,s){return q&&q.d===s},l=function(){return k.next(1)};if((j.charAt(0)==="r"?h(l()):g(l()))&&n(l(),",")&&h(l())&&n(l(),",")&&h(l())&&(j==="rgb"||j==="hsa"||n(l(),",")&&g(l()))&&n(l(),")"))return d(b.B,this.$a.substring(i,
|
||||
this.ch));return e()}return d(b.Xb,j)}return d(b.ma,j)}this.ch++;return d(b.Wb,j)},D:function(){return this.X[this.Ga-- -2]},all:function(){for(;this.next(););return this.X},la:function(c,d){for(var e=[],g,i;g=this.next();){if(c(g)){i=true;this.D();break}e.push(g)}return d&&!i?null:e}};return a}();var da=function(a){this.e=a};da.prototype={Z:0,Nd:function(){var a=this.qb,b;return!a||(b=this.o())&&(a.x!==b.x||a.y!==b.y)},Sd:function(){var a=this.qb,b;return!a||(b=this.o())&&(a.i!==b.i||a.f!==b.f)},
|
||||
hc:function(){var a=this.e,b=a.getBoundingClientRect(),c=f.Ba===9;return{x:b.left,y:b.top,i:c?a.offsetWidth:b.right-b.left,f:c?a.offsetHeight:b.bottom-b.top}},o:function(){return this.Z?this.Va||(this.Va=this.hc()):this.hc()},Ad:function(){return!!this.qb},cb:function(){++this.Z},hb:function(){if(!--this.Z){if(this.Va)this.qb=this.Va;this.Va=null}}};(function(){function a(b){var c=f.p.Aa(b);return function(){if(this.Z){var d=this.$b||(this.$b={});return c in d?d[c]:(d[c]=b.call(this))}else return b.call(this)}}
|
||||
f.C={Z:0,ja:function(b){function c(d){this.e=d;this.Zb=this.ia()}f.p.Eb(c.prototype,f.C,b);c.$c={};return c},j:function(){var b=this.ia(),c=this.constructor.$c;return b?b in c?c[b]:(c[b]=this.ka(b)):null},ia:a(function(){var b=this.e,c=this.constructor,d=b.style;b=b.currentStyle;var e=this.va,g=this.Fa,i=c.Yc||(c.Yc=f.Q+e);c=c.Zc||(c.Zc=f.nb+g.charAt(0).toUpperCase()+g.substring(1));return d[c]||b.getAttribute(i)||d[g]||b.getAttribute(e)}),h:a(function(){return!!this.j()}),G:a(function(){var b=this.ia(),
|
||||
c=b!==this.Zb;this.Zb=b;return c}),ua:a,cb:function(){++this.Z},hb:function(){--this.Z||delete this.$b}}})();f.Sb=f.C.ja({va:f.Q+"background",Fa:f.nb+"Background",cd:{scroll:1,fixed:1,local:1},fb:{"repeat-x":1,"repeat-y":1,repeat:1,"no-repeat":1},sc:{"padding-box":1,"border-box":1,"content-box":1},Od:{top:1,right:1,bottom:1,left:1,center:1},Td:{contain:1,cover:1},eb:{Ma:"backgroundClip",B:"backgroundColor",da:"backgroundImage",Pa:"backgroundOrigin",R:"backgroundPosition",S:"backgroundRepeat",Sa:"backgroundSize"},
|
||||
ka:function(a){function b(v){return v&&v.W()||v.k&k&&v.d in m}function c(v){return v&&(v.W()&&f.n(v.d)||v.d==="auto"&&"auto")}var d=this.e.currentStyle,e,g,i,j=f.v.pa,h=j.oa,k=j.ma,n=j.B,l,q,s=0,m=this.Od,r,p,t={L:[]};if(this.wb()){e=new f.v(a);for(i={};g=e.next();){l=g.k;q=g.d;if(!i.N&&l&j.Xb&&q==="linear-gradient"){r={ca:[],N:q};for(p={};g=e.next();){l=g.k;q=g.d;if(l&j.Wb&&q===")"){p.color&&r.ca.push(p);r.ca.length>1&&f.p.Eb(i,r);break}if(l&n){if(r.ra||r.zb){g=e.D();if(g.k!==h)break;e.next()}p=
|
||||
{color:f.ha(q)};g=e.next();if(g.W())p.db=f.n(g.d);else e.D()}else if(l&j.Ia&&!r.ra&&!p.color&&!r.ca.length)r.ra=new f.Ec(g.d);else if(b(g)&&!r.zb&&!p.color&&!r.ca.length){e.D();r.zb=new f.Ja(e.la(function(v){return!b(v)},false))}else if(l&h&&q===","){if(p.color){r.ca.push(p);p={}}}else break}}else if(!i.N&&l&j.URL){i.Ab=q;i.N="image"}else if(b(g)&&!i.$){e.D();i.$=new f.Ja(e.la(function(v){return!b(v)},false))}else if(l&k)if(q in this.fb&&!i.bb)i.bb=q;else if(q in this.sc&&!i.Wa){i.Wa=q;if((g=e.next())&&
|
||||
g.k&k&&g.d in this.sc)i.ub=g.d;else{i.ub=q;e.D()}}else if(q in this.cd&&!i.bc)i.bc=q;else return null;else if(l&n&&!t.color)t.color=f.ha(q);else if(l&h&&q==="/"&&!i.Xa&&i.$){g=e.next();if(g.k&k&&g.d in this.Td)i.Xa=new f.Ka(g.d);else if(g=c(g)){l=c(e.next());if(!l){l=g;e.D()}i.Xa=new f.Ka(g,l)}else return null}else if(l&h&&q===","&&i.N){i.Hb=a.substring(s,e.ch-1);s=e.ch;t.L.push(i);i={}}else return null}if(i.N){i.Hb=a.substring(s);t.L.push(i)}}else this.Bc(f.Ba<9?function(){var v=this.eb,o=d[v.R+
|
||||
"X"],u=d[v.R+"Y"],x=d[v.da],y=d[v.B];if(y!=="transparent")t.color=f.ha(y);if(x!=="none")t.L=[{N:"image",Ab:(new f.v(x)).next().d,bb:d[v.S],$:new f.Ja((new f.v(o+" "+u)).all())}]}:function(){var v=this.eb,o=/\s*,\s*/,u=d[v.da].split(o),x=d[v.B],y,z,D,G,E,B;if(x!=="transparent")t.color=f.ha(x);if((G=u.length)&&u[0]!=="none"){x=d[v.S].split(o);y=d[v.R].split(o);z=d[v.Pa].split(o);D=d[v.Ma].split(o);v=d[v.Sa].split(o);t.L=[];for(o=0;o<G;o++)if((E=u[o])&&E!=="none"){B=v[o].split(" ");t.L.push({Hb:E+" "+
|
||||
x[o]+" "+y[o]+" / "+v[o]+" "+z[o]+" "+D[o],N:"image",Ab:(new f.v(E)).next().d,bb:x[o],$:new f.Ja((new f.v(y[o])).all()),Wa:z[o],ub:D[o],Xa:new f.Ka(B[0],B[1])})}}});return t.color||t.L[0]?t:null},Bc:function(a){var b=f.Ba>8,c=this.eb,d=this.e.runtimeStyle,e=d[c.da],g=d[c.B],i=d[c.S],j,h,k,n;if(e)d[c.da]="";if(g)d[c.B]="";if(i)d[c.S]="";if(b){j=d[c.Ma];h=d[c.Pa];n=d[c.R];k=d[c.Sa];if(j)d[c.Ma]="";if(h)d[c.Pa]="";if(n)d[c.R]="";if(k)d[c.Sa]=""}a=a.call(this);if(e)d[c.da]=e;if(g)d[c.B]=g;if(i)d[c.S]=
|
||||
i;if(b){if(j)d[c.Ma]=j;if(h)d[c.Pa]=h;if(n)d[c.R]=n;if(k)d[c.Sa]=k}return a},ia:f.C.ua(function(){return this.wb()||this.Bc(function(){var a=this.e.currentStyle,b=this.eb;return a[b.B]+" "+a[b.da]+" "+a[b.S]+" "+a[b.R+"X"]+" "+a[b.R+"Y"]})}),wb:f.C.ua(function(){var a=this.e;return a.style[this.Fa]||a.currentStyle.getAttribute(this.va)}),qc:function(){var a=0;if(f.V<7){a=this.e;a=""+(a.style[f.nb+"PngFix"]||a.currentStyle.getAttribute(f.Q+"png-fix"))==="true"}return a},h:f.C.ua(function(){return(this.wb()||
|
||||
this.qc())&&!!this.j()})});f.Vb=f.C.ja({wc:["Top","Right","Bottom","Left"],Hd:{thin:"1px",medium:"3px",thick:"5px"},ka:function(){var a={},b={},c={},d=false,e=true,g=true,i=true;this.Cc(function(){for(var j=this.e.currentStyle,h=0,k,n,l,q,s,m,r;h<4;h++){l=this.wc[h];r=l.charAt(0).toLowerCase();k=b[r]=j["border"+l+"Style"];n=j["border"+l+"Color"];l=j["border"+l+"Width"];if(h>0){if(k!==q)g=false;if(n!==s)e=false;if(l!==m)i=false}q=k;s=n;m=l;c[r]=f.ha(n);l=a[r]=f.n(b[r]==="none"?"0":this.Hd[l]||l);if(l.a(this.e)>
|
||||
0)d=true}});return d?{I:a,Yd:b,gd:c,de:i,hd:e,Zd:g}:null},ia:f.C.ua(function(){var a=this.e,b=a.currentStyle,c;a.tagName in f.Ac&&a.offsetParent.currentStyle.borderCollapse==="collapse"||this.Cc(function(){c=b.borderWidth+"|"+b.borderStyle+"|"+b.borderColor});return c}),Cc:function(a){var b=this.e.runtimeStyle,c=b.borderWidth,d=b.borderColor;if(c)b.borderWidth="";if(d)b.borderColor="";a=a.call(this);if(c)b.borderWidth=c;if(d)b.borderColor=d;return a}});(function(){f.jb=f.C.ja({va:"border-radius",
|
||||
Fa:"borderRadius",ka:function(b){var c=null,d,e,g,i,j=false;if(b){e=new f.v(b);var h=function(){for(var k=[],n;(g=e.next())&&g.W();){i=f.n(g.d);n=i.ic();if(n<0)return null;if(n>0)j=true;k.push(i)}return k.length>0&&k.length<5?{tl:k[0],tr:k[1]||k[0],br:k[2]||k[0],bl:k[3]||k[1]||k[0]}:null};if(b=h()){if(g){if(g.k&f.v.pa.oa&&g.d==="/")d=h()}else d=b;if(j&&b&&d)c={x:b,y:d}}}return c}});var a=f.n("0");a={tl:a,tr:a,br:a,bl:a};f.jb.Dc={x:a,y:a}})();f.Ub=f.C.ja({va:"border-image",Fa:"borderImage",fb:{stretch:1,
|
||||
round:1,repeat:1,space:1},ka:function(a){var b=null,c,d,e,g,i,j,h=0,k=f.v.pa,n=k.ma,l=k.na,q=k.Ra;if(a){c=new f.v(a);b={};for(var s=function(p){return p&&p.k&k.oa&&p.d==="/"},m=function(p){return p&&p.k&n&&p.d==="fill"},r=function(){g=c.la(function(p){return!(p.k&(l|q))});if(m(c.next())&&!b.fill)b.fill=true;else c.D();if(s(c.next())){h++;i=c.la(function(p){return!p.W()&&!(p.k&n&&p.d==="auto")});if(s(c.next())){h++;j=c.la(function(p){return!p.Ca()})}}else c.D()};a=c.next();){d=a.k;e=a.d;if(d&(l|q)&&
|
||||
!g){c.D();r()}else if(m(a)&&!b.fill){b.fill=true;r()}else if(d&n&&this.fb[e]&&!b.repeat){b.repeat={f:e};if(a=c.next())if(a.k&n&&this.fb[a.d])b.repeat.Ob=a.d;else c.D()}else if(d&k.URL&&!b.src)b.src=e;else return null}if(!b.src||!g||g.length<1||g.length>4||i&&i.length>4||h===1&&i.length<1||j&&j.length>4||h===2&&j.length<1)return null;if(!b.repeat)b.repeat={f:"stretch"};if(!b.repeat.Ob)b.repeat.Ob=b.repeat.f;a=function(p,t){return{t:t(p[0]),r:t(p[1]||p[0]),b:t(p[2]||p[0]),l:t(p[3]||p[1]||p[0])}};b.slice=
|
||||
a(g,function(p){return f.n(p.k&l?p.d+"px":p.d)});if(i&&i[0])b.I=a(i,function(p){return p.W()?f.n(p.d):p.d});if(j&&j[0])b.Da=a(j,function(p){return p.Ca()?f.n(p.d):p.d})}return b}});f.Ic=f.C.ja({va:"box-shadow",Fa:"boxShadow",ka:function(a){var b,c=f.n,d=f.v.pa,e;if(a){e=new f.v(a);b={Da:[],Bb:[]};for(a=function(){for(var g,i,j,h,k,n;g=e.next();){j=g.d;i=g.k;if(i&d.oa&&j===",")break;else if(g.Ca()&&!k){e.D();k=e.la(function(l){return!l.Ca()})}else if(i&d.B&&!h)h=j;else if(i&d.ma&&j==="inset"&&!n)n=
|
||||
true;else return false}g=k&&k.length;if(g>1&&g<5){(n?b.Bb:b.Da).push({ee:c(k[0].d),fe:c(k[1].d),blur:c(k[2]?k[2].d:"0"),Ud:c(k[3]?k[3].d:"0"),color:f.ha(h||"currentColor")});return true}return false};a(););}return b&&(b.Bb.length||b.Da.length)?b:null}});f.Uc=f.C.ja({ia:f.C.ua(function(){var a=this.e.currentStyle;return a.visibility+"|"+a.display}),ka:function(){var a=this.e,b=a.runtimeStyle;a=a.currentStyle;var c=b.visibility,d;b.visibility="";d=a.visibility;b.visibility=c;return{be:d!=="hidden",
|
||||
nd:a.display!=="none"}},h:function(){return false}});f.u={P:function(a){function b(c,d,e,g){this.e=c;this.s=d;this.g=e;this.parent=g}f.p.Eb(b.prototype,f.u,a);return b},Cb:false,O:function(){return false},Ea:f.aa,Lb:function(){this.m();this.h()&&this.U()},ib:function(){this.Cb=true},Mb:function(){this.h()?this.U():this.m()},sb:function(a,b){this.vc(a);for(var c=this.qa||(this.qa=[]),d=a+1,e=c.length,g;d<e;d++)if(g=c[d])break;c[a]=b;this.H().insertBefore(b,g||null)},ya:function(a){var b=this.qa;return b&&
|
||||
b[a]||null},vc:function(a){var b=this.ya(a),c=this.Ta;if(b&&c){c.removeChild(b);this.qa[a]=null}},za:function(a,b,c,d){var e=this.rb||(this.rb={}),g=e[a];if(!g){g=e[a]=f.p.Za("shape");if(b)g.appendChild(g[b]=f.p.Za(b));if(d){c=this.ya(d);if(!c){this.sb(d,doc.createElement("group"+d));c=this.ya(d)}}c.appendChild(g);a=g.style;a.position="absolute";a.left=a.top=0;a.behavior="url(#default#VML)"}return g},vb:function(a){var b=this.rb,c=b&&b[a];if(c){c.parentNode.removeChild(c);delete b[a]}return!!c},kc:function(a){var b=
|
||||
this.e,c=this.s.o(),d=c.i,e=c.f,g,i,j,h,k,n;c=a.x.tl.a(b,d);g=a.y.tl.a(b,e);i=a.x.tr.a(b,d);j=a.y.tr.a(b,e);h=a.x.br.a(b,d);k=a.y.br.a(b,e);n=a.x.bl.a(b,d);a=a.y.bl.a(b,e);d=Math.min(d/(c+i),e/(j+k),d/(n+h),e/(g+a));if(d<1){c*=d;g*=d;i*=d;j*=d;h*=d;k*=d;n*=d;a*=d}return{x:{tl:c,tr:i,br:h,bl:n},y:{tl:g,tr:j,br:k,bl:a}}},xa:function(a,b,c){b=b||1;var d,e,g=this.s.o();e=g.i*b;g=g.f*b;var i=this.g.F,j=Math.floor,h=Math.ceil,k=a?a.Jb*b:0,n=a?a.Ib*b:0,l=a?a.tb*b:0;a=a?a.Db*b:0;var q,s,m,r,p;if(c||i.h()){d=
|
||||
this.kc(c||i.j());c=d.x.tl*b;i=d.y.tl*b;q=d.x.tr*b;s=d.y.tr*b;m=d.x.br*b;r=d.y.br*b;p=d.x.bl*b;b=d.y.bl*b;e="m"+j(a)+","+j(i)+"qy"+j(c)+","+j(k)+"l"+h(e-q)+","+j(k)+"qx"+h(e-n)+","+j(s)+"l"+h(e-n)+","+h(g-r)+"qy"+h(e-m)+","+h(g-l)+"l"+j(p)+","+h(g-l)+"qx"+j(a)+","+h(g-b)+" x e"}else e="m"+j(a)+","+j(k)+"l"+h(e-n)+","+j(k)+"l"+h(e-n)+","+h(g-l)+"l"+j(a)+","+h(g-l)+"xe";return e},H:function(){var a=this.parent.ya(this.M),b;if(!a){a=doc.createElement(this.Ya);b=a.style;b.position="absolute";b.top=b.left=
|
||||
0;this.parent.sb(this.M,a)}return a},mc:function(){var a=this.e,b=a.currentStyle,c=a.runtimeStyle,d=a.tagName,e=f.V===6,g;if(e&&(d in f.cc||d==="FIELDSET")||d==="BUTTON"||d==="INPUT"&&a.type in f.Gd){c.borderWidth="";d=this.g.z.wc;for(g=d.length;g--;){e=d[g];c["padding"+e]="";c["padding"+e]=f.n(b["padding"+e]).a(a)+f.n(b["border"+e+"Width"]).a(a)+(f.V!==8&&g%2?1:0)}c.borderWidth=0}else if(e){if(a.childNodes.length!==1||a.firstChild.tagName!=="ie6-mask"){b=doc.createElement("ie6-mask");d=b.style;d.visibility=
|
||||
"visible";for(d.zoom=1;d=a.firstChild;)b.appendChild(d);a.appendChild(b);c.visibility="hidden"}}else c.borderColor="transparent"},he:function(){},m:function(){this.parent.vc(this.M);delete this.rb;delete this.qa}};f.Rc=f.u.P({h:function(){var a=this.ed;for(var b in a)if(a.hasOwnProperty(b)&&a[b].h())return true;return false},O:function(){return this.g.Pb.G()},ib:function(){if(this.h()){var a=this.jc(),b=a,c;a=a.currentStyle;var d=a.position,e=this.H().style,g=0,i=0;i=this.s.o();if(d==="fixed"&&f.V>
|
||||
6){g=i.x;i=i.y;b=d}else{do b=b.offsetParent;while(b&&b.currentStyle.position==="static");if(b){c=b.getBoundingClientRect();b=b.currentStyle;g=i.x-c.left-(parseFloat(b.borderLeftWidth)||0);i=i.y-c.top-(parseFloat(b.borderTopWidth)||0)}else{b=doc.documentElement;g=i.x+b.scrollLeft-b.clientLeft;i=i.y+b.scrollTop-b.clientTop}b="absolute"}e.position=b;e.left=g;e.top=i;e.zIndex=d==="static"?-1:a.zIndex;this.Cb=true}},Mb:f.aa,Nb:function(){var a=this.g.Pb.j();this.H().style.display=a.be&&a.nd?"":"none"},
|
||||
Lb:function(){this.h()?this.Nb():this.m()},jc:function(){var a=this.e;return a.tagName in f.Ac?a.offsetParent:a},H:function(){var a=this.Ta,b;if(!a){b=this.jc();a=this.Ta=doc.createElement("css3-container");a.style.direction="ltr";this.Nb();b.parentNode.insertBefore(a,b)}return a},ab:f.aa,m:function(){var a=this.Ta,b;if(a&&(b=a.parentNode))b.removeChild(a);delete this.Ta;delete this.qa}});f.Fc=f.u.P({M:2,Ya:"background",O:function(){var a=this.g;return a.w.G()||a.F.G()},h:function(){var a=this.g;
|
||||
return a.q.h()||a.F.h()||a.w.h()||a.ga.h()&&a.ga.j().Bb},U:function(){var a=this.s.o();if(a.i&&a.f){this.od();this.pd()}},od:function(){var a=this.g.w.j(),b=this.s.o(),c=this.e,d=a&&a.color,e,g;if(d&&d.fa()>0){this.lc();a=this.za("bgColor","fill",this.H(),1);e=b.i;b=b.f;a.stroked=false;a.coordsize=e*2+","+b*2;a.coordorigin="1,1";a.path=this.xa(null,2);g=a.style;g.width=e;g.height=b;a.fill.color=d.T(c);c=d.fa();if(c<1)a.fill.opacity=c}else this.vb("bgColor")},pd:function(){var a=this.g.w.j(),b=this.s.o();
|
||||
a=a&&a.L;var c,d,e,g,i;if(a){this.lc();d=b.i;e=b.f;for(i=a.length;i--;){b=a[i];c=this.za("bgImage"+i,"fill",this.H(),2);c.stroked=false;c.fill.type="tile";c.fillcolor="none";c.coordsize=d*2+","+e*2;c.coordorigin="1,1";c.path=this.xa(0,2);g=c.style;g.width=d;g.height=e;if(b.N==="linear-gradient")this.bd(c,b);else{c.fill.src=b.Ab;this.Md(c,i)}}}for(i=a?a.length:0;this.vb("bgImage"+i++););},Md:function(a,b){var c=this;f.p.Rb(a.fill.src,function(d){var e=c.e,g=c.s.o(),i=g.i;g=g.f;if(i&&g){var j=a.fill,
|
||||
h=c.g,k=h.z.j(),n=k&&k.I;k=n?n.t.a(e):0;var l=n?n.r.a(e):0,q=n?n.b.a(e):0;n=n?n.l.a(e):0;h=h.w.j().L[b];e=h.$?h.$.coords(e,i-d.i-n-l,g-d.f-k-q):{x:0,y:0};h=h.bb;q=l=0;var s=i+1,m=g+1,r=f.V===8?0:1;n=Math.round(e.x)+n+0.5;k=Math.round(e.y)+k+0.5;j.position=n/i+","+k/g;if(h&&h!=="repeat"){if(h==="repeat-x"||h==="no-repeat"){l=k+1;m=k+d.f+r}if(h==="repeat-y"||h==="no-repeat"){q=n+1;s=n+d.i+r}a.style.clip="rect("+l+"px,"+s+"px,"+m+"px,"+q+"px)"}}})},bd:function(a,b){var c=this.e,d=this.s.o(),e=d.i,g=
|
||||
d.f;a=a.fill;d=b.ca;var i=d.length,j=Math.PI,h=f.Na,k=h.tc,n=h.dc;b=h.gc(c,e,g,b);h=b.ra;var l=b.xc,q=b.yc,s=b.Vd,m=b.Wd,r=b.rd,p=b.sd,t=b.kd,v=b.ld;b=b.rc;e=h%90?Math.atan2(t*e/g,v)/j*180:h+90;e+=180;e%=360;r=k(s,m,h,r,p);g=n(s,m,r[0],r[1]);j=[];r=k(l,q,h,s,m);n=n(l,q,r[0],r[1])/g*100;k=[];for(h=0;h<i;h++)k.push(d[h].db?d[h].db.a(c,b):h===0?0:h===i-1?b:null);for(h=1;h<i;h++){if(k[h]===null){l=k[h-1];b=h;do q=k[++b];while(q===null);k[h]=l+(q-l)/(b-h+1)}k[h]=Math.max(k[h],k[h-1])}for(h=0;h<i;h++)j.push(n+
|
||||
k[h]/g*100+"% "+d[h].color.T(c));a.angle=e;a.type="gradient";a.method="sigma";a.color=d[0].color.T(c);a.color2=d[i-1].color.T(c);if(a.colors)a.colors.value=j.join(",");else a.colors=j.join(",")},lc:function(){var a=this.e.runtimeStyle;a.backgroundImage="url(about:blank)";a.backgroundColor="transparent"},m:function(){f.u.m.call(this);var a=this.e.runtimeStyle;a.backgroundImage=a.backgroundColor=""}});f.Gc=f.u.P({M:4,Ya:"border",O:function(){var a=this.g;return a.z.G()||a.F.G()},h:function(){var a=
|
||||
this.g;return(a.F.h()||a.w.h())&&!a.q.h()&&a.z.h()},U:function(){var a=this.e,b=this.g.z.j(),c=this.s.o(),d=c.i;c=c.f;var e,g,i,j,h;if(b){this.mc();b=this.wd(2);j=0;for(h=b.length;j<h;j++){i=b[j];e=this.za("borderPiece"+j,i.stroke?"stroke":"fill",this.H());e.coordsize=d*2+","+c*2;e.coordorigin="1,1";e.path=i.path;g=e.style;g.width=d;g.height=c;e.filled=!!i.fill;e.stroked=!!i.stroke;if(i.stroke){e=e.stroke;e.weight=i.Qb+"px";e.color=i.color.T(a);e.dashstyle=i.stroke==="dashed"?"2 2":i.stroke==="dotted"?
|
||||
"1 1":"solid";e.linestyle=i.stroke==="double"&&i.Qb>2?"ThinThin":"Single"}else e.fill.color=i.fill.T(a)}for(;this.vb("borderPiece"+j++););}},wd:function(a){var b=this.e,c,d,e,g=this.g.z,i=[],j,h,k,n,l=Math.round,q,s,m;if(g.h()){c=g.j();g=c.I;s=c.Yd;m=c.gd;if(c.de&&c.Zd&&c.hd){if(m.t.fa()>0){c=g.t.a(b);k=c/2;i.push({path:this.xa({Jb:k,Ib:k,tb:k,Db:k},a),stroke:s.t,color:m.t,Qb:c})}}else{a=a||1;c=this.s.o();d=c.i;e=c.f;c=l(g.t.a(b));k=l(g.r.a(b));n=l(g.b.a(b));b=l(g.l.a(b));var r={t:c,r:k,b:n,l:b};
|
||||
b=this.g.F;if(b.h())q=this.kc(b.j());j=Math.floor;h=Math.ceil;var p=function(o,u){return q?q[o][u]:0},t=function(o,u,x,y,z,D){var G=p("x",o),E=p("y",o),B=o.charAt(1)==="r";o=o.charAt(0)==="b";return G>0&&E>0?(D?"al":"ae")+(B?h(d-G):j(G))*a+","+(o?h(e-E):j(E))*a+","+(j(G)-u)*a+","+(j(E)-x)*a+","+y*65535+","+2949075*(z?1:-1):(D?"m":"l")+(B?d-u:u)*a+","+(o?e-x:x)*a},v=function(o,u,x,y){var z=o==="t"?j(p("x","tl"))*a+","+h(u)*a:o==="r"?h(d-u)*a+","+j(p("y","tr"))*a:o==="b"?h(d-p("x","br"))*a+","+j(e-
|
||||
u)*a:j(u)*a+","+h(e-p("y","bl"))*a;o=o==="t"?h(d-p("x","tr"))*a+","+h(u)*a:o==="r"?h(d-u)*a+","+h(e-p("y","br"))*a:o==="b"?j(p("x","bl"))*a+","+j(e-u)*a:j(u)*a+","+j(p("y","tl"))*a;return x?(y?"m"+o:"")+"l"+z:(y?"m"+z:"")+"l"+o};b=function(o,u,x,y,z,D){var G=o==="l"||o==="r",E=r[o],B,A;if(E>0&&s[o]!=="none"&&m[o].fa()>0){B=r[G?o:u];u=r[G?u:o];A=r[G?o:x];x=r[G?x:o];if(s[o]==="dashed"||s[o]==="dotted"){i.push({path:t(y,B,u,D+45,0,1)+t(y,0,0,D,1,0),fill:m[o]});i.push({path:v(o,E/2,0,1),stroke:s[o],Qb:E,
|
||||
color:m[o]});i.push({path:t(z,A,x,D,0,1)+t(z,0,0,D-45,1,0),fill:m[o]})}else i.push({path:t(y,B,u,D+45,0,1)+v(o,E,0,0)+t(z,A,x,D,0,0)+(s[o]==="double"&&E>2?t(z,A-j(A/3),x-j(x/3),D-45,1,0)+v(o,h(E/3*2),1,0)+t(y,B-j(B/3),u-j(u/3),D,1,0)+"x "+t(y,j(B/3),j(u/3),D+45,0,1)+v(o,j(E/3),1,0)+t(z,j(A/3),j(x/3),D,0,0):"")+t(z,0,0,D-45,1,0)+v(o,0,1,0)+t(y,0,0,D,1,0),fill:m[o]})}};b("t","l","r","tl","tr",90);b("r","t","b","tr","br",0);b("b","r","l","br","bl",-90);b("l","b","t","bl","tl",-180)}}return i},m:function(){if(this.ec||
|
||||
!this.g.q.h())this.e.runtimeStyle.borderColor="";f.u.m.call(this)}});f.Tb=f.u.P({M:5,Ld:["t","tr","r","br","b","bl","l","tl","c"],O:function(){return this.g.q.G()},h:function(){return this.g.q.h()},U:function(){this.H();var a=this.g.q.j(),b=this.g.z.j(),c=this.s.o(),d=this.e,e=this.uc;f.p.Rb(a.src,function(g){function i(v,o,u,x,y){v=e[v].style;var z=Math.max;v.width=z(o,0);v.height=z(u,0);v.left=x;v.top=y}function j(v,o,u){for(var x=0,y=v.length;x<y;x++)e[v[x]].imagedata[o]=u}var h=c.i,k=c.f,n=f.n("0"),
|
||||
l=a.I||(b?b.I:{t:n,r:n,b:n,l:n});n=l.t.a(d);var q=l.r.a(d),s=l.b.a(d);l=l.l.a(d);var m=a.slice,r=m.t.a(d),p=m.r.a(d),t=m.b.a(d);m=m.l.a(d);i("tl",l,n,0,0);i("t",h-l-q,n,l,0);i("tr",q,n,h-q,0);i("r",q,k-n-s,h-q,n);i("br",q,s,h-q,k-s);i("b",h-l-q,s,l,k-s);i("bl",l,s,0,k-s);i("l",l,k-n-s,0,n);i("c",h-l-q,k-n-s,l,n);j(["tl","t","tr"],"cropBottom",(g.f-r)/g.f);j(["tl","l","bl"],"cropRight",(g.i-m)/g.i);j(["bl","b","br"],"cropTop",(g.f-t)/g.f);j(["tr","r","br"],"cropLeft",(g.i-p)/g.i);j(["l","r","c"],"cropTop",
|
||||
r/g.f);j(["l","r","c"],"cropBottom",t/g.f);j(["t","b","c"],"cropLeft",m/g.i);j(["t","b","c"],"cropRight",p/g.i);e.c.style.display=a.fill?"":"none"},this)},H:function(){var a=this.parent.ya(this.M),b,c,d,e=this.Ld,g=e.length;if(!a){a=doc.createElement("border-image");b=a.style;b.position="absolute";this.uc={};for(d=0;d<g;d++){c=this.uc[e[d]]=f.p.Za("rect");c.appendChild(f.p.Za("imagedata"));b=c.style;b.behavior="url(#default#VML)";b.position="absolute";b.top=b.left=0;c.imagedata.src=this.g.q.j().src;
|
||||
c.stroked=false;c.filled=false;a.appendChild(c)}this.parent.sb(this.M,a)}return a},Ea:function(){if(this.h()){var a=this.e,b=a.runtimeStyle,c=this.g.q.j().I;b.borderStyle="solid";if(c){b.borderTopWidth=c.t.a(a)+"px";b.borderRightWidth=c.r.a(a)+"px";b.borderBottomWidth=c.b.a(a)+"px";b.borderLeftWidth=c.l.a(a)+"px"}this.mc()}},m:function(){var a=this.e.runtimeStyle;a.borderStyle="";if(this.ec||!this.g.z.h())a.borderColor=a.borderWidth="";f.u.m.call(this)}});f.Hc=f.u.P({M:1,Ya:"outset-box-shadow",O:function(){var a=
|
||||
this.g;return a.ga.G()||a.F.G()},h:function(){var a=this.g.ga;return a.h()&&a.j().Da[0]},U:function(){function a(B,A,L,N,H,I,F){B=b.za("shadow"+B+A,"fill",d,i-B);A=B.fill;B.coordsize=n*2+","+l*2;B.coordorigin="1,1";B.stroked=false;B.filled=true;A.color=H.T(c);if(I){A.type="gradienttitle";A.color2=A.color;A.opacity=0}B.path=F;p=B.style;p.left=L;p.top=N;p.width=n;p.height=l;return B}var b=this,c=this.e,d=this.H(),e=this.g,g=e.ga.j().Da;e=e.F.j();var i=g.length,j=i,h,k=this.s.o(),n=k.i,l=k.f;k=f.V===
|
||||
8?1:0;for(var q=["tl","tr","br","bl"],s,m,r,p,t,v,o,u,x,y,z,D,G,E;j--;){m=g[j];t=m.ee.a(c);v=m.fe.a(c);h=m.Ud.a(c);o=m.blur.a(c);m=m.color;u=-h-o;if(!e&&o)e=f.jb.Dc;u=this.xa({Jb:u,Ib:u,tb:u,Db:u},2,e);if(o){x=(h+o)*2+n;y=(h+o)*2+l;z=o*2/x;D=o*2/y;if(o-h>n/2||o-h>l/2)for(h=4;h--;){s=q[h];G=s.charAt(0)==="b";E=s.charAt(1)==="r";s=a(j,s,t,v,m,o,u);r=s.fill;r.focusposition=(E?1-z:z)+","+(G?1-D:D);r.focussize="0,0";s.style.clip="rect("+((G?y/2:0)+k)+"px,"+(E?x:x/2)+"px,"+(G?y:y/2)+"px,"+((E?x/2:0)+k)+
|
||||
"px)"}else{s=a(j,"",t,v,m,o,u);r=s.fill;r.focusposition=z+","+D;r.focussize=1-z*2+","+(1-D*2)}}else{s=a(j,"",t,v,m,o,u);t=m.fa();if(t<1)s.fill.opacity=t}}}});f.Pc=f.u.P({M:6,Ya:"imgEl",O:function(){var a=this.g;return this.e.src!==this.Xc||a.F.G()},h:function(){var a=this.g;return a.F.h()||a.w.qc()},U:function(){this.Xc=i;this.Cd();var a=this.za("img","fill",this.H()),b=a.fill,c=this.s.o(),d=c.i;c=c.f;var e=this.g.z.j(),g=e&&e.I;e=this.e;var i=e.src,j=Math.round,h=e.currentStyle,k=f.n;if(!g||f.V<
|
||||
7){g=f.n("0");g={t:g,r:g,b:g,l:g}}a.stroked=false;b.type="frame";b.src=i;b.position=(d?0.5/d:0)+","+(c?0.5/c:0);a.coordsize=d*2+","+c*2;a.coordorigin="1,1";a.path=this.xa({Jb:j(g.t.a(e)+k(h.paddingTop).a(e)),Ib:j(g.r.a(e)+k(h.paddingRight).a(e)),tb:j(g.b.a(e)+k(h.paddingBottom).a(e)),Db:j(g.l.a(e)+k(h.paddingLeft).a(e))},2);a=a.style;a.width=d;a.height=c},Cd:function(){this.e.runtimeStyle.filter="alpha(opacity=0)"},m:function(){f.u.m.call(this);this.e.runtimeStyle.filter=""}});f.Oc=f.u.P({ib:f.aa,
|
||||
Mb:f.aa,Nb:f.aa,Lb:f.aa,Kd:/^,+|,+$/g,Fd:/,+/g,gb:function(a,b){(this.pb||(this.pb=[]))[a]=b||void 0},ab:function(){var a=this.pb,b;if(a&&(b=a.join(",").replace(this.Kd,"").replace(this.Fd,","))!==this.Wc)this.Wc=this.e.runtimeStyle.background=b},m:function(){this.e.runtimeStyle.background="";delete this.pb}});f.Mc=f.u.P({ta:1,O:function(){return this.g.w.G()},h:function(){var a=this.g;return a.w.h()||a.q.h()},U:function(){var a=this.g.w.j(),b,c,d=0,e,g;if(a){b=[];if(c=a.L)for(;e=c[d++];)if(e.N===
|
||||
"linear-gradient"){g=this.vd(e.Wa);g=(e.Xa||f.Ka.Kc).a(this.e,g.i,g.f,g.i,g.f);b.push("url(data:image/svg+xml,"+escape(this.xd(e,g.i,g.f))+") "+this.dd(e.$)+" / "+g.i+"px "+g.f+"px "+(e.bc||"")+" "+(e.Wa||"")+" "+(e.ub||""))}else b.push(e.Hb);a.color&&b.push(a.color.Y);this.parent.gb(this.ta,b.join(","))}},dd:function(a){return a?a.X.map(function(b){return b.d}).join(" "):"0 0"},vd:function(a){var b=this.e,c=this.s.o(),d=c.i;c=c.f;var e;if(a!=="border-box")if((e=this.g.z.j())&&(e=e.I)){d-=e.l.a(b)+
|
||||
e.l.a(b);c-=e.t.a(b)+e.b.a(b)}if(a==="content-box"){a=f.n;e=b.currentStyle;d-=a(e.paddingLeft).a(b)+a(e.paddingRight).a(b);c-=a(e.paddingTop).a(b)+a(e.paddingBottom).a(b)}return{i:d,f:c}},xd:function(a,b,c){var d=this.e,e=a.ca,g=e.length,i=f.Na.gc(d,b,c,a);a=i.xc;var j=i.yc,h=i.td,k=i.ud;i=i.rc;var n,l,q,s,m;n=[];for(l=0;l<g;l++)n.push(e[l].db?e[l].db.a(d,i):l===0?0:l===g-1?i:null);for(l=1;l<g;l++)if(n[l]===null){s=n[l-1];q=l;do m=n[++q];while(m===null);n[l]=s+(m-s)/(q-l+1)}b=['<svg width="'+b+'" height="'+
|
||||
c+'" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="g" gradientUnits="userSpaceOnUse" x1="'+a/b*100+'%" y1="'+j/c*100+'%" x2="'+h/b*100+'%" y2="'+k/c*100+'%">'];for(l=0;l<g;l++)b.push('<stop offset="'+n[l]/i+'" stop-color="'+e[l].color.T(d)+'" stop-opacity="'+e[l].color.fa()+'"/>');b.push('</linearGradient></defs><rect width="100%" height="100%" fill="url(#g)"/></svg>');return b.join("")},m:function(){this.parent.gb(this.ta)}});f.Nc=f.u.P({S:"repeat",Sc:"stretch",Qc:"round",ta:0,O:function(){return this.g.q.G()},
|
||||
h:function(){return this.g.q.h()},U:function(){var a=this,b=a.g.q.j(),c=a.g.z.j(),d=a.s.o(),e=b.repeat,g=e.f,i=e.Ob,j=a.e,h=0;f.p.Rb(b.src,function(k){function n(R,S,U,V,W,T,w,C,K,O){J.push('<pattern patternUnits="userSpaceOnUse" id="pattern'+Q+'" x="'+(g===p?R+U/2-K/2:R)+'" y="'+(i===p?S+V/2-O/2:S)+'" width="'+K+'" height="'+O+'"><svg width="'+K+'" height="'+O+'" viewBox="'+W+" "+T+" "+w+" "+C+'" preserveAspectRatio="none"><image xlink:href="'+r+'" x="0" y="0" width="'+s+'" height="'+m+'" /></svg></pattern>');
|
||||
P.push('<rect x="'+R+'" y="'+S+'" width="'+U+'" height="'+V+'" fill="url(#pattern'+Q+')" />');Q++}var l=d.i,q=d.f,s=k.i,m=k.f,r=a.Dd(b.src,s,m),p=a.S,t=a.Sc;k=a.Qc;var v=Math.ceil,o=f.n("0"),u=b.I||(c?c.I:{t:o,r:o,b:o,l:o});o=u.t.a(j);var x=u.r.a(j),y=u.b.a(j);u=u.l.a(j);var z=b.slice,D=z.t.a(j),G=z.r.a(j),E=z.b.a(j);z=z.l.a(j);var B=l-u-x,A=q-o-y,L=s-z-G,N=m-D-E,H=g===t?B:L*o/D,I=i===t?A:N*x/G,F=g===t?B:L*y/E;t=i===t?A:N*u/z;var J=[],P=[],Q=0;if(g===k){H-=(H-(B%H||H))/v(B/H);F-=(F-(B%F||F))/v(B/
|
||||
F)}if(i===k){I-=(I-(A%I||I))/v(A/I);t-=(t-(A%t||t))/v(A/t)}k=['<svg width="'+l+'" height="'+q+'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">'];n(0,0,u,o,0,0,z,D,u,o);n(u,0,B,o,z,0,L,D,H,o);n(l-x,0,x,o,s-G,0,G,D,x,o);n(0,o,u,A,0,D,z,N,u,t);if(b.fill)n(u,o,B,A,z,D,L,N,H||F||L,t||I||N);n(l-x,o,x,A,s-G,D,G,N,x,I);n(0,q-y,u,y,0,m-E,z,E,u,y);n(u,q-y,B,y,z,m-E,L,E,F,y);n(l-x,q-y,x,y,s-G,m-E,G,E,x,y);k.push("<defs>"+J.join("\n")+"</defs>"+P.join("\n")+"</svg>");a.parent.gb(a.ta,
|
||||
"url(data:image/svg+xml,"+escape(k.join(""))+") no-repeat border-box border-box");h&&a.parent.ab()},a);h=1},Dd:function(){var a={};return function(b,c,d){var e=a[b],g;if(!e){e=new Image;g=doc.createElement("canvas");e.src=b;g.width=c;g.height=d;g.getContext("2d").drawImage(e,0,0);e=a[b]=g.toDataURL()}return e}}(),Ea:f.Tb.prototype.Ea,m:function(){var a=this.e.runtimeStyle;this.parent.gb(this.ta);a.borderColor=a.borderStyle=a.borderWidth=""}});f.kb=function(){function a(m,r){m.className+=" "+r}function b(m){var r=
|
||||
s.slice.call(arguments,1),p=r.length;setTimeout(function(){for(;p--;)a(m,r[p])},0)}function c(m){var r=s.slice.call(arguments,1),p=r.length;setTimeout(function(){for(;p--;){var t=r[p];t=q[t]||(q[t]=new RegExp("\\b"+t+"\\b","g"));m.className=m.className.replace(t,"")}},0)}function d(m){function r(){if(!R){var w,C,K=f.Ba,O=m.currentStyle,M=O.getAttribute(g)==="true";T=O.getAttribute(i);T=K>7?T!=="false":T==="true";if(!Q){Q=1;m.runtimeStyle.zoom=1;O=m;for(var ba=1;O=O.previousSibling;)if(O.nodeType===
|
||||
1){ba=0;break}ba&&a(m,n)}F.cb();if(M&&(C=F.o())&&(w=doc.documentElement||doc.body)&&(C.y>w.clientHeight||C.x>w.clientWidth||C.y+C.f<0||C.x+C.i<0)){if(!V){V=1;f.mb.ba(r)}}else{R=1;V=Q=0;f.mb.Ha(r);if(K===9){J={w:new f.Sb(m),q:new f.Ub(m),z:new f.Vb(m)};P=[J.w,J.q];I=new f.Oc(m,F,J);w=[new f.Mc(m,F,J,I),new f.Nc(m,F,J,I)]}else{J={w:new f.Sb(m),z:new f.Vb(m),q:new f.Ub(m),F:new f.jb(m),ga:new f.Ic(m),Pb:new f.Uc(m)};P=[J.w,J.z,J.q,J.F,J.ga,J.Pb];I=new f.Rc(m,F,J);w=[new f.Hc(m,F,J,I),new f.Fc(m,F,J,
|
||||
I),new f.Gc(m,F,J,I),new f.Tb(m,F,J,I)];m.tagName==="IMG"&&w.push(new f.Pc(m,F,J,I));I.ed=w}H=[I].concat(w);if(w=m.currentStyle.getAttribute(f.Q+"watch-ancestors")){w=parseInt(w,10);C=0;for(M=m.parentNode;M&&(w==="NaN"||C++<w);){A(M,"onpropertychange",G);A(M,"onmouseenter",o);A(M,"onmouseleave",u);A(M,"onmousedown",x);if(M.tagName in f.fc){A(M,"onfocus",z);A(M,"onblur",D)}M=M.parentNode}}if(T){f.Oa.ba(t);f.Oa.Qd()}t(1)}if(!S){S=1;K<9&&A(m,"onmove",p);A(m,"onresize",p);A(m,"onpropertychange",v);A(m,
|
||||
"onmouseenter",o);A(m,"onmouseleave",u);A(m,"onmousedown",x);if(m.tagName in f.fc){A(m,"onfocus",z);A(m,"onblur",D)}f.Qa.ba(p);f.K.ba(L)}F.hb()}}function p(){F&&F.Ad()&&t()}function t(w){if(!W)if(R){var C,K=H.length;E();for(C=0;C<K;C++)H[C].Ea();if(w||F.Nd())for(C=0;C<K;C++)H[C].ib();if(w||F.Sd())for(C=0;C<K;C++)H[C].Mb();I.ab();B()}else Q||r()}function v(){var w,C=H.length,K;w=event;if(!W&&!(w&&w.propertyName in l))if(R){E();for(w=0;w<C;w++)H[w].Ea();for(w=0;w<C;w++){K=H[w];K.Cb||K.ib();K.O()&&K.Lb()}I.ab();
|
||||
B()}else Q||r()}function o(){b(m,j)}function u(){c(m,j,h)}function x(){b(m,h);f.lb.ba(y)}function y(){c(m,h);f.lb.Ha(y)}function z(){b(m,k)}function D(){c(m,k)}function G(){var w=event.propertyName;if(w==="className"||w==="id")v()}function E(){F.cb();for(var w=P.length;w--;)P[w].cb()}function B(){for(var w=P.length;w--;)P[w].hb();F.hb()}function A(w,C,K){w.attachEvent(C,K);U.push([w,C,K])}function L(){if(S){for(var w=U.length,C;w--;){C=U[w];C[0].detachEvent(C[1],C[2])}f.K.Ha(L);S=0;U=[]}}function N(){if(!W){var w,
|
||||
C;L();W=1;if(H){w=0;for(C=H.length;w<C;w++){H[w].ec=1;H[w].m()}}T&&f.Oa.Ha(t);f.Qa.Ha(t);H=F=J=P=m=null}}var H,I,F=new da(m),J,P,Q,R,S,U=[],V,W,T;this.Ed=r;this.update=t;this.m=N;this.qd=m}var e={},g=f.Q+"lazy-init",i=f.Q+"poll",j=f.La+"hover",h=f.La+"active",k=f.La+"focus",n=f.La+"first-child",l={background:1,bgColor:1,display:1},q={},s=[];d.yd=function(m){var r=f.p.Aa(m);return e[r]||(e[r]=new d(m))};d.m=function(m){m=f.p.Aa(m);var r=e[m];if(r){r.m();delete e[m]}};d.md=function(){var m=[],r;if(e){for(var p in e)if(e.hasOwnProperty(p)){r=
|
||||
e[p];m.push(r.qd);r.m()}e={}}return m};return d}();f.supportsVML=f.zc;f.attach=function(a){f.Ba<10&&f.zc&&f.kb.yd(a).Ed()};f.detach=function(a){f.kb.m(a)}};
|
||||
var $=element;function init(){var a=window.PIE;a&&doc.media!=="print"&&a.attach($)}function cleanup(){var a=window.PIE;if(a){a.detach($);$=0}}$.readyState==="complete"&&init();
|
||||
</script>
|
||||
</PUBLIC:COMPONENT>
|
||||
27
static/cms/config.rb
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Require any additional compass plugins here.
|
||||
|
||||
# Set this to the root of your project when deployed:
|
||||
http_path = "" # use if other than /
|
||||
sass_dir = "sass"
|
||||
css_dir = "css"
|
||||
images_dir = "images"
|
||||
javascripts_dir = "js"
|
||||
|
||||
# be: :production or :development
|
||||
environment = :production
|
||||
|
||||
# You can select your preferred output style here (can be overridden via the command line):
|
||||
# output_style = :expanded or :nested or :compact or :compressed
|
||||
output_style = (environment == :production) ? :compressed : :nested
|
||||
|
||||
# To enable relative paths to assets via compass helper functions. Uncomment:
|
||||
# relative_assets = true
|
||||
|
||||
# To disable debugging comments that display the original location of your selectors. Uncomment:
|
||||
line_comments = false
|
||||
|
||||
# If you prefer the indented syntax, you might want to regenerate this
|
||||
# project again passing --syntax sass, or you can uncomment this:
|
||||
# preferred_syntax = :sass
|
||||
# and then run:
|
||||
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
|
||||
19
static/cms/css/cms.base.css
Normal file
3
static/cms/css/cms.pagetree.css
Normal file
3
static/cms/css/cms.toolbar.modal.css
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
/*!
|
||||
* @copyright: https://github.com/divio/django-cms
|
||||
*/#content>h2:first-child{display:none}#content{margin:10px 10px 0}#content .module{padding:10px}#container{padding-top:0}#footer{display:none}#cke_id_body{border:1px solid #e6e6e6 !important}#cke_id_body .cke_top,#cke_id_body .cke_bottom{background:#fafafa !important;border-color:#e6e6e6 !important;-moz-box-shadow:none !important;-webkit-box-shadow:none !important;box-shadow:none !important}.errornote{margin:0 !important}
|
||||
3
static/cms/css/cms.toolbar.sideframe.css
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
/*!
|
||||
* @copyright: https://github.com/divio/django-cms
|
||||
*/#header{display:none}#container{padding-top:30px}.cms_debug #container{padding-top:35px}#container .breadcrumbs{display:block;background:#666 !important}#content{padding-top:10px}#content h1:first-child{margin-top:0}.change-form #content{margin-top:0}.submit-row{padding:10px 10px 5px !important}.submit-row input.default,.object-tools .addlink{font-weight:200 !important;padding:5px 12px !important;margin-bottom:5px !important;border:1px solid #0e72ec !important;background-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzBlOTdlYyIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzBlNzJlYyIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==') !important;background-size:100%;background-image:-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0e97ec),color-stop(100%, #0e72ec)) !important;background-image:-moz-linear-gradient(top, #0e97ec,#0e72ec) !important;background-image:-webkit-linear-gradient(top, #0e97ec,#0e72ec) !important;background-image:linear-gradient(to bottom, #0e97ec,#0e72ec) !important;-moz-box-shadow:inset #6accf6 0px 1px 0px;-webkit-box-shadow:inset #6accf6 0px 1px 0px;box-shadow:inset #6accf6 0px 1px 0px}.submit-row input.default:hover,.submit-row input.default:active,.submit-row input.default:focus,.object-tools .addlink:hover,.object-tools .addlink:active,.object-tools .addlink:focus{background:#0e72ec !important;-moz-box-shadow:none !important;-webkit-box-shadow:none !important;box-shadow:none !important}.submit-row input.default:active,.submit-row input.default:focus,.object-tools .addlink:active,.object-tools .addlink:focus{background:#0b5bbc !important}.object-tools .recoverlink,.submit-row input{font-weight:200 !important;padding:5px 12px !important;margin-bottom:5px !important;border:1px solid #e6e6e6 !important;-moz-box-shadow:none !important;-webkit-box-shadow:none !important;box-shadow:none !important}
|
||||
BIN
static/cms/images/sitemap-li-bg.jpg
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
static/cms/img/icons/filetypes/flv.gif
Normal file
|
After Width: | Height: | Size: 384 B |
BIN
static/cms/img/icons/filetypes/gif.gif
Normal file
|
After Width: | Height: | Size: 621 B |
BIN
static/cms/img/icons/filetypes/html.gif
Normal file
|
After Width: | Height: | Size: 285 B |
BIN
static/cms/img/icons/filetypes/java.gif
Normal file
|
After Width: | Height: | Size: 650 B |
BIN
static/cms/img/icons/filetypes/jpg.gif
Normal file
|
After Width: | Height: | Size: 621 B |
BIN
static/cms/img/icons/filetypes/mp3.png
Normal file
|
After Width: | Height: | Size: 388 B |
BIN
static/cms/img/icons/filetypes/ods.png
Normal file
|
After Width: | Height: | Size: 749 B |
BIN
static/cms/img/icons/filetypes/odt.png
Normal file
|
After Width: | Height: | Size: 702 B |
BIN
static/cms/img/icons/filetypes/pdf.gif
Normal file
|
After Width: | Height: | Size: 208 B |
BIN
static/cms/img/icons/filetypes/php.gif
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
static/cms/img/icons/filetypes/png.gif
Normal file
|
After Width: | Height: | Size: 621 B |
BIN
static/cms/img/icons/filetypes/swf.gif
Normal file
|
After Width: | Height: | Size: 279 B |
BIN
static/cms/img/icons/filetypes/tgz.png
Normal file
|
After Width: | Height: | Size: 548 B |
BIN
static/cms/img/icons/filetypes/ttf.gif
Normal file
|
After Width: | Height: | Size: 648 B |
BIN
static/cms/img/icons/filetypes/txt.gif
Normal file
|
After Width: | Height: | Size: 276 B |
BIN
static/cms/img/icons/filetypes/txt.png
Normal file
|
After Width: | Height: | Size: 654 B |
BIN
static/cms/img/icons/filetypes/wav.gif
Normal file
|
After Width: | Height: | Size: 407 B |
BIN
static/cms/img/icons/filetypes/zip.png
Normal file
|
After Width: | Height: | Size: 548 B |
BIN
static/cms/img/icons/plugins/file.png
Normal file
|
After Width: | Height: | Size: 758 B |
BIN
static/cms/img/icons/plugins/get_flash_player.gif
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
static/cms/img/icons/plugins/image.png
Normal file
|
After Width: | Height: | Size: 969 B |
BIN
static/cms/img/icons/plugins/link.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
static/cms/img/icons/plugins/snippet.png
Normal file
|
After Width: | Height: | Size: 1,017 B |
BIN
static/cms/img/loader.gif
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
static/cms/img/loader@2x.gif
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
static/cms/img/logo-white.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
static/cms/img/logo-white@2x.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
static/cms/img/pagetree/sprite.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
static/cms/img/pagetree/tree-li-drag.gif
Normal file
|
After Width: | Height: | Size: 200 B |
BIN
static/cms/img/toolbar/pattern.png
Normal file
|
After Width: | Height: | Size: 938 B |
BIN
static/cms/img/toolbar/render_model_add.png
Normal file
|
After Width: | Height: | Size: 255 B |
BIN
static/cms/img/toolbar/render_model_icon.png
Normal file
|
After Width: | Height: | Size: 336 B |
BIN
static/cms/img/toolbar/render_model_placeholder.png
Normal file
|
After Width: | Height: | Size: 172 B |
BIN
static/cms/img/toolbar/sprite_toolbar.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
static/cms/img/toolbar/sprite_toolbar@2x.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
static/cms/img/welcome-bg.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
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;
|
||||
}
|
||||