function AddCssLink(src) { var node = document.getElementsByTagName('head')[0] || document.body; if(node){ var link = document.createElement('link'); link.type='text/css'; link.href=src; link.rel='stylesheet'; node.appendChild(link); } else { document.write(""); } } // WE NEED TO DO &css=1 in the ViewExposer.ashx. //AddCssLink('http://extjs.cachefly.net/ext-3.2.0/resources/css/ext-all.css'); AddCssLink('/js/ext/myCalendar/css/calendar_core.css'); AddCssLink('/Common/ext/css/trakkware.css'); /* * Ext JS Library 3.2.0 * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license */ window.undefined=window.undefined;Ext={version:"3.2.0"};Ext.apply=function(d,e,b){if(b){Ext.apply(d,b)}if(d&&e&&typeof e=="object"){for(var a in e){d[a]=e[a]}}return d};(function(){var g=0,s=Object.prototype.toString,t=navigator.userAgent.toLowerCase(),y=function(e){return e.test(t)},i=document,l=i.compatMode=="CSS1Compat",A=y(/opera/),h=y(/\bchrome\b/),u=y(/webkit/),x=!h&&y(/safari/),f=x&&y(/applewebkit\/4/),b=x&&y(/version\/3/),B=x&&y(/version\/4/),r=!A&&y(/msie/),p=r&&y(/msie 7/),o=r&&y(/msie 8/),q=r&&!p&&!o,n=!u&&y(/gecko/),d=n&&y(/rv:1\.8/),a=n&&y(/rv:1\.9/),v=r&&!l,z=y(/windows|win32/),k=y(/macintosh|mac os x/),j=y(/adobeair/),m=y(/linux/),c=/^https/i.test(window.location.protocol);if(q){try{i.execCommand("BackgroundImageCache",false,true)}catch(w){}}Ext.apply(Ext,{SSL_SECURE_URL:c&&r?'javascript:""':"about:blank",isStrict:l,isSecure:c,isReady:false,enableGarbageCollector:true,enableListenerCollection:false,enableNestedListenerRemoval:false,USE_NATIVE_JSON:false,applyIf:function(C,D){if(C){for(var e in D){if(!Ext.isDefined(C[e])){C[e]=D[e]}}}return C},id:function(e,C){e=Ext.getDom(e,true)||{};if(!e.id){e.id=(C||"ext-gen")+(++g)}return e.id},extend:function(){var C=function(E){for(var D in E){this[D]=E[D]}};var e=Object.prototype.constructor;return function(J,G,I){if(Ext.isObject(G)){I=G;G=J;J=I.constructor!=e?I.constructor:function(){G.apply(this,arguments)}}var E=function(){},H,D=G.prototype;E.prototype=D;H=J.prototype=new E();H.constructor=J;J.superclass=D;if(D.constructor==e){D.constructor=G}J.override=function(F){Ext.override(J,F)};H.superclass=H.supr=(function(){return D});H.override=C;Ext.override(J,I);J.extend=function(F){return Ext.extend(J,F)};return J}}(),override:function(e,D){if(D){var C=e.prototype;Ext.apply(C,D);if(Ext.isIE&&D.hasOwnProperty("toString")){C.toString=D.toString}}},namespace:function(){var C,e;Ext.each(arguments,function(D){e=D.split(".");C=window[e[0]]=window[e[0]]||{};Ext.each(e.slice(1),function(E){C=C[E]=C[E]||{}})});return C},urlEncode:function(G,F){var D,C=[],E=encodeURIComponent;Ext.iterate(G,function(e,H){D=Ext.isEmpty(H);Ext.each(D?e:H,function(I){C.push("&",E(e),"=",(!Ext.isEmpty(I)&&(I!=e||!D))?(Ext.isDate(I)?Ext.encode(I).replace(/"/g,""):E(I)):"")})});if(!F){C.shift();F=""}return F+C.join("")},urlDecode:function(D,C){if(Ext.isEmpty(D)){return{}}var G={},F=D.split("&"),H=decodeURIComponent,e,E;Ext.each(F,function(I){I=I.split("=");e=H(I[0]);E=H(I[1]);G[e]=C||!G[e]?E:[].concat(G[e]).concat(E)});return G},urlAppend:function(e,C){if(!Ext.isEmpty(C)){return e+(e.indexOf("?")===-1?"?":"&")+C}return e},toArray:function(){return r?function(D,G,E,F){F=[];for(var C=0,e=D.length;C0){return setTimeout(d,c)}d();return 0}});Ext.applyIf(String,{format:function(b){var a=Ext.toArray(arguments,1);return b.replace(/\{(\d+)\}/g,function(c,d){return a[d]})}});Ext.applyIf(Array.prototype,{indexOf:function(b,c){var a=this.length;c=c||0;c+=(c<0)?a:0;for(;c
'),g=h.child("div",true);var e=g.offsetWidth;h.setStyle("overflow",(Ext.isWebKit||Ext.isGecko)?"auto":"scroll");var d=g.offsetWidth;h.remove();b=e-d+2}return b},combine:function(){var f=arguments,e=f.length,h=[];for(var g=0;gg?1:-1};Ext.each(d,function(g){f=e(f,g)==1?f:g});return f},mean:function(d){return d.length>0?Ext.sum(d)/d.length:undefined},sum:function(d){var e=0;Ext.each(d,function(f){e+=f});return e},partition:function(d,e){var f=[[],[]];Ext.each(d,function(h,j,g){f[(e&&e(h,j,g))||(!e&&h)?0:1].push(h)});return f},invoke:function(d,e){var g=[],f=Array.prototype.slice.call(arguments,2);Ext.each(d,function(h,j){if(h&&Ext.isFunction(h[e])){g.push(h[e].apply(h,f))}else{g.push(undefined)}});return g},pluck:function(d,f){var e=[];Ext.each(d,function(g){e.push(g[f])});return e},zip:function(){var m=Ext.partition(arguments,function(i){return !Ext.isFunction(i)}),h=m[0],l=m[1][0],d=Ext.max(Ext.pluck(h,"length")),g=[];for(var k=0;k0){for(var p=0;p0);if(!C){C=true;for(K=0,H=p.length;K=0){z=s.substr(0,y).toLowerCase();if(s.charAt(y+1)==" "){++y}A[z]=s.substr(y+1)}})}catch(x){}return{tId:q.tId,status:r?204:u.status,statusText:r?"No Content":u.statusText,getResponseHeader:function(s){return A[s.toLowerCase()]},getAllResponseHeaders:function(){return v},responseText:u.responseText,responseXML:u.responseXML,argument:w}}function n(q){if(q.tId){k.conn[q.tId]=null}q.conn=null;q=null}function f(v,w,r,q){if(!w){n(v);return}var t,s;try{if(v.conn.status!==undefined&&v.conn.status!=0){t=v.conn.status}else{t=13030}}catch(u){t=13030}if((t>=200&&t<300)||(Ext.isIE&&t==1223)){s=o(v,w.argument);if(w.success){if(!w.scope){w.success(s)}else{w.success.apply(w.scope,[s])}}}else{switch(t){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:s=e(v.tId,w.argument,(r?r:false),q);if(w.failure){if(!w.scope){w.failure(s)}else{w.failure.apply(w.scope,[s])}}break;default:s=o(v,w.argument);if(w.failure){if(!w.scope){w.failure(s)}else{w.failure.apply(w.scope,[s])}}}}n(v);s=null}function m(s,v){v=v||{};var q=s.conn,u=s.tId,r=k.poll,t=v.timeout||null;if(t){k.conn[u]=q;k.timeout[u]=setTimeout(function(){k.abort(s,v,true)},t)}r[u]=setInterval(function(){if(q&&q.readyState==4){clearInterval(r[u]);r[u]=null;if(t){clearTimeout(k.timeout[u]);k.timeout[u]=null}f(s,v)}},k.pollInterval)}function i(u,r,t,q){var s=l()||null;if(s){s.conn.open(u,r,true);if(k.useDefaultXhrHeader){j("X-Requested-With",k.defaultXhrHeader)}if(q&&k.useDefaultHeader&&(!k.headers||!k.headers[d])){j(d,k.defaultPostHeader)}if(k.defaultHeaders||k.headers){h(s)}m(s,t);s.conn.send(q||null)}return s}function l(){var r;try{if(r=p(k.transactionId)){k.transactionId++}}catch(q){}finally{return r}}function p(t){var q;try{q=new XMLHttpRequest()}catch(s){for(var r=0;r=d.left&&e.right<=d.right&&e.top>=d.top&&e.bottom<=d.bottom)},getArea:function(){var d=this;return((d.bottom-d.top)*(d.right-d.left))},intersect:function(i){var h=this,f=Math.max(h.top,i.top),g=Math.min(h.right,i.right),d=Math.min(h.bottom,i.bottom),e=Math.max(h.left,i.left);if(d>=f&&g>=e){return new Ext.lib.Region(f,g,d,e)}},union:function(i){var h=this,f=Math.min(h.top,i.top),g=Math.max(h.right,i.right),d=Math.max(h.bottom,i.bottom),e=Math.min(h.left,i.left);return new Ext.lib.Region(f,g,d,e)},constrainTo:function(e){var d=this;d.top=d.top.constrain(e.top,e.bottom);d.bottom=d.bottom.constrain(e.top,e.bottom);d.left=d.left.constrain(e.left,e.right);d.right=d.right.constrain(e.left,e.right);return d},adjust:function(f,e,d,h){var g=this;g.top+=f;g.left+=e;g.right+=h;g.bottom+=d;return g}};Ext.lib.Region.getRegion=function(g){var i=Ext.lib.Dom.getXY(g),f=i[1],h=i[0]+g.offsetWidth,d=i[1]+g.offsetHeight,e=i[0];return new Ext.lib.Region(f,h,d,e)};Ext.lib.Point=function(d,f){if(Ext.isArray(d)){f=d[1];d=d[0]}var e=this;e.x=e.right=e.left=e[0]=d;e.y=e.top=e.bottom=e[1]=f};Ext.lib.Point.prototype=new Ext.lib.Region();(function(){var g=Ext.lib,i=/width|height|opacity|padding/i,f=/^((width|height)|(top|left))$/,d=/width|height|top$|bottom$|left$|right$/i,h=/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i,j=function(k){return typeof k!=="undefined"},e=function(){return new Date()};g.Anim={motion:function(n,l,o,p,k,m){return this.run(n,l,o,p,k,m,Ext.lib.Motion)},run:function(o,l,q,r,k,n,m){m=m||Ext.lib.AnimBase;if(typeof r=="string"){r=Ext.lib.Easing[r]}var p=new m(o,l,q,r);p.animateX(function(){if(Ext.isFunction(k)){k.call(n)}});return p}};g.AnimBase=function(l,k,m,n){if(l){this.init(l,k,m,n)}};g.AnimBase.prototype={doMethod:function(k,n,l){var m=this;return m.method(m.curFrame,n,l-n,m.totalFrames)},setAttr:function(k,m,l){if(i.test(k)&&m<0){m=0}Ext.fly(this.el,"_anim").setStyle(k,m+l)},getAttr:function(k){var m=Ext.fly(this.el),n=m.getStyle(k),l=f.exec(k)||[];if(n!=="auto"&&!h.test(n)){return parseFloat(n)}return(!!(l[2])||(m.getStyle("position")=="absolute"&&!!(l[3])))?m.dom["offset"+l[0].charAt(0).toUpperCase()+l[0].substr(1)]:0},getDefaultUnit:function(k){return d.test(k)?"px":""},animateX:function(n,k){var l=this,m=function(){l.onComplete.removeListener(m);if(Ext.isFunction(n)){n.call(k||l,l)}};l.onComplete.addListener(m,l);l.animate()},setRunAttr:function(p){var r=this,s=this.attributes[p],t=s.to,q=s.by,u=s.from,v=s.unit,l=(this.runAttrs[p]={}),m;if(!j(t)&&!j(q)){return false}var k=j(u)?u:r.getAttr(p);if(j(t)){m=t}else{if(j(q)){if(Ext.isArray(k)){m=[];for(var n=0,o=k.length;n0&&isFinite(w)){if(r.curFrame+w>=v){w=v-(u+1)}r.curFrame+=w}}};g.Bezier=new function(){this.getPosition=function(p,o){var r=p.length,m=[],q=1-o,l,k;for(l=0;l0&&!Ext.isArray(t[0])){t=[t]}else{}Ext.fly(q,"_anim").position();B.setXY(q,j(y)?y:B.getXY(q));p=x.getAttr("points");if(j(z)){r=k.call(x,z,p);for(s=0,u=t.length;s0){o=o.concat(t)}o[o.length]=r}else{n.setRunAttr.call(this,v)}}});var k=function(o,q){var p=g.Dom.getXY(this.el);return[o[0]-p[0]+q[0],o[1]-p[1]+q[1]]}})()})();(function(){var d=Math.abs,i=Math.PI,h=Math.asin,g=Math.pow,e=Math.sin,f=Ext.lib;Ext.apply(f.Easing,{easeBoth:function(k,j,m,l){return((k/=l/2)<1)?m/2*k*k+j:-m/2*((--k)*(k-2)-1)+j},easeInStrong:function(k,j,m,l){return m*(k/=l)*k*k*k+j},easeOutStrong:function(k,j,m,l){return -m*((k=k/l-1)*k*k*k-1)+j},easeBothStrong:function(k,j,m,l){return((k/=l/2)<1)?m/2*k*k*k*k+j:-m/2*((k-=2)*k*k*k-2)+j},elasticIn:function(l,j,q,o,k,n){if(l==0||(l/=o)==1){return l==0?j:j+q}n=n||(o*0.3);var m;if(k>=d(q)){m=n/(2*i)*h(q/k)}else{k=q;m=n/4}return -(k*g(2,10*(l-=1))*e((l*o-m)*(2*i)/n))+j},elasticOut:function(l,j,q,o,k,n){if(l==0||(l/=o)==1){return l==0?j:j+q}n=n||(o*0.3);var m;if(k>=d(q)){m=n/(2*i)*h(q/k)}else{k=q;m=n/4}return k*g(2,-10*l)*e((l*o-m)*(2*i)/n)+q+j},elasticBoth:function(l,j,q,o,k,n){if(l==0||(l/=o/2)==2){return l==0?j:j+q}n=n||(o*(0.3*1.5));var m;if(k>=d(q)){m=n/(2*i)*h(q/k)}else{k=q;m=n/4}return l<1?-0.5*(k*g(2,10*(l-=1))*e((l*o-m)*(2*i)/n))+j:k*g(2,-10*(l-=1))*e((l*o-m)*(2*i)/n)*0.5+q+j},backIn:function(k,j,n,m,l){l=l||1.70158;return n*(k/=m)*k*((l+1)*k-l)+j},backOut:function(k,j,n,m,l){if(!l){l=1.70158}return n*((k=k/m-1)*k*((l+1)*k+l)+1)+j},backBoth:function(k,j,n,m,l){l=l||1.70158;return((k/=m/2)<1)?n/2*(k*k*(((l*=(1.525))+1)*k-l))+j:n/2*((k-=2)*k*(((l*=(1.525))+1)*k+l)+2)+j},bounceIn:function(k,j,m,l){return m-f.Easing.bounceOut(l-k,0,m,l)+j},bounceOut:function(k,j,m,l){if((k/=l)<(1/2.75)){return m*(7.5625*k*k)+j}else{if(k<(2/2.75)){return m*(7.5625*(k-=(1.5/2.75))*k+0.75)+j}else{if(k<(2.5/2.75)){return m*(7.5625*(k-=(2.25/2.75))*k+0.9375)+j}}}return m*(7.5625*(k-=(2.625/2.75))*k+0.984375)+j},bounceBoth:function(k,j,m,l){return(k",h="",b=a+"",i=""+h,k=b+"",r=""+i;function g(x,z,y,A,v,t){var u=p.insertHtml(A,Ext.getDom(x),q(z));return y?Ext.get(u,true):u}function q(A){var v="",u,z,y,t,B;if(Ext.isString(A)){v=A}else{if(Ext.isArray(A)){for(var x=0;x"}}}return v}function e(B,y,x,z){s.innerHTML=[y,x,z].join("");var t=-1,v=s,u;while(++t "'+z+'"'},insertBefore:function(t,v,u){return g(t,v,u,c)},insertAfter:function(t,v,u){return g(t,v,u,n,"nextSibling")},insertFirst:function(t,v,u){return g(t,v,u,m,"firstChild")},append:function(t,v,u){return g(t,v,u,o,"",true)},overwrite:function(t,v,u){t=Ext.getDom(t);t.innerHTML=q(v);return u?Ext.get(t.firstChild):t.firstChild},createHtml:q};return p}();Ext.apply(Ext.DomHelper,function(){var d,a="afterbegin",g="afterend",h="beforebegin",c="beforeend";function e(l,n,m,p,k,i){l=Ext.getDom(l);var j;if(d.useDom){j=b(n,null);if(i){l.appendChild(j)}else{(k=="firstChild"?l:l.parentNode).insertBefore(j,l[k]||l)}}else{j=Ext.DomHelper.insertHtml(p,l,Ext.DomHelper.createHtml(n))}return m?Ext.get(j,true):j}function b(p,j){var l,m=document,k,i,n,q;if(Ext.isArray(p)){l=m.createDocumentFragment();Ext.each(p,function(o){b(o,l)})}else{if(Ext.isString(p)){l=m.createTextNode(p)}else{l=m.createElement(p.tag||"div");k=!!l.setAttribute;Ext.iterate(p,function(o,r){if(!/tag|children|cn|html|style/.test(o)){if(o=="cls"){l.className=r}else{if(k){l.setAttribute(o,r)}else{l[o]=r}}}});Ext.DomHelper.applyStyles(l,p.style);if((q=p.children||p.cn)){b(q,l)}else{if(p.html){l.innerHTML=p.html}}}}if(j){j.appendChild(l)}return l}d={createTemplate:function(j){var i=Ext.DomHelper.createHtml(j);return new Ext.Template(i)},useDom:false,insertBefore:function(i,k,j){return e(i,k,j,h)},insertAfter:function(i,k,j){return e(i,k,j,g,"nextSibling")},insertFirst:function(i,k,j){return e(i,k,j,a,"firstChild")},append:function(i,k,j){return e(i,k,j,c,"",true)},createDom:b};return d}());Ext.Template=function(d){var e=this,b=arguments,c=[];if(Ext.isArray(d)){d=d.join("")}else{if(b.length>1){Ext.each(b,function(a){if(Ext.isObject(a)){Ext.apply(e,a)}else{c.push(a)}});d=c.join("")}}e.html=d;if(e.compiled){e.compile()}};Ext.Template.prototype={re:/\{([\w-]+)\}/g,applyTemplate:function(a){var b=this;return b.compiled?b.compiled(a):b.html.replace(b.re,function(c,d){return a[d]!==undefined?a[d]:""})},set:function(a,c){var b=this;b.html=a;b.compiled=null;return c?b.compile():b},compile:function(){var me=this,sep=Ext.isGecko?"+":",";function fn(m,name){name="values['"+name+"']";return"'"+sep+"("+name+" == undefined ? '' : "+name+")"+sep+"'"}eval("this.compiled = function(values){ return "+(Ext.isGecko?"'":"['")+me.html.replace(/\\/g,"\\\\").replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,fn)+(Ext.isGecko?"';};":"'].join('');};"));return me},insertFirst:function(b,a,c){return this.doInsert("afterBegin",b,a,c)},insertBefore:function(b,a,c){return this.doInsert("beforeBegin",b,a,c)},insertAfter:function(b,a,c){return this.doInsert("afterEnd",b,a,c)},append:function(b,a,c){return this.doInsert("beforeEnd",b,a,c)},doInsert:function(c,e,b,a){e=Ext.getDom(e);var d=Ext.DomHelper.insertHtml(c,e,this.applyTemplate(b));return a?Ext.get(d,true):d},overwrite:function(b,a,c){b=Ext.getDom(b);b.innerHTML=this.applyTemplate(a);return c?Ext.get(b.firstChild,true):b.firstChild}};Ext.Template.prototype.apply=Ext.Template.prototype.applyTemplate;Ext.Template.from=function(b,a){b=Ext.getDom(b);return new Ext.Template(b.value||b.innerHTML,a||"")};Ext.apply(Ext.Template.prototype,{disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,applyTemplate:function(b){var g=this,a=g.disableFormats!==true,e=Ext.util.Format,c=g;if(g.compiled){return g.compiled(b)}function d(j,l,p,k){if(p&&a){if(p.substr(0,5)=="this."){return c.call(p.substr(5),b[l],b)}else{if(k){var o=/^\s*['"](.*)["']\s*$/;k=k.split(",");for(var n=0,h=k.length;n+~]\s?|\s|$)/,tagTokenRe=/^(#)?([\w-\*]+)/,nthRe=/(\d*)n\+?(\d*)/,nthRe2=/\D/,isIE=window.ActiveXObject?true:false,key=30803;eval("var batch = 30803;");function child(parent,index){var i=0,n=parent.firstChild;while(n){if(n.nodeType==1){if(++i==index){return n}}n=n.nextSibling}return null}function next(n){while((n=n.nextSibling)&&n.nodeType!=1){}return n}function prev(n){while((n=n.previousSibling)&&n.nodeType!=1){}return n}function children(parent){var n=parent.firstChild,nodeIndex=-1,nextNode;while(n){nextNode=n.nextSibling;if(n.nodeType==3&&!nonSpace.test(n.nodeValue)){parent.removeChild(n)}else{n.nodeIndex=++nodeIndex}n=nextNode}return this}function byClassName(nodeSet,cls){if(!cls){return nodeSet}var result=[],ri=-1;for(var i=0,ci;ci=nodeSet[i];i++){if((" "+ci.className+" ").indexOf(cls)!=-1){result[++ri]=ci}}return result}function attrValue(n,attr){if(!n.tagName&&typeof n.length!="undefined"){n=n[0]}if(!n){return null}if(attr=="for"){return n.htmlFor}if(attr=="class"||attr=="className"){return n.className}return n.getAttribute(attr)||n[attr]}function getNodes(ns,mode,tagName){var result=[],ri=-1,cs;if(!ns){return result}tagName=tagName||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns]}if(!mode){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(tagName);for(var j=0,ci;ci=cs[j];j++){result[++ri]=ci}}}else{if(mode=="/"||mode==">"){var utag=tagName.toUpperCase();for(var i=0,ni,cn;ni=ns[i];i++){cn=ni.childNodes;for(var j=0,cj;cj=cn[j];j++){if(cj.nodeName==utag||cj.nodeName==tagName||tagName=="*"){result[++ri]=cj}}}}else{if(mode=="+"){var utag=tagName.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(n&&(n.nodeName==utag||n.nodeName==tagName||tagName=="*")){result[++ri]=n}}}else{if(mode=="~"){var utag=tagName.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)){if(n.nodeName==utag||n.nodeName==tagName||tagName=="*"){result[++ri]=n}}}}}}}return result}function concat(a,b){if(b.slice){return a.concat(b)}for(var i=0,l=b.length;i1){return nodup(results)}return results},isXml:function(el){var docEl=(el?el.ownerDocument||el:0).documentElement;return docEl?docEl.nodeName!=="HTML":false},select:document.querySelectorAll?function(path,root,type){root=root||document;if(!Ext.DomQuery.isXml(root)){try{var cs=root.querySelectorAll(path);return Ext.toArray(cs)}catch(ex){}}return Ext.DomQuery.jsSelect.call(this,path,root,type)}:function(path,root,type){return Ext.DomQuery.jsSelect.call(this,path,root,type)},selectNode:function(path,root){return Ext.DomQuery.select(path,root)[0]},selectValue:function(path,root,defaultValue){path=path.replace(trimRe,"");if(!valueCache[path]){valueCache[path]=Ext.DomQuery.compile(path,"select")}var n=valueCache[path](root),v;n=n[0]?n[0]:n;if(typeof n.normalize=="function"){n.normalize()}v=(n&&n.firstChild?n.firstChild.nodeValue:null);return((v===null||v===undefined||v==="")?defaultValue:v)},selectNumber:function(path,root,defaultValue){var v=Ext.DomQuery.selectValue(path,root,defaultValue||0);return parseFloat(v)},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el)}var isArray=Ext.isArray(el),result=Ext.DomQuery.filter(isArray?el:[el],ss);return isArray?(result.length==el.length):(result.length>0)},filter:function(els,ss,nonMatches){ss=ss.replace(trimRe,"");if(!simpleCache[ss]){simpleCache[ss]=Ext.DomQuery.compile(ss,"simple")}var result=simpleCache[ss](els);return nonMatches?quickDiff(result,els):result},matchers:[{re:/^\.([\w-]+)/,select:'n = byClassName(n, " {1} ");'},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:'n = byPseudo(n, "{1}", "{2}");'},{re:/^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,select:'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'},{re:/^#([\w-]+)/,select:'n = byId(n, "{1}");'},{re:/^@([\w-]+)/,select:'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'}],operators:{"=":function(a,v){return a==v},"!=":function(a,v){return a!=v},"^=":function(a,v){return a&&a.substr(0,v.length)==v},"$=":function(a,v){return a&&a.substr(a.length-v.length)==v},"*=":function(a,v){return a&&a.indexOf(v)!==-1},"%=":function(a,v){return(a%v)==0},"|=":function(a,v){return a&&(a==v||a.substr(0,v.length+1)==v+"-")},"~=":function(a,v){return a&&(" "+a+" ").indexOf(" "+v+" ")!=-1}},pseudos:{"first-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.previousSibling)&&n.nodeType!=1){}if(!n){r[++ri]=ci}}return r},"last-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(!n){r[++ri]=ci}}return r},"nth-child":function(c,a){var r=[],ri=-1,m=nthRe.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!nthRe2.test(a)&&"n+"+a||a),f=(m[1]||1)-0,l=m[2]-0;for(var i=0,n;n=c[i];i++){var pn=n.parentNode;if(batch!=pn._batch){var j=0;for(var cn=pn.firstChild;cn;cn=cn.nextSibling){if(cn.nodeType==1){cn.nodeIndex=++j}}pn._batch=batch}if(f==1){if(l==0||n.nodeIndex==l){r[++ri]=n}}else{if((n.nodeIndex+l)%f==0){r[++ri]=n}}}return r},"only-child":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(!prev(ci)&&!next(ci)){r[++ri]=ci}}return r},empty:function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var cns=ci.childNodes,j=0,cn,empty=true;while(cn=cns[j]){++j;if(cn.nodeType==1||cn.nodeType==3){empty=false;break}}if(empty){r[++ri]=ci}}return r},contains:function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if((ci.textContent||ci.innerText||"").indexOf(v)!=-1){r[++ri]=ci}}return r},nodeValue:function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.firstChild&&ci.firstChild.nodeValue==v){r[++ri]=ci}}return r},checked:function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.checked==true){r[++ri]=ci}}return r},not:function(c,ss){return Ext.DomQuery.filter(c,ss,true)},any:function(c,selectors){var ss=selectors.split("|"),r=[],ri=-1,s;for(var i=0,ci;ci=c[i];i++){for(var j=0;s=ss[j];j++){if(Ext.DomQuery.is(ci,s)){r[++ri]=ci;break}}}return r},odd:function(c){return this["nth-child"](c,"odd")},even:function(c){return this["nth-child"](c,"even")},nth:function(c,a){return c[a-1]||[]},first:function(c){return c[0]||[]},last:function(c){return c[c.length-1]||[]},has:function(c,ss){var s=Ext.DomQuery.select,r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(s(ss,ci).length>0){r[++ri]=ci}}return r},next:function(c,ss){var is=Ext.DomQuery.is,r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=next(ci);if(n&&is(n,ss)){r[++ri]=ci}}return r},prev:function(c,ss){var is=Ext.DomQuery.is,r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=prev(ci);if(n&&is(n,ss)){r[++ri]=ci}}return r}}}}();Ext.query=Ext.DomQuery.select;Ext.util.DelayedTask=function(d,c,a){var e=this,g,b=function(){clearInterval(g);g=null;d.apply(c,a||[])};e.delay=function(i,k,j,h){e.cancel();d=k||d;c=j||c;a=h||a;g=setInterval(b,i)};e.cancel=function(){if(g){clearInterval(g);g=null}}};(function(){var i=Ext.util,l=Ext.toArray,k=Ext.each,a=Ext.isObject,h=true,j=false;i.Observable=function(){var m=this,n=m.events;if(m.listeners){m.on(m.listeners);delete m.listeners}m.events=n||{}};i.Observable.prototype={filterOptRe:/^(?:scope|delay|buffer|single)$/,fireEvent:function(){var m=l(arguments),o=m[0].toLowerCase(),p=this,n=h,s=p.events[o],r,t;if(p.eventsSuspended===h){if(r=p.eventQueue){r.push(m)}}else{if(a(s)&&s.bubble){if(s.fire.apply(s,m.slice(1))===j){return j}t=p.getBubbleTarget&&p.getBubbleTarget();if(t&&t.enableBubble){if(!t.events[o]||!Ext.isObject(t.events[o])||!t.events[o].bubble){t.enableBubble(o)}return t.fireEvent.apply(t,m)}}else{if(a(s)){m.shift();n=s.fire.apply(s,m)}}}return n},addListener:function(p,s,u,n){var r=this,q,v,t,m;if(a(p)){n=p;for(q in n){v=n[q];if(!r.filterOptRe.test(q)){r.addListener(q,v.fn||v,v.scope||n.scope,v.fn?v:n)}}}else{p=p.toLowerCase();m=r.events[p]||h;if(Ext.isBoolean(m)){r.events[p]=m=new i.Event(r,p)}m.addListener(s,u,a(n)?n:{})}},removeListener:function(m,o,n){var p=this.events[m.toLowerCase()];if(a(p)){p.removeListener(o,n)}},purgeListeners:function(){var o=this.events,m,n;for(n in o){m=o[n];if(a(m)){m.clearListeners()}}},addEvents:function(q){var p=this;p.events=p.events||{};if(Ext.isString(q)){var m=arguments,n=m.length;while(n--){p.events[m[n]]=p.events[m[n]]||h}}else{Ext.applyIf(p.events,q)}},hasListener:function(m){var n=this.events[m.toLowerCase()];return a(n)&&n.listeners.length>0},suspendEvents:function(m){this.eventsSuspended=h;if(m&&!this.eventQueue){this.eventQueue=[]}},resumeEvents:function(){var m=this,n=m.eventQueue||[];m.eventsSuspended=j;delete m.eventQueue;k(n,function(o){m.fireEvent.apply(m,o)})}};var e=i.Observable.prototype;e.on=e.addListener;e.un=e.removeListener;i.Observable.releaseCapture=function(m){m.fireEvent=e.fireEvent};function g(n,p,m){return function(){if(p.target==arguments[0]){n.apply(m,l(arguments))}}}function c(p,q,m,n){m.task=new i.DelayedTask();return function(){m.task.delay(q.buffer,p,n,l(arguments))}}function d(o,p,n,m){return function(){p.removeListener(n,m);return o.apply(m,arguments)}}function b(p,q,m,n){return function(){var o=new i.DelayedTask();if(!m.tasks){m.tasks=[]}m.tasks.push(o);o.delay(q.delay||10,p,n,l(arguments))}}i.Event=function(n,m){this.name=m;this.obj=n;this.listeners=[]};i.Event.prototype={addListener:function(p,o,n){var q=this,m;o=o||q.obj;if(!q.isListening(p,o)){m=q.createListener(p,o,n);if(q.firing){q.listeners=q.listeners.slice(0)}q.listeners.push(m)}},createListener:function(q,p,r){r=r||{},p=p||this.obj;var m={fn:q,scope:p,options:r},n=q;if(r.target){n=g(n,r,p)}if(r.delay){n=b(n,r,m,p)}if(r.single){n=d(n,this,q,p)}if(r.buffer){n=c(n,r,m,p)}m.fireFn=n;return m},findListener:function(p,o){var q=this.listeners,n=q.length,m;o=o||this.obj;while(n--){m=q[n];if(m){if(m.fn==p&&m.scope==o){return n}}}return -1},isListening:function(n,m){return this.findListener(n,m)!=-1},removeListener:function(r,q){var p,m,n,s=this,o=j;if((p=s.findListener(r,q))!=-1){if(s.firing){s.listeners=s.listeners.slice(0)}m=s.listeners[p];if(m.task){m.task.cancel();delete m.task}n=m.tasks&&m.tasks.length;if(n){while(n--){m.tasks[n].cancel()}delete m.tasks}s.listeners.splice(p,1);o=h}return o},clearListeners:function(){var o=this,m=o.listeners,n=m.length;while(n--){o.removeListener(m[n].fn,m[n].scope)}},fire:function(){var r=this,o=l(arguments),q=r.listeners,m=q.length,p=0,n;if(m>0){r.firing=h;for(;p=525:!((Ext.isGecko&&!Ext.isWindows)||Ext.isOpera);return{doResizeEvent:function(){var l=a.getViewHeight(),k=a.getViewWidth();if(g!=l||h!=k){c.fire(h=k,g=l)}},onWindowResize:function(m,l,k){if(!c){c=new Ext.util.Event();j=new Ext.util.DelayedTask(this.doResizeEvent);Ext.EventManager.on(window,"resize",this.fireWindowResize,this)}c.addListener(m,l,k)},fireWindowResize:function(){if(c){j.delay(100)}},onTextResize:function(n,m,k){if(!e){e=new Ext.util.Event();var l=new Ext.Element(document.createElement("div"));l.dom.className="x-text-resize";l.dom.innerHTML="X";l.appendTo(document.body);b=l.dom.offsetHeight;setInterval(function(){if(l.dom.offsetHeight!=b){e.fire(b,b=l.dom.offsetHeight)}},this.textResizeInterval)}e.addListener(n,m,k)},removeResizeListener:function(l,k){if(c){c.removeListener(l,k)}},fireResize:function(){if(c){c.fire(a.getViewWidth(),a.getViewHeight())}},textResizeInterval:50,ieDeferSrc:false,useKeydown:d}}());Ext.EventManager.on=Ext.EventManager.addListener;Ext.apply(Ext.EventObjectImpl.prototype,{BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,RETURN:13,SHIFT:16,CTRL:17,CONTROL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGEUP:33,PAGE_DOWN:34,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,isNavKeyPress:function(){var b=this,a=this.normalizeKey(b.keyCode);return(a>=33&&a<=40)||a==b.RETURN||a==b.TAB||a==b.ESC},isSpecialKey:function(){var a=this.normalizeKey(this.keyCode);return(this.type=="keypress"&&this.ctrlKey)||this.isNavKeyPress()||(a==this.BACKSPACE)||(a>=16&&a<=20)||(a>=44&&a<=46)},getPoint:function(){return new Ext.lib.Point(this.xy[0],this.xy[1])},hasModifier:function(){return((this.ctrlKey||this.altKey)||this.shiftKey)}});(function(){var j=document;Ext.Element=function(o,p){var q=typeof o=="string"?j.getElementById(o):o,r;if(!q){return null}r=q.id;if(!p&&r&&Ext.elCache[r]){return Ext.elCache[r].el}this.dom=q;this.id=r||Ext.id(q)};var a=Ext.lib.Dom,g=Ext.DomHelper,m=Ext.lib.Event,e=Ext.lib.Anim,h=Ext.Element,b=Ext.elCache;h.prototype={set:function(t,q){var r=this.dom,p,s,q=(q!==false)&&!!r.setAttribute;for(p in t){if(t.hasOwnProperty(p)){s=t[p];if(p=="style"){g.applyStyles(r,s)}else{if(p=="cls"){r.className=s}else{if(q){r.setAttribute(p,s)}else{r[p]=s}}}}}return this},defaultUnit:"px",is:function(o){return Ext.DomQuery.is(this.dom,o)},focus:function(r,q){var o=this,q=q||o.dom;try{if(Number(r)){o.focus.defer(r,null,[null,q])}else{q.focus()}}catch(p){}return o},blur:function(){try{this.dom.blur()}catch(o){}return this},getValue:function(o){var p=this.dom.value;return o?parseInt(p,10):p},addListener:function(o,r,q,p){Ext.EventManager.on(this.dom,o,r,q||this,p);return this},removeListener:function(o,q,p){Ext.EventManager.removeListener(this.dom,o,q,p||this);return this},removeAllListeners:function(){Ext.EventManager.removeAll(this.dom);return this},purgeAllListeners:function(){Ext.EventManager.purgeElement(this,true);return this},addUnits:function(o){if(o===""||o=="auto"||o===undefined){o=o||""}else{if(!isNaN(o)||!k.test(o)){o=o+(this.defaultUnit||"px")}}return o},load:function(p,q,o){Ext.Ajax.request(Ext.apply({params:q,url:p.url||p,callback:o,el:this.dom,indicatorText:p.indicatorText||""},Ext.isObject(p)?p:{}));return this},isBorderBox:function(){return i[(this.dom.tagName||"").toLowerCase()]||Ext.isBorderBox},remove:function(){var o=this,p=o.dom;if(p){delete o.dom;Ext.removeNode(p)}},hover:function(p,o,r,q){var s=this;s.on("mouseenter",p,r||s.dom,q);s.on("mouseleave",o,r||s.dom,q);return s},contains:function(o){return !o?false:Ext.lib.Dom.isAncestor(this.dom,o.dom?o.dom:o)},getAttributeNS:function(p,o){return this.getAttribute(o,p)},getAttribute:Ext.isIE?function(o,q){var r=this.dom,p=typeof r[q+":"+o];if(["undefined","unknown"].indexOf(p)==-1){return r[q+":"+o]}return r[o]}:function(o,p){var q=this.dom;return q.getAttributeNS(p,o)||q.getAttribute(p+":"+o)||q.getAttribute(o)||q[o]},update:function(o){if(this.dom){this.dom.innerHTML=o}return this}};var n=h.prototype;h.addMethods=function(p){Ext.apply(n,p)};n.on=n.addListener;n.un=n.removeListener;n.autoBoxAdjust=true;var k=/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,d;h.get=function(p){var o,s,r;if(!p){return null}if(typeof p=="string"){if(!(s=j.getElementById(p))){return null}if(b[p]&&b[p].el){o=b[p].el;o.dom=s}else{o=h.addToCache(new h(s))}return o}else{if(p.tagName){if(!(r=p.id)){r=Ext.id(p)}if(b[r]&&b[r].el){o=b[r].el;o.dom=p}else{o=h.addToCache(new h(p))}return o}else{if(p instanceof h){if(p!=d){if(Ext.isIE&&(p.id==undefined||p.id=="")){p.dom=p.dom}else{p.dom=j.getElementById(p.id)||p.dom}}return p}else{if(p.isComposite){return p}else{if(Ext.isArray(p)){return h.select(p)}else{if(p==j){if(!d){var q=function(){};q.prototype=h.prototype;d=new q();d.dom=j}return d}}}}}}return null};h.addToCache=function(o,p){p=p||o.id;b[p]={el:o,data:{},events:{}};return o};h.data=function(p,o,q){p=h.get(p);if(!p){return null}var r=b[p.id].data;if(arguments.length==2){return r[o]}else{return(r[o]=q)}};function l(){if(!Ext.enableGarbageCollector){clearInterval(h.collectorThreadId)}else{var p,r,u,s;for(p in b){s=b[p];if(s.skipGC){continue}r=s.el;u=r.dom;if(!u||!u.parentNode||(!u.offsetParent&&!j.getElementById(p))){if(Ext.enableListenerCollection){Ext.EventManager.removeAll(u)}delete b[p]}}if(Ext.isIE){var q={};for(p in b){q[p]=b[p]}b=Ext.elCache=q}}}h.collectorThreadId=setInterval(l,30000);var c=function(){};c.prototype=h.prototype;h.Flyweight=function(o){this.dom=o};h.Flyweight.prototype=new c();h.Flyweight.prototype.isFlyweight=true;h._flyweights={};h.fly=function(q,o){var p=null;o=o||"_global";if(q=Ext.getDom(q)){(h._flyweights[o]=h._flyweights[o]||new h.Flyweight()).dom=q;p=h._flyweights[o]}return p};Ext.get=h.get;Ext.fly=h.fly;var i=Ext.isStrict?{select:1}:{input:1,select:1,textarea:1};if(Ext.isIE||Ext.isGecko){i.button=1}})();Ext.Element.addMethods({swallowEvent:function(a,b){var d=this;function c(g){g.stopPropagation();if(b){g.preventDefault()}}if(Ext.isArray(a)){Ext.each(a,function(g){d.on(g,c)});return d}d.on(a,c);return d},relayEvent:function(a,b){this.on(a,function(c){b.fireEvent(a,c)})},clean:function(b){var d=this,e=d.dom,g=e.firstChild,c=-1;if(Ext.Element.data(e,"isCleaned")&&b!==true){return d}while(g){var a=g.nextSibling;if(g.nodeType==3&&!/\S/.test(g.nodeValue)){e.removeChild(g)}else{g.nodeIndex=++c}g=a}Ext.Element.data(e,"isCleaned",true);return d},load:function(){var a=this.getUpdater();a.update.apply(a,arguments);return this},getUpdater:function(){return this.updateManager||(this.updateManager=new Ext.Updater(this))},update:function(html,loadScripts,callback){if(!this.dom){return this}html=html||"";if(loadScripts!==true){this.dom.innerHTML=html;if(Ext.isFunction(callback)){callback()}return this}var id=Ext.id(),dom=this.dom;html+='';Ext.lib.Event.onAvailable(id,function(){var DOC=document,hd=DOC.getElementsByTagName("head")[0],re=/(?:]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,srcRe=/\ssrc=([\'\"])(.*?)\1/i,typeRe=/\stype=([\'\"])(.*?)\1/i,match,attrs,srcMatch,typeMatch,el,s;while((match=re.exec(html))){attrs=match[1];srcMatch=attrs?attrs.match(srcRe):false;if(srcMatch&&srcMatch[2]){s=DOC.createElement("script");s.src=srcMatch[2];typeMatch=attrs.match(typeRe);if(typeMatch&&typeMatch[2]){s.type=typeMatch[2]}hd.appendChild(s)}else{if(match[2]&&match[2].length>0){if(window.execScript){window.execScript(match[2])}else{window.eval(match[2])}}}}el=DOC.getElementById(id);if(el){Ext.removeNode(el)}if(Ext.isFunction(callback)){callback()}});dom.innerHTML=html.replace(/(?:)((\n|\r|.)*?)(?:<\/script>)/ig,"");return this},removeAllListeners:function(){this.removeAnchor();Ext.EventManager.removeAll(this.dom);return this},createProxy:function(a,e,d){a=Ext.isObject(a)?a:{tag:"div",cls:a};var c=this,b=e?Ext.DomHelper.append(e,a,true):Ext.DomHelper.insertBefore(c.dom,a,true);if(d&&c.setBox&&c.getBox){b.setBox(c.getBox())}return b}});Ext.Element.prototype.getUpdateManager=Ext.Element.prototype.getUpdater;Ext.Element.addMethods({getAnchorXY:function(e,l,q){e=(e||"tl").toLowerCase();q=q||{};var k=this,b=k.dom==document.body||k.dom==document,n=q.width||b?Ext.lib.Dom.getViewWidth():k.getWidth(),i=q.height||b?Ext.lib.Dom.getViewHeight():k.getHeight(),p,a=Math.round,c=k.getXY(),m=k.getScroll(),j=b?m.left:!l?c[0]:0,g=b?m.top:!l?c[1]:0,d={c:[a(n*0.5),a(i*0.5)],t:[a(n*0.5),0],l:[0,a(i*0.5)],r:[n,a(i*0.5)],b:[a(n*0.5),i],tl:[0,0],bl:[0,i],br:[n,i],tr:[n,0]};p=d[e];return[p[0]+j,p[1]+g]},anchorTo:function(b,h,c,a,k,l){var i=this,e=i.dom,j=!Ext.isEmpty(k),d=function(){Ext.fly(e).alignTo(b,h,c,a);Ext.callback(l,Ext.fly(e))},g=this.getAnchor();this.removeAnchor();Ext.apply(g,{fn:d,scroll:j});Ext.EventManager.onWindowResize(d,null);if(j){Ext.EventManager.on(window,"scroll",d,null,{buffer:!isNaN(k)?k:50})}d.call(i);return i},removeAnchor:function(){var b=this,a=this.getAnchor();if(a&&a.fn){Ext.EventManager.removeResizeListener(a.fn);if(a.scroll){Ext.EventManager.un(window,"scroll",a.fn)}delete a.fn}return b},getAnchor:function(){var b=Ext.Element.data,c=this.dom;if(!c){return}var a=b(c,"_anchor");if(!a){a=b(c,"_anchor",{})}return a},getAlignToXY:function(g,A,B){g=Ext.get(g);if(!g||!g.dom){throw"Element.alignToXY with an element that doesn't exist"}B=B||[0,0];A=(!A||A=="?"?"tl-bl?":(!/-/.test(A)&&A!==""?"tl-"+A:A||"tl-bl")).toLowerCase();var K=this,H=K.dom,M,L,n,l,s,F,v,t=Ext.lib.Dom.getViewWidth()-10,G=Ext.lib.Dom.getViewHeight()-10,b,i,j,k,u,z,N=document,J=N.documentElement,q=N.body,E=(J.scrollLeft||q.scrollLeft||0)+5,D=(J.scrollTop||q.scrollTop||0)+5,I=false,e="",a="",C=A.match(/^([a-z]+)-([a-z]+)(\?)?$/);if(!C){throw"Element.alignTo with an invalid alignment "+A}e=C[1];a=C[2];I=!!C[3];M=K.getAnchorXY(e,true);L=g.getAnchorXY(a,false);n=L[0]-M[0]+B[0];l=L[1]-M[1]+B[1];if(I){s=K.getWidth();F=K.getHeight();v=g.getRegion();b=e.charAt(0);i=e.charAt(e.length-1);j=a.charAt(0);k=a.charAt(a.length-1);u=((b=="t"&&j=="b")||(b=="b"&&j=="t"));z=((i=="r"&&k=="l")||(i=="l"&&k=="r"));if(n+s>t+E){n=z?v.left-s:t+E-s}if(nG+D){l=u?v.top-F:G+D-F}if(lA){o=A-p;l=true}if((n+B)>g){n=g-B;l=true}if(o "+g,this.dom);return h?i:a(i)},parent:function(g,h){return this.matchNode(d,d,g,h)},next:function(g,h){return this.matchNode(b,b,g,h)},prev:function(g,h){return this.matchNode(c,c,g,h)},first:function(g,h){return this.matchNode(b,"firstChild",g,h)},last:function(g,h){return this.matchNode(c,"lastChild",g,h)},matchNode:function(h,k,g,i){var j=this.dom[k];while(j){if(j.nodeType==1&&(!g||e.is(j,g))){return !i?a(j):j}j=j[h]}return null}}}());Ext.Element.addMethods({select:function(a,b){return Ext.Element.select(a,b,this.dom)}});Ext.Element.addMethods(function(){var c=Ext.getDom,a=Ext.get,b=Ext.DomHelper;return{appendChild:function(d){return a(d).appendTo(this)},appendTo:function(d){c(d).appendChild(this.dom);return this},insertBefore:function(d){(d=c(d)).parentNode.insertBefore(this.dom,d);return this},insertAfter:function(d){(d=c(d)).parentNode.insertBefore(this.dom,d.nextSibling);return this},insertFirst:function(e,d){e=e||{};if(e.nodeType||e.dom||typeof e=="string"){e=c(e);this.dom.insertBefore(e,this.dom.firstChild);return !d?a(e):e}else{return this.createChild(e,this.dom.firstChild,d)}},replace:function(d){d=a(d);this.insertBefore(d);d.remove();return this},replaceWith:function(d){var e=this;if(d.nodeType||d.dom||typeof d=="string"){d=c(d);e.dom.parentNode.insertBefore(d,e.dom)}else{d=b.insertBefore(e.dom,d)}delete Ext.elCache[e.id];Ext.removeNode(e.dom);e.id=Ext.id(e.dom=d);Ext.Element.addToCache(e.isFlyweight?new Ext.Element(e.dom):e);return e},createChild:function(e,d,g){e=e||{tag:"div"};return d?b.insertBefore(d,e,g!==true):b[!this.dom.firstChild?"overwrite":"append"](this.dom,e,g!==true)},wrap:function(d,e){var g=b.insertBefore(this.dom,d||{tag:"div"},!e);g.dom?g.dom.appendChild(this.dom):g.appendChild(this.dom);return g},insertHtml:function(e,g,d){var h=b.insertHtml(e,this.dom,g);return d?Ext.get(h):h}}}());Ext.apply(Ext.Element.prototype,function(){var c=Ext.getDom,a=Ext.get,b=Ext.DomHelper;return{insertSibling:function(i,g,h){var j=this,e,d=(g||"before").toLowerCase()=="after",k;if(Ext.isArray(i)){k=j;Ext.each(i,function(l){e=Ext.fly(k,"_internal").insertSibling(l,g,h);if(d){k=e}});return e}i=i||{};if(i.nodeType||i.dom){e=j.dom.parentNode.insertBefore(c(i),d?j.dom.nextSibling:j.dom);if(!h){e=a(e)}}else{if(d&&!j.dom.nextSibling){e=b.append(j.dom.parentNode,i,!h)}else{e=b[d?"insertAfter":"insertBefore"](j.dom,i,!h)}}return e}}}());Ext.Element.addMethods(function(){var h={},y=/(-[a-z])/gi,b={},s=document.defaultView,u=Ext.isIE?"styleFloat":"cssFloat",D=/alpha\(opacity=(.*)\)/i,l=/^\s+|\s+$/g,B=Ext.Element,d="padding",c="margin",z="border",t="-left",q="-right",x="-top",o="-bottom",j="-width",r=Math,A="hidden",e="isClipped",k="overflow",n="overflow-x",m="overflow-y",C="originalClip",i={l:z+t+j,r:z+q+j,t:z+x+j,b:z+o+j},g={l:d+t,r:d+q,t:d+x,b:d+o},a={l:c+t,r:c+q,t:c+x,b:c+o},E=Ext.Element.data;function p(F,G){return G.charAt(1).toUpperCase()}function v(F){return h[F]||(h[F]=F=="float"?u:F.replace(y,p))}return{adjustWidth:function(F){var G=this;var H=Ext.isNumber(F);if(H&&G.autoBoxAdjust&&!G.isBorderBox()){F-=(G.getBorderWidth("lr")+G.getPadding("lr"))}return(H&&F<0)?0:F},adjustHeight:function(F){var G=this;var H=Ext.isNumber(F);if(H&&G.autoBoxAdjust&&!G.isBorderBox()){F-=(G.getBorderWidth("tb")+G.getPadding("tb"))}return(H&&F<0)?0:F},addClass:function(I){var J=this,H,F,G;I=Ext.isArray(I)?I:[I];for(H=0,F=I.length;H5?H.toLowerCase():G)},setStyle:function(J,I){var G,H,F;if(!Ext.isObject(J)){G={};G[J]=I;J=G}for(H in J){I=J[H];H=="opacity"?this.setOpacity(I):this.dom.style[v(H)]=I}return this},setOpacity:function(G,F){var J=this,H=J.dom.style;if(!F||!J.anim){if(Ext.isIE){var I=G<1?"alpha(opacity="+G*100+")":"",K=H.filter.replace(D,"").replace(l,"");H.zoom=1;H.filter=K+(K.length>0?" ":"")+I}else{H.opacity=G}}else{J.anim({opacity:{to:G}},J.preanim(arguments,1),null,0.35,"easeIn")}return J},clearOpacity:function(){var F=this.dom.style;if(Ext.isIE){if(!Ext.isEmpty(F.filter)){F.filter=F.filter.replace(D,"").replace(l,"")}}else{F.opacity=F["-moz-opacity"]=F["-khtml-opacity"]=""}return this},getHeight:function(H){var G=this,J=G.dom,I=Ext.isIE&&G.isStyle("display","none"),F=r.max(J.offsetHeight,I?0:J.clientHeight)||0;F=!H?F:F-G.getBorderWidth("tb")-G.getPadding("tb");return F<0?0:F},getWidth:function(G){var H=this,J=H.dom,I=Ext.isIE&&H.isStyle("display","none"),F=r.max(J.offsetWidth,I?0:J.clientWidth)||0;F=!G?F:F-H.getBorderWidth("lr")-H.getPadding("lr");return F<0?0:F},setWidth:function(G,F){var H=this;G=H.adjustWidth(G);!F||!H.anim?H.dom.style.width=H.addUnits(G):H.anim({width:{to:G}},H.preanim(arguments,1));return H},setHeight:function(F,G){var H=this;F=H.adjustHeight(F);!G||!H.anim?H.dom.style.height=H.addUnits(F):H.anim({height:{to:F}},H.preanim(arguments,1));return H},getBorderWidth:function(F){return this.addStyles(F,i)},getPadding:function(F){return this.addStyles(F,g)},clip:function(){var F=this,G=F.dom;if(!E(G,e)){E(G,e,true);E(G,C,{o:F.getStyle(k),x:F.getStyle(n),y:F.getStyle(m)});F.setStyle(k,A);F.setStyle(n,A);F.setStyle(m,A)}return F},unclip:function(){var F=this,H=F.dom;if(E(H,e)){E(H,e,false);var G=E(H,C);if(G.o){F.setStyle(k,G.o)}if(G.x){F.setStyle(n,G.x)}if(G.y){F.setStyle(m,G.y)}}return F},addStyles:function(K,J){var L=0,G=K.match(/\w/g),I;for(var H=0,F=G.length;H"+String.format(Ext.Element.boxMarkup,c)+""));Ext.DomQuery.selectNode("."+c+"-mc",d.dom).appendChild(this.dom);return d},setSize:function(e,c,d){var g=this;if(Ext.isObject(e)){c=e.height;e=e.width}e=g.adjustWidth(e);c=g.adjustHeight(c);if(!d||!g.anim){g.dom.style.width=g.addUnits(e);g.dom.style.height=g.addUnits(c)}else{g.anim({width:{to:e},height:{to:c}},g.preanim(arguments,2))}return g},getComputedHeight:function(){var d=this,c=Math.max(d.dom.offsetHeight,d.dom.clientHeight);if(!c){c=parseFloat(d.getStyle("height"))||0;if(!d.isBorderBox()){c+=d.getFrameWidth("tb")}}return c},getComputedWidth:function(){var c=Math.max(this.dom.offsetWidth,this.dom.clientWidth);if(!c){c=parseFloat(this.getStyle("width"))||0;if(!this.isBorderBox()){c+=this.getFrameWidth("lr")}}return c},getFrameWidth:function(d,c){return c&&this.isBorderBox()?0:(this.getPadding(d)+this.getBorderWidth(d))},addClassOnOver:function(c){this.hover(function(){Ext.fly(this,a).addClass(c)},function(){Ext.fly(this,a).removeClass(c)});return this},addClassOnFocus:function(c){this.on("focus",function(){Ext.fly(this,a).addClass(c)},this.dom);this.on("blur",function(){Ext.fly(this,a).removeClass(c)},this.dom);return this},addClassOnClick:function(c){var d=this.dom;this.on("mousedown",function(){Ext.fly(d,a).addClass(c);var g=Ext.getDoc(),e=function(){Ext.fly(d,a).removeClass(c);g.removeListener("mouseup",e)};g.on("mouseup",e)});return this},getViewSize:function(){var g=document,h=this.dom,c=(h==g||h==g.body);if(c){var e=Ext.lib.Dom;return{width:e.getViewWidth(),height:e.getViewHeight()}}else{return{width:h.clientWidth,height:h.clientHeight}}},getStyleSize:function(){var j=this,c,i,l=document,m=this.dom,e=(m==l||m==l.body),g=m.style;if(e){var k=Ext.lib.Dom;return{width:k.getViewWidth(),height:k.getViewHeight()}}if(g.width&&g.width!="auto"){c=parseFloat(g.width);if(j.isBorderBox()){c-=j.getFrameWidth("lr")}}if(g.height&&g.height!="auto"){i=parseFloat(g.height);if(j.isBorderBox()){i-=j.getFrameWidth("tb")}}return{width:c||j.getWidth(true),height:i||j.getHeight(true)}},getSize:function(c){return{width:this.getWidth(c),height:this.getHeight(c)}},repaint:function(){var c=this.dom;this.addClass("x-repaint");setTimeout(function(){Ext.fly(c).removeClass("x-repaint")},1);return this},unselectable:function(){this.dom.unselectable="on";return this.swallowEvent("selectstart",true).applyStyles("-moz-user-select:none;-khtml-user-select:none;").addClass("x-unselectable")},getMargins:function(d){var e=this,c,g={t:"top",l:"left",r:"right",b:"bottom"},h={};if(!d){for(c in e.margins){h[g[c]]=parseFloat(e.getStyle(e.margins[c]))||0}return h}else{return e.addStyles.call(e,d,e.margins)}}}}());(function(){var a=Ext.lib.Dom,b="left",g="right",d="top",i="bottom",h="position",c="static",e="relative",j="auto",k="z-index";Ext.Element.addMethods({getX:function(){return a.getX(this.dom)},getY:function(){return a.getY(this.dom)},getXY:function(){return a.getXY(this.dom)},getOffsetsTo:function(l){var n=this.getXY(),m=Ext.fly(l,"_internal").getXY();return[n[0]-m[0],n[1]-m[1]]},setX:function(l,m){return this.setXY([l,this.getY()],this.animTest(arguments,m,1))},setY:function(m,l){return this.setXY([this.getX(),m],this.animTest(arguments,l,1))},setLeft:function(l){this.setStyle(b,this.addUnits(l));return this},setTop:function(l){this.setStyle(d,this.addUnits(l));return this},setRight:function(l){this.setStyle(g,this.addUnits(l));return this},setBottom:function(l){this.setStyle(i,this.addUnits(l));return this},setXY:function(n,l){var m=this;if(!l||!m.anim){a.setXY(m.dom,n)}else{m.anim({points:{to:n}},m.preanim(arguments,1),"motion")}return m},setLocation:function(l,n,m){return this.setXY([l,n],this.animTest(arguments,m,2))},moveTo:function(l,n,m){return this.setXY([l,n],this.animTest(arguments,m,2))},getLeft:function(l){return !l?this.getX():parseInt(this.getStyle(b),10)||0},getRight:function(l){var m=this;return !l?m.getX()+m.getWidth():(m.getLeft(true)+m.getWidth())||0},getTop:function(l){return !l?this.getY():parseInt(this.getStyle(d),10)||0},getBottom:function(l){var m=this;return !l?m.getY()+m.getHeight():(m.getTop(true)+m.getHeight())||0},position:function(p,o,l,n){var m=this;if(!p&&m.isStyle(h,c)){m.setStyle(h,e)}else{if(p){m.setStyle(h,p)}}if(o){m.setStyle(k,o)}if(l||n){m.setXY([l||false,n||false])}},clearPositioning:function(l){l=l||"";this.setStyle({left:l,right:l,top:l,bottom:l,"z-index":"",position:c});return this},getPositioning:function(){var m=this.getStyle(b);var n=this.getStyle(d);return{position:this.getStyle(h),left:m,right:m?"":this.getStyle(g),top:n,bottom:n?"":this.getStyle(i),"z-index":this.getStyle(k)}},setPositioning:function(l){var n=this,m=n.dom.style;n.setStyle(l);if(l.right==j){m.right=""}if(l.bottom==j){m.bottom=""}return n},translatePoints:function(m,u){u=isNaN(m[1])?u:m[1];m=isNaN(m[0])?m:m[0];var q=this,r=q.isStyle(h,e),s=q.getXY(),n=parseInt(q.getStyle(b),10),p=parseInt(q.getStyle(d),10);n=!isNaN(n)?n:(r?0:q.dom.offsetLeft);p=!isNaN(p)?p:(r?0:q.dom.offsetTop);return{left:(m-s[0]+n),top:(u-s[1]+p)}},animTest:function(m,l,n){return !!l&&this.preanim?this.preanim(m,n):false}})})();Ext.Element.addMethods({setBox:function(e,g,b){var d=this,a=e.width,c=e.height;if((g&&!d.autoBoxAdjust)&&!d.isBorderBox()){a-=(d.getBorderWidth("lr")+d.getPadding("lr"));c-=(d.getBorderWidth("tb")+d.getPadding("tb"))}d.setBounds(e.x,e.y,a,c,d.animTest.call(d,arguments,b,2));return d},getBox:function(j,p){var m=this,v,e,o,d=m.getBorderWidth,q=m.getPadding,g,a,u,n;if(!p){v=m.getXY()}else{e=parseInt(m.getStyle("left"),10)||0;o=parseInt(m.getStyle("top"),10)||0;v=[e,o]}var c=m.dom,s=c.offsetWidth,i=c.offsetHeight,k;if(!j){k={x:v[0],y:v[1],0:v[0],1:v[1],width:s,height:i}}else{g=d.call(m,"l")+q.call(m,"l");a=d.call(m,"r")+q.call(m,"r");u=d.call(m,"t")+q.call(m,"t");n=d.call(m,"b")+q.call(m,"b");k={x:v[0]+g,y:v[1]+u,0:v[0]+g,1:v[1]+u,width:s-(g+a),height:i-(u+n)}}k.right=k.x+k.width;k.bottom=k.y+k.height;return k},move:function(j,b,c){var g=this,m=g.getXY(),k=m[0],i=m[1],d=[k-b,i],l=[k+b,i],h=[k,i-b],a=[k,i+b],e={l:d,left:d,r:l,right:l,t:h,top:h,up:h,b:a,bottom:a,down:a};j=j.toLowerCase();g.moveTo(e[j][0],e[j][1],g.animTest.call(g,arguments,c,2))},setLeftTop:function(d,c){var b=this,a=b.dom.style;a.left=b.addUnits(d);a.top=b.addUnits(c);return b},getRegion:function(){return Ext.lib.Dom.getRegion(this.dom)},setBounds:function(b,g,d,a,c){var e=this;if(!c||!e.anim){e.setSize(d,a);e.setLocation(b,g)}else{e.anim({points:{to:[b,g]},width:{to:e.adjustWidth(d)},height:{to:e.adjustHeight(a)}},e.preanim(arguments,4),"motion")}return e},setRegion:function(b,a){return this.setBounds(b.left,b.top,b.right-b.left,b.bottom-b.top,this.animTest.call(this,arguments,a,1))}});Ext.Element.addMethods({isScrollable:function(){var a=this.dom;return a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth},scrollTo:function(a,b){this.dom["scroll"+(/top/i.test(a)?"Top":"Left")]=b;return this},getScroll:function(){var i=this.dom,h=document,a=h.body,c=h.documentElement,b,g,e;if(i==h||i==a){if(Ext.isIE&&Ext.isStrict){b=c.scrollLeft;g=c.scrollTop}else{b=window.pageXOffset;g=window.pageYOffset}e={left:b||(a?a.scrollLeft:0),top:g||(a?a.scrollTop:0)}}else{e={left:i.scrollLeft,top:i.scrollTop}}return e}});Ext.Element.addMethods({scrollTo:function(b,d,a){var e=/top/i.test(b),c=this,g=c.dom,h;if(!a||!c.anim){h="scroll"+(e?"Top":"Left"),g[h]=d}else{h="scroll"+(e?"Left":"Top"),c.anim({scroll:{to:e?[g[h],d]:[d,g[h]]}},c.preanim(arguments,2),"scroll")}return c},scrollIntoView:function(e,i){var p=Ext.getDom(e)||Ext.getBody().dom,h=this.dom,g=this.getOffsetsTo(p),k=g[0]+p.scrollLeft,u=g[1]+p.scrollTop,q=u+h.offsetHeight,d=k+h.offsetWidth,a=p.clientHeight,m=parseInt(p.scrollTop,10),s=parseInt(p.scrollLeft,10),j=m+a,n=s+p.clientWidth;if(h.offsetHeight>a||uj){p.scrollTop=q-a}}p.scrollTop=p.scrollTop;if(i!==false){if(h.offsetWidth>p.clientWidth||kn){p.scrollLeft=d-p.clientWidth}}p.scrollLeft=p.scrollLeft}return this},scrollChildIntoView:function(b,a){Ext.fly(b,"_scrollChildIntoView").scrollIntoView(this,a)},scroll:function(m,b,d){if(!this.isScrollable()){return}var e=this.dom,g=e.scrollLeft,p=e.scrollTop,n=e.scrollWidth,k=e.scrollHeight,i=e.clientWidth,a=e.clientHeight,c=false,o,j={l:Math.min(g+b,n-i),r:o=Math.max(g-b,0),t:Math.max(p-b,0),b:Math.min(p+b,k-a)};j.d=j.b;j.u=j.t;m=m.substr(0,1);if((o=j[m])>-1){c=true;this.scrollTo(m=="l"||m=="r"?"left":"top",o,this.preanim(arguments,2))}return c}});Ext.Element.VISIBILITY=1;Ext.Element.DISPLAY=2;Ext.Element.addMethods(function(){var h="visibility",d="display",b="hidden",k="offsets",j="none",a="originalDisplay",c="visibilityMode",e=Ext.Element.DISPLAY,g=Ext.Element.data,i=function(n){var m=g(n,a);if(m===undefined){g(n,a,m="")}return m},l=function(o){var n=g(o,c);if(n===undefined){g(o,c,n=1)}return n};return{originalDisplay:"",visibilityMode:1,setVisibilityMode:function(m){g(this.dom,c,m);return this},animate:function(n,p,o,q,m){this.anim(n,{duration:p,callback:o,easing:q},m);return this},anim:function(p,q,n,s,o,m){n=n||"run";q=q||{};var r=this,t=Ext.lib.Anim[n](r.dom,p,(q.duration||s)||0.35,(q.easing||o)||"easeOut",function(){if(m){m.call(r)}if(q.callback){q.callback.call(q.scope||r,r,q)}},r);q.anim=t;return t},preanim:function(m,n){return !m[n]?false:(Ext.isObject(m[n])?m[n]:{duration:m[n+1],callback:m[n+2],easing:m[n+3]})},isVisible:function(){return !this.isStyle(h,b)&&!this.isStyle(d,j)},setVisible:function(r,o){var p=this,n,m,s,q=p.dom;if(Ext.isString(o)){n=o==d;m=o==h;s=o==k;o=false}else{n=l(this.dom)==e;m=!n}if(!o||!p.anim){if(n){p.setDisplayed(r)}else{if(s){if(!r){p.hideModeStyles={position:p.getStyle("position"),top:p.getStyle("top"),left:p.getStyle("left")};p.applyStyles({position:"absolute",top:"-10000px",left:"-10000px"})}else{p.applyStyles(p.hideModeStyles||{position:"",top:"",left:""})}}else{p.fixDisplay();q.style.visibility=r?"visible":b}}}else{if(r){p.setOpacity(0.01);p.setVisible(true)}p.anim({opacity:{to:(r?1:0)}},p.preanim(arguments,1),null,0.35,"easeIn",function(){if(!r){q.style[n?d:h]=(n)?j:b;Ext.fly(q).setOpacity(1)}})}return p},toggle:function(m){var n=this;n.setVisible(!n.isVisible(),n.preanim(arguments,0));return n},setDisplayed:function(m){if(typeof m=="boolean"){m=m?i(this.dom):j}this.setStyle(d,m);return this},fixDisplay:function(){var m=this;if(m.isStyle(d,j)){m.setStyle(h,b);m.setStyle(d,i(this.dom));if(m.isStyle(d,j)){m.setStyle(d,"block")}}},hide:function(m){if(Ext.isString(m)){this.setVisible(false,m);return this}this.setVisible(false,this.preanim(arguments,0));return this},show:function(m){if(Ext.isString(m)){this.setVisible(true,m);return this}this.setVisible(true,this.preanim(arguments,0));return this}}}());Ext.Element.addMethods(function(){var d="visibility",b="display",a="hidden",h="none",c="x-masked",g="x-masked-relative",e=Ext.Element.data;return{isVisible:function(i){var j=!this.isStyle(d,a)&&!this.isStyle(b,h),k=this.dom.parentNode;if(i!==true||!j){return j}while(k&&!/^body/i.test(k.tagName)){if(!Ext.fly(k,"_isVisible").isVisible()){return false}k=k.parentNode}return true},isDisplayed:function(){return !this.isStyle(b,h)},enableDisplayMode:function(i){this.setVisibilityMode(Ext.Element.DISPLAY);if(!Ext.isEmpty(i)){e(this.dom,"originalDisplay",i)}return this},mask:function(j,n){var p=this,l=p.dom,o=Ext.DomHelper,m="ext-el-mask-msg",i,q;if(!/^body/i.test(l.tagName)&&p.getStyle("position")=="static"){p.addClass(g)}if((i=e(l,"maskMsg"))){i.remove()}if((i=e(l,"mask"))){i.remove()}q=o.append(l,{cls:"ext-el-mask"},true);e(l,"mask",q);p.addClass(c);q.setDisplayed(true);if(typeof j=="string"){var k=o.append(l,{cls:m,cn:{tag:"div"}},true);e(l,"maskMsg",k);k.dom.className=n?m+" "+n:m;k.dom.firstChild.innerHTML=j;k.setDisplayed(true);k.center(p)}if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&p.getStyle("height")=="auto"){q.setSize(undefined,p.getHeight())}return q},unmask:function(){var k=this,l=k.dom,i=e(l,"mask"),j=e(l,"maskMsg");if(i){if(j){j.remove();e(l,"maskMsg",undefined)}i.remove();e(l,"mask",undefined)}k.removeClass([c,g])},isMasked:function(){var i=e(this.dom,"mask");return i&&i.isVisible()},createShim:function(){var i=document.createElement("iframe"),j;i.frameBorder="0";i.className="ext-shim";i.src=Ext.SSL_SECURE_URL;j=Ext.get(this.dom.parentNode.insertBefore(i,this.dom));j.autoBoxAdjust=false;return j}}}());Ext.Element.addMethods({addKeyListener:function(b,d,c){var a;if(!Ext.isObject(b)||Ext.isArray(b)){a={key:b,fn:d,scope:c}}else{a={key:b.key,shift:b.shift,ctrl:b.ctrl,alt:b.alt,fn:d,scope:c}}return new Ext.KeyMap(this,a)},addKeyMap:function(a){return new Ext.KeyMap(this,a)}});(function(){var z=null,B=undefined,k=true,t=false,j="setX",h="setY",a="setXY",n="left",l="bottom",s="top",m="right",q="height",g="width",i="points",x="hidden",A="absolute",u="visible",e="motion",o="position",r="easeOut",d=new Ext.Element.Flyweight(),v={},y=function(C){return C||{}},p=function(C){d.dom=C;d.id=Ext.id(C);return d},c=function(C){if(!v[C]){v[C]=[]}return v[C]},b=function(D,C){v[D]=C};Ext.enableFx=k;Ext.Fx={switchStatements:function(D,E,C){return E.apply(this,C[D])},slideIn:function(I,F){F=y(F);var K=this,H=K.dom,N=H.style,P,C,M,E,D,N,J,O,L,G;I=I||"t";K.queueFx(F,function(){P=p(H).getXY();p(H).fixDisplay();C=p(H).getFxRestore();M={x:P[0],y:P[1],0:P[0],1:P[1],width:H.offsetWidth,height:H.offsetHeight};M.right=M.x+M.width;M.bottom=M.y+M.height;p(H).setWidth(M.width).setHeight(M.height);E=p(H).fxWrap(C.pos,F,x);N.visibility=u;N.position=A;function Q(){p(H).fxUnwrap(E,C.pos,F);N.width=C.width;N.height=C.height;p(H).afterFx(F)}O={to:[M.x,M.y]};L={to:M.width};G={to:M.height};function R(V,S,W,T,Y,aa,ad,ac,ab,X,U){var Z={};p(V).setWidth(W).setHeight(T);if(p(V)[Y]){p(V)[Y](aa)}S[ad]=S[ac]="0";if(ab){Z.width=ab}if(X){Z.height=X}if(U){Z.points=U}return Z}J=p(H).switchStatements(I.toLowerCase(),R,{t:[E,N,M.width,0,z,z,n,l,z,G,z],l:[E,N,0,M.height,z,z,m,s,L,z,z],r:[E,N,M.width,M.height,j,M.right,n,s,z,z,O],b:[E,N,M.width,M.height,h,M.bottom,n,s,z,G,O],tl:[E,N,0,0,z,z,m,l,L,G,O],bl:[E,N,0,0,h,M.y+M.height,m,s,L,G,O],br:[E,N,0,0,a,[M.right,M.bottom],n,s,L,G,O],tr:[E,N,0,0,j,M.x+M.width,n,l,L,G,O]});N.visibility=u;p(E).show();arguments.callee.anim=p(E).fxanim(J,F,e,0.5,r,Q)});return K},slideOut:function(G,E){E=y(E);var I=this,F=I.dom,L=F.style,M=I.getXY(),D,C,J,K,H={to:0};G=G||"t";I.queueFx(E,function(){C=p(F).getFxRestore();J={x:M[0],y:M[1],0:M[0],1:M[1],width:F.offsetWidth,height:F.offsetHeight};J.right=J.x+J.width;J.bottom=J.y+J.height;p(F).setWidth(J.width).setHeight(J.height);D=p(F).fxWrap(C.pos,E,u);L.visibility=u;L.position=A;p(D).setWidth(J.width).setHeight(J.height);function N(){E.useDisplay?p(F).setDisplayed(t):p(F).hide();p(F).fxUnwrap(D,C.pos,E);L.width=C.width;L.height=C.height;p(F).afterFx(E)}function O(P,X,V,Y,T,W,S,U,R){var Q={};P[X]=P[V]="0";Q[Y]=T;if(W){Q[W]=S}if(U){Q[U]=R}return Q}K=p(F).switchStatements(G.toLowerCase(),O,{t:[L,n,l,q,H],l:[L,m,s,g,H],r:[L,n,s,g,H,i,{to:[J.right,J.y]}],b:[L,n,s,q,H,i,{to:[J.x,J.bottom]}],tl:[L,m,l,g,H,q,H],bl:[L,m,s,g,H,q,H,i,{to:[J.x,J.bottom]}],br:[L,n,s,g,H,q,H,i,{to:[J.x+J.width,J.bottom]}],tr:[L,n,l,g,H,q,H,i,{to:[J.right,J.y]}]});arguments.callee.anim=p(D).fxanim(K,E,e,0.5,r,N)});return I},puff:function(I){I=y(I);var G=this,H=G.dom,D=H.style,E,C,F;G.queueFx(I,function(){E=p(H).getWidth();C=p(H).getHeight();p(H).clearOpacity();p(H).show();F=p(H).getFxRestore();function J(){I.useDisplay?p(H).setDisplayed(t):p(H).hide();p(H).clearOpacity();p(H).setPositioning(F.pos);D.width=F.width;D.height=F.height;D.fontSize="";p(H).afterFx(I)}arguments.callee.anim=p(H).fxanim({width:{to:p(H).adjustWidth(E*2)},height:{to:p(H).adjustHeight(C*2)},points:{by:[-E*0.5,-C*0.5]},opacity:{to:0},fontSize:{to:200,unit:"%"}},I,e,0.5,r,J)});return G},switchOff:function(G){G=y(G);var E=this,F=E.dom,C=F.style,D;E.queueFx(G,function(){p(F).clearOpacity();p(F).clip();D=p(F).getFxRestore();function H(){G.useDisplay?p(F).setDisplayed(t):p(F).hide();p(F).clearOpacity();p(F).setPositioning(D.pos);C.width=D.width;C.height=D.height;p(F).afterFx(G)}p(F).fxanim({opacity:{to:0.3}},z,z,0.1,z,function(){p(F).clearOpacity();(function(){p(F).fxanim({height:{to:1},points:{by:[0,p(F).getHeight()*0.5]}},G,e,0.3,"easeIn",H)}).defer(100)})});return E},highlight:function(E,I){I=y(I);var G=this,H=G.dom,C=I.attr||"backgroundColor",D={},F;G.queueFx(I,function(){p(H).clearOpacity();p(H).show();function J(){H.style[C]=F;p(H).afterFx(I)}F=H.style[C];D[C]={from:E||"ffff9c",to:I.endColor||p(H).getColor(C)||"ffffff"};arguments.callee.anim=p(H).fxanim(D,I,"color",1,"easeIn",J)});return G},frame:function(C,F,I){I=y(I);var E=this,H=E.dom,D,G;E.queueFx(I,function(){C=C||"#C3DAF9";if(C.length==6){C="#"+C}F=F||1;p(H).show();var M=p(H).getXY(),K={x:M[0],y:M[1],0:M[0],1:M[1],width:H.offsetWidth,height:H.offsetHeight},J=function(){D=p(document.body||document.documentElement).createChild({style:{position:A,"z-index":35000,border:"0px solid "+C}});return D.queueFx({},L)};arguments.callee.anim={isAnimated:true,stop:function(){F=0;D.stopFx()}};function L(){var N=Ext.isBorderBox?2:1;G=D.anim({top:{from:K.y,to:K.y-20},left:{from:K.x,to:K.x-20},borderWidth:{from:0,to:10},opacity:{from:1,to:0},height:{from:K.height,to:K.height+20*N},width:{from:K.width,to:K.width+20*N}},{duration:I.duration||1,callback:function(){D.remove();--F>0?J():p(H).afterFx(I)}});arguments.callee.anim={isAnimated:true,stop:function(){G.stop()}}}J()});return E},pause:function(E){var D=this.dom,C;this.queueFx({},function(){C=setTimeout(function(){p(D).afterFx({})},E*1000);arguments.callee.anim={isAnimated:true,stop:function(){clearTimeout(C);p(D).afterFx({})}}});return this},fadeIn:function(E){E=y(E);var C=this,D=C.dom,F=E.endOpacity||1;C.queueFx(E,function(){p(D).setOpacity(0);p(D).fixDisplay();D.style.visibility=u;arguments.callee.anim=p(D).fxanim({opacity:{to:F}},E,z,0.5,r,function(){if(F==1){p(D).clearOpacity()}p(D).afterFx(E)})});return C},fadeOut:function(F){F=y(F);var D=this,E=D.dom,C=E.style,G=F.endOpacity||0;D.queueFx(F,function(){arguments.callee.anim=p(E).fxanim({opacity:{to:G}},F,z,0.5,r,function(){if(G==0){Ext.Element.data(E,"visibilityMode")==Ext.Element.DISPLAY||F.useDisplay?C.display="none":C.visibility=x;p(E).clearOpacity()}p(E).afterFx(F)})});return D},scale:function(C,D,E){this.shift(Ext.apply({},E,{width:C,height:D}));return this},shift:function(E){E=y(E);var D=this.dom,C={};this.queueFx(E,function(){for(var F in E){if(E[F]!=B){C[F]={to:E[F]}}}C.width?C.width.to=p(D).adjustWidth(E.width):C;C.height?C.height.to=p(D).adjustWidth(E.height):C;if(C.x||C.y||C.xy){C.points=C.xy||{to:[C.x?C.x.to:p(D).getX(),C.y?C.y.to:p(D).getY()]}}arguments.callee.anim=p(D).fxanim(C,E,e,0.35,r,function(){p(D).afterFx(E)})});return this},ghost:function(F,D){D=y(D);var H=this,E=H.dom,K=E.style,I={opacity:{to:0},points:{}},L=I.points,C,J,G;F=F||"b";H.queueFx(D,function(){C=p(E).getFxRestore();J=p(E).getWidth();G=p(E).getHeight();function M(){D.useDisplay?p(E).setDisplayed(t):p(E).hide();p(E).clearOpacity();p(E).setPositioning(C.pos);K.width=C.width;K.height=C.height;p(E).afterFx(D)}L.by=p(E).switchStatements(F.toLowerCase(),function(O,N){return[O,N]},{t:[0,-G],l:[-J,0],r:[J,0],b:[0,G],tl:[-J,-G],bl:[-J,G],br:[J,G],tr:[J,-G]});arguments.callee.anim=p(E).fxanim(I,D,e,0.5,r,M)});return H},syncFx:function(){var C=this;C.fxDefaults=Ext.apply(C.fxDefaults||{},{block:t,concurrent:k,stopFx:t});return C},sequenceFx:function(){var C=this;C.fxDefaults=Ext.apply(C.fxDefaults||{},{block:t,concurrent:t,stopFx:t});return C},nextFx:function(){var C=c(this.dom.id)[0];if(C){C.call(this)}},hasActiveFx:function(){return c(this.dom.id)[0]},stopFx:function(C){var D=this,F=D.dom.id;if(D.hasActiveFx()){var E=c(F)[0];if(E&&E.anim){if(E.anim.isAnimated){b(F,[E]);E.anim.stop(C!==undefined?C:k)}else{b(F,[])}}}return D},beforeFx:function(C){if(this.hasActiveFx()&&!C.concurrent){if(C.stopFx){this.stopFx();return k}return t}return k},hasFxBlock:function(){var C=c(this.dom.id);return C&&C[0]&&C[0].block},queueFx:function(F,C){var D=p(this.dom);if(!D.hasFxBlock()){Ext.applyIf(F,D.fxDefaults);if(!F.concurrent){var E=D.beforeFx(F);C.block=F.block;c(D.dom.id).push(C);if(E){D.nextFx()}}else{C.call(D)}}return D},fxWrap:function(I,G,E){var F=this.dom,D,C;if(!G.wrap||!(D=Ext.getDom(G.wrap))){if(G.fixPosition){C=p(F).getXY()}var H=document.createElement("div");H.style.visibility=E;D=F.parentNode.insertBefore(H,F);p(D).setPositioning(I);if(p(D).isStyle(o,"static")){p(D).position("relative")}p(F).clearPositioning("auto");p(D).clip();D.appendChild(F);if(C){p(D).setXY(C)}}return D},fxUnwrap:function(D,G,F){var E=this.dom;p(E).clearPositioning();p(E).setPositioning(G);if(!F.wrap){var C=p(D).dom.parentNode;C.insertBefore(E,D);p(D).remove()}},getFxRestore:function(){var C=this.dom.style;return{pos:this.getPositioning(),width:C.width,height:C.height}},afterFx:function(D){var C=this.dom,E=C.id;if(D.afterStyle){p(C).setStyle(D.afterStyle)}if(D.afterCls){p(C).addClass(D.afterCls)}if(D.remove==k){p(C).remove()}if(D.callback){D.callback.call(D.scope,p(C))}if(!D.concurrent){c(E).shift();p(C).nextFx()}},fxanim:function(F,G,D,H,E,C){D=D||"run";G=G||{};var I=Ext.lib.Anim[D](this.dom,F,(G.duration||H)||0.35,(G.easing||E)||r,C,this);G.anim=I;return I}};Ext.Fx.resize=Ext.Fx.scale;Ext.Element.addMethods(Ext.Fx)})();Ext.CompositeElementLite=function(b,a){this.elements=[];this.add(b,a);this.el=new Ext.Element.Flyweight()};Ext.CompositeElementLite.prototype={isComposite:true,getElement:function(a){var b=this.el;b.dom=a;b.id=a.id;return b},transformElement:function(a){return Ext.getDom(a)},getCount:function(){return this.elements.length},add:function(d,b){var e=this,g=e.elements;if(!d){return this}if(Ext.isString(d)){d=Ext.Element.selectorFunction(d,b)}else{if(d.isComposite){d=d.elements}else{if(!Ext.isIterable(d)){d=[d]}}}for(var c=0,a=d.length;c-1){c=Ext.getDom(c);if(a){g=this.elements[b];g.parentNode.insertBefore(c,g);Ext.removeNode(g)}this.elements.splice(b,1,c)}return this},clear:function(){this.elements=[]}};Ext.CompositeElementLite.prototype.on=Ext.CompositeElementLite.prototype.addListener;(function(){var c,b=Ext.Element.prototype,a=Ext.CompositeElementLite.prototype;for(c in b){if(Ext.isFunction(b[c])){(function(d){a[d]=a[d]||function(){return this.invoke(d,arguments)}}).call(a,c)}}})();if(Ext.DomQuery){Ext.Element.selectorFunction=Ext.DomQuery.select}Ext.Element.select=function(a,b){var c;if(typeof a=="string"){c=Ext.Element.selectorFunction(a,b)}else{if(a.length!==undefined){c=a}else{throw"Invalid selector"}}return new Ext.CompositeElementLite(c)};Ext.select=Ext.Element.select;Ext.apply(Ext.CompositeElementLite.prototype,{addElements:function(c,a){if(!c){return this}if(typeof c=="string"){c=Ext.Element.selectorFunction(c,a)}var b=this.elements;Ext.each(c,function(d){b.push(Ext.get(d))});return this},first:function(){return this.item(0)},last:function(){return this.item(this.getCount()-1)},contains:function(a){return this.indexOf(a)!=-1},removeElement:function(d,e){var c=this,a=this.elements,b;Ext.each(d,function(g){if((b=(a[g]||a[g=c.indexOf(g)]))){if(e){if(b.dom){b.remove()}else{Ext.removeNode(b)}}a.splice(g,1)}});return this}});Ext.CompositeElement=function(b,a){this.elements=[];this.add(b,a)};Ext.extend(Ext.CompositeElement,Ext.CompositeElementLite,{getElement:function(a){return a},transformElement:function(a){return Ext.get(a)}});Ext.Element.select=function(a,d,b){var c;if(typeof a=="string"){c=Ext.Element.selectorFunction(a,b)}else{if(a.length!==undefined){c=a}else{throw"Invalid selector"}}return(d===true)?new Ext.CompositeElement(c):new Ext.CompositeElementLite(c)};Ext.select=Ext.Element.select;(function(){var b="beforerequest",e="requestcomplete",d="requestexception",h=undefined,c="load",i="POST",a="GET",g=window;Ext.data.Connection=function(j){Ext.apply(this,j);this.addEvents(b,e,d);Ext.data.Connection.superclass.constructor.call(this)};Ext.extend(Ext.data.Connection,Ext.util.Observable,{timeout:30000,autoAbort:false,disableCaching:true,disableCachingParam:"_dc",request:function(n){var s=this;if(s.fireEvent(b,s,n)){if(n.el){if(!Ext.isEmpty(n.indicatorText)){s.indicatorText='
'+n.indicatorText+"
"}if(s.indicatorText){Ext.getDom(n.el).innerHTML=s.indicatorText}n.success=(Ext.isFunction(n.success)?n.success:function(){}).createInterceptor(function(o){Ext.getDom(n.el).innerHTML=o.responseText})}var l=n.params,k=n.url||s.url,j,q={success:s.handleResponse,failure:s.handleFailure,scope:s,argument:{options:n},timeout:n.timeout||s.timeout},m,t;if(Ext.isFunction(l)){l=l.call(n.scope||g,n)}l=Ext.urlEncode(s.extraParams,Ext.isObject(l)?Ext.urlEncode(l):l);if(Ext.isFunction(k)){k=k.call(n.scope||g,n)}if((m=Ext.getDom(n.form))){k=k||m.action;if(n.isUpload||/multipart\/form-data/i.test(m.getAttribute("enctype"))){return s.doFormUpload.call(s,n,l,k)}t=Ext.lib.Ajax.serializeForm(m);l=l?(l+"&"+t):t}j=n.method||s.method||((l||n.xmlData||n.jsonData)?i:a);if(j===a&&(s.disableCaching&&n.disableCaching!==false)||n.disableCaching===true){var r=n.disableCachingParam||s.disableCachingParam;k=Ext.urlAppend(k,r+"="+(new Date().getTime()))}n.headers=Ext.apply(n.headers||{},s.defaultHeaders||{});if(n.autoAbort===true||s.autoAbort){s.abort()}if((j==a||n.xmlData||n.jsonData)&&l){k=Ext.urlAppend(k,l);l=""}return(s.transId=Ext.lib.Ajax.request(j,k,q,l,n))}else{return n.callback?n.callback.apply(n.scope,[n,h,h]):null}},isLoading:function(j){return j?Ext.lib.Ajax.isCallInProgress(j):!!this.transId},abort:function(j){if(j||this.isLoading()){Ext.lib.Ajax.abort(j||this.transId)}},handleResponse:function(j){this.transId=false;var k=j.argument.options;j.argument=k?k.argument:null;this.fireEvent(e,this,j,k);if(k.success){k.success.call(k.scope,j,k)}if(k.callback){k.callback.call(k.scope,k,true,j)}},handleFailure:function(j,l){this.transId=false;var k=j.argument.options;j.argument=k?k.argument:null;this.fireEvent(d,this,j,k,l);if(k.failure){k.failure.call(k.scope,j,k)}if(k.callback){k.callback.call(k.scope,k,false,j)}},doFormUpload:function(q,j,k){var l=Ext.id(),v=document,r=v.createElement("iframe"),m=Ext.getDom(q.form),u=[],t,p="multipart/form-data",n={target:m.target,method:m.method,encoding:m.encoding,enctype:m.enctype,action:m.action};Ext.fly(r).set({id:l,name:l,cls:"x-hidden"});v.body.appendChild(r);Ext.fly(r).set({src:Ext.SSL_SECURE_URL});if(Ext.isIE){document.frames[l].name=l}Ext.fly(m).set({target:l,method:i,enctype:p,encoding:p,action:k||n.action});Ext.iterate(Ext.urlDecode(j,false),function(x,o){t=v.createElement("input");Ext.fly(t).set({type:"hidden",value:o,name:x});m.appendChild(t);u.push(t)});function s(){var y=this,x={responseText:"",responseXML:null,argument:q.argument},B,A;try{B=r.contentWindow.document||r.contentDocument||g.frames[l].document;if(B){if(B.body){if(/textarea/i.test((A=B.body.firstChild||{}).tagName)){x.responseText=A.value}else{x.responseText=B.body.innerHTML}}x.responseXML=B.XMLDocument||B}}catch(z){}Ext.EventManager.removeListener(r,c,s,y);y.fireEvent(e,y,x,q);function o(E,D,C){if(Ext.isFunction(E)){E.apply(D,C)}}o(q.success,q.scope,[x,q]);o(q.callback,q.scope,[q,true,x]);if(!y.debugUploads){setTimeout(function(){Ext.removeNode(r)},100)}}Ext.EventManager.on(r,c,s,this);m.submit();Ext.fly(m).set(n);Ext.each(u,function(o){Ext.removeNode(o)})}})})();Ext.Ajax=new Ext.data.Connection({autoAbort:false,serializeForm:function(a){return Ext.lib.Ajax.serializeForm(a)}});Ext.UpdateManager=Ext.Updater=Ext.extend(Ext.util.Observable,function(){var b="beforeupdate",d="update",c="failure";function a(h){var i=this;i.transaction=null;if(h.argument.form&&h.argument.reset){try{h.argument.form.reset()}catch(j){}}if(i.loadScripts){i.renderer.render(i.el,h,i,g.createDelegate(i,[h]))}else{i.renderer.render(i.el,h,i);g.call(i,h)}}function g(h,i,j){this.fireEvent(i||d,this.el,h);if(Ext.isFunction(h.argument.callback)){h.argument.callback.call(h.argument.scope,this.el,Ext.isEmpty(j)?true:false,h,h.argument.options)}}function e(h){g.call(this,h,c,!!(this.transaction=null))}return{constructor:function(i,h){var j=this;i=Ext.get(i);if(!h&&i.updateManager){return i.updateManager}j.el=i;j.defaultUrl=null;j.addEvents(b,d,c);Ext.apply(j,Ext.Updater.defaults);j.transaction=null;j.refreshDelegate=j.refresh.createDelegate(j);j.updateDelegate=j.update.createDelegate(j);j.formUpdateDelegate=(j.formUpdate||function(){}).createDelegate(j);j.renderer=j.renderer||j.getDefaultRenderer();Ext.Updater.superclass.constructor.call(j)},setRenderer:function(h){this.renderer=h},getRenderer:function(){return this.renderer},getDefaultRenderer:function(){return new Ext.Updater.BasicRenderer()},setDefaultUrl:function(h){this.defaultUrl=h},getEl:function(){return this.el},update:function(i,n,p,l){var k=this,h,j;if(k.fireEvent(b,k.el,i,n)!==false){if(Ext.isObject(i)){h=i;i=h.url;n=n||h.params;p=p||h.callback;l=l||h.discardUrl;j=h.scope;if(!Ext.isEmpty(h.nocache)){k.disableCaching=h.nocache}if(!Ext.isEmpty(h.text)){k.indicatorText='
'+h.text+"
"}if(!Ext.isEmpty(h.scripts)){k.loadScripts=h.scripts}if(!Ext.isEmpty(h.timeout)){k.timeout=h.timeout}}k.showLoading();if(!l){k.defaultUrl=i}if(Ext.isFunction(i)){i=i.call(k)}var m=Ext.apply({},{url:i,params:(Ext.isFunction(n)&&j)?n.createDelegate(j):n,success:a,failure:e,scope:k,callback:undefined,timeout:(k.timeout*1000),disableCaching:k.disableCaching,argument:{options:h,url:i,form:null,callback:p,scope:j||window,params:n}},h);k.transaction=Ext.Ajax.request(m)}},formUpdate:function(k,h,j,l){var i=this;if(i.fireEvent(b,i.el,k,h)!==false){if(Ext.isFunction(h)){h=h.call(i)}k=Ext.getDom(k);i.transaction=Ext.Ajax.request({form:k,url:h,success:a,failure:e,scope:i,timeout:(i.timeout*1000),argument:{url:h,form:k,callback:l,reset:j}});i.showLoading.defer(1,i)}},startAutoRefresh:function(i,j,l,m,h){var k=this;if(h){k.update(j||k.defaultUrl,l,m,true)}if(k.autoRefreshProcId){clearInterval(k.autoRefreshProcId)}k.autoRefreshProcId=setInterval(k.update.createDelegate(k,[j||k.defaultUrl,l,m,true]),i*1000)},stopAutoRefresh:function(){if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);delete this.autoRefreshProcId}},isAutoRefreshing:function(){return !!this.autoRefreshProcId},showLoading:function(){if(this.showLoadIndicator){this.el.dom.innerHTML=this.indicatorText}},abort:function(){if(this.transaction){Ext.Ajax.abort(this.transaction)}},isUpdating:function(){return this.transaction?Ext.Ajax.isLoading(this.transaction):false},refresh:function(h){if(this.defaultUrl){this.update(this.defaultUrl,null,h,true)}}}}());Ext.Updater.defaults={timeout:30,disableCaching:false,showLoadIndicator:true,indicatorText:'
Loading...
',loadScripts:false,sslBlankUrl:Ext.SSL_SECURE_URL};Ext.Updater.updateElement=function(d,c,e,b){var a=Ext.get(d).getUpdater();Ext.apply(a,b);a.update(c,e,b?b.callback:null)};Ext.Updater.BasicRenderer=function(){};Ext.Updater.BasicRenderer.prototype={render:function(c,a,b,d){c.update(a.responseText,b.loadScripts,d)}};(function(){Date.useStrict=false;function b(d){var c=Array.prototype.slice.call(arguments,1);return d.replace(/\{(\d+)\}/g,function(e,g){return c[g]})}Date.formatCodeToRegex=function(d,c){var e=Date.parseCodes[d];if(e){e=typeof e=="function"?e():e;Date.parseCodes[d]=e}return e?Ext.applyIf({c:e.c?b(e.c,c||"{0}"):e.c},e):{g:0,c:null,s:Ext.escapeRe(d)}};var a=Date.formatCodeToRegex;Ext.apply(Date,{parseFunctions:{"M$":function(d,c){var e=new RegExp("\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/");var g=(d||"").match(e);return g?new Date(((g[1]||"")+g[2])*1):null}},parseRegexes:[],formatFunctions:{"M$":function(){return"\\/Date("+this.getTime()+")\\/"}},y2kYear:50,MILLI:"ms",SECOND:"s",MINUTE:"mi",HOUR:"h",DAY:"d",MONTH:"mo",YEAR:"y",defaults:{},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNumbers:{Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11},getShortMonthName:function(c){return Date.monthNames[c].substring(0,3)},getShortDayName:function(c){return Date.dayNames[c].substring(0,3)},getMonthNumber:function(c){return Date.monthNumbers[c.substring(0,1).toUpperCase()+c.substring(1,3).toLowerCase()]},formatCodes:{d:"String.leftPad(this.getDate(), 2, '0')",D:"Date.getShortDayName(this.getDay())",j:"this.getDate()",l:"Date.dayNames[this.getDay()]",N:"(this.getDay() ? this.getDay() : 7)",S:"this.getSuffix()",w:"this.getDay()",z:"this.getDayOfYear()",W:"String.leftPad(this.getWeekOfYear(), 2, '0')",F:"Date.monthNames[this.getMonth()]",m:"String.leftPad(this.getMonth() + 1, 2, '0')",M:"Date.getShortMonthName(this.getMonth())",n:"(this.getMonth() + 1)",t:"this.getDaysInMonth()",L:"(this.isLeapYear() ? 1 : 0)",o:"(this.getFullYear() + (this.getWeekOfYear() == 1 && this.getMonth() > 0 ? +1 : (this.getWeekOfYear() >= 52 && this.getMonth() < 11 ? -1 : 0)))",Y:"this.getFullYear()",y:"('' + this.getFullYear()).substring(2, 4)",a:"(this.getHours() < 12 ? 'am' : 'pm')",A:"(this.getHours() < 12 ? 'AM' : 'PM')",g:"((this.getHours() % 12) ? this.getHours() % 12 : 12)",G:"this.getHours()",h:"String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",H:"String.leftPad(this.getHours(), 2, '0')",i:"String.leftPad(this.getMinutes(), 2, '0')",s:"String.leftPad(this.getSeconds(), 2, '0')",u:"String.leftPad(this.getMilliseconds(), 3, '0')",O:"this.getGMTOffset()",P:"this.getGMTOffset(true)",T:"this.getTimezone()",Z:"(this.getTimezoneOffset() * -60)",c:function(){for(var k="Y-m-dTH:i:sP",h=[],g=0,d=k.length;g= 0 && y >= 0){","v = new Date(y, 0, 1, h, i, s, ms);","v = !strict? v : (strict === true && (z <= 364 || (v.isLeapYear() && z <= 365))? v.add(Date.DAY, z) : null);","}else if(strict === true && !Date.isValid(y, m + 1, d, h, i, s, ms)){","v = null;","}else{","v = new Date(y, m, d, h, i, s, ms);","}","}","}","if(v){","if(zz != null){","v = v.add(Date.SECOND, -v.getTimezoneOffset() * 60 - zz);","}else if(o){","v = v.add(Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));","}","}","return v;"].join("\n");return function(m){var e=Date.parseRegexes.length,n=1,g=[],l=[],k=false,d="";for(var j=0;j Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"},a:{g:1,c:"if (results[{0}] == 'am') {\nif (!h || h == 12) { h = 0; }\n} else { if (!h || h < 12) { h = (h || 0) + 12; }}",s:"(am|pm)"},A:{g:1,c:"if (results[{0}] == 'AM') {\nif (!h || h == 12) { h = 0; }\n} else { if (!h || h < 12) { h = (h || 0) + 12; }}",s:"(AM|PM)"},g:function(){return a("G")},G:{g:1,c:"h = parseInt(results[{0}], 10);\n",s:"(\\d{1,2})"},h:function(){return a("H")},H:{g:1,c:"h = parseInt(results[{0}], 10);\n",s:"(\\d{2})"},i:{g:1,c:"i = parseInt(results[{0}], 10);\n",s:"(\\d{2})"},s:{g:1,c:"s = parseInt(results[{0}], 10);\n",s:"(\\d{2})"},u:{g:1,c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",s:"(\\d+)"},O:{g:1,c:["o = results[{0}];","var sn = o.substring(0,1),","hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),","mn = o.substring(3,5) % 60;","o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"].join("\n"),s:"([+-]\\d{4})"},P:{g:1,c:["o = results[{0}];","var sn = o.substring(0,1),","hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),","mn = o.substring(4,6) % 60;","o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"].join("\n"),s:"([+-]\\d{2}:\\d{2})"},T:{g:0,c:null,s:"[A-Z]{1,4}"},Z:{g:1,c:"zz = results[{0}] * 1;\nzz = (-43200 <= zz && zz <= 50400)? zz : null;\n",s:"([+-]?\\d{1,5})"},c:function(){var e=[],c=[a("Y",1),a("m",2),a("d",3),a("h",4),a("i",5),a("s",6),{c:"ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"},{c:["if(results[8]) {","if(results[8] == 'Z'){","zz = 0;","}else if (results[8].indexOf(':') > -1){",a("P",8).c,"}else{",a("O",8).c,"}","}"].join("\n")}];for(var g=0,d=c.length;g0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+(a?":":"")+String.leftPad(Math.abs(this.getTimezoneOffset()%60),2,"0")},getDayOfYear:function(){var b=0,e=this.clone(),a=this.getMonth(),c;for(c=0,e.setDate(1),e.setMonth(0);c28){a=Math.min(a,this.getFirstDateOfMonth().add("mo",c).getLastDateOfMonth().getDate())}e.setDate(a);e.setMonth(this.getMonth()+c);break;case Date.YEAR:e.setFullYear(this.getFullYear()+c);break}return e},between:function(c,a){var b=this.getTime();return c.getTime()<=b&&b<=a.getTime()}});Date.prototype.format=Date.prototype.dateFormat;if(Ext.isSafari&&(navigator.userAgent.match(/WebKit\/(\d+)/)[1]||NaN)<420){Ext.apply(Date.prototype,{_xMonth:Date.prototype.setMonth,_xDate:Date.prototype.setDate,setMonth:function(a){if(a<=-1){var d=Math.ceil(-a),c=Math.ceil(d/12),b=(d%12)?12-d%12:0;this.setFullYear(this.getFullYear()-c);return this._xMonth(b)}else{return this._xMonth(a)}},setDate:function(a){return this.setTime(this.getTime()-(this.getDate()-a)*86400000)}})}Ext.util.MixedCollection=function(b,a){this.items=[];this.map={};this.keys=[];this.length=0;this.addEvents("clear","add","replace","remove","sort");this.allowFunctions=b===true;if(a){this.getKey=a}Ext.util.MixedCollection.superclass.constructor.call(this)};Ext.extend(Ext.util.MixedCollection,Ext.util.Observable,{allowFunctions:false,add:function(b,c){if(arguments.length==1){c=arguments[0];b=this.getKey(c)}if(typeof b!="undefined"&&b!==null){var a=this.map[b];if(typeof a!="undefined"){return this.replace(b,c)}this.map[b]=c}this.length++;this.items.push(c);this.keys.push(b);this.fireEvent("add",this.length-1,c,b);return c},getKey:function(a){return a.id},replace:function(c,d){if(arguments.length==1){d=arguments[0];c=this.getKey(d)}var a=this.map[c];if(typeof c=="undefined"||c===null||typeof a=="undefined"){return this.add(c,d)}var b=this.indexOfKey(c);this.items[b]=d;this.map[c]=d;this.fireEvent("replace",c,a,d);return d},addAll:function(e){if(arguments.length>1||Ext.isArray(e)){var b=arguments.length>1?arguments:e;for(var d=0,a=b.length;d=this.length){return this.add(b,c)}this.length++;this.items.splice(a,0,c);if(typeof b!="undefined"&&b!==null){this.map[b]=c}this.keys.splice(a,0,b);this.fireEvent("add",a,c,b);return c},remove:function(a){return this.removeAt(this.indexOf(a))},removeAt:function(a){if(a=0){this.length--;var c=this.items[a];this.items.splice(a,1);var b=this.keys[a];if(typeof b!="undefined"){delete this.map[b]}this.keys.splice(a,1);this.fireEvent("remove",c,b);return c}return false},removeKey:function(a){return this.removeAt(this.indexOfKey(a))},getCount:function(){return this.length},indexOf:function(a){return this.items.indexOf(a)},indexOfKey:function(a){return this.keys.indexOf(a)},item:function(b){var a=this.map[b],c=a!==undefined?a:(typeof b=="number")?this.items[b]:undefined;return !Ext.isFunction(c)||this.allowFunctions?c:null},itemAt:function(a){return this.items[a]},key:function(a){return this.map[a]},contains:function(a){return this.indexOf(a)!=-1},containsKey:function(a){return typeof this.map[a]!="undefined"},clear:function(){this.length=0;this.items=[];this.keys=[];this.map={};this.fireEvent("clear")},first:function(){return this.items[0]},last:function(){return this.items[this.length-1]},_sort:function(k,a,j){var d,e,b=String(a).toUpperCase()=="DESC"?-1:1,h=[],l=this.keys,g=this.items;j=j||function(i,c){return i-c};for(d=0,e=g.length;de?1:(g=a;c--){d[d.length]=b[c]}}return d},filter:function(c,b,d,a){if(Ext.isEmpty(b,false)){return this.clone()}b=this.createValueMatcher(b,d,a);return this.filterBy(function(e){return e&&b.test(e[c])})},filterBy:function(g,e){var h=new Ext.util.MixedCollection();h.getKey=this.getKey;var b=this.keys,d=this.items;for(var c=0,a=d.length;c]+>/gi,stripScriptsRe=/(?:)((\n|\r|.)*?)(?:<\/script>)/ig,nl2brRe=/\r?\n/g;return{ellipsis:function(value,len,word){if(value&&value.length>len){if(word){var vs=value.substr(0,len-2),index=Math.max(vs.lastIndexOf(" "),vs.lastIndexOf("."),vs.lastIndexOf("!"),vs.lastIndexOf("?"));if(index==-1||index<(len-15)){return value.substr(0,len-3)+"..."}else{return vs.substr(0,index)+"..."}}else{return value.substr(0,len-3)+"..."}}return value},undef:function(value){return value!==undefined?value:""},defaultValue:function(value,defaultValue){return value!==undefined&&value!==""?value:defaultValue},htmlEncode:function(value){return !value?value:String(value).replace(/&/g,"&").replace(/>/g,">").replace(/").replace(/</g,"<").replace(/"/g,'"').replace(/&/g,"&")},trim:function(value){return String(value).replace(trimRe,"")},substr:function(value,start,length){return String(value).substr(start,length)},lowercase:function(value){return String(value).toLowerCase()},uppercase:function(value){return String(value).toUpperCase()},capitalize:function(value){return !value?value:value.charAt(0).toUpperCase()+value.substr(1).toLowerCase()},call:function(value,fn){if(arguments.length>2){var args=Array.prototype.slice.call(arguments,2);args.unshift(value);return eval(fn).apply(window,args)}else{return eval(fn).call(window,value)}},usMoney:function(v){v=(Math.round((v-0)*100))/100;v=(v==Math.floor(v))?v+".00":((v*10==Math.floor(v*10))?v+"0":v);v=String(v);var ps=v.split("."),whole=ps[0],sub=ps[1]?"."+ps[1]:".00",r=/(\d+)(\d{3})/;while(r.test(whole)){whole=whole.replace(r,"$1,$2")}v=whole+sub;if(v.charAt(0)=="-"){return"-$"+v.substr(1)}return"$"+v},date:function(v,format){if(!v){return""}if(!Ext.isDate(v)){v=new Date(Date.parse(v))}return v.dateFormat(format||"m/d/Y")},dateRenderer:function(format){return function(v){return Ext.util.Format.date(v,format)}},stripTags:function(v){return !v?v:String(v).replace(stripTagsRE,"")},stripScripts:function(v){return !v?v:String(v).replace(stripScriptsRe,"")},fileSize:function(size){if(size<1024){return size+" bytes"}else{if(size<1048576){return(Math.round(((size*10)/1024))/10)+" KB"}else{return(Math.round(((size*10)/1048576))/10)+" MB"}}},math:function(){var fns={};return function(v,a){if(!fns[a]){fns[a]=new Function("v","return v "+a+";")}return fns[a](v)}}(),round:function(value,precision){var result=Number(value);if(typeof precision=="number"){precision=Math.pow(10,precision);result=Math.round(value*precision)/precision}return result},number:function(v,format){if(!format){return v}v=Ext.num(v,NaN);if(isNaN(v)){return""}var comma=",",dec=".",i18n=false,neg=v<0;v=Math.abs(v);if(format.substr(format.length-2)=="/i"){format=format.substr(0,format.length-2);i18n=true;comma=".";dec=","}var hasComma=format.indexOf(comma)!=-1,psplit=(i18n?format.replace(/[^\d\,]/g,""):format.replace(/[^\d\.]/g,"")).split(dec);if(1")}}}();Ext.XTemplate=function(){Ext.XTemplate.superclass.constructor.apply(this,arguments);var x=this,i=x.html,p=/]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/,d=/^]*?for="(.*?)"/,t=/^]*?if="(.*?)"/,v=/^]*?exec="(.*?)"/,q,o=0,j=[],n="values",u="parent",k="xindex",l="xcount",e="return ",c="with(values){ ";i=["",i,""].join("");while((q=i.match(p))){var b=q[0].match(d),a=q[0].match(t),z=q[0].match(v),g=null,h=null,r=null,y=b&&b[1]?b[1]:"";if(a){g=a&&a[1]?a[1]:null;if(g){h=new Function(n,u,k,l,c+e+(Ext.util.Format.htmlDecode(g))+"; }")}}if(z){g=z&&z[1]?z[1]:null;if(g){r=new Function(n,u,k,l,c+(Ext.util.Format.htmlDecode(g))+"; }")}}if(y){switch(y){case".":y=new Function(n,u,c+e+n+"; }");break;case"..":y=new Function(n,u,c+e+u+"; }");break;default:y=new Function(n,u,c+e+y+"; }")}}j.push({id:o,target:y,exec:r,test:h,body:q[1]||""});i=i.replace(q[0],"{xtpl"+o+"}");++o}Ext.each(j,function(m){x.compileTpl(m)});x.master=j[j.length-1];x.tpls=j};Ext.extend(Ext.XTemplate,Ext.Template,{re:/\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,codeRe:/\{\[((?:\\\]|.|\n)*?)\]\}/g,applySubTemplate:function(a,i,h,d,c){var g=this,e,k=g.tpls[a],j,b=[];if((k.test&&!k.test.call(g,i,h,d,c))||(k.exec&&k.exec.call(g,i,h,d,c))){return""}j=k.target?k.target.call(g,i,h):i;e=j.length;h=k.target?i:h;if(k.target&&Ext.isArray(j)){Ext.each(j,function(l,m){b[b.length]=k.compiled.call(g,l,h,m+1,e)});return b.join("")}return k.compiled.call(g,j,h,d,c)},compileTpl:function(tpl){var fm=Ext.util.Format,useF=this.disableFormats!==true,sep=Ext.isGecko?"+":",",body;function fn(m,name,format,args,math){if(name.substr(0,4)=="xtpl"){return"'"+sep+"this.applySubTemplate("+name.substr(4)+", values, parent, xindex, xcount)"+sep+"'"}var v;if(name==="."){v="values"}else{if(name==="#"){v="xindex"}else{if(name.indexOf(".")!=-1){v=name}else{v="values['"+name+"']"}}}if(math){v="("+v+math+")"}if(format&&useF){args=args?","+args:"";if(format.substr(0,5)!="this."){format="fm."+format+"("}else{format='this.call("'+format.substr(5)+'", ';args=", values"}}else{args="";format="("+v+" === undefined ? '' : "}return"'"+sep+format+v+args+")"+sep+"'"}function codeFn(m,code){return"'"+sep+"("+code.replace(/\\'/g,"'")+")"+sep+"'"}if(Ext.isGecko){body="tpl.compiled = function(values, parent, xindex, xcount){ return '"+tpl.body.replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,fn).replace(this.codeRe,codeFn)+"';};"}else{body=["tpl.compiled = function(values, parent, xindex, xcount){ return ['"];body.push(tpl.body.replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,fn).replace(this.codeRe,codeFn));body.push("'].join('');};");body=body.join("")}eval(body);return this},applyTemplate:function(a){return this.master.compiled.call(this,a,{},1,1)},compile:function(){return this}});Ext.XTemplate.prototype.apply=Ext.XTemplate.prototype.applyTemplate;Ext.XTemplate.from=function(a){a=Ext.getDom(a);return new Ext.XTemplate(a.value||a.innerHTML)};Ext.util.CSS=function(){var d=null;var c=document;var b=/(-[a-z])/gi;var a=function(e,g){return g.charAt(1).toUpperCase()};return{createStyleSheet:function(i,l){var h;var g=c.getElementsByTagName("head")[0];var k=c.createElement("style");k.setAttribute("type","text/css");if(l){k.setAttribute("id",l)}if(Ext.isIE){g.appendChild(k);h=k.styleSheet;h.cssText=i}else{try{k.appendChild(c.createTextNode(i))}catch(j){k.cssText=i}g.appendChild(k);h=k.styleSheet?k.styleSheet:(k.sheet||c.styleSheets[c.styleSheets.length-1])}this.cacheStyleSheet(h);return h},removeStyleSheet:function(g){var e=c.getElementById(g);if(e){e.parentNode.removeChild(e)}},swapStyleSheet:function(h,e){this.removeStyleSheet(h);var g=c.createElement("link");g.setAttribute("rel","stylesheet");g.setAttribute("type","text/css");g.setAttribute("id",h);g.setAttribute("href",e);c.getElementsByTagName("head")[0].appendChild(g)},refreshCache:function(){return this.getRules(true)},cacheStyleSheet:function(h){if(!d){d={}}try{var k=h.cssRules||h.rules;for(var g=k.length-1;g>=0;--g){d[k[g].selectorText.toLowerCase()]=k[g]}}catch(i){}},getRules:function(h){if(d===null||h){d={};var k=c.styleSheets;for(var j=0,g=k.length;j=37&&a<=40){b.stopEvent()}},destroy:function(){this.disable()},enable:function(){if(this.disabled){if(Ext.isSafari2){this.el.on("keyup",this.stopKeyUp,this)}this.el.on(this.isKeydown()?"keydown":"keypress",this.relay,this);this.disabled=false}},disable:function(){if(!this.disabled){if(Ext.isSafari2){this.el.un("keyup",this.stopKeyUp,this)}this.el.un(this.isKeydown()?"keydown":"keypress",this.relay,this);this.disabled=true}},setDisabled:function(a){this[a?"disable":"enable"]()},isKeydown:function(){return this.forceKeyDown||Ext.EventManager.useKeydown}};Ext.KeyMap=function(c,b,a){this.el=Ext.get(c);this.eventName=a||"keydown";this.bindings=[];if(b){this.addBinding(b)}this.enable()};Ext.KeyMap.prototype={stopEvent:false,addBinding:function(b){if(Ext.isArray(b)){Ext.each(b,function(j){this.addBinding(j)},this);return}var k=b.key,g=b.fn||b.handler,l=b.scope;if(b.stopEvent){this.stopEvent=b.stopEvent}if(typeof k=="string"){var h=[];var e=k.toUpperCase();for(var c=0,d=e.length;c2)?a[2]:null;var h=(i>3)?a[3]:"/";var d=(i>4)?a[4]:null;var g=(i>5)?a[5]:false;document.cookie=c+"="+escape(e)+((b===null)?"":("; expires="+b.toGMTString()))+((h===null)?"":("; path="+h))+((d===null)?"":("; domain="+d))+((g===true)?"; secure":"")},get:function(d){var b=d+"=";var g=b.length;var a=document.cookie.length;var e=0;var c=0;while(e0){return this.ownerCt.items.itemAt(a-1)}}return null},getBubbleTarget:function(){return this.ownerCt}});Ext.reg("component",Ext.Component);Ext.Action=Ext.extend(Object,{constructor:function(a){this.initialConfig=a;this.itemId=a.itemId=(a.itemId||a.id||Ext.id());this.items=[]},isAction:true,setText:function(a){this.initialConfig.text=a;this.callEach("setText",[a])},getText:function(){return this.initialConfig.text},setIconClass:function(a){this.initialConfig.iconCls=a;this.callEach("setIconClass",[a])},getIconClass:function(){return this.initialConfig.iconCls},setDisabled:function(a){this.initialConfig.disabled=a;this.callEach("setDisabled",[a])},enable:function(){this.setDisabled(false)},disable:function(){this.setDisabled(true)},isDisabled:function(){return this.initialConfig.disabled},setHidden:function(a){this.initialConfig.hidden=a;this.callEach("setVisible",[!a])},show:function(){this.setHidden(false)},hide:function(){this.setHidden(true)},isHidden:function(){return this.initialConfig.hidden},setHandler:function(b,a){this.initialConfig.handler=b;this.initialConfig.scope=a;this.callEach("setHandler",[b,a])},each:function(b,a){Ext.each(this.items,b,a)},callEach:function(e,b){var d=this.items;for(var c=0,a=d.length;cj+o.left){k=j-l-c;g=true}if((i+e)>d+o.top){i=d-e-c;g=true}if(k=m){i=m-e-5}}n=[k,i];this.storeXY(n);a.setXY.call(this,n);this.sync()}}return this},isVisible:function(){return this.visible},showAction:function(){this.visible=true;if(this.useDisplay===true){this.setDisplayed("")}else{if(this.lastXY){a.setXY.call(this,this.lastXY)}else{if(this.lastLT){a.setLeftTop.call(this,this.lastLT[0],this.lastLT[1])}}}},hideAction:function(){this.visible=false;if(this.useDisplay===true){this.setDisplayed(false)}else{this.setLeftTop(-10000,-10000)}},setVisible:function(i,h,k,l,j){if(i){this.showAction()}if(h&&i){var g=function(){this.sync(true);if(l){l()}}.createDelegate(this);a.setVisible.call(this,true,true,k,g,j)}else{if(!i){this.hideUnders(true)}var g=l;if(h){g=function(){this.hideAction();if(l){l()}}.createDelegate(this)}a.setVisible.call(this,i,h,k,g,j);if(i){this.sync(true)}else{if(!h){this.hideAction()}}}return this},storeXY:function(c){delete this.lastLT;this.lastXY=c},storeLeftTop:function(d,c){delete this.lastXY;this.lastLT=[d,c]},beforeFx:function(){this.beforeAction();return Ext.Layer.superclass.beforeFx.apply(this,arguments)},afterFx:function(){Ext.Layer.superclass.afterFx.apply(this,arguments);this.sync(this.isVisible())},beforeAction:function(){if(!this.updating&&this.shadow){this.shadow.hide()}},setLeft:function(c){this.storeLeftTop(c,this.getTop(true));a.setLeft.apply(this,arguments);this.sync();return this},setTop:function(c){this.storeLeftTop(this.getLeft(true),c);a.setTop.apply(this,arguments);this.sync();return this},setLeftTop:function(d,c){this.storeLeftTop(d,c);a.setLeftTop.apply(this,arguments);this.sync();return this},setXY:function(j,h,k,l,i){this.fixDisplay();this.beforeAction();this.storeXY(j);var g=this.createCB(l);a.setXY.call(this,j,h,k,g,i);if(!h){g()}return this},createCB:function(e){var d=this;return function(){d.constrainXY();d.sync(true);if(e){e()}}},setX:function(g,h,j,k,i){this.setXY([g,this.getY()],h,j,k,i);return this},setY:function(k,g,i,j,h){this.setXY([this.getX(),k],g,i,j,h);return this},setSize:function(j,k,i,m,n,l){this.beforeAction();var g=this.createCB(n);a.setSize.call(this,j,k,i,m,g,l);if(!i){g()}return this},setWidth:function(i,h,k,l,j){this.beforeAction();var g=this.createCB(l);a.setWidth.call(this,i,h,k,g,j);if(!h){g()}return this},setHeight:function(j,i,l,m,k){this.beforeAction();var g=this.createCB(m);a.setHeight.call(this,j,i,l,g,k);if(!i){g()}return this},setBounds:function(o,m,p,i,n,k,l,j){this.beforeAction();var g=this.createCB(l);if(!n){this.storeXY([o,m]);a.setXY.call(this,[o,m]);a.setSize.call(this,p,i,n,k,g,j);g()}else{a.setBounds.call(this,o,m,p,i,n,k,g,j)}return this},setZIndex:function(c){this.zindex=c;this.setStyle("z-index",c+2);if(this.shadow){this.shadow.setZIndex(c+1)}if(this.shim){this.shim.setStyle("z-index",c)}return this}})})();Ext.Shadow=function(d){Ext.apply(this,d);if(typeof this.mode!="string"){this.mode=this.defaultMode}var e=this.offset,c={h:0};var b=Math.floor(this.offset/2);switch(this.mode.toLowerCase()){case"drop":c.w=0;c.l=c.t=e;c.t-=1;if(Ext.isIE){c.l-=this.offset+b;c.t-=this.offset+b;c.w-=b;c.h-=b;c.t+=1}break;case"sides":c.w=(e*2);c.l=-e;c.t=e-1;if(Ext.isIE){c.l-=(this.offset-b);c.t-=this.offset+b;c.l+=1;c.w-=(this.offset-b)*2;c.w-=b+1;c.h-=1}break;case"frame":c.w=c.h=(e*2);c.l=c.t=-e;c.t+=1;c.h-=2;if(Ext.isIE){c.l-=(this.offset-b);c.t-=(this.offset-b);c.l+=1;c.w-=(this.offset+b+1);c.h-=(this.offset+b);c.h+=1}break}this.adjusts=c};Ext.Shadow.prototype={offset:4,defaultMode:"drop",show:function(a){a=Ext.get(a);if(!this.el){this.el=Ext.Shadow.Pool.pull();if(this.el.dom.nextSibling!=a.dom){this.el.insertBefore(a)}}this.el.setStyle("z-index",this.zIndex||parseInt(a.getStyle("z-index"),10)-1);if(Ext.isIE){this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")"}this.realign(a.getLeft(true),a.getTop(true),a.getWidth(),a.getHeight());this.el.dom.style.display="block"},isVisible:function(){return this.el?true:false},realign:function(b,r,q,g){if(!this.el){return}var n=this.adjusts,k=this.el.dom,u=k.style;var i=0;u.left=(b+n.l)+"px";u.top=(r+n.t)+"px";var p=(q+n.w),e=(g+n.h),j=p+"px",o=e+"px";if(u.width!=j||u.height!=o){u.width=j;u.height=o;if(!Ext.isIE){var m=k.childNodes;var c=Math.max(0,(p-12))+"px";m[0].childNodes[1].style.width=c;m[1].childNodes[1].style.width=c;m[2].childNodes[1].style.width=c;m[1].style.height=Math.max(0,(e-12))+"px"}}},hide:function(){if(this.el){this.el.dom.style.display="none";Ext.Shadow.Pool.push(this.el);delete this.el}},setZIndex:function(a){this.zIndex=a;if(this.el){this.el.setStyle("z-index",a)}}};Ext.Shadow.Pool=function(){var b=[];var a=Ext.isIE?'
':'
';return{pull:function(){var c=b.shift();if(!c){c=Ext.get(Ext.DomHelper.insertHtml("beforeBegin",document.body.firstChild,a));c.autoBoxAdjust=false}return c},push:function(c){b.push(c)}}}();Ext.BoxComponent=Ext.extend(Ext.Component,{initComponent:function(){Ext.BoxComponent.superclass.initComponent.call(this);this.addEvents("resize","move")},boxReady:false,deferHeight:false,setSize:function(b,d){if(typeof b=="object"){d=b.height;b=b.width}if(Ext.isDefined(b)&&Ext.isDefined(this.boxMinWidth)&&(bthis.boxMaxWidth)){b=this.boxMaxWidth}if(Ext.isDefined(d)&&Ext.isDefined(this.boxMaxHeight)&&(d>this.boxMaxHeight)){d=this.boxMaxHeight}if(!this.boxReady){this.width=b;this.height=d;return this}if(this.cacheSizes!==false&&this.lastSize&&this.lastSize.width==b&&this.lastSize.height==d){return this}this.lastSize={width:b,height:d};var c=this.adjustSize(b,d),g=c.width,a=c.height,e;if(g!==undefined||a!==undefined){e=this.getResizeEl();if(!this.deferHeight&&g!==undefined&&a!==undefined){e.setSize(g,a)}else{if(!this.deferHeight&&a!==undefined){e.setHeight(a)}else{if(g!==undefined){e.setWidth(g)}}}this.onResize(g,a,b,d);this.fireEvent("resize",this,g,a,b,d)}return this},setWidth:function(a){return this.setSize(a)},setHeight:function(a){return this.setSize(undefined,a)},getSize:function(){return this.getResizeEl().getSize()},getWidth:function(){return this.getResizeEl().getWidth()},getHeight:function(){return this.getResizeEl().getHeight()},getOuterSize:function(){var a=this.getResizeEl();return{width:a.getWidth()+a.getMargins("lr"),height:a.getHeight()+a.getMargins("tb")}},getPosition:function(a){var b=this.getPositionEl();if(a===true){return[b.getLeft(true),b.getTop(true)]}return this.xy||b.getXY()},getBox:function(a){var c=this.getPosition(a);var b=this.getSize();b.x=c[0];b.y=c[1];return b},updateBox:function(a){this.setSize(a.width,a.height);this.setPagePosition(a.x,a.y);return this},getResizeEl:function(){return this.resizeEl||this.el},setAutoScroll:function(a){if(this.rendered){this.getContentTarget().setOverflow(a?"auto":"")}this.autoScroll=a;return this},setPosition:function(a,g){if(a&&typeof a[1]=="number"){g=a[1];a=a[0]}this.x=a;this.y=g;if(!this.boxReady){return this}var b=this.adjustPosition(a,g);var e=b.x,d=b.y;var c=this.getPositionEl();if(e!==undefined||d!==undefined){if(e!==undefined&&d!==undefined){c.setLeftTop(e,d)}else{if(e!==undefined){c.setLeft(e)}else{if(d!==undefined){c.setTop(d)}}}this.onPosition(e,d);this.fireEvent("move",this,e,d)}return this},setPagePosition:function(a,c){if(a&&typeof a[1]=="number"){c=a[1];a=a[0]}this.pageX=a;this.pageY=c;if(!this.boxReady){return}if(a===undefined||c===undefined){return}var b=this.getPositionEl().translatePoints(a,c);this.setPosition(b.left,b.top);return this},afterRender:function(){Ext.BoxComponent.superclass.afterRender.call(this);if(this.resizeEl){this.resizeEl=Ext.get(this.resizeEl)}if(this.positionEl){this.positionEl=Ext.get(this.positionEl)}this.boxReady=true;Ext.isDefined(this.autoScroll)&&this.setAutoScroll(this.autoScroll);this.setSize(this.width,this.height);if(this.x||this.y){this.setPosition(this.x,this.y)}else{if(this.pageX||this.pageY){this.setPagePosition(this.pageX,this.pageY)}}},syncSize:function(){delete this.lastSize;this.setSize(this.autoWidth?undefined:this.getResizeEl().getWidth(),this.autoHeight?undefined:this.getResizeEl().getHeight());return this},onResize:function(d,b,a,c){},onPosition:function(a,b){},adjustSize:function(a,b){if(this.autoWidth){a="auto"}if(this.autoHeight){b="auto"}return{width:a,height:b}},adjustPosition:function(a,b){return{x:a,y:b}}});Ext.reg("box",Ext.BoxComponent);Ext.Spacer=Ext.extend(Ext.BoxComponent,{autoEl:"div"});Ext.reg("spacer",Ext.Spacer);Ext.SplitBar=function(c,e,b,d,a){this.el=Ext.get(c,true);this.el.dom.unselectable="on";this.resizingEl=Ext.get(e,true);this.orientation=b||Ext.SplitBar.HORIZONTAL;this.minSize=0;this.maxSize=2000;this.animate=false;this.useShim=false;this.shim=null;if(!a){this.proxy=Ext.SplitBar.createProxy(this.orientation)}else{this.proxy=Ext.get(a).dom}this.dd=new Ext.dd.DDProxy(this.el.dom.id,"XSplitBars",{dragElId:this.proxy.id});this.dd.b4StartDrag=this.onStartProxyDrag.createDelegate(this);this.dd.endDrag=this.onEndProxyDrag.createDelegate(this);this.dragSpecs={};this.adapter=new Ext.SplitBar.BasicLayoutAdapter();this.adapter.init(this);if(this.orientation==Ext.SplitBar.HORIZONTAL){this.placement=d||(this.el.getX()>this.resizingEl.getX()?Ext.SplitBar.LEFT:Ext.SplitBar.RIGHT);this.el.addClass("x-splitbar-h")}else{this.placement=d||(this.el.getY()>this.resizingEl.getY()?Ext.SplitBar.TOP:Ext.SplitBar.BOTTOM);this.el.addClass("x-splitbar-v")}this.addEvents("resize","moved","beforeresize","beforeapply");Ext.SplitBar.superclass.constructor.call(this)};Ext.extend(Ext.SplitBar,Ext.util.Observable,{onStartProxyDrag:function(a,e){this.fireEvent("beforeresize",this);this.overlay=Ext.DomHelper.append(document.body,{cls:"x-drag-overlay",html:" "},true);this.overlay.unselectable();this.overlay.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true));this.overlay.show();Ext.get(this.proxy).setDisplayed("block");var c=this.adapter.getElementSize(this);this.activeMinSize=this.getMinimumSize();this.activeMaxSize=this.getMaximumSize();var d=c-this.activeMinSize;var b=Math.max(this.activeMaxSize-c,0);if(this.orientation==Ext.SplitBar.HORIZONTAL){this.dd.resetConstraints();this.dd.setXConstraint(this.placement==Ext.SplitBar.LEFT?d:b,this.placement==Ext.SplitBar.LEFT?b:d,this.tickSize);this.dd.setYConstraint(0,0)}else{this.dd.resetConstraints();this.dd.setXConstraint(0,0);this.dd.setYConstraint(this.placement==Ext.SplitBar.TOP?d:b,this.placement==Ext.SplitBar.TOP?b:d,this.tickSize)}this.dragSpecs.startSize=c;this.dragSpecs.startPoint=[a,e];Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd,a,e)},onEndProxyDrag:function(c){Ext.get(this.proxy).setDisplayed(false);var b=Ext.lib.Event.getXY(c);if(this.overlay){Ext.destroy(this.overlay);delete this.overlay}var a;if(this.orientation==Ext.SplitBar.HORIZONTAL){a=this.dragSpecs.startSize+(this.placement==Ext.SplitBar.LEFT?b[0]-this.dragSpecs.startPoint[0]:this.dragSpecs.startPoint[0]-b[0])}else{a=this.dragSpecs.startSize+(this.placement==Ext.SplitBar.TOP?b[1]-this.dragSpecs.startPoint[1]:this.dragSpecs.startPoint[1]-b[1])}a=Math.min(Math.max(a,this.activeMinSize),this.activeMaxSize);if(a!=this.dragSpecs.startSize){if(this.fireEvent("beforeapply",this,a)!==false){this.adapter.setElementSize(this,a);this.fireEvent("moved",this,a);this.fireEvent("resize",this,a)}}},getAdapter:function(){return this.adapter},setAdapter:function(a){this.adapter=a;this.adapter.init(this)},getMinimumSize:function(){return this.minSize},setMinimumSize:function(a){this.minSize=a},getMaximumSize:function(){return this.maxSize},setMaximumSize:function(a){this.maxSize=a},setCurrentSize:function(b){var a=this.animate;this.animate=false;this.adapter.setElementSize(this,b);this.animate=a},destroy:function(a){Ext.destroy(this.shim,Ext.get(this.proxy));this.dd.unreg();if(a){this.el.remove()}this.purgeListeners()}});Ext.SplitBar.createProxy=function(b){var c=new Ext.Element(document.createElement("div"));document.body.appendChild(c.dom);c.unselectable();var a="x-splitbar-proxy";c.addClass(a+" "+(b==Ext.SplitBar.HORIZONTAL?a+"-h":a+"-v"));return c.dom};Ext.SplitBar.BasicLayoutAdapter=function(){};Ext.SplitBar.BasicLayoutAdapter.prototype={init:function(a){},getElementSize:function(a){if(a.orientation==Ext.SplitBar.HORIZONTAL){return a.resizingEl.getWidth()}else{return a.resizingEl.getHeight()}},setElementSize:function(b,a,c){if(b.orientation==Ext.SplitBar.HORIZONTAL){if(!b.animate){b.resizingEl.setWidth(a);if(c){c(b,a)}}else{b.resizingEl.setWidth(a,true,0.1,c,"easeOut")}}else{if(!b.animate){b.resizingEl.setHeight(a);if(c){c(b,a)}}else{b.resizingEl.setHeight(a,true,0.1,c,"easeOut")}}}};Ext.SplitBar.AbsoluteLayoutAdapter=function(a){this.basic=new Ext.SplitBar.BasicLayoutAdapter();this.container=Ext.get(a)};Ext.SplitBar.AbsoluteLayoutAdapter.prototype={init:function(a){this.basic.init(a)},getElementSize:function(a){return this.basic.getElementSize(a)},setElementSize:function(b,a,c){this.basic.setElementSize(b,a,this.moveSplitter.createDelegate(this,[b]))},moveSplitter:function(a){var b=Ext.SplitBar;switch(a.placement){case b.LEFT:a.el.setX(a.resizingEl.getRight());break;case b.RIGHT:a.el.setStyle("right",(this.container.getWidth()-a.resizingEl.getLeft())+"px");break;case b.TOP:a.el.setY(a.resizingEl.getBottom());break;case b.BOTTOM:a.el.setY(a.resizingEl.getTop()-a.el.getHeight());break}}};Ext.SplitBar.VERTICAL=1;Ext.SplitBar.HORIZONTAL=2;Ext.SplitBar.LEFT=1;Ext.SplitBar.RIGHT=2;Ext.SplitBar.TOP=3;Ext.SplitBar.BOTTOM=4;Ext.Container=Ext.extend(Ext.BoxComponent,{bufferResize:50,autoDestroy:true,forceLayout:false,defaultType:"panel",resizeEvent:"resize",bubbleEvents:["add","remove"],initComponent:function(){Ext.Container.superclass.initComponent.call(this);this.addEvents("afterlayout","beforeadd","beforeremove","add","remove");var a=this.items;if(a){delete this.items;this.add(a)}},initItems:function(){if(!this.items){this.items=new Ext.util.MixedCollection(false,this.getComponentId);this.getLayout()}},setLayout:function(a){if(this.layout&&this.layout!=a){this.layout.setContainer(null)}this.initItems();this.layout=a;a.setContainer(this)},afterRender:function(){Ext.Container.superclass.afterRender.call(this);if(!this.layout){this.layout="auto"}if(Ext.isObject(this.layout)&&!this.layout.layout){this.layoutConfig=this.layout;this.layout=this.layoutConfig.type}if(Ext.isString(this.layout)){this.layout=new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig)}this.setLayout(this.layout);if(this.activeItem!==undefined){var a=this.activeItem;delete this.activeItem;this.layout.setActiveItem(a)}if(!this.ownerCt){this.doLayout(false,true)}if(this.monitorResize===true){Ext.EventManager.onWindowResize(this.doLayout,this,[false])}},getLayoutTarget:function(){return this.el},getComponentId:function(a){return a.getItemId()},add:function(b){this.initItems();var e=arguments.length>1;if(e||Ext.isArray(b)){var a=[];Ext.each(e?arguments:b,function(h){a.push(this.add(h))},this);return a}var g=this.lookupComponent(this.applyDefaults(b));var d=this.items.length;if(this.fireEvent("beforeadd",this,g,d)!==false&&this.onBeforeAdd(g)!==false){this.items.add(g);g.onAdded(this,d);this.onAdd(g);this.fireEvent("add",this,g,d)}return g},onAdd:function(a){},onAdded:function(a,b){this.ownerCt=a;this.initRef();this.cascade(function(d){d.initRef()});this.fireEvent("added",this,a,b)},insert:function(h,g){this.initItems();var e=arguments,d=e.length;if(d>2){var b=[];for(var j=d-1;j>=1;--j){b.push(this.insert(h,e[j]))}return b}var k=this.lookupComponent(this.applyDefaults(g));h=Math.min(h,this.items.length);if(this.fireEvent("beforeadd",this,k,h)!==false&&this.onBeforeAdd(k)!==false){if(k.ownerCt==this){this.items.remove(k)}this.items.insert(h,k);k.onAdded(this,h);this.onAdd(k);this.fireEvent("add",this,k,h)}return k},applyDefaults:function(b){var a=this.defaults;if(a){if(Ext.isFunction(a)){a=a.call(this,b)}if(Ext.isString(b)){b=Ext.ComponentMgr.get(b);Ext.apply(b,a)}else{if(!b.events){Ext.applyIf(b,a)}else{Ext.apply(b,a)}}}return b},onBeforeAdd:function(a){if(a.ownerCt){a.ownerCt.remove(a,false)}if(this.hideBorders===true){a.border=(a.border===true)}},remove:function(a,b){this.initItems();var d=this.getComponent(a);if(d&&this.fireEvent("beforeremove",this,d)!==false){this.doRemove(d,b);this.fireEvent("remove",this,d)}return d},onRemove:function(a){},doRemove:function(e,d){var b=this.layout,a=b&&this.rendered;if(a){b.onRemove(e)}this.items.remove(e);e.onRemoved();this.onRemove(e);if(d===true||(d!==false&&this.autoDestroy)){e.destroy()}if(a){b.afterRemove(e)}},removeAll:function(c){this.initItems();var e,g=[],b=[];this.items.each(function(h){g.push(h)});for(var d=0,a=g.length;d','','
','
',"");a.disableFormats=true;return a.compile()})(),destroy:function(){if(this.resizeTask&&this.resizeTask.cancel){this.resizeTask.cancel()}if(!Ext.isEmpty(this.targetCls)){var a=this.container.getLayoutTarget();if(a){a.removeClass(this.targetCls)}}}});Ext.layout.AutoLayout=Ext.extend(Ext.layout.ContainerLayout,{type:"auto",monitorResize:true,onLayout:function(d,g){Ext.layout.AutoLayout.superclass.onLayout.call(this,d,g);var e=this.getRenderedItems(d),a=e.length,b,h;for(b=0;b0){b.setSize(a)}}});Ext.Container.LAYOUTS.fit=Ext.layout.FitLayout;Ext.layout.CardLayout=Ext.extend(Ext.layout.FitLayout,{deferredRender:false,layoutOnCardChange:false,renderHidden:true,type:"card",setActiveItem:function(d){var a=this.activeItem,b=this.container;d=b.getComponent(d);if(d&&a!=d){if(a){a.hide();if(a.hidden!==true){return false}a.fireEvent("deactivate",a)}var c=d.doLayout&&(this.layoutOnCardChange||!d.rendered);this.activeItem=d;delete d.deferLayout;d.show();this.layout();if(c){d.doLayout()}d.fireEvent("activate",d)}},renderAll:function(a,b){if(this.deferredRender){this.renderItem(this.activeItem,undefined,b)}else{Ext.layout.CardLayout.superclass.renderAll.call(this,a,b)}}});Ext.Container.LAYOUTS.card=Ext.layout.CardLayout;Ext.layout.AnchorLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,type:"anchor",defaultAnchor:"100%",parseAnchorRE:/^(r|right|b|bottom)$/i,getLayoutTargetSize:function(){var a=this.container.getLayoutTarget();if(!a){return{}}return a.getStyleSize()},onLayout:function(m,p){Ext.layout.AnchorLayout.superclass.onLayout.call(this,m,p);var v=this.getLayoutTargetSize();var t=v.width,l=v.height;if(t<20&&l<20){return}var d,r;if(m.anchorSize){if(typeof m.anchorSize=="number"){d=m.anchorSize}else{d=m.anchorSize.width;r=m.anchorSize.height}}else{d=m.initialConfig.width;r=m.initialConfig.height}var o=this.getRenderedItems(m),n=o.length,j,q,s,g,b,e,u,k=[];for(j=0;j ');b.disableFormats=true;b.compile();Ext.layout.BorderLayout.Region.prototype.toolTemplate=b}this.collapsedEl=this.targetEl.createChild({cls:"x-layout-collapsed x-layout-collapsed-"+this.position,id:this.panel.id+"-xcollapsed"});this.collapsedEl.enableDisplayMode("block");if(this.collapseMode=="mini"){this.collapsedEl.addClass("x-layout-cmini-"+this.position);this.miniCollapsedEl=this.collapsedEl.createChild({cls:"x-layout-mini x-layout-mini-"+this.position,html:" "});this.miniCollapsedEl.addClassOnOver("x-layout-mini-over");this.collapsedEl.addClassOnOver("x-layout-collapsed-over");this.collapsedEl.on("click",this.onExpandClick,this,{stopEvent:true})}else{if(this.collapsible!==false&&!this.hideCollapseTool){var a=this.toolTemplate.append(this.collapsedEl.dom,{id:"expand-"+this.position},true);a.addClassOnOver("x-tool-expand-"+this.position+"-over");a.on("click",this.onExpandClick,this,{stopEvent:true})}if(this.floatable!==false||this.titleCollapse){this.collapsedEl.addClassOnOver("x-layout-collapsed-over");this.collapsedEl.on("click",this[this.floatable?"collapseClick":"onExpandClick"],this)}}}return this.collapsedEl},onExpandClick:function(a){if(this.isSlid){this.panel.expand(false)}else{this.panel.expand()}},onCollapseClick:function(a){this.panel.collapse()},beforeCollapse:function(c,a){this.lastAnim=a;if(this.splitEl){this.splitEl.hide()}this.getCollapsedEl().show();var b=this.panel.getEl();this.originalZIndex=b.getStyle("z-index");b.setStyle("z-index",100);this.isCollapsed=true;this.layout.layout()},onCollapse:function(a){this.panel.el.setStyle("z-index",1);if(this.lastAnim===false||this.panel.animCollapse===false){this.getCollapsedEl().dom.style.visibility="visible"}else{this.getCollapsedEl().slideIn(this.panel.slideAnchor,{duration:0.2})}this.state.collapsed=true;this.panel.saveState()},beforeExpand:function(a){if(this.isSlid){this.afterSlideIn()}var b=this.getCollapsedEl();this.el.show();if(this.position=="east"||this.position=="west"){this.panel.setSize(undefined,b.getHeight())}else{this.panel.setSize(b.getWidth(),undefined)}b.hide();b.dom.style.visibility="hidden";this.panel.el.setStyle("z-index",this.floatingZIndex)},onExpand:function(){this.isCollapsed=false;if(this.splitEl){this.splitEl.show()}this.layout.layout();this.panel.el.setStyle("z-index",this.originalZIndex);this.state.collapsed=false;this.panel.saveState()},collapseClick:function(a){if(this.isSlid){a.stopPropagation();this.slideIn()}else{a.stopPropagation();this.slideOut()}},onHide:function(){if(this.isCollapsed){this.getCollapsedEl().hide()}else{if(this.splitEl){this.splitEl.hide()}}},onShow:function(){if(this.isCollapsed){this.getCollapsedEl().show()}else{if(this.splitEl){this.splitEl.show()}}},isVisible:function(){return !this.panel.hidden},getMargins:function(){return this.isCollapsed&&this.cmargins?this.cmargins:this.margins},getSize:function(){return this.isCollapsed?this.getCollapsedEl().getSize():this.panel.getSize()},setPanel:function(a){this.panel=a},getMinWidth:function(){return this.minWidth},getMinHeight:function(){return this.minHeight},applyLayoutCollapsed:function(a){var b=this.getCollapsedEl();b.setLeftTop(a.x,a.y);b.setSize(a.width,a.height)},applyLayout:function(a){if(this.isCollapsed){this.applyLayoutCollapsed(a)}else{this.panel.setPosition(a.x,a.y);this.panel.setSize(a.width,a.height)}},beforeSlide:function(){this.panel.beforeEffect()},afterSlide:function(){this.panel.afterEffect()},initAutoHide:function(){if(this.autoHide!==false){if(!this.autoHideHd){this.autoHideSlideTask=new Ext.util.DelayedTask(this.slideIn,this);this.autoHideHd={mouseout:function(a){if(!a.within(this.el,true)){this.autoHideSlideTask.delay(500)}},mouseover:function(a){this.autoHideSlideTask.cancel()},scope:this}}this.el.on(this.autoHideHd);this.collapsedEl.on(this.autoHideHd)}},clearAutoHide:function(){if(this.autoHide!==false){this.el.un("mouseout",this.autoHideHd.mouseout);this.el.un("mouseover",this.autoHideHd.mouseover);this.collapsedEl.un("mouseout",this.autoHideHd.mouseout);this.collapsedEl.un("mouseover",this.autoHideHd.mouseover)}},clearMonitor:function(){Ext.getDoc().un("click",this.slideInIf,this)},slideOut:function(){if(this.isSlid||this.el.hasActiveFx()){return}this.isSlid=true;var b=this.panel.tools,c,a;if(b&&b.toggle){b.toggle.hide()}this.el.show();a=this.panel.collapsed;this.panel.collapsed=false;if(this.position=="east"||this.position=="west"){c=this.panel.deferHeight;this.panel.deferHeight=false;this.panel.setSize(undefined,this.collapsedEl.getHeight());this.panel.deferHeight=c}else{this.panel.setSize(this.collapsedEl.getWidth(),undefined)}this.panel.collapsed=a;this.restoreLT=[this.el.dom.style.left,this.el.dom.style.top];this.el.alignTo(this.collapsedEl,this.getCollapseAnchor());this.el.setStyle("z-index",this.floatingZIndex+2);this.panel.el.replaceClass("x-panel-collapsed","x-panel-floating");if(this.animFloat!==false){this.beforeSlide();this.el.slideIn(this.getSlideAnchor(),{callback:function(){this.afterSlide();this.initAutoHide();Ext.getDoc().on("click",this.slideInIf,this)},scope:this,block:true})}else{this.initAutoHide();Ext.getDoc().on("click",this.slideInIf,this)}},afterSlideIn:function(){this.clearAutoHide();this.isSlid=false;this.clearMonitor();this.el.setStyle("z-index","");this.panel.el.replaceClass("x-panel-floating","x-panel-collapsed");this.el.dom.style.left=this.restoreLT[0];this.el.dom.style.top=this.restoreLT[1];var a=this.panel.tools;if(a&&a.toggle){a.toggle.show()}},slideIn:function(a){if(!this.isSlid||this.el.hasActiveFx()){Ext.callback(a);return}this.isSlid=false;if(this.animFloat!==false){this.beforeSlide();this.el.slideOut(this.getSlideAnchor(),{callback:function(){this.el.hide();this.afterSlide();this.afterSlideIn();Ext.callback(a)},scope:this,block:true})}else{this.el.hide();this.afterSlideIn()}},slideInIf:function(a){if(!a.within(this.el)){this.slideIn()}},anchors:{west:"left",east:"right",north:"top",south:"bottom"},sanchors:{west:"l",east:"r",north:"t",south:"b"},canchors:{west:"tl-tr",east:"tr-tl",north:"tl-bl",south:"bl-tl"},getAnchor:function(){return this.anchors[this.position]},getCollapseAnchor:function(){return this.canchors[this.position]},getSlideAnchor:function(){return this.sanchors[this.position]},getAlignAdj:function(){var a=this.cmargins;switch(this.position){case"west":return[0,0];break;case"east":return[0,0];break;case"north":return[0,0];break;case"south":return[0,0];break}},getExpandAdj:function(){var b=this.collapsedEl,a=this.cmargins;switch(this.position){case"west":return[-(a.right+b.getWidth()+a.left),0];break;case"east":return[a.right+b.getWidth()+a.left,0];break;case"north":return[0,-(a.top+a.bottom+b.getHeight())];break;case"south":return[0,a.top+a.bottom+b.getHeight()];break}},destroy:function(){if(this.autoHideSlideTask&&this.autoHideSlideTask.cancel){this.autoHideSlideTask.cancel()}Ext.destroy(this.miniCollapsedEl,this.collapsedEl)}};Ext.layout.BorderLayout.SplitRegion=function(b,a,c){Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this,b,a,c);this.applyLayout=this.applyFns[c]};Ext.extend(Ext.layout.BorderLayout.SplitRegion,Ext.layout.BorderLayout.Region,{splitTip:"Drag to resize.",collapsibleSplitTip:"Drag to resize. Double click to hide.",useSplitTips:false,splitSettings:{north:{orientation:Ext.SplitBar.VERTICAL,placement:Ext.SplitBar.TOP,maxFn:"getVMaxSize",minProp:"minHeight",maxProp:"maxHeight"},south:{orientation:Ext.SplitBar.VERTICAL,placement:Ext.SplitBar.BOTTOM,maxFn:"getVMaxSize",minProp:"minHeight",maxProp:"maxHeight"},east:{orientation:Ext.SplitBar.HORIZONTAL,placement:Ext.SplitBar.RIGHT,maxFn:"getHMaxSize",minProp:"minWidth",maxProp:"maxWidth"},west:{orientation:Ext.SplitBar.HORIZONTAL,placement:Ext.SplitBar.LEFT,maxFn:"getHMaxSize",minProp:"minWidth",maxProp:"maxWidth"}},applyFns:{west:function(c){if(this.isCollapsed){return this.applyLayoutCollapsed(c)}var d=this.splitEl.dom,b=d.style;this.panel.setPosition(c.x,c.y);var a=d.offsetWidth;b.left=(c.x+c.width-a)+"px";b.top=(c.y)+"px";b.height=Math.max(0,c.height)+"px";this.panel.setSize(c.width-a,c.height)},east:function(c){if(this.isCollapsed){return this.applyLayoutCollapsed(c)}var d=this.splitEl.dom,b=d.style;var a=d.offsetWidth;this.panel.setPosition(c.x+a,c.y);b.left=(c.x)+"px";b.top=(c.y)+"px";b.height=Math.max(0,c.height)+"px";this.panel.setSize(c.width-a,c.height)},north:function(c){if(this.isCollapsed){return this.applyLayoutCollapsed(c)}var d=this.splitEl.dom,b=d.style;var a=d.offsetHeight;this.panel.setPosition(c.x,c.y);b.left=(c.x)+"px";b.top=(c.y+c.height-a)+"px";b.width=Math.max(0,c.width)+"px";this.panel.setSize(c.width,c.height-a)},south:function(c){if(this.isCollapsed){return this.applyLayoutCollapsed(c)}var d=this.splitEl.dom,b=d.style;var a=d.offsetHeight;this.panel.setPosition(c.x,c.y+a);b.left=(c.x)+"px";b.top=(c.y)+"px";b.width=Math.max(0,c.width)+"px";this.panel.setSize(c.width,c.height-a)}},render:function(a,c){Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this,a,c);var d=this.position;this.splitEl=a.createChild({cls:"x-layout-split x-layout-split-"+d,html:" ",id:this.panel.id+"-xsplit"});if(this.collapseMode=="mini"){this.miniSplitEl=this.splitEl.createChild({cls:"x-layout-mini x-layout-mini-"+d,html:" "});this.miniSplitEl.addClassOnOver("x-layout-mini-over");this.miniSplitEl.on("click",this.onCollapseClick,this,{stopEvent:true})}var b=this.splitSettings[d];this.split=new Ext.SplitBar(this.splitEl.dom,c.el,b.orientation);this.split.tickSize=this.tickSize;this.split.placement=b.placement;this.split.getMaximumSize=this[b.maxFn].createDelegate(this);this.split.minSize=this.minSize||this[b.minProp];this.split.on("beforeapply",this.onSplitMove,this);this.split.useShim=this.useShim===true;this.maxSize=this.maxSize||this[b.maxProp];if(c.hidden){this.splitEl.hide()}if(this.useSplitTips){this.splitEl.dom.title=this.collapsible?this.collapsibleSplitTip:this.splitTip}if(this.collapsible){this.splitEl.on("dblclick",this.onCollapseClick,this)}},getSize:function(){if(this.isCollapsed){return this.collapsedEl.getSize()}var a=this.panel.getSize();if(this.position=="north"||this.position=="south"){a.height+=this.splitEl.dom.offsetHeight}else{a.width+=this.splitEl.dom.offsetWidth}return a},getHMaxSize:function(){var b=this.maxSize||10000;var a=this.layout.center;return Math.min(b,(this.el.getWidth()+a.el.getWidth())-a.getMinWidth())},getVMaxSize:function(){var b=this.maxSize||10000;var a=this.layout.center;return Math.min(b,(this.el.getHeight()+a.el.getHeight())-a.getMinHeight())},onSplitMove:function(b,a){var c=this.panel.getSize();this.lastSplitSize=a;if(this.position=="north"||this.position=="south"){this.panel.setSize(c.width,a);this.state.height=a}else{this.panel.setSize(a,c.height);this.state.width=a}this.layout.layout();this.panel.saveState();return false},getSplitBar:function(){return this.split},destroy:function(){Ext.destroy(this.miniSplitEl,this.split,this.splitEl);Ext.layout.BorderLayout.SplitRegion.superclass.destroy.call(this)}});Ext.Container.LAYOUTS.border=Ext.layout.BorderLayout;Ext.layout.FormLayout=Ext.extend(Ext.layout.AnchorLayout,{labelSeparator:":",trackLabels:false,type:"form",onRemove:function(d){Ext.layout.FormLayout.superclass.onRemove.call(this,d);if(this.trackLabels){d.un("show",this.onFieldShow,this);d.un("hide",this.onFieldHide,this)}var b=d.getPositionEl(),a=d.getItemCt&&d.getItemCt();if(d.rendered&&a){if(b&&b.dom){b.insertAfter(a)}Ext.destroy(a);Ext.destroyMembers(d,"label","itemCt");if(d.customItemCt){Ext.destroyMembers(d,"getItemCt","customItemCt")}}},setContainer:function(a){Ext.layout.FormLayout.superclass.setContainer.call(this,a);if(a.labelAlign){a.addClass("x-form-label-"+a.labelAlign)}if(a.hideLabels){Ext.apply(this,{labelStyle:"display:none",elementStyle:"padding-left:0;",labelAdjust:0})}else{this.labelSeparator=a.labelSeparator||this.labelSeparator;a.labelWidth=a.labelWidth||100;if(Ext.isNumber(a.labelWidth)){var b=Ext.isNumber(a.labelPad)?a.labelPad:5;Ext.apply(this,{labelAdjust:a.labelWidth+b,labelStyle:"width:"+a.labelWidth+"px;",elementStyle:"padding-left:"+(a.labelWidth+b)+"px"})}if(a.labelAlign=="top"){Ext.apply(this,{labelStyle:"width:auto;",labelAdjust:0,elementStyle:"padding-left:0;"})}}},isHide:function(a){return a.hideLabel||this.container.hideLabels},onFieldShow:function(a){a.getItemCt().removeClass("x-hide-"+a.hideMode)},onFieldHide:function(a){a.getItemCt().addClass("x-hide-"+a.hideMode)},getLabelStyle:function(e){var b="",c=[this.labelStyle,e];for(var d=0,a=c.length;d=b)||(this.cells[c]&&this.cells[c][a])){if(b&&a>=b){c++;a=0}else{a++}}return[a,c]},renderItem:function(e,a,d){if(!this.table){this.table=d.createChild(Ext.apply({tag:"table",cls:"x-table-layout",cellspacing:0,cn:{tag:"tbody"}},this.tableAttrs),null,true)}if(e&&!e.rendered){e.render(this.getNextCell(e));this.configureItem(e,a)}else{if(e&&!this.isValidParent(e,d)){var b=this.getNextCell(e);b.insertBefore(e.getPositionEl().dom,null);e.container=Ext.get(b);this.configureItem(e,a)}}},isValidParent:function(b,a){return b.getPositionEl().up("table",5).dom.parentNode===(a.dom||a)}});Ext.Container.LAYOUTS.table=Ext.layout.TableLayout;Ext.layout.AbsoluteLayout=Ext.extend(Ext.layout.AnchorLayout,{extraCls:"x-abs-layout-item",type:"absolute",onLayout:function(a,b){b.position();this.paddingLeft=b.getPadding("l");this.paddingTop=b.getPadding("t");Ext.layout.AbsoluteLayout.superclass.onLayout.call(this,a,b)},adjustWidthAnchor:function(b,a){return b?b-a.getPosition(true)[0]+this.paddingLeft:b},adjustHeightAnchor:function(b,a){return b?b-a.getPosition(true)[1]+this.paddingTop:b}});Ext.Container.LAYOUTS.absolute=Ext.layout.AbsoluteLayout;Ext.layout.BoxLayout=Ext.extend(Ext.layout.ContainerLayout,{defaultMargins:{left:0,top:0,right:0,bottom:0},padding:"0",pack:"start",monitorResize:true,type:"box",scrollOffset:0,extraCls:"x-box-item",targetCls:"x-box-layout-ct",innerCls:"x-box-inner",constructor:function(a){Ext.layout.BoxLayout.superclass.constructor.call(this,a);if(Ext.isString(this.defaultMargins)){this.defaultMargins=this.parseMargins(this.defaultMargins)}},onLayout:function(a,d){Ext.layout.BoxLayout.superclass.onLayout.call(this,a,d);var b=this.getVisibleItems(a),c=this.getLayoutTargetSize();this.layoutTargetLastSize=c;this.childBoxCache=this.calculateChildBoxes(b,c);this.updateInnerCtSize(c,this.childBoxCache);this.updateChildBoxes(this.childBoxCache.boxes);this.handleTargetOverflow(c,a,d)},updateChildBoxes:function(c){for(var b=0,e=c.length;b0){s.left=p+H+(r/2)}}z+=s.height+t.bottom}return{boxes:j,meta:{maxWidth:F}}}});Ext.Container.LAYOUTS.vbox=Ext.layout.VBoxLayout;Ext.layout.HBoxLayout=Ext.extend(Ext.layout.BoxLayout,{align:"top",type:"hbox",updateInnerCtSize:function(b,d){var a=b.width,c=d.meta.maxHeight+this.padding.top+this.padding.bottom;if(this.align=="stretch"){c=b.height}else{if(this.align=="middle"){c=Math.max(b.height,c)}}this.innerCt.setSize(a||undefined,c||undefined)},calculateChildBoxes:function(A,e){var n=A.length,y=this.padding,D=y.top,r=y.left,s=D+y.bottom,a=r+y.right,C=e.width-this.scrollOffset,z=e.height,h=Math.max(0,z-s),o=this.pack=="start",p=this.pack=="center",q=this.pack=="end",J=0,B=0,E=0,m=[],l,d,g,c,x,G,F,v,I,j,t;for(F=0;F0){v.top=D+j+(u/2)}}r+=v.width+x.right}return{boxes:m,meta:{maxHeight:B}}}});Ext.Container.LAYOUTS.hbox=Ext.layout.HBoxLayout;Ext.layout.ToolbarLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,type:"toolbar",triggerWidth:18,noItemsMenuText:'
(None)
',lastOverflow:false,tableHTML:['',"","",'",'","","","
','',"",'',"","
","
','',"","","","","","","
",'',"",'',"","
","
",'',"",'',"","
","
","
"].join(""),onLayout:function(e,j){if(!this.leftTr){var h=e.buttonAlign=="center"?"center":"left";j.addClass("x-toolbar-layout-ct");j.insertHtml("beforeEnd",String.format(this.tableHTML,h));this.leftTr=j.child("tr.x-toolbar-left-row",true);this.rightTr=j.child("tr.x-toolbar-right-row",true);this.extrasTr=j.child("tr.x-toolbar-extras-row",true);if(this.hiddenItem==undefined){this.hiddenItems=[]}}var k=e.buttonAlign=="right"?this.rightTr:this.leftTr,l=e.items.items,d=0;for(var b=0,g=l.length,m;b=0&&(d=e[a]);a--){if(!d.firstChild){b.removeChild(d)}}},insertCell:function(e,b,a){var d=document.createElement("td");d.className="x-toolbar-cell";b.insertBefore(d,b.childNodes[a]||null);return d},hideItem:function(a){this.hiddenItems.push(a);a.xtbHidden=true;a.xtbWidth=a.getPositionEl().dom.parentNode.offsetWidth;a.hide()},unhideItem:function(a){a.show();a.xtbHidden=false;this.hiddenItems.remove(a)},getItemWidth:function(a){return a.hidden?(a.xtbWidth||0):a.getPositionEl().dom.parentNode.offsetWidth},fitToSize:function(k){if(this.container.enableOverflow===false){return}var b=k.dom.clientWidth,j=k.dom.firstChild.offsetWidth,m=b-this.triggerWidth,a=this.lastWidth||0,c=this.hiddenItems,e=c.length!=0,n=b>=a;this.lastWidth=b;if(j>b||(e&&n)){var l=this.container.items.items,h=l.length,d=0,o;for(var g=0;gm){if(!(o.hidden||o.xtbHidden)){this.hideItem(o)}}else{if(o.xtbHidden){this.unhideItem(o)}}}}}e=c.length!=0;if(e){this.initMore();if(!this.lastOverflow){this.container.fireEvent("overflowchange",this.container,true);this.lastOverflow=true}}else{if(this.more){this.clearMenu();this.more.destroy();delete this.more;if(this.lastOverflow){this.container.fireEvent("overflowchange",this.container,false);this.lastOverflow=false}}}},createMenuConfig:function(c,a){var b=Ext.apply({},c.initialConfig),d=c.toggleGroup;Ext.copyTo(b,c,["iconCls","icon","itemId","disabled","handler","scope","menu"]);Ext.apply(b,{text:c.overflowText||c.text,hideOnClick:a});if(d||c.enableToggle){Ext.apply(b,{group:d,checked:c.pressed,listeners:{checkchange:function(g,e){c.toggle(e)}}})}delete b.ownerCt;delete b.xtype;delete b.id;return b},addComponentToMenu:function(b,a){if(a instanceof Ext.Toolbar.Separator){b.add("-")}else{if(Ext.isFunction(a.isXType)){if(a.isXType("splitbutton")){b.add(this.createMenuConfig(a,true))}else{if(a.isXType("button")){b.add(this.createMenuConfig(a,!a.menu))}else{if(a.isXType("buttongroup")){a.items.each(function(c){this.addComponentToMenu(b,c)},this)}}}}}},clearMenu:function(){var a=this.moreMenu;if(a&&a.items){a.items.each(function(b){delete b.menu})}},beforeMoreShow:function(h){var b=this.container.items.items,a=b.length,g,e;var c=function(j,i){return j.isXType("buttongroup")&&!(i instanceof Ext.Toolbar.Separator)};this.clearMenu();h.removeAll();for(var d=0;d','','',"","")}if(g&&!g.rendered){if(Ext.isNumber(b)){b=e.dom.childNodes[b]}var d=this.getItemArgs(g);g.render(g.positionEl=b?this.itemTpl.insertBefore(b,d,true):this.itemTpl.append(e,d,true));g.positionEl.menuItemId=g.getItemId();if(!d.isMenuItem&&d.needsIcon){g.positionEl.addClass("x-menu-list-item-indent")}this.configureItem(g,b)}else{if(g&&!this.isValidParent(g,e)){if(Ext.isNumber(b)){b=e.dom.childNodes[b]}e.dom.insertBefore(g.getActionEl().dom,b||null)}}},getItemArgs:function(b){var a=b instanceof Ext.menu.Item;return{isMenuItem:a,needsIcon:!a&&(b.icon||b.iconCls),icon:b.icon||Ext.BLANK_IMAGE_URL,iconCls:"x-menu-item-icon "+(b.iconCls||""),itemId:"x-menu-el-"+b.id,itemCls:"x-menu-list-item "}},isValidParent:function(b,a){return b.el.up("li.x-menu-list-item",5).dom.parentNode===(a.dom||a)},onLayout:function(a,b){Ext.layout.MenuLayout.superclass.onLayout.call(this,a,b);this.doAutoSize()},doAutoSize:function(){var c=this.container,a=c.width;if(c.floating){if(a){c.setWidth(a)}else{if(Ext.isIE){c.setWidth(Ext.isStrict&&(Ext.isIE7||Ext.isIE8)?"auto":c.minWidth);var d=c.getEl(),b=d.dom.offsetWidth;c.setWidth(c.getLayoutTarget().getWidth()+d.getFrameWidth("lr"))}}}}});Ext.Container.LAYOUTS.menu=Ext.layout.MenuLayout;Ext.Viewport=Ext.extend(Ext.Container,{initComponent:function(){Ext.Viewport.superclass.initComponent.call(this);document.getElementsByTagName("html")[0].className+=" x-viewport";this.el=Ext.getBody();this.el.setHeight=Ext.emptyFn;this.el.setWidth=Ext.emptyFn;this.el.setSize=Ext.emptyFn;this.el.dom.scroll="no";this.allowDomMove=false;this.autoWidth=true;this.autoHeight=true;Ext.EventManager.onWindowResize(this.fireResize,this);this.renderTo=this.el},fireResize:function(a,b){this.fireEvent("resize",this,a,b,a,b)}});Ext.reg("viewport",Ext.Viewport);Ext.Panel=Ext.extend(Ext.Container,{baseCls:"x-panel",collapsedCls:"x-panel-collapsed",maskDisabled:true,animCollapse:Ext.enableFx,headerAsText:true,buttonAlign:"right",collapsed:false,collapseFirst:true,minButtonWidth:75,elements:"body",preventBodyReset:false,padding:undefined,resizeEvent:"bodyresize",toolTarget:"header",collapseEl:"bwrap",slideAnchor:"t",disabledClass:"",deferHeight:true,expandDefaults:{duration:0.25},collapseDefaults:{duration:0.25},initComponent:function(){Ext.Panel.superclass.initComponent.call(this);this.addEvents("bodyresize","titlechange","iconchange","collapse","expand","beforecollapse","beforeexpand","beforeclose","close","activate","deactivate");if(this.unstyled){this.baseCls="x-plain"}this.toolbars=[];if(this.tbar){this.elements+=",tbar";this.topToolbar=this.createToolbar(this.tbar);this.tbar=null}if(this.bbar){this.elements+=",bbar";this.bottomToolbar=this.createToolbar(this.bbar);this.bbar=null}if(this.header===true){this.elements+=",header";this.header=null}else{if(this.headerCfg||(this.title&&this.header!==false)){this.elements+=",header"}}if(this.footerCfg||this.footer===true){this.elements+=",footer";this.footer=null}if(this.buttons){this.fbar=this.buttons;this.buttons=null}if(this.fbar){this.createFbar(this.fbar)}if(this.autoLoad){this.on("render",this.doAutoLoad,this,{delay:10})}},createFbar:function(b){var a=this.minButtonWidth;this.elements+=",footer";this.fbar=this.createToolbar(b,{buttonAlign:this.buttonAlign,toolbarCls:"x-panel-fbar",enableOverflow:false,defaults:function(d){return{minWidth:d.minWidth||a}}});this.fbar.items.each(function(d){d.minWidth=d.minWidth||this.minButtonWidth},this);this.buttons=this.fbar.items.items},createToolbar:function(b,c){var a;if(Ext.isArray(b)){b={items:b}}a=b.events?Ext.apply(b,c):this.createComponent(Ext.apply({},b,c),"toolbar");this.toolbars.push(a);return a},createElement:function(a,c){if(this[a]){c.appendChild(this[a].dom);return}if(a==="bwrap"||this.elements.indexOf(a)!=-1){if(this[a+"Cfg"]){this[a]=Ext.fly(c).createChild(this[a+"Cfg"])}else{var b=document.createElement("div");b.className=this[a+"Cls"];this[a]=Ext.get(c.appendChild(b))}if(this[a+"CssClass"]){this[a].addClass(this[a+"CssClass"])}if(this[a+"Style"]){this[a].applyStyles(this[a+"Style"])}}},onRender:function(g,e){Ext.Panel.superclass.onRender.call(this,g,e);this.createClasses();var a=this.el,h=a.dom,k,i;if(this.collapsible&&!this.hideCollapseTool){this.tools=this.tools?this.tools.slice(0):[];this.tools[this.collapseFirst?"unshift":"push"]({id:"toggle",handler:this.toggleCollapse,scope:this})}if(this.tools){i=this.tools;this.elements+=(this.header!==false)?",header":""}this.tools={};a.addClass(this.baseCls);if(h.firstChild){this.header=a.down("."+this.headerCls);this.bwrap=a.down("."+this.bwrapCls);var j=this.bwrap?this.bwrap:a;this.tbar=j.down("."+this.tbarCls);this.body=j.down("."+this.bodyCls);this.bbar=j.down("."+this.bbarCls);this.footer=j.down("."+this.footerCls);this.fromMarkup=true}if(this.preventBodyReset===true){a.addClass("x-panel-reset")}if(this.cls){a.addClass(this.cls)}if(this.buttons){this.elements+=",footer"}if(this.frame){a.insertHtml("afterBegin",String.format(Ext.Element.boxMarkup,this.baseCls));this.createElement("header",h.firstChild.firstChild.firstChild);this.createElement("bwrap",h);k=this.bwrap.dom;var c=h.childNodes[1],b=h.childNodes[2];k.appendChild(c);k.appendChild(b);var l=k.firstChild.firstChild.firstChild;this.createElement("tbar",l);this.createElement("body",l);this.createElement("bbar",l);this.createElement("footer",k.lastChild.firstChild.firstChild);if(!this.footer){this.bwrap.dom.lastChild.className+=" x-panel-nofooter"}this.ft=Ext.get(this.bwrap.dom.lastChild);this.mc=Ext.get(l)}else{this.createElement("header",h);this.createElement("bwrap",h);k=this.bwrap.dom;this.createElement("tbar",k);this.createElement("body",k);this.createElement("bbar",k);this.createElement("footer",k);if(!this.header){this.body.addClass(this.bodyCls+"-noheader");if(this.tbar){this.tbar.addClass(this.tbarCls+"-noheader")}}}if(Ext.isDefined(this.padding)){this.body.setStyle("padding",this.body.addUnits(this.padding))}if(this.border===false){this.el.addClass(this.baseCls+"-noborder");this.body.addClass(this.bodyCls+"-noborder");if(this.header){this.header.addClass(this.headerCls+"-noborder")}if(this.footer){this.footer.addClass(this.footerCls+"-noborder")}if(this.tbar){this.tbar.addClass(this.tbarCls+"-noborder")}if(this.bbar){this.bbar.addClass(this.bbarCls+"-noborder")}}if(this.bodyBorder===false){this.body.addClass(this.bodyCls+"-noborder")}this.bwrap.enableDisplayMode("block");if(this.header){this.header.unselectable();if(this.headerAsText){this.header.dom.innerHTML=''+this.header.dom.innerHTML+"";if(this.iconCls){this.setIconClass(this.iconCls)}}}if(this.floating){this.makeFloating(this.floating)}if(this.collapsible&&this.titleCollapse&&this.header){this.mon(this.header,"click",this.toggleCollapse,this);this.header.setStyle("cursor","pointer")}if(i){this.addTool.apply(this,i)}if(this.fbar){this.footer.addClass("x-panel-btns");this.fbar.ownerCt=this;this.fbar.render(this.footer);this.footer.createChild({cls:"x-clear"})}if(this.tbar&&this.topToolbar){this.topToolbar.ownerCt=this;this.topToolbar.render(this.tbar)}if(this.bbar&&this.bottomToolbar){this.bottomToolbar.ownerCt=this;this.bottomToolbar.render(this.bbar)}},setIconClass:function(b){var a=this.iconCls;this.iconCls=b;if(this.rendered&&this.header){if(this.frame){this.header.addClass("x-panel-icon");this.header.replaceClass(a,this.iconCls)}else{var e=this.header,c=e.child("img.x-panel-inline-icon");if(c){Ext.fly(c).replaceClass(a,this.iconCls)}else{var d=e.child("span."+this.headerTextCls);if(d){Ext.DomHelper.insertBefore(d.dom,{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-panel-inline-icon "+this.iconCls})}}}}this.fireEvent("iconchange",this,b,a)},makeFloating:function(a){this.floating=true;this.el=new Ext.Layer(Ext.apply({},a,{shadow:Ext.isDefined(this.shadow)?this.shadow:"sides",shadowOffset:this.shadowOffset,constrain:false,shim:this.shim===false?false:undefined}),this.el)},getTopToolbar:function(){return this.topToolbar},getBottomToolbar:function(){return this.bottomToolbar},getFooterToolbar:function(){return this.fbar},addButton:function(a,c,b){if(!this.fbar){this.createFbar([])}if(c){if(Ext.isString(a)){a={text:a}}a=Ext.apply({handler:c,scope:b},a)}return this.fbar.add(a)},addTool:function(){if(!this.rendered){if(!this.tools){this.tools=[]}Ext.each(arguments,function(a){this.tools.push(a)},this);return}if(!this[this.toolTarget]){return}if(!this.toolTemplate){var h=new Ext.Template('
 
');h.disableFormats=true;h.compile();Ext.Panel.prototype.toolTemplate=h}for(var g=0,d=arguments,c=d.length;g0){Ext.each(this.toolbars,function(c){c.doLayout(undefined,a)});this.syncHeight()}},syncHeight:function(){var b=this.toolbarHeight,c=this.body,a=this.lastSize.height,d;if(this.autoHeight||!Ext.isDefined(a)||a=="auto"){return}if(b!=this.getToolbarHeight()){b=Math.max(0,a-this.getFrameHeight());c.setHeight(b);d=c.getSize();this.toolbarHeight=this.getToolbarHeight();this.onBodyResize(d.width,d.height)}},onShow:function(){if(this.floating){return this.el.show()}Ext.Panel.superclass.onShow.call(this)},onHide:function(){if(this.floating){return this.el.hide()}Ext.Panel.superclass.onHide.call(this)},createToolHandler:function(c,a,d,b){return function(g){c.removeClass(d);if(a.stopEvent!==false){g.stopEvent()}if(a.handler){a.handler.call(a.scope||c,g,c,b,a)}}},afterRender:function(){if(this.floating&&!this.hidden){this.el.show()}if(this.title){this.setTitle(this.title)}Ext.Panel.superclass.afterRender.call(this);if(this.collapsed){this.collapsed=false;this.collapse(false)}this.initEvents()},getKeyMap:function(){if(!this.keyMap){this.keyMap=new Ext.KeyMap(this.el,this.keys)}return this.keyMap},initEvents:function(){if(this.keys){this.getKeyMap()}if(this.draggable){this.initDraggable()}if(this.toolbars.length>0){Ext.each(this.toolbars,function(a){a.doLayout();a.on({scope:this,afterlayout:this.syncHeight,remove:this.syncHeight})},this);this.syncHeight()}},initDraggable:function(){this.dd=new Ext.Panel.DD(this,Ext.isBoolean(this.draggable)?null:this.draggable)},beforeEffect:function(a){if(this.floating){this.el.beforeAction()}if(a!==false){this.el.addClass("x-panel-animated")}},afterEffect:function(a){this.syncShadow();this.el.removeClass("x-panel-animated")},createEffect:function(c,b,d){var e={scope:d,block:true};if(c===true){e.callback=b;return e}else{if(!c.callback){e.callback=b}else{e.callback=function(){b.call(d);Ext.callback(c.callback,c.scope)}}}return Ext.applyIf(e,c)},collapse:function(b){if(this.collapsed||this.el.hasFxBlock()||this.fireEvent("beforecollapse",this,b)===false){return}var a=b===true||(b!==false&&this.animCollapse);this.beforeEffect(a);this.onCollapse(a,b);return this},onCollapse:function(a,b){if(a){this[this.collapseEl].slideOut(this.slideAnchor,Ext.apply(this.createEffect(b||true,this.afterCollapse,this),this.collapseDefaults))}else{this[this.collapseEl].hide(this.hideMode);this.afterCollapse(false)}},afterCollapse:function(a){this.collapsed=true;this.el.addClass(this.collapsedCls);if(a!==false){this[this.collapseEl].hide(this.hideMode)}this.afterEffect(a);this.cascade(function(b){if(b.lastSize){b.lastSize={width:0,height:0}}});this.fireEvent("collapse",this)},expand:function(b){if(!this.collapsed||this.el.hasFxBlock()||this.fireEvent("beforeexpand",this,b)===false){return}var a=b===true||(b!==false&&this.animCollapse);this.el.removeClass(this.collapsedCls);this.beforeEffect(a);this.onExpand(a,b);return this},onExpand:function(a,b){if(a){this[this.collapseEl].slideIn(this.slideAnchor,Ext.apply(this.createEffect(b||true,this.afterExpand,this),this.expandDefaults))}else{this[this.collapseEl].show(this.hideMode);this.afterExpand(false)}},afterExpand:function(a){this.collapsed=false;if(a!==false){this[this.collapseEl].show(this.hideMode)}this.afterEffect(a);if(this.deferLayout){delete this.deferLayout;this.doLayout(true)}this.fireEvent("expand",this)},toggleCollapse:function(a){this[this.collapsed?"expand":"collapse"](a);return this},onDisable:function(){if(this.rendered&&this.maskDisabled){this.el.mask()}Ext.Panel.superclass.onDisable.call(this)},onEnable:function(){if(this.rendered&&this.maskDisabled){this.el.unmask()}Ext.Panel.superclass.onEnable.call(this)},onResize:function(g,d,c,e){var a=g,b=d;if(Ext.isDefined(a)||Ext.isDefined(b)){if(!this.collapsed){if(Ext.isNumber(a)){this.body.setWidth(a=this.adjustBodyWidth(a-this.getFrameWidth()))}else{if(a=="auto"){a=this.body.setWidth("auto").dom.offsetWidth}else{a=this.body.dom.offsetWidth}}if(this.tbar){this.tbar.setWidth(a);if(this.topToolbar){this.topToolbar.setSize(a)}}if(this.bbar){this.bbar.setWidth(a);if(this.bottomToolbar){this.bottomToolbar.setSize(a);if(Ext.isIE){this.bbar.setStyle("position","static");this.bbar.setStyle("position","")}}}if(this.footer){this.footer.setWidth(a);if(this.fbar){this.fbar.setSize(Ext.isIE?(a-this.footer.getFrameWidth("lr")):"auto")}}if(Ext.isNumber(b)){b=Math.max(0,b-this.getFrameHeight());this.body.setHeight(b)}else{if(b=="auto"){this.body.setHeight(b)}}if(this.disabled&&this.el._mask){this.el._mask.setSize(this.el.dom.clientWidth,this.el.getHeight())}}else{this.queuedBodySize={width:a,height:b};if(!this.queuedExpand&&this.allowQueuedExpand!==false){this.queuedExpand=true;this.on("expand",function(){delete this.queuedExpand;this.onResize(this.queuedBodySize.width,this.queuedBodySize.height)},this,{single:true})}}this.onBodyResize(a,b)}this.syncShadow();Ext.Panel.superclass.onResize.call(this,g,d,c,e)},onBodyResize:function(a,b){this.fireEvent("bodyresize",this,a,b)},getToolbarHeight:function(){var a=0;if(this.rendered){Ext.each(this.toolbars,function(b){a+=b.getHeight()},this)}return a},adjustBodyHeight:function(a){return a},adjustBodyWidth:function(a){return a},onPosition:function(){this.syncShadow()},getFrameWidth:function(){var b=this.el.getFrameWidth("lr")+this.bwrap.getFrameWidth("lr");if(this.frame){var a=this.bwrap.dom.firstChild;b+=(Ext.fly(a).getFrameWidth("l")+Ext.fly(a.firstChild).getFrameWidth("r"));b+=this.mc.getFrameWidth("lr")}return b},getFrameHeight:function(){var a=Math.max(0,this.getHeight()-this.body.getHeight());if(isNaN(a)){a=0}return a},getInnerWidth:function(){return this.getSize().width-this.getFrameWidth()},getInnerHeight:function(){return this.body.getHeight()},syncShadow:function(){if(this.floating){this.el.sync(true)}},getLayoutTarget:function(){return this.body},getContentTarget:function(){return this.body},setTitle:function(b,a){this.title=b;if(this.header&&this.headerAsText){this.header.child("span").update(b)}if(a){this.setIconClass(a)}this.fireEvent("titlechange",this,b);return this},getUpdater:function(){return this.body.getUpdater()},load:function(){var a=this.body.getUpdater();a.update.apply(a,arguments);return this},beforeDestroy:function(){Ext.Panel.superclass.beforeDestroy.call(this);if(this.header){this.header.removeAllListeners()}if(this.tools){for(var a in this.tools){Ext.destroy(this.tools[a])}}if(this.toolbars.length>0){Ext.each(this.toolbars,function(b){b.un("afterlayout",this.syncHeight,this);b.un("remove",this.syncHeight,this)},this)}if(Ext.isArray(this.buttons)){while(this.buttons.length){Ext.destroy(this.buttons[0])}}if(this.rendered){Ext.destroy(this.ft,this.header,this.footer,this.toolbars,this.tbar,this.bbar,this.body,this.mc,this.bwrap);if(this.fbar){Ext.destroy(this.fbar,this.fbar.el)}}else{Ext.destroy(this.topToolbar,this.bottomToolbar)}},createClasses:function(){this.headerCls=this.baseCls+"-header";this.headerTextCls=this.baseCls+"-header-text";this.bwrapCls=this.baseCls+"-bwrap";this.tbarCls=this.baseCls+"-tbar";this.bodyCls=this.baseCls+"-body";this.bbarCls=this.baseCls+"-bbar";this.footerCls=this.baseCls+"-footer"},createGhost:function(a,e,b){var d=document.createElement("div");d.className="x-panel-ghost "+(a?a:"");if(this.header){d.appendChild(this.el.dom.firstChild.cloneNode(true))}Ext.fly(d.appendChild(document.createElement("ul"))).setHeight(this.bwrap.getHeight());d.style.width=this.el.dom.offsetWidth+"px";if(!b){this.container.dom.appendChild(d)}else{Ext.getDom(b).appendChild(d)}if(e!==false&&this.el.useShim!==false){var c=new Ext.Layer({shadow:false,useDisplay:true,constrain:false},d);c.show();return c}else{return new Ext.Element(d)}},doAutoLoad:function(){var a=this.body.getUpdater();if(this.renderer){a.setRenderer(this.renderer)}a.update(Ext.isObject(this.autoLoad)?this.autoLoad:{url:this.autoLoad})},getTool:function(a){return this.tools[a]}});Ext.reg("panel",Ext.Panel);Ext.Editor=function(b,a){if(b.field){this.field=Ext.create(b.field,"textfield");a=Ext.apply({},b);delete a.field}else{this.field=b}Ext.Editor.superclass.constructor.call(this,a)};Ext.extend(Ext.Editor,Ext.Component,{allowBlur:true,value:"",alignment:"c-c?",offsets:[0,0],shadow:"frame",constrain:false,swallowKeys:true,completeOnEnter:true,cancelOnEsc:true,updateEl:false,initComponent:function(){Ext.Editor.superclass.initComponent.call(this);this.addEvents("beforestartedit","startedit","beforecomplete","complete","canceledit","specialkey")},onRender:function(b,a){this.el=new Ext.Layer({shadow:this.shadow,cls:"x-editor",parentEl:b,shim:this.shim,shadowOffset:this.shadowOffset||4,id:this.id,constrain:this.constrain});if(this.zIndex){this.el.setZIndex(this.zIndex)}this.el.setStyle("overflow",Ext.isGecko?"auto":"hidden");if(this.field.msgTarget!="title"){this.field.msgTarget="qtip"}this.field.inEditor=true;this.mon(this.field,{scope:this,blur:this.onBlur,specialkey:this.onSpecialKey});if(this.field.grow){this.mon(this.field,"autosize",this.el.sync,this.el,{delay:1})}this.field.render(this.el).show();this.field.getEl().dom.name="";if(this.swallowKeys){this.field.el.swallowEvent(["keypress","keydown"])}},onSpecialKey:function(g,d){var b=d.getKey(),a=this.completeOnEnter&&b==d.ENTER,c=this.cancelOnEsc&&b==d.ESC;if(a||c){d.stopEvent();if(a){this.completeEdit()}else{this.cancelEdit()}if(g.triggerBlur){g.triggerBlur()}}this.fireEvent("specialkey",g,d)},startEdit:function(b,c){if(this.editing){this.completeEdit()}this.boundEl=Ext.get(b);var a=c!==undefined?c:this.boundEl.dom.innerHTML;if(!this.rendered){this.render(this.parentEl||document.body)}if(this.fireEvent("beforestartedit",this,this.boundEl,a)!==false){this.startValue=a;this.field.reset();this.field.setValue(a);this.realign(true);this.editing=true;this.show()}},doAutoSize:function(){if(this.autoSize){var b=this.boundEl.getSize(),a=this.field.getSize();switch(this.autoSize){case"width":this.setSize(b.width,a.height);break;case"height":this.setSize(a.width,b.height);break;case"none":this.setSize(a.width,a.height);break;default:this.setSize(b.width,b.height)}}},setSize:function(a,b){delete this.field.lastSize;this.field.setSize(a,b);if(this.el){if(Ext.isGecko2||Ext.isOpera){this.el.setSize(a,b)}this.el.sync()}},realign:function(a){if(a===true){this.doAutoSize()}this.el.alignTo(this.boundEl,this.alignment,this.offsets)},completeEdit:function(a){if(!this.editing){return}if(this.field.assertValue){this.field.assertValue()}var b=this.getValue();if(!this.field.isValid()){if(this.revertInvalid!==false){this.cancelEdit(a)}return}if(String(b)===String(this.startValue)&&this.ignoreNoChange){this.hideEdit(a);return}if(this.fireEvent("beforecomplete",this,b,this.startValue)!==false){b=this.getValue();if(this.updateEl&&this.boundEl){this.boundEl.update(b)}this.hideEdit(a);this.fireEvent("complete",this,b,this.startValue)}},onShow:function(){this.el.show();if(this.hideEl!==false){this.boundEl.hide()}this.field.show().focus(false,true);this.fireEvent("startedit",this.boundEl,this.startValue)},cancelEdit:function(a){if(this.editing){var b=this.getValue();this.setValue(this.startValue);this.hideEdit(a);this.fireEvent("canceledit",this,b,this.startValue)}},hideEdit:function(a){if(a!==true){this.editing=false;this.hide()}},onBlur:function(){if(this.allowBlur===true&&this.editing&&this.selectSameEditor!==true){this.completeEdit()}},onHide:function(){if(this.editing){this.completeEdit();return}this.field.blur();if(this.field.collapse){this.field.collapse()}this.el.hide();if(this.hideEl!==false){this.boundEl.show()}},setValue:function(a){this.field.setValue(a)},getValue:function(){return this.field.getValue()},beforeDestroy:function(){Ext.destroyMembers(this,"field");delete this.parentEl;delete this.boundEl}});Ext.reg("editor",Ext.Editor);Ext.ColorPalette=Ext.extend(Ext.Component,{itemCls:"x-color-palette",value:null,clickEvent:"click",ctype:"Ext.ColorPalette",allowReselect:false,colors:["000000","993300","333300","003300","003366","000080","333399","333333","800000","FF6600","808000","008000","008080","0000FF","666699","808080","FF0000","FF9900","99CC00","339966","33CCCC","3366FF","800080","969696","FF00FF","FFCC00","FFFF00","00FF00","00FFFF","00CCFF","993366","C0C0C0","FF99CC","FFCC99","FFFF99","CCFFCC","CCFFFF","99CCFF","CC99FF","FFFFFF"],initComponent:function(){Ext.ColorPalette.superclass.initComponent.call(this);this.addEvents("select");if(this.handler){this.on("select",this.handler,this.scope,true)}},onRender:function(b,a){this.autoEl={tag:"div",cls:this.itemCls};Ext.ColorPalette.superclass.onRender.call(this,b,a);var c=this.tpl||new Ext.XTemplate(' ');c.overwrite(this.el,this.colors);this.mon(this.el,this.clickEvent,this.handleClick,this,{delegate:"a"});if(this.clickEvent!="click"){this.mon(this.el,"click",Ext.emptyFn,this,{delegate:"a",preventDefault:true})}},afterRender:function(){Ext.ColorPalette.superclass.afterRender.call(this);if(this.value){var a=this.value;this.value=null;this.select(a)}},handleClick:function(b,a){b.preventDefault();if(!this.disabled){var d=a.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];this.select(d.toUpperCase())}},select:function(a){a=a.replace("#","");if(a!=this.value||this.allowReselect){var b=this.el;if(this.value){b.child("a.color-"+this.value).removeClass("x-color-palette-sel")}b.child("a.color-"+a).addClass("x-color-palette-sel");this.value=a;this.fireEvent("select",this,a)}}});Ext.reg("colorpalette",Ext.ColorPalette);Ext.DatePicker=Ext.extend(Ext.BoxComponent,{todayText:"Today",okText:" OK ",cancelText:"Cancel",todayTip:"{0} (Spacebar)",minText:"This date is before the minimum date",maxText:"This date is after the maximum date",format:"m/d/y",disabledDaysText:"Disabled",disabledDatesText:"Disabled",monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:"Next Month (Control+Right)",prevText:"Previous Month (Control+Left)",monthYearText:"Choose a month (Control+Up/Down to move years)",startDay:0,showToday:true,focusOnSelect:true,initHour:12,initComponent:function(){Ext.DatePicker.superclass.initComponent.call(this);this.value=this.value?this.value.clearTime(true):new Date().clearTime();this.addEvents("select");if(this.handler){this.on("select",this.handler,this.scope||this)}this.initDisabledDays()},initDisabledDays:function(){if(!this.disabledDatesRE&&this.disabledDates){var b=this.disabledDates,a=b.length-1,c="(?:";Ext.each(b,function(g,e){c+=Ext.isDate(g)?"^"+Ext.escapeRe(g.dateFormat(this.format))+"$":b[e];if(e!=a){c+="|"}},this);this.disabledDatesRE=new RegExp(c+")")}},setDisabledDates:function(a){if(Ext.isArray(a)){this.disabledDates=a;this.disabledDatesRE=null}else{this.disabledDatesRE=a}this.initDisabledDays();this.update(this.value,true)},setDisabledDays:function(a){this.disabledDays=a;this.update(this.value,true)},setMinDate:function(a){this.minDate=a;this.update(this.value,true)},setMaxDate:function(a){this.maxDate=a;this.update(this.value,true)},setValue:function(a){this.value=a.clearTime(true);this.update(this.value)},getValue:function(){return this.value},focus:function(){this.update(this.activeDate)},onEnable:function(a){Ext.DatePicker.superclass.onEnable.call(this);this.doDisabled(false);this.update(a?this.value:this.activeDate);if(Ext.isIE){this.el.repaint()}},onDisable:function(){Ext.DatePicker.superclass.onDisable.call(this);this.doDisabled(true);if(Ext.isIE&&!Ext.isIE8){Ext.each([].concat(this.textNodes,this.el.query("th span")),function(a){Ext.fly(a).repaint()})}},doDisabled:function(a){this.keyNav.setDisabled(a);this.prevRepeater.setDisabled(a);this.nextRepeater.setDisabled(a);if(this.showToday){this.todayKeyListener.setDisabled(a);this.todayBtn.setDisabled(a)}},onRender:function(e,b){var a=['','','",this.showToday?'':"",'
  
'],c=this.dayNames,h;for(h=0;h<7;h++){var k=this.startDay+h;if(k>6){k=k-7}a.push("")}a[a.length]="";for(h=0;h<42;h++){if(h%7===0&&h!==0){a[a.length]=""}a[a.length]=''}a.push("
",c[k].substr(0,1),"
');var j=document.createElement("div");j.className="x-date-picker";j.innerHTML=a.join("");e.dom.insertBefore(j,b);this.el=Ext.get(j);this.eventEl=Ext.get(j.firstChild);this.prevRepeater=new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"),{handler:this.showPrevMonth,scope:this,preventDefault:true,stopDefault:true});this.nextRepeater=new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"),{handler:this.showNextMonth,scope:this,preventDefault:true,stopDefault:true});this.monthPicker=this.el.down("div.x-date-mp");this.monthPicker.enableDisplayMode("block");this.keyNav=new Ext.KeyNav(this.eventEl,{left:function(d){if(d.ctrlKey){this.showPrevMonth()}else{this.update(this.activeDate.add("d",-1))}},right:function(d){if(d.ctrlKey){this.showNextMonth()}else{this.update(this.activeDate.add("d",1))}},up:function(d){if(d.ctrlKey){this.showNextYear()}else{this.update(this.activeDate.add("d",-7))}},down:function(d){if(d.ctrlKey){this.showPrevYear()}else{this.update(this.activeDate.add("d",7))}},pageUp:function(d){this.showNextMonth()},pageDown:function(d){this.showPrevMonth()},enter:function(d){d.stopPropagation();return true},scope:this});this.el.unselectable();this.cells=this.el.select("table.x-date-inner tbody td");this.textNodes=this.el.query("table.x-date-inner tbody span");this.mbtn=new Ext.Button({text:" ",tooltip:this.monthYearText,renderTo:this.el.child("td.x-date-middle",true)});this.mbtn.el.child("em").addClass("x-btn-arrow");if(this.showToday){this.todayKeyListener=this.eventEl.addKeyListener(Ext.EventObject.SPACE,this.selectToday,this);var g=(new Date()).dateFormat(this.format);this.todayBtn=new Ext.Button({renderTo:this.el.child("td.x-date-bottom",true),text:String.format(this.todayText,g),tooltip:String.format(this.todayTip,g),handler:this.selectToday,scope:this})}this.mon(this.eventEl,"mousewheel",this.handleMouseWheel,this);this.mon(this.eventEl,"click",this.handleDateClick,this,{delegate:"a.x-date-date"});this.mon(this.mbtn,"click",this.showMonthPicker,this);this.onEnable(true)},createMonthPicker:function(){if(!this.monthPicker.dom.firstChild){var a=[''];for(var b=0;b<6;b++){a.push('",'",b===0?'':'')}a.push('","
',Date.getShortMonthName(b),"',Date.getShortMonthName(b+6),"
");this.monthPicker.update(a.join(""));this.mon(this.monthPicker,"click",this.onMonthClick,this);this.mon(this.monthPicker,"dblclick",this.onMonthDblClick,this);this.mpMonths=this.monthPicker.select("td.x-date-mp-month");this.mpYears=this.monthPicker.select("td.x-date-mp-year");this.mpMonths.each(function(c,d,e){e+=1;if((e%2)===0){c.dom.xmonth=5+Math.round(e*0.5)}else{c.dom.xmonth=Math.round((e-1)*0.5)}})}},showMonthPicker:function(){if(!this.disabled){this.createMonthPicker();var a=this.el.getSize();this.monthPicker.setSize(a);this.monthPicker.child("table").setSize(a);this.mpSelMonth=(this.activeDate||this.value).getMonth();this.updateMPMonth(this.mpSelMonth);this.mpSelYear=(this.activeDate||this.value).getFullYear();this.updateMPYear(this.mpSelYear);this.monthPicker.slideIn("t",{duration:0.2})}},updateMPYear:function(e){this.mpyear=e;var c=this.mpYears.elements;for(var b=1;b<=10;b++){var d=c[b-1],a;if((b%2)===0){a=e+Math.round(b*0.5);d.firstChild.innerHTML=a;d.xyear=a}else{a=e-(5-Math.round(b*0.5));d.firstChild.innerHTML=a;d.xyear=a}this.mpYears.item(b-1)[a==this.mpSelYear?"addClass":"removeClass"]("x-date-mp-sel")}},updateMPMonth:function(a){this.mpMonths.each(function(b,c,d){b[b.dom.xmonth==a?"addClass":"removeClass"]("x-date-mp-sel")})},selectMPMonth:function(a){},onMonthClick:function(g,b){g.stopEvent();var c=new Ext.Element(b),a;if(c.is("button.x-date-mp-cancel")){this.hideMonthPicker()}else{if(c.is("button.x-date-mp-ok")){var h=new Date(this.mpSelYear,this.mpSelMonth,(this.activeDate||this.value).getDate());if(h.getMonth()!=this.mpSelMonth){h=new Date(this.mpSelYear,this.mpSelMonth,1).getLastDateOfMonth()}this.update(h);this.hideMonthPicker()}else{if((a=c.up("td.x-date-mp-month",2))){this.mpMonths.removeClass("x-date-mp-sel");a.addClass("x-date-mp-sel");this.mpSelMonth=a.dom.xmonth}else{if((a=c.up("td.x-date-mp-year",2))){this.mpYears.removeClass("x-date-mp-sel");a.addClass("x-date-mp-sel");this.mpSelYear=a.dom.xyear}else{if(c.is("a.x-date-mp-prev")){this.updateMPYear(this.mpyear-10)}else{if(c.is("a.x-date-mp-next")){this.updateMPYear(this.mpyear+10)}}}}}}},onMonthDblClick:function(d,b){d.stopEvent();var c=new Ext.Element(b),a;if((a=c.up("td.x-date-mp-month",2))){this.update(new Date(this.mpSelYear,a.dom.xmonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker()}else{if((a=c.up("td.x-date-mp-year",2))){this.update(new Date(a.dom.xyear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker()}}},hideMonthPicker:function(a){if(this.monthPicker){if(a===true){this.monthPicker.hide()}else{this.monthPicker.slideOut("t",{duration:0.2})}}},showPrevMonth:function(a){this.update(this.activeDate.add("mo",-1))},showNextMonth:function(a){this.update(this.activeDate.add("mo",1))},showPrevYear:function(){this.update(this.activeDate.add("y",-1))},showNextYear:function(){this.update(this.activeDate.add("y",1))},handleMouseWheel:function(a){a.stopEvent();if(!this.disabled){var b=a.getWheelDelta();if(b>0){this.showPrevMonth()}else{if(b<0){this.showNextMonth()}}}},handleDateClick:function(b,a){b.stopEvent();if(!this.disabled&&a.dateValue&&!Ext.fly(a.parentNode).hasClass("x-date-disabled")){this.cancelFocus=this.focusOnSelect===false;this.setValue(new Date(a.dateValue));delete this.cancelFocus;this.fireEvent("select",this,this.value)}},selectToday:function(){if(this.todayBtn&&!this.todayBtn.disabled){this.setValue(new Date().clearTime());this.fireEvent("select",this,this.value)}},update:function(G,A){if(this.rendered){var a=this.activeDate,p=this.isVisible();this.activeDate=G;if(!A&&a&&this.el){var o=G.getTime();if(a.getMonth()==G.getMonth()&&a.getFullYear()==G.getFullYear()){this.cells.removeClass("x-date-selected");this.cells.each(function(d){if(d.dom.firstChild.dateValue==o){d.addClass("x-date-selected");if(p&&!this.cancelFocus){Ext.fly(d.dom.firstChild).focus(50)}return false}},this);return}}var k=G.getDaysInMonth(),q=G.getFirstDateOfMonth(),g=q.getDay()-this.startDay;if(g<0){g+=7}k+=g;var B=G.add("mo",-1),h=B.getDaysInMonth()-g,e=this.cells.elements,r=this.textNodes,D=(new Date(B.getFullYear(),B.getMonth(),h,this.initHour)),C=new Date().clearTime().getTime(),v=G.clearTime(true).getTime(),u=this.minDate?this.minDate.clearTime(true):Number.NEGATIVE_INFINITY,y=this.maxDate?this.maxDate.clearTime(true):Number.POSITIVE_INFINITY,F=this.disabledDatesRE,s=this.disabledDatesText,I=this.disabledDays?this.disabledDays.join(""):false,E=this.disabledDaysText,z=this.format;if(this.showToday){var m=new Date().clearTime(),c=(my||(F&&z&&F.test(m.dateFormat(z)))||(I&&I.indexOf(m.getDay())!=-1));if(!this.disabled){this.todayBtn.setDisabled(c);this.todayKeyListener[c?"disable":"enable"]()}}var l=function(K,d){d.title="";var i=D.clearTime(true).getTime();d.firstChild.dateValue=i;if(i==C){d.className+=" x-date-today";d.title=K.todayText}if(i==v){d.className+=" x-date-selected";if(p){Ext.fly(d.firstChild).focus(50)}}if(iy){d.className=" x-date-disabled";d.title=K.maxText;return}if(I){if(I.indexOf(D.getDay())!=-1){d.title=E;d.className=" x-date-disabled"}}if(F&&z){var J=D.dateFormat(z);if(F.test(J)){d.title=s.replace("%0",J);d.className=" x-date-disabled"}}};var x=0;for(;x=a.value){d=a.value}}c.setValue(b,d,false);c.fireEvent("drag",c,g,this)},getNewValue:function(){var a=this.slider,b=a.innerEl.translatePoints(this.tracker.getXY());return Ext.util.Format.round(a.reverseValue(b.left),a.decimalPrecision)},onDragEnd:function(c){var a=this.slider,b=this.value;this.el.removeClass("x-slider-thumb-drag");this.dragging=false;a.fireEvent("dragend",a,c);if(this.dragStartValue!=b){a.fireEvent("changecomplete",a,b,this)}}});Ext.slider.MultiSlider=Ext.extend(Ext.BoxComponent,{vertical:false,minValue:0,maxValue:100,decimalPrecision:0,keyIncrement:1,increment:0,clickRange:[5,15],clickToChange:true,animate:true,dragging:false,constrainThumbs:true,topThumbZIndex:10000,initComponent:function(){if(!Ext.isDefined(this.value)){this.value=this.minValue}this.thumbs=[];Ext.slider.MultiSlider.superclass.initComponent.call(this);this.keyIncrement=Math.max(this.increment,this.keyIncrement);this.addEvents("beforechange","change","changecomplete","dragstart","drag","dragend");if(this.values==undefined||Ext.isEmpty(this.values)){this.values=[0]}var a=this.values;for(var b=0;bthis.clickRange[0]&&c.top=c){d+=c}else{if(a*2<-c){d-=c}}}return d.constrain(this.minValue,this.maxValue)},afterRender:function(){Ext.slider.MultiSlider.superclass.afterRender.apply(this,arguments);for(var c=0;cb){this.thumbs[a].value=b}}},setValue:function(d,c,b,g){var a=this.thumbs[d],e=a.el;c=this.normalizeValue(c);if(c!==a.value&&this.fireEvent("beforechange",this,c,a.value)!==false){a.value=c;this.moveThumb(d,this.translateValue(c),b!==false);this.fireEvent("change",this,c,a);if(g){this.fireEvent("changecomplete",this,c,a)}}},translateValue:function(a){var b=this.getRatio();return(a*b)-(this.minValue*b)-this.halfThumb},reverseValue:function(b){var a=this.getRatio();return(b+(this.minValue*a))/a},moveThumb:function(d,c,b){var a=this.thumbs[d].el;if(!b||this.animate===false){a.setLeft(c)}else{a.shift({left:c,stopFx:true,duration:0.35})}},focus:function(){this.focusEl.focus(10)},onResize:function(c,e){var b=this.thumbs,a=b.length,d=0;for(;dthis.clickRange[0]&&c.left','
','
','
',"
 
","
","
",'
',"
 
","
","
","");this.el=a?c.insertBefore(a,{cls:this.baseCls},true):c.append(d,{cls:this.baseCls},true);if(this.id){this.el.dom.id=this.id}var b=this.el.dom.firstChild;this.progressBar=Ext.get(b.firstChild);if(this.textEl){this.textEl=Ext.get(this.textEl);delete this.textTopEl}else{this.textTopEl=Ext.get(this.progressBar.dom.firstChild);var e=Ext.get(b.childNodes[1]);this.textTopEl.setStyle("z-index",99).addClass("x-hidden");this.textEl=new Ext.CompositeElement([this.textTopEl.dom.firstChild,e.dom.firstChild]);this.textEl.setWidth(b.offsetWidth)}this.progressBar.setHeight(b.offsetHeight)},afterRender:function(){Ext.ProgressBar.superclass.afterRender.call(this);if(this.value){this.updateProgress(this.value,this.text)}else{this.updateText(this.text)}},updateProgress:function(c,d,b){this.value=c||0;if(d){this.updateText(d)}if(this.rendered&&!this.isDestroyed){var a=Math.floor(c*this.el.dom.firstChild.offsetWidth);this.progressBar.setWidth(a,b===true||(b!==false&&this.animate));if(this.textTopEl){this.textTopEl.removeClass("x-hidden").setWidth(a)}}this.fireEvent("update",this,c,d);return this},wait:function(b){if(!this.waitTimer){var a=this;b=b||{};this.updateText(b.text);this.waitTimer=Ext.TaskMgr.start({run:function(c){var d=b.increment||10;c-=1;this.updateProgress(((((c+d)%d)+1)*(100/d))*0.01,null,b.animate)},interval:b.interval||1000,duration:b.duration,onStop:function(){if(b.fn){b.fn.apply(b.scope||this)}this.reset()},scope:a})}return this},isWaiting:function(){return this.waitTimer!==null},updateText:function(a){this.text=a||" ";if(this.rendered){this.textEl.update(this.text)}return this},syncProgressBar:function(){if(this.value){this.updateProgress(this.value,this.text)}return this},setSize:function(a,c){Ext.ProgressBar.superclass.setSize.call(this,a,c);if(this.textTopEl){var b=this.el.dom.firstChild;this.textEl.setSize(b.offsetWidth,b.offsetHeight)}this.syncProgressBar();return this},reset:function(a){this.updateProgress(0);if(this.textTopEl){this.textTopEl.addClass("x-hidden")}this.clearTimer();if(a===true){this.hide()}return this},clearTimer:function(){if(this.waitTimer){this.waitTimer.onStop=null;Ext.TaskMgr.stop(this.waitTimer);this.waitTimer=null}},onDestroy:function(){this.clearTimer();if(this.rendered){if(this.textEl.isComposite){this.textEl.clear()}Ext.destroyMembers(this,"textEl","progressBar","textTopEl")}Ext.ProgressBar.superclass.onDestroy.call(this)}});Ext.reg("progress",Ext.ProgressBar);(function(){var a=Ext.EventManager;var b=Ext.lib.Dom;Ext.dd.DragDrop=function(e,c,d){if(e){this.init(e,c,d)}};Ext.dd.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true},moveOnly:false,unlock:function(){this.locked=false},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(c,d){},startDrag:function(c,d){},b4Drag:function(c){},onDrag:function(c){},onDragEnter:function(c,d){},b4DragOver:function(c){},onDragOver:function(c,d){},b4DragOut:function(c){},onDragOut:function(c,d){},b4DragDrop:function(c){},onDragDrop:function(c,d){},onInvalidDrop:function(c){},b4EndDrag:function(c){},endDrag:function(c){},b4MouseDown:function(c){},onMouseDown:function(c){},onMouseUp:function(c){},onAvailable:function(){},defaultPadding:{left:0,right:0,top:0,bottom:0},constrainTo:function(j,h,o){if(Ext.isNumber(h)){h={left:h,right:h,top:h,bottom:h}}h=h||this.defaultPadding;var l=Ext.get(this.getEl()).getBox(),d=Ext.get(j),n=d.getScroll(),k,e=d.dom;if(e==document.body){k={x:n.left,y:n.top,width:Ext.lib.Dom.getViewWidth(),height:Ext.lib.Dom.getViewHeight()}}else{var m=d.getXY();k={x:m[0],y:m[1],width:e.clientWidth,height:e.clientHeight}}var i=l.y-k.y,g=l.x-k.x;this.resetConstraints();this.setXConstraint(g-(h.left||0),k.width-g-l.width-(h.right||0),this.xTickSize);this.setYConstraint(i-(h.top||0),k.height-i-l.height-(h.bottom||0),this.yTickSize)},getEl:function(){if(!this._domRef){this._domRef=Ext.getDom(this.id)}return this._domRef},getDragEl:function(){return Ext.getDom(this.dragElId)},init:function(e,c,d){this.initTarget(e,c,d);a.on(this.id,"mousedown",this.handleMouseDown,this)},initTarget:function(e,c,d){this.config=d||{};this.DDM=Ext.dd.DDM;this.groups={};if(typeof e!=="string"){e=Ext.id(e)}this.id=e;this.addToGroup((c)?c:"default");this.handleElId=e;this.setDragElId(e);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();this.handleOnAvailable()},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false)},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable()},setPadding:function(e,c,g,d){if(!c&&0!==c){this.padding=[e,e,e,e]}else{if(!g&&0!==g){this.padding=[e,c,e,c]}else{this.padding=[e,c,g,d]}}},setInitPosition:function(g,e){var h=this.getEl();if(!this.DDM.verifyEl(h)){return}var d=g||0;var c=e||0;var i=b.getXY(h);this.initPageX=i[0]-d;this.initPageY=i[1]-c;this.lastPageX=i[0];this.lastPageY=i[1];this.setStartPosition(i)},setStartPosition:function(d){var c=d||b.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=c[0];this.startPageY=c[1]},addToGroup:function(c){this.groups[c]=true;this.DDM.regDragDrop(this,c)},removeFromGroup:function(c){if(this.groups[c]){delete this.groups[c]}this.DDM.removeDDFromGroup(this,c)},setDragElId:function(c){this.dragElId=c},setHandleElId:function(c){if(typeof c!=="string"){c=Ext.id(c)}this.handleElId=c;this.DDM.regHandle(this.id,c)},setOuterHandleElId:function(c){if(typeof c!=="string"){c=Ext.id(c)}a.on(c,"mousedown",this.handleMouseDown,this);this.setHandleElId(c);this.hasOuterHandles=true},unreg:function(){a.un(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this)},destroy:function(){this.unreg()},isLocked:function(){return(this.DDM.isLocked()||this.locked)},handleMouseDown:function(g,d){if(this.primaryButtonOnly&&g.button!=0){return}if(this.isLocked()){return}this.DDM.refreshCache(this.groups);var c=new Ext.lib.Point(Ext.lib.Event.getPageX(g),Ext.lib.Event.getPageY(g));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(c,this)){}else{if(this.clickValidator(g)){this.setStartPosition();this.b4MouseDown(g);this.onMouseDown(g);this.DDM.handleMouseDown(g,this);this.DDM.stopEvent(g)}else{}}},clickValidator:function(d){var c=d.getTarget();return(this.isValidHandleChild(c)&&(this.id==this.handleElId||this.DDM.handleWasClicked(c,this.id)))},addInvalidHandleType:function(c){var d=c.toUpperCase();this.invalidHandleTypes[d]=d},addInvalidHandleId:function(c){if(typeof c!=="string"){c=Ext.id(c)}this.invalidHandleIds[c]=c},addInvalidHandleClass:function(c){this.invalidHandleClasses.push(c)},removeInvalidHandleType:function(c){var d=c.toUpperCase();delete this.invalidHandleTypes[d]},removeInvalidHandleId:function(c){if(typeof c!=="string"){c=Ext.id(c)}delete this.invalidHandleIds[c]},removeInvalidHandleClass:function(d){for(var e=0,c=this.invalidHandleClasses.length;e=this.minX;d=d-c){if(!e[d]){this.xTicks[this.xTicks.length]=d;e[d]=true}}for(d=this.initPageX;d<=this.maxX;d=d+c){if(!e[d]){this.xTicks[this.xTicks.length]=d;e[d]=true}}this.xTicks.sort(this.DDM.numericSort)},setYTicks:function(g,c){this.yTicks=[];this.yTickSize=c;var e={};for(var d=this.initPageY;d>=this.minY;d=d-c){if(!e[d]){this.yTicks[this.yTicks.length]=d;e[d]=true}}for(d=this.initPageY;d<=this.maxY;d=d+c){if(!e[d]){this.yTicks[this.yTicks.length]=d;e[d]=true}}this.yTicks.sort(this.DDM.numericSort)},setXConstraint:function(e,d,c){this.leftConstraint=e;this.rightConstraint=d;this.minX=this.initPageX-e;this.maxX=this.initPageX+d;if(c){this.setXTicks(this.initPageX,c)}this.constrainX=true},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks()},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0},setYConstraint:function(c,e,d){this.topConstraint=c;this.bottomConstraint=e;this.minY=this.initPageY-c;this.maxY=this.initPageY+e;if(d){this.setYTicks(this.initPageY,d)}this.constrainY=true},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var d=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var c=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(d,c)}else{this.setInitPosition()}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize)}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize)}},getTick:function(k,g){if(!g){return k}else{if(g[0]>=k){return g[0]}else{for(var d=0,c=g.length;d=k){var j=k-g[d];var h=g[e]-k;return(h>j)?g[d]:g[e]}}return g[g.length-1]}}},toString:function(){return("DragDrop "+this.id)}}})(); /* * The drag and drop utility provides a framework for building drag and drop * applications. In addition to enabling drag and drop for specific elements, * the drag and drop elements are tracked by the manager class, and the * interactions between the various elements are tracked during the drag and * the implementing code is notified about these important moments. */ if(!Ext.dd.DragDropMgr){Ext.dd.DragDropMgr=function(){var a=Ext.EventManager;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initialized:false,locked:false,init:function(){this.initialized=true},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(d,c){for(var e in this.ids){for(var b in this.ids[e]){var g=this.ids[e][b];if(!this.isTypeOfDD(g)){continue}g[d].apply(g,c)}}},_onLoad:function(){this.init();a.on(document,"mouseup",this.handleMouseUp,this,true);a.on(document,"mousemove",this.handleMouseMove,this,true);a.on(window,"unload",this._onUnload,this,true);a.on(window,"resize",this._onResize,this,true)},_onResize:function(b){this._execOnAll("resetConstraints",[])},lock:function(){this.locked=true},unlock:function(){this.locked=false},isLocked:function(){return this.locked},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:350,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(c,b){if(!this.initialized){this.init()}if(!this.ids[b]){this.ids[b]={}}this.ids[b][c.id]=c},removeDDFromGroup:function(d,b){if(!this.ids[b]){this.ids[b]={}}var c=this.ids[b];if(c&&c[d.id]){delete c[d.id]}},_remove:function(c){for(var b in c.groups){if(b&&this.ids[b]&&this.ids[b][c.id]){delete this.ids[b][c.id]}}delete this.handleIds[c.id]},regHandle:function(c,b){if(!this.handleIds[c]){this.handleIds[c]={}}this.handleIds[c][b]=b},isDragDrop:function(b){return(this.getDDById(b))?true:false},getRelated:function(h,c){var g=[];for(var e in h.groups){for(var d in this.ids[e]){var b=this.ids[e][d];if(!this.isTypeOfDD(b)){continue}if(!c||b.isTarget){g[g.length]=b}}}return g},isLegalTarget:function(g,e){var c=this.getRelated(g,true);for(var d=0,b=c.length;dthis.clickPixelThresh||b>this.clickPixelThresh){this.startDrag(this.startX,this.startY)}}if(this.dragThreshMet){this.dragCurrent.b4Drag(d);this.dragCurrent.onDrag(d);if(!this.dragCurrent.moveOnly){this.fireEvents(d,false)}}this.stopEvent(d);return true},fireEvents:function(n,o){var q=this.dragCurrent;if(!q||q.isLocked()){return}var r=n.getPoint();var b=[];var g=[];var l=[];var j=[];var d=[];for(var h in this.dragOvers){var c=this.dragOvers[h];if(!this.isTypeOfDD(c)){continue}if(!this.isOverTarget(r,c,this.mode)){g.push(c)}b[h]=true;delete this.dragOvers[h]}for(var p in q.groups){if("string"!=typeof p){continue}for(h in this.ids[p]){var k=this.ids[p][h];if(!this.isTypeOfDD(k)){continue}if(k.isTarget&&!k.isLocked()&&((k!=q)||(q.ignoreSelf===false))){if(this.isOverTarget(r,k,this.mode)){if(o){j.push(k)}else{if(!b[k.id]){d.push(k)}else{l.push(k)}this.dragOvers[k.id]=k}}}}}if(this.mode){if(g.length){q.b4DragOut(n,g);q.onDragOut(n,g)}if(d.length){q.onDragEnter(n,d)}if(l.length){q.b4DragOver(n,l);q.onDragOver(n,l)}if(j.length){q.b4DragDrop(n,j);q.onDragDrop(n,j)}}else{var m=0;for(h=0,m=g.length;h2000){}else{setTimeout(b._addListeners,10);if(document&&document.body){b._timeoutCount+=1}}}},handleWasClicked:function(b,d){if(this.isHandle(d,b.id)){return true}else{var c=b.parentNode;while(c){if(this.isHandle(d,c.id)){return true}else{c=c.parentNode}}}return false}}}();Ext.dd.DDM=Ext.dd.DragDropMgr;Ext.dd.DDM._addListeners()}Ext.dd.DD=function(c,a,b){if(c){this.init(c,a,b)}};Ext.extend(Ext.dd.DD,Ext.dd.DragDrop,{scroll:true,autoOffset:function(c,b){var a=c-this.startPageX;var d=b-this.startPageY;this.setDelta(a,d)},setDelta:function(b,a){this.deltaX=b;this.deltaY=a},setDragElPos:function(c,b){var a=this.getDragEl();this.alignElWithMouse(a,c,b)},alignElWithMouse:function(c,h,g){var e=this.getTargetCoord(h,g);var b=c.dom?c:Ext.fly(c,"_dd");if(!this.deltaSetXY){var i=[e.x,e.y];b.setXY(i);var d=b.getLeft(true);var a=b.getTop(true);this.deltaSetXY=[d-e.x,a-e.y]}else{b.setLeftTop(e.x+this.deltaSetXY[0],e.y+this.deltaSetXY[1])}this.cachePosition(e.x,e.y);this.autoScroll(e.x,e.y,c.offsetHeight,c.offsetWidth);return e},cachePosition:function(b,a){if(b){this.lastPageX=b;this.lastPageY=a}else{var c=Ext.lib.Dom.getXY(this.getEl());this.lastPageX=c[0];this.lastPageY=c[1]}},autoScroll:function(l,k,e,m){if(this.scroll){var n=Ext.lib.Dom.getViewHeight();var b=Ext.lib.Dom.getViewWidth();var p=this.DDM.getScrollTop();var d=this.DDM.getScrollLeft();var j=e+k;var o=m+l;var i=(n+p-k-this.deltaY);var g=(b+d-l-this.deltaX);var c=40;var a=(document.all)?80:30;if(j>n&&i0&&k-pb&&g0&&l-dthis.maxX){a=this.maxX}}if(this.constrainY){if(dthis.maxY){d=this.maxY}}a=this.getTick(a,this.xTicks);d=this.getTick(d,this.yTicks);return{x:a,y:d}},applyConfig:function(){Ext.dd.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false)},b4MouseDown:function(a){this.autoOffset(a.getPageX(),a.getPageY())},b4Drag:function(a){this.setDragElPos(a.getPageX(),a.getPageY())},toString:function(){return("DD "+this.id)}});Ext.dd.DDProxy=function(c,a,b){if(c){this.init(c,a,b);this.initFrame()}};Ext.dd.DDProxy.dragElId="ygddfdiv";Ext.extend(Ext.dd.DDProxy,Ext.dd.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var b=this;var a=document.body;if(!a||!a.firstChild){setTimeout(function(){b.createFrame()},50);return}var d=this.getDragEl();if(!d){d=document.createElement("div");d.id=this.dragElId;var c=d.style;c.position="absolute";c.visibility="hidden";c.cursor="move";c.border="2px solid #aaa";c.zIndex=999;a.insertBefore(d,a.firstChild)}},initFrame:function(){this.createFrame()},applyConfig:function(){Ext.dd.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||Ext.dd.DDProxy.dragElId)},showFrame:function(e,d){var c=this.getEl();var a=this.getDragEl();var b=a.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(b.width,10)/2),Math.round(parseInt(b.height,10)/2))}this.setDragElPos(e,d);Ext.fly(a).show()},_resizeProxy:function(){if(this.resizeFrame){var a=this.getEl();Ext.fly(this.getDragEl()).setSize(a.offsetWidth,a.offsetHeight)}},b4MouseDown:function(b){var a=b.getPageX();var c=b.getPageY();this.autoOffset(a,c);this.setDragElPos(a,c)},b4StartDrag:function(a,b){this.showFrame(a,b)},b4EndDrag:function(a){Ext.fly(this.getDragEl()).hide()},endDrag:function(c){var b=this.getEl();var a=this.getDragEl();a.style.visibility="";this.beforeMove();b.style.visibility="hidden";Ext.dd.DDM.moveToEl(b,a);a.style.visibility="hidden";b.style.visibility="";this.afterDrag()},beforeMove:function(){},afterDrag:function(){},toString:function(){return("DDProxy "+this.id)}});Ext.dd.DDTarget=function(c,a,b){if(c){this.initTarget(c,a,b)}};Ext.extend(Ext.dd.DDTarget,Ext.dd.DragDrop,{getDragEl:Ext.emptyFn,isValidHandleChild:Ext.emptyFn,startDrag:Ext.emptyFn,endDrag:Ext.emptyFn,onDrag:Ext.emptyFn,onDragDrop:Ext.emptyFn,onDragEnter:Ext.emptyFn,onDragOut:Ext.emptyFn,onDragOver:Ext.emptyFn,onInvalidDrop:Ext.emptyFn,onMouseDown:Ext.emptyFn,onMouseUp:Ext.emptyFn,setXConstraint:Ext.emptyFn,setYConstraint:Ext.emptyFn,resetConstraints:Ext.emptyFn,clearConstraints:Ext.emptyFn,clearTicks:Ext.emptyFn,setInitPosition:Ext.emptyFn,setDragElId:Ext.emptyFn,setHandleElId:Ext.emptyFn,setOuterHandleElId:Ext.emptyFn,addInvalidHandleClass:Ext.emptyFn,addInvalidHandleId:Ext.emptyFn,addInvalidHandleType:Ext.emptyFn,removeInvalidHandleClass:Ext.emptyFn,removeInvalidHandleId:Ext.emptyFn,removeInvalidHandleType:Ext.emptyFn,toString:function(){return("DDTarget "+this.id)}});Ext.dd.DragTracker=Ext.extend(Ext.util.Observable,{active:false,tolerance:5,autoStart:false,constructor:function(a){Ext.apply(this,a);this.addEvents("mousedown","mouseup","mousemove","dragstart","dragend","drag");this.dragRegion=new Ext.lib.Region(0,0,0,0);if(this.el){this.initEl(this.el)}Ext.dd.DragTracker.superclass.constructor.call(this,a)},initEl:function(a){this.el=Ext.get(a);a.on("mousedown",this.onMouseDown,this,this.delegate?{delegate:this.delegate}:undefined)},destroy:function(){this.el.un("mousedown",this.onMouseDown,this)},onMouseDown:function(c,b){if(this.fireEvent("mousedown",this,c)!==false&&this.onBeforeStart(c)!==false){this.startXY=this.lastXY=c.getXY();this.dragTarget=this.delegate?b:this.el.dom;if(this.preventDefault!==false){c.preventDefault()}var a=Ext.getDoc();a.on("mouseup",this.onMouseUp,this);a.on("mousemove",this.onMouseMove,this);a.on("selectstart",this.stopSelect,this);if(this.autoStart){this.timer=this.triggerStart.defer(this.autoStart===true?1000:this.autoStart,this)}}},onMouseMove:function(d,c){if(this.active&&Ext.isIE&&!d.browserEvent.button){d.preventDefault();this.onMouseUp(d);return}d.preventDefault();var b=d.getXY(),a=this.startXY;this.lastXY=b;if(!this.active){if(Math.abs(a[0]-b[0])>this.tolerance||Math.abs(a[1]-b[1])>this.tolerance){this.triggerStart()}else{return}}this.fireEvent("mousemove",this,d);this.onDrag(d);this.fireEvent("drag",this,d)},onMouseUp:function(c){var b=Ext.getDoc();b.un("mousemove",this.onMouseMove,this);b.un("mouseup",this.onMouseUp,this);b.un("selectstart",this.stopSelect,this);c.preventDefault();this.clearStart();var a=this.active;this.active=false;delete this.elRegion;this.fireEvent("mouseup",this,c);if(a){this.onEnd(c);this.fireEvent("dragend",this,c)}},triggerStart:function(a){this.clearStart();this.active=true;this.onStart(this.startXY);this.fireEvent("dragstart",this,this.startXY)},clearStart:function(){if(this.timer){clearTimeout(this.timer);delete this.timer}},stopSelect:function(a){a.stopEvent();return false},onBeforeStart:function(a){},onStart:function(a){},onDrag:function(a){},onEnd:function(a){},getDragTarget:function(){return this.dragTarget},getDragCt:function(){return this.el},getXY:function(a){return a?this.constrainModes[a].call(this,this.lastXY):this.lastXY},getOffset:function(c){var b=this.getXY(c);var a=this.startXY;return[a[0]-b[0],a[1]-b[1]]},constrainModes:{point:function(b){if(!this.elRegion){this.elRegion=this.getDragCt().getRegion()}var a=this.dragRegion;a.left=b[0];a.top=b[1];a.right=b[0];a.bottom=b[1];a.constrainTo(this.elRegion);return[a.left,a.top]}}});Ext.dd.ScrollManager=function(){var c=Ext.dd.DragDropMgr;var e={};var b=null;var i={};var h=function(l){b=null;a()};var j=function(){if(c.dragCurrent){c.refreshCache(c.dragCurrent.groups)}};var d=function(){if(c.dragCurrent){var l=Ext.dd.ScrollManager;var m=i.el.ddScrollConfig?i.el.ddScrollConfig.increment:l.increment;if(!l.animate){if(i.el.scroll(i.dir,m)){j()}}else{i.el.scroll(i.dir,m,true,l.animDuration,j)}}};var a=function(){if(i.id){clearInterval(i.id)}i.id=0;i.el=null;i.dir=""};var g=function(m,l){a();i.el=m;i.dir=l;var n=(m.ddScrollConfig&&m.ddScrollConfig.frequency)?m.ddScrollConfig.frequency:Ext.dd.ScrollManager.frequency;i.id=setInterval(d,n)};var k=function(o,q){if(q||!c.dragCurrent){return}var s=Ext.dd.ScrollManager;if(!b||b!=c.dragCurrent){b=c.dragCurrent;s.refreshCache()}var t=Ext.lib.Event.getXY(o);var u=new Ext.lib.Point(t[0],t[1]);for(var m in e){var n=e[m],l=n._region;var p=n.ddScrollConfig?n.ddScrollConfig:s;if(l&&l.contains(u)&&n.isScrollable()){if(l.bottom-u.y<=p.vthresh){if(i.el!=n){g(n,"down")}return}else{if(l.right-u.x<=p.hthresh){if(i.el!=n){g(n,"left")}return}else{if(u.y-l.top<=p.vthresh){if(i.el!=n){g(n,"up")}return}else{if(u.x-l.left<=p.hthresh){if(i.el!=n){g(n,"right")}return}}}}}}a()};c.fireEvents=c.fireEvents.createSequence(k,c);c.stopDrag=c.stopDrag.createSequence(h,c);return{register:function(n){if(Ext.isArray(n)){for(var m=0,l=n.length;m]+>/gi,asText:function(a){return String(a).replace(this.stripTagsRE,"")},asUCText:function(a){return String(a).toUpperCase().replace(this.stripTagsRE,"")},asUCString:function(a){return String(a).toUpperCase()},asDate:function(a){if(!a){return 0}if(Ext.isDate(a)){return a.getTime()}return Date.parse(String(a))},asFloat:function(a){var b=parseFloat(String(a).replace(/,/g,""));return isNaN(b)?0:b},asInt:function(a){var b=parseInt(String(a).replace(/,/g,""),10);return isNaN(b)?0:b}};Ext.data.Record=function(a,b){this.id=(b||b===0)?b:Ext.data.Record.id(this);this.data=a||{}};Ext.data.Record.create=function(e){var c=Ext.extend(Ext.data.Record,{});var d=c.prototype;d.fields=new Ext.util.MixedCollection(false,function(g){return g.name});for(var b=0,a=e.length;b-1){a.join(null);this.data.removeAt(b)}if(this.pruneModifiedRecords){this.modified.remove(a)}if(this.snapshot){this.snapshot.remove(a)}if(b>-1){this.fireEvent("remove",this,a,b)}},removeAt:function(a){this.remove(this.getAt(a))},removeAll:function(b){var a=[];this.each(function(c){a.push(c)});this.clearData();if(this.snapshot){this.snapshot.clear()}if(this.pruneModifiedRecords){this.modified=[]}if(b!==true){this.fireEvent("clear",this,a)}},onClear:function(b,a){Ext.each(a,function(d,c){this.destroyRecord(this,d,c)},this)},insert:function(c,b){b=[].concat(b);for(var d=0,a=b.length;d=0;d--){if(b[d].phantom===true){var a=b.splice(d,1).shift();if(a.isValid()){g.push(a)}}else{if(!b[d].isValid()){b.splice(d,1)}}}if(g.length){h.push(["create",g])}if(b.length){h.push(["update",b])}}j=h.length;if(j){e=++this.batchCounter;for(var d=0;d=0;b--){this.modified.splice(this.modified.indexOf(a[b]),1)}}else{this.modified.splice(this.modified.indexOf(a),1)}},reMap:function(b){if(Ext.isArray(b)){for(var d=0,a=b.length;d=0;c--){this.insert(b[c].lastIndex,b[c])}}},handleException:function(a){Ext.handleError(a)},reload:function(a){this.load(Ext.applyIf(a||{},this.lastOptions))},loadRecords:function(h,b,g){if(this.isDestroyed===true){return}if(!h||g===false){if(g!==false){this.fireEvent("load",this,[],b)}if(b.callback){b.callback.call(b.scope||this,[],b,false,h)}return}var e=h.records,d=h.totalRecords||e.length;if(!b||b.add!==true){if(this.pruneModifiedRecords){this.modified=[]}for(var c=0,a=e.length;c1){for(var p=1,o=c.length;ph?1:(i=0;b--){if(Ext.isArray(c)){this.realize(a.splice(b,1).shift(),c.splice(b,1).shift())}else{this.realize(a.splice(b,1).shift(),c)}}}else{if(Ext.isArray(c)&&c.length==1){c=c.shift()}if(!this.isData(c)){throw new Ext.data.DataReader.Error("realize",a)}a.phantom=false;a._phid=a.id;a.id=this.getId(c);a.data=c;a.commit()}},update:function(a,c){if(Ext.isArray(a)){for(var b=a.length-1;b>=0;b--){if(Ext.isArray(c)){this.update(a.splice(b,1).shift(),c.splice(b,1).shift())}else{this.update(a.splice(b,1).shift(),c)}}}else{if(Ext.isArray(c)&&c.length==1){c=c.shift()}if(this.isData(c)){a.data=Ext.apply(a.data,c)}a.commit()}},extractData:function(k,a){var j=(this instanceof Ext.data.JsonReader)?"json":"node";var c=[];if(this.isData(k)&&!(this instanceof Ext.data.XmlReader)){k=[k]}var h=this.recordType.prototype.fields,o=h.items,m=h.length,c=[];if(a===true){var l=this.recordType;for(var e=0;e=0){return new Function("obj","return obj"+(b>0?".":"")+c)}return function(d){return d[c]}}}(),extractValues:function(h,d,a){var g,c={};for(var e=0;e<\u003fxml version="{version}" encoding="{encoding}"\u003f><{documentRoot}><{name}>{value}<{root}><{parent.record}><{name}>{value}',render:function(b,c,a){c=this.toArray(c);b.xmlData=this.tpl.applyTemplate({version:this.xmlVersion,encoding:this.xmlEncoding,documentRoot:(c.length>0||this.forceDocumentRoot===true)?this.documentRoot:false,record:this.meta.record,root:this.root,baseParams:c,records:(Ext.isArray(a[0]))?a:[a]})},createRecord:function(a){return this.toArray(this.toHash(a))},updateRecord:function(a){return this.toArray(this.toHash(a))},destroyRecord:function(b){var a={};a[this.meta.idProperty]=b.id;return this.toArray(a)}});Ext.data.XmlReader=function(a,b){a=a||{};Ext.applyIf(a,{idProperty:a.idProperty||a.idPath||a.id,successProperty:a.successProperty||a.success});Ext.data.XmlReader.superclass.constructor.call(this,a,b||a.fields)};Ext.extend(Ext.data.XmlReader,Ext.data.DataReader,{read:function(a){var b=a.responseXML;if(!b){throw {message:"XmlReader.read: XML Document not available"}}return this.readRecords(b)},readRecords:function(d){this.xmlData=d;var a=d.documentElement||d,c=Ext.DomQuery,g=0,e=true;if(this.meta.totalProperty){g=this.getTotal(a,0)}if(this.meta.successProperty){e=this.getSuccess(a)}var b=this.extractData(c.select(this.meta.record,a),true);return{success:e,records:b,totalRecords:g||b.length}},readResponse:function(e,a){var d=Ext.DomQuery,g=a.responseXML;var b=new Ext.data.Response({action:e,success:this.getSuccess(g),message:this.getMessage(g),data:this.extractData(d.select(this.meta.record,g)||d.select(this.meta.root,g),false),raw:g});if(Ext.isEmpty(b.success)){throw new Ext.data.DataReader.Error("successProperty-response",this.meta.successProperty)}if(e===Ext.data.Api.actions.create){var c=Ext.isDefined(b.data);if(c&&Ext.isEmpty(b.data)){throw new Ext.data.JsonReader.Error("root-empty",this.meta.root)}else{if(!c){throw new Ext.data.JsonReader.Error("root-undefined-response",this.meta.root)}}}return b},getSuccess:function(){return true},buildExtractors:function(){if(this.ef){return}var l=this.meta,h=this.recordType,e=h.prototype.fields,k=e.items,j=e.length;if(l.totalProperty){this.getTotal=this.createAccessor(l.totalProperty)}if(l.successProperty){this.getSuccess=this.createAccessor(l.successProperty)}if(l.messageProperty){this.getMessage=this.createAccessor(l.messageProperty)}this.getRoot=function(g){return(!Ext.isEmpty(g[this.meta.record]))?g[this.meta.record]:g[this.meta.root]};if(l.idPath||l.idProperty){var d=this.createAccessor(l.idPath||l.idProperty);this.getId=function(g){var i=d(g)||g.id;return(i===undefined||i==="")?null:i}}else{this.getId=function(){return null}}var c=[];for(var b=0;b0&&sorters[0].field==this.groupField){sorters.shift()}this.groupField=d;this.groupDir=c;this.applyGroupField();var b=function(){this.fireEvent("groupchange",this,this.getGroupState())};if(this.groupOnSort){this.sort(d,c);b.call(this);return}if(this.remoteGroup){this.on("load",b,this,{single:true});this.reload()}else{this.sort(sorters);b.call(this)}},sort:function(h,c){if(this.remoteSort){return Ext.data.GroupingStore.superclass.sort.call(this,h,c)}var g=[];if(Ext.isArray(arguments[0])){g=arguments[0]}else{if(h==undefined){g=[this.sortInfo]}else{var e=this.fields.get(h);if(!e){return false}var b=e.name,a=this.sortInfo||null,d=this.sortToggle?this.sortToggle[b]:null;if(!c){if(a&&a.field==b){c=(this.sortToggle[b]||"ASC").toggle("ASC","DESC")}else{c=e.sortDir}}this.sortToggle[b]=c;this.sortInfo={field:b,direction:c};g=[this.sortInfo]}}if(this.groupField){g.unshift({direction:this.groupDir,field:this.groupField})}return this.multiSort.call(this,g,c)},applyGroupField:function(){if(this.remoteGroup){if(!this.baseParams){this.baseParams={}}Ext.apply(this.baseParams,{groupBy:this.groupField,groupDir:this.groupDir});var a=this.lastOptions;if(a&&a.params){a.params.groupDir=this.groupDir;delete a.params.groupBy}}},applyGrouping:function(a){if(this.groupField!==false){this.groupBy(this.groupField,true,this.groupDir);return true}else{if(a===true){this.fireEvent("datachanged",this)}return false}},getGroupState:function(){return this.groupOnSort&&this.groupField!==false?(this.sortInfo?this.sortInfo.field:undefined):this.groupField}});Ext.reg("groupingstore",Ext.data.GroupingStore);Ext.data.DirectProxy=function(a){Ext.apply(this,a);if(typeof this.paramOrder=="string"){this.paramOrder=this.paramOrder.split(/[\s,|]/)}Ext.data.DirectProxy.superclass.constructor.call(this,a)};Ext.extend(Ext.data.DirectProxy,Ext.data.DataProxy,{paramOrder:undefined,paramsAsHash:true,directFn:undefined,doRequest:function(b,c,a,e,k,l,n){var j=[],h=this.api[b]||this.directFn;switch(b){case Ext.data.Api.actions.create:j.push(a.jsonData);break;case Ext.data.Api.actions.read:if(h.directCfg.method.len>0){if(this.paramOrder){for(var d=0,g=this.paramOrder.length;d1){for(var d=0,b=c.length;d0){this.doSend(a==1?this.callBuffer[0]:this.callBuffer);this.callBuffer=[]}},queueTransaction:function(a){if(a.form){this.processForm(a);return}this.callBuffer.push(a);if(this.enableBuffer){if(!this.callTask){this.callTask=new Ext.util.DelayedTask(this.combineAndSend,this)}this.callTask.delay(Ext.isNumber(this.enableBuffer)?this.enableBuffer:10)}else{this.combineAndSend()}},doCall:function(i,a,b){var h=null,e=b[a.len],g=b[a.len+1];if(a.len!==0){h=b.slice(0,a.len)}var d=new Ext.Direct.Transaction({provider:this,args:b,action:i,method:a.name,data:h,cb:g&&Ext.isFunction(e)?e.createDelegate(g):e});if(this.fireEvent("beforecall",this,d)!==false){Ext.Direct.addTransaction(d);this.queueTransaction(d);this.fireEvent("call",this,d)}},doForm:function(j,b,g,i,e){var d=new Ext.Direct.Transaction({provider:this,action:j,method:b.name,args:[g,i,e],cb:e&&Ext.isFunction(i)?i.createDelegate(e):i,isForm:true});if(this.fireEvent("beforecall",this,d)!==false){Ext.Direct.addTransaction(d);var a=String(g.getAttribute("enctype")).toLowerCase()=="multipart/form-data",h={extTID:d.tid,extAction:j,extMethod:b.name,extType:"rpc",extUpload:String(a)};Ext.apply(d,{form:Ext.getDom(g),isUpload:a,params:i&&Ext.isObject(i.params)?Ext.apply(h,i.params):h});this.fireEvent("call",this,d);this.processForm(d)}},processForm:function(a){Ext.Ajax.request({url:this.url,params:a.params,callback:this.onData,scope:this,form:a.form,isUpload:a.isUpload,ts:a})},createMethod:function(d,a){var b;if(!a.formHandler){b=function(){this.doCall(d,a,Array.prototype.slice.call(arguments,0))}.createDelegate(this)}else{b=function(e,g,c){this.doForm(d,a,e,g,c)}.createDelegate(this)}b.directCfg={action:d,method:a};return b},getTransaction:function(a){return a&&a.tid?Ext.Direct.getTransaction(a.tid):null},doCallback:function(c,g){var d=g.status?"success":"failure";if(c&&c.cb){var b=c.cb,a=Ext.isDefined(g.result)?g.result:g.data;if(Ext.isFunction(b)){b(a,g)}else{Ext.callback(b[d],b.scope,[a,g]);Ext.callback(b.callback,b.scope,[a,g])}}}});Ext.Direct.PROVIDERS.remoting=Ext.direct.RemotingProvider;Ext.Resizable=Ext.extend(Ext.util.Observable,{constructor:function(d,e){this.el=Ext.get(d);if(e&&e.wrap){e.resizeChild=this.el;this.el=this.el.wrap(typeof e.wrap=="object"?e.wrap:{cls:"xresizable-wrap"});this.el.id=this.el.dom.id=e.resizeChild.id+"-rzwrap";this.el.setStyle("overflow","hidden");this.el.setPositioning(e.resizeChild.getPositioning());e.resizeChild.clearPositioning();if(!e.width||!e.height){var g=e.resizeChild.getSize();this.el.setSize(g.width,g.height)}if(e.pinned&&!e.adjustments){e.adjustments="auto"}}this.proxy=this.el.createProxy({tag:"div",cls:"x-resizable-proxy",id:this.el.id+"-rzproxy"},Ext.getBody());this.proxy.unselectable();this.proxy.enableDisplayMode("block");Ext.apply(this,e);if(this.pinned){this.disableTrackOver=true;this.el.addClass("x-resizable-pinned")}var k=this.el.getStyle("position");if(k!="absolute"&&k!="fixed"){this.el.setStyle("position","relative")}if(!this.handles){this.handles="s,e,se";if(this.multiDirectional){this.handles+=",n,w"}}if(this.handles=="all"){this.handles="n s e w ne nw se sw"}var o=this.handles.split(/\s*?[,;]\s*?| /);var c=Ext.Resizable.positions;for(var j=0,l=o.length;j0){if(a>(e/2)){d=c+(e-a)}else{d=c-a}}return Math.max(b,d)},resizeElement:function(){var a=this.proxy.getBox();if(this.updateBox){this.el.setBox(a,false,this.animate,this.duration,null,this.easing)}else{this.el.setSize(a.width,a.height,this.animate,this.duration,null,this.easing)}this.updateChildSize();if(!this.dynamic){this.proxy.hide()}if(this.draggable&&this.constrainTo){this.dd.resetConstraints();this.dd.constrainTo(this.constrainTo)}return a},constrain:function(b,c,a,d){if(b-cd){c=b-d}}return c},onMouseMove:function(z){if(this.enabled&&this.activeHandle){try{if(this.resizeRegion&&!this.resizeRegion.contains(z.getPoint())){return}var t=this.curSize||this.startBox,l=this.startBox.x,k=this.startBox.y,c=l,b=k,m=t.width,u=t.height,d=m,o=u,n=this.minWidth,A=this.minHeight,s=this.maxWidth,D=this.maxHeight,i=this.widthIncrement,a=this.heightIncrement,B=z.getXY(),r=-(this.startPoint[0]-Math.max(this.minX,B[0])),p=-(this.startPoint[1]-Math.max(this.minY,B[1])),j=this.activeHandle.position,E,g;switch(j){case"east":m+=r;m=Math.min(Math.max(n,m),s);break;case"south":u+=p;u=Math.min(Math.max(A,u),D);break;case"southeast":m+=r;u+=p;m=Math.min(Math.max(n,m),s);u=Math.min(Math.max(A,u),D);break;case"north":p=this.constrain(u,p,A,D);k+=p;u-=p;break;case"west":r=this.constrain(m,r,n,s);l+=r;m-=r;break;case"northeast":m+=r;m=Math.min(Math.max(n,m),s);p=this.constrain(u,p,A,D);k+=p;u-=p;break;case"northwest":r=this.constrain(m,r,n,s);p=this.constrain(u,p,A,D);k+=p;u-=p;l+=r;m-=r;break;case"southwest":r=this.constrain(m,r,n,s);u+=p;u=Math.min(Math.max(A,u),D);l+=r;m-=r;break}var q=this.snap(m,i,n);var C=this.snap(u,a,A);if(q!=m||C!=u){switch(j){case"northeast":k-=C-u;break;case"north":k-=C-u;break;case"southwest":l-=q-m;break;case"west":l-=q-m;break;case"northwest":l-=q-m;k-=C-u;break}m=q;u=C}if(this.preserveRatio){switch(j){case"southeast":case"east":u=o*(m/d);u=Math.min(Math.max(A,u),D);m=d*(u/o);break;case"south":m=d*(u/o);m=Math.min(Math.max(n,m),s);u=o*(m/d);break;case"northeast":m=d*(u/o);m=Math.min(Math.max(n,m),s);u=o*(m/d);break;case"north":E=m;m=d*(u/o);m=Math.min(Math.max(n,m),s);u=o*(m/d);l+=(E-m)/2;break;case"southwest":u=o*(m/d);u=Math.min(Math.max(A,u),D);E=m;m=d*(u/o);l+=E-m;break;case"west":g=u;u=o*(m/d);u=Math.min(Math.max(A,u),D);k+=(g-u)/2;E=m;m=d*(u/o);l+=E-m;break;case"northwest":E=m;g=u;u=o*(m/d);u=Math.min(Math.max(A,u),D);m=d*(u/o);k+=g-u;l+=E-m;break}}this.proxy.setBounds(l,k,m,u);if(this.dynamic){this.resizeElement()}}catch(v){}}},handleOver:function(){if(this.enabled){this.el.addClass("x-resizable-over")}},handleOut:function(){if(!this.resizing){this.el.removeClass("x-resizable-over")}},getEl:function(){return this.el},getResizeChild:function(){return this.resizeChild},destroy:function(b){Ext.destroy(this.dd,this.overlay,this.proxy);this.overlay=null;this.proxy=null;var c=Ext.Resizable.positions;for(var a in c){if(typeof c[a]!="function"&&this[c[a]]){this[c[a]].destroy()}}if(b){this.el.update("");Ext.destroy(this.el);this.el=null}this.purgeListeners()},syncHandleHeight:function(){var a=this.el.getHeight(true);if(this.west){this.west.el.setHeight(a)}if(this.east){this.east.el.setHeight(a)}}});Ext.Resizable.positions={n:"north",s:"south",e:"east",w:"west",se:"southeast",sw:"southwest",nw:"northwest",ne:"northeast"};Ext.Resizable.Handle=Ext.extend(Object,{constructor:function(d,g,c,e,a){if(!this.tpl){var b=Ext.DomHelper.createTemplate({tag:"div",cls:"x-resizable-handle x-resizable-handle-{0}"});b.compile();Ext.Resizable.Handle.prototype.tpl=b}this.position=g;this.rz=d;this.el=this.tpl.append(d.el.dom,[this.position],true);this.el.unselectable();if(e){this.el.setOpacity(0)}if(!Ext.isEmpty(a)){this.el.addClass(a)}this.el.on("mousedown",this.onMouseDown,this);if(!c){this.el.on({scope:this,mouseover:this.onMouseOver,mouseout:this.onMouseOut})}},afterResize:function(a){},onMouseDown:function(a){this.rz.onMouseDown(this,a)},onMouseOver:function(a){this.rz.handleOver(this,a)},onMouseOut:function(a){this.rz.handleOut(this,a)},destroy:function(){Ext.destroy(this.el);this.el=null}});Ext.Window=Ext.extend(Ext.Panel,{baseCls:"x-window",resizable:true,draggable:true,closable:true,closeAction:"close",constrain:false,constrainHeader:false,plain:false,minimizable:false,maximizable:false,minHeight:100,minWidth:200,expandOnShow:true,collapsible:false,initHidden:undefined,hidden:true,elements:"header,body",frame:true,floating:true,initComponent:function(){this.initTools();Ext.Window.superclass.initComponent.call(this);this.addEvents("resize","maximize","minimize","restore");if(Ext.isDefined(this.initHidden)){this.hidden=this.initHidden}if(this.hidden===false){this.hidden=true;this.show()}},getState:function(){return Ext.apply(Ext.Window.superclass.getState.call(this)||{},this.getBox(true))},onRender:function(b,a){Ext.Window.superclass.onRender.call(this,b,a);if(this.plain){this.el.addClass("x-window-plain")}this.focusEl=this.el.createChild({tag:"a",href:"#",cls:"x-dlg-focus",tabIndex:"-1",html:" "});this.focusEl.swallowEvent("click",true);this.proxy=this.el.createProxy("x-window-proxy");this.proxy.enableDisplayMode("block");if(this.modal){this.mask=this.container.createChild({cls:"ext-el-mask"},this.el.dom);this.mask.enableDisplayMode("block");this.mask.hide();this.mon(this.mask,"click",this.focus,this)}if(this.maximizable){this.mon(this.header,"dblclick",this.toggleMaximize,this)}},initEvents:function(){Ext.Window.superclass.initEvents.call(this);if(this.animateTarget){this.setAnimateTarget(this.animateTarget)}if(this.resizable){this.resizer=new Ext.Resizable(this.el,{minWidth:this.minWidth,minHeight:this.minHeight,handles:this.resizeHandles||"all",pinned:true,resizeElement:this.resizerAction,handleCls:"x-window-handle"});this.resizer.window=this;this.mon(this.resizer,"beforeresize",this.beforeResize,this)}if(this.draggable){this.header.addClass("x-window-draggable")}this.mon(this.el,"mousedown",this.toFront,this);this.manager=this.manager||Ext.WindowMgr;this.manager.register(this);if(this.maximized){this.maximized=false;this.maximize()}if(this.closable){var a=this.getKeyMap();a.on(27,this.onEsc,this);a.disable()}},initDraggable:function(){this.dd=new Ext.Window.DD(this)},onEsc:function(a,b){b.stopEvent();this[this.closeAction]()},beforeDestroy:function(){if(this.rendered){this.hide();this.clearAnchor();Ext.destroy(this.focusEl,this.resizer,this.dd,this.proxy,this.mask)}Ext.Window.superclass.beforeDestroy.call(this)},onDestroy:function(){if(this.manager){this.manager.unregister(this)}Ext.Window.superclass.onDestroy.call(this)},initTools:function(){if(this.minimizable){this.addTool({id:"minimize",handler:this.minimize.createDelegate(this,[])})}if(this.maximizable){this.addTool({id:"maximize",handler:this.maximize.createDelegate(this,[])});this.addTool({id:"restore",handler:this.restore.createDelegate(this,[]),hidden:true})}if(this.closable){this.addTool({id:"close",handler:this[this.closeAction].createDelegate(this,[])})}},resizerAction:function(){var a=this.proxy.getBox();this.proxy.hide();this.window.handleResize(a);return a},beforeResize:function(){this.resizer.minHeight=Math.max(this.minHeight,this.getFrameHeight()+40);this.resizer.minWidth=Math.max(this.minWidth,this.getFrameWidth()+40);this.resizeBox=this.el.getBox()},updateHandles:function(){if(Ext.isIE&&this.resizer){this.resizer.syncHandleHeight();this.el.repaint()}},handleResize:function(b){var a=this.resizeBox;if(a.x!=b.x||a.y!=b.y){this.updateBox(b)}else{this.setSize(b);if(Ext.isIE6&&Ext.isStrict){this.doLayout()}}this.focus();this.updateHandles();this.saveState()},focus:function(){var e=this.focusEl,a=this.defaultButton,c=typeof a,d,b;if(Ext.isDefined(a)){if(Ext.isNumber(a)&&this.fbar){e=this.fbar.items.get(a)}else{if(Ext.isString(a)){e=Ext.getCmp(a)}else{e=a}}d=e.getEl();b=Ext.getDom(this.container);if(d&&b){if(!Ext.lib.Region.getRegion(b).contains(Ext.lib.Region.getRegion(d.dom))){return}}}e=e||this.focusEl;e.focus.defer(10,e)},setAnimateTarget:function(a){a=Ext.get(a);this.animateTarget=a},beforeShow:function(){delete this.el.lastXY;delete this.el.lastLT;if(this.x===undefined||this.y===undefined){var a=this.el.getAlignToXY(this.container,"c-c");var b=this.el.translatePoints(a[0],a[1]);this.x=this.x===undefined?b.left:this.x;this.y=this.y===undefined?b.top:this.y}this.el.setLeftTop(this.x,this.y);if(this.expandOnShow){this.expand(false)}if(this.modal){Ext.getBody().addClass("x-body-masked");this.mask.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true));this.mask.show()}},show:function(c,a,b){if(!this.rendered){this.render(Ext.getBody())}if(this.hidden===false){this.toFront();return this}if(this.fireEvent("beforeshow",this)===false){return this}if(a){this.on("show",a,b,{single:true})}this.hidden=false;if(Ext.isDefined(c)){this.setAnimateTarget(c)}this.beforeShow();if(this.animateTarget){this.animShow()}else{this.afterShow()}return this},afterShow:function(b){if(this.isDestroyed){return false}this.proxy.hide();this.el.setStyle("display","block");this.el.show();if(this.maximized){this.fitContainer()}if(Ext.isMac&&Ext.isGecko2){this.cascade(this.setAutoScroll)}if(this.monitorResize||this.modal||this.constrain||this.constrainHeader){Ext.EventManager.onWindowResize(this.onWindowResize,this)}this.doConstrain();this.doLayout();if(this.keyMap){this.keyMap.enable()}this.toFront();this.updateHandles();if(b&&(Ext.isIE||Ext.isWebKit)){var a=this.getSize();this.onResize(a.width,a.height)}this.onShow();this.fireEvent("show",this)},animShow:function(){this.proxy.show();this.proxy.setBox(this.animateTarget.getBox());this.proxy.setOpacity(0);var a=this.getBox();this.el.setStyle("display","none");this.proxy.shift(Ext.apply(a,{callback:this.afterShow.createDelegate(this,[true],false),scope:this,easing:"easeNone",duration:0.25,opacity:0.5}))},hide:function(c,a,b){if(this.hidden||this.fireEvent("beforehide",this)===false){return this}if(a){this.on("hide",a,b,{single:true})}this.hidden=true;if(c!==undefined){this.setAnimateTarget(c)}if(this.modal){this.mask.hide();Ext.getBody().removeClass("x-body-masked")}if(this.animateTarget){this.animHide()}else{this.el.hide();this.afterHide()}return this},afterHide:function(){this.proxy.hide();if(this.monitorResize||this.modal||this.constrain||this.constrainHeader){Ext.EventManager.removeResizeListener(this.onWindowResize,this)}if(this.keyMap){this.keyMap.disable()}this.onHide();this.fireEvent("hide",this)},animHide:function(){this.proxy.setOpacity(0.5);this.proxy.show();var a=this.getBox(false);this.proxy.setBox(a);this.el.hide();this.proxy.shift(Ext.apply(this.animateTarget.getBox(),{callback:this.afterHide,scope:this,duration:0.25,easing:"easeNone",opacity:0}))},onShow:Ext.emptyFn,onHide:Ext.emptyFn,onWindowResize:function(){if(this.maximized){this.fitContainer()}if(this.modal){this.mask.setSize("100%","100%");var a=this.mask.dom.offsetHeight;this.mask.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true))}this.doConstrain()},doConstrain:function(){if(this.constrain||this.constrainHeader){var b;if(this.constrain){b={right:this.el.shadowOffset,left:this.el.shadowOffset,bottom:this.el.shadowOffset}}else{var a=this.getSize();b={right:-(a.width-100),bottom:-(a.height-25)}}var c=this.el.getConstrainToXY(this.container,true,b);if(c){this.setPosition(c[0],c[1])}}},ghost:function(a){var c=this.createGhost(a);var b=this.getBox(true);c.setLeftTop(b.x,b.y);c.setWidth(b.width);this.el.hide();this.activeGhost=c;return c},unghost:function(b,a){if(!this.activeGhost){return}if(b!==false){this.el.show();this.focus.defer(10,this);if(Ext.isMac&&Ext.isGecko2){this.cascade(this.setAutoScroll)}}if(a!==false){this.setPosition(this.activeGhost.getLeft(true),this.activeGhost.getTop(true))}this.activeGhost.hide();this.activeGhost.remove();delete this.activeGhost},minimize:function(){this.fireEvent("minimize",this);return this},close:function(){if(this.fireEvent("beforeclose",this)!==false){if(this.hidden){this.doClose()}else{this.hide(null,this.doClose,this)}}},doClose:function(){this.fireEvent("close",this);this.destroy()},maximize:function(){if(!this.maximized){this.expand(false);this.restoreSize=this.getSize();this.restorePos=this.getPosition(true);if(this.maximizable){this.tools.maximize.hide();this.tools.restore.show()}this.maximized=true;this.el.disableShadow();if(this.dd){this.dd.lock()}if(this.collapsible){this.tools.toggle.hide()}this.el.addClass("x-window-maximized");this.container.addClass("x-window-maximized-ct");this.setPosition(0,0);this.fitContainer();this.fireEvent("maximize",this)}return this},restore:function(){if(this.maximized){var a=this.tools;this.el.removeClass("x-window-maximized");if(a.restore){a.restore.hide()}if(a.maximize){a.maximize.show()}this.setPosition(this.restorePos[0],this.restorePos[1]);this.setSize(this.restoreSize.width,this.restoreSize.height);delete this.restorePos;delete this.restoreSize;this.maximized=false;this.el.enableShadow(true);if(this.dd){this.dd.unlock()}if(this.collapsible&&a.toggle){a.toggle.show()}this.container.removeClass("x-window-maximized-ct");this.doConstrain();this.fireEvent("restore",this)}return this},toggleMaximize:function(){return this[this.maximized?"restore":"maximize"]()},fitContainer:function(){var a=this.container.getViewSize(false);this.setSize(a.width,a.height)},setZIndex:function(a){if(this.modal){this.mask.setStyle("z-index",a)}this.el.setZIndex(++a);a+=5;if(this.resizer){this.resizer.proxy.setStyle("z-index",++a)}this.lastZIndex=a},alignTo:function(b,a,c){var d=this.el.getAlignToXY(b,a,c);this.setPagePosition(d[0],d[1]);return this},anchorTo:function(c,e,d,b){this.clearAnchor();this.anchorTarget={el:c,alignment:e,offsets:d};Ext.EventManager.onWindowResize(this.doAnchor,this);var a=typeof b;if(a!="undefined"){Ext.EventManager.on(window,"scroll",this.doAnchor,this,{buffer:a=="number"?b:50})}return this.doAnchor()},doAnchor:function(){var a=this.anchorTarget;this.alignTo(a.el,a.alignment,a.offsets);return this},clearAnchor:function(){if(this.anchorTarget){Ext.EventManager.removeResizeListener(this.doAnchor,this);Ext.EventManager.un(window,"scroll",this.doAnchor,this);delete this.anchorTarget}return this},toFront:function(a){if(this.manager.bringToFront(this)){if(!a||!a.getTarget().focus){this.focus()}}return this},setActive:function(a){if(a){if(!this.maximized){this.el.enableShadow(true)}this.fireEvent("activate",this)}else{this.el.disableShadow();this.fireEvent("deactivate",this)}},toBack:function(){this.manager.sendToBack(this);return this},center:function(){var a=this.el.getAlignToXY(this.container,"c-c");this.setPagePosition(a[0],a[1]);return this}});Ext.reg("window",Ext.Window);Ext.Window.DD=function(a){this.win=a;Ext.Window.DD.superclass.constructor.call(this,a.el.id,"WindowDD-"+a.id);this.setHandleElId(a.header.id);this.scroll=false};Ext.extend(Ext.Window.DD,Ext.dd.DD,{moveOnly:true,headerOffsets:[100,25],startDrag:function(){var a=this.win;this.proxy=a.ghost();if(a.constrain!==false){var c=a.el.shadowOffset;this.constrainTo(a.container,{right:c,left:c,bottom:c})}else{if(a.constrainHeader!==false){var b=this.proxy.getSize();this.constrainTo(a.container,{right:-(b.width-this.headerOffsets[0]),bottom:-(b.height-this.headerOffsets[1])})}}},b4Drag:Ext.emptyFn,onDrag:function(a){this.alignElWithMouse(this.proxy,a.getPageX(),a.getPageY())},endDrag:function(a){this.win.unghost();this.win.saveState()}});Ext.WindowGroup=function(){var g={};var d=[];var e=null;var c=function(j,i){return(!j._lastAccess||j._lastAccess0){l.sort(c);var k=l[0].manager.zseed;for(var m=0;m=0;--j){if(!d[j].hidden){b(d[j]);return}}b(null)};return{zseed:9000,register:function(i){if(i.manager){i.manager.unregister(i)}i.manager=this;g[i.id]=i;d.push(i);i.on("hide",a)},unregister:function(i){delete i.manager;delete g[i.id];i.un("hide",a);d.remove(i)},get:function(i){return typeof i=="object"?i:g[i]},bringToFront:function(i){i=this.get(i);if(i!=e){i._lastAccess=new Date().getTime();h();return true}return false},sendToBack:function(i){i=this.get(i);i._lastAccess=-(new Date().getTime());h();return i},hideAll:function(){for(var i in g){if(g[i]&&typeof g[i]!="function"&&g[i].isVisible()){g[i].hide()}}},getActive:function(){return e},getBy:function(l,k){var m=[];for(var j=d.length-1;j>=0;--j){var n=d[j];if(l.call(k||n,n)!==false){m.push(n)}}return m},each:function(j,i){for(var k in g){if(g[k]&&typeof g[k]!="function"){if(j.call(i||g[k],g[k])===false){return}}}}}};Ext.WindowMgr=new Ext.WindowGroup();Ext.MessageBox=function(){var u,b,q,t,h,l,s,a,n,p,j,g,r,v,o,i="",d="",m=["ok","yes","no","cancel"];var c=function(y){r[y].blur();if(u.isVisible()){u.hide();x();Ext.callback(b.fn,b.scope||window,[y,v.dom.value,b],1)}};var x=function(){if(b&&b.cls){u.el.removeClass(b.cls)}n.reset()};var e=function(A,y,z){if(b&&b.closable!==false){u.hide();x()}if(z){z.stopEvent()}};var k=function(y){var A=0,z;if(!y){Ext.each(m,function(B){r[B].hide()});return A}u.footer.dom.style.display="";Ext.iterate(r,function(B,C){z=y[B];if(z){C.show();C.setText(Ext.isString(z)?z:Ext.MessageBox.buttonText[B]);A+=C.getEl().getWidth()+15}else{C.hide()}});return A};return{getDialog:function(y){if(!u){var A=[];r={};Ext.each(m,function(B){A.push(r[B]=new Ext.Button({text:this.buttonText[B],handler:c.createCallback(B),hideMode:"offsets"}))},this);u=new Ext.Window({autoCreate:true,title:y,resizable:false,constrain:true,constrainHeader:true,minimizable:false,maximizable:false,stateful:false,modal:true,shim:true,buttonAlign:"center",width:400,height:100,minHeight:80,plain:true,footer:true,closable:true,close:function(){if(b&&b.buttons&&b.buttons.no&&!b.buttons.cancel){c("no")}else{c("cancel")}},fbar:new Ext.Toolbar({items:A,enableOverflow:false})});u.render(document.body);u.getEl().addClass("x-window-dlg");q=u.mask;h=u.body.createChild({html:'

'});j=Ext.get(h.dom.firstChild);var z=h.dom.childNodes[1];l=Ext.get(z.firstChild);s=Ext.get(z.childNodes[2].firstChild);s.enableDisplayMode();s.addKeyListener([10,13],function(){if(u.isVisible()&&b&&b.buttons){if(b.buttons.ok){c("ok")}else{if(b.buttons.yes){c("yes")}}}});a=Ext.get(z.childNodes[2].childNodes[1]);a.enableDisplayMode();n=new Ext.ProgressBar({renderTo:h});h.createChild({cls:"x-clear"})}return u},updateText:function(B){if(!u.isVisible()&&!b.width){u.setSize(this.maxWidth,100)}l.update(B||" ");var z=d!=""?(j.getWidth()+j.getMargins("lr")):0,D=l.getWidth()+l.getMargins("lr"),A=u.getFrameWidth("lr"),C=u.body.getFrameWidth("lr"),y;if(Ext.isIE&&z>0){z+=3}y=Math.max(Math.min(b.width||z+D+A+C,b.maxWidth||this.maxWidth),Math.max(b.minWidth||this.minWidth,o||0));if(b.prompt===true){v.setWidth(y-z-A-C)}if(b.progress===true||b.wait===true){n.setSize(y-z-A-C)}if(Ext.isIE&&y==o){y+=4}u.setSize(y,"auto").center();return this},updateProgress:function(z,y,A){n.updateProgress(z,y);if(A){this.updateText(A)}return this},isVisible:function(){return u&&u.isVisible()},hide:function(){var y=u?u.activeGhost:null;if(this.isVisible()||y){u.hide();x();if(y){u.unghost(false,false)}}return this},show:function(B){if(this.isVisible()){this.hide()}b=B;var C=this.getDialog(b.title||" ");C.setTitle(b.title||" ");var y=(b.closable!==false&&b.progress!==true&&b.wait!==true);C.tools.close.setDisplayed(y);v=s;b.prompt=b.prompt||(b.multiline?true:false);if(b.prompt){if(b.multiline){s.hide();a.show();a.setHeight(Ext.isNumber(b.multiline)?b.multiline:this.defaultTextHeight);v=a}else{s.show();a.hide()}}else{s.hide();a.hide()}v.dom.value=b.value||"";if(b.prompt){C.focusEl=v}else{var A=b.buttons;var z=null;if(A&&A.ok){z=r.ok}else{if(A&&A.yes){z=r.yes}}if(z){C.focusEl=z}}if(b.iconCls){C.setIconClass(b.iconCls)}this.setIcon(Ext.isDefined(b.icon)?b.icon:i);o=k(b.buttons);n.setVisible(b.progress===true||b.wait===true);this.updateProgress(0,b.progressText);this.updateText(b.msg);if(b.cls){C.el.addClass(b.cls)}C.proxyDrag=b.proxyDrag===true;C.modal=b.modal!==false;C.mask=b.modal!==false?q:false;if(!C.isVisible()){document.body.appendChild(u.el.dom);C.setAnimateTarget(b.animEl);C.on("show",function(){if(y===true){C.keyMap.enable()}else{C.keyMap.disable()}},this,{single:true});C.show(b.animEl)}if(b.wait===true){n.wait(b.waitConfig)}return this},setIcon:function(y){if(!u){i=y;return}i=undefined;if(y&&y!=""){j.removeClass("x-hidden");j.replaceClass(d,y);h.addClass("x-dlg-icon");d=y}else{j.replaceClass(d,"x-hidden");h.removeClass("x-dlg-icon");d=""}return this},progress:function(A,z,y){this.show({title:A,msg:z,buttons:false,progress:true,closable:false,minWidth:this.minProgressWidth,progressText:y});return this},wait:function(A,z,y){this.show({title:z,msg:A,buttons:false,closable:false,wait:true,modal:true,minWidth:this.minProgressWidth,waitConfig:y});return this},alert:function(B,A,z,y){this.show({title:B,msg:A,buttons:this.OK,fn:z,scope:y,minWidth:this.minWidth});return this},confirm:function(B,A,z,y){this.show({title:B,msg:A,buttons:this.YESNO,fn:z,scope:y,icon:this.QUESTION,minWidth:this.minWidth});return this},prompt:function(D,C,A,z,y,B){this.show({title:D,msg:C,buttons:this.OKCANCEL,fn:A,minWidth:this.minPromptWidth,scope:z,prompt:true,multiline:y,value:B});return this},OK:{ok:true},CANCEL:{cancel:true},OKCANCEL:{ok:true,cancel:true},YESNO:{yes:true,no:true},YESNOCANCEL:{yes:true,no:true,cancel:true},INFO:"ext-mb-info",WARNING:"ext-mb-warning",QUESTION:"ext-mb-question",ERROR:"ext-mb-error",defaultTextHeight:75,maxWidth:600,minWidth:100,minProgressWidth:250,minPromptWidth:250,buttonText:{ok:"OK",cancel:"Cancel",yes:"Yes",no:"No"}}}();Ext.Msg=Ext.MessageBox;Ext.dd.PanelProxy=function(a,b){this.panel=a;this.id=this.panel.id+"-ddproxy";Ext.apply(this,b)};Ext.dd.PanelProxy.prototype={insertProxy:true,setStatus:Ext.emptyFn,reset:Ext.emptyFn,update:Ext.emptyFn,stop:Ext.emptyFn,sync:Ext.emptyFn,getEl:function(){return this.ghost},getGhost:function(){return this.ghost},getProxy:function(){return this.proxy},hide:function(){if(this.ghost){if(this.proxy){this.proxy.remove();delete this.proxy}this.panel.el.dom.style.display="";this.ghost.remove();delete this.ghost}},show:function(){if(!this.ghost){this.ghost=this.panel.createGhost(undefined,undefined,Ext.getBody());this.ghost.setXY(this.panel.el.getXY());if(this.insertProxy){this.proxy=this.panel.el.insertSibling({cls:"x-panel-dd-spacer"});this.proxy.setSize(this.panel.getSize())}this.panel.el.dom.style.display="none"}},repair:function(b,c,a){this.hide();if(typeof c=="function"){c.call(a||this)}},moveProxy:function(a,b){if(this.proxy){a.insertBefore(this.proxy.dom,b)}}};Ext.Panel.DD=function(b,a){this.panel=b;this.dragData={panel:b};this.proxy=new Ext.dd.PanelProxy(b,a);Ext.Panel.DD.superclass.constructor.call(this,b.el,a);var c=b.header;if(c){this.setHandleElId(c.id)}(c?c:this.panel.body).setStyle("cursor","move");this.scroll=false};Ext.extend(Ext.Panel.DD,Ext.dd.DragSource,{showFrame:Ext.emptyFn,startDrag:Ext.emptyFn,b4StartDrag:function(a,b){this.proxy.show()},b4MouseDown:function(b){var a=b.getPageX();var c=b.getPageY();this.autoOffset(a,c)},onInitDrag:function(a,b){this.onStartDrag(a,b);return true},createFrame:Ext.emptyFn,getDragEl:function(a){return this.proxy.ghost.dom},endDrag:function(a){this.proxy.hide();this.panel.saveState()},autoOffset:function(a,b){a-=this.startPageX;b-=this.startPageY;this.setDelta(a,b)}});Ext.state.Provider=function(){this.addEvents("statechange");this.state={};Ext.state.Provider.superclass.constructor.call(this)};Ext.extend(Ext.state.Provider,Ext.util.Observable,{get:function(b,a){return typeof this.state[b]=="undefined"?a:this.state[b]},clear:function(a){delete this.state[a];this.fireEvent("statechange",this,a,null)},set:function(a,b){this.state[a]=b;this.fireEvent("statechange",this,a,b)},decodeValue:function(b){var e=/^(a|n|d|b|s|o)\:(.*)$/;var g=e.exec(unescape(b));if(!g||!g[1]){return}var d=g[1];var a=g[2];switch(d){case"n":return parseFloat(a);case"d":return new Date(Date.parse(a));case"b":return(a=="1");case"a":var c=[];if(a!=""){Ext.each(a.split("^"),function(h){c.push(this.decodeValue(h))},this)}return c;case"o":var c={};if(a!=""){Ext.each(a.split("^"),function(i){var h=i.split("=");c[h[0]]=this.decodeValue(h[1])},this)}return c;default:return a}},encodeValue:function(c){var b;if(typeof c=="number"){b="n:"+c}else{if(typeof c=="boolean"){b="b:"+(c?"1":"0")}else{if(Ext.isDate(c)){b="d:"+c.toGMTString()}else{if(Ext.isArray(c)){var g="";for(var e=0,a=c.length;e-1){var e=this.isSelected(b);var c=this.all.elements[b];var d=this.bufferRender([a],b)[0];this.all.replaceElement(b,d,true);if(e){this.selected.replaceElement(c,d);this.all.item(b).addClass(this.selectedClass)}this.updateIndexes(b,b)}},onAdd:function(g,d,e){if(this.all.getCount()===0){this.refresh();return}var c=this.bufferRender(d,e),h,b=this.all.elements;if(e0){if(!b){this.selected.removeClass(this.selectedClass)}this.selected.clear();this.last=false;if(!a){this.fireEvent("selectionchange",this,this.selected.elements)}}},isSelected:function(a){return this.selected.contains(this.getNode(a))},deselect:function(a){if(this.isSelected(a)){a=this.getNode(a);this.selected.removeElement(a);if(this.last==a.viewIndex){this.last=false}Ext.fly(a).removeClass(this.selectedClass);this.fireEvent("selectionchange",this,this.selected.elements)}},select:function(d,g,b){if(Ext.isArray(d)){if(!g){this.clearSelections(true)}for(var c=0,a=d.length;c=a&&d[c];c--){b.push(d[c])}}return b},indexOf:function(a){a=this.getNode(a);if(Ext.isNumber(a.viewIndex)){return a.viewIndex}return this.all.indexOf(a)},onBeforeLoad:function(){if(this.loadingText){this.clearSelections(false,true);this.getTemplateTarget().update('
'+this.loadingText+"
");this.all.clear()}},onDestroy:function(){this.all.clear();this.selected.clear();Ext.DataView.superclass.onDestroy.call(this);this.bindStore(null)}});Ext.DataView.prototype.setStore=Ext.DataView.prototype.bindStore;Ext.reg("dataview",Ext.DataView);Ext.list.ListView=Ext.extend(Ext.DataView,{itemSelector:"dl",selectedClass:"x-list-selected",overClass:"x-list-over",scrollOffset:undefined,columnResize:true,columnSort:true,maxWidth:Ext.isIE?99:100,initComponent:function(){if(this.columnResize){this.colResizer=new Ext.list.ColumnResizer(this.colResizer);this.colResizer.init(this)}if(this.columnSort){this.colSorter=new Ext.list.Sorter(this.columnSort);this.colSorter.init(this)}if(!this.internalTpl){this.internalTpl=new Ext.XTemplate('
','','
',"{header}","
","
",'
',"
",'
',"
")}if(!this.tpl){this.tpl=new Ext.XTemplate('',"
",'','
',' class="{cls}">',"{[values.tpl.apply(parent)]}","
","
",'
',"
","
")}var l=this.columns,h=0,k=0,m=l.length,b=[];for(var g=0;g10)){e.style.width=a+"px";g.style.width=a+"px"}else{e.style.width=b+"px";g.style.width=b+"px";setTimeout(function(){if((c.offsetWidth-c.clientWidth)>10){e.style.width=a+"px";g.style.width=a+"px"}},10)}}if(Ext.isNumber(d)){c.style.height=(d-g.parentNode.offsetHeight)+"px"}},updateIndexes:function(){Ext.list.ListView.superclass.updateIndexes.apply(this,arguments);this.verifyInternalSize()},findHeaderIndex:function(e){e=e.dom||e;var a=e.parentNode,d=a.parentNode.childNodes;for(var b=0,g;g=d[b];b++){if(g==a){return b}}return -1},setHdWidths:function(){var c=this.innerHd.dom.getElementsByTagName("div");for(var b=0,d=this.columns,a=d.length;b','','{text}',"");d.disableFormats=true;d.compile();Ext.TabPanel.prototype.itemTpl=d}this.items.each(this.initTab,this)},afterRender:function(){Ext.TabPanel.superclass.afterRender.call(this);if(this.autoTabs){this.readTabs(false)}if(this.activeTab!==undefined){var a=Ext.isObject(this.activeTab)?this.activeTab:this.items.get(this.activeTab);delete this.activeTab;this.setActiveTab(a)}},initEvents:function(){Ext.TabPanel.superclass.initEvents.call(this);this.mon(this.strip,{scope:this,mousedown:this.onStripMouseDown,contextmenu:this.onStripContextMenu});if(this.enableTabScroll){this.mon(this.strip,"mousewheel",this.onWheel,this)}},findTargets:function(c){var b=null,a=c.getTarget("li:not(.x-tab-edge)",this.strip);if(a){b=this.getComponent(a.id.split(this.idDelimiter)[1]);if(b.disabled){return{close:null,item:null,el:null}}}return{close:c.getTarget(".x-tab-strip-close",this.strip),item:b,el:a}},onStripMouseDown:function(b){if(b.button!==0){return}b.preventDefault();var a=this.findTargets(b);if(a.close){if(a.item.fireEvent("beforeclose",a.item)!==false){a.item.fireEvent("close",a.item);this.remove(a.item)}return}if(a.item&&a.item!=this.activeTab){this.setActiveTab(a.item)}},onStripContextMenu:function(b){b.preventDefault();var a=this.findTargets(b);if(a.item){this.fireEvent("contextmenu",this,a.item,b)}},readTabs:function(d){if(d===true){this.items.each(function(h){this.remove(h)},this)}var c=this.el.query(this.autoTabSelector);for(var b=0,a=c.length;b0){this.setActiveTab(0)}else{this.setActiveTab(null)}}}if(!this.destroying){this.delegateUpdates()}},onBeforeShowItem:function(a){if(a!=this.activeTab){this.setActiveTab(a);return false}},onItemDisabled:function(b){var a=this.getTabEl(b);if(a){Ext.fly(a).addClass("x-item-disabled")}this.stack.remove(b)},onItemEnabled:function(b){var a=this.getTabEl(b);if(a){Ext.fly(a).removeClass("x-item-disabled")}},onItemTitleChanged:function(b){var a=this.getTabEl(b);if(a){Ext.fly(a).child("span.x-tab-strip-text",true).innerHTML=b.title}},onItemIconChanged:function(d,a,c){var b=this.getTabEl(d);if(b){b=Ext.get(b);b.child("span.x-tab-strip-text").replaceClass(c,a);b[Ext.isEmpty(a)?"removeClass":"addClass"]("x-tab-with-icon")}},getTabEl:function(a){var b=this.getComponent(a);return b?b.tabEl:null},onResize:function(){Ext.TabPanel.superclass.onResize.apply(this,arguments);this.delegateUpdates()},beginUpdate:function(){this.suspendUpdates=true},endUpdate:function(){this.suspendUpdates=false;this.delegateUpdates()},hideTabStripItem:function(b){b=this.getComponent(b);var a=this.getTabEl(b);if(a){a.style.display="none";this.delegateUpdates()}this.stack.remove(b)},unhideTabStripItem:function(b){b=this.getComponent(b);var a=this.getTabEl(b);if(a){a.style.display="";this.delegateUpdates()}},delegateUpdates:function(){if(this.suspendUpdates){return}if(this.resizeTabs&&this.rendered){this.autoSizeTabs()}if(this.enableTabScroll&&this.rendered){this.autoScrollTabs()}},autoSizeTabs:function(){var h=this.items.length,b=this.tabPosition!="bottom"?"header":"footer",c=this[b].dom.offsetWidth,a=this[b].dom.clientWidth;if(!this.resizeTabs||h<1||!a){return}var k=Math.max(Math.min(Math.floor((a-4)/h)-this.tabMargin,this.tabWidth),this.minTabWidth);this.lastTabWidth=k;var m=this.strip.query("li:not(.x-tab-edge)");for(var e=0,j=m.length;e20?c:20);if(!this.scrolling){if(!this.scrollLeft){this.createScrollers()}else{this.scrollLeft.show();this.scrollRight.show()}}this.scrolling=true;if(i>(a-c)){e.scrollLeft=a-c}else{this.scrollToTab(this.activeTab,false)}this.updateScrollButtons()}},createScrollers:function(){this.pos.addClass("x-tab-scrolling-"+this.tabPosition);var c=this.stripWrap.dom.offsetHeight;var a=this.pos.insertFirst({cls:"x-tab-scroller-left"});a.setHeight(c);a.addClassOnOver("x-tab-scroller-left-over");this.leftRepeater=new Ext.util.ClickRepeater(a,{interval:this.scrollRepeatInterval,handler:this.onScrollLeft,scope:this});this.scrollLeft=a;var b=this.pos.insertFirst({cls:"x-tab-scroller-right"});b.setHeight(c);b.addClassOnOver("x-tab-scroller-right-over");this.rightRepeater=new Ext.util.ClickRepeater(b,{interval:this.scrollRepeatInterval,handler:this.onScrollRight,scope:this});this.scrollRight=b},getScrollWidth:function(){return this.edge.getOffsetsTo(this.stripWrap)[0]+this.getScrollPos()},getScrollPos:function(){return parseInt(this.stripWrap.dom.scrollLeft,10)||0},getScrollArea:function(){return parseInt(this.stripWrap.dom.clientWidth,10)||0},getScrollAnim:function(){return{duration:this.scrollDuration,callback:this.updateScrollButtons,scope:this}},getScrollIncrement:function(){return this.scrollIncrement||(this.resizeTabs?this.lastTabWidth+2:100)},scrollToTab:function(e,a){if(!e){return}var c=this.getTabEl(e),h=this.getScrollPos(),d=this.getScrollArea(),g=Ext.fly(c).getOffsetsTo(this.stripWrap)[0]+h,b=g+c.offsetWidth;if(g(h+d)){this.scrollTo(b-d,a)}}},scrollTo:function(b,a){this.stripWrap.scrollTo("left",b,a?this.getScrollAnim():false);if(!a){this.updateScrollButtons()}},onWheel:function(g){var h=g.getWheelDelta()*this.wheelIncrement*-1;g.stopEvent();var i=this.getScrollPos(),c=i+h,a=this.getScrollWidth()-this.getScrollArea();var b=Math.max(0,Math.min(a,c));if(b!=i){this.scrollTo(b,false)}},onScrollRight:function(){var a=this.getScrollWidth()-this.getScrollArea(),c=this.getScrollPos(),b=Math.min(a,c+this.getScrollIncrement());if(b!=c){this.scrollTo(b,this.animScroll)}},onScrollLeft:function(){var b=this.getScrollPos(),a=Math.max(0,b-this.getScrollIncrement());if(a!=b){this.scrollTo(a,this.animScroll)}},updateScrollButtons:function(){var a=this.getScrollPos();this.scrollLeft[a===0?"addClass":"removeClass"]("x-tab-scroller-left-disabled");this.scrollRight[a>=(this.getScrollWidth()-this.getScrollArea())?"addClass":"removeClass"]("x-tab-scroller-right-disabled")},beforeDestroy:function(){Ext.destroy(this.leftRepeater,this.rightRepeater);this.deleteMembers("strip","edge","scrollLeft","scrollRight","stripWrap");this.activeTab=null;Ext.TabPanel.superclass.beforeDestroy.apply(this)}});Ext.reg("tabpanel",Ext.TabPanel);Ext.TabPanel.prototype.activate=Ext.TabPanel.prototype.setActiveTab;Ext.TabPanel.AccessStack=function(){var a=[];return{add:function(b){a.push(b);if(a.length>10){a.shift()}},remove:function(e){var d=[];for(var c=0,b=a.length;c','  ','  ','  ',"");Ext.Button.buttonTemplate.compile()}this.template=Ext.Button.buttonTemplate}var b,d=this.getTemplateArgs();if(a){b=this.template.insertBefore(a,d,true)}else{b=this.template.append(c,d,true)}this.btnEl=b.child(this.buttonSelector);this.mon(this.btnEl,{scope:this,focus:this.onFocus,blur:this.onBlur});this.initButtonEl(b,this.btnEl);Ext.ButtonToggleMgr.register(this)},initButtonEl:function(b,c){this.el=b;this.setIcon(this.icon);this.setText(this.text);this.setIconClass(this.iconCls);if(Ext.isDefined(this.tabIndex)){c.dom.tabIndex=this.tabIndex}if(this.tooltip){this.setTooltip(this.tooltip,true)}if(this.handleMouseEvents){this.mon(b,{scope:this,mouseover:this.onMouseOver,mousedown:this.onMouseDown})}if(this.menu){this.mon(this.menu,{scope:this,show:this.onMenuShow,hide:this.onMenuHide})}if(this.repeat){var a=new Ext.util.ClickRepeater(b,Ext.isObject(this.repeat)?this.repeat:{});this.mon(a,"click",this.onClick,this)}this.mon(b,this.clickEvent,this.onClick,this)},afterRender:function(){Ext.Button.superclass.afterRender.call(this);this.useSetClass=true;this.setButtonClass();this.doc=Ext.getDoc();this.doAutoWidth()},setIconClass:function(a){this.iconCls=a;if(this.el){this.btnEl.dom.className="";this.btnEl.addClass(["x-btn-text",a||""]);this.setButtonClass()}return this},setTooltip:function(b,a){if(this.rendered){if(!a){this.clearTip()}if(Ext.isObject(b)){Ext.QuickTips.register(Ext.apply({target:this.btnEl.id},b));this.tooltip=b}else{this.btnEl.dom[this.tooltipType]=b}}else{this.tooltip=b}return this},clearTip:function(){if(Ext.isObject(this.tooltip)){Ext.QuickTips.unregister(this.btnEl)}},beforeDestroy:function(){if(this.rendered){this.clearTip()}if(this.menu&&this.destroyMenu!==false){Ext.destroy(this.menu)}Ext.destroy(this.repeater)},onDestroy:function(){if(this.rendered){this.doc.un("mouseover",this.monitorMouseOver,this);this.doc.un("mouseup",this.onMouseUp,this);delete this.doc;delete this.btnEl;Ext.ButtonToggleMgr.unregister(this)}Ext.Button.superclass.onDestroy.call(this)},doAutoWidth:function(){if(this.el&&this.text&&this.width===undefined){this.el.setWidth("auto");if(Ext.isIE7&&Ext.isStrict){var a=this.btnEl;if(a&&a.getWidth()>20){a.clip();a.setWidth(Ext.util.TextMetrics.measure(a,this.text).width+a.getFrameWidth("lr"))}}if(this.minWidth){if(this.el.getWidth()a}else{return c.getPageY()>this.btnEl.getRegion().bottom}},onClick:function(b,a){b.preventDefault();if(!this.disabled){if(this.isClickOnArrow(b)){if(this.menu&&!this.menu.isVisible()&&!this.ignoreNextClick){this.showMenu()}this.fireEvent("arrowclick",this,b);if(this.arrowHandler){this.arrowHandler.call(this.scope||this,this,b)}}else{if(this.enableToggle){this.toggle()}this.fireEvent("click",this,b);if(this.handler){this.handler.call(this.scope||this,this,b)}}}},isMenuTriggerOver:function(a){return this.menu&&a.target.tagName==this.arrowSelector},isMenuTriggerOut:function(b,a){return this.menu&&b.target.tagName!=this.arrowSelector}});Ext.reg("splitbutton",Ext.SplitButton);Ext.CycleButton=Ext.extend(Ext.SplitButton,{getItemText:function(a){if(a&&this.showText===true){var b="";if(this.prependText){b+=this.prependText}b+=a.text;return b}return undefined},setActiveItem:function(c,a){if(!Ext.isObject(c)){c=this.menu.getComponent(c)}if(c){if(!this.rendered){this.text=this.getItemText(c);this.iconCls=c.iconCls}else{var b=this.getItemText(c);if(b){this.setText(b)}this.setIconClass(c.iconCls)}this.activeItem=c;if(!c.checked){c.setChecked(true,false)}if(this.forceIcon){this.setIconClass(this.forceIcon)}if(!a){this.fireEvent("change",this,c)}}},getActiveItem:function(){return this.activeItem},initComponent:function(){this.addEvents("change");if(this.changeHandler){this.on("change",this.changeHandler,this.scope||this);delete this.changeHandler}this.itemCount=this.items.length;this.menu={cls:"x-cycle-menu",items:[]};var a=0;Ext.each(this.items,function(c,b){Ext.apply(c,{group:c.group||this.id,itemIndex:b,checkHandler:this.checkHandler,scope:this,checked:c.checked||false});this.menu.items.push(c);if(c.checked){a=b}},this);Ext.CycleButton.superclass.initComponent.call(this);this.on("click",this.toggleSelected,this);this.setActiveItem(a,true)},checkHandler:function(a,b){if(b){this.setActiveItem(a)}},toggleSelected:function(){var a=this.menu;a.render();if(!a.hasLayout){a.doLayout()}var d,b;for(var c=1;c"){b=new a.Fill()}else{b=new a.TextItem(b)}}}this.applyDefaults(b)}else{if(b.isFormField||b.render){b=this.createComponent(b)}else{if(b.tag){b=new a.Item({autoEl:b})}else{if(b.tagName){b=new a.Item({el:b})}else{if(Ext.isObject(b)){b=b.xtype?this.createComponent(b):this.constructButton(b)}}}}}return b},applyDefaults:function(e){if(!Ext.isString(e)){e=Ext.Toolbar.superclass.applyDefaults.call(this,e);var b=this.internalDefaults;if(e.events){Ext.applyIf(e.initialConfig,b);Ext.apply(e,b)}else{Ext.applyIf(e,b)}}return e},addSeparator:function(){return this.add(new a.Separator())},addSpacer:function(){return this.add(new a.Spacer())},addFill:function(){this.add(new a.Fill())},addElement:function(b){return this.addItem(new a.Item({el:b}))},addItem:function(b){return this.add.apply(this,arguments)},addButton:function(c){if(Ext.isArray(c)){var e=[];for(var d=0,b=c.length;d");this.items.push(this.displayItem=new a.TextItem({}))}Ext.PagingToolbar.superclass.initComponent.call(this);this.addEvents("change","beforechange");this.on("afterlayout",this.onFirstLayout,this,{single:true});this.cursor=0;this.bindStore(this.store,true)},onFirstLayout:function(){if(this.dsLoaded){this.onLoad.apply(this,this.dsLoaded)}},updateInfo:function(){if(this.displayItem){var b=this.store.getCount();var c=b==0?this.emptyMsg:String.format(this.displayMsg,this.cursor+1,this.cursor+b,this.store.getTotalCount());this.displayItem.setText(c)}},onLoad:function(b,e,j){if(!this.rendered){this.dsLoaded=[b,e,j];return}var g=this.getParams();this.cursor=(j.params&&j.params[g.start])?j.params[g.start]:0;var i=this.getPageData(),c=i.activePage,h=i.pages;this.afterTextItem.setText(String.format(this.afterPageText,i.pages));this.inputItem.setValue(c);this.first.setDisabled(c==1);this.prev.setDisabled(c==1);this.next.setDisabled(c==h);this.last.setDisabled(c==h);this.refresh.enable();this.updateInfo();this.fireEvent("change",this,i)},getPageData:function(){var b=this.store.getTotalCount();return{total:b,activePage:Math.ceil((this.cursor+this.pageSize)/this.pageSize),pages:b=1&g<=j.pages){i.setValue(g)}}}}}},getParams:function(){return this.paramNames||this.store.paramNames},beforeLoad:function(){if(this.rendered&&this.refresh){this.refresh.disable()}},doLoad:function(d){var c={},b=this.getParams();c[b.start]=d;c[b.limit]=this.pageSize;if(this.fireEvent("beforechange",this,c)!==false){this.store.load({params:c})}},moveFirst:function(){this.doLoad(0)},movePrevious:function(){this.doLoad(Math.max(0,this.cursor-this.pageSize))},moveNext:function(){this.doLoad(this.cursor+this.pageSize)},moveLast:function(){var c=this.store.getTotalCount(),b=c%this.pageSize;this.doLoad(b?(c-b):c-this.pageSize)},doRefresh:function(){this.doLoad(this.cursor)},bindStore:function(c,d){var b;if(!d&&this.store){if(c!==this.store&&this.store.autoDestroy){this.store.destroy()}else{this.store.un("beforeload",this.beforeLoad,this);this.store.un("load",this.onLoad,this);this.store.un("exception",this.onLoadError,this)}if(!c){this.store=null}}if(c){c=Ext.StoreMgr.lookup(c);c.on({scope:this,beforeload:this.beforeLoad,load:this.onLoad,exception:this.onLoadError});b=true}this.store=c;if(b){this.onLoad(c,null,{})}},unbind:function(b){this.bindStore(null)},bind:function(b){this.bindStore(b)},onDestroy:function(){this.bindStore(null);Ext.PagingToolbar.superclass.onDestroy.call(this)}})})();Ext.reg("paging",Ext.PagingToolbar);Ext.History=(function(){var e,c;var k=false;var d;function g(){var l=top.location.href,m=l.indexOf("#");return m>=0?l.substr(m+1):null}function a(){c.value=d}function h(l){d=l;Ext.History.fireEvent("change",l)}function i(m){var l=['
',Ext.util.Format.htmlEncode(m),"
"].join("");try{var o=e.contentWindow.document;o.open();o.write(l);o.close();return true}catch(n){return false}}function b(){if(!e.contentWindow||!e.contentWindow.document){setTimeout(b,10);return}var o=e.contentWindow.document;var m=o.getElementById("state");var l=m?m.innerText:null;var n=g();setInterval(function(){o=e.contentWindow.document;m=o.getElementById("state");var q=m?m.innerText:null;var p=g();if(q!==l){l=q;h(l);top.location.hash=l;n=l;a()}else{if(p!==n){n=p;i(p)}}},50);k=true;Ext.History.fireEvent("ready",Ext.History)}function j(){d=c.value?c.value:g();if(Ext.isIE){b()}else{var l=g();setInterval(function(){var m=g();if(m!==l){l=m;h(l);a()}},50);k=true;Ext.History.fireEvent("ready",Ext.History)}}return{fieldId:"x-history-field",iframeId:"x-history-frame",events:{},init:function(m,l){if(k){Ext.callback(m,l,[this]);return}if(!Ext.isReady){Ext.onReady(function(){Ext.History.init(m,l)});return}c=Ext.getDom(Ext.History.fieldId);if(Ext.isIE){e=Ext.getDom(Ext.History.iframeId)}this.addEvents("ready","change");if(m){this.on("ready",m,l,{single:true})}j()},add:function(l,m){if(m!==false){if(this.getToken()==l){return true}}if(Ext.isIE){return i(l)}else{top.location.hash=l;return true}},back:function(){history.go(-1)},forward:function(){history.go(1)},getToken:function(){return k?d:g()}}})();Ext.apply(Ext.History,new Ext.util.Observable());Ext.Tip=Ext.extend(Ext.Panel,{minWidth:40,maxWidth:300,shadow:"sides",defaultAlign:"tl-bl?",autoRender:true,quickShowInterval:250,frame:true,hidden:true,baseCls:"x-tip",floating:{shadow:true,shim:true,useDisplay:true,constrain:false},autoHeight:true,closeAction:"hide",initComponent:function(){Ext.Tip.superclass.initComponent.call(this);if(this.closable&&!this.title){this.elements+=",header"}},afterRender:function(){Ext.Tip.superclass.afterRender.call(this);if(this.closable){this.addTool({id:"close",handler:this[this.closeAction],scope:this})}},showAt:function(a){Ext.Tip.superclass.show.call(this);if(this.measureWidth!==false&&(!this.initialConfig||typeof this.initialConfig.width!="number")){this.doAutoWidth()}if(this.constrainPosition){a=this.el.adjustForConstraints(a)}this.setPagePosition(a[0],a[1])},doAutoWidth:function(a){a=a||0;var b=this.body.getTextWidth();if(this.title){b=Math.max(b,this.header.child("span").getTextWidth(this.title))}b+=this.getFrameWidth()+(this.closable?20:0)+this.body.getPadding("lr")+a;this.setWidth(b.constrain(this.minWidth,this.maxWidth));if(Ext.isIE7&&!this.repainted){this.el.repaint();this.repainted=true}},showBy:function(a,b){if(!this.rendered){this.render(Ext.getBody())}this.showAt(this.el.getAlignToXY(a,b||this.defaultAlign))},initDraggable:function(){this.dd=new Ext.Tip.DD(this,typeof this.draggable=="boolean"?null:this.draggable);this.header.addClass("x-tip-draggable")}});Ext.reg("tip",Ext.Tip);Ext.Tip.DD=function(b,a){Ext.apply(this,a);this.tip=b;Ext.Tip.DD.superclass.constructor.call(this,b.el.id,"WindowDD-"+b.id);this.setHandleElId(b.header.id);this.scroll=false};Ext.extend(Ext.Tip.DD,Ext.dd.DD,{moveOnly:true,scroll:false,headerOffsets:[100,25],startDrag:function(){this.tip.el.disableShadow()},endDrag:function(a){this.tip.el.enableShadow(true)}});Ext.ToolTip=Ext.extend(Ext.Tip,{showDelay:500,hideDelay:200,dismissDelay:5000,trackMouse:false,anchorToTarget:true,anchorOffset:0,targetCounter:0,constrainPosition:false,initComponent:function(){Ext.ToolTip.superclass.initComponent.call(this);this.lastActive=new Date();this.initTarget(this.target);this.origAnchor=this.anchor},onRender:function(b,a){Ext.ToolTip.superclass.onRender.call(this,b,a);this.anchorCls="x-tip-anchor-"+this.getAnchorPosition();this.anchorEl=this.el.createChild({cls:"x-tip-anchor "+this.anchorCls})},afterRender:function(){Ext.ToolTip.superclass.afterRender.call(this);this.anchorEl.setStyle("z-index",this.el.getZIndex()+1)},initTarget:function(c){var a;if((a=Ext.get(c))){if(this.target){var b=Ext.get(this.target);this.mun(b,"mouseover",this.onTargetOver,this);this.mun(b,"mouseout",this.onTargetOut,this);this.mun(b,"mousemove",this.onMouseMove,this)}this.mon(a,{mouseover:this.onTargetOver,mouseout:this.onTargetOut,mousemove:this.onMouseMove,scope:this});this.target=a}if(this.anchor){this.anchorTarget=this.target}},onMouseMove:function(b){var a=this.delegate?b.getTarget(this.delegate):this.triggerElement=true;if(a){this.targetXY=b.getXY();if(a===this.triggerElement){if(!this.hidden&&this.trackMouse){this.setPagePosition(this.getTargetXY())}}else{this.hide();this.lastActive=new Date(0);this.onTargetOver(b)}}else{if(!this.closable&&this.isVisible()){this.hide()}}},getTargetXY:function(){if(this.delegate){this.anchorTarget=this.triggerElement}if(this.anchor){this.targetCounter++;var c=this.getOffsets(),l=(this.anchorToTarget&&!this.trackMouse)?this.el.getAlignToXY(this.anchorTarget,this.getAnchorAlign()):this.targetXY,a=Ext.lib.Dom.getViewWidth()-5,h=Ext.lib.Dom.getViewHeight()-5,i=document.documentElement,e=document.body,k=(i.scrollLeft||e.scrollLeft||0)+5,j=(i.scrollTop||e.scrollTop||0)+5,b=[l[0]+c[0],l[1]+c[1]],g=this.getSize();this.anchorEl.removeClass(this.anchorCls);if(this.targetCounter<2){if(b[0]a){if(this.anchorToTarget){this.defaultAlign="r-l";if(this.mouseOffset){this.mouseOffset[0]*=-1}}this.anchor="right";return this.getTargetXY()}if(b[1]h){if(this.anchorToTarget){this.defaultAlign="b-t";if(this.mouseOffset){this.mouseOffset[1]*=-1}}this.anchor="bottom";return this.getTargetXY()}}this.anchorCls="x-tip-anchor-"+this.getAnchorPosition();this.anchorEl.addClass(this.anchorCls);this.targetCounter=0;return b}else{var d=this.getMouseOffset();return[this.targetXY[0]+d[0],this.targetXY[1]+d[1]]}},getMouseOffset:function(){var a=this.anchor?[0,0]:[15,18];if(this.mouseOffset){a[0]+=this.mouseOffset[0];a[1]+=this.mouseOffset[1]}return a},getAnchorPosition:function(){if(this.anchor){this.tipAnchor=this.anchor.charAt(0)}else{var a=this.defaultAlign.match(/^([a-z]+)-([a-z]+)(\?)?$/);if(!a){throw"AnchorTip.defaultAlign is invalid"}this.tipAnchor=a[1].charAt(0)}switch(this.tipAnchor){case"t":return"top";case"b":return"bottom";case"r":return"right"}return"left"},getAnchorAlign:function(){switch(this.anchor){case"top":return"tl-bl";case"left":return"tl-tr";case"right":return"tr-tl";default:return"bl-tl"}},getOffsets:function(){var b,a=this.getAnchorPosition().charAt(0);if(this.anchorToTarget&&!this.trackMouse){switch(a){case"t":b=[0,9];break;case"b":b=[0,-13];break;case"r":b=[-13,0];break;default:b=[9,0];break}}else{switch(a){case"t":b=[-15-this.anchorOffset,30];break;case"b":b=[-19-this.anchorOffset,-13-this.el.dom.offsetHeight];break;case"r":b=[-15-this.el.dom.offsetWidth,-13-this.anchorOffset];break;default:b=[25,-13-this.anchorOffset];break}}var c=this.getMouseOffset();b[0]+=c[0];b[1]+=c[1];return b},onTargetOver:function(b){if(this.disabled||b.within(this.target.dom,true)){return}var a=b.getTarget(this.delegate);if(a){this.triggerElement=a;this.clearTimer("hide");this.targetXY=b.getXY();this.delayShow()}},delayShow:function(){if(this.hidden&&!this.showTimer){if(this.lastActive.getElapsed()=c){d=c-b-5}}return{x:a,y:d}},beforeDestroy:function(){this.clearTimers();Ext.destroy(this.anchorEl);delete this.anchorEl;delete this.target;delete this.anchorTarget;delete this.triggerElement;Ext.ToolTip.superclass.beforeDestroy.call(this)},onDestroy:function(){Ext.getDoc().un("mousedown",this.onDocMouseDown,this);Ext.ToolTip.superclass.onDestroy.call(this)}});Ext.reg("tooltip",Ext.ToolTip);Ext.QuickTip=Ext.extend(Ext.ToolTip,{interceptTitles:false,tagConfig:{namespace:"ext",attribute:"qtip",width:"qwidth",target:"target",title:"qtitle",hide:"hide",cls:"qclass",align:"qalign",anchor:"anchor"},initComponent:function(){this.target=this.target||Ext.getDoc();this.targets=this.targets||{};Ext.QuickTip.superclass.initComponent.call(this)},register:function(e){var h=Ext.isArray(e)?e:arguments;for(var g=0,a=h.length;g1){var d=function(i,h){if(i&&h){var j=h.findChild(a,b);if(j){j.select();if(g){g(true,j)}}else{if(g){g(false,j)}}}else{if(g){g(false,j)}}};this.expandPath(c.join(this.pathSeparator),a,d)}else{this.root.select();if(g){g(true,this.root)}}},getTreeEl:function(){return this.body},onRender:function(b,a){Ext.tree.TreePanel.superclass.onRender.call(this,b,a);this.el.addClass("x-tree");this.innerCt=this.body.createChild({tag:"ul",cls:"x-tree-root-ct "+(this.useArrows?"x-tree-arrows":this.lines?"x-tree-lines":"x-tree-no-lines")})},initEvents:function(){Ext.tree.TreePanel.superclass.initEvents.call(this);if(this.containerScroll){Ext.dd.ScrollManager.register(this.body)}if((this.enableDD||this.enableDrop)&&!this.dropZone){this.dropZone=new Ext.tree.TreeDropZone(this,this.dropConfig||{ddGroup:this.ddGroup||"TreeDD",appendOnly:this.ddAppendOnly===true})}if((this.enableDD||this.enableDrag)&&!this.dragZone){this.dragZone=new Ext.tree.TreeDragZone(this,this.dragConfig||{ddGroup:this.ddGroup||"TreeDD",scroll:this.ddScroll})}this.getSelectionModel().init(this)},afterRender:function(){Ext.tree.TreePanel.superclass.afterRender.call(this);this.renderRoot()},beforeDestroy:function(){if(this.rendered){Ext.dd.ScrollManager.unregister(this.body);Ext.destroy(this.dropZone,this.dragZone)}this.destroyRoot();Ext.destroy(this.loader);this.nodeHash=this.root=this.loader=null;Ext.tree.TreePanel.superclass.beforeDestroy.call(this)},destroyRoot:function(){if(this.root&&this.root.destroy){this.root.destroy(true)}}});Ext.tree.TreePanel.nodeTypes={};Ext.reg("treepanel",Ext.tree.TreePanel);Ext.tree.TreeEventModel=function(a){this.tree=a;this.tree.on("render",this.initEvents,this)};Ext.tree.TreeEventModel.prototype={initEvents:function(){var a=this.tree;if(a.trackMouseOver!==false){a.mon(a.innerCt,{scope:this,mouseover:this.delegateOver,mouseout:this.delegateOut})}a.mon(a.getTreeEl(),{scope:this,click:this.delegateClick,dblclick:this.delegateDblClick,contextmenu:this.delegateContextMenu})},getNode:function(b){var a;if(a=b.getTarget(".x-tree-node-el",10)){var c=Ext.fly(a,"_treeEvents").getAttribute("tree-node-id","ext");if(c){return this.tree.getNodeById(c)}}return null},getNodeTarget:function(b){var a=b.getTarget(".x-tree-node-icon",1);if(!a){a=b.getTarget(".x-tree-node-el",6)}return a},delegateOut:function(b,a){if(!this.beforeEvent(b)){return}if(b.getTarget(".x-tree-ec-icon",1)){var c=this.getNode(b);this.onIconOut(b,c);if(c==this.lastEcOver){delete this.lastEcOver}}if((a=this.getNodeTarget(b))&&!b.within(a,true)){this.onNodeOut(b,this.getNode(b))}},delegateOver:function(b,a){if(!this.beforeEvent(b)){return}if(Ext.isGecko&&!this.trackingDoc){Ext.getBody().on("mouseover",this.trackExit,this);this.trackingDoc=true}if(this.lastEcOver){this.onIconOut(b,this.lastEcOver);delete this.lastEcOver}if(b.getTarget(".x-tree-ec-icon",1)){this.lastEcOver=this.getNode(b);this.onIconOver(b,this.lastEcOver)}if(a=this.getNodeTarget(b)){this.onNodeOver(b,this.getNode(b))}},trackExit:function(a){if(this.lastOverNode){if(this.lastOverNode.ui&&!a.within(this.lastOverNode.ui.getEl())){this.onNodeOut(a,this.lastOverNode)}delete this.lastOverNode;Ext.getBody().un("mouseover",this.trackExit,this);this.trackingDoc=false}},delegateClick:function(b,a){if(this.beforeEvent(b)){if(b.getTarget("input[type=checkbox]",1)){this.onCheckboxClick(b,this.getNode(b))}else{if(b.getTarget(".x-tree-ec-icon",1)){this.onIconClick(b,this.getNode(b))}else{if(this.getNodeTarget(b)){this.onNodeClick(b,this.getNode(b))}}}}else{this.checkContainerEvent(b,"click")}},delegateDblClick:function(b,a){if(this.beforeEvent(b)){if(this.getNodeTarget(b)){this.onNodeDblClick(b,this.getNode(b))}}else{this.checkContainerEvent(b,"dblclick")}},delegateContextMenu:function(b,a){if(this.beforeEvent(b)){if(this.getNodeTarget(b)){this.onNodeContextMenu(b,this.getNode(b))}}else{this.checkContainerEvent(b,"contextmenu")}},checkContainerEvent:function(b,a){if(this.disabled){b.stopEvent();return false}this.onContainerEvent(b,a)},onContainerEvent:function(b,a){this.tree.fireEvent("container"+a,this.tree,b)},onNodeClick:function(b,a){a.ui.onClick(b)},onNodeOver:function(b,a){this.lastOverNode=a;a.ui.onOver(b)},onNodeOut:function(b,a){a.ui.onOut(b)},onIconOver:function(b,a){a.ui.addClass("x-tree-ec-over")},onIconOut:function(b,a){a.ui.removeClass("x-tree-ec-over")},onIconClick:function(b,a){a.ui.ecClick(b)},onCheckboxClick:function(b,a){a.ui.onCheckChange(b)},onNodeDblClick:function(b,a){a.ui.onDblClick(b)},onNodeContextMenu:function(b,a){a.ui.onContextMenu(b)},beforeEvent:function(b){var a=this.getNode(b);if(this.disabled||!a||!a.ui){b.stopEvent();return false}return true},disable:function(){this.disabled=true},enable:function(){this.disabled=false}};Ext.tree.DefaultSelectionModel=function(a){this.selNode=null;this.addEvents("selectionchange","beforeselect");Ext.apply(this,a);Ext.tree.DefaultSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.tree.DefaultSelectionModel,Ext.util.Observable,{init:function(a){this.tree=a;a.mon(a.getTreeEl(),"keydown",this.onKeyDown,this);a.on("click",this.onNodeClick,this)},onNodeClick:function(a,b){this.select(a)},select:function(c,a){if(!Ext.fly(c.ui.wrap).isVisible()&&a){return a.call(this,c)}var b=this.selNode;if(c==b){c.ui.onSelectedChange(true)}else{if(this.fireEvent("beforeselect",this,c,b)!==false){if(b&&b.ui){b.ui.onSelectedChange(false)}this.selNode=c;c.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,c,b)}}return c},unselect:function(b,a){if(this.selNode==b){this.clearSelections(a)}},clearSelections:function(a){var b=this.selNode;if(b){b.ui.onSelectedChange(false);this.selNode=null;if(a!==true){this.fireEvent("selectionchange",this,null)}}return b},getSelectedNode:function(){return this.selNode},isSelected:function(a){return this.selNode==a},selectPrevious:function(a){if(!(a=a||this.selNode||this.lastSelNode)){return null}var c=a.previousSibling;if(c){if(!c.isExpanded()||c.childNodes.length<1){return this.select(c,this.selectPrevious)}else{var b=c.lastChild;while(b&&b.isExpanded()&&Ext.fly(b.ui.wrap).isVisible()&&b.childNodes.length>0){b=b.lastChild}return this.select(b,this.selectPrevious)}}else{if(a.parentNode&&(this.tree.rootVisible||!a.parentNode.isRoot)){return this.select(a.parentNode,this.selectPrevious)}}return null},selectNext:function(b){if(!(b=b||this.selNode||this.lastSelNode)){return null}if(b.firstChild&&b.isExpanded()&&Ext.fly(b.ui.wrap).isVisible()){return this.select(b.firstChild,this.selectNext)}else{if(b.nextSibling){return this.select(b.nextSibling,this.selectNext)}else{if(b.parentNode){var a=null;b.parentNode.bubble(function(){if(this.nextSibling){a=this.getOwnerTree().selModel.select(this.nextSibling,this.selectNext);return false}});return a}}}return null},onKeyDown:function(c){var b=this.selNode||this.lastSelNode;var d=this;if(!b){return}var a=c.getKey();switch(a){case c.DOWN:c.stopEvent();this.selectNext();break;case c.UP:c.stopEvent();this.selectPrevious();break;case c.RIGHT:c.preventDefault();if(b.hasChildNodes()){if(!b.isExpanded()){b.expand()}else{if(b.firstChild){this.select(b.firstChild,c)}}}break;case c.LEFT:c.preventDefault();if(b.hasChildNodes()&&b.isExpanded()){b.collapse()}else{if(b.parentNode&&(this.tree.rootVisible||b.parentNode!=this.tree.getRootNode())){this.select(b.parentNode,c)}}break}}});Ext.tree.MultiSelectionModel=function(a){this.selNodes=[];this.selMap={};this.addEvents("selectionchange");Ext.apply(this,a);Ext.tree.MultiSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.tree.MultiSelectionModel,Ext.util.Observable,{init:function(a){this.tree=a;a.mon(a.getTreeEl(),"keydown",this.onKeyDown,this);a.on("click",this.onNodeClick,this)},onNodeClick:function(a,b){if(b.ctrlKey&&this.isSelected(a)){this.unselect(a)}else{this.select(a,b,b.ctrlKey)}},select:function(a,c,b){if(b!==true){this.clearSelections(true)}if(this.isSelected(a)){this.lastSelNode=a;return a}this.selNodes.push(a);this.selMap[a.id]=a;this.lastSelNode=a;a.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,this.selNodes);return a},unselect:function(b){if(this.selMap[b.id]){b.ui.onSelectedChange(false);var c=this.selNodes;var a=c.indexOf(b);if(a!=-1){this.selNodes.splice(a,1)}delete this.selMap[b.id];this.fireEvent("selectionchange",this,this.selNodes)}},clearSelections:function(b){var d=this.selNodes;if(d.length>0){for(var c=0,a=d.length;c0},isExpandable:function(){return this.attributes.expandable||this.hasChildNodes()},appendChild:function(e){var g=false;if(Ext.isArray(e)){g=e}else{if(arguments.length>1){g=arguments}}if(g){for(var d=0,a=g.length;d0){var g=d?function(){e.apply(d,arguments)}:e;c.sort(g);for(var b=0;b
','',this.indentMarkup,"",'','',g?('':"/>")):"",'',e.text,"
",'',""].join("");if(l!==true&&e.nextSibling&&(b=e.nextSibling.ui.getEl())){this.wrap=Ext.DomHelper.insertHtml("beforeBegin",b,d)}else{this.wrap=Ext.DomHelper.insertHtml("beforeEnd",j,d)}this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var i=this.elNode.childNodes;this.indentNode=i[0];this.ecNode=i[1];this.iconNode=i[2];var h=3;if(g){this.checkbox=i[3];this.checkbox.defaultChecked=this.checkbox.checked;h++}this.anchor=i[h];this.textNode=i[h].firstChild},getAnchor:function(){return this.anchor},getTextEl:function(){return this.textNode},getIconEl:function(){return this.iconNode},isChecked:function(){return this.checkbox?this.checkbox.checked:false},updateExpandIcon:function(){if(this.rendered){var g=this.node,d,c,a=g.isLast()?"x-tree-elbow-end":"x-tree-elbow",e=g.hasChildNodes();if(e||g.attributes.expandable){if(g.expanded){a+="-minus";d="x-tree-node-collapsed";c="x-tree-node-expanded"}else{a+="-plus";d="x-tree-node-expanded";c="x-tree-node-collapsed"}if(this.wasLeaf){this.removeClass("x-tree-node-leaf");this.wasLeaf=false}if(this.c1!=d||this.c2!=c){Ext.fly(this.elNode).replaceClass(d,c);this.c1=d;this.c2=c}}else{if(!this.wasLeaf){Ext.fly(this.elNode).replaceClass("x-tree-node-expanded","x-tree-node-collapsed");delete this.c1;delete this.c2;this.wasLeaf=true}}var b="x-tree-ec-icon "+a;if(this.ecc!=b){this.ecNode.className=b;this.ecc=b}}},onIdChange:function(a){if(this.rendered){this.elNode.setAttribute("ext:tree-node-id",a)}},getChildIndent:function(){if(!this.childIndent){var a=[],b=this.node;while(b){if(!b.isRoot||(b.isRoot&&b.ownerTree.rootVisible)){if(!b.isLast()){a.unshift('')}else{a.unshift('')}}b=b.parentNode}this.childIndent=a.join("")}return this.childIndent},renderIndent:function(){if(this.rendered){var a="",b=this.node.parentNode;if(b){a=b.ui.getChildIndent()}if(this.indentMarkup!=a){this.indentNode.innerHTML=a;this.indentMarkup=a}this.updateExpandIcon()}},destroy:function(){if(this.elNode){Ext.dd.Registry.unregister(this.elNode.id)}Ext.each(["textnode","anchor","checkbox","indentNode","ecNode","iconNode","elNode","ctNode","wrap","holder"],function(a){if(this[a]){Ext.fly(this[a]).remove();delete this[a]}},this);delete this.node}};Ext.tree.RootTreeNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{render:function(){if(!this.rendered){var a=this.node.ownerTree.innerCt.dom;this.node.expanded=true;a.innerHTML='
';this.wrap=this.ctNode=a.firstChild}},collapse:Ext.emptyFn,expand:Ext.emptyFn});Ext.tree.TreeLoader=function(a){this.baseParams={};Ext.apply(this,a);this.addEvents("beforeload","load","loadexception");Ext.tree.TreeLoader.superclass.constructor.call(this);if(Ext.isString(this.paramOrder)){this.paramOrder=this.paramOrder.split(/[\s,|]/)}};Ext.extend(Ext.tree.TreeLoader,Ext.util.Observable,{uiProviders:{},clearOnLoad:true,paramOrder:undefined,paramsAsHash:false,nodeParameter:"node",directFn:undefined,load:function(b,c,a){if(this.clearOnLoad){while(b.firstChild){b.removeChild(b.firstChild)}}if(this.doPreload(b)){this.runCallback(c,a||b,[b])}else{if(this.directFn||this.dataUrl||this.url){this.requestData(b,c,a||b)}}},doPreload:function(d){if(d.attributes.children){if(d.childNodes.length<1){var c=d.attributes.children;d.beginUpdate();for(var b=0,a=c.length;b-1){c=[]}for(var d=0,a=b.length;dl){return e?-1:+1}else{return 0}}}};Ext.tree.TreeSorter.prototype={doSort:function(a){a.sort(this.sortFn)},compareNodes:function(b,a){return(b.text.toUpperCase()>a.text.toUpperCase()?1:-1)},updateSort:function(a,b){if(b.childrenRendered){this.doSort.defer(1,this,[b])}},updateSortParent:function(a){var b=a.parentNode;if(b&&b.childrenRendered){this.doSort.defer(1,this,[b])}}};if(Ext.dd.DropZone){Ext.tree.TreeDropZone=function(a,b){this.allowParentInsert=b.allowParentInsert||false;this.allowContainerDrop=b.allowContainerDrop||false;this.appendOnly=b.appendOnly||false;Ext.tree.TreeDropZone.superclass.constructor.call(this,a.getTreeEl(),b);this.tree=a;this.dragOverData={};this.lastInsertClass="x-tree-no-status"};Ext.extend(Ext.tree.TreeDropZone,Ext.dd.DropZone,{ddGroup:"TreeDD",expandDelay:1000,expandNode:function(a){if(a.hasChildNodes()&&!a.isExpanded()){a.expand(false,null,this.triggerCacheRefresh.createDelegate(this))}},queueExpand:function(a){this.expandProcId=this.expandNode.defer(this.expandDelay,this,[a])},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);this.expandProcId=false}},isValidDropPoint:function(a,k,i,d,c){if(!a||!c){return false}var g=a.node;var h=c.node;if(!(g&&g.isTarget&&k)){return false}if(k=="append"&&g.allowChildren===false){return false}if((k=="above"||k=="below")&&(g.parentNode&&g.parentNode.allowChildren===false)){return false}if(h&&(g==h||h.contains(g))){return false}var b=this.dragOverData;b.tree=this.tree;b.target=g;b.data=c;b.point=k;b.source=i;b.rawEvent=d;b.dropNode=h;b.cancel=false;var j=this.tree.fireEvent("nodedragover",b);return b.cancel===false&&j!==false},getDropPoint:function(h,g,l){var m=g.node;if(m.isRoot){return m.allowChildren!==false?"append":false}var c=g.ddel;var o=Ext.lib.Dom.getY(c),j=o+c.offsetHeight;var i=Ext.lib.Event.getPageY(h);var k=m.allowChildren===false||m.isLeaf();if(this.appendOnly||m.parentNode.allowChildren===false){return k?false:"append"}var d=false;if(!this.allowParentInsert){d=m.hasChildNodes()&&m.isExpanded()}var a=(j-o)/(k?2:3);if(i>=o&&i<(o+a)){return"above"}else{if(!d&&(k||i>=j-a&&i<=j)){return"below"}else{return"append"}}},onNodeEnter:function(d,a,c,b){this.cancelExpand()},onContainerOver:function(a,c,b){if(this.allowContainerDrop&&this.isValidDropPoint({ddel:this.tree.getRootNode().ui.elNode,node:this.tree.getRootNode()},"append",a,c,b)){return this.dropAllowed}return this.dropNotAllowed},onNodeOver:function(b,i,h,g){var k=this.getDropPoint(h,b,i);var c=b.node;if(!this.expandProcId&&k=="append"&&c.hasChildNodes()&&!b.node.isExpanded()){this.queueExpand(c)}else{if(k!="append"){this.cancelExpand()}}var d=this.dropNotAllowed;if(this.isValidDropPoint(b,k,i,h,g)){if(k){var a=b.ddel;var j;if(k=="above"){d=b.node.isFirst()?"x-tree-drop-ok-above":"x-tree-drop-ok-between";j="x-tree-drag-insert-above"}else{if(k=="below"){d=b.node.isLast()?"x-tree-drop-ok-below":"x-tree-drop-ok-between";j="x-tree-drag-insert-below"}else{d="x-tree-drop-ok-append";j="x-tree-drag-append"}}if(this.lastInsertClass!=j){Ext.fly(a).replaceClass(this.lastInsertClass,j);this.lastInsertClass=j}}}return d},onNodeOut:function(d,a,c,b){this.cancelExpand();this.removeDropIndicators(d)},onNodeDrop:function(i,b,h,d){var a=this.getDropPoint(h,i,b);var g=i.node;g.ui.startDrop();if(!this.isValidDropPoint(i,a,b,h,d)){g.ui.endDrop();return false}var c=d.node||(b.getTreeNode?b.getTreeNode(d,g,a,h):null);return this.processDrop(g,d,a,b,h,c)},onContainerDrop:function(a,g,c){if(this.allowContainerDrop&&this.isValidDropPoint({ddel:this.tree.getRootNode().ui.elNode,node:this.tree.getRootNode()},"append",a,g,c)){var d=this.tree.getRootNode();d.ui.startDrop();var b=c.node||(a.getTreeNode?a.getTreeNode(c,d,"append",g):null);return this.processDrop(d,c,"append",a,g,b)}return false},processDrop:function(j,h,b,a,i,d){var g={tree:this.tree,target:j,data:h,point:b,source:a,rawEvent:i,dropNode:d,cancel:!d,dropStatus:false};var c=this.tree.fireEvent("beforenodedrop",g);if(c===false||g.cancel===true||!g.dropNode){j.ui.endDrop();return g.dropStatus}j=g.target;if(b=="append"&&!j.isExpanded()){j.expand(false,null,function(){this.completeDrop(g)}.createDelegate(this))}else{this.completeDrop(g)}return true},completeDrop:function(h){var d=h.dropNode,e=h.point,c=h.target;if(!Ext.isArray(d)){d=[d]}var g;for(var b=0,a=d.length;bd.offsetLeft){e.scrollLeft=d.offsetLeft}var a=Math.min(this.maxWidth,(e.clientWidth>20?e.clientWidth:e.offsetWidth)-Math.max(0,d.offsetLeft-e.scrollLeft)-5);this.setSize(a,"")},triggerEdit:function(a,c){this.completeEdit();if(a.attributes.editable!==false){this.editNode=a;if(this.tree.autoScroll){Ext.fly(a.ui.getEl()).scrollIntoView(this.tree.body)}var b=a.text||"";if(!Ext.isGecko&&Ext.isEmpty(a.text)){a.setText(" ")}this.autoEditTimer=this.startEdit.defer(this.editDelay,this,[a.ui.textNode,b]);return false}},bindScroll:function(){this.tree.getTreeEl().on("scroll",this.cancelEdit,this)},beforeNodeClick:function(a,b){clearTimeout(this.autoEditTimer);if(this.tree.getSelectionModel().isSelected(a)){b.stopEvent();return this.triggerEdit(a)}},onNodeDblClick:function(a,b){clearTimeout(this.autoEditTimer)},updateNode:function(a,b){this.tree.getTreeEl().un("scroll",this.cancelEdit,this);this.editNode.setText(b)},onHide:function(){Ext.tree.TreeEditor.superclass.onHide.call(this);if(this.editNode){this.editNode.ui.focus.defer(50,this.editNode.ui)}},onSpecialKey:function(c,b){var a=b.getKey();if(a==b.ESC){b.stopEvent();this.cancelEdit()}else{if(a==b.ENTER&&!b.hasModifier()){b.stopEvent();this.completeEdit()}}},onDestroy:function(){clearTimeout(this.autoEditTimer);Ext.tree.TreeEditor.superclass.onDestroy.call(this);var a=this.tree;a.un("beforeclick",this.beforeNodeClick,this);a.un("dblclick",this.onNodeDblClick,this)}}); /* SWFObject v2.2 is released under the MIT License */ var swfobject=function(){var F="undefined",s="object",U="Shockwave Flash",Y="ShockwaveFlash.ShockwaveFlash",r="application/x-shockwave-flash",T="SWFObjectExprInst",z="onreadystatechange",Q=window,k=document,u=navigator,V=false,W=[i],p=[],P=[],K=[],m,S,G,D,L=false,a=false,o,I,n=true,O=function(){var ac=typeof k.getElementById!=F&&typeof k.getElementsByTagName!=F&&typeof k.createElement!=F,aj=u.userAgent.toLowerCase(),aa=u.platform.toLowerCase(),ag=aa?/win/.test(aa):/win/.test(aj),ae=aa?/mac/.test(aa):/mac/.test(aj),ah=/webkit/.test(aj)?parseFloat(aj.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,Z=!+"\v1",ai=[0,0,0],ad=null;if(typeof u.plugins!=F&&typeof u.plugins[U]==s){ad=u.plugins[U].description;if(ad&&!(typeof u.mimeTypes!=F&&u.mimeTypes[r]&&!u.mimeTypes[r].enabledPlugin)){V=true;Z=false;ad=ad.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ai[0]=parseInt(ad.replace(/^(.*)\..*$/,"$1"),10);ai[1]=parseInt(ad.replace(/^.*\.(.*)\s.*$/,"$1"),10);ai[2]=/[a-zA-Z]/.test(ad)?parseInt(ad.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof Q.ActiveXObject!=F){try{var af=new ActiveXObject(Y);if(af){ad=af.GetVariable("$version");if(ad){Z=true;ad=ad.split(" ")[1].split(",");ai=[parseInt(ad[0],10),parseInt(ad[1],10),parseInt(ad[2],10)]}}}catch(ab){}}}return{w3:ac,pv:ai,wk:ah,ie:Z,win:ag,mac:ae}}(),l=function(){if(!O.w3){return}if((typeof k.readyState!=F&&k.readyState=="complete")||(typeof k.readyState==F&&(k.getElementsByTagName("body")[0]||k.body))){g()}if(!L){if(typeof k.addEventListener!=F){k.addEventListener("DOMContentLoaded",g,false)}if(O.ie&&O.win){k.attachEvent(z,function(){if(k.readyState=="complete"){k.detachEvent(z,arguments.callee);g()}});if(Q==top){(function(){if(L){return}try{k.documentElement.doScroll("left")}catch(Z){setTimeout(arguments.callee,0);return}g()})()}}if(O.wk){(function(){if(L){return}if(!/loaded|complete/.test(k.readyState)){setTimeout(arguments.callee,0);return}g()})()}t(g)}}();function g(){if(L){return}try{var ab=k.getElementsByTagName("body")[0].appendChild(E("span"));ab.parentNode.removeChild(ab)}catch(ac){return}L=true;var Z=W.length;for(var aa=0;aa0){for(var ah=0;ah0){var ag=c(aa);if(ag){if(H(p[ah].swfVersion)&&!(O.wk&&O.wk<312)){y(aa,true);if(ad){ac.success=true;ac.ref=B(aa);ad(ac)}}else{if(p[ah].expressInstall&&C()){var ak={};ak.data=p[ah].expressInstall;ak.width=ag.getAttribute("width")||"0";ak.height=ag.getAttribute("height")||"0";if(ag.getAttribute("class")){ak.styleclass=ag.getAttribute("class")}if(ag.getAttribute("align")){ak.align=ag.getAttribute("align")}var aj={};var Z=ag.getElementsByTagName("param");var ae=Z.length;for(var af=0;af'}}ac.outerHTML='"+ah+"";P[P.length]=ak.id;Z=c(ak.id)}else{var ab=E(s);ab.setAttribute("type",r);for(var ae in ak){if(ak[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="styleclass"){ab.setAttribute("class",ak[ae])}else{if(ae.toLowerCase()!="classid"){ab.setAttribute(ae,ak[ae])}}}}for(var ad in ai){if(ai[ad]!=Object.prototype[ad]&&ad.toLowerCase()!="movie"){e(ab,ad,ai[ad])}}ac.parentNode.replaceChild(ab,ac);Z=ab}}return Z}function e(ab,Z,aa){var ac=E("param");ac.setAttribute("name",Z);ac.setAttribute("value",aa);ab.appendChild(ac)}function A(aa){var Z=c(aa);if(Z&&Z.nodeName=="OBJECT"){if(O.ie&&O.win){Z.style.display="none";(function(){if(Z.readyState==4){b(aa)}else{setTimeout(arguments.callee,10)}})()}else{Z.parentNode.removeChild(Z)}}}function b(ab){var aa=c(ab);if(aa){for(var Z in aa){if(typeof aa[Z]=="function"){aa[Z]=null}}aa.parentNode.removeChild(aa)}}function c(ab){var Z=null;try{Z=k.getElementById(ab)}catch(aa){}return Z}function E(Z){return k.createElement(Z)}function j(ab,Z,aa){ab.attachEvent(Z,aa);K[K.length]=[ab,Z,aa]}function H(ab){var aa=O.pv,Z=ab.split(".");Z[0]=parseInt(Z[0],10);Z[1]=parseInt(Z[1],10)||0;Z[2]=parseInt(Z[2],10)||0;return(aa[0]>Z[0]||(aa[0]==Z[0]&&aa[1]>Z[1])||(aa[0]==Z[0]&&aa[1]==Z[1]&&aa[2]>=Z[2]))?true:false}function x(ae,aa,af,ad){if(O.ie&&O.mac){return}var ac=k.getElementsByTagName("head")[0];if(!ac){return}var Z=(af&&typeof af=="string")?af:"screen";if(ad){o=null;I=null}if(!o||I!=Z){var ab=E("style");ab.setAttribute("type","text/css");ab.setAttribute("media",Z);o=ac.appendChild(ab);if(O.ie&&O.win&&typeof k.styleSheets!=F&&k.styleSheets.length>0){o=k.styleSheets[k.styleSheets.length-1]}I=Z}if(O.ie&&O.win){if(o&&typeof o.addRule==s){o.addRule(ae,aa)}}else{if(o&&typeof k.createTextNode!=F){o.appendChild(k.createTextNode(ae+" {"+aa+"}"))}}}function y(ab,Z){if(!n){return}var aa=Z?"visible":"hidden";if(L&&c(ab)){c(ab).style.visibility=aa}else{x("#"+ab,"visibility:"+aa)}}function N(aa){var ab=/[\\\"<>\.;]/;var Z=ab.exec(aa)!=null;return Z&&typeof encodeURIComponent!=F?encodeURIComponent(aa):aa}var d=function(){if(O.ie&&O.win){window.attachEvent("onunload",function(){var ae=K.length;for(var ad=0;ad0){for(h=0;h-1&&e.position=="left"){e.position="bottom"}return e},onDestroy:function(){Ext.chart.CartesianChart.superclass.onDestroy.call(this);Ext.each(this.labelFn,function(a){this.removeFnProxy(a)},this)}});Ext.reg("cartesianchart",Ext.chart.CartesianChart);Ext.chart.LineChart=Ext.extend(Ext.chart.CartesianChart,{type:"line"});Ext.reg("linechart",Ext.chart.LineChart);Ext.chart.ColumnChart=Ext.extend(Ext.chart.CartesianChart,{type:"column"});Ext.reg("columnchart",Ext.chart.ColumnChart);Ext.chart.StackedColumnChart=Ext.extend(Ext.chart.CartesianChart,{type:"stackcolumn"});Ext.reg("stackedcolumnchart",Ext.chart.StackedColumnChart);Ext.chart.BarChart=Ext.extend(Ext.chart.CartesianChart,{type:"bar"});Ext.reg("barchart",Ext.chart.BarChart);Ext.chart.StackedBarChart=Ext.extend(Ext.chart.CartesianChart,{type:"stackbar"});Ext.reg("stackedbarchart",Ext.chart.StackedBarChart);Ext.chart.Axis=function(a){Ext.apply(this,a)};Ext.chart.Axis.prototype={type:null,orientation:"horizontal",reverse:false,labelFunction:null,hideOverlappingLabels:true,labelSpacing:2};Ext.chart.NumericAxis=Ext.extend(Ext.chart.Axis,{type:"numeric",minimum:NaN,maximum:NaN,majorUnit:NaN,minorUnit:NaN,snapToUnits:true,alwaysShowZero:true,scale:"linear",roundMajorUnit:true,calculateByLabelSize:true,position:"left",adjustMaximumByMajorUnit:true,adjustMinimumByMajorUnit:true});Ext.chart.TimeAxis=Ext.extend(Ext.chart.Axis,{type:"time",minimum:null,maximum:null,majorUnit:NaN,majorTimeUnit:null,minorUnit:NaN,minorTimeUnit:null,snapToUnits:true,stackingEnabled:false,calculateByLabelSize:true});Ext.chart.CategoryAxis=Ext.extend(Ext.chart.Axis,{type:"category",categoryNames:null,calculateCategoryCount:false});Ext.chart.Series=function(a){Ext.apply(this,a)};Ext.chart.Series.prototype={type:null,displayName:null};Ext.chart.CartesianSeries=Ext.extend(Ext.chart.Series,{xField:null,yField:null,showInLegend:true,axis:"primary"});Ext.chart.ColumnSeries=Ext.extend(Ext.chart.CartesianSeries,{type:"column"});Ext.chart.LineSeries=Ext.extend(Ext.chart.CartesianSeries,{type:"line"});Ext.chart.BarSeries=Ext.extend(Ext.chart.CartesianSeries,{type:"bar"});Ext.chart.PieSeries=Ext.extend(Ext.chart.Series,{type:"pie",dataField:null,categoryField:null});Ext.menu.Menu=Ext.extend(Ext.Container,{minWidth:120,shadow:"sides",subMenuAlign:"tl-tr?",defaultAlign:"tl-bl?",allowOtherMenus:false,ignoreParentClicks:false,enableScrolling:true,maxHeight:null,scrollIncrement:24,showSeparator:true,defaultOffsets:[0,0],plain:false,floating:true,zIndex:15000,hidden:true,layout:"menu",hideMode:"offsets",scrollerHeight:8,autoLayout:true,defaultType:"menuitem",bufferResize:false,initComponent:function(){if(Ext.isArray(this.initialConfig)){Ext.apply(this,{items:this.initialConfig})}this.addEvents("click","mouseover","mouseout","itemclick");Ext.menu.MenuMgr.register(this);if(this.floating){Ext.EventManager.onWindowResize(this.hide,this)}else{if(this.initialConfig.hidden!==false){this.hidden=false}this.internalDefaults={hideOnClick:false}}Ext.menu.Menu.superclass.initComponent.call(this);if(this.autoLayout){var a=this.doLayout.createDelegate(this,[]);this.on({add:a,remove:a})}},getLayoutTarget:function(){return this.ul},onRender:function(b,a){if(!b){b=Ext.getBody()}var c={id:this.getId(),cls:"x-menu "+((this.floating)?"x-menu-floating x-layer ":"")+(this.cls||"")+(this.plain?" x-menu-plain":"")+(this.showSeparator?"":" x-menu-nosep"),style:this.style,cn:[{tag:"a",cls:"x-menu-focus",href:"#",onclick:"return false;",tabIndex:"-1"},{tag:"ul",cls:"x-menu-list"}]};if(this.floating){this.el=new Ext.Layer({shadow:this.shadow,dh:c,constrain:false,parentEl:b,zindex:this.zIndex})}else{this.el=b.createChild(c)}Ext.menu.Menu.superclass.onRender.call(this,b,a);if(!this.keyNav){this.keyNav=new Ext.menu.MenuNav(this)}this.focusEl=this.el.child("a.x-menu-focus");this.ul=this.el.child("ul.x-menu-list");this.mon(this.ul,{scope:this,click:this.onClick,mouseover:this.onMouseOver,mouseout:this.onMouseOut});if(this.enableScrolling){this.mon(this.el,{scope:this,delegate:".x-menu-scroller",click:this.onScroll,mouseover:this.deactivateActive})}},findTargetItem:function(b){var a=b.getTarget(".x-menu-list-item",this.ul,true);if(a&&a.menuItemId){return this.items.get(a.menuItemId)}},onClick:function(b){var a=this.findTargetItem(b);if(a){if(a.isFormField){this.setActiveItem(a)}else{if(a instanceof Ext.menu.BaseItem){if(a.menu&&this.ignoreParentClicks){a.expandMenu();b.preventDefault()}else{if(a.onClick){a.onClick(b);this.fireEvent("click",this,a,b)}}}}}},setActiveItem:function(a,b){if(a!=this.activeItem){this.deactivateActive();if((this.activeItem=a).isFormField){a.focus()}else{a.activate(b)}}else{if(b){a.expandMenu()}}},deactivateActive:function(){var b=this.activeItem;if(b){if(b.isFormField){if(b.collapse){b.collapse()}}else{b.deactivate()}delete this.activeItem}},tryActivate:function(g,e){var b=this.items;for(var c=g,a=b.length;c>=0&&c=a.scrollHeight){this.onScrollerOut(null,b)}},onScrollerIn:function(d,b){var a=this.ul.dom,c=Ext.fly(b).is(".x-menu-scroller-top");if(c?a.scrollTop>0:a.scrollTop+this.activeMaxc){b=c;a=i-h}else{if(bb&&b>0){this.activeMax=b-this.scrollerHeight*2-this.el.getFrameWidth("tb")-Ext.num(this.el.shadowOffset,0);this.ul.setHeight(this.activeMax);this.createScrollers();this.el.select(".x-menu-scroller").setDisplayed("")}else{this.ul.setHeight(d);this.el.select(".x-menu-scroller").setDisplayed("none")}this.ul.dom.scrollTop=0;return a},createScrollers:function(){if(!this.scroller){this.scroller={pos:0,top:this.el.insertFirst({tag:"div",cls:"x-menu-scroller x-menu-scroller-top",html:" "}),bottom:this.el.createChild({tag:"div",cls:"x-menu-scroller x-menu-scroller-bottom",html:" "})};this.scroller.top.hover(this.onScrollerIn,this.onScrollerOut,this);this.scroller.topRepeater=new Ext.util.ClickRepeater(this.scroller.top,{listeners:{click:this.onScroll.createDelegate(this,[null,this.scroller.top],false)}});this.scroller.bottom.hover(this.onScrollerIn,this.onScrollerOut,this);this.scroller.bottomRepeater=new Ext.util.ClickRepeater(this.scroller.bottom,{listeners:{click:this.onScroll.createDelegate(this,[null,this.scroller.bottom],false)}})}},onLayout:function(){if(this.isVisible()){if(this.enableScrolling){this.constrainScroll(this.el.getTop())}if(this.floating){this.el.sync()}}},focus:function(){if(!this.hidden){this.doFocus.defer(50,this)}},doFocus:function(){if(!this.hidden){this.focusEl.focus()}},hide:function(a){if(!this.isDestroyed){this.deepHide=a;Ext.menu.Menu.superclass.hide.call(this);delete this.deepHide}},onHide:function(){Ext.menu.Menu.superclass.onHide.call(this);this.deactivateActive();if(this.el&&this.floating){this.el.hide()}var a=this.parentMenu;if(this.deepHide===true&&a){if(a.floating){a.hide(true)}else{a.deactivateActive()}}},lookupComponent:function(a){if(Ext.isString(a)){a=(a=="separator"||a=="-")?new Ext.menu.Separator():new Ext.menu.TextItem(a);this.applyDefaults(a)}else{if(Ext.isObject(a)){a=this.getMenuItem(a)}else{if(a.tagName||a.el){a=new Ext.BoxComponent({el:a})}}}return a},applyDefaults:function(b){if(!Ext.isString(b)){b=Ext.menu.Menu.superclass.applyDefaults.call(this,b);var a=this.internalDefaults;if(a){if(b.events){Ext.applyIf(b.initialConfig,a);Ext.apply(b,a)}else{Ext.applyIf(b,a)}}}return b},getMenuItem:function(a){if(!a.isXType){if(!a.xtype&&Ext.isBoolean(a.checked)){return new Ext.menu.CheckItem(a)}return Ext.create(a,this.defaultType)}return a},addSeparator:function(){return this.add(new Ext.menu.Separator())},addElement:function(a){return this.add(new Ext.menu.BaseItem({el:a}))},addItem:function(a){return this.add(a)},addMenuItem:function(a){return this.add(this.getMenuItem(a))},addText:function(a){return this.add(new Ext.menu.TextItem(a))},onDestroy:function(){Ext.EventManager.removeResizeListener(this.hide,this);var a=this.parentMenu;if(a&&a.activeChild==this){delete a.activeChild}delete this.parentMenu;Ext.menu.Menu.superclass.onDestroy.call(this);Ext.menu.MenuMgr.unregister(this);if(this.keyNav){this.keyNav.disable()}var b=this.scroller;if(b){Ext.destroy(b.topRepeater,b.bottomRepeater,b.top,b.bottom)}Ext.destroy(this.el,this.focusEl,this.ul)}});Ext.reg("menu",Ext.menu.Menu);Ext.menu.MenuNav=Ext.extend(Ext.KeyNav,function(){function a(d,c){if(!c.tryActivate(c.items.indexOf(c.activeItem)-1,-1)){c.tryActivate(c.items.length-1,-1)}}function b(d,c){if(!c.tryActivate(c.items.indexOf(c.activeItem)+1,1)){c.tryActivate(0,1)}}return{constructor:function(c){Ext.menu.MenuNav.superclass.constructor.call(this,c.el);this.scope=this.menu=c},doRelay:function(g,d){var c=g.getKey();if(this.menu.activeItem&&this.menu.activeItem.isFormField&&c!=g.TAB){return false}if(!this.menu.activeItem&&g.isNavKeyPress()&&c!=g.SPACE&&c!=g.RETURN){this.menu.tryActivate(0,1);return false}return d.call(this.scope||this,g,this.menu)},tab:function(d,c){d.stopEvent();if(d.shiftKey){a(d,c)}else{b(d,c)}},up:a,down:b,right:function(d,c){if(c.activeItem){c.activeItem.expandMenu(true)}},left:function(d,c){c.hide();if(c.parentMenu&&c.parentMenu.activeItem){c.parentMenu.activeItem.activate()}},enter:function(d,c){if(c.activeItem){d.stopPropagation();c.activeItem.onClick(d);c.fireEvent("click",this,c.activeItem);return true}}}}());Ext.menu.MenuMgr=function(){var g,d,c={},a=false,l=new Date();function n(){g={};d=new Ext.util.MixedCollection();Ext.getDoc().addKeyListener(27,function(){if(d.length>0){i()}})}function i(){if(d&&d.length>0){var o=d.clone();o.each(function(p){p.hide()});return true}return false}function e(o){d.remove(o);if(d.length<1){Ext.getDoc().un("mousedown",m);a=false}}function k(o){var p=d.last();l=new Date();d.add(o);if(!a){Ext.getDoc().on("mousedown",m);a=true}if(o.parentMenu){o.getEl().setZIndex(parseInt(o.parentMenu.getEl().getStyle("z-index"),10)+3);o.parentMenu.activeChild=o}else{if(p&&!p.isDestroyed&&p.isVisible()){o.getEl().setZIndex(parseInt(p.getEl().getStyle("z-index"),10)+3)}}}function b(o){if(o.activeChild){o.activeChild.hide()}if(o.autoHideTimer){clearTimeout(o.autoHideTimer);delete o.autoHideTimer}}function h(o){var p=o.parentMenu;if(!p&&!o.allowOtherMenus){i()}else{if(p&&p.activeChild){p.activeChild.hide()}}}function m(o){if(l.getElapsed()>50&&d.length>0&&!o.getTarget(".x-menu")){i()}}function j(p,s){if(s){var r=c[p.group];for(var q=0,o=r.length;q',' target="{hrefTarget}"',"",">",'','{text}',"")}var c=this.getTemplateArgs();this.el=b?this.itemTpl.insertBefore(b,c,true):this.itemTpl.append(d,c,true);this.iconEl=this.el.child("img.x-menu-item-icon");this.textEl=this.el.child(".x-menu-item-text");if(!this.href){this.mon(this.el,"click",Ext.emptyFn,null,{preventDefault:true})}Ext.menu.Item.superclass.onRender.call(this,d,b)},getTemplateArgs:function(){return{id:this.id,cls:this.itemCls+(this.menu?" x-menu-item-arrow":"")+(this.cls?" "+this.cls:""),href:this.href||"#",hrefTarget:this.hrefTarget,icon:this.icon||Ext.BLANK_IMAGE_URL,iconCls:this.iconCls||"",text:this.itemText||this.text||" "}},setText:function(a){this.text=a||" ";if(this.rendered){this.textEl.update(this.text);this.parentMenu.layout.doAutoSize()}},setIconClass:function(a){var b=this.iconCls;this.iconCls=a;if(this.rendered){this.iconEl.replaceClass(b,this.iconCls)}},beforeDestroy:function(){if(this.menu){delete this.menu.ownerCt;this.menu.destroy()}Ext.menu.Item.superclass.beforeDestroy.call(this)},handleClick:function(a){if(!this.href){a.stopEvent()}Ext.menu.Item.superclass.handleClick.apply(this,arguments)},activate:function(a){if(Ext.menu.Item.superclass.activate.apply(this,arguments)){this.focus();if(a){this.expandMenu()}}return true},shouldDeactivate:function(a){if(Ext.menu.Item.superclass.shouldDeactivate.call(this,a)){if(this.menu&&this.menu.isVisible()){return !this.menu.getEl().getRegion().contains(a.getPoint())}return true}return false},deactivate:function(){Ext.menu.Item.superclass.deactivate.apply(this,arguments);this.hideMenu()},expandMenu:function(a){if(!this.disabled&&this.menu){clearTimeout(this.hideTimer);delete this.hideTimer;if(!this.menu.isVisible()&&!this.showTimer){this.showTimer=this.deferExpand.defer(this.showDelay,this,[a])}else{if(this.menu.isVisible()&&a){this.menu.tryActivate(0,1)}}}},deferExpand:function(a){delete this.showTimer;this.menu.show(this.container,this.parentMenu.subMenuAlign||"tl-tr?",this.parentMenu);if(a){this.menu.tryActivate(0,1)}},hideMenu:function(){clearTimeout(this.showTimer);delete this.showTimer;if(!this.hideTimer&&this.menu&&this.menu.isVisible()){this.hideTimer=this.deferHide.defer(this.hideDelay,this)}},deferHide:function(){delete this.hideTimer;if(this.menu.over){this.parentMenu.setActiveItem(this,false)}else{this.menu.hide()}}});Ext.reg("menuitem",Ext.menu.Item);Ext.menu.CheckItem=Ext.extend(Ext.menu.Item,{itemCls:"x-menu-item x-menu-check-item",groupClass:"x-menu-group-item",checked:false,ctype:"Ext.menu.CheckItem",initComponent:function(){Ext.menu.CheckItem.superclass.initComponent.call(this);this.addEvents("beforecheckchange","checkchange");if(this.checkHandler){this.on("checkchange",this.checkHandler,this.scope)}Ext.menu.MenuMgr.registerCheckable(this)},onRender:function(a){Ext.menu.CheckItem.superclass.onRender.apply(this,arguments);if(this.group){this.el.addClass(this.groupClass)}if(this.checked){this.checked=false;this.setChecked(true,true)}},destroy:function(){Ext.menu.MenuMgr.unregisterCheckable(this);Ext.menu.CheckItem.superclass.destroy.apply(this,arguments)},setChecked:function(b,a){var c=a===true;if(this.checked!=b&&(c||this.fireEvent("beforecheckchange",this,b)!==false)){if(this.container){this.container[b?"addClass":"removeClass"]("x-menu-item-checked")}this.checked=b;if(!c){this.fireEvent("checkchange",this,b)}}},handleClick:function(a){if(!this.disabled&&!(this.checked&&this.group)){this.setChecked(!this.checked)}Ext.menu.CheckItem.superclass.handleClick.apply(this,arguments)}});Ext.reg("menucheckitem",Ext.menu.CheckItem);Ext.menu.DateMenu=Ext.extend(Ext.menu.Menu,{enableScrolling:false,hideOnClick:true,pickerId:null,cls:"x-date-menu",initComponent:function(){this.on("beforeshow",this.onBeforeShow,this);if(this.strict=(Ext.isIE7&&Ext.isStrict)){this.on("show",this.onShow,this,{single:true,delay:20})}Ext.apply(this,{plain:true,showSeparator:false,items:this.picker=new Ext.DatePicker(Ext.applyIf({internalRender:this.strict||!Ext.isIE,ctCls:"x-menu-date-item",id:this.pickerId},this.initialConfig))});this.picker.purgeListeners();Ext.menu.DateMenu.superclass.initComponent.call(this);this.relayEvents(this.picker,["select"]);this.on("show",this.picker.focus,this.picker);this.on("select",this.menuHide,this);if(this.handler){this.on("select",this.handler,this.scope||this)}},menuHide:function(){if(this.hideOnClick){this.hide(true)}},onBeforeShow:function(){if(this.picker){this.picker.hideMonthPicker(true)}},onShow:function(){var a=this.picker.getEl();a.setWidth(a.getWidth())}});Ext.reg("datemenu",Ext.menu.DateMenu);Ext.menu.ColorMenu=Ext.extend(Ext.menu.Menu,{enableScrolling:false,hideOnClick:true,cls:"x-color-menu",paletteId:null,initComponent:function(){Ext.apply(this,{plain:true,showSeparator:false,items:this.palette=new Ext.ColorPalette(Ext.applyIf({id:this.paletteId},this.initialConfig))});this.palette.purgeListeners();Ext.menu.ColorMenu.superclass.initComponent.call(this);this.relayEvents(this.palette,["select"]);this.on("select",this.menuHide,this);if(this.handler){this.on("select",this.handler,this.scope||this)}},menuHide:function(){if(this.hideOnClick){this.hide(true)}}});Ext.reg("colormenu",Ext.menu.ColorMenu);Ext.form.Field=Ext.extend(Ext.BoxComponent,{invalidClass:"x-form-invalid",invalidText:"The value in this field is invalid",focusClass:"x-form-focus",validationEvent:"keyup",validateOnBlur:true,validationDelay:250,defaultAutoCreate:{tag:"input",type:"text",size:"20",autocomplete:"off"},fieldClass:"x-form-field",msgTarget:"qtip",msgFx:"normal",readOnly:false,disabled:false,submitValue:true,isFormField:true,msgDisplay:"",hasFocus:false,initComponent:function(){Ext.form.Field.superclass.initComponent.call(this);this.addEvents("focus","blur","specialkey","change","invalid","valid")},getName:function(){return this.rendered&&this.el.dom.name?this.el.dom.name:this.name||this.id||""},onRender:function(c,a){if(!this.el){var b=this.getAutoCreate();if(!b.name){b.name=this.name||this.id}if(this.inputType){b.type=this.inputType}this.autoEl=b}Ext.form.Field.superclass.onRender.call(this,c,a);if(this.submitValue===false){this.el.dom.removeAttribute("name")}var d=this.el.dom.type;if(d){if(d=="password"){d="text"}this.el.addClass("x-form-"+d)}if(this.readOnly){this.setReadOnly(true)}if(this.tabIndex!==undefined){this.el.dom.setAttribute("tabIndex",this.tabIndex)}this.el.addClass([this.fieldClass,this.cls])},getItemCt:function(){return this.itemCt},initValue:function(){if(this.value!==undefined){this.setValue(this.value)}else{if(!Ext.isEmpty(this.el.dom.value)&&this.el.dom.value!=this.emptyText){this.setValue(this.el.dom.value)}}this.originalValue=this.getValue()},isDirty:function(){if(this.disabled||!this.rendered){return false}return String(this.getValue())!==String(this.originalValue)},setReadOnly:function(a){if(this.rendered){this.el.dom.readOnly=a}this.readOnly=a},afterRender:function(){Ext.form.Field.superclass.afterRender.call(this);this.initEvents();this.initValue()},fireKey:function(a){if(a.isSpecialKey()){this.fireEvent("specialkey",this,a)}},reset:function(){this.setValue(this.originalValue);this.clearInvalid()},initEvents:function(){this.mon(this.el,Ext.EventManager.useKeydown?"keydown":"keypress",this.fireKey,this);this.mon(this.el,"focus",this.onFocus,this);this.mon(this.el,"blur",this.onBlur,this,this.inEditor?{buffer:10}:null)},preFocus:Ext.emptyFn,onFocus:function(){this.preFocus();if(this.focusClass){this.el.addClass(this.focusClass)}if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();this.fireEvent("focus",this)}},beforeBlur:Ext.emptyFn,onBlur:function(){this.beforeBlur();if(this.focusClass){this.el.removeClass(this.focusClass)}this.hasFocus=false;if(this.validationEvent!==false&&(this.validateOnBlur||this.validationEvent=="blur")){this.validate()}var a=this.getValue();if(String(a)!==String(this.startValue)){this.fireEvent("change",this,a,this.startValue)}this.fireEvent("blur",this);this.postBlur()},postBlur:Ext.emptyFn,isValid:function(a){if(this.disabled){return true}var c=this.preventMark;this.preventMark=a===true;var b=this.validateValue(this.processValue(this.getRawValue()));this.preventMark=c;return b},validate:function(){if(this.disabled||this.validateValue(this.processValue(this.getRawValue()))){this.clearInvalid();return true}return false},processValue:function(a){return a},validateValue:function(b){var a=this.getErrors(b)[0];if(a==undefined){return true}else{this.markInvalid(a);return false}},getErrors:function(){return[]},getActiveError:function(){return this.activeError||""},markInvalid:function(c){if(this.rendered&&!this.preventMark){c=c||this.invalidText;var a=this.getMessageHandler();if(a){a.mark(this,c)}else{if(this.msgTarget){this.el.addClass(this.invalidClass);var b=Ext.getDom(this.msgTarget);if(b){b.innerHTML=c;b.style.display=this.msgDisplay}}}}this.setActiveError(c)},clearInvalid:function(){if(this.rendered&&!this.preventMark){this.el.removeClass(this.invalidClass);var a=this.getMessageHandler();if(a){a.clear(this)}else{if(this.msgTarget){this.el.removeClass(this.invalidClass);var b=Ext.getDom(this.msgTarget);if(b){b.innerHTML="";b.style.display="none"}}}}this.unsetActiveError()},setActiveError:function(b,a){this.activeError=b;if(a!==true){this.fireEvent("invalid",this,b)}},unsetActiveError:function(a){delete this.activeError;if(a!==true){this.fireEvent("valid",this)}},getMessageHandler:function(){return Ext.form.MessageTargets[this.msgTarget]},getErrorCt:function(){return this.el.findParent(".x-form-element",5,true)||this.el.findParent(".x-form-field-wrap",5,true)},alignErrorEl:function(){this.errorEl.setWidth(this.getErrorCt().getWidth(true)-20)},alignErrorIcon:function(){this.errorIcon.alignTo(this.el,"tl-tr",[2,0])},getRawValue:function(){var a=this.rendered?this.el.getValue():Ext.value(this.value,"");if(a===this.emptyText){a=""}return a},getValue:function(){if(!this.rendered){return this.value}var a=this.el.getValue();if(a===this.emptyText||a===undefined){a=""}return a},setRawValue:function(a){return this.rendered?(this.el.dom.value=(Ext.isEmpty(a)?"":a)):""},setValue:function(a){this.value=a;if(this.rendered){this.el.dom.value=(Ext.isEmpty(a)?"":a);this.validate()}return this},append:function(a){this.setValue([this.getValue(),a].join(""))}});Ext.form.MessageTargets={qtip:{mark:function(a,b){a.el.addClass(a.invalidClass);a.el.dom.qtip=b;a.el.dom.qclass="x-form-invalid-tip";if(Ext.QuickTips){Ext.QuickTips.enable()}},clear:function(a){a.el.removeClass(a.invalidClass);a.el.dom.qtip=""}},title:{mark:function(a,b){a.el.addClass(a.invalidClass);a.el.dom.title=b},clear:function(a){a.el.dom.title=""}},under:{mark:function(b,c){b.el.addClass(b.invalidClass);if(!b.errorEl){var a=b.getErrorCt();if(!a){b.el.dom.title=c;return}b.errorEl=a.createChild({cls:"x-form-invalid-msg"});b.on("resize",b.alignErrorEl,b);b.on("destroy",function(){Ext.destroy(this.errorEl)},b)}b.alignErrorEl();b.errorEl.update(c);Ext.form.Field.msgFx[b.msgFx].show(b.errorEl,b)},clear:function(a){a.el.removeClass(a.invalidClass);if(a.errorEl){Ext.form.Field.msgFx[a.msgFx].hide(a.errorEl,a)}else{a.el.dom.title=""}}},side:{mark:function(b,c){b.el.addClass(b.invalidClass);if(!b.errorIcon){var a=b.getErrorCt();if(!a){b.el.dom.title=c;return}b.errorIcon=a.createChild({cls:"x-form-invalid-icon"});if(b.ownerCt){b.ownerCt.on("afterlayout",b.alignErrorIcon,b);b.ownerCt.on("expand",b.alignErrorIcon,b)}b.on("resize",b.alignErrorIcon,b);b.on("destroy",function(){Ext.destroy(this.errorIcon)},b)}b.alignErrorIcon();b.errorIcon.dom.qtip=c;b.errorIcon.dom.qclass="x-form-invalid-tip";b.errorIcon.show()},clear:function(a){a.el.removeClass(a.invalidClass);if(a.errorIcon){a.errorIcon.dom.qtip="";a.errorIcon.hide()}else{a.el.dom.title=""}}}};Ext.form.Field.msgFx={normal:{show:function(a,b){a.setDisplayed("block")},hide:function(a,b){a.setDisplayed(false).update("")}},slide:{show:function(a,b){a.slideIn("t",{stopFx:true})},hide:function(a,b){a.slideOut("t",{stopFx:true,useDisplay:true})}},slideRight:{show:function(a,b){a.fixDisplay();a.alignTo(b.el,"tl-tr");a.slideIn("l",{stopFx:true})},hide:function(a,b){a.slideOut("l",{stopFx:true,useDisplay:true})}}};Ext.reg("field",Ext.form.Field);Ext.form.TextField=Ext.extend(Ext.form.Field,{grow:false,growMin:30,growMax:800,vtype:null,maskRe:null,disableKeyFilter:false,allowBlank:true,minLength:0,maxLength:Number.MAX_VALUE,minLengthText:"The minimum length for this field is {0}",maxLengthText:"The maximum length for this field is {0}",selectOnFocus:false,blankText:"This field is required",validator:null,regex:null,regexText:"",emptyText:null,emptyClass:"x-form-empty-field",initComponent:function(){Ext.form.TextField.superclass.initComponent.call(this);this.addEvents("autosize","keydown","keyup","keypress")},initEvents:function(){Ext.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=="keyup"){this.validationTask=new Ext.util.DelayedTask(this.validate,this);this.mon(this.el,"keyup",this.filterValidation,this)}else{if(this.validationEvent!==false&&this.validationEvent!="blur"){this.mon(this.el,this.validationEvent,this.validate,this,{buffer:this.validationDelay})}}if(this.selectOnFocus||this.emptyText){this.mon(this.el,"mousedown",this.onMouseDown,this);if(this.emptyText){this.applyEmptyText()}}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Ext.form.VTypes[this.vtype+"Mask"]))){this.mon(this.el,"keypress",this.filterKeys,this)}if(this.grow){this.mon(this.el,"keyup",this.onKeyUpBuffered,this,{buffer:50});this.mon(this.el,"click",this.autoSize,this)}if(this.enableKeyEvents){this.mon(this.el,{scope:this,keyup:this.onKeyUp,keydown:this.onKeyDown,keypress:this.onKeyPress})}},onMouseDown:function(a){if(!this.hasFocus){this.mon(this.el,"mouseup",Ext.emptyFn,this,{single:true,preventDefault:true})}},processValue:function(a){if(this.stripCharsRe){var b=a.replace(this.stripCharsRe,"");if(b!==a){this.setRawValue(b);return b}}return a},filterValidation:function(a){if(!a.isNavKeyPress()){this.validationTask.delay(this.validationDelay)}},onDisable:function(){Ext.form.TextField.superclass.onDisable.call(this);if(Ext.isIE){this.el.dom.unselectable="on"}},onEnable:function(){Ext.form.TextField.superclass.onEnable.call(this);if(Ext.isIE){this.el.dom.unselectable=""}},onKeyUpBuffered:function(a){if(this.doAutoSize(a)){this.autoSize()}},doAutoSize:function(a){return !a.isNavKeyPress()},onKeyUp:function(a){this.fireEvent("keyup",this,a)},onKeyDown:function(a){this.fireEvent("keydown",this,a)},onKeyPress:function(a){this.fireEvent("keypress",this,a)},reset:function(){Ext.form.TextField.superclass.reset.call(this);this.applyEmptyText()},applyEmptyText:function(){if(this.rendered&&this.emptyText&&this.getRawValue().length<1&&!this.hasFocus){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass)}},preFocus:function(){var a=this.el;if(this.emptyText){if(a.dom.value==this.emptyText){this.setRawValue("")}a.removeClass(this.emptyClass)}if(this.selectOnFocus){a.dom.select()}},postBlur:function(){this.applyEmptyText()},filterKeys:function(b){if(b.ctrlKey){return}var a=b.getKey();if(Ext.isGecko&&(b.isNavKeyPress()||a==b.BACKSPACE||(a==b.DELETE&&b.button==-1))){return}var c=String.fromCharCode(b.getCharCode());if(!Ext.isGecko&&b.isSpecialKey()&&!c){return}if(!this.maskRe.test(c)){b.stopEvent()}},setValue:function(a){if(this.emptyText&&this.el&&!Ext.isEmpty(a)){this.el.removeClass(this.emptyClass)}Ext.form.TextField.superclass.setValue.apply(this,arguments);this.applyEmptyText();this.autoSize();return this},getErrors:function(a){var d=Ext.form.TextField.superclass.getErrors.apply(this,arguments);a=a||this.processValue(this.getRawValue());if(Ext.isFunction(this.validator)){var c=this.validator(a);if(c!==true){d.push(c)}}if(!this.allowBlank&&(a.length<1||a===this.emptyText)){d.push(this.blankText)}if(a.lengththis.maxLength){d.push(String.format(this.maxLengthText,this.maxLength))}if(this.vtype){var b=Ext.form.VTypes;if(!b[this.vtype](a,this)){d.push(this.vtypeText||b[this.vtype+"Text"])}}if(this.regex&&!this.regex.test(a)){d.push(this.regexText)}return d},selectText:function(h,a){var c=this.getRawValue();var e=false;if(c.length>0){h=h===undefined?0:h;a=a===undefined?c.length:a;var g=this.el.dom;if(g.setSelectionRange){g.setSelectionRange(h,a)}else{if(g.createTextRange){var b=g.createTextRange();b.moveStart("character",h);b.moveEnd("character",a-c.length);b.select()}}e=Ext.isGecko||Ext.isOpera}else{e=true}if(e){this.focus()}},autoSize:function(){if(!this.grow||!this.rendered){return}if(!this.metrics){this.metrics=Ext.util.TextMetrics.createInstance(this.el)}var c=this.el;var b=c.dom.value;var e=document.createElement("div");e.appendChild(document.createTextNode(b));b=e.innerHTML;Ext.removeNode(e);e=null;b+=" ";var a=Math.min(this.growMax,Math.max(this.metrics.getWidth(b)+10,this.growMin));this.el.setWidth(a);this.fireEvent("autosize",this,a)},onDestroy:function(){if(this.validationTask){this.validationTask.cancel();this.validationTask=null}Ext.form.TextField.superclass.onDestroy.call(this)}});Ext.reg("textfield",Ext.form.TextField);Ext.form.TriggerField=Ext.extend(Ext.form.TextField,{defaultAutoCreate:{tag:"input",type:"text",size:"16",autocomplete:"off"},hideTrigger:false,editable:true,readOnly:false,wrapFocusClass:"x-trigger-wrap-focus",autoSize:Ext.emptyFn,monitorTab:true,deferHeight:true,mimicing:false,actionMode:"wrap",defaultTriggerWidth:17,onResize:function(a,c){Ext.form.TriggerField.superclass.onResize.call(this,a,c);var b=this.getTriggerWidth();if(Ext.isNumber(a)){this.el.setWidth(a-b)}this.wrap.setWidth(this.el.getWidth()+b)},getTriggerWidth:function(){var a=this.trigger.getWidth();if(!this.hideTrigger&&!this.readOnly&&a===0){a=this.defaultTriggerWidth}return a},alignErrorIcon:function(){if(this.wrap){this.errorIcon.alignTo(this.wrap,"tl-tr",[2,0])}},onRender:function(b,a){this.doc=Ext.isIE?Ext.getBody():Ext.getDoc();Ext.form.TriggerField.superclass.onRender.call(this,b,a);this.wrap=this.el.wrap({cls:"x-form-field-wrap x-form-field-trigger-wrap"});this.trigger=this.wrap.createChild(this.triggerConfig||{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.triggerClass});this.initTrigger();if(!this.width){this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth())}this.resizeEl=this.positionEl=this.wrap},getWidth:function(){return(this.el.getWidth()+this.trigger.getWidth())},updateEditState:function(){if(this.rendered){if(this.readOnly){this.el.dom.readOnly=true;this.el.addClass("x-trigger-noedit");this.mun(this.el,"click",this.onTriggerClick,this);this.trigger.setDisplayed(false)}else{if(!this.editable){this.el.dom.readOnly=true;this.el.addClass("x-trigger-noedit");this.mon(this.el,"click",this.onTriggerClick,this)}else{this.el.dom.readOnly=false;this.el.removeClass("x-trigger-noedit");this.mun(this.el,"click",this.onTriggerClick,this)}this.trigger.setDisplayed(!this.hideTrigger)}this.onResize(this.width||this.wrap.getWidth())}},setHideTrigger:function(a){if(a!=this.hideTrigger){this.hideTrigger=a;this.updateEditState()}},setEditable:function(a){if(a!=this.editable){this.editable=a;this.updateEditState()}},setReadOnly:function(a){if(a!=this.readOnly){this.readOnly=a;this.updateEditState()}},afterRender:function(){Ext.form.TriggerField.superclass.afterRender.call(this);this.updateEditState()},initTrigger:function(){this.mon(this.trigger,"click",this.onTriggerClick,this,{preventDefault:true});this.trigger.addClassOnOver("x-form-trigger-over");this.trigger.addClassOnClick("x-form-trigger-click")},onDestroy:function(){Ext.destroy(this.trigger,this.wrap);if(this.mimicing){this.doc.un("mousedown",this.mimicBlur,this)}delete this.doc;Ext.form.TriggerField.superclass.onDestroy.call(this)},onFocus:function(){Ext.form.TriggerField.superclass.onFocus.call(this);if(!this.mimicing){this.wrap.addClass(this.wrapFocusClass);this.mimicing=true;this.doc.on("mousedown",this.mimicBlur,this,{delay:10});if(this.monitorTab){this.on("specialkey",this.checkTab,this)}}},checkTab:function(a,b){if(b.getKey()==b.TAB){this.triggerBlur()}},onBlur:Ext.emptyFn,mimicBlur:function(a){if(!this.isDestroyed&&!this.wrap.contains(a.target)&&this.validateBlur(a)){this.triggerBlur()}},triggerBlur:function(){this.mimicing=false;this.doc.un("mousedown",this.mimicBlur,this);if(this.monitorTab&&this.el){this.un("specialkey",this.checkTab,this)}Ext.form.TriggerField.superclass.onBlur.call(this);if(this.wrap){this.wrap.removeClass(this.wrapFocusClass)}},beforeBlur:Ext.emptyFn,validateBlur:function(a){return true},onTriggerClick:Ext.emptyFn});Ext.form.TwinTriggerField=Ext.extend(Ext.form.TriggerField,{initComponent:function(){Ext.form.TwinTriggerField.superclass.initComponent.call(this);this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",cn:[{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger1Class},{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger2Class}]}},getTrigger:function(a){return this.triggers[a]},initTrigger:function(){var a=this.trigger.select(".x-form-trigger",true);var b=this;a.each(function(d,g,c){var e="Trigger"+(c+1);d.hide=function(){var h=b.wrap.getWidth();this.dom.style.display="none";b.el.setWidth(h-b.trigger.getWidth());this["hidden"+e]=true};d.show=function(){var h=b.wrap.getWidth();this.dom.style.display="";b.el.setWidth(h-b.trigger.getWidth());this["hidden"+e]=false};if(this["hide"+e]){d.dom.style.display="none";this["hidden"+e]=true}this.mon(d,"click",this["on"+e+"Click"],this,{preventDefault:true});d.addClassOnOver("x-form-trigger-over");d.addClassOnClick("x-form-trigger-click")},this);this.triggers=a.elements},getTriggerWidth:function(){var a=0;Ext.each(this.triggers,function(d,c){var e="Trigger"+(c+1),b=d.getWidth();if(b===0&&!this["hidden"+e]){a+=this.defaultTriggerWidth}else{a+=b}},this);return a},onDestroy:function(){Ext.destroy(this.triggers);Ext.form.TwinTriggerField.superclass.onDestroy.call(this)},onTrigger1Click:Ext.emptyFn,onTrigger2Click:Ext.emptyFn});Ext.reg("trigger",Ext.form.TriggerField);Ext.form.TextArea=Ext.extend(Ext.form.TextField,{growMin:60,growMax:1000,growAppend:" \n ",enterIsSpecial:false,preventScrollbars:false,onRender:function(b,a){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:100px;height:60px;",autocomplete:"off"}}Ext.form.TextArea.superclass.onRender.call(this,b,a);if(this.grow){this.textSizeEl=Ext.DomHelper.append(document.body,{tag:"pre",cls:"x-form-grow-sizer"});if(this.preventScrollbars){this.el.setStyle("overflow","hidden")}this.el.setHeight(this.growMin)}},onDestroy:function(){Ext.removeNode(this.textSizeEl);Ext.form.TextArea.superclass.onDestroy.call(this)},fireKey:function(a){if(a.isSpecialKey()&&(this.enterIsSpecial||(a.getKey()!=a.ENTER||a.hasModifier()))){this.fireEvent("specialkey",this,a)}},doAutoSize:function(a){return !a.isNavKeyPress()||a.getKey()==a.ENTER},autoSize:function(){if(!this.grow||!this.textSizeEl){return}var c=this.el,a=Ext.util.Format.htmlEncode(c.dom.value),d=this.textSizeEl,b;Ext.fly(d).setWidth(this.el.getWidth());if(a.length<1){a="  "}else{a+=this.growAppend;if(Ext.isIE){a=a.replace(/\n/g," 
")}}d.innerHTML=a;b=Math.min(this.growMax,Math.max(d.offsetHeight,this.growMin));if(b!=this.lastHeight){this.lastHeight=b;this.el.setHeight(b);this.fireEvent("autosize",this,b)}}});Ext.reg("textarea",Ext.form.TextArea);Ext.form.NumberField=Ext.extend(Ext.form.TextField,{fieldClass:"x-form-field x-form-num-field",allowDecimals:true,decimalSeparator:".",decimalPrecision:2,allowNegative:true,minValue:Number.NEGATIVE_INFINITY,maxValue:Number.MAX_VALUE,minText:"The minimum value for this field is {0}",maxText:"The maximum value for this field is {0}",nanText:"{0} is not a valid number",baseChars:"0123456789",initEvents:function(){var a=this.baseChars+"";if(this.allowDecimals){a+=this.decimalSeparator}if(this.allowNegative){a+="-"}this.maskRe=new RegExp("["+Ext.escapeRe(a)+"]");Ext.form.NumberField.superclass.initEvents.call(this)},getErrors:function(b){var c=Ext.form.NumberField.superclass.getErrors.apply(this,arguments);b=b||this.processValue(this.getRawValue());if(b.length<1){return c}b=String(b).replace(this.decimalSeparator,".");if(isNaN(b)){c.push(String.format(this.nanText,b))}var a=this.parseValue(b);if(athis.maxValue){c.push(String.format(this.maxText,this.maxValue))}return c},getValue:function(){return this.fixPrecision(this.parseValue(Ext.form.NumberField.superclass.getValue.call(this)))},setValue:function(a){a=Ext.isNumber(a)?a:parseFloat(String(a).replace(this.decimalSeparator,"."));a=isNaN(a)?"":String(a).replace(".",this.decimalSeparator);return Ext.form.NumberField.superclass.setValue.call(this,a)},setMinValue:function(a){this.minValue=Ext.num(a,Number.NEGATIVE_INFINITY)},setMaxValue:function(a){this.maxValue=Ext.num(a,Number.MAX_VALUE)},parseValue:function(a){a=parseFloat(String(a).replace(this.decimalSeparator,"."));return isNaN(a)?"":a},fixPrecision:function(b){var a=isNaN(b);if(!this.allowDecimals||this.decimalPrecision==-1||a||!b){return a?"":b}return parseFloat(parseFloat(b).toFixed(this.decimalPrecision))},beforeBlur:function(){var a=this.parseValue(this.getRawValue());if(!Ext.isEmpty(a)){this.setValue(this.fixPrecision(a))}}});Ext.reg("numberfield",Ext.form.NumberField);Ext.form.DateField=Ext.extend(Ext.form.TriggerField,{format:"m/d/Y",altFormats:"m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d",disabledDaysText:"Disabled",disabledDatesText:"Disabled",minText:"The date in this field must be equal to or after {0}",maxText:"The date in this field must be equal to or before {0}",invalidText:"{0} is not a valid date - it must be in the format {1}",triggerClass:"x-form-date-trigger",showToday:true,defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"off"},initTime:"12",initTimeFormat:"H",safeParse:function(b,c){if(/[gGhH]/.test(c.replace(/(\\.)/g,""))){return Date.parseDate(b,c)}else{var a=Date.parseDate(b+" "+this.initTime,c+" "+this.initTimeFormat);if(a){return a.clearTime()}}},initComponent:function(){Ext.form.DateField.superclass.initComponent.call(this);this.addEvents("select");if(Ext.isString(this.minValue)){this.minValue=this.parseDate(this.minValue)}if(Ext.isString(this.maxValue)){this.maxValue=this.parseDate(this.maxValue)}this.disabledDatesRE=null;this.initDisabledDays()},initEvents:function(){Ext.form.DateField.superclass.initEvents.call(this);this.keyNav=new Ext.KeyNav(this.el,{down:function(a){this.onTriggerClick()},scope:this,forceKeyDown:true})},initDisabledDays:function(){if(this.disabledDates){var b=this.disabledDates,a=b.length-1,c="(?:";Ext.each(b,function(g,e){c+=Ext.isDate(g)?"^"+Ext.escapeRe(g.dateFormat(this.format))+"$":b[e];if(e!=a){c+="|"}},this);this.disabledDatesRE=new RegExp(c+")")}},setDisabledDates:function(a){this.disabledDates=a;this.initDisabledDays();if(this.menu){this.menu.picker.setDisabledDates(this.disabledDatesRE)}},setDisabledDays:function(a){this.disabledDays=a;if(this.menu){this.menu.picker.setDisabledDays(a)}},setMinValue:function(a){this.minValue=(Ext.isString(a)?this.parseDate(a):a);if(this.menu){this.menu.picker.setMinDate(this.minValue)}},setMaxValue:function(a){this.maxValue=(Ext.isString(a)?this.parseDate(a):a);if(this.menu){this.menu.picker.setMaxDate(this.maxValue)}},getErrors:function(e){var h=Ext.form.DateField.superclass.getErrors.apply(this,arguments);e=this.formatDate(e||this.processValue(this.getRawValue()));if(e.length<1){return h}var c=e;e=this.parseDate(e);if(!e){h.push(String.format(this.invalidText,c,this.format));return h}var g=e.getTime();if(this.minValue&&gthis.maxValue.getTime()){h.push(String.format(this.maxText,this.formatDate(this.maxValue)))}if(this.disabledDays){var a=e.getDay();for(var b=0;b
{'+this.displayField+"}
"}this.view=new Ext.DataView({applyTo:this.innerList,tpl:this.tpl,singleSelect:true,selectedClass:this.selectedClass,itemSelector:this.itemSelector||"."+a+"-item",emptyText:this.listEmptyText,deferEmptyText:false});this.mon(this.view,{containerclick:this.onViewClick,click:this.onViewClick,scope:this});this.bindStore(this.store,true);if(this.resizable){this.resizer=new Ext.Resizable(this.list,{pinned:true,handles:"se"});this.mon(this.resizer,"resize",function(i,e,g){this.maxHeight=g-this.handleHeight-this.list.getFrameWidth("tb")-this.assetHeight;this.listWidth=e;this.innerList.setWidth(e-this.list.getFrameWidth("lr"));this.restrictHeight()},this);this[this.pageSize?"footer":"innerList"].setStyle("margin-bottom",this.handleHeight+"px")}}},getListParent:function(){return document.body},getStore:function(){return this.store},bindStore:function(a,b){if(this.store&&!b){if(this.store!==a&&this.store.autoDestroy){this.store.destroy()}else{this.store.un("beforeload",this.onBeforeLoad,this);this.store.un("load",this.onLoad,this);this.store.un("exception",this.collapse,this)}if(!a){this.store=null;if(this.view){this.view.bindStore(null)}if(this.pageTb){this.pageTb.bindStore(null)}}}if(a){if(!b){this.lastQuery=null;if(this.pageTb){this.pageTb.bindStore(a)}}this.store=Ext.StoreMgr.lookup(a);this.store.on({scope:this,beforeload:this.onBeforeLoad,load:this.onLoad,exception:this.collapse});if(this.view){this.view.bindStore(a)}}},reset:function(){Ext.form.ComboBox.superclass.reset.call(this);if(this.clearFilterOnReset&&this.mode=="local"){this.store.clearFilter()}},initEvents:function(){Ext.form.ComboBox.superclass.initEvents.call(this);this.keyNav=new Ext.KeyNav(this.el,{up:function(a){this.inKeyMode=true;this.selectPrev()},down:function(a){if(!this.isExpanded()){this.onTriggerClick()}else{this.inKeyMode=true;this.selectNext()}},enter:function(a){this.onViewClick()},esc:function(a){this.collapse()},tab:function(a){if(this.forceSelection===true){this.collapse()}else{this.onViewClick(false)}return true},scope:this,doRelay:function(c,b,a){if(a=="down"||this.scope.isExpanded()){var d=Ext.KeyNav.prototype.doRelay.apply(this,arguments);if(!Ext.isIE&&Ext.EventManager.useKeydown){this.scope.fireKey(c)}return d}return true},forceKeyDown:true,defaultEventAction:"stopEvent"});this.queryDelay=Math.max(this.queryDelay||10,this.mode=="local"?10:250);this.dqTask=new Ext.util.DelayedTask(this.initQuery,this);if(this.typeAhead){this.taTask=new Ext.util.DelayedTask(this.onTypeAhead,this)}if(!this.enableKeyEvents){this.mon(this.el,"keyup",this.onKeyUp,this)}},onDestroy:function(){if(this.dqTask){this.dqTask.cancel();this.dqTask=null}this.bindStore(null);Ext.destroy(this.resizer,this.view,this.pageTb,this.list);Ext.destroyMembers(this,"hiddenField");Ext.form.ComboBox.superclass.onDestroy.call(this)},fireKey:function(a){if(!this.isExpanded()){Ext.form.ComboBox.superclass.fireKey.call(this,a)}},onResize:function(a,b){Ext.form.ComboBox.superclass.onResize.apply(this,arguments);if(!isNaN(a)&&this.isVisible()&&this.list){this.doResize(a)}else{this.bufferSize=a}},doResize:function(a){if(!Ext.isDefined(this.listWidth)){var b=Math.max(a,this.minListWidth);this.list.setWidth(b);this.innerList.setWidth(b-this.list.getFrameWidth("lr"))}},onEnable:function(){Ext.form.ComboBox.superclass.onEnable.apply(this,arguments);if(this.hiddenField){this.hiddenField.disabled=false}},onDisable:function(){Ext.form.ComboBox.superclass.onDisable.apply(this,arguments);if(this.hiddenField){this.hiddenField.disabled=true}},onBeforeLoad:function(){if(!this.hasFocus){return}this.innerList.update(this.loadingText?'
'+this.loadingText+"
":"");this.restrictHeight();this.selectedIndex=-1},onLoad:function(){if(!this.hasFocus){return}if(this.store.getCount()>0||this.listEmptyText){this.expand();this.restrictHeight();if(this.lastQuery==this.allQuery){if(this.editable){this.el.dom.select()}if(this.autoSelect!==false&&!this.selectByValue(this.value,true)){this.select(0,true)}}else{if(this.autoSelect!==false){this.selectNext()}if(this.typeAhead&&this.lastKey!=Ext.EventObject.BACKSPACE&&this.lastKey!=Ext.EventObject.DELETE){this.taTask.delay(this.typeAheadDelay)}}}else{this.collapse()}},onTypeAhead:function(){if(this.store.getCount()>0){var b=this.store.getAt(0);var c=b.data[this.displayField];var a=c.length;var d=this.getRawValue().length;if(d!=a){this.setRawValue(c);this.selectText(d,c.length)}}},assertValue:function(){var b=this.getRawValue(),a=this.findRecord(this.displayField,b);if(!a&&this.forceSelection){if(b.length>0&&b!=this.emptyText){this.el.dom.value=Ext.value(this.lastSelectionText,"");this.applyEmptyText()}else{this.clearValue()}}else{if(a){if(b==a.get(this.displayField)&&this.value==a.get(this.valueField)){return}b=a.get(this.valueField||this.displayField)}this.setValue(b)}},onSelect:function(a,b){if(this.fireEvent("beforeselect",this,a,b)!==false){this.setValue(a.data[this.valueField||this.displayField]);this.collapse();this.fireEvent("select",this,a,b)}},getName:function(){var a=this.hiddenField;return a&&a.name?a.name:this.hiddenName||Ext.form.ComboBox.superclass.getName.call(this)},getValue:function(){if(this.valueField){return Ext.isDefined(this.value)?this.value:""}else{return Ext.form.ComboBox.superclass.getValue.call(this)}},clearValue:function(){if(this.hiddenField){this.hiddenField.value=""}this.setRawValue("");this.lastSelectionText="";this.applyEmptyText();this.value=""},setValue:function(a){var c=a;if(this.valueField){var b=this.findRecord(this.valueField,a);if(b){c=b.data[this.displayField]}else{if(Ext.isDefined(this.valueNotFoundText)){c=this.valueNotFoundText}}}this.lastSelectionText=c;if(this.hiddenField){this.hiddenField.value=Ext.value(a,"")}Ext.form.ComboBox.superclass.setValue.call(this,c);this.value=a;return this},findRecord:function(c,b){var a;if(this.store.getCount()>0){this.store.each(function(d){if(d.data[c]==b){a=d;return false}})}return a},onViewMove:function(b,a){this.inKeyMode=false},onViewOver:function(d,b){if(this.inKeyMode){return}var c=this.view.findItemFromChild(b);if(c){var a=this.view.indexOf(c);this.select(a,false)}},onViewClick:function(b){var a=this.view.getSelectedIndexes()[0],c=this.store,d=c.getAt(a);if(d){this.onSelect(d,a)}else{this.collapse()}if(b!==false){this.el.focus()}},restrictHeight:function(){this.innerList.dom.style.height="";var b=this.innerList.dom,e=this.list.getFrameWidth("tb")+(this.resizable?this.handleHeight:0)+this.assetHeight,c=Math.max(b.clientHeight,b.offsetHeight,b.scrollHeight),a=this.getPosition()[1]-Ext.getBody().getScroll().top,g=Ext.lib.Dom.getViewHeight()-a-this.getSize().height,d=Math.max(a,g,this.minHeight||0)-this.list.shadowOffset-e-5;c=Math.min(c,d,this.maxHeight);this.innerList.setHeight(c);this.list.beginUpdate();this.list.setHeight(c+e);this.list.alignTo.apply(this.list,[this.el].concat(this.listAlign));this.list.endUpdate()},isExpanded:function(){return this.list&&this.list.isVisible()},selectByValue:function(a,c){if(!Ext.isEmpty(a,true)){var b=this.findRecord(this.valueField||this.displayField,a);if(b){this.select(this.store.indexOf(b),c);return true}}return false},select:function(a,c){this.selectedIndex=a;this.view.select(a);if(c!==false){var b=this.view.getNode(a);if(b){this.innerList.scrollChildIntoView(b,false)}}},selectNext:function(){var a=this.store.getCount();if(a>0){if(this.selectedIndex==-1){this.select(0)}else{if(this.selectedIndex0){if(this.selectedIndex==-1){this.select(0)}else{if(this.selectedIndex!==0){this.select(this.selectedIndex-1)}}}},onKeyUp:function(b){var a=b.getKey();if(this.editable!==false&&this.readOnly!==true&&(a==b.BACKSPACE||!b.isSpecialKey())){this.lastKey=a;this.dqTask.delay(this.queryDelay)}Ext.form.ComboBox.superclass.onKeyUp.call(this,b)},validateBlur:function(){return !this.list||!this.list.isVisible()},initQuery:function(){this.doQuery(this.getRawValue())},beforeBlur:function(){this.assertValue()},postBlur:function(){Ext.form.ComboBox.superclass.postBlur.call(this);this.collapse();this.inKeyMode=false},doQuery:function(c,b){c=Ext.isEmpty(c)?"":c;var a={query:c,forceAll:b,combo:this,cancel:false};if(this.fireEvent("beforequery",a)===false||a.cancel){return false}c=a.query;b=a.forceAll;if(b===true||(c.length>=this.minChars)){if(this.lastQuery!==c){this.lastQuery=c;if(this.mode=="local"){this.selectedIndex=-1;if(b){this.store.clearFilter()}else{this.store.filter(this.displayField,c)}this.onLoad()}else{this.store.baseParams[this.queryParam]=c;this.store.load({params:this.getParams(c)});this.expand()}}else{this.selectedIndex=-1;this.onLoad()}}},getParams:function(a){var b={};if(this.pageSize){b.start=0;b.limit=this.pageSize}return b},collapse:function(){if(!this.isExpanded()){return}this.list.hide();Ext.getDoc().un("mousewheel",this.collapseIf,this);Ext.getDoc().un("mousedown",this.collapseIf,this);this.fireEvent("collapse",this)},collapseIf:function(a){if(!this.isDestroyed&&!a.within(this.wrap)&&!a.within(this.list)){this.collapse()}},expand:function(){if(this.isExpanded()||!this.hasFocus){return}if(this.title||this.pageSize){this.assetHeight=0;if(this.title){this.assetHeight+=this.header.getHeight()}if(this.pageSize){this.assetHeight+=this.footer.getHeight()}}if(this.bufferSize){this.doResize(this.bufferSize);delete this.bufferSize}this.list.alignTo.apply(this.list,[this.el].concat(this.listAlign));var b=Ext.getDom(this.getListParent()||Ext.getBody()),a=parseInt(Ext.fly(b).getStyle("z-index"),10);if(!a){a=this.getParentZIndex()}if(a){this.list.setZIndex(a+5)}this.list.show();if(Ext.isGecko2){this.innerList.setOverflow("auto")}this.mon(Ext.getDoc(),{scope:this,mousewheel:this.collapseIf,mousedown:this.collapseIf});this.fireEvent("expand",this)},onTriggerClick:function(){if(this.readOnly||this.disabled){return}if(this.isExpanded()){this.collapse();this.el.focus()}else{this.onFocus({});if(this.triggerAction=="all"){this.doQuery(this.allQuery,true)}else{this.doQuery(this.getRawValue())}this.el.focus()}}});Ext.reg("combo",Ext.form.ComboBox);Ext.form.Checkbox=Ext.extend(Ext.form.Field,{focusClass:undefined,fieldClass:"x-form-field",checked:false,boxLabel:" ",defaultAutoCreate:{tag:"input",type:"checkbox",autocomplete:"off"},actionMode:"wrap",initComponent:function(){Ext.form.Checkbox.superclass.initComponent.call(this);this.addEvents("check")},onResize:function(){Ext.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel&&!this.fieldLabel){this.el.alignTo(this.wrap,"c-c")}},initEvents:function(){Ext.form.Checkbox.superclass.initEvents.call(this);this.mon(this.el,{scope:this,click:this.onClick,change:this.onClick})},markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn,onRender:function(b,a){Ext.form.Checkbox.superclass.onRender.call(this,b,a);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue}this.wrap=this.el.wrap({cls:"x-form-check-wrap"});if(this.boxLabel){this.wrap.createChild({tag:"label",htmlFor:this.el.id,cls:"x-form-cb-label",html:this.boxLabel})}if(this.checked){this.setValue(true)}else{this.checked=this.el.dom.checked}if(Ext.isIE){this.wrap.repaint()}this.resizeEl=this.positionEl=this.wrap},onDestroy:function(){Ext.destroy(this.wrap);Ext.form.Checkbox.superclass.onDestroy.call(this)},initValue:function(){this.originalValue=this.getValue()},getValue:function(){if(this.rendered){return this.el.dom.checked}return this.checked},onClick:function(){if(this.el.dom.checked!=this.checked){this.setValue(this.el.dom.checked)}},setValue:function(a){var b=this.checked;this.checked=(a===true||a==="true"||a=="1"||String(a).toLowerCase()=="on");if(this.rendered){this.el.dom.checked=this.checked;this.el.dom.defaultChecked=this.checked}if(b!=this.checked){this.fireEvent("check",this,this.checked);if(this.handler){this.handler.call(this.scope||this,this,this.checked)}}return this}});Ext.reg("checkbox",Ext.form.Checkbox);Ext.form.CheckboxGroup=Ext.extend(Ext.form.Field,{columns:"auto",vertical:false,allowBlank:true,blankText:"You must select at least one item in this group",defaultType:"checkbox",groupCls:"x-form-check-group",initComponent:function(){this.addEvents("change");this.on("change",this.validate,this);Ext.form.CheckboxGroup.superclass.initComponent.call(this)},onRender:function(j,g){if(!this.el){var p={autoEl:{id:this.id},cls:this.groupCls,layout:"column",renderTo:j,bufferResize:false};var a={xtype:"container",defaultType:this.defaultType,layout:"form",defaults:{hideLabel:true,anchor:"100%"}};if(this.items[0].items){Ext.apply(p,{layoutConfig:{columns:this.items.length},defaults:this.defaults,items:this.items});for(var e=0,m=this.items.length;e0&&e%r==0){o++}if(this.items[e].fieldLabel){this.items[e].hideLabel=false}n[o].items.push(this.items[e])}}else{for(var e=0,m=this.items.length;e-1){b.setValue(true)}})},getBox:function(b){var a=null;this.eachItem(function(c){if(b==c||c.dataIndex==b||c.id==b||c.getName()==b){a=c;return false}});return a},getValue:function(){var a=[];this.eachItem(function(b){if(b.checked){a.push(b)}});return a},eachItem:function(b,a){if(this.items&&this.items.each){this.items.each(b,a||this)}},getRawValue:Ext.emptyFn,setRawValue:Ext.emptyFn});Ext.reg("checkboxgroup",Ext.form.CheckboxGroup);Ext.form.CompositeField=Ext.extend(Ext.form.Field,{defaultMargins:"0 5 0 0",skipLastItemMargin:true,isComposite:true,combineErrors:true,initComponent:function(){var e=[],a=this.items,d;for(var c=0,b=a.length;c")},sortErrors:function(){var a=this.items;this.fieldErrors.sort("ASC",function(g,d){var c=function(b){return function(i){return i.getName()==b}};var h=a.findIndexBy(c(g.field)),e=a.findIndexBy(c(d.field));return h1){var a=this.getBox(c);if(a){a.setValue(b);if(a.checked){this.eachItem(function(d){if(d!==a){d.setValue(false)}})}}}else{this.setValueForItem(c)}},setValueForItem:function(a){a=String(a).split(",")[0];this.eachItem(function(b){b.setValue(a==b.inputValue)})},fireChecked:function(){if(!this.checkTask){this.checkTask=new Ext.util.DelayedTask(this.bufferChecked,this)}this.checkTask.delay(10)},bufferChecked:function(){var a=null;this.eachItem(function(b){if(b.checked){a=b;return false}});this.fireEvent("change",this,a)},onDestroy:function(){if(this.checkTask){this.checkTask.cancel();this.checkTask=null}Ext.form.RadioGroup.superclass.onDestroy.call(this)}});Ext.reg("radiogroup",Ext.form.RadioGroup);Ext.form.Hidden=Ext.extend(Ext.form.Field,{inputType:"hidden",onRender:function(){Ext.form.Hidden.superclass.onRender.apply(this,arguments)},initEvents:function(){this.originalValue=this.getValue()},setSize:Ext.emptyFn,setWidth:Ext.emptyFn,setHeight:Ext.emptyFn,setPosition:Ext.emptyFn,setPagePosition:Ext.emptyFn,markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn});Ext.reg("hidden",Ext.form.Hidden);Ext.form.BasicForm=Ext.extend(Ext.util.Observable,{constructor:function(b,a){Ext.apply(this,a);if(Ext.isString(this.paramOrder)){this.paramOrder=this.paramOrder.split(/[\s,|]/)}this.items=new Ext.util.MixedCollection(false,function(c){return c.getItemId()});this.addEvents("beforeaction","actionfailed","actioncomplete");if(b){this.initEl(b)}Ext.form.BasicForm.superclass.constructor.call(this)},timeout:30,paramOrder:undefined,paramsAsHash:false,waitTitle:"Please Wait...",activeAction:null,trackResetOnLoad:false,initEl:function(a){this.el=Ext.get(a);this.id=this.el.id||Ext.id();if(!this.standardSubmit){this.el.on("submit",this.onSubmit,this)}this.el.addClass("x-form")},getEl:function(){return this.el},onSubmit:function(a){a.stopEvent()},destroy:function(a){if(a!==true){this.items.each(function(b){Ext.destroy(b)});Ext.destroy(this.el)}this.items.clear();this.purgeListeners()},isValid:function(){var a=true;this.items.each(function(b){if(!b.validate()){a=false}});return a},isDirty:function(){var a=false;this.items.each(function(b){if(b.isDirty()){a=true;return false}});return a},doAction:function(b,a){if(Ext.isString(b)){b=new Ext.form.Action.ACTION_TYPES[b](this,a)}if(this.fireEvent("beforeaction",this,b)!==false){this.beforeAction(b);b.run.defer(100,b)}return this},submit:function(b){b=b||{};if(this.standardSubmit){var a=b.clientValidation===false||this.isValid();if(a){var c=this.el.dom;if(this.url&&Ext.isEmpty(c.action)){c.action=this.url}c.submit()}return a}var d=String.format("{0}submit",this.api?"direct":"");this.doAction(d,b);return this},load:function(a){var b=String.format("{0}load",this.api?"direct":"");this.doAction(b,a);return this},updateRecord:function(b){b.beginEdit();var a=b.fields;a.each(function(c){var d=this.findField(c.name);if(d){b.set(c.name,d.getValue())}},this);b.endEdit();return this},loadRecord:function(a){this.setValues(a.data);return this},beforeAction:function(a){this.items.each(function(c){if(c.isFormField&&c.syncValue){c.syncValue()}});var b=a.options;if(b.waitMsg){if(this.waitMsgTarget===true){this.el.mask(b.waitMsg,"x-mask-loading")}else{if(this.waitMsgTarget){this.waitMsgTarget=Ext.get(this.waitMsgTarget);this.waitMsgTarget.mask(b.waitMsg,"x-mask-loading")}else{Ext.MessageBox.wait(b.waitMsg,b.waitTitle||this.waitTitle)}}}},afterAction:function(a,c){this.activeAction=null;var b=a.options;if(b.waitMsg){if(this.waitMsgTarget===true){this.el.unmask()}else{if(this.waitMsgTarget){this.waitMsgTarget.unmask()}else{Ext.MessageBox.updateProgress(1);Ext.MessageBox.hide()}}}if(c){if(b.reset){this.reset()}Ext.callback(b.success,b.scope,[this,a]);this.fireEvent("actioncomplete",this,a)}else{Ext.callback(b.failure,b.scope,[this,a]);this.fireEvent("actionfailed",this,a)}},findField:function(c){var b=this.items.get(c);if(!Ext.isObject(b)){var a=function(d){if(d.isFormField){if(d.dataIndex==c||d.id==c||d.getName()==c){b=d;return false}else{if(d.isComposite){return d.items.each(a)}}}};this.items.each(a)}return b||null},markInvalid:function(h){if(Ext.isArray(h)){for(var c=0,a=h.length;c':">"),c,"")}return d.join("")},createToolbar:function(e){var c=[];var a=Ext.QuickTips&&Ext.QuickTips.isEnabled();function d(j,h,i){return{itemId:j,cls:"x-btn-icon",iconCls:"x-edit-"+j,enableToggle:h!==false,scope:e,handler:i||e.relayBtnCmd,clickEvent:"mousedown",tooltip:a?e.buttonTips[j]||undefined:undefined,overflowText:e.buttonTips[j].title||undefined,tabIndex:-1}}if(this.enableFont&&!Ext.isSafari2){var g=new Ext.Toolbar.Item({autoEl:{tag:"select",cls:"x-font-select",html:this.createFontOptions()}});c.push(g,"-")}if(this.enableFormat){c.push(d("bold"),d("italic"),d("underline"))}if(this.enableFontSize){c.push("-",d("increasefontsize",false,this.adjustFont),d("decreasefontsize",false,this.adjustFont))}if(this.enableColors){c.push("-",{itemId:"forecolor",cls:"x-btn-icon",iconCls:"x-edit-forecolor",clickEvent:"mousedown",tooltip:a?e.buttonTips.forecolor||undefined:undefined,tabIndex:-1,menu:new Ext.menu.ColorMenu({allowReselect:true,focus:Ext.emptyFn,value:"000000",plain:true,listeners:{scope:this,select:function(i,h){this.execCmd("forecolor",Ext.isWebKit||Ext.isIE?"#"+h:h);this.deferFocus()}},clickEvent:"mousedown"})},{itemId:"backcolor",cls:"x-btn-icon",iconCls:"x-edit-backcolor",clickEvent:"mousedown",tooltip:a?e.buttonTips.backcolor||undefined:undefined,tabIndex:-1,menu:new Ext.menu.ColorMenu({focus:Ext.emptyFn,value:"FFFFFF",plain:true,allowReselect:true,listeners:{scope:this,select:function(i,h){if(Ext.isGecko){this.execCmd("useCSS",false);this.execCmd("hilitecolor",h);this.execCmd("useCSS",true);this.deferFocus()}else{this.execCmd(Ext.isOpera?"hilitecolor":"backcolor",Ext.isWebKit||Ext.isIE?"#"+h:h);this.deferFocus()}}},clickEvent:"mousedown"})})}if(this.enableAlignments){c.push("-",d("justifyleft"),d("justifycenter"),d("justifyright"))}if(!Ext.isSafari2){if(this.enableLinks){c.push("-",d("createlink",false,this.createLink))}if(this.enableLists){c.push("-",d("insertorderedlist"),d("insertunorderedlist"))}if(this.enableSourceEdit){c.push("-",d("sourceedit",true,function(h){this.toggleSourceEdit(!this.sourceEditMode)}))}}var b=new Ext.Toolbar({renderTo:this.wrap.dom.firstChild,items:c});if(g){this.fontSelect=g.el;this.mon(this.fontSelect,"change",function(){var h=this.fontSelect.dom.value;this.relayCmd("fontname",h);this.deferFocus()},this)}this.mon(b.el,"click",function(h){h.preventDefault()});this.tb=b;this.tb.doLayout()},onDisable:function(){this.wrap.mask();Ext.form.HtmlEditor.superclass.onDisable.call(this)},onEnable:function(){this.wrap.unmask();Ext.form.HtmlEditor.superclass.onEnable.call(this)},setReadOnly:function(b){Ext.form.HtmlEditor.superclass.setReadOnly.call(this,b);if(this.initialized){this.setDesignMode(!b);var a=this.getEditorBody();if(a){a.style.cursor=this.readOnly?"default":"text"}this.disableItems(b)}},getDocMarkup:function(){var a=Ext.fly(this.iframe).getHeight()-this.iframePad*2;return String.format('',this.iframePad,a)},getEditorBody:function(){var a=this.getDoc();return a.body||a.documentElement},getDoc:function(){return Ext.isIE?this.getWin().document:(this.iframe.contentDocument||this.getWin().document)},getWin:function(){return Ext.isIE?this.iframe.contentWindow:window.frames[this.iframe.name]},onRender:function(b,a){Ext.form.HtmlEditor.superclass.onRender.call(this,b,a);this.el.dom.style.border="0 none";this.el.dom.setAttribute("tabIndex",-1);this.el.addClass("x-hidden");if(Ext.isIE){this.el.applyStyles("margin-top:-1px;margin-bottom:-1px;")}this.wrap=this.el.wrap({cls:"x-html-editor-wrap",cn:{cls:"x-html-editor-tb"}});this.createToolbar(this);this.disableItems(true);this.tb.doLayout();this.createIFrame();if(!this.width){var c=this.el.getSize();this.setSize(c.width,this.height||c.height)}this.resizeEl=this.positionEl=this.wrap},createIFrame:function(){var a=document.createElement("iframe");a.name=Ext.id();a.frameBorder="0";a.style.overflow="auto";this.wrap.dom.appendChild(a);this.iframe=a;this.monitorTask=Ext.TaskMgr.start({run:this.checkDesignMode,scope:this,interval:100})},initFrame:function(){Ext.TaskMgr.stop(this.monitorTask);var b=this.getDoc();this.win=this.getWin();b.open();b.write(this.getDocMarkup());b.close();var a={run:function(){var c=this.getDoc();if(c.body||c.readyState=="complete"){Ext.TaskMgr.stop(a);this.setDesignMode(true);this.initEditor.defer(10,this)}},interval:10,duration:10000,scope:this};Ext.TaskMgr.start(a)},checkDesignMode:function(){if(this.wrap&&this.wrap.dom.offsetWidth){var a=this.getDoc();if(!a){return}if(!a.editorInitialized||this.getDesignMode()!="on"){this.initFrame()}}},setDesignMode:function(b){var a;if(a=this.getDoc()){if(this.readOnly){b=false}a.designMode=(/on|true/i).test(String(b).toLowerCase())?"on":"off"}},getDesignMode:function(){var a=this.getDoc();if(!a){return""}return String(a.designMode).toLowerCase()},disableItems:function(a){if(this.fontSelect){this.fontSelect.dom.disabled=a}this.tb.items.each(function(b){if(b.getItemId()!="sourceedit"){b.setDisabled(a)}})},onResize:function(b,c){Ext.form.HtmlEditor.superclass.onResize.apply(this,arguments);if(this.el&&this.iframe){if(Ext.isNumber(b)){var e=b-this.wrap.getFrameWidth("lr");this.el.setWidth(e);this.tb.setWidth(e);this.iframe.style.width=Math.max(e,0)+"px"}if(Ext.isNumber(c)){var a=c-this.wrap.getFrameWidth("tb")-this.tb.el.getHeight();this.el.setHeight(a);this.iframe.style.height=Math.max(a,0)+"px";var d=this.getEditorBody();if(d){d.style.height=Math.max((a-(this.iframePad*2)),0)+"px"}}}},toggleSourceEdit:function(b){var d,a;if(b===undefined){b=!this.sourceEditMode}this.sourceEditMode=b===true;var c=this.tb.getComponent("sourceedit");if(c.pressed!==this.sourceEditMode){c.toggle(this.sourceEditMode);if(!c.xtbHidden){return}}if(this.sourceEditMode){ls=this.getSize();d=Ext.get(this.iframe).getHeight();this.disableItems(true);this.syncValue();this.iframe.className="x-hidden";this.el.removeClass("x-hidden");this.el.dom.removeAttribute("tabIndex");this.el.focus();this.el.dom.style.height=d+"px"}else{a=parseInt(this.el.dom.style.height,10);if(this.initialized){this.disableItems(this.readOnly)}this.pushValue();this.iframe.className="";this.el.addClass("x-hidden");this.el.dom.setAttribute("tabIndex",-1);this.deferFocus();this.setSize(ls);this.iframe.style.height=a+"px"}this.fireEvent("editmodechange",this,this.sourceEditMode)},createLink:function(){var a=prompt(this.createLinkText,this.defaultLinkValue);if(a&&a!="http://"){this.relayCmd("createlink",a)}},initEvents:function(){this.originalValue=this.getValue()},markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn,setValue:function(a){Ext.form.HtmlEditor.superclass.setValue.call(this,a);this.pushValue();return this},cleanHtml:function(a){a=String(a);if(Ext.isWebKit){a=a.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi,"")}if(a.charCodeAt(0)==this.defaultValue.replace(/\D/g,"")){a=a.substring(1)}return a},syncValue:function(){if(this.initialized){var d=this.getEditorBody();var c=d.innerHTML;if(Ext.isWebKit){var b=d.getAttribute("style");var a=b.match(/text-align:(.*?);/i);if(a&&a[1]){c='
'+c+"
"}}c=this.cleanHtml(c);if(this.fireEvent("beforesync",this,c)!==false){this.el.dom.value=c;this.fireEvent("sync",this,c)}}},getValue:function(){this[this.sourceEditMode?"pushValue":"syncValue"]();return Ext.form.HtmlEditor.superclass.getValue.call(this)},pushValue:function(){if(this.initialized){var a=this.el.dom.value;if(!this.activated&&a.length<1){a=this.defaultValue}if(this.fireEvent("beforepush",this,a)!==false){this.getEditorBody().innerHTML=a;if(Ext.isGecko){this.setDesignMode(false)}this.setDesignMode(true);this.fireEvent("push",this,a)}}},deferFocus:function(){this.focus.defer(10,this)},focus:function(){if(this.win&&!this.sourceEditMode){this.win.focus()}else{this.el.focus()}},initEditor:function(){try{var c=this.getEditorBody(),a=this.el.getStyles("font-size","font-family","background-image","background-repeat","background-color","color"),g,b;a["background-attachment"]="fixed";c.bgProperties="fixed";Ext.DomHelper.applyStyles(c,a);g=this.getDoc();if(g){try{Ext.EventManager.removeAll(g)}catch(d){}}b=this.onEditorEvent.createDelegate(this);Ext.EventManager.on(g,{mousedown:b,dblclick:b,click:b,keyup:b,buffer:100});if(Ext.isGecko){Ext.EventManager.on(g,"keypress",this.applyCommand,this)}if(Ext.isIE||Ext.isWebKit||Ext.isOpera){Ext.EventManager.on(g,"keydown",this.fixKeys,this)}g.editorInitialized=true;this.initialized=true;this.pushValue();this.setReadOnly(this.readOnly);this.fireEvent("initialize",this)}catch(d){}},onDestroy:function(){if(this.monitorTask){Ext.TaskMgr.stop(this.monitorTask)}if(this.rendered){Ext.destroy(this.tb);var b=this.getDoc();if(b){try{Ext.EventManager.removeAll(b);for(var c in b){delete b[c]}}catch(a){}}if(this.wrap){this.wrap.dom.innerHTML="";this.wrap.remove()}}if(this.el){this.el.removeAllListeners();this.el.remove()}this.purgeListeners()},onFirstFocus:function(){this.activated=true;this.disableItems(this.readOnly);if(Ext.isGecko){this.win.focus();var a=this.win.getSelection();if(!a.focusNode||a.focusNode.nodeType!=3){var b=a.getRangeAt(0);b.selectNodeContents(this.getEditorBody());b.collapse(true);this.deferFocus()}try{this.execCmd("useCSS",true);this.execCmd("styleWithCSS",false)}catch(c){}}this.fireEvent("activate",this)},adjustFont:function(b){var d=b.getItemId()=="increasefontsize"?1:-1,c=this.getDoc(),a=parseInt(c.queryCommandValue("FontSize")||2,10);if((Ext.isSafari&&!Ext.isSafari2)||Ext.isChrome||Ext.isAir){if(a<=10){a=1+d}else{if(a<=13){a=2+d}else{if(a<=16){a=3+d}else{if(a<=18){a=4+d}else{if(a<=24){a=5+d}else{a=6+d}}}}}a=a.constrain(1,6)}else{if(Ext.isSafari){d*=2}a=Math.max(1,a+d)+(Ext.isSafari?"px":0)}this.execCmd("FontSize",a)},onEditorEvent:function(a){this.updateToolbar()},updateToolbar:function(){if(this.readOnly){return}if(!this.activated){this.onFirstFocus();return}var b=this.tb.items.map,c=this.getDoc();if(this.enableFont&&!Ext.isSafari2){var a=(c.queryCommandValue("FontName")||this.defaultFont).toLowerCase();if(a!=this.fontSelect.dom.value){this.fontSelect.dom.value=a}}if(this.enableFormat){b.bold.toggle(c.queryCommandState("bold"));b.italic.toggle(c.queryCommandState("italic"));b.underline.toggle(c.queryCommandState("underline"))}if(this.enableAlignments){b.justifyleft.toggle(c.queryCommandState("justifyleft"));b.justifycenter.toggle(c.queryCommandState("justifycenter"));b.justifyright.toggle(c.queryCommandState("justifyright"))}if(!Ext.isSafari2&&this.enableLists){b.insertorderedlist.toggle(c.queryCommandState("insertorderedlist"));b.insertunorderedlist.toggle(c.queryCommandState("insertunorderedlist"))}Ext.menu.MenuMgr.hideAll();this.syncValue()},relayBtnCmd:function(a){this.relayCmd(a.getItemId())},relayCmd:function(b,a){(function(){this.focus();this.execCmd(b,a);this.updateToolbar()}).defer(10,this)},execCmd:function(b,a){var c=this.getDoc();c.execCommand(b,false,a===undefined?null:a);this.syncValue()},applyCommand:function(b){if(b.ctrlKey){var d=b.getCharCode(),a;if(d>0){d=String.fromCharCode(d);switch(d){case"b":a="bold";break;case"i":a="italic";break;case"u":a="underline";break}if(a){this.win.focus();this.execCmd(a);this.deferFocus();b.preventDefault()}}}},insertAtCursor:function(c){if(!this.activated){return}if(Ext.isIE){this.win.focus();var b=this.getDoc(),a=b.selection.createRange();if(a){a.pasteHTML(c);this.syncValue();this.deferFocus()}}else{this.win.focus();this.execCmd("InsertHTML",c);this.deferFocus()}},fixKeys:function(){if(Ext.isIE){return function(g){var a=g.getKey(),d=this.getDoc(),b;if(a==g.TAB){g.stopEvent();b=d.selection.createRange();if(b){b.collapse(true);b.pasteHTML("    ");this.deferFocus()}}else{if(a==g.ENTER){b=d.selection.createRange();if(b){var c=b.parentElement();if(!c||c.tagName.toLowerCase()!="li"){g.stopEvent();b.pasteHTML("
");b.collapse(false);b.select()}}}}}}else{if(Ext.isOpera){return function(b){var a=b.getKey();if(a==b.TAB){b.stopEvent();this.win.focus();this.execCmd("InsertHTML","    ");this.deferFocus()}}}else{if(Ext.isWebKit){return function(b){var a=b.getKey();if(a==b.TAB){b.stopEvent();this.execCmd("InsertText","\t");this.deferFocus()}else{if(a==b.ENTER){b.stopEvent();this.execCmd("InsertHtml","

");this.deferFocus()}}}}}}}(),getToolbar:function(){return this.tb},buttonTips:{bold:{title:"Bold (Ctrl+B)",text:"Make the selected text bold.",cls:"x-html-editor-tip"},italic:{title:"Italic (Ctrl+I)",text:"Make the selected text italic.",cls:"x-html-editor-tip"},underline:{title:"Underline (Ctrl+U)",text:"Underline the selected text.",cls:"x-html-editor-tip"},increasefontsize:{title:"Grow Text",text:"Increase the font size.",cls:"x-html-editor-tip"},decreasefontsize:{title:"Shrink Text",text:"Decrease the font size.",cls:"x-html-editor-tip"},backcolor:{title:"Text Highlight Color",text:"Change the background color of the selected text.",cls:"x-html-editor-tip"},forecolor:{title:"Font Color",text:"Change the color of the selected text.",cls:"x-html-editor-tip"},justifyleft:{title:"Align Text Left",text:"Align text to the left.",cls:"x-html-editor-tip"},justifycenter:{title:"Center Text",text:"Center text in the editor.",cls:"x-html-editor-tip"},justifyright:{title:"Align Text Right",text:"Align text to the right.",cls:"x-html-editor-tip"},insertunorderedlist:{title:"Bullet List",text:"Start a bulleted list.",cls:"x-html-editor-tip"},insertorderedlist:{title:"Numbered List",text:"Start a numbered list.",cls:"x-html-editor-tip"},createlink:{title:"Hyperlink",text:"Make the selected text a hyperlink.",cls:"x-html-editor-tip"},sourceedit:{title:"Source Edit",text:"Switch to source editing mode.",cls:"x-html-editor-tip"}}});Ext.reg("htmleditor",Ext.form.HtmlEditor);Ext.form.TimeField=Ext.extend(Ext.form.ComboBox,{minValue:undefined,maxValue:undefined,minText:"The time in this field must be equal to or after {0}",maxText:"The time in this field must be equal to or before {0}",invalidText:"{0} is not a valid time",format:"g:i A",altFormats:"g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H|gi a|hi a|giA|hiA|gi A|hi A",increment:15,mode:"local",triggerAction:"all",typeAhead:false,initDate:"1/1/2008",initDateFormat:"j/n/Y",initComponent:function(){if(Ext.isDefined(this.minValue)){this.setMinValue(this.minValue,true)}if(Ext.isDefined(this.maxValue)){this.setMaxValue(this.maxValue,true)}if(!this.store){this.generateStore(true)}Ext.form.TimeField.superclass.initComponent.call(this)},setMinValue:function(b,a){this.setLimit(b,true,a);return this},setMaxValue:function(b,a){this.setLimit(b,false,a);return this},generateStore:function(b){var c=this.minValue||new Date(this.initDate).clearTime(),a=this.maxValue||new Date(this.initDate).clearTime().add("mi",(24*60)-1),d=[];while(c<=a){d.push(c.dateFormat(this.format));c=c.add("mi",this.increment)}this.bindStore(d,b)},setLimit:function(b,g,a){var e;if(Ext.isString(b)){e=this.parseDate(b)}else{if(Ext.isDate(b)){e=b}}if(e){var c=new Date(this.initDate).clearTime();c.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds());this[g?"minValue":"maxValue"]=c;if(!a){this.generateStore()}}},getValue:function(){var a=Ext.form.TimeField.superclass.getValue.call(this);return this.formatDate(this.parseDate(a))||""},setValue:function(a){return Ext.form.TimeField.superclass.setValue.call(this,this.formatDate(this.parseDate(a)))},validateValue:Ext.form.DateField.prototype.validateValue,formatDate:Ext.form.DateField.prototype.formatDate,parseDate:function(h){if(!h||Ext.isDate(h)){return h}var j=this.initDate+" ",g=this.initDateFormat+" ",b=Date.parseDate(j+h,g+this.format),c=this.altFormats;if(!b&&c){if(!this.altFormatsArray){this.altFormatsArray=c.split("|")}for(var e=0,d=this.altFormatsArray,a=d.length;e=0){if(!d){c=g-1}d=false;while(c>=0){if(e.call(j||this,k,c,i)===true){return[k,c]}c--}k--}}else{if(c>=g){k++;d=false}while(k','
','
{header}
','
{body}
',"
",'
 
','
 
',"")}if(!c.header){c.header=new Ext.Template('','{cells}',"
")}if(!c.hcell){c.hcell=new Ext.Template('
',this.grid.enableHdMenu?'':"",'{value}',"
")}if(!c.body){c.body=new Ext.Template("{rows}")}if(!c.row){c.row=new Ext.Template('
',"{cells}",(this.enableRowBody?'':""),"
{body}
")}if(!c.cell){c.cell=new Ext.Template('','
{value}
',"")}for(var a in c){var b=c[a];if(b&&Ext.isFunction(b.compile)&&!b.compiled){b.disableFormats=true;b.compile()}}this.templates=c;this.colRe=new RegExp("x-grid3-td-([^\\s]+)","")},fly:function(a){if(!this._flyweight){this._flyweight=new Ext.Element.Flyweight(document.body)}this._flyweight.dom=a;return this._flyweight},getEditorParent:function(){return this.scroller.dom},initElements:function(){var c=Ext.Element;var b=this.grid.getGridEl().dom.firstChild;var a=b.childNodes;this.el=new c(b);this.mainWrap=new c(a[0]);this.mainHd=new c(this.mainWrap.dom.firstChild);if(this.grid.hideHeaders){this.mainHd.setDisplayed(false)}this.innerHd=this.mainHd.dom.firstChild;this.scroller=new c(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new c(this.scroller.dom.firstChild);this.focusEl=new c(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new c(a[1]);this.resizeProxy=new c(a[2])},getRows:function(){return this.hasRows()?this.mainBody.dom.childNodes:[]},findCell:function(a){if(!a){return false}return this.fly(a).findParent(this.cellSelector,this.cellSelectorDepth)},findCellIndex:function(c,b){var a=this.findCell(c);if(a&&(!b||this.fly(a).hasClass(b))){return this.getCellIndex(a)}return false},getCellIndex:function(b){if(b){var a=b.className.match(this.colRe);if(a&&a[1]){return this.cm.getIndexById(a[1])}}return false},findHeaderCell:function(b){var a=this.findCell(b);return a&&this.fly(a).hasClass(this.hdCls)?a:null},findHeaderIndex:function(a){return this.findCellIndex(a,this.hdCls)},findRow:function(a){if(!a){return false}return this.fly(a).findParent(this.rowSelector,this.rowSelectorDepth)},findRowIndex:function(a){var b=this.findRow(a);return b?b.rowIndex:false},findRowBody:function(a){if(!a){return false}return this.fly(a).findParent(this.rowBodySelector,this.rowBodySelectorDepth)},getRow:function(a){return this.getRows()[a]},getCell:function(b,a){return this.getRow(b).getElementsByTagName("td")[a]},getHeaderCell:function(a){return this.mainHd.dom.getElementsByTagName("td")[a]},addRowClass:function(c,a){var b=this.getRow(c);if(b){this.fly(b).addClass(a)}},removeRowClass:function(c,a){var b=this.getRow(c);if(b){this.fly(b).removeClass(a)}},removeRow:function(a){Ext.removeNode(this.getRow(a));this.syncFocusEl(a)},removeRows:function(c,a){var b=this.mainBody.dom;for(var d=c;d<=a;d++){Ext.removeNode(b.childNodes[c])}this.syncFocusEl(c)},getScrollState:function(){var a=this.scroller.dom;return{left:a.scrollLeft,top:a.scrollTop}},restoreScroll:function(a){var b=this.scroller.dom;b.scrollLeft=a.left;b.scrollTop=a.top},scrollToTop:function(){this.scroller.dom.scrollTop=0;this.scroller.dom.scrollLeft=0},syncScroll:function(){this.syncHeaderScroll();var a=this.scroller.dom;this.grid.fireEvent("bodyscroll",a.scrollLeft,a.scrollTop)},syncHeaderScroll:function(){var a=this.scroller.dom;this.innerHd.scrollLeft=a.scrollLeft;this.innerHd.scrollLeft=a.scrollLeft},updateSortIcon:function(b,a){var d=this.sortClasses;var c=this.mainHd.select("td").removeClass(d);c.item(b).addClass(d[a=="DESC"?1:0])},updateAllColumnWidths:function(){var d=this.getTotalWidth(),l=this.cm.getColumnCount(),g=[],e,b;for(b=0;b=this.ds.getCount()){return null}d=(d!==undefined?d:0);var c=this.getRow(h),a=this.cm,e=a.getColumnCount(),b;if(!(g===false&&d===0)){while(dm){n.scrollTop=q-a}}if(e!==false){var l=parseInt(h.offsetLeft,10);var j=l+h.offsetWidth;var i=parseInt(n.scrollLeft,10);var b=i+n.clientWidth;if(lb){n.scrollLeft=j-n.clientWidth}}}return this.getResolvedXY(r)},insertRows:function(a,i,e,h){var d=a.getCount()-1;if(!h&&i===0&&e>=d){this.fireEvent("beforerowsinserted",this,i,e);this.refresh();this.fireEvent("rowsinserted",this,i,e)}else{if(!h){this.fireEvent("beforerowsinserted",this,i,e)}var b=this.renderRows(i,e),g=this.getRow(i);if(g){if(i===0){Ext.fly(this.getRow(0)).removeClass(this.firstRowCls)}Ext.DomHelper.insertHtml("beforeBegin",g,b)}else{var c=this.getRow(d-1);if(c){Ext.fly(c).removeClass(this.lastRowCls)}Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,b)}if(!h){this.fireEvent("rowsinserted",this,i,e);this.processRows(i)}else{if(i===0||i>=d){Ext.fly(this.getRow(i)).addClass(i===0?this.firstRowCls:this.lastRowCls)}}}this.syncFocusEl(i)},deleteRows:function(a,c,b){if(a.getRowCount()<1){this.refresh()}else{this.fireEvent("beforerowsdeleted",this,c,b);this.removeRows(c,b);this.processRows(c);this.fireEvent("rowsdeleted",this,c,b)}},getColumnStyle:function(a,c){var b=!c?(this.cm.config[a].css||""):"";b+="width:"+this.getColumnWidth(a)+";";if(this.cm.isHidden(a)){b+="display:none;"}var d=this.cm.config[a].align;if(d){b+="text-align:"+d+";"}return b},getColumnWidth:function(b){var a=this.cm.getColumnWidth(b);if(Ext.isNumber(a)){return(Ext.isBorderBox||(Ext.isWebKit&&!Ext.isSafari2)?a:(a-this.borderWidth>0?a-this.borderWidth:0))+"px"}return a},getTotalWidth:function(){return this.cm.getTotalWidth()+"px"},fitColumns:function(d,h,j){var q=this.cm,k;var l=q.getTotalWidth(false);var a=this.grid.getGridEl().getWidth(true)-this.getScrollOffset();if(a<20){return}var e=a-l;if(e===0){return false}var m=q.getColumnCount(true);var s=m-(Ext.isNumber(j)?1:0);if(s===0){s=1;j=undefined}var r=q.getColumnCount();var o=[];var n=0;var c=0;var p;for(k=0;ka){var g=s!=m?j:n;q.setColumnWidth(g,Math.max(1,q.getColumnWidth(g)-(l-a)),true)}if(d!==true){this.updateAllColumnWidths()}return true},autoExpand:function(b){var i=this.grid,a=this.cm;if(!this.userResized&&i.autoExpandColumn){var d=a.getTotalWidth(false);var j=this.grid.getGridEl().getWidth(true)-this.getScrollOffset();if(d!=j){var h=a.getIndexById(i.autoExpandColumn);var e=a.getColumnWidth(h);var c=Math.min(Math.max(((j-d)+e),i.autoExpandMin),i.autoExpandMax);if(c!=e){a.setColumnWidth(h,c,true);if(b!==true){this.updateColumnWidth(h,c)}}}}},getColumnData:function(){var d=[],a=this.cm,e=a.getColumnCount();for(var c=0;c'+this.emptyText+"")}},updateHeaderSortState:function(){var b=this.ds.getSortState();if(!b){return}if(!this.sortState||(this.sortState.field!=b.field||this.sortState.direction!=b.direction)){this.grid.fireEvent("sortchange",this.grid,b)}this.sortState=b;var c=this.cm.findColumnIndex(b.field);if(c!=-1){var a=b.direction;this.updateSortIcon(c,a)}},clearHeaderSortState:function(){if(!this.sortState){return}this.grid.fireEvent("sortchange",this.grid,null);this.mainHd.select("td").removeClass(this.sortClasses);delete this.sortState},destroy:function(){if(this.scrollToTopTask&&this.scrollToTopTask.cancel){this.scrollToTopTask.cancel()}if(this.colMenu){Ext.menu.MenuMgr.unregister(this.colMenu);this.colMenu.destroy();delete this.colMenu}if(this.hmenu){Ext.menu.MenuMgr.unregister(this.hmenu);this.hmenu.destroy();delete this.hmenu}this.initData(null,null);this.purgeListeners();Ext.fly(this.innerHd).un("click",this.handleHdDown,this);if(this.grid.enableColumnMove){Ext.destroy(this.columnDrag.el,this.columnDrag.proxy.ghost,this.columnDrag.proxy.el,this.columnDrop.el,this.columnDrop.proxyTop,this.columnDrop.proxyBottom,this.columnDrag.dragData.ddel,this.columnDrag.dragData.header);if(this.columnDrag.proxy.anim){Ext.destroy(this.columnDrag.proxy.anim)}delete this.columnDrag.proxy.ghost;delete this.columnDrag.dragData.ddel;delete this.columnDrag.dragData.header;this.columnDrag.destroy();delete Ext.dd.DDM.locationCache[this.columnDrag.id];delete this.columnDrag._domRef;delete this.columnDrop.proxyTop;delete this.columnDrop.proxyBottom;this.columnDrop.destroy();delete Ext.dd.DDM.locationCache["gridHeader"+this.grid.getGridEl().id];delete this.columnDrop._domRef;delete Ext.dd.DDM.ids[this.columnDrop.ddGroup]}if(this.splitZone){this.splitZone.destroy();delete this.splitZone._domRef;delete Ext.dd.DDM.ids["gridSplitters"+this.grid.getGridEl().id]}Ext.fly(this.innerHd).removeAllListeners();Ext.removeNode(this.innerHd);delete this.innerHd;Ext.destroy(this.el,this.mainWrap,this.mainHd,this.scroller,this.mainBody,this.focusEl,this.resizeMarker,this.resizeProxy,this.activeHdBtn,this.dragZone,this.splitZone,this._flyweight);delete this.grid.container;if(this.dragZone){this.dragZone.destroy()}Ext.dd.DDM.currentTarget=null;delete Ext.dd.DDM.locationCache[this.grid.getGridEl().id];Ext.EventManager.removeResizeListener(this.onWindowResize,this)},onDenyColumnHide:function(){},render:function(){if(this.autoFill){var a=this.grid.ownerCt;if(a&&a.getLayout()){a.on("afterlayout",function(){this.fitColumns(true,true);this.updateHeaders()},this,{single:true})}else{this.fitColumns(true,true)}}else{if(this.forceFit){this.fitColumns(true,false)}else{if(this.grid.autoExpandColumn){this.autoExpand(true)}}}this.renderUI()},initData:function(b,a){if(this.ds){this.ds.un("load",this.onLoad,this);this.ds.un("datachanged",this.onDataChange,this);this.ds.un("add",this.onAdd,this);this.ds.un("remove",this.onRemove,this);this.ds.un("update",this.onUpdate,this);this.ds.un("clear",this.onClear,this);if(this.ds!==b&&this.ds.autoDestroy){this.ds.destroy()}}if(b){b.on({scope:this,load:this.onLoad,datachanged:this.onDataChange,add:this.onAdd,remove:this.onRemove,update:this.onUpdate,clear:this.onClear})}this.ds=b;if(this.cm){this.cm.un("configchange",this.onColConfigChange,this);this.cm.un("widthchange",this.onColWidthChange,this);this.cm.un("headerchange",this.onHeaderChange,this);this.cm.un("hiddenchange",this.onHiddenChange,this);this.cm.un("columnmoved",this.onColumnMove,this)}if(a){delete this.lastViewWidth;a.on({scope:this,configchange:this.onColConfigChange,widthchange:this.onColWidthChange,headerchange:this.onHeaderChange,hiddenchange:this.onHiddenChange,columnmoved:this.onColumnMove})}this.cm=a},onDataChange:function(){this.refresh();this.updateHeaderSortState();this.syncFocusEl(0)},onClear:function(){this.refresh();this.syncFocusEl(0)},onUpdate:function(b,a){this.refreshRow(a)},onAdd:function(c,a,b){this.insertRows(c,b,b+(a.length-1))},onRemove:function(d,a,b,c){if(c!==true){this.fireEvent("beforerowremoved",this,b,a)}this.removeRow(b);if(c!==true){this.processRows(b);this.applyEmptyText();this.fireEvent("rowremoved",this,b,a)}},onLoad:function(){if(Ext.isGecko){if(!this.scrollToTopTask){this.scrollToTopTask=new Ext.util.DelayedTask(this.scrollToTop,this)}this.scrollToTopTask.delay(1)}else{this.scrollToTop()}},onColWidthChange:function(a,b,c){this.updateColumnWidth(b,c)},onHeaderChange:function(a,b,c){this.updateHeaders()},onHiddenChange:function(a,b,c){this.updateColumnHidden(b,c)},onColumnMove:function(a,d,b){this.indexMap=null;var c=this.getScrollState();this.refresh(true);this.restoreScroll(c);this.afterMove(b);this.grid.fireEvent("columnmove",d,b)},onColConfigChange:function(){delete this.lastViewWidth;this.indexMap=null;this.refresh(true)},initUI:function(a){a.on("headerclick",this.onHeaderClick,this)},initEvents:function(){},onHeaderClick:function(b,a){if(this.headersDisabled||!this.cm.isSortable(a)){return}b.stopEditing(true);b.store.sort(this.cm.getDataIndex(a))},onRowOver:function(b,a){var c;if((c=this.findRowIndex(a))!==false){this.addRowClass(c,"x-grid3-row-over")}},onRowOut:function(b,a){var c;if((c=this.findRowIndex(a))!==false&&!b.within(this.getRow(c),true)){this.removeRowClass(c,"x-grid3-row-over")}},handleWheel:function(a){a.stopPropagation()},onRowSelect:function(a){this.addRowClass(a,this.selectedRowClass)},onRowDeselect:function(a){this.removeRowClass(a,this.selectedRowClass)},onCellSelect:function(c,b){var a=this.getCell(c,b);if(a){this.fly(a).addClass("x-grid3-cell-selected")}},onCellDeselect:function(c,b){var a=this.getCell(c,b);if(a){this.fly(a).removeClass("x-grid3-cell-selected")}},onColumnSplitterMoved:function(c,b){this.userResized=true;var a=this.grid.colModel;a.setColumnWidth(c,b,true);if(this.forceFit){this.fitColumns(true,false,c);this.updateAllColumnWidths()}else{this.updateColumnWidth(c,b);this.syncHeaderScroll()}this.grid.fireEvent("columnresize",c,b)},handleHdMenuClick:function(c){var b=this.hdCtxIndex,a=this.cm,d=this.ds,e=c.getItemId();switch(e){case"asc":d.sort(a.getDataIndex(b),"ASC");break;case"desc":d.sort(a.getDataIndex(b),"DESC");break;default:b=a.getIndexById(e.substr(4));if(b!=-1){if(c.checked&&a.getColumnsBy(this.isHideableColumn,this).length<=1){this.onDenyColumnHide();return false}a.setHidden(b,c.checked)}}return true},isHideableColumn:function(a){return !a.hidden},beforeColMenuShow:function(){var a=this.cm,c=a.getColumnCount();this.colMenu.removeAll();for(var b=0;b=0&&this.config[a].resizable!==false&&this.config[a].fixed!==true},setHidden:function(a,b){var d=this.config[a];if(d.hidden!==b){d.hidden=b;this.totalWidth=null;this.fireEvent("hiddenchange",this,a,b)}},setEditor:function(a,b){this.config[a].setEditor(b)},destroy:function(){var d;for(var b=0,a=this.config.length;b0},isSelected:function(a){var b=Ext.isNumber(a)?this.grid.store.getAt(a):a;return(b&&this.selections.key(b.id)?true:false)},isIdSelected:function(a){return(this.selections.key(a)?true:false)},handleMouseDown:function(d,i,h){if(h.button!==0||this.isLocked()){return}var a=this.grid.getView();if(h.shiftKey&&!this.singleSelect&&this.last!==false){var c=this.last;this.selectRange(c,i,h.ctrlKey);this.last=c;a.focusRow(i)}else{var b=this.isSelected(i);if(h.ctrlKey&&b){this.deselectRow(i)}else{if(!b||this.getCount()>1){this.selectRow(i,h.ctrlKey||h.shiftKey);a.focusRow(i)}}}},selectRows:function(c,d){if(!d){this.clearSelections()}for(var b=0,a=c.length;b=a;c--){this.selectRow(c,true)}}},deselectRange:function(c,b,a){if(this.isLocked()){return}for(var d=c;d<=b;d++){this.deselectRow(d,a)}},selectRow:function(b,d,a){if(this.isLocked()||(b<0||b>=this.grid.store.getCount())||(d&&this.isSelected(b))){return}var c=this.grid.store.getAt(b);if(c&&this.fireEvent("beforerowselect",this,b,d,c)!==false){if(!d||this.singleSelect){this.clearSelections()}this.selections.add(c);this.last=this.lastActive=b;if(!a){this.grid.getView().onRowSelect(b)}this.fireEvent("rowselect",this,b,c);this.fireEvent("selectionchange",this)}},deselectRow:function(b,a){if(this.isLocked()){return}if(this.last==b){this.last=false}if(this.lastActive==b){this.lastActive=false}var c=this.grid.store.getAt(b);if(c){this.selections.remove(c);if(!a){this.grid.getView().onRowDeselect(b)}this.fireEvent("rowdeselect",this,b,c);this.fireEvent("selectionchange",this)}},restoreLast:function(){if(this._last){this.last=this._last}},acceptsNav:function(c,b,a){return !a.isHidden(b)&&a.isCellEditable(b,c)},onEditorKey:function(n,l){var d=l.getKey(),h,i=this.grid,o=i.lastEdit,j=i.activeEditor,p,o,a,m;var b=l.shiftKey;if(d==l.TAB){l.stopEvent();j.completeEdit();if(b){h=i.walkCells(j.row,j.col-1,-1,this.acceptsNav,this)}else{h=i.walkCells(j.row,j.col+1,1,this.acceptsNav,this)}}else{if(d==l.ENTER){if(this.moveEditorOnEnter!==false){if(b){h=i.walkCells(o.row-1,o.col,-1,this.acceptsNav,this)}else{h=i.walkCells(o.row+1,o.col,1,this.acceptsNav,this)}}}}if(h){a=h[0];m=h[1];if(o.row!=a){this.selectRow(a)}if(i.isEditor&&i.editing){p=i.activeEditor;if(p&&p.field.triggerBlur){p.field.triggerBlur()}}i.startEditing(a,m)}},destroy:function(){if(this.rowNav){this.rowNav.disable();this.rowNav=null}Ext.grid.RowSelectionModel.superclass.destroy.call(this)}});Ext.grid.Column=Ext.extend(Object,{isColumn:true,constructor:function(b){Ext.apply(this,b);if(Ext.isString(this.renderer)){this.renderer=Ext.util.Format[this.renderer]}else{if(Ext.isObject(this.renderer)){this.scope=this.renderer.scope;this.renderer=this.renderer.fn}}if(!this.scope){this.scope=this}var a=this.editor;delete this.editor;this.setEditor(a)},renderer:function(a){if(Ext.isString(a)&&a.length<1){return" "}return a},getEditor:function(a){return this.editable!==false?this.editor:null},setEditor:function(b){var a=this.editor;if(a){if(a.gridEditor){a.gridEditor.destroy();delete a.gridEditor}else{a.destroy()}}this.editor=null;if(b){if(!b.isXType){b=Ext.create(b,"textfield")}this.editor=b}},getCellEditor:function(b){var a=this.getEditor(b);if(a){if(!a.startEdit){if(!a.gridEditor){a.gridEditor=new Ext.grid.GridEditor(a)}a=a.gridEditor}}return a}});Ext.grid.BooleanColumn=Ext.extend(Ext.grid.Column,{trueText:"true",falseText:"false",undefinedText:" ",constructor:function(a){Ext.grid.BooleanColumn.superclass.constructor.call(this,a);var c=this.trueText,d=this.falseText,b=this.undefinedText;this.renderer=function(e){if(e===undefined){return b}if(!e||e==="false"){return d}return c}}});Ext.grid.NumberColumn=Ext.extend(Ext.grid.Column,{format:"0,000.00",constructor:function(a){Ext.grid.NumberColumn.superclass.constructor.call(this,a);this.renderer=Ext.util.Format.numberRenderer(this.format)}});Ext.grid.DateColumn=Ext.extend(Ext.grid.Column,{format:"m/d/Y",constructor:function(a){Ext.grid.DateColumn.superclass.constructor.call(this,a);this.renderer=Ext.util.Format.dateRenderer(this.format)}});Ext.grid.TemplateColumn=Ext.extend(Ext.grid.Column,{constructor:function(a){Ext.grid.TemplateColumn.superclass.constructor.call(this,a);var b=(!Ext.isPrimitive(this.tpl)&&this.tpl.compile)?this.tpl:new Ext.XTemplate(this.tpl);this.renderer=function(d,e,c){return b.apply(c.data)};this.tpl=b}});Ext.grid.Column.types={gridcolumn:Ext.grid.Column,booleancolumn:Ext.grid.BooleanColumn,numbercolumn:Ext.grid.NumberColumn,datecolumn:Ext.grid.DateColumn,templatecolumn:Ext.grid.TemplateColumn};Ext.grid.RowNumberer=Ext.extend(Object,{header:"",width:23,sortable:false,constructor:function(a){Ext.apply(this,a);if(this.rowspan){this.renderer=this.renderer.createDelegate(this)}},fixed:true,hideable:false,menuDisabled:true,dataIndex:"",id:"numberer",rowspan:undefined,renderer:function(b,c,a,d){if(this.rowspan){c.cellAttr='rowspan="'+this.rowspan+'"'}return d+1}});Ext.grid.CheckboxSelectionModel=Ext.extend(Ext.grid.RowSelectionModel,{header:'
 
',width:20,sortable:false,menuDisabled:true,fixed:true,hideable:false,dataIndex:"",id:"checker",constructor:function(){Ext.grid.CheckboxSelectionModel.superclass.constructor.apply(this,arguments);if(this.checkOnly){this.handleMouseDown=Ext.emptyFn}},initEvents:function(){Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);this.grid.on("render",function(){var a=this.grid.getView();a.mainBody.on("mousedown",this.onMouseDown,this);Ext.fly(a.innerHd).on("mousedown",this.onHdMouseDown,this)},this)},handleMouseDown:function(){Ext.grid.CheckboxSelectionModel.superclass.handleMouseDown.apply(this,arguments);this.mouseHandled=true},onMouseDown:function(c,b){if(c.button===0&&b.className=="x-grid3-row-checker"){c.stopEvent();var d=c.getTarget(".x-grid3-row");if(!this.mouseHandled&&d){var a=d.rowIndex;if(this.isSelected(a)){this.deselectRow(a)}else{this.selectRow(a,true)}}}this.mouseHandled=false},onHdMouseDown:function(c,a){if(a.className=="x-grid3-hd-checker"){c.stopEvent();var b=Ext.fly(a.parentNode);var d=b.hasClass("x-grid3-hd-checker-on");if(d){b.removeClass("x-grid3-hd-checker-on");this.clearSelections()}else{b.addClass("x-grid3-hd-checker-on");this.selectAll()}}},renderer:function(b,c,a){return'
 
'}});Ext.grid.CellSelectionModel=Ext.extend(Ext.grid.AbstractSelectionModel,{constructor:function(a){Ext.apply(this,a);this.selection=null;this.addEvents("beforecellselect","cellselect","selectionchange");Ext.grid.CellSelectionModel.superclass.constructor.call(this)},initEvents:function(){this.grid.on("cellmousedown",this.handleMouseDown,this);this.grid.on(Ext.EventManager.useKeydown?"keydown":"keypress",this.handleKeyDown,this);this.grid.getView().on({scope:this,refresh:this.onViewChange,rowupdated:this.onRowUpdated,beforerowremoved:this.clearSelections,beforerowsinserted:this.clearSelections});if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this)}},beforeEdit:function(a){this.select(a.row,a.column,false,true,a.record)},onRowUpdated:function(a,b,c){if(this.selection&&this.selection.record==c){a.onCellSelect(b,this.selection.cell[1])}},onViewChange:function(){this.clearSelections(true)},getSelectedCell:function(){return this.selection?this.selection.cell:null},clearSelections:function(b){var a=this.selection;if(a){if(b!==true){this.grid.view.onCellDeselect(a.cell[0],a.cell[1])}this.selection=null;this.fireEvent("selectionchange",this,null)}},hasSelection:function(){return this.selection?true:false},handleMouseDown:function(b,d,a,c){if(c.button!==0||this.isLocked()){return}this.select(d,a)},select:function(g,c,b,e,d){if(this.fireEvent("beforecellselect",this,g,c)!==false){this.clearSelections();d=d||this.grid.store.getAt(g);this.selection={record:d,cell:[g,c]};if(!b){var a=this.grid.getView();a.onCellSelect(g,c);if(e!==true){a.focusCell(g,c)}}this.fireEvent("cellselect",this,g,c);this.fireEvent("selectionchange",this,this.selection)}},isSelectable:function(c,b,a){return !a.isHidden(b)},onEditorKey:function(b,a){if(a.getKey()==a.TAB){this.handleKeyDown(a)}},handleKeyDown:function(j){if(!j.isNavKeyPress()){return}var d=j.getKey(),i=this.grid,p=this.selection,b=this,m=function(g,c,e){return i.walkCells(g,c,e,i.isEditor&&i.editing?b.acceptsNav:b.isSelectable,b)},o,h,a,l,n;switch(d){case j.ESC:case j.PAGE_UP:case j.PAGE_DOWN:break;default:j.stopEvent();break}if(!p){o=m(0,0,1);if(o){this.select(o[0],o[1])}return}o=p.cell;a=o[0];l=o[1];switch(d){case j.TAB:if(j.shiftKey){h=m(a,l-1,-1)}else{h=m(a,l+1,1)}break;case j.DOWN:h=m(a+1,l,1);break;case j.UP:h=m(a-1,l,-1);break;case j.RIGHT:h=m(a,l+1,1);break;case j.LEFT:h=m(a,l-1,-1);break;case j.ENTER:if(i.isEditor&&!i.editing){i.startEditing(a,l);return}break}if(h){a=h[0];l=h[1];this.select(a,l);if(i.isEditor&&i.editing){n=i.activeEditor;if(n&&n.field.triggerBlur){n.field.triggerBlur()}i.startEditing(a,l)}}},acceptsNav:function(c,b,a){return !a.isHidden(b)&&a.isCellEditable(b,c)}});Ext.grid.EditorGridPanel=Ext.extend(Ext.grid.GridPanel,{clicksToEdit:2,forceValidation:false,isEditor:true,detectEdit:false,autoEncode:false,trackMouseOver:false,initComponent:function(){Ext.grid.EditorGridPanel.superclass.initComponent.call(this);if(!this.selModel){this.selModel=new Ext.grid.CellSelectionModel()}this.activeEditor=null;this.addEvents("beforeedit","afteredit","validateedit")},initEvents:function(){Ext.grid.EditorGridPanel.superclass.initEvents.call(this);this.getGridEl().on("mousewheel",this.stopEditing.createDelegate(this,[true]),this);this.on("columnresize",this.stopEditing,this,[true]);if(this.clicksToEdit==1){this.on("cellclick",this.onCellDblClick,this)}else{var a=this.getView();if(this.clicksToEdit=="auto"&&a.mainBody){a.mainBody.on("mousedown",this.onAutoEditClick,this)}this.on("celldblclick",this.onCellDblClick,this)}},onResize:function(){Ext.grid.EditorGridPanel.superclass.onResize.apply(this,arguments);var a=this.activeEditor;if(this.editing&&a){a.realign(true)}},onCellDblClick:function(b,c,a){this.startEditing(c,a)},onAutoEditClick:function(c,b){if(c.button!==0){return}var g=this.view.findRowIndex(b),a=this.view.findCellIndex(b);if(g!==false&&a!==false){this.stopEditing();if(this.selModel.getSelectedCell){var d=this.selModel.getSelectedCell();if(d&&d[0]===g&&d[1]===a){this.startEditing(g,a)}}else{if(this.selModel.isSelected(g)){this.startEditing(g,a)}}}},onEditComplete:function(b,d,a){this.editing=false;this.lastActiveEditor=this.activeEditor;this.activeEditor=null;var c=b.record,h=this.colModel.getDataIndex(b.col);d=this.postEditValue(d,a,c,h);if(this.forceValidation===true||String(d)!==String(a)){var g={grid:this,record:c,field:h,originalValue:a,value:d,row:b.row,column:b.col,cancel:false};if(this.fireEvent("validateedit",g)!==false&&!g.cancel&&String(d)!==String(a)){c.set(h,g.value);delete g.cancel;this.fireEvent("afteredit",g)}}this.view.focusCell(b.row,b.col)},startEditing:function(i,c){this.stopEditing();if(this.colModel.isCellEditable(c,i)){this.view.ensureVisible(i,c,true);var d=this.store.getAt(i),h=this.colModel.getDataIndex(c),g={grid:this,record:d,field:h,value:d.data[h],row:i,column:c,cancel:false};if(this.fireEvent("beforeedit",g)!==false&&!g.cancel){this.editing=true;var b=this.colModel.getCellEditor(c,i);if(!b){return}if(!b.rendered){b.parentEl=this.view.getEditorParent(b);b.on({scope:this,render:{fn:function(e){e.field.focus(false,true)},single:true,scope:this},specialkey:function(k,j){this.getSelectionModel().onEditorKey(k,j)},complete:this.onEditComplete,canceledit:this.stopEditing.createDelegate(this,[true])})}Ext.apply(b,{row:i,col:c,record:d});this.lastEdit={row:i,col:c};this.activeEditor=b;b.selectSameEditor=(this.activeEditor==this.lastActiveEditor);var a=this.preEditValue(d,h);b.startEdit(this.view.getCell(i,c).firstChild,Ext.isDefined(a)?a:"");(function(){delete b.selectSameEditor}).defer(50)}}},preEditValue:function(a,c){var b=a.data[c];return this.autoEncode&&Ext.isString(b)?Ext.util.Format.htmlDecode(b):b},postEditValue:function(c,a,b,d){return this.autoEncode&&Ext.isString(c)?Ext.util.Format.htmlEncode(c):c},stopEditing:function(b){if(this.editing){var a=this.lastActiveEditor=this.activeEditor;if(a){a[b===true?"cancelEdit":"completeEdit"]();this.view.focusCell(a.row,a.col)}this.activeEditor=null}this.editing=false}});Ext.reg("editorgrid",Ext.grid.EditorGridPanel);Ext.grid.GridEditor=function(b,a){Ext.grid.GridEditor.superclass.constructor.call(this,b,a);b.monitorTab=false};Ext.extend(Ext.grid.GridEditor,Ext.Editor,{alignment:"tl-tl",autoSize:"width",hideEl:false,cls:"x-small-editor x-grid-editor",shim:false,shadow:false});Ext.grid.PropertyRecord=Ext.data.Record.create([{name:"name",type:"string"},"value"]);Ext.grid.PropertyStore=Ext.extend(Ext.util.Observable,{constructor:function(a,b){this.grid=a;this.store=new Ext.data.Store({recordType:Ext.grid.PropertyRecord});this.store.on("update",this.onUpdate,this);if(b){this.setSource(b)}Ext.grid.PropertyStore.superclass.constructor.call(this)},setSource:function(c){this.source=c;this.store.removeAll();var b=[];for(var a in c){if(this.isEditableValue(c[a])){b.push(new Ext.grid.PropertyRecord({name:a,value:c[a]},a))}}this.store.loadRecords({records:b},{},true)},onUpdate:function(e,a,d){if(d==Ext.data.Record.EDIT){var b=a.data.value;var c=a.modified.value;if(this.grid.fireEvent("beforepropertychange",this.source,a.id,b,c)!==false){this.source[a.id]=b;a.commit();this.grid.fireEvent("propertychange",this.source,a.id,b,c)}else{a.reject()}}},getProperty:function(a){return this.store.getAt(a)},isEditableValue:function(a){return Ext.isPrimitive(a)||Ext.isDate(a)},setValue:function(d,c,a){var b=this.getRec(d);if(b){b.set("value",c);this.source[d]=c}else{if(a){this.source[d]=c;b=new Ext.grid.PropertyRecord({name:d,value:c},d);this.store.add(b)}}},remove:function(b){var a=this.getRec(b);if(a){this.store.remove(a);delete this.source[b]}},getRec:function(a){return this.store.getById(a)},getSource:function(){return this.source}});Ext.grid.PropertyColumnModel=Ext.extend(Ext.grid.ColumnModel,{nameText:"Name",valueText:"Value",dateFormat:"m/j/Y",trueText:"true",falseText:"false",constructor:function(c,b){var d=Ext.grid,e=Ext.form;this.grid=c;d.PropertyColumnModel.superclass.constructor.call(this,[{header:this.nameText,width:50,sortable:true,dataIndex:"name",id:"name",menuDisabled:true},{header:this.valueText,width:50,resizable:false,dataIndex:"value",id:"value",menuDisabled:true}]);this.store=b;var a=new e.Field({autoCreate:{tag:"select",children:[{tag:"option",value:"true",html:this.trueText},{tag:"option",value:"false",html:this.falseText}]},getValue:function(){return this.el.dom.value=="true"}});this.editors={date:new d.GridEditor(new e.DateField({selectOnFocus:true})),string:new d.GridEditor(new e.TextField({selectOnFocus:true})),number:new d.GridEditor(new e.NumberField({selectOnFocus:true,style:"text-align:left;"})),"boolean":new d.GridEditor(a,{autoSize:"both"})};this.renderCellDelegate=this.renderCell.createDelegate(this);this.renderPropDelegate=this.renderProp.createDelegate(this)},renderDate:function(a){return a.dateFormat(this.dateFormat)},renderBool:function(a){return this[a?"trueText":"falseText"]},isCellEditable:function(a,b){return a==1},getRenderer:function(a){return a==1?this.renderCellDelegate:this.renderPropDelegate},renderProp:function(a){return this.getPropertyName(a)},renderCell:function(d,b,c){var a=this.grid.customRenderers[c.get("name")];if(a){return a.apply(this,arguments)}var e=d;if(Ext.isDate(d)){e=this.renderDate(d)}else{if(typeof d=="boolean"){e=this.renderBool(d)}}return Ext.util.Format.htmlEncode(e)},getPropertyName:function(b){var a=this.grid.propertyNames;return a&&a[b]?a[b]:b},getCellEditor:function(a,e){var b=this.store.getProperty(e),d=b.data.name,c=b.data.value;if(this.grid.customEditors[d]){return this.grid.customEditors[d]}if(Ext.isDate(c)){return this.editors.date}else{if(typeof c=="number"){return this.editors.number}else{if(typeof c=="boolean"){return this.editors["boolean"]}else{return this.editors.string}}}},destroy:function(){Ext.grid.PropertyColumnModel.superclass.destroy.call(this);for(var a in this.editors){Ext.destroy(this.editors[a])}}});Ext.grid.PropertyGrid=Ext.extend(Ext.grid.EditorGridPanel,{enableColumnMove:false,stripeRows:false,trackMouseOver:false,clicksToEdit:1,enableHdMenu:false,viewConfig:{forceFit:true},initComponent:function(){this.customRenderers=this.customRenderers||{};this.customEditors=this.customEditors||{};this.lastEditRow=null;var b=new Ext.grid.PropertyStore(this);this.propStore=b;var a=new Ext.grid.PropertyColumnModel(this,b);b.store.sort("name","ASC");this.addEvents("beforepropertychange","propertychange");this.cm=a;this.ds=b.store;Ext.grid.PropertyGrid.superclass.initComponent.call(this);this.mon(this.selModel,"beforecellselect",function(e,d,c){if(c===0){this.startEditing.defer(200,this,[d,1]);return false}},this)},onRender:function(){Ext.grid.PropertyGrid.superclass.onRender.apply(this,arguments);this.getGridEl().addClass("x-props-grid")},afterRender:function(){Ext.grid.PropertyGrid.superclass.afterRender.apply(this,arguments);if(this.source){this.setSource(this.source)}},setSource:function(a){this.propStore.setSource(a)},getSource:function(){return this.propStore.getSource()},setProperty:function(c,b,a){this.propStore.setValue(c,b,a)},removeProperty:function(a){this.propStore.remove(a)}});Ext.reg("propertygrid",Ext.grid.PropertyGrid);Ext.grid.GroupingView=Ext.extend(Ext.grid.GridView,{groupByText:"Group By This Field",showGroupsText:"Show in Groups",hideGroupedColumn:false,showGroupName:true,startCollapsed:false,enableGrouping:true,enableGroupingMenu:true,enableNoGroups:true,emptyGroupText:"(None)",ignoreAdd:false,groupTextTpl:"{text}",groupMode:"value",initTemplates:function(){Ext.grid.GroupingView.superclass.initTemplates.call(this);this.state={};var a=this.grid.getSelectionModel();a.on(a.selectRow?"beforerowselect":"beforecellselect",this.onBeforeRowSelect,this);if(!this.startGroup){this.startGroup=new Ext.XTemplate('
','
',this.groupTextTpl,"
",'
')}this.startGroup.compile();if(!this.endGroup){this.endGroup="
"}},findGroup:function(a){return Ext.fly(a).up(".x-grid-group",this.mainBody.dom)},getGroups:function(){return this.hasRows()?this.mainBody.dom.childNodes:[]},onAdd:function(d,a,b){if(this.canGroup()&&!this.ignoreAdd){var c=this.getScrollState();this.fireEvent("beforerowsinserted",d,b,b+(a.length-1));this.refresh();this.restoreScroll(c);this.fireEvent("rowsinserted",d,b,b+(a.length-1))}else{if(!this.canGroup()){Ext.grid.GroupingView.superclass.onAdd.apply(this,arguments)}}},onRemove:function(e,a,b,d){Ext.grid.GroupingView.superclass.onRemove.apply(this,arguments);var c=document.getElementById(a._groupId);if(c&&c.childNodes[1].childNodes.length<1){Ext.removeNode(c)}this.applyEmptyText()},refreshRow:function(a){if(this.ds.getCount()==1){this.refresh()}else{this.isUpdating=true;Ext.grid.GroupingView.superclass.refreshRow.apply(this,arguments);this.isUpdating=false}},beforeMenuShow:function(){var c,a=this.hmenu.items,b=this.cm.config[this.hdCtxIndex].groupable===false;if((c=a.get("groupBy"))){c.setDisabled(b)}if((c=a.get("showGroups"))){c.setDisabled(b);c.setChecked(this.enableGrouping,true)}},renderUI:function(){Ext.grid.GroupingView.superclass.renderUI.call(this);this.mainBody.on("mousedown",this.interceptMouse,this);if(this.enableGroupingMenu&&this.hmenu){this.hmenu.add("-",{itemId:"groupBy",text:this.groupByText,handler:this.onGroupByClick,scope:this,iconCls:"x-group-by-icon"});if(this.enableNoGroups){this.hmenu.add({itemId:"showGroups",text:this.showGroupsText,checked:true,checkHandler:this.onShowGroupsClick,scope:this})}this.hmenu.on("beforeshow",this.beforeMenuShow,this)}},processEvent:function(b,h){Ext.grid.GroupingView.superclass.processEvent.call(this,b,h);var g=h.getTarget(".x-grid-group-hd",this.mainBody);if(g){var d=this.getGroupField(),c=this.getPrefix(d),a=g.id.substring(c.length);a=a.substr(0,a.length-3);if(a){this.grid.fireEvent("group"+b,this.grid,d,a,h)}}},onGroupByClick:function(){this.enableGrouping=true;this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));this.grid.fireEvent("groupchange",this,this.grid.store.getGroupState());this.beforeMenuShow();this.refresh()},onShowGroupsClick:function(a,b){this.enableGrouping=b;if(b){this.onGroupByClick()}else{this.grid.store.clearGrouping();this.grid.fireEvent("groupchange",this,null)}},toggleRowIndex:function(c,a){if(!this.canGroup()){return}var b=this.getRow(c);if(b){this.toggleGroup(this.findGroup(b),a)}},toggleGroup:function(c,b){var a=Ext.get(c);b=Ext.isDefined(b)?b:a.hasClass("x-grid-group-collapsed");if(this.state[a.id]!==b){this.grid.stopEditing(true);this.state[a.id]=b;a[b?"removeClass":"addClass"]("x-grid-group-collapsed")}},toggleAllGroups:function(c){var b=this.getGroups();for(var d=0,a=b.length;d
Level ' + accuracy + ' Accuracy (8 = Exact Match, 1 = Vague Match)'); } else { point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); if (typeof this.setCenter.marker === 'object' && typeof point === 'object') { this.addMarker(point, this.setCenter.marker, this.setCenter.marker.clear, true, this.setCenter.listeners); } } } } } }); Ext.reg('gmappanel', Ext.ux.GMapPanel); /*! * Ext JS Library 3.0+ * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ Ext.ns('Ext.ux.form'); /** * @class Ext.ux.form.FileUploadField * @extends Ext.form.TextField * Creates a file upload field. * @xtype fileuploadfield */ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, { /** * @cfg {String} buttonText The button text to display on the upload button (defaults to * 'Browse...'). Note that if you supply a value for {@link #buttonCfg}, the buttonCfg.text * value will be used instead if available. */ buttonText: 'Browse...', /** * @cfg {Boolean} buttonOnly True to display the file upload field as a button with no visible * text field (defaults to false). If true, all inherited TextField members will still be available. */ buttonOnly: false, /** * @cfg {Number} buttonOffset The number of pixels of space reserved between the button and the text field * (defaults to 3). Note that this only applies if {@link #buttonOnly} = false. */ buttonOffset: 3, /** * @cfg {Object} buttonCfg A standard {@link Ext.Button} config object. */ // private readOnly: true, /** * @hide * @method autoSize */ autoSize: Ext.emptyFn, // private initComponent: function(){ Ext.ux.form.FileUploadField.superclass.initComponent.call(this); this.addEvents( /** * @event fileselected * Fires when the underlying file input field's value has changed from the user * selecting a new file from the system file selection dialog. * @param {Ext.ux.form.FileUploadField} this * @param {String} value The file value returned by the underlying file input field */ 'fileselected' ); }, // private onRender : function(ct, position){ Ext.ux.form.FileUploadField.superclass.onRender.call(this, ct, position); this.wrap = this.el.wrap({cls:'x-form-field-wrap x-form-file-wrap'}); this.el.addClass('x-form-file-text'); this.el.dom.removeAttribute('name'); this.fileInput = this.wrap.createChild({ id: this.getFileInputId(), name: this.name||this.getId(), cls: 'x-form-file', tag: 'input', type: 'file', size: 1 }); var btnCfg = Ext.applyIf(this.buttonCfg || {}, { text: this.buttonText }); this.button = new Ext.Button(Ext.apply(btnCfg, { renderTo: this.wrap, cls: 'x-form-file-btn' + (btnCfg.iconCls ? ' x-btn-icon' : '') })); if(this.buttonOnly){ this.el.hide(); this.wrap.setWidth(this.button.getEl().getWidth()); } this.fileInput.on('change', function(){ var v = this.fileInput.dom.value; this.setValue(v); this.fireEvent('fileselected', this, v); }, this); }, // private getFileInputId: function(){ return this.id + '-file'; }, // private onResize : function(w, h){ Ext.ux.form.FileUploadField.superclass.onResize.call(this, w, h); this.wrap.setWidth(w); if(!this.buttonOnly){ var w = this.wrap.getWidth() - this.button.getEl().getWidth() - this.buttonOffset; this.el.setWidth(w); } }, // private onDestroy: function(){ Ext.ux.form.FileUploadField.superclass.onDestroy.call(this); Ext.destroy(this.fileInput, this.button, this.wrap); }, // private preFocus : Ext.emptyFn, // private getResizeEl : function(){ return this.wrap; }, // private getPositionEl : function(){ return this.wrap; }, // private alignErrorIcon : function(){ this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]); } }); Ext.reg('fileuploadfield', Ext.ux.form.FileUploadField); // backwards compat Ext.form.FileUploadField = Ext.ux.form.FileUploadField; /*! * Ext JS Library 3.0+ * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ Ext.namespace('Ext.ux.grid'); /** * @class Ext.ux.grid.GridFilters * @extends Ext.util.Observable *

GridFilter is a plugin (ptype='gridfilters') for grids that * allow for a slightly more robust representation of filtering than what is * provided by the default store.

*

Filtering is adjusted by the user using the grid's column header menu * (this menu can be disabled through configuration). Through this menu users * can configure, enable, and disable filters for each column.

*

Features:

*
    *
  • Filtering implementations : *
    * Default filtering for Strings, Numeric Ranges, Date Ranges, Lists (which can * be backed by a Ext.data.Store), and Boolean. Additional custom filter types * and menus are easily created by extending Ext.ux.grid.filter.Filter. *
  • *
  • Graphical indicators : *
    * Columns that are filtered have {@link #filterCls a configurable css class} * applied to the column headers. *
  • *
  • Paging : *
    * If specified as a plugin to the grid's configured PagingToolbar, the current page * will be reset to page 1 whenever you update the filters. *
  • *
  • Automatic Reconfiguration : *
    * Filters automatically reconfigure when the grid 'reconfigure' event fires. *
  • *
  • Stateful : * Filter information will be persisted across page loads by specifying a * stateId in the Grid configuration. *
    * The filter collection binds to the * {@link Ext.grid.GridPanel#beforestaterestore beforestaterestore} * and {@link Ext.grid.GridPanel#beforestatesave beforestatesave} * events in order to be stateful. *
  • *
  • Grid Changes : *
      *
    • A filters property is added to the grid pointing to * this plugin.
    • *
    • A filterupdate event is added to the grid and is * fired upon onStateChange completion.
    • *
  • *
  • Server side code examples : *
  • *
*

Example usage:

*
    
var store = new Ext.data.GroupingStore({
    ...
});
 
var filters = new Ext.ux.grid.GridFilters({
    autoReload: false, //don't reload automatically
    local: true, //only filter locally
    // filters may be configured through the plugin,
    // or in the column definition within the column model configuration
    filters: [{
        type: 'numeric',
        dataIndex: 'id'
    }, {
        type: 'string',
        dataIndex: 'name'
    }, {
        type: 'numeric',
        dataIndex: 'price'
    }, {
        type: 'date',
        dataIndex: 'dateAdded'
    }, {
        type: 'list',
        dataIndex: 'size',
        options: ['extra small', 'small', 'medium', 'large', 'extra large'],
        phpMode: true
    }, {
        type: 'boolean',
        dataIndex: 'visible'
    }]
});
var cm = new Ext.grid.ColumnModel([{
    ...
}]);
 
var grid = new Ext.grid.GridPanel({
     ds: store,
     cm: cm,
     view: new Ext.grid.GroupingView(),
     plugins: [filters],
     height: 400,
     width: 700,
     bbar: new Ext.PagingToolbar({
         store: store,
         pageSize: 15,
         plugins: [filters] //reset page to page 1 if filters change
     })
 });

store.load({params: {start: 0, limit: 15}});

// a filters property is added to the grid
grid.filters
 * 
*/ Ext.ux.grid.GridFilters = Ext.extend(Ext.util.Observable, { /** * @cfg {Boolean} autoReload * Defaults to true, reloading the datasource when a filter change happens. * Set this to false to prevent the datastore from being reloaded if there * are changes to the filters. See {@link updateBuffer}. */ autoReload : true, /** * @cfg {Boolean} encode * Specify true for {@link #buildQuery} to use Ext.util.JSON.encode to * encode the filter query parameter sent with a remote request. * Defaults to false. */ /** * @cfg {Array} filters * An Array of filters config objects. Refer to each filter type class for * configuration details specific to each filter type. Filters for Strings, * Numeric Ranges, Date Ranges, Lists, and Boolean are the standard filters * available. */ /** * @cfg {String} filterCls * The css class to be applied to column headers with active filters. * Defaults to 'ux-filterd-column'. */ filterCls : 'ux-filtered-column', /** * @cfg {Boolean} local * true to use Ext.data.Store filter functions (local filtering) * instead of the default (false) server side filtering. */ local : false, /** * @cfg {String} menuFilterText * defaults to 'Filters'. */ menuFilterText : 'Filters', /** * @cfg {String} paramPrefix * The url parameter prefix for the filters. * Defaults to 'filter'. */ paramPrefix : 'filter', /** * @cfg {Boolean} showMenu * Defaults to true, including a filter submenu in the default header menu. */ showMenu : true, /** * @cfg {String} stateId * Name of the value to be used to store state information. */ stateId : undefined, /** * @cfg {Integer} updateBuffer * Number of milliseconds to defer store updates since the last filter change. */ updateBuffer : 500, /** @private */ constructor : function (config) { this.deferredUpdate = new Ext.util.DelayedTask(this.reload, this); this.filters = new Ext.util.MixedCollection(); this.filters.getKey = function (o) { return o ? o.dataIndex : null; }; this.addFilters(config.filters); delete config.filters; Ext.apply(this, config); }, /** @private */ init : function (grid) { if (grid instanceof Ext.grid.GridPanel) { this.grid = grid; this.bindStore(this.grid.getStore(), true); this.grid.filters = this; this.grid.addEvents({'filterupdate': true}); grid.on({ scope: this, beforestaterestore: this.applyState, beforestatesave: this.saveState, beforedestroy: this.destroy, reconfigure: this.onReconfigure }); if (grid.rendered){ this.onRender(); } else { grid.on({ scope: this, single: true, render: this.onRender }); } } else if (grid instanceof Ext.PagingToolbar) { this.toolbar = grid; } }, /** * @private * Handler for the grid's beforestaterestore event (fires before the state of the * grid is restored). * @param {Object} grid The grid object * @param {Object} state The hash of state values returned from the StateProvider. */ applyState : function (grid, state) { var key, filter; this.applyingState = true; this.clearFilters(); if (state.filters) { for (key in state.filters) { filter = this.filters.get(key); if (filter) { filter.setValue(state.filters[key]); filter.setActive(true); } } } this.deferredUpdate.cancel(); if (this.local) { this.reload(); } delete this.applyingState; }, /** * Saves the state of all active filters * @param {Object} grid * @param {Object} state * @return {Boolean} */ saveState : function (grid, state) { var filters = {}; this.filters.each(function (filter) { if (filter.active) { filters[filter.dataIndex] = filter.getValue(); } }); return (state.filters = filters); }, /** * @private * Handler called when the grid is rendered */ onRender : function () { this.grid.getView().on('refresh', this.onRefresh, this); this.createMenu(); }, /** * @private * Handler called by the grid 'beforedestroy' event */ destroy : function () { this.removeAll(); this.purgeListeners(); if(this.filterMenu){ Ext.menu.MenuMgr.unregister(this.filterMenu); this.filterMenu.destroy(); this.filterMenu = this.menu.menu = null; } }, /** * Remove all filters, permanently destroying them. */ removeAll : function () { if(this.filters){ Ext.destroy.apply(Ext, this.filters.items); // remove all items from the collection this.filters.clear(); } }, /** * Changes the data store bound to this view and refreshes it. * @param {Store} store The store to bind to this view */ bindStore : function(store, initial){ if(!initial && this.store){ if (this.local) { store.un('load', this.onLoad, this); } else { store.un('beforeload', this.onBeforeLoad, this); } } if(store){ if (this.local) { store.on('load', this.onLoad, this); } else { store.on('beforeload', this.onBeforeLoad, this); } } this.store = store; }, /** * @private * Handler called when the grid reconfigure event fires */ onReconfigure : function () { this.bindStore(this.grid.getStore()); this.store.clearFilter(); this.removeAll(); this.addFilters(this.grid.getColumnModel()); this.updateColumnHeadings(); }, createMenu : function () { var view = this.grid.getView(), hmenu = view.hmenu; if (this.showMenu && hmenu) { this.sep = hmenu.addSeparator(); this.filterMenu = new Ext.menu.Menu({ id: this.grid.id + '-filters-menu' }); this.menu = hmenu.add({ checked: false, itemId: 'filters', text: this.menuFilterText, menu: this.filterMenu }); this.menu.on({ scope: this, checkchange: this.onCheckChange, beforecheckchange: this.onBeforeCheck }); hmenu.on('beforeshow', this.onMenu, this); } this.updateColumnHeadings(); }, /** * @private * Get the filter menu from the filters MixedCollection based on the clicked header */ getMenuFilter : function () { var view = this.grid.getView(); if (!view || view.hdCtxIndex === undefined) { return null; } return this.filters.get( view.cm.config[view.hdCtxIndex].dataIndex ); }, /** * @private * Handler called by the grid's hmenu beforeshow event */ onMenu : function (filterMenu) { var filter = this.getMenuFilter(); if (filter) { /* TODO: lazy rendering if (!filter.menu) { filter.menu = filter.createMenu(); } */ this.menu.menu = filter.menu; this.menu.setChecked(filter.active, false); // disable the menu if filter.disabled explicitly set to true this.menu.setDisabled(filter.disabled === true); } this.menu.setVisible(filter !== undefined); this.sep.setVisible(filter !== undefined); }, /** @private */ onCheckChange : function (item, value) { this.getMenuFilter().setActive(value); }, /** @private */ onBeforeCheck : function (check, value) { return !value || this.getMenuFilter().isActivatable(); }, /** * @private * Handler for all events on filters. * @param {String} event Event name * @param {Object} filter Standard signature of the event before the event is fired */ onStateChange : function (event, filter) { if (event === 'serialize') { return; } if (filter == this.getMenuFilter()) { this.menu.setChecked(filter.active, false); } if ((this.autoReload || this.local) && !this.applyingState) { this.deferredUpdate.delay(this.updateBuffer); } this.updateColumnHeadings(); if (!this.applyingState) { this.grid.saveState(); } this.grid.fireEvent('filterupdate', this, filter); }, /** * @private * Handler for store's beforeload event when configured for remote filtering * @param {Object} store * @param {Object} options */ onBeforeLoad : function (store, options) { options.params = options.params || {}; this.cleanParams(options.params); var params = this.buildQuery(this.getFilterData()); Ext.apply(options.params, params); }, /** * @private * Handler for store's load event when configured for local filtering * @param {Object} store * @param {Object} options */ onLoad : function (store, options) { store.filterBy(this.getRecordFilter()); }, /** * @private * Handler called when the grid's view is refreshed */ onRefresh : function () { this.updateColumnHeadings(); }, /** * Update the styles for the header row based on the active filters */ updateColumnHeadings : function () { var view = this.grid.getView(), hds, i, len, filter; if (view.mainHd) { hds = view.mainHd.select('td').removeClass(this.filterCls); for (i = 0, len = view.cm.config.length; i < len; i++) { filter = this.getFilter(view.cm.config[i].dataIndex); if (filter && filter.active) { hds.item(i).addClass(this.filterCls); } } } }, /** @private */ reload : function () { if (this.local) { this.grid.store.clearFilter(true); this.grid.store.filterBy(this.getRecordFilter()); } else { var start, store = this.grid.store; this.deferredUpdate.cancel(); if (this.toolbar) { start = store.paramNames.start; if (store.lastOptions && store.lastOptions.params && store.lastOptions.params[start]) { store.lastOptions.params[start] = 0; } } store.reload(); } }, /** * Method factory that generates a record validator for the filters active at the time * of invokation. * @private */ getRecordFilter : function () { var f = [], len, i; this.filters.each(function (filter) { if (filter.active) { f.push(filter); } }); len = f.length; return function (record) { for (i = 0; i < len; i++) { if (!f[i].validateRecord(record)) { return false; } } return true; }; }, /** * Adds a filter to the collection and observes it for state change. * @param {Object/Ext.ux.grid.filter.Filter} config A filter configuration or a filter object. * @return {Ext.ux.grid.filter.Filter} The existing or newly created filter object. */ addFilter : function (config) { var Cls = this.getFilterClass(config.type), filter = config.menu ? config : (new Cls(config)); this.filters.add(filter); Ext.util.Observable.capture(filter, this.onStateChange, this); return filter; }, /** * Adds filters to the collection. * @param {Array/Ext.grid.ColumnModel} filters Either an Array of * filter configuration objects or an Ext.grid.ColumnModel. The columns * of a passed Ext.grid.ColumnModel will be examined for a filter * property and, if present, will be used as the filter configuration object. */ addFilters : function (filters) { if (filters) { var i, len, filter, cm = false, dI; if (filters instanceof Ext.grid.ColumnModel) { filters = filters.config; cm = true; } for (i = 0, len = filters.length; i < len; i++) { filter = false; if (cm) { dI = filters[i].dataIndex; filter = filters[i].filter || filters[i].filterable; if (filter){ filter = (filter === true) ? {} : filter; Ext.apply(filter, {dataIndex:dI}); // filter type is specified in order of preference: // filter type specified in config // type specified in store's field's type config filter.type = filter.type || this.store.fields.get(dI).type; } } else { filter = filters[i]; } // if filter config found add filter for the column if (filter) { this.addFilter(filter); } } } }, /** * Returns a filter for the given dataIndex, if one exists. * @param {String} dataIndex The dataIndex of the desired filter object. * @return {Ext.ux.grid.filter.Filter} */ getFilter : function (dataIndex) { return this.filters.get(dataIndex); }, /** * Turns all filters off. This does not clear the configuration information * (see {@link #removeAll}). */ clearFilters : function () { this.filters.each(function (filter) { filter.setActive(false); }); }, /** * Returns an Array of the currently active filters. * @return {Array} filters Array of the currently active filters. */ getFilterData : function () { var filters = [], i, len; this.filters.each(function (f) { if (f.active) { var d = [].concat(f.serialize()); for (i = 0, len = d.length; i < len; i++) { filters.push({ field: f.dataIndex, data: d[i] }); } } }); return filters; }, /** * Function to take the active filters data and build it into a query. * The format of the query depends on the {@link #encode} * configuration: *
    * *
  • false : Default *
    * Flatten into query string of the form (assuming {@link #paramPrefix}='filters': *
    
    filters[0][field]="someDataIndex"&
    filters[0][data][comparison]="someValue1"&
    filters[0][data][type]="someValue2"&
    filters[0][data][value]="someValue3"&
         * 
    *
  • *
  • true : *
    * JSON encode the filter data *
    
    filters[0][field]="someDataIndex"&
    filters[0][data][comparison]="someValue1"&
    filters[0][data][type]="someValue2"&
    filters[0][data][value]="someValue3"&
         * 
    *
  • *
* Override this method to customize the format of the filter query for remote requests. * @param {Array} filters A collection of objects representing active filters and their configuration. * Each element will take the form of {field: dataIndex, data: filterConf}. dataIndex is not assured * to be unique as any one filter may be a composite of more basic filters for the same dataIndex. * @return {Object} Query keys and values */ buildQuery : function (filters) { var p = {}, i, f, root, dataPrefix, key, tmp, len = filters.length; if (!this.encode){ for (i = 0; i < len; i++) { f = filters[i]; root = [this.paramPrefix, '[', i, ']'].join(''); p[root + '[field]'] = f.field; dataPrefix = root + '[data]'; for (key in f.data) { p[[dataPrefix, '[', key, ']'].join('')] = f.data[key]; } } } else { tmp = []; for (i = 0; i < len; i++) { f = filters[i]; tmp.push(Ext.apply( {}, {field: f.field}, f.data )); } // only build if there is active filter if (tmp.length > 0){ p[this.paramPrefix] = Ext.util.JSON.encode(tmp); } } return p; }, /** * Removes filter related query parameters from the provided object. * @param {Object} p Query parameters that may contain filter related fields. */ cleanParams : function (p) { // if encoding just delete the property if (this.encode) { delete p[this.paramPrefix]; // otherwise scrub the object of filter data } else { var regex, key; regex = new RegExp('^' + this.paramPrefix + '\[[0-9]+\]'); for (key in p) { if (regex.test(key)) { delete p[key]; } } } }, /** * Function for locating filter classes, overwrite this with your favorite * loader to provide dynamic filter loading. * @param {String} type The type of filter to load ('Filter' is automatically * appended to the passed type; eg, 'string' becomes 'StringFilter'). * @return {Class} The Ext.ux.grid.filter.Class */ getFilterClass : function (type) { // map the supported Ext.data.Field type values into a supported filter switch(type) { case 'auto': type = 'string'; break; case 'int': case 'float': type = 'numeric'; break; } return Ext.ux.grid.filter[type.substr(0, 1).toUpperCase() + type.substr(1) + 'Filter']; } }); // register ptype Ext.preg('gridfilters', Ext.ux.grid.GridFilters); /*! * Ext JS Library 3.0+ * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ Ext.namespace('Ext.ux.grid.filter'); /** * @class Ext.ux.grid.filter.Filter * @extends Ext.util.Observable * Abstract base class for filter implementations. */ Ext.ux.grid.filter.Filter = Ext.extend(Ext.util.Observable, { /** * @cfg {Boolean} active * Indicates the initial status of the filter (defaults to false). */ active : false, /** * True if this filter is active. Use setActive() to alter after configuration. * @type Boolean * @property active */ /** * @cfg {String} dataIndex * The {@link Ext.data.Store} dataIndex of the field this filter represents. * The dataIndex does not actually have to exist in the store. */ dataIndex : null, /** * The filter configuration menu that will be installed into the filter submenu of a column menu. * @type Ext.menu.Menu * @property */ menu : null, /** * @cfg {Number} updateBuffer * Number of milliseconds to wait after user interaction to fire an update. Only supported * by filters: 'list', 'numeric', and 'string'. Defaults to 500. */ updateBuffer : 500, constructor : function (config) { Ext.apply(this, config); this.addEvents( /** * @event activate * Fires when an inactive filter becomes active * @param {Ext.ux.grid.filter.Filter} this */ 'activate', /** * @event deactivate * Fires when an active filter becomes inactive * @param {Ext.ux.grid.filter.Filter} this */ 'deactivate', /** * @event serialize * Fires after the serialization process. Use this to attach additional parameters to serialization * data before it is encoded and sent to the server. * @param {Array/Object} data A map or collection of maps representing the current filter configuration. * @param {Ext.ux.grid.filter.Filter} filter The filter being serialized. */ 'serialize', /** * @event update * Fires when a filter configuration has changed * @param {Ext.ux.grid.filter.Filter} this The filter object. */ 'update' ); Ext.ux.grid.filter.Filter.superclass.constructor.call(this); this.menu = new Ext.menu.Menu(); this.init(config); if(config && config.value){ this.setValue(config.value); this.setActive(config.active !== false, true); delete config.value; } }, /** * Destroys this filter by purging any event listeners, and removing any menus. */ destroy : function(){ if (this.menu){ this.menu.destroy(); } this.purgeListeners(); }, /** * Template method to be implemented by all subclasses that is to * initialize the filter and install required menu items. * Defaults to Ext.emptyFn. */ init : Ext.emptyFn, /** * Template method to be implemented by all subclasses that is to * get and return the value of the filter. * Defaults to Ext.emptyFn. * @return {Object} The 'serialized' form of this filter * @methodOf Ext.ux.grid.filter.Filter */ getValue : Ext.emptyFn, /** * Template method to be implemented by all subclasses that is to * set the value of the filter and fire the 'update' event. * Defaults to Ext.emptyFn. * @param {Object} data The value to set the filter * @methodOf Ext.ux.grid.filter.Filter */ setValue : Ext.emptyFn, /** * Template method to be implemented by all subclasses that is to * return true if the filter has enough configuration information to be activated. * Defaults to return true. * @return {Boolean} */ isActivatable : function(){ return true; }, /** * Template method to be implemented by all subclasses that is to * get and return serialized filter data for transmission to the server. * Defaults to Ext.emptyFn. */ getSerialArgs : Ext.emptyFn, /** * Template method to be implemented by all subclasses that is to * validates the provided Ext.data.Record against the filters configuration. * Defaults to return true. * @param {Ext.data.Record} record The record to validate * @return {Boolean} true if the record is valid within the bounds * of the filter, false otherwise. */ validateRecord : function(){ return true; }, /** * Returns the serialized filter data for transmission to the server * and fires the 'serialize' event. * @return {Object/Array} An object or collection of objects containing * key value pairs representing the current configuration of the filter. * @methodOf Ext.ux.grid.filter.Filter */ serialize : function(){ var args = this.getSerialArgs(); this.fireEvent('serialize', args, this); return args; }, /** @private */ fireUpdate : function(){ if (this.active) { this.fireEvent('update', this); } this.setActive(this.isActivatable()); }, /** * Sets the status of the filter and fires the appropriate events. * @param {Boolean} active The new filter state. * @param {Boolean} suppressEvent True to prevent events from being fired. * @methodOf Ext.ux.grid.filter.Filter */ setActive : function(active, suppressEvent){ if(this.active != active){ this.active = active; if (suppressEvent !== true) { this.fireEvent(active ? 'activate' : 'deactivate', this); } } } });/*! * Ext JS Library 3.0+ * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ /** * @class Ext.ux.grid.filter.StringFilter * @extends Ext.ux.grid.filter.Filter * Filter by a configurable Ext.form.TextField *

Example Usage:

*
    
var filters = new Ext.ux.grid.GridFilters({
    ...
    filters: [{
        // required configs
        type: 'string',
        dataIndex: 'name',
        
        // optional configs
        value: 'foo',
        active: true, // default is false
        iconCls: 'ux-gridfilter-text-icon' // default
        // any Ext.form.TextField configs accepted
    }]
});
 * 
*/ Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, { /** * @cfg {String} iconCls * The iconCls to be applied to the menu item. * Defaults to 'ux-gridfilter-text-icon'. */ iconCls : 'ux-gridfilter-text-icon', emptyText: 'Enter Filter Text...', selectOnFocus: true, width: 125, /** * @private * Template method that is to initialize the filter and install required menu items. */ init : function (config) { Ext.applyIf(config, { enableKeyEvents: true, iconCls: this.iconCls, listeners: { scope: this, keyup: this.onInputKeyUp } }); this.inputItem = new Ext.form.TextField(config); this.menu.add(this.inputItem); this.updateTask = new Ext.util.DelayedTask(this.fireUpdate, this); }, /** * @private * Template method that is to get and return the value of the filter. * @return {String} The value of this filter */ getValue : function () { return this.inputItem.getValue(); }, /** * @private * Template method that is to set the value of the filter. * @param {Object} value The value to set the filter */ setValue : function (value) { this.inputItem.setValue(value); this.fireEvent('update', this); }, /** * @private * Template method that is to return true if the filter * has enough configuration information to be activated. * @return {Boolean} */ isActivatable : function () { return this.inputItem.getValue().length > 0; }, /** * @private * Template method that is to get and return serialized filter data for * transmission to the server. * @return {Object/Array} An object or collection of objects containing * key value pairs representing the current configuration of the filter. */ getSerialArgs : function () { return {type: 'string', value: this.getValue()}; }, /** * Template method that is to validate the provided Ext.data.Record * against the filters configuration. * @param {Ext.data.Record} record The record to validate * @return {Boolean} true if the record is valid within the bounds * of the filter, false otherwise. */ validateRecord : function (record) { var val = record.get(this.dataIndex); if(typeof val != 'string') { return (this.getValue().length === 0); } return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1; }, /** * @private * Handler method called when there is a keyup event on this.inputItem */ onInputKeyUp : function (field, e) { var k = e.getKey(); if (k == e.RETURN && field.isValid()) { e.stopEvent(); this.menu.hide(true); return; } // restart the timer this.updateTask.delay(this.updateBuffer); } }); /*! * Ext JS Library 3.0+ * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ /** * @class Ext.ux.grid.filter.DateFilter * @extends Ext.ux.grid.filter.Filter * Filter by a configurable Ext.menu.DateMenu *

Example Usage:

*
    
var filters = new Ext.ux.grid.GridFilters({
    ...
    filters: [{
        // required configs
        type: 'date',
        dataIndex: 'dateAdded',
        
        // optional configs
        dateFormat: 'm/d/Y',  // default
        beforeText: 'Before', // default
        afterText: 'After',   // default
        onText: 'On',         // default
        pickerOpts: {
            // any DateMenu configs
        },

        active: true // default is false
    }]
});
 * 
*/ Ext.ux.grid.filter.DateFilter = Ext.extend(Ext.ux.grid.filter.Filter, { /** * @cfg {String} afterText * Defaults to 'After'. */ afterText : 'After', /** * @cfg {String} beforeText * Defaults to 'Before'. */ beforeText : 'Before', /** * @cfg {Object} compareMap * Map for assigning the comparison values used in serialization. */ compareMap : { before: 'lt', after: 'gt', on: 'eq' }, /** * @cfg {String} dateFormat * The date format to return when using getValue. * Defaults to 'm/d/Y'. */ dateFormat : 'm/d/Y', /** * @cfg {Date} maxDate * Allowable date as passed to the Ext.DatePicker * Defaults to undefined. */ /** * @cfg {Date} minDate * Allowable date as passed to the Ext.DatePicker * Defaults to undefined. */ /** * @cfg {Array} menuItems * The items to be shown in this menu * Defaults to:
     * menuItems : ['before', 'after', '-', 'on'],
     * 
*/ menuItems : ['before', 'after', '-', 'on'], /** * @cfg {Object} menuItemCfgs * Default configuration options for each menu item */ menuItemCfgs : { selectOnFocus: true, width: 125 }, /** * @cfg {String} onText * Defaults to 'On'. */ onText : 'On', /** * @cfg {Object} pickerOpts * Configuration options for the date picker associated with each field. */ pickerOpts : {}, /** * @private * Template method that is to initialize the filter and install required menu items. */ init : function (config) { var menuCfg, i, len, item, cfg, Cls; menuCfg = Ext.apply(this.pickerOpts, { minDate: this.minDate, maxDate: this.maxDate, format: this.dateFormat, listeners: { scope: this, select: this.onMenuSelect } }); this.fields = {}; for (i = 0, len = this.menuItems.length; i < len; i++) { item = this.menuItems[i]; if (item !== '-') { cfg = { itemId: 'range-' + item, text: this[item + 'Text'], menu: new Ext.menu.DateMenu( Ext.apply(menuCfg, { itemId: item }) ), listeners: { scope: this, checkchange: this.onCheckChange } }; Cls = Ext.menu.CheckItem; item = this.fields[item] = new Cls(cfg); } //this.add(item); this.menu.add(item); } }, onCheckChange : function () { this.setActive(this.isActivatable()); this.fireEvent('update', this); }, /** * @private * Handler method called when there is a keyup event on an input * item of this menu. */ onInputKeyUp : function (field, e) { var k = e.getKey(); if (k == e.RETURN && field.isValid()) { e.stopEvent(); this.menu.hide(true); return; } }, /** * Handler for when the menu for a field fires the 'select' event * @param {Object} date * @param {Object} menuItem * @param {Object} value * @param {Object} picker */ onMenuSelect : function (menuItem, value, picker) { var fields = this.fields, field = this.fields[menuItem.itemId]; field.setChecked(true); if (field == fields.on) { fields.before.setChecked(false, true); fields.after.setChecked(false, true); } else { fields.on.setChecked(false, true); if (field == fields.after && fields.before.menu.picker.value < value) { fields.before.setChecked(false, true); } else if (field == fields.before && fields.after.menu.picker.value > value) { fields.after.setChecked(false, true); } } this.fireEvent('update', this); }, /** * @private * Template method that is to get and return the value of the filter. * @return {String} The value of this filter */ getValue : function () { var key, result = {}; for (key in this.fields) { if (this.fields[key].checked) { result[key] = this.fields[key].menu.picker.getValue(); } } return result; }, /** * @private * Template method that is to set the value of the filter. * @param {Object} value The value to set the filter * @param {Boolean} preserve true to preserve the checked status * of the other fields. Defaults to false, unchecking the * other fields */ setValue : function (value, preserve) { var key; for (key in this.fields) { if(value[key]){ this.fields[key].menu.picker.setValue(value[key]); this.fields[key].setChecked(true); } else if (!preserve) { this.fields[key].setChecked(false); } } this.fireEvent('update', this); }, /** * @private * Template method that is to return true if the filter * has enough configuration information to be activated. * @return {Boolean} */ isActivatable : function () { var key; for (key in this.fields) { if (this.fields[key].checked) { return true; } } return false; }, /** * @private * Template method that is to get and return serialized filter data for * transmission to the server. * @return {Object/Array} An object or collection of objects containing * key value pairs representing the current configuration of the filter. */ getSerialArgs : function () { var args = []; for (var key in this.fields) { if(this.fields[key].checked){ args.push({ type: 'date', comparison: this.compareMap[key], value: this.getFieldValue(key).format(this.dateFormat) }); } } return args; }, /** * Get and return the date menu picker value * @param {String} item The field identifier ('before', 'after', 'on') * @return {Date} Gets the current selected value of the date field */ getFieldValue : function(item){ return this.fields[item].menu.picker.getValue(); }, /** * Gets the menu picker associated with the passed field * @param {String} item The field identifier ('before', 'after', 'on') * @return {Object} The menu picker */ getPicker : function(item){ return this.fields[item].menu.picker; }, /** * Template method that is to validate the provided Ext.data.Record * against the filters configuration. * @param {Ext.data.Record} record The record to validate * @return {Boolean} true if the record is valid within the bounds * of the filter, false otherwise. */ validateRecord : function (record) { var key, pickerValue, val = record.get(this.dataIndex).clearTime(true).getTime(); for (key in this.fields) { if (this.fields[key].checked) { pickerValue = this.getFieldValue(key).clearTime(true).getTime(); if (key == 'before' && pickerValue <= val) { return false; } if (key == 'after' && pickerValue >= val) { return false; } if (key == 'on' && pickerValue != val) { return false; } } } return true; } });/*! * Ext JS Library 3.0+ * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ /** * @class Ext.ux.grid.filter.ListFilter * @extends Ext.ux.grid.filter.Filter *

List filters are able to be preloaded/backed by an Ext.data.Store to load * their options the first time they are shown. ListFilter utilizes the * {@link Ext.ux.menu.ListMenu} component.

*

Although not shown here, this class accepts all configuration options * for {@link Ext.ux.menu.ListMenu}.

* *

Example Usage:

*
    
var filters = new Ext.ux.grid.GridFilters({
    ...
    filters: [{
        type: 'list',
        dataIndex: 'size',
        phpMode: true,
        // options will be used as data to implicitly creates an ArrayStore
        options: ['extra small', 'small', 'medium', 'large', 'extra large']
    }]
});
 * 
* */ Ext.ux.grid.filter.ListFilter = Ext.extend(Ext.ux.grid.filter.Filter, { /** * @cfg {Array} options *

data to be used to implicitly create a data store * to back this list when the data source is local. If the * data for the list is remote, use the {@link #store} * config instead.

*

Each item within the provided array may be in one of the * following formats:

*
    *
  • Array : *
    
    options: [
        [11, 'extra small'], 
        [18, 'small'],
        [22, 'medium'],
        [35, 'large'],
        [44, 'extra large']
    ]
         * 
    *
  • *
  • Object : *
    
    labelField: 'name', // override default of 'text'
    options: [
        {id: 11, name:'extra small'}, 
        {id: 18, name:'small'}, 
        {id: 22, name:'medium'}, 
        {id: 35, name:'large'}, 
        {id: 44, name:'extra large'} 
    ]
         * 
    *
  • *
  • String : *
    
         * options: ['extra small', 'small', 'medium', 'large', 'extra large']
         * 
    *
  • */ /** * @cfg {Boolean} phpMode *

    Adjust the format of this filter. Defaults to false.

    *

    When GridFilters @cfg encode = false (default):

    *
    
    // phpMode == false (default):
    filter[0][data][type] list
    filter[0][data][value] value1
    filter[0][data][value] value2
    filter[0][field] prod 
    
    // phpMode == true:
    filter[0][data][type] list
    filter[0][data][value] value1, value2
    filter[0][field] prod 
         * 
    * When GridFilters @cfg encode = true: *
    
    // phpMode == false (default):
    filter : [{"type":"list","value":["small","medium"],"field":"size"}]
    
    // phpMode == true:
    filter : [{"type":"list","value":"small,medium","field":"size"}]
         * 
    */ phpMode : false, /** * @cfg {Ext.data.Store} store * The {@link Ext.data.Store} this list should use as its data source * when the data source is remote. If the data for the list * is local, use the {@link #options} config instead. */ /** * @private * Template method that is to initialize the filter and install required menu items. * @param {Object} config */ init : function (config) { this.dt = new Ext.util.DelayedTask(this.fireUpdate, this); // if a menu already existed, do clean up first if (this.menu){ this.menu.destroy(); } this.menu = new Ext.ux.menu.ListMenu(config); this.menu.on('checkchange', this.onCheckChange, this); }, /** * @private * Template method that is to get and return the value of the filter. * @return {String} The value of this filter */ getValue : function () { return this.menu.getSelected(); }, /** * @private * Template method that is to set the value of the filter. * @param {Object} value The value to set the filter */ setValue : function (value) { this.menu.setSelected(value); this.fireEvent('update', this); }, /** * @private * Template method that is to return true if the filter * has enough configuration information to be activated. * @return {Boolean} */ isActivatable : function () { return this.getValue().length > 0; }, /** * @private * Template method that is to get and return serialized filter data for * transmission to the server. * @return {Object/Array} An object or collection of objects containing * key value pairs representing the current configuration of the filter. */ getSerialArgs : function () { var args = {type: 'list', value: this.phpMode ? this.getValue().join(',') : this.getValue()}; return args; }, /** @private */ onCheckChange : function(){ this.dt.delay(this.updateBuffer); }, /** * Template method that is to validate the provided Ext.data.Record * against the filters configuration. * @param {Ext.data.Record} record The record to validate * @return {Boolean} true if the record is valid within the bounds * of the filter, false otherwise. */ validateRecord : function (record) { return this.getValue().indexOf(record.get(this.dataIndex)) > -1; } });/*! * Ext JS Library 3.0+ * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ /** * @class Ext.ux.grid.filter.NumericFilter * @extends Ext.ux.grid.filter.Filter * Filters using an Ext.ux.menu.RangeMenu. *

    Example Usage:

    *
        
    var filters = new Ext.ux.grid.GridFilters({
        ...
        filters: [{
            type: 'numeric',
            dataIndex: 'price'
        }]
    });
     * 
    */ Ext.ux.grid.filter.NumericFilter = Ext.extend(Ext.ux.grid.filter.Filter, { /** * @cfg {Object} fieldCls * The Class to use to construct each field item within this menu * Defaults to:
         * fieldCls : Ext.form.NumberField
         * 
    */ fieldCls : Ext.form.NumberField, /** * @cfg {Object} fieldCfg * The default configuration options for any field item unless superseded * by the {@link #fields} configuration. * Defaults to:
         * fieldCfg : {}
         * 
    * Example usage: *
    
    fieldCfg : {
        width: 150,
    },
         * 
    */ /** * @cfg {Object} fields * The field items may be configured individually * Defaults to undefined. * Example usage: *
    
    fields : {
        gt: { // override fieldCfg options
            width: 200,
            fieldCls: Ext.ux.form.CustomNumberField // to override default {@link #fieldCls}
        }
    },
         * 
    */ /** * @cfg {Object} iconCls * The iconCls to be applied to each comparator field item. * Defaults to:
    iconCls : {
        gt : 'ux-rangemenu-gt',
        lt : 'ux-rangemenu-lt',
        eq : 'ux-rangemenu-eq'
    }
         * 
    */ iconCls : { gt : 'ux-rangemenu-gt', lt : 'ux-rangemenu-lt', eq : 'ux-rangemenu-eq' }, /** * @cfg {Object} menuItemCfgs * Default configuration options for each menu item * Defaults to:
    menuItemCfgs : {
        emptyText: 'Enter Filter Text...',
        selectOnFocus: true,
        width: 125
    }
         * 
    */ menuItemCfgs : { emptyText: 'Enter Filter Text...', selectOnFocus: true, width: 125 }, /** * @cfg {Array} menuItems * The items to be shown in this menu. Items are added to the menu * according to their position within this array. Defaults to:
         * menuItems : ['lt','gt','-','eq']
         * 
    */ menuItems : ['lt', 'gt', '-', 'eq'], /** * @private * Template method that is to initialize the filter and install required menu items. */ init : function (config) { // if a menu already existed, do clean up first if (this.menu){ this.menu.destroy(); } this.menu = new Ext.ux.menu.RangeMenu(Ext.apply(config, { // pass along filter configs to the menu fieldCfg : this.fieldCfg || {}, fieldCls : this.fieldCls, fields : this.fields || {}, iconCls: this.iconCls, menuItemCfgs: this.menuItemCfgs, menuItems: this.menuItems, updateBuffer: this.updateBuffer })); // relay the event fired by the menu this.menu.on('update', this.fireUpdate, this); }, /** * @private * Template method that is to get and return the value of the filter. * @return {String} The value of this filter */ getValue : function () { return this.menu.getValue(); }, /** * @private * Template method that is to set the value of the filter. * @param {Object} value The value to set the filter */ setValue : function (value) { this.menu.setValue(value); }, /** * @private * Template method that is to return true if the filter * has enough configuration information to be activated. * @return {Boolean} */ isActivatable : function () { var values = this.getValue(); for (key in values) { if (values[key] !== undefined) { return true; } } return false; }, /** * @private * Template method that is to get and return serialized filter data for * transmission to the server. * @return {Object/Array} An object or collection of objects containing * key value pairs representing the current configuration of the filter. */ getSerialArgs : function () { var key, args = [], values = this.menu.getValue(); for (key in values) { args.push({ type: 'numeric', comparison: key, value: values[key] }); } return args; }, /** * Template method that is to validate the provided Ext.data.Record * against the filters configuration. * @param {Ext.data.Record} record The record to validate * @return {Boolean} true if the record is valid within the bounds * of the filter, false otherwise. */ validateRecord : function (record) { var val = record.get(this.dataIndex), values = this.getValue(); if (values.eq !== undefined && val != values.eq) { return false; } if (values.lt !== undefined && val >= values.lt) { return false; } if (values.gt !== undefined && val <= values.gt) { return false; } return true; } }); /*! * Ext JS Library 3.0+ * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ /** * @class Ext.ux.grid.filter.NumericFilter * @extends Ext.ux.grid.filter.Filter * Filters using an Ext.ux.menu.RangeMenu. *

    Example Usage:

    *
        
    var filters = new Ext.ux.grid.GridFilters({
    ...
    filters: [{
    type: 'numeric',
    dataIndex: 'price'
    }]
    });
    * 
    */ Ext.ux.grid.filter.NumericFilter = Ext.extend(Ext.ux.grid.filter.Filter, { /** * @cfg {Object} fieldCls * The Class to use to construct each field item within this menu * Defaults to:
        * fieldCls : Ext.form.NumberField
        * 
    */ fieldCls: Ext.form.NumberField, /** * @cfg {Object} fieldCfg * The default configuration options for any field item unless superseded * by the {@link #fields} configuration. * Defaults to:
        * fieldCfg : {}
        * 
    * Example usage: *
    
        fieldCfg : {
        width: 150,
        },
        * 
    */ /** * @cfg {Object} fields * The field items may be configured individually * Defaults to undefined. * Example usage: *
    
        fields : {
        gt: { // override fieldCfg options
        width: 200,
        fieldCls: Ext.ux.form.CustomNumberField // to override default {@link #fieldCls}
        }
        },
        * 
    */ /** * @cfg {Object} iconCls * The iconCls to be applied to each comparator field item. * Defaults to:
        iconCls : {
        gt : 'ux-rangemenu-gt',
        lt : 'ux-rangemenu-lt',
        eq : 'ux-rangemenu-eq'
        }
        * 
    */ iconCls: { gt: 'ux-rangemenu-gt', lt: 'ux-rangemenu-lt', eq: 'ux-rangemenu-eq' }, /** * @cfg {Object} menuItemCfgs * Default configuration options for each menu item * Defaults to:
        menuItemCfgs : {
        emptyText: 'Enter Filter Text...',
        selectOnFocus: true,
        width: 125
        }
        * 
    */ menuItemCfgs: { emptyText: 'Enter Filter Text...', selectOnFocus: true, width: 125 }, /** * @cfg {Array} menuItems * The items to be shown in this menu. Items are added to the menu * according to their position within this array. Defaults to:
        * menuItems : ['lt','gt','-','eq']
        * 
    */ menuItems: ['lt', 'gt', '-', 'eq'], /** * @private * Template method that is to initialize the filter and install required menu items. */ init: function(config) { // if a menu already existed, do clean up first if (this.menu) { this.menu.destroy(); } this.menu = new Ext.ux.menu.RangeMenu(Ext.apply(config, { // pass along filter configs to the menu fieldCfg: this.fieldCfg || {}, fieldCls: this.fieldCls, fields: this.fields || {}, iconCls: this.iconCls, menuItemCfgs: this.menuItemCfgs, menuItems: this.menuItems, updateBuffer: this.updateBuffer })); // relay the event fired by the menu this.menu.on('update', this.fireUpdate, this); }, /** * @private * Template method that is to get and return the value of the filter. * @return {String} The value of this filter */ getValue: function() { return this.menu.getValue(); }, /** * @private * Template method that is to set the value of the filter. * @param {Object} value The value to set the filter */ setValue: function(value) { this.menu.setValue(value); }, /** * @private * Template method that is to return true if the filter * has enough configuration information to be activated. * @return {Boolean} */ isActivatable: function() { var values = this.getValue(); for (key in values) { if (values[key] !== undefined) { return true; } } return false; }, /** * @private * Template method that is to get and return serialized filter data for * transmission to the server. * @return {Object/Array} An object or collection of objects containing * key value pairs representing the current configuration of the filter. */ getSerialArgs: function() { var key, args = [], values = this.menu.getValue(); for (key in values) { args.push({ type: 'numeric', comparison: key, value: values[key] }); } return args; }, /** * Template method that is to validate the provided Ext.data.Record * against the filters configuration. * @param {Ext.data.Record} record The record to validate * @return {Boolean} true if the record is valid within the bounds * of the filter, false otherwise. */ validateRecord: function(record) { var val = record.get(this.dataIndex), values = this.getValue(); if (values.eq !== undefined && val != values.eq) { return false; } if (values.lt !== undefined && val >= values.lt) { return false; } if (values.gt !== undefined && val <= values.gt) { return false; } return true; } });/*! * Ext JS Library 3.0+ * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ /** * @class Ext.ux.grid.filter.BooleanFilter * @extends Ext.ux.grid.filter.Filter * Boolean filters use unique radio group IDs (so you can have more than one!) *

    Example Usage:

    *
        
    var filters = new Ext.ux.grid.GridFilters({
        ...
        filters: [{
            // required configs
            type: 'boolean',
            dataIndex: 'visible'
    
            // optional configs
            defaultValue: null, // leave unselected (false selected by default)
            yesText: 'Yes',     // default
            noText: 'No'        // default
        }]
    });
     * 
    */ Ext.ux.grid.filter.BooleanFilter = Ext.extend(Ext.ux.grid.filter.Filter, { /** * @cfg {Boolean} defaultValue * Set this to null if you do not want either option to be checked by default. Defaults to false. */ defaultValue : false, /** * @cfg {String} yesText * Defaults to 'Yes'. */ yesText : 'Yes', /** * @cfg {String} noText * Defaults to 'No'. */ noText : 'No', /** * @private * Template method that is to initialize the filter and install required menu items. */ init : function (config) { var gId = Ext.id(); this.options = [ new Ext.menu.CheckItem({text: this.yesText, group: gId, checked: this.defaultValue === true}), new Ext.menu.CheckItem({text: this.noText, group: gId, checked: this.defaultValue === false})]; this.menu.add(this.options[0], this.options[1]); for(var i=0; i -1) result[name]=params[p]; } } return result; }, // Perform a view change. The view is launched according to the launch option and defaults to window if none is provided. // view: Name of the view to launch. // command: The command state to start the new view in. // ControlID: An ID that is used to indicate that this view belongs to a certain parent control. Used for statefulness. // internalParams: The internal parameters for this view. MUST be passed to every view building request. // config: // viewParams: A set of parameters to send into the view. // launch: Indicates how to launch this view. values can be 'window' or 'inline' // launchingView: If launch is inline, then this must be the view that is launching this new view. The launchingView's owner will be used to house the new view. // Broadcast: A broadcasting object that will be sent to .Broadcast if this launch is successful // NoBroadcast: An indicator that, when set to true, will prevent this view launch from broadcasting. // header: Set to false and the window will not have a title or border. // DefaultSizing, SubviewSizing: Sizing objects that simply pass on through to the view constructors. // sm: A method that is called when the launch is successful. // top, left: If provided and the view is launching into a window, the window will be positioned using these options. // isSubview: (true/false) indicates this view should be treated as a subview. // PassControl: (true/false) Indicates this view should pass on its control to the launching view and cancel the launching view. launchView: function(config) { var view=config.view; var command=config.command; if(view&&command) { // mask the applied to, or parent element. if(false&&config.launchingView) { if(config.launchingView.appliedTo) { config.launchingView.appliedTo.mask('Loading...'); } else { if(config.launchingView.ownerCt) { var owner_el=config.launchingView.ownerCt.getEl(); if(owner_el) owner_el.mask('Loading'); } } } //alert('vp = ' + Ext.encode(config.viewParams)); //alert('cp = ' + Ext.encode(config.controlParams)); //alert('ip = ' + Ext.encode(config.internalParams)); // Try to create the view+command specified.. var view_object=Trakkware.ViewFramework.createView({ view: view, command: command, parent: config.launchingView, viewParams: config.viewParams, controlParams: config.controlParams, ControlID: config.ControlID, isSubview: config.isSubview, internalParams: config.internalParams, SubviewSizing: config.SubviewSizing, failureCallback: function() { if(config.failureCallback) config.failureCallback(); }, callback: function(view_object) { if(view_object) { if(config.callback) config.callback(); var launching_view = config.launchingView; // Launch into a window by default or if 'window' is specified. if(!config.launch||(config.launch&&config.launch=='window')) { // Default sizing must be defined in order to launch a window. /*if (!Ext.isDefined(config.DefaultSizing)) { alert('A config with no DefaultSizing was passed to a view which is trying to launch in a Window, but cannot because it has no sizing info!'); return; }*/ var window_config={ width: 0, height: 0, autoHeight: false, items: view_object, layout: 'fit', //modal: true, maximizable: (config.maximizable||false), listeners: { afterrender: function(rendered) { // Semi-modal features. Mask the launching view instead of modal-ing the entire thing. // Then, when the launching view is hidden, hide this window. And when the launching view // is shown, show the window! if(launching_view) { if(config.PassControl == true) { // Get the launching view of the view that is launching this view....JESUS! var new_launching_view = launching_view.getLaunchingView(); // Tell the launching view to go away. launching_view.fireEvent('cancelview', true); // Now assign the launching view of the view we just made go away to THIS view's launching view. launching_view = new_launching_view; } } var finish=function(rendered_view) { var width=rendered_view.getWidth(); //Trakkware.ViewFramework.SCROLLBAR_WIDTH; var height=rendered_view.getHeight(); // +Trakkware.ViewFramework.SCROLLBAR_WIDTH; // Sometimes we have a view which likes to autoheight, but gets stuffed into a window. In this case, height will come // back as zero, so use the Height value. //alert(Ext.encode(config.DefaultSizing)); if(height == 0 && config.DefaultSizing) height = config.DefaultSizing.Height; var body_size=Ext.getBody().getViewSize(); var auto_scroll=false; if(width>body_size.width) { width=body_size.width-Trakkware.ViewFramework.SCROLLBAR_WIDTH; auto_scroll=true; } if(height>body_size.height) { height=body_size.height-Trakkware.ViewFramework.SCROLLBAR_WIDTH; auto_scroll=true; } rendered.setSize({ width: width,height: height }); if(auto_scroll===true) rendered.setAutoScroll(true); } if(view_object.rendered===true) { finish(view_object); } else { view_object.on('afterrender',finish); } } } }; var attach_titlechange=true; if(config.header===false) { Ext.apply(window_config,{ header: false, closable: false }); attach_titlechange=false; } else { Ext.apply(window_config,{ title: 'loading...' }); } if(config.top) Ext.apply(window_config, { x: config.top }); if(config.left) Ext.apply(window_config, { y: config.left }); if(config.ControlID) Ext.apply(window_config,{ id: 'window'+config.ControlID }); var window=new Ext.Window(window_config); if(attach_titlechange===true) { // Captures title changes on the view and re-titles the window with the view's title. view_object.on('titlechange',function(panel,title) { window.setTitle(title); }); } // When the view needs to cancel, close this window. // I was listening for cancelview on view_object before, in case this // change causes issues. window.addEvents('cancelview'); window.on('cancelview',function(passed_control) { window.fireEvent('registersemimodalwindow', { Window: window }); window.wasPassedControl = passed_control; window.close(); Ext.destroy(window); return false; }); window.addEvents('registersemimodalwindow', 'semimodal'); window.on('registersemimodalwindow', function(mc) { if(launching_view) launching_view.fireEvent('registersemimodalwindow', mc); }); // This part keeps the infinite front->back->front loop from happening when more than // one masked window is open and then the top (unmasked) window is closed. var current_mask = null; function windowOrder() { if(current_mask != null) { window.toBack(); } } window.on('activate', function() { windowOrder.defer(100); }); window.on('semimodal', function(show) { if(show === true) { current_mask = window.el.mask(null); } else { if(window.wasPassedControl == true) { } window.el.unmask(); current_mask = null; window.toFront(); } }); view_object.on('reloadparentview',function() { if(launching_view) launching_view.fireEvent('reloadview'); window.close(); Ext.destroy(window); return false; }); window.show(); } else if(config.launch=='inline' && launching_view) { var owner=launching_view.ownerCt; var cancelobj=(launching_view.getCancelObject?launching_view.getCancelObject():null); if(owner) { if(owner.items) { // find the current position in owner. var pos = 0; owner.items.each(function(item) { if(item == launching_view) return false; pos++; }); var title = launching_view.title; owner.remove(launching_view); var newtab = owner.insert(pos, view_object); owner.doLayout(); if(owner.getXType && owner.getXType() == 'tabpanel') { owner.activate(newtab); } view_object.applyTitle(title); } else { owner.removeAll(true); owner.add(view_object); owner.doLayout(); } // unmask the owner. var owner_el=owner.getEl(); if(owner_el) owner_el.unmask(); } else { var applied_to=launching_view.appliedTo; // try to save some ram on the client if(launching_view.wrapper) Ext.destroy(launching_view.wrapper); Ext.destroy(launching_view); applied_to.update(''); var wrapper=applied_to.createChild({ tag: 'div' }); view_object.applyToMarkup(wrapper); view_object.appliedTo=applied_to; view_object.wrapper=wrapper; // unmask the applied to element. if(applied_to&&applied_to.unmask) applied_to.unmask(); } } else { throw('unknown launch string: '+config.launch); return; } // If a broadcast object was provided, send it to the Broadcaster. if(config.NoBroadcast!=true&&config.Broadcast) { Trakkware.ViewFramework.Broadcast(config.Broadcast); } if(config.sm && Ext.isFunction(config.sm)) config.sm(true); } } }); } }, // Executes a view action which does not involve view launching. // example of actions that don't launch views: Save, cancel, delete, etc.. // view: name of the view to use for performing this action. // command: the command that represents the action in view. // **Special Note** => Leave view and command empty, and this action will not attempt to make ajax calls back to the Method Handler. // This is useful for actions like Cancel which do not require any data manipulation. // ActionDefinition: The action definition object for this command. // ControlID: The unique id of the website control this view belongs to. used for Broadcasting and listening. // config: // actionParams: A set of unmapped parameters that is used as a source for mapped out parameters when the method handler is called. // successCommand: A command to put this view into if this action is sucessful. // transactionCommand: A command of a parent view that this action is mapped to. Perform action will not do the actual ajax call but will pass this call up to the parent view for transactional processing. // useConfirmation: (true/false) Indicates to use a confirmation before performing this cation. // confirmationTitle: A title to use for the confirmation message box when confirm is true. // confirmationMessage: The message to display when confirming this action. // reloadOnSuccess: (true/false) Indicates that the view or its parent should reload on success. // cancelOnSuccess: (true/false) Indicates the current view should cancel itself upon success. // successMessage: A message to display when the action is sucessful. The actionParams are used as a data source for templating the sucess message. // resetDirtyOnSuccess: (true/false) Indicates that form dirty statuses should be reset when this action is successful. // NoBroadcast: An override boolean that, when set to true, will force this action to NOT broadcast. // rm: A method that is invoked if the action is successful and reloadOnSuccess is true. // cm: A method that is invoked if the action is successful and cancelOnSuccess is true. // vm: A method that is invoked if the action causes a validation response to occur. An array of validations is provided to the method as its sole parameter. // form: If you are using a form with performAction and need it to submit for uploads, then you must include // the FormPanel itself so this csode can call form.getForm().submit() and cause the uploads to submit. // PLEASE NOTE: Even tho you are providing a form here, this code is NOT harvesting the form for values. The data values to // submit must be provided as actionParams just as a non-form would do. // IsTransactional: Indicates this action should be performed transactionally. // TransactionFormID: ID of the form that this transaction belongs to. Used for validations. // TransactionParentCommand: The parent command that maps to this transaction. // ChildTransactions: An array of child transactions that need to go along with this action. // IsDirty: Indicates if the dirtiness associated with the current action. // JustResults: Just get the data from this action and return it. No post action or ANYTHING. // failureCallback: function is called when there is a failure // successCallback: function invoked when action is finished and successful. // ViewObject: The view object making this call. Used by masking to call fireEvent performAction: function(config, calling_view_object) { // Get view and command. They can be empty, so don't get judgemental about their existence up here. var view=config.view; var command=config.command; // Construct a broadcasting object for later use. var broadcast_config={ Command: command, ActionDefinition: config.ActionDefinition, RawData: config.actionParams, ControlID: config.ControlID } // Quick reference var. var child_transactions=null; // When a valid subview transaction map is provided, use transactions. if(Ext.isArray(config.ChildTransactions)&&config.ChildTransactions.length>0) { child_transactions=config.ChildTransactions; config.IsTransactional=true; } // If JustResults is true, override Transactional. if(config.JustResults==true) config.IsTransactional=false; // inner function is called to start the action. The reason for this is Ext.Msg.confirm is a non-blocking alert box so to use the same code for confirmation and non-confirmation, i put // the code in an inner function. function startAction() { // Throw mask if(config.ViewObject) config.ViewObject.fireEvent('mask', { Activate: true, ViewName: view, Command: command }); // Check if this is a transactional action. If so, capture its info and pass it back. if(config.IsTransactional==true) { var transaction={ view: view, command: command, data: config.actionParams, ParentCommand: config.TransactionParentCommand, control_id: config.TransactionFormID // Needs to be set in transactionCallback by caller. }; // Child transactions where provided? If so, bundled this all together and send it off to // the commitTransaction method. if(Ext.isArray(child_transactions)&&child_transactions.length>0) { // Check if this transaction should be added.. var add_transaction=true; if(config.ActionDefinition&&config.ActionDefinition.transactional_only_on_dirty==true) { // If this action requires dirtiness when it is a transaction, don't add it unless it's dirty! if(config.IsDirty==false) add_transaction=false; } if(add_transaction==true) child_transactions.push(transaction); // Commit the collection of transactions. Trakkware.ViewFramework.commitTransaction(view,command,child_transactions,config, function(config,response) { Trakkware.ViewFramework.doPostAction(config,response,calling_view_object); if(Ext.isFunction(config.successCallback)) config.successCallback(); }, config.failureCallback ); return false; } return transaction; } else { // When both the view and command are specified, make a call to the Method Handler with the // actionParams supplied. if(Ext.isDefined(view)&&!Ext.isEmpty(view)&&Ext.isDefined(command)&&!Ext.isEmpty(command)) { // Make the method call and allow it to proceed on to doPostAction. Trakkware.ViewFramework.performMethodCall( calling_view_object, config, function(result) { if(Ext.isFunction(config.successCallback)) config.successCallback(); // When just results, return the results of this method call. if(config.JustResults==true) { return result; } else { // Call a success callback if provided. if(config.sm) config.sm(); // If an action definition was provided send off to the broadcaster if(config.NoBroadcast!=true) { Trakkware.ViewFramework.Broadcast(broadcast_config); } } }, config.failureCallback); } else { // Only do these if JustResults is not true. if(config.JustResults != true) { // No view and/or command so just do the action. Don't make a call to the server. var success=Trakkware.ViewFramework.doPostAction(config,null,calling_view_object); if(config.NoBroadcast != true && success==true) { Trakkware.ViewFramework.Broadcast(broadcast_config); } if(Ext.isFunction(config.successCallback)) config.successCallback(); } } } } // Decide whether to use the dirty confirmation or regular. var use_dirty=false; var confirm=config.useConfirmation; if(config.isDirty==true&&config.confirmOnDirty==true) { use_dirty=true; confirm=true; } var confirm_msg = (use_dirty == true ? config.dirtyConfirmationMessage : config.confirmationMessage); var confirm_title = (use_dirty == true ? config.dirtyConfirmationTitle : config.confirmationTitle); // If a confirmation is required, show one before completing the action. if(confirm==true) { Ext.Msg.confirm(confirm_title,confirm_msg,function(btn) { if(btn=='yes') { return startAction(); } }); } else { return startAction(); } }, // Takes method information and makes an ajax call which call doPostAction // if no callback is provided. // // See performAction // Additional config options: // // JustResults: Set to true to only get the results back from this call, ignoring post action. performMethodCall: function(calling_view_object,config,callback, failureCallback) { var view=config.view; var command=config.command; // Check if a form option was provided. This is required for executing actions that cause a form to upload. if(config.form&&config.form.fileUpload==true) { var upload_form=config.form.getForm(); if(upload_form&&upload_form.isValid()) { upload_form.submit({ params: { view: view, command: command, paramarray: Ext.encode(config.actionParams) }, url: Trakkware.Handlers.MethodHandler, waitMsg: 'Please wait...', success: function(response,action) { // Damn form submits. response=action.result; // Parse the response. //response = Ext.decode(response.responseText); var result=response.result; var send_back=null; if(result=='0') { Ext.Msg.alert('Cannot Continue','No changes were made because:\r\n\r\n'+response.msg); if(Ext.isFunction(failureCallback)) failureCallback(); return; } else if(result=='1') { // If instructed to, return the data from the list immediately. if(config.JustResults==true) { send_back={ list: response.list,count: response.count,response: response }; } else { send_back=true; } var success_msg=response.msg; if(success_msg) { Ext.Msg.alert('Success',success_msg); } } else if(result=='2') { if(calling_view_object) { calling_view_object.fireEvent('validations',response.validations); } } if(callback) { callback(config,send_back); } // Do post action after everything else. Trakkware.ViewFramework.doPostAction(config,response,calling_view_object); }, failure: function(response) { Ext.Msg.alert('HTTP error','An unknown Http error occured when I tried to launch this view. Are you still connected to the web?'); if(Ext.isFunction(failureCallback)) failureCallback(); } }); } } else { Ext.Ajax.request({ method: 'POST', url: Trakkware.Handlers.MethodHandler, params: { view: view, command: command, paramarray: Ext.encode(config.actionParams) }, success: function(response) { // Parse the response. response=Ext.decode(response.responseText); var result=response.result; var send_back=null; if(result=='0') { Ext.Msg.alert('Cannot Continue','No changes were made because:\r\n\r\n'+response.msg); if(Ext.isFunction(failureCallback)) failureCallback(); return; } else if(result=='1') { // If instructed to, return the data from the list immediately. if(config.JustResults==true) { send_back={ list: response.list,count: response.count,response: response }; } else { send_back=true; } var success_msg=response.msg; if(success_msg) { Ext.Msg.alert('Success',success_msg); } } else if(result=='2') { if(calling_view_object) { calling_view_object.fireEvent('validations',response.validations); } } if(callback) { callback(config,send_back); } // Do post action after everything else. Trakkware.ViewFramework.doPostAction(config,response,calling_view_object); }, failure: function(response) { if(Ext.isFunction(failureCallback)) failureCallback(); Ext.Msg.alert('HTTP error','An unknown Http error occured when I tried to launch this view. Are you still connected to the web?'); } }); } }, // Takes an array of transactions and commits them. Any validation results or messages returned by the transaction // are returned to the caller. commitTransaction: function(view,command,transaction_array,config,on_success_callback, failure_callback) { var fixed_array=''; var first=true; Ext.each(transaction_array,function(transaction) { if(first==true) first=false;else fixed_array+=','; fixed_array+=Ext.encode(transaction); }); fixed_array='['+fixed_array+']'; // Test code. See how many transactions and what is in them. //alert('committing a transaction with ' + transaction_array.length + ' transactions.'); Ext.each(transaction_array,function(t) { Trakkware.ViewFramework.log('TRANSACTION: '+Ext.encode(t)); }); // If there were transaction, process them. if(transaction_array.length>0) { Ext.Ajax.request({ method: 'POST', // Do not change this to a GET unless you know what yer doing! url: Trakkware.Handlers.MethodHandler, params: { view: view, command: command, transactions: fixed_array }, success: function(response) { // Parse the response. response=Ext.decode(response.responseText); if(on_success_callback) on_success_callback(config,response); }, failure: function(response) { if(Ext.isFunction(failure_callback)) failure_callback(); Ext.Msg.alert('HTTP error','An unknown Http error occured when I tried to commit a transaction. Are you still connected to the web?'); } }); } else { // If the transaction must go forward but there are no transactions, simply call the success methods. if(on_success_callback) on_success_callback(); } }, // Takes a template string, turns it into an Ext.XTemplate, and then finally applies the data parameter to them. applyTemplate: function(template,data) { var tpl=new Ext.XTemplate(template); try { return tpl.apply(data); } catch(e) { } return template; }, // Inner function that is called from performAction() when the action has completed with the server // or never bothered with the server. doPostAction: function(config, response, calling_view_object) { // collect behavior config info. var reload_success=config.reloadOnSuccess; var cancel_view_success=config.cancelOnSuccess; var success_msg=config.successMessage; var reset_dirty=config.resetDirtyOnSuccess; var success_command = config.successCommand; // An ajax response is provided. Deal with it appropriately. if(response&&response.responseText) response=Ext.decode(response.responseText); var perform_success=false; // If a null response is provided, go forward as if we were successful. if(response==null) { perform_success=true; } else { if(!response||response.result=='1') { perform_success=true; // Tell forms to reset.. if(reset_dirty==true) { calling_view_object.fireEvent('resetdirty',calling_view_object); } } // result of 2 means validation errors. if(response&&response.result=='2') { var success=response.success; if(success==false) { calling_view_object.fireEvent('validations',response.validations); } else { perform_success=true; } } else if(response&&response.result=='5') { // The user does not have permission to handle the view requested. Ext.Msg.alert('Permission Denied','The action you attempted cannot be completed because you do not have permissions.',function() { }); } else if(response&&response.result=='6') { // The user is not logged in. Ext.Msg.alert('Not logged in','Your session has ended. Please login again to continue working.',function() { // do re-login here. }); } else if(response&&response.result=='0') { Ext.Msg.alert('Error performing action',response.msg); } } // If the action was successful, do several things depending on how its behavior was set in config. if(perform_success==true) { action_successful=true; // Check success command before anything. if(success_command) { // Fire reload if indicated before changing to the other command and a parent exists. // I put this in to satisfy save & continue functionality. if(reload_success==true && calling_view_object.Parent) { calling_view_object.Parent.fireEvent('reloadview'); calling_view_object = calling_view_object.Parent; } var new_config = { view: config.view, command: success_command, launchingView: calling_view_object, isSubview: false, viewParams: config.actionParams }; var windowMgr = calling_view_object.getWindowMgr(); if(windowMgr != null) { var view = Trakkware.ViewFramework.createView({ view: config.view, command: success_command, launchingView: calling_view_object, viewParams: config.actionParams, isSubview: false, callback: function(viewobject) { windowMgr.addView({ view: viewobject, launch: 'window', replace: true }); }, failureCallback: function(response) { alert('nothing happening in this failure callback.'); } }); } else { // First cancel the calling view. if(cancel_view_success == true) { // Tell the launching view to go away. calling_view_object.fireEvent('cancelview', true); } // THE OLD WAY! Then launch the new view Trakkware.ViewFramework.launchView(new_config); } } else { // When both reload and cancel are set, fire the close-and-reload event. if(reload_success==true && cancel_view_success==true) { calling_view_object.fireEvent('closeviewandreloadparent'); } else { // Fire reload if indicated. if(reload_success==true) { calling_view_object.fireEvent('reloadview'); } // Fire cancel if indicated. if(cancel_view_success==true) { calling_view_object.fireEvent('cancelview'); } } } } // Return an indicator of success. return perform_success; }, // BROADCASTING!!!!!!!!!!! // Expected params: // ControlID: Unique page ID of the control that is broadcasting. // Command: The command to broadcast. // ActionDefinition: The action definition for the command that mapped to this command. // RawData: A raw data set that will be mapped using... Broadcast: function(config) { // Validate incoming: if(Trakkware.ViewFramework.requireOption(config,'Command',config.ControlID+': Trakkware.View.Broadcast')==false) return; if(Trakkware.ViewFramework.requireOption(config,'RawData',config.ControlID+': Trakkware.View.Broadcast')==false) return; if(Trakkware.ViewFramework.requireOption(config,'ActionDefinition',config.ControlID+': Trakkware.View.Broadcast')==false) return; // Only broadcast if a ControlID is present. if(config.ControlID) { // Get config options. var command=config.Command; var data=config.RawData; var broadcast=config.ActionDefinition.broadcast; var expected=config.ActionDefinition.expected; // When no map is provided, build one with no parameters. if(!broadcast) broadcast={}; // Get parameter set for the broadcast. var broadcast_parameters={} // Move through the data provided and snag any parameters that match // and convert their parameter name according to the broadcast map. Ext.iterate(broadcast,function(from) { // To be included in the broadcast params, a property needs // to exist in the data AND expected objects. if(data[from]&&expected.indexOf(from)!= -1) broadcast_parameters[broadcast[from]]=data[from]; }) // Special case: If broadcast data is empty, set it to the null token. if(Ext.encode(broadcast_parameters)=='{}') { broadcast_parameters={ NULL: 'NULL' }; } // If you're having a hard time telling what is going on in broadcasts, use this test alert: //alert(config.ControlID + ' is expecting ' + expected + ', \r\nhas ' + Ext.encode(broadcast_parameters) + ' and is changing its state to ' + config.Command + ' with ' + Ext.encode(broadcast)); // Do the actual broadcasting with the StateHash Trakkware.StateHash.changeState(config.ControlID,command,broadcast_parameters); } }, findFieldByPropertyName: function(container,property_name) { if(container&&container.items) { var result=null; container.items.each(function(field) { var xtype=field.getXType?field.getXType():null; if(field.PropertyName&&field.PropertyName==property_name) { result=field; return false; } if(field.xtype=='container') { var child=Trakkware.ViewFramework.findFieldByPropertyName(field,property_name); if(child!=null) { result=child; return false; } } }); return result; } }, findFieldByDatafield: function(container,datafield) { if(container&&container.items) { var result=null; container.items.each(function(field) { var xtype=field.getXType?field.getXType():null; if(field.datafield&&field.datafield==datafield) { result=field; return false; } if(field.xtype=='container') { var child=Trakkware.ViewFramework.findFieldByDatafield(field,datafield); if(child!=null) { result=child; return false; } } }); return result; } }, findTextOrCombo: function(container) { if(container&&container.items) { var result=null; container.items.each(function(field) { if(field.getXType) { var xtype=field.getXType(); if(xtype=='textfield'||xtype=='combo'||xtype=='trakkware_combopicklist') { result=field; return false; } if(xtype=='container') { var child=Trakkware.ViewFramework.findTextOrCombo(field); if(child!=null) { result=child; return false; } } } }); return result; } }, // Simple console logging. log: function(msg) { if(window.console&&window.console.log) window.console.log(msg); }, // Used to indicate xtypes that need ALL data when their values are set. requiresAllData: function(xtype) { var accept=[ 'trakkware_popup', 'trakkware_button', 'trakkware_template', 'trakkware_repeatform' ]; var req=accept.indexOf(xtype); if(req> -1) return true; return false; }, // hack for the massive confusion of javascript + extJS + Microsoft JSON serializer. ParseMicrosoftData: function(date) { if(date.indexOf&&date.indexOf('Date')> -1) { return eval('new '+date.replace('/','').replace('/','')); } }, // Takes a Sizing object and applies it to the config supplied. ApplySizing: function(config,sizing) { if(sizing) { config.width=sizing.Width-Trakkware.ViewFramework.SCROLLBAR_WIDTH; if(sizing.Anchor && sizing.UseAnchor==true) { config.anchor=sizing.Anchor; } if(sizing.AutoHeight==true || sizing.Height == -1) { config.autoHeight=true; } else { config.height=sizing.Height-Trakkware.ViewFramework.SCROLLBAR_WIDTH;; } } return config; }, // Returns an object describing whether to show or hide or don't worry about it based on // the ShowOn provided and data. ProcessShowOn: function(field, showon, data) { // If the data contains a property that matches the show-on property, we are in business! if(showon && data && field) { var show = showon.show; var property = showon.property; var value = showon.value; if(Ext.isDefined(data[property])) { var eq = false; if(Ext.isBoolean(data[property]) && !Ext.isBoolean(value)) { if(value == 'true' || value == '1') value = true; else if (value == 'false' || value == '0') value = false; eq = data[property] == value; } else eq = (data[property] == value) if(eq === true) { // We only care about when they are equal, // so since they are equal, return a show/hide indicator. if(show === true) { return 'show'; } else { if(field.getEl) { var el = field.getEl(); if(el && el.findParent) { var form_item = el.findParent('.x-form-item'); if(form_item) Ext.get(form_item).applyStyles({ display: 'none' }); } field.hide(); if(field.label && field.label.hide) field.label.hide(); return 'hide'; } else return; } } } } return null; }, ProcessDisableOn: function(field, disableon, data) { // If the data contains a property that matches the show-on property, we are in business! if(disableon && data && field) { var disable = disableon.show; var property = disableon.property; var value = disableon.value; if(Ext.isDefined(data[property])) { var eq = false; if(Ext.isBoolean(data[property]) && !Ext.isBoolean(value)) { // Derp.. Boolean('false') return true. Nice one, javascript. if(value == 'true' || value == '1') value = true; else if (value == 'false' || value == '0') value = false; eq = data[property] == value; } else eq = (data[property] == value) if(eq === true) { // We only care about when they are equal, // so since they are equal, return a show/hide indicator. if(disable === true) { field.disable(); return 'disable'; } else { return 'enable'; } } } } return null; }, // Use as the function for an Ajax.request({ failure }) and the failure response will be processed accordingly. // If callback is a function it will be called afterwards with response as the lone parameter. processRequestFailure: function(response, callback) { }, // // config: // // view: The view to use // code: Field change code to send back. // command: The command that the view is CURRENTLY using. This is used to capture a ViewLayout on the server when building new fields. // viewParams: A set of parameters to send back with this request. // callback: Function is invoked when the field change object is successfully returned. fieldChange: function(config) { Ext.Ajax.request({ method: 'POST', url: Trakkware.Handlers.ViewHandler, params: { view: config.view, command: Trakkware.Handlers.FieldChangeCommand, fieldchange: config.code, fieldcommand: config.command, paramarray: Ext.encode(config.viewParams) }, success: function(response) { // Parse the response. response = Ext.decode(response.responseText); // Send the new object array along to the callback. config.callback(response); }, failure: function(response) { if(Ext.isFunction(failureCallback)) failureCallback(); Ext.Msg.alert('HTTP error','An unknown Http error occured when I tried to launch this view. Are you still connected to the web?'); } }); } }; Trakkware.ViewFramework.keyMap = new Ext.KeyMap(document); Trakkware.ViewFramework.keyMap.accessKey = function(key, handler, pass_along) { var h = function(n, e) { e.preventDefault(); handler(pass_along, n, e); }; this.on(key, h); }; Ext.ns('Trakkware'); // Expected config values: // ViewName: The name of this view. // ControlID: A unique identifier that indicates which HTML control this view belongs to. // Parameters: An object in the form { // Control: { n1:v1, n2:v2, ... }, // View: {x1: y1, x2: y2, ... }, // InitialQueryModifiers: { sort: x, sort_dir: y, groupbys: [], filters: [], search: z } // } // These are the parameters used to initialize the view. // Parent: The parent view if this view is a subview. // Actions: An action definition object in the form: { COMMAND1: { n1:v1, n2:v2, etc }, COMMAND2: { n4: v4, n5: v5, etc } } // SubviewMap: A map that indicates action commands in subviews that are mapped to actions in this view. // Needs to be in this form: { PropertyName: { parameter_map: {}, action_map: {} }, PropertyName2: { parameter_map: {}, action_map: {} ) ) // PropertyName: A view property name used to identify this view if it is a subview. // // GroupHeaders: An object filled with group headers, accessible by property name: { PropertyName: 'group header', propertyName: 'group header' } // // ParentCommandMap: A map of commands that the parent is mapping to this subview. // // isSubview: Indicates this is a subview. // Sizing: A Sizing object that will set height, width, and auto_height automatically. Trakkware.View = function(apply_to, config) { // Enable some events and allow them to bubble. apply_to.addEvents( 'modifierchanged', 'registersubview', 'preregistersubview', 'registerdirtyable', 'registerreactdirty', 'actionhandler', 'resetdirty', 'dirty', 'reloadview', 'cancelview', 'reloadsubview', 'closeviewandreloadparent', 'reloadparentview', 'registerdatafield', 'mask', 'broadcastmodifiers', 'performactionondirties', 'validations', 'picklistreaction', 'controlsloaded', 'broadcast', 'emptydataset', 'registersemimodalwindow', 'semimodal', 'fullreload' ); apply_to.enableBubble('reloadparentview', 'cancelview', 'registersubview', 'mask', 'resetdirty', 'registersemimodalwindow', 'semimodal'); // If an undefiend apply_to is suppled, just return it as is. if (!Ext.isDefined(apply_to)) return apply_to; apply_to.getCurrentCommand = function() { return config.Command }; // Private // Registered subviews. apply_to._registered_subviews = []; // dirtyable forms. apply_to._registered_dirtyable = []; // controls that react to the form being dirty. apply_to._registered_reactdirty = []; // pending transactions apply_to._pending_transactions = []; // Hidden transactional actionhandler-firing things. apply_to._registered_transactionals = []; // Register ed picklists. apply_to._registered_picklists = []; // Fields that are data. apply_to._registered_datafields = []; // Pre-registered subviews. apply_to._preregistered_subviews = []; var cancel_object = null; var reload_object = null; var reload_view = null; var title_object = null; var passing_state = false; apply_to._window_mgr = null; var _ControlID = config.ControlID; // React to events. apply_to.on('preregistersubview', function(subview) { apply_to._preregistered_subviews.push(subview); subview.on('afterrender', function(subview) { subview.setWindowMgr(apply_to.getWindowMgr()); }); }); // Register subviews. apply_to.on('registersubview', function(subview) { // subview is a Trakkware.View which has no xtype. // Validate the incoming subview. if (!Ext.isDefined(subview) || Ext.isEmpty(subview)) { alert('An empty subview was provided to registersubview!'); return false; } // When the subview is not THIS view, register it and prevent it from bubbling. if (subview != apply_to) { apply_to._registered_subviews.push(subview); subview.on('afterrender', function(subview) { subview.setWindowMgr(apply_to.getWindowMgr()); }); return false; } // When a view catches its OWN registersubview, return true so that this event bubbles up to the parent and it can register the subview. return true; }); // Register dirtyable controls. apply_to.on('registerdirtyable', function(control) { // If an empty control is provided, bail. if (!Ext.isDefined(control)) { alert('An undefined control was provided to Trakkware.View.registerDirtyable'); return false; } // do not register trakkware_buttons or hiddens. var xtype = control.getXType ? control.getXType() : null; if (xtype != 'hidden') { if (control.isDirty) { apply_to._registered_dirtyable.push(control); } else { if (xtype == null) xtype = 'unknown xtype'; Trakkware.ViewFramework.log('A dirtyable was provided and yet it has no .isDirty method and was subsequently ignored. (' + xtype + ')'); } } return false; }); apply_to.on('causesfieldchange', function(control, new_value, change_code) { var viewparams = apply_to.actionDataProvider(); Trakkware.ViewFramework.fieldChange({ view: apply_to.getViewName(), code: change_code, command: config.Command, viewParams: viewparams, callback: function(item_array) { var owner = control.ownerCt; // get index of control. var ii = 0; owner.items.each(function(item) { if(item.id == control.id) { ii++; // we want AFTER the control. return false; } ii++; }); // Now, get the values in existing field-change fields for later use.. var existing_values = {}; if(control.existing_field_changes) { Ext.each(control.existing_field_changes, function(old) { existing_values[old.datafield] = old.getValue(); apply_to.removeRegisteredDatafield(old); owner.remove(old); }); } // Don't forget to remove initial dynamics. owner.items.each(function(item) { if(item.isInitialDynamic == true) { owner.remove(item); } }); control.existing_field_changes = []; var focus = null; if(item_array && item_array.length > 0) { Ext.each(item_array, function(new_item) { var item = owner.insert(ii, new_item); control.existing_field_changes.push(item); if(focus == null) focus = item; ii++; }); owner.doLayout(); focus.focus(); // Now replace old values which match datafields on new items. Ext.each(control.existing_field_changes, function(item) { if(existing_values[item.datafield]) item.setValue(existing_values[item.datafield]); }); } } }); }); // Register a picklist. apply_to.on('registerpicklist', function(picklist) { apply_to._registered_picklists.push(picklist); // When a picklist reaction occurs, find registered picklists that might care. picklist.on('picklistreaction', function(from_property_name, new_value, reactions) { Ext.each(apply_to._registered_picklists, function(check_picklist) { if (reactions.indexOf(check_picklist.datafield) > -1) { var data = {}; data[from_property_name] = new_value; check_picklist.fireEvent('react', data); } }); return false; }); return false; }); // Register datafields. apply_to.on('registerdatafield', function(control) { if (control) { if (!Ext.isDefined(control.getValue)) { alert('A datafield has been passed to registerdatafield event on Trakkware.View that has no .getValue method!'); return false; } apply_to._registered_datafields.push(control); // Setting a reference back to this view for masking purposes. control.ViewObject = apply_to; } return false; }); // Register controls that react to dirtiness apply_to.on('registerreactdirty', function(control) { }); apply_to.on('reloadsubview', function(datafield_name, data) { var subviews = apply_to.getRegisteredSubviews(); Ext.each(subviews, function(subview) { if(subview.datafield == datafield_name) { subview.fireEvent('reloadview', data); } }); }); // Arises when a view must change its data but needs to commit the current changes on the view. apply_to.on('performactionondirties', function(dirty_config) { // Validate config. if (Trakkware.ViewFramework.requireOption(dirty_config, 'Command', 'Trakkware.View.on.performactionondirties') == false) return; // Get transactions that are waiting or apply to the command supplied. var transaction_array = apply_to.getTransactionsFor(dirty_config.Command, true); if (transaction_array) { Trakkware.ViewFramework.commitTransaction(dirty_config.ViewName, dirty_config.Command, transaction_array, dirty_config, function() { if (Ext.isFunction(dirty_config.Callback)) { // reset dirty! apply_to.fireEvent('resetdirty', apply_to); dirty_config.Callback(true); } }); } return false; }); // Listen for the emptydataset event. If the view is supposed to hide when this // happens, have it hide itself. apply_to.on('emptydataset', function() { if (config.HideIfEmptyDataSet === true && apply_to.hide) { apply_to.hide(); } }); // Register a transactional action. apply_to.on('registertransactional', function(command, parent_command, control) { apply_to._registered_transactionals.push({ ParentCommand: parent_command, Command: command, Control: control }); return false; }); // Attend to an action handler. apply_to.on('actionhandler', function(control, config) { apply_to.actionHandler(control, config); return false; }); // Hookup resetdirty. apply_to.on('resetdirty', function(originating_view) { // Un-dirty anything in the dirtyable list. Ext.each(apply_to._registered_dirtyable, function(item) { // Ext.util.Observable.hasEvents would be nice.... var evt = item.events['resetdirty']; var hasevent = Ext.isObject(evt) || (evt === true); // Any dirtyable that has the reset dirty event, pass it on! if (hasevent == true) { // For some reason the subview type is swallowing resetdirty... so, doing it the wrong way. if(item.view_object) { item.view_object.fireEvent('resetdirty'); } else { // Fire the items event with down == true so resetdirty won't bubble back up if item is a subview. item.fireEvent('resetdirty', apply_to, true); } } else if (item.originalValue && item.getValue) { // Things like textfields and combos have originalValue and getValue, so // use them to trick themselves in to thinking they are no longer dirty. item.originalValue = item.getValue(); // property helps do quick-dirty. See the listener in ExtHelper. if(item.pre_emptive_dirty) item.pre_emptive_dirty = false; } }); // Also tell the react-to-dirty crowd that dirty has been reset. Ext.each(apply_to._registered_reactdirty, function(react) { //UNUSED... react.fireEvent('reactdirty', false); }); // Have toolbar buttons, etc reset themselves.3 apply_to.performDirtyDuties(apply_to, true); return false; }); // Do on-dirty tasks for this form. apply_to.on('dirty', function(control, new_value, old_value) { apply_to.performDirtyDuties(apply_to, false); }); // Listen for event which causes this entire view to reload itself. apply_to.on('fullreload', function() { var title = apply_to.title; var newconfig = { TitleTemplate: title, launch: 'inline', launchingView: apply_to, view: config.ViewName, command: config.Command, viewParams: apply_to.getViewParameters(), isSubview: config.isSubview } var view = Trakkware.ViewFramework.launchView(newconfig); }); // When this event is fired, fire reloadview on the parent and then destroy this view. apply_to.on('closeviewandreloadparent', function() { apply_to.fireEvent('reloadparentview'); return false; }); // Mask listener. // mask_config: { Activate: (true/false), ViewName: Name of the view the mask lives in, Command: Command of the action causing this mask, Text: Explicit text to mask with ignores ViewName and Commnad } apply_to.on('mask', function(mask_config) { var el = apply_to.el; if (mask_config.Activate != true) { el.unmask(); } else { if(config.Text) { el.mas(config.Text); } else { if (mask_config.ViewName == apply_to.getViewName()) { var action = apply_to.getActionDefinition(mask_config.Command); if (mask_config.Activate == true && action && !Ext.isEmpty(action.mask_text)) { el.mask(action.mask_text); } } } } return false; }); // Listen for broadcasts. apply_to.on('broadcast', function(broadcast_config) { apply_to.Listen(broadcast_config); }); // Listen for validations and pass them out to subviews. apply_to.on('validations', function(validations) { // TEST CODE: What validations did we receive? //alert('got validations: ' + Ext.encode(validations)); // holds validation messages that cannot be attached to a field. var nonfield = ''; // holds the first field we encounter that has a validation error. Cheap way to set focus to the first bad item. Won't always work and we should redo. var first = null; // On each validation message, try and find its control. Ext.each(validations, function(item) { // Get the form (could be a subview) that this validation belongs to. var parent_form_id = item.control_id; var parent_view = Ext.getCmp(parent_form_id); if (parent_view) { var field = Trakkware.ViewFramework.findFieldByDatafield(parent_view, item.property); if (field && field.markInvalid) { if (first == null) first = field; field.markInvalid(item.msg); } else { nonfield += item.msg + '
    '; } } else { nonfield += item.msg + '
    '; } }); // Sets focus to the first field that failed validation. function setFocusToFirst() { if (first != null) { first.focus(true); } } if (nonfield != '') { Ext.Msg.alert('Validation Error', 'Could not complete the action because:
    ' + nonfield, function() { setFocusToFirst(); }); } else { setFocusToFirst(); } return; // Pass the validations on to subviews! It's SO EASY! Ext.each(apply_to._registered_subviews, function(subview) { subview.fireEvent('validations', validations); }); }); // React to a store loading for the first time. apply_to.on('controlsloaded', function(data) { // Fire react on each picklist. It will react if it needs to. Ext.each(apply_to._registered_picklists, function(picklist) { picklist.fireEvent('react', data); }); // Important this event does not bubble. return false; }); // Public // apply these methods to the apply to object. Ext.apply(apply_to, { // Returns true if the event name exists for this object. hasEvent: function(event_name) { var evt = apply_to.events[event_name]; return Ext.isObject(evt) || (evt === true); }, // // Parameter and Parent setup // // Access to the view's name. getViewName: function() { if (config.ViewName) return config.ViewName; return null; }, // Parameters and their access methods. getControlParameters: function() { if (config.Parameters) return Ext.apply({}, config.Parameters.Control); else return {}; }, getViewParameters: function() { if (config.Parameters) return Ext.apply({}, config.Parameters.View); else return {}; }, getParameters: function() { return { View: this.getViewParameters(), Control: this.getControlParameters(), Interal: this.getInternalParameters() } }, getInternalParameters: function() { return Ext.apply({}, config.Parameters.Internal); }, getInitialQueryModifiers: function() { if (config.Parameters) return config.Parameters.InitialQueryModifiers; else return {}; }, // Returns subview property names of the subviews with with a command specified mapped to them. getSubviewMapsForCommand: function(parent_command) { var results = []; var maps = config.SubviewMaps; if (maps) { Ext.iterate(maps, function(property) { var action_map = maps[property].action_map; if (Ext.isArray(action_map[parent_command]) && action_map[parent_command].length > 0) { results.push(property); } }); } return results; }, // Returns the action array in its entirety. getActionArray: function() { return config.ActionArray; }, // Returns a bool indicating whether this view has a parent. isSubview: function() { if (!Ext.isEmpty(config.Parent)) return true; return false; }, // Returns the property name that was provided in config. getPropertyName: function() { if (!Ext.isEmpty(config.PropertyName)) return config.PropertyName; return null; }, // Returns the matching parent command for the local command provided or null if none. getParentCommandMapTo: function(local_command) { var pcm = config.ParentCommandMap; if (pcm) { var results = []; Ext.iterate(pcm, function(parent_command) { if (pcm[parent_command].indexOf(local_command) > -1) { results.push(parent_command); } }); return results; } return null; }, // // Actions // // Access to the view's action definition object. getActionDefinition: function(command) { if (config.ActionArray && config.ActionArray[command]) return config.ActionArray[command]; else return null; }, // Access to the unique control identifier. getControlIdentifier: function() { if (_ControlID) return _ControlID; else return null; }, // Registers this control for broadcasting and listening. registerForState: function() { // Register this view as a stateful one if ControlID is existing. if (_ControlID) { Trakkware.StateHash.registerListeningView(_ControlID, this); } }, // Returns the data held in the registered datafields. actionDataProvider: function() { var fields = apply_to._registered_datafields; var data = {}; Ext.each(fields, function(field) { if (!Ext.isEmpty(field.datafield) || !field.isUIMarkerType === true) { var field_value = field.getValue(); if (field.getXType() == 'datepicker' || field.is_date === true) { // Format Date values. field_value = new Date(field_value); } data[field.datafield] = field_value; } }); Ext.each(apply_to._registered_subviews, function(subview) { var list = subview.getValue && subview.getValue(); if (list) { data[subview.datafield] = list; } }); return data; }, // Returns the array of fields registered as datafields. getRegisteredDatafields: function() { return apply_to._registered_datafields; }, removeRegisteredDatafield: function(control) { apply_to._registered_datafields.pop(control); }, getRegisteredSubviews: function() { return apply_to._registered_subviews; }, getTransactionals: function() { return apply_to._registered_transactionals; }, getPreRegisteredSubviews: function() { return apply_to._preregistered_subviews; }, resetTransactionals: function() { apply_to._registered_transactionals = []; }, resetDirtyables: function() { apply_to._registered_dirtyable = []; }, // // Group-related // // Returns the group header tied to the property name supplied. getGroupHeader: function(property_name) { if (config.GroupHeaders && config.GroupHeaders[property_name]) return config.GroupHeaders[property_name]; return null; }, // // Query Modifying controls // // controls should call this function when they change. modifierChanged: function(control) { apply_to.fireEvent('modifierchanged', control); }, // // Subview-related: // // Gets parameter maps for a subview. getSubviewMap: function(property_name) { if (!Ext.isEmpty(property_name) && config.SubviewMap && config.SubviewMap[property_name]) { return config.SubviewMap[property_name]; } return null; }, // // Dirty and Form-related: // // Indicates if this view is considered dirty. isDirty: function(include_subviews) { var result = false; Ext.each(apply_to._registered_dirtyable, function(dirty) { // When include_subviews is false, do not consider trakkware_subview for isDirty. if (include_subviews != false || dirty.getXType() != 'trakkware_subview') { var is_dirty = dirty.isDirty(); if (is_dirty === true) { result = true; return false; } } }); return result; }, // performs the things that need to occur when dirtiness is encountered. // Changes button text // Enables/Disables button performDirtyDuties: function(form, reset) { // alert(form.getViewName() + ' has performDirtyDuties called on it with reset = ' + reset); // Check for required options. if (Trakkware.ViewFramework.requireOption(config, 'onDirtyArray', 'Trakkware.View.performDirtyDuties') == false) return; // Get an array of things that should change when dirty happens. var changes = config.onDirtyArray; var tbar = (form.getTopToolbar ? form.getTopToolbar() : null); var bbar = (form.getBottomToolbar ? form.getBottomToolbar() : null); // Inefficient.. do this a different way in the future for speed gains. Ext.each(changes, function(action) { var property_name = action['property_name']; var changeText = action['changeText']; var enable = action['enable']; //alert(form.getViewName() + ' property = ' + property_name + ' :: This is an iteration of the changes array'); // Holds a button that we are looking for. var button = undefined; // First check the topbar, if there was one. if (tbar) { Ext.each(tbar.findBy(function(thing) { if (thing && thing.PropertyName) return true; }), function(tbar_item) { if (tbar_item.PropertyName == property_name) { button = tbar_item; return false; } }); } // Next check the bottom bar. if (!button && bbar) { Ext.each(bbar.findBy(function(thing) { if (thing && thing.PropertyName) return true; }), function(bbar_item) { if (bbar_item.PropertyName == property_name) { button = bbar_item; return false; } }); } // Lastly, check the form items. if (!button && form.items) { button = Trakkware.ViewFramework.findFieldByPropertyName(form, property_name); } // When a button is found, perform if (button) { if (reset == true) { // very important to set change_back_to something. // When a button is clicked, it uses existence of change_back_to // to indicate whether a confirm-on-dirty should be shown if applcable. var changeback = button.changebackto; if (changeback) button.setText(changeback); if (enable == true) button.disable(); } else { if (!Ext.isEmpty(changeText)) { // Set the button's change-back-to text so the logic above this can know to change text back on reset. var current_text = button.getText(); if (current_text !== changeText) { button.changebackto = current_text; button.setText(changeText); } } if (enable == true) { button.enable(); } } } }); }, // // ACTION PROCESSING including TRANSACTIONS // // Processes actions for buttons, view-links, anything that needs an action to perform. // Expected config options: // ViewName: The view to use for this command. If none is specified then the current view is used. // Command: The command related to this button. // Parameters: A parameters object from the view's config. Needs to have // .Control and .Internal already intact. // Callback: Called when the action handler is complete. A success bool is the only parameter of the callback function. // NoBroadcast: Handle this action without broadcasting it to the world! // DontAdjustParams: (true/false) When true, the parameters provided will not be adjusted by constructActionParameters // Map: A map to apply to view params before using them. // PassControl: (true/false) Indicates this action should pass control to the new view being launched or inlined. // RequiresSelectedRow: (true/false) Override for action.require_row or for viewlinks which have no action associated. actionHandler: function(control, config) { // Several easy-reference vars. var that = this; var current_viewname = this.getViewName(); // Validate options if (Trakkware.ViewFramework.requireOption(config, 'Command', 'Trakkware.View.actionHandler') == false) { if(Ext.isEmpty(config.subview_reload)) { return; } } // If ViewName is not provided, use the current view. if (Ext.isEmpty(config.ViewName)) config.ViewName = this.getViewName(); // Get the action for this button's command var action = null; // Only set action if it is a locally known action for this view. if(config.ViewName == this.getViewName()) action = this.getActionDefinition(config.Command); if (Ext.isEmpty(action) && current_viewname == config.ViewName) { // This would be nice to have, but action is empty for ViewLinks that go to the view currently. //alert(this.getViewName() + ':\r\nTrakkware.View.actionHandler was called with an action that does not exist: ' + Ext.encode(config)); //return; } // If we are passing control in one way or another, set the passing state to true // so that semimodality all works out. if(config.PassControl == true || (action && Ext.isEmpty(action.success_command) == false)) { passing_state = true; } // If this action requires a selected row, check for one. if (config.RequiresSelectedRow == true || (action && action.require_row == true)) { if (this.hasSelectedRow && this.hasSelectedRow() == false) { return; } } // Check if this control is in a transactionally-invoked state. If so, and the button is clicked again, // it means to revoke the transactional behavior that is linked to the button. if (control.revoke_transaction) { // Revoke the transaction held in revoke_transaction. this.removePendingTransaction(control.revoke_transaction); // If there is a form attached and it has a transaction revoke method, use it! if (control.attachedToForm && control.attachedToForm.transactionRevoke) { var behavior = null; if (action) behavior = action.transaction_invoke; // Pass the behavior to the attached form's transaction revoke method so it can put things back to normal. control.attachedToForm.transactionRevoke(behavior, control); delete control.revoke_transaction; } } else { // Test Code: What are the config parameters before being through parameter construction? // alert('pre-built = ' + Ext.encode(config.Parameters)); // Get parameters for the action. var full_parameter_object = {}; if(config.DontAdjustParams !== true) { full_parameter_object = this.constructActionParameters(control.attachedToForm, this.getParameters()); } else { full_parameter_object = config.Parameters; } // When an explicit map is supplied, apply it before doing expected. if(config.Map) { //alert('expected = ' + Ext.encode(action.expected) + '\r\n and the view parameter is ' + Ext.encode(parameter_object.View)); var expected = (action && action.expected) ? action.expected : null; full_parameter_object.View = Trakkware.ViewFramework.applyMapAndExpected(config.Map, expected, full_parameter_object.View); } var parameter_object = { View: {}, Control: {}, Internal: {} }; Ext.apply(parameter_object.Internal, full_parameter_object.Internal); // Test Code: What came back from the construct method? // alert('before pairing down: ' + Ext.encode(full_parameter_object)); // Added new logic to only use expected when it exists and has a length. if (action && config.DontAdjustParams != true) { // Apply expected filter unless instructed otherwise. if(action.ignore_expected !== true) { // Pare down View and Controls parameters using action.expected. Ext.each(action.expected, function(expected_name) { if (Ext.isDefined(full_parameter_object.View[expected_name])) parameter_object.View[expected_name] = full_parameter_object.View[expected_name]; if (Ext.isDefined(full_parameter_object.Control[expected_name])) parameter_object.Control[expected_name] = full_parameter_object.Control[expected_name]; }); } else { // Use it all if ignore_expected is set. parameter_object = full_parameter_object; } if(!Ext.isEmpty(action.dynamic_property) && config.Parameters.View) { // Check for a dynamic command. if(action.dynamic_command !== null) { config.command = action.dynamic_command; } // find properties that are not in the new .View but exist in the sent-in one. Ext.iterate(config.Parameters.View, function(pn) { if(!parameter_object.View[pn]) { parameter_object.View[pn] = config.Parameters.View[pn]; } }); } } else { parameter_object = full_parameter_object; } // Test Code: What are the config parameters after being through parameter construction? // alert(config.Command + ' built = ' + Ext.encode(parameter_object)); // Check if this action launches a different view. // The trigger is if a non-empty view name different from the current view name is provided. // or if action.launch is not set to 'none'. // First check if there is a subview that needs to reload. if(action && !Ext.isEmpty(action.reload_subview)) { that.fireEvent('reloadsubview', action.reload_subview, full_parameter_object); } if (!action || (current_viewname != config.ViewName || (config.launch && config.launch != 'none')) || (action && action.launch && action.launch != 'none')) { // get how we are going to launch this view.. var launch = null; if(config.launch) launch = config.launch; if(Ext.isEmpty(launch) || launch == 'none') launch = (action && action.launch ? action.launch : 'window'); // If there is a performSimpleViewChange function defined for this // call it instead of launchView. This is for layouts that can // perform view state changes without having to reload themselves // such as the map. var skip_launch = false; if (this.performSimpleViewChange) { skip_launch = this.performSimpleViewChange(command, parameter_object.View); } var broadcast_params = Ext.apply({}, parameter_object.View); // Attach a broadcast object. var broadcast_object = { Command: config.Command, RawData: parameter_object.View, ActionDefinition: action, ControlID: _ControlID } // When the simple view change returns true, do not launch a view. if (skip_launch != true) { var windowMgr = apply_to.getWindowMgr(); if(launch == 'window' && windowMgr != null) { var view = Trakkware.ViewFramework.createView({ view: config.ViewName, command: config.Command, viewParams: parameter_object.View, callback: function(viewobject) { windowMgr.addView({ view: viewobject, launch: launch, modalParent: that, replace: config.PassControl, parentRefreshView: that }); }, failureCallback: function(response) { alert('nothing happening in this failure callback.'); } }); } else { Trakkware.ViewFramework.launchView({ view: config.ViewName, command: config.Command, Broadcast: broadcast_object, ControlID: _ControlID, viewParams: parameter_object.View, launch: launch, launchingView: this, controlParams: parameter_object.Control, internalParams: parameter_object.Internal, sm: function(final_result) { if (Ext.isFunction(config.Callback)) { config.Callback(final_result); } }, PassControl: config.PassControl, NoBroadcast: config.NoBroadcast }); } } } else { function final_cleanup() { // Unmask.. that.fireEvent('mask', { Activate: false }); } // calculate if the form is dirty var dirty = this.isDirty(); /* // Start a mask.. if (!Ext.isEmpty(action.mask_text)) { this.fireEvent('mask', { Activate: true, ViewName: this.getViewName(), Command: config.Command }); } */ // Perform a normal action and get a transaction back if that was the case. var transaction = this.performAction({ Command: config.Command, Parameters: parameter_object, IsDirty: dirty, ActionDefinition: action, NoBroadcast: config.NoBroadcast, ControlID: _ControlID, failureCallback: final_cleanup, successCallback: final_cleanup }); var transaction_invoke = action ? action.transaction_invoke : null; var special_ten = false; if (action && transaction_invoke == 10) special_ten = true; // define function used in transactioning. function do_invokes(data) { var invoke_parameters = Ext.isDefined(data) ? data : parameter_object.View; if (control.attachedToForm && control.attachedToForm.specialInvoke) { result = control.attachedToForm.specialInvoke(control, config.Command, action.transaction_invoke, invoke_parameters, revoke_text); finish(result); } else if (that.specialInvoke) { // call the special invoke method. If true is returned, do not continue on with this action. result = that.specialInvoke(control, config.Command, action.transaction_invoke, invoke_parameters, revoke_text); finish(result); } else { final_cleanup(); } } function finish(success) { // If result was true, fire dirtiness and do not continue with this action. if (success === true) { that.enableBubble('dirty'); that.fireEvent('dirty', control); } // Figure out the absolute final success of this action and call // the callback with its value. var final_result = true; if (result === false) final_result = false; if (Ext.isFunction(config.Callback)) { config.Callback(final_result); } final_cleanup(); } // Transaction invokes.. if (transaction_invoke && (transaction || special_ten == true)) { var result = false; if (transaction != false || special_ten == true) { // Get revoke info. var revoke_text = action.transactional_revoke; // Attach this transaction to the control unless it is the very special case of // behavior 10. We should improve the localized behavior section. if (action.transaction_invoke != 10) { control.revoke_transaction = transaction; do_invokes(); } else { // When a #10 occurs, make a special call out and then fill the new form with its results. Trakkware.ViewFramework.performMethodCall(that, { view: config.ViewName, JustResults: true, command: config.Command, actionParams: parameter_object.View }, function(used_config, data) { // Get the list from data response. if (data.list) data = data.list; // This data should be in an array since it is a list, so take the first one if so. if (Ext.isArray(data) && data.length > 0) data = data[0]; do_invokes(data); }, final_cleanup); } } else { result = transaction; finish(result); } } } } }, // Fires when a broadcast has occured. // Expected options: // Command: The new command // Data: Additional parameters. broadcastHandler: function(broadcast_config) { if (Trakkware.ViewFramework.requireOption(broadcast_config, 'Command', 'Trakkware.View.broadcastHandler') == false) return; if (Trakkware.ViewFramework.requireOption(broadcast_config, 'Data', 'Trakkware.View.broadcastHandler') == false) return; // When NULL:NULL is broadcast, reset the view parameters to what they were initially. if (broadcast_config.Data.NULL) { config.Parameters.View = Ext.apply({}, config.Parameters.Control); } else { // Set the view parameters to include broadcast params. config.Parameters.View = Ext.apply(config.Parameters.View, broadcast_config.Data); } // Test code to see what is being handled. //alert('in ' + _ControlID + ' and config params are ' + Ext.encode(config.Parameters)); // Signal to stores that modifiers have changed and get a result of whether any were actually changed. var reload = apply_to.fireEvent('broadcastmodifiers', broadcast_config); // Check if the new command differs from this new one. If so, we need to do a performAction. if (broadcast_config.Command != config.Command) { // Get the params to send along. var view_parameters = this.getViewParameters(); // First, check if the view has a simple state changer and use it instead. if (this.performSimpleViewChange) { this.performSimpleViewChange(broadcast_config.Command, this.getViewParameters()); } else { var action_config = { ViewName: this.getViewName(), Command: broadcast_config.Command, Parameters: Ext.apply({}, this.getParameters()), NoBroadcast: true }; // Test code to see what perform action is getting. //alert('Broadcast handler giving this action config to View.actionHandler:\r\n' + Ext.encode(action_config)); // don't fire reload, the action handler should take care of it. reload = false; // Let the action handler deal with what should happen due to hearing this broadcast. // I'm sending {} as control so the actionHandler is happy. this.actionHandler({}, action_config); } } else { // When the commands match, do a refresh on the view. this.fireEvent('reloadview'); } // This only happens if the view layout has defined .reloadForBroadcast if (reload == true) { this.fireEvent('reload'); } }, // Constructs a .Parameters object for actions and view launchings to use. // parameters should be the .Parameters object from a config constructActionParameters: function(form, parameters) { // Start with the Parameters object from config. if (!Ext.isDefined(parameters)) parameters = {}; // Start with an empty object and apply Control and then View parameters. var view_parameters = Ext.apply({}, parameters.Control); Ext.apply(view_parameters, parameters.View); // If there is a form to get data from, get that data and apply it to the view params. if (form) { if (form.getData) { var data = form.getData(); view_parameters = Ext.apply(view_parameters, data); } else if (form.actionDataProvider) { var data = form.actionDataProvider(); view_parameters = Ext.apply(view_parameters, data); } } else if (this.actionDataProvider) { // If no form is available to get data from, try the view's actionDataProvider method. var data = this.actionDataProvider(); view_parameters = Ext.apply(view_parameters, data); } // Set the View property to this new set of params and off we go! parameters.View = view_parameters; return parameters; }, // Performs a view action. Expected config options: // // ViewName: The name of the view that this action applies to. // Command: Indicates the action that should take place. // ChildTransactions: An array of child transactions. Used when a transactional action is taking place. // Parameters: A parameters object with .View set. // IsDirty: true/false indicating whether dirtiness is currently in effect. // NoBroadcast: Indicates not to perform broadcasts during this action. // failureCallback: Function invoked when the action fails. // successCallback: function invoked when the action succeeds performAction: function(config) { var me = this; // Validate incoming options if (Trakkware.ViewFramework.requireOption(config, 'Command', 'Trakkware.View.performAction') == false) return; // Use the action state to fill config. If the method parameter // is true, then send in this view's name as the view. This will // trigger the view action method to occur. If anything is returned, then this was // a transactional action and needs to be passed up or stored. var action = this.getActionDefinition(config.Command); // Check if this is a transactional action. var maps_to_parent_command = me.getParentCommandMapTo(config.Command); // THIS IS WHERE IT IS DECIDED IF AN ACTION IS TRANSACTIONAL! // If an array came back from getParentCommandMapTo AND it has values, then this is a transactional value. var transactional = (Ext.isArray(maps_to_parent_command) && maps_to_parent_command.length > 0); // Indicates this action is a special invoke #10 if transactional. var special_ten = false; if (action.transaction_invoke && action.transaction_invoke == 10) special_ten = true; // Get child transactions that need to go along with this action, but // not when transactional and there is a transactional invoke behavior. var child_transactions = []; var get_children = true; if (transactional == true) { if (action.transaction_invoke) get_children = false; } if (get_children == true) { child_transactions = me.getTransactionsFor(config.Command); } // Capture the is dirty value for JUST this thing, not its children also. // This must be provided to performAction so that the top-level action does not get included // in a transaction just because it has dirty children. var is_dirty = this.isDirty ? this.isDirty(false) : false; var config = { ControlID: _ControlID, command: config.Command, view: (Ext.isDefined(action.method) && action.method == true ? this.getViewName() : null), ActionDefinition: action, IsDirty: is_dirty, IsTransactional: transactional, TransactionParentCommand: maps_to_parent_command, ChildTransactions: child_transactions, TransactionFormID: this.id, NoBroadcast: config.NoBroadcast, actionParams: config.Parameters.View, reloadOnSuccess: action.reloadOnSuccess, cancelOnSuccess: action.cancelOnSuccess, useConfirmation: action.confirm, confirmationMessage: action.confirm_msg, confirmationTitle: action.confirm_title, successMessage: action.success_msg, resetDirtyOnSuccess: action.reset_dirty_on_success, confirmOnDirty: action.confirm_on_dirty, dirtyConfirmationMessage: action.dirty_msg, dirtyConfirmationTitle: action.dirty_title, successCommand: action.success_command, isDirty: config.IsDirty, form: me, failureCallback: config.failureCallback, successCallback: config.successCallback, ViewObject: me }; // Perform this action and try to receive a transaction back. var transaction = Trakkware.ViewFramework.performAction(config, me); // When a transaction is returned, add it to the pending list. if (transaction) { // The special case of a number ten should not add pending transactions. // There should be an action on the newly added form that is mapped to the parent's save if (special_ten != true) { this.addPendingTransaction(transaction); return transaction; } } else if (transactional == true) { // When this action was transactional but did not produce a transaction, we still // need to alert the caller that they should continue. return true; } // No further processing is required, return false. return false; }, // // Transactions // // Adds a transaction to this view's list of pendings. addPendingTransaction: function(transaction) { if (transaction) { var t = Ext.apply({}, transaction) apply_to._pending_transactions.push(t); } }, // Removes the transaction from the list of pendings. removePendingTransaction: function(transaction) { if (transaction) apply_to._pending_transactions.pop(transaction); }, // Returns the list of pending transactions for this view. getAllPendingTransactions: function() { // Retrieve pending transactions for this view and all of its subviews. return apply_to._pending_transactions; }, // Gets the transactions for this view and its subviews for the command provided. // Its not perfect, but if get_local = true, then transactions are merely gathered for this // view for the command specified by parent_command. getTransactionsFor: function(parent_command, get_local) { var that = this; //alert('getting transactions for ' + that.getViewName() + '\r\nreg trans: ' + apply_to._registered_transactionals.length + ' and pending trans: ' + _pending_transactions.length); // Our final results array. var results = []; // First get the pending transactions in this view that match. Ext.each(apply_to._pending_transactions, function(transaction) { // Include pending transactions if their parent command matches or if // get_local is set to true since getting transactions for this view should // always include any pendings. if (transaction.ParentCommand == parent_command || get_local === true) { results.push(transaction); } }); // Next test registered hidden actions. These will be things such as Save button that are per-row in a formlist. Ext.each(apply_to._registered_transactionals, function(hidden) { var command = hidden.Command; // reget the control so we can check its revoke transaction. var control = hidden.Control; // Get the array of parent commands that are mapped to this button. var parent_command_array = hidden.ParentCommand; // Need to see if any of the forms buttons are in revoke.. var in_revoke = control.attachedToForm.InRevoke(); // The hidden's parent command must match the current parent command. // or get local is true and the parent command matches this hidden's command. if ((get_local == true && parent_command == command) || (in_revoke != true && parent_command_array.indexOf(parent_command) > -1)) { // Get the action for this command. var action = that.getActionDefinition(command); if (action) { // If it is only to be added when dirty, check if dirty. if (action.transactional_only_on_dirty == true) { if (control.attachedToForm && control.attachedToForm.isDirty) { // Look for dirty. When it is false, return. This causes the Ext.each to move to the next registered hidden control var dirty = control.attachedToForm.isDirty(); if (dirty == false) return; } } // Try to derive view params for this action. var data = {}; if (control.attachedToForm && control.attachedToForm.getData) { data = control.attachedToForm.getData(); } // Setup parameters for this action. var parameters = Ext.apply(that.getViewParameters(), data); // Cause the action to return a transaction. var transaction = { view: that.getViewName(), command: command, data: parameters, ParentCommand: parent_command, control_id: control.attachedToForm.id } results.push(transaction); } } }); // Get subviews that are mapped to this parent command. var mapped = this.getSubviewMapsForCommand(parent_command); // Try to get child transactions if there are mappings for this command. if (Ext.isArray(mapped) && mapped.length > 0) { // Check each subview that has been registered. Ext.each(apply_to._registered_subviews, function(subview) { // If the subview's property name (datafield) exists in the mapped array, then get its transactions. var index = mapped.indexOf(subview.datafield); if (index > -1) { // Get pending transactions from the subview for this command and add them to the child_transactions array. var pending_subview_transactions = subview.getTransactionsFor(parent_command); if (Ext.isArray(pending_subview_transactions)) { Ext.each(pending_subview_transactions, function(t) { results.push(t); }); } } }); } return results; }, // Method that is provided to subviews for them to call when a transactional action is invoked or revoked. listenForSubviewTransaction: function(how, transaction) { if (how == 'add') { // Add the transaction to the pendings list. If this is a subview, this call // will cause the transaction to be passed up to a parent, if applicable. addPendingTransaction(transaction); } else if (how == 'revoke') { // revoke the transaction provided. revokeTransaction(transaction); } }, // Called by the StateHash when an other control broadcasts data. // Expected config options: // Command: The command that was broadcast. // Data: Data broadcast. Listen: function(config) { var action_array = this.getActionArray(); var me = this; // Validate incoming options. if (Trakkware.ViewFramework.requireOption(config, 'Command', 'Trakkware.View.Listen') == false) return; if (Trakkware.ViewFramework.requireOption(config, 'Data', 'Trakkware.View.Listen') == false) return; // Ease of use vars. var broadcast_params = config.Data; var command = config.Command; // Ensure we always have something to work on. if (!Ext.isDefined(broadcast_params)) broadcast_params = {}; // Holds the action states that can possibly be triggered by this broadcast. var possible_states = {}; // Get filters that are listening. var filters = me.getListeningModifierNames ? me.getListeningModifierNames() : []; // If the empty token is being broadcast and something is listening for that, use it. if (broadcast_params && broadcast_params['NULL'] == 'NULL') { // When empty is broadcast and heard, ignore everything else. Ext.iterate(action_array, function(action_name, action_value) { var listenfor = action_value.listenfor; if (listenfor) { if (listenfor['NULL']) { possible_states[action_name] = action_value; return false; } } }); } else { // Check each broadcast_param and see if it should trigger based on the data Ext.iterate(broadcast_params, function(broadcast_name, broadcast_value) { // if an action's listen_for has a matching parameter, look into it. // ALL parameters for the action's listen_for must be fulfilled in order to invoke it. Ext.iterate(action_array, function(action_name, action_value) { var listenfor = action_value.listenfor; if (listenfor) { if (listenfor) { if (listenfor[broadcast_name]) { possible_states[action_name] = action_value; } } else { // Check if any filters are listening for this broadcast name. if (filters && filters[broadcast_name]) { possible_states[action_name] = action_value; } } } }); }); } //for(var v in possible_states) alert(ControlID + ' has a possible state change to ' + v); // Iterate each state and try to fill it. If it successfully filled, put it into final_candidates. var final_candidate = null; var final_command = null; var high_score = 0; Ext.iterate(possible_states, function(state_name, state) { // Attempt to fill each listenfor. If the fill is successful, make note // of the state's param count. The highest one will be invoked. var listenfor = state.listenfor; var candidate = {}; var add = true; var count = 0; if (listenfor['NULL'] == 'NULL' && broadcast_params['NULL'] == 'NULL') { count++; candidate['NULL'] = 'NULL'; } else { Ext.iterate(listenfor, function(name, value) { // MAPPING: broadcast value is mapped to a listenfor name. //alert(ControlID + ' trying to listen for parameter ' + name + ' and found the value ' + broadcast_params[name]); if (Ext.isDefined(broadcast_params[name])) { count++; candidate[value] = broadcast_params[name]; } else { add = false; return false; } }); } Ext.each(filters, function(name) { // MAPPING: broadcast value is mapped to a listening_filter name. //alert(ControlID + ' trying to listen for filter ' + name + ' and found the value ' + broadcast_params[name]); if (Ext.isDefined(broadcast_params[name])) { count++; candidate[name] = broadcast_params[name]; } }); if (add == true && count > high_score) { final_candidate = {}; for (var value in candidate) final_candidate[value] = candidate[value]; final_command = state_name; high_score = count; //for(var fc in final_candidate) alert(ControlID + ' new final candidate has ' + fc + ' = ' + final_candidate[fc]); } }); //for(var fc in final_candidate) alert(ControlID + ' has a final candidate with ' + fc + ' = ' + final_candidate[fc]); //alert(_ControlID + ': Final candidate is ' + Ext.encode(final_candidate) + ' and final command is ' + final_command); // If something was found, invoke it! if (final_candidate != null && final_command != null) { Trakkware.StateHash.applyExistingState(_ControlID, final_command, final_candidate); // signal to this view that a broadcast state change has occured. this.broadcastHandler({ Command: final_command, Data: final_candidate }); } }, // // Confirmation wrappers // // Performs a confirmation using the configuration msg and title. // The handler function is called with the result of the confirmation. // config = { title: '', msg: '', handler: function(result) {} // Since we are using Ext.Msg.confirm, you must keep in mind: // THIS METHOD IS NON-BLOCKING!!!! confirm: function(config) { if (config) { var title = config.title ? config.title : ''; var msg = config.msg ? config.msg : ''; var handler = config.handler; if (title && msg && handler) { Ext.Msg.confirm(title, msg, handler); } } }, // // Titling // // Takes a title, which is an XTemplate template string, and applys data to it and sets this's title applyTitle: function(title, data) { if (this.setTitle) { var text = Trakkware.ViewFramework.applyTemplate(title, data); this.setTitle(text); } }, getPassingState: function() { return passing_state; }, setPassingState: function(value) { passing_state = value; }, getWindowMgr: function() { return apply_to._window_mgr; }, setWindowMgr: function(mgr) { apply_to._window_mgr = mgr; }, // // Toolbars // // Takes a toolbar config object and turns it into a query modifiers toolbar. constructToolbar: function(toolbar_config) { if (toolbar_config) { var toolbar = []; Ext.each(toolbar_config, function(option) { if(option.xtype != 'trakkware_button') { // Get view name from the config supplied way up above. option.ViewName = apply_to.getViewName(); option.rm = apply_to.registerQueryModifier; option.mc = apply_to.modifierChanged; option.gm = apply_to.getQueryModifiers; } toolbar.push(option); }); return toolbar; } return null; }, whatAmI: function() { return config.ViewName + '\r\n' + config.Command; } }); return apply_to; }; Ext.ns('Trakkware', 'Trakkware.View'); // config options: // ViewName: The view the store will use to get data. // Command: The command used to get data. // Parameters: The base parameters this store will use when loading, along with the query modifiers // gathered from its registered modifiers. // UseFullViewRefresh: (true/false) When true, a refresh of this store causing the entire view to be reloaded // instead of just reloading the data. Had to put this in because of dynamic fields. // The reload will fire the 'fullreload' event on StoreOwner if it is set. // StoreOwner: The view that owns this store. // NOTE: Parameters.View is used as the store's base parameters. // ModifierConfirmation: // Config object that indicates how to handly dirty forms when query modifiers change. // See ExtViewBuilder.getViewJavascript for definition. // ds: A datastore definition object. // qm: A query modifier object to use during first load. // ib: An initial broadcast state object that will be checked for initial modifier values. // Fires: // title(data): The data parameter is record.data from the first row returned. // Listens For: // registermodifier({ // control, // type, // getValue }): registers a modifier as something to gather when the store reloads. // modifierchanged(control): The store reloads when it hears a modifier change. Trakkware.View.Store = Ext.extend(Ext.data.Store, { constructor: function(config) { this.addEvents('registermodifier', 'modifierchanged', 'mask', 'broadcastmodifiers', 'emptydataset'); // Validate required options. Trakkware.ViewFramework.requireOption(config, 'ViewName', 'Trakkware.View.Store.constructor'); var me = this; this.my_id = Ext.id(); // region: Query Modifier // Query modifiers registered with this store, and a way to get them. var _registered_modifiers = []; this.getRegisteredModifiers = function() { return _registered_modifiers; } this.pushModifier = function(modifier) { _registered_modifiers.push(modifier); } // Returns a list of query modifiers that have a PropertyName. Those are the ones listening for broadcasts. this.getListeningModifierNames = function() { var array = []; Ext.each(_registered_modifiers, function(modifier) { if (modifier.PropertyName) array.push(modifier.PropertyName); }); return array; } // Method invoked when the registermodifier event occurs. // config options: // control: The actual control. // type: 'groupby', 'sort', 'filter', search', 'pager' // getValue: A function that takes the control and returns its value. If nothing is supplied // then control.getValue() is called function registerQueryModifier(modifier_config) { // Validate require options. if (Trakkware.ViewFramework.requireOption(modifier_config, 'control', 'Trakkware.View.Store.registerQueryModifier') == false) return; if (Trakkware.ViewFramework.requireOption(modifier_config, 'type', 'Trakkware.View.Store.registerQueryModifier') == false) return; if (Trakkware.ViewFramework.requireOption(modifier_config, 'getValue', 'Trakkware.View.Store.registerQueryModifier') == false) return; // When registering a modifier, add a listener so we can hear when it changes. var control = modifier_config.control; var confirm = config.ModifierConfirmation; control.on('modifierchanged', function(control) { //When the store's owner is dirty, check if we should do a confirmation before continuing with the modifierchanged event. if (config.StoreOwner.isDirty && config.StoreOwner.isDirty() == true) { var command = confirm.Command; if (!Ext.isEmpty(command)) { // Confirm this modifier change. Ext.Msg.confirm(confirm.Title, confirm.Message, function(result) { if (result == 'yes') { me.fireEvent('performactionondirties', { ViewName: config.ViewName, Command: command, Callback: function(success) { reload_the_store(); } }); } }); } } else { reload_the_store(); } // reload the store.. function reload_the_store() { me.load() } }); // Check if this modifier should have its value set from initial state params. if (config.ib && modifier_config.PropertyName) { var paramobject = config.ib.paramobject; if (paramobject) { if (paramobject[modifier_config.PropertyName] && control.changeForModifier) control.changeForModifier(paramobject[modifier_config.PropertyName]); } } me.pushModifier(modifier_config); } // Return the current group being used. this.getCurrentGroup = function() { var result = null; Ext.each(_registered_modifiers, function(modifier) { if (modifier.type == 'groupby') { result = modifier.getValue(); return false; } }); return result; } // Returns the query modifier object ready to be encoded. this.getQueryModifierObject = function() { var result = {}; Ext.each(this.getRegisteredModifiers(), function(qm) { var modifiers = qm.getValue(); if (modifiers != null) { if (qm.type == 'filter') { if (!result.filter) result.filter = []; result.filter.push(modifiers); } else { Ext.apply(result, modifiers); } } }); return result; } // If initial modifiers are supplied, try to stuff a sort into sort info. if (config.qm) { if (config.qm.sort) { config.sortInfo = { field: config.qm.sort, direction: config.qm.dir }; } } var first_load = true; var my_base_params = null; config = Ext.apply({ remoteSort: true, proxy: new Ext.data.HttpProxy({ method: 'POST', url: Trakkware.Handlers.MethodHandler, listeners: { exception: function(proxy, type, action, options, response, arg) { response = Ext.decode(response.responseText); if (response && response.result) { if (response.result == '0') { Ext.Msg.alert('Data loading error', 'Unable to load or change pages because: ' + response.msg); } else if (response.result == '1') { Ext.Msg.alert('A data reader error has occured, sorry but I cannot display your data because of it.'); } } me.fireEvent('mask', { Activate: false }); }, // Before reloading data, modifiers must be checked for values and included. beforeload: function(store, options) { if(first_load !== true && config.UseFullViewRefresh === true) { config.StoreOwner.fireEvent('fullreload'); return false; } // TESTING // alert('Options before meddling: ' + Ext.encode(options)); // allow controls using this store to mask themselves. me.fireEvent('mask', { Activate: true, ViewName: config.ViewName, Command: config.Command }); // Paramarray is the store owner's view parameters. var p = {}; p.paramarray = Ext.encode((config.StoreOwner && config.StoreOwner.getViewParameters ? config.StoreOwner.getViewParameters() : {})); // Apply initial query modifiers on first load if they exist. if (first_load == true) { // Turn off first-load. first_load = false; // Apply initial query modifiers if they were passed in. if (config.qm) { Ext.apply(p, config.qm); } // Apply initial broadcast as paramarray they were passed in. if (config.ib) { // This is where initial state params are added in to the first call. Ext.apply(options.paramarray, config.ib.paramobject); } } else { // Not first time thru. Get the query modifier object and apply it to p. var query_modifiers = me.getQueryModifierObject(); // We need to encode filters.. if (query_modifiers.filter) { query_modifiers.filter = Ext.encode(query_modifiers.filter); } // Get the current start/limit since the one in query_modifiers will be wrong. var real_start = options['start']; var real_limit = options['limit']; Ext.apply(p, query_modifiers); if (Ext.isDefined(real_start)) p['start'] = real_start; if (Ext.isDefined(real_limit)) p['limit'] = real_limit; } // Apply reload params if found. if(Ext.isDefined(me.reload_params)) { p.paramarray = Ext.encode(me.reload_params.View); } // Apply p to the options. options = Ext.apply(options, p); // TESTING: // alert('the beforeload options are ' + Ext.encode(options)); // Trakkware.ViewFramework.log(Ext.encode(options)); } } }), baseParams: { view: config.ViewName, command: config.Command, paramarray: Ext.encode(config.Parameters.View), viewparam: Ext.encode(config.Parameters.Internal) }, reader: new Ext.data.JsonReader({ root: 'list', successProperty: 'success', totalProperty: 'count', fields: config.ds }), listeners: { broadcastmodifiers: function(broadcast_config) { // TEST CODE: What was broadcast to the modifiers? // alert('heard broadcast modifiers in store.' + Ext.encode(broadcast_config)); var data = broadcast_config.Data; // Check for modifiers that need to change. var result = false; Ext.each(me.getRegisteredModifiers(), function(modifier) { // We only care about modifiers that have a property name assigned to them. if (!Ext.isEmpty(modifier.PropertyName)) { // If the broadcast params have a matching propertyname, change this modifier! if (data[modifier.PropertyName] && modifier.control.changeForModifier) { result = true; modifier.control.changeForModifier(data[modifier.PropertyName]); } } }); if (result == true) { this.load(); } }, registermodifier: function(modifier_config) { registerQueryModifier(modifier_config); }, load: function(store, data, options) { // When loading is complete, unmask! me.fireEvent('mask', { Activate: false, ViewName: config.ViewName, Command: config.Command }); // When an empty data set is loaded, fire an event to let the owning view know this fact. if (!data || data.length == 0) { this.fireEvent('emptydataset'); } } } }, config); Trakkware.View.Store.superclass.constructor.call(this, config); } }); Ext.ns('Trakkware', 'Trakkware.View'); // // BUTTON // // Expected config options: // ViewName: The viewname related to this button. Used only for ViewLinks. // Command: The command for the action that this button triggers. // Template: A template to use for the link/button's text. // ShowAsHyperlink: Indicates this button should display itself as a hyperlink, not a button. // ParentCommandMap: A map from a parent view that maps to this button's action. Used to know whether this button // should hide itself. // RenderAsSubview: Indicates the view is being rendered as a subview. // HideIfSubview: Indicates whether to hide this button if it is being rendered as a subview. // HideIfParentCommandIsMappedTo: Indicates that this button should hide if its parent view has a command mapped to it. // OnlyShowOnMouseover: Indicates this button should hide until a mouseover occurs. // AccessKeyAlt: The alt key to map to this button. // AccessKeyCode: A keycode that will trigger this button. // DynamicViewNameProperty: Property name of the property to use to get ViewName when launching a view from this action. // RequiresRow: Override to indicate this button requires a selected row or item in order to perform its action. // Map: An explicit map that will be applied to parameters before they are used. // text: Button text (from Ext.Button) // PassControl: (true/false) Indicates if this action causes the current view to cancel and its control objects passed on to the new view. Trakkware.View.ActionButton = Ext.extend(Ext.Button, { initComponent: function() { Trakkware.View.ActionButton.superclass.initComponent.call(this); this.addEvents('actionhandler', 'cancelview', 'registertransactional', 'reactdirty', 'resetdirty', 'registerdatafield'); this.enableBubble('actionhandler', 'cancelview', 'registertransactional', 'registerdatafield'); }, constructor: function(config) { // An easy reference var. var this_button = this; // Validate incoming. var method_name = 'ActionButton constructor'; Trakkware.ViewFramework.requireOption(config, 'Command', method_name); var dynamic_view_name = null; function click_action() { // Fire the action handler event when this button is clicked. this_button.fireEvent('actionhandler', this_button, { ViewName: dynamic_view_name || config.ViewName, Command: config.Command, launch: config.launch, Map: config.Map, PassControl: config.PassControl, RequiresSelectedRow: config.RequiresRow, Callback : function() { } }); } // apply additional button-related properties. config = Ext.apply(config, { getValue: function() { }, setValue: function(data) { // Check for a dynamic viewlink property. if(config.DynamicViewNameProperty !== null && data[config.DynamicViewNameProperty]) { dynamic_view_name = config.DynamicViewNameProperty; } // Check for show-on calculations. if(config.ShowOn != null) { var showon = Trakkware.ViewFramework.ProcessShowOn(config.ShowOn, data); if(showon == 'hide') this.hide(); } // If a template exists, use the data and template to replace this button's text. if (!Ext.isEmpty(config.Template)) { var text = Trakkware.ViewFramework.applyTemplate(config.Template, data); this_button.setText(text); } }, handler: function(button) { click_action(button); }, // A button is dirty if it has a transaction attached to it. isDirty: function() { if (this_button.revoke_transaction) return true; return false; }, listeners: { afterrender: function(button) { if(button.datafield) button.fireEvent('registerdatafield', button); }, beforerender: function(button) { var hide_after_render = false; if (config.RenderAsSubview == true) { if (config.HideIfSubview == true) { hide_after_render = true; } if (config.HideIfParentCommandIsMappedTo == true) { if (config.ParentCommandMap) { var this_buttons_command = config.Command; var pcm = config.ParentCommandMap; // Make an array of the parent commands that will trigger this button so that // we can quickly check the button against a parent command over in Trakkware.View.getTransactionsFor() var parent_commands = []; Ext.iterate(pcm, function(parent_command_name) { if (pcm[parent_command_name].indexOf(this_buttons_command) > -1) { parent_commands.push(parent_command_name); } }); if (parent_commands.length > 0) { hide_after_render = true; //alert(this_buttons_command + ' pcm = ' + Ext.encode(pcm) + ' parent commands = ' + Ext.encode(parent_commands)); // Fire the registertransactional event when this is a hidden, mapped button. button.fireEvent('registertransactional', this_buttons_command, parent_commands, button); } } } } if (config.OnlyShowOnMouseover == true) { button.on('afterrender', function(b) { b.getEl().fadeOut(); }); button.attachedToForm.getEl().on('mouseover', function() { button.getEl().show(); }); button.attachedToForm.getEl().on('mouseout', function() { button.getEl().hide(); }); } if (hide_after_render == true) { button.hide(); button.on('afterrender', function(the_button) { // If this button is in a formpanel, try to hide the entire formitem. var el = button.getEl(); var formitem = el.findParent('.x-form-item'); var formelement = el.findParent('.x-form-element'); if (formitem) { var fly = Ext.fly(formitem); fly.setHeight(0); fly.setStyle({ margin: 0, padding: 0 }); } }); } if (!Ext.isEmpty(config.AccessKeyAlt)) { /* temporarily turn off access keys. Trakkware.ViewFramework.keyMap.accessKey({ key: config.AccessKeyAlt, alt: true }, click_action, button); */ } //if(config.AccessKeyCode) { // var map = Ext.getBody().addKeyListener(Ext.EventObject.ENTER, function(e, target) { click_action();}); // map.stopEvent = true; //} } } }); Trakkware.View.ActionButton.superclass.constructor.call(this, config); } }); Ext.reg('trakkware_button', Trakkware.View.ActionButton); // // TREE PANEL // Trakkware.View.TreePanel = Ext.extend(Ext.tree.TreePanel, { initComponent: function(config) { // Call the superclass init first. Trakkware.View.TreePanel.superclass.initComponent.call(this, config); // Setup events this.addEvents('actionhandler', 'registertransactional', 'reactdirty', 'resetdirty', 'registerdatafield', 'registersemimodalwindow'); this.enableBubble('actionhandler', 'registertransactional', 'registerdatafield', 'registersemimodalwindow'); }, constructor: function(config) { var me = this; config.root = new Ext.tree.AsyncTreeNode({ expanded: false, children: [] }); function setKids(parent_node, data_list) { if(parent_node.hasChildNodes() == true) { Ext.each(parent_node.childNodes, function(child) { // only do this once. if(!child.data) { Ext.each(data_list, function(data) { if(data.id == child.id) { if(data.viewparams) data.viewparams = Ext.decode(data.viewparams); child.data = data; setKids(child, data.children); return false; } }); } }); } } Ext.apply(config, { border: false, rootVisible: false, autoScroll: true, containerScroll: true, loader: new Ext.tree.TreeLoader({ preloadChildren: true, baseAttrs: { singleClickExpand: true }, dataUrl: Trakkware.Handlers.MethodHandler, listeners: { beforeload: function(loader, node) { var viewparams = {}; if(node.data && node.data.viewparams) viewparams = node.data.viewparams; var parameters = Ext.apply(viewparams, { id: node.id }); if(node.data && node.data.pos) Ext.apply(parameters, { pos: node.data.pos }); loader.baseParams.command = config.loadercommand; loader.baseParams.view = config.loaderview; loader.baseParams.paramarray = Ext.encode(parameters); }, load: function(loader, node, response) { var list = Ext.decode(response.responseText); setKids(node, list); } } }) }); Trakkware.View.TreePanel.superclass.constructor.call(this, config); this.setValue = function(data) { var root = new Ext.tree.AsyncTreeNode({ expanded: false }); root.id = data; me.setRootNode(root); root.expand(); } this.getValue = function() {} this.isDirty = function() { return false; } // Refresh the tree. this.refreshTree = function() { var selected = me.getSelectionModel().getSelectedNode(); if(selected) { var data = selected.data; var parent = selected.parentNode; if(parent) { } } } this.on('dblclick', function(node, e) { var data = node.data; if(!Ext.isEmpty(data.view) && !Ext.isEmpty(data.command)) { var owner = me.ownerCt; var windowMgr = owner.getWindowMgr(); if(windowMgr != null) { var view = Trakkware.ViewFramework.createView({ view: data.view, command: data.command, viewParams: data.viewparams, callback: function(viewobject) { windowMgr.addView({ view: viewobject, launch: 'window', modalParent: me.ownerCt, replace: config.PassControl, parentRefreshView: me.ownerCt }); }, failureCallback: function(response) { alert('nothing happening in this failure callback.'); } }); } else { Trakkware.ViewFramework.launchView({ view: data.view, command: data.command, launch: 'window', viewParams: data.viewparams, launchingView: me.ownerCt // i don't trust this, could cause issues. }); } } }); this.on('expandnode', function(node) { // The node was loaded but its data not set if there is no .data property. if(node.data && node.hasChildNodes() == true) { setKids(node, node.data.children); } }); } }); Ext.reg('trakkware_tree', Trakkware.View.TreePanel); // // SUBVIEW // // Expected config options: // // ViewName: Name of the view for this subview. // Command: The command that this subview will start in. // Parameters: The parameters object. Specifically, Parameters.View // PropertyName: The propertyname of the field that represents this subview. Used to reference the subview map. // AsData: When true, this subview will return its data to the parent. // SubviewMaps The subview maps array. // lpt: Method that is passed on as the listen-for-subview-transaction method when creating this subview. // CaptureSubviewDirty: Indicates this subview should pass its dirties up to the calling view. // height: Height of the subview in pixels. Trakkware.View.Subview = Ext.extend(Ext.Panel, { initComponent: function(config) { // Call the superclass init first. Trakkware.View.Subview.superclass.initComponent.call(this, config); // Setup events this.addEvents('registersubview', 'preregistersubview', 'dirty', 'resetdirty', 'validations', 'deferredrendersubview', 'reloadsubview', 'registersemimodalwindow', 'semimodal'); this.enableBubble('registersubview', 'preregistersubview', 'dirty', 'registersemimodalwindow', 'semimodal'); }, constructor: function(config) { // Check for required options. var method_name = 'Subview constructor'; Trakkware.ViewFramework.requireOption(config, 'ViewName', method_name); Trakkware.ViewFramework.requireOption(config, 'Command', method_name); Trakkware.ViewFramework.requireOption(config, 'SubviewMaps', method_name); // A nice reference to this form. var the_form = this; // Holds a reference to the view object is contained in this subview. var internal_view_object = null; // Need this to exist to get the subview registered. The actual method will be implemented after view is created. this.isDirty = function() { } // Used to indicate the subview has already been constructed. var already_constructed = false; function constructSubview(data, is_deferred_tab) { if(already_constructed === true) return; already_constructed = true; var subview_map = config.SubviewMaps[config.PropertyName]; if (!Ext.isDefined(subview_map)) subview_map = { parameter_map: null, action_map: null }; var view_parameters = Ext.apply({}, config.Parameters.View); view_parameters = Ext.apply(view_parameters, data); var internal_parameters = Ext.apply({}, config.Parameters.Internal); internal_parameters = Ext.apply(internal_parameters, data); var control_parameters = Ext.apply({}, config.Parameters.Control); var view = Trakkware.ViewFramework.createView({ view: config.ViewName, command: config.Command, viewParams: view_parameters, controlParams: control_parameters, internalParams: internal_parameters, isSubview: true, map: subview_map.parameter_map, actionMap: subview_map.action_map, ControlID: config.ControlID, SubviewSizing: config.SubviewSizing, callback: function(view_object) { if (view_object) { // Important to have this datafield set. view_object.datafield = config.PropertyName; the_form.view_object = view_object view_object.setWindowMgr(_window_mgr); // Pass validations down to the view object. the_form.on('validations', function(validations) { view_object.fireEvent('validations', validations); }); // Register this subview with its parent. the_form.fireEvent('registersubview', view_object); // Set the internal reference for getTransactions. internal_view_object = view_object; // Add the subview to its owner differently for tabs. var ownerCt = the_form.findParentByType('tabpanel'); if (ownerCt) { var ii = 0; ownerCt.items.each(function(item) { if(item === the_form.ownerCt) return false; ii++; }); var item = ownerCt.insert(ii, view_object); ownerCt.remove(the_form.ownerCt); if(is_deferred_tab === true) ownerCt.activate(item); if(item.setTitle) item.setTitle(config.title || ''); } else { // Non-tab parents: ownerCt = the_form.ownerCt; if(ownerCt) { // Get the index of the_form so we can replace it with the view. var ii = 0; var found = false; ownerCt.items.each(function(item) { if (item == the_form) { found = true; return false; } ii++; }); if (found === true) { ownerCt.insert(ii, view_object); ownerCt.remove(the_form); } else { ownerCt.add(view_object); ownerCt.remove(the_form); } ownerCt.doLayout(); } } // Set a title to what the parent provided if it WAS provided. if(config.title !== null) { view_object.applyTitle(config.title, {}); } // Arrange .isDirty passing. the_form.isDirty = function() { return view_object.isDirty(); } view_object.getValue = function() { // When this subview has been indicated as data, return its data. if (config.AsData === true) { return view_object.actionDataProvider(); } } } } }); } // Apply additional panel-related options config = Ext.apply(config, { items: [], unstyled: true, hideBorders: true, getValue: function() { }, autoScroll: true, datafield: config.PropertyName, layout: 'fit', hide: true, closable: false, setValue: function(data) { // Check for show-hide-on before constructing. if(config.ShowOn != null) { var showhide = Trakkware.ViewFramework.ProcessShowOn(config.ShowOn, data); if(showhide === 'hide') // When hide comes back, don't bother constructing the view. return; } constructSubview(data); }, // Gets the transactions for this subview that correspond to the parent command provided. getTransactionsFor: function(parent_command) { return internal_view_object.getTransactionsFor(parent_command); } }); //delete config.height; //delete config.autoHeight; //delete config.width; Trakkware.View.Subview.superclass.constructor.call(this, config); // Register this subview with its parent. the_form.fireEvent('preregistersubview', the_form); this.on('resetdirty', function(form, down) { view_object.fireEvent('resetdirty', form); }); this.on('deferredrendersubview', function(control) { // Only call construct if deferred_data is set. If it is not defined, it means the subview has not been through the proper // processing to the constructed. if(Ext.isDefined(the_form.deferred_data)) { constructSubview(the_form.deferred_data, true); } }); this.on('reloadsubview', function(data) { internal_view_object.fireEvent('reload', data); }); _window_mgr = null; this.setWindowMgr = function(mgr) { _window_mgr = mgr; } } }); Ext.reg('trakkware_subview', Trakkware.View.Subview); // Used to house templates in form panels. Trakkware.View.TemplateField = Ext.extend(Ext.Panel, { // Expected config options: // // template: The template text to use. // text: Label text for this field. Leave blank to hide. // sv: An additional method that overriders can provide that will be invoked // when setValue is called on this TemplateField. constructor: function(config) { // Validate incoming. //if (Trakkware.ViewFramework.requireOption(config, 'template', 'Trakkware.View.TemplateField.constructor') == false) return; // Convenience reference. var panel = this; // Apply additional container properties then call the superclass constructor. config = Ext.apply(config, { unstyled: true, fieldLabel: config.text, autoHeight: true, hideBorders: true, setValue: function(value, component) { function render() { // need the panel's parent component. var owner = panel.ownerCt; // Render the field's template. var html = ''; try { var template = config.useData === true ? value[component.datafield] : config.template; //alert('templating with:\r\n' + template); if(value.json) value = Ext.apply(value, value.json); var xt = new Ext.XTemplate(template); xt.overwrite(panel.getEl(), value); delete xt; } catch (ex) { alert(ex + 'A bad template was supplied to XTemplate: ' + template); } // IE is freakin nuts.. With out this crazy mask/unmask, Internet Explorer // will put a bunch of space around the overwritten el from above.. if (Ext.isIE == true) { panel.getEl().mask(''); var t = function(c) { panel.getEl().unmask(); }; t.defer(10); } // After templating, do apply-tos. Ext.select('.x-trakkware-auto-collapse').each(function(div) { var title = div.getAttribute('title'); var parent = div.findParent('.x-trakkware-render-to'); var panel = new Ext.Panel({ collapsible: true, collapsed: false, contentEl: div, applyTo: parent, autoHeight: true, title: title, hidden: true, listeners: { afterrender: function(control) { control.show(true); } } }); }); // If a setValue callback is in place, call it with the data provided to setValue. if (config.sv) config.sv(component, value); } if (panel.rendered == true) { render(); } else { panel.on('afterrender', function(cmp) { render(); }); } }, getValue: function() { }, isDirty: function() { return false; } }); Trakkware.View.TemplateField.superclass.constructor.call(this, config); } }); Ext.reg('trakkware_template', Trakkware.View.TemplateField); // // POPUP FIELD // // Expected config options: // PopupTemplate: Template used to populate the popup field. // LinkTemplate: Template used to fill the link template. // PopupStyle: 'onmouseover', 'onclick' // PopupCloseStyle: 'outsideclick', 'anyclick', 'closebutton', 'windowclosexonly' // PopupModal: (true/false) Indicates the popup will be shown modal or not. // PopupStyled: (true/false) Indicates whether to show this popup window as styled or plain. Trakkware.View.PopupField = Ext.extend(Trakkware.View.TemplateField, { constructor: function(config) { // Set a default value if (!config.PopupStyle) config.PopupStyle = 'onclick'; if (!config.PopupCloseStyle) config.PopupCloseStyle = 'anyclick'; // Store the popup window out here so it doesn't get recreated on reloads. var popup_window = null; var styled = config.Styled || true; // Adjust config before sending it on to the TemplateField constructor. config = Ext.apply(config, { text: null, template: config.LinkTemplate, sv: function(panel, data) { var content = Trakkware.ViewFramework.applyTemplate(config.PopupTemplate, data); // Delete old popup window and create a new one. if(popup_window !== null) Ext.destroy(popup_window); popup_window = new Ext.Window({ html: content, closeAction: 'hide', y: panel.getEl().getTop() + config.TopOffset, x: panel.getEl().getLeft() + config.LeftOffset, modal: (config.PopupModal || false), unstyled: !styled, hideBorders: !styled, header: styled, shadow: false, closable: styled, draggable: true, resizable: false, cls: (config.cls || '') }); function finish(rendered_panel) { var el = rendered_panel.el; el.setStyle({ cursor: 'pointer' }); // holds state of mouse over the popup and target el. var over = false; var trigger = 'click'; if (config.PopupStyle) { if (config.PopupStyle == 'onmouseover') trigger = 'mouseover'; else if (config.PopupStyle == 'onclick') trigger = 'click'; } el.on(trigger, function(e, clicked_panel, o) { e.preventDefault(); var close = config.PopupCloseStyle; var hide_window = function(e, target, options) { over = false; function try_hide() { if(over === false && popup_window.el.hasActiveFx() === undefined) { Ext.get(target).un(e.type, hide_window); Ext.getBody().un('click', hide_window); if(styled === true) { popup_window.hide(); } else { popup_window.el.fadeOut({duration: 0.2}); } } } if(styled === true) try_hide(); else try_hide.defer(700); } // Anyclick: Attach a click handler to body so when ANYTHING is clicked this window will close. if (close == 'outsideclick') { function miss_click() { Ext.getBody().on('click', hide_window); } miss_click.defer(200); } // MouseOut: When the mouse goes outside of the target template or the popup window, hide the window. else if (close == 'mouseout') { var attach_to_window = function() { el.on('mouseover', function() { over = true; }); popup_window.el.on('mouseover', function() { over = true; }); el.on('mouseout', hide_window); popup_window.el.on('mouseout', hide_window); } if (popup_window.rendered === true) { attach_to_window(); } else { popup_window.on('afterrender', attach_to_window); } } popup_window.show(); if(popup_window.el) popup_window.el.fadeIn({ duration: 0.2 }); return false; }); } if (panel.rendered === true) { finish(panel); } else { panel.on('afterrender', function(rendered_panel) { finish(rendered_panel); }); } }, getPopupWindow: function() { return popup_window; } }); Trakkware.View.PopupField.superclass.constructor.call(this, config); } }); Ext.reg('trakkware_popup', Trakkware.View.PopupField); Trakkware.View.HtmlEditor = Ext.extend(Ext.form.HtmlEditor, { constructor: function(config) { this.original_value = null; var timer_id = null; var htmleditor = this; var ii = 0; var me = this; var check_html_isdirty = function() { // If this editor gets destroyed and somehow the timer keeps going, do away with the time. if(htmleditor.getDoc() == null) { clearInterval(timer_id); return; } var current = htmleditor.getValue(); var orig = htmleditor.original_value; if(orig == null) { orig = current; htmleditor.original_value = current; } if(current != orig) { clearInterval(timer_id); htmleditor.fireEvent('dirty', htmleditor); } } this.setValue = function(value) { var result = Trakkware.View.HtmlEditor.superclass.setValue.call(this, value); timer_id = setInterval(check_html_isdirty, 500); return result; } this.isDirty = function() { var value = this.getValue(); return value != htmleditor.original_value; } Trakkware.View.HtmlEditor.superclass.constructor.call(this, config); this.addEvents('dirty', 'resetdirty'); this.on('destroy', function() { clearInterval(timer_id); }); this.on('resetdirty', function() { me.original_value = null; }); } }); Ext.reg('trakkware_html', Trakkware.View.HtmlEditor); Trakkware.View.RepeatForm = function(config) { var _data = {}; this.datafield = config.datafield; // This is vital. Since UI Markers are not part of the View, they will not be in an action's expected array and will be // skipped when getting data. this.isUIMarkerType = true; this.setValue = function(data) { // Convert to the format myCalendar can read. var my_data = {}; my_data.eventId = data.EventID; var beginDate = data.BeginDate; if (beginDate && beginDate.indexOf('Date') > -1) { beginDate = eval('new ' + beginDate.replace('/', '').replace('/', '')); } var untilDate = data.UntilDateTime; if (untilDate && untilDate.indexOf('Date') > -1) { untilDate = eval('new ' + untilDate.replace('/', '').replace('/', '')); } // Build the repeattype. var repeatType = { beginDay: beginDate, endDay: untilDate, rtype: data.Frequency, rtime: data.Count, rday: {}, intervalSlot: data.Interval } my_data.repeatType = repeatType; _data = my_data; this.resetRepeatSetting(data.Frequency, my_data); // Set other fields that aren't set in resetRepeatSetting. this.startDayField.setValue(beginDate); this.repeatEndDateField.setValue(untilDate); this.startTimeField.setValue(data.BeginTime); this.endTimeField.setValue(data.EndTime); // Deal with the byday object. var byday = Ext.decode(data.ByDay); if (byday) { var cg = this.weekCheckGroup.items; Ext.iterate(byday, function(day) { day = day - 1; cg.items[day].setValue(1); }); } } this.getValue = function() { var day = this.startDayField.getValue(); var event = { day: day, eday: day } var repeat_data = this.handleRepeatType(event); //alert(Ext.encode(repeat_data)); var data = { BeginDate: repeat_data.day, EndDate: repeat_data.eday, BeginTime: this.startTimeField.getValue(), EndTime: this.endTimeField.getValue(), Frequency: repeat_data.repeatType.rtype, Interval: repeat_data.repeatType.intervalSlot, UntilDateTime: repeat_data.repeatType.endDay, ByDay: Ext.encode(repeat_data.repeatType.rday || ''), Count: repeat_data.repeatType.rtime || 0 } return data; } this.getData = function() { return _data; } this.isDirty = function() { return true; } function getTimeStore() { var picklist_type = 'Trakkware.Platform.Lib.Picklists.TimePickList, Trakkware.Platform.Lib'; var picklist_command = '____PICKLIST____'; var store = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ method: 'POST', url: Trakkware.Handlers.MethodHandler, listeners: { exception: function(proxy, type, action, options, response, arg) { response = Ext.decode(response.responseText); if (response && response.result) { if (response.result == '0') { Ext.Msg.alert('Data loading error', 'Unable to load or change pages because: ' + response.msg); } else if (response.result == '1') { Ext.Msg.alert('A data reader error has occured, sorry but I cannot display your data because of it.'); } } } } }), baseParams: { view: picklist_type, command: picklist_command, paramarray: [] }, reader: new Ext.data.JsonReader({ root: 'list', successProperty: 'success', fields: ['text', 'value'] }) }); store.load(); return store; } this.startDayField = new Ext.form.DateField({ fieldLabel: 'Begins', value: new Date(), format: 'Y-m-d', allowBlank: false, anchor: '95%', editable: false, disabled: this.singleDay }); //this.startDayField.on('select', this.onStartEndDayCheckFn, this); this.startTimeField = new Ext.form.ComboBox({ hideLabel: true, labelSeparator: '', store: getTimeStore(), displayField: 'text', valueField: 'value', typeAhead: true, mode: 'local', triggerAction: 'all', selectOnFocus: true, allowBlank: false, editable: true, anchor: '95%', forceSelection: true }); //this.startTimeField.on('select', this.onStartTimeSelectFn, this); this.endTimeField = new Ext.form.ComboBox({ hideLabel: true, labelSeparator: '', store: getTimeStore(), displayField: 'text', valueField: 'value', typeAhead: true, mode: 'local', triggerAction: 'all', selectOnFocus: true, allowBlank: false, editable: true, anchor: '95%', forceSelection: true }); this.repeatIntervalField = new Ext.form.NumberField({ fieldLabel: 'Recur Every', labelSeparator: '', value: 1, allowBlank: false, anchor: '99%' }); this.repeatIntervalField.on('valid', this.onRepeatIntervalValidFn, this); this.intervalUnitLabel = new Ext.util.LabelField({ hideLabel: true, labelSeparator: '' }); this.repeatStartField = new Ext.form.DateField({ fieldLabel: 'Begin Date', format: 'Y-m-d', allowBlank: false, anchor: '90%', value: new Date() }); this.repeatStartField.on('select', this.onRepeatStartSelectFn, this); this.repeatNoEndRG = new Ext.form.Radio({ boxLabel: 'No end RG?', name: 'repeat-end-type' }); this.repeatEndTimeRG = new Ext.form.Radio({ boxLabel: 'Repeat End Time RG', name: 'repeat-end-type' }); this.repeatEndTimeField = new Ext.form.NumberField({ width: 50, value: 10, allowBlank: false, disabled: true }); this.repeatEndDateRG = new Ext.form.Radio({ boxLabel: 'Repeat End Date RG', name: 'repeat-end-type' }); this.repeatEndDateField = new Ext.form.DateField({ hideLabel: false, labelSeparator: '', label: 'Repeat Until', format: 'Y-m-d', allowBlank: false, anchor: '99%', disabled: true, value: (new Date()).add(Date.DAY, 365), margins: '0 0 0 75' }); this.repeatInfoPanel = new Ext.Panel({ border: false, html: '
    ' }); this.repeatTypeField = new Ext.form.ComboBox({ fieldLabel: 'Repeat field type', store: new Ext.data.ArrayStore({ fields: ['display', 'value'], data: [['Daily', 'day'], ['Weekly', 'week'], ['Monthly', 'month'], ['Yearly', 'year']] }), displayField: 'display', valueField: 'value', typeAhead: true, mode: 'local', triggerAction: 'all', selectOnFocus: true, allowBlank: false, editable: false, anchor: '99%' }); var checkListener = { 'check': { fn: this.refreshRepeatInfo, scope: this } }; var items = []; var nd = new Date(); var n = nd.format('N'); var mon = nd.add(Date.DAY, 1 - n); for (var i = 0; i < 7; i++) { items.push({ boxLabel: mon.add(Date.DAY, i).format('D'), listeners: checkListener }); } this.weekCheckGroup = new Ext.form.CheckboxGroup({ fieldLabel: 'Week', items: items, anchor: '100%' }); this.monthRadioGroup = new Ext.form.RadioGroup({ fieldLabel: 'Month', hidden: true, // TRAKKWARE CHANGE hideLabel: true, // TRAKKWARE CHANGE items: [{ boxLabel: 'Repeat by date', name: 'repeat-month-group', checked: true }, { boxLabel: 'Repeat by day', name: 'repeat-month-group', listeners: checkListener }], anchor: '60%' }); var cws; if (Ext.isIE) { if ('3.0.3' == Ext.version) { cws = [0.4, 0.2, 0.38, 0.4, 0.6]; } else { cws = [0.2, 0.1, 0.3, 0.2, 0.3]; } } else { cws = [0.4, 0.2, 0.38, 0.4, 0.6]; } this.timepanel = new Ext.Panel({ border: false, layout: 'column', labelWidth: 40, items: [{ columnWidth: .4, border: false, layout: 'form', items: [this.startDayField] }, { columnWidth: .2, border: false, layout: 'form', items: [this.startTimeField] }, { html: 'until', style: 'padding: 5px;' }, { columnWidth: .2, border: false, layout: 'form', items: [this.endTimeField] }] }); config = { border: false, style: 'padding:10px;', frame: true, autoHeight: true, labelWidth: 80, items: [ this.timepanel, this.repeatTypeField, { border: false, style: 'padding-left:85px;', layout: 'column', items: [{ border: false, columnWidth: .35, layout: 'form', items: [this.repeatIntervalField] }, { border: false, columnWidth: .2, items: [this.intervalUnitLabel] }] }, this.repeatInfoPanel, { border: false, style: 'padding-left:85px;', layout: 'form', items: [this.weekCheckGroup] }, { border: false, style: 'padding-left:85px;', layout: 'form', items: [this.monthRadioGroup] }, { border: false, style: 'padding-left:85px;', layout: 'column', items: [this.repeatEndDateField] } ] } Ext.apply(this, config); Trakkware.View.RepeatForm.superclass.constructor.call(this, config); this.addEvents( 'showdetailsetting' ); this.repeatTypeField.on('select', this.onRepeatTypeSelectFn, this); //this.calendarField.on('select', this.onCalendarSelectFn, this); this.repeatNoEndRG.on('check', this.onRepeatNoEndCheckFn, this); this.repeatEndTimeRG.on('check', this.onRepeatEndTimeCheckFn, this); this.repeatEndDateRG.on('check', this.onRepeatEndDateCheckFn, this); this.addEvents('registerdatafield', 'dirty', 'causesfieldchange'); this.enableBubble('registerdatafield', 'dirty', 'causesfieldchange') this.on('afterrender', function(control) { control.fireEvent('registerdatafield', control); }); }; Ext.extend(Trakkware.View.RepeatForm, Ext.Panel, { layout: 'form', onRepeatIntervalValidFn: function() { this.refreshRepeatInfo(); }, onRepeatStartSelectFn: function(df) { this.refreshRepeatInfo(); }, refreshRepeatInfo: function() { var beginDate = this.repeatStartField.getValue(); var intervalSlot = this.repeatIntervalField.getValue(); var getIntervalText = Ext.ux.calendar.Mask.getIntervalText; //var lan = Ext.ux.calendar.Mask.Editor; var v = this.repeatTypeField.getValue(); var str = ''; if ('day' == v) { this.updateRepeatInfo(getIntervalText(v, intervalSlot)); } else if ('week' == v) { var monday = beginDate.add(Date.DAY, 1 - beginDate.format('N')); var cbs = this.weekCheckGroup.items; var num = 0; for (var i = 0, len = cbs.getCount(); i < len; i++) { var cb = cbs.get(i); if (cb.checked) { num++; str += monday.add(Date.DAY, i).format('l') + ' '; } } if (7 == num) { str = 'Repeat Day Info'; } else if (0 == num) { str = beginDate.format('l') } this.updateRepeatInfo(getIntervalText(v, intervalSlot) + str); } else if ('month' == v) { var rds = this.monthRadioGroup.items; if (rds.get(1).checked) { str = Ext.ux.calendar.Mask.getWeekDayInMonth(beginDate); } else { str = beginDate.format('d'); } this.updateRepeatInfo(getIntervalText(v, intervalSlot) + str); } else if ('year' == v) { this.updateRepeatInfo(getIntervalText(v, intervalSlot) + beginDate.format('m-d')); } }, updateRepeatInfo: function(html) { var div = this.repeatInfoPanel.body.dom.firstChild.firstChild; div.innerHTML = html; }, onRepeatTypeSelectFn: function(combo, rd, index) { var v = combo.getValue(); this.resetRepeatSetting(v, this.getData()); }, resetRepeatSetting: function(v, event) { var rt = event.repeatType || 'no'; if (!Ext.isDefined(v)) { v = rt.rtype; } if (this.repeatTypeField.getValue() != v) this.repeatTypeField.setValue(v); // var lan = Ext.ux.calendar.Mask.Editor; var items = this.items; if ('no' == v || 'exception' == v) { items.get(2).hide(); items.get(3).hide(); items.get(4).hide(); items.get(5).hide(); items.get(6).hide(); } else { items.get(2).show(); items.get(3).show(); if ('day' == v || 'year' == v) { if ('day' == v) { this.intervalUnitLabel.setText('days'); } else { this.intervalUnitLabel.setText('years'); } items.get(4).hide(); items.get(5).hide(); } else if ('week' == v) { this.intervalUnitLabel.setText('weeks'); items.get(4).show(); this.weekCheckGroup.reset(); var cbs = this.weekCheckGroup.items; cbs.each(function(it) { it.checked = false; }); if ('string' != Ext.type(rt)) { var rday = rt.rday; for (var p in rday) { cbs.get(p - 1).setValue(true); } } items.get(5).hide(); } else if ('month' == v) { this.intervalUnitLabel.setText('months'); items.get(4).hide(); items.get(5).show(); this.monthRadioGroup.reset(); var rds = this.monthRadioGroup.items; rds.each(function(it) { it.checked = false; }); if ('string' != Ext.type(rt)) { var rby = rt.rby; if ('day' == rby) { rds.get(1).setValue(true); } else { rds.get(0).setValue(true); } } } items.get(6).show(); this.doLayout(); this.repeatNoEndRG.checked = false; this.repeatEndTimeRG.checked = false; this.repeatEndDateRG.checked = false; if ('string' != Ext.type(rt)) { this.repeatIntervalField.setValue(rt.intervalSlot); this.repeatStartField.setValue(rt.beginDay); if ('no' == rt.endDay) { if (false != Ext.type(rt.rtime)) { this.repeatEndTimeRG.setValue(true); } else { this.repeatNoEndRG.setValue(true); } } else { this.repeatEndDateRG.setValue(true); this.repeatEndDateField.setValue(rt.endDay); } } else { if ('day' == v) { this.repeatIntervalField.setValue(Ext.ux.calendar.Mask.getDayOffset(event.day, event.eday) + 1); } else { this.repeatIntervalField.setValue(1); } this.repeatStartField.setValue(event.day); this.repeatNoEndRG.setValue(true); } this.refreshRepeatInfo(); } }, onRepeatNoEndCheckFn: function(cb, checked) { if (checked) { this.repeatEndTimeField.disable(); this.repeatEndDateField.disable(); } }, onRepeatEndTimeCheckFn: function(cb, checked) { if (checked) { this.repeatEndTimeField.enable(); this.repeatEndDateField.disable(); } }, onRepeatEndDateCheckFn: function(cb, checked) { if (checked) { this.repeatEndTimeField.disable(); this.repeatEndDateField.enable(); } }, onStartEndDayCheckFn: function(df) { }, handleRepeatType: function(e) { var event = Ext.apply({}, e); var nrt = this.repeatTypeField.getValue(); if ('no' == nrt) { event.repeatType = 'no'; } else { var o = { rtype: nrt, intervalSlot: this.repeatIntervalField.getValue(), dspan: Ext.ux.calendar.Mask.getDayOffset(e.day, e.eday), beginDay: this.repeatStartField.getValue().format('Y-m-d') }; if (this.repeatNoEndRG.checked) { o.endDay = 'no'; } else if (this.repeatEndTimeRG.checked) { o.endDay = 'no'; o.rtime = this.repeatEndTimeField.getValue(); } else if (this.repeatEndDateRG.checked) { o.endDay = this.repeatEndDateField.getValue().format('Y-m-d'); } if ('week' == nrt) { var obj = {}; var items = this.weekCheckGroup.items; var flag = false; for (var i = 0, len = items.getCount(); i < len; i++) { var it = items.get(i); if (it.checked) { flag = true; obj[i + 1] = true; } } if (!flag) { var n = event.day.format('N'); //Date.parseDate(event.day, 'Y-m-d').format('N'); obj[n] = true; } o.rday = obj; } else if ('month' == nrt) { var items = this.monthRadioGroup.items; if (true == items.get(0).checked) { o.rby = 'date'; } else { o.rby = 'day'; } } event.repeatType = o; } return event; } }); Ext.reg('trakkware_repeatform', Trakkware.View.RepeatForm); Trakkware.View.MoneyField = Ext.extend(Ext.form.NumberField, { constructor: function(config) { Ext.apply(config, { allowDecimals: true, allowNegative: false, minValue: 1 }); Trakkware.View.MoneyField.superclass.constructor.call(this, config); } }); Ext.reg('trakkware_moneyfield', Trakkware.View.MoneyField);Ext.ns('Trakkware', 'Trakkware.View'); Trakkware.View.ComboPicklist = Ext.extend(Ext.form.ComboBox, { initComponent: function(config) { Trakkware.View.ComboPicklist.superclass.initComponent.call(this, config); this.addEvents('picklistreaction', 'react', 'registerpicklist', 'resetdirty', 'mask'); this.enableBubble('registerpicklist', 'picklistreaction', 'mask'); }, constructor: function(config) { var me = this; // Keeps track of whether a load is due to a JIT combo load. var jit_reload = false; var last_jit_value = null; // function that checks the combo for dirtiness. function testForDirty(combo) { var value = combo.getRawValue(); if(combo.last_keypress_value != value) { combo.last_keypress_value = value; combo.fireEvent('dirty', combo); } } // When this picklist is a simple combo, grab its StoreItems and use them // as the combo's store item. var store = null; if (config.LocalData === true) { store = config.StoreItems; } else { store = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ method: 'POST', url: Trakkware.Handlers.MethodHandler, listeners: { exception: function(proxy, type, action, options, response, arg) { response = Ext.decode(response.responseText); if (response && response.result) { if (response.result == '0') { Ext.Msg.alert('Data loading error', 'Unable to load or change pages because: ' + response.msg); } else if (response.result == '1') { Ext.Msg.alert('A data reader error has occured, sorry but I cannot display your data because of it.'); } } else { Ext.Msg.alert('Unknown error', 'An unknown error has occurred. The picklist failed to load.'); } me.fireEvent('mask', { Activate: false }); } } }), baseParams: { view: config.PicklistType, command: config.PicklistCommand, paramarray: [] }, reader: new Ext.data.JsonReader({ root: 'list', successProperty: 'success', fields: ['text', 'value'] }), listeners: { load: function(store) { if(jit_reload === true) { jit_reload = false; } else { // necessary for combo picklists that do not have data when they are .setValue()-ed the first time. var value = me.getValue(); // Check that the old value exists in the store data and reset to null if not. var store = me.getStore(); if(store) { var found = false; var has_items = false; store.each(function(record) { has_items = true; if(record.data.value == value) { found = true; return false; } }); if(found === true) { me.setValue(value); } else { if(has_items == true) { me.setValue(''); } } } } } } }); } config.store = store; config.valueField = 'value'; config.displayField = 'text'; config.minListWidth = 160; config.enableKeyEvents = true; //config.valueNotFoundText = config.emptyText || 'select...'; //config.tpl = '
    {field2:htmlDecode}
    '; // Turn on key events when using JIT combos. if(config.JustInTime === true) { var timeout_id = null; config.listeners.keypress = function(textfield, e) { var keycode = e.getKey(); if(keycode != 13 && keycode != 9 && keycode != 40 && keycode != 37 && keycode != 38 && keycode != 39) { // If we are already waiting, clear that wait and start a new one. if(timeout_id != null) clearTimeout(timeout_id); function do_search() { var value = textfield.getRawValue(); if(value != last_jit_value && value != '' && value != null) { store.load({ params: { paramarray: Ext.encode({ Search: value })}}); last_jit_value = value; jit_reload = true; } timeout_id = null; } timeout_id = do_search.defer(500); } } } Trakkware.View.ComboPicklist.superclass.constructor.call(this, config); this.setValue = function(value) { Trakkware.View.ComboPicklist.superclass.setValue.call(this, value); if(config.JustInTime === true) { var raw = me.getRawValue(); var current = me.getValue(); // Trakkware.ViewFramework.log(raw + ' : ' + current); } } this.on('afterrender', function(picklist) { // This override forces the selected value into a combo when tab is hit. var keynav = new Ext.KeyNav(picklist.el, { "tab": function(e) { if(config.forceSelection == true) { var raw = picklist.getRawValue(); // this if statement allows blank values to exist in our fancy dropdown lists. if(config.allowBlank == true && raw == '') { picklist.setValue(''); } else { var value = picklist.getValue(); picklist.onViewClick(false); } picklist.fireEvent('dirty', picklist); } return true; } }); picklist.fireEvent('registerpicklist', picklist); }); this.on('keypress', function(combo, e) { testForDirty(combo); }); this.on('collapse', function(combo) { if(combo) testForDirty(combo); }); // Fire when the combo value changes. this.on('change', function(combo, new_value, old_value) { // When this value changes, check if anything else should reload. if (config.OtherReactions) { combo.fireEvent('picklistreaction', combo.datafield, new_value, config.OtherReactions); } last_jit_value = combo.getRawValue(); }); // React to other picklist changing. this.on('react', function(data) { if (config.LocalData !== true && config.JustInTime !== true) { //var bp = store.baseParams.paramarray; var bp = Ext.apply({}, data); store.setBaseParam('paramarray', Ext.encode(bp)); store.load(); } }); this.on('resetdirty', function() { me.originalValue = me.getValue(); }); } }); Ext.reg('trakkware_combopicklist', Trakkware.View.ComboPicklist);Ext.ns('Trakkware', 'Trakkware.View'); // A Trakkware sort field that registers as a query modifier. Trakkware.View.Sort = Ext.extend(Ext.form.ComboBox, { initComponent: function() { this.addEvents('registermodifier', 'modifierchanged'); this.enableBubble('registermodifier', 'modifierchanged'); }, // config options: // // dataArray: The data to use for the combo's array store. Must be in the form [{ value: x, text: y}, {value: x, text: y}] // width: The width in pixels of this sort combo. // defaultValue: The default value to set this sort to. constructor: function(config) { // Validate several expected values. if (!Ext.isDefined(config.dataArray)) { alert('Config.dataArray is not defined in a config provided to Trakkware.View.Sort.'); return; } // Create a data store.. var store = new Ext.data.ArrayStore({ autoDestroy: true, fields: ['value', 'text'], data: [] }); // This is the object that is returned when this modifier changes. var sort_by_data_object = { sort: null, dir: null }; // Apply additional information for the combo box. config = Ext.apply(config, { store: store, id: Ext.id(), displayField: 'text', valueField: 'value', typeAhead: true, mode: 'local', forceSelection: true, triggerAction: 'all', width: config.width ? config.width : 100, iconCls: 'no-icon', value: config.defaultValue, disableKeyFilter: true, minListWidth: 100, listeners: { select: function(combo, record, index) { combo.fireEvent('modifierchanged', combo, record.data); }, afterrender: function(control) { if (config.dataArray.length > 0) { store.loadData(config.dataArray); control.fireEvent('registermodifier', { control: control, type: 'sort', getValue: function() { return { sort: control.getValue(), dir: 'asc' }; } }); } } } }); Trakkware.View.Sort.superclass.constructor.call(this, config); this.changeForModifier = function(new_value) { this.setRawValue(new_value); this.originalValue = this.getValue(); } } }); Ext.reg('trakkware_sort', Trakkware.View.Sort); // A grouping that registers as a query modifier. // // Expected config options: // // dataArray: The data to use for the combo's array store. Must be in the form [{ value: x, text: y}, {value: x, text: y}] // width: The width in pixels of this sort combo. // defaultValue: The default value to set this sort to. // rm: The function to call that registers this modifier. // mc: A function that is called when this modifier changes. Trakkware.View.GroupBy = Ext.extend(Ext.form.ComboBox, { initComponent: function() { this.addEvents('registermodifier', 'modifierchanged', 'broadcast'); this.enableBubble('registermodifier', 'modifierchanged'); }, constructor: function(config) { // Validate several expected values. if (!Ext.isDefined(config.dataArray)) { alert('Config.dataArray is not defined in a config provided to Trakkware.View.GroupBy.'); return; } // Start a datastore for this combo. var store = new Ext.data.ArrayStore({ autoDestroy: true, fields: ['value', 'text'] }); // Apply additional combo box properties before calling superclass constructor. Ext.apply(config, { store: store, id: Ext.id(), displayField: 'text', valueField: 'value', typeAhead: true, mode: 'local', forceSelection: true, triggerAction: 'all', width: 150, iconCls: 'no-icon', value: config.defaultText, disableKeyFilter: true, minListWidth: 100, listeners: { select: function(combo, record, index) { combo.fireEvent('modifierchanged', combo, record.data); }, afterrender: function(control) { if (config.dataArray.length > 0) { store.loadData(config.dataArray); // set the default value.. Important for getting the current group on form lists! control.setRawValue(config.defaultValue); control.fireEvent('registermodifier', { control: control, type: 'groupby', getValue: function() { return control.getValue(); } }); } } } }); Trakkware.View.GroupBy.superclass.constructor.call(this, config); this.changeForModifier = function(new_value) { this.setRawValue(new_value); this.originalValue = this.getValue(); } } }); Ext.reg('trakkware_groupby', Trakkware.View.GroupBy); // A filter combo that registers as a query modifier. // // Expected config options: // // ViewName: The view this filter belongs to. // propertyName: The propertyname assigned to this filter data. // Parameters: The config.Parameters object. // width: The width (in pixels) of this combo // emptyText: Text to display when the filter is empty. // dataType: The type of data that this filter deals with. Important for Ext and the backend systems. // rm: The function to call that registers this modifier. // mc: A function that is called when this modifier changes. Trakkware.View.ColumnFilter = Ext.extend(Ext.form.ComboBox, { initComponent: function() { this.addEvents('registermodifier', 'modifierchanged'); this.enableBubble('registermodifier', 'modifierchanged'); }, constructor: function(config) { // validate that certain config options exist. if (!Ext.isDefined(config.ViewName)) { alert('config.view is not defined in a config supplied to Trakkware.View.ColumnFilter'); return; } if (!Ext.isDefined(config.propertyName)) { alert('A config without .propertyName was supplied to Trakkware.View.ColumnFilter'); return; } // Convenience reference. var this_filter = this; // setup parameters to give the filter when it loads data. var parameters = Ext.apply(config.Parameters.Control, config.Parameters.View); if (config.Parameters.InitialState) parameters = Ext.apply(parameters, config.Parameters.InitialState.paramobject); // set up a store that will retrieve this filter's options. var store = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ method: 'POST', url: Trakkware.Handlers.MethodHandler, listeners: { exception: function(proxy, type, action, options, response, arg) { response = Ext.decode(response.responseText); if (response && response.result) { if (response.result == '0') { Ext.Msg.alert('Data loading error', 'Unable to load or change pages because: ' + response.msg); } else if (response.result == '1') { Ext.Msg.alert('A data reader error has occured, sorry but I cannot display your data because of it.'); } } } } }), baseParams: { view: config.ViewName, command: Trakkware.Handlers.FilterCommandPlaceHolder + config.propertyName, paramarray: Ext.encode(parameters) }, reader: new Ext.data.JsonReader({ root: 'list', successProperty: 'success', fields: ['text', 'value'] }) }); // Apply combo-related config options. config = Ext.apply(config, { store: store, id: Ext.id(), displayField: 'text', valueField: 'value', typeAhead: false, mode: 'local', forceSelection: true, width: config.width ? config.width : 100, iconCls: 'no-icon', value: '', disableKeyFilter: false, emptyText: config.emptyText, allowBlank: true, minListWidth: config.width ? config.width : 100, listWidth: config.width ? config.width * 2 : 200, triggerAction: 'all', listeners: { select: function(combo, record, index) { combo.fireEvent('modifierchanged', combo, record.data); }, afterrender: function(control) { store.load(); control.fireEvent('registermodifier', { control: control, type: 'filter', PropertyName: config.propertyName, getValue: function() { var value = control.getValue(); if (!Ext.isEmpty(value)) { return { type: config.dataType, field: config.propertyName, value: control.getValue() } } else { return null; } } }); } } }); // call the superclass constructor with this updated config. Trakkware.View.Filter.superclass.constructor.call(this, config); this.changeForModifier = function(new_value) { this.setValue(new_value); } } }); Ext.reg('trakkware_columnfilter', Trakkware.View.ColumnFilter); // A search box for use with data sets. Registers as a query modifier. // // Expected config options: // // textfield: The text field (or id of the field) that supplies the search term when this search is clicked. // text: Text that will show on the search button. Defaults to "search" // // rm: The function to call that registers this modifier. // mc: A function that is called when this modifier changes. Trakkware.View.Search = Ext.extend(Ext.Button, { initComponent: function() { this.addEvents('registermodifier', 'modifierchanged'); this.enableBubble('registermodifier', 'modifierchanged'); }, constructor: function(config) { var me = this; // validate some expected values from config. if (Ext.isEmpty(config.textfield)) { alert('The config.textfield option does not exist in a config provided to Trakkware.View.Search'); return; } // Get the textfield being referred to. If config.textfield is a string that means it is an id used to get the text. var textfield = (Ext.type(config.textfield) == 'string' ? Ext.getCmp(config.textfield) : config.textfield); if (!Ext.isDefined(textfield)) { alert('The textfield provided to Trakkware.View.Search is not defined or could not be found. (' + config.textfield + ')'); return; } // Add this method so that outside controls can reset the search. Specifically so that there can be a "clear search" button // which causes a modifier change. textfield.resetSearch = function() { // Empty out the search field first. if (textfield.setValue) textfield.setValue(''); else textfield.value = ''; me.fireEvent('modifierchanged', me, {}); } // This method allows the textbox to fire a search when a key is pressed. textfield.triggerSearch = function() { me.fireEvent('modifierchanged', me, {}); } // Registers this search control. function register(control) { control.fireEvent('registermodifier', { type: 'search', control: control, getValue: function() { var value = textfield.getValue(); if (!Ext.isEmpty(value)) return { search: textfield.getValue() }; else return null; } }); } // apply config values needed by the button. config = Ext.apply(config, { id: Ext.id(), text: (config.text ? config.text : 'search'), listeners: { click: function(control) { control.fireEvent('modifierchanged', control, null); }, afterrender: function(button) { register(button); } } }); Trakkware.View.Search.superclass.constructor.call(this, config); this.changeForModifier = function(new_value) { this.setRawValue(new_value); this.originalValue = this.getValue(); } } }); Ext.reg('trakkware_search', Trakkware.View.Search); // A filter combo filled with pre-built Filters that can be used to changed viewed data. Registers as a query modifier. // // Expected config options: // // ViewName: The view this filter belongs to. // width: The width (in pixels) of this combo // emptyText: Text to display when the filter is empty. // items: Array of prebuilt Filters to show. // rm: The function to call that registers this modifier. // mc: A function that is called when this modifier changes. Trakkware.View.Filter = Ext.extend(Ext.form.ComboBox, { initComponent: function() { this.addEvents('registermodifier', 'modifierchanged'); this.enableBubble('registermodifier', 'modifierchanged'); }, constructor: function(config) { // validate that certain config options exist. if (!Ext.isDefined(config.ViewName)) { alert('config.view is not defined in a config supplied to Trakkware.View.Filter'); return; } if (!Ext.isDefined(config.items)) { alert('A config without .items was supplied to Trakkware.View.Filter'); return; } // Convenience reference. var this_filter = this; // Create a data store.. var store = new Ext.data.ArrayStore({ autoDestroy: true, fields: ['value', 'text'], data: config.items }); // Apply combo-related config options. config = Ext.apply(config, { store: store, id: Ext.id(), displayField: 'text', valueField: 'value', typeAhead: false, mode: 'local', forceSelection: true, width: config.width ? config.width : 200, iconCls: 'no-icon', value: '', disableKeyFilter: false, emptyText: (config.emptyText || 'select filter'), allowBlank: true, minListWidth: config.width ? config.width : 100, listWidth: config.width ? config.width * 2 : 200, triggerAction: 'all', listeners: { select: function(combo, record, index) { combo.fireEvent('modifierchanged', combo, record.data); }, afterrender: function(control) { control.fireEvent('registermodifier', { control: control, type: 'builtfilter', PropertyName: '', getValue: function() { return { builtfilter: control.getValue() }; } }); } } }); // call the superclass constructor with this updated config. Trakkware.View.Filter.superclass.constructor.call(this, config); this.changeForModifier = function(new_value) { } } }); Ext.reg('trakkware_filter', Trakkware.View.Filter); // A combo box of reports that can be run. // // Expected config options: // // dataArray: The data to use for the combo's array store. Must be in the form [ [ value, text], [value, text] ] // width: The width in pixels of this sort combo. // defaultValue: The default value to set this sort to. // rm: The function to call that registers this modifier. // mc: A function that is called when this modifier changes. Trakkware.View.ReportCombo = Ext.extend(Ext.form.ComboBox, { constructor: function(config) { // Validate several expected values. if (!Ext.isDefined(config.dataArray)) { alert('Config.dataArray is not defined in a config provided to Trakkware.View.ReportCombo.'); return; } // Start a datastore for this combo. var store = new Ext.data.ArrayStore({ autoDestroy: true, fields: ['value', 'text'] }); // Apply additional combo box properties before calling superclass constructor. Ext.apply(config, { store: store, id: config.id, displayField: 'text', valueField: 'value', typeAhead: true, mode: 'local', forceSelection: true, triggerAction: 'all', width: 200, iconCls: 'no-icon', value: config.defaultText, disableKeyFilter: true, minListWidth: 100, listeners: { afterrender: function(control) { if (config.dataArray.length > 0) { store.loadData(config.dataArray); } control.runReport = function(data) { var viewparams = { AdditionalParameters: Ext.apply({}, data), ReportID: control.getValue() }; var report_config = { view: 'Trakkware.Platform.Lib.Reporting.ReportControl, Trakkware.Platform.Lib', command: 'VIEWRESULTS', viewParams: viewparams, launch: 'window', DefaultSizing: { Height: 800 } }; Trakkware.ViewFramework.launchView(report_config); } } } }); Trakkware.View.ReportCombo.superclass.constructor.call(this, config); } }); Ext.reg('trakkware_reportcombo', Trakkware.View.ReportCombo); Ext.ns('Trakkware', 'Trakkware.View'); Trakkware.View.FormLayout = Ext.extend(Ext.Panel, { initComponent: function(config) { Trakkware.View.FormLayout.superclass.initComponent.call(this, config); // Setup events. this.addEvents('registermodifier', 'modifierchanged', 'broadcast', 'registersemimodalwindow'); this.enableBubble('registersemimodalwindow'); }, // // Expected config options: // // Parameters: The parameters object. Parameters.View is used to load forms. // fields: A data definition for this form's data reader. // items: The form's ui items. // // hasUploads: Indicates that this form contains upload fields and therefore must be submitted differently. // toolbar: A toolbar config object. // labelAlign: Indicates how labels should be aligned for this form's items. // DefaultSizing, SubviewSizing: How to size this form. constructor: function(config) { // Immediately attach Trakkware.View functionality. Trakkware.View(this, config); // Construct a toolbar if provided. var toolbar = null if (config.toolbar) toolbar = this.constructToolbar(config.toolbar); // Nice references: var this_form = this; var sizing = config.SubviewSizing || config.DefaultSizing; config = Trakkware.ViewFramework.ApplySizing(config, sizing); // Indicates the dirties on this form are already registered. var dirties = false; // Loads the form. var loadform = function(data) { // If data was provided, apply if to config.Parameters.View if(Ext.isDefined(data)) { config.Parameters.View = Ext.apply(config.Parameters.View, data); } // Create an ajax request and load the form's controls on success. Ext.Ajax.request({ method: 'POST', url: Trakkware.Handlers.MethodHandler, params: { view: config.ViewName, command: config.Command, paramarray: Ext.encode(config.Parameters.View), viewparams: Ext.encode(config.Parameters.Internal) }, reader: new Ext.data.JsonReader({ root: 'list', totalProperty: 'count' }, config.fields), success: function(record) { json_result = Ext.decode(record.responseText); if (Ext.isDefined(json_result.result) && json_result.result == '0') { if (Ext.isDefined(json_result.msg)) { error = json_result.msg; } if (error !== null) { Ext.Msg.alert('Error: Cannot load view data', error); } else { Ext.Msg.alert('Error: Cannot load view data', 'An unspecified error has prevented this view from getting its data. (The failure response object was malformed so I can\'t tell you the actual problem...*sigh*)'); } } else { // Store sub views off to load after everything else is loaded. var subs = {}; // I'm doing each here but it should only ever be for one form. Maybe in the future we will have a form list view // and this first .each will become more useful. Ext.each(json_result.list, function(item, index, all) { // Data that will be sent to subviews. var subview_data = {}; // Template data has internal params applied. var template_data = item; // Apply internal view parameters that don't already exist in the dataset. if (config.Parameters && config.Parameters.Internal) { Ext.iterate(config.Parameters.Internal, function(p) { if (!item[p]) { item[p] = config.Parameters.Internal[p]; } }); } // Try to fill each data field on the form. var fields = this_form.getRegisteredDatafields(); Ext.each(fields, function(field) { var datafield = field['datafield']; if(dirties === false) { // Register this thing as dirtyable. this_form.fireEvent('registerdirtyable', field); } var xtype = field.getXType ? field.getXType() : null; var requires_all = Trakkware.ViewFramework.requiresAllData(xtype); // If the field is a subview, just save it for after we are done with the other fields. // Also listen for formdirty since this is a subview. if (xtype == 'trakkware_subview') { subs[datafield] = field; } else { var the_value = item[datafield]; if (requires_all == true || Ext.isDefined(the_value) || the_value === null) { if (Ext.isDefined(the_value) && the_value) { // hack for the massive confusion of javascript + extJS + Microsoft JSON serializer. if (the_value.indexOf && the_value.indexOf('Date(') > -1) { the_value = eval('new ' + the_value.replace('/', '').replace('/', '')); // Set this for later.. I'm having trouble getting dates in a format that .NET and Ext/JS are all happy with. field.is_date = true; } } // Checkbox needs to be set specially so dirty stuff doesn't fire. if (xtype == 'checkbox') { field.originalValue = null; field.setValue(the_value); field.originalValue = field.getValue(); } else { // Some fields need ALL data given to them. if (requires_all == true) { field.setValue(template_data, field); field.originalValue = field.getValue(); } else { // Setting null to textfields causes them to report isDirty() true before they are dirty // probably because '' and null are not equal and therefore the field is dirty. // The tree is an exception.. i want it to have setValue called no matter what. if (the_value != null || xtype == 'trakkware_tree') { // I don't like doing this here.. :/ Convert true/false to string "true" or "false" since that is what all my picklists use as values: string. if(xtype == 'trakkware_combopicklist' || xtype == 'combo') { if(Ext.isBoolean(the_value) || Ext.isNumber(the_value)) the_value = the_value + ''; } field.setValue(the_value, field); field.originalValue = field.getValue(); } } } if (xtype !== 'trakkware_template' && xtype !== 'trakkware_popup') { subview_data[datafield] = the_value; } // I had to do this here.. not sure how to do it correct in the picklist object. if(field.ShowOn != null) { Trakkware.ViewFramework.ProcessShowOn(field, field.ShowOn, template_data); } if(field.DisableOn != null) { Trakkware.ViewFramework.ProcessDisableOn(field, field.DisableOn, template_data); } // lastly, remove the inner-label class just in case this is a text field with inner labelling field.removeClass('trakkware-textfield-inner-label'); } } }); // calling .setValue() on subviews causes them to load. for (var c in subs) { var this_subview = subs[c]; this_subview.setValue(subview_data); } dirties = true; // Set the preregistered subview's deferred data. var pres = this_form.getPreRegisteredSubviews(); Ext.each(pres, function(pre) { pre.deferred_data = subview_data; }); }); // Controls are all loaded, so fire an event. this_form.fireEvent('controlsloaded', json_result.list[0]); // Apply a title var title_data = null; if (json_result.list.length > 0) title_data = json_result.list[0]; if(config.isSubview != true) this_form.applyTitle(config.TitleTemplate, title_data); // Get a field to focus on/ var focus_field = Trakkware.ViewFramework.findTextOrCombo(this_form); if (config.isSubview !== true && focus_field) { var f = function() { focus_field.focus(); } f.defer(50); } } }, failure: function() { //alert('Unable to load the form.'); } }); } // Listen for reloads. this.on('reloadview', function(data) { if(config.PassReloadToTreeChildren != true) { loadform(data); } else { this_form.items.each(function(item) { if(item.refreshTree) item.refreshTree(); }); } }); // Takes a command and data and reloads this view with them. // Expected config options: // Command: The new command // Data: Additional data to include function reload(reload_config) { if (Trakkware.ViewFramework.requireOption(config, 'Command', 'Trakkware.View.FormLayout.reload') == false) return; if (Trakkware.ViewFramework.requireOption(config, 'Data', 'Trakkware.View.FormLayout.reload') == false) return; // Apply config.Data to the view config. config = Ext.apply(config.Parameters.View, reload_config.Data); loadform(); } // Given a property, returns the control associated with it. function findControl(property_name) { Ext.each(this.findBy(function(thing) { return (Ext.isDefined(thing.datafield) && Ext.isFunction(thing.getValue)); }), function(field) { if (field.datafield == property_name) return field; }); return null; } // add formpanel-related config options. config = Ext.apply(config, { layout: 'form', id: (config.ControlID ? config.ControlID : Ext.id()), autoScroll: true, fileUpload: config.hasUploads, labelAlign: config.labelAlign ? config.labelAlign : 'top', monitorValid: false, tbar: toolbar, unstyled: (config.unstyled || false), hideBorders: (config.unstyled || false), items: config.items, findControl: findControl, padding: '0 0 0 5px', listeners: { // Load the form and register it for broadcasting after this control renders. afterrender: function(form) { loadform(); this.registerForState(); } }, reloadForBroadcast: reload }); // Call the superclass' constructor. Trakkware.View.FormLayout.superclass.constructor.call(this, config); } }); Ext.reg('trakkware_form', Trakkware.View.FormLayout); Ext.ns('Trakkware', 'Trakkware.View'); if(!Trakkware.View.GridLayout) { Trakkware.View.GridLayout = Ext.extend(Ext.grid.GridPanel, { // config options: (See Trakkware.View for base config options) // // ds: An Ext datastore data definition. // cm: An Ext.ColumnModel object. example: new Ext.grid.ColumnModel({columns: { } }); // toolbar: An Ext Toolbar filled with view actions. // Paging related: // usePaging: (true/false) Indicates whether to use paging on this grid. // pageSize: (int) A valid pagesize to start at (5/10/25/50 for now) // gridFilters: A grid filter array indicating which columns to allow filtering on. // DoubleClick: An object describing rowdblclick behavior. // use { ViewName: '', Command: '' } // title: A title template to use for this grid. constructor: function(config) { this.addEvents('registermodifier', 'modifierchanged', 'broadcastmodifiers', 'registersemimodalwindow'); this.enableBubble('registersemimodalwindow'); // add on view functionality to the config.. looks silly doesnt it? Trakkware.View(this, config); // Nice reference var this_grid = this; // Create grid filters.. var filters = new Ext.ux.grid.GridFilters({ encode: true, local: false, filters: config.gridFilters }); // Set initial modifiers for store. config.qm = config.Parameters.InitialQueryModifiers; config.ib = config.Parameters.InitialState; config.StoreOwner = this_grid; // Create a datastore. var datastore = new Trakkware.View.Store(config); // Relay these store events. this.relayEvents(datastore, ['emptydataset', 'performactionondirties', 'afterfirstload', 'mask']); // When the store is loaded, re-apply title. datastore.on('load', function(store, records, options) { var data = {}; if(config.isSubview != true) { if (records.length > 0) data = records[0].data; // Title is the first row of data with View parameters applied on top of them. Ext.apply(data, config.Parameters.View); this_grid.applyTitle(config.TitleTemplate, data); } }); // Pass on modifier events to the store. this.on('registermodifier', function(config) { datastore.fireEvent('registermodifier', config); return false; }); this.on('modifierchanged', function(control, data) { datastore.fireEvent('modifierchanged', control, data); return false; }); // Catch broadcasts and give them to the store. this.on('broadcastmodifiers', function(broadcast_config) { return datastore.fireEvent('broadcastmodifiers', broadcast_config); }); // A paging toolbar will be created is usePaging is specified in config. var paging_toolbar = config.usePaging != true ? null : new Ext.PagingToolbar({ id: Ext.id(), store: datastore, pageSize: config.pageSize, displayInfo: true, prependButtons: true, totalProperty: 'count', plugins: [filters], items: ['Page Size:', { xtype: 'combo', width: 40, mode: 'local', store: new Ext.data.ArrayStore({ id: 0, fields: ['DisplayPage', 'page_count'], data: [['5', 5], ['10', 10], ['25', 25], ['50', 50]] }), valueField: 'page_count', displayField: 'DisplayPage', editable: false, typeAhead: false, allowBlank: false, mode: 'local', disableKeyFilter: true, triggerAction: 'all', value: config.pageSize, listeners: { scope: this, 'select': function(combo, record, index) { paging_toolbar.pageSize = record.get('page_count'); paging_toolbar.doLoad(paging_toolbar.cursor); } } } ] }); // register the pager. if (paging_toolbar != null) { // Register the pager. this.fireEvent('registermodifier', { control: paging_toolbar, type: 'pager', getValue: function() { var limit = paging_toolbar.pageSize; var t = paging_toolbar; start = (Math.ceil((t.cursor + t.pageSize) / t.pageSize) - 1) * t.pageSize; return { start: start, limit: limit }; } }); } // Listen for reloads. this.on('reloadview', function() { datastore.reload(); }); // Reloads the grid when a broadcast is heard. function reload(reload_config) { if (Trakkware.ViewFramework.requireOption(reload_config, 'Command', 'Trakkware.View.GridLayout.reload') == false) return; if (Trakkware.ViewFramework.requireOption(reload_config, 'Data', 'Trakkware.View.GridLayout.reload') == false) return; // Apply all broadcast params to the view paramters config.Parameters.View = Ext.apply(config.Parameters.View, reload_config.Data); // delete the NULL parameter if it exists. delete config.Parameters.NULL; // Tell the grid's store to reload itself. datastore.load(); } var mask = null; var last_row = 0; // Construct a toolbar from config settings. var toolbar = null if (config.toolbar) toolbar = this.constructToolbar(config.toolbar); var grid_config = { id: Ext.id(), ds: datastore, cm: config.cm, fbar: config.usePaging == true ? paging_toolbar : null, tbar: toolbar, plugins: [filters], sm: new Ext.grid.RowSelectionModel({ singleSelect: true }), buttonAlign: 'left', title: 'loading...', onLoad: Ext.emptyFn, listeners: { load: function(store, records, options) { // Try to reselect the last row that was selected. if (last_row != null) { this.getSelectionModel().selectRow(last_row); last_row = null; } //alert(last_left + ' and ' + last_top); }, afterrender: function(grid) { // This is necessary to have the grid remember its scroll position. // I spent way too much time trying to figure this out.. NONE of the Ext solutions work. var view = grid.getView(); view.scrollToTop = function() { } // Load data.. datastore.load(); //Register for broadcasting. this.registerForState(); // register an event for when a query modifier control changes. grid.addEvents('modifierchanged'); }, click: function(e) { var el = Ext.get(e.getTarget()); if(Ext.isDefined(el)) { if(el.hasClass && el.findParent && !el.hasClass('.x-btn-text')) { var new_el = el.findParent('.x-btn-text'); if(new_el != null) el = new_el; } // a grid link must contain at least the command attribute. // if a view attribute is provided, then the link will launch the // view using the command provided. The map and expected attributes are // used to map values from config.viewParams to property names that the // view-being-launched is expecting. var command = el.getAttribute('command'); var view = el.getAttribute('view'); if (Ext.isEmpty(view)) view = config.view; var data = config.viewParams || {}; var row = this_grid.getSelectionModel().getSelected(); if(row) { Ext.apply(data, row.data); } if (command) { var map = el.getAttribute('map'); if (map) { map = Ext.decode(map); } var expected = el.getAttribute('expected'); if (expected) { expected = Ext.decode(expected); } // map the view parameters from this view's parameters. var view_params = Trakkware.ViewFramework.applyMapAndExpected(map, expected, data); this_grid.actionHandler(el, { Command: command, ViewName: view, Parameters: { View: view_params }, DontAdjustParams: true }); } } }, rowdblclick: function(grid, index, e) { if(config.DoubleClick) { var row = grid.getSelectionModel().getSelected(); var viewname = config.DoubleClick.ViewName; var map_to = ''; if(config.DoubleClick.Dynamic != null && row) { viewname = row.data[config.DoubleClick.Dynamic]; } var parameters = Ext.apply({}, config.Parameters); if(config.DoubleClick.MapTo) { Ext.iterate(config.DoubleClick.MapTo, function(from) { var to = config.DoubleClick.MapTo[from]; if(row.data[from] && row.data[to]) parameters.View[row.data[to]] = row.data[from]; }); } this.actionHandler(grid, { ViewName: viewname, Command: config.DoubleClick.Command, Parameters: parameters }); last_row = index; } }, // Event fires when a query modifier's value has changed locally. modifierchanged: function(control) { datastore.reload(); } } } var sizing = config.SubviewSizing || config.DefaultSizing; grid_config = Trakkware.ViewFramework.ApplySizing(grid_config, sizing); // When grid is a subview, set sizing info. if (config.isSubview === true) { grid_config.anchor = '95%'; } // Apply methods that the view will use. Ext.apply(this, { hasSelectedRow: function() { if (this.getSelectionModel().getCount() > 0) { return true; } return false; }, actionDataProvider: function() { if (this.getSelectionModel().getCount() > 0) { return this.getSelectionModel().getSelected().data; } }, onActionReload: function() { datastore.reload(); }, isSelected: function() { return (datastore.getSelectionModel().getCount() > 0); }, getListeningModifierNames: datastore.getListeningModifierNames }); Trakkware.View.GridLayout.superclass.constructor.call(this, grid_config) } }); } Ext.ns('Trakkware', 'Trakkware.View'); Trakkware.View.MapLayout = Ext.extend(Ext.ux.GMapPanel, { initComponent: function(config) { Trakkware.View.MapLayout.superclass.initComponent.call(this, config); this.addEvents('broadcast', 'registermodifier', 'modifierchanged'); }, // Expected config options: // ds: A data store object for the json reader. // Parameters.Internal:The map looks for width and height in the Control parameters. // mapOptions: Google Map options such as 'enableDoubleClickZoom', 'enableDragging' // mapControls: Google Map control options such as 'GSmallMapControl', 'GMapTypeControl' // zoomLevel: The zoom level to start on. // autoCenter: (true/false) Indicates that this map should auto-center on its pins when they are loaded. // centerLng: A center longitude to set this map to. This value overrides the autoCenter value if autoCenter is true. // centerLat: A center latitude to set this map to. The value overrides the autoCenter value if autoCenter is true. // longitudeProperty: The property name used to gather longitude from data items. // latitudeProperty: The property name used to gather latitude values from data items. // zoomLevelProperty: The property name used to get a zoom level from data items. // titleTemplate: The template used to title pins for when people mouse-over them. // pinTemplate: The template that is used to template pin popups. // pinImageUrl: Url to an image to use for pins. // pinClickCommand: A command to put this map into when a pin is clicked instead of showing a popup. // titleCallback: A callback that is invoked after data is loaded so that the parent can set its title. // mapInfo: An object that contains each command for the map, whether the command causes simple view changes, // the commands title and pin templates, and pin urls that are used when simple view changes occur. constructor: function(config) { // add trakkware view functionality. Trakkware.View(this, config); // make a nice reference to this map. var this_map = this; config.ViewObject = this; // Ensure that parameters is an object if (!config.Parameters) config.Parameters = {}; // marker arrays var markers_dict = []; var hidden_markers = []; var original_view_params = Ext.apply({}, config.Parameters ? config.Parameters.View : {}); // load the map... function load_map(leave_pins, causing_marker) { // Show a mask.. //this_map.fireEvent('mask', { Activate: true, ViewName: config.ViewName, Command: config.Command }); // Request the map's data. The data items that come back are mapped as pins. Ext.Ajax.request({ method: 'POST', url: Trakkware.Handlers.MethodHandler, params: { view: config.ViewName, command: config.Command, paramarray: Ext.encode(config.Parameters.View) }, reader: new Ext.data.JsonReader({ root: 'list', totalProperty: 'count' }, config.ds ), success: function(record) { json_result = Ext.decode(record.responseText); if (Ext.isDefined(json_result.result) && json_result.result == '0') { if (Ext.isDefined(json_result.msg)) { error = json_result.msg; } if (error !== null) { Ext.Msg.alert('Error: Cannot load view data', error); } else { Ext.Msg.alert('Error: Cannot load view data', 'An unspecified error has prevented this view from getting its data. (The failure response object was malformed so I can\'t tell you the actual problem...*sigh*)'); } } else { // Got data successfully. Call the title callback, then add pins. if (config.titleCallback) config.titleCallback(json_result.list[0]); // Set up pin templating. var template = null; var xtemplate = null; var title_template = null; var title_xtemplate = null; try { template = config.pinTemplate; // template can have %22s still at this point, so replace them. template = template.replace(/%22/g, '"'); xtemplate = new Ext.XTemplate(template); title_template = config.titleTemplate; title_template = title_template.replace('%22', '"'); title_xtemplate = new Ext.XTemplate(title_template); } catch (e) { Ext.Msg.alert('Invalid Template', 'An invalid template was provided to a map control! Hint: its either Template or TitleTemplate'); } if (title_xtemplate && xtemplate) { // Get the map info for this command. var info = config.mapInfo[config.Command]; // clear pins (unless otherwise indicated) if (leave_pins == true && info.leave_pins) { var the_map = this_map.getMap(); // Get the command for the pins that are to be left on. var leave = info.leave_pins; var leave_props = info.leave_properties; var new_markers_dict = []; // Check each existing marker for whether to leave it or destroy it. Ext.each(markers_dict, function(marker) { var keep = false; Ext.each(info.leave_pins, function(leave_command) { if (marker.set_by_command == leave_command) { keep = true; // If a leave property array exists, check that this marker's value matches a // value in the data. Ext.each(leave_props, function(property) { if (!config.Parameters.View[property] || config.Parameters.View[property] != marker.data_item[property]) { keep = false; return false; } }); return false; } }); if (keep == true) { new_markers_dict.push(marker); } else { the_map.removeOverlay(marker); delete marker; } }); // Set the markers dict to the new one that now contains only the pins that we left on the map. markers_dict = new_markers_dict; } else { // If leave pins was not true, clear out all current pins and reset the marker dictionary. this_map.getMap().clearOverlays(); markers_dict = []; } // Before added this data, check if the dataset returned is valid but empty. // If it is empty, check if this state forwards itself. // SPECIAL NOTE: This check is performed AFTER the pin manipulation bits above because // we want to maintain the same kind of pin hiding that would occur if the current state was instituted. if (config.mapInfo && json_result.count < config.mapInfo[config.Command].empty_trigger_count && config.mapInfo[config.Command] && config.mapInfo[config.Command].if_empty_command) { var forwarded_command = config.mapInfo[config.Command].if_empty_command; // A causing marker might not exist here because a broadcast may be responsible for this load_map. // Create a fake marker that has the properties that are needed by simple state change. // I'm not a big fan of this.. it will cause problems in the future. if (!causing_marker) { causing_marker = { data_item: json_result.list[0], set_by_command: config.Command }; } performSimpleStateChange(forwarded_command, causing_marker); return; } // Start an average lat and lng. var lng_avg = 0; var lat_avg = 0; Ext.each(json_result.list, function(item, index, all) { // Get lng/lat and apply them to the average for autoCentering. var lat = item[config.latitudeProperty]; var lng = item[config.longitudeProperty]; if (lat && lat != 0 && lng && lng != 0) { if (lat_avg == 0) lat_avg = lat; else lat_avg = (lat_avg + lat) / 2; if (lng_avg == 0) lng_avg = lng; else lng_avg = (lng_avg + lng) / 2; } // Create a new pin, assign the pinImageUrl if defined, and set templates. var mkr_point = new GLatLng(lat, lng); var data = item; // Figure out which pin graphics to use. var icon = new GIcon(G_DEFAULT_ICON); // Special case: When UseFlagPins has been specified, use the flag graphic if a CountryCode field is available. if (info && info['use_flag_pins'] == true) { icon.image = '/MapData/flags/' + data['CountryCode'] + '.png'; icon.iconSize = new GSize(22, 16); icon.iconAnchor = new GPoint(5, 32); } else if (Ext.isDefined(config.pinImageUrl)) icon.image = config.pinImageUrl; // Template the pin's html.. var pin_html = xtemplate.apply(item); // Assign data and pin html along with standard GMarker stuff. var marker_data = { icon: icon, title: title_xtemplate.apply(item), id: index, data_item: data, pin_html: pin_html, command: config.pinClickCommand, set_by_command: config.Command }; marker = new GMarker(mkr_point, marker_data); this_map.getMap().addOverlay(marker); Ext.apply(marker, marker_data); // push this marker onto the marker dictionary. markers_dict.push(marker); }); // this bool indicates whether center-to-pin-average is on or off. if (config.autoCenter) { //alert('setting center to ' + lat_avg + ', ' + lng_avg); this_map.getMap().setCenter(new GLatLng(lat_avg, lng_avg)); } // Set the map's initial zoom manually. var zoom = config.zoomLevel; if (config.zoomLevelProperty && !Ext.isEmpty(config.zoomLevelProperty) && causing_marker && causing_marker.data_item && causing_marker.data_item[config.zoomLevelProperty]) { zoom = causing_marker.data_item[config.zoomLevelProperty]; } this_map.getMap().setZoom(zoom); // Show a mask.. //this_map.fireEvent('mask', { Activate: false }); } } }, failure: function() { //alert('Unable to load the form.'); // Show a mask.. //this_map.fireEvent('mask', { Activate: false }); } }); } // Takes a command and data and reloads the map with them. // Expected config options: // Command: The new command // Data: Additional data to include function reload(reload_config) { if (Trakkware.ViewFramework.requireOption(reload_config, 'Command', 'Trakkware.View.FormLayout.reload') == false) return; if (Trakkware.ViewFramework.requireOption(reload_config, 'Data', 'Trakkware.View.FormLayout.reload') == false) return; // Get the command that caused this.. var old_command = config.Command; // Apply config.Data to the view config. config = Ext.apply(config.Parameters.View, reload_config.Data); // Do a simple state change and tell it not to broadcast. var marker = { set_by_command: old_command, data_item: config.Parameters.View }; performSimpleStateChange(reload_config.command, marker, true); } // Apply additional map panel properties to config. config = Ext.apply(config, { id: Ext.id(), mapConfOpts: config.mapOptions, mapControls: config.mapControls, reloadForBroadcast: reload, listeners: { beforerender: function(map) { // Before rendering, derive a size for this map. // NOTE: SIZE IS REQUIRED. var width = null; var height = null; if (config.Parameters && config.Parameters.Internal) { if (config.Parameters.Internal.WidthInPixels) width = config.Parameters.Internal.WidthInPixels; if (config.Parameters.Internal.HeightInPixels) height = config.Parameters.Internal.HeightInPixels; } if ((width == null || height == null) && config.width && config.height) { width = config.width; height = config.height; } if (width == null || height == null) { alert('A width and height were not fully provided to a map. (' + config.ControlID + ': w=' + width + ',h=' + height + ')'); return; } // Before rending the map, set its absolute size. This is // required for map. map.setSize(width, height); }, afterrender: function() { // Get the map to load itself and then attach a click handler // to the google map. load_map(); // Register this map for stateful-ness. this.registerForState(); var map = this_map.getMap(); if (map) { GEvent.addListener(map, 'click', markerClick); } } } }); // Called when the map gets a click. function markerClick(marker, point) { if (marker) { // Get the command that this pin click causes var command_change_to = marker.command; // If there is a command, figure out what to do.. if (!Ext.isEmpty(command_change_to)) { // Look in map info if there is any for this change-to command. var info = (config.mapInfo ? config.mapInfo[command_change_to] : null); if (info) { // Found the command's info. See if we should do a simple change. if (info.simple_change == true) { // Change map state to this new command. performSimpleStateChange(command_change_to, marker); // Bail out after reloading the map. return; } } // If we get this far, then check if an action method exists in config // and use it to trigger an action change. if (Ext.isFunction(config.action)) { config.action(command_change_to, config.view, marker.data_item); } } else { // Check that an actual marker was clicked. The check for openInfoWindow indicates that a // marker was clicked, not something else (like the marker's info window) // Also check that no pin click command is specified. var command = marker.command; var mapinfo = config.mapInfo[command]; if (marker && marker.openInfoWindow && !Ext.isEmpty(marker.pin_html)) { var html = marker.pin_html; var info = Ext.DomHelper.createDom({ tag: 'div', html: html }); marker.openInfoWindow(info); } } } } this.performSimpleViewChange = function(command, actionParams) { // Create a fake causing_marker to send into simple state change.. var marker = { set_by_command: config.Command, data_item: actionParams }; performSimpleStateChange(command, marker, true); return true; } // change the config command to put this view into a new command state function performSimpleStateChange(command, causing_marker, no_broadcast) { // Get map info for this new state. var info = config.mapInfo[command]; // and then reload the map to put it into that state. config.Command = command; // Change our config's zoom level andtemplates to that of the new command state. config.zoomLevel = info.zoom; config.pinTemplate = info.pin_template; config.titleTemplate = info.title_template; config.pinClickCommand = info.pin_command; config.pinImageUrl = info.pin_image; config.zoomLevelProperty = info.zoom_level_property; // When the map is reloading in this way, we must overwrite viewParam data with // data that has been provided by the pin click. config.Parameters.View = Ext.apply({}, original_view_params); config.Parameters.View = Ext.apply(config.Parameters.View, causing_marker.data_item); // TESTING: //alert(' in map layout, performing simple state change, config.Parameters = \r\n' + Ext.encode(config.Parameters)); // Get an action for the broadcaster var action = this_map.getActionDefinition(command); // broadcast the change unless otherwise specified. if (no_broadcast != true) { //alert(config.ControlID + ' broadcasting ' + command + ' with\r\n' + Ext.encode(action) + '\r\nand\r\n' + Ext.encode(config.Parameters.View)); Trakkware.ViewFramework.Broadcast({ ControlID: config.ControlID, Command: command, ActionDefinition: action, RawData: config.Parameters.View }); } // Reload the map with the new command and viewParams! var send_leave_pins = (info.leave_pins && info.leave_pins.length > 0); // Before setting the hidden marker, check if the existing hidden marker should be re-shown. if (hidden_markers && hidden_markers.length > 0) { Ext.each(hidden_markers, function(marker) { // If this hidden pin has a command which is indicated as a command to leave, then show it! if (info.leave_pins && info.leave_pins.length > 0 && info.leave_pins.indexOf(marker.set_by_command) > -1) { marker.show(); } else { delete marker; } }); } // when leave pins is set to true, remove this pin.. if (send_leave_pins && causing_marker.hide) { causing_marker.hide(); hidden_markers = [causing_marker]; } // Reload the map.. load_map(send_leave_pins, causing_marker); } Trakkware.View.MapLayout.superclass.constructor.call(this, config); } }); Ext.ns('Trakkware', 'Trakkware.View'); if(!Trakkware.View.TemplatedListLayout) { Trakkware.View.TemplatedListLayout = function(config) { // TemplatedListLayout config options: // view: Name of the view // command: The view command used to load the form. // viewParams: An object of values that is used to load the form. These params are sent to the method handler everytime. // action: Method is invoked when the form needs to perform a view action. // ds: An Ext datastore data definition. // rs: A method that is invoked when a row selection occurs. It is invoked with the signature (enable, data) // dblclick: A function that will get invoked when a template row is double clicked. The function is invoked with the same parameters as the templates's dblclick event. // Paging related: // usePaging: (true/false) Indicates whether to use paging on this list. // pageSize: (int) A valid pagesize to start at (5/10/25/50 for now) // toolbar: A toolbar of actions. // titleCallback: Callback function that is called when it is time to set the title. // Modifier registration and retrieval // rm: A method which is called that returns a modifiers object ready to be used for data method calls. // pager: A method that takes a paging control's id and registers it for use with the method provided in rm. // qm: An initial query modifiers parameter object to use when making the first load // height: Absolute height of this list. AutoScroll is set to true when an autoHeight is false. // width: Absolute width of the list, in pixels. // autoHeight: (true/false) indicates the list should use autoHeight. var first_load = true; var dataview_store = new Ext.data.Store({ remoteSort: true, proxy: new Ext.data.HttpProxy({ method: 'GET', url: Trakkware.Handlers.MethodHandler, listeners: { exception: function(proxy, type, action, options, response, arg) { response = Ext.decode(response.responseText); if (response && response.result) { if (response.result == '0') { Ext.Msg.alert('Data loading error', 'Unable to load or change pages because: ' + response.msg); } else if (response.result == '1') { Ext.Msg.alert('A data reader error has occured, sorry but I cannot display your data because of it.'); } } }, // Before reloading data, modifiers must be checked for values and included. beforeload: function(store, options) { // Ensure query modifier data is added to the parameters being sent back. var p = null; if (config.rm) { // Get modifier data and use it to override and add values in the options // parameter. Values added to the options param will be send back when // the data store continues loading. p = config.rm(); } if (p) { if (!options) options = {}; for (var ps in p) { // only assign values to the use_object if the value's property name // does not already exist. The main reason for this is start/limit on // paging. if (!Ext.isDefined(options[ps])) { options[ps] = p[ps]; } } } //for(var v in options) alert('before load in the template, ' + v + ' = ' + options[v]); } } }), baseParams: { view: config.view, command: config.command, paramarray: Ext.encode(config.viewParams) }, reader: new Ext.data.JsonReader({ root: 'list', successProperty: 'success', totalProperty: 'count', fields: config.ds }) }); dataview_store.on('load', function(store, records, options) { // When data loads, send the first row's data off to the title callback. if (config.titleCallback && records.length > 0) { config.titleCallback(records[0].data); } }); // A paging toolbar will be created is usePaging is specified in config. var paging_toolbar = config.usePaging != true ? null : new Ext.PagingToolbar({ id: Ext.id(), store: dataview_store, pageSize: config.pageSize, displayInfo: true, prependButtons: true, width: config.width, totalProperty: 'count', items: ['Page Size:', { xtype: 'combo', width: 40, mode: 'local', store: new Ext.data.ArrayStore({ id: 0, fields: ['DisplayPage', 'page_count'], data: [['5', 5], ['10', 10], ['25', 25], ['50', 50]] }), valueField: 'page_count', displayField: 'DisplayPage', editable: false, typeAhead: false, allowBlank: false, mode: 'local', disableKeyFilter: true, triggerAction: 'all', value: config.pageSize, listeners: { scope: this, 'select': function(combo, record, index) { paging_toolbar.pageSize = record.get('page_count'); paging_toolbar.doLoad(paging_toolbar.cursor); } } }] }); // The paging toolbar needs to be registered immediately so that its paging information // can be sent on the first load. if (paging_toolbar != null) { config.pager(paging_toolbar.id); } // adjust a few values if they weren't provided. Ext.applyIf(config, { autoHeight: true, width: 500 }); // Instantiate the data view. var dataview = new Ext.DataView({ id: Ext.id(), autoScroll: true, singleSelect: true, tpl: new Ext.XTemplate(config.template), store: dataview_store, itemSelector: 'div.x-trakkware-selector', overClass: 'trakkware-dataview-item-hover', selectedClass: 'trakkware-dataview-item-selected', width: config.width }); // data view is wrapped in a panel since it is not panel-like. var panel = new Ext.Panel({ tbar: (Ext.isDefined(config.toolbar) ? config.toolbar : null), bbar: (paging_toolbar == null ? null : paging_toolbar), items: dataview, //layout: 'fit', unstyled: true, width: config.width + Trakkware.ViewFramework.getScrollBarWidth(), height: (config.autoHeight == true ? 'auto' : config.height), autoHeight: config.autoHeight, autoScroll: true }); // Perform selection change action if one is set. dataview.on('selectionchange', function(dv, selections) { var selected = selections[0]; if (selected) { var command = selected.getAttribute('command'); var data = Ext.decode(selected.getAttribute('params')); if (command && !Ext.isEmpty(command)) { config.action(command, config.view, data); } config.rs(true, data); } else { config.rs(false, data); } }); // Show a mask when loading. var mask = null; dataview.on('afterrender', function() { mask = new Ext.LoadMask(dataview.id, { msg: 'Loading...', store: dataview_store }); }); // Call the dblclick config method when a row is double clicked. dataview.on('dblclick', function(the_data_view, index, e) { if (config.dblclick) config.dblclick(the_data_view, index, e); }); dataview_store.load(); // Apply methods that the view will use. Ext.apply(panel, { actionDataProvider: function() { var rows = dataview.getSelectedRecords(); // im only allowing for single select currently. if (rows && rows.length > 0) return rows[0].data; }, filterChanged: function(field, value) { // If the filter values is set to empty, // try and eliminate it from the store's // paramarray. This is an artifact of broadcasting // filters. // If the value is not empty, we must replace it in the param array var paramarray_string = dataview_store.baseParams['paramarray']; if (paramarray_string) { var paramarray = Ext.decode(paramarray_string); if (paramarray && paramarray[field]) { if (!Ext.isDefined(value) || value == '' || Ext.isEmpty(value) || value == 'None' || value == 'none') { delete paramarray[field]; } else { paramarray[field] = value; } } paramarray_string = Ext.encode(paramarray); dataview_store.setBaseParam('paramarray', paramarray_string); } //for(var v in dataview_store.baseParams) alert(v + ' = ' + dataview_store.baseParams[v]); dataview_store.load(); }, sortChanged: function() { dataview_store.load(); }, onSearch: function() { dataview_store.load(); }, onActionReload: function() { dataview_store.reload(); }, isSelected: function() { var rs = dataview.getSelectedRecords(); if (rs && rs.length && rs.length > 0) { return true; } return false; } }); return panel; }; }Ext.ns('Trakkware', 'Trakkware.View'); Trakkware.View.FormListLayout = Ext.extend(Ext.Panel, { initComponent: function(config) { Trakkware.View.FormListLayout.superclass.initComponent.call(this, config); // Setup events. this.addEvents('registermodifier', 'modifierchanged', 'broadcast', 'registersemimodalwindow'); this.enableBubble('registersemimodalwindow'); }, // Expected config options: // // items: An items object, Ext-form-style. // Parameters: The parameters object. Specifically .View and .InitialQueryModifiers. // labelAlign: How to align labels on each form item. // ds: An Ext datastore data definition. // Paging related: // usePaging: (true/false) Indicates whether to use paging on this list. // pageSize: (int) A valid pagesize to start at (5/10/25/50 for now) // DoubleClick: An object describing the behavior that occurs when a form item is double clicked. // use { ViewName: '', Command: '' } // ModifierConfirmation: // An object that indicates what to do when there are dirty forms and a query modifier changes. // UseFullViewRefresh: Will be passed to the store. Indicates that refreshs cause the entire view to reload not just data. constructor: function(config) { // easy access var. var panel = this; config.ViewObject = this; // Adjust view size. var sizing=config.SubviewSizing||config.DefaultSizing; config=Trakkware.ViewFramework.ApplySizing(config,sizing); // add trakkware view functionality. Trakkware.View(this, config); // Set initial modifiers for the store. config.qm = config.Parameters.InitialQueryModifiers; config.ib = config.Parameters.InitialState; config.StoreOwner = this; // Get a store for this list. var datastore = new Trakkware.View.Store(config); // When the data is loaded, redo title. datastore.on('load', function(store, records, option) { if (records.length > 0) { if(config.isSubview != true) { var title_data = records[0].data; panel.applyTitle(config.TitleTemplate, title_data); } } }); // Relay these store events. this.relayEvents(datastore, ['emptydataset']); // Listen for reloadview. this.on('reloadview', function(data) { datastore.reload_params = data; datastore.reload(); }); // Catch broadcasts and give them to the store. this.on('broadcast', function(broadcast_config) { var result = datastore.fireEvent('broadcast', broadcast_config); }); // Get mask from the datastore and fire it on this. datastore.on('mask', function(mask_config) { panel.fireEvent('mask', mask_config); }); // pass performactionondirties on to this view. datastore.on('performactionondirties', function(dirty_config) { panel.fireEvent('performactionondirties', dirty_config); }); // Store config.items here so it can be reused when creating form items. var formitems = config.items; // A paging toolbar will be created is usePaging is specified in config. var paging_toolbar = config.usePaging != true ? null : new Ext.PagingToolbar({ id: Ext.id(), store: datastore, pageSize: config.pageSize, displayInfo: true, prependButtons: true, totalProperty: 'count', items: ['Page Size:', { xtype: 'combo', width: 40, mode: 'local', store: new Ext.data.ArrayStore({ id: 0, fields: ['DisplayPage', 'page_count'], data: [['5', 5], ['10', 10], ['25', 25], ['50', 50]] }), valueField: 'page_count', displayField: 'DisplayPage', editable: false, typeAhead: false, allowBlank: false, mode: 'local', disableKeyFilter: true, triggerAction: 'all', value: config.pageSize, listeners: { scope: this, 'select': function(combo, record, index) { paging_toolbar.pageSize = record.get('page_count'); paging_toolbar.doLoad(paging_toolbar.cursor); } } } ] }); // register the pager. if (paging_toolbar != null) { datastore.fireEvent('registermodifier', { control: paging_toolbar, type: 'pager', getValue: function() { var limit = paging_toolbar.pageSize; var t = paging_toolbar; start = (Math.ceil((t.cursor + t.pageSize) / t.pageSize) - 1) * t.pageSize; return { start: start, limit: limit }; } }); } // Takes a command and data and reloads this view with them. // Expected config options: // Command: The new command // Data: Additional data to include function reload(reload_config) { if (Trakkware.ViewFramework.requireOption(reload_config, 'Command', 'Trakkware.View.FormListLayout.reload') == false) return; if (Trakkware.ViewFramework.requireOption(reload_config, 'Data', 'Trakkware.View.FormListLayout.reload') == false) return; // Apply config.Data to the view config. config = Ext.apply(config.Parameters.View, reload_config.Data); datastore.load(); } // Method that gets called when the store loads. function onStoreLoad(store, records, options) { // When data loads, send the first row's data to the title setter. var title_data = {}; if (records.length > 0) title_data = records[0].data; if(config.isSubview != true) panel.applyTitle(config.TitleTemplate, title_data); // Remove all existing items from the listing panel and add the new ones. panel.removeAll(true); // dump old transactions. panel.resetTransactionals(); panel.resetDirtyables(); // If there was data, fill it. Otherwise show the empty text. if (records && records.length > 0) { var group = store.getCurrentGroup(); var group_val = null; var index = 0; Ext.each(records, function(record) { // Get data from the record. var data = record.data; data.json = record.json; if(config.ReportMode === true) { var d = []; Ext.each(records, function(r) { d.push(Ext.apply(r.data, r.json)); }); data.data = d; } // Insert list information into the data. data.__list_count = records.length; // Insert the current group into data. data.CurrentGroup = group; if (config.GroupHeaders && group != null && config.GroupHeaders[group] && data[group] != group_val) { group_val = data[group]; var xt = new Ext.XTemplate(config.GroupHeaders[group]); var template_panel = new Ext.Panel({ unstyled: true, border: false, autoHeight: true, listeners: { afterrender: function(cmp) { xt.overwrite(cmp.getEl(), data); } } }); template_panel.isDirty = function() { return false; } template_panel.getData = function() { return {} } template_panel.findControl = function() { return null; } template_panel.transactionRevoke = function() { } panel.add(template_panel); } // Creates and adds a new form item to the panel. panel.addFormItemToPanel(data, index); index++; if(config.ReportMode === true) return false; }); } else { // Create a panel with the empty dataset text and add it to this control. var empty_panel = new Ext.Panel({ html: config.EmptyDatasetText, anchor: '99%, 99%', datafield: 'empty text panel' }); panel.add(empty_panel); } panel.doLayout(); } // Takes a new formitem and adds it to this panel at the end. panel.addFormItemToPanel = function(data, index) { // Check if there is an empty text panel and remove if so. if (panel.items.length == 1) { var remove_all = false; panel.items.each(function(item) { if (item.datafield == 'empty text panel') { remove_all = true; return false; } }); if (remove_all === true) { panel.removeAll(true); } } // Create a new and add it.. var form = createFormItem(config, data, index); // Check for alternate coloring. if(!Ext.isEmpty(config.AlternateRowColor) && index %2 == 0) { form.on('afterrender', function(f) { f.el.setStyle({ 'background-color': config.AlternateRowColor}); }); } panel.add(form); panel.doLayout(); // Register this new form.. panel.fireEvent('registerdirtyable', form); return form; } function createFormItem(config, data, index) { if (!Ext.isDefined(data['index'])) data['index'] = index; var form = new Ext.Container({ layout: 'form', id: Ext.id(), hideBorders: (config.unstyled || false), unstyled: (config.unstyled || false), autoHeight: true, labelAlign: config.labelAlign ? config.labelAlign : 'left', items: formitems, cls: (config.cls || ''), listeners: { controlsloaded: function(data) { Ext.each(form._registered_picklists, function(picklist) { picklist.fireEvent('react', data); }); }, picklistreaction: function(property_name, new_value, reactions) { Ext.each(form._registered_picklists, function(picklist) { if (reactions.indexOf(picklist.datafield) > -1) { var data = {}; data[property_name] = new_value; picklist.fireEvent('react', data); } }); return false; }, resetdirty: function(originating_view) { // NOTE: Taken from the 'resetdirty' handler in Trakkware.View. // Un-dirty anything in the dirtyable list. Ext.each(form._registered_dirtyables, function(item) { // Ext.util.Observable.hasEvents would be nice.... var evt = item.events['resetdirty']; var hasevent = Ext.isObject(evt) || (evt === true); // Any dirtyable that has the reset dirty event, pass it on! if (hasevent == true) { item.fireEvent('resetdirty', form); } else if (item.getValue) { // Things like textfields and combos have originalValue and getValue, so // use them to trick themselves in to thinking they are no longer dirty. item.originalValue = item.getValue(); } }); }, registerdirtyable: function(control) { form._registered_dirtyables.push(control); return false; }, registersubview: function(subview) { form._registered_subviews.push(subview); return false; }, registerdatafield: function(control) { form._registered_datafields.push(control); if (control.getXType && control.getXType() == 'trakkware_combopicklist') { form._registered_picklists.push(control); } return false; }, afterrender: function() { form.getEl().addClassOnOver('trakkware-select-row'); // Store this form's data off for later use. form.DataItem = data; // Fill the cloned fields with values. setFieldValues(form, form.findBy( function(cmp, container) { if (cmp.datafield) { form.fireEvent('registerdatafield', cmp); return true; } } ), data ); // Get buttons and attach this form to them. Ext.each( form.findBy( function(cmp, container) { if (cmp.datafield) { return true; } } ), function(control) { attachControlToForm(control, form); } ); // Let picklists load. form.fireEvent('controlsloaded', data); // Finally, register a dbl click event. form.getEl().addListener('dblclick', function(e) { if (config.DoubleClick) { // Need to make a "control" here that contains an attachedToForm that is THIS form item. var control = { attachedToForm: form }; panel.actionHandler(control, { ViewName: config.DoubleClick.ViewName, Command: config.DoubleClick.Command, Parameters: config.Parameters }); } }); } } }); // Takes a control and form, and sets the control's .attachedToForm property to the form. // This is necessary because we have many forms and many cobntrols and when a button is clicked or a control dirtied (when autosave), // it needs to get data from the correct form. function attachControlToForm(control, form) { if (control && form) { control.attachedToForm = form; } } var _in_revoke = false; form.InRevoke = function(in_revoke) { if (in_revoke) _in_revoke = in_revoke; return _in_revoke; } form._registered_dirtyables = []; form._registered_datafields = []; form._registered_picklists = []; form._registered_subviews = []; // Keeps us from re-registering dirties on reload. form.dirties = false; // Enable dirty events and allow them to bubble up to the containing view. form.addEvents('dirty', 'causesfieldchange'); form.enableBubble('dirty', 'causesfieldchange'); // Checks if this form item is currently dirty. form.isDirty = function() { var result = false; Ext.each(form._registered_dirtyables, function(control) { var is_dirty = control.isDirty(); if (is_dirty == true) { result = true; return false; } }); return result; } // Add a method for getting data from this form. form.getData = function() { // Get data fields from this form. These are fields with a property called // datafield set to a propertyname and having a method called getValue(); // The data STARTS as the data that was provided TO the form originally, so values // will be overwritten with newer data in the form's controls. var data = form.DataItem ? form.DataItem : {}; Ext.each(form._registered_datafields, function(field) { var xtype = field.getXType ? field.getXType() : 'unknown'; if (xtype != 'trakkware_template' && xtype !== 'trakkware_popup') { var datafield = field['datafield']; try { var value = field.getValue(); } catch(e) { alert('got an error trying to get value:\r\n' + field.getValue); } // If the fields value is the same as an innerLabel value, then it is actually empty. if (value == field.innerLabel) value = ''; // The getValue method for radiogroups returns the radio button that is checked. else if (field.getXType && field.getXType() == 'radiogroup') value = value.inputValue; // Format date fields. if (field.is_date === true) { value = new Date(value); } data[datafield] = value; } } ); Ext.each(form._registered_subviews, function(subview) { var list = subview.getValue(); if (list) data[subview.datafield] = list; }); return data; } form.findControl = function(property_name) { Ext.each(form.findBy(function(thing) { return (Ext.isDefined(thing.datafield) && Ext.isFunction(thing.getValue)); }), function(field) { if (field.datafield == property_name) return field; }); return null; } // Performs local duties for special action invocation. // This is the method that INVOKES special behaviors. The one that REVOKES these // behaviors (for undoing) is down below.. transactionRevoke() form.specialInvoke = function(control, command, invoke_behavior, invoke_parameters, revoke_text) { // add a new record. if (invoke_behavior == 10) { // Add a new form to the panel. var newform = panel.addFormItemToPanel(invoke_parameters, 0); panel.doLayout(); var focus_field = Trakkware.ViewFramework.findTextOrCombo(newform); if (focus_field != null) { var f = function() { focus_field.focus(); }; f.defer(50); } } else if (invoke_behavior == 20) { _in_revoke = true; form.hide(); } else if (invoke_behavior == 30) { _in_revoke = true; form.disable(true); } else if (invoke_behavior == 40) { _in_revoke = true; // Disable all items on the form with the exception of the button that caused the action if revoke text is specified. Ext.each(form.findBy(function(control) { if (control && control.datafield) return true; return false; }), function(item) { if (item == control && !Ext.isEmpty(revoke_text)) { // When we find the button, and revoke text has been specified, set the button's text and DO NOT // disable it. Instead, set .causes_revoke to true so next time its clicked it will revoke the // behavior it caused. var width = control.getWidth(); control.text_on_revoke = control.getText(); control.setText(revoke_text); control.causes_revoke = true; control.setWidth(width); } else if (item.disable) { item.disable(true); } }); } return true; } form.transactionRevoke = function(invoke_behavior, button) { _in_revoke = false; if (invoke_behavior == 10) { alert('Undoing add new is not supported.'); } else if (invoke_behavior == 20) { form.show(); } else if (invoke_behavior == 30) { form.enable(true); } else if (invoke_behavior == 40) { // Disable all items on the form with the exception of the button that caused the action if revoke text is specified. Ext.each(form.findBy(function(control) { if (control && control.datafield) return true; return false; }), function(item) { if (item == button) { var width = button.getWidth(); button.causes_revoke = undefined; // Change the button text back.. if (button.text_on_revoke) { button.setText(button.text_on_revoke); button.text_on_revoke = undefined; } button.setWidth(width); } else if (item.enable) { item.enable(true); } }); } // Important to return the fact that everything was cool. return true; } return form; } // private method: Gets an array of the fields on this form that are datafields. function getDataFields(form) { var fields = []; Ext.each(form.findBy(function(thing) { return (Ext.isDefined(thing.datafield) && Ext.isFunction(thing.getValue)); }), function(field) { fields.push(field); }); return fields; } // Takes a set of fields and sets them with data using each field's datafield property to get the property from the provided data object. function setFieldValues(form, fields, data) { // Keeps track of sub views. var subs = []; // Template data has internal params applied. var template_data = data; // Apply internal view parameters that don't already exist in the dataset. if (config.Parameters && config.Parameters.Internal) { Ext.iterate(config.Parameters.Internal, function(p) { if (!data[p]) { data[p] = config.Parameters.Internal[p]; } }); } // Holds data that will be passed to subviews. var subview_data = {}; // Fill the cloned fields with values. Ext.each(fields, function(field) { // Get several pieces of info about this field.. var datafield = field.datafield; // Deal with show on and hide this control if necessary. if(field.ShowOn !== null) { var showon = Trakkware.ViewFramework.ProcessShowOn(field.ShowOn, data); if(showon === 'hide') { // Try to hide.. if all else fails, forget it and move on. Wasn't meant to be. if(Ext.isFunction(field.hide)) field.hide(); else if(Ext.isFunction(field.setStyles)) field.setStyles({ display: 'none' }); return; } } // Register this thing as dirtyable. var xtype = field.getXType ? field.getXType() : null; if(xtype == 'hidden') { // do nothing } else { if(form.dirties === false) { form.fireEvent('registerdirtyable', field); } } // Register events on the field. field.addEvents('dirty', 'causesfieldchange'); field.enableBubble('dirty', 'causesfieldchange'); var xtype = (field.getXType ? field.getXType() : null); if (xtype == 'trakkware_subview') { subs.push(field); } else { if(Ext.isDefined(data[datafield]) === true || xtype == 'trakkware_button') { var the_value = data[datafield]; var requires_all = Trakkware.ViewFramework.requiresAllData(xtype); if (requires_all == true || Ext.isDefined(the_value) || the_value === null) { if (Ext.isDefined(the_value) && the_value) { // hack for the massive confusion of javascript + extJS + Microsoft JSON serializer. if (the_value.indexOf && the_value.indexOf('Date(') > -1) { the_value = eval('new ' + the_value.replace('/', '').replace('/', '')); // Set this for later.. I'm having trouble getting dates in a format that .NET and Ext/JS are all happy with. field.is_date = true; } } // Checkbox needs to be set in a specific manner so dirty stuff doesn't fire. if (xtype == 'checkboxgroup') { field.originalValue = null; field.setValue(the_value); } else { // Templated fields need ALL data given to them. if (requires_all == true) { field.setValue(template_data, field); field.originalValue = field.getValue(); } else { // I don't like doing this here.. :/ Convert true/false to string "true" or "false" since that is what all my picklists use as values: string. if(xtype == 'trakkware_combopicklist' || xtype == 'combo') { if(Ext.isBoolean(the_value) || Ext.isNumber(the_value)) the_value = the_value + ''; } // Setting null to textfields causes them to report isDirty() true before they are dirty // probably because '' and null are not equal and therefore the field is dirty. if (the_value != null || xtype == 'trakkware_tree') { field.setValue(the_value, field); field.originalValue = field.getValue(); } } } // I had to do this here.. not sure how to do it right in the picklist object. if(field.ShowOn != null) { Trakkware.ViewFramework.ProcessShowOn(field, field.ShowOn, template_data); } if(field.DisableOn != null) { Trakkware.ViewFramework.ProcessDisableOn(field, field.DisableOn, template_data); } if (xtype !== 'trakkware_template' && xtype !== 'trakkware_popup') { subview_data[datafield] = the_value; } // lastly, remove althe inner-label class just in case this is a text field with inner labelling field.removeClass('trakkware-textfield-inner-label'); } } } }); Ext.each(subs, function(subview) { subview.setValue(subview_data); }); form.dirties = true; } // used to keep paging confirmation changes from forming infinite "Are you sure?" loops. var in_confirmation = false; // Construct a toolbar from config settings. var toolbar = null if (config.toolbar) toolbar = this.constructToolbar(config.toolbar); // Apply additional config options for the panel. config = Ext.apply(config, { // This is why I store the var 'formitems' at the top.. items sent to the panel needs to be empty array. items: [], ui: Ext.id(), tbar: toolbar, bbar: paging_toolbar, collapsible: false, closable: false, layout: 'fit', unstyled: (config.unstyled || false), hideBorders: (config.unstyled || false), autoScroll: true, border: false, anchor: '95%', listeners: { broadcastmodifiers: function(broadcast_config) { datastore.fireEvent('broadcastmodifiers', broadcast_config); }, registermodifier: function(modifier_config) { datastore.fireEvent('registermodifier', modifier_config); return false; }, afterrender: function(panel) { // If this list is inside a tabpanel, hide it's title. if (panel.ownerCt && panel.ownerCt.ownerCt && panel.ownerCt.ownerCt.ownerCt && panel.ownerCt.ownerCt.ownerCt.getXType() == 'tabpanel') { panel.header.setHeight(0); panel.header.hide(); } } } }); // I don't want the entire form to take this class, just the individual form list items. var cls = config.cls; delete config.cls; Trakkware.View.FormListLayout.superclass.constructor.call(this, config); config.cls = cls; // Apply methods that the view will use. Ext.apply(panel, { specialInvoke: function(control, command, invoke_behavior, invoke_parameters, revoke_text) { // add a new record. if (invoke_behavior == 10) { // Add a new form to the panel. var newform = panel.addFormItemToPanel(invoke_parameters, 0); panel.doLayout(); var focus_field = Trakkware.ViewFramework.findTextOrCombo(newform); if (focus_field != null) { var f = function() { focus_field.focus(); }; f.defer(50); } } // Return true so that dirty happens!~!! return true; }, // Given a property, returns the control associated with it. findControl: function(property_name) { Ext.each(form.findBy(function(thing) { return (Ext.isDefined(thing.datafield) && Ext.isFunction(thing.getValue)); }), function(field) { if (field.datafield == property_name) return field; }); return null; }, isSelected: function() { /*var rs = formlist.getSelectedRecords(); if (rs && rs.length && rs.length > 0) { return true; } return false; */ }, actionDataProvider: function() { var data = []; panel.items.each(function(formitem) { if(formitem.getData) data.push(formitem.getData()); }); return data; }, performActionOnDirtyRecords: function(command) { var ii = 0; panel.items.each(function(form_item) { if (form_item && form_item.isDirty() == true) { var data = form_item.getData(); config.action(command, config.view, data, true, null, function(transactions) { if (transactions && transactions.length) { Trakkware.ViewFramework.commitTransaction(config.view, null, transactions, config, function() { // for now do nothing on success? }); } }); } }); }, getListeningModifierNames: datastore.getListeningModifierNames }); // Attach a load listener. datastore.on('load', onStoreLoad); // Finally, register and load this view. panel.on('afterrender', function() { datastore.load(); panel.registerForState(); }); } }); Ext.ns('Trakkware', 'Trakkware.View'); Trakkware.View.PieChartLayout = Ext.extend(Ext.Panel, { initComponent: function(config) { Trakkware.View.PieChartLayout.superclass.initComponent.call(this, config); // Set up events. this.addEvents('registermodifier', 'modifierchanged', 'broadcast', 'registersemimodalwindow'); this.enableBubble('registersemimodalwindow'); }, // // Expected config options: // // Parameters: The parameters object. Parameters.View is used to load forms. // fields: A data definition for this form's data reader. // items: The form's ui items. // // hasUploads: Indicates that this form contains upload fields and therefore must be submitted differently. // toolbar: A toolbar config object. // labelAlign: Indicates how labels should be aligned for this form's items. // DefaultSizing, SubviewSizing: How to size this form. constructor: function(config) { // Immediately attach Trakkware.View functionality. Trakkware.View(this, config); // Construct a toolbar if provided. var toolbar = null if (config.toolbar) toolbar = this.constructToolbar(config.toolbar); // Nice references: var this_chart = this; // A couple store settings. config.qm = config.Parameters.InitialQueryModifiers; config.ib = config.Parameters.InitialState; config.StoreOwner = this; var sizing = config.SubviewSizing || config.DefaultSizing; config = Trakkware.ViewFramework.ApplySizing(config, sizing); // Create a store. var datastore = new Trakkware.View.Store(config); datastore.on('load', function(store, records, options) { if(records.length > 0) { // Get colors. var colors = []; Ext.each(records, function(record) { var data = record.data; if(data.Color) colors.push(data.Color); }); var piechart = { xtype: 'piechart', data: records, store: datastore, dataField: config.DataPropertyName, categoryField: config.CategoryPropertyName, series: [{ style: { colors: colors } }], extraStyle: { legend: { display: 'bottom', padding: 5, font: { family: 'Tahoma', size: 13 } } } } this_chart.add(piechart); } else { this_chart.add({ xtype: 'panel', html: config.EmptyText, unstyled: true, hideBorders: true }); } this_chart.doLayout(); }); // add formpanel-related config options. config = Ext.apply(config, { id: (config.ControlID ? config.ControlID : Ext.id()), autoScroll: true, items: [], labelAlign: config.labelAlign ? config.labelAlign : 'top', tbar: toolbar, unstyled: (config.unstyled || false), hideBorders: (config.unstyled || false), padding: '0 0 0 5px', closable: false, listeners: { // Load the form and register it for broadcasting after this control renders. afterrender: function(form) { datastore.load(); this.registerForState(); } } }); // Call the superclass' constructor. Trakkware.View.PieChartLayout.superclass.constructor.call(this, config); } }); Ext.reg('trakkware_piechart', Trakkware.View.PieChartLayout); //Ext.ns('Trakkware', 'Trakkware.View'); Trakkware.View.WindowManager=Ext.extend(Ext.util.Observable,{ // config options // // DefaultSizing: Sizing options to use to determine window sizing. // cascade (true/false) When set to true, windows will be cascaded from the active window out. // cascadePositionContainer: A container which is used to get a starting position for cascading windows. constructor: function(config) { var me=this; // PRIVATE // The window group used to do the heavy lifting of this window manager. var mgr = new Ext.WindowGroup(); // Ensure the global window manager has a very high zseed. Otherwise Msg alerts appear behind our windows. Ext.WindowMgr.zseed = 15000; // Takes a rendered view object and adjusts the window it is using to its size. function makeWindowAdjustment(window,rendered_view,top,left) { var x=left; var y=top; // Perform cascade positioning first. if(config.cascade==true) { var active=mgr.getActive(); if(active) { var pos=active.getPosition(); x=pos[0]+4; y=pos[1]+26; } else { // When either top or left is unknown and we have a positioning object, use it! if((!x||!y)&&config.cascadePositionContainer) { // Derive a starting position. Made to work with TabManager currently. var pos=config.cascadePositionContainer.getPosition(); x=pos[0]+3; y=pos[1]+28; } } } var width=rendered_view.getWidth(); //Trakkware.ViewFramework.SCROLLBAR_WIDTH; var height=rendered_view.getHeight(); // +Trakkware.ViewFramework.SCROLLBAR_WIDTH; // Sometimes we have a view which likes to autoheight, but gets stuffed into a window. In this case, height will come // back as zero, so use the Height value. //alert(Ext.encode(config.DefaultSizing)); if(height==0&&config.DefaultSizing) height=config.DefaultSizing.Height; var body_size=Ext.getBody().getViewSize(); if(x) body_size.width+= -x; if(y) body_size.height+= -y; var auto_scroll=false; if(width>body_size.width) { width=body_size.width-Trakkware.ViewFramework.SCROLLBAR_WIDTH; auto_scroll=true; } if(height>body_size.height) { height=body_size.height-Trakkware.ViewFramework.SCROLLBAR_WIDTH; auto_scroll=true; } if(x&&y) { window.setPosition(x,y); } window.setSize({ width: width,height: height }); if(auto_scroll===true) window.setAutoScroll(true); } Trakkware.View.WindowManager.superclass.constructor.call(this,config); // Create an event for alerting the user of WindowManager when a window is added or removed. me.addEvents('windowchange'); Ext.apply(this,{ // config: // // view: The view object to use. // launch: How to launch this view. // modalParent: A parent object to modalize. // header: (true/false) Whether to show a header for this window. // closable: Indicates this window should show a closing X. // replace: (true/false) Indicates this window should replace the currently active window. // Basically, this just closes the currently active window and shows this one. // parentRefreshView: A view object that 'refresh' will be passed to when this view object hears refresh. // Used for passing around a view who launched a window which passed control to another window, which then needs to refresh a parent after an action. addView: function(config) { config.view.setWindowMgr(me); // Get the active window so i can be modalized after render. var modal_parent = mgr.getActive(); if(modal_parent == null) modal_parent = config.modalParent; // Capture the parent object which will get refresh events if they come through. var refresh_parent = config.parentRefreshView; // Houses the mask which is currently active on this window. var mask = null; var window=new Ext.Window({ width: 0, height: 0, autoHeight: false, layout: 'fit', items: [config.view], manager: mgr, title: (config.header == true ? null : 'loading...'), header: config.header, closable: (config.header == false ? false : (config.closable || true)), listeners: { cancelview: function(view) { // Close the window when a view cancels itself. window.close(); }, activate: function(activated) { // When a semimodal window is activated, reorder windows. function sendback() { if(mask) { mgr.sendToBack(activated); } } sendback.defer(250); }, afterrender: function(rendered_window) { // Check for replacement option. if(config.replace == true) { // We need to try to get the modal parent for this window's modal parent. // This parent replaces this window's parent so we demodalize the correct thing on destroy. var new_parent = null; if(modal_parent.getModalParent) new_parent = modal_parent.getModalParent(); // Remove the parent's parent so it doesn't de-modalize and then close. modal_parent.setModalParent(null); modal_parent.close(); // Pass this view's parent refresh object on to this replacement view. rendered_window.setParentRefreshObject(modal_parent.getParentRefreshObject()); // And replace it. modal_parent = new_parent; } else { if(modal_parent) { // Semimodalize the window that was active before this one or the parent provided in config. if(Ext.isFunction(modal_parent.makeSemimodal)) modal_parent.makeSemimodal(true); else modal_parent.el.mask(null); } } // Once the window is rendered, wait for the view object to finish // rendering and then call the window size adjustment bits. if(config.view.rendered===true) { makeWindowAdjustment(rendered_window, config.view); } else { config.view.on('afterrender',function(rendered_view) { makeWindowAdjustment(rendered_window, rendered_view); }); } // Since we added a window, throw the event. me.fireEvent('windowchange', me); }, beforedestroy: function(destroyed_window) { // Modal parent might be gone if we did a replace. if(modal_parent != null) { // Revoke the modalizations on this window's predecessor. if(modal_parent.makeSemimodal) modal_parent.makeSemimodal(false); else modal_parent.el.unmask(); } // Unregister the window. mgr.unregister(destroyed_window); // Alert others that our windows have changed. me.fireEvent('windowchange', me); // Reset mask. mask = null; } } }); // Returns true if this window is masked. window.makeSemimodal = function(option) { if(option == true) { mask = window.el.mask(null); } else { window.el.unmask(); mask = null; } } // Returns the thing which is considered the modal parent of this window. // Usually this is the window which launched this window window.getModalParent = function() { return modal_parent; } // Sets the modal parent for this window. Used for control passing. window.setModalParent = function(parent) { modal_parent = parent; } // Sets the view object that will have refresh called on it when this window // receives a "refresh and close" event. window.setParentRefreshObject = function(view) { refresh_parent = view; } // Gets the view object that parent refresh should be passed to. window.getParentRefreshObject = function() { return refresh_parent; } // // Additional window listeners. // // Attach a title listener on this view so when the view sets // its title, this window can set its title to that value. config.view.on('titlechange', function(panel, title) { if(config.header != false) window.setTitle(title); }); // Listen for parent reload and close. This event name is not explicit enough. config.view.on('reloadparentview',function() { refresh_parent.fireEvent('reloadview'); window.close(); return false; }); window.show(); }, hideAll: function() { mgr.hideAll(); }, showAll: function() { mgr.each(function(window) { window.show(); }); }, // Returns the window count. getCount: function() { var ii = 0; mgr.each(function(window) { ii++; }); return ii; }, destroy: function() { // Destroy each window belonging to this manager. mgr.each(function(window) { delete window; }); delete mgr; } }); } }); Ext.reg('trakkware_windowmgr',Trakkware.View.WindowManager);//Ext.ns('Trakkware', 'Trakkware.View'); Trakkware.View.TabManager = Ext.extend(Ext.TabPanel, { // config options // // homeHtml: HTML to display on the home tab. // dashboardView: The view type of a dashboard to show instead of homeHtml. // cascadeWindows: (true/false) Set to true and windows will be cascaded using the last window's top,left as a starting point. // parentForNonTabs: A tabpanel which will act as the parent for non-tab window launches. constructor: function(config) { var me = this; // PRIVATE // Indicates whether the Tab Manager is busy launching views or not. Used to prevent // the user from building up a huge queue of launches. var _busy = false; // An object used to reference window managers. _manager[tab.id] = WindowManager object. var _managers = {}; // Creates a view from config.dashboardView and inserts it into the panel provided. function createDashboard(panel) { createView({ view: config.dashboardView, command: 'POPULATE', launch: 'inline', callback: function(viewobject) { panel.removeAll(); panel.add(viewobject); panel.setTitle('Dashboard'); panel.doLayout(); } }); } // Looks for a tab with the id specified and activates it if found. // Returns true if found, false if not found. function switchToExistingTab(tabid) { var found = false; me.items.each(function(item) { if(item.tabid == tabid) { found = true; me.activate(item); return false; } }); return found; } // config: // view: name of the view to start with. // command: command to indicates the view's initial state. // parameters: A set of parameters to send to the view when it is created. // launch: ('window'/'inline') Indicates how to launch this initial view it is created. // callback: function is invoked with the viewobject when the object is done being created. function createView(config) { return Trakkware.ViewFramework.createView({ view: config.view, command: config.command, viewParams: config.parameters, callback : config.callback, failureCallback: function(response) { alert('nothing happening in this failure callback.'); } }); } // Takes a view object and launches it accordingly, while also starting a tab // and associated window manager for that tab. function createTab(tabid, viewobject, launch) { // Make launch consistent. launch = (launch || '').toLowerCase(); // setup a panel that will be used for windowed launches. var panel = { html: 'Place Holder', title: '????' }; if(launch === 'inline') { panel = viewobject; } // Add the panel to tabs. // Create a window manager to be used by this tab. var window_manager = new Trakkware.View.WindowManager({ cascade: true, cascadePositionContainer: me }); // Add this view to the window manager. // for now only window launch is handled by the window manager. inlines will sometimes // soon hopefully. if(launch == 'window') { window_manager.addView({ view: viewobject, launch: launch }); } else { var newtab = me.add(panel); newtab.tabid = tabid; // once window manager handles all adds, this line will become obsolete. viewobject.setWindowMgr(window_manager); // activate the new tab. me.activate(newtab); // Clean up when the tab is destroyed. newtab.on('destroy', function(destroyed_tab) { // Remove the reference in the managers list. delete _managers[tabid]; // Get rid of the manager and the panel. window_manager.destroy(); delete window_manager; delete panel; }); // Listen for windowchanges. window_manager.on('windowchange', function(mgr) { var el = me.getTabEl(newtab); var count = mgr.getCount(); // Hide the tab's closing X when there are outstanding windows. if(count == 0) { Ext.get(el).addClass('x-tab-strip-closable'); } else { Ext.get(el).removeClass('x-tab-strip-closable'); } }); // Tie this tab and manager together in the managers array. _managers[tabid] = window_manager; } } // config: // tabid: An identifier that can be used by users of the tab manager to identify tabs. // see createView() for the rest. // returns: A status string: // 'busy' = The manager is busy. // anything else means success. function startNewTab(config) { if(_busy === true) { return 'busy'; } // set the busy status during the creation phase of things. _busy = true; // Create the new view and deal with it. Ext.apply(config, { callback: function(view) { createTab(config.tabid, view, config.launch); _busy = false; } }); createView(config); } Ext.apply(config, { id: Ext.id(), items: [{ xtype: 'panel', items: [{ html: 'Loading Dashboard...' }], listeners: { afterrender: function(panel) { createDashboard(panel); } } }], activeTab: 0, enableTabScroll:true, defaults: { autoScroll:true, closable: true, layout: 'fit', title: 'loading...' }, listeners: { tabchange: function(tabpanel, tab) { // Hide all window managers except the one tied to activated tab. Ext.iterate(_managers, function(id) { if(tab.tabid != id) _managers[id].hideAll(); else _managers[id].showAll(); }); } } }); Trakkware.View.TabManager.superclass.constructor.call(this, config); Ext.apply(this, { // Switches the focus to the id provided if it is already a tab, // otherwise creates a tab based on the information in config. // config: // see launchNewTab() switchTo: function(tabid, config) { if(switchToExistingTab(tabid) == false) { Ext.apply(config, { tabid: tabid }); startNewTab(config); } } }); } }); Ext.reg('trakkware_tabmgr', Trakkware.View.TabManager);/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.Mask = { repeatType:[ ['no', 'Not Repeat'], ['day', 'Daily'], ['week', 'Weekly'], ['month', 'Monthly'], ['year', 'Yearly'] ], colors: ['668CD9', 'D96666', '59BFB3', 'F2A442', '4CB052', 'B373B3'], colorIndex: ["blue", "red", "cyan", "orange", "green", "purple"], getColorByIndex:function(colorIndex){ var mask = Ext.ux.calendar.Mask; for(var i = 0, len = mask.colorIndex.length; i < len; i++){ if(colorIndex == mask.colorIndex[i]){ return mask.colors[i]; } } return null; }, getIndexByColor:function(color){ var mask = Ext.ux.calendar.Mask; for(var i = 0, len = mask.colors.length; i < len; i++){ if(color == mask.colors[i]){ return mask.colorIndex[i]; } } return null; }, getRepeatTypeStore:function() { var store = new Ext.data.SimpleStore({ fields:['value', 'display'], data:Ext.ux.calendar.Mask.repeatType }); return store; }, getEventStore:function(url){ var store = new Ext.data.GroupingStore({ proxy: new Ext.data.HttpProxy({ url: url }), reader:new Ext.data.JsonReader({ root: 'list', //'results', // TRAKKWARE id: 'id', totalProperty: 'count'//'total' // TRAKKWARE }, [ {name: "id"}, {name: "calendarId"}, {name: "startTime"}, {name: "endTime"}, {name: "subject"}, {name: "description"}, {name: "ymd"}, {name: "eymd"}, {name: "color"}, {name: "isShared"}, {name: "alertFlag"}, {name: "locked"}, {name: "repeatType"} ]), sortInfo:{field: 'ymd', direction: "DESC"}, groupField:'ymd' }); return store; }, getCalendarStore:function(){ var store = new Ext.data.SimpleStore({ fields:['id', 'title', 'description', 'color'], data:[] }); return store; }, getHourFormatStore:function(){ var lan = Ext.ux.calendar.Mask.Mask; var store = new Ext.data.SimpleStore({ fields:['id', 'text'], data:[ ['12', lan['12Hours']], ['24', lan['24Hours']] ] }); return store; }, getLanguageConfig:function(){ /* * you can change the data here, add/substract languages. But notice you need have the related file under multi-language folder first; * For example, ['en_US', 'American English'], this means there is a file named en_US.js under multi-language folder */ var lan = Ext.ux.calendar.Mask.Mask; var data = [ ['en_US', lan['en_US']], ['fr', lan['fr']], ['it', lan['it']], ['nl', lan['nl']], ['pl', lan['pl']], ['pt', lan['pt']], ['zh_CN', lan['zh_CN']] ]; var store = new Ext.data.SimpleStore({ fields:['name', 'display'], data:data }); return { data:data, store:store }; }, parseHM:function(hm){ var h, m; var parts = hm.split(':'); h = parts[0]; if('0' == h.charAt(0)){ h = h.charAt(1); } h = parseInt(h); m = parts[1]; if('0' == m.charAt(0)){ m = m.charAt(1); } m = parseInt(m); return { h:h, m:m }; }, calculateActiveRow:function(cs){ var obj = {}; var hm = this.parseHM(cs.activeStartTime); var st = hm.h*60+hm.m; hm = this.parseHM(cs.activeEndTime); var et = hm.h*60+hm.m; obj.intervalSlot = parseInt(cs.intervalSlot); obj.rowCount = 24*60/obj.intervalSlot; obj.activeStartRow = Math.floor(st/obj.intervalSlot); obj.activeEndRow = Math.floor(et/obj.intervalSlot); obj.numInHour = Math.floor(60/obj.intervalSlot); delete(cs['id']); delete(cs['class']); obj = Ext.apply(obj, cs); obj.startDay = parseInt(obj.startDay); obj.startRow = 0; obj.endRow = obj.rowCount; if(obj.hideInactiveRow){ obj.startRow = obj.activeStartRow; obj.endRow = obj.activeEndRow; } return obj; }, getTimeStore:function(){ var store = new Ext.data.SimpleStore({ fields:['row', 'hour'], data:[] }); return store; }, getHMFromRow:function(intervalSlot, row, hourFormat){ var m = intervalSlot*row; var h = Math.floor(m/60); m = m%60; if(10 > m){ m = '0'+m; } if(10 > h){ h = '0'+h; } var s = h+':'+m; if('12' == hourFormat){ var dt = Date.parseDate(h+':'+m, 'H:i'); s = dt.format('h:i A'); } return s; }, generateIntervalData:function(intervalSlot, start, end, hourFormat){ var num = Math.floor(24*60/intervalSlot); start = start || 0; end = end || num; var data = []; for(var i = start; i <= end; i++){ var o = []; o.push(i); var s = this.getHMFromRow(intervalSlot, i, hourFormat); o.push(s); data.push(o); } return data; }, getIntervalFromRow:function(intervalSlot, row, hourFormat){ var m = intervalSlot*row; var h = Math.floor(m/60); m = m%60; if(10 > m){ m = '0'+m; } if(10 > h){ h = '0'+h; } var s = h+':'+m; if('12' == hourFormat){ var dt = Date.parseDate(h+':'+m, 'H:i'); s = dt.format('h:i A'); } return s; }, getRowFromHM: function(hm, intervalSlot) { if('23:59' == hm){ hm = '24:00'; } hm = Ext.ux.calendar.Mask.parseHM(hm); var row = Math.round(hm.h*60/intervalSlot+hm.m/intervalSlot); return row; }, getEDStore:function(){ var lan = Ext.ux.calendar.Mask.Mask; var store = new Ext.data.SimpleStore({ fields:['value', 'display'], data:[ [true, lan['enable']], [false, lan['disable']] ] }); return store; }, getStartDayStore:function(){ var lan = Ext.ux.calendar.Mask.Mask; var store = new Ext.data.SimpleStore({ fields:['value', 'display'], data:[ [0, lan['sunday']], [1, lan['monday']] ] }); return store; }, getIntervalStore:function(){ var lan = Ext.ux.calendar.Mask.Mask; var store = new Ext.data.SimpleStore({ fields:['value', 'display'], data:[ [10, '10 '+lan['minute']], [15, '15 '+lan['minute']], [20, '20 '+lan['minute']], [30, '30 '+lan['minute']], [60, '60 '+lan['minute']] ] }); return store; }, getDayOffset:function(sday, eday){ if(!(sday instanceof Date)){ sday = Date.parseDate(sday, 'Y-m-d'); } if(!(eday instanceof Date)){ eday = Date.parseDate(eday, 'Y-m-d'); } var offset = sday.getElapsed(eday); offset = Math.round(offset/(3600000*24)); return offset; }, getWeekDayInMonth:function(date){ var n = date.format('N'); var d = date.format('d'); var w = Math.floor((d-n)/7)+1; var wd = date.format('l'); var str = 'the '+w; if(1 == w){ str += 'st'; }else if(2 == w){ str += 'nd'; }else if(3 == w){ str += 'rd'; }else{ str += 'th'; } return str+' '+wd; }, getIntervalText:function(rtype, intervalSlot){ var str = ''; if('day' == rtype){ if(1 == intervalSlot){ str = 'Everyday'; }else{ str = 'Every '+intervalSlot+' days'; } }else if('week' == rtype){ if(1 == intervalSlot){ str = 'Every week at '; }else{ str = 'Every '+intervalSlot+' weeks at '; } }else if('month' == rtype){ if(1 == intervalSlot){ str = 'Every month at '; }else{ str = 'Every '+intervalSlot+' months at '; } }else if('year' == rtype){ if(1 == intervalSlot){ str = 'Every year at '; }else{ str = 'Every '+intervalSlot+' years at '; } } return str; }, getPermitStore:function(){ var lan = Ext.ux.calendar.Mask.Mask; var store = new Ext.data.SimpleStore({ fields:['value', 'display'], data:lan['permitData'] }); return store; }, getUserStore:function(){ var store = new Ext.data.Store({ proxy:new Ext.data.HttpProxy({ url:Ext.ux.calendar.CONST.listUserURL }), reader:new Ext.data.JsonReader({ root: 'results', id: 'id', totalProperty: 'total' }, [ {name: "id"}, {name: "username"}, {name: "email"} ]) }); return store; } };/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.Language = { // please help to transfer words after :. Thanks 'CalendarWin':{ 'title':'FeyaSoft MyCalendar 2.0.0', 'loadMask.msg':'Please wait...' }, 'SharingPopup':{ 'title':'Sharing Calendar' }, 'MainPanel': { 'loadMask.msg': 'Loading...' }, 'CalendarContainer':{ 'todayBtn.text':'Today', 'dayBtn.text':'Day view', 'weekBtn.text':'Week view', 'monthBtn.text':'Month view', 'weekMenu.showAll.text':'Show All', 'weekMenu.onlyWeek.text':'Only Weekday', 'monthMenu.showAll.text':'Show All', 'monthMenu.onlyWeek.text':'Only Weekday', 'moreMenu.setting.text':'Setting', 'moreMenu.about.text':'About FeyaSoft MyCalendar', 'moreBtn.text':'More', 'searchCriteria.text':'Search', 'moreMenu.showAlert.text':'Activate Alert Function', 'moreMenu.language.text':'Language Setting' }, 'WestPanel':{ 'myCalendarPanel.title':'My Calendar', 'otherCalendarPanel.title':'Other Calendar', 'myShowAllBtn.text':'Show All', 'myAddBtn.text':'New' }, 'EventHandler':{ 'showOnlyItem.text':'Show this only', 'viewItem.hide.text':'Hide calendar', 'viewItem.show.text':'Show calendar', 'editItem.text':'Edit calendar', 'deleteItem.text':'Delete calendar', 'clearItem.text':'Empty calendar', 'wholeDay':'Whole day', 'untitled':'Untitled', 'unlockItem.text':'Unlock', 'lockItem.text':'Lock', 'editEvent.title':'Edit Event', 'deleteEvent.title':'Delete Event', 'more':'More', 'deleteRepeatPopup.title':'Confirm', 'deleteRepeatPopup.msg':'Click "Yes" to delete all this repeat events, or click "No" to only delete the current event?', 'updateRepeatPopup.title':'Confirm', 'updateRepeatPopup.msg':'Click "Yes" to update for all this repeat events, or click "No" to only update for the current event?', 'shareItem.text':'Share Calendar' }, 'Editor':{ 'startDayField.label':'Time', 'endDayField.label':'To', 'wholeField.label':'Whole day', 'subjectField.label':'Subject', 'contentField.label':'Content', 'calendarField.label':'Calendar', 'alertCB.label':'Alert when actived', 'lockCB.label':'Locked', 'deleteBtn.text':'Remove', 'saveBtn.text':'Save', 'cancelBtn.text':'Cancel', 'new.title':'New Event', 'edit.title':'Edit Event', 'repeatTypeField.label':'Repeat Type', 'repeatIntervalField.label':'Recur every ', 'intervalUnitLabel.day.text':' Day(s) ', 'intervalUnitLabel.week.text':' Week(s) ', 'intervalUnitLabel.month.text':' Month(s) ', 'intervalUnitLabel.year.text':' Year(s) ', 'detailSetting':'Modify Detail...', 'returnBtn.text':'Back', 'startAndEnd':'Start and End', 'repeatStartField.label':'Start', 'repeatNoEndRG.label':'No end date', 'repeatEndTimeRG.label':'End after', 'repeatEndDateRG.label':'End by', 'repeatEndTimeUnit':'occurrence(s)', 'weekCheckGroup.label':'Repeat Day', 'monthRadioGroup.label':'Repeat By', 'repeatByDate':'Date', 'repeatByDay':'Day' }, 'CalendarEditor':{ 'new.title':'New Calendar', 'edit.title':'Edit Calendar', 'nameField.label':'Name', 'descriptionField.label':'Description', 'clearBtn.text':'Clear', 'saveBtn.text':'Save', 'cancelBtn.text':'Cancel', 'returnBtn.text':'Back', 'shareCalendar':'Share Calendar With People', 'shareColumns.user':'User', 'shareColumns.permit':'Permit', 'shareColumns.add':'Add User to Share', 'shareColumns.remove':'Remove', 'userField.emptyText':'Please input username or email address' }, 'ExpirePopup':{ 'hideCB.label':'Don\'t popup any more', 'title':'Alerted Events', 'tpl.calendar':'Calendar', 'tpl.subject':'Subject', 'tpl.content':'Content', 'tpl.leftTime':'Left time', 'hour':'Hour(s)', 'minute':'Minute(s)', 'untitled':'Untitled', 'noContent':'No Content' }, 'SettingPopup':{ 'title':'feyaCalendar Setting', 'hourFormatField.label':'Hour Format', 'dayFormatField.label':'Day Format of DayView', 'weekFormatField.label':'Day Format of WeekView', 'monthFormatField.label':'Day Format of MonthView', 'applyBtn.text':'Apply', 'resetBtn.text':'Reset', 'closeBtn.text':'Close', 'fromtoFormatField.label':'FromTo Format', 'scrollStartRowField.label':'Scroll Start Row', 'languageField.label':'Language', 'generalForm.title':'General', 'dwViewForm.title':'DayView|WeekView', 'monthViewForm.title':'MonthView', 'createByDblClickField.label':'Create Event by Double click', 'singleDayField.label':'Cross Day Event', 'weekStartDayField.label': 'Start Week Day', 'activeStartTimeField.label':'Active Start Time', 'activeEndTimeField.label':'Active End Time', 'hideInactiveTimeField.label':'Hide Inactive Time', 'intervalField.label':'Interval Slot', 'startEndInvalid':'Active Start Time should be earlier than Active End Time!', 'formatInvalid':'Example: 09:00' }, 'ResultView':{ 'cm.date':'Date', 'cm.calendar':'Calendar', 'cm.time':'Time', 'cm.subject':'Subject', 'cm.content':'Content', 'cm.expire':'Left time', 'groupBtn.group.text':'Group', 'groupBtn.unGroup.text':'Ungroup', 'returnBtn.text':'Back', 'hour':'Hour(s)', 'noSubject':'(No Subject)', 'noContent':'(No Content)', 'loadMask.msg':'Please wait...' }, 'DayView':{ 'loadMask.msg':'Please wait...', 'addItem.text':'New Event', 'events':'events' }, 'MonthView':{ 'loadMask.msg':'Please wait...', 'overview':'Overview', 'showingEvents':'Showing Events', 'totalEvents':'Total Events', 'dayPre':'', 'addItem.text':'New Event', 'clearItem.text':'Clean Event', 'cutItem.text':'Cut', 'copyItem.text':'Copy', 'pasteItem.text':'Paste', 'events':'events' }, 'Mask':{ '12Hours':'12 Hours', '24Hours':'24 Hours', 'ar': 'Arabic', 'de': 'German', 'en_US':'American English', 'es': 'Spanish', 'fr': 'Français', 'it': 'Italiano', 'ja': 'Japanese', 'nl': 'Nederlandse', 'pl': 'Polski', 'pt': 'Portuguese', 'ru': 'Russian', 'zh_CN':'简体中文', 'enable':'Enable', 'disable':'Disable', 'minute':'Minutes', 'monday':'Monday', 'sunday':'Sunday', 'permitData':[ [0, 'Read, Write and Share'], [1, 'Read and Write'], [2, 'Read only'] ] }, repeatType:[ ['no', 'Not Repeat'], ['day', 'Daily'], ['week', 'Weekly'], ['month', 'Monthly'], ['year', 'Yearly'] ], getWeekDayInMonth:function(date){ var n = date.format('N'); var d = date.format('d'); var w = Math.floor((d-n)/7)+1; var wd = date.format('l'); var str = 'the '+w; if(1 == w){ str += 'st'; }else if(2 == w){ str += 'nd'; }else if(3 == w){ str += 'rd'; }else{ str += 'th'; } return str+' '+wd; }, getIntervalText:function(rtype, intervalSlot){ var str = ''; if('day' == rtype){ if(1 == intervalSlot){ str = 'Everyday'; }else{ str = 'Every '+intervalSlot+' days'; } }else if('week' == rtype){ if(1 == intervalSlot){ str = 'Every week at '; }else{ str = 'Every '+intervalSlot+' weeks at '; } }else if('month' == rtype){ if(1 == intervalSlot){ str = 'Every month at '; }else{ str = 'Every '+intervalSlot+' months at '; } }else if('year' == rtype){ if(1 == intervalSlot){ str = 'Every year at '; }else{ str = 'Every '+intervalSlot+' years at '; } } return str; } }; Ext.apply(Ext.ux.calendar.Mask, Ext.ux.calendar.Language);/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.LanManager = { addJavaScript:function(lan){ var flag = true; var exist = false; var id = 'x-calendar-language'; var lanel = document.getElementById(id); if(lanel){ if(lanel.name == lan){ flag = false; exist = true; }else{ Ext.get(lanel).remove(); } } if(!exist){ var js = document.createElement('script'); js.id = id; js.name = lan; js.setAttribute('type', 'text/javascript'); var url = Ext.ux.calendar.CONST.CALENDAR_LANGUAGE_PATH+lan+'.js'; js.setAttribute('src', url); document.getElementsByTagName("head")[0].appendChild(js); } exist = false; id = 'ext-language'; lanel = document.getElementById(id); if(lanel){ if(lanel.name == lan){ exist = true; }else{ Ext.get(lanel).remove(); } } if(!exist){ js = document.createElement('script'); js.id = id; js.setAttribute('type', 'text/javascript'); url = Ext.ux.calendar.CONST.EXT_LANGUAGE_PATH+'ext-lang-'+lan+'.js'; js.setAttribute('src', url); document.getElementsByTagName("head")[0].appendChild(js); } return flag; } };/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.RepeatType = { getEvent:function(re, day){ var rt = re.repeatType; var rtype = rt.rtype; var eps = rt.exceptions; if(rt.beginDay <= day && ('no' == rt.endDay || day <= rt.endDay) && (!eps || !eps[day])){ var e; if('day' == rtype){ e = Ext.ux.calendar.RepeatType.getRepeatDayEvent(day, re); }else if('week' == rtype){ e = Ext.ux.calendar.RepeatType.getRepeatWeekEvent(day, re); }else if('month' == rtype){ e = Ext.ux.calendar.RepeatType.getRepeatMonthEvent(day, re); }else if('year' == rtype){ e = Ext.ux.calendar.RepeatType.getRepeatYearEvent(day, re); } return e; } }, getRepeatDayEvent:function(day, re){ var rt = re.repeatType; var beginDay = rt.beginDay; var intervalSlot = rt.intervalSlot; var dspan = rt.dspan; var rtime = rt.rtime; var dnum = Ext.ux.calendar.Mask.getDayOffset(beginDay, day); var r = dnum%intervalSlot; var t = Math.floor(dnum/intervalSlot); if(0 == r && (!rtime || t < rtime)){ var e = Ext.apply({}, re); e.day = day; var date = Date.parseDate(day, 'Y-m-d'); e.eday = date.add(Date.DAY, dspan).format('Y-m-d'); delete(e.lflag); delete(e.rflag); return e; } }, getRepeatWeekEvent:function(day, re){ var rt = re.repeatType; var beginDay = rt.beginDay; var beginDate = Date.parseDate(beginDay, 'Y-m-d'); var bn = beginDate.format('N'); var date = Date.parseDate(day, 'Y-m-d'); var n = date.format('N'); var rday = rt.rday; if('{}' == Ext.encode(rday)){ rday[bn] = true; } if(rday[n]){ var intervalSlot = rt.intervalSlot; var dspan = rt.dspan; var rtime = rt.rtime; var dnum = Math.floor((Ext.ux.calendar.Mask.getDayOffset(beginDay, day)-n-bn)/7)+1; var r = dnum%intervalSlot; var t = Math.floor(dnum/intervalSlot); if(0 == r && (!rtime || t < rtime)){ var e = Ext.apply({}, re); e.day = day; var date = Date.parseDate(day, 'Y-m-d'); e.eday = date.add(Date.DAY, dspan).format('Y-m-d'); delete(e.lflag); delete(e.rflag); return e; } } }, getRepeatMonthEvent:function(day, re){ var rt = re.repeatType; var beginDay = rt.beginDay; var parts = beginDay.split('-', 3); var by = parseInt(parts[0]); var bm = parseInt(parts[1]); var bd = parseInt(parts[2]); parts = day.split('-', 3); var y = parseInt(parts[0]); var m = parseInt(parts[1]); var d = parseInt(parts[2]); var rby = rt.rby; var beginDate = Date.parseDate(beginDay, 'Y-m-d'); var bn = beginDate.format('N'); var bw = Math.floor((bd-bn)/7)+1; var date = Date.parseDate(day, 'Y-m-d'); var n = date.format('N'); var w = Math.floor((d-n)/7)+1; if(('date' == rby && bd == d) || ('day' == rby && w == bw && n == bn)){ var intervalSlot = rt.intervalSlot; var dspan = rt.dspan; var rtime = rt.rtime; var dnum = 12*y+m-12*by-bm; var r = dnum%intervalSlot; var t = Math.floor(dnum/intervalSlot); if(0 == r && (!rtime || t < rtime)){ var e = Ext.apply({}, re); e.day = day; var date = Date.parseDate(day, 'Y-m-d'); e.eday = date.add(Date.DAY, dspan).format('Y-m-d'); delete(e.lflag); delete(e.rflag); return e; } } }, getRepeatYearEvent:function(day, re){ var rt = re.repeatType; var beginDay = rt.beginDay; var parts = beginDay.split('-', 3); var by = parseInt(parts[0]); var bm = parts[1]; var bd = parts[2]; parts = day.split('-', 3); var y = parseInt(parts[0]); var m = parts[1]; var d = parts[2]; if(bm == m && bd == d){ var intervalSlot = rt.intervalSlot; var dspan = rt.dspan; var rtime = rt.rtime; var dnum = y-by; var r = dnum%intervalSlot; var t = Math.floor(dnum/intervalSlot); if(0 == r && (!rtime || t < rtime)){ var e = Ext.apply({}, re); e.day = day; var date = Date.parseDate(day, 'Y-m-d'); e.eday = date.add(Date.DAY, dspan).format('Y-m-d'); delete(e.lflag); delete(e.rflag); return e; } } } };/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.onReady(function() { Ext.ux.calendar.CONST = { /* *true to show the language submenu in myCalendar, or not */ SHOW_LANGUAGE_MENU: true, BLANK_IMAGE_URL: '../../../../extjs/resources/images/default/s.gif', /* *define the main path of myCalendar */ MAIN_PATH: '', /* *define the multi-language path of myCalendar */ CALENDAR_LANGUAGE_PATH: '/js/ext/calendar/', /* *define the multi-language path of EXT */ EXT_LANGUAGE_PATH: '../../../../extjs/src/locale/', /* * define the some url here for datasource */ searchURL: 'un used', showAllCalendarURL: Trakkware.Handlers.MethodHandlerUrl + '?action=showAllCalendar', showOnlyCalendarURL: 'php/db-proxy.php?action=showOnlyCalendar', createUpdateCalendarURL: 'php/db-proxy.php?action=createUpdateCalendar', deleteEventsByCalendarURL: 'php/db-proxy.php?action=deleteEventsByCalendar', deleteCalendarURL: 'php/db-proxy.php?action=deleteCalendar', loadCalendarURL: 'php/db-proxy.php?action=loadCalendar', loadEventURL: 'php/db-proxy.php?action=loadEvent', loadRepeatEventURL: 'php/db-proxy.php?action=loadRepeatEvent', createEventURL: 'php/db-proxy.php?action=createEvent', updateEventURL: 'php/db-proxy.php?action=updateEvent', deleteEventURL: 'php/db-proxy.php?action=deleteEvent', deleteRepeatEventURL: 'php/db-proxy.php?action=deleteRepeatEvent', changeDayURL: 'php/db-proxy.php?action=changeDay', deleteDayURL: 'php/db-proxy.php?action=deleteDay', loadSettingURL: 'php/db-proxy.php?action=loadSetting', updateSettingURL: 'php/db-proxy.php?action=updateSetting', createUpdateRepeatEventURL: 'php/db-proxy.php?action=createUpdateRepeatEvent', initialLoadURL: 'unused' }; });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns('Ext.util'); Ext.util.DatePicker = Ext.extend(Ext.DatePicker, { onRender : function(container, position){ Ext.util.DatePicker.superclass.onRender.call(this, container, position); }, updateRange : function(){ if(this.startDate && this.endDate){ var st = this.startDate.clearTime().getTime(); var et = this.endDate.clearTime().getTime(); this.cells.each(function(c){ var dt = c.dom.firstChild.dateValue; if(st <= dt && dt <= et){ c.addClass('x-date-selected'); }else{ c.removeClass('x-date-selected'); } }); } }, setRange : function(startDate, endDate){ this.startDate = startDate; this.endDate = endDate; }, update : function(date, forceRefresh){ Ext.util.DatePicker.superclass.update.call(this, date, forceRefresh); this.updateRange(); } }); /** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns('Ext.util'); Ext.util.LabelField = Ext.extend(Ext.form.Field, { onRender:function(ct, position){ Ext.util.LabelField.superclass.onRender.call(this, ct, position); this.wrap = this.el.wrap({cls: this.wrapClass}); if(Ext.isIE) this.wrap.setHeight(20); this.el.addClass('x-hidden'); this.labelEl = Ext.DomHelper.append(this.wrap, '
    ', true); this.labelEl.dom.innerHTML = this.text; }, setText:function(v){ if(this.labelEl){ this.labelEl.dom.innerHTML = v; }else{ this.text = v; } }, getText:function(){ return this.labelEl.dom.innerHTML; } }); Ext.ns('Ext.ux.calendar'); Ext.ux.calendar.CommentTip = Ext.extend(Ext.Tip, { closable:true, closeAction:'hide', showTip:function(title, text, bEl, pos, during){ this.setTitle(title); if(this.rendered){ this.body.update(text); }else{ this.html = text; } this.showBy(bEl, pos); during = during || 5000; (function(){ this.hide(); }).defer(during, this); } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.BasicView = Ext.extend(Ext.Panel, { daySet:[], checkLayout:Ext.emptyFn, renderEvent:Ext.emptyFn, resetSCover:Ext.emptyFn, resizePort:Ext.emptyFn });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.Block = function(config){ var obj = {}; obj.id = 0; obj.colNum = 0; obj.startRow = 100; obj.endRow = -1; obj.eventList = new Array(); obj.addEvent = function(event){ if(event.startRow < obj.startRow){ obj.startRow = event.startRow; } if(event.endRow > obj.endRow){ obj.endRow = event.endRow; } obj.eventList[obj.eventList.length] = event; } Ext.apply(obj, config); return obj; }/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.BlockMap = function(event, block){ var obj = {}; obj.event = event; obj.block = block; return obj; }/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.Line = function(config){ var obj = {}; obj.areaList = new Array(); obj.block = null; Ext.apply(obj, config); return obj; }/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.LayoutGrid = function(config){ Ext.apply(this, config); this.CALENDAR_ROW_NUM = this.ehandler.rowCount; this.blockId = 0; this.grid = new Array(); this.wholeList = []; this.heventList = []; this.hwholeList = []; this.visited = {}; this.crossVisited = {}; }; Ext.ux.calendar.LayoutGrid.prototype = { getAllEvents: function(){ var events = this.getEventList(); events = this.owner.getWholeList(this.cview, this.day, true, true).concat(events); return events; }, getEventList: function(){ var eventList = new Array(); var blockId = -1; for(var i = 0; i < this.CALENDAR_ROW_NUM; i++){ var line = this.grid[i]; if(-1 == blockId){ if(null != line.block){ blockId = line.block.id; eventList = eventList.concat(line.block.eventList); } }else if(null != line.block){ if(blockId != line.block.id){ blockId = line.block.id; eventList = eventList.concat(line.block.eventList); } } } return eventList; }, removeOutDeletedCalendar:function(eventList){ /* * remove out event of deleted calendar */ var eh = this.ehandler; var i, len, arr = []; for(i = 0, len = this.heventList.length; i < len; i++){ var event = this.heventList[i]; if(eh.calendarSet[event.calendarId]){ arr.push(event); } } this.heventList = arr; arr = []; for(i = 0, len = eventList.length; i < len; i++){ var event = eventList[i]; if(eh.calendarSet[event.calendarId]){ arr.push(event); } } return arr; }, refreshRepeatEvent:function(eventList){ /* * remove out repeat event from eventlist and heventlist */ var i, len, arr = []; for(i = 0, len = this.heventList.length; i < len; i++){ var event = this.heventList[i]; if('string' == Ext.type(event.repeatType)){ arr.push(event); } } this.heventList = arr; arr = []; for(i = 0, len = eventList.length; i < len; i++){ var event = eventList[i]; if('string' == Ext.type(event.repeatType)){ arr.push(event); } } var res = this.owner.getRepeatEvent(this.cview, this.day); arr = this.owner.combine2List(res, arr); return arr; }, filterEvent:function(eventList){ var eh = this.ehandler; var selist = []; var arr = []; var i, j, len; if(this.deleteCalendar){ this.deleteCalendar = false; eventList = this.removeOutDeletedCalendar(eventList); } if(this.hideCalendar){ this.hideCalendar = false; for(i = 0, len = this.heventList.length; i < len; i++){ var event = this.heventList[i]; if(!eh.calendarSet[event.calendarId].hide){ selist.push(event); }else{ arr.push(event); } } this.heventList = arr; arr = []; for(i = 0, len = eventList.length; i < len; i++){ var event = eventList[i]; if(!eh.calendarSet[event.calendarId].hide){ arr.push(event); }else{ this.heventList.push(event); } } eventList = this.owner.combine2List(arr, selist); eventList = this.refreshRepeatEvent(eventList); } if(this.updateRepeat){ this.updateRepeat = false; eventList = this.refreshRepeatEvent(eventList); } return eventList; }, reLayout: function(single, nowhole){ return this.generateLayout(this.getEventList(), true, single, nowhole); }, increaseLine: function(line, lstArea, lstIndex){ while(lstIndex > line.areaList.length){ line.areaList[line.areaList.length] = null; } line.areaList[line.areaList.length] = lstArea; }, addArea: function(line, area, colIndex){ if(line.areaList.length < colIndex + 1){ this.increaseLine(line, area, colIndex); }else{ line.areaList[colIndex] = area; } }, generateArea: function(event, block, colIndex){ for(var i = event.startRow; i < event.endRow; i++){ var line = this.grid[i]; line.block = block; this.addArea(line, event, colIndex); } }, getColIndex: function(line){ var colIndex, size; for(colIndex = 0, size = line.areaList.length; colIndex < size; colIndex++){ var event = line.areaList[colIndex]; if(null == event){ break; } } return colIndex; }, generateLayout: function(eventList, reload, single, nowhole){ var elist = [], wlist = []; if(!reload){ this.heventList = []; elist = eventList; }else{ elist = eventList; } if(!nowhole){ wlist = this.owner.getWholeList(this.cview, this.day, null, single); } elist = this.filterEvent(elist); if(!this.layouted){ this.visited = {}; if(this.cview){ this.visited[this.cview.id] = true; } this.layouted = true; //clear grid first for(var i = 0; i < this.CALENDAR_ROW_NUM; i++){ this.grid[i] = new Ext.ux.calendar.Line(); } this.blockId = 0; //Layouting events elist = this.Layouting(elist); }else{ this.visited[this.cview.id] = true; } this.inited = true; return { elist:elist, wlist:wlist }; }, Layouting: function(eventList){ var eh = this.ehandler; var b2eMap = new Array(); var block = null; for(var i = 0, size = eventList.length; i < size; i++){ var event = eventList[i]; var line = this.grid[event.startRow]; //get the free postion in line for the event var colIndex = this.getColIndex(line); //for check whether the value changed if(event.colIndex != colIndex){ event.colIndex = colIndex; event.changed = true; } //generate or update a block if(0 == line.areaList.length){ block = new Ext.ux.calendar.Block(); block.id = this.blockId++; }else if(null != block){ if(block.colNum < colIndex) block.colNum = colIndex; } line.block = block; //bind the event with a block b2eMap[b2eMap.length] = new Ext.ux.calendar.BlockMap(event, block); block.addEvent(event); //generate the areas covered by event this.generateArea(event, block, colIndex); } //calculate the span for every event for(var i = 0, size = b2eMap.length; i < size; i++){ var b2e = b2eMap[i]; var span = b2e.block.colNum + 1; if(span != b2e.event.span){ b2e.event.span = span; b2e.event.changed = true; } } var arr = []; for(var i = 0, len = eventList.length; i < len; i++){ var event = eventList[i]; if(!eh.calendarSet[event.calendarId].hide){ arr[arr.length] = event; } } eventList = arr; //for get max colIndex for every line var cols = {}; for(var i = 0, len = eventList.length; i < len; i++){ var event = eventList[i]; var startRow = event.startRow; var endRow = event.endRow; for(var j = startRow; j < endRow; j++){ if(!cols[j]){ cols[j] = event; }else if(cols[j].colIndex < event.colIndex){ cols[j] = event; } } } for(var i = 0, len = eventList.length; i < len; i++){ var event = eventList[i]; var startRow = event.startRow; var endRow = event.endRow; var last = true; for(var j = startRow; j < endRow; j++){ if(cols[j] && event.colIndex < cols[j].colIndex && cols[j].startRow >= event.startRow){ last = false; break; } } if(true === last){ if(true !== event.last){ event.last = true; event.changed = true; } }else{ if(true === event.last){ event.changed = true; } delete(event.last); } } return eventList; }, updateLayout: function(event, action, force){ this.visited = {}; this.visited[this.cview.id] = true; if((0 == event.startRow && this.CALENDAR_ROW_NUM == event.endRow) || (event.day != event.eday)){ var arr = [event]; this.owner.updateWholeList(arr, action); return this.owner.getWholeList(this.cview, this.day); }else{ var eventList = new Array(); var startRow = event.startRow; var endRow = event.endRow; var i, size, colIndex = -1; /* * get the start line and end line of changed event */ for(i = 0, size = this.grid.length; i < size; i++){ var line = this.grid[i]; if(colIndex == -1){ for(var j = 0, colNum = line.areaList.length; j < colNum; j++){ var area = line.areaList[j]; if(null == area) continue; if(area.eventId == event.eventId){ colIndex = j; if(startRow > i){ startRow = i; } if(endRow < i+1){ endRow = i+1; } } } }else{ if(line.areaList.length > colIndex){ if(null != line.areaList[colIndex]){ if(line.areaList[colIndex].eventId == event.eventId){ if(endRow < i+1){ endRow = i+1; } } }else{ break; } }else{ break; } } } /* * get all events inside the area */ var blockId = -1; for(i = startRow; i < endRow; i++){ var line = this.grid[i]; if(-1 == blockId){ if(null != line.block){ blockId = line.block.id; eventList = eventList.concat(line.block.eventList); } }else if(null != line.block){ if(blockId != line.block.id){ blockId = line.block.id; eventList = eventList.concat(line.block.eventList); } } } /* * update the event */ //remove old one if((action == 'update') || (action == 'delete')){ for(i = 0, size = eventList.length; i < size; i++){ var be = eventList[i]; if(event.eventId == be.eventId){ if('update' == action && true !== force && event.startRow == be.startRow && event.endRow == be.endRow){ Ext.apply(be, event); return { elist:[event] }; } eventList.splice(i, 1); break; } } } //add new one if((action == 'update') || (action == 'add')){ for(i = 0, size = eventList.length; i < size; i++){ var sId = eventList[i].startRow; var eId = eventList[i].endRow; if(sId > event.startRow){ eventList.splice(i, 0, event); break; }else if(sId == event.startRow && eId <= event.endRow){ eventList.splice(i, 0, event); break; } } if(i == size){ eventList[eventList.length] = event; } } /* * get the areas which's layout will change */ if(eventList[0]){ if(startRow > eventList[0].startRow){ startRow = eventList[0].startRow; } } if(null != this.grid[endRow-1].block){ if(endRow < this.grid[endRow-1].block.endRow){ endRow = this.grid[endRow-1].block.endRow; } } //reset changing areas and block for(i = startRow; i < endRow; i++){ if(this.grid[i].areaList.length > 0){ this.grid[i].areaList.length = 0; } this.grid[i].block = null; } //set changed falg to false for(i = 0, size = eventList.length; i < size; i++){ eventList[i].changed = false; } event.changed = true; //update layout for eventList = this.Layouting(eventList); //only return position or width changed event to js var backList = new Array(); for(i = 0, size = eventList.length; i < size; i++){ event = eventList[i]; if(event.changed == true){ backList.push(event); } } return { elist:backList }; } } };/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.CalendarLayout = function(config){ Ext.apply(this, config); this.layoutSet = {}; this.wholeList = []; this.repeatSet = {}; Ext.ux.calendar.CalendarLayout.superclass.constructor.call(this); }; Ext.extend(Ext.ux.calendar.CalendarLayout, Ext.util.Observable, { getWholeList: function(cview, day, all, single) { var eh = this.ehandler; var cs = eh.calendarSet; var wlist = []; var arr = []; var sday, eday; if (single) { sday = day; eday = day; } else { if (1 == cview.dayNum) { sday = day; eday = day; } else { var colNum = cview.colNum || cview.dayNum; var cd = Date.parseDate(day, 'Y-m-d'); var sd = eh.getStartDateInWeek(cd, cview); sday = sd.format('Y-m-d'); eday = sd.add(Date.DAY, colNum - 1).format('Y-m-d'); } } for (var i = 0, len = this.wholeList.length; i < len; i++) { var e = this.wholeList[i]; if (cs[e.calendarId]) { if (!cs[e.calendarId].hide || all) { if (e.day == day || (sday == day && e.day < day && e.eday >= day)) { if (e.day < sday) { e.lflag = true; } else { delete (e.lflag); } if (e.eday > eday) { e.rflag = true; } else { delete (e.rflag); } wlist.push(e); } } arr.push(e); } } this.wholeList = arr; wlist = this.combine2List(this.getRepeatEvent(cview, day, true, all, single), wlist); return wlist; }, updateWholeList: function(arr, action) { if (arr) { if ('add' == action) { this.wholeList = this.combine2List(this.wholeList, arr); } else if ('update' == action) { for (var i = 0, len = arr.length; i < len; i++) { this.deleteFromList(this.wholeList, arr[i]); } this.wholeList = this.combine2List(this.wholeList, arr); } else if ('delete' == action) { for (var i = 0, len = arr.length; i < len; i++) { this.deleteFromList(this.wholeList, arr[i]); } } } }, deleteFromList: function(arr, e) { for (var i = 0, len = arr.length; i < len; i++) { var w = arr[i]; if (w.eventId == e.eventId) { arr.splice(i, 1); break; } } }, deleteDayFromWholeList: function(day, eday, prevent) { var cs = this.ehandler.calendarSet; eday = eday || day; var i, j, len = this.wholeList.length, wlist = []; ; for (i = 0; i < len; i++) { var w = this.wholeList[i]; if (w.day > day) { return wlist; } else if (!cs[w.calendarId].hide && w.day >= day && w.eday <= eday) { break; } } for (j = i; j < len; j++) { var w = this.wholeList[j]; if (!cs[w.calendarId].hide && w.day >= day && w.eday <= eday) { wlist.push(Ext.apply({}, w)); } else { break; } } if (!prevent) { this.wholeList.splice(i, j - i); } return wlist; }, changeDayInWholeList: function(oday, tday, keep) { var cs = this.ehandler.calendarSet; var i, j, len = this.wholeList.length; for (i = 0; i < len; i++) { var w = this.wholeList[i]; if (w.day > oday) { i = len; break; } else if (!cs[w.calendarId].hide && w.day >= oday && w.eday <= oday) { break; } } var arr = []; for (j = i; j < len; j++) { var w = this.wholeList[j]; if (!cs[w.calendarId].hide && w.day >= oday && w.eday <= oday) { var o = Ext.apply({}, w); o.day = tday; o.eday = tday; arr.push(o); } else { break; } } if (!keep) { this.wholeList.splice(i, j - i); } this.wholeList = this.combine2List(this.wholeList, arr); }, getLayout: function(day, cview, eventList, newFlag, refresh) { if (day instanceof Date) { day = day.format('Y-m-d'); } var fn = function() { var eh = this.ehandler; var layout = new Ext.ux.calendar.LayoutGrid({ owner: this, ehandler: eh, cview: cview, day: day, hideCalendar: true }); layout.viewChanged = true; layout.generateLayout(eventList || []); this.layoutSet[day] = layout; }; if (refresh) { fn.call(this); } else { if (!this.layoutSet[day]) { if (true == newFlag) { fn.call(this); } else { return null; } } else { if (this.layoutSet[day].cview !== cview) { this.layoutSet[day].viewChanged = true; } else { this.layoutSet[day].viewChanged = false; } this.layoutSet[day].cview = cview; } } return this.layoutSet[day]; }, resetSingleLayout: function(layout, config, reLayout) { layout.hideCalendar = config.hideCalendar; layout.deleteCalendar = config.deleteCalendar; layout.updateRepeat = config.updateRepeat; delete (layout.layouted); var v = layout.visited; if (reLayout) { layout.reLayout(); } if (layout.hideCalendar) { for (var p in v) { v[p] = 'hideCalendar'; } layout.visited = v; } else if (layout.deleteCalendar) { for (var p in v) { v[p] = 'deleteCalendar'; } layout.visited = v; } else if (layout.updateRepeat) { for (var p in v) { v[p] = 'updateRepeat'; } layout.visited = v; } else { layout.visited = {}; } }, resetLayout: function(config, reLayout) { for (var p in this.layoutSet) { var layout = this.layoutSet[p]; this.resetSingleLayout(layout, config, reLayout); } }, checkRepeat: function(c, list, i) { for (var len = list.length; i < len; i++) { var e = list[i]; if (!(e.day == c.day && e.eday == c.eday && e.startRow == c.startRow && e.endRow == c.endRow)) { return false; } if (e.eventId == c.eventId) { return true; } } return false; }, combine2List: function(alist, blist) { var nlist = []; var alen = 0, blen = 0; if (alist) { alen = alist.length; } if (blist) { blen = blist.length } var i, j; for (i = 0, j = 0; i < alen && j < blen; ) { var a = alist[i]; var b = blist[j]; var ast = a.day + '-' + a.startRow, aet = a.eday + '-' + a.endRow; var bst = b.day + '-' + b.startRow, bet = b.eday + '-' + b.endRow; if (ast < bst || (ast == bst && aet > bet)) { nlist.push(a); i++; } else { if (!this.checkRepeat(b, alist, i)) { nlist.push(b); } j++; } } if (i == alen) { for (; j < blen; j++) { var b = blist[j]; nlist.push(b); } } if (j == blen) { for (; i < alen; i++) { var a = alist[i]; nlist.push(a); } } return nlist; }, updateRepeatEventList: function(cview, arr, action) { if ('add' == action || 'update' == action) { for (var i = 0, len = arr.length; i < len; i++) { var e = arr[i]; this.repeatSet[e.eventId] = e; } } else if ('delete' == action) { for (var i = 0, len = arr.length; i < len; i++) { var e = arr[i]; delete (this.repeatSet[e.eventId]); } } this.resetLayout({ hideCalendar: false, deleteCalendar: false, updateRepeat: true }, true); cview.checkLayout(); }, getRepeatEvent: function(cview, day, whole, all, single) { var eh = this.ehandler; var cd, sday, eday; if (whole) { cd = Date.parseDate(day, 'Y-m-d'); if (single) { sday = day; eday = day; } else { if (1 == cview.dayNum) { sday = day; eday = day; } else { var colNum = cview.colNum || cview.dayNum; var sd = eh.getStartDateInWeek(cd, cview); sday = sd.format('Y-m-d'); eday = sd.add(Date.DAY, colNum - 1).format('Y-m-d'); } } } var arr = [], newset = {}; var rset = this.repeatSet, cs = eh.calendarSet; for (var p in rset) { var re = rset[p]; var c = cs[re.calendarId]; if (c) { if (!c.hide || all) { var e; var rt = re.repeatType; var dspan = rt.dspan; if (!whole) { if (0 == dspan && (0 != re.startRow || eh.rowCount != re.endRow)) { /* * handle in-day event */ e = Ext.ux.calendar.RepeatType.getEvent(re, day); if (e) { arr = this.combine2List(arr, [e]); } } } else if (0 < dspan || (0 == re.startRow && eh.rowCount == re.endRow)) { /* * handle whole day event */ if (sday == day) { /* * handle the left-join event */ for (var i = 0; i <= dspan; i++) { var d = cd.add(Date.DAY, -i).format('Y-m-d'); e = Ext.ux.calendar.RepeatType.getEvent(re, d); if (e) { if (e.day < sday) { e.lflag = true; } else { delete (e.lflag); } if (e.eday > eday) { e.rflag = true; } else { delete (e.rflag); } arr = this.combine2List(arr, [e]); } } } else { e = Ext.ux.calendar.RepeatType.getEvent(re, day); if (e) { if (e.day < sday) { e.lflag = true; } else { delete (e.lflag); } if (e.eday > eday) { e.rflag = true; } else { delete (e.rflag); } arr = this.combine2List(arr, [e]); } } } } newset[re.eventId] = re; } } this.repeatSet = newset; return arr; }, showWeek: function(cview, tbody, week, eventSet, stop) { var eh = this.ehandler; cview.cleanup(week, true); var colNum = cview.colNum || cview.dayNum, dayNum = cview.shiftDay || cview.dayNum, daySet = cview.daySet; var table = [], mline = []; for (var j = 0; j < dayNum; j++) { mline.push(0); } var sdate = eh.getStartDateInWeek(cview.daySet[week * dayNum], cview); var sday = sdate.format('Y-m-d'); var si = cview.startColIndex, ei = cview.endColIndex; for (var j = 0; j < colNum; j++) { var index = week * dayNum + j + si; var day = daySet[index]; var dayStr = day.format('Y-m-d'); var eventList = eventSet[dayStr]; /* * if stop is true, then no need relayout */ if (!stop) { var layout = this.getLayout(dayStr, cview, eventList || [], true); var rs = layout.reLayout(); eventList = rs.wlist.concat(rs.elist); } for (var k = 0, len = eventList.length; k < len; k++) { var e = Ext.apply({}, eventList[k]); var dnum = Ext.ux.calendar.Mask.getDayOffset((sday < e.day) ? e.day : sday, e.eday); var epos = j + dnum; if (epos >= colNum) { epos = colNum - 1; } this.insert2Table(table, j, epos, e, mline, cview.lineNum); } } /* * need relayout for weekend too, or will have exception * */ for (var j = 0; j < si; j++) { var index = week * dayNum + j; var day = daySet[index]; var dayStr = day.format('Y-m-d'); var eventList = eventSet[dayStr]; if (!stop) { var layout = this.getLayout(dayStr, cview, eventList || [], true); var rs = layout.reLayout(); eventList = rs.wlist.concat(rs.elist); } } for (var j = ei; j < cview.dayNum; j++) { var index = week * dayNum + j; var day = daySet[index]; var dayStr = day.format('Y-m-d'); var eventList = eventSet[dayStr]; if (!stop) { var layout = this.getLayout(dayStr, cview, eventList || [], true); var rs = layout.reLayout(); eventList = rs.wlist.concat(rs.elist); } } this.checkMore(cview, mline, table); var tr = this.generateTR(cview, table, week); if (tr && 0 < tr.length) { if (tbody.insertAdjacentHTML && !Ext.isIE) { tr = tr.join(''); tbody.insertAdjacentHTML('beforeEnd', tr); } else { for (var k = 0, len = tr.length; k < len; k++) { Ext.DomHelper.append(tbody, tr[k]); } } this.bindEvent2Table(cview, table, tbody); } }, insert2Table: function(table, spos, epos, e, mline, limit) { var flag = false, tr; for (var i = 0, len = table.length; i < len; i++) { tr = table[i]; flag = true; for (var j = spos; j <= epos; j++) { if (tr[j]) { flag = false; break; } } if (flag) { break; } } if (!flag) { if (!limit || table.length < limit) { tr = {}; table.push(tr); flag = true; } else { for (var j = spos; j <= epos; j++) { mline[j]++; } } } if (flag) { var span = epos - spos + 1; for (var j = spos; j <= epos; j++) { tr[j] = { span: span, event: e }; } } return flag; }, checkMore: function(cview, mline, table) { if (0 < table.length) { var colNum = cview.colNum || cview.dayNum; var tr = table[table.length - 1]; for (var i = 0; i < colNum; ) { var td = tr[i]; if (td) { var span = td.span; var flag = false; for (var j = 0; j < span; j++) { if (0 < mline[i + j]) { flag = true; break; } } if (flag) { for (var j = 0; j < span; j++) { var index = i + j; var t = tr[index]; t.span = 1; t.event = (0 >= mline[index]) ? 1 : mline[index] + 1; } } i += span; } else { if (0 < mline[i]) { tr[i] = { span: 1, event: mline[i] }; } i++; } } } return table; }, generateTR: function(cview, rows, w) { var eh = this.ehandler; var lan = Ext.ux.calendar.Mask.EventHandler; var colNum = cview.colNum || cview.dayNum, dayNum = cview.shiftDay, daySet = cview.daySet; var si = cview.startColIndex; var tr = []; var rowNum = rows.length; for (var i = 0; i < rowNum; i++) { var row = rows[i]; var str = ''; for (var j = 0; j < colNum; ) { if (!row[j]) { str += ''; j++; } else { var span = row[j].span; var e = row[j].event; var html; if ('number' == Ext.type(e)) { var day = daySet[w * dayNum + j + si].format('Y-m-d'); html = '
    ' + '    ' + e + ' ' + lan['more'] + '...' + '
    '; } else { html = eh.generateLegend(cview, e); } str += '' + html + ''; j += span; } } str = '' + str + ''; tr.push(str); } if (0 < tr.length) { return tr; } }, bindEvent2Table: function(cview, rows, root) { var colNum = cview.colNum || cview.dayNum; var rowNum = rows.length; for (var i = 0; i < rowNum; i++) { var row = rows[i]; for (var j = 0; j < colNum; ) { if (!row[j]) { j++; } else { var span = row[j].span; var e = row[j].event; var els = Ext.DomQuery.select('div[name=x-event-' + e.day + '-' + e.eday + '-' + e.eventId + ']', root); for (var k = 0, len = els.length; k < len; k++) { var El = Ext.get(els[k]); El.bindEvent = e; El.cview = cview; } j += span; } } } } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. * * @class Ext.ux.calendar.DataSource * @extends Ext.util.Observable * This class represents the primary interface of Server request. * You may need use your own backend, so you need rewrite this file, here we only define the input/output, * once your backend can work with these input/output, it will be fine */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.DataSource = Ext.extend(Ext.util.Observable, { constructor: function(master_config) { //Ext.apply(this, master_config); Ext.ux.calendar.DataSource.superclass.constructor.call(this, master_config); var trakkware_config = Ext.apply({}, master_config); Ext.apply(this, { /* * For show all calendars * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ showAllCalendar: function(sucessFn, scope) { Ext.Ajax.request({ url: Ext.ux.calendar.CONST.showAllCalendarURL, params: { userId: this.mainPanel.userId }, success: function(response, options) { /* * The back json string should have a param "success", when it equal "false" means fail to create/update in server side */ var backObj = Ext.decode(response.responseText); if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { }, scope: scope || this }); }, /* * For hide all calendars but only show this one * @param {int} calendarId: the id of the calendar * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ showOnlyCalendar: function(calendarId, sucessFn, scope) { Ext.Ajax.request({ url: Ext.ux.calendar.CONST.showOnlyCalendarURL, params: { id: calendarId, userId: this.mainPanel.userId }, success: function(response, options) { /* * The back json string should have a param "success", when it equal "false" means fail to create/update in server side */ var backObj = Ext.decode(response.responseText); if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { }, scope: scope || this }); }, /* * For create/update a calendar * @param {Obj} calendar: the object of a calendar, should contain all field of calendar table in db * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ createUpdateCalendar: function(calendar, sucessFn, scope) { // We are not doing calendar update/creation from the calendar control. return; }, /* * For delete all events belong to a calendar * @param {int} calendarId: the id of a calendar * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ deleteEventsByCalendar: function(calendarId, sucessFn, scope) { // deleting events by calendar not supported. }, /* * For delete a calendar and all events belong to it * @param {int} calendarId: the id of a calendar * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ deleteCalendar: function(calendarId, sucessFn, scope) { // we are not deleting calendars from the calendar control }, /* * For load all calendars of a user * @param {int} userId: the id of a user * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ loadCalendar: function(successFn, scope) { Ext.Ajax.request({ url: Ext.ux.calendar.CONST.loadCalendarURL, params: { userId: this.mainPanel.userId }, success: function(response, options) { /* * The back json string should like below: * { * "total":2, * "results":[{ * "id":"1", * "color":"blue", * "description":null, * "hide":false, * "name":"Demo" * },{ * "id":"2", * "color":"red", * "description":null, * "hide":false, * "name":"df" * }] * } */ var backObj = Ext.decode(response.responseText); if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { successFn.call(scope, backObj); } }, failure: function(response, options) { }, scope: scope || this }); }, /* * For load all events from a day to another day * @param {Date} startData: the start date * @param {Date} endData: the end date * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ loadEvent: function(startDate, endDate, sucessFn, scope) { var that = this; startDate = startDate || new Date(); endDate = endDate || new Date(); var startDay = startDate.format('Y-m-d'); var endDay = endDate.format('Y-m-d'); var action_params = { UserID: '981957F2-3B04-4992-9BD6-69E3B8060F12', StartDate: startDate, EndDate: endDate } if (trakkware_config.Parameters && trakkware_config.Parameters.Internal && Ext.isDefined(trakkware_config.Parameters.Internal.TagFilterID)) action_params['TagFilterID'] = trakkware_config.Parameters.Internal.TagFilterID; if (trakkware_config.Parameters && trakkware_config.Parameters.Internal && Ext.isDefined(trakkware_config.Parameters.Internal.TagFilterGroupID)) action_params['TagFilterGroupID'] = trakkware_config.Parameters.Internal.TagFilterGroupID; var load_config = { view: trakkware_config.ViewName, command: 'LOADEVENTS', actionParams: action_params, JustResults: true }; Trakkware.ViewFramework.performMethodCall(null, load_config, function(config_used, backObj) { //alert('got back ' + Ext.encode(backObj) + ' events'); var rs = backObj.list; var eventSet = {}; eventSet['whole'] = []; var getRowFromHM = Ext.ux.calendar.Mask.getRowFromHM; for (var i = 0, len = rs.length; i < len; i++) { var data = rs[i]; var startRow = getRowFromHM(data.startTime, this.intervalSlot); var endRow = getRowFromHM(data.endTime, this.intervalSlot); if (!this.hideInactiveRow || (this.activeStartRow <= startRow && endRow <= this.activeEndRow) || (0 == startRow && this.rowCount == endRow)) { // Figure out which cal this event belongs on. var cal = data.calendarId; if (that.existing_calendars.indexOf(cal) < 0) { Ext.each(data.possible_cals, function(possible_cal) { if (that.existing_calendars.indexOf(possible_cal) > -1) { cal = possible_cal; return false; } }); } var day = data.ymd; var eday = data.eymd; eventSet[day] = eventSet[day] || []; var e = { eventId: data.id, calendarId: cal, color: data.color, startRow: startRow, endRow: endRow, subject: data.subject, content: data.description, day: day, eday: eday, alertFlag: data.alertFlag, locked: data.locked, repeatType: data.repeatType }; if (day != eday || (0 == startRow) && (this.rowCount == endRow)) { eventSet['whole'].push(e); } else { eventSet[day] = eventSet[day] || []; eventSet[day].push(e); } } } sucessFn.call(scope, eventSet); }); }, loadRepeatEvent: function(sucessFn, scope) { Ext.Ajax.request({ url: Ext.ux.calendar.CONST.loadRepeatEventURL, params: { userId: this.mainPanel.userId }, success: function(response, options) { var backObj = Ext.decode(response.responseText); if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { var rs = backObj['results']; var eventSet = {}; var getRowFromHM = Ext.ux.calendar.Mask.getRowFromHM; for (var i = 0, len = rs.length; i < len; i++) { var data = rs[i]; var startRow = getRowFromHM(data.startTime, this.intervalSlot); var endRow = getRowFromHM(data.endTime, this.intervalSlot); var e = { eventId: data.id, calendarId: data.calendarId, color: data.color, startRow: startRow, endRow: endRow, subject: data.subject, content: data.description, repeatType: Ext.decode(data.repeatType), alertFlag: data.alertFlag, locked: data.locked }; eventSet[e.eventId] = e; } sucessFn.call(scope, eventSet); } }, failure: function(response, options) { }, scope: scope || this }); }, /* * For create an event * @param {Obj} event: the object of event * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ createEvent: function(event, sucessFn, scope) { var day = event.day || new Date().format('Y-m-d'); var eday = event.eday || day; Ext.Ajax.request({ url: Ext.ux.calendar.CONST.createEventURL, /* * the params pass to server should contain: * calendarId: int, the id of the calendar this event belong to * selectedDay: string, 'Y-m-d' format, the day of this event * startHMTime: string, 'H:i' format, the start time of this event * endHMTime: string, 'H:i' format, the end time of this event * repeatType: boolean, not use yet, always false in this version * allDay: boolean, if true means this event is a whole event * flag: boolean, if true mean this event need alert a window when it's activing * locked: boolean, if true mean this event is locked, can not be changed * subject: string, the subject of this event * description: string, the description of this event */ params: { 'calendarId': event.calendarId, 'startDay': day, 'endDay': eday, 'startHMTime': Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, event.startRow), 'endHMTime': Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, event.endRow), 'repeatType': event.repeatType, 'alertFlag': event.alertFlag, 'locked': event.locked, 'subject': event.subject, 'description': event.content, 'userId': this.mainPanel.userId }, success: function(response, options) { var backObj = Ext.decode(response.responseText); /* * The back json string should contain a param "id", which is the id of the event just created, * it should also have a param "success", when it equal "false" means fail to create/update in server side, * for example: {"success":"true","info":"Your have successful created event","id":17} */ if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { } }); }, /* * For update an event * @param {Obj} event: the object of event * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ updateEvent: function(event, sucessFn, scope) { var day = event.day || new Date().format('Y-m-d'); var eday = event.eday || day; Ext.Ajax.request({ url: Ext.ux.calendar.CONST.updateEventURL, /* * the params pass to server should contain: * id: int, the id of the event * calendarId: int, the id of the calendar this event belong to * selectedDay: string, 'Y-m-d' format, the day of this event * startHMTime: string, 'H:i' format, the start time of this event * endHMTime: string, 'H:i' format, the end time of this event * repeatType: boolean, not use yet, always false in this version * allDay: boolean, if true means this event is a whole event * flag: boolean, if true mean this event need alert a window when it's activing * locked: boolean, if true mean this event is locked, can not be changed * subject: string, the subject of this event * description: string, the description of this event */ params: { 'id': event.eventId, 'calendarId': event.calendarId, 'startDay': day, 'endDay': eday, 'startHMTime': Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, event.startRow), 'endHMTime': Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, event.endRow), 'repeatType': event.repeatType, 'alertFlag': event.alertFlag, 'locked': event.locked, 'subject': event.subject, 'description': event.content }, success: function(response, options) { var backObj = Ext.decode(response.responseText); /* * The back json string should have a param "success", when it equal "false" means fail to create/update in server side */ if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { }, scope: scope || this }); }, /* * For delete an event * @param {Obj} event: the object of event * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ deleteEvent: function(event, sucessFn, scope) { Ext.Ajax.request({ url: Ext.ux.calendar.CONST.deleteEventURL, /* * pass the id of event to delete */ params: { 'id': event.eventId }, success: function(response, options) { var backObj = Ext.decode(response.responseText); /* * The back json string should have a param "success", when it equal "false" means fail to delete in server side */ if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { }, scope: scope || this }); }, deleteRepeatEvent: function(event, makeException, sucessFn, scope) { Ext.Ajax.request({ url: Ext.ux.calendar.CONST.deleteRepeatEventURL, /* * pass the id of event to delete */ params: { 'id': event.eventId, 'makeException': makeException, 'repeatType': Ext.encode(event.repeatType) }, success: function(response, options) { var backObj = Ext.decode(response.responseText); /* * The back json string should have a param "success", when it equal "false" means fail to delete in server side */ if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { }, scope: scope || this }); }, /* * For change all events in a day to another day * @param {string} oday: the old day, all events belong to this day need be changed * @param {string} nday: the new day, all events belong to old day will change to this day * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function * @param {boolean} keep: if true will keep the events for old day, if false then delete events for old day */ changeDay: function(oday, nday, sucessFn, scope, keep) { Ext.Ajax.request({ url: Ext.ux.calendar.CONST.changeDayURL, params: { 'dragDay': oday, 'dropDay': nday, 'keep': keep }, success: function(response, options) { var backObj = Ext.decode(response.responseText); /* * If keep is true, the back json string should contain a param "ids", which is an array keeps the id of the events just created for new day, * for example: {"success":"true","info":"You have success update those events","backids":[18,19]}; * if keep is false, the back json is like: {"success":"true","info":"You have success update those events","backids":[]}; * it should also have a param "success", when it equal "false" means fail to change in server side */ if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { }, scope: scope || this }); }, /* * For delete all events in a day * @param {string} day: all events belong to this day need be deleted * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ deleteDay: function(day, sucessFn, scope) { Ext.Ajax.request({ url: Ext.ux.calendar.CONST.deleteDayURL, /* * pass the day to server, it's a string, 'Y-m-d' format */ params: { 'day': day }, success: function(response, options) { var backObj = Ext.decode(response.responseText); /* * The back json string should have a param "success", when it equal "false" means fail to delete in server side */ if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { }, scope: scope || this }); }, /* * For load setting of feyaCalendar * @param {int} userId: the ID of current user * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ loadSetting: function(userId, sucessFn, scope) { Ext.Ajax.request({ url: Ext.ux.calendar.CONST.loadSettingURL, /* * pass the userId to server */ params: { 'userId': userId }, success: function(response, options) { var backObj = Ext.decode(response.responseText); /* * The back json string should have a param "success", when it equal "false" means fail to delete in server side */ if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { }, scope: scope || this }); }, /* * For save setting of feyaCalendar * @param {obj} obj: the obj of current setting * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ updateSetting: function(obj, sucessFn, scope) { var params = { 'userId': this.mainPanel.userId }; Ext.apply(params, obj); Ext.Ajax.request({ url: Ext.ux.calendar.CONST.updateSettingURL, /* * pass the userId to server */ params: params, success: function(response, options) { var backObj = Ext.decode(response.responseText); /* * The back json string should have a param "success", when it equal "false" means fail to delete in server side */ if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { }, scope: scope || this }); }, createUpdateRepeatEvent: function(event, oevent, sucessFn, scope) { var stime = Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, event.startRow); var etime = Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, event.endRow); var params = { 'calendarId': event.calendarId, 'startDay': event.day, 'endDay': event.eday, 'startHMTime': stime, 'endHMTime': etime, 'repeatType': ('string' == Ext.type(event.repeatType)) ? event.repeatType : Ext.encode(event.repeatType), 'alertFlag': event.alertFlag, 'locked': event.locked, 'subject': event.subject, 'description': event.content, 'userId': this.mainPanel.userId }; if ('prepare' != event.eventId) { params.id = event.eventId; } if (oevent) { if ('string' == Ext.type(oevent.repeatType)) { params.oldRepeatType = oevent.repeatType; } else { params.oldRepeatType = Ext.encode(oevent.repeatType); } } Ext.Ajax.request({ url: Ext.ux.calendar.CONST.createUpdateRepeatEventURL, /* * the params pass to server should contain: * calendarId: int, the id of the calendar this event belong to * selectedDay: string, 'Y-m-d' format, the day of this event * startHMTime: string, 'H:i' format, the start time of this event * endHMTime: string, 'H:i' format, the end time of this event * repeatType: boolean, not use yet, always false in this version * allDay: boolean, if true means this event is a whole event * flag: boolean, if true mean this event need alert a window when it's activing * locked: boolean, if true mean this event is locked, can not be changed * subject: string, the subject of this event * description: string, the description of this event */ params: params, success: function(response, options) { var backObj = Ext.decode(response.responseText); /* * The back json string should contain a param "id", which is the id of the event just created, * it should also have a param "success", when it equal "false" means fail to create/update in server side, * for example: {"success":"true","info":"Your have successful created event","id":17} */ if (backObj.success == 'false') { Ext.Msg.show({ title: 'Error', msg: backObj.errorInfo, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } else { sucessFn.call(scope, backObj); } }, failure: function(response, options) { } }); }, /* * For load setting and calendar from db * @param {int} userId: the ID of current user * @param {function} sucessFn: the callback function when request completed successfully * @param {obj} scope: the scope of sucessFn function */ initialLoad: function(ControlID, sucessFn, scope) { var that = this; var action_params = { UserID: '981957F2-3B04-4992-9BD6-69E3B8060F12' } if (trakkware_config.Parameters && trakkware_config.Parameters.Internal && Ext.isDefined(trakkware_config.Parameters.Internal.TagFilterID) && !Ext.isEmpty(trakkware_config.Parameters.Internal.TagFilterID)) action_params['TagFilterID'] = trakkware_config.Parameters.Internal.TagFilterID; if (trakkware_config.Parameters && trakkware_config.Parameters.Internal && Ext.isDefined(trakkware_config.Parameters.Internal.TagFilterGroupID) && !Ext.isEmpty(trakkware_config.Parameters.Internal.TagFilterGroupID)) action_params['TagFilterGroupID'] = trakkware_config.Parameters.Internal.TagFilterGroupID; var load_config = { view: trakkware_config.ViewName, command: 'INITIALLOAD', JustResults: true, actionParams: action_params, ControlID: ControlID }; Trakkware.ViewFramework.performMethodCall(null, load_config, function(orig_config, backObj) { // Due to everything going into an array coming back from the server, get first value as a valid backObj for the cal. backObj = backObj.list[0]; var cs = backObj.cs; //alert('back obj is ' + Ext.encode(backObj)); cs = Ext.ux.calendar.Mask.calculateActiveRow(cs); Ext.apply(this, cs); backObj.cs = cs; var re = []; var eventSet = {}; var getRowFromHM = Ext.ux.calendar.Mask.getRowFromHM; for (var i = 0, len = re.length; i < len; i++) { var data = re[i]; var startRow = getRowFromHM(data.startTime, this.intervalSlot); var endRow = getRowFromHM(data.endTime, this.intervalSlot); var e = { eventId: data.id, calendarId: data.calendarId, color: data.color, startRow: startRow, endRow: endRow, subject: data.subject, content: data.description, repeatType: Ext.decode(data.repeatType), alertFlag: data.alertFlag, locked: data.locked }; eventSet[e.eventId] = e; } backObj.re = eventSet; that.existing_calendars = []; Ext.each(backObj.owned, function(cal) { that.existing_calendars.push(cal.id); }); // TRAKKWARE: Add colors to the mask color index. // NOT working :( Ext.each(backObj.owned, function(calendar) { var color = calendar.color; if (color) { var color_no_hex = color.replace('#', ''); Ext.ux.calendar.Mask.colorIndex.push(color); Ext.ux.calendar.Mask.colors.push(color_no_hex); } }); sucessFn.call(scope, backObj); }); } }); } }); /** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.BackThread = function(config){ Ext.apply(this, config); this.runner = new Ext.util.TaskRunner(); this.timelineTask = { run:function(eh){ var mp = eh.mainPanel; var cview = mp.calendarContainer.getLayout().activeItem; if(cview instanceof Ext.ux.calendar.DayView){ cview.setToday(); cview.updateTimeline(); }else if(cview instanceof Ext.ux.calendar.MonthView){ cview.setToday(); } eh.checkExpireEvents(); }, args:[this.ehandler], interval:60000 }; this.expireTask = { run:function(eh){ var mp = eh.mainPanel; var cview = mp.calendarContainer.getLayout().activeItem; if(cview instanceof Ext.ux.calendar.ResultView){ cview.list.getView().refresh(); } }, args:[this.ehandler], interval:1800000 }; Ext.ux.calendar.BackThread.superclass.constructor.call(this); this.runner.start(this.timelineTask); }; Ext.extend(Ext.ux.calendar.BackThread, Ext.util.Observable, { destroy:function(){ this.runner.stopAll(); } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.ExpirePopup = function(config){ Ext.apply(this, config); var lan = Ext.ux.calendar.Mask.ExpirePopup; var p; if(Ext.isIE){ p = 96; }else{ p = 100; } this.tpl = new Ext.XTemplate( '' + '
    ' + '
    ' + '' + '' + '
    From: {startDate}
    To: {endDate}
    '+lan['tpl.calendar']+': {calendar}
    ' + lan['tpl.subject']+': {subject}
    ' + lan['tpl.content']+': {content}
    ' + lan['tpl.leftTime']+': {left}' + '
    ' + '
    ' ); this.tpl.compile(); this.viewpanel = new Ext.Panel({ region:'center', autoScroll:true, bodyStyle:'background:transparent;', border:false }); this.hideCB = new Ext.form.Checkbox({ boxLabel:lan['hideCB.label'] }); Ext.ux.calendar.ExpirePopup.superclass.constructor.call(this, { iconCls:'icon_feyaCalendar_clock', title:lan['title'], width:300, height:200, closable:true, plain:false, draggable:false, resizable:false, closeAction:'hide', layout:'border', animCollapse:false, tools:[{ id:'down', handler:this.onDownFn, scope:this }, { id:'up', hidden:true, handler:this.onUpFn, scope:this }], items:[ this.viewpanel, { border:false, region:'south', height:25, bodyStyle:'background:transparent;padding:5px;', items:[this.hideCB] } ] }); this.on('show', this.onShowFn, this); }; Ext.extend(Ext.ux.calendar.ExpirePopup, Ext.Window, { manager:{ register:Ext.emptyFn, unregister:Ext.emptyFn, bringToFront:Ext.emptyFn, sendToBack:Ext.emptyFn }, changeTool:function(id){ if('up' == id){ this.tools['down'].hide(); this.tools['up'].show(); }else{ this.tools['up'].hide(); this.tools['down'].show(); } }, onUpFn:function(event, tEl, p){ this.changeTool('down'); var ch = this.getSize().height; this.expand(); var eh = this.getSize().height; var pos = this.getPosition(true); this.setPosition(pos[0], pos[1]+ch-eh); }, onDownFn:function(event, tEl, p){ this.changeTool('up'); var eh = this.getSize().height; this.collapse(); var ch = this.getSize().height; var pos = this.getPosition(true); this.setPosition(pos[0], pos[1]+eh-ch); }, sortEvents:function(events){ var arr = []; for(var k = 0, count = events.length; k < count; k++){ var e = events[k]; var len = arr.length; for(var i = len-1; i >= 0; i--){ var a = arr[i]; if(a.endRow > e.endRow){ arr[i+1] = a; }else{ break; } } arr[i+1] = e; } return arr; }, isChanged:function(events){ if(this.activedEvents){ var len = events.length; if(len == this.activedEvents.length && 0 != len){ for(var i = 0; i < len; i++){ var e = events[i]; var a = this.activedEvents[i]; if(!(e.eventId == a.eventId && e.day == a.day && e.eday == a.eday && e.startRow == a.startRow && e.endRow == a.endRow)){ return true; } } }else{ return true; } }else{ return true; } return false; }, popup:function(events){ var eh = this.ehandler; var lan = Ext.ux.calendar.Mask.ExpirePopup; var now = new Date(); for(var i = 0, len = events.length; i < len; i++){ var event = events[i]; var time = Date.parseDate(event.endDate, 'Y-m-d H:i'); var left = Math.round(now.getElapsed(time)/60000); var hour = Math.floor(left/60); var minute = left%60; event['subject'] = event['subject'] || lan['untitled']; event['content'] = event['content'] || lan['noContent']; event['calendar'] = eh.calendarSet[event.calendarId].name; event['left'] = hour+' '+lan['hour']+' '+minute+' '+lan['minute']; } var sFlag = !this.hideCB.getValue() && this.isChanged(events); if(this.isVisible()){ this.activedEvents = events; if(this.collapsed){ this.onUpFn(); } this.onShowFn(); }else if(sFlag){ this.activedEvents = events; this.show(); this.expand(); this.changeTool('down'); var taskBar = Ext.get('ux-taskbar'); if(taskBar){ this.el.alignTo(taskBar, "br-tr", [ -1, -1]); }else{ this.el.alignTo(Ext.getBody(), "br-br", [ -10, -10]); } this.el.slideIn('b', { duration:.7 }); } }, onShowFn:function(p){ var len = this.activedEvents.length; if(0 < len){ this.setTitle(Ext.ux.calendar.Mask.ExpirePopup['title']+'('+len+')'); var html = this.tpl.apply(this.activedEvents); this.viewpanel.body.update(html); this.viewpanel.body.highlight('#c3daf9', {block:true}); }else{ this.hide(); } } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.SettingPopup = function(config){ Ext.apply(this, config); var lan = Ext.ux.calendar.Mask.SettingPopup; this.hourFormatField = new Ext.form.ComboBox({ fieldLabel:lan['hourFormatField.label'], store:Ext.ux.calendar.Mask.getHourFormatStore(), typeAhead:true, mode:'local', triggerAction:'all', valueField:'id', displayField:'text', selectOnFocus:true, editable:false, allowBlank:false, anchor:'95%' }); this.dayFormatField = new Ext.form.TextField({ fieldLabel:lan['dayFormatField.label'], allowBlank:false, anchor:'95%' }); this.weekFormatField = new Ext.form.TextField({ fieldLabel:lan['weekFormatField.label'], allowBlank:false, anchor:'95%' }); this.monthFormatField = new Ext.form.TextField({ fieldLabel:lan['monthFormatField.label'], allowBlank:false, anchor:'95%' }); this.fromtoFormatField = new Ext.form.TextField({ fieldLabel:lan['fromtoFormatField.label'], allowBlank:false, anchor:'95%' }); this.languageField = new Ext.form.ComboBox({ hideLabel:!Ext.ux.calendar.CONST.SHOW_LANGUAGE_MENU, hidden:!Ext.ux.calendar.CONST.SHOW_LANGUAGE_MENU, fieldLabel:lan['languageField.label'], editable:false, store: Ext.ux.calendar.Mask.getLanguageConfig().store, displayField:'display', valueField:'name' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, anchor:'95%' }); this.createByDblClickField = new Ext.form.ComboBox({ fieldLabel:lan['createByDblClickField.label'], editable:false, store: Ext.ux.calendar.Mask.getEDStore(), displayField:'display', valueField:'value' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, anchor:'95%' }); this.singleDayField = new Ext.form.ComboBox({ fieldLabel:lan['singleDayField.label'], editable:false, store: Ext.ux.calendar.Mask.getEDStore(), displayField:'display', valueField:'value' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, anchor:'95%' }); this.activeStartTimeField = new Ext.form.TextField({ fieldLabel:lan['activeStartTimeField.label'], allowBlank:false, anchor:'95%', validator:this.timeValidator, sender:this }); this.activeEndTimeField = new Ext.form.TextField({ fieldLabel:lan['activeEndTimeField.label'], allowBlank:false, anchor:'95%', validator:this.timeValidator, sender:this }); this.hideInactiveTimeField = new Ext.form.ComboBox({ fieldLabel:lan['hideInactiveTimeField.label'], editable:false, store: Ext.ux.calendar.Mask.getEDStore(), displayField:'display', valueField:'value' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, anchor:'95%' }); this.readOnlyField = new Ext.form.ComboBox({ fieldLabel:lan['readOnlyField.label'], editable:false, store: Ext.ux.calendar.Mask.getEDStore(), displayField:'display', valueField:'value' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, anchor:'95%' }); this.intervalField = new Ext.form.ComboBox({ fieldLabel:lan['intervalField.label'], editable:false, store: Ext.ux.calendar.Mask.getIntervalStore(), displayField:'display', valueField:'value' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, anchor:'95%' }); this.startDayField = new Ext.form.ComboBox({ fieldLabel:lan['weekStartDayField.label'], editable:false, store: Ext.ux.calendar.Mask.getStartDayStore(), displayField:'display', valueField:'value' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, anchor:'95%' }); // was formpanel this.generalForm = new Ext.Panel({ layout: 'form', title:lan['generalForm.title'], frame:true, border:false, style:'padding:10px;', bodyStyle:'background:transparent;', labelWidth:180, items:[ this.hourFormatField, this.fromtoFormatField, this.startDayField, this.readOnlyField, this.languageField ] }); // was formpanel this.dwViewForm = new Ext.Panel({ layout: 'form', title:lan['dwViewForm.title'], frame:true, border:false, style:'padding:10px;', bodyStyle:'background:transparent;', labelWidth:180, items:[ this.dayFormatField, this.weekFormatField, this.createByDblClickField, this.singleDayField, this.activeStartTimeField, this.activeEndTimeField, this.hideInactiveTimeField, this.intervalField ] }); //was formpanel this.monthViewForm = new Ext.Panel({ layout: 'form', title:lan['monthViewForm.title'], frame:true, border:false, style:'padding:10px;', bodyStyle:'background:transparent;', labelWidth:180, items:[ this.monthFormatField ] }); this.tabs = new Ext.TabPanel({ border:false, activeTab:0, deferredRender:true, resizeTabs:true, tabWidth:1000, minTabWidth:0, layoutOnTabChange:true, hideMode:'offsets', items:[ this.generalForm, this.dwViewForm, this.monthViewForm ] }); this.applyBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_accept', text:lan['applyBtn.text'], handler:this.onApplyFn, scope:this }); this.resetBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_cancel', text:lan['resetBtn.text'], handler:this.onResetFn, scope:this }); this.closeBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_door_out', text:lan['closeBtn.text'], handler:this.onCloseFn, scope:this }); Ext.ux.calendar.SettingPopup.superclass.constructor.call(this, { iconCls:'icon_feyaCalendar_setting', title:lan['title'], width:500, height:360, closable:true, resizable:false, closeAction:'hide', modal:true, layout:'fit', items:[this.tabs], buttons:[this.resetBtn, this.applyBtn, this.closeBtn] }); }; Ext.extend(Ext.ux.calendar.SettingPopup, Ext.Window, { timeValidator: function(v) { var lan = Ext.ux.calendar.Mask.SettingPopup; var pattern = new RegExp(/[0-2]\d:[0-5]\d/); v = v.toString(); if (5 == v.length && pattern.test(v)) { var sender = this.sender; if (sender.activeStartTimeField && sender.activeEndTimeField) { if (sender.activeStartTimeField.getValue() >= sender.activeEndTimeField.getValue()) { return lan['startEndInvalid']; } } return true; } else { return lan['formatInvalid']; } }, popup: function(data) { this.hourFormatField.setValue(data.hourFormat); this.dayFormatField.setValue(data.dayFormat); this.weekFormatField.setValue(data.weekFormat); this.monthFormatField.setValue(data.monthFormat); this.fromtoFormatField.setValue(data.fromtoFormat); this.languageField.setValue(data.language); this.createByDblClickField.setValue(data.createByDblclick); this.singleDayField.setValue(!data.singleDay); this.activeStartTimeField.setValue(data.activeStartTime); this.activeEndTimeField.setValue(data.activeEndTime); this.hideInactiveTimeField.setValue(data.hideInactiveRow); this.intervalField.setValue(data.intervalSlot); this.startDayField.setValue(data.startDay); this.readOnlyField.setValue(data.readOnly); this.show(); }, onApplyFn: function() { var flag = true; if (!this.generalForm.getForm().isValid()) { flag = false; this.tabs.setActiveTab(this.generalForm); } else if (!this.dwViewForm.getForm().isValid()) { flag = false; this.tabs.setActiveTab(this.dwViewForm); } else if (!this.monthViewForm.getForm().isValid()) { flag = false; this.tabs.setActiveTab(this.monthViewForm); } if (flag) { var cc = this.calendarContainer; var wp = cc.ownerCt.westPanel; var eh = cc.ehandler; var hourFormat = this.hourFormatField.getValue(); var dayFormat = this.dayFormatField.getValue(); var weekFormat = this.weekFormatField.getValue(); var monthFormat = this.monthFormatField.getValue(); var fromtoFormat = this.fromtoFormatField.getValue(); var language = this.languageField.getValue(); var createByDblclick = this.createByDblClickField.getValue(); var singleDay = !this.singleDayField.getValue(); var activeStartTime = this.activeStartTimeField.getValue(); var activeEndTime = this.activeEndTimeField.getValue(); var hideInactiveRow = this.hideInactiveTimeField.getValue(); var intervalSlot = this.intervalField.getValue(); var startDay = this.startDayField.getValue(); var readOnly = this.readOnlyField.getValue(); var params = { hourFormat: hourFormat, dayFormat: dayFormat, weekFormat: weekFormat, monthFormat: monthFormat, fromtoFormat: fromtoFormat, language: language, createByDblclick: createByDblclick, singleDay: singleDay, activeStartTime: activeStartTime, activeEndTime: activeEndTime, hideInactiveRow: hideInactiveRow, readOnly: readOnly, intervalSlot: intervalSlot, startDay: startDay }; eh.ds.updateSetting(params, function(backObj) { if (eh.language != language || eh.createByDblclick != createByDblclick || eh.singleDay != singleDay || eh.activeStartTime != activeStartTime || eh.activeEndTime != activeEndTime || eh.hideInactiveRow != hideInactiveRow || eh.intervalSlot != intervalSlot || eh.startDay != startDay || eh.readOnly != readOnly) { window.location = window.location.href; return; } var cs = eh.calendarSetting; Ext.apply(cs, params); eh.applyCalendarSetting(eh); var de = cc.detailEditor; de.reloadStartTimeStore(); var sv = de.startTimeField.getValue(); de.startTimeField.setValue(sv); de.reloadEndTimeStore(sv); de.endTimeField.setValue(de.endTimeField.getValue()); var cv = cc.currentView; eh.checkExpireEvents(); eh.applyCalendarSetting(wp); wp.changeDateLabel(cv.daySet[0], cv.daySet[cv.daySet.length - 1]); var dv = cc.dayView; dv.dayFormat = dayFormat; eh.applyCalendarSetting(dv); dv.refreshLefter(); dv.refreshDate(); var wv = cc.weekView; wv.dayFormat = weekFormat; eh.applyCalendarSetting(wv); wv.refreshLefter(); wv.refreshDate(); var wov = cc.weekOnlyView; wov.dayFormat = weekFormat; eh.applyCalendarSetting(wov); wov.refreshLefter(); wov.refreshDate(); var mv = cc.monthView; mv.dayFormat = monthFormat; eh.applyCalendarSetting(mv); mv.refreshDate(); cv.checkLayout(true); }, this); this.onCloseFn(); } }, onCloseFn: function() { this.hide(); }, onResetFn: function() { this.generalForm.getForm().reset(); this.dwViewForm.getForm().reset(); this.monthViewForm.getForm().reset(); } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns('Ext.ux.calendar'); Ext.ux.calendar.Editor = function(config){ Ext.apply(this, config); this.ehandler.applyCalendarSetting(this); var lan = Ext.ux.calendar.Mask.Editor; this.timeField = new Ext.util.LabelField({ fieldLabel:lan['startDayField.label'], anchor:'99%' }); this.subjectField = new Ext.form.TextField({ fieldLabel:lan['subjectField.label'], anchor:'99%' }); this.contentField = new Ext.form.TextField({ fieldLabel:lan['contentField.label'], anchor:'99%' }); var tpl = '' + '
    ' + this.ehandler.cTplStr + '
    ' + '
    '; this.calendarField = new Ext.form.ComboBox({ fieldLabel:lan['calendarField.label'], store:Ext.ux.calendar.Mask.getCalendarStore(), displayField:'title', valueField:'id' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, anchor:'99%', editable:false, tpl:tpl, initList:function(){ Ext.form.ComboBox.prototype.initList.call(this); this.list.setZIndex(999999); } }); this.alertCB = new Ext.form.Checkbox({ anchor:'99%', boxLabel:lan['alertCB.label'] }); this.deleteBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_delete', text:lan['deleteBtn.text'], disabled:true, handler:this.onRemoveFn, scope:this }); this.saveBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_accept', text:lan['saveBtn.text'], handler:this.onSaveFn, scope:this }); this.detailBtn = new Ext.Button({ text:lan['detailSetting'], handler:this.onDetailFn, scope:this }); this.cancelBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_cancel', minWidth:80, text:lan['cancelBtn.text'], handler:this.onCancelFn, scope:this }); // was formpanel this.formpanel = new Ext.Panel({ border:false, style:'padding:10px;', labelWidth:75, frame:true, items:[ this.timeField, this.subjectField, this.contentField, { border:false, layout:'column', items:[{ columnWidth:.7, border:false, layout:'form', items:[this.calendarField] }, { columnWidth:.3, border:false, items:[this.alertCB] }] } ], buttonAlign:'center', buttons:[this.detailBtn, this.deleteBtn, this.saveBtn, this.cancelBtn] }); Ext.ux.calendar.Editor.superclass.constructor.call(this, { style:'left:-1000px;top:-1000px;', title:' ', width:460, height:180, baseCls:'x-tip', closable:true, closeAction:'onCancelFn', resizable:false, frame:true, floating:{shadow:true,shim:true,useDisplay:true,constrain:false}, items:[this.formpanel] }); this.addEvents( 'showdetailsetting', 'hided', 'hideeditor', 'showed' ); this.on('render', this.onRenderFn, this); this.on('showed', this.onShowFn, this); this.on('hided', this.onHideFn, this); this.on('hideeditor', this.onHideEditorFn, this); this.calendarField.on('select', this.onCalendarSelectFn, this); }; Ext.extend(Ext.ux.calendar.Editor, Ext.Panel, { initComponent:function(){ Ext.ux.calendar.Editor.superclass.initComponent.call(this); if(this.closable && !this.title){ this.elements += ',header'; } }, afterRender:function(){ Ext.ux.calendar.Editor.superclass.afterRender.call(this); if(this.closable){ this.addTool({ id:'close', handler:this[this.closeAction], scope:this }); } }, onRenderFn:function(p){ p.getEl().on('mousedown', function(e){ this.mdFlag = true; }, this); p.getEl().on('mouseup', function(e){ delete(this.mdFlag); e.stopPropagation(); }, this); }, onDetailFn:function(){ this.hideEditor(); this.fireEvent('showdetailsetting', this.obj); }, onCalendarSelectFn:function(combo, rd, index){ var coverEl = this.bindEl; if(coverEl && !coverEl.hold){ var event = coverEl.bindEvent; var cview = coverEl.cview; var eh = cview.ehandler; var color = eh.calendarSet[rd.data.id].color; var arr = Ext.DomQuery.select('div[name=x-event-'+event.day+'-'+event.eday+'-'+event.eventId+']', cview.body.dom); for(var i = 0, len = arr.length; i < len; i++){ coverEl = Ext.get(arr[i]); if(0 == event.startRow && this.rowCount == event.endRow){ if(this.oldColor != color){ eh.changeWholeColor(coverEl, this.oldColor, color); } }else{ if(this.oldColor != color){ if(cview instanceof Ext.ux.calendar.DayView){ eh.changeEventColor(coverEl, this.oldColor, color); }else{ eh.changeLegendColor(coverEl, this.oldColor, color); } } } } } this.oldColor = color; }, onRemoveFn:function(){ var lan = Ext.ux.calendar.Mask.EventHandler; var coverEl = this.bindEl; var be = coverEl.bindEvent; var cview = coverEl.cview; var eh = cview.ehandler; var col = coverEl.col; if(coverEl){ if('string' == Ext.type(be.repeatType)){ eh.freeEventEl(coverEl); eh.deleteEvent(be, cview, col); }else{ Ext.Msg.show({ title:lan['deleteRepeatPopup.title'], msg:lan['deleteRepeatPopup.msg'], buttons: Ext.Msg.YESNOCANCEL, fn: function(bid, text){ if('yes' == bid){ eh.freeEventEl(coverEl); eh.deleteRepeatEvent(be, cview); }else if('no' == bid){ eh.freeEventEl(coverEl); eh.deleteRepeatEvent(be, cview, true); } }, icon: Ext.MessageBox.QUESTION }); } } cview.fireEvent('canceldetail'); this.hideEditor(); }, onSaveFn:function(){ if(this.formpanel.form.isValid()){ var eh = this.ehandler; var cview = this.cview; if(this.bindEl){ var coverEl = this.bindEl; var event = coverEl.bindEvent; var oevent = Ext.apply({}, event); if('add' == this.action && !coverEl.hold){ coverEl.remove(); } event.repeatType = event.repeatType || 'no'; event.allDay = false; event.alertFlag = this.alertCB.checked; if(!event.locked){ event.locked = false; } event.subject = this.subjectField.getValue(); event.content = this.contentField.getValue(); event.calendarId = this.calendarField.getValue(); event.color = eh.calendarSet[event.calendarId].color; if('add' == this.action){ if('string' == Ext.type(event.repeatType)){ eh.createEvent(event, cview); }else{ eh.createRepeatEvent(event, cview); } }else if('update' == this.action){ if('string' == Ext.type(oevent.repeatType) && 'string' == Ext.type(event.repeatType)){ eh.updateEvent(event, cview, null, oevent, this.noLayout); }else{ if('string' == Ext.type(event.repeatType)){ /* * need ask user to choose apply all or just current one */ var lan = Ext.ux.calendar.Mask.EventHandler; Ext.Msg.show({ title:lan['updateRepeatPopup.title'], msg:lan['updateRepeatPopup.msg'], buttons: Ext.Msg.YESNOCANCEL, fn: function(bid, text){ if('yes' == bid){ eh.updateRepeatEvent(event, cview, oevent); }else if('no' == bid){ event.repeatType = 'exception'; eh.updateRepeatEvent(event, cview, oevent); } }, icon: Ext.MessageBox.QUESTION }); }else{ eh.updateRepeatEvent(event, cview, oevent); } } } } cview.fireEvent('canceldetail'); this.hideEditor(); } }, onCancelFn:function(){ var coverEl = this.bindEl; if(coverEl){ var cview = this.cview; var event = coverEl.bindEvent; var eh = this.ehandler; if(!coverEl.hold){ if('add' == this.action){ coverEl.remove(); }else{ var color = eh.calendarSet[event.calendarId].color; if(0 == event.startRow && this.rowCount == event.endRow){ if(this.oldColor != color){ eh.changeWholeColor(coverEl, this.oldColor, color); } }else{ if(this.oldColor != color){ if(cview instanceof Ext.ux.calendar.DayView){ eh.changeEventColor(coverEl, this.oldColor, color); }else{ eh.changeLegendColor(coverEl, this.oldColor, color); } } } } } this.hideEditor(); } }, popup:function(obj){ var eh = this.ehandler; eh.floating = true; this.obj = obj; this.noLayout = obj.noLayout; this.bindEl = obj.bindEl; this.cview = obj.cview; this.action = obj.action; var lan = Ext.ux.calendar.Mask.Editor; if('add' == this.action){ this.deleteBtn.disable(); this.setIconClass('x-event-editor-title-add'); this.setTitle(lan['new.title']); }else{ this.deleteBtn.enable(); this.setTitle(lan['edit.title']); this.setIconClass('x-event-editor-title-edit'); } this.showAt(this.adjustXY(this.bindEl)); }, adjustXY:function(pn){ var pxy = pn.getXY(); var cview = pn.cview; var xy = [0, 0]; var w = this.width, h = this.height; var r = pxy[0]+w; xy[0] = pxy[0]; var right = cview.body.getRight(); if(r > right){ xy[0] = right-w; } xy[1] = pxy[1]-h; var top = cview.body.getTop(); if(xy[1] < top){ if(pxy[1] > top){ xy[1] = pxy[1]+20; }else{ xy[1] = top+20; } } return xy; }, reloadCalendar:function(eh){ var store = this.calendarField.store; store.removeAll(); for(var p in eh.calendarSet){ var calendar = eh.calendarSet[p]; if(true !== calendar.hide){ var rd = new (store.recordType)({ id:calendar.id, title:calendar.name, description:calendar.description, color:calendar.color }); store.add(rd); } } }, onShowFn:function(){ var eh = this.ehandler; if(this.bindEl){ var coverEl = this.bindEl; if(!coverEl.hold){ eh.setEditingStatus(coverEl, true); } var bindEvent = coverEl.bindEvent; var time = ''+eh.generateInfo(bindEvent)+''; this.timeField.setText(time); this.subjectField.setValue(bindEvent.subject); this.contentField.setValue(bindEvent.content); if(bindEvent.alertFlag){ this.alertCB.setValue(true); }else{ this.alertCB.setValue(false); } this.reloadCalendar(eh); this.calendarField.setValue(bindEvent.calendarId); this.oldColor = eh.calendarSet[bindEvent.calendarId].color; }else{ } }, onHideFn:function(){ var eh = this.ehandler; eh.floating = false; var cview = this.cview; if(this.bindEl){ //cview.resizePort(); cview.resetSCover(); } delete(this.bindEl); delete(this.cview); delete(this.noLayout); delete(this.action) }, hideEditor:function(){ if(!this.hided){ this.hided = true; this.showAt([-1000, -1000], true); this.fireEvent('hided'); } }, showAt:function(xy, hold){ if(!hold){ this.fireEvent('showed'); delete(this.hided); } this.setPagePosition(xy[0], xy[1]); }, onHideEditorFn:function(){ if(!this.mdFlag){ this.onCancelFn(); } } }); /** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns('Ext.ux.calendar'); Ext.ux.calendar.DetailEditor = function(config){ Ext.apply(this, config); this.ehandler.applyCalendarSetting(this); var lan = Ext.ux.calendar.Mask.Editor; this.startDayField = new Ext.form.DateField({ fieldLabel:lan['startDayField.label'], value:new Date(), format:'Y-m-d', allowBlank: false, anchor:'95%', editable:false, disabled:this.singleDay }); this.startDayField.on('select', this.onStartEndDayCheckFn, this); this.startTimeField = new Ext.form.ComboBox({ hideLabel:true, labelSeparator:'', store:Ext.ux.calendar.Mask.getTimeStore(), displayField:'hour', valueField:'row' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, editable:false, anchor:'95%' }); this.startTimeField.on('select', this.onStartTimeSelectFn, this); this.endDayField = new Ext.form.DateField({ fieldLabel:lan['endDayField.label'], labelSeparator:'', format:'Y-m-d', value:new Date(), allowBlank: false, anchor:'95%', editable:false, disabled:this.singleDay }); this.endDayField.on('select', this.onStartEndDayCheckFn, this); this.endTimeField = new Ext.form.ComboBox({ hideLabel:true, labelSeparator:'', store: Ext.ux.calendar.Mask.getTimeStore(), displayField:'hour', valueField:'row' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, editable:false, anchor:'95%' }); this.wholeField = new Ext.form.Checkbox({ hideLabel:true, labelSeparator:'', boxLabel:lan['wholeField.label'] }); this.wholeField.on('check', this.onWholeCheck, this); this.repeatTypeField = new Ext.form.ComboBox({ fieldLabel:lan['repeatTypeField.label'], store: Ext.ux.calendar.Mask.getRepeatTypeStore(), displayField:'display', valueField:'value' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, editable:false, anchor:'99%' }); this.subjectField = new Ext.form.TextField({ fieldLabel:lan['subjectField.label'], anchor:'99%' }); this.contentField = new Ext.form.TextArea({ fieldLabel:lan['contentField.label'], height:70, anchor:'99%' }); var tpl = '' + '
    ' + this.ehandler.cTplStr + '
    ' + '
    '; this.calendarField = new Ext.form.ComboBox({ fieldLabel:lan['calendarField.label'], store:Ext.ux.calendar.Mask.getCalendarStore(), displayField:'title', valueField:'id' , typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, allowBlank: false, anchor:'99%', editable:false, tpl:tpl }); this.alertCB = new Ext.form.Checkbox({ labelSeparator:'', anchor:'99%', boxLabel:lan['alertCB.label'] }); this.lockCB = new Ext.form.Checkbox({ labelSeparator:'', anchor:'99%', boxLabel:lan['lockCB.label'] }); this.returnBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_door_out', text:lan['returnBtn.text'], handler:this.onReturnFn, scope:this }); this.saveBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_accept', minWidth:80, text:lan['saveBtn.text'], handler:this.onSaveFn, scope:this }); this.cancelBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_cancel', minWidth:80, text:lan['cancelBtn.text'], handler:this.onCancelFn, scope:this }); this.timepanel = new Ext.Panel({ border:false, layout:'column', items:[{ columnWidth:.32, border:false, layout:'form', items:[this.startDayField] }, { columnWidth:.15, border:false, layout:'form', items:[this.startTimeField] }, { columnWidth:.22, border:false, layout:'form', labelWidth:15, items:[this.endDayField] }, { columnWidth:.15, border:false, layout:'form', items:[this.endTimeField] }, { columnWidth:.15, border:false, style:'padding-top:5px;', items:[this.wholeField] }] }); this.repeatIntervalField = new Ext.form.NumberField({ fieldLabel:lan['repeatIntervalField.label'], labelSeparator:'', value:1, allowBlank: false, anchor:'99%' }); this.repeatIntervalField.on('valid', this.onRepeatIntervalValidFn, this); this.intervalUnitLabel = new Ext.util.LabelField({ hideLabel:true, labelSeparator:'' }); this.repeatStartField = new Ext.form.DateField({ fieldLabel:lan['repeatStartField.label'], format:'Y-m-d', allowBlank: false, anchor:'90%' }); this.repeatStartField.on('select', this.onRepeatStartSelectFn, this); this.repeatNoEndRG = new Ext.form.Radio({ boxLabel:lan['repeatNoEndRG.label'], name:'repeat-end-type' }); this.repeatEndTimeRG = new Ext.form.Radio({ boxLabel:lan['repeatEndTimeRG.label'], name:'repeat-end-type' }); this.repeatEndTimeField = new Ext.form.NumberField({ width:50, value:10, allowBlank:false, disabled:true }); this.repeatEndDateRG = new Ext.form.Radio({ boxLabel:lan['repeatEndDateRG.label'], name:'repeat-end-type' }); this.repeatEndDateField = new Ext.form.DateField({ hideLabel:true, labelSeparator:'', format:'Y-m-d', allowBlank: false, anchor:'99%', disabled:true, value:(new Date()).add(Date.DAY, 365) }); var checkListener = { 'check':{ fn:this.refreshRepeatInfo, scope:this } }; var items = []; var nd = new Date(); var n = nd.format('N'); var mon = nd.add(Date.DAY, 1-n); for(var i = 0; i < 7; i++){ items.push({ boxLabel:mon.add(Date.DAY, i).format('D'), listeners:checkListener }); } this.weekCheckGroup = new Ext.form.CheckboxGroup({ fieldLabel:lan['weekCheckGroup.label'], items:items, anchor:'100%' }); this.monthRadioGroup = new Ext.form.RadioGroup({ fieldLabel:lan['monthRadioGroup.label'], items:[{ boxLabel:lan['repeatByDate'], name:'repeat-month-group', checked:true }, { boxLabel:lan['repeatByDay'], name:'repeat-month-group', listeners:checkListener }], anchor:'60%' }); // was formpanel this.generalForm = new Ext.Panel({ layout: 'form', border:false, style:'padding:10px;', frame:true, autoHeight:true, labelWidth:80, items:[ this.timepanel, this.subjectField, this.contentField, this.calendarField, this.alertCB, this.lockCB ] }); this.repeatInfoPanel = new Ext.Panel({ border:false, html:'
    ' }); var cws; if(Ext.isIE){ if('3.0.3' == Ext.version){ cws = [0.4, 0.2, 0.38, 0.4, 0.6]; }else{ cws = [0.2, 0.1, 0.3, 0.2, 0.3]; } }else{ cws = [0.4, 0.2, 0.38, 0.4, 0.6]; } // was formpanel this.repeatForm = new Ext.Panel({ layout: 'form', border:false, style:'padding:10px;', frame:true, autoHeight:true, labelWidth:80, items:[ this.repeatTypeField, { border:false, style:'padding-left:85px;', layout:'column', items:[{ border:false, columnWidth:.25, layout:'form', items:[this.repeatIntervalField] }, { border:false, columnWidth:.2, items:[this.intervalUnitLabel] }] }, this.repeatInfoPanel, { border:false, style:'padding-left:85px;', layout:'form', items:[this.weekCheckGroup] }, { border:false, style:'padding-left:85px;', layout:'form', items:[this.monthRadioGroup] }, { border:false, style:'padding-left:85px;', layout:'column', items:[{ border:false, columnWidth:.5, layout:'form', labelWidth:75, items:[this.repeatStartField] }, { border:false, columnWidth:.5, items:[ this.repeatNoEndRG, { border:false, layout:'column', items:[{ border:false, columnWidth:cws[0], items:[this.repeatEndTimeRG] }, { border:false, columnWidth:cws[1], items:[this.repeatEndTimeField] }, { border:false, columnWidth:cws[2], layout:'form', labelWidth:95, items:[{ xtype:'textfield', fieldLabel:lan['repeatEndTimeUnit'], labelSeparator:'', hidden:true }] }] }, { border:false, layout:'column', items:[{ border:false, columnWidth:cws[3], items:[this.repeatEndDateRG] }, { border:false, columnWidth:cws[4], layout:'form', items:[this.repeatEndDateField] }] } ] }] } ] }); Ext.ux.calendar.DetailEditor.superclass.constructor.call(this, { border:false, autoScroll:true, items:[{ border:false, width:650, layout:'form', items:[ this.generalForm, this.repeatForm ] }], buttonAlign:'center', buttons:[this.returnBtn, this.saveBtn, this.cancelBtn] }); this.addEvents( 'showdetailsetting' ); this.repeatTypeField.on('select', this.onRepeatTypeSelectFn, this); this.calendarField.on('select', this.onCalendarSelectFn, this); this.repeatNoEndRG.on('check', this.onRepeatNoEndCheckFn, this); this.repeatEndTimeRG.on('check', this.onRepeatEndTimeCheckFn, this); this.repeatEndDateRG.on('check', this.onRepeatEndDateCheckFn, this); }; Ext.extend(Ext.ux.calendar.DetailEditor, Ext.ux.calendar.BasicView, { onRepeatIntervalValidFn:function(){ this.refreshRepeatInfo(); }, onRepeatStartSelectFn:function(df){ this.refreshRepeatInfo(); }, refreshRepeatInfo:function(){ var beginDate = this.repeatStartField.getValue(); var intervalSlot = this.repeatIntervalField.getValue(); var getIntervalText = Ext.ux.calendar.Mask.getIntervalText; var lan = Ext.ux.calendar.Mask.Editor; var v = this.repeatTypeField.getValue(); var str = ''; if('day' == v){ this.updateRepeatInfo(getIntervalText(v, intervalSlot)); }else if('week' == v){ var monday = beginDate.add(Date.DAY, 1-beginDate.format('N')); var cbs = this.weekCheckGroup.items; var num = 0; for(var i = 0, len = cbs.getCount(); i < len; i++){ var cb = cbs.get(i); if(cb.checked){ num++; str += monday.add(Date.DAY, i).format('l')+' '; } } if(7 == num){ str = lan['repeatDayInfo']; }else if(0 == num){ str = beginDate.format('l') } this.updateRepeatInfo(getIntervalText(v, intervalSlot)+str); }else if('month' == v){ var rds = this.monthRadioGroup.items; if(rds.get(1).checked){ str = Ext.ux.calendar.Mask.getWeekDayInMonth(beginDate); }else{ str = beginDate.format('d'); } this.updateRepeatInfo(getIntervalText(v, intervalSlot)+str); }else if('year' == v){ this.updateRepeatInfo(getIntervalText(v, intervalSlot)+beginDate.format('m-d')); } }, updateRepeatInfo:function(html){ var div = this.repeatInfoPanel.body.dom.firstChild.firstChild; div.innerHTML = html; }, onRepeatTypeSelectFn:function(combo, rd, index){ var v = combo.getValue(); this.resetRepeatSetting(v, this.bindEl.bindEvent); }, resetRepeatSetting:function(v, event){ var rt = event.repeatType || 'no'; var lan = Ext.ux.calendar.Mask.Editor; var items = this.repeatForm.items; if('no' == v || 'exception' == v){ items.get(1).hide(); items.get(2).hide(); items.get(3).hide(); items.get(4).hide(); items.get(5).hide(); }else{ items.get(1).show(); items.get(2).show(); if('day' == v || 'year' == v){ if('day' == v){ this.intervalUnitLabel.setText(lan['intervalUnitLabel.day.text']); }else{ this.intervalUnitLabel.setText(lan['intervalUnitLabel.year.text']); } items.get(3).hide(); items.get(4).hide(); }else if('week' == v){ this.intervalUnitLabel.setText(lan['intervalUnitLabel.week.text']); items.get(3).show(); this.weekCheckGroup.reset(); var cbs = this.weekCheckGroup.items; cbs.each(function(it){ it.checked = false; }); if('string' != Ext.type(rt)){ var rday = rt.rday; for(var p in rday){ cbs.get(p-1).setValue(true); } } items.get(4).hide(); }else if('month' == v){ this.intervalUnitLabel.setText(lan['intervalUnitLabel.month.text']); items.get(3).hide(); items.get(4).show(); this.monthRadioGroup.reset(); var rds = this.monthRadioGroup.items; rds.each(function(it){ it.checked = false; }); if('string' != Ext.type(rt)){ var rby = rt.rby; if('day' == rby){ rds.get(1).setValue(true); }else{ rds.get(0).setValue(true); } } } items.get(5).show(); this.repeatForm.doLayout(); this.repeatNoEndRG.checked = false; this.repeatEndTimeRG.checked = false; this.repeatEndDateRG.checked = false; if('string' != Ext.type(rt)){ this.repeatIntervalField.setValue(rt.intervalSlot); this.repeatStartField.setValue(rt.beginDay); if('no' == rt.endDay){ if(false != Ext.type(rt.rtime)){ this.repeatEndTimeRG.setValue(true); }else{ this.repeatNoEndRG.setValue(true); } }else{ this.repeatEndDateRG.setValue(true); this.repeatEndDateField.setValue(rt.endDay); } }else{ if('day' == v){ this.repeatIntervalField.setValue(Ext.ux.calendar.Mask.getDayOffset(event.day, event.eday)+1); }else{ this.repeatIntervalField.setValue(1); } this.repeatStartField.setValue(event.day); this.repeatNoEndRG.setValue(true); } this.refreshRepeatInfo(); } }, onRepeatNoEndCheckFn:function(cb, checked){ if(checked){ this.repeatEndTimeField.disable(); this.repeatEndDateField.disable(); } }, onRepeatEndTimeCheckFn:function(cb, checked){ if(checked){ this.repeatEndTimeField.enable(); this.repeatEndDateField.disable(); } }, onRepeatEndDateCheckFn:function(cb, checked){ if(checked){ this.repeatEndTimeField.disable(); this.repeatEndDateField.enable(); } }, onReturnFn:function(){ var calendarContainer = this.ownerCt; var cview = this.bview; calendarContainer.getLayout().setActiveItem(cview); cview.checkLayout(true); }, onStartEndDayCheckFn:function(df){ var sdate = this.startDayField.getValue(); var sday = sdate.format('Y-m-d'); var edate = this.endDayField.getValue(); var eday = edate.format('Y-m-d'); if(sday >= eday){ if(df == this.startDayField){ this.endDayField.setValue(sdate); }else if(df == this.endDayField){ this.startDayField.setValue(edate); } var sv = this.startTimeField.getValue(); var ev = this.endTimeField.getValue(); this.reloadEndTimeStore(sv); if(sv > ev){ ev = sv+this.numInHour; if(ev >= this.activeEndRow){ ev = this.activeEndRow-1; } this.endTimeField.setValue(ev); } } }, reloadStartTimeStore:function(all){ var store = this.startTimeField.store; store.removeAll(); var data; if(all){ data = Ext.ux.calendar.Mask.generateIntervalData(this.intervalSlot, 0, this.rowCount-1, this.ehandler.hourFormat); }else{ data = Ext.ux.calendar.Mask.generateIntervalData(this.intervalSlot, this.activeStartRow, this.activeEndRow-1, this.ehandler.hourFormat); } store.loadData(data); }, reloadEndTimeStore:function(sIndex, all){ var store = this.endTimeField.store; store.removeAll(); var data; if(all){ data = Ext.ux.calendar.Mask.generateIntervalData(this.intervalSlot, 0, this.rowCount, this.ehandler.hourFormat); }else{ if(false == Ext.type(sIndex)){ sIndex = this.activeStartRow; }else{ sIndex++; } data = Ext.ux.calendar.Mask.generateIntervalData(this.intervalSlot, sIndex, this.activeEndRow, this.ehandler.hourFormat); } store.loadData(data); }, onStartTimeSelectFn:function(combo, rd, index){ var v = combo.getValue(); var eIndex; var sday = this.startDayField.getValue().format('Y-m-d'); var eday = this.endDayField.getValue().format('Y-m-d'); if(this.bindEl){ var event = this.bindEl.bindEvent; if(sday != eday){ this.reloadEndTimeStore(); }else{ var span = event.endRow-event.startRow; eIndex = v+span; this.reloadEndTimeStore(v); } } if(false != Ext.type(eIndex)){ if(this.activeEndRow >= eIndex){ this.endTimeField.setValue(eIndex); }else{ this.endTimeField.setValue(this.activeEndRow); } } }, onCalendarSelectFn:function(combo, rd, index){ var coverEl = this.bindEl; if(coverEl && !coverEl.hold){ var event = coverEl.bindEvent; var cview = coverEl.cview; var eh = cview.ehandler; var color = eh.calendarSet[rd.data.id].color; var arr = Ext.DomQuery.select('div[name=x-event-'+event.day+'-'+event.eday+'-'+event.eventId+']', cview.body.dom); for(var i = 0, len = arr.length; i < len; i++){ coverEl = Ext.get(arr[i]); if(coverEl instanceof Ext.Element){ if(0 == event.startRow && this.rowCount == event.endRow){ if(this.oldColor != color){ eh.changeWholeColor(coverEl, this.oldColor, color); } }else{ if(this.oldColor != color){ if(cview instanceof Ext.ux.calendar.DayView){ eh.changeEventColor(coverEl, this.oldColor, color); }else{ eh.changeLegendColor(coverEl, this.oldColor, color); } } } } } } this.oldColor = color; }, onWholeCheck:function(){ var sday = this.startDayField.getValue().format('Y-m-d'); var eday = this.endDayField.getValue().format('Y-m-d'); if(this.bindEl){ var event = this.bindEl.bindEvent; if(this.wholeField.checked){ var getHMFromRow = Ext.ux.calendar.Mask.getHMFromRow; this.reloadStartTimeStore(true); this.reloadEndTimeStore(null, true); this.startTimeField.setRawValue(getHMFromRow(this.intervalSlot, 0, this.hourFormat)); this.endTimeField.setRawValue(getHMFromRow(this.intervalSlot, this.rowCount, this.hourFormat)); this.startTimeField.disable(); this.endTimeField.disable(); }else{ var startRow, endRow; startRow = (this.activeStartRow <= event.startRow)?event.startRow:this.activeStartRow; endRow = (this.activeEndRow >= event.endRow)?event.endRow:this.activeEndRow-1; this.reloadStartTimeStore(); this.startTimeField.setValue(startRow); if(sday == eday && this.rowCount != event.endRow){ this.reloadEndTimeStore(startRow); }else{ this.reloadEndTimeStore(); } this.endTimeField.setValue(endRow); this.startTimeField.enable(); this.endTimeField.enable(); } this.startDayField.setValue(event.day); this.endDayField.setValue(event.eday); } }, onSaveFn:function(){ if(this.generalForm.form.isValid()){ if(this.bindEl){ var coverEl = this.bindEl; var event = coverEl.bindEvent; var oevent = Ext.apply({}, event); var cview = coverEl.cview; var eh = cview.ehandler; if('add' == this.action && !coverEl.hold){ coverEl.remove(); } // check whether this is all day if(this.wholeField.checked){ event.allDay = true; event.startRow = 0; event.endRow = this.rowCount; }else{ event.startRow = parseInt(this.startTimeField.getValue()); event.endRow = parseInt(this.endTimeField.getValue()); } event.day = this.startDayField.getValue().format('Y-m-d'); var edate = this.endDayField.getValue(); if(0 == event.endRow){ edate = edate.add(Date.DAY, -1); event.endRow = this.rowCount; } event.eday = edate.format('Y-m-d'); event.subject = this.subjectField.getValue(); event.content = this.contentField.getValue(); event.calendarId = this.calendarField.getValue(); event.color = eh.calendarSet[event.calendarId].color; event.alertFlag = this.alertCB.checked; event.locked = this.lockCB.checked; // continue in repeat type event = this.handleRepeatType(event); if('add' == this.action){ if('string' == Ext.type(event.repeatType)){ eh.createEvent(event, cview); }else{ eh.createRepeatEvent(event, cview); } }else if('update' == this.action){ if('string' == Ext.type(oevent.repeatType) && 'string' == Ext.type(event.repeatType)){ event.repeatType = oevent.repeatType; eh.updateEvent(event, cview, null, oevent, this.noLayout); }else{ if('string' == Ext.type(event.repeatType)){ /* * need ask user to choose apply all or just current one */ var lan = Ext.ux.calendar.Mask.EventHandler; Ext.Msg.show({ title:lan['updateRepeatPopup.title'], msg:lan['updateRepeatPopup.msg'], buttons: Ext.Msg.YESNOCANCEL, fn: function(bid, text){ if('yes' == bid){ eh.updateRepeatEvent(event, cview, oevent); }else if('no' == bid){ event.repeatType = 'exception'; eh.updateRepeatEvent(event, cview, oevent); } }, icon: Ext.MessageBox.QUESTION }); }else{ eh.updateRepeatEvent(event, cview, oevent); } } } } cview.fireEvent('canceldetail'); this.onReturnFn(); } }, handleRepeatType:function(e){ var event = Ext.apply({}, e); var nrt = this.repeatTypeField.getValue(); if('no' == nrt){ event.repeatType = 'no'; }else{ var o = { rtype:nrt, intervalSlot:this.repeatIntervalField.getValue(), dspan:Ext.ux.calendar.Mask.getDayOffset(e.day, e.eday), beginDay:this.repeatStartField.getValue().format('Y-m-d') }; if(this.repeatNoEndRG.checked){ o.endDay = 'no'; }else if(this.repeatEndTimeRG.checked){ o.endDay = 'no'; o.rtime = this.repeatEndTimeField.getValue(); }else if(this.repeatEndDateRG.checked){ o.endDay = this.repeatEndDateField.getValue().format('Y-m-d'); } if('week' == nrt){ var obj = {}; var items = this.weekCheckGroup.items; var flag = false; for(var i = 0, len = items.getCount(); i < len; i++){ var it = items.get(i); if(it.checked){ flag = true; obj[i+1] = true; } } if(!flag){ var n = Date.parseDate(event.day, 'Y-m-d').format('N'); obj[n] = true; } o.rday = obj; }else if('month' == nrt){ var items = this.monthRadioGroup.items; if(true == items.get(0).checked){ o.rby = 'date'; }else{ o.rby = 'day'; } } event.repeatType = o; } return event; }, onCancelFn:function(){ var coverEl = this.bindEl; var coverEl = this.bindEl; if(coverEl){ var cview = coverEl.cview; var event = coverEl.bindEvent; var eh = cview.ehandler; if(!coverEl.hold){ if('add' == this.action){ this.bindEl.remove(); }else{ var color = eh.calendarSet[event.calendarId].color; if(0 == event.startRow && this.rowCount == event.endRow){ if(this.oldColor != color){ eh.changeWholeColor(coverEl, this.oldColor, color); } }else{ if(this.oldColor != color){ if(cview instanceof Ext.ux.calendar.DayView){ eh.changeEventColor(coverEl, this.oldColor, color); }else{ eh.changeLegendColor(coverEl, this.oldColor, color); } } } } } this.onReturnFn(); } }, setup:function(obj){ this.noLayout = obj.noLayout; this.bindEl = obj.bindEl; this.action = obj.action; this.bview = obj.cview; if(this.bindEl){ var coverEl = this.bindEl; var cview = coverEl.cview; var eh = cview.ehandler; if(coverEl instanceof Ext.Element){ eh.setEditingStatus(coverEl, true); } var bindEvent = coverEl.bindEvent; // check whether it is whole day if(bindEvent.endRow == this.rowCount && bindEvent.startRow == 0){ this.wholeField.setValue(true); }else{ if(this.wholeField.getValue()){ this.wholeField.setValue(false); }else{ this.reloadStartTimeStore(); if(bindEvent.day != bindEvent.eday){ this.reloadEndTimeStore(); }else{ this.reloadEndTimeStore(bindEvent.startRow); } } } this.repeatStartField.setValue(bindEvent.day); this.startTimeField.setValue(bindEvent.startRow); this.endTimeField.setValue(bindEvent.endRow); this.subjectField.setValue(bindEvent.subject); this.contentField.setValue(bindEvent.content); this.startDayField.setValue(bindEvent.day); this.endDayField.setValue(bindEvent.eday); var v = 'no'; var rt = bindEvent.repeatType; if(rt && 'string' != Ext.type(rt)){ v = rt.rtype; } if('exception' == v){ v = 'no'; } this.repeatTypeField.setValue(v); this.resetRepeatSetting(v, bindEvent); if(bindEvent.alertFlag){ this.alertCB.setValue(true); }else{ this.alertCB.setValue(false); } if(bindEvent.locked){ this.lockCB.setValue(true); }else{ this.lockCB.setValue(false); } this.reloadCalendar(eh); this.calendarField.setValue(bindEvent.calendarId); this.oldColor = eh.calendarSet[bindEvent.calendarId].color; } else { this.wholeField.setValue(true); } this.generalForm.doLayout(); this.repeatForm.doLayout(); }, reloadCalendar:function(eh){ var store = this.calendarField.store; store.removeAll(); for(var p in eh.calendarSet){ var calendar = eh.calendarSet[p]; if(true !== calendar.hide){ var rd = new (store.recordType)({ id:calendar.id, title:calendar.name, description:calendar.description, color:calendar.color }); store.add(rd); } } } }); /** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns('Ext.ux.calendar'); Ext.ux.calendar.CalendarEditor = function(config){ Ext.apply(this, config); var lan = Ext.ux.calendar.Mask.CalendarEditor; this.nameField = new Ext.form.TextField({ name:'name', fieldLabel:lan['nameField.label'], allowBlank:false, anchor:'99%' }); this.descriptionField = new Ext.form.TextField({ name:'description', fieldLabel:lan['descriptionField.label'], anchor:'99%' }); this.colorField = new Ext.ColorPalette({}); this.colorField.on('select', this.onColorSelectFn, this); this.colorField.colors = Ext.ux.calendar.Mask.colors; this.clearBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_delete', minWidth:80, text:lan['clearBtn.text'], handler:this.onClearFn, scope:this }); this.saveBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_accept', minWidth:80, text:lan['saveBtn.text'], handler:this.onSaveFn, scope:this }); this.cancelBtn = new Ext.Button({ iconCls:'icon_feyaCalendar_cancel', minWidth:80, text:lan['cancelBtn.text'], handler:this.onCancelFn, scope:this }); // was formpanel this.formpanel = new Ext.Panel({ cls: 'x-calendar-menu', layout: 'form', border:false, style:'padding:10px;', labelWidth: 70, items:[ this.nameField, this.descriptionField, { border:false, style:'padding-left:60px;', items:[this.colorField] } ], buttonAlign:'right', buttons:[this.clearBtn, this.saveBtn, this.cancelBtn] }); Ext.ux.calendar.CalendarEditor.superclass.constructor.call(this, { width:500, height:160, closable:false, closeAction:'hide', layout:'fit', modal: true, resizable:false, items:[{ border:false, layout:'fit', items:[this.formpanel] }] }); }; Ext.extend(Ext.ux.calendar.CalendarEditor, Ext.Window, { onColorSelectFn:function(cp, color){ this.color = Ext.ux.calendar.Mask.getIndexByColor(color); }, popup:function(obj){ this.action = obj.action; this.show(); var lan = Ext.ux.calendar.Mask.CalendarEditor; if('add' == obj.action){ this.setTitle(lan['new.title']); this.setIconClass('icon_feyaCalendar_calendar'); }else{ this.setTitle(lan['edit.title']); this.setIconClass('icon_feyaCalendar_calendar_edit'); } if(obj.cEl){ this.calendarEl = obj.cEl; }else{ this.calendarEl = null; } var mask = Ext.ux.calendar.Mask; if(obj.data){ this.calendar = obj.data; var data = obj.data; this.nameField.setValue(data.name); this.descriptionField.setValue(data.description); var color = data.color; var cl = Ext.ux.calendar.Mask.getColorByIndex(color); if(cl){ this.colorField.select(cl); }else{ this.colorField.select(mask.colors[0]); } }else{ this.nameField.reset(); this.descriptionField.reset(); this.colorField.select(mask.colors[0]); } }, onClearFn:function(){ this.formpanel.form.reset(); }, onSaveFn:function(){ if(this.formpanel.form.isValid()){ var params = {}; if(this.calendar){ params.id = this.calendar.id; params.hide = this.calendar.hide; }else{ params.hide = false; } params.name = this.nameField.getValue(); params.description = this.descriptionField.getValue(); params.color = this.color; var eh = this.ehandler; eh.ds.createUpdateCalendar(params, function(backObj){ var cEl = this.calendarEl; if(cEl){ var oldColor = cEl.calendar.color; var oldName = cEl.calendar.name; Ext.apply(cEl.calendar, params); var color = cEl.calendar.color; eh.calendarSet[cEl.calendar.id] = cEl.calendar; var titleEl = cEl.child('.x-calendar-title-b'); if(titleEl){ titleEl.dom.innerHTML = ''+params.name+''; } if(oldColor != color){ cEl.calendar.color = oldColor; eh.changeColor(cEl.calendar, color); }else if(oldName != params.name){ eh.checkExpireEvents(); } }else if(backObj.id){ var calendar = Ext.apply({}, params); calendar.id = backObj.id; eh.calendarSet[calendar.id] = calendar; var mc = eh.mainPanel.westPanel.myCalendarPanel; eh.createCalendar(mc.body, null, null, calendar); var css = '.'+eh.id+'-x-calendar-'+calendar.id+'{}'; eh.ss[eh.ss.length] = Ext.util.CSS.createStyleSheet(css, Ext.id()); } }, this); this.hide(); } }, onCancelFn:function(){ this.hide(); } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. * * @class Ext.ux.calendar.EventHandler * @extends Ext.util.Observable * This class represents the primary interface of render, add/edit/delete, drag/drop calendar Event function. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.EventHandler = function(config) { Ext.apply(this, config); this.applyCalendarSetting(this); this.calendarSet = {}; this.dayCache = {}; this.id = Ext.id(); this.ControlID = config.ControlID; Ext.ux.calendar.EventHandler.superclass.constructor.call(this); this.calendarLayout = new Ext.ux.calendar.CalendarLayout({ ehandler: this }); var initobj = this.ds.initialObj; if (initobj) { for (var i = 0, len = initobj.owned.length; i < len; i++) { var c = initobj.owned[i]; this.calendarSet[c.id] = c; } for (var i = 0, len = initobj.shared.length; i < len; i++) { var c = initobj.shared[i]; this.calendarSet[c.id] = c; } this.calendarLayout.repeatSet = initobj.re; } this.detailTpl = new Ext.XTemplate( '
    ' + '
    ' + '' + '' + '' + '
    ' + '{title}' + '' + '' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '' + '' + '' + '
    ' + '' + '' + '' + '
    ' + '
    ' + '
    ' ); /* * The XTemplate for an event render in Ext.ux.calendar.DayView */ this.eventTpl = new Ext.XTemplate( '
    ' + '
    ' + '' + '' + '' + '' + '
    ' + '
     
    ' + '
    ' + '
    ' + '{title}' + '
    ' + '
    ' + '
     
    ' + '
    ' + '
    ' + '
    ' + '' + '' + ' ' + '' + '' + ' ' + '' + '' + ' ' + '' + '' + ' ' + '' + '{subject}
    {content}' + '
    ' + '
    ' + '' + '' + '' + '' + '
    ' + '
     
    ' + '
    ' + '
     
    ' + '
    ' + '
     
    ' + '
    ' + '
    ' + '
    ', { isRepeat: function(repeatType) { return ('string' != Ext.type(repeatType)); }, isException: function(repeatType) { return ('exception' == repeatType); }, isAlert: function(alertFlag) { return alertFlag; }, isLocked: function(locked) { return locked; } } ); this.eventTpl.compile(); /* * The XTemplate for an event render in Ext.ux.calendar.MonthView */ this.legendTpl = new Ext.XTemplate( '
    ' + '' + '{subject}, {title}' + '' + '
    ', { isRepeat: function(repeatType) { return ('string' != Ext.type(repeatType)); }, isException: function(repeatType) { return ('exception' == repeatType); }, isAlert: function(alertFlag) { return alertFlag; }, isLocked: function(locked) { return locked; } } ); this.legendTpl.compile(); /* * The XTemplate for a whole day event render in both Ext.ux.calendar.DayView and Ext.ux.calendar.MonthView */ this.wholeTpl = new Ext.XTemplate( '
    ' + '' + '' + '' + '' + '
    ' + '
     
    ' + '' + '
    ' + '
    ' + '
     ' + '' + '' + ' ' + '' + '' + ' ' + '' + '' + ' ' + '' + '' + ' ' + '' + '{subject}' + '' + '' + '
     
    ' + '' + '
    ' + '
    ' + '
    ' + '
    ', { isLeftJoin: function(lflag) { return lflag; }, isRightJoin: function(rflag) { return rflag; }, isRepeat: function(repeatType) { return ('string' != Ext.type(repeatType)); }, isException: function(repeatType) { return ('exception' == repeatType); }, isAlert: function(alertFlag) { return alertFlag; }, isLocked: function(locked) { return locked; } } ); this.wholeTpl.compile(); /* * The XTemplate for a calendar with drop menu, which render in Ext.ux.calendar.WestPanel */ this.cTplStr = '
    ' + '
    {title}
    ' + '' + '' + '' + '' + '
    ' + '
     
    ' + '
    ' + ' ' + '' + '
     
    ' + '
    ' + '
    '; this.calendarDropTpl = new Ext.XTemplate( '
    ' + '' + '' + // TRAKKWARE //'' + '
    ' + this.cTplStr + '' + // '
    ' + // '
    ' + //'
    ' + '
    ' ); this.calendarDropTpl.compile(); /* * The XTemplate for a calendar, which render in Ext.ux.calendar.Editor and Ext.ux.calendar.ResultView */ this.calendarTpl = new Ext.XTemplate(this.cTplStr); this.calendarTpl.compile(); this.initMenu(); this.initContextMenu(); /* * add some private events */ this.addEvents( 'calendarloaded', 'reloadCalendar', 'createEvent', 'updateEvent', 'deleteEvent', /* * for change all events from one day to another */ 'changeDay', 'deleteCalendar', /* * for clear all events belong to a calendar */ 'clearCalendar', 'changeEventCache', 'changeCalendarColor' ); this.on('reloadCalendar', this.reloadCalendar, this); this.on('changeCalendarColor', this.onChangeCalendarColorFn, this); this.on('changeEventCache', this.onChangeEventCacheFn, this); }; Ext.extend(Ext.ux.calendar.EventHandler, Ext.util.Observable, { /* * for save the css element */ ss: [], hourFormat: '', /* * The basic z-index for events */ baseIndex: 100, /* * widthRatio and posRatio are for caculate the overlap of events */ widthRatio: 0.95, posRatio: 1.05, applyCalendarSetting: function(source) { var cs = this.calendarSetting; var o = Ext.apply({}, cs); delete (o.dayFormat); delete (o.weekFormat); delete (o.monthFormat); Ext.apply(source, o); }, onChangeCalendarColorFn: function() { this.checkExpireEvents.defer(1, this); }, onChangeEventCacheFn: function() { this.checkExpireEvents.defer(1, this); }, showMenu: function(cEl, dEl) { if (this.menu) { this.menu.calendarEl = cEl; var calendar = cEl.calendar; var lan = Ext.ux.calendar.Mask.EventHandler; if (true === this.calendarSet[calendar.id].hide) { this.viewItem.setText(lan['viewItem.show.text']); this.viewItem.setIconClass('icon_feyaCalendar_calendar_show'); } else { this.viewItem.setText(lan['viewItem.hide.text']); this.viewItem.setIconClass('icon_feyaCalendar_calendar_hide'); } var c = 0; for (var p in this.calendarSet) { c++; } if (1 >= c) { this.deleteItem.hide(); } else { this.deleteItem.show(); } if (this.readOnly) { for (var i = 2, len = this.menu.items.getCount(); i < len; i++) { var it = this.menu.items.get(i); it.hide(); } } this.menu.bindEl = dEl; this.menu.show(dEl, this.menuAlign); } return this; }, onMenuShowFn: function(menu) { var calendar = menu.calendarEl.calendar; var color = Ext.ux.calendar.Mask.getColorByIndex(calendar.color); if (color) { menu.palette.still = true; menu.palette.select('#' + color); delete (menu.palette.still); } }, hideMenu: function() { if (this.menu) { this.menu.hide(); } return this; }, showContextMenu: function(e, eEl) { e.stopEvent(); if (this.cmenu) { this.cmenu.eventEl = eEl; var event = eEl.bindEvent; if (event.locked) { this.editItem.hide(); this.lockItem.hide(); this.unlockItem.show(); } else { this.editItem.show(); this.lockItem.show(); this.unlockItem.hide(); } this.cmenu.showAt(e.getXY()); } }, hideContextMenu: function() { if (this.cmenu) { this.cmenu.hide(); } return this; }, /* * Init the drop menu for calendar */ initMenu: function() { var lan = Ext.ux.calendar.Mask.EventHandler; this.showOnlyItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_calendar_show', text: lan['showOnlyItem.text'], handler: this.onShowOnlyFn, scope: this }); this.viewItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_calendar_hide', text: lan['viewItem.hide.text'], handler: this.onViewFn, scope: this }); this.editItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_calendar_edit', text: lan['editItem.text'], handler: this.onEditFn, scope: this }); this.deleteItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_delete', text: lan['deleteItem.text'], handler: this.onDeleteFn, scope: this }); this.clearItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_clear_event', text: lan['clearItem.text'], handler: this.onClearFn, scope: this }); var palette = new Ext.ColorPalette({ }); this.menu = new Ext.menu.Menu({ cls: 'x-calendar-menu', items: [ this.showOnlyItem, this.viewItem, this.editItem, this.deleteItem, this.clearItem, '-', palette ] }); this.menu.palette = palette; this.menu = Ext.menu.MenuMgr.get(this.menu); this.menu.palette.colors = Ext.ux.calendar.Mask.colors; this.menu.palette.on('select', this.onCalendarColorChangedFn, this); this.menu.on('show', this.onMenuShowFn, this); }, /* * Init the contextmenu for event */ initContextMenu: function() { var lan = Ext.ux.calendar.Mask.EventHandler; this.lockItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_event_lock', text: lan['lockItem.text'], handler: this.onLockEventFn, scope: this }); this.unlockItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_event_unlock', text: lan['unlockItem.text'], handler: this.onUnlockEventFn, scope: this }); this.editItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_event_edit', text: lan['editEvent.title'], handler: this.onEditEventFn, scope: this }); this.deleteItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_delete', text: lan['deleteEvent.title'], handler: this.onDeleteEventFn, scope: this }); this.cmenu = new Ext.menu.Menu({ items: [ this.lockItem, this.unlockItem, this.editItem, this.deleteItem ] }); this.cmenu = Ext.menu.MenuMgr.get(this.cmenu); }, onLockEventFn: function(item) { var menu = item.parentMenu; var eEl = menu.eventEl; var cview = eEl.cview; var eh = cview.ehandler; var event = eEl.bindEvent; var oevent = Ext.apply({}, event); event.locked = true; if ('string' == Ext.type(event.repeatType)) { eh.updateEvent(event, cview); } else { /* * need ask user to choose apply all or just current one */ var lan = Ext.ux.calendar.Mask.EventHandler; Ext.Msg.show({ title: lan['updateRepeatPopup.title'], msg: lan['updateRepeatPopup.msg'], buttons: Ext.Msg.YESNOCANCEL, fn: function(bid, text) { if ('yes' == bid) { eh.updateRepeatEvent(event, cview, oevent); } else if ('no' == bid) { event.repeatType = 'exception'; eh.updateRepeatEvent(event, cview, oevent); } else { event.locked = false; } }, icon: Ext.MessageBox.QUESTION }); } }, onUnlockEventFn: function(item) { var menu = item.parentMenu; var eEl = menu.eventEl; var cview = eEl.cview; var eh = cview.ehandler; var event = eEl.bindEvent; var oevent = Ext.apply({}, event); event.locked = false; if ('string' == Ext.type(event.repeatType)) { eh.updateEvent(event, cview); } else { /* * need ask user to choose apply all or just current one */ var lan = Ext.ux.calendar.Mask.EventHandler; Ext.Msg.show({ title: lan['updateRepeatPopup.title'], msg: lan['updateRepeatPopup.msg'], buttons: Ext.Msg.YESNOCANCEL, fn: function(bid, text) { if ('yes' == bid) { eh.updateRepeatEvent(event, cview, oevent); } else if ('no' == bid) { event.repeatType = 'exception'; eh.updateRepeatEvent(event, cview, oevent); } else { event.locked = true; } }, icon: Ext.MessageBox.QUESTION }); } }, onEditEventFn: function(item) { var menu = item.parentMenu; var eEl = menu.eventEl; var cview = eEl.cview; var eh = cview.ehandler; eh.showEditor(eEl, cview, 'update'); }, onDeleteEventFn: function(item) { var lan = Ext.ux.calendar.Mask.EventHandler; var menu = item.parentMenu; var eEl = menu.eventEl; var cview = eEl.cview; var eh = cview.ehandler; var event = eEl.bindEvent; if ('string' == Ext.type(event.repeatType)) { eh.freeEventEl(eEl); eh.deleteEvent(event, cview, eEl.col); } else { Ext.Msg.show({ title: lan['deleteRepeatPopup.title'], msg: lan['deleteRepeatPopup.msg'], buttons: Ext.Msg.YESNOCANCEL, fn: function(bid, text) { if ('yes' == bid) { eh.freeEventEl(eEl); eh.deleteRepeatEvent(event, cview); } else if ('no' == bid) { eh.freeEventEl(eEl); eh.deleteRepeatEvent(event, cview, true); } }, icon: Ext.MessageBox.QUESTION }); } }, /* * For clear all events belong a calendar */ onClearFn: function(item) { Ext.Msg.confirm('Hint', 'Do you really want to delete all events of this calendar?', function(btn) { if (btn == 'yes') { var menu = item.parentMenu; var cEl = menu.calendarEl; var calendar = cEl.calendar; var calendarId = calendar.id; this.ds.deleteEventsByCalendar(calendarId, function(backObj) { delete (this.calendarSet[calendarId]); var cc = this.mainPanel.calendarContainer; var cview = cc.currentView; this.calendarLayout.resetLayout({ hideCalendar: false, deleteCalendar: true }, true); cview.checkLayout(); this.fireEvent('changeEventCache', this); this.calendarSet[calendarId] = calendar; }, this); } }, this ); }, /* * For delete a calendar and all events belong to it */ onDeleteFn: function(item) { Ext.Msg.confirm('Hint', 'Do you really want to delete this calendar?', function(btn) { if (btn == 'yes') { var menu = item.parentMenu; var cEl = menu.calendarEl; var calendar = cEl.calendar; var calendarId = calendar.id; this.ds.deleteCalendar(calendarId, function(backObj) { delete (this.calendarSet[calendarId]); var cc = this.mainPanel.calendarContainer; var cview = cc.currentView; this.calendarLayout.resetLayout({ hideCalendar: false, deleteCalendar: true }, true); cview.checkLayout(); this.fireEvent('changeEventCache', this); cEl.remove(); }, this); } }, this ); }, copyCalendarSet: function() { var o = {}, cs = this.calendarSet; for (var p in cs) { o[p] = Ext.apply({}, cs[p]); } return o; }, /* * For check event cache to see whether any event is actived or expired, * if yes where popup a window to show the actived events */ checkExpireEvents: function() { var now = new Date(); var nowday = now.format('Y-m-d'); var nowTime = now.format('Y-m-d H:i'); var expire = []; var layout = this.calendarLayout.layoutSet[nowday]; if (layout) { var events = layout.getAllEvents(); var getHM = Ext.ux.calendar.Mask.getIntervalFromRow; for (var i = 0, len = events.length; i < len; i++) { var event = events[i]; var startHi = getHM(this.intervalSlot, event.startRow); var endHi = getHM(this.intervalSlot, event.endRow); var startTime = event.day + ' ' + startHi; var endTime = event.eday + ' ' + endHi; var eday = event.eday; if (this.rowCount == event.endRow) { eday = Date.parseDate(event.eday, 'Y-m-d').add(Date.DAY, 1).format('Y-m-d'); endTime = eday + ' ' + endHi; } if (event.alertFlag && startTime <= nowTime && nowTime < endTime) { expire[expire.length] = Ext.applyIf({ color: '#' + Ext.ux.calendar.Mask.getColorByIndex(this.calendarSet[event.calendarId].color), startDate: event.day + ' ' + getHM(this.intervalSlot, event.startRow, this.hourFormat), endDate: eday + ' ' + getHM(this.intervalSlot, event.endRow, this.hourFormat) }, event); } } if (!this.epopup) { this.epopup = new Ext.ux.calendar.ExpirePopup({ ehandler: this }); } if (0 < expire.length) { if (this.epopup) { this.epopup.popup(expire); } // for support extjs 2.2 } else { this.epopup.activedEvents = null; try { this.epopup.hide(); } catch (err) { } // for support extjs 2.2 } } }, /* * For show all calendars belong to current user */ onShowAllFn: function(item) { var cview = this.mainPanel.calendarContainer.getLayout().activeItem; this.ds.showAllCalendar(function(backObj) { var cs = this.calendarSet; for (var p in cs) { var c = cs[p]; c.hide = false; var calendarEl = Ext.get(this.id + '-x-calendar-' + p); this.showCalendarColor(calendarEl, c.color); } this.calendarLayout.resetLayout({ hideCalendar: true, deleteCalendar: false }, true); cview.checkLayout(); }, this); }, /* * For only show a calendar and hide all other calendars */ onShowOnlyFn: function(item) { var cview = this.mainPanel.calendarContainer.getLayout().activeItem; var menu = item.parentMenu; var cEl = menu.calendarEl; var calendar = cEl.calendar; var id = calendar.id; calendar.hide = false; this.ds.showOnlyCalendar(id, function(backObj) { this.showCalendarColor(cEl, calendar.color); var cs = this.calendarSet; for (var p in cs) { if (p != id) { var c = cs[p]; c.hide = true; var calendarEl = Ext.get(this.id + '-x-calendar-' + p); this.hideCalendarColor(calendarEl, c.color); } } this.calendarLayout.resetLayout({ hideCalendar: true, deleteCalendar: false }, true); cview.checkLayout(); }, this); }, /* * For show/hide a calendar and all events belong to it */ onViewFn: function(item) { var menu = item.parentMenu; var cEl = menu.calendarEl; var calendar = cEl.calendar; var lan = Ext.ux.calendar.Mask.EventHandler; calendar.hide = !calendar.hide; this.ds.createUpdateCalendar(calendar, function(backObj) { if (lan['viewItem.hide.text'] == item.text) { item.setText(lan['viewItem.show.text']); this.hideCalendar(calendar, true); this.hideCalendarColor(cEl, calendar.color); } else { item.setText(lan['viewItem.hide.text']); this.hideCalendar(calendar, false); this.showCalendarColor(cEl, calendar.color); } }, this); }, /* * For show/hide a calendar and all events belong to it * @param {Boolean} flag, true for hide, false for show */ hideCalendar: function(calendar, flag) { var id = calendar.id; var cview = this.mainPanel.calendarContainer.currentView; calendar.hide = flag; this.calendarSet[id].hide = flag; this.calendarLayout.resetLayout({ hideCalendar: true, deleteCalendar: false }, true); cview.checkLayout(); }, /* * show the editor to edit an event */ onEditFn: function(item) { var menu = item.parentMenu; var cEl = menu.calendarEl; var calendar = cEl.calendar; this.ceditor.popup({ data: calendar, cEl: cEl }); }, prepareLegend: function(pn, spos, epos, cview) { var eh = cview.ehandler; var sindex = spos.x * cview.shiftDay + spos.y; var eindex = epos.x * cview.shiftDay + epos.y; var tmp = sindex; if (sindex > eindex) { sindex = eindex; eindex = tmp; } var calendar; for (var p in eh.calendarSet) { calendar = eh.calendarSet[p]; if (true !== calendar.hide) { break; } } var event = { eventId: 'prepare', calendarId: calendar.id, color: calendar.color, startRow: 0, endRow: this.rowCount, day: cview.daySet[sindex].format('Y-m-d'), eday: cview.daySet[eindex].format('Y-m-d'), repeatType: 'no' }; pn.hold = true; pn.cview = cview; pn.bindEvent = event; this.showEditor(pn, cview, 'add'); }, prepareEvent: function(pn, cview) { var id = pn.dom.id; var pos = cview.getCellIndex(id); var eh = cview.ehandler; var x = pos.x, y = pos.y; var calendar; for (var p in eh.calendarSet) { calendar = eh.calendarSet[p]; if (true !== calendar.hide) { break; } } var event = { eventId: 'prepare', calendarId: calendar.id, color: calendar.color, startRow: x, endRow: x + this.numInHour, day: cview.daySet[y].format('Y-m-d'), eday: cview.daySet[y].format('Y-m-d'), span: 1, colIndex: 0, repeatType: 'no' }; return this.renderEvent(cview, [event], y, true); }, generateInfo: function(event) { var startRow = event.startRow; var endRow = event.endRow; var hm; if (0 == startRow && this.rowCount == endRow) { hm = event.day; if (event.day != event.eday) { hm += ' to ' + event.eday; } hm += ' ' + Ext.ux.calendar.Mask.EventHandler['wholeDay']; return hm; } else { hm = event.day + ' ' + Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, startRow, this.hourFormat) + ' to '; if (event.day != event.eday) { hm += event.eday + ' '; } hm += Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, endRow, this.hourFormat); return hm; } }, generateTitle: function(event) { var startRow = event.startRow; var endRow = event.endRow; if (0 == startRow && this.rowCount == endRow) { return Ext.ux.calendar.Mask.EventHandler['wholeDay']; } else { var hm = Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, startRow, this.hourFormat) + '-' + Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, endRow, this.hourFormat); return hm; } }, getContentEl: function(coverEl) { return coverEl.child('.x-event-content-default'); }, getTitleEl: function(coverEl) { return coverEl.child('.x-event-title-default'); }, getBottomEl: function(coverEl) { return coverEl.child('.x-event-bottom-default'); }, getLeftTopEl: function(coverEl) { return coverEl.child('.x-event-lt-default'); }, getRightTopEl: function(coverEl) { return coverEl.child('.x-event-rt-default'); }, /* * this function is for render Event * @param {Class} cview: an instance of DayView or MonthView; the container where these events to render * @param {Array} rs: an array of events to render * @param {int} col: the index of column in cview to render the events, * for DayView, it's always 0, for WeekView, it's from 0 to 6, for MonthView, it's from 0 to 27 */ renderEvent: function(cview, rs, col, full) { var bl = cview.cbody.getLeft(), bt = cview.cbody.getTop(); var coverEl; for (var i = 0, len = rs.length; i < len; i++) { var e = rs[i]; var arr = Ext.DomQuery.select('div[eid=' + e.eventId + ']', cview.body.dom); for (var j = 0, size = arr.length; j < size; j++) { var eEl = Ext.get(arr[j]); if (eEl.col == col || eEl.nol == col) { if (this.editingId == eEl.dom.id) { delete (this.editingId); this.editDisabled = false; } this.freeEventEl(eEl); } } } for (var i = 0, len = rs.length; i < len; i++) { var e = rs[i]; var pn = Ext.get(cview.id + '-x-dayview-viewer-' + e.startRow + '-' + col); var cl = pn.getLeft(); var tw = pn.getWidth(); var offset = Math.round(tw * cview.offsetPercent); var cw = tw - offset; if (full) { cw = tw; } var ct = pn.getTop(); var ch = (pn.getHeight() + 1) * (e.endRow - e.startRow) - 24; var r = cw / Math.pow(e.span, this.posRatio) * e.colIndex; var rest = cw - r; var x = Math.round(cl - bl + offset + r); if (full) { x = Math.round(cl - bl + r); } var y = Math.round(ct - bt); if (true == e.last && 0 != e.colIndex) { r = 1; } else { r = Math.pow(this.widthRatio, e.span - 1 - e.colIndex); } var w = Math.floor(rest * r); var leftStyle = 5, rightStyle = 5; var mw = w - leftStyle - rightStyle; var zindex = this.baseIndex + e.colIndex; var coverStyle = 'top:' + y + 'px;left:' + x + 'px;width:' + w + 'px;z-index:' + zindex + ';'; var contentStyle = 'height:' + ch + 'px;'; if (Ext.isIE) { contentStyle += 'width:' + w + 'px;'; } var titleStyle = 'width:' + mw + 'px;'; var bottomStyle = 'width:' + mw + 'px;'; var subject = e.subject || ''; if ('' === subject.trim()) { subject = Ext.ux.calendar.Mask.EventHandler['untitled']; } var color = e.color; if (this.calendarSet) { color = this.calendarSet[e.calendarId].color; } var html = this.eventTpl.apply({ 'id': e.eventId, 'calendarId': e.calendarId, 'color': color, 'cover-style': coverStyle, 'content-style': contentStyle, 'title-style': titleStyle, 'bottom-style': bottomStyle, 'left-style': 'width:' + leftStyle + 'px;', 'right-style': 'width:' + rightStyle + 'px;', 'title': this.generateTitle(e), 'time': this.generateInfo(e), 'subject': subject, 'content': e.content || '', 'day': e.day, 'eday': e.eday, 'repeatType': e.repeatType, 'alertFlag': e.alertFlag, 'locked': e.locked }); var coverel = Ext.DomHelper.insertHtml('beforeEnd', pn.dom, html); coverEl = Ext.get(coverel); if (coverEl) { var contentEl = this.getContentEl(coverEl); var titleEl = this.getTitleEl(coverEl); var bottomEl = this.getBottomEl(coverEl); var ltEl = this.getLeftTopEl(coverEl); var rtEl = this.getRightTopEl(coverEl); e.eId = coverEl.id; coverEl.bindEvent = Ext.apply({}, e); coverEl.cview = cview; coverEl.col = col; coverEl.cEl = pn; coverEl.titleEl = titleEl; coverEl.contentEl = contentEl; coverEl.bottomEl = bottomEl; coverEl.ltEl = ltEl; coverEl.rtEl = rtEl; coverEl.leftStyle = leftStyle; coverEl.rightStyle = rightStyle; contentEl.coverEl = coverEl; contentEl.bindEvent = Ext.apply({}, e); contentEl.cview = cview; contentEl.cEl = pn; contentEl.col = col; } } cview.resizePort(); this.floating = false; return coverEl; }, getIndexFromDay: function(cview, day) { return cview.getIndexFromDay(day); }, /* * For create an event and add it in LayoutGrid * @param {Object} event: the event config to create * @param {Class} cview: an instance of DayView or MonthView; the container where these events to render * @param {int} col: the index of column in cview to render the events, * for DayView, it's always 0, for WeekView, it's from 0 to 6, for MonthView, it's from 0 to 27 */ createEvent: function(event, cview, col) { this.ds.createEvent(event, function(backObj) { event.eventId = backObj.id; this.createEventToLayout(event, cview, col); this.fireEvent('changeEventCache', this); }, this); }, createEventToLayout: function(event, cview, col) { if (false === Ext.type(col)) { col = this.getIndexFromDay(cview, event.day); } var glayout = this.calendarLayout; var all = (0 == event.startRow && this.rowCount == event.endRow) || (event.day != event.eday); if (all) { glayout.updateWholeList([event], 'add'); cview.checkLayout(Ext.isIE); } else { var layout = glayout.getLayout(event.day, cview); if (layout) { var rs = layout.updateLayout(event, 'add'); if (cview instanceof Ext.ux.calendar.DayView) { this.renderEvent(cview, rs.elist, col); } else { cview.checkLayout(); } } } }, createRepeatEvent: function(event, cview, col) { this.ds.createUpdateRepeatEvent(event, null, function(backObj) { event.eventId = backObj.id; var gLayout = this.calendarLayout; gLayout.updateRepeatEventList(cview, [event], 'add'); this.fireEvent('changeEventCache', this); }, this); }, /* * For update an event and update it in LayoutGrid * @param {Object} event: the event config to create * @param {Class} cview: an instance of DayView or MonthView; the container where these events to render * @param {int} col: the index of column in cview to render the events, * for DayView, it's always 0, for WeekView, it's from 0 to 6, for MonthView, it's from 0 to 27 * @param {Object} oevent: the old event config * @param {boolean or function} noLayout: if not null means no need update LayoutGrid, also can be a callback function */ updateEvent: function(event, cview, ocol, oevent, noLayout) { this.ds.updateEvent(event, function(backObj) { if ('function' === Ext.type(noLayout)) { noLayout(event); } var all = ((0 == event.startRow && this.rowCount == event.endRow) || (event.day != event.eday)), oall = false; var col; var glayout = this.calendarLayout; if (oevent) { if (false === Ext.type(ocol)) { ocol = this.getIndexFromDay(cview, oevent.day); } oall = ((0 == oevent.startRow && this.rowCount == oevent.endRow) || (oevent.day != oevent.eday)); var olayout = this.calendarLayout.getLayout(oevent.day, cview); if (oevent.day != event.day) { col = this.getIndexFromDay(cview, event.day); var rs = olayout.updateLayout(oevent, 'delete'); if (rs.elist && cview instanceof Ext.ux.calendar.DayView) { var arr = Ext.DomQuery.select('div[name=x-event-' + oevent.day + '-' + oevent.eday + '-' + oevent.eventId + ']', cview.body.dom); for (var i = 0, len = arr.length; i < len; i++) { this.freeEventEl(Ext.get(arr[i])); } this.renderEvent(cview, rs.elist, ocol); } } else { col = ocol; if (oall != all) { var rs = olayout.updateLayout(oevent, 'delete'); if (rs.elist && cview instanceof Ext.ux.calendar.DayView) { var arr = Ext.DomQuery.select('div[name=x-event-' + oevent.day + '-' + oevent.eday + '-' + oevent.eventId + ']', cview.body.dom); for (var i = 0, len = arr.length; i < len; i++) { this.freeEventEl(Ext.get(arr[i])); } this.renderEvent(cview, rs.elist, ocol); } } } } else { if (false == Ext.type(ocol)) { col = this.getIndexFromDay(cview, event.day); } else { col = ocol; } } if (all) { glayout.updateWholeList([event], 'update'); } else { var layout = glayout.getLayout(event.day, cview); if (layout) { var rs = layout.updateLayout(event, 'update'); if (false != Ext.type(col) && rs.elist && cview instanceof Ext.ux.calendar.DayView) { this.renderEvent(cview, rs.elist, col); } } } if ((oall || all) && cview instanceof Ext.ux.calendar.DayView) { cview.checkLayout(Ext.isIE); } if (cview instanceof Ext.ux.calendar.MonthView) { cview.checkLayout(true); } this.fireEvent('changeEventCache', this); }, this); }, /* * For delete an event and delete it in LayoutGrid * @param {Object} event: the event config to create * @param {Class} cview: an instance of DayView or MonthView; the container where these events to render * @param {int} col: the index of column in cview to render the events, * for DayView, it's always 0, for WeekView, it's from 0 to 6, for MonthView, it's from 0 to 27 * @param {boolean} keep: whether keep the edit status for the editing event */ deleteEvent: function(event, cview, col, keep) { this.ds.deleteEvent(event, function(backObj) { this.deleteEventFromLayout(event, cview, col); if (Ext.isIE && (event.day != event.eday || (0 == event.startRow) && (this.rowCount == event.endRow))) { cview.checkLayout(true); } this.fireEvent('changeEventCache', this); }, this); }, deleteEventFromLayout: function(event, cview, col) { var glayout = this.calendarLayout; var all = (0 == event.startRow && this.rowCount == event.endRow) || (event.day != event.eday); if (all) { glayout.updateWholeList([event], 'delete'); cview.checkLayout(); } else { var layout = glayout.getLayout(event.day, cview); if (layout) { var rs = layout.updateLayout(event, 'delete'); if (false != Ext.type(col) && cview instanceof Ext.ux.calendar.DayView) { this.renderEvent(cview, rs.elist, col); } } } }, deleteRepeatEvent: function(event, cview, makeException) { if (makeException) { var eps = event.repeatType.exceptions || {}; eps[event.day] = true; event.repeatType.exceptions = eps; } this.ds.deleteRepeatEvent(event, makeException, function(backObj) { var gLayout = this.calendarLayout; if (makeException) { gLayout.updateRepeatEventList(cview, [event], 'update'); } else { gLayout.updateRepeatEventList(cview, [event], 'delete'); } this.fireEvent('changeEventCache', this); }, this); }, /* * For create an event and add it in LayoutGrid * @param {Element} eEl: the event element where the editor align to * @param {Class} cview: the view container * @param {boolean or function} noLayout: if not null means no need update the LayoutGrid, also can be a callback function */ showEditor: function(eEl, cview, action, noLayout) { this.editor.popup({ bindEl: eEl, cview: cview, action: action, noLayout: noLayout }); }, /* * for set the pin-on class for event element */ setPinOn: function(coverEl) { var pinEl = coverEl.child('img'); pinEl.removeClass('x-calendar-event-pin-off'); pinEl.addClass('x-calendar-event-pin-on'); }, /* * for set the pin-off class for event element */ setPinOff: function(coverEl) { var pinEl = coverEl.child('img'); pinEl.removeClass('x-calendar-event-pin-on'); pinEl.addClass('x-calendar-event-pin-off'); }, onPinElClickFn: function(e) { e.stopEvent(); var target = e.getTarget(); var tgEl = Ext.get(target); if (tgEl.hasClass('x-calendar-event-pin-off')) { tgEl.removeClass('x-calendar-event-pin-off'); tgEl.addClass('x-calendar-event-pin-on'); this.editDisabled = true; } else { tgEl.removeClass('x-calendar-event-pin-on'); tgEl.addClass('x-calendar-event-pin-off'); this.editDisabled = false; } }, /* * set the editing status for an event */ setEditingStatus: function(coverEl, forceFlag, pinFlag) { var coverFlag = null; if (coverEl.hasClass('x-event-cover')) { coverFlag = 'event'; } var editCover = Ext.get(this.editingId); var bindEvent = coverEl.bindEvent; var titleEl = coverEl.titleEl; var contentEl = coverEl.contentEl; var bottomEl = coverEl.bottomEl; var flag = false; if (true != this.floating) { if (true !== this.editDisabled) { flag = true; } else if (true === forceFlag) { flag = true; if (this.editingId != coverEl.dom.id) { this.editDisabled = false; } if (editCover) { this.setPinOff(editCover); } } } if (flag) { if (editCover) { this.removeEditingStatus(editCover); } this.editingId = coverEl.dom.id; coverEl.setStyle('z-index', 3009); if (coverFlag) { coverEl.addClass('x-event-editing'); } var color = this.calendarSet[bindEvent.calendarId].color; if (coverEl.hasClass('x-event-cover')) { if (titleEl) { titleEl.addClass('x-calendar-' + color + '-event-top'); titleEl.removeClass('x-calendar-' + color + '-event-top-clear'); } var ltEl = coverEl.ltEl; if (ltEl) { ltEl.addClass('x-calendar-' + color + '-event-ltcorner'); ltEl.removeClass('x-calendar-' + color + '-event-ltcorner-clear'); } var rtEl = coverEl.rtEl; if (rtEl) { rtEl.addClass('x-calendar-' + color + '-event-rtcorner'); rtEl.removeClass('x-calendar-' + color + '-event-rtcorner-clear'); } } } var cw = coverEl.getWidth(); var w = cw; if (coverEl.leftStyle && coverEl.rightStyle) { w = cw - coverEl.leftStyle - coverEl.rightStyle; } if (titleEl && coverFlag) { titleEl.setWidth(w); } if (Ext.isIE && contentEl && coverFlag) { contentEl.setWidth(cw); } if (bottomEl) { bottomEl.setWidth(w); } if (false !== Ext.type(pinFlag)) { this.editDisabled = pinFlag; } if (this.editDisabled) { this.setPinOn(coverEl); } }, removeEditingStatus: function(coverEl) { var bindEvent = coverEl.bindEvent; var index = this.baseIndex; if (bindEvent.colIndex) { index += bindEvent.colIndex; } coverEl.setStyle('z-index', index.toString()); coverEl.removeClass('x-event-editing'); var color = this.calendarSet[bindEvent.calendarId].color; var titleEl = coverEl.titleEl; if (titleEl) { titleEl.removeClass('x-calendar-' + color + '-event-top'); if (coverEl.cview instanceof Ext.ux.calendar.DayView && !(0 == bindEvent.startRow && this.rowCount == bindEvent.endRow)) { titleEl.addClass('x-calendar-' + color + '-event-top-clear'); } } var ltEl = coverEl.ltEl; if (ltEl) { ltEl.removeClass('x-calendar-' + color + '-event-ltcorner'); ltEl.addClass('x-calendar-' + color + '-event-ltcorner-clear'); } var rtEl = coverEl.rtEl; if (rtEl) { rtEl.removeClass('x-calendar-' + color + '-event-rtcorner'); rtEl.addClass('x-calendar-' + color + '-event-rtcorner-clear'); } }, generateLegend: function(cview, e) { var subject = e.subject || ''; if ('' === subject.trim()) { subject = Ext.ux.calendar.Mask.EventHandler['untitled']; } var html; var color = e.color; if (this.calendarSet) { color = this.calendarSet[e.calendarId].color; } if ((0 == e.startRow && this.rowCount == e.endRow) || (e.day != e.eday)) { html = this.wholeTpl.apply({ 'id': e.eventId, 'lflag': e.lflag || false, 'rflag': e.rflag || false, 'calendarId': e.calendarId, 'color': color, 'title': this.generateTitle(e), 'time': this.generateInfo(e), 'subject': subject, 'content': e.content || '', 'day': e.day, 'eday': e.eday, 'repeatType': e.repeatType, 'alertFlag': e.alertFlag, 'locked': e.locked }); } else { html = this.legendTpl.apply({ 'id': e.eventId, 'calendarId': e.calendarId, 'color': color, 'title': this.generateTitle(e), 'time': this.generateInfo(e), 'subject': subject, 'content': e.content || '', 'day': e.day, 'eday': e.eday, 'repeatType': e.repeatType, 'alertFlag': e.alertFlag, 'locked': e.locked }); } return html; }, /* * for delete an event from monthView or the pool of DayView * @param {Class} cview: an instance of DayView or MonthView; the container where these events to render * @param {Array} rs: an array of events to render * @param {Element} pn: the parent node where this event Element belong to */ deleteLegend: function(event, cview, pn) { var pos = cview.getCellIndex(pn.dom.id); var index = pos.x * cview.dayNum + pos.y; var layout = this.calendarLayout.getLayout(cview.daySet[index], cview); var rs = layout.updateLayout(event, 'delete'); }, /* * for create a calendar * @param {Element} pn: the parent node where this event Element belong to * @param {Class} cview: an instance of DayView or MonthView; the container where these events to render * @param {string} pos: the postition to insert * @param {Class} calendar: the calendar ready to create */ createCalendar: function(pnode, cview, pos, calendar) { var legendStyle = 'height:9px;'; var html = this.calendarDropTpl.apply({ 'legend-style': legendStyle, 'title': calendar.name, 'calendarId': calendar.id, 'color': calendar.color }); var nel, calendarEl; if ('beforeBegin' == pos) { nel = Ext.DomHelper.insertHtml('beforeBegin', pnode.dom.firstChild, html); } else { nel = Ext.DomHelper.insertHtml('beforeEnd', pnode.dom, html); } calendarEl = Ext.get(nel); if (calendarEl) { calendarEl.addClassOnOver('x-calendar-over'); calendarEl.calendar = calendar; this.initCalendar(calendarEl); } return calendarEl; }, initCalendar: function(calendarEl) { calendarEl.on('click', this.onCalendarElClickFn, { cEl: calendarEl, sp: this }); calendarEl.on('dblclick', this.onCalendarElDblClickFn, { cEl: calendarEl, sp: this }); }, onCalendarElDblClickFn: function(e) { // TRAKKWARE return; // END TRAKKWARE var sp = this.sp; var cEl = this.cEl; var calendar = cEl.calendar; sp.ceditor.popup({ data: calendar, cEl: cEl }); }, onCalendarElClickFn: function(e) { var sp = this.sp; var cEl = this.cEl; var calendar = cEl.calendar; var tgEl = Ext.get(e.getTarget()); // TRAKKWARE: added false. I want to show/hide on click, regardless of the situation. if (false && tgEl.hasClass('x-legend-tool')) { sp.menu.palette.calendar = calendar; sp.showMenu(cEl, tgEl); } else { calendar.hide = !calendar.hide; // TRAKKWARE numerous changes here. The method that was being called is a stub. if (calendar.hide === true) { sp.hideCalendar(calendar, true); sp.hideCalendarColor(cEl, calendar.color); } else { sp.hideCalendar(calendar, false); sp.showCalendarColor(cEl, calendar.color); } } }, /* * for change the color of a calendar */ onCalendarColorChangedFn: function(cp, color) { if (true !== cp.still) { color = Ext.ux.calendar.Mask.getIndexByColor(color); if (color) { this.changeColor(cp.calendar, color); } this.menu.hide(); } }, /* * for change the color of an event Element */ changeEventColor: function(eEl, oldColor, color) { var ltEl = eEl.child('.x-calendar-' + oldColor + '-event-ltcorner-clear'); if (ltEl) { ltEl.removeClass('x-calendar-' + oldColor + '-event-ltcorner-clear'); ltEl.addClass('x-calendar-' + color + '-event-ltcorner-clear'); } ltEl = eEl.child('.x-calendar-' + oldColor + '-event-ltcorner'); if (ltEl) { ltEl.removeClass('x-calendar-' + oldColor + '-event-ltcorner'); ltEl.addClass('x-calendar-' + color + '-event-ltcorner'); } var rtEl = eEl.child('.x-calendar-' + oldColor + '-event-rtcorner-clear'); if (rtEl) { rtEl.removeClass('x-calendar-' + oldColor + '-event-rtcorner-clear'); rtEl.addClass('x-calendar-' + color + '-event-rtcorner-clear'); } rtEl = eEl.child('.x-calendar-' + oldColor + '-event-rtcorner'); if (rtEl) { rtEl.removeClass('x-calendar-' + oldColor + '-event-rtcorner'); rtEl.addClass('x-calendar-' + color + '-event-rtcorner'); } var tEl = eEl.child('.x-calendar-' + oldColor + '-event-top-clear'); if (tEl) { tEl.removeClass('x-calendar-' + oldColor + '-event-top-clear'); tEl.addClass('x-calendar-' + color + '-event-top-clear'); } tEl = eEl.child('.x-calendar-' + oldColor + '-event-top'); if (tEl) { tEl.removeClass('x-calendar-' + oldColor + '-event-top'); tEl.addClass('x-calendar-' + color + '-event-top'); } var lrEl = eEl.child('.x-calendar-' + oldColor + '-event-lr'); if (lrEl) { lrEl.removeClass('x-calendar-' + oldColor + '-event-lr'); lrEl.addClass('x-calendar-' + color + '-event-lr'); } var lbEl = eEl.child('.x-calendar-' + oldColor + '-event-lbcorner'); if (lbEl) { lbEl.removeClass('x-calendar-' + oldColor + '-event-lbcorner'); lbEl.addClass('x-calendar-' + color + '-event-lbcorner'); } var rbEl = eEl.child('.x-calendar-' + oldColor + '-event-rbcorner'); if (rbEl) { rbEl.removeClass('x-calendar-' + oldColor + '-event-rbcorner'); rbEl.addClass('x-calendar-' + color + '-event-rbcorner'); } var bEl = eEl.child('.x-calendar-' + oldColor + '-event-bottom'); if (bEl) { bEl.removeClass('x-calendar-' + oldColor + '-event-bottom'); bEl.addClass('x-calendar-' + color + '-event-bottom'); } }, changeWholeColor: function(wEl, oldColor, color) { var titleEl = wEl.child('.x-whole-title-' + oldColor); if (titleEl) { titleEl.removeClass('x-whole-title-' + oldColor); titleEl.addClass('x-whole-title-' + color); } var leftEl = wEl.child('.x-calendar-' + oldColor + '-whole-left'); if (leftEl) { leftEl.removeClass('x-calendar-' + oldColor + '-whole-left'); leftEl.addClass('x-calendar-' + color + '-whole-left'); } var rightEl = wEl.child('.x-calendar-' + oldColor + '-whole-right'); if (rightEl) { rightEl.removeClass('x-calendar-' + oldColor + '-whole-right'); rightEl.addClass('x-calendar-' + color + '-whole-right'); } }, changeCalendarColor: function(cEl, oldColor, color) { var hide; var titleEl = cEl.child('.x-whole-title-' + oldColor); if (titleEl) { hide = false; titleEl.removeClass('x-whole-title-' + oldColor); titleEl.addClass('x-whole-title-' + color); } else { hide = true; var bEl = cEl.child('.x-calendar-title-b'); if (bEl) { bEl.setStyle('color', '#' + Ext.ux.calendar.Mask.getColorByIndex(color)); } } if (false == hide) { var leftEl = cEl.child('.x-calendar-' + oldColor + '-whole-left'); if (leftEl) { leftEl.removeClass('x-calendar-' + oldColor + '-whole-left'); leftEl.addClass('x-calendar-' + color + '-whole-left'); } var rightEl = cEl.child('.x-calendar-' + oldColor + '-whole-right'); if (rightEl) { rightEl.removeClass('x-calendar-' + oldColor + '-whole-right'); rightEl.addClass('x-calendar-' + color + '-whole-right'); } } }, hideCalendarColor: function(cEl, oldColor) { var leftEl = cEl.child('.x-calendar-' + oldColor + '-whole-left'); if (leftEl) { leftEl.removeClass('x-calendar-' + oldColor + '-whole-left'); } var rightEl = cEl.child('.x-calendar-' + oldColor + '-whole-right'); if (rightEl) { rightEl.removeClass('x-calendar-' + oldColor + '-whole-right'); } var titleEl = cEl.child('.x-whole-title-' + oldColor); if (titleEl) { titleEl.removeClass('x-whole-title-' + oldColor); } var bEl = cEl.child('.x-calendar-title-b'); if (bEl) { var color = Ext.ux.calendar.Mask.getColorByIndex(oldColor); bEl.setStyle('color', '#' + color); } }, showCalendarColor: function(cEl, oldColor) { var leftEl = cEl.child('.x-whole-left'); if (leftEl) { leftEl.addClass('x-calendar-' + oldColor + '-whole-left'); } var rightEl = cEl.child('.x-whole-right'); if (rightEl) { rightEl.addClass('x-calendar-' + oldColor + '-whole-right'); } var titleEl = cEl.child('.x-calendar-title'); if (titleEl) { titleEl.addClass('x-whole-title-' + oldColor); } var bEl = cEl.child('.x-calendar-title-b'); if (bEl) { bEl.setStyle('color', 'white'); } }, changeLegendColor: function(lEl, oldColor, color) { var bEl = lEl.child('.x-legend-title-' + oldColor); if (bEl) { bEl.removeClass('x-legend-title-' + oldColor); bEl.addClass('x-legend-title-' + color); } }, /* * for change color of a calendar and all events belong to it * @param {Obj} calendar: the obj of calendar * @param {int} index: the index of the color */ changeColor: function(calendar, index) { var oldColor = calendar.color; calendar.color = index; this.ds.createUpdateCalendar(calendar, function(backObj) { if ("true" == backObj.success) { this.calendarSet[calendar.id].color = index; var calendarEl = Ext.get(this.id + '-x-calendar-' + calendar.id); if (calendarEl) { this.changeCalendarColor(calendarEl, oldColor, calendar.color); } var mainBody = this.mainPanel.body; var events = Ext.DomQuery.select('.' + this.id + '-x-calendar-' + calendar.id + '-event', mainBody.dom); if (events) { for (var i = 0, len = events.length; i < len; i++) { var eEl = Ext.get(events[i]); this.changeEventColor(eEl, oldColor, calendar.color); } } var wholes = Ext.DomQuery.select('.' + this.id + '-x-calendar-' + calendar.id + '-whole', mainBody.dom); if (wholes) { for (var i = 0, len = wholes.length; i < len; i++) { var wEl = Ext.get(wholes[i]); this.changeWholeColor(wEl, oldColor, calendar.color); } } var legends = Ext.DomQuery.select('.' + this.id + '-x-calendar-' + calendar.id + '-legend', mainBody.dom); if (legends) { for (var i = 0, len = legends.length; i < len; i++) { var lEl = Ext.get(legends[i]); this.changeLegendColor(lEl, oldColor, calendar.color); } } var cview = this.mainPanel.calendarContainer.getLayout().activeItem; if (cview instanceof Ext.ux.calendar.ResultView) { cview.list.getView().refresh(); } this.fireEvent('changeCalendarColor', this, calendar, oldColor, calendar.color); } }, this); }, /* * For destory an Event and its Element */ freeEventEl: function(El) { El.remove(); }, pushDayCache: function(startDate, endDate) { var day = startDate.format('Y-m-d'); var date = startDate; var endDay = endDate.format('Y-m-d'); while (day <= endDay) { this.dayCache[day] = date; date = date.add(Date.DAY, 1); day = date.format('Y-m-d'); } }, isInDayCache: function(startDate, endDate) { var flag = true; var day = startDate.format('Y-m-d'); var date = startDate; var endDay = endDate.format('Y-m-d'); while (day <= endDay) { if (!this.dayCache[day]) { flag = false; break; } date = date.add(Date.DAY, 1); day = date.format('Y-m-d'); } return flag; }, bindEvent2Detail: function(cview, events, detailCt) { var html = ''; for (var i = 0, len = events.length; i < len; i++) { var e = events[i]; html += this.generateLegend(this, e); } detailCt.dom.innerHTML = html; for (var i = 0, len = detailCt.dom.childNodes.length; i < len; i++) { var e = Ext.apply({}, events[i]); var el = detailCt.dom.childNodes[i]; var El = Ext.get(el); El.bindEvent = e; El.cview = cview; } }, updateRepeatEvent: function(event, cview, oevent) { if ('string' == Ext.type(event.repeatType)) { var eps = oevent.repeatType.exceptions || {}; eps[oevent.day] = true; oevent.repeatType.exceptions = eps; } this.ds.createUpdateRepeatEvent(event, oevent, function(backObj) { var gLayout = this.calendarLayout; if (backObj.id) { event.eventId = backObj.id; } if ('string' == Ext.type(oevent.repeatType)) { this.deleteEventFromLayout(oevent, cview); gLayout.updateRepeatEventList(cview, [event], 'update'); } else if ('string' == Ext.type(event.repeatType)) { this.createEventToLayout(event, cview); if ('exception' == event.repeatType) { gLayout.updateRepeatEventList(cview, [oevent], 'update'); } else { gLayout.updateRepeatEventList(cview, [oevent], 'delete'); } } else { gLayout.updateRepeatEventList(cview, [event], 'update'); } this.fireEvent('changeEventCache', this); }, this); }, loadRepeatEvent: function(fn, scope) { this.ds.loadRepeatEvent(function(eventSet) { this.calendarLayout.repeatSet = eventSet; fn.call(scope); }, this); }, getStartDateInWeek: function(date, cview) { var sDate; if (1 == this.startDay) { var n = date.format('N'); sDate = date.add(Date.DAY, 1 - n); } else { var w = -date.format('w'); if ((5 == cview.dayNum && cview instanceof Ext.ux.calendar.DayView) || (5 == cview.colNum && cview instanceof Ext.ux.calendar.MonthView)) { w++; } sDate = date.add(Date.DAY, w); } return sDate; }, loadCalendar: function(ownedCt, sharedCt) { this.ds.loadCalendar(function(backObj) { var owned = backObj.owned; var shared = backObj.shared; this.calendarSet = {}; if (0 < owned.length || 0 < shared.length) { var calendar; for (var i = 0, len = owned.length; i < len; i++) { calendar = owned[i]; this.calendarSet[calendar.id] = calendar; } for (var i = 0, len = shared.length; i < len; i++) { calendar = shared[i]; this.calendarSet[calendar.id] = calendar; } this.loadRepeatEvent(function() { this.fireEvent('calendarloaded'); }, this); if (ownedCt) { this.renderOwnedCalendar(ownedCt); } if (sharedCt) { this.renderSharedCalendar(sharedCt); } } }, this); }, renderOwnedCalendar: function(container) { var cs = this.calendarSet; container.dom.innerHTML = ''; for (var q in cs) { var calendar = cs[q]; if (!calendar.isShared) { var cEl = this.createCalendar(container, null, null, calendar); if (calendar.hide) { this.hideCalendarColor(cEl, calendar.color); } } } }, renderSharedCalendar: function(container) { var cs = this.calendarSet; container.dom.innerHTML = ''; for (var q in cs) { var calendar = cs[q]; if (calendar.isShared) { var cEl = this.createCalendar(container, null, null, calendar); if (calendar.hide) { this.hideCalendarColor(cEl, calendar.color); } } } }, reloadCalendar: function(ownedCt, sharedCt, cflag) { this.dayCache = {}; this.calendarLayout.layoutSet = {}; this.calendarLayout.wholeList = []; if (cflag) { this.loadCalendar(ownedCt, sharedCt); } else { this.loadRepeatEvent(function() { this.fireEvent('calendarloaded'); }, this); } } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.DayView = Ext.extend(Ext.ux.calendar.BasicView, { createByDblclick: false, hideInactiveRow: false, activeStartRow: 0, activeEndRow: 48, startRow: 0, endRow: 48, cls: 'x-dayview-ct', lineNum: 3, border: false, weekNum: 1, dayNum: 1, dayFormat: 'm/d(D)', thin: 4, leftWidth: 70, scrollOffset: 17, offsetPercent: 0.1, headerHeight: 30, rowHeight: 26, poolMaxDepth: 4, poolDepth: 0, generateCSS: function() { var cssText = '.' + this.id + '-x-dayview-viewer-row-height{}' + '.' + this.id + '-x-dayview-pool{overflow:hidden;}' + '.' + this.id + '-x-dayview-pool-height{}' + '.' + this.id + '-x-dayview-pool-width{}' + '.' + this.id + '-x-dayview-pool-viewer-width{}' + '.' + this.id + '-x-dayview-lefter-width{width:' + this.leftWidth + 'px;}'; var cid = Ext.id(); this.ss = Ext.util.CSS.createStyleSheet(cssText, cid); }, updateTimeline: function() { var now = new Date(); var day = now.format('Y-m-d'); for (var j = 0, len = this.daySet.length; j < len; j++) { if (day == this.daySet[j].format('Y-m-d')) { break; } } if (this.timelinePn && this.timeindexPn) { this.timeindexPn.removeClass('x-dayview-timeindex'); this.timelinePn.removeClass('x-dayview-timeline'); } if (j != len) { var col = j % this.dayNum; var h = parseInt(now.format('G')); var s = now.format('i'); if ('0' == s[0]) { s = s.slice(1); } var i = parseInt(s); var intervalSlot = this.intervalSlot; var numInHour = this.numInHour; var startRow = h * numInHour + Math.floor(i / intervalSlot); var r = i % intervalSlot; var pn = Ext.get(this.id + '-x-dayview-viewer-' + startRow + '-' + col); var lefter = Ext.get(this.id + '-x-dayview-lefter-' + startRow + '-0'); if (pn && lefter) { var p = Math.floor(r / intervalSlot * 100); pn.addClass('x-dayview-timeline'); pn.setStyle('background-position', '0% ' + p + '%'); lefter.addClass('x-dayview-timeindex'); lefter.setStyle('background-position', '0% ' + p + '%'); this.timelinePn = pn; this.timeindexPn = lefter; } } }, generateHTML: function(data) { this.generateCSS(); var lefter = ''; var hnum = this.numInHour; for (var i = this.startRow; i < this.endRow; i++) { lefter += ''; for (var j = 0; j < 1; j++) { var hour = Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, i, this.hourFormat); var rest = i % hnum; if (0 != rest && i != this.activeStartRow) { hour = '
    ' + '' + hour + '' + '
    '; } else { hour = '
    ' + '' + hour + '' + '
    '; } lefter += '' + hour + ''; } lefter += ''; } var viewer = ''; for (var i = this.startRow; i < this.endRow; i++) { viewer += ''; for (var j = 0; j < this.dayNum; j++) { viewer += '' + '
    ' + '
    ' + ''; } viewer += ''; } var port = '
    ' + '
    ' + '' + '' + '' + '' + '' + '
    ' + '' + lefter + '
    ' + '
    ' + '' + viewer + '
    ' + '
    ' + '
    ' + '
    '; var days = ''; this.dayTpl = new Ext.XTemplate( '' + '' + '
    {day}
    ' + '' + '
    ' ); var d = []; for (var j = 0; j < this.dayNum; j++) { d[d.length] = { idx: j, day: this.daySet[j].format(this.dayFormat) }; } days = this.dayTpl.apply(d); var week = this.daySet[0].getWeekOfYear(); if (1 == this.dayNum) { week = '' + week + ''; } else { week = '' + week + ''; } var header = '
    ' + '' + '' + '' + '' + '' + '' + '
    ' + '
    ' + week + '
    ' + '
    ' + '' + '' + days + '' + '
    ' + '
    ' + '
    ' + '
    '; var bg = ''; for (var i = 0; i < this.dayNum; i++) { bg += ' '; } bg = '' + '' + bg + '' + '
    '; var pool = '
    ' + '' + '' + '' + '' + '' + '
    ' + '
    ' + '
    ' + '
    ' + bg + '' + '' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    '; var html = header + pool + port; return html; }, setToday: function() { var today = (new Date()).format('Y-m-d'); var len = this.daySet.length; var t; for (var i = 0; i < len; i++) { var day = this.daySet[i].format('Y-m-d'); if (day === today) { t = i; break; } } for (var i = 0; i < this.dayNum; i++) { var pbk = Ext.get(this.id + '-x-dayview-bg-0-' + i); if (pbk) { pbk.setStyle('background-color', 'white'); } } var flag = (false != Ext.type(t)); if (flag) { var pbk = Ext.get(this.id + '-x-dayview-bg-0-' + t); if (pbk) { pbk.setStyle('background-color', 'rgb(255,255,214)'); } } for (var i = this.activeStartRow; i < this.activeEndRow; i++) { for (var j = 0; j < this.dayNum; j++) { var div = Ext.get(this.id + '-x-dayview-viewer-' + i + '-' + j); if (div) { var td = Ext.get(div.dom.parentNode); if (flag && j == t) { td.setStyle('background-color', 'rgb(255,255,214)'); } else { td.setStyle('background-color', 'white'); } } } } }, getStartDate: function(date) { var sDate; if (1 == this.dayNum) { sDate = date; } else if (5 == this.dayNum) { var n = date.format('N'); if (7 == n) { n = 0; } n = 1 - n; sDate = date.add(Date.DAY, n); } else { if (1 == this.startDay) { var n = date.format('N'); n = 1 - n; sDate = date.add(Date.DAY, n); } else { var w = date.format('w'); sDate = date.add(Date.DAY, -w); } } return sDate; }, initComponent: function() { this.id = Ext.id(); this.daySet = []; this.ehandler.applyCalendarSetting(this); var sDate = this.getStartDate(new Date()); for (var i = 0, len = this.dayNum; i < len; i++) { this.daySet[this.daySet.length] = sDate.add(Date.DAY, i); } this.html = this.generateHTML(); Ext.ux.calendar.DayView.superclass.initComponent.call(this); this.addEvents( 'checklayout', 'sizechanged', 'afterresize', 'beforeremoteload', 'remoteload', 'canceldetail', 'viewDay', 'viewWeek' ); this.on('afterrender', this._onAfterRenderFn, this); this.on('checklayout', this.checkLayout, this); this.on('canceldetail', this.onCancelDetailFn, this); this.on('afterlayout', this._onReSizingFn, this); this.on('bodyresize', this._onReSizingFn, this); this.on('sizechanged', this.onSizeChangedFn, this, { buffer: 50 }); Ext.EventManager.on(document, 'mouseup', this._onMouseUpFn, this); }, _onReSizingFn: function() { this.fireEvent('sizechanged'); }, onSizeChangedFn: function() { this.handleResize(this.body.getWidth(), this.body.getHeight()); }, onCancelDetailFn: function() { if (this.detailing) { this.detailing = false; this.detailCt.setStyle('display', 'none'); } }, resetDragEventEl: function() { if (this.dragEventEl) { var eh = this.ehandler; delete (this.dragEventEl.row); delete (this.dragEventEl); delete (this.moving); eh.floating = false; } }, resetPrepareEl: function() { if (this.preEl) { var eh = this.ehandler; eh.showEditor(this.preEl, this, 'add'); delete (this.preEl); } }, resetSCover: function() { delete (this.startPos); delete (this.endPos); this.hideSCovers(); }, endDragEventEl: function(coverEl, e) { var cview = coverEl.cview; var eh = this.ehandler; eh.floating = false; var event = coverEl.bindEvent; var col = coverEl.col; var nol = coverEl.nol; if (false == Ext.type(nol)) { nol = col; coverEl.nol = nol; } var row = coverEl.row || event.startRow; var slot = event['endRow'] - event['startRow']; if (nol == col) { event['startRow'] = row; event['endRow'] = row + slot; if ('string' == Ext.type(event.repeatType)) { eh.updateEvent(event, cview, col); } else { var oevent = Ext.apply({}, event); event.repeatType = 'exception'; oevent.startRow = oevent.oldStartRow; oevent.endRow = oevent.oldEndRow; eh.updateRepeatEvent(event, this, oevent); } } else { var oevent = Ext.apply({}, event); event.startRow = row; event.endRow = row + slot; var day = cview.daySet[nol]; var dnum = Ext.ux.calendar.Mask.getDayOffset(event.day, event.eday); event.day = day.format('Y-m-d'); day = day.add(Date.DAY, dnum); event.eday = day.format('Y-m-d'); if ('string' == Ext.type(oevent.repeatType)) { eh.ds.updateEvent(event, function() { var layout = eh.calendarLayout.getLayout(cview.daySet[col], cview); var rs = layout.updateLayout(oevent, 'delete'); eh.renderEvent(cview, rs.elist, col); layout = eh.calendarLayout.getLayout(day, cview); rs = layout.updateLayout(event, 'add'); eh.renderEvent(cview, rs.elist, nol); eh.fireEvent('changeEventCache', eh); }, this); } else { event.repeatType = 'exception'; oevent.startRow = oevent.oldStartRow; oevent.endRow = oevent.oldEndRow; eh.updateRepeatEvent(event, this, oevent); } } }, endResizeEventEl: function(eventEl) { var eh = this.ehandler; eh.floating = false; var event = eventEl.bindEvent; if ('string' == Ext.type(event.repeatType)) { eh.updateEvent(event, this, eventEl.col); } else { var oevent = Ext.apply({}, event); event.repeatType = 'exception'; oevent.startRow = oevent.oldStartRow; oevent.endRow = oevent.oldEndRow; eh.updateRepeatEvent(event, this, oevent); } }, _onMouseUpFn: function(e) { var eh = this.ehandler; this.resetPrepareEl(); if (this.dragEventEl && this.moving) { this.endDragEventEl(this.dragEventEl, e); } this.resetDragEventEl(); if (!this.dragging) { if (this.startPos) { var spos = Ext.apply({}, this.startPos), epos = Ext.apply({}, this.endPos); this.startPos = null; eh.prepareLegend(Ext.get(this.id + '-x-dayview-bg-0-' + epos.y), spos, epos, this); } } if (this.resizeEventEl) { this.endResizeEventEl(this.resizeEventEl); } this.resetResizeEventEl(); }, getCellIndex: function(cellId) { var parts = cellId.toString().split('-'); var len = parts.length; var colIndex = parts[len - 1]; var rowIndex = parts[len - 2]; return { x: parseInt(rowIndex), y: parseInt(colIndex) }; }, _onAfterRenderFn: function(p) { this.initEls(); this.setToday(); }, _onPortClickFn: function(e) { var eh = this.ehandler; var target = e.getTarget(); var tgEl = Ext.get(target); if (tgEl.hasClass('x-event-pin')) { if (tgEl.hasClass('x-calendar-event-pin-off')) { tgEl.removeClass('x-calendar-event-pin-off'); tgEl.addClass('x-calendar-event-pin-on'); eh.editDisabled = true; } else { tgEl.removeClass('x-calendar-event-pin-on'); tgEl.addClass('x-calendar-event-pin-off'); eh.editDisabled = false; } } else { var cEl; if (tgEl.hasClass('x-event-content-link')) { cEl = tgEl.parent('.x-event-cover'); if (!cEl.bindEvent.locked) { eh.showEditor(cEl, this, 'update'); } } else { if (tgEl.hasClass('x-event-cover')) { cEl = tgEl; } else { cEl = tgEl.parent('.x-event-cover'); } if (cEl) { eh.setEditingStatus(cEl, true, false); } } } }, _onPortMouseOverFn: function(e) { var target = e.getTarget(); var tgEl = Ext.get(target); var flag = false; if (tgEl.hasClass('x-event-cover')) { flag = true; } else if ((tgEl = tgEl.parent('.x-event-cover'))) { flag = true; } if (flag) { var eh = this.ehandler; if (!eh.editDisabled) { eh.setEditingStatus(tgEl, true); } } }, _onBodyClickFn: function(e) { var data = {}; var target = e.getTarget(); var tgEl = Ext.get(target); var eh = this.ehandler; if (tgEl.hasClass('x-dayview-pool-collapse')) { tgEl.removeClass('x-dayview-pool-collapse'); tgEl.addClass('x-dayview-pool-expand'); this.lineNum = Math.floor(this.body.getHeight() / 17) - 5; this.checkLayout(Ext.isIE); } else if (tgEl.hasClass('x-dayview-pool-expand')) { tgEl.addClass('x-dayview-pool-collapse'); tgEl.removeClass('x-dayview-pool-expand'); this.lineNum = 3; this.checkLayout(Ext.isIE); } else if (tgEl.hasClass('x-event-detail-tool-close')) { this.fireEvent('canceldetail'); } else { var titleEl; // TRAKKWARE data = tgEl.bindEvent; if (tgEl.hasClass('x-event-title-default')) { titleEl = tgEl; } else { titleEl = tgEl.parent('.x-event-title-default'); if (!titleEl) { titleEl = tgEl.parent('.x-event-content-default'); } } if (titleEl) { var lEl = titleEl.parent('.x-calendar-event'); data = lEl.bindEvent; } // END TRAKKWARE if (!this.readOnly && (tgEl.hasClass('x-whole-title-b') || tgEl.hasClass('x-legend-title-b'))) { var wEl = tgEl.parent('.x-whole-cover'); if (wEl && !wEl.bindEvent.locked) { eh.showEditor(wEl, this, 'update'); } } else if (tgEl.hasClass('x-dayview-header-day-link')) { var pos = this.getCellIndex(tgEl.dom.id); var day = this.daySet[pos.y]; this.fireEvent('viewDay', this, day); } else if (tgEl.hasClass('x-dayview-wn-link')) { var sdate = this.daySet[0]; this.fireEvent('viewWeek', sdate, sdate); } } // Only show an event if one was actually clicked on. if (data) { var id = data.eventId; if (Ext.isDefined(id)) { Trakkware.ViewFramework.launchView({ view: 'Trakkware.Common.NopCommerce.Views.CommerceEventCalendarDetailView, Trakkware.Common.NopCommerce', command: 'POPULATE', viewParams: { EventOccurrenceID: id }, launch: 'window', width: 500, height: 500, header: true, title: eh.subject, ControlID: eh.ControlID }); } } return; }, _onBodyContextMenuFn: function(e) { e.stopEvent(); var eh = this.ehandler; var target = e.getTarget(); var tgEl = Ext.get(target); if (!tgEl.hasClass('x-calendar-event')) { tgEl = tgEl.parent('.x-calendar-event'); } if (tgEl) { eh.showContextMenu(e, tgEl); this.menu.hide(); } else if (this.createByDblclick) { var pvEl = Ext.get(target); ; if (!pvEl.hasClass('x-dayview-pool-viewer')) { pvEl = pvEl.parent('.x-dayview-pool-viewer') } if (pvEl) { this.menu.pn = this.calculatePos(e); this.menu.showAt(e.getXY()); eh.cmenu.hide(); } } }, _onBodyDblclickFn: function(e) { var eh = this.ehandler; var target = e.getTarget(); var tgEl = Ext.get(target); if (!tgEl.hasClass('x-calendar-event')) { tgEl = tgEl.parent('.x-calendar-event'); } if (tgEl && !tgEl.bindEvent.locked) { eh.showEditor(tgEl, this, 'update'); } else if (this.createByDblclick) { var pvEl = Ext.get(target); if (!pvEl.hasClass('x-dayview-pool-viewer')) { pvEl = pvEl.parent('.x-dayview-pool-viewer') } if (pvEl) { var pos = this.calculatePos(e); var epos = Ext.apply({}, pos); this.selectRange(pos, epos); this.startPos = null; eh.prepareLegend(Ext.get(this.id + '-x-dayview-bg-0-' + pos.y), pos, epos, this); } } }, resetResizeEventEl: function() { if (this.resizeEventEl) { delete (this.resizeEventEl); } }, _onPortMouseDownFn: function(e) { e.stopEvent(); this.fireEvent('hideeditor'); this.fireEvent('canceldetail'); if (0 == e.button) { var target = e.getTarget(); var tgEl = Ext.get(target); var eh = this.ehandler; if (tgEl.hasClass('x-dayview-viewer-cell')) { if (!this.createByDblclick) { this.preEl = eh.prepareEvent(tgEl, this); this.preEl.base = this.preEl.bindEvent.startRow; eh.setEditingStatus(this.preEl, true); eh.floating = true; } } else if (tgEl.hasClass('x-event-bottom-default')) { var eEl = tgEl.parent('.x-event-cover'); var event = eEl.bindEvent; if (!event.locked) { event.oldStartRow = event.startRow; event.oldEndRow = event.endRow; this.resizeEventEl = eEl; } else { this.resetResizeEventEl(); } } else if (!tgEl.hasClass('x-event-pin') && !tgEl.hasClass('x-event-content-link')) { delete (this.preEl); var eEl = tgEl; if (!eEl.hasClass('x-event-cover')) { eEl = tgEl.parent('.x-event-cover'); } if (eEl) { var event = eEl.bindEvent; if (!event.locked) { event.oldStartRow = event.startRow; event.oldEndRow = event.endRow; eEl.span = event.endRow - event.startRow; this.dragEventEl = eEl; } else { this.resetDragEventEl(); } } } } }, movePrepareEl: function(prepareEl, e) { var event = prepareEl.bindEvent; var base = prepareEl.base; var baseEl = Ext.get(this.id + '-x-dayview-viewer-' + base + '-0'); var top = baseEl.getTop(); var bottom = baseEl.getBottom(); var y = e.getXY()[1]; if (y >= top) { var h = y - top; var plot = Math.round(h / 26); h = plot * 26; event.startRow = base; event.endRow = base + plot + 1; if (this.endRow < event.endRow) { event.endRow = this.endRow; h = 26 * (this.endRow - base - 1); } prepareEl.contentEl.setHeight(h); prepareEl.titleEl.dom.innerHTML = '' + this.ehandler.generateTitle(event) + ''; prepareEl.setY(top); } else { var h = bottom - y; var plot = Math.round(h / 26); h = plot * 26; event.startRow = base - plot; event.endRow = base + 1; if (this.startRow > event.startRow) { event.startRow = this.startRow; h = 26 * (event.endRow - event.startRow - 1); } prepareEl.contentEl.setHeight(h); prepareEl.titleEl.dom.innerHTML = '' + this.ehandler.generateTitle(event) + ''; var t = bottom - prepareEl.getHeight(); prepareEl.setY(t); } }, resizingEventEl: function(eventEl, e) { eventEl.setStyle('cursor', 's-resize'); var event = eventEl.bindEvent; var eh = this.ehandler; eh.floating = true; var xy = e.getXY(); var bl = this.cbody.getLeft(); var fn = Ext.get(this.id + '-x-dayview-viewer-' + this.startRow + '-0'); var lt = fn.getXY(), cw = fn.getWidth(), ch = fn.getHeight() + 1; var y = xy[1] - lt[1]; var row = this.startRow + Math.ceil(y / ch); if (this.endRow < row) { row = this.endRow; } var r = (this.endRow == row) ? this.endRow - 1 : row; var pn = Ext.get(this.id + '-x-dayview-viewer-' + r + '-' + eventEl.col); var left = pn.getLeft() - bl; event.endRow = row; if (this.endRow < event.endRow) { event.endRow = this.endRow; } if (event.endRow <= event.startRow) { event.endRow = event.startRow + 1; } var h = ch * (event.endRow - event.startRow) - 24; eventEl.setStyle('left', left + 'px'); eventEl.setStyle('width', cw + 'px'); eventEl.contentEl.setHeight(h); eventEl.titleEl.dom.innerHTML = '' + eh.generateTitle(event) + ''; eh.setEditingStatus(eventEl, true); }, moveEventEl: function(eventEl, e) { var eh = this.ehandler; var xy = e.getXY(); var bl = this.cbody.getLeft(), bt = this.cbody.getTop(); var fn = Ext.get(this.id + '-x-dayview-viewer-' + this.startRow + '-0'); var lt = fn.getXY(), cw = fn.getWidth(), ch = fn.getHeight() + 1; var x = xy[0] - lt[0], y = xy[1] - lt[1]; var row = this.startRow + Math.ceil(y / ch), col = Math.floor(x / cw); row -= 1; if (this.startRow > row) { row = this.startRow; } else if (this.endRow <= row) { row = this.endRow - 1; } if (0 > col) { col = 0; } else if (this.dayNum <= col) { col = this.dayNum - 1; } var pn = Ext.get(this.id + '-x-dayview-viewer-' + row + '-' + col); var left = pn.getLeft() - bl; var top = pn.getTop() - bt; eventEl.setStyle('left', left + 'px'); eventEl.setStyle('top', top + 'px'); eventEl.setStyle('width', cw + 'px'); eh.floating = true; eh.setEditingStatus(eventEl, true); var event = eventEl.bindEvent; var span = eventEl.span || event['endRow'] - event['startRow']; event['startRow'] = row; event['endRow'] = event['startRow'] + span; if (this.endRow - 1 < event['startRow']) { event['startRow'] = this.endRow - 1; } if (this.endRow < event['endRow']) { event['endRow'] = this.endRow; } var h = 26 * (event.endRow - event.startRow - 1); eventEl.contentEl.setHeight(h); eventEl.titleEl.dom.innerHTML = '' + eh.generateTitle(event) + ''; eventEl.nol = col; eventEl.row = row; }, _onPortMouseMoveFn: function(e) { if (0 == e.button) { if (this.preEl) { this.movePrepareEl(this.preEl, e); } else if (this.dragEventEl) { this.moving = true; this.moveEventEl(this.dragEventEl, e); } else if (this.resizeEventEl) { this.resizingEventEl(this.resizeEventEl, e); } } else { this.resetResizeEventEl(); this.resetDragEventEl(); this.resetPrepareEl(); } }, initEls: function() { this.port = Ext.get(this.id + '-x-dayview-port'); this.cbody = Ext.get(this.id + '-x-dayview-body'); this.lefter = Ext.get(this.id + '-x-dayview-lefter'); this.cheader = Ext.get(this.id + '-x-dayview-header'); this.cpool = Ext.get(this.id + '-x-dayview-pool'); this.cptable = Ext.get(this.id + '-x-dayview-pool-ct'); this.pviewer = Ext.get(this.id + '-x-dayview-pool-viewer'); this.pswitch = Ext.get(this.id + '-x-dayview-pool-switch'); this.port.un('mouseover', this._onPortMouseOverFn, this); this.port.on('mouseover', this._onPortMouseOverFn, this); this.body.un('mousedown', this._onBodyMouseDownFn, this); this.body.on('mousedown', this._onBodyMouseDownFn, this); this.body.un('click', this._onBodyClickFn, this); this.body.on('click', this._onBodyClickFn, this); if (!this.ehandler.readOnly) { this.body.un('contextmenu', this._onBodyContextMenuFn, this); this.body.un('dblclick', this._onBodyDblclickFn, this); this.body.un('mousemove', this._onBodyMouseMoveFn, this); this.port.un('mousedown', this._onPortMouseDownFn, this); this.port.un('mousemove', this._onPortMouseMoveFn, this); this.body.on('mousemove', this._onBodyMouseMoveFn, this); this.body.on('contextmenu', this._onBodyContextMenuFn, this); this.body.on('dblclick', this._onBodyDblclickFn, this); this.port.on('mousedown', this._onPortMouseDownFn, this); this.port.on('mousemove', this._onPortMouseMoveFn, this); if (this.createByDblclick) { this.port.un('dblclick', this._onPortDblclickFn, this); this.port.on('dblclick', this._onPortDblclickFn, this); } this.port.un('click', this._onPortClickFn, this); this.port.un('contextmenu', this._PortContextMenuFn, this); this.port.on('click', this._onPortClickFn, this); this.port.on('contextmenu', this._PortContextMenuFn, this); this.initMenu(); if (1 < this.dayNum) { this.initDragZone(this.body); } } this.initSelectCover(); this.initDetailCt(); }, _PortContextMenuFn: function(e) { e.preventDefault(); var target = e.getTarget(); var tgEl = Ext.get(target); if (tgEl.hasClass('x-dayview-viewer-cell')) { this.menu.pn = tgEl; this.menu.showAt(e.getXY()); this.ehandler.cmenu.hide(); } }, initMenu: function() { var lan = Ext.ux.calendar.Mask.DayView; this.addItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_event_add', text: lan['addItem.text'], handler: this.onAddFn, scope: this }); this.menu = new Ext.menu.Menu({ items: [ this.addItem ] }); this.menu = Ext.menu.MenuMgr.get(this.menu); }, onAddFn: function(item) { var pn = item.parentMenu.pn; if (pn) { if (pn instanceof Ext.Element) { this.addEvent2Row(pn); } else { this.startPos = pn; this.endPos = pn; this.ehandler.prepareLegend(null, this); } } }, addEvent2Row: function(pn) { var eh = this.ehandler; eh.floating = true; this.preEl = eh.prepareEvent(pn, this); this.preEl.base = this.preEl.bindEvent.startRow; eh.showEditor(this.preEl, this, 'add'); eh.floating = false; delete (this.preEl); }, _onPortDblclickFn: function(e) { var target = e.getTarget(); var tgEl = Ext.get(target); var eh = this.ehandler; if (tgEl.hasClass('x-dayview-viewer-cell')) { this.addEvent2Row(tgEl); } }, initDetailCt: function() { var eh = this.ehandler; var html = eh.detailTpl.apply({}); this.detailCt = Ext.DomHelper.append(this.body, html, true); this.detailCt.setStyle('display', 'none'); this.detailTitle = this.detailCt.child('.x-event-detail-title-td'); this.detailViewer = this.detailCt.child('.x-event-detail-viewer'); this.detailFoot = this.detailCt.child('.x-event-detail-foot-text'); }, initDragZone: function(bindEl) { var proxy = new Ext.dd.StatusProxy({ dropNotAllowed: 'x-dd-drop-ok' }); bindEl.dragzone = new Ext.dd.DragZone(bindEl, { cview: this, ddGroup: 'x-mycalendar', proxy: proxy, onStartDrag: function() { this.cview.dragging = true; (function() { var event = this.dragData.bindEvent; var arr = Ext.DomQuery.select('div[name=x-event-' + event.day + '-' + event.eday + '-' + event.eventId + ']', this.cview.body.dom); for (var i = 0, len = arr.length; i < len; i++) { Ext.get(arr[i]).setOpacity(0.3); } }).defer(1, this); }, getDragData: function(e) { var target = e.getTarget(); var tgEl = Ext.get(target); if (!tgEl.hasClass('x-calendar-event')) { tgEl = tgEl.parent('.x-calendar-event'); } if (tgEl) { var event = tgEl.bindEvent; if (!event.locked) { var ddel = tgEl.dom.cloneNode(true); var w = tgEl.getWidth(); if (200 < w) { ddel.style.width = '200px'; } else { ddel.style.width = w + 'px'; } return { ddel: ddel, bindEvent: event }; } } return false; }, getRepairXY: function() { return null; }, onDrag: function(e) { var event = this.dragData.bindEvent; var cview = this.cview; var eh = cview.ehandler; var span = Ext.ux.calendar.Mask.getDayOffset(event.day, event.eday); var pos = cview.calculatePos(e); var epos = cview.addSpan2Pos(pos, span); cview.selectRange(pos, epos); }, endDrag: function(e) { var event = this.dragData.bindEvent; var oevent = Ext.apply({}, event); var cview = this.cview; var spos = cview.startPos; var eh = cview.ehandler; var dnum = Ext.ux.calendar.Mask.getDayOffset(event.day, event.eday); var date = cview.daySet[spos.y]; var day = date.format('Y-m-d'); if (event.day != day) { event.eday = date.add(Date.DAY, dnum).format('Y-m-d'); event.day = day; delete (cview.startPos); if ('string' == Ext.type(event.repeatType)) { eh.updateEvent(event, cview, spos.y); } else { event.repeatType = 'exception'; eh.updateRepeatEvent(event, cview, oevent); } } else { var arr = Ext.DomQuery.select('div[name=x-event-' + event.day + '-' + event.eday + '-' + event.eventId + ']', this.cview.body.dom); for (var i = 0, len = arr.length; i < len; i++) { var eEl = Ext.get(arr[i]); eEl.setOpacity(1); } } cview.dragging = false; cview.resetSCover(); cview.fireEvent('canceldetail'); } }); }, addSpan2Pos: function(pos, span) { var o = Ext.apply({}, pos); o.y += span; if (o.y >= this.dayNum) { o.y = this.dayNum - 1; } return o; }, alignDetailCt: function() { if (this.detailing) { var x = this.detailing.x, y = this.detailing.y, events = this.detailing.events; this.detailCt.setStyle('display', ''); var cEl = Ext.get(this.id + '-x-dayview-bg-' + x + '-' + y); var h = events.length * 17, mh = this.port.getBottom() - cEl.getTop() - 30; var roffset = this.port.getRight() - cEl.getRight(); var hpos; var offset = [0, 0]; if (h > mh) { this.detailViewer.setHeight(mh); } else { this.detailViewer.setStyle('height', ''); } if (1 < this.dayNum && roffset < this.detailCt.getWidth()) { hpos = 'r'; offset[0] = -1; } else { hpos = 'l'; } var cw = cEl.getWidth(); if (200 < cw) { this.detailCt.setWidth(cw); } else { this.detailCt.setWidth(200); } var str = 't' + hpos; this.detailCt.alignTo(cEl, str + '-' + str, offset); } }, showDetails: function(day) { var lan = Ext.ux.calendar.Mask.DayView; var eh = this.ehandler; var glayout = eh.calendarLayout; var events = glayout.getWholeList(this, day, false, true); var index = this.getIndexFromDay(day); var x = 0; var y = index % this.shiftDay; this.detailing = { x: x, y: y, events: events }; this.detailTitle.dom.innerHTML = '' + day + ''; this.detailFoot.dom.innerHTML = events.length + ' ' + lan['events']; eh.bindEvent2Detail(this, events, this.detailViewer); this.alignDetailCt(); }, _onBodyMouseDownFn: function(e) { e.stopEvent(); this.fireEvent('hideeditor'); var target = e.getTarget(); var tgEl = Ext.get(target); var eEl; if (tgEl.hasClass('x-event-more')) { var day = tgEl.dom.getAttribute('name'); this.showDetails(day); } else { if (this.detailing) { if (!(tgEl.hasClass('x-event-detail-ct') || tgEl.parent('.x-event-detail-ct'))) { this.fireEvent('canceldetail'); } else { return; } } if (!this.createByDblclick && !this.ehandler.readOnly) { if (tgEl.hasClass('x-calendar-event')) { eEl = tgEl; } else { eEl = tgEl.parent('.x-calendar-event'); } if (!eEl) { eEl = tgEl.parent('.x-dayview-pool-viewer'); if (eEl) { var pos = this.calculatePos(e); this.selectRange(pos, pos); } } } } }, calculatePos: function(e) { var xy = e.getXY(); var lt = this.pviewer.getXY(); var y = Math.floor((xy[0] - lt[0]) / this.cw); if (0 > y) { y = 0; } else if (y >= this.dayNum) { y = this.dayNum - 1; } return { x: 0, y: y }; }, _onBodyMouseMoveFn: function(e) { if (0 == e.button) { if (this.startPos) { var pos = this.calculatePos(e); this.selectRange(null, pos); } } else { this.resetSCover(); } }, hideSCovers: function() { this.scover.dom.style.display = 'none'; }, selectRange: function(spos, epos) { this.hideSCovers(); if (spos) { this.startPos = spos; } else { spos = this.startPos; } this.endPos = epos; var sy, ey; if (this.startPos.y > this.endPos.y) { sy = this.endPos.y; ey = this.startPos.y; } else { ey = this.endPos.y; sy = this.startPos.y; } var cw = this.cw; var ch = this.pviewer.getHeight(); var w, l = cw * sy; var sc = this.scover; sc.dom.style.display = ''; w = cw * (ey - sy + 1); sc.setWidth(w); sc.setHeight(ch); sc.setLeft(l + 'px'); sc.setTop('0px'); }, initSelectCover: function() { var div = document.createElement('div'); div.className = 'x-event-select-cover'; div = Ext.get(div); this.pviewer.appendChild(div); this.scover = div; }, resizePort: function(relayout) { var bh = this.body.getHeight(); var ph = this.cpool.getHeight(); var ah = bh - this.cheader.getHeight() - ph - 1; if (ah != this.port.getHeight()) { this.port.setHeight(ah); } if (true == relayout) { var eh = this.ehandler; var glayout = eh.calendarLayout; for (var i = 0, len = this.dayNum; i < len; i++) { var layout = glayout.getLayout(this.daySet[i], this); if (layout) { var rs = layout.reLayout(); eh.renderEvent(this, rs.elist, i); } } this.adjustScroller(); } }, handleResize: function(bw, bh, still) { if (typeof bw == 'number') { this.cheader.setWidth(bw); if (!Ext.isIE) { bw -= 2; } var pw = bw - this.scrollOffset; var r = pw % 7; this.leftWidth = 70 + r; Ext.util.CSS.updateRule('.' + this.id + '-x-dayview-lefter-width', 'width', this.leftWidth + 'px'); this.port.setWidth(bw); bw = pw - this.leftWidth; this.cw = Math.round(bw / this.dayNum); } if (typeof bh == 'number') { this.resizePort(true); } this.alignDetailCt(); this.updateTimeline(); this.fireEvent('afterresize', this, bw, bh); }, adjustScroller: function() { if (!this.hideInactiveRow) { var rh = Ext.get(this.id + '-x-dayview-viewer-' + this.activeStartRow + '-0'); rh = Ext.get(rh.dom.parentNode); this.port.dom.scrollTop = rh.getHeight() * this.activeStartRow; } }, checkLayout: function(force, refresh) { var eh = this.ehandler; var startDate = this.daySet[0]; var endDate = this.daySet[this.daySet.length - 1]; if (eh.isInDayCache(startDate, endDate) && !refresh) {/* if it in the eventCache, we don't need request server*/ var glayout = eh.calendarLayout; var layoutSet = {}; var whole = {}; for (var i = 0, len = this.dayNum; i < len; i++) { var day = this.daySet[i].format('Y-m-d'); var layout = glayout.getLayout(day, this); whole[day] = glayout.getWholeList(this, day); if (true !== layout.visited[this.id] || force) { layoutSet[i] = layout; this.cleanup(i); } } glayout.showWeek(this, this.cptable.dom.firstChild, 0, whole, true); this.resizePort(); for (var p in layoutSet) { var layout = layoutSet[p]; var rs = layout.reLayout(false, true); eh.renderEvent(this, rs.elist, p); } this.adjustScroller(); } else { this.fireEvent('beforeremoteload'); this.cleanup(); eh.ds.loadEvent(startDate, endDate, function(eventSet) { var glayout = eh.calendarLayout; var wlist = eventSet['whole']; glayout.updateWholeList(wlist, 'add'); this.showEvents(eventSet, refresh); eh.pushDayCache(startDate, endDate); this.adjustScroller(); if (this.firstTime) { this.firstTime = false; eh.checkExpireEvents(); } this.resizePort(Ext.isIE); this.fireEvent('remoteload'); }, this); } this.setToday(); this.updateTimeline(); }, showEvents: function(eventSet, refresh) { var whole = {}; var eh = this.ehandler; var glayout = eh.calendarLayout; for (var i = 0, len = this.dayNum; i < len; i++) { var day = this.daySet[i].format('Y-m-d'); var layout = glayout.getLayout(day, this, eventSet[day] || [], true, refresh); if (layout) { var rs = layout.reLayout(); eh.renderEvent(this, rs.elist, i); whole[day] = rs.wlist; } } glayout.showWeek(this, this.cptable.dom.firstChild, 0, whole, true); }, refreshLefter: function() { var hnum = this.numInHour; for (var i = 0; i < this.rowCount; i++) { for (var j = 0; j < 1; j++) { var hour = Ext.ux.calendar.Mask.getIntervalFromRow(this.intervalSlot, i, this.hourFormat); var rest = i % hnum; if (0 != rest && i != this.activeStartRow) { hour = '
    ' + '' + hour + '' + '
    '; } else { hour = '
    ' + '' + hour + '' + '
    '; } var hEl = Ext.get(this.id + '-x-dayview-lefter-' + i + '-' + j); if (hEl) { hEl.dom.firstChild.innerHTML = hour; } } } }, refreshDate: function() { for (var i = 0; i < this.dayNum; i++) { var titleEl = Ext.get(this.id + '-x-dayview-day-link-0-' + i); if (titleEl) { var day = this.daySet[i].format(this.dayFormat); titleEl.dom.innerHTML = day; } } var wEl = Ext.get(this.id + '-x-dayview-wn'); wEl.dom.innerHTML = this.daySet[0].getWeekOfYear(); }, resetView: function() { this.refreshDate(); this.setToday(); }, cleanup: function(col, pool) { if (!pool) { if (false == Ext.type(col)) { for (var i = 0; i < this.rowCount; i++) { for (var j = 0; j < this.dayNum; j++) { var El = Ext.get(this.id + '-x-dayview-viewer-' + i + '-' + j); if (El) { El.dom.innerHTML = ''; } } } } else { for (var i = 0; i < this.rowCount; i++) { var El = Ext.get(this.id + '-x-dayview-viewer-' + i + '-' + col); if (El) { El.dom.innerHTML = ''; } } } } if (this.cptable) { var tbody = this.cptable.dom.firstChild; while (0 < tbody.childNodes.length) { Ext.get(tbody.lastChild).remove(); } } }, getIndexFromDay: function(day) { for (var i = 0, len = this.daySet.length; i < len; i++) { var iday = this.daySet[i]; if (day == iday.format('Y-m-d')) { return i; } } }, locateDay: function(day) { var fd = this.getStartDate(day); this.daySet[0] = fd; for (var i = 1; i < this.dayNum; i++) { this.daySet[i] = fd.add(Date.DAY, i); } }, showDay: function(day) { this.locateDay(day); this.resetView(); this.checkLayout(true); }, goBack: function() { var shiftDay = this.shiftDay || this.dayNum; var dayNum = this.dayNum; var sdate = this.daySet[0]; var fdate = sdate.add(Date.DAY, -1 * shiftDay); var weekNum = this.weekNum || 1; this.daySet = []; for (var i = 0; i < weekNum; i++) { for (var j = 0; j < dayNum; j++) { this.daySet[this.daySet.length] = fdate.add(Date.DAY, i * shiftDay + j); } } this.resetView(); this.checkLayout(true); }, goNext: function() { var shiftDay = this.shiftDay || this.dayNum; var dayNum = this.dayNum; var sdate = this.daySet[0]; var fdate = sdate.add(Date.DAY, shiftDay); var weekNum = this.weekNum || 1; this.daySet = []; for (var i = 0; i < weekNum; i++) { for (var j = 0; j < dayNum; j++) { this.daySet[this.daySet.length] = fdate.add(Date.DAY, i * shiftDay + j); } } this.resetView(); this.checkLayout(true); }, isShift: function(startDate, endDate) { var maxmin, minmax; var day1 = startDate.format('Y-m-d'); var day2 = this.daySet[0].format('Y-m-d') if (day1 < day2) { maxmin = day2; } else { maxmin = day1; } day1 = endDate.format('Y-m-d'); day2 = this.daySet[this.daySet.length - 1].format('Y-m-d'); if (day1 > day2) { minmax = day2; } else { minmax = day1; } if (maxmin > minmax) { var sdate = this.getStartDate(startDate); this.daySet = []; for (var i = 0; i < this.weekNum; i++) { for (var j = 0; j < this.dayNum; j++) { this.daySet[this.daySet.length] = sdate.add(Date.DAY, i * this.shiftDay + j); } } return true; } else { return false; } }, showRange: function(startDate, endDate, force) { if (this.isShift(startDate, endDate)) { force = true; this.resetView(); } this.checkLayout(force); } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.ResultView = function(config) { Ext.apply(this, config); this.ehandler.applyCalendarSetting(this); this.pageSize = 20; var lan = Ext.ux.calendar.Mask.ResultView; var url = Trakkware.Handlers.MethodHandler + '?view=' + config.TrakkwareConfig.ViewName; var store = Ext.ux.calendar.Mask.getEventStore(url); // TRAKKWARE CHANGE: Added hidden:true to some columns. var columns = [ { header: '', hidden: true, sortable: true, menuDisabled: true, width: 20, dataIndex: 'calendarId', renderer: this.hiddenRenderFn.createDelegate(this) }, { header: '', hidden: true, sortable: true, menuDisabled: true, width: 20, dataIndex: 'locked', renderer: this.lockedRenderFn.createDelegate(this) }, { header: lan['cm.time'], dataIndex: 'ymd', sortable: true, width: 140, renderer: this.fromtoRenderFn.createDelegate(this) }, { header: lan['cm.calendar'], sortable: true, menuDisabled: true, width: 100, dataIndex: 'calendarId', renderer: this.calendarRenderFn.createDelegate(this) }, { header: lan['cm.subject'], sortable: true, width: 120, dataIndex: 'subject', renderer: this.subjectRenderFn }, { header: lan['cm.content'], sortable: true, width: 120, dataIndex: 'description', renderer: this.contentRenderFn }, { header: lan['cm.expire'], hidden: true, sortable: true, menuDisabled: true, width: 80, renderer: this.expireRenderFn.createDelegate(this) } ]; this.groupBtn = new Ext.Button({ iconCls: 'icon_feyaCalendar_group', text: lan['groupBtn.group.text'], handler: this.onGroupFn, scope: this }); this.returnBtn = new Ext.Button({ iconCls: 'icon_feyaCalendar_door_out', text: lan['returnBtn.text'], handler: this.onReturnFn, scope: this }); var pbar = new Ext.PagingToolbar({ pageSize: this.pageSize, store: store }); pbar.on('render', this.onPageToolbarRenderFn, this); this.list = new Ext.grid.GridPanel({ border: false, store: store, columns: columns, view: new Ext.grid.GroupingView({ forceFit: true }), loadMask: { msg: lan['loadMask.msg'] }, bbar: pbar }); Ext.ux.calendar.ResultView.superclass.constructor.call(this, { layout: 'fit', items: [this.list] }); this.on('render', this.onRenderFn, this); this.list.on('rowdblclick', this.onRowDblClickFn, this); this.list.on('rowclick', this.onRowClickFn, this); store.on('beforeload', this.onBeforeLoadFn, this); store.on('load', this.onLoadFn, this); store.clearGrouping(); }; Ext.extend(Ext.ux.calendar.ResultView, Ext.ux.calendar.BasicView, { onBeforeLoadFn: function(store) { store.removeAll(); }, onLoadFn: function(store, rds, options) { for (var i = 0, len = rds.length; i < len; i++) { var rd = rds[i]; var rt = rd.data.repeatType; if ('no' != rt && 'exception' != rt) { rd.data.repeatType = Ext.decode(rt); } } }, onGroupFn: function(btn) { var lan = Ext.ux.calendar.Mask.ResultView; var store = this.list.getStore(); if (lan['groupBtn.group.text'] == btn.getText()) { btn.setText(lan['groupBtn.unGroup.text']); btn.setIconClass('icon_feyaCalendar_ungroup'); store.groupBy('ymd'); } else { btn.setText(lan['groupBtn.group.text']); btn.setIconClass('icon_feyaCalendar_group'); store.clearGrouping(); } }, onReturnFn: function() { var calendarContainer = this.ownerCt; calendarContainer.getLayout().setActiveItem(calendarContainer.currentIdx); calendarContainer.currentView.checkLayout(true); }, onRenderFn: function(p) { p.port = p.body; }, onPageToolbarRenderFn: function(t) { t.add('->', this.groupBtn, '-', this.returnBtn); }, onRowClickFn: function(grid, rowIndex, e) { var target = e.getTarget(); var tgEl = Ext.get(target); var eh = this.ehandler; var store = grid.getStore(); var rd = store.getAt(rowIndex); var event = { eventId: rd.data.id, calendarId: rd.data.calendarId, startRow: parseInt(rd.data.startRow), endRow: parseInt(rd.data.endRow), subject: rd.data.subject, content: rd.data.description, day: rd.data.ymd, eday: rd.data.eymd, isShared: rd.data.isShared, alertFlag: rd.data.alertFlag, repeatType: rd.data.repeatType }; //TRAKKWARE CHANGES // Only show an event if one was actually clicked on. var id = rd.data.id; if (Ext.isDefined(id)) { Trakkware.ViewFramework.launchView({ view: 'Trakkware.Common.NopCommerce.Views.CommerceEventCalendarDetailView, Trakkware.Common.NopCommerce', command: 'POPULATE', viewParams: { EventOccurrenceID: id }, launch: 'window', width: 500, height: 500, header: true, title: eh.subject, ControlID: eh.ControlID }); } return; // TRAKKWARE CHANGES END HERE! var oevent = Ext.apply({}, event); if (tgEl.hasClass('x-calendar-resultview-lock')) { if (tgEl.hasClass('icon_feyaCalendar_event_lock')) { tgEl.removeClass('icon_feyaCalendar_event_lock'); tgEl.addClass('icon_feyaCalendar_event_unlock'); rd.set('locked', false); event['locked'] = false; } else if (tgEl.hasClass('icon_feyaCalendar_event_unlock')) { tgEl.removeClass('icon_feyaCalendar_event_unlock'); tgEl.addClass('icon_feyaCalendar_event_lock'); rd.set('locked', true); event['locked'] = true; } store.commitChanges(); var cc = this.ownerCt; var cview = cc.currentView; if ('string' == Ext.type(rd.data.repeatType)) { eh.updateEvent(event, cview); } else { eh.updateRepeatEvent(event, cview, oevent); } } }, onRowDblClickFn: function(grid, rowIndex, e) { // TRAKKWARE: Return from double clicks without doing anything. return; var cc = this.ownerCt; var cview = cc.currentView; var eh = this.ehandler; var store = grid.getStore(); var rd = store.getAt(rowIndex); if (!rd.data.locked) { var rowEl = grid.getView().getRow(rowIndex); if (rowEl) { rowEl = Ext.get(rowEl); rowEl.bindEvent = { eventId: rd.data.id, calendarId: rd.data.calendarId, startRow: parseInt(rd.data.startRow), endRow: parseInt(rd.data.endRow), subject: rd.data.subject, content: rd.data.description, day: rd.data.ymd, eday: rd.data.eymd, isShared: rd.data.isShared, alertFlag: rd.data.alertFlag, locked: rd.data.locked, repeatType: rd.data.repeatType }; rowEl.cview = cview; var obj = { bindEl: rowEl, cview: this, onLayout: function(event) { rd.set('calendarId', event.calendarId); rd.set('subject', event.subject); rd.set('description', event.content); rd.set('ymd', event.day); rd.set('eymd', event.eday); rd.set('isShared', event.isShared); rd.set('alertFlag', event.alertFlag); rd.set('locked', event.locked); rd.set('repeatType', event.repeatType); store.commitChanges(); }, action: 'update' } eh.editor.fireEvent('showdetailsetting', obj); } } }, calendarRenderFn: function(value, meta, rd, row, col, store) { var legendStyle = 'height:9px;'; var calendarId = rd.data.calendarId; var eh = this.ehandler; var calendar = eh.calendarSet[calendarId]; var html = eh.calendarTpl.apply({ 'calendarId': calendar.id, 'legend-style': legendStyle, 'title': calendar.name, 'color': calendar.color }); return html; }, fromtoRenderFn: function(value, meta, rd, row, col, store) { var data = rd.data; data.startRow = Ext.ux.calendar.Mask.getRowFromHM(rd.data.startTime, this.intervalSlot); data.endRow = Ext.ux.calendar.Mask.getRowFromHM(rd.data.endTime, this.intervalSlot); data.day = data.ymd; data.eday = data.eymd; var html = this.ehandler.generateInfo(data); return html; }, subjectRenderFn: function(value, meta, rd, row, col, store) { var html = value || ''; if ('' == html.trim()) { html = Ext.ux.calendar.Mask.ResultView['noSubject']; } return html; }, contentRenderFn: function(value, meta, rd, row, col, store) { var html = value || ''; if ('' == html.trim()) { html = Ext.ux.calendar.Mask.ResultView['noContent']; } return html; }, generateExpireHTML: function(data) { var lan = Ext.ux.calendar.Mask.ResultView; var hour = data.hour; var html; if (-1 == hour) { html = '
    ' + 'Out of date' + '
    '; } else if (0 <= hour && hour <= 24) { html = '
    ' + '' + hour + ' ' + lan['hour'] + '' + '
    '; } else if (24 < hour && hour <= 72) { html = '
    ' + '' + hour + ' ' + lan['hour'] + '' + '
    '; } else if (72 < hour) { html = '
    ' + '' + hour + ' ' + lan['hour'] + '' + '
    '; } return html; }, expireRenderFn: function(value, meta, rd, row, col, store) { var endRow = Ext.ux.calendar.Mask.getRowFromHM(rd.data.endTime, this.intervalSlot); var str = rd.data.ymd + ' ' + rd.data.endTime; var day = Date.parseDate(str, 'Y-m-d H:i'); if (this.rowCount == endRow) { day = day.add(Date.DAY, 1); str = day.format('Y-m-d H:i'); } var offset = day.getElapsed(); if ((new Date()).format('Y-m-d H:i') >= str) { return this.generateExpireHTML({ hour: -1 }); } else { var hour = Math.round(offset / 3600000); return this.generateExpireHTML({ hour: hour }); } }, hiddenRenderFn: function(value, meta, rd, row, col, store) { var html; var cs = this.ehandler.calendarSet; if (cs[rd.data.calendarId].hide) { html = '
    '; } else { html = '
    '; } return html; }, lockedRenderFn: function(value, meta, rd, row, col, store) { var html; if (rd.data.locked) { html = '
    '; } else { html = '
    '; } return html; }, loadEvents: function(text) { var store = this.list.getStore(); store.removeAll(); this.matchText = text; /* var load_config = { view: this.TrakkwareConfig.ViewName, command: 'SEARCH', JustResults: true, actionParams: { UserID: '981957F2-3B04-4992-9BD6-69E3B8060F12' }, ControlID: this.TrakkwareConfig.ControlID }; Trakkware.ViewFramework.performMethodCall(null, load_config, function(orig_config, backObj) { }); */ store.baseParams = { paramarray: Ext.encode({ SearchTerm: text, TagFilterID: this.TrakkwareConfig.TagFilterID, TagFilterGroupID: this.TrakkwareConfig.TagFilterGroupID }), userId: this.ehandler.mainPanel.userId, command: 'SEARCH' }; store.load({ params: { start: 0, limit: this.pageSize } }); }, checkLayout: function() { var store = this.list.getStore(); store.reload(); } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.MonthView = Ext.extend(Ext.ux.calendar.BasicView, { legendHeight: 17, border: false, dayFormat: 'm/d', templateRowNum: 6, weekNum: 5, dayNum: 7, rowNum: 6, colNum: 7, menuAlign: "tr-br?", poolDepth: 0, leftWidth: 25, showMenu: function(El) { if (this.menu) { this.menu.bindEl = El; this.menu.show(Ext.get(El.dom.parentNode), this.menuAlign); } return this; }, hideMenu: function() { if (this.menu) { this.menu.hide(); } return this; }, initMenu: function() { var lan = Ext.ux.calendar.Mask.MonthView; this.addItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_new', text: lan['addItem.text'], handler: this.onAddFn, scope: this }); this.clearItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_clear_event', text: lan['clearItem.text'], handler: this.onClearFn, scope: this }); this.cutItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_cut', text: lan['cutItem.text'], handler: this.onCutFn, scope: this }); this.copyItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_copy', text: lan['copyItem.text'], handler: this.onCopyFn, scope: this }); this.pasteItem = new Ext.menu.Item({ iconCls: 'icon_feyaCalendar_paste', text: lan['pasteItem.text'], handler: this.onPasteFn, scope: this }); this.menu = new Ext.menu.Menu({ items: [ this.addItem, this.clearItem, '-', this.cutItem, this.copyItem, this.pasteItem ] }); this.menu = Ext.menu.MenuMgr.get(this.menu); }, getCellIndex: function(cellId) { var parts = cellId.toString().split('-'); var len = parts.length; var colIndex = parts[len - 1]; var rowIndex = parts[len - 2]; return { x: parseInt(rowIndex), y: parseInt(colIndex) }; }, generateHTML: function(data) { this.generateCSS(); this.viewerTpl = new Ext.XTemplate( '
    ' + '' + '' + '' + '
    ' + '
    ' + '' + '
    ' + '{week}' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '' + '
    ' + '' + '' + '' + '' + '' + '' + '
     
    ' + '' + '' + '' + '' + '' + '' + '
    ' + '
    ' + '' + '' + (this.ehandler.readOnly ? '' : '') + '
    ' + '{day}' + '' + '' + '' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '' + '
    ' ); this.viewerTpl.compile(); var obj = []; var sdate = this.daySet[0]; var week = sdate.getWeekOfYear(); for (var i = 0; i < this.templateRowNum; i++) { var arr = []; for (var j = 0; j < this.dayNum; j++) { arr[arr.length] = { idx: j, day: (sdate.add(Date.DAY, i * this.dayNum + j)).format(this.dayFormat) }; } var w = (week + i) % 53; if (0 == w) { w = 53; } obj[obj.length] = { idx: i, week: w, arr: arr } } var viewer = this.viewerTpl.apply(obj); var days = ''; for (var j = 0; j < this.dayNum; j++) { days += '' + '
    ' + '' + Ext.ux.calendar.Mask.MonthView['dayPre'] + this.daySet[j].format('l') + '' + '
    ' + ''; } var header = '
    ' + '' + '' + days + '' + '
    ' + '
    '; var html = header + viewer; return html; }, generateCSS: function() { var cssText = '.' + this.id + '-x-monthview-viewer-row-height{}' + '.' + this.id + '-x-monthview-row{}' + '.' + this.id + '-x-monthview-viewer-list{}'; for (var i = 0; i < this.dayNum; i++) { cssText += '.' + this.id + '-x-monthview-viewer-col-' + i + '{}'; } var cid = Ext.id(); this.ss = Ext.util.CSS.createStyleSheet(cssText, cid); }, setToday: function() { var sdate = this.daySet[0]; var m = sdate.format('n'); if (1 != sdate.format('j')) { m = (m + 1) % 12; if (0 == m) m = 12; } var today = (new Date()).format('Y-m-d'); for (var i = 0, len = this.daySet.length; i < len; i++) { var day = this.daySet[i].format('Y-m-d'); var month = this.daySet[i].format('n'); if (day == today) { var x = Math.floor(i / this.dayNum); var y = i % this.dayNum; var tEl = Ext.get(this.id + '-x-monthview-viewer-title-' + x + '-' + y); if (tEl) { tEl.setStyle('background-color', 'rgb(255,255,200)'); } } else if (m != month) { var x = Math.floor(i / this.dayNum); var y = i % this.dayNum; var tEl = Ext.get(this.id + '-x-monthview-viewer-title-' + x + '-' + y); if (tEl) { tEl.setStyle('background-color', 'rgb(235,235,235)'); } } else { var x = Math.floor(i / this.dayNum); var y = i % this.dayNum; var tEl = Ext.get(this.id + '-x-monthview-viewer-title-' + x + '-' + y); if (tEl) { tEl.setStyle('background-color', 'rgb(241,244,250)'); } } } }, getStartDate: function(date) { var sDate; if (1 == this.startDay) { var n = date.format('N'); n = 1 - n; sDate = date.add(Date.DAY, n); } else { var w = date.format('w'); sDate = date.add(Date.DAY, -w); } return sDate; }, initComponent: function() { this.id = Ext.id(); this.ehandler.applyCalendarSetting(this); var today = new Date(); var first = today.getFirstDateOfMonth(); this.recalculateWeek(first); var sDate = this.getStartDate(first); this.daySet = []; for (var i = 0; i < this.weekNum; i++) { for (var j = 0; j < this.dayNum; j++) { this.daySet[this.daySet.length] = sDate.add(Date.DAY, i * this.shiftDay + j); } } this.html = this.generateHTML(); this.initMenu(); Ext.ux.calendar.MonthView.superclass.initComponent.call(this); this.addEvents( 'checklayout', 'afterresize', 'beforeremoteload', 'remoteload', 'canceldetail', 'viewDay', 'viewWeek' ); this.on('checklayout', this.checkLayout, this); this.on('canceldetail', this.onCancelDetailFn, this); this.on('afterrender', this._onAfterRenderFn, this); this.on('afterlayout', this._onReSizingFn, this); this.on('bodyresize', this._onReSizingFn, this); this.on('sizechanged', this.onSizeChangedFn, this, { buffer: 50 }); Ext.EventManager.on(document, 'mouseup', this._onMouseUpFn, this); }, _onAfterRenderFn: function() { this.initEls(); }, _onReSizingFn: function() { this.fireEvent('sizechanged'); }, onSizeChangedFn: function() { this.handleResize(this.body.getWidth(), this.body.getHeight()); }, onCancelDetailFn: function(e) { if (this.detailing) { this.detailing = false; this.detailCt.setStyle('display', 'none'); } }, resetSCover: function() { delete (this.startPos); delete (this.endPos); this.hideSCovers(); }, _onMouseUpFn: function(e) { if (!this.dragging) { if (this.startPos) { var spos = Ext.apply({}, this.startPos), epos = Ext.apply({}, this.endPos); this.startPos = null; var eh = this.ehandler; if (this.colNum != this.shiftDay && 1 != eh.startDay) { spos.y++; epos.y++; } eh.prepareLegend(Ext.get(this.id + '-x-monthview-viewer-title-' + epos.x + '-' + epos.y), spos, epos, this); } } }, getMinMaxFromStartEnd: function(startPos, endPos) { var stx = startPos.x; var sty = startPos.y; var edx = endPos.x; var edy = endPos.y; if (stx < edx || (stx == edx && sty <= edy)) { return { minPos: startPos, maxPos: endPos }; } else { return { minPos: endPos, maxPos: startPos } } }, hideSCovers: function() { for (var i = 0, len = this.scovers.length; i < len; i++) { this.scovers[i].dom.style.display = 'none'; } }, selectRange: function(spos, epos) { this.hideSCovers(); if (spos) { this.startPos = spos; } else { spos = this.startPos; } this.endPos = epos; var rs = this.getMinMaxFromStartEnd(spos, epos); var sx = rs.minPos.x, sy = rs.minPos.y, ex = rs.maxPos.x, ey = rs.maxPos.y; var cw = this.cw; var ch = this.ch; var sc, fsc = this.scovers[sx]; var w, l = Math.floor(cw * sy); if (sx == ex) { sc = this.scovers[sx]; sc.dom.style.display = ''; w = cw * (ey - sy + 1); sc.setWidth(w); sc.setHeight(ch); sc.setLeft(l + 'px'); } else { sc = this.scovers[sx]; sc.dom.style.display = ''; w = cw * (this.colNum - sy); sc.setWidth(w); sc.setHeight(ch); sc.setLeft(l + 'px'); for (var i = sx + 1; i < ex; i++) { sc = this.scovers[i]; sc.dom.style.display = ''; w = cw * this.colNum; sc.setWidth(w); sc.setHeight(ch); sc.setLeft('0px'); } sc = this.scovers[ex]; sc.dom.style.display = ''; w = cw * (ey + 1); sc.setWidth(w); sc.setHeight(ch); sc.setLeft('0px'); } }, calculatePos: function(e) { var xy = e.getXY(); var lt = this.port.getXY(); var y = Math.floor((xy[0] - lt[0]) / this.cw); var x = Math.floor((xy[1] - lt[1]) / this.ch); if (0 > x) { x = 0; } else if (x >= this.weekNum) { x = this.weekNum - 1; y = this.colNum - 1; } if (0 > y) { y = 0; } else if (y >= this.colNum) { y = this.colNum - 1; } return { x: x, y: y }; }, getIndexFromDay: function(day) { for (var i = 0, len = this.daySet.length; i < len; i++) { var iday = this.daySet[i]; if (day == iday.format('Y-m-d')) { return i; } } }, alignDetailCt: function() { if (this.detailing) { var x = this.detailing.x, y = this.detailing.y, events = this.detailing.events; this.detailCt.setStyle('display', ''); var tEl = Ext.get(this.id + '-x-monthview-viewer-title-' + x + '-' + y); var cEl = Ext.get(this.id + '-x-monthview-viewer-' + x + '-' + y); var tfh = this.detailTitle.getHeight() + this.detailFoot.getHeight() + 20; var h = events.length * 17; var bh = this.port.getBottom() - tEl.getTop() - tfh, th = cEl.getBottom() - this.port.getTop() - tfh; var roffset = this.port.getRight() - tEl.getRight(); var hpos, vpos = 't', mh = bh; var offset = [0, 0]; var cw = cEl.getWidth(); if (200 < cw) { this.detailCt.setWidth(cw); } else { this.detailCt.setWidth(200); } if (bh > h) { this.detailViewer.setStyle('height', ''); } else if (th > h) { vpos = 'b'; tEl = cEl; offset[1] = -4; this.detailViewer.setStyle('height', ''); } else { if (th > bh) { vpos = 'b'; mh = th; tEl = cEl; offset[1] = -4; } this.detailViewer.setHeight(mh); } if (roffset < this.detailCt.getWidth()) { hpos = 'r'; offset[0] = -1; } else { hpos = 'l'; } var str = vpos + hpos; this.detailCt.alignTo(tEl, str + '-' + str, offset); } }, showDetails: function(day) { var lan = Ext.ux.calendar.Mask.MonthView; var eh = this.ehandler; var glayout = eh.calendarLayout; var layout = glayout.getLayout(day, this); var rs = layout.reLayout(true); var events = rs.wlist.concat(rs.elist); var index = this.getIndexFromDay(day); var x = Math.floor(index / this.dayNum); var y = index % this.dayNum; this.detailing = { x: x, y: y, events: events }; this.detailTitle.dom.innerHTML = '' + '' + day + ''; this.detailFoot.dom.innerHTML = events.length + ' ' + lan['events']; eh.bindEvent2Detail(this, events, this.detailViewer); this.alignDetailCt(); }, _onPortMouseDownFn: function(e) { e.stopEvent(); this.fireEvent('hideeditor'); var target = e.getTarget(); var tgEl = Ext.get(target); if (tgEl.hasClass('x-event-more')) { var day = tgEl.dom.getAttribute('name'); this.showDetails(day); } else { if (this.detailing) { if (!(tgEl.hasClass('x-event-detail-ct') || tgEl.parent('.x-event-detail-ct'))) { this.fireEvent('canceldetail'); } else { return; } } if (!this.createByDblclick && !this.ehandler.readOnly) { if (!tgEl.hasClass('x-monthview-tool-drop') && !tgEl.hasClass('x-monthview-viewer-link-b')) { var eEl; if (tgEl.hasClass('x-calendar-event')) { eEl = tgEl; } else { eEl = tgEl.parent('.x-calendar-event'); } if (!eEl) { var pos = this.calculatePos(e); if (0 <= pos.x && 0 <= pos.y) { this.selectRange(pos, pos); } } } } } }, _onPortMouseMoveFn: function(e) { if (0 == e.button) { if (this.startPos) { var pos = this.calculatePos(e); if (0 <= pos.x && 0 <= pos.y) { this.selectRange(null, pos); } } } else { this.resetSCover(); } }, initEls: function() { this.lefter = Ext.get(this.id + '-x-monthview-lefter'); this.viewer = Ext.get(this.id + '-x-monthview-viewer'); this.port = Ext.get(this.id + '-x-monthview-port'); this.cheader = Ext.get(this.id + '-x-monthview-header'); this.lefter.un('click', this._onLefterClickFn, this); this.lefter.on('click', this._onLefterClickFn, this); this.port.un('click', this._onPortClickFn, this); this.port.on('click', this._onPortClickFn, this); this.port.un('mousedown', this._onPortMouseDownFn, this); this.port.on('mousedown', this._onPortMouseDownFn, this); // TRAKKWARE Change: if (true || !this.ehandler.readOnly) { this.port.un('mousemove', this._onPortMouseMoveFn, this); this.port.un('mouseover', this._onPortMouseOverFn, this); this.port.un('contextmenu', this._onPortContextMenuFn, this); this.port.un('dblclick', this._onPortDblclickFn, this); this.port.on('mousemove', this._onPortMouseMoveFn, this); //this.port.on('contextmenu', this._onPortContextMenuFn, this); this.port.on('mouseover', this._onPortMouseOverFn, this); this.port.on('dblclick', this._onPortDblclickFn, this); //this.initDragZone(this.port); } this.initDetailCt(); this.initSelectCover(); this.setToday(); }, _onLefterClickFn: function(e) { e.stopEvent(); var target = e.getTarget(); var tgEl = Ext.get(target); if (tgEl.hasClass('x-monthview-lefter-inner-b')) { var pos = this.getCellIndex(tgEl.dom.id); var x = pos.x; var sdate = this.daySet[x * this.shiftDay]; var edate = this.daySet[(x + 1) * this.shiftDay - 1]; this.fireEvent('viewWeek', sdate, edate); } }, _onPortDblclickFn: function(e) { e.stopEvent(); var target = e.getTarget(); var tgEl = Ext.get(target); if (!tgEl.hasClass('x-calendar-event')) { tgEl = tgEl.parent('.x-calendar-event'); } if (tgEl) { if (tgEl && !tgEl.bindEvent.locked) { this.ehandler.showEditor(tgEl, this, 'update'); } } else if (this.createByDblclick) { var pos = this.calculatePos(e); this.addLegend(pos); } }, _onPortContextMenuFn: function(e) { e.stopEvent(); var target = e.getTarget(); var tgEl = Ext.get(target); var cEl; if (tgEl.hasClass('x-calendar-event')) { cEl = tgEl; } else { cEl = tgEl.parent('.x-calendar-event'); } if (cEl) { var eh = this.ehandler; eh.showContextMenu(e, cEl); } }, _onPortMouseOverFn: function(e) { if (this.detailing) { return; } //alert('got here'); var target = e.getTarget(); var tgEl = Ext.get(target); if (this.overEl) { this.overEl.removeClass('x-tool-btn-over'); delete (this.overEl); } // Trakkware Change: added rthe if (tgEl.hasClass('x-legend-title-b') || tgEl.hasClass('x-monthview-tool-drop') || tgEl.hasClass('x-monthview-tool-add')) { tgEl.addClass('x-tool-btn-over'); this.overEl = tgEl; } }, addLegend: function(pos) { var eh = this.ehandler; var epos = Ext.apply({}, pos); this.selectRange(pos, epos); this.startPos = null; eh.prepareLegend(Ext.get(this.id + '-x-monthview-viewer-title-' + pos.x + '-' + pos.y), pos, epos, this); }, _onPortClickFn: function(e) { var data = {}; var eh = this.ehandler; var target = e.getTarget(); var tgEl = Ext.get(target); // Trakware change: looking for tgEl.hasClass('x-whole-title') also. if (tgEl.hasClass('x-whole-title-b') || tgEl.hasClass('x-whole-title')) { titleEl = tgEl; } else { titleEl = tgEl.parent('.x-whole-title-b'); if (!titleEl) titleEl = tgEl.parent('.x-whole-title'); } if (titleEl) { var wEl = titleEl.parent('.x-whole-cover'); // Trakkware change: Need populate the data object.. data = wEl.bindEvent; // end trakkware change. if (wEl && !wEl.bindEvent.locked) { eh.showEditor(wEl, this, 'update'); } } else { if (tgEl.hasClass('x-legend-title-b')) { titleEl = tgEl; } else { titleEl = tgEl.parent('.x-legend-title-b'); } if (titleEl) { var lEl = titleEl.parent('.x-legend-cover'); data = lEl.bindEvent; } } // TRAKKWARE CHANGES // Only show an event if one was actually clicked on. var id = data.eventId; if (Ext.isDefined(id)) { Trakkware.ViewFramework.launchView({ view: 'Trakkware.Common.NopCommerce.Views.CommerceEventCalendarDetailView, Trakkware.Common.NopCommerce', command: 'POPULATE', viewParams: { EventOccurrenceID: id }, launch: 'window', width: 500, height: 500, header: true, title: eh.subject, ControlID: eh.ControlID }); } // Include the bits for the detail tool to close. if (tgEl.hasClass('x-event-detail-tool-close')) { this.fireEvent('canceldetail'); } return; // END TRAKKWARE CHANGES var eh = this.ehandler; var target = e.getTarget(); var tgEl = Ext.get(target); var titleEl; if (tgEl.hasClass('x-event-detail-tool-close')) { this.fireEvent('canceldetail'); } else if (tgEl.hasClass('x-monthview-viewer-link-b')) { var pos = this.getCellIndex(tgEl.dom.parentNode.id); var day = this.daySet[pos.x * this.dayNum + pos.y]; this.fireEvent('viewDay', this, day); } else if (!eh.readOnly) { if (tgEl.hasClass('x-monthview-tool-add')) { this.addLegend(this.getCellIndex(tgEl.dom.id)); } else if (tgEl.hasClass('x-monthview-tool-drop')) { this.showMenu(tgEl); } else { if (tgEl.hasClass('x-whole-title-b')) { titleEl = tgEl; } else { titleEl = tgEl.parent('.x-whole-title-b'); } if (titleEl) { var wEl = titleEl.parent('.x-whole-cover'); if (wEl && !wEl.bindEvent.locked) { eh.showEditor(wEl, this, 'update'); } } else { if (tgEl.hasClass('x-legend-title-b')) { titleEl = tgEl; } else { titleEl = tgEl.parent('.x-legend-title-b'); } if (titleEl) { var lEl = titleEl.parent('.x-legend-cover'); if (lEl && !lEl.bindEvent.locked) { eh.showEditor(lEl, this, 'update'); } } } } } }, initDetailCt: function() { var eh = this.ehandler; var html = eh.detailTpl.apply({}); this.detailCt = Ext.DomHelper.append(this.port, html, true); this.detailCt.setStyle('display', 'none'); this.detailTitle = this.detailCt.child('.x-event-detail-title-td'); this.detailViewer = this.detailCt.child('.x-event-detail-viewer'); this.detailFoot = this.detailCt.child('.x-event-detail-foot-text'); }, initSelectCover: function() { this.scovers = []; for (var i = 0, len = this.templateRowNum; i < len; i++) { var div = document.createElement('div'); div.className = 'x-event-select-cover'; div = Ext.get(div); var row = Ext.get(this.port.dom.childNodes[i]); row.appendChild(div); this.scovers[this.scovers.length] = div; } }, initDragZone: function(bindEl) { var proxy = new Ext.dd.StatusProxy({ dropNotAllowed: 'x-dd-drop-ok' }); bindEl.dragzone = new Ext.dd.DragZone(bindEl, { ddGroup: 'x-mycalendar', proxy: proxy, cview: this, onStartDrag: function() { this.cview.dragging = true; (function() { var event = this.dragData.bindEvent; var arr = Ext.DomQuery.select('div[name=x-event-' + event.day + '-' + event.eday + '-' + event.eventId + ']', this.cview.body.dom); for (var i = 0, len = arr.length; i < len; i++) { var eEl = Ext.get(arr[i]); eEl.setOpacity(0.3); } }).defer(1, this); }, getDragData: function(e) { var target = e.getTarget(); var tgEl = Ext.get(target); if (!tgEl.hasClass('x-calendar-event')) { tgEl = tgEl.parent('.x-calendar-event'); } if (tgEl) { var event = tgEl.bindEvent; if (!event.locked) { var ddel = tgEl.dom.cloneNode(true); var w = tgEl.getWidth(); if (200 < w) { ddel.style.width = '200px'; } else { ddel.style.width = w + 'px'; } return { ddel: ddel, bindEvent: event }; } } return false; }, getRepairXY: function(e, data) { return null; }, onDrag: function(e) { var event = this.dragData.bindEvent; var cview = this.cview; var eh = cview.ehandler; var span = Ext.ux.calendar.Mask.getDayOffset(event.day, event.eday); var pos = cview.calculatePos(e); var epos = cview.addSpan2Pos(pos, span); cview.selectRange(pos, epos); }, endDrag: function(e) { var cview = this.cview; var event = this.dragData.bindEvent; var oldevent = Ext.apply({}, event); var oevent; if (event.day == event.eday && (0 != event.startRow || cview.rowCount != event.endRow)) { oevent = Ext.apply({}, event); } var spos = cview.startPos; var eh = cview.ehandler; var dnum = Ext.ux.calendar.Mask.getDayOffset(event.day, event.eday); /* * need relayout for weekend too, or will have exception */ if (cview.colNum != cview.shiftDay && 1 != eh.startDay) { spos.y++; } var index = spos.x * cview.shiftDay + spos.y; var date = cview.daySet[index]; var day = date.format('Y-m-d'); if (event.day != day) { event.eday = date.add(Date.DAY, dnum).format('Y-m-d'); event.day = day; if ('string' == Ext.type(event.repeatType)) { eh.updateEvent(event, cview, null, oevent); } else { event.repeatType = 'exception'; eh.updateRepeatEvent(event, cview, oldevent); } } else { var arr = Ext.DomQuery.select('div[name=x-event-' + event.day + '-' + event.eday + '-' + event.eventId + ']', this.cview.body.dom); for (var i = 0, len = arr.length; i < len; i++) { var eEl = Ext.get(arr[i]); eEl.setOpacity(1); } } cview.dragging = false; cview.resetSCover(); cview.fireEvent('canceldetail'); } }); }, addSpan2Pos: function(pos, span) { var o = Ext.apply({}, pos); o.y += span; var x = Math.floor(o.y / this.dayNum); o.y = o.y % this.shiftDay; o.x += x; if (o.x >= this.weekNum) { o.x = this.weekNum - 1; o.y = this.colNum - 1; } if (o.y >= this.colNum) { o.y = this.colNum - 1; } return o; }, viewWeekend: function(display) { if (1 == this.startDay) { Ext.util.CSS.updateRule('.' + this.id + '-x-monthview-viewer-col-6', 'display', display); Ext.util.CSS.updateRule('.' + this.id + '-x-monthview-viewer-col-5', 'display', display); } else { Ext.util.CSS.updateRule('.' + this.id + '-x-monthview-viewer-col-0', 'display', display); Ext.util.CSS.updateRule('.' + this.id + '-x-monthview-viewer-col-6', 'display', display); } }, recalculateSize: function(bw, bh) { if (typeof bw == 'number') { this.cheader.setWidth(bw); bw -= this.leftWidth; this.port.setWidth(bw); if (7 == this.colNum) { this.viewWeekend(''); } else if (5 == this.colNum) { this.viewWeekend('none'); } this.cw = bw / this.colNum; } if (typeof bh == 'number') { var ah = bh - this.cheader.getHeight(); this.ch = ah / this.rowNum; var th = Ext.get(this.id + '-x-monthview-viewer-title-0-1').getHeight(); this.lineNum = Math.floor((this.ch - th) / this.legendHeight); Ext.util.CSS.updateRule('.' + this.id + '-x-monthview-row', 'height', Math.ceil(this.ch) + 'px'); } }, handleResize: function(bw, bh) { var oldLineNum = this.lineNum; this.recalculateSize(bw, bh); if (oldLineNum != this.lineNum) { this.showCache(); } this.alignDetailCt(); this.fireEvent('afterresize', this, bw, bh); }, checkCSHide: function(cs) { var eh = this.ehandler; var ecs = eh.calendarSet; var flag = false; for (var p in ecs) { var ec = ecs[p]; var c = cs[p]; if (ec && c) { if (false === ec.hide && false !== c.hide) { flag = true; break; } } } return flag; }, showCache: function(startDate, endDate, force, refresh) { var eh = this.ehandler; startDate = startDate || this.daySet[0]; endDate = endDate || this.daySet[this.daySet.length - 1]; if (eh.isInDayCache(startDate, endDate) && !refresh) { var glayout = eh.calendarLayout; for (var i = 0, len = this.weekNum; i < len; i++) { var eventSet = {}; for (var j = 0, count = this.dayNum; j < count; j++) { var index = i * this.dayNum + j; var day = this.daySet[index].format('Y-m-d'); var layout = glayout.getLayout(day, this); var rs = layout.reLayout(); eventSet[day] = rs.wlist.concat(rs.elist); } var tbody = Ext.get(this.id + '-x-monthview-ct-' + i).dom.firstChild; glayout.showWeek(this, tbody, i, eventSet, true); } return true; } return false; }, checkLayout: function(force, refresh) { var eh = this.ehandler; var startDate = this.daySet[0]; var endDate = this.daySet[this.daySet.length - 1]; if (!this.showCache(startDate, endDate, force, refresh)) { this.fireEvent('beforeremoteload'); eh.ds.loadEvent(startDate, endDate, function(eventSet) { this.showEvents(eventSet, refresh); eh.pushDayCache(startDate, endDate); this.fireEvent('remoteload'); }, this); } this.setToday(); }, showEvents: function(eventSet, refresh) { var eh = this.ehandler; var glayout = eh.calendarLayout; glayout.updateWholeList(eventSet['whole'], 'add'); for (var i = 0; i < this.weekNum; i++) { var tbody = Ext.get(this.id + '-x-monthview-ct-' + i).dom.firstChild; glayout.showWeek(this, tbody, i, eventSet); } }, onAddFn: function(item) { var menu = item.parentMenu; var pos = this.getCellIndex(menu.bindEl.dom.id); this.addLegend(pos); }, onClearFn: function(item) { var menu = item.parentMenu; var pos = this.getCellIndex(menu.bindEl.dom.id); this.clearLegend(pos); }, setCutStatus: function(pos) { var x = pos.x, y = pos.y; var cEl = Ext.get(this.id + '-x-monthview-viewer-' + x + '-' + y); if (cEl) { cEl.addClass('x-monthview-cell-cut'); } var tEl = Ext.get(this.id + '-x-monthview-viewer-title-' + x + '-' + y); if (tEl) { tEl.addClass('x-monthview-cell-cut'); } var eh = this.ehandler; eh.commentTip.showTip('Notice', 'Cross-day event and repeat event can not be cut/copied!', tEl, 'bl-tl?'); }, resetCutStatus: function(pos) { var x = pos.x, y = pos.y; var cEl = Ext.get(this.id + '-x-monthview-viewer-' + x + '-' + y); if (cEl) { cEl.removeClass('x-monthview-cell-cut'); } var tEl = Ext.get(this.id + '-x-monthview-viewer-title-' + x + '-' + y); if (tEl) { tEl.removeClass('x-monthview-cell-cut'); } }, onCutFn: function(item) { var menu = item.parentMenu; var pos = this.getCellIndex(menu.bindEl.dom.id); var x = pos.x, y = pos.y; var index = x * this.dayNum + y; var day = this.daySet[index].format('Y-m-d'); if (this.cpFlag) { this.resetCutStatus(this.cpFlag.pos); } this.setCutStatus(pos); this.cpFlag = { day: day, keep: false, pos: pos }; }, onCopyFn: function(item) { var menu = item.parentMenu; var pos = this.getCellIndex(menu.bindEl.dom.id); var index = pos.x * this.dayNum + pos.y; var day = this.daySet[index].format('Y-m-d'); if (this.cpFlag) { this.resetCutStatus(this.cpFlag.pos); } this.setCutStatus(pos); this.cpFlag = { day: day, keep: true, pos: pos }; }, onPasteFn: function(item) { if (this.cpFlag) { var keep = this.cpFlag.keep; var menu = item.parentMenu; var pos = this.getCellIndex(menu.bindEl.dom.id); var index = pos.x * this.dayNum + pos.y; var tday = this.daySet[index].format('Y-m-d'); var eh = this.ehandler; var oday = this.cpFlag.day; eh.ds.changeDay(oday, tday, function(backObj) { var gLayout = eh.calendarLayout; /* * delete oday wlist */ var wlist = gLayout.deleteDayFromWholeList(oday, oday, keep); var olayout = gLayout.getLayout(oday, this); /* * get oday elist */ var olist = [], elist = olayout.reLayout(null, true).elist; var orlist = []; for (var i = 0, len = elist.length; i < len; i++) { var e = elist[i]; if ('string' == Ext.type(e.repeatType)) { olist.push(Ext.apply({}, e)); } else { orlist.push(Ext.apply({}, e)); } } /* * if it's copy, backend will return new id, here need replace the old id with new ones */ if (backObj && backObj.backids) { var bids = backObj.backids; for (var i = 0, len = wlist.length; i < len; i++) { var w = wlist[i]; if (bids[w.eventId]) { w.eventId = bids[w.eventId]; } } for (var i = 0, len = olist.length; i < len; i++) { var e = olist[i]; if (bids[e.eventId]) { e.eventId = bids[e.eventId]; } } } /* * here need change the day and eday to the tday */ for (var i = 0, len = wlist.length; i < len; i++) { var w = wlist[i]; w.day = tday; w.eday = tday; } /* * add new wlist to glayout */ gLayout.updateWholeList(wlist, 'add'); for (var i = 0, len = olist.length; i < len; i++) { var e = olist[i]; e.day = tday; e.eday = tday; } var tlayout = gLayout.getLayout(tday, this); elist = tlayout.reLayout(null, true).elist; elist = gLayout.combine2List(elist, olist); /* * relayout the target layout */ tlayout.layouted = false; tlayout.generateLayout(elist, true, null, true); if (!keep) { /* * if it's cut, then need remove the elist in old layout */ olayout.layouted = false; olayout.generateLayout(orlist, true, null, true); } /* * re-render the monthview */ this.checkLayout(); eh.fireEvent('changeEventCache', eh); }, this, keep); if (!keep) { this.resetCutStatus(this.cpFlag.pos); delete (this.cpFlag); } } }, clearLegend: function(pos) { var eh = this.ehandler; var cs = eh.calendarSet; var gLayout = eh.calendarLayout; var index = pos.x * this.dayNum + pos.y; var day = this.daySet[index].format('Y-m-d'); eh.ds.deleteDay(day, function() { gLayout.deleteDayFromWholeList(day); var layout = gLayout.getLayout(day, this); if (layout) { layout.layouted = false; layout.updateRepeat = true; layout.generateLayout([], true, null, true); } this.checkLayout(true); eh.fireEvent('changeEventCache', eh); }, this); }, resizePort: Ext.emptyFn, refreshDate: function() { var week = this.daySet[0].getWeekOfYear(); for (var i = 0; i < this.weekNum; i++) { for (var j = 0; j < this.dayNum; j++) { var titleEl = Ext.get(this.id + '-x-monthview-viewer-link-' + i + '-' + j); if (titleEl) { var day = this.daySet[i * this.dayNum + j].format(this.dayFormat); titleEl.dom.innerHTML = '' + day + ''; } } var weekEl = Ext.get(this.id + '-x-monthview-week-' + i + '-0'); var w = (week + i) % 53; if (0 == w) { w = 53; } weekEl.dom.innerHTML = w; } }, resetView: function(callback, scope, params) { this.refreshDate(); this.setToday(); }, cleanup: function(w) { var fn = (function(w) { var El = Ext.get(this.id + '-x-monthview-ct-' + w); if (El) { var tbody = El.dom.firstChild; var arr = []; for (var i = 1, len = tbody.childNodes.length; i < len; i++) { arr.push(tbody.childNodes[i]); } for (var i = 0, len = arr.length; i < len; i++) { Ext.get(arr[i]).remove(); } } }).createDelegate(this); if (false == Ext.type(w)) { for (var i = 0; i < this.templateRowNum; i++) { fn(i); } } else { fn(w); } }, locateDay: function(day) { var fd = day.getFirstDateOfMonth(); this.recalculateWeek(fd); this.recalculateSize(this.body.getWidth(), this.body.getHeight()); fd = this.getStartDate(fd); this.daySet = []; for (var i = 0; i < this.weekNum; i++) { for (var j = 0; j < this.dayNum; j++) { var offset = i * this.shiftDay + j; this.daySet[this.daySet.length] = fd.add(Date.DAY, offset); } } }, showDay: function(day) { this.locateDay(day); this.resetView(); this.checkLayout(true); }, recalculateWeek: function(fdate) { if (1 == this.startDay) { var n = fdate.format('N'); if (7 == n && 30 <= fdate.getDaysInMonth()) { this.rowNum = 6; } else if (6 == n && 31 == fdate.getDaysInMonth()) { this.rowNum = 6; } else if (1 == n && 28 == fdate.getDaysInMonth()) { this.rowNum = 4; } else { this.rowNum = 5; } } else { var w = fdate.format('w'); if (6 == w && 30 <= fdate.getDaysInMonth()) { this.rowNum = 6; } else if (5 == w && 31 == fdate.getDaysInMonth()) { this.rowNum = 6; } else if (0 == n && 28 == fdate.getDaysInMonth()) { this.rowNum = 4; } else { this.rowNum = 5; } } this.weekNum = this.rowNum; }, goBack: function() { var shiftDay = this.shiftDay || this.dayNum; var dayNum = this.dayNum; var sdate = this.daySet[0]; var fdate = sdate.getFirstDateOfMonth(); if (sdate.format('Y-m-d') == fdate.format('Y-m-d')) { fdate = fdate.add(Date.DAY, -1); fdate = fdate.getFirstDateOfMonth(); } this.recalculateWeek(fdate); fdate = this.getStartDate(fdate); var weekNum = this.weekNum; this.daySet = []; for (var i = 0; i < weekNum; i++) { for (var j = 0; j < dayNum; j++) { this.daySet[this.daySet.length] = fdate.add(Date.DAY, i * shiftDay + j); } } this.resetView(); this.recalculateSize(this.body.getWidth(), this.body.getHeight()); this.checkLayout(true); }, goNext: function() { var shiftDay = this.shiftDay || this.dayNum; var dayNum = this.dayNum; var edate = this.daySet[this.daySet.length - 1]; var fdate = edate.getLastDateOfMonth(); if (edate.format('Y-m-d') == fdate.format('Y-m-d')) { fdate = fdate.add(Date.DAY, 1); } else { fdate = edate.getFirstDateOfMonth(); } this.recalculateWeek(fdate); fdate = this.getStartDate(fdate); this.daySet = []; var weekNum = this.weekNum; for (var i = 0; i < weekNum; i++) { for (var j = 0; j < dayNum; j++) { this.daySet[this.daySet.length] = fdate.add(Date.DAY, i * shiftDay + j); } } this.resetView(); this.recalculateSize(this.body.getWidth(), this.body.getHeight()); this.checkLayout(true); }, isShift: function(startDate, endDate) { var maxmin, minmax; var day1 = startDate.format('Y-m-d'); var day2 = this.daySet[0].format('Y-m-d'); if (day1 < day2) { maxmin = day2; } else { maxmin = day1; } day1 = endDate.format('Y-m-d'); day2 = this.daySet[this.daySet.length - 1].format('Y-m-d'); if (day1 > day2) { minmax = day2; } else { minmax = day1; } if (maxmin > minmax) { var sdate = startDate.getFirstDateOfMonth(); this.recalculateWeek(sdate); sdate = this.getStartDate(sdate); this.daySet = []; for (var i = 0; i < this.weekNum; i++) { for (var j = 0; j < this.dayNum; j++) { this.daySet[this.daySet.length] = sdate.add(Date.DAY, i * this.shiftDay + j); } } return true; } else { return false; } }, showRange: function(startDate, endDate) { var force = false; if (this.isShift(startDate, endDate)) { this.resetView(); force = true; } this.recalculateSize(this.body.getWidth(), this.body.getHeight()); this.checkLayout(force); } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.CalendarContainer = function(config) { Ext.apply(this, config); var eh = this.ehandler; var cs = eh.calendarSetting; var lan = Ext.ux.calendar.Mask.CalendarContainer; var now = new Date(); this.startDate = now; this.endDate = now; this.dayView = new Ext.ux.calendar.DayView({ dayFormat: cs.dayFormat, offsetPercent: 0.05, firstTime: true, shiftDay: 1, dayNum: 1, startColIndex: 0, endColIndex: 1, ehandler: this.ehandler, TrakkwareConfig: config.TrakkwareConfig }); this.weekView = new Ext.ux.calendar.DayView({ dayFormat: cs.weekFormat, firstTime: true, offsetPercent: 0.1, shiftDay: 7, dayNum: 7, startColIndex: 0, endColIndex: 7, ehandler: this.ehandler, TrakkwareConfig: config.TrakkwareConfig }); this.weekOnlyView = new Ext.ux.calendar.DayView({ dayFormat: cs.weekFormat, firstTime: true, offsetPercent: 0.1, dayNum: 5, shiftDay: 7, startColIndex: 0, endColIndex: 5, ehandler: this.ehandler, TrakkwareConfig: config.TrakkwareConfig }); this.monthView = new Ext.ux.calendar.MonthView({ dayFormat: cs.monthFormat, firstTime: true, dayNum: 7, shiftDay: 7, startColIndex: 0, endColIndex: 7, ehandler: this.ehandler, TrakkwareConfig: config.TrakkwareConfig }); this.resultView = new Ext.ux.calendar.ResultView({ ehandler: this.ehandler, TrakkwareConfig: config.TrakkwareConfig }); this.detailEditor = new Ext.ux.calendar.DetailEditor({ ehandler: this.ehandler, TrakkwareConfig: config.TrakkwareConfig }); // TRAKKWARE: Added prev text. this.backBtn = new Ext.Button({ iconCls: 'icon_feyaCalendar_back', handler: this.onBackFn, scope: this, text: 'prev' }); // TRAKKWARE: Added next text. Added iconAlign property. this.nextBtn = new Ext.Button({ iconCls: 'icon_feyaCalendar_next', handler: this.onNextFn, scope: this, text: 'next', iconAlign: 'right' }); // TRAKKWARE CHANGE: Next button to show/hide the west panel. this.showHideBtn = new Ext.Button({ text: "show/hide", handler: this.onShowHideFn }); this.showHideBtn.that = this; this.todayBtn = new Ext.Button({ text: lan['todayBtn.text'], iconCls: 'icon_feyaCalendar_today', handler: this.onTodayFn, scope: this }); this.refreshBtn = new Ext.Button({ iconCls: 'x-tbar-loading', handler: this.onRefreshFn, scope: this }); this.dayBtn = new Ext.Button({ iconCls: 'icon_feyaCalendar_dayview', text: lan['dayBtn.text'], handler: this.onDayFn, scope: this }); this.resultBtn = new Ext.Button({ iconCls: 'icon_feyaCalendar_dayview', text: 'List View', handler: this.onSearchFn, scope: this }); this.weekMenu = new Ext.menu.Menu({ items: [{ text: lan['weekMenu.showAll.text'], checked: true, group: 'week', handler: this.onWeekAllFn, scope: this }, { text: lan['weekMenu.onlyWeek.text'], checked: false, group: 'week', handler: this.onWeekOnlyFn, scope: this }] }); this.weekBtn = new Ext.SplitButton({ iconCls: 'icon_feyaCalendar_weekview', text: lan['weekBtn.text'], arrowAlign: 'right', menu: this.weekMenu, handler: this.onWeekFn, scope: this }); this.monthMenu = new Ext.menu.Menu({ items: [{ text: lan['monthMenu.showAll.text'], checked: true, group: 'month', handler: this.onMonthAllFn, scope: this }, { text: lan['monthMenu.onlyWeek.text'], checked: false, group: 'month', handler: this.onMonthOnlyFn, scope: this }] }); this.monthBtn = new Ext.SplitButton({ iconCls: 'icon_feyaCalendar_monthview', text: lan['monthBtn.text'], arrowAlign: 'right', menu: this.monthMenu, handler: this.onMonthFn, pressed: true, scope: this }); var items = []; /* * below code is for language submenu, you can set SHOW_LANGUAGE_MENU to false if you don't need it */ if (Ext.ux.calendar.CONST.SHOW_LANGUAGE_MENU) { var data = Ext.ux.calendar.Mask.getLanguageConfig().data; for (var i = 0, len = data.length; i < len; i++) { var d = data[i]; items[items.length] = { group: 'language', checked: d[0] == cs.language, text: d[1], name: d[0], handler: this.onLanguageSettingFn, scope: this }; } this.lanMenu = new Ext.menu.Menu({ items: items }); items = []; items.push({ iconCls: 'icon_feyacalendar_world', text: lan['moreMenu.language.text'], menu: this.lanMenu, scope: this }); } items.push({ iconCls: 'icon_feyaCalendar_setting', text: lan['moreMenu.setting.text'], handler: this.onSettingFn, scope: this }); items.push({ iconCls: 'icon_feyaCalendar_clock', text: lan['moreMenu.showAlert.text'], handler: this.onShowAlertFn, scope: this }); items.push({ iconCls: 'icon_feyaCalendar_feyasoft', text: lan['moreMenu.about.text'], handler: this.onAboutMyCalendarFn, scope: this }); this.moreMenu = new Ext.menu.Menu({ items: items }); this.moreBtn = new Ext.Button({ iconCls: 'icon_feyaCalendar_setting', text: lan['moreBtn.text'], menu: this.moreMenu }); // TRAKKWARE made adjustments to this text field to allow Enter key behavior. Also changed field width. var that = this; this.searchField = new Ext.form.TextField({ width: 175, enableKeyEvents: true, listeners: { focus: function(field) { field.selectText(); return false; }, keypress: function(form, e) { if (e.getKey() == e.ENTER) { e.stopEvent(); that.onSearchFn(); return false; } return true; } } }); // END TRAKKWARE CHANGES this.searchBtn = new Ext.Button({ iconCls: 'icon_feyaCalendar_search', handler: this.onSearchFn, scope: this }); Ext.ux.calendar.CalendarContainer.superclass.constructor.call(this, { border: false, region: 'center', cls: 'x-calendar-container', layout: 'card', layoutConfig: { deferredRender: true }, activeItem: 2, items: [ this.dayView, this.weekView, this.monthView, this.resultView, this.weekOnlyView, this.detailEditor ], tbar: [ // TRAKKWARE CHANGE: added this.showHIdeBtn. this.backBtn, this.showHideBtn, this.nextBtn, this.todayBtn, '-', lan['searchCriteria.text'], this.searchField, this.searchBtn, '-', this.refreshBtn, '-', this.dayBtn, '-', this.weekBtn, '-', this.monthBtn, '-', this.resultBtn ] }); this.addEvents( 'refresh', 'editcalendar' ); this.currentView = this.monthView; this.currentIdx = 2; var options = { single: true }; if (Ext.isIE) { options['delay'] = 5000; } this.currentView.on('afterresize', this.onAfterResizeFn, this, options); this.weekView.on('viewDay', this.onDayChangeFn, this); this.weekOnlyView.on('viewDay', this.onDayChangeFn, this); this.monthView.on('viewDay', this.onDayChangeFn, this); this.monthView.on('viewWeek', this.onWeekChangeFn, this); this.dayView.on('viewWeek', this.onWeekChangeFn, this); this.relayEvents(this.dayView, ['beforeremoteload', 'remoteload', 'hideeditor']); this.relayEvents(this.weekView, ['beforeremoteload', 'remoteload', 'hideeditor']); this.relayEvents(this.weekOnlyView, ['beforeremoteload', 'remoteload', 'hideeditor']); this.relayEvents(this.monthView, ['beforeremoteload', 'remoteload', 'hideeditor']); this.dayView.relayEvents(this, ['canceldetail']); this.weekView.relayEvents(this, ['canceldetail']); this.weekOnlyView.relayEvents(this, ['canceldetail']); this.monthView.relayEvents(this, ['canceldetail']); this.on('mousedown', this.onMMouseDownFn, this); this.on('showdetailsetting', this.onShowDetailSettingFn, this); this.on('refresh', this.refresh, this); }; Ext.extend(Ext.ux.calendar.CalendarContainer, Ext.Panel, { onAfterResizeFn: function() { this.ehandler.fireEvent('calendarloaded'); }, onShowDetailSettingFn: function(obj) { this.getLayout().setActiveItem(5); this.detailEditor.setup(obj); }, onLanguageSettingFn: function(item) { var name = item.name; var eh = this.ehandler; eh.ds.updateSetting({ language: name }, function() { window.location = window.location.href; }, this); }, onShowAlertFn: function(item) { var eh = this.ehandler; var epopup = eh.epopup; if (epopup) { epopup.hideCB.setValue(false); } eh.checkExpireEvents(); }, onBackFn: function(btn) { var cview = this.currentView; this.getLayout().setActiveItem(this.currentIdx); cview.goBack(); this.changeLabel(cview); }, onNextFn: function(btn) { var cview = this.currentView; this.getLayout().setActiveItem(this.currentIdx); cview.goNext(); this.changeLabel(cview); }, onTodayFn: function(btn) { this.showDay(new Date()); }, onDayFn: function(btn) { if (this.currentView != this.dayView) { this.showPressed(btn); var cview = this.dayView; this.getLayout().setActiveItem(0); cview.showRange(this.startDate, this.endDate); this.changeLabel(cview); } }, // TRAKKWARE CHANGE: Next function. onShowHideFn: function(btn) { var that = btn.that; var wp = that.ownerCt.westPanel; if(wp.collapsed === true) wp.expand(true); else wp.collapse(true); }, onWeekFn: function(btn) { if (true === btn.weekdayFlag) { this.onWeekOnlyFn(); } else if (this.currentView != this.weekView) { this.onWeekAllFn(); } }, onWeekAllFn: function() { if (this.currentView != this.weekView) { var cview = this.weekView; this.weekBtn.weekdayFlag = false; this.showPressed(this.weekBtn); this.getLayout().setActiveItem(1); cview.showRange(this.startDate, this.endDate, true); this.changeLabel(cview); } }, onWeekOnlyFn: function() { if (this.currentView != this.weekOnlyView) { this.weekBtn.weekdayFlag = true; this.showPressed(this.weekBtn); var cview = this.weekOnlyView; this.getLayout().setActiveItem(4); cview.showRange(this.startDate, this.endDate, true); this.changeLabel(cview); } }, onMonthFn: function(btn) { if (true == btn.weekdayFlag) { this.onMonthOnlyFn(); } else { this.onMonthAllFn(); } }, onMonthAllFn: function() { var cview = this.monthView; this.monthBtn.weekdayFlag = false; if (this.currentView != this.monthView) { this.showPressed(this.monthBtn); this.getLayout().setActiveItem(2); cview.startColIndex = 0; cview.endColIndex = 7; cview.colNum = 7; cview.showRange(this.startDate, this.endDate); this.changeLabel(cview); } else { cview.startColIndex = 0; cview.endColIndex = 7; cview.colNum = 7; cview.cleanup(); cview.recalculateSize(cview.body.getWidth(), cview.body.getHeight()); cview.showCache(); } }, onMonthOnlyFn: function() { var cview = this.monthView; this.monthBtn.weekdayFlag = true; var offset = (1 == cview.startDay ? 1 : 0); if (this.currentView != this.monthView) { this.showPressed(this.monthBtn); this.getLayout().setActiveItem(2); cview.colNum = 5; cview.startColIndex = 1 - offset; cview.endColIndex = 6 - offset; cview.showRange(this.startDate, this.endDate); this.changeLabel(cview); } else { cview.colNum = 5; cview.startColIndex = 1 - offset; cview.endColIndex = 6 - offset; cview.cleanup(); cview.recalculateSize(cview.body.getWidth(), cview.body.getHeight()); cview.showCache(); } }, showPressed: function(btn) { this.dayBtn.el.removeClass("x-btn-pressed"); this.weekBtn.el.removeClass("x-btn-pressed"); this.monthBtn.el.removeClass("x-btn-pressed"); btn.el.addClass("x-btn-pressed"); if (btn == this.dayBtn) { this.currentIdx = 0; this.currentView = this.dayView; } else if (btn == this.weekBtn) { if (true !== this.weekBtn.weekdayFlag) { this.currentIdx = 1; this.currentView = this.weekView; } else { this.currentIdx = 4; this.currentView = this.weekOnlyView; } } else if (btn == this.monthBtn || btn == this.monthOnlyBtn) { this.currentIdx = 2; this.currentView = this.monthView; } else if (btn == this.resultBtn) { this.currentIdx = 3; this.currentView = this.resultView; } }, showDay: function(day) { var cview = this.currentView; this.getLayout().setActiveItem(this.currentIdx); cview.showDay(day); this.changeLabel(cview); }, showSingleDay: function(day) { var cview = this.dayView; cview.daySet[0] = day; if (this.currentView != this.dayView) { this.showPressed(this.dayBtn); this.getLayout().setActiveItem(0); cview.resetView(); cview.fireEvent('checklayout', true); this.changeLabel(cview); } }, onDayChangeFn: function(cview, day) { this.showSingleDay(day); }, onWeekChangeFn: function(sdate, edate) { this.showPressed(this.weekBtn); var cview = this.currentView; this.getLayout().setActiveItem(this.currentIdx); cview.showDay(sdate); this.changeLabel(cview); }, changeLabel: function(cview) { this.startDate = cview.daySet[0]; this.endDate = cview.daySet[cview.daySet.length - 1]; this.fireEvent('changedate', this.startDate, this.endDate); }, onSearchFn: function() { var resultView = this.resultView; this.getLayout().setActiveItem(3); resultView.list.getStore().removeAll(); resultView.loadEvents.defer(1, resultView, [this.searchField.getValue()]); this.showPressed(this.resultBtn) }, onSettingFn: function() { var eh = this.ehandler; if (!eh.settingPop) { eh.settingPop = new Ext.ux.calendar.SettingPopup({ calendarContainer: this }); } var cs = eh.calendarSetting; eh.settingPop.popup(cs); }, onAboutMyCalendarFn: function() { var myHtml = '
    ' + '
    ' + ' FeyaSoft MyCalendar
    ' + ' Version 2.0.3' + '

    ' + ' Copyright © 2006-2010 FeyaSoft Inc. All right reserved
    ' + ' http://www.feyasoft.com

    ' + '
    ' + '
    ' + ' FeyaSoft MyCalendar provides a dual license business model which include commercial and open source license.' + ' You need buy a commercial license if you want to use MyCalendar in your commercial production. Otherwise ' + ' you need make your whole project released under GNU GPL 3.0 license. To query license' + ' information, please send the email to: fzhuang@feyasoft.com.' + '


    ' + ' Warning: This computer program is protected by the copyright law and international treaties. Unauthorized ' + ' reproduction or distribution this program, or any portion of it, maybe result in severe civil and ' + ' criminal penalties, and will be prosecuted to the maximum extent possible under the law.' '
    '; var aboutUsWin = new Ext.Window({ iconCls: 'icon_feyaCalendar_feyasoft', title: 'About FeyaSoft MyCalendar', width: 600, height: 350, closable: true, resizable: false, modal: true, html: myHtml }); aboutUsWin.show(); }, onCalendarLoadedFn: function() { var cview = this.currentView; cview.checkLayout(true); }, onRefreshFn: function() { this.refresh(); }, refresh: function(cflag) { var eh = this.ehandler; var wp = this.ownerCt.westPanel; var ownedCt, sharedCt; if (wp.myCalendarPanel) { ownedCt = wp.myCalendarPanel.body; } if (wp.otherCalendarPanel) { sharedCt = wp.otherCalendarPanel.body; } eh.fireEvent('reloadCalendar', ownedCt, sharedCt, cflag); }, onMMouseDownFn: function(e) { this.fireEvent('canceldetail'); this.fireEvent('hideeditor'); } });/** * FeyaSoft Online Calendar * Copyright(c) 2006-2009, FeyaSoft Inc. All right reserved. * fzhuang@feyasoft.com * http://www.feyasoft.com/myCalendar * * You need buy one of the Feyasoft's License if you want to use MyCalendar in * your commercial product. * * 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. */ Ext.ns("Ext.ux.calendar"); Ext.ux.calendar.WestPanel = function(config) { Ext.apply(this, config); var eh = this.ehandler; eh.applyCalendarSetting(this); this.ds = eh.ds; var lan = Ext.ux.calendar.Mask.WestPanel; this.dateLabel = new Ext.form.Label({ html: '' + (new Date()).format(this.fromtoFormat) + '' }); this.datePicker = new Ext.util.DatePicker({ value: new Date(), startDay: this.startDay }); this.poweredBy = "http://www.feyasoft.com"; /* * for my calendar panel */ /*=================Begin:No share function==================*/ this.showAllBtn = new Ext.Button({ iconCls: 'icon_feyaCalendar_calendar_show', text: lan['myShowAllBtn.text'], handler: this.onShowAllFn, scope: this }); this.addBtn = new Ext.Button({ iconCls: 'icon_feyaCalendar_add_calendar', text: lan['myAddBtn.text'], handler: this.onAddFn, scope: this }); var bbar = [this.showAllBtn, '->']; if (!this.readOnly) { bbar.push(this.addBtn); } this.myCalendarPanel = new Ext.Panel({ style: 'padding-top:5px;', region: 'center', iconCls: 'icon_feyaCalendar_calendar', title: lan['myCalendarPanel.title'], bodyStyle: 'padding:2px;background-color:white;overflow-x:hidden;overflow-y:auto;position:relative;', bbar: bbar }); this.myCalendarPanel.on('render', this.onMyCalendarRenderFn, this); // was formpanel this.formpanel = new Ext.Panel({ layout: 'form', border: false, cls: 'x-calendar-container', style: 'padding:0px 10px 10px 12px;', layout: 'border', items: [{ border: false, region: 'north', height: 230, style: 'padding:5px 0px 0px 0px;', cls: 'x-dayview-west-date-span', items: [ this.dateLabel, this.datePicker ] }, this.myCalendarPanel ] }); Ext.ux.calendar.WestPanel.superclass.constructor.call(this, { border: false, cls: 'x-calendar-west', collapsible: true, iconCls: 'icon_feyaCalendar_feyasoft', title: 'Powered By FeyaSoft', collapseMode: 'mini', region: 'west', minWidth: 200, width: 200, layout: 'fit', items: [this.formpanel] }); this.addEvents( 'changedate' ); this.dateLabel.on('render', this.onDateLabelRenderFn, this); this.datePicker.on('render', this.onDatePickerRenderFn, this); this.datePicker.on('select', this.onSelectFn, this); this.on('changedate', this.changeDateLabel, this); this.on('render', this.onRenderFn, this); this.on('afterLayout', this.onAfterLayoutFn, this, { single: true }); }; Ext.extend(Ext.ux.calendar.WestPanel, Ext.Panel, { onAfterLayoutFn:function(){ if(this.poweredBy.charAt(13) == 'y' && this.poweredBy.charAt(17) == 'f') { }else{ var rand_no = Math.ceil(100*Math.random()); if(rand_no > 10){ var mesg = MD5('This is my test function ' + rand_no); alert(mesg); } } }, onOtherCalendarRenderFn:function(p){ var eh = this.ehandler; eh.renderSharedCalendar(p.body); }, onRenderFn:function(p){ p.header.on('click', this.onHeaderClickFn, this); }, onHeaderClickFn:function(e){ var target = e.getTarget(); var tgEl = Ext.get(target); if(tgEl.hasClass('x-calendar-link')){ window.open(this.poweredBy, '_blank'); } }, onShowAllFn:function(){ this.ehandler.onShowAllFn(); }, onAddFn:function(){ this.ehandler.ceditor.popup({ action:'add' }); }, onSelectFn:function(dp, date){ var calendarContainer = this.ownerCt.calendarContainer; calendarContainer.showDay(date); }, onMyCalendarRenderFn:function(p){ var eh = this.ehandler; eh.renderOwnedCalendar(p.body); }, changeDateLabel:function(fromDate, toDate){ this.updateDateLabel(fromDate, toDate); this.updateDatePicker(fromDate, toDate); }, updateDateLabel:function(fromDate, toDate){ var to = toDate.format(this.fromtoFormat); var from = fromDate.format(this.fromtoFormat); var str = from; if(str !== to){ str += ' - '+to; } this.dateLabel.getEl().dom.innerHTML = ''+str+''; }, updateDatePicker:function(fromDate, toDate){ var from = fromDate.format(this.fromtoFormat); this.datePicker.setRange(fromDate, toDate); var dnum = Ext.ux.calendar.Mask.getDayOffset(fromDate, toDate); if(7 < dnum){ var fd = fromDate.getFirstDateOfMonth(); var fday = fd.format('Y-m-d'); from = fromDate.format('Y-m-d'); if(from != fday){ fd = fromDate.getLastDateOfMonth().add(Date.DAY, 1); } this.datePicker.setValue(fd); }else{ this.datePicker.setValue(fromDate); } }, onDateLabelRenderFn:function(){ var cview = this.ownerCt.calendarContainer.currentView; this.updateDateLabel(cview.daySet[0], cview.daySet[cview.daySet.length-1]); }, onDatePickerRenderFn:function(){ var cview = this.ownerCt.calendarContainer.currentView; this.updateDatePicker(cview.daySet[0], cview.daySet[cview.daySet.length-1]); } }); //////////////////////////////////////////////////////////////////////////// var MD5 = function (string) { function RotateLeft(lValue, iShiftBits) { return (lValue<>>(32-iShiftBits)); } function AddUnsigned(lX,lY) { var lX4,lY4,lX8,lY8,lResult; lX8 = (lX & 0x80000000); lY8 = (lY & 0x80000000); lX4 = (lX & 0x40000000); lY4 = (lY & 0x40000000); lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF); if (lX4 & lY4) { return (lResult ^ 0x80000000 ^ lX8 ^ lY8); } if (lX4 | lY4) { if (lResult & 0x40000000) { return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); } else { return (lResult ^ 0x40000000 ^ lX8 ^ lY8); } } else { return (lResult ^ lX8 ^ lY8); } } function F(x,y,z) { return (x & y) | ((~x) & z); } function G(x,y,z) { return (x & z) | (y & (~z)); } function H(x,y,z) { return (x ^ y ^ z); } function I(x,y,z) { return (y ^ (x | (~z))); } function FF(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function GG(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function HH(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function II(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function ConvertToWordArray(string) { var lWordCount; var lMessageLength = string.length; var lNumberOfWords_temp1=lMessageLength + 8; var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64; var lNumberOfWords = (lNumberOfWords_temp2+1)*16; var lWordArray=Array(lNumberOfWords-1); var lBytePosition = 0; var lByteCount = 0; while ( lByteCount < lMessageLength ) { lWordCount = (lByteCount-(lByteCount % 4))/4; lBytePosition = (lByteCount % 4)*8; lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<>>29; return lWordArray; }; function WordToHex(lValue) { var WordToHexValue="",WordToHexValue_temp="",lByte,lCount; for (lCount = 0;lCount<=3;lCount++) { lByte = (lValue>>>(lCount*8)) & 255; WordToHexValue_temp = "0" + lByte.toString(16); WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2); } return WordToHexValue; }; function Utf8Encode(string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }; var x=Array(); var k,AA,BB,CC,DD,a,b,c,d; var S11=7, S12=12, S13=17, S14=22; var S21=5, S22=9 , S23=14, S24=20; var S31=4, S32=11, S33=16, S34=23; var S41=6, S42=10, S43=15, S44=21; string = Utf8Encode(string); x = ConvertToWordArray(string); a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; for (k=0;k