/* * Ext JS Library 3.4.0 * Copyright(c) 2006-2011 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ window.undefined=window.undefined;Ext={version:"3.4.0",versionDetail:{major:3,minor:4,patch: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,u=Object.prototype.toString,v=navigator.userAgent.toLowerCase(),A=function(e){return e.test(v)},i=document,n=i.documentMode,l=i.compatMode=="CSS1Compat",C=A(/opera/),h=A(/\bchrome\b/),w=A(/webkit/),z=!h&&A(/safari/),f=z&&A(/applewebkit\/4/),b=z&&A(/version\/3/),D=z&&A(/version\/4/),t=!C&&A(/msie/),r=t&&(A(/msie 7/)||n==7),q=t&&(A(/msie 8/)&&n!=7),p=t&&A(/msie 9/),s=t&&!r&&!q&&!p,o=!w&&A(/gecko/),d=o&&A(/rv:1\.8/),a=o&&A(/rv:1\.9/),x=t&&!l,B=A(/windows|win32/),k=A(/macintosh|mac os x/),j=A(/adobeair/),m=A(/linux/),c=/^https/i.test(window.location.protocol);if(s){try{i.execCommand("BackgroundImageCache",false,true)}catch(y){}}Ext.apply(Ext,{SSL_SECURE_URL:c&&t?'javascript:""':"about:blank",isStrict:l,isSecure:c,isReady:false,enableForcedBoxModel:false,enableGarbageCollector:true,enableListenerCollection:false,enableNestedListenerRemoval:false,USE_NATIVE_JSON:false,applyIf:function(E,F){if(E){for(var e in F){if(!Ext.isDefined(E[e])){E[e]=F[e]}}}return E},id:function(e,E){e=Ext.getDom(e,true)||{};if(!e.id){e.id=(E||"ext-gen")+(++g)}return e.id},extend:function(){var E=function(G){for(var F in G){this[F]=G[F]}};var e=Object.prototype.constructor;return function(L,I,K){if(typeof I=="object"){K=I;I=L;L=K.constructor!=e?K.constructor:function(){I.apply(this,arguments)}}var H=function(){},J,G=I.prototype;H.prototype=G;J=L.prototype=new H();J.constructor=L;L.superclass=G;if(G.constructor==e){G.constructor=I}L.override=function(F){Ext.override(L,F)};J.superclass=J.supr=(function(){return G});J.override=E;Ext.override(L,K);L.extend=function(F){return Ext.extend(L,F)};return L}}(),override:function(e,F){if(F){var E=e.prototype;Ext.apply(E,F);if(Ext.isIE&&F.hasOwnProperty("toString")){E.toString=F.toString}}},namespace:function(){var G=arguments.length,H=0,E,F,e,J,I,K;for(;H0){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(;c0){for(var p=0;p0);if(!A){A=true;for(I=0;I=0){B=s.substr(0,A).toLowerCase();if(s.charAt(A+1)==" "){++A}C[B]=s.substr(A+1)}})}catch(z){}return{tId:u.tId,status:v?204:w.status,statusText:v?"No Content":w.statusText,getResponseHeader:function(s){return C[s.toLowerCase()]},getAllResponseHeaders:function(){return x},responseText:w.responseText,responseXML:w.responseXML,argument:y}}function o(s){if(s.tId){k.conn[s.tId]=null}s.conn=null;s=null}function f(x,y,t,s){if(!y){o(x);return}var v,u;try{if(x.conn.status!==undefined&&x.conn.status!=0){v=x.conn.status}else{v=13030}}catch(w){v=13030}if((v>=200&&v<300)||(Ext.isIE&&v==1223)){u=p(x,y.argument);if(y.success){if(!y.scope){y.success(u)}else{y.success.apply(y.scope,[u])}}}else{switch(v){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:u=e(x.tId,y.argument,(t?t:false),s);if(y.failure){if(!y.scope){y.failure(u)}else{y.failure.apply(y.scope,[u])}}break;default:u=p(x,y.argument);if(y.failure){if(!y.scope){y.failure(u)}else{y.failure.apply(y.scope,[u])}}}}o(x);u=null}function m(u,x,s,w,t,v){if(s&&s.readyState==4){clearInterval(t[w]);t[w]=null;if(v){clearTimeout(k.timeout[w]);k.timeout[w]=null}f(u,x)}}function r(s,t){k.abort(s,t,true)}function n(u,x){x=x||{};var s=u.conn,w=u.tId,t=k.poll,v=x.timeout||null;if(v){k.conn[w]=s;k.timeout[w]=setTimeout(r.createCallback(u,x),v)}t[w]=setInterval(m.createCallback(u,x,s,w,t,v),k.pollInterval)}function i(w,t,v,s){var u=l()||null;if(u){u.conn.open(w,t,true);if(k.useDefaultXhrHeader){j("X-Requested-With",k.defaultXhrHeader)}if(s&&k.useDefaultHeader&&(!k.headers||!k.headers[d])){j(d,k.defaultPostHeader)}if(k.defaultHeaders||k.headers){h(u)}n(u,v);u.conn.send(s||null)}return u}function l(){var t;try{if(t=q(k.transactionId)){k.transactionId++}}catch(s){}finally{return t}}function q(v){var s;try{s=new XMLHttpRequest()}catch(u){for(var t=Ext.isIE6?1:0;t0&&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(s[0])){s=[s]}else{}Ext.fly(p,"_anim").position();A.setXY(p,j(x)?x:A.getXY(p));o=w.getAttr("points");if(j(y)){q=k.call(w,y,o);for(r=0,t=s.length;r0){n=n.concat(s)}n[n.length]=q}else{m.setRunAttr.call(this,u)}}});var k=function(n,p){var o=g.Dom.getXY(this.el);return[n[0]-o[0]+p[0],n[1]-o[1]+p[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(k0},suspendEvents:function(k){this.eventsSuspended=g;if(k&&!this.eventQueue){this.eventQueue=[]}},resumeEvents:function(){var k=this,l=k.eventQueue||[];k.eventsSuspended=i;delete k.eventQueue;j(l,function(m){k.fireEvent.apply(k,m)})}};var d=h.Observable.prototype;d.on=d.addListener;d.un=d.removeListener;h.Observable.releaseCapture=function(k){k.fireEvent=d.fireEvent};function e(l,m,k){return function(){if(m.target==arguments[0]){l.apply(k,Array.prototype.slice.call(arguments,0))}}}function b(n,p,k,m){k.task=new h.DelayedTask();return function(){k.task.delay(p.buffer,n,m,Array.prototype.slice.call(arguments,0))}}function c(m,n,l,k){return function(){n.removeListener(l,k);return m.apply(k,arguments)}}function a(n,p,k,m){return function(){var l=new h.DelayedTask(),o=Array.prototype.slice.call(arguments,0);if(!k.tasks){k.tasks=[]}k.tasks.push(l);l.delay(p.delay||10,function(){k.tasks.remove(l);n.apply(m,o)},m)}}h.Event=function(l,k){this.name=k;this.obj=l;this.listeners=[]};h.Event.prototype={addListener:function(o,n,m){var p=this,k;n=n||p.obj;if(!p.isListening(o,n)){k=p.createListener(o,n,m);if(p.firing){p.listeners=p.listeners.slice(0)}p.listeners.push(k)}},createListener:function(p,n,q){q=q||{};n=n||this.obj;var k={fn:p,scope:n,options:q},m=p;if(q.target){m=e(m,q,n)}if(q.delay){m=a(m,q,k,n)}if(q.single){m=c(m,this,p,n)}if(q.buffer){m=b(m,q,k,n)}k.fireFn=m;return k},findListener:function(o,n){var p=this.listeners,m=p.length,k;n=n||this.obj;while(m--){k=p[m];if(k){if(k.fn==o&&k.scope==n){return m}}}return -1},isListening:function(l,k){return this.findListener(l,k)!=-1},removeListener:function(r,q){var p,m,n,s=this,o=i;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=g}return o},clearListeners:function(){var n=this,k=n.listeners,m=k.length;while(m--){n.removeListener(k[m].fn,k[m].scope)}},fire:function(){var q=this,p=q.listeners,k=p.length,o=0,m;if(k>0){q.firing=g;var n=Array.prototype.slice.call(arguments,0);for(;o",i="",b=a+"",j=""+i,l=b+"",w=""+j;function h(B,D,C,E,A,y){var z=r.insertHtml(E,Ext.getDom(B),u(D));return C?Ext.get(z,true):z}function u(D){var z="",y,C,B,E;if(typeof D=="string"){z=D}else{if(Ext.isArray(D)){for(var A=0;A"}}}return z}function g(F,C,B,D){x.innerHTML=[C,B,D].join("");var y=-1,A=x,z;while(++y "'+D+'"'},insertBefore:function(y,A,z){return h(y,A,z,c)},insertAfter:function(y,A,z){return h(y,A,z,p,"nextSibling")},insertFirst:function(y,A,z){return h(y,A,z,n,"firstChild")},append:function(y,A,z){return h(y,A,z,q,"",true)},overwrite:function(y,A,z){y=Ext.getDom(y);y.innerHTML=u(A);return z?Ext.get(y.firstChild):y.firstChild},createHtml:u};return r}();Ext.Template=function(h){var j=this,c=arguments,e=[],d;if(Ext.isArray(h)){h=h.join("")}else{if(c.length>1){for(var g=0,b=c.length;g+~]\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?(["']?)(.*?)\4)?[\]\}])/,select:'n = byAttribute(n, "{2}", "{5}", "{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 h=document;Ext.Element=function(l,m){var n=typeof l=="string"?h.getElementById(l):l,o;if(!n){return null}o=n.id;if(!m&&o&&Ext.elCache[o]){return Ext.elCache[o].el}this.dom=n;this.id=o||Ext.id(n)};var d=Ext.DomHelper,e=Ext.Element,a=Ext.elCache;e.prototype={set:function(q,m){var n=this.dom,l,p,m=(m!==false)&&!!n.setAttribute;for(l in q){if(q.hasOwnProperty(l)){p=q[l];if(l=="style"){d.applyStyles(n,p)}else{if(l=="cls"){n.className=p}else{if(m){n.setAttribute(l,p)}else{n[l]=p}}}}}return this},defaultUnit:"px",is:function(l){return Ext.DomQuery.is(this.dom,l)},focus:function(o,n){var l=this,n=n||l.dom;try{if(Number(o)){l.focus.defer(o,null,[null,n])}else{n.focus()}}catch(m){}return l},blur:function(){try{this.dom.blur()}catch(l){}return this},getValue:function(l){var m=this.dom.value;return l?parseInt(m,10):m},addListener:function(l,o,n,m){Ext.EventManager.on(this.dom,l,o,n||this,m);return this},removeListener:function(l,n,m){Ext.EventManager.removeListener(this.dom,l,n,m||this);return this},removeAllListeners:function(){Ext.EventManager.removeAll(this.dom);return this},purgeAllListeners:function(){Ext.EventManager.purgeElement(this,true);return this},addUnits:function(l){if(l===""||l=="auto"||l===undefined){l=l||""}else{if(!isNaN(l)||!i.test(l)){l=l+(this.defaultUnit||"px")}}return l},load:function(m,n,l){Ext.Ajax.request(Ext.apply({params:n,url:m.url||m,callback:l,el:this.dom,indicatorText:m.indicatorText||""},Ext.isObject(m)?m:{}));return this},isBorderBox:function(){return Ext.isBorderBox||Ext.isForcedBorderBox||g[(this.dom.tagName||"").toLowerCase()]},remove:function(){var l=this,m=l.dom;if(m){delete l.dom;Ext.removeNode(m)}},hover:function(m,l,o,n){var p=this;p.on("mouseenter",m,o||p.dom,n);p.on("mouseleave",l,o||p.dom,n);return p},contains:function(l){return !l?false:Ext.lib.Dom.isAncestor(this.dom,l.dom?l.dom:l)},getAttributeNS:function(m,l){return this.getAttribute(l,m)},getAttribute:(function(){var p=document.createElement("table"),o=false,m="getAttribute" in p,l=/undefined|unknown/;if(m){try{p.getAttribute("ext:qtip")}catch(n){o=true}return function(q,s){var r=this.dom,t;if(r.getAttributeNS){t=r.getAttributeNS(s,q)||null}if(t==null){if(s){if(o&&r.tagName.toUpperCase()=="TABLE"){try{t=r.getAttribute(s+":"+q)}catch(u){t=""}}else{t=r.getAttribute(s+":"+q)}}else{t=r.getAttribute(q)||r[q]}}return t||""}}else{return function(q,s){var r=this.om,u,t;if(s){t=r[s+":"+q];u=l.test(typeof t)?undefined:t}else{u=r[q]}return u||""}}p=null})(),update:function(l){if(this.dom){this.dom.innerHTML=l}return this}};var k=e.prototype;e.addMethods=function(l){Ext.apply(k,l)};k.on=k.addListener;k.un=k.removeListener;k.autoBoxAdjust=true;var i=/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,c;e.get=function(m){var l,p,o;if(!m){return null}if(typeof m=="string"){if(!(p=h.getElementById(m))){return null}if(a[m]&&a[m].el){l=a[m].el;l.dom=p}else{l=e.addToCache(new e(p))}return l}else{if(m.tagName){if(!(o=m.id)){o=Ext.id(m)}if(a[o]&&a[o].el){l=a[o].el;l.dom=m}else{l=e.addToCache(new e(m))}return l}else{if(m instanceof e){if(m!=c){if(Ext.isIE&&(m.id==undefined||m.id=="")){m.dom=m.dom}else{m.dom=h.getElementById(m.id)||m.dom}}return m}else{if(m.isComposite){return m}else{if(Ext.isArray(m)){return e.select(m)}else{if(m==h){if(!c){var n=function(){};n.prototype=e.prototype;c=new n();c.dom=h}return c}}}}}}return null};e.addToCache=function(l,m){m=m||l.id;a[m]={el:l,data:{},events:{}};return l};e.data=function(m,l,n){m=e.get(m);if(!m){return null}var o=a[m.id].data;if(arguments.length==2){return o[l]}else{return(o[l]=n)}};function j(){if(!Ext.enableGarbageCollector){clearInterval(e.collectorThreadId)}else{var l,n,q,p;for(l in a){p=a[l];if(p.skipGC){continue}n=p.el;q=n.dom;if(!q||!q.parentNode||(!q.offsetParent&&!h.getElementById(l))){if(Ext.enableListenerCollection){Ext.EventManager.removeAll(q)}delete a[l]}}if(Ext.isIE){var m={};for(l in a){m[l]=a[l]}a=Ext.elCache=m}}}e.collectorThreadId=setInterval(j,30000);var b=function(){};b.prototype=e.prototype;e.Flyweight=function(l){this.dom=l};e.Flyweight.prototype=new b();e.Flyweight.prototype.isFlyweight=true;e._flyweights={};e.fly=function(n,l){var m=null;l=l||"_global";if(n=Ext.getDom(n)){(e._flyweights[l]=e._flyweights[l]||new e.Flyweight()).dom=n;m=e._flyweights[l]}return m};Ext.get=e.get;Ext.fly=e.fly;var g=Ext.isStrict?{select:1}:{input:1,select:1,textarea:1};if(Ext.isIE||Ext.isGecko){g.button=1}})();Ext.Element.addMethods(function(){var d="parentNode",b="nextSibling",c="previousSibling",e=Ext.DomQuery,a=Ext.get;return{findParent:function(m,l,h){var j=this.dom,g=document.body,k=0,i;if(Ext.isGecko&&Object.prototype.toString.call(j)=="[object XULElement]"){return null}l=l||50;if(isNaN(l)){i=Ext.getDom(l);l=Number.MAX_VALUE}while(j&&j.nodeType==1&&k "+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(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.Element.addMethods(function(){var A=Ext.supports,h={},x=/(-[a-z])/gi,s=document.defaultView,D=/alpha\(opacity=(.*)\)/i,l=/^\s+|\s+$/g,B=Ext.Element,u=/\s+/,b=/\w/g,d="padding",c="margin",y="border",t="-left",q="-right",w="-top",o="-bottom",j="-width",r=Math,z="hidden",e="isClipped",k="overflow",n="overflow-x",m="overflow-y",C="originalClip",i={l:y+t+j,r:y+q+j,t:y+w+j,b:y+o+j},g={l:d+t,r:d+q,t:d+w,b:d+o},a={l:c+t,r:c+q,t:c+w,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"?(A.cssFloat?"cssFloat":"styleFloat"):F.replace(x,p))}return{adjustWidth:function(F){var G=this;var H=(typeof F=="number");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=(typeof F=="number");if(H&&G.autoBoxAdjust&&!G.isBorderBox()){F-=(G.getBorderWidth("tb")+G.getPadding("tb"))}return(H&&F<0)?0:F},addClass:function(J){var K=this,I,F,H,G=[];if(!Ext.isArray(J)){if(typeof J=="string"&&!this.hasClass(J)){K.dom.className+=" "+J}}else{for(I=0,F=J.length;I5?H.toLowerCase():G)},setStyle:function(I,H){var F,G;if(typeof I!="object"){F={};F[I]=H;I=F}for(G in I){H=I[G];G=="opacity"?this.setOpacity(H):this.dom.style[v(G)]=H}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,z);F.setStyle(n,z);F.setStyle(m,z)}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(M,L){var J=0,K=M.match(b),I,H,G,F=K.length;for(G=0;Ga.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.VISIBILITY=1;Ext.Element.DISPLAY=2;Ext.Element.OFFSETS=3;Ext.Element.ASCLASS=4;Ext.Element.visibilityCls="x-hide-nosize";Ext.Element.addMethods(function(){var e=Ext.Element,p="opacity",j="visibility",g="display",d="hidden",n="offsets",k="asclass",m="none",a="nosize",b="originalDisplay",c="visibilityMode",h="isVisible",i=e.data,l=function(r){var q=i(r,b);if(q===undefined){i(r,b,q="")}return q},o=function(r){var q=i(r,c);if(q===undefined){i(r,c,q=1)}return q};return{originalDisplay:"",visibilityMode:1,setVisibilityMode:function(q){i(this.dom,c,q);return this},animate:function(r,t,s,u,q){this.anim(r,{duration:t,callback:s,easing:u},q);return this},anim:function(t,u,r,w,s,q){r=r||"run";u=u||{};var v=this,x=Ext.lib.Anim[r](v.dom,t,(u.duration||w)||0.35,(u.easing||s)||"easeOut",function(){if(q){q.call(v)}if(u.callback){u.callback.call(u.scope||v,v,u)}},v);u.anim=x;return x},preanim:function(q,r){return !q[r]?false:(typeof q[r]=="object"?q[r]:{duration:q[r+1],callback:q[r+2],easing:q[r+3]})},isVisible:function(){var q=this,s=q.dom,r=i(s,h);if(typeof r=="boolean"){return r}r=!q.isStyle(j,d)&&!q.isStyle(g,m)&&!((o(s)==e.ASCLASS)&&q.hasClass(q.visibilityCls||e.visibilityCls));i(s,h,r);return r},setVisible:function(t,q){var w=this,r,y,x,v,u=w.dom,s=o(u);if(typeof q=="string"){switch(q){case g:s=e.DISPLAY;break;case j:s=e.VISIBILITY;break;case n:s=e.OFFSETS;break;case a:case k:s=e.ASCLASS;break}w.setVisibilityMode(s);q=false}if(!q||!w.anim){if(s==e.ASCLASS){w[t?"removeClass":"addClass"](w.visibilityCls||e.visibilityCls)}else{if(s==e.DISPLAY){return w.setDisplayed(t)}else{if(s==e.OFFSETS){if(!t){w.hideModeStyles={position:w.getStyle("position"),top:w.getStyle("top"),left:w.getStyle("left")};w.applyStyles({position:"absolute",top:"-10000px",left:"-10000px"})}else{w.applyStyles(w.hideModeStyles||{position:"",top:"",left:""});delete w.hideModeStyles}}else{w.fixDisplay();u.style.visibility=t?"visible":d}}}}else{if(t){w.setOpacity(0.01);w.setVisible(true)}w.anim({opacity:{to:(t?1:0)}},w.preanim(arguments,1),null,0.35,"easeIn",function(){t||w.setVisible(false).setOpacity(1)})}i(u,h,t);return w},hasMetrics:function(){var q=this.dom;return this.isVisible()||(o(q)==e.VISIBILITY)},toggle:function(q){var r=this;r.setVisible(!r.isVisible(),r.preanim(arguments,0));return r},setDisplayed:function(q){if(typeof q=="boolean"){q=q?l(this.dom):m}this.setStyle(g,q);return this},fixDisplay:function(){var q=this;if(q.isStyle(g,m)){q.setStyle(j,d);q.setStyle(g,l(this.dom));if(q.isStyle(g,m)){q.setStyle(g,"block")}}},hide:function(q){if(typeof q=="string"){this.setVisible(false,q);return this}this.setVisible(false,this.preanim(arguments,0));return this},show:function(q){if(typeof q=="string"){this.setVisible(true,q);return this}this.setVisible(true,this.preanim(arguments,0));return this}}}());(function(){var y=null,A=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",w="hidden",z="absolute",u="visible",e="motion",o="position",r="easeOut",d=new Ext.Element.Flyweight(),v={},x=function(B){return B||{}},p=function(B){d.dom=B;d.id=Ext.id(B);return d},c=function(B){if(!v[B]){v[B]=[]}return v[B]},b=function(C,B){v[C]=B};Ext.enableFx=k;Ext.Fx={switchStatements:function(C,D,B){return D.apply(this,B[C])},slideIn:function(H,E){E=x(E);var J=this,G=J.dom,M=G.style,O,B,L,D,C,M,I,N,K,F;H=H||"t";J.queueFx(E,function(){O=p(G).getXY();p(G).fixDisplay();B=p(G).getFxRestore();L={x:O[0],y:O[1],0:O[0],1:O[1],width:G.offsetWidth,height:G.offsetHeight};L.right=L.x+L.width;L.bottom=L.y+L.height;p(G).setWidth(L.width).setHeight(L.height);D=p(G).fxWrap(B.pos,E,w);M.visibility=u;M.position=z;function P(){p(G).fxUnwrap(D,B.pos,E);M.width=B.width;M.height=B.height;p(G).afterFx(E)}N={to:[L.x,L.y]};K={to:L.width};F={to:L.height};function Q(U,R,V,S,X,Z,ac,ab,aa,W,T){var Y={};p(U).setWidth(V).setHeight(S);if(p(U)[X]){p(U)[X](Z)}R[ac]=R[ab]="0";if(aa){Y.width=aa}if(W){Y.height=W}if(T){Y.points=T}return Y}I=p(G).switchStatements(H.toLowerCase(),Q,{t:[D,M,L.width,0,y,y,n,l,y,F,y],l:[D,M,0,L.height,y,y,m,s,K,y,y],r:[D,M,L.width,L.height,j,L.right,n,s,y,y,N],b:[D,M,L.width,L.height,h,L.bottom,n,s,y,F,N],tl:[D,M,0,0,y,y,m,l,K,F,N],bl:[D,M,0,0,h,L.y+L.height,m,s,K,F,N],br:[D,M,0,0,a,[L.right,L.bottom],n,s,K,F,N],tr:[D,M,0,0,j,L.x+L.width,n,l,K,F,N]});M.visibility=u;p(D).show();arguments.callee.anim=p(D).fxanim(I,E,e,0.5,r,P)});return J},slideOut:function(F,D){D=x(D);var H=this,E=H.dom,K=E.style,L=H.getXY(),C,B,I,J,G={to:0};F=F||"t";H.queueFx(D,function(){B=p(E).getFxRestore();I={x:L[0],y:L[1],0:L[0],1:L[1],width:E.offsetWidth,height:E.offsetHeight};I.right=I.x+I.width;I.bottom=I.y+I.height;p(E).setWidth(I.width).setHeight(I.height);C=p(E).fxWrap(B.pos,D,u);K.visibility=u;K.position=z;p(C).setWidth(I.width).setHeight(I.height);function M(){D.useDisplay?p(E).setDisplayed(t):p(E).hide();p(E).fxUnwrap(C,B.pos,D);K.width=B.width;K.height=B.height;p(E).afterFx(D)}function N(O,W,U,X,S,V,R,T,Q){var P={};O[W]=O[U]="0";P[X]=S;if(V){P[V]=R}if(T){P[T]=Q}return P}J=p(E).switchStatements(F.toLowerCase(),N,{t:[K,n,l,q,G],l:[K,m,s,g,G],r:[K,n,s,g,G,i,{to:[I.right,I.y]}],b:[K,n,s,q,G,i,{to:[I.x,I.bottom]}],tl:[K,m,l,g,G,q,G],bl:[K,m,s,g,G,q,G,i,{to:[I.x,I.bottom]}],br:[K,n,s,g,G,q,G,i,{to:[I.x+I.width,I.bottom]}],tr:[K,n,l,g,G,q,G,i,{to:[I.right,I.y]}]});arguments.callee.anim=p(C).fxanim(J,D,e,0.5,r,M)});return H},puff:function(H){H=x(H);var F=this,G=F.dom,C=G.style,D,B,E;F.queueFx(H,function(){D=p(G).getWidth();B=p(G).getHeight();p(G).clearOpacity();p(G).show();E=p(G).getFxRestore();function I(){H.useDisplay?p(G).setDisplayed(t):p(G).hide();p(G).clearOpacity();p(G).setPositioning(E.pos);C.width=E.width;C.height=E.height;C.fontSize="";p(G).afterFx(H)}arguments.callee.anim=p(G).fxanim({width:{to:p(G).adjustWidth(D*2)},height:{to:p(G).adjustHeight(B*2)},points:{by:[-D*0.5,-B*0.5]},opacity:{to:0},fontSize:{to:200,unit:"%"}},H,e,0.5,r,I)});return F},switchOff:function(F){F=x(F);var D=this,E=D.dom,B=E.style,C;D.queueFx(F,function(){p(E).clearOpacity();p(E).clip();C=p(E).getFxRestore();function G(){F.useDisplay?p(E).setDisplayed(t):p(E).hide();p(E).clearOpacity();p(E).setPositioning(C.pos);B.width=C.width;B.height=C.height;p(E).afterFx(F)}p(E).fxanim({opacity:{to:0.3}},y,y,0.1,y,function(){p(E).clearOpacity();(function(){p(E).fxanim({height:{to:1},points:{by:[0,p(E).getHeight()*0.5]}},F,e,0.3,"easeIn",G)}).defer(100)})});return D},highlight:function(D,H){H=x(H);var F=this,G=F.dom,B=H.attr||"backgroundColor",C={},E;F.queueFx(H,function(){p(G).clearOpacity();p(G).show();function I(){G.style[B]=E;p(G).afterFx(H)}E=G.style[B];C[B]={from:D||"ffff9c",to:H.endColor||p(G).getColor(B)||"ffffff"};arguments.callee.anim=p(G).fxanim(C,H,"color",1,"easeIn",I)});return F},frame:function(B,E,H){H=x(H);var D=this,G=D.dom,C,F;D.queueFx(H,function(){B=B||"#C3DAF9";if(B.length==6){B="#"+B}E=E||1;p(G).show();var L=p(G).getXY(),J={x:L[0],y:L[1],0:L[0],1:L[1],width:G.offsetWidth,height:G.offsetHeight},I=function(){C=p(document.body||document.documentElement).createChild({style:{position:z,"z-index":35000,border:"0px solid "+B}});return C.queueFx({},K)};arguments.callee.anim={isAnimated:true,stop:function(){E=0;C.stopFx()}};function K(){var M=Ext.isBorderBox?2:1;F=C.anim({top:{from:J.y,to:J.y-20},left:{from:J.x,to:J.x-20},borderWidth:{from:0,to:10},opacity:{from:1,to:0},height:{from:J.height,to:J.height+20*M},width:{from:J.width,to:J.width+20*M}},{duration:H.duration||1,callback:function(){C.remove();--E>0?I():p(G).afterFx(H)}});arguments.callee.anim={isAnimated:true,stop:function(){F.stop()}}}I()});return D},pause:function(D){var C=this.dom,B;this.queueFx({},function(){B=setTimeout(function(){p(C).afterFx({})},D*1000);arguments.callee.anim={isAnimated:true,stop:function(){clearTimeout(B);p(C).afterFx({})}}});return this},fadeIn:function(D){D=x(D);var B=this,C=B.dom,E=D.endOpacity||1;B.queueFx(D,function(){p(C).setOpacity(0);p(C).fixDisplay();C.style.visibility=u;arguments.callee.anim=p(C).fxanim({opacity:{to:E}},D,y,0.5,r,function(){if(E==1){p(C).clearOpacity()}p(C).afterFx(D)})});return B},fadeOut:function(E){E=x(E);var C=this,D=C.dom,B=D.style,F=E.endOpacity||0;C.queueFx(E,function(){arguments.callee.anim=p(D).fxanim({opacity:{to:F}},E,y,0.5,r,function(){if(F==0){Ext.Element.data(D,"visibilityMode")==Ext.Element.DISPLAY||E.useDisplay?B.display="none":B.visibility=w;p(D).clearOpacity()}p(D).afterFx(E)})});return C},scale:function(B,C,D){this.shift(Ext.apply({},D,{width:B,height:C}));return this},shift:function(D){D=x(D);var C=this.dom,B={};this.queueFx(D,function(){for(var E in D){if(D[E]!=A){B[E]={to:D[E]}}}B.width?B.width.to=p(C).adjustWidth(D.width):B;B.height?B.height.to=p(C).adjustWidth(D.height):B;if(B.x||B.y||B.xy){B.points=B.xy||{to:[B.x?B.x.to:p(C).getX(),B.y?B.y.to:p(C).getY()]}}arguments.callee.anim=p(C).fxanim(B,D,e,0.35,r,function(){p(C).afterFx(D)})});return this},ghost:function(E,C){C=x(C);var G=this,D=G.dom,J=D.style,H={opacity:{to:0},points:{}},K=H.points,B,I,F;E=E||"b";G.queueFx(C,function(){B=p(D).getFxRestore();I=p(D).getWidth();F=p(D).getHeight();function L(){C.useDisplay?p(D).setDisplayed(t):p(D).hide();p(D).clearOpacity();p(D).setPositioning(B.pos);J.width=B.width;J.height=B.height;p(D).afterFx(C)}K.by=p(D).switchStatements(E.toLowerCase(),function(N,M){return[N,M]},{t:[0,-F],l:[-I,0],r:[I,0],b:[0,F],tl:[-I,-F],bl:[-I,F],br:[I,F],tr:[I,-F]});arguments.callee.anim=p(D).fxanim(H,C,e,0.5,r,L)});return G},syncFx:function(){var B=this;B.fxDefaults=Ext.apply(B.fxDefaults||{},{block:t,concurrent:k,stopFx:t});return B},sequenceFx:function(){var B=this;B.fxDefaults=Ext.apply(B.fxDefaults||{},{block:t,concurrent:t,stopFx:t});return B},nextFx:function(){var B=c(this.dom.id)[0];if(B){B.call(this)}},hasActiveFx:function(){return c(this.dom.id)[0]},stopFx:function(B){var C=this,E=C.dom.id;if(C.hasActiveFx()){var D=c(E)[0];if(D&&D.anim){if(D.anim.isAnimated){b(E,[D]);D.anim.stop(B!==undefined?B:k)}else{b(E,[])}}}return C},beforeFx:function(B){if(this.hasActiveFx()&&!B.concurrent){if(B.stopFx){this.stopFx();return k}return t}return k},hasFxBlock:function(){var B=c(this.dom.id);return B&&B[0]&&B[0].block},queueFx:function(E,B){var C=p(this.dom);if(!C.hasFxBlock()){Ext.applyIf(E,C.fxDefaults);if(!E.concurrent){var D=C.beforeFx(E);B.block=E.block;c(C.dom.id).push(B);if(D){C.nextFx()}}else{B.call(C)}}return C},fxWrap:function(H,F,D){var E=this.dom,C,B;if(!F.wrap||!(C=Ext.getDom(F.wrap))){if(F.fixPosition){B=p(E).getXY()}var G=document.createElement("div");G.style.visibility=D;C=E.parentNode.insertBefore(G,E);p(C).setPositioning(H);if(p(C).isStyle(o,"static")){p(C).position("relative")}p(E).clearPositioning("auto");p(C).clip();C.appendChild(E);if(B){p(C).setXY(B)}}return C},fxUnwrap:function(C,F,E){var D=this.dom;p(D).clearPositioning();p(D).setPositioning(F);if(!E.wrap){var B=p(C).dom.parentNode;B.insertBefore(D,C);p(C).remove()}},getFxRestore:function(){var B=this.dom.style;return{pos:this.getPositioning(),width:B.width,height:B.height}},afterFx:function(C){var B=this.dom,D=B.id;if(C.afterStyle){p(B).setStyle(C.afterStyle)}if(C.afterCls){p(B).addClass(C.afterCls)}if(C.remove==k){p(B).remove()}if(C.callback){C.callback.call(C.scope,p(B))}if(!C.concurrent){c(D).shift();p(B).nextFx()}},fxanim:function(E,F,C,G,D,B){C=C||"run";F=F||{};var H=Ext.lib.Anim[C](this.dom,E,(F.duration||G)||0.35,(F.easing||D)||r,B,this);F.anim=H;return H}};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(typeof d=="string"){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;Ext.CompositeElementLite.importElementMethods=function(){var c,b=Ext.Element.prototype,a=Ext.CompositeElementLite.prototype;for(c in b){if(typeof b[c]=="function"){(function(d){a[d]=a[d]||function(){return this.invoke(d,arguments)}}).call(a,c)}}};Ext.CompositeElementLite.importElementMethods();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;(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:Ext.num(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.applyIf(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",src:Ext.SSL_SECURE_URL});v.body.appendChild(r);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(w,o){t=v.createElement("input");Ext.fly(t).set({type:"hidden",value:o,name:w});m.appendChild(t);u.push(t)});function s(){var x=this,w={responseText:"",responseXML:null,argument:q.argument},A,z;try{A=r.contentWindow.document||r.contentDocument||g.frames[l].document;if(A){if(A.body){if(/textarea/i.test((z=A.body.firstChild||{}).tagName)){w.responseText=z.value}else{w.responseText=A.body.innerHTML}}w.responseXML=A.XMLDocument||A}}catch(y){}Ext.EventManager.removeListener(r,c,s,x);x.fireEvent(e,x,w,q);function o(D,C,B){if(Ext.isFunction(D)){D.apply(C,B)}}o(q.success,q.scope,[w,q]);o(q.callback,q.scope,[q,true,w]);if(!x.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.util.JSON=new (function(){var useHasOwn=!!{}.hasOwnProperty,isNative=function(){var useNative=null;return function(){if(useNative===null){useNative=Ext.USE_NATIVE_JSON&&window.JSON&&JSON.toString()=="[object JSON]"}return useNative}}(),pad=function(n){return n<10?"0"+n:n},doDecode=function(json){return json?eval("("+json+")"):""},doEncode=function(o){if(!Ext.isDefined(o)||o===null){return"null"}else{if(Ext.isArray(o)){return encodeArray(o)}else{if(Ext.isDate(o)){return Ext.util.JSON.encodeDate(o)}else{if(Ext.isString(o)){return encodeString(o)}else{if(typeof o=="number"){return isFinite(o)?String(o):"null"}else{if(Ext.isBoolean(o)){return String(o)}else{var a=["{"],b,i,v;for(i in o){if(!o.getElementsByTagName){if(!useHasOwn||o.hasOwnProperty(i)){v=o[i];switch(typeof v){case"undefined":case"function":case"unknown":break;default:if(b){a.push(",")}a.push(doEncode(i),":",v===null?"null":doEncode(v));b=true}}}}a.push("}");return a.join("")}}}}}}},m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},encodeString=function(s){if(/["\\\x00-\x1f]/.test(s)){return'"'+s.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c}c=b.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"'}return'"'+s+'"'},encodeArray=function(o){var a=["["],b,i,l=o.length,v;for(i=0;i
';e.body.appendChild(g);d=g.lastChild;if((c=e.defaultView)){if(c.getComputedStyle(g.firstChild.firstChild,null).marginRight!="0px"){b.correctRightMargin=false}if(c.getComputedStyle(d,null).backgroundColor!="transparent"){b.correctTransparentColor=false}}b.cssFloat=!!d.style.cssFloat;e.body.removeChild(g)};if(Ext.isReady){a()}else{Ext.onReady(a)}})();Ext.EventObject=function(){var b=Ext.lib.Event,c=/(dbl)?click/,a={3:13,63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35},d=Ext.isIE?{1:0,4:1,2:2}:{0:0,1:1,2:2};Ext.EventObjectImpl=function(g){if(g){this.setEvent(g.browserEvent||g)}};Ext.EventObjectImpl.prototype={setEvent:function(h){var g=this;if(h==g||(h&&h.browserEvent)){return h}g.browserEvent=h;if(h){g.button=h.button?d[h.button]:(h.which?h.which-1:-1);if(c.test(h.type)&&g.button==-1){g.button=0}g.type=h.type;g.shiftKey=h.shiftKey;g.ctrlKey=h.ctrlKey||h.metaKey||false;g.altKey=h.altKey;g.keyCode=h.keyCode;g.charCode=h.charCode;g.target=b.getTarget(h);g.xy=b.getXY(h)}else{g.button=-1;g.shiftKey=false;g.ctrlKey=false;g.altKey=false;g.keyCode=0;g.charCode=0;g.target=null;g.xy=[0,0]}return g},stopEvent:function(){var e=this;if(e.browserEvent){if(e.browserEvent.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(e)}b.stopEvent(e.browserEvent)}},preventDefault:function(){if(this.browserEvent){b.preventDefault(this.browserEvent)}},stopPropagation:function(){var e=this;if(e.browserEvent){if(e.browserEvent.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(e)}b.stopPropagation(e.browserEvent)}},getCharCode:function(){return this.charCode||this.keyCode},getKey:function(){return this.normalizeKey(this.keyCode||this.charCode)},normalizeKey:function(e){return Ext.isSafari?(a[e]||e):e},getPageX:function(){return this.xy[0]},getPageY:function(){return this.xy[1]},getXY:function(){return this.xy},getTarget:function(g,h,e){return g?Ext.fly(this.target).findParent(g,h,e):(e?Ext.get(this.target):this.target)},getRelatedTarget:function(){return this.browserEvent?b.getRelatedTarget(this.browserEvent):null},getWheelDelta:function(){var g=this.browserEvent;var h=0;if(g.wheelDelta){h=g.wheelDelta/120}else{if(g.detail){h=-g.detail/3}}return h},within:function(h,i,e){if(h){var g=this[i?"getRelatedTarget":"getTarget"]();return g&&((e?(g==Ext.getDom(h)):false)||Ext.fly(h).contains(g))}return false}};return new Ext.EventObjectImpl()}();Ext.Loader=Ext.apply({},{load:function(j,i,k,c){var k=k||this,g=document.getElementsByTagName("head")[0],b=document.createDocumentFragment(),a=j.length,h=0,e=this;var l=function(m){g.appendChild(e.buildScriptTag(j[m],d))};var d=function(){h++;if(a==h&&typeof i=="function"){i.call(k)}else{if(c===true){l(h)}}};if(c===true){l.call(this,0)}else{Ext.each(j,function(n,m){b.appendChild(this.buildScriptTag(n,d))},this);g.appendChild(b)}},buildScriptTag:function(b,c){var a=document.createElement("script");a.type="text/javascript";a.src=b;if(a.readyState){a.onreadystatechange=function(){if(a.readyState=="loaded"||a.readyState=="complete"){a.onreadystatechange=null;c()}}}else{a.onload=c}return a}});Ext.ns("Ext.grid","Ext.list","Ext.dd","Ext.tree","Ext.form","Ext.menu","Ext.state","Ext.layout.boxOverflow","Ext.app","Ext.ux","Ext.chart","Ext.direct","Ext.slider");Ext.apply(Ext,function(){var c=Ext,a=0,b=null;return{emptyFn:function(){},BLANK_IMAGE_URL:Ext.isIE6||Ext.isIE7||Ext.isAir?"http://www.extjs.com/s.gif":"data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",extendX:function(d,e){return Ext.extend(d,e(d.prototype))},getDoc:function(){return Ext.get(document)},num:function(e,d){e=Number(Ext.isEmpty(e)||Ext.isArray(e)||typeof e=="boolean"||(typeof e=="string"&&e.trim().length==0)?NaN:e);return isNaN(e)?d:e},value:function(g,d,e){return Ext.isEmpty(g,e)?d:g},escapeRe:function(d){return d.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")},sequence:function(h,d,g,e){h[d]=h[d].createSequence(g,e)},addBehaviors:function(i){if(!Ext.isReady){Ext.onReady(function(){Ext.addBehaviors(i)})}else{var e={},h,d,g;for(d in i){if((h=d.split("@"))[1]){g=h[0];if(!e[g]){e[g]=Ext.select(g)}e[g].on(h[1],i[d])}}e=null}},getScrollBarWidth:function(g){if(!Ext.isReady){return 0}if(g===true||b===null){var i=Ext.getBody().createChild('
'),h=i.child("div",true);var e=h.offsetWidth;i.setStyle("overflow",(Ext.isWebKit||Ext.isGecko)?"auto":"scroll");var d=h.offsetWidth;i.remove();b=e-d+2}return b},combine:function(){var g=arguments,e=g.length,j=[];for(var h=0;hh?1:-1};Ext.each(d,function(h){g=e(g,h)==1?g:h});return g},mean:function(d){return d.length>0?Ext.sum(d)/d.length:undefined},sum:function(d){var e=0;Ext.each(d,function(g){e+=g});return e},partition:function(d,e){var g=[[],[]];Ext.each(d,function(j,k,h){g[(e&&e(j,k,h))||(!e&&j)?0:1].push(j)});return g},invoke:function(d,e){var h=[],g=Array.prototype.slice.call(arguments,2);Ext.each(d,function(j,k){if(j&&typeof j[e]=="function"){h.push(j[e].apply(j,g))}else{h.push(undefined)}});return h},pluck:function(d,g){var e=[];Ext.each(d,function(h){e.push(h[g])});return e},zip:function(){var n=Ext.partition(arguments,function(i){return typeof i!="function"}),k=n[0],m=n[1][0],d=Ext.max(Ext.pluck(k,"length")),h=[];for(var l=0;l=a.left&&b.right<=a.right&&b.top>=a.top&&b.bottom<=a.bottom)},getArea:function(){var a=this;return((a.bottom-a.top)*(a.right-a.left))},intersect:function(h){var g=this,d=Math.max(g.top,h.top),e=Math.min(g.right,h.right),a=Math.min(g.bottom,h.bottom),c=Math.max(g.left,h.left);if(a>=d&&e>=c){return new Ext.lib.Region(d,e,a,c)}},union:function(h){var g=this,d=Math.min(g.top,h.top),e=Math.max(g.right,h.right),a=Math.max(g.bottom,h.bottom),c=Math.min(g.left,h.left);return new Ext.lib.Region(d,e,a,c)},constrainTo:function(b){var a=this;a.top=a.top.constrain(b.top,b.bottom);a.bottom=a.bottom.constrain(b.top,b.bottom);a.left=a.left.constrain(b.left,b.right);a.right=a.right.constrain(b.left,b.right);return a},adjust:function(d,c,a,g){var e=this;e.top+=d;e.left+=c;e.right+=g;e.bottom+=a;return e}};Ext.lib.Region.getRegion=function(e){var h=Ext.lib.Dom.getXY(e),d=h[1],g=h[0]+e.offsetWidth,a=h[1]+e.offsetHeight,c=h[0];return new Ext.lib.Region(d,g,a,c)};Ext.lib.Point=function(a,c){if(Ext.isArray(a)){c=a[1];a=a[0]}var b=this;b.x=b.right=b.left=b[0]=a;b.y=b.top=b.bottom=b[1]=c};Ext.lib.Point.prototype=new Ext.lib.Region();Ext.apply(Ext.DomHelper,function(){var e,a="afterbegin",h="afterend",i="beforebegin",d="beforeend",b=/tag|children|cn|html$/i;function g(m,p,n,q,l,j){m=Ext.getDom(m);var k;if(e.useDom){k=c(p,null);if(j){m.appendChild(k)}else{(l=="firstChild"?m:m.parentNode).insertBefore(k,m[l]||m)}}else{k=Ext.DomHelper.insertHtml(q,m,Ext.DomHelper.createHtml(p))}return n?Ext.get(k,true):k}function c(j,r){var k,u=document,p,s,m,t;if(Ext.isArray(j)){k=u.createDocumentFragment();for(var q=0,n=j.length;q0){return setTimeout(d,c)}d();return 0},createSequence:function(c,b,a){if(!Ext.isFunction(b)){return c}else{return function(){var d=c.apply(this||window,arguments);b.apply(a||this||window,arguments);return d}}}};Ext.defer=Ext.util.Functions.defer;Ext.createInterceptor=Ext.util.Functions.createInterceptor;Ext.createSequence=Ext.util.Functions.createSequence;Ext.createDelegate=Ext.util.Functions.createDelegate;Ext.apply(Ext.util.Observable.prototype,function(){function a(j){var i=(this.methodEvents=this.methodEvents||{})[j],d,c,g,h=this;if(!i){this.methodEvents[j]=i={};i.originalFn=this[j];i.methodName=j;i.before=[];i.after=[];var b=function(l,k,e){if((c=l.apply(k||h,e))!==undefined){if(typeof c=="object"){if(c.returnValue!==undefined){d=c.returnValue}else{d=c}g=!!c.cancel}else{if(c===false){g=true}else{d=c}}}};this[j]=function(){var l=Array.prototype.slice.call(arguments,0),k;d=c=undefined;g=false;for(var m=0,e=i.before.length;m=525:!((Ext.isGecko&&!Ext.isWindows)||Ext.isOpera);return{_unload:function(){Ext.EventManager.un(window,"resize",this.fireWindowResize,this);c.call(Ext.EventManager)},doResizeEvent:function(){var m=a.getViewHeight(),l=a.getViewWidth();if(h!=m||i!=l){d.fire(i=l,h=m)}},onWindowResize:function(n,m,l){if(!d){d=new Ext.util.Event();k=new Ext.util.DelayedTask(this.doResizeEvent);Ext.EventManager.on(window,"resize",this.fireWindowResize,this)}d.addListener(n,m,l)},fireWindowResize:function(){if(d){k.delay(100)}},onTextResize:function(o,n,l){if(!g){g=new Ext.util.Event();var m=new Ext.Element(document.createElement("div"));m.dom.className="x-text-resize";m.dom.innerHTML="X";m.appendTo(document.body);b=m.dom.offsetHeight;setInterval(function(){if(m.dom.offsetHeight!=b){g.fire(b,b=m.dom.offsetHeight)}},this.textResizeInterval)}g.addListener(o,n,l)},removeResizeListener:function(m,l){if(d){d.removeListener(m,l)}},fireResize:function(){if(d){d.fire(a.getViewWidth(),a.getViewHeight())}},textResizeInterval:50,ieDeferSrc:false,getKeyEvent:function(){return e?"keydown":"keypress"},useKeydown:e}}());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)}});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(typeof callback=="function"){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(typeof callback=="function"){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=(typeof a=="object")?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(lB){p=B-q;m=true}if((o+C)>g){o=g-C;m=true}if(p"+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(typeof e=="object"){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)}}}}());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({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 false}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.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(typeof b!="object"||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)}});Ext.CompositeElementLite.importElementMethods();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=Ext.extend(Ext.CompositeElementLite,{constructor:function(b,a){this.elements=[];this.add(b,a)},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;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()]},formatContainsHourInfo:(function(){var d=/(\\.)/g,c=/([gGhHisucUOPZ]|M\$)/;return function(e){return c.test(e.replace(d,""))}})(),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:"String.leftPad(this.getFullYear(), 4, '0')",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 < 100 ? 100 : y, 0, 1, h, i, s, ms).add(Date.YEAR, y < 100 ? y - 100 : 0);","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 < 100 ? 100 : y, m, d, h, i, s, ms).add(Date.YEAR, y < 100 ? y - 100 : 0);","}","}","}","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,o=1,g=[],l=[],k=false,d="",j=0,h,n;for(;j Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"},a:function(){return a("A")},A:{calcLast:true,g:1,c:"if (/(am)/i.test(results[{0}])) {\nif (!h || h == 12) { h = 0; }\n} else { if (!h || h < 12) { h = (h || 0) + 12; }}",s:"(AM|PM|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 typeof c!="function"||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 y=this,j=y.html,q=/]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/,d=/^]*?for="(.*?)"/,v=/^]*?if="(.*?)"/,x=/^]*?exec="(.*?)"/,r,p=0,k=[],o="values",w="parent",l="xindex",n="xcount",e="return ",c="with(values){ ";j=["",j,""].join("");while((r=j.match(q))){var b=r[0].match(d),a=r[0].match(v),A=r[0].match(x),g=null,h=null,t=null,z=b&&b[1]?b[1]:"";if(a){g=a&&a[1]?a[1]:null;if(g){h=new Function(o,w,l,n,c+e+(Ext.util.Format.htmlDecode(g))+"; }")}}if(A){g=A&&A[1]?A[1]:null;if(g){t=new Function(o,w,l,n,c+(Ext.util.Format.htmlDecode(g))+"; }")}}if(z){switch(z){case".":z=new Function(o,w,c+e+o+"; }");break;case"..":z=new Function(o,w,c+e+w+"; }");break;default:z=new Function(o,w,c+e+z+"; }")}}k.push({id:p,target:z,exec:t,test:h,body:r[1]||""});j=j.replace(r[0],"{xtpl"+p+"}");++p}for(var u=k.length-1;u>=0;--u){y.compileTpl(k[u])}y.master=k[k.length-1];y.tpls=k};Ext.extend(Ext.XTemplate,Ext.Template,{re:/\{([\w\-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,codeRe:/\{\[((?:\\\]|.|\n)*?)\]\}/g,applySubTemplate:function(a,k,j,d,c){var h=this,g,m=h.tpls[a],l,b=[];if((m.test&&!m.test.call(h,k,j,d,c))||(m.exec&&m.exec.call(h,k,j,d,c))){return""}l=m.target?m.target.call(h,k,j):k;g=l.length;j=m.target?k:j;if(m.target&&Ext.isArray(l)){for(var e=0,g=l.length;e=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},getConstrainOffset:function(){return this.shadowOffset},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},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,i=0,p=(q+n.w),e=(g+n.h),j=p+"px",o=e+"px",m,c;u.left=(b+n.l)+"px";u.top=(r+n.t)+"px";if(u.width!=j||u.height!=o){u.width=j;u.height=o;if(!Ext.isIE){m=k.childNodes;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=[],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.layout=a;this.initItems();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&&this.layout.setActiveItem){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(e,b){var d=arguments,h=d.length,a=[],g,j;this.initItems();if(h>2){for(g=h-1;g>=1;--g){a.push(this.insert(e,d[g]))}return a}j=this.lookupComponent(this.applyDefaults(b));e=Math.min(e,this.items.length);if(this.fireEvent("beforeadd",this,j,e)!==false&&this.onBeforeAdd(j)!==false){if(j.ownerCt==this){this.items.remove(j)}this.items.insert(e,j);j.onAdded(this,e);this.onAdd(j);this.fireEvent("add",this,j,e)}return j},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.isAction?b.initialConfig: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(this.container){this.container.un(this.container.resizeEvent,this.onResize,this)}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 b=this.container.getLayoutTarget(),a={};if(b){a=b.getViewSize();if(Ext.isIE&&Ext.isStrict&&a.width==0){a=b.getStyleSize()}a.width-=b.getPadding("lr");a.height-=b.getPadding("tb")}return a},onLayout:function(m,w){Ext.layout.AnchorLayout.superclass.onLayout.call(this,m,w);var p=this.getLayoutTargetSize(),k=p.width,o=p.height,q=w.getStyle("overflow"),n=this.getRenderedItems(m),t=n.length,g=[],j,a,v,l,h,c,e,d,u=0,s,b;if(k<20&&o<20){return}if(m.anchorSize){if(typeof m.anchorSize=="number"){a=m.anchorSize}else{a=m.anchorSize.width;v=m.anchorSize.height}}else{a=m.initialConfig.width;v=m.initialConfig.height}for(s=0;s ');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.expandToolEl=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.destroyMembers(this,"miniCollapsedEl","collapsedEl","expandToolEl")}};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:true,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=Ext.isDefined(a.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);if(a.isComposite){a.doLayout()}},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)}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)}}},isValidParent:function(b,a){return b.getPositionEl().up("table",5).dom.parentNode===(a.dom||a)},destroy:function(){delete this.table;Ext.layout.TableLayout.superclass.destroy.call(this)}});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)}var d=this.overflowHandler;if(typeof d=="string"){d={type:d}}var c="none";if(d&&d.type!=undefined){c=d.type}var b=Ext.layout.boxOverflow[c];if(b[this.type]){b=b[this.type]}this.overflowHandler=new b(this,d)},onLayout:function(b,h){Ext.layout.BoxLayout.superclass.onLayout.call(this,b,h);var d=this.getLayoutTargetSize(),i=this.getVisibleItems(b),c=this.calculateChildBoxes(i,d),g=c.boxes,j=c.meta;if(d.width>0){var k=this.overflowHandler,a=j.tooNarrow?"handleOverflow":"clearOverflow";var e=k[a](c,d);if(e){if(e.targetSize){d=e.targetSize}if(e.recalculate){i=this.getVisibleItems(b);c=this.calculateChildBoxes(i,d);g=c.boxes}}}this.layoutTargetLastSize=d;this.childBoxCache=c;this.updateInnerCtSize(d,c);this.updateChildBoxes(g);this.handleTargetOverflow(d,b,h)},updateChildBoxes:function(c){for(var b=0,e=c.length;b(None)',constructor:function(a){Ext.layout.boxOverflow.Menu.superclass.constructor.apply(this,arguments);this.menuItems=[]},createInnerElements:function(){if(!this.afterCt){this.afterCt=this.layout.innerCt.insertSibling({cls:this.afterCls},"before")}},clearOverflow:function(a,g){var e=g.width+(this.afterCt?this.afterCt.getWidth():0),b=this.menuItems;this.hideTrigger();for(var c=0,d=b.length;ci.width;return l}},handleOverflow:function(d,h){this.showTrigger();var k=h.width-this.afterCt.getWidth(),l=d.boxes,e=0,r=false;for(var o=0,c=l.length;o=0;j--){var q=l[j].component,p=l[j].left+l[j].width;if(p>=k){this.menuItems.unshift({component:q,width:l[j].width});q.hide()}else{break}}}if(this.menuItems.length==0){this.hideTrigger()}return{targetSize:{height:h.height,width:k},recalculate:r}}});Ext.layout.boxOverflow.menu.hbox=Ext.layout.boxOverflow.HorizontalMenu;Ext.layout.boxOverflow.Scroller=Ext.extend(Ext.layout.boxOverflow.None,{animateScroll:true,scrollIncrement:100,wheelIncrement:3,scrollRepeatInterval:400,scrollDuration:0.4,beforeCls:"x-strip-left",afterCls:"x-strip-right",scrollerCls:"x-strip-scroller",beforeScrollerCls:"x-strip-scroller-left",afterScrollerCls:"x-strip-scroller-right",createWheelListener:function(){this.layout.innerCt.on({scope:this,mousewheel:function(a){a.stopEvent();this.scrollBy(a.getWheelDelta()*this.wheelIncrement*-1,false)}})},handleOverflow:function(a,b){this.createInnerElements();this.showScrollers()},clearOverflow:function(){this.hideScrollers()},showScrollers:function(){this.createScrollers();this.beforeScroller.show();this.afterScroller.show();this.updateScrollButtons()},hideScrollers:function(){if(this.beforeScroller!=undefined){this.beforeScroller.hide();this.afterScroller.hide()}},createScrollers:function(){if(!this.beforeScroller&&!this.afterScroller){var a=this.beforeCt.createChild({cls:String.format("{0} {1} ",this.scrollerCls,this.beforeScrollerCls)});var b=this.afterCt.createChild({cls:String.format("{0} {1}",this.scrollerCls,this.afterScrollerCls)});a.addClassOnOver(this.beforeScrollerCls+"-hover");b.addClassOnOver(this.afterScrollerCls+"-hover");a.setVisibilityMode(Ext.Element.DISPLAY);b.setVisibilityMode(Ext.Element.DISPLAY);this.beforeRepeater=new Ext.util.ClickRepeater(a,{interval:this.scrollRepeatInterval,handler:this.scrollLeft,scope:this});this.afterRepeater=new Ext.util.ClickRepeater(b,{interval:this.scrollRepeatInterval,handler:this.scrollRight,scope:this});this.beforeScroller=a;this.afterScroller=b}},destroy:function(){Ext.destroy(this.beforeScroller,this.afterScroller,this.beforeRepeater,this.afterRepeater,this.beforeCt,this.afterCt)},scrollBy:function(b,a){this.scrollTo(this.getScrollPosition()+b,a)},getItem:function(a){if(Ext.isString(a)){a=Ext.getCmp(a)}else{if(Ext.isNumber(a)){a=this.items[a]}}return a},getScrollAnim:function(){return{duration:this.scrollDuration,callback:this.updateScrollButtons,scope:this}},updateScrollButtons:function(){if(this.beforeScroller==undefined||this.afterScroller==undefined){return}var d=this.atExtremeBefore()?"addClass":"removeClass",c=this.atExtremeAfter()?"addClass":"removeClass",a=this.beforeScrollerCls+"-disabled",b=this.afterScrollerCls+"-disabled";this.beforeScroller[d](a);this.afterScroller[c](b);this.scrolling=false},atExtremeBefore:function(){return this.getScrollPosition()===0},scrollLeft:function(a){this.scrollBy(-this.scrollIncrement,a)},scrollRight:function(a){this.scrollBy(this.scrollIncrement,a)},scrollToItem:function(d,b){d=this.getItem(d);if(d!=undefined){var a=this.getItemVisibility(d);if(!a.fullyVisible){var c=d.getBox(true,true),e=c.x;if(a.hiddenRight){e-=(this.layout.innerCt.getWidth()-c.width)}this.scrollTo(e,b)}}},getItemVisibility:function(e){var d=this.getItem(e).getBox(true,true),a=d.x,c=d.x+d.width,g=this.getScrollPosition(),b=this.layout.innerCt.getWidth()+g;return{hiddenLeft:ab,fullyVisible:a>g&&c=this.getMaxScrollBottom()}});Ext.layout.boxOverflow.scroller.vbox=Ext.layout.boxOverflow.VerticalScroller;Ext.layout.boxOverflow.HorizontalScroller=Ext.extend(Ext.layout.boxOverflow.Scroller,{handleOverflow:function(a,b){Ext.layout.boxOverflow.HorizontalScroller.superclass.handleOverflow.apply(this,arguments);return{targetSize:{height:b.height,width:b.width-(this.beforeCt.getWidth()+this.afterCt.getWidth())}}},createInnerElements:function(){var a=this.layout.innerCt;if(!this.beforeCt){this.afterCt=a.insertSibling({cls:this.afterCls},"before");this.beforeCt=a.insertSibling({cls:this.beforeCls},"before");this.createWheelListener()}},scrollTo:function(a,b){var d=this.getScrollPosition(),c=a.constrain(0,this.getMaxScrollRight());if(c!=d&&!this.scrolling){if(b==undefined){b=this.animateScroll}this.layout.innerCt.scrollTo("left",c,b?this.getScrollAnim():false);if(b){this.scrolling=true}else{this.scrolling=false;this.updateScrollButtons()}}},getScrollPosition:function(){return parseInt(this.layout.innerCt.dom.scrollLeft,10)||0},getMaxScrollRight:function(){return this.layout.innerCt.dom.scrollWidth-this.layout.innerCt.getWidth()},atExtremeAfter:function(){return this.getScrollPosition()>=this.getMaxScrollRight()}});Ext.layout.boxOverflow.scroller.hbox=Ext.layout.boxOverflow.HorizontalScroller;Ext.layout.HBoxLayout=Ext.extend(Ext.layout.BoxLayout,{align:"top",type:"hbox",calculateChildBoxes:function(r,b){var F=r.length,R=this.padding,D=R.top,U=R.left,y=D+R.bottom,O=U+R.right,a=b.width-this.scrollOffset,e=b.height,o=Math.max(0,e-y),P=this.pack=="start",W=this.pack=="center",A=this.pack=="end",L=0,Q=0,T=0,l=0,X=0,H=[],k,J,M,V,w,j,S,I,c,x,q,N;for(S=0;Sa;var n=Math.max(0,a-L-O);if(p){for(S=0;S0){var C=[];for(var E=0,v=F;Ei.available?1:-1});for(var S=0,v=C.length;S0){I.top=D+q+(z/2)}}U+=I.width+w.right}return{boxes:H,meta:{maxHeight:Q,nonFlexWidth:L,desiredWidth:l,minimumWidth:X,shortfall:l-a,tooNarrow:p}}}});Ext.Container.LAYOUTS.hbox=Ext.layout.HBoxLayout;Ext.layout.VBoxLayout=Ext.extend(Ext.layout.BoxLayout,{align:"left",type:"vbox",calculateChildBoxes:function(o,b){var E=o.length,R=this.padding,C=R.top,V=R.left,x=C+R.bottom,O=V+R.right,a=b.width-this.scrollOffset,c=b.height,K=Math.max(0,a-O),P=this.pack=="start",X=this.pack=="center",z=this.pack=="end",k=0,u=0,U=0,L=0,m=0,G=[],h,I,N,W,t,g,T,H,S,w,n,d,r;for(T=0;Tc;var q=Math.max(0,(c-k-x));if(l){for(T=0,r=E;T0){var J=[];for(var D=0,r=E;Di.available?1:-1});for(var T=0,r=J.length;T0){H.left=V+w+(y/2)}}C+=H.height+t.bottom}return{boxes:G,meta:{maxWidth:u,nonFlexHeight:k,desiredHeight:L,minimumHeight:m,shortfall:L-c,tooNarrow:l}}}});Ext.Container.LAYOUTS.vbox=Ext.layout.VBoxLayout;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','','{altText}',"","")}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)}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(d){var a=d instanceof Ext.menu.Item,b=!(a||d instanceof Ext.menu.Separator);return{isMenuItem:a,needsIcon:b&&(d.icon||d.iconCls),icon:d.icon||Ext.BLANK_IMAGE_URL,iconCls:"x-menu-item-icon "+(d.iconCls||""),itemId:"x-menu-el-"+d.id,itemCls:"x-menu-list-item ",altText:d.altText||""}},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||Ext.isIE9)?"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",alt:"",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:undefined,height:undefined}}});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=this.el.getFrameWidth("tb")+this.bwrap.getFrameWidth("tb");a+=(this.tbar?this.tbar.getHeight():0)+(this.bbar?this.bbar.getHeight():0);if(this.frame){a+=this.el.dom.firstChild.offsetHeight+this.ft.dom.offsetHeight+this.mc.getFrameWidth("tb")}else{a+=(this.header?this.header.getHeight():0)+(this.footer?this.footer.getHeight():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.tbar,this.bbar,this.body,this.mc,this.bwrap,this.dd);if(this.fbar){Ext.destroy(this.fbar,this.fbar.el)}}Ext.destroy(this.toolbars)},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||(Ext.isIE7&&Ext.isStrict)){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,true)}},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(b,a){b=b.replace("#","");if(b!=this.value||this.allowReselect){var c=this.el;if(this.value){c.child("a.color-"+this.value).removeClass("x-color-palette-sel")}c.child("a.color-"+b).addClass("x-color-palette-sel");this.value=b;if(a!==true){this.fireEvent("select",this,b)}}}});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(J,d){d.title="";var i=D.clearTime(true).getTime();d.firstChild.dateValue=i;if(i==C){d.className+=" x-date-today";d.title=J.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=J.maxText;return}if(I){if(I.indexOf(D.getDay())!=-1){d.title=E;d.className=" x-date-disabled"}}if(F&&z){var w=D.dateFormat(z);if(F.test(w)){d.title=s.replace("%0",w);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)}},destroy:function(){Ext.destroyMembers(this,"tracker","el")}});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,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;ce?e:c.value}this.syncThumb()},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,a)!==false){a.value=c;if(this.rendered){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)}}})();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);delete this.el},onMouseDown:function(b,a){if(this.fireEvent("mousedown",this,b)!==false&&this.onBeforeStart(b)!==false){this.startXY=this.lastXY=b.getXY();this.dragTarget=this.delegate?a:this.el.dom;if(this.preventDefault!==false){b.preventDefault()}Ext.getDoc().on({scope:this,mouseup:this.onMouseUp,mousemove:this.onMouseMove,selectstart:this.stopSelect});if(this.autoStart){this.timer=this.triggerStart.defer(this.autoStart===true?1000:this.autoStart,this,[b])}}},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(d)}else{return}}this.fireEvent("mousemove",this,d);this.onDrag(d);this.fireEvent("drag",this,d)},onMouseUp:function(c){var b=Ext.getDoc(),a=this.active;b.un("mousemove",this.onMouseMove,this);b.un("mouseup",this.onMouseUp,this);b.un("selectstart",this.stopSelect,this);c.preventDefault();this.clearStart();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(a);this.fireEvent("dragstart",this,a)},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),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 o=m.ddScrollConfig?m.ddScrollConfig.ddGroup:undefined,n=(m.ddScrollConfig&&m.ddScrollConfig.frequency)?m.ddScrollConfig.frequency:Ext.dd.ScrollManager.frequency;if(o===undefined||c.dragCurrent.ddGroup==o){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(d,c){var e,a,b;c=[].concat(c);for(e=0,a=c.length;e=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(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(b,l,h){var e,g;if(this.isDestroyed===true){return}if(!b||h===false){if(h!==false){this.fireEvent("load",this,[],l)}if(l.callback){l.callback.call(l.scope||this,[],l,false,b)}return}var a=b.records,j=b.totalRecords||a.length;if(!l||l.add!==true){if(this.pruneModifiedRecords){this.modified=[]}for(e=0,g=a.length;e-1){this.doUpdate(d)}else{k.push(d);++c}}this.totalLength=Math.max(j,this.data.length+c);this.add(k)}this.fireEvent("load",this,a,l);if(l.callback){l.callback.call(l.scope||this,a,l,true)}},loadData:function(c,a){var b=this.reader.readRecords(c);this.loadRecords(b,{add:a},true)},getCount:function(){return this.data.length||0},getTotalCount:function(){return this.totalLength||0},getSortState:function(){return this.sortInfo},applySort:function(){if((this.sortInfo||this.multiSortInfo)&&!this.remoteSort){this.sortData()}},sortData:function(){var a=this.hasMultiSort?this.multiSortInfo:this.sortInfo,k=a.direction||"ASC",h=a.sorters,c=[];if(!this.hasMultiSort){h=[{direction:k,field:a.field}]}for(var d=0,b=h.length;d1){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();a.store.reMap(a)}},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(g,b){var e=Ext.DomQuery,h=b.responseXML,a=h.documentElement||h;var c=new Ext.data.Response({action:g,success:this.getSuccess(a),message:this.getMessage(a),data:this.extractData(e.select(this.meta.record,a)||e.select(this.meta.root,a),false),raw:h});if(Ext.isEmpty(c.success)){throw new Ext.data.DataReader.Error("successProperty-response",this.meta.successProperty)}if(g===Ext.data.Api.actions.create){var d=Ext.isDefined(c.data);if(d&&Ext.isEmpty(c.data)){throw new Ext.data.JsonReader.Error("root-empty",this.meta.root)}else{if(!d){throw new Ext.data.JsonReader.Error("root-undefined-response",this.meta.root)}}}return c},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&&c[0].field==this.groupField){c.shift()}this.groupField=e;this.groupDir=d;this.applyGroupField();var b=function(){this.fireEvent("groupchange",this,this.getGroupState())};if(this.groupOnSort){this.sort(e,d);b.call(this);return}if(this.remoteGroup){this.on("load",b,this,{single:true});this.reload()}else{this.sort(c);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?[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,a)!==false){Ext.Direct.addTransaction(d);this.queueTransaction(d);this.fireEvent("call",this,d,a)}},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,b)!==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,b);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,showAnimDuration:0.25,hideAnimDuration:0.25,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){if(this.activeGhost){this.unghost()}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(b!=document.body&&!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:this.showAnimDuration,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:this.hideAnimDuration,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+this.el.getConstrainOffset())}}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=Ext.extend(Ext.dd.DD,{constructor: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},moveOnly:true,headerOffsets:[100,25],startDrag:function(){var a=this.win;this.proxy=a.ghost(a.initialConfig.cls);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(x){r[x].blur();if(u.isVisible()){u.hide();w();Ext.callback(b.fn,b.scope||window,[x,v.dom.value,b],1)}};var w=function(){if(b&&b.cls){u.el.removeClass(b.cls)}n.reset()};var e=function(z,x,y){if(b&&b.closable!==false){u.hide();w()}if(y){y.stopEvent()}};var k=function(x){var z=0,y;if(!x){Ext.each(m,function(A){r[A].hide()});return z}u.footer.dom.style.display="";Ext.iterate(r,function(A,B){y=x[A];if(y){B.show();B.setText(Ext.isString(y)?y:Ext.MessageBox.buttonText[A]);z+=B.getEl().getWidth()+15}else{B.hide()}});return z};return{getDialog:function(x){if(!u){var z=[];r={};Ext.each(m,function(A){z.push(r[A]=new Ext.Button({text:this.buttonText[A],handler:c.createCallback(A),hideMode:"offsets"}))},this);u=new Ext.Window({autoCreate:true,title:x,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:z,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 y=h.dom.childNodes[1];l=Ext.get(y.firstChild);s=Ext.get(y.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(y.childNodes[2].childNodes[1]);a.enableDisplayMode();n=new Ext.ProgressBar({renderTo:h});h.createChild({cls:"x-clear"})}return u},updateText:function(A){if(!u.isVisible()&&!b.width){u.setSize(this.maxWidth,100)}l.update(A?A+" ":" ");var y=d!=""?(j.getWidth()+j.getMargins("lr")):0,C=l.getWidth()+l.getMargins("lr"),z=u.getFrameWidth("lr"),B=u.body.getFrameWidth("lr"),x;x=Math.max(Math.min(b.width||y+C+z+B,b.maxWidth||this.maxWidth),Math.max(b.minWidth||this.minWidth,o||0));if(b.prompt===true){v.setWidth(x-y-z-B)}if(b.progress===true||b.wait===true){n.setSize(x-y-z-B)}if(Ext.isIE&&x==o){x+=4}l.update(A||" ");u.setSize(x,"auto").center();return this},updateProgress:function(y,x,z){n.updateProgress(y,x);if(z){this.updateText(z)}return this},isVisible:function(){return u&&u.isVisible()},hide:function(){var x=u?u.activeGhost:null;if(this.isVisible()||x){u.hide();w();if(x){u.unghost(false,false)}}return this},show:function(A){if(this.isVisible()){this.hide()}b=A;var B=this.getDialog(b.title||" ");B.setTitle(b.title||" ");var x=(b.closable!==false&&b.progress!==true&&b.wait!==true);B.tools.close.setDisplayed(x);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){B.focusEl=v}else{var z=b.buttons;var y=null;if(z&&z.ok){y=r.ok}else{if(z&&z.yes){y=r.yes}}if(y){B.focusEl=y}}if(Ext.isDefined(b.iconCls)){B.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){B.el.addClass(b.cls)}B.proxyDrag=b.proxyDrag===true;B.modal=b.modal!==false;B.mask=b.modal!==false?q:false;if(!B.isVisible()){document.body.appendChild(u.el.dom);B.setAnimateTarget(b.animEl);B.on("show",function(){if(x===true){B.keyMap.enable()}else{B.keyMap.disable()}},this,{single:true});B.show(b.animEl)}if(b.wait===true){n.wait(b.waitConfig)}return this},setIcon:function(x){if(!u){i=x;return}i=undefined;if(x&&x!=""){j.removeClass("x-hidden");j.replaceClass(d,x);h.addClass("x-dlg-icon");d=x}else{j.replaceClass(d,"x-hidden");h.removeClass("x-dlg-icon");d=""}return this},progress:function(z,y,x){this.show({title:z,msg:y,buttons:false,progress:true,closable:false,minWidth:this.minProgressWidth,progressText:x});return this},wait:function(z,y,x){this.show({title:y,msg:z,buttons:false,closable:false,wait:true,modal:true,minWidth:this.minProgressWidth,waitConfig:x});return this},alert:function(A,z,y,x){this.show({title:A,msg:z,buttons:this.OK,fn:y,scope:x,minWidth:this.minWidth});return this},confirm:function(A,z,y,x){this.show({title:A,msg:z,buttons:this.YESNO,fn:y,scope:x,icon:this.QUESTION,minWidth:this.minWidth});return this},prompt:function(C,B,z,y,x,A){this.show({title:C,msg:B,buttons:this.OKCANCEL,fn:z,minWidth:this.minPromptWidth,scope:y,prompt:true,multiline:x,value:A});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=Ext.extend(Object,{constructor:function(a,b){this.panel=a;this.id=this.panel.id+"-ddproxy";Ext.apply(this,b)},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(this.panel.initialConfig.cls,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=Ext.extend(Ext.dd.DragSource,{constructor: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 d=b.header,c=b.body;if(d){this.setHandleElId(d.id);c=b.header}c.setStyle("cursor","move");this.scroll=false},showFrame:Ext.emptyFn,startDrag:Ext.emptyFn,b4StartDrag:function(a,b){this.proxy.show()},b4MouseDown:function(b){var a=b.getPageX(),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=Ext.extend(Ext.util.Observable,{constructor:function(){this.addEvents("statechange");this.state={};Ext.state.Provider.superclass.constructor.call(this)},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|e)\:(.*)$/,h=e.exec(unescape(b)),d,c,a,g;if(!h||!h[1]){return}c=h[1];a=h[2];switch(c){case"e":return null;case"n":return parseFloat(a);case"d":return new Date(Date.parse(a));case"b":return(a=="1");case"a":d=[];if(a!=""){Ext.each(a.split("^"),function(i){d.push(this.decodeValue(i))},this)}return d;case"o":d={};if(a!=""){Ext.each(a.split("^"),function(i){g=i.split("=");d[g[0]]=this.decodeValue(g[1])},this)}return d;default:return a}},encodeValue:function(c){var b,g="",e=0,a,d;if(c==null){return"e:1"}else{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)){for(a=c.length;e-1){var e=this.isSelected(b),c=this.all.elements[b],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,maxColumnWidth: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;gthis.maxColumnWidth){n.width-=(h-this.maxColumnWidth)/100}k++}b.push(n)}l=this.columns=b;if(k10)){b.style.width=d;g.style.width=d}else{b.style.width=c+"px";g.style.width=c+"px";setTimeout(function(){if((a.offsetWidth-a.clientWidth)>10){b.style.width=d;g.style.width=d}},10)}}if(Ext.isNumber(e)){a.style.height=Math.max(0,e-g.parentNode.offsetHeight)+"px"}},updateIndexes:function(){Ext.list.ListView.superclass.updateIndexes.apply(this,arguments);this.verifyInternalSize()},findHeaderIndex:function(g){g=g.dom||g;var a=g.parentNode,d=a.parentNode.childNodes,b=0,e;for(;e=d[b];b++){if(e==a){return b}}return -1},setHdWidths:function(){var d=this.innerHd.dom.getElementsByTagName("div"),c=0,b=this.columns,a=b.length;for(;c','','{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(){var a=this.rendered;if(this.suspendUpdates){return}if(this.resizeTabs&&a){this.autoSizeTabs()}if(this.enableTabScroll&&a){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.onRepeatClick,this)}else{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.btnEl,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.autoWidth!==false&&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{this.doToggle();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,a)}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=location.href,m=l.indexOf("#"),n=m>=0?l.substr(m+1):null;if(Ext.isGecko){n=decodeURIComponent(n)}return n}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);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{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).setVisibilityMode(Ext.Element.DISPLAY)},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=Ext.extend(Ext.util.Observable,{constructor:function(a){this.selNode=null;this.addEvents("selectionchange","beforeselect");Ext.apply(this,a);Ext.tree.DefaultSelectionModel.superclass.constructor.call(this)},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=Ext.extend(Ext.util.Observable,{constructor:function(a){this.selNodes=[];this.selMap={};this.addEvents("selectionchange");Ext.apply(this,a);Ext.tree.MultiSelectionModel.superclass.constructor.call(this)},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},getHref:function(a){return Ext.isEmpty(a)?(Ext.isGecko?"":"#"):a},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;dp){return e?-1:1}}return 0}},doSort:function(a){a.sort(this.sortFn)},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 E="undefined",s="object",T="Shockwave Flash",X="ShockwaveFlash.ShockwaveFlash",r="application/x-shockwave-flash",S="SWFObjectExprInst",y="onreadystatechange",P=window,k=document,u=navigator,U=false,V=[i],p=[],O=[],J=[],m,R,F,C,K=false,a=false,o,H,n=true,N=function(){var ab=typeof k.getElementById!=E&&typeof k.getElementsByTagName!=E&&typeof k.createElement!=E,ai=u.userAgent.toLowerCase(),Z=u.platform.toLowerCase(),af=Z?(/win/).test(Z):/win/.test(ai),ad=Z?(/mac/).test(Z):/mac/.test(ai),ag=/webkit/.test(ai)?parseFloat(ai.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,Y=!+"\v1",ah=[0,0,0],ac=null;if(typeof u.plugins!=E&&typeof u.plugins[T]==s){ac=u.plugins[T].description;if(ac&&!(typeof u.mimeTypes!=E&&u.mimeTypes[r]&&!u.mimeTypes[r].enabledPlugin)){U=true;Y=false;ac=ac.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ah[0]=parseInt(ac.replace(/^(.*)\..*$/,"$1"),10);ah[1]=parseInt(ac.replace(/^.*\.(.*)\s.*$/,"$1"),10);ah[2]=/[a-zA-Z]/.test(ac)?parseInt(ac.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof P.ActiveXObject!=E){try{var ae=new ActiveXObject(X);if(ae){ac=ae.GetVariable("$version");if(ac){Y=true;ac=ac.split(" ")[1].split(",");ah=[parseInt(ac[0],10),parseInt(ac[1],10),parseInt(ac[2],10)]}}}catch(aa){}}}return{w3:ab,pv:ah,wk:ag,ie:Y,win:af,mac:ad}}(),l=function(){if(!N.w3){return}if((typeof k.readyState!=E&&k.readyState=="complete")||(typeof k.readyState==E&&(k.getElementsByTagName("body")[0]||k.body))){g()}if(!K){if(typeof k.addEventListener!=E){k.addEventListener("DOMContentLoaded",g,false)}if(N.ie&&N.win){k.attachEvent(y,function(){if(k.readyState=="complete"){k.detachEvent(y,arguments.callee);g()}});if(P==top){(function(){if(K){return}try{k.documentElement.doScroll("left")}catch(Y){setTimeout(arguments.callee,0);return}g()})()}}if(N.wk){(function(){if(K){return}if(!(/loaded|complete/).test(k.readyState)){setTimeout(arguments.callee,0);return}g()})()}t(g)}}();function g(){if(K){return}try{var aa=k.getElementsByTagName("body")[0].appendChild(D("span"));aa.parentNode.removeChild(aa)}catch(ab){return}K=true;var Y=V.length;for(var Z=0;Z0){for(var ag=0;ag0){var af=c(Z);if(af){if(G(p[ag].swfVersion)&&!(N.wk&&N.wk<312)){x(Z,true);if(ac){ab.success=true;ab.ref=A(Z);ac(ab)}}else{if(p[ag].expressInstall&&B()){var aj={};aj.data=p[ag].expressInstall;aj.width=af.getAttribute("width")||"0";aj.height=af.getAttribute("height")||"0";if(af.getAttribute("class")){aj.styleclass=af.getAttribute("class")}if(af.getAttribute("align")){aj.align=af.getAttribute("align")}var ai={};var Y=af.getElementsByTagName("param");var ad=Y.length;for(var ae=0;ae'}}ab.outerHTML='"+ag+"";O[O.length]=aj.id;Y=c(aj.id)}else{var aa=D(s);aa.setAttribute("type",r);for(var ad in aj){if(aj[ad]!=Object.prototype[ad]){if(ad.toLowerCase()=="styleclass"){aa.setAttribute("class",aj[ad])}else{if(ad.toLowerCase()!="classid"){aa.setAttribute(ad,aj[ad])}}}}for(var ac in ah){if(ah[ac]!=Object.prototype[ac]&&ac.toLowerCase()!="movie"){e(aa,ac,ah[ac])}}ab.parentNode.replaceChild(aa,ab);Y=aa}}return Y}function e(aa,Y,Z){var ab=D("param");ab.setAttribute("name",Y);ab.setAttribute("value",Z);aa.appendChild(ab)}function z(Z){var Y=c(Z);if(Y&&Y.nodeName=="OBJECT"){if(N.ie&&N.win){Y.style.display="none";(function(){if(Y.readyState==4){b(Z)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.removeChild(Y)}}}function b(aa){var Z=c(aa);if(Z){for(var Y in Z){if(typeof Z[Y]=="function"){Z[Y]=null}}Z.parentNode.removeChild(Z)}}function c(aa){var Y=null;try{Y=k.getElementById(aa)}catch(Z){}return Y}function D(Y){return k.createElement(Y)}function j(aa,Y,Z){aa.attachEvent(Y,Z);J[J.length]=[aa,Y,Z]}function G(aa){var Z=N.pv,Y=aa.split(".");Y[0]=parseInt(Y[0],10);Y[1]=parseInt(Y[1],10)||0;Y[2]=parseInt(Y[2],10)||0;return(Z[0]>Y[0]||(Z[0]==Y[0]&&Z[1]>Y[1])||(Z[0]==Y[0]&&Z[1]==Y[1]&&Z[2]>=Y[2]))?true:false}function w(ad,Z,ae,ac){if(N.ie&&N.mac){return}var ab=k.getElementsByTagName("head")[0];if(!ab){return}var Y=(ae&&typeof ae=="string")?ae:"screen";if(ac){o=null;H=null}if(!o||H!=Y){var aa=D("style");aa.setAttribute("type","text/css");aa.setAttribute("media",Y);o=ab.appendChild(aa);if(N.ie&&N.win&&typeof k.styleSheets!=E&&k.styleSheets.length>0){o=k.styleSheets[k.styleSheets.length-1]}H=Y}if(N.ie&&N.win){if(o&&typeof o.addRule==s){o.addRule(ad,Z)}}else{if(o&&typeof k.createTextNode!=E){o.appendChild(k.createTextNode(ad+" {"+Z+"}"))}}}function x(aa,Y){if(!n){return}var Z=Y?"visible":"hidden";if(K&&c(aa)){c(aa).style.visibility=Z}else{w("#"+aa,"visibility:"+Z)}}function M(Z){var aa=/[\\\"<>\.;]/;var Y=aa.exec(Z)!=null;return Y&&typeof encodeURIComponent!=E?encodeURIComponent(Z):Z}var d=function(){if(N.ie&&N.win){window.attachEvent("onunload",function(){var ad=J.length;for(var ac=0;ac0){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){a.ownerCt=this;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 h,e,b,d={},a=false,l=new Date();function n(){h={};e=new Ext.util.MixedCollection();b=Ext.getDoc().addKeyListener(27,j);b.disable()}function j(){if(e&&e.length>0){var o=e.clone();o.each(function(p){p.hide()});return true}return false}function g(o){e.remove(o);if(e.length<1){b.disable();Ext.getDoc().un("mousedown",m);a=false}}function k(o){var p=e.last();l=new Date();e.add(o);if(!a){b.enable();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 c(o){if(o.activeChild){o.activeChild.hide()}if(o.autoHideTimer){clearTimeout(o.autoHideTimer);delete o.autoHideTimer}}function i(o){var p=o.parentMenu;if(!p&&!o.allowOtherMenus){j()}else{if(p&&p.activeChild){p.activeChild.hide()}}}function m(o){if(l.getElapsed()>50&&e.length>0&&!o.getTarget(".x-menu")){j()}}return{hideAll:function(){return j()},register:function(o){if(!h){n()}h[o.id]=o;o.on({beforehide:c,hide:g,beforeshow:i,show:k})},get:function(o){if(typeof o=="string"){if(!h){return null}return h[o]}else{if(o.events){return o}else{if(typeof o.length=="number"){return new Ext.menu.Menu({items:o})}else{return Ext.create(o,"menu")}}}},unregister:function(o){delete h[o.id];o.un("beforehide",c);o.un("hide",g);o.un("beforeshow",i);o.un("show",k)},registerCheckable:function(o){var p=o.group;if(p){if(!d[p]){d[p]=[]}d[p].push(o)}},unregisterCheckable:function(o){var p=o.group;if(p){d[p].remove(o)}},onCheckChange:function(q,r){if(q.group&&r){var t=d[q.group],p=0,o=t.length,s;for(;p',' target="{hrefTarget}"',"",">",'{altText}','{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||" ",altText:this.altText||""}},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(){clearTimeout(this.showTimer);clearTimeout(this.hideTimer);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)){Ext.menu.MenuMgr.onCheckChange(this,b);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.getKeyEvent(),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()),a);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,b;if(this.emptyText){if(a.dom.value==this.emptyText){this.setRawValue("");b=true}a.removeClass(this.emptyClass)}if(this.selectOnFocus||b){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=Ext.isDefined(a)?a:this.processValue(this.getRawValue());if(Ext.isFunction(this.validator)){var c=this.validator(a);if(c!==true){d.push(c)}}if(a.length<1||a===this.emptyText){if(this.allowBlank){return d}else{d.push(this.blankText)}}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,alt:"",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,alt:"",cls:"x-form-trigger "+this.trigger1Class},{tag:"img",src:Ext.BLANK_IMAGE_URL,alt:"",cls:"x-form-trigger "+this.trigger2Class}]}},getTrigger:function(a){return this.triggers[a]},afterRender:function(){Ext.form.TwinTriggerField.superclass.afterRender.call(this);var c=this.triggers,b=0,a=c.length;for(;b")}}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",autoStripChars:false,initEvents:function(){var a=this.baseChars+"";if(this.allowDecimals){a+=this.decimalSeparator}if(this.allowNegative){a+="-"}a=Ext.escapeRe(a);this.maskRe=new RegExp("["+a+"]");if(this.autoStripChars){this.stripCharsRe=new RegExp("[^"+a+"]","gi")}Ext.form.NumberField.superclass.initEvents.call(this)},getErrors:function(b){var c=Ext.form.NumberField.superclass.getErrors.apply(this,arguments);b=Ext.isDefined(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=this.fixPrecision(a);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(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|n-j|n/j",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,startDay:0,defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"off"},initTime:"12",initTimeFormat:"H",safeParse:function(b,c){if(Date.formatContainsHourInfo(c)){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.clearTime().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(g,d,e){this.maxHeight=e-this.handleHeight-this.list.getFrameWidth("tb")-this.assetHeight;this.listWidth=d;this.innerList.setWidth(d-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(){if(this.clearFilterOnReset&&this.mode=="local"){this.store.clearFilter()}Ext.form.ComboBox.superclass.reset.call(this)},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;if(this.valueField&&Ext.isDefined(this.value)){a=this.findRecord(this.valueField,this.value)}if(!a||a.get(this.displayField)!=b){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&&this.valueField){if(this.value==b){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={},c=this.store.paramNames;if(this.pageSize){b[c.start]=0;b[c.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));this.list.setZIndex(this.getZIndex());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&&!Ext.isStrict){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 c=this.checked,b=this.inputValue;if(a===false){this.checked=false}else{this.checked=(a===true||a==="true"||a=="1"||(b?a==b:String(a).toLowerCase()=="on"))}if(this.rendered){this.el.dom.checked=this.checked;this.el.dom.defaultChecked=this.checked}if(c!=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,labelConnector:", ",initComponent:function(){var g=[],b=this.items,e;for(var d=0,c=b.length;d")},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",shouldLayout:false,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,d,c;a.each(function(e){d=this.findField(e.name);if(d){c=d.getValue();if(Ext.type(c)!==false&&c.getGroupValue){c=c.getGroupValue()}else{if(d.eachItem){c=[];d.eachItem(function(g){c.push(g.getValue())})}}b.set(e.name,c)}},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)}else{if(d instanceof Ext.form.CheckboxGroup&&d.rendered){return d.eachItem(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){if(Ext.isIE){this.getEditorBody().contentEditable=!b}else{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";a.src=Ext.SSL_SECURE_URL;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=this.getDoc();if(a){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){this.previousSize=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(this.previousSize);delete this.previousSize;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){}},beforeDestroy: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()}}Ext.form.HtmlEditor.superclass.beforeDestroy.call(this)},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){a=a+d;}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}
','',"
","
",'
 
','
 
',""),headerTpl:new Ext.Template('',"",'{cells}',"","
"),bodyTpl:new Ext.Template("{rows}"),cellTpl:new Ext.Template('','
{value}
',""),initTemplates:function(){var c=this.templates||{},d,b,g=new Ext.Template('','
',this.grid.enableHdMenu?'':"","{value}",'',"
",""),a=['','','
{body}
',"",""].join(""),e=['',"","{cells}",this.enableRowBody?a:"","","
"].join("");Ext.applyIf(c,{hcell:g,cell:this.cellTpl,body:this.bodyTpl,header:this.headerTpl,master:this.masterTpl,row:new Ext.Template('
'+e+"
"),rowInner:new Ext.Template(e)});for(b in c){d=c[b];if(d&&Ext.isFunction(d.compile)&&!d.compiled){d.disableFormats=true;d.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 b=Ext.Element,d=Ext.get(this.grid.getGridEl().dom.firstChild),e=new b(d.child("div.x-grid3-viewport")),c=new b(e.child("div.x-grid3-header")),a=new b(e.child("div.x-grid3-scroller"));if(this.grid.hideHeaders){c.setDisplayed(false)}if(this.forceFit){a.setStyle("overflow-x","hidden")}Ext.apply(this,{el:d,mainWrap:e,scroller:a,mainHd:c,innerHd:c.child("div.x-grid3-header-inner").dom,mainBody:new b(b.fly(a).child("div.x-grid3-body")),focusEl:new b(b.fly(a).child("a")),resizeMarker:new b(d.child("div.x-grid3-resize-marker")),resizeProxy:new b(d.child("div.x-grid3-resize-proxy"))});this.focusEl.swallowEvent("click",true)},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(d,c){var b=this.findCell(d),a;if(b){a=this.fly(b).hasClass(c);if(!c||a){return this.getCellIndex(b)}}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 Ext.fly(this.getRow(b)).query(this.cellSelector)[a]},getHeaderCell:function(a){return this.mainHd.dom.getElementsByTagName("td")[a]},addRowClass:function(b,a){var c=this.getRow(b);if(c){this.fly(c).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,d;for(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(){var a=this.scroller.dom;a.scrollTop=0;a.scrollLeft=0},syncScroll:function(){this.syncHeaderScroll();var a=this.scroller.dom;this.grid.fireEvent("bodyscroll",a.scrollLeft,a.scrollTop)},syncHeaderScroll:function(){var a=this.innerHd,b=this.scroller.dom.scrollLeft;a.scrollLeft=b;a.scrollLeft=b},updateSortIcon:function(d,c){var a=this.sortClasses,b=a[c=="DESC"?1:0],e=this.mainHd.select("td").removeClass(a);e.item(d).addClass(b)},updateAllColumnWidths:function(){var e=this.getTotalWidth(),k=this.cm.getColumnCount(),m=this.getRows(),g=m.length,b=[],l,a,h,d,c;for(d=0;d=this.ds.getCount()){return null}d=(d!==undefined?d:0);var c=this.getRow(h),b=this.cm,e=b.getColumnCount(),a;if(!(g===false&&d===0)){while(dm){n.scrollTop=q-a}}if(e!==false){var l=parseInt(h.offsetLeft,10),j=l+h.offsetWidth,i=parseInt(n.scrollLeft,10),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.processRows(i);this.fireEvent("rowsinserted",this,i,e)}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(b,d){var a=this.cm,g=a.config,c=d?"":g[b].css||"",e=g[b].align;c+=String.format("width: {0};",this.getColumnWidth(b));if(a.isHidden(b)){c+="display: none; "}if(e){c+=String.format("text-align: {0};",e)}return c},getColumnWidth:function(b){var c=this.cm.getColumnWidth(b),a=this.borderWidth;if(Ext.isNumber(c)){if(Ext.isBorderBox||(Ext.isWebKit&&!Ext.isSafari2)){return c+"px"}else{return Math.max(c-a,0)+"px"}}else{return c}},getTotalWidth:function(){return this.cm.getTotalWidth()+"px"},fitColumns:function(g,j,h){var a=this.grid,l=this.cm,s=l.getTotalWidth(false),q=this.getGridInnerWidth(),r=q-s,c=[],o=0,n=0,u,d,p;if(q<20||r===0){return false}var e=l.getColumnCount(true),m=l.getColumnCount(false),b=e-(Ext.isNumber(h)?1:0);if(b===0){b=1;h=undefined}for(p=0;pq){var t=(b==e)?o:h,k=Math.max(1,l.getColumnWidth(t)-(s-q));l.setColumnWidth(t,k,true)}if(g!==true){this.updateAllColumnWidths()}return true},autoExpand:function(k){var a=this.grid,i=this.cm,e=this.getGridInnerWidth(),c=i.getTotalWidth(false),g=a.autoExpandColumn;if(!this.userResized&&g){if(e!=c){var j=i.getIndexById(g),b=i.getColumnWidth(j),h=e-c+b,d=Math.min(Math.max(h,a.autoExpandMin),a.autoExpandMax);if(b!=d){i.setColumnWidth(j,d,true);if(k!==true){this.updateColumnWidth(j,d)}}}}},getGridInnerWidth:function(){return this.grid.getGridEl().getWidth(true)-this.getScrollOffset()},getColumnData:function(){var e=[],c=this.cm,g=c.getColumnCount(),a=this.ds.fields,d,b;for(d=0;d'+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(){var j=this,a=j.grid,d=a.getGridEl(),i=j.dragZone,g=j.splitZone,h=j.columnDrag,e=j.columnDrop,k=j.scrollToTopTask,c,b;if(k&&k.cancel){k.cancel()}Ext.destroyMembers(j,"colMenu","hmenu");j.initData(null,null);j.purgeListeners();Ext.fly(j.innerHd).un("click",j.handleHdDown,j);if(a.enableColumnMove){c=h.dragData;b=h.proxy;Ext.destroy(h.el,b.ghost,b.el,e.el,e.proxyTop,e.proxyBottom,c.ddel,c.header);if(b.anim){Ext.destroy(b.anim)}delete b.ghost;delete c.ddel;delete c.header;h.destroy();delete Ext.dd.DDM.locationCache[h.id];delete h._domRef;delete e.proxyTop;delete e.proxyBottom;e.destroy();delete Ext.dd.DDM.locationCache["gridHeader"+d.id];delete e._domRef;delete Ext.dd.DDM.ids[e.ddGroup]}if(g){g.destroy();delete g._domRef;delete Ext.dd.DDM.ids["gridSplitters"+d.id]}Ext.fly(j.innerHd).removeAllListeners();Ext.removeNode(j.innerHd);delete j.innerHd;Ext.destroy(j.el,j.mainWrap,j.mainHd,j.scroller,j.mainBody,j.focusEl,j.resizeMarker,j.resizeProxy,j.activeHdBtn,j._flyweight,i,g);delete a.container;if(i){i.destroy()}Ext.dd.DDM.currentTarget=null;delete Ext.dd.DDM.locationCache[d.id];Ext.EventManager.removeResizeListener(j.onWindowResize,j)},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.updateHeaderSortState()},this,{single:true})}}else{if(this.forceFit){this.fitColumns(true,false)}else{if(this.grid.autoExpandColumn){this.autoExpand(true)}}}this.grid.getGridEl().dom.innerHTML=this.renderUI();this.afterRenderUI()},initData:function(a,e){var b=this;if(b.ds){var d=b.ds;d.un("add",b.onAdd,b);d.un("load",b.onLoad,b);d.un("clear",b.onClear,b);d.un("remove",b.onRemove,b);d.un("update",b.onUpdate,b);d.un("datachanged",b.onDataChange,b);if(d!==a&&d.autoDestroy){d.destroy()}}if(a){a.on({scope:b,load:b.onLoad,add:b.onAdd,remove:b.onRemove,update:b.onUpdate,clear:b.onClear,datachanged:b.onDataChange})}if(b.cm){var c=b.cm;c.un("configchange",b.onColConfigChange,b);c.un("widthchange",b.onColWidthChange,b);c.un("headerchange",b.onHeaderChange,b);c.un("hiddenchange",b.onHiddenChange,b);c.un("columnmoved",b.onColumnMove,b)}if(e){delete b.lastViewWidth;e.on({scope:b,configchange:b.onColConfigChange,widthchange:b.onColWidthChange,headerchange:b.onHeaderChange,hiddenchange:b.onHiddenChange,columnmoved:b.onColumnMove})}b.ds=a;b.cm=e},onDataChange:function(){this.refresh(true);this.updateHeaderSortState();this.syncFocusEl(0)},onClear:function(){this.refresh();this.syncFocusEl(0)},onUpdate:function(b,a){this.refreshRow(a)},onAdd:function(b,a,c){this.insertRows(b,c,c+(a.length-1))},onRemove:function(b,a,c,d){if(d!==true){this.fireEvent("beforerowremoved",this,c,a)}this.removeRow(c);if(d!==true){this.processRows(c);this.applyEmptyText();this.fireEvent("rowremoved",this,c,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,c,b){this.indexMap=null;this.refresh(true);this.restoreScroll(this.getScrollState());this.afterMove(b);this.grid.fireEvent("columnmove",c,b)},onColConfigChange:function(){delete this.lastViewWidth;this.indexMap=null;this.refresh(true)},initUI:function(a){a.on("headerclick",this.onHeaderClick,this)},initEvents:Ext.emptyFn,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=this.findRowIndex(a);if(c!==false){this.addRowClass(c,this.rowOverCls)}},onRowOut:function(b,a){var c=this.findRowIndex(a);if(c!==false&&!b.within(this.getRow(c),true)){this.removeRowClass(c,this.rowOverCls)}},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")}},handleWheel:function(a){a.stopPropagation()},onColumnSplitterMoved:function(a,b){this.userResized=true;this.grid.colModel.setColumnWidth(a,b,true);if(this.forceFit){this.fitColumns(true,false,a);this.updateAllColumnWidths()}else{this.updateColumnWidth(a,b);this.syncHeaderScroll()}this.grid.fireEvent("columnresize",a,b)},beforeColMenuShow:function(){var b=this.cm,d=b.getColumnCount(),a=this.colMenu,c;a.removeAll();for(c=0;c0){if(!this.cm.isHidden(a-1)){return a}a--}return undefined},handleHdOver:function(c,b){var d=this.findHeaderCell(b);if(d&&!this.headersDisabled){var a=this.fly(d);this.activeHdRef=b;this.activeHdIndex=this.getCellIndex(d);this.activeHdRegion=a.getRegion();if(!this.isMenuDisabled(this.activeHdIndex,a)){a.addClass("x-grid3-hd-over");this.activeHdBtn=a.child(".x-grid3-hd-btn");if(this.activeHdBtn){this.activeHdBtn.dom.style.height=(d.firstChild.offsetHeight-1)+"px"}}}},handleHdOut:function(b,a){var c=this.findHeaderCell(a);if(c&&(!Ext.isIE||!b.within(c,true))){this.activeHdRef=null;this.fly(c).removeClass("x-grid3-hd-over");c.style.cursor=""}},isMenuDisabled:function(a,b){return this.cm.isMenuDisabled(a)},hasRows:function(){var a=this.mainBody.dom.firstChild;return a&&a.nodeType==1&&a.className!="x-grid-empty"},isHideableColumn:function(a){return !a.hidden},bind:function(a,b){this.initData(a,b)}});Ext.grid.GridView.SplitDragZone=Ext.extend(Ext.dd.DDProxy,{constructor:function(a,b){this.grid=a;this.view=a.getView();this.marker=this.view.resizeMarker;this.proxy=this.view.resizeProxy;Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this,b,"gridSplitters"+this.grid.getGridEl().id,{dragElId:Ext.id(this.proxy.dom),resizeFrame:false});this.scroll=false;this.hw=this.view.splitHandleWidth||5},b4StartDrag:function(a,e){this.dragHeadersDisabled=this.view.headersDisabled;this.view.headersDisabled=true;var d=this.view.mainWrap.getHeight();this.marker.setHeight(d);this.marker.show();this.marker.alignTo(this.view.getHeaderCell(this.cellIndex),"tl-tl",[-2,0]);this.proxy.setHeight(d);var b=this.cm.getColumnWidth(this.cellIndex),c=Math.max(b-this.grid.minColumnWidth,0);this.resetConstraints();this.setXConstraint(c,1000);this.setYConstraint(0,0);this.minX=a-c;this.maxX=a+1000;this.startPos=a;Ext.dd.DDProxy.prototype.b4StartDrag.call(this,a,e)},allowHeaderDrag:function(a){return true},handleMouseDown:function(a){var h=this.view.findHeaderCell(a.getTarget());if(h&&this.allowHeaderDrag(a)){var k=this.view.fly(h).getXY(),c=k[0],i=a.getXY(),b=i[0],g=h.offsetWidth,d=false;if((b-c)<=this.hw){d=-1}else{if((c+g)-b<=this.hw){d=0}}if(d!==false){this.cm=this.grid.colModel;var j=this.view.getCellIndex(h);if(d==-1){if(j+d<0){return}while(this.cm.isHidden(j+d)){--d;if(j+d<0){return}}}this.cellIndex=j+d;this.split=h.dom;if(this.cm.isResizable(this.cellIndex)&&!this.cm.isFixed(this.cellIndex)){Ext.grid.GridView.SplitDragZone.superclass.handleMouseDown.apply(this,arguments)}}else{if(this.view.columnDrag){this.view.columnDrag.callHandleMouseDown(a)}}}},endDrag:function(g){this.marker.hide();var a=this.view,c=Math.max(this.minX,g.getPageX()),d=c-this.startPos,b=this.dragHeadersDisabled;a.onColumnSplitterMoved(this.cellIndex,this.cm.getColumnWidth(this.cellIndex)+d);setTimeout(function(){a.headersDisabled=b},50)},autoOffset:function(){this.setDelta(0,0)}});Ext.grid.PivotGridView=Ext.extend(Ext.grid.GridView,{colHeaderCellCls:"grid-hd-group-cell",title:"",getColumnHeaders:function(){return this.grid.topAxis.buildHeaders()},getRowHeaders:function(){return this.grid.leftAxis.buildHeaders()},renderRows:function(a,t){var b=this.grid,o=b.extractData(),p=o.length,g=this.templates,s=b.renderer,h=typeof s=="function",w=this.getCellCls,n=typeof w=="function",d=g.cell,x=g.row,k=[],q={},c="width:"+this.getGridInnerWidth()+"px;",l,r,e,v,m;a=a||0;t=Ext.isDefined(t)?t:p-1;for(v=0;v','
','
','
{title}
','
','
',"
",'
',"
",'
','
','
{body}
','',"
","
",'
 
','
 
',""),initTemplates:function(){Ext.grid.PivotGridView.superclass.initTemplates.apply(this,arguments);var a=this.templates||{};if(!a.gcell){a.gcell=new Ext.XTemplate('','
',this.grid.enableHdMenu?'':"","{value}","
","")}this.templates=a;this.hrowRe=new RegExp("ux-grid-hd-group-row-(\\d+)","")},initElements:function(){Ext.grid.PivotGridView.superclass.initElements.apply(this,arguments);this.rowHeadersEl=new Ext.Element(this.scroller.child("div.x-grid3-row-headers"));this.headerTitleEl=new Ext.Element(this.mainHd.child("div.x-grid3-header-title"))},getGridInnerWidth:function(){var a=Ext.grid.PivotGridView.superclass.getGridInnerWidth.apply(this,arguments);return a-this.getTotalRowHeaderWidth()},getTotalRowHeaderWidth:function(){var d=this.getRowHeaders(),c=d.length,b=0,a;for(a=0;a0&&d>0){h=h||o.data[a[g-1].dataIndex]!=l[d-1].data[a[g-1].dataIndex]}if(h){s.push({header:q,span:p,start:b});b+=p;p=0}if(k){s.push({header:n,span:p+1,start:b});b+=p;p=0}q=n;p++}c.push({items:s,width:e.width||this.defaultHeaderWidth});q=undefined}return c}});Ext.grid.HeaderDragZone=Ext.extend(Ext.dd.DragZone,{maxDragWidth:120,constructor:function(a,c,b){this.grid=a;this.view=a.getView();this.ddGroup="gridHeader"+this.grid.getGridEl().id;Ext.grid.HeaderDragZone.superclass.constructor.call(this,c);if(b){this.setHandleElId(Ext.id(c));this.setOuterHandleElId(Ext.id(b))}this.scroll=false},getDragData:function(c){var a=Ext.lib.Event.getTarget(c),b=this.view.findHeaderCell(a);if(b){return{ddel:b.firstChild,header:b}}return false},onInitDrag:function(a){this.dragHeadersDisabled=this.view.headersDisabled;this.view.headersDisabled=true;var b=this.dragData.ddel.cloneNode(true);b.id=Ext.id();b.style.width=Math.min(this.dragData.header.offsetWidth,this.maxDragWidth)+"px";this.proxy.update(b);return true},afterValidDrop:function(){this.completeDrop()},afterInvalidDrop:function(){this.completeDrop()},completeDrop:function(){var a=this.view,b=this.dragHeadersDisabled;setTimeout(function(){a.headersDisabled=b},50)}});Ext.grid.HeaderDropZone=Ext.extend(Ext.dd.DropZone,{proxyOffsets:[-4,-9],fly:Ext.Element.fly,constructor:function(a,c,b){this.grid=a;this.view=a.getView();this.proxyTop=Ext.DomHelper.append(document.body,{cls:"col-move-top",html:" "},true);this.proxyBottom=Ext.DomHelper.append(document.body,{cls:"col-move-bottom",html:" "},true);this.proxyTop.hide=this.proxyBottom.hide=function(){this.setLeftTop(-100,-100);this.setStyle("visibility","hidden")};this.ddGroup="gridHeader"+this.grid.getGridEl().id;Ext.grid.HeaderDropZone.superclass.constructor.call(this,a.getGridEl().dom)},getTargetFromEvent:function(c){var a=Ext.lib.Event.getTarget(c),b=this.view.findCellIndex(a);if(b!==false){return this.view.getHeaderCell(b)}},nextVisible:function(c){var b=this.view,a=this.grid.colModel;c=c.nextSibling;while(c){if(!a.isHidden(b.getCellIndex(c))){return c}c=c.nextSibling}return null},prevVisible:function(c){var b=this.view,a=this.grid.colModel;c=c.prevSibling;while(c){if(!a.isHidden(b.getCellIndex(c))){return c}c=c.prevSibling}return null},positionIndicator:function(d,k,j){var a=Ext.lib.Event.getPageX(j),g=Ext.lib.Dom.getRegion(k.firstChild),c,i,b=g.top+this.proxyOffsets[1];if((g.right-a)<=(g.right-g.left)/2){c=g.right+this.view.borderWidth;i="after"}else{c=g.left;i="before"}if(this.grid.colModel.isFixed(this.view.getCellIndex(k))){return false}c+=this.proxyOffsets[0];this.proxyTop.setLeftTop(c,b);this.proxyTop.show();if(!this.bottomOffset){this.bottomOffset=this.view.mainHd.getHeight()}this.proxyBottom.setLeftTop(c,b+this.proxyTop.dom.offsetHeight+this.bottomOffset);this.proxyBottom.show();return i},onNodeEnter:function(d,a,c,b){if(b.header!=d){this.positionIndicator(b.header,d,c)}},onNodeOver:function(g,b,d,c){var a=false;if(c.header!=g){a=this.positionIndicator(c.header,g,d)}if(!a){this.proxyTop.hide();this.proxyBottom.hide()}return a?this.dropAllowed:this.dropNotAllowed},onNodeOut:function(d,a,c,b){this.proxyTop.hide();this.proxyBottom.hide()},onNodeDrop:function(b,m,g,c){var d=c.header;if(d!=b){var k=this.grid.colModel,j=Ext.lib.Event.getPageX(g),a=Ext.lib.Dom.getRegion(b.firstChild),o=(a.right-j)<=((a.right-a.left)/2)?"after":"before",i=this.view.getCellIndex(d),l=this.view.getCellIndex(b);if(o=="after"){l++}if(i=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 b=this.config.length,a=0;for(;a0},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)}if(!this.silent){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)}},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,p=i.lastEdit,j=i.activeEditor,b=l.shiftKey,o,p,a,m;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(p.row-1,p.col,-1,this.acceptsNav,this)}else{h=i.walkCells(p.row+1,p.col,1,this.acceptsNav,this)}}}}if(h){a=h[0];m=h[1];this.onEditorSelect(a,p.row);if(i.isEditor&&i.editing){o=i.activeEditor;if(o&&o.field.triggerBlur){o.field.triggerBlur()}}i.startEditing(a,m)}},onEditorSelect:function(b,a){if(a!=b){this.selectRow(b)}},destroy:function(){Ext.destroy(this.rowNav);this.rowNav=null;Ext.grid.RowSelectionModel.superclass.destroy.call(this)}});Ext.grid.Column=Ext.extend(Ext.util.Observable,{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);this.addEvents("click","contextmenu","dblclick","mousedown");Ext.grid.Column.superclass.constructor.call(this)},processEvent:function(b,d,c,g,a){return this.fireEvent(b,this,c,g,d)},destroy:function(){if(this.setEditor){this.setEditor(null)}this.purgeListeners()},renderer:function(a){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.ActionColumn=Ext.extend(Ext.grid.Column,{header:" ",actionIdRe:/x-action-col-(\d+)/,altText:"",constructor:function(b){var g=this,c=b.items||(g.items=[g]),a=c.length,d,e;Ext.grid.ActionColumn.superclass.constructor.call(g,b);g.renderer=function(h,i){h=Ext.isFunction(b.renderer)?b.renderer.apply(this,arguments)||"":"";i.css+=" x-action-col-cell";for(d=0;d"}return h}},destroy:function(){delete this.items;delete this.renderer;return Ext.grid.ActionColumn.superclass.destroy.apply(this,arguments)},processEvent:function(c,i,d,j,b){var a=i.getTarget().className.match(this.actionIdRe),h,g;if(a&&(h=this.items[parseInt(a[1],10)])){if(c=="click"){(g=h.handler||this.handler)&&g.call(h.scope||this.scope||this,d,j,b,h,i)}else{if((c=="mousedown")&&(h.stopSelection!==false)){return false}}}return Ext.grid.ActionColumn.superclass.processEvent.apply(this,arguments)}});Ext.grid.Column.types={gridcolumn:Ext.grid.Column,booleancolumn:Ext.grid.BooleanColumn,numbercolumn:Ext.grid.NumberColumn,datecolumn:Ext.grid.DateColumn,templatecolumn:Ext.grid.TemplateColumn,actioncolumn:Ext.grid.ActionColumn};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",isColumn:true,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(){Ext.fly(this.grid.getView().innerHd).on("mousedown",this.onHdMouseDown,this)},this)},processEvent:function(b,d,c,g,a){if(b=="mousedown"){this.onMouseDown(d,d.getTarget());return false}else{return Ext.grid.Column.prototype.processEvent.apply(this,arguments)}},onMouseDown:function(c,b){if(c.button===0&&b.className=="x-grid3-row-checker"){c.stopEvent();var d=c.getTarget(".x-grid3-row");if(d){var a=d.rowIndex;if(this.isSelected(a)){this.deselectRow(a)}else{this.selectRow(a,true);this.grid.getView().focusRow(a)}}}},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'
 
'},onEditorSelect:function(b,a){if(a!=b&&!this.checkOnly){this.selectRow(b)}}});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.getKeyEvent(),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:"Yes",falseText:"No",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);this.destroyEditors(this.editors);this.destroyEditors(this.grid.customEditors)},destroyEditors:function(b){for(var a in b){Ext.destroy(b[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",cancelEditOnToggle:true,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.canGroup(),true)}},renderUI:function(){var a=Ext.grid.GroupingView.superclass.renderUI.call(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)}return a},processEvent:function(b,i){Ext.grid.GroupingView.superclass.processEvent.call(this,b,i);var h=i.getTarget(".x-grid-group-hd",this.mainBody);if(h){var g=this.getGroupField(),d=this.getPrefix(g),a=h.id.substring(d.length),c=new RegExp("gp-"+Ext.escapeRe(g)+"--hd");a=a.substr(0,a.length-3);if(a||c.test(h.id)){this.grid.fireEvent("group"+b,this.grid,g,a,i)}if(b=="mousedown"&&i.button==0){this.toggleGroup(h.parentNode)}}},onGroupByClick:function(){var a=this.grid;this.enableGrouping=true;a.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));a.fireEvent("groupchange",a,a.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),d=Ext.util.Format.htmlEncode(a.id);b=Ext.isDefined(b)?b:a.hasClass("x-grid-group-collapsed");if(this.state[d]!==b){if(this.cancelEditOnToggle!==false){this.grid.stopEditing(true)}this.state[d]=b;a[b?"removeClass":"addClass"]("x-grid-group-collapsed")}},toggleAllGroups:function(c){var b=this.getGroups();for(var d=0,a=b.length;d 0) { height = viewSize.height * heightPc / 100; } this.setSize(width, height); if (!noCenter) { this.center(); } } return this; } }); // Fix IE 7 - Iframe problem with tree panel Ext.override(Ext.EventObjectImpl, { getTarget: function(selector, maxDepth, returnEl) { var targetElement; try { targetElement = selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target); } catch (e) { targetElement = returnEl ? Ext.get(this.target) : this.target; } return targetElement; } }); /** * Override the default date format of Date field */ Ext.apply(Ext.form.DateField.prototype, { format: auDate1, altFormats: auDate2 }); /** * Allow DataView plugins time to react */ Ext.apply(Ext.DataView.prototype, { ignoreContainerClick: false, onContainerClick: function() { if (this.ignoreContainerClick) return; this.clearSelections(); } }); Ext.grid.DateColumn.prototype.format = auDateShortWithZero; Ext.override(Ext.Element, { index: function() { var parent = this.dom.parentNode; return parent ? arrProto.indexOf.call(parent.children, this.dom) : -1; } }); Ext.apply(Ext.data.Store.prototype, { any: function(fn, scope) { if (!Ext.isFunction(fn)) return false; for (var i = 0, ii = this.getCount(); i < ii; ++i) { if (fn.call(scope || this, this.getAt(i), i)) return true; } return false; }, /** * Overwrite current baseParms with new one, and reload * Can specify to ommit auto reload */ applyBaseParams: function(params, noAutoReload) { Ext.apply(this.baseParams, params || {}); if (!noAutoReload) this.reload(); }, every: function(fn, scope) { if (!Ext.isFunction(fn)) throw new Error('First parameter is not a function.'); for (var i = 0, ii = this.getCount(); i < ii; ++i) { if (!fn.call(scope || this, this.getAt(i), i)) return false; } return true; }, pluck: function(prop, clean) { return this.data.pluck(prop, clean); }, pluckRecord: function(prop, clean) { return this.data.pluckRecord(prop, clean); }, toArray: function() { return this.data.toArray(); } }); Ext.override(Ext.util.MixedCollection, { /** * Get the desired prop out of every item in the collection * @param {boolean} clean Flag to determine if falsy value should be remove * Falsy values include 0, '', false, null, undefined */ pluck: function(prop, clean) { var result = []; for (var i = 0, ii = this.getCount(); i < ii; ++i) { result.push(this.itemAt(i)[prop]); } return clean ? Ext.clean(result) : result; }, /** * Get the desired prop out of every record in the collection * @param {boolean} clean Flag to determine if falsy value should be remove * Falsy values include 0, '', false, null, undefined */ pluckRecord: function(prop, clean) { var result = []; for (var i = 0, ii = this.getCount(); i < ii; ++i) { result.push(this.itemAt(i).get(prop)); } return clean ? Ext.clean(result) : result; }, toArray: function() { return this.items.slice(0); } }); Ext.apply(Ext, { copyToIf: function(d, e, g) { if (typeof g === "string") g = g.split(/[,;\s]/); Ext.each(g, function(h) { if (!d.hasOwnProperty(h) && e[h]) { d[h]=e[h]; } }); return d; }, pluckRecord: function(records, prop, clean) { var result = records.map(function(rec) { return rec.get(prop); }); return clean ? Ext.clean(result) : result; }, areNumber: function(val) { return Ext.isArray(val) && val.forEach(Ext.isNumber); }, isIpad: !!navigator.userAgent.match(/iPad/i), isRecord: function(r) { return r instanceof Ext.data.Record; } }); })(); /** * Define basic mixins for grid to have state store in persistence layer * API for stateful grid * - settingId {string} (required) Associated by GRID_LAYOUT_STATES const */ Ext.preg('column-state', Ext.ns('CTB.grid.plugin').ColumnState = Ext.extend(Ext.emptyFn, { init: function(grid) { this.settingId = grid.settingId || this.settingId; this.grid = grid; grid.on({ scope: this, render: this.checkHasGridSettings, columnresize: this.onGridSettingsChange, destroy: this.onGridDestroy }); grid.getColumnModel().on({ scope: this, hiddenchange: grid.onGridSettingsChange, columnmoved: grid.onGridSettingsChange, widthchange: grid.onGridSettingsChange }); }, onGridDestroy: function() { this.settingId = this.grid = null; }, checkHasGridSettings: function() { if (!this.settingId) { return; } CTB.api.setting.Grid.checkHasGridSettings({ settingId: this.settingId, scope: this, beforeSend: { fn: this.maskCmp, args: ['Getting grid settings. Please wait...'] }, success: function(hasSetting) { if (!hasSetting) { this.unmask(); return; } this.loadGridSettings(); }, failure: this.unmask }); }, loadGridSettings: function() { CTB.api.setting.Grid.loadGridSettings({ settingId: this.settingId, scope: this, success: function(result) { var response = result.json(); if (!response.message.IsSuccess) { showWarningMessage('Failure loading grid settings. Please try again later.'); return; } var settings = JSON.tryParse(response.data); if (!settings) { return; } this.applyGridSettings(settings); }, callback: this.unmask }); }, applyGridSettings: function(settings) { var colModel = this.grid.getColumnModel(); var columns = colModel.columns; var groupRows = colModel.rows ? colModel.rows[0] : null; var columnSettings = settings.columns; var rowSettings = settings.rows; var newColumns = []; columnSettings.forEach(function(setting) { for (var i = 0, ii = columns.length; i < ii; ++i) { var column = columns[i]; var isChecker = column.id === 'checker' || column.columnId === 'checker'; if (isChecker) { column.width = 20; column.columnId = 'checker'; newColumns.unshift(column); return; } if (column.columnId === setting.columnId || column.id === setting.id) { Ext.copyTo(column, setting, ['columnId', 'hidden', 'width']); newColumns.push(column); } } }); colModel.columns = newColumns; // columns.sort(function(a, b) { // return typeof a.idx === 'undefined' ? 1 : (a.idx > b.idx ? 1 : -1); // }); if (Ext.isArray(rowSettings)) { rowSettings.forEach(function(setting) { for (var i = 0, ii = groupRows.length; i < ii; ++i) { var row = groupRows[i]; if (row.groupName === setting.groupName) { row.idx = setting.idx; return; } } }); groupRows.sort(function(a, b) { return typeof a.idx === 'undefined' ? 1 : (a.idx > b.idx ? 1 : -1); }); } this.grid.getView().refresh(true); }, onGridSettingsChange: function() { if (this._changeHandlerTO) clearTimeout(this._changeHandlerTO); this._changeHandlerTO = Ext.defer(this.saveGridSettings, 500, this); }, saveGridSettings: function() { var colModel = this.grid.getColumnModel(); var columns = colModel.columns; var groupRows = colModel.rows ? colModel.rows : void 0; var settings = { columns: columns.map(function(column, idx) { return { idx: idx, columnId: column.columnId, hidden: column.hidden, width: column.width }; }), rows: groupRows ? groupRows.map(function(row, idx) { return { idx: idx, groupName: row.groupName }; }) : void 0 }; CTB.api.setting.Grid.saveGridSettings({ settingId: this.settingId, settings: settings, scope: this, success: function(result) { var response = result.json(); if (!response.message.IsSuccess) { showWarningMessage('Error saving grid settings. Please try again later.'); return; } }, failure: function() { showWarningMessage('Error saving grid settings. Please try again later.'); } }); }, maskCmp: function(txt) { this.grid.maskCmp(txt); }, unmask: function() { this.grid.unmask(); } })); !(function() { Ext.apply(Ext.ns('CTB'), { WIN_CLS: 'ctbwindow-detail-general', WIN_ICON: '', fn: { returnTrue: function() { return true; }, returnFalse: function() { return false; }, identityFn: function(a) { return a; } }, assert: (function() { var asserters = { number: Ext.isNumber, date: Ext.isDate, string: Ext.isString, bool: Ext.isBoolean, boolean: Ext.isBoolean, defined: Ext.isDefined }; return function assert(data, opts) { var assertedProps; var props = Object.keys(opts); for (var i = 0, ii = props.length; ii > i; ++i) { var prop = props[i]; var assertion = opts[prop]; var type; var message; var optional; // dont assert if passed null, just passed to assertedProps if (type === null) { (assertedProps || (assertedProps = [])).push(prop); continue; } switch (Ext.type(assertion)) { case 'array': type = assertion[0]; message = assertion[1]; optional = assertion[2]; break; case 'object': message = assertion.msg; type = assertion.type; optional = assertion.optional; } if (!(type in asserters)) throw new Error('Invalid data type for assertion: "' + type + '".'); if (optional !== true && !asserters[type](data[prop])) throw new Error(typeof message !== 'undefined' ? message : 'Invalid type of prop: ' + prop + '. Expected type: ' + type + ' but got ' + Ext.type(data[prop]) ); (assertedProps || (assertedProps = [])).push(prop); } return assertedProps; }; })() }); Ext.apply(Ext.ns('CTB.util'), { /** * Utility to append css string at runtime */ css: (function() { var head = document.head; function getEl(text) { var style = document.createElement('style'); style.textContent = text; return style; } return function(text) { text = Array.isArray(text) ? text.join('') : text; return head.appendChild(getEl(text)); }; }()), toCssCls: function() { var r = ''; for (var i = 0, ii = arguments.length; i < ii; ++i) { var arg = arguments[i]; if (Ext.isArray(arg)) { r += ' .' + arg.join('.'); } else { r += ' .' + arg; } } return r; } }); })(); Ext.preg('relay_element_event', Ext.extend(Object, { events: Object.freeze([]), constructor: function(cfg) { this.events = cfg.events || this.events; }, /**@param {ExtCmp} c */ init: function(c) { if (c.rendered) { this.relayEvents(c); } else { c.on('render', this.relayEvents, this, { single: true }); } }, /**@private @param {ExtCmp} c */ relayEvents: function(c) { var el = c.getEl(); var events = this.events || []; events = Array.isArray(events) ? events : [events]; for (var i = 0, ii = events.length; i < ii; ++i) { // el.relayEvent(events[i], c); c.mon(el, events[i], this.refire, { context: c, event: 'el_' + events[i] }); } }, refire: function() { var c = this.context; c.fireEvent.apply(c, [].concat.apply([this.event], arguments)); } })); Ext.apply(Ext.util.Format, (function() { return { currencyRenderer: function(value, currencyId) { if (!currencyId) currencyId = GLOBAL_SYSTEM_CURRENCY; // Australian dollar as default var currencyRecord = Global_Currency_Store.getById(currencyId); if (currencyRecord) { var currencySymbol = currencyRecord.data.currencySymbol; return Ext.util.Format.customMoney(value, currencySymbol); } return Ext.util.Format.usMoney(value); } }; })()); Ext.onReady(function() { Ext.apply(Ext.Msg, { warn: function showWarningMessage(msg, cb, scope) { return Ext.Msg.show({ title: 'Warning', msg: msg, buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING, fn: function() { Ext.isFunction(cb) && cb.call(scope); } }); }, error: function showErrorMessage(msg, cb, scope) { return Ext.Msg.show({ title: 'Error', msg: msg, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR, fn: function() { Ext.isFunction(cb) && cb.call(scope); }, scope: scope }); }, info: function showInfoMessage(msg, cb, scope) { return Ext.Msg.show({ title: 'Info', msg: msg, buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO, fn: function() { Ext.isFunction(cb) && cb.call(scope); } }); } }); }); !(function() { JSON.tryParse = function(str, receiver) { try { return JSON.parse(str, receiver); } catch (ex) { return null; } }; if (!Array.prototype.findIndex) { Object.defineProperty(Array.prototype, 'findIndex', { value: function(predicate) { if (this == null) { throw new TypeError('"this" is null or not defined'); } if (typeof predicate !== 'function') { throw new TypeError('predicate must be a function'); } var o = Object(this); var len = o.length >>> 0; var thisArg = arguments.length > 1 ? arguments[1] : void 0; var k = 0; while (k < len) { if (predicate.call(thisArg, o[k], k, o)) return k; k++; } return -1; } }); } })(); Ext.reg('report-store', (function() { var cap = Ext.util.Format.capitalize; function translate(v) { var isDtp = /beverage/i.test(CTB.init.languageDictionary.GetValue("FOOD_COST")); return isDtp ? cap(v.replace('Kitchen', 'Bar').replace(/food cost/i, 'beverage cost')) : v; } return Ext.ns('CTB.data.store').Report = Ext.extend(Ext.data.JsonStore, { fields: [ { name: 'reportId', type: 'number' }, { name: 'reportName', type: 'string', convert: translate }, { name: 'reportDescription', type: 'string' }, { name: 'pictureLocation', type: 'string' }, { name: 'url', mapping: 'reportName', convert: function(v) { return translate(v).trim().toLowerCase().split(' ').join('-'); }}, { name: 'isHavingAccess', type: 'boolean' } ], root: 'data[0].reports', idProperty: 'reportId', sortInfo: { field: 'reportName', direction: 'ASC' }, constructor: function(cfg) { CTB.data.store.Report.superclass.constructor.call(this, Ext.applyIf(cfg, { baseParams: cfg.baseParams || { sectionName: cfg.sectionName }, root: this.root, idProperty: this.idProperty, fields: this.fields, proxy: new Ext.data.HttpProxy({ url: '/User/LoadCurrentUserReportAccess', dataType: 'json', method: 'post' }) })); } }); })()); Ext.reg('stockorder-store', Ext.ns('CTB.data.store').StockOrder = Ext.extend(Ext.data.JsonStore, (function() { var fields = Ext.ns('CTB.data.model').StockOrder = Ext.data.Record.create([ { name: 'stockOrderId', type: 'number' }, { name: 'supplierReferenceOrderNumber', type: 'string' }, { name: 'stockOrderDate', type: 'date' }, { name: 'stockOrderNo', type: 'string' }, { name: 'supplierName', type: 'string' }, { name: 'supplierId', type: 'number' }, { name: 'isHavingMultipleSuppliers', type: 'boolean' }, { name: 'stockOrderTotal', type: 'number' }, { name: 'status', type: 'string' }, { name: 'outletName', type: 'string' }, { name: 'invoiceReferenceNo', type: 'string' }, { name: 'createdBy', type: 'string' }, { name: 'createdDate', type: 'date' }, { name: 'multiSuppliersOrderStocktakeTemplateId', type: 'number' }, { name: 'businessDepartmentIdForRequisition', type: 'number' } ]); return { fields: fields, root: 'data', idProperty: 'stockOrderId', totalProperty: 'totalCount', constructor: function(o) { var cfg = o || {}; cfg.root = cfg.root || this.root; cfg.idProperty = cfg.idProperty || this.idProperty; cfg.fields = cfg.fields || this.fields; cfg.proxy = cfg.proxy || new Ext.data.HttpProxy({ url: '/StockOrder/SearchStockOrders', dataType: 'json', method: 'post' }); CTB.data.store.StockOrder.superclass.constructor.call(this, cfg); } }; })())); Ext.reg('stockorder-template-store', CTB.data.store.StockOrderTemplate = Ext.extend(Ext.data.JsonStore, (function() { var fields = CTB.data.model.StockOrderTemplate = Ext.data.Record.create([ { name: 'stockOrderId', type: 'number' }, { name: 'isHavingMultipleSuppliers', type: 'boolean' }, { name: 'stockOrderDate', type: 'date' }, { name: 'stockOrderNo', type: 'string' }, { name: 'supplierName', type: 'string' }, { name: 'supplierId', type: 'number' }, { name: 'stockOrderTotal', type: 'number' }, { name: 'templateName', type: 'string' }, { name: 'status', type: 'string' }, { name: 'outletName', type: 'string' }, { name: 'multiSuppliersOrderStocktakeTemplateId', type: 'number' } ]); return { fields: fields, root: 'data', idProperty: 'stockOrderId', totalProperty: 'totalCount', constructor: function(o) { var cfg = o || {}; cfg.root = cfg.root || this.root; cfg.idProperty = cfg.idProperty || this.idProperty; cfg.fields = cfg.fields || this.fields; cfg.proxy = cfg.proxy || new Ext.data.HttpProxy({ url: '/StockOrder/SearchStockOrderTemplates', dataType: 'json', method: 'post' }); CTB.data.store.StockOrderTemplate.superclass.constructor.call(this, cfg); } }; })())); Ext.reg('stockorder-detail-store', CTB.data.store.StockOrderDetail = Ext.extend(Ext.data.JsonStore, (function() { var fields = CTB.data.model.StockOrderDetail = Ext.data.Record.create([ { name: 'stockOrderDetailId', type: 'number' }, { name: 'stockSupplierId', type: 'number' }, { name: 'stockCode', type: 'string' }, { name: 'stockDesc', type: 'string' }, { name: 'stockUnit', type: 'number' }, { name: 'stockUnitOfMeasurementId', type: 'number' }, { name: 'supplierSellingUnit', type: 'number' }, { name: 'supplierUnitMeasurement', type: 'string' }, { name: 'stockOrderCost', type: 'number' }, { name: 'stockOrderSubtotal', type: 'number' }, { name: 'stockQty', type: 'number' }, { name: 'stockQtyByPackagingType', type: 'number' }, { name: 'notes', type: 'string' }, { name: 'stockCategoryName', type: 'string' }, { name: 'isDifferent', type: 'bool' } ]); return { fields: fields, root: 'data', idProperty: 'stockOrderDetailId', totalProperty: 'totalCount', constructor: function(o) { var cfg = o || {}; cfg.root = cfg.root || this.root; cfg.idProperty = cfg.idProperty || this.idProperty; cfg.fields = cfg.fields || this.fields; cfg.proxy = cfg.proxy || new Ext.data.HttpProxy({ url: '/StockOrder/GetStockOrderDetailByStockOrderId', dataType: 'json', method: 'POST' }); CTB.data.store.StockOrderDetail.superclass.call(this, cfg); } }; })())); Ext.reg('uploader-store', Ext.ns('CTB.data.store').Uploader = Ext.extend(Ext.data.Store, (function() { window.URL = window.URL || window.webkitURL; var Types = Ext.data.Types; /** * File Model associated with the store */ Ext.ns('CTB.data.model').Uploader = Ext.data.Record.create([ { name: 'file', convert: function(v) { addFileToModel(v, this); return v; }}, { name: 'name' }, { name: 'url' }, { name: 'mediaType' }, { name: 'ext' }, { name: 'mime' }, { name: 'size' }, { name: 'started', type: Types.BOOL }, { name: 'progress', type: Types.NUMBER }, { name: 'complete', type: Types.BOOL }, { name: 'error', type: Types.BOOL }, { name: 'canDownloadDocument', type: Types.BOOL} ]); /** * Static helper to create a record from file */ CTB.data.model.Uploader.fromFile = function(file) { var document = addFileToModel(file, new CTB.data.model.Uploader()); document.data.canDownloadDocument = this.uploadParams.canDownloadDocument; document.data.mediaFolderId = this.uploadParams.mediaFolderId; return document; }; Ext.apply(CTB.data.model.Uploader.prototype, (function() { return { upload: function(uploadParams) { var endPoint = uploadParams.endPoint; if (!endPoint) { throw new Error('No end point specify for uploading process'); } if (this.get('started') || this.get('complete')) { throw new Error('Already uploaded'); } var xhr = new XMLHttpRequest(); var data = new FormData(); var file = this.get('file'); data.append(file.name, file); Object.keys(uploadParams).forEach(function(key) { if (key === 'endPoint') return; data.append(key, uploadParams[key]); }); this.data.started = true; // dont trigger event. View may not be ready this.xhr = xhr; xhr.fakePercent = 0; xhr.rec = this; xhr.open('post', endPoint, true); xhr.setRequestHeader('ContentType', 'application/x-www-form-urlencoded'); xhr.onprogress = onXhrProgress; xhr.onload = onXhrLoaded; xhr.send(data); return this; }, isQueueing: function() { return this.get('file') && !this.get('started') && !this.get('progress'); }, isUploading: function() { return this.get('started') && !this.get('complete'); }, stop: function() { if (this.isUploading()) { this.xhr.abort(); } this.xhr = null; return this; }, onUploadComplete: function(response) { var rec = this; rec.set('progress', 100); rec.set('complete', true); rec.store.onFileUploaded(rec, response); }, unlinkFile: function() { destroyLink(this.get('file')); this.set('file', null); return this; } }; function onXhrProgress(e) { this.rec.set('progress', e.lengthComputable ? (((e.loaded / e.total) || 0) * 100) : Math.min(this.fakePercent++, 90)); } function onXhrLoaded() { this.rec.onUploadComplete(JSON.parse(this.responseText)); } })()); return { recordType: CTB.data.model.Uploader, maxFileSizeKB: 500, constructor: function(config) { if (!Ext.isNumber(config.maxFileSizeKB)) config.maxFileSizeKB = 500; CTB.data.store.Uploader.superclass.constructor.call(this, config || {}); this.isUploadingFile = false; this.on({ add: this.onAddFile, remove: this.onRemoveFile }); }, /** * Deciding final common api for all stores to implement a simple, unified way to create records from data */ createNewRecord: Ext.emptyFn, addFile: function(files) { var inputs = Array.isArray(files) ? files : [files]; var recs = inputs.filter(this.isAddable, this).map(CTB.data.model.Uploader.fromFile.bind(this)); return this.add(recs); }, isAddable: function(file) { var isSizeValid = this.isSizeValid(file); if (!isSizeValid) { showWarningMessage('Maximum size exceeded. Please choose file size smaller than ' + Ext.util.Format.fileSize(this.maxFileSizeKB * 1024)); return false; } var isExistingFile = this.isExistingFile(file); if (isExistingFile) { showNotification('Duplicated', 'File ' + file.name + ' already included'); return false; } return true; }, isSizeValid: function(file) { return file.size < (this.maxFileSizeKB * 1024); }, // Perform simple check whether a file was included. Based on name + size isExistingFile: function(file) { var count = this.getCount(); if (!count) return false; for (var i = 0, ii = count; i < ii; ++i) { var f = this.getAt(i); if (f.get('size') === file.size && f.get('name') === file.name) return true; } return false; }, removeFileAt: function(idx) { var rec = this.getAt(idx), next; if (!rec) return; next = this.getNextRecordOf(rec); this.remove(rec); if (next) { next.upload(this.uploadParams); } else { this.isUploadingFile = false; this.fireEvent('uploadcomplete', this); } }, onFileUploaded: function(rec, response) { var next = this.getNextRecordOf(rec); this.fireEvent('fileuploaddone', this, rec, response); if (next) { next.upload(this.uploadParams); } else { this.isUploadingFile = false; this.fireEvent('uploadcomplete', this); } }, onAddFile: function(store, recs) { if (this.isUploadingFile) return; this.isUploadingFile = true; recs[0].upload(this.uploadParams); this.fireEvent('uploadstart', this, recs[0]); }, onRemoveFile: function(store, rec) { rec.stop().unlinkFile(); }, getNextRecordOf: function(rec) { var idx = this.indexOf(rec); if (idx === -1) return null; var next = this.getAt(idx + 1); return next ? (next.get('complete') ? this.getNextRecordOf(next) : next) : null; }, hasQueueingFile: function() { for (var i = 0, ii = this.getCount(); i < ii; ++i) { if (!this.getAt(i).get('complete')) return true; } return false; } }; function addFileToModel(file, rec) { var type = file.type; var mime = /^(\w+)\/(\w+)$/i.exec(type); Ext.apply(rec.data, { file: file, url: file.noNeedUrl ? "" : getLink(file), name: file.name, size: file.size, mime: type, started: false, progress: file.progress || 0, complete: file.complete || false, error: false, mediaType: mime ? mime[1] : 'unknown', ext: mime ? mime[2] : getFileExt(file.name), canDownloadDocument: false }); return rec; } function getLink(file) { return URL.createObjectURL(file); } function destroyLink(file) { URL.revokeObjectURL(file); } function getFileExt(fileName) { var result = /\.(\w+)$/i.exec(fileName); return result ? result[1] : ''; } })())); Ext.reg('upload-view', Ext.ns('CTB.upload').View = Ext.extend(Ext.DataView, (function() { var viewCls = 'ctb-uploader-view'; var itemCls = 'uploader-item'; /*var inputCls = 'uploader-input'; Ext.util.CSS.createStyleSheet([ // '.' + viewCls + ' { }', '.' + viewCls + '-header { display: table; table-layout: fixed; width: 100%; height: 30px; border-bottom: 1px solid #000; font-weight: bold; }', '.' + viewCls + '-header > div { display: table-cell; vertical-align: middle; }', '.' + viewCls + '-body { height: calc(100% - 30px); overflow-x: hidden; overflow-y: auto; }', '.' + inputCls + '-btn { height: 20px; margin: 0; padding: 0 10px; border: 0; background-color: #c0c0c0; color: #000; font-weight: bold; font-size: 12px; cursor: pointer; }', '.' + inputCls + '-btn:hover { opacity: 0.8; }', '.' + inputCls + ' { display: inline-block; position: absolute; width: 80px; height: 20px; opacity: 0; z-index: 0; pointer-events: none; }', '.{0}-wrap { position: relative; padding: 5px 0; margin-right: 10px }', '.{0}-progress-bg { position: absolute; top: 5px; height: 35px; background-color: darkgreen; }', '.{0}-wrap.error .{0}-progress-bg { background-color: #be1b21; }', '.{0} { position: relative; display: table; table-layout: fixed; width: 100%; height: 35px; }', '.{0}.complete { color: #fff; }', '.{0} > div { display: table-cell; vertical-align: middle; }', '.{0}-info { padding-left: 10px; }', '.{0}-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }', '.{0}-progress-text { width: 60px; text-align: center }', '.{0}-ctrl { width: 40px; text-align: center; }', '.{0}-cancel { height: 20px; margin: 0; padding: 0 10px; border: 0; background-color: #c0c0c0; color: #000; font-weight: bold; font-size: 12px; cursor: pointer; }' ].join('').replace(/\{0\}/g, itemCls), 'uploader-style'); */ return { cls: viewCls, itemCls: itemCls, height: 270, uploadParams: {}, emptyText: "There's no file to upload", store: { xtype: 'uploader-store' }, itemSelector: '.' + itemCls + '-file', initComponent: function() { this.tpl = this.getTemplate(); this.getSuper().initComponent.call(this); this.store.maxFileSizeKB = this.maxFileSizeKB || this.store.maxFileSizeKB; this.relayEvents(this.store, ['addfile', 'removefile', 'fileuploaddone', 'uploadstart', 'uploadcomplete']); this.on({ click: this.onClick }); }, loadDocumentDatas: function(documents){ var theThis = this; this.getStore().removeAll(); documents.forEach(function(document){ theThis.getStore().data.add(CTB.data.model.Uploader.fromFile.bind(theThis)(document)); }); this.refresh(); }, onClick: function(e) { var btn = e.getTarget('.uploader-item-cancel-btn'); var isCanceling = !!btn; var theThis = this; var uploadParams = theThis.uploadParams; if (isCanceling) { var item = e.getTarget(this.itemSelector); var recIdx = [].indexOf.call(item.parentElement.children, item); var file = theThis.getStore().data.items[recIdx]; if (uploadParams.canDeleteDocument && file.data.complete) { Ext.Msg.show({ title: 'Confirm', msg: 'Are you sure you want to delete the document files ?', buttons: Ext.Msg.YESNO, icon: Ext.MessageBox.QUESTION, fn: function(btn) { if (btn === 'yes') { Ext.Ajax.request({ method: 'POST', url: uploadParams.deleteDocumentUrl, params: { filePaths: Ext.util.JSON.encode([uploadParams.mediaFolderId + "\\" + file.data.name]) }, success: function(result) { var jsonData = Ext.util.JSON.decode(result.responseText) if (!jsonData.message.IsSuccess) { showWarningMessage(jsonData.message.Info); return false; } uploadParams.afterDeleteDocument(file.data.name); theThis.getStore().removeFileAt(recIdx); }, failure: function() { return false; } }); } }}); } else { theThis.getStore().removeFileAt(recIdx); } } }, addFile: function(files) { this.store.addFile(Ext.toArray(files)); var uploaderView = this.el.dom.querySelector(".ctb-uploader-view-body"); if(!uploaderView.SimpleBar) { setScrollBarToControl(this.el.dom.querySelector(".ctb-uploader-view-body"), true); } }, onDestroy: function() { this.getStore().each(function(rec) { rec.stop().unlinkFile(); }); this.getSuper().onDestroy.call(this); }, clearUploads: function() { var store = this.getStore(); store.each(function(rec) { rec.stop().unlinkFile(); }); store.removeAll(); }, setUploadParams: function(params) { var uploadParams = { endPoint: params.endPoint, mediaFolderId: params.mediaFolderId, canDownloadDocument: params.canDownloadDocument }; this.uploadParams = params; this.store.uploadParams = uploadParams; return this; }, doUpload: function(rec) { var endPoint = this.uploadParams && this.uploadParams.endPoint; if (!endPoint) { throw new Error('No end point specify for uploading process'); } rec && rec.upload(this.uploadParams); }, getSuper: function() { return CTB.upload.View.superclass; }, getTemplate: function() { var tpl = '
' + '' + '
' + '
' + '
{name}
' + '
{name}
' + '
{size:fileSize}
' + '
Upload failed
' + '
' + '
' + '
' + '
' + '
' + '
' + '
'; return new Ext.XTemplate(tpl.replace(/\{0\}/g, this.itemCls)); } }; })())); Ext.reg('upload-panel', CTB.upload.Panel = Ext.extend(Ext.Panel, (function() { (function() { CTB.upload.TypeExts = { image: 'image/gif,image/jpg,image/jpeg,image/png', video: '.mp3,.mp4,.3gp', word: '.doc,.docx', excel: '.xls,.xlsx', pp: '.ppt,.pptx', text: '.txt', pdf: '.pdf', csv: '.csv' }; CTB.upload.types = { image: 'image', video: 'video', word: 'word', excel: 'excel', csv: 'csv', pdf: 'pdf', text: 'text' }; })(); return { layout: { type: 'vbox', align: 'stretch' }, accept: [ /** * API for setting up accepted file type to select to assist user */ ], margins: '10 10 10 10', initComponent: function() { var inputCls = 'uploader-input'; this.maxFileSizeKB = this.maxFileSizeKB || 3072; //TR833: Update to image upload feature this.items = [ { xtype: 'fieldset', title: 'Select file to upload (' + Ext.util.Format.fileSize(this.maxFileSizeKB * 1024) + ' maximum)', height: 90, margins: 0, items: [ { xtype: 'component', autoEl: { tag: 'input', type: 'file', multiple: '', accept: this.getAcceptedExtensions(this.accept) }, cls: inputCls, ref: '../inputEl' }, { xtype: 'component', autoEl: 'button', cls: 'x-btn-text icon-ok-large', html: 'Add File', ref: '../addFileBtn' } ] }, this.uploadView = { xtype: 'upload-view', flex: 1, margins: '10 0 0 0', ref: 'fileView', uploadParams: this.uploadParams, maxFileSizeKB: this.maxFileSizeKB } ]; CTB.upload.Panel.superclass.initComponent.call(this); this.relayEvents(this.fileView, ['addfile', 'removefile', 'fileuploaddone', 'uploadstart', 'uploadcomplete']); }, openFileSelect: function() { this.inputEl.getEl().dom.click(); }, clearUploads: function() { this.fileView.clearUploads(); }, afterRender: function() { CTB.upload.Panel.superclass.afterRender.call(this); Ext.defer(this.setupEvents, 1, this); }, onSelectFiles: function() { var inputDom = this.inputEl.getEl().dom; var files = inputDom.files; if (files.length) { this.fileView.addFile(files); } inputDom.value = ''; if (!Ext.isSafari) { inputDom.type = ''; inputDom.type = 'file'; } }, setupEvents: function() { this.mon(this.addFileBtn.getEl(), { scope: this, click: this.openFileSelect }); this.mon(this.inputEl.getEl(), { scope: this, change: this.onSelectFiles }); }, setUploadParams: function(params) { this.uploadParams = params; this.fileView.setUploadParams(params); }, getAcceptedExtensions: function(fileTypes) { var typeExts = CTB.upload.TypeExts; var types = Array.isArray(fileTypes) ? fileTypes : [fileTypes]; return types .map(function(type) { return typeExts[type] || void 0 }) .filter(CTB.fn.identityFn) .join(',') || '*'; }, loadDocumentDatas: function(documents) { this.fileView.loadDocumentDatas(documents.map(function(document){ return { name: document, type: null, size: null, progress: 100, complete: true, noNeedUrl: true } })); } }; })())); Ext.ns('CTB.upload').Window = Ext.extend(Ext.Window, (function() { return { iconCls: CTB.WIN_ICON, cls: CTB.WIN_CLS, layout: 'fit', width: 535, height: 480, closable: true, resizable: false, modal: true, plain: true, title: 'Upload Photo', description: 'Please select an image in your computer.
(only JPG, PNG and GIF images will be accepted)', waitingMessage: 'Uploading the new image...', scope: null, onFileUploaded: Ext.emptyFn, onUploadComplete: Ext.emptyFn, /* listeners: { show: function(pThis){ setScrollBarToFirstElement(pThis.items.first().el.dom.querySelector(".ctb-uploader-view-body"), true); } }, */ initComponent: function() { this.items = [ { xtype: 'upload-panel', uploadParams: this.uploadParams, accept: this.accept, maxFileSizeKB: this.maxFileSizeKB, listeners: { scope: this.scope || this, fileuploaddone: this.onFileUploaded, uploadcomplete: this.onUploadComplete } } ]; this.buttons = [ { text: 'Close', handler: this.onClose, scope: this } ]; this.getSuper().initComponent.call(this); }, loadDocumentDatas: function(documents){ if(documents.length > 0 || (this.items.first().fileView && this.items.first().fileView.getStore().data.length > 0)) { this.items.first().loadDocumentDatas(documents); } }, onClose: function() { this[this.closeAction](); }, onDestroy: function() { this.onUploadComplete = this.scope = null; this.getSuper().call(this, arguments); }, setUploadParams: function(params) { this.uploadParams = params; this.items.first().setUploadParams(params); }, clearUploads: function() { this.items.first().clearUploads(); }, getSuper: function() { return CTB.upload.Window.superclass; } }; })()); Ext.reg('upload.tendering', CTB.upload.tendering = function() { var theThis = this; return new CTB.upload.Window({ title: 'Upload Document', closeAction: 'hide', maxFileSizeKB: 10280, accept: (function() { var types = CTB.upload.types; return [types.excel, types.word, types.pdf, types.text, types.csv]; })(), setFormParams: function(params){ theThis.endPoint = params.endPoint; theThis.mediaFolderId = params.mediaFolderId; theThis.accessCode = params.accessCode; theThis.onChangesCallback = params.onChangesCallback; theThis.canDeleteDocument = params.canDeleteDocument; theThis.canDownloadDocument = params.canDownloadDocument; theThis.deleteDocumentUrl = params.deleteDocumentUrl; }, loadDatas: function(metaData){ theThis.metaData = metaData || {}; }, listeners: { scope: this, beforeshow: function(win) { win.setUploadParams({ endPoint: theThis.endPoint, mediaFolderId: theThis.mediaFolderId, canDownloadDocument: theThis.canDownloadDocument, canDeleteDocument: theThis.canDeleteDocument, deleteDocumentUrl: theThis.deleteDocumentUrl, afterDeleteDocument: function(documentName){ var index = theThis.metaData.documentNames.indexOf(documentName); if (index !== -1) { theThis.metaData.documentNames.splice(index, 1); saveMetaData(theThis.accessCode ,theThis.metaData, theThis.onChangesCallback); } } }); win.loadDocumentDatas(theThis.metaData.documentNames || []); } }, scope: this, onFileUploaded: function(store, rec, response) { if (!response.message.IsSuccess) { var isError = /[Ee]rror/.test(response.message.Info); isError ? showErrorMessageWithEmailNotify(response.message.Info) : showNotification('Error', response.message.Info); rec.data.progress = 100; rec.set('error', true); return; } else { if(!theThis.metaData.documentNames) { theThis.metaData.documentNames = []; } theThis.metaData.documentNames.push(response.data.name); saveMetaData(theThis.accessCode, theThis.metaData, theThis.onChangesCallback); } } }); }); function saveMetaData(accessCode, metaData, onChangesCallback){ Ext.Ajax.request({ method: 'POST', url: '/Tendering/SaveMetaData', params: { jsonData : Ext.util.JSON.encode(metaData), accessCode: accessCode }, success: function (result) { var jsonData = Ext.util.JSON.decode(result.responseText); if (!jsonData.message.IsSuccess) { showNotification(jsonData.message.Info); } onChangesCallback && onChangesCallback(metaData); } }); } Ext.ns('CTB').Ajax = (function() { function getConfig(url, params, options) { return { url: url, params: params, method: options.method || 'post', jsonData: options.jsonData || undefined, timeout: options.timeout || 30000, // default 30s timeout scope: options.scope || Ext.emptyFn, success: options.success || Ext.emptyFn, failure: options.failure || Ext.emptyFn, callback: options.callback || Ext.emptyFn }; } // function json() { // return JSON.parse(this.responseText); // } function throwTypeError(value, type) { throw new TypeError('Given value [', value, '] is not the type [', type, ']'); } function assert(value, type) { return typeof value === type || throwTypeError(value, type); } function assertProp(obj, prop, type) { return typeof obj[prop] === type || throwTypeError(obj[prop], type); } return { request: function(url, params, options) { var requestConfig = getConfig(url, params, options); if (options.beforeSend) { var cfg = options.beforeSend; switch (Ext.type(cfg)) { case 'object': cfg.fn.apply(options.scope, cfg.args ? (Ext.isArray(cfg.args) ? cfg.args : [cfg.args]) : null); break; case 'function': cfg.call(options.scope); break; } } return Ext.Ajax.request(requestConfig); }, assert: assert, assertProp: assertProp }; })(); Ext.ns('CTB.api.setting').Grid = (function() { function checkGridSettingInterceptor(result, request, cbOpts) { var response = result.json(); if (!response.message.IsSuccess) { cbOpts.fn.call(this, false); } var settingId = cbOpts.settingId; var settings = JSON.tryParse(response.data); if (!settings) { cbOpts.fn.call(this, false); return; } var setting = settings.find(function(gridSetting) { // gridSetting = [id, desc, on/off] return gridSetting[0] === settingId; }); if (!setting) { cbOpts.fn.call(this, false); } cbOpts.fn.call(this, true); } return { checkHasGridSettings: function(options) { if (!options.settingId) { throw new Error('No grid setting id provided.'); } if (!Ext.isFunction(options.success)) { throw new Error('No callback provided for setting check.'); } options.success = Ext.createDelegate(checkGridSettingInterceptor, options.scope, { settingId: options.settingId, fn: options.success }, true); return CTB.Ajax.request( '/Setting/GetValueByKey', { key: DICTIONARY_KEYS.GRID_COLUMNS_SETTING }, options ); }, loadGridSettings: function(options) { if (!options.settingId) { throw new Error('No grid setting id provided'); } return CTB.Ajax.request( '/Setting/GetValueByKey', { key: options.settingId }, options ); }, saveGridSettings: function(options) { if (!options.settings || !options.settingId) { throw new Error('Not grid settings provided'); } return CTB.Ajax.request( '/Setting/InsertOrUpdateKeyValueDictionary', { key: options.settingId, value: JSON.stringify(options.settings) }, options ); } }; })(); Ext.ns('CTB.api').Order = function() { return { checkDailyOrderDate: function(options) { return CTB.Ajax.request( '/StockOrder/CheckDailyOrderDateValid', { dailyOrderId: options.orderId }, options ); }, checkStockOrderDateValid: function(options) { return CTB.Ajax.request( '/StockOrder/DoesSupplierAcceptDeliveryOnDate', { supplierId: options.supplierId, stockOrderDate: options.deliveryDate, orderTotalValue: options.total }, options ); }, deleteStockOrders: function(options) { return CTB.Ajax.request( '/StockOrder/DeleteStockOrders', { stockOrderIds: JSON.stringify(options.stockOrderIds) }, options ); }, isDateValidForOrders: function(options) { if (!options.orders) throw new Error('Cannot determine orders.'); var orders = options.orders; orders = Array.isArray(orders) ? orders : [orders]; var isRequestDataOk = orders.every(function(order) { return Ext.isNumber(order.total) && Ext.isNumber(order.supplierId); }); if (!isRequestDataOk) { throw new Error('Invalid request data. Each order is expected to have `value` and `supplierId`'); } /** * orders is expected to be an array of object with supplierId, order value and *optional* stockorder id * ex: orders = [ { supplierId: 1, total: 50 }, { supplierId: 2, total: 80 } ] */ return CTB.Ajax.request( '/StockOrder/isDateValidForOrders', { orders: JSON.stringify(orders), date: options.date }, options ); }, isDateValidToOrderFromSuppliers: function(options) { var sups = options.supplierIds; if (!sups) throw new Error('Cannot determine suppliers'); sups = Ext.unique(Array.isArray(sups) ? sups : [sups]); var isRequestOk = sups.length && sups.every(Ext.isNumber); if (!isRequestOk) throw new Error('Invalid request suppliers.'); return CTB.Ajax.request( '/StockOrder/IsDateValidToOrderFromSuppliers', { date: options.date, supplierIds: JSON.stringify(sups), isForWhiteboard: options.isForWhiteboard }, options ); }, areOrdersValid: function(options) { /**@type {any[]} */ var orders = Array.isArray(options.orders) ? options.orders : [options.orders]; if (!orders) throw new Error('Cannot determine orders'); var isRequestDataOk = orders.every(function(order) { return Ext.isNumber(order.supplierId) && Ext.isDate(order.date); }); if (!isRequestDataOk) { throw new Error('Cannot process request. Invalid supplier order data'); } return CTB.Ajax.request( '/StockOrder/AreOrdersValid', { orders: JSON.stringify(orders), isForWhiteboard: options.isForWhiteboard }, options ); }, recipeOrder: { /** * This will always result in a whiteboard order */ toWhiteboard: function(options) { return CTB.Ajax.request( '/StockOrder/RecipeOrderToWhiteboard', { // History: recipe order is daily order. Avoid renaming on server to avoid confusing. dailyOrderId: options.recipeOrderId, recipeOrderName: options.recipeOrderName, // A map of supplier id with their respective date to order for all their stock in this recipe order supplierOrderDates: JSON.stringify(options.supplierOrderDates) }, options ); } }, /** * Inner namespace for Whiteboard API */ whiteboard: { loadOrders: function(options) { if (!Ext.isDate(options.date)) throw new Error('Invalid date.'); return CTB.Ajax.request( '/StockOrder/ViewWhiteboardOrderByDate', { whiteboardDate: options.date }, options ); }, lockDate: function(options) { return CTB.Ajax.request( '/StockOrder/UpdateMultiSupplierOrderStatus', { stockOrderId: options.wbStockOrderId, orderStatus: ORDER_STATUS.MULTI_SUPPLIERS_ORDER_SENT }, options ); }, updateStockItem: function(options) { return CTB.Ajax.request( '/StockOrder/EditStockItemFromMultiSupplierOrder', { callingFromStockOrderId: options.stockOrderId, stockSupplierId: options.stockSupplierId, stockQty: options.stockQty }, options ); }, addStockItem: function(options) { return CTB.Ajax.request( '/StockOrder/AddNewStockItemToWhiteboardOrder', { whiteboardDate: options.date, whiteboardStockOrderDetails: JSON.stringify(options.orderDetails) }, options ); }, deleteStockItem: function(options) { return CTB.Ajax.request( '/StockOrder/DeleteStockItemFromMultiSupplierOrder', { callingFromStockOrderId: options.stockOrderId, stockSupplierId: options.stockSupplierId }, options ); }, canAddStocks: function(options) { var stockSupIds = options.stockSupplierIds; stockSupIds = Array.isArray(stockSupIds) ? stockSupIds : [stockSupIds]; return CTB.Ajax.request( '/StockOrder/CanAddStocksToWhiteboard', { date: options.date, stockSupplierIds: JSON.stringify(stockSupIds) }, options ); }, canAddSuppliers: function(options) { var supIds = options.supplierIds; supIds = Array.isArray(supIds) ? supIds : [supIds]; return CTB.Ajax.request( '/StockOrder/CanAddSuppliersToWhiteboard', { date: options.date, supplierIds: JSON.stringify(supIds) }, options ); } } }; }(); Ext.ns('CTB.api').Outlet = (function() { return { reassignOutlet: function(options) { return CTB.Ajax.request( '/OutletsHierarchy/SetSelectedOutletIdsForReportInSession', { outletId: options.outletId }, options ); } }; })(); Ext.ns('CTB.api').Recipe = function() { return { deleteRecipeFact: function(options) { return CTB.Ajax.request( '/RecipeBook/deleteRecipeFact', { toDelete: options.toDelete, toReplace: options.toReplace, factType: options.factType }, options ); }, addRecipeSection: function(options) { return CTB.Ajax.request( '/RecipeBook/AddRecipeSection', { sectionName: options.sectionName }, options ); }, setRecipeSection: function(options) { return CTB.Ajax.request( '/RecipeBook/SetRecipeSection', { recipeId: options.recipeId, sectionName: options.sectionName }, options ); }, deleteRecipeDietaryRequirement: function(options){ return CTB.Ajax.request( '/DietaryRequirement/DeleteDietaryRequirement', { dietaryIdToDelete: options.dietaryToDelete, dietaryIdToReplace: options.dietaryToReplace }, options ); }, deleteRecipeAllergen: function(options){ return CTB.Ajax.request( '/DietaryRequirement/DeleteAllergen', { allergenIdToDelete: options.allergenIdToDelete, allergenIdToReplace: options.allergenIdToReplace }, options ); }, deleteRecipeTextureModifier: function(options){ return CTB.Ajax.request( '/DietaryRequirement/DeleteTextureModifier', { textureModifierIdToDelete: options.textureModifierIdToDelete, textureModifierIdToReplace: options.textureModifierIdToReplace }, options ); } }; }(); Ext.ns('CTB.api').Report = (function() { return { show: { stockConfirmationOrderSheet: function(options) { return CTB.Ajax.request( '/Report/ShowStockConfirmationOrderSheet', { startDate: options.startDate, endDate: options.endDate }, options ); } } }; })(); Ext.ns('CTB.api').Supplier = function() { return { updateDetail: function(options) { return CTB.Ajax.request( '/Supplier/UpdateSupplierDetail', { supplierData: JSON.stringify(options.supplierData) }, options ); }, updateSettings: function(options) { return CTB.Ajax.request( '/Supplier/UpdateSupplierSettings', { supplierId: options.supplierId, metaData: JSON.stringify(options.settings) }, options ); } }; }(); Ext.reg('requisition-type-combo', Ext.ns('CTB.requisition').TypeCombo = Ext.extend(Ext.form.ComboBox, { store: { xtype: 'arraystore', data: [['In', 'I'], ['Out', 'O']], fields: [ { name: 'requisitionTypeDesc' }, { name: 'requisitionType' } ] }, emptyText: 'Select a type ...', fieldLabel: 'Requisition Type', displayField: 'requisitionTypeDesc', valueField: 'requisitionType', editable: false, triggerAction: 'all', lazyRender: true, mode: 'local' })); Ext.reg('supplier-combo', Ext.ns('CTB.supplier').Combo = Ext.extend(Ext.form.ComboBox, { emptyText: 'Select a Supplier...', fieldLabel: 'Supplier name', displayField: 'supName', valueField: 'supId', forceSelection: true, allowBlank: false, typeAhead: true, editable: true, triggerAction: 'all', lazyRender: true, mode: 'local' })); /** * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com * * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ * * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz�n and Mammon Media and is released under the MIT License: * http://www.opensource.org/licenses/mit-license.php * * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: * http://www.opensource.org/licenses/mit-license.php * */ /* ******************* */ /* Constructor & Init */ /* ******************* */ var SWFUpload; if (SWFUpload == undefined) { SWFUpload = function (settings) { this.initSWFUpload(settings); }; } SWFUpload.prototype.initSWFUpload = function (settings) { try { this.customSettings = {}; // A container where developers can place their own settings associated with this instance. this.settings = settings; this.eventQueue = []; this.movieName = "SWFUpload_" + SWFUpload.movieCount++; this.movieElement = null; // Setup global control tracking SWFUpload.instances[this.movieName] = this; // Load the settings. Load the Flash movie. this.initSettings(); this.loadFlash(); this.displayDebugInfo(); } catch (ex) { delete SWFUpload.instances[this.movieName]; throw ex; } }; /* *************** */ /* Static Members */ /* *************** */ SWFUpload.instances = {}; SWFUpload.movieCount = 0; SWFUpload.version = "2.2.0 2009-03-25"; SWFUpload.QUEUE_ERROR = { QUEUE_LIMIT_EXCEEDED : -100, FILE_EXCEEDS_SIZE_LIMIT : -110, ZERO_BYTE_FILE : -120, INVALID_FILETYPE : -130 }; SWFUpload.UPLOAD_ERROR = { HTTP_ERROR : -200, MISSING_UPLOAD_URL : -210, IO_ERROR : -220, SECURITY_ERROR : -230, UPLOAD_LIMIT_EXCEEDED : -240, UPLOAD_FAILED : -250, SPECIFIED_FILE_ID_NOT_FOUND : -260, FILE_VALIDATION_FAILED : -270, FILE_CANCELLED : -280, UPLOAD_STOPPED : -290 }; SWFUpload.FILE_STATUS = { QUEUED : -1, IN_PROGRESS : -2, ERROR : -3, COMPLETE : -4, CANCELLED : -5 }; SWFUpload.BUTTON_ACTION = { SELECT_FILE : -100, SELECT_FILES : -110, START_UPLOAD : -120 }; SWFUpload.CURSOR = { ARROW : -1, HAND : -2 }; SWFUpload.WINDOW_MODE = { WINDOW : "window", TRANSPARENT : "transparent", OPAQUE : "opaque" }; // Private: takes a URL, determines if it is relative and converts to an absolute URL // using the current site. Only processes the URL if it can, otherwise returns the URL untouched SWFUpload.completeURL = function(url) { if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) { return url; } var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : ""); var indexSlash = window.location.pathname.lastIndexOf("/"); if (indexSlash <= 0) { path = "/"; } else { path = window.location.pathname.substr(0, indexSlash) + "/"; } return /*currentURL +*/ path + url; }; /* ******************** */ /* Instance Members */ /* ******************** */ // Private: initSettings ensures that all the // settings are set, getting a default value if one was not assigned. SWFUpload.prototype.initSettings = function () { this.ensureDefault = function (settingName, defaultValue) { this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName]; }; // Upload backend settings this.ensureDefault("upload_url", ""); this.ensureDefault("preserve_relative_urls", false); this.ensureDefault("file_post_name", "Filedata"); this.ensureDefault("post_params", {}); this.ensureDefault("use_query_string", false); this.ensureDefault("requeue_on_error", false); this.ensureDefault("http_success", []); this.ensureDefault("assume_success_timeout", 0); // File Settings this.ensureDefault("file_types", "*.*"); this.ensureDefault("file_types_description", "All Files"); this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited" this.ensureDefault("file_upload_limit", 0); this.ensureDefault("file_queue_limit", 0); // Flash Settings this.ensureDefault("flash_url", "swfupload.swf"); this.ensureDefault("prevent_swf_caching", true); // Button Settings this.ensureDefault("button_image_url", ""); this.ensureDefault("button_width", 1); this.ensureDefault("button_height", 1); this.ensureDefault("button_text", ""); this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;"); this.ensureDefault("button_text_top_padding", 0); this.ensureDefault("button_text_left_padding", 0); this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES); this.ensureDefault("button_disabled", false); this.ensureDefault("button_placeholder_id", ""); this.ensureDefault("button_placeholder", null); this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW); this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW); // Debug Settings this.ensureDefault("debug", false); this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API // Event Handlers this.settings.return_upload_start_handler = this.returnUploadStart; this.ensureDefault("swfupload_loaded_handler", null); this.ensureDefault("file_dialog_start_handler", null); this.ensureDefault("file_queued_handler", null); this.ensureDefault("file_queue_error_handler", null); this.ensureDefault("file_dialog_complete_handler", null); this.ensureDefault("upload_start_handler", null); this.ensureDefault("upload_progress_handler", null); this.ensureDefault("upload_error_handler", null); this.ensureDefault("upload_success_handler", null); this.ensureDefault("upload_complete_handler", null); this.ensureDefault("debug_handler", this.debugMessage); this.ensureDefault("custom_settings", {}); // Other settings this.customSettings = this.settings.custom_settings; // Update the flash url if needed if (!!this.settings.prevent_swf_caching) { this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); } if (!this.settings.preserve_relative_urls) { //this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url); this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); } delete this.ensureDefault; }; // Private: loadFlash replaces the button_placeholder element with the flash movie. SWFUpload.prototype.loadFlash = function () { var targetElement, tempParent; // Make sure an element with the ID we are going to use doesn't already exist if (document.getElementById(this.movieName) !== null) { throw "ID " + this.movieName + " is already in use. The Flash Object could not be added"; } // Get the element where we will be placing the flash movie targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder; if (targetElement == undefined) { throw "Could not find the placeholder element: " + this.settings.button_placeholder_id; } // Append the container and load the flash tempParent = document.createElement("div"); tempParent.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers) targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement); // Fix IE Flash/Form bug if (window[this.movieName] == undefined) { window[this.movieName] = this.getMovieElement(); } }; // Private: getFlashHTML generates the object tag needed to embed the flash in to the document SWFUpload.prototype.getFlashHTML = function () { // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay return ['', '', '', '', '', '', '', ''].join(""); }; // Private: getFlashVars builds the parameter string that will be passed // to flash in the flashvars param. SWFUpload.prototype.getFlashVars = function () { // Build a string from the post param object var paramString = this.buildParamString(); var httpSuccessString = this.settings.http_success.join(","); // Build the parameter string return ["movieName=", encodeURIComponent(this.movieName), "&uploadURL=", encodeURIComponent(this.settings.upload_url), "&useQueryString=", encodeURIComponent(this.settings.use_query_string), "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), "&httpSuccess=", encodeURIComponent(httpSuccessString), "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), "&params=", encodeURIComponent(paramString), "&filePostName=", encodeURIComponent(this.settings.file_post_name), "&fileTypes=", encodeURIComponent(this.settings.file_types), "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), "&buttonWidth=", encodeURIComponent(this.settings.button_width), "&buttonHeight=", encodeURIComponent(this.settings.button_height), "&buttonText=", encodeURIComponent(this.settings.button_text), "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), "&buttonAction=", encodeURIComponent(this.settings.button_action), "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), "&buttonCursor=", encodeURIComponent(this.settings.button_cursor) ].join(""); }; // Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload // The element is cached after the first lookup SWFUpload.prototype.getMovieElement = function () { if (this.movieElement == undefined) { this.movieElement = document.getElementById(this.movieName); } if (this.movieElement === null) { throw "Could not find Flash element"; } return this.movieElement; }; // Private: buildParamString takes the name/value pairs in the post_params setting object // and joins them up in to a string formatted "name=value&name=value" SWFUpload.prototype.buildParamString = function () { var postParams = this.settings.post_params; var paramStringPairs = []; if (typeof(postParams) === "object") { for (var name in postParams) { if (postParams.hasOwnProperty(name)) { paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString())); } } } return paramStringPairs.join("&"); }; // Public: Used to remove a SWFUpload instance from the page. This method strives to remove // all references to the SWF, and other objects so memory is properly freed. // Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state. // Credits: Major improvements provided by steffen SWFUpload.prototype.destroy = function () { try { // Make sure Flash is done before we try to remove it this.cancelUpload(null, false); // Remove the SWFUpload DOM nodes var movieElement = null; movieElement = this.getMovieElement(); if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE // Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround) for (var i in movieElement) { try { if (typeof(movieElement[i]) === "function") { movieElement[i] = null; } } catch (ex1) {} } // Remove the Movie Element from the page try { movieElement.parentNode.removeChild(movieElement); } catch (ex) {} } // Remove IE form fix reference window[this.movieName] = null; // Destroy other references SWFUpload.instances[this.movieName] = null; delete SWFUpload.instances[this.movieName]; this.movieElement = null; this.settings = null; this.customSettings = null; this.eventQueue = null; this.movieName = null; return true; } catch (ex2) { return false; } }; // Public: displayDebugInfo prints out settings and configuration // information about this SWFUpload instance. // This function (and any references to it) can be deleted when placing // SWFUpload in production. SWFUpload.prototype.displayDebugInfo = function () { this.debug( [ "---SWFUpload Instance Info---\n", "Version: ", SWFUpload.version, "\n", "Movie Name: ", this.movieName, "\n", "Settings:\n", "\t", "upload_url: ", this.settings.upload_url, "\n", "\t", "flash_url: ", this.settings.flash_url, "\n", "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", "\t", "http_success: ", this.settings.http_success.join(", "), "\n", "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", "\t", "file_post_name: ", this.settings.file_post_name, "\n", "\t", "post_params: ", this.settings.post_params.toString(), "\n", "\t", "file_types: ", this.settings.file_types, "\n", "\t", "file_types_description: ", this.settings.file_types_description, "\n", "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", "\t", "debug: ", this.settings.debug.toString(), "\n", "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", "\t", "button_width: ", this.settings.button_width.toString(), "\n", "\t", "button_height: ", this.settings.button_height.toString(), "\n", "\t", "button_text: ", this.settings.button_text.toString(), "\n", "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", "\t", "button_action: ", this.settings.button_action.toString(), "\n", "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", "Event Handlers:\n", "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n" ].join("") ); }; /* Note: addSetting and getSetting are no longer used by SWFUpload but are included the maintain v2 API compatibility */ // Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used. SWFUpload.prototype.addSetting = function (name, value, default_value) { if (value == undefined) { return (this.settings[name] = default_value); } else { return (this.settings[name] = value); } }; // Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found. SWFUpload.prototype.getSetting = function (name) { if (this.settings[name] != undefined) { return this.settings[name]; } return ""; }; // Private: callFlash handles function calls made to the Flash element. // Calls are made with a setTimeout for some functions to work around // bugs in the ExternalInterface library. SWFUpload.prototype.callFlash = function (functionName, argumentArray) { argumentArray = argumentArray || []; var movieElement = this.getMovieElement(); var returnValue, returnString; // Flash's method if calling ExternalInterface methods (code adapted from MooTools). try { returnString = movieElement.CallFunction('' + __flash__argumentsToXML(argumentArray, 0) + ''); returnValue = eval(returnString); } catch (ex) { throw "Call to " + functionName + " failed"; } // Unescape file post param values if (returnValue != undefined && typeof returnValue.post === "object") { returnValue = this.unescapeFilePostParams(returnValue); } return returnValue; }; /* ***************************** -- Flash control methods -- Your UI should use these to operate SWFUpload ***************************** */ // WARNING: this function does not work in Flash Player 10 // Public: selectFile causes a File Selection Dialog window to appear. This // dialog only allows 1 file to be selected. SWFUpload.prototype.selectFile = function () { this.callFlash("SelectFile"); }; // WARNING: this function does not work in Flash Player 10 // Public: selectFiles causes a File Selection Dialog window to appear/ This // dialog allows the user to select any number of files // Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names. // If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around // for this bug. SWFUpload.prototype.selectFiles = function () { this.callFlash("SelectFiles"); }; // Public: startUpload starts uploading the first file in the queue unless // the optional parameter 'fileID' specifies the ID SWFUpload.prototype.startUpload = function (fileID) { this.callFlash("StartUpload", [fileID]); }; // Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index. // If you do not specify a fileID the current uploading file or first file in the queue is cancelled. // If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter. SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) { if (triggerErrorEvent !== false) { triggerErrorEvent = true; } this.callFlash("CancelUpload", [fileID, triggerErrorEvent]); }; // Public: stopUpload stops the current upload and requeues the file at the beginning of the queue. // If nothing is currently uploading then nothing happens. SWFUpload.prototype.stopUpload = function () { this.callFlash("StopUpload"); }; /* ************************ * Settings methods * These methods change the SWFUpload settings. * SWFUpload settings should not be changed directly on the settings object * since many of the settings need to be passed to Flash in order to take * effect. * *********************** */ // Public: getStats gets the file statistics object. SWFUpload.prototype.getStats = function () { return this.callFlash("GetStats"); }; // Public: setStats changes the SWFUpload statistics. You shouldn't need to // change the statistics but you can. Changing the statistics does not // affect SWFUpload accept for the successful_uploads count which is used // by the upload_limit setting to determine how many files the user may upload. SWFUpload.prototype.setStats = function (statsObject) { this.callFlash("SetStats", [statsObject]); }; // Public: getFile retrieves a File object by ID or Index. If the file is // not found then 'null' is returned. SWFUpload.prototype.getFile = function (fileID) { if (typeof(fileID) === "number") { return this.callFlash("GetFileByIndex", [fileID]); } else { return this.callFlash("GetFile", [fileID]); } }; // Public: addFileParam sets a name/value pair that will be posted with the // file specified by the Files ID. If the name already exists then the // exiting value will be overwritten. SWFUpload.prototype.addFileParam = function (fileID, name, value) { return this.callFlash("AddFileParam", [fileID, name, value]); }; // Public: removeFileParam removes a previously set (by addFileParam) name/value // pair from the specified file. SWFUpload.prototype.removeFileParam = function (fileID, name) { this.callFlash("RemoveFileParam", [fileID, name]); }; // Public: setUploadUrl changes the upload_url setting. SWFUpload.prototype.setUploadURL = function (url) { this.settings.upload_url = url.toString(); this.callFlash("SetUploadURL", [url]); }; // Public: setPostParams changes the post_params setting SWFUpload.prototype.setPostParams = function (paramsObject) { this.settings.post_params = paramsObject; this.callFlash("SetPostParams", [paramsObject]); }; // Public: addPostParam adds post name/value pair. Each name can have only one value. SWFUpload.prototype.addPostParam = function (name, value) { this.settings.post_params[name] = value; this.callFlash("SetPostParams", [this.settings.post_params]); }; // Public: removePostParam deletes post name/value pair. SWFUpload.prototype.removePostParam = function (name) { delete this.settings.post_params[name]; this.callFlash("SetPostParams", [this.settings.post_params]); }; // Public: setFileTypes changes the file_types setting and the file_types_description setting SWFUpload.prototype.setFileTypes = function (types, description) { this.settings.file_types = types; this.settings.file_types_description = description; this.callFlash("SetFileTypes", [types, description]); }; // Public: setFileSizeLimit changes the file_size_limit setting SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) { this.settings.file_size_limit = fileSizeLimit; this.callFlash("SetFileSizeLimit", [fileSizeLimit]); }; // Public: setFileUploadLimit changes the file_upload_limit setting SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) { this.settings.file_upload_limit = fileUploadLimit; this.callFlash("SetFileUploadLimit", [fileUploadLimit]); }; // Public: setFileQueueLimit changes the file_queue_limit setting SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) { this.settings.file_queue_limit = fileQueueLimit; this.callFlash("SetFileQueueLimit", [fileQueueLimit]); }; // Public: setFilePostName changes the file_post_name setting SWFUpload.prototype.setFilePostName = function (filePostName) { this.settings.file_post_name = filePostName; this.callFlash("SetFilePostName", [filePostName]); }; // Public: setUseQueryString changes the use_query_string setting SWFUpload.prototype.setUseQueryString = function (useQueryString) { this.settings.use_query_string = useQueryString; this.callFlash("SetUseQueryString", [useQueryString]); }; // Public: setRequeueOnError changes the requeue_on_error setting SWFUpload.prototype.setRequeueOnError = function (requeueOnError) { this.settings.requeue_on_error = requeueOnError; this.callFlash("SetRequeueOnError", [requeueOnError]); }; // Public: setHTTPSuccess changes the http_success setting SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) { if (typeof http_status_codes === "string") { http_status_codes = http_status_codes.replace(" ", "").split(","); } this.settings.http_success = http_status_codes; this.callFlash("SetHTTPSuccess", [http_status_codes]); }; // Public: setHTTPSuccess changes the http_success setting SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) { this.settings.assume_success_timeout = timeout_seconds; this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]); }; // Public: setDebugEnabled changes the debug_enabled setting SWFUpload.prototype.setDebugEnabled = function (debugEnabled) { this.settings.debug_enabled = debugEnabled; this.callFlash("SetDebugEnabled", [debugEnabled]); }; // Public: setButtonImageURL loads a button image sprite SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) { if (buttonImageURL == undefined) { buttonImageURL = ""; } this.settings.button_image_url = buttonImageURL; this.callFlash("SetButtonImageURL", [buttonImageURL]); }; // Public: setButtonDimensions resizes the Flash Movie and button SWFUpload.prototype.setButtonDimensions = function (width, height) { this.settings.button_width = width; this.settings.button_height = height; var movie = this.getMovieElement(); if (movie != undefined) { movie.style.width = width + "px"; movie.style.height = height + "px"; } this.callFlash("SetButtonDimensions", [width, height]); }; // Public: setButtonText Changes the text overlaid on the button SWFUpload.prototype.setButtonText = function (html) { this.settings.button_text = html; this.callFlash("SetButtonText", [html]); }; // Public: setButtonTextPadding changes the top and left padding of the text overlay SWFUpload.prototype.setButtonTextPadding = function (left, top) { this.settings.button_text_top_padding = top; this.settings.button_text_left_padding = left; this.callFlash("SetButtonTextPadding", [left, top]); }; // Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button SWFUpload.prototype.setButtonTextStyle = function (css) { this.settings.button_text_style = css; this.callFlash("SetButtonTextStyle", [css]); }; // Public: setButtonDisabled disables/enables the button SWFUpload.prototype.setButtonDisabled = function (isDisabled) { this.settings.button_disabled = isDisabled; this.callFlash("SetButtonDisabled", [isDisabled]); }; // Public: setButtonAction sets the action that occurs when the button is clicked SWFUpload.prototype.setButtonAction = function (buttonAction) { this.settings.button_action = buttonAction; this.callFlash("SetButtonAction", [buttonAction]); }; // Public: setButtonCursor changes the mouse cursor displayed when hovering over the button SWFUpload.prototype.setButtonCursor = function (cursor) { this.settings.button_cursor = cursor; this.callFlash("SetButtonCursor", [cursor]); }; /* ******************************* Flash Event Interfaces These functions are used by Flash to trigger the various events. All these functions a Private. Because the ExternalInterface library is buggy the event calls are added to a queue and the queue then executed by a setTimeout. This ensures that events are executed in a determinate order and that the ExternalInterface bugs are avoided. ******************************* */ SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) { // Warning: Don't call this.debug inside here or you'll create an infinite loop if (argumentArray == undefined) { argumentArray = []; } else if (!(argumentArray instanceof Array)) { argumentArray = [argumentArray]; } var self = this; if (typeof this.settings[handlerName] === "function") { // Queue the event this.eventQueue.push(function () { this.settings[handlerName].apply(this, argumentArray); }); // Execute the next queued event setTimeout(function () { self.executeNextEvent(); }, 0); } else if (this.settings[handlerName] !== null) { throw "Event handler " + handlerName + " is unknown or is not a function"; } }; // Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout // we must queue them in order to garentee that they are executed in order. SWFUpload.prototype.executeNextEvent = function () { // Warning: Don't call this.debug inside here or you'll create an infinite loop var f = this.eventQueue ? this.eventQueue.shift() : null; if (typeof(f) === "function") { f.apply(this); } }; // Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have // properties that contain characters that are not valid for JavaScript identifiers. To work around this // the Flash Component escapes the parameter names and we must unescape again before passing them along. SWFUpload.prototype.unescapeFilePostParams = function (file) { var reg = /[$]([0-9a-f]{4})/i; var unescapedPost = {}; var uk; if (file != undefined) { for (var k in file.post) { if (file.post.hasOwnProperty(k)) { uk = k; var match; while ((match = reg.exec(uk)) !== null) { uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16))); } unescapedPost[uk] = file.post[k]; } } file.post = unescapedPost; } return file; }; // Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working) SWFUpload.prototype.testExternalInterface = function () { try { return this.callFlash("TestExternalInterface"); } catch (ex) { return false; } }; // Private: This event is called by Flash when it has finished loading. Don't modify this. // Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded. SWFUpload.prototype.flashReady = function () { // Check that the movie element is loaded correctly with its ExternalInterface methods defined var movieElement = this.getMovieElement(); if (!movieElement) { this.debug("Flash called back ready but the flash movie can't be found."); return; } this.cleanUp(movieElement); this.queueEvent("swfupload_loaded_handler"); }; // Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE. // This function is called by Flash each time the ExternalInterface functions are created. SWFUpload.prototype.cleanUp = function (movieElement) { // Pro-actively unhook all the Flash functions try { if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); for (var key in movieElement) { try { if (typeof(movieElement[key]) === "function") { movieElement[key] = null; } } catch (ex) { } } } } catch (ex1) { } // Fix Flashes own cleanup code so if the SWFMovie was removed from the page // it doesn't display errors. window["__flash__removeCallback"] = function (instance, name) { try { if (instance) { instance[name] = null; } } catch (flashEx) { } }; }; /* This is a chance to do something before the browse window opens */ SWFUpload.prototype.fileDialogStart = function () { this.queueEvent("file_dialog_start_handler"); }; /* Called when a file is successfully added to the queue. */ SWFUpload.prototype.fileQueued = function (file) { file = this.unescapeFilePostParams(file); this.queueEvent("file_queued_handler", file); }; /* Handle errors that occur when an attempt to queue a file fails. */ SWFUpload.prototype.fileQueueError = function (file, errorCode, message) { file = this.unescapeFilePostParams(file); this.queueEvent("file_queue_error_handler", [file, errorCode, message]); }; /* Called after the file dialog has closed and the selected files have been queued. You could call startUpload here if you want the queued files to begin uploading immediately. */ SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) { this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]); }; SWFUpload.prototype.uploadStart = function (file) { file = this.unescapeFilePostParams(file); this.queueEvent("return_upload_start_handler", file); }; SWFUpload.prototype.returnUploadStart = function (file) { var returnValue; if (typeof this.settings.upload_start_handler === "function") { file = this.unescapeFilePostParams(file); returnValue = this.settings.upload_start_handler.call(this, file); } else if (this.settings.upload_start_handler != undefined) { throw "upload_start_handler must be a function"; } // Convert undefined to true so if nothing is returned from the upload_start_handler it is // interpretted as 'true'. if (returnValue === undefined) { returnValue = true; } returnValue = !!returnValue; this.callFlash("ReturnUploadStart", [returnValue]); }; SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) { file = this.unescapeFilePostParams(file); this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]); }; SWFUpload.prototype.uploadError = function (file, errorCode, message) { file = this.unescapeFilePostParams(file); this.queueEvent("upload_error_handler", [file, errorCode, message]); }; SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) { file = this.unescapeFilePostParams(file); this.queueEvent("upload_success_handler", [file, serverData, responseReceived]); }; SWFUpload.prototype.uploadComplete = function (file) { file = this.unescapeFilePostParams(file); this.queueEvent("upload_complete_handler", file); }; /* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the internal debug console. You can override this event and have messages written where you want. */ SWFUpload.prototype.debug = function (message) { this.queueEvent("debug_handler", message); }; /* ********************************** Debug Console The debug console is a self contained, in page location for debug message to be sent. The Debug Console adds itself to the body if necessary. The console is automatically scrolled as messages appear. If you are using your own debug handler or when you deploy to production and have debug disabled you can remove these functions to reduce the file size and complexity. ********************************** */ // Private: debugMessage is the default debug_handler. If you want to print debug messages // call the debug() function. When overriding the function your own function should // check to see if the debug setting is true before outputting debug information. SWFUpload.prototype.debugMessage = function (message) { if (this.settings.debug) { var exceptionMessage, exceptionValues = []; // Check for an exception object and print it nicely if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") { for (var key in message) { if (message.hasOwnProperty(key)) { exceptionValues.push(key + ": " + message[key]); } } exceptionMessage = exceptionValues.join("\n") || ""; exceptionValues = exceptionMessage.split("\n"); exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: "); SWFUpload.Console.writeLine(exceptionMessage); } else { SWFUpload.Console.writeLine(message); } } }; SWFUpload.Console = {}; SWFUpload.Console.writeLine = function (message) { var console, documentForm; try { console = document.getElementById("SWFUpload_Console"); if (!console) { documentForm = document.createElement("form"); document.getElementsByTagName("body")[0].appendChild(documentForm); console = document.createElement("textarea"); console.id = "SWFUpload_Console"; console.style.fontFamily = "monospace"; console.setAttribute("wrap", "off"); console.wrap = "off"; console.style.overflow = "auto"; console.style.width = "700px"; console.style.height = "350px"; console.style.margin = "5px"; documentForm.appendChild(console); } console.value += message + "\n"; console.scrollTop = console.scrollHeight - console.clientHeight; } catch (ex) { alert("Exception: " + ex.name + " Message: " + ex.message); } }; /* Queue Plug-in Features: *Adds a cancelQueue() method for cancelling the entire queue. *All queued files are uploaded when startUpload() is called. *If false is returned from uploadComplete then the queue upload is stopped. If false is not returned (strict comparison) then the queue upload is continued. *Adds a QueueComplete event that is fired when all the queued files have finished uploading. Set the event handler with the queue_complete_handler setting. */ var SWFUpload; if (typeof(SWFUpload) === "function") { SWFUpload.queue = {}; SWFUpload.prototype.initSettings = (function (oldInitSettings) { return function () { if (typeof(oldInitSettings) === "function") { oldInitSettings.call(this); } this.queueSettings = {}; this.queueSettings.queue_cancelled_flag = false; this.queueSettings.queue_upload_count = 0; this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler; this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler; this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler; this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler; this.settings.queue_complete_handler = this.settings.queue_complete_handler || null; }; })(SWFUpload.prototype.initSettings); SWFUpload.prototype.startUpload = function (fileID) { this.queueSettings.queue_cancelled_flag = false; this.callFlash("StartUpload", [fileID]); }; SWFUpload.prototype.cancelQueue = function () { this.queueSettings.queue_cancelled_flag = true; this.stopUpload(); var stats = this.getStats(); while (stats.files_queued > 0) { this.cancelUpload(); stats = this.getStats(); } }; SWFUpload.queue.uploadStartHandler = function (file) { var returnValue; if (typeof(this.queueSettings.user_upload_start_handler) === "function") { returnValue = this.queueSettings.user_upload_start_handler.call(this, file); } // To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value. returnValue = (returnValue === false) ? false : true; this.queueSettings.queue_cancelled_flag = !returnValue; return returnValue; }; SWFUpload.queue.uploadCompleteHandler = function (file) { var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler; var continueUpload; if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) { this.queueSettings.queue_upload_count++; } if (typeof(user_upload_complete_handler) === "function") { continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true; } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) { // If the file was stopped and re-queued don't restart the upload continueUpload = false; } else { continueUpload = true; } if (continueUpload) { var stats = this.getStats(); if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) { this.startUpload(); } else if (this.queueSettings.queue_cancelled_flag === false) { this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]); this.queueSettings.queue_upload_count = 0; } else { this.queueSettings.queue_cancelled_flag = false; this.queueSettings.queue_upload_count = 0; } } }; } /* A simple class for displaying file information and progress Note: This is a demonstration only and not part of SWFUpload. Note: Some have had problems adapting this class in IE7. It may not be suitable for your application. */ // Constructor // file is a SWFUpload file object // targetID is the HTML element id attribute that the FileProgress HTML structure will be added to. // Instantiating a new FileProgress object with an existing file will reuse/update the existing DOM elements function FileProgress(file, targetID) { this.fileProgressID = file.id; this.opacity = 100; this.height = 0; this.fileProgressWrapper = document.getElementById(this.fileProgressID); if (!this.fileProgressWrapper) { this.fileProgressWrapper = document.createElement("div"); this.fileProgressWrapper.className = "progressWrapper"; this.fileProgressWrapper.id = this.fileProgressID; this.fileProgressElement = document.createElement("div"); this.fileProgressElement.className = "progressContainer"; var progressCancel = document.createElement("a"); progressCancel.className = "progressCancel"; progressCancel.href = "#"; progressCancel.style.visibility = "hidden"; progressCancel.appendChild(document.createTextNode(" ")); var progressText = document.createElement("div"); progressText.className = "progressName"; progressText.appendChild(document.createTextNode(file.name)); var progressBar = document.createElement("div"); progressBar.className = "progressBarInProgress"; var progressStatus = document.createElement("div"); progressStatus.className = "progressBarStatus"; progressStatus.innerHTML = " "; this.fileProgressElement.appendChild(progressCancel); this.fileProgressElement.appendChild(progressText); this.fileProgressElement.appendChild(progressStatus); this.fileProgressElement.appendChild(progressBar); this.fileProgressWrapper.appendChild(this.fileProgressElement); document.getElementById(targetID).appendChild(this.fileProgressWrapper); } else { this.fileProgressElement = this.fileProgressWrapper.firstChild; this.reset(); } this.height = this.fileProgressWrapper.offsetHeight; this.setTimer(null); } FileProgress.prototype.setTimer = function (timer) { this.fileProgressElement["FP_TIMER"] = timer; }; FileProgress.prototype.getTimer = function (timer) { return this.fileProgressElement["FP_TIMER"] || null; }; FileProgress.prototype.reset = function () { this.fileProgressElement.className = "progressContainer"; this.fileProgressElement.childNodes[2].innerHTML = " "; this.fileProgressElement.childNodes[2].className = "progressBarStatus"; this.fileProgressElement.childNodes[3].className = "progressBarInProgress"; this.fileProgressElement.childNodes[3].style.width = "0%"; this.appear(); }; FileProgress.prototype.setProgress = function (percentage) { this.fileProgressElement.className = "progressContainer green"; this.fileProgressElement.childNodes[3].className = "progressBarInProgress"; this.fileProgressElement.childNodes[3].style.width = percentage + "%"; this.appear(); }; FileProgress.prototype.setComplete = function () { this.fileProgressElement.className = "progressContainer blue"; this.fileProgressElement.childNodes[3].className = "progressBarComplete"; this.fileProgressElement.childNodes[3].style.width = ""; var oSelf = this; this.setTimer(setTimeout(function () { oSelf.disappear(); }, 10000)); }; FileProgress.prototype.setError = function () { this.fileProgressElement.className = "progressContainer red"; this.fileProgressElement.childNodes[3].className = "progressBarError"; this.fileProgressElement.childNodes[3].style.width = ""; var oSelf = this; this.setTimer(setTimeout(function () { oSelf.disappear(); }, 5000)); }; FileProgress.prototype.setCancelled = function () { this.fileProgressElement.className = "progressContainer"; this.fileProgressElement.childNodes[3].className = "progressBarError"; this.fileProgressElement.childNodes[3].style.width = ""; var oSelf = this; this.setTimer(setTimeout(function () { oSelf.disappear(); }, 2000)); }; FileProgress.prototype.setStatus = function (status) { this.fileProgressElement.childNodes[2].innerHTML = status; }; // Show/Hide the cancel button FileProgress.prototype.toggleCancel = function (show, swfUploadInstance) { this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden"; if (swfUploadInstance) { var fileID = this.fileProgressID; this.fileProgressElement.childNodes[0].onclick = function () { swfUploadInstance.cancelUpload(fileID); return false; }; } }; FileProgress.prototype.appear = function () { if (this.getTimer() !== null) { clearTimeout(this.getTimer()); this.setTimer(null); } if (this.fileProgressWrapper.filters) { try { this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 100; } catch (e) { // If it is not set initially, the browser will throw an error. This will set it if it is not set yet. this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=100)"; } } else { this.fileProgressWrapper.style.opacity = 1; } this.fileProgressWrapper.style.height = ""; this.height = this.fileProgressWrapper.offsetHeight; this.opacity = 100; this.fileProgressWrapper.style.display = ""; }; // Fades out and clips away the FileProgress box. FileProgress.prototype.disappear = function () { var reduceOpacityBy = 15; var reduceHeightBy = 4; var rate = 30; // 15 fps if (this.opacity > 0) { this.opacity -= reduceOpacityBy; if (this.opacity < 0) { this.opacity = 0; } if (this.fileProgressWrapper.filters) { try { this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity; } catch (e) { // If it is not set initially, the browser will throw an error. This will set it if it is not set yet. this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")"; } } else { this.fileProgressWrapper.style.opacity = this.opacity / 100; } } if (this.height > 0) { this.height -= reduceHeightBy; if (this.height < 0) { this.height = 0; } this.fileProgressWrapper.style.height = this.height + "px"; } if (this.height > 0 || this.opacity > 0) { var oSelf = this; this.setTimer(setTimeout(function () { oSelf.disappear(); }, rate)); } else { this.fileProgressWrapper.style.display = "none"; this.setTimer(null); } }; /* This is an example of how to cancel all the files queued up. It's made somewhat generic. Just pass your SWFUpload object in to this method and it loops through cancelling the uploads. */ function cancelQueue(instance) { document.getElementById(instance.customSettings.cancelButtonId).disabled = true; instance.stopUpload(); var stats; do { stats = instance.getStats(); instance.cancelUpload(); } while (stats.files_queued !== 0); } /* ********************** Event Handlers These are my custom event handlers to make my web application behave the way I went when SWFUpload completes different tasks. These aren't part of the SWFUpload package. They are part of my application. Without these none of the actions SWFUpload makes will show up in my application. ********************** */ function fileDialogStart() { /* I don't need to do anything here */ //Global_SWFUploader.post_params = { "test": "e58j3vg2rd6danht7k7rbs8a97" }; //Global_SWFUploader.buildParamString(); } function fileQueued(file) { try { // You might include code here that prevents the form from being submitted while the upload is in // progress. Then you'll want to put code in the Queue Complete handler to "unblock" the form var progress = new FileProgress(file, this.customSettings.progressTarget); progress.setStatus("Pending..."); progress.toggleCancel(true, this); } catch (ex) { this.debug(ex); } } function fileQueueError(file, errorCode, message) { try { if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) { alert("You have attempted to queue too many files.\n" + (message === 0 ? "You have reached the upload limit." : "You may select " + (message > 1 ? "up to " + message + " files." : "one file."))); return; } var progress = new FileProgress(file, this.customSettings.progressTarget); progress.setError(); progress.toggleCancel(false); switch (errorCode) { case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: progress.setStatus("File is too big."); this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: progress.setStatus("Cannot upload Zero Byte files."); this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE: progress.setStatus("Invalid File Type."); this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED: alert("You have selected too many files. " + (message > 1 ? "You may only add " + message + " more files" : "You cannot add any more files.")); break; default: if (file !== null) { progress.setStatus("Unhandled Error"); } this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; } } catch (ex) { this.debug(ex); } } function fileDialogComplete(numFilesSelected, numFilesQueued) { try { if (this.getStats().files_queued > 0) { document.getElementById(this.customSettings.cancelButtonId).disabled = false; } /* I want auto start and I can do that here */ this.startUpload(); } catch (ex) { this.debug(ex); } } function uploadStart(file) { try { /* I don't want to do any file validation or anything, I'll just update the UI and return true to indicate that the upload should start */ var progress = new FileProgress(file, this.customSettings.progressTarget); progress.setStatus("Uploading..."); progress.toggleCancel(true, this); } catch (ex) { } return true; } function uploadProgress(file, bytesLoaded, bytesTotal) { try { var percent = Math.ceil((bytesLoaded / bytesTotal) * 100); var progress = new FileProgress(file, this.customSettings.progressTarget); progress.setProgress(percent); progress.setStatus("Uploading..."); } catch (ex) { this.debug(ex); } } function uploadSuccess(file, serverData) { try { var progress = new FileProgress(file, this.customSettings.progressTarget); progress.setComplete(); progress.setStatus("Complete."); progress.toggleCancel(false); } catch (ex) { this.debug(ex); } } function uploadComplete(file) { try { /* I want the next upload to continue automatically so I'll call startUpload here */ if (this.getStats().files_queued === 0) { document.getElementById(this.customSettings.cancelButtonId).disabled = true; } else { this.startUpload(); } } catch (ex) { this.debug(ex); } } function uploadError(file, errorCode, message) { try { var progress = new FileProgress(file, this.customSettings.progressTarget); progress.setError(); progress.toggleCancel(false); switch (errorCode) { case SWFUpload.UPLOAD_ERROR.HTTP_ERROR: progress.setStatus("Upload Error: " + message); this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message); break; case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL: progress.setStatus("Configuration Error"); this.debug("Error Code: No backend file, File name: " + file.name + ", Message: " + message); break; case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED: progress.setStatus("Upload Failed."); this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; case SWFUpload.UPLOAD_ERROR.IO_ERROR: progress.setStatus("Server (IO) Error"); this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message); break; case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR: progress.setStatus("Security Error"); this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message); break; case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED: progress.setStatus("Upload limit exceeded."); this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND: progress.setStatus("File not found."); this.debug("Error Code: The file was not found, File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED: progress.setStatus("Failed Validation. Upload skipped."); this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: if (this.getStats().files_queued === 0) { document.getElementById(this.customSettings.cancelButtonId).disabled = true; } progress.setStatus("Cancelled"); progress.setCancelled(); break; case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED: progress.setStatus("Stopped"); break; default: progress.setStatus("Unhandled Error: " + error_code); this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message); break; } } catch (ex) { this.debug(ex); } } /*! * Ext Core Library $version http://extjs.com/ Copyright(c) 2006-2009, $author. The MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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'); Ext.ux.Lightbox = (function(){ var els = {}, images = [], activeImage, initialized = false, selectors = []; return { overlayOpacity: 0.85, animate: true, resizeSpeed: 8, borderSize: 10, labelImage: "Image", labelOf: "of", init: function() { this.resizeDuration = this.animate ? ((11 - this.resizeSpeed) * 0.15) : 0; this.overlayDuration = this.animate ? 0.2 : 0; if(!initialized) { Ext.apply(this, Ext.util.Observable.prototype); Ext.util.Observable.constructor.call(this); this.addEvents('open', 'close'); this.initMarkup(); this.initEvents(); initialized = true; } }, initMarkup: function() { els.shim = Ext.DomHelper.append(document.body, { tag: 'iframe', id: 'ux-lightbox-shim' }, true); els.overlay = Ext.DomHelper.append(document.body, { id: 'ux-lightbox-overlay' }, true); var lightboxTpl = new Ext.Template(this.getTemplate()); els.lightbox = lightboxTpl.append(document.body, {}, true); var ids = ['outerImageContainer', 'imageContainer', 'image', 'hoverNav', 'navPrev', 'navNext', 'loading', 'loadingLink', 'outerDataContainer', 'dataContainer', 'data', 'details', 'caption', 'imageNumber', 'bottomNav', 'navClose']; Ext.each(ids, function(id){ els[id] = Ext.get('ux-lightbox-' + id); }); Ext.each([els.overlay, els.lightbox, els.shim], function(el){ el.setVisibilityMode(Ext.Element.DISPLAY) el.hide(); }); var size = (this.animate ? 250 : 1) + 'px'; els.outerImageContainer.setStyle({ width: size, height: size }); }, getTemplate : function() { return [ '
', '
', '
', '', '
', '', '', '
', '
', '', '
', '
', '
', '
', '
', '
', '
', '', '', '
', '
', '', '
', '
', '
', '
', '
' ]; }, initEvents: function() { var close = function(ev) { ev.preventDefault(); this.close(); }; els.overlay.on('click', close, this); els.loadingLink.on('click', close, this); els.navClose.on('click', close, this); els.lightbox.on('click', function(ev) { if(ev.getTarget().id == 'ux-lightbox') { this.close(); } }, this); els.navPrev.on('click', function(ev) { ev.preventDefault(); this.setImage(activeImage - 1); }, this); els.navNext.on('click', function(ev) { ev.preventDefault(); this.setImage(activeImage + 1); }, this); }, register: function(sel, group) { if(selectors.indexOf(sel) === -1) { selectors.push(sel); Ext.fly(document).on('click', function(ev){ var target = ev.getTarget(sel); if (target) { ev.preventDefault(); this.open(target, sel, group); } }, this); } }, open: function(image, sel, group) { group = group || false; this.setViewSize(); els.overlay.fadeIn({ duration: this.overlayDuration, endOpacity: this.overlayOpacity, callback: function() { images = []; var index = 0; if(!group) { images.push([image.href, image.title]); } else { var setItems = Ext.query(sel); Ext.each(setItems, function(item) { if(item.href) { images.push([item.href, item.title]); } }); while (images[index][0] != image.href) { index++; } } // calculate top and left offset for the lightbox var pageScroll = Ext.fly(document).getScroll(); var lightboxTop = pageScroll.top + (Ext.lib.Dom.getViewportHeight() / 10); var lightboxLeft = pageScroll.left; els.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show(); this.setImage(index); this.fireEvent('open', images[index]); }, scope: this }); }, setViewSize: function(){ var viewSize = this.getViewSize(); els.overlay.setStyle({ width: viewSize[0] + 'px', height: viewSize[1] + 'px' }); els.shim.setStyle({ width: viewSize[0] + 'px', height: viewSize[1] + 'px' }).show(); }, setImage: function(index){ activeImage = index; this.disableKeyNav(); if (this.animate) { els.loading.show(); } els.image.hide(); els.hoverNav.hide(); els.navPrev.hide(); els.navNext.hide(); els.dataContainer.setOpacity(0.0001); els.imageNumber.hide(); var preload = new Image(); preload.onload = (function(){ els.image.dom.src = images[activeImage][0]; this.resizeImage(preload.width, preload.height); }).createDelegate(this); preload.src = images[activeImage][0]; }, resizeImage: function(w, h){ var wCur = els.outerImageContainer.getWidth(); var hCur = els.outerImageContainer.getHeight(); var wNew = (w + this.borderSize * 2); var hNew = (h + this.borderSize * 2); var wDiff = wCur - wNew; var hDiff = hCur - hNew; var afterResize = function(){ els.hoverNav.setWidth(els.imageContainer.getWidth() + 'px'); els.navPrev.setHeight(h + 'px'); els.navNext.setHeight(h + 'px'); els.outerDataContainer.setWidth(wNew + 'px'); this.showImage(); }; if (hDiff != 0 || wDiff != 0) { els.outerImageContainer.shift({ height: hNew, width: wNew, duration: this.resizeDuration, scope: this, callback: afterResize, delay: 50 }); } else { afterResize.call(this); } }, showImage: function(){ els.loading.hide(); els.image.fadeIn({ duration: this.resizeDuration, scope: this, callback: function(){ this.updateDetails(); } }); this.preloadImages(); }, updateDetails: function(){ var detailsWidth = els.data.getWidth(true) - els.navClose.getWidth() - 10; els.details.setWidth((detailsWidth > 0 ? detailsWidth : 0) + 'px'); els.caption.update(images[activeImage][1]); els.caption.show(); if (images.length > 1) { els.imageNumber.update(this.labelImage + ' ' + (activeImage + 1) + ' ' + this.labelOf + ' ' + images.length); els.imageNumber.show(); } els.dataContainer.fadeIn({ duration: this.resizeDuration/2, scope: this, callback: function() { var viewSize = this.getViewSize(); els.overlay.setHeight(viewSize[1] + 'px'); this.updateNav(); } }); }, updateNav: function(){ this.enableKeyNav(); els.hoverNav.show(); // if not first image in set, display prev image button if (activeImage > 0) els.navPrev.show(); // if not last image in set, display next image button if (activeImage < (images.length - 1)) els.navNext.show(); }, enableKeyNav: function() { Ext.fly(document).on('keydown', this.keyNavAction, this); }, disableKeyNav: function() { Ext.fly(document).un('keydown', this.keyNavAction, this); }, keyNavAction: function(ev) { var keyCode = ev.getKey(); if ( keyCode == 88 || // x keyCode == 67 || // c keyCode == 27 ) { this.close(); } else if (keyCode == 80 || keyCode == 37){ // display previous image if (activeImage != 0){ this.setImage(activeImage - 1); } } else if (keyCode == 78 || keyCode == 39){ // display next image if (activeImage != (images.length - 1)){ this.setImage(activeImage + 1); } } }, preloadImages: function(){ var next, prev; if (images.length > activeImage + 1) { next = new Image(); next.src = images[activeImage + 1][0]; } if (activeImage > 0) { prev = new Image(); prev.src = images[activeImage - 1][0]; } }, close: function(){ this.disableKeyNav(); els.lightbox.hide(); els.overlay.fadeOut({ duration: this.overlayDuration }); els.shim.hide(); this.fireEvent('close', activeImage); }, getViewSize: function() { return [Ext.lib.Dom.getViewWidth(), Ext.lib.Dom.getViewHeight()]; } } })(); Ext.onReady(Ext.ux.Lightbox.init, Ext.ux.Lightbox); Ext.namespace("Ext.ux.grid"); /** * @class Ext.ux.grid.GridHeaderFilters * @extends Ext.util.Observable * * Plugin that enables filters in columns headers. * * To add a grid header filter, put the "filter" attribute in column configuration of the grid column model. * This attribute is the configuration of the Ext.form.Field to use as filter in the header or an array of fields configurations.
*
* The filter configuration object can include some special attributes to manage filter configuration: *
    *
  • filterName: to specify the name of the filter and the corresponding HTTP parameter used to send filter value to server. * If not specified column "dataIndex" attribute will be used, if more than one filter is configured for the same column, the filterName will be the "dataIndex" followed by filter index (if index > 0)
  • *
  • value: to specify default value for filter. If no value is provided for filter (in filters plugin configuration parameter or from loaded status), * this value will be used as default filter value
  • *
  • filterEncoder: a function used to convert filter value returned by filter field "getValue" method to a string. Useful if the filter field getValue() method * returns an object that is not a string
  • *
  • filterDecoder: a function used to convert a string to a valid filter field value. Useful if the filter field setValue(obj) method * needs an object that is not a string
  • *
  • applyFilterEvent
  • : a string that specifies the event that starts filter application for this filter field. If not specified, the "applyMode" is used. (since 1.0.10) *
*
* Filter fields are rendered in the header cells within an Ext.Panel with layout='form'.
* For each filter you can specify fieldLabel or other values supported by this layout type.
* You can also override panel configuration using containerConfig attribute.
*
* This plugin enables some new grid methods: *
    *
  • getHeaderFilter(name)
  • *
  • getHeaderFilterField(name)
  • *
  • setHeaderFilter(name, value)
  • *
  • setHeaderFilters(object, [bReset], [bReload])
  • *
  • resetHeaderFilters([bReload])
  • *
  • applyHeaderFilters([bReload])
  • *
* The "name" is the filterName (see filterName in each filter configuration) * * @author Damiano Zucconi - http://www.isipc.it * @version 2.0.6 - 03/03/2011 */ Ext.ux.grid.GridHeaderFilters = function (cfg) { if (cfg) Ext.apply(this, cfg); }; Ext.extend(Ext.ux.grid.GridHeaderFilters, Ext.util.Observable, { /** * @cfg {Number} fieldHeight * Height for each filter field used by autoHeight. */ fieldHeight: 22, /** * @cfg {Number} padding * Padding for filter fields. Default: 2 */ fieldPadding: 1, /** * @cfg {Boolean} highlightOnFilter * Enable grid header highlight if active filters */ highlightOnFilter: true, /** * @cfg {String} highlightColor * Color for highlighted grid header */ highlightColor: 'transparent', /** * @cfg {String} highlightCls * Class to apply to filter header when filters are highlighted. If specified overrides highlightColor. * See highlightOnFilter. */ highlightCls: null, /** * @cfg {Boolean} stateful * Enable or disable filters save and restore through enabled Ext.state.Provider */ stateful: true, /** * @cfg {String} applyMode * Sets how filters are applied. If equals to "auto" (default) the filter is applyed when filter field value changes (change, select, ENTER). * If set to "enter" the filters are applied only when user push "ENTER" on filter field.
* See also applyFilterEvent in columnmodel filter configuration: if this option is specified in * filter configuration, applyMode value will be ignored and filter will be applied on specified event. * @since Ext.ux.grid.GridHeaderFilters 1.0.6 */ applyMode: "auto", /** * @cfg {Object} filters * Initial values for filters (mapped with filters names). If this object is defined, * its attributes values overrides the corresponding filter values loaded from grid status or value specified in column model filter configuration.
* Values specified into column model configuration (filter value attribute) are ignored if this object is specified.
* See filtersInitMode to understand how these values are mixed with values loaded from grid status. * @since Ext.ux.grid.GridHeaderFilters 1.0.9 */ filters: null, /** * @cfg {String} filtersInitMode * If filters config value is specified, this parameter defines how these values are used: *
    *
  • replace: these values replace all values loaded from grid status (status is completely ignored)
  • *
  • merge: these values overrides values loaded from status with the same name. Other status values are keeped and used to init filters.
  • *
* This parameter doesn't affect how filter value attribute is managed: it will be always ignored if filters object is specified.
* Default = 'replace' */ filtersInitMode: 'replace', /** * @cfg {Boolean} ensureFilteredVisible * If true, forces hidden columns to be made visible if relative filter is set. Default = true. */ ensureFilteredVisible: true, cfgFilterInit: false, /** * @cfg {Object} containerConfig * Base configuration for filters container of each column. With this attribute you can override filters Ext.Container configuration. */ containerConfig: null, /** * @cfg {Number} labelWidth * Label width for filter containers Form layout. Default = 50. */ labelWidth: 50, fcc: null, filterFields: null, filterContainers: null, filterContainerCls: 'x-ghf-filter-container', init: function (grid) { this.grid = grid; var gv = this.grid.getView(); gv.updateHeaders = gv.updateHeaders.createSequence(function () { this.renderFilters.call(this); }, this).createInterceptor(function () { this.destroyFilters.call(this); return true; }, this); this.grid.on({ scope: this, render: this.onRender, resize: this.onResize, columnresize: this.onColResize, reconfigure: this.onReconfigure, beforedestroy: this.destroyFilters }); //this.grid.on("columnmove", this.renderFilters, this); if (this.stateful) { this.grid.on("beforestatesave", this.saveFilters, this); this.grid.on("beforestaterestore", this.loadFilters, this); } //Column hide event managed this.grid.getColumnModel().on("hiddenchange", this.onColHidden, this); this.grid.addEvents( /** * @event filterupdate * Event enabled on the GridPanel: fired when a filter is updated * @param {String} name Filter name * @param {Object} value Filter value * @param {Ext.form.Field} el Filter field */ 'filterupdate'); this.addEvents( /** * @event render * Fired when filters render on grid header is completed * @param {Ext.ux.grid.GridHeaderFilters} this */ {'render': true } ); //Must ignore filter config value ? this.cfgFilterInit = Ext.isDefined(this.filters) && this.filters !== null; if (!this.filters) this.filters = {}; //Configuring filters this.configure(this.grid.getColumnModel()); Ext.ux.grid.GridHeaderFilters.superclass.constructor.call(this); if (this.stateful) { if (!Ext.isArray(this.grid.stateEvents)) this.grid.stateEvents = []; this.grid.stateEvents.push('filterupdate'); } //Enable new grid methods Ext.apply(this.grid, { headerFilters: this, getHeaderFilter: function (sName) { if (!this.headerFilters) return null; return this.headerFilters.filters[sName]; }, setHeaderFilter: function (sName, sValue) { if (!this.headerFilters) return; var fd = {}; fd[sName] = sValue; this.setHeaderFilters(fd); }, setHeaderFilters: function (obj, bReset, bReload) { if (!this.headerFilters) return; if (bReset) this.resetHeaderFilters(false); if (arguments.length < 3) var bReload = true; var bOne = false; for (var fn in obj) { if (this.headerFilters.filterFields[fn]) { var el = this.headerFilters.filterFields[fn]; this.headerFilters.setFieldValue(el, obj[fn]); this.headerFilters.applyFilter(el, false); bOne = true; } } if (bOne && bReload) this.headerFilters.storeReload(); }, getHeaderFilterField: function (fn) { if (!this.headerFilters) return; if (this.headerFilters.filterFields[fn]) return this.headerFilters.filterFields[fn]; else return null; }, resetHeaderFilters: function (bReload) { if (!this.headerFilters) return; if (arguments.length == 0) var bReload = true; for (var fn in this.headerFilters.filterFields) { var el = this.headerFilters.filterFields[fn]; if (Ext.isFunction(el.clearValue)) { el.clearValue(); } else { this.headerFilters.setFieldValue(el, ''); } this.headerFilters.applyFilter(el, false); } if (bReload) this.headerFilters.storeReload(); }, applyHeaderFilters: function (bReload) { if (arguments.length == 0) var bReload = true; this.headerFilters.applyFilters(bReload); } }); }, /** * @private * Configures filters and containers starting from grid ColumnModel * @param {Ext.grid.ColumnModel} cm The column model to use */ configure: function (cm) { /*Filters config*/ var filteredColumns = cm.getColumnsBy(function (cc) { if (Ext.isObject(cc.filter) || Ext.isArray(cc.filter)) return true; else return false; }); /*Building filters containers configs*/ this.fcc = {}; for (var i = 0; i < filteredColumns.length; i++) { var co = filteredColumns[i]; var fca = co.filter; if (!Ext.isArray(fca)) fca = [fca]; for (var ci = 0; ci < fca.length; ci++) { var fc = Ext.apply({ filterName: ci > 0 ? co.dataIndex + ci : co.dataIndex, callbackFunction : co.callbackFunction }, fca[ci]); Ext.apply(fc, { columnId: co.id, dataIndex: co.dataIndex, hideLabel: Ext.isEmpty(fc.fieldLabel), anchor: '100%' }); if (!this.cfgFilterInit && !Ext.isEmpty(fc.value)) { this.filters[fc.filterName] = Ext.isFunction(fc.filterEncoder) ? fc.filterEncoder.call(this, fc.value) : fc.value; } delete fc.value; /* * Se la configurazione del field di filtro specifica l'attributo applyFilterEvent, il filtro verr� applicato * in corrispondenza di quest'evento specifico */ if (fc.applyFilterEvent) { fc.listeners = { scope: this }; fc.listeners[fc.applyFilterEvent] = function (field) { this.applyFilter(field); }; delete fc.applyFilterEvent; } else { //applyMode: auto o enter if (this.applyMode === 'auto' || this.applyMode === 'change' || Ext.isEmpty(this.applyMode)) { //Legacy mode and deprecated. Use applyMode = "enter" or applyFilterEvent fc.listeners = { change: function (field) { var t = field.getXType(); if (t == 'combo' || t == 'datefield') { //avoid refresh twice for combo select return; } else { this.applyFilter(field); } }, specialkey: function (el, ev) { ev.stopPropagation(); if (ev.getKey() == ev.ENTER) { el.el.dom.blur(); el.el.dom.focus(); } }, select: function (field) { this.applyFilter(field); }, scope: this }; } else if (this.applyMode === 'enter') { fc.listeners = { specialkey: function (el, ev) { ev.stopPropagation(); if (ev.getKey() == ev.ENTER) { this.applyFilters(); } }, scope: this }; } } //Looking for filter column index var containerCfg = this.fcc[fc.columnId]; if (!containerCfg) { containerCfg = { cls: this.filterContainerCls, border: false, bodyBorder: false, /*layout: 'vbox', layoutConfig: {align: 'stretch', padding: this.padding},*/ labelSeparator: '', labelWidth: this.labelWidth, layout: 'form', style: {}, items: [] }; if (this.containerConfig) Ext.apply(containerCfg, this.containerConfig); this.fcc[fc.columnId] = containerCfg; } containerCfg.items.push(fc); } } }, renderFilterContainer: function (columnId, fcc) { if (!this.filterContainers) this.filterContainers = {}; //Associated column index var ci = this.grid.getColumnModel().getIndexById(columnId); //Header TD var td = this.grid.getView().getHeaderCell(ci); td = Ext.get(td); //Patch for field text selection on Mozilla if (Ext.isGecko) td.dom.style.MozUserSelect = "text"; td.dom.style.verticalAlign = 'top'; //Render filter container fcc.width = td.getWidth() - 3; var fc = new Ext.Container(fcc); fc.render(td); //Container cache this.filterContainers[columnId] = fc; //Fields cache var height = 0; if (!this.filterFields) this.filterFields = {}; var fields = fc.findBy(function (cmp) { return !Ext.isEmpty(cmp.filterName); }); if (!Ext.isEmpty(fields)) { for (var i = 0; i < fields.length; i++) { var filterName = fields[i].filterName; /*if(this.filterFields[filterName]) { //Ext.destroy(this.filterFields[filterName]) delete this.filterFields[filterName]; }*/ this.filterFields[filterName] = fields[i]; height += fields[i].getHeight(); } } return fc; }, renderFilters: function () { if (!this.fcc) return; for (var cid in this.fcc) { this.renderFilterContainer(cid, this.fcc[cid]); } this.setFilters(this.filters); this.highlightFilters(this.isFiltered()); }, onRender: function () { this.renderFilters(); if (this.isFiltered()) { this.applyFilters(false); } this.fireEvent("render", this); }, getFilterField: function (filterName) { return this.filterFields ? this.filterFields[filterName] : null; }, /** * Sets filter values by values specified into fo. * @param {Object} fo Object with attributes filterName = value * @param {Boolean} clear If current values must be cleared. Default = false */ setFilters: function (fo, clear) { this.filters = fo; if (this.filters && this.filterFields) { //Delete filters that doesn't match with any field for (var fn in this.filters) { if (!this.filterFields[fn]) delete this.filters[fn]; } for (var fn in this.filterFields) { var field = this.filterFields[fn]; var value = this.filters[field.filterName]; if (Ext.isEmpty(value)) { if (clear) this.setFieldValue(field, ''); } else { // Parent component is a custom attribute to let user specify the default value of the field // getFilterValue must be implemented in the parentComponent if (field.parentComponent != null) this.setFieldValue(field, field.parentComponent.getFilterValue()); else this.setFieldValue(field, value); } } } }, onColResize: function (index, iWidth) { if (!this.filterContainers) return; var colId = this.grid.getColumnModel().getColumnId(index); var cnt = this.filterContainers[colId]; if (cnt) { if (isNaN(iWidth)) iWidth = 0; var filterW = (iWidth < 3) ? 0 : (iWidth - 3); cnt.setWidth(filterW); //Thanks to ob1 cnt.doLayout(false, true); } }, /** * @private * Resize filters containers on grid resize * Thanks to dolittle */ onResize: function () { var n = this.grid.getColumnModel().getColumnCount(); for (var i = 0; i < n; i++) { var td = this.grid.getView().getHeaderCell(i); td = Ext.get(td); this.onColResize(i, td.getWidth()); } }, onColHidden: function (cm, index, bHidden) { if (bHidden) return; var cw = this.grid.getColumnModel().getColumnWidth(index); this.onColResize(index, cw); }, onReconfigure: function (grid, store, cm) { this.destroyFilters(); this.configure(cm); this.renderFilters(); }, saveFilters: function (grid, status) { var vals = {}; for (var name in this.filters) { vals[name] = this.filters[name]; } status["gridHeaderFilters"] = vals; return true; }, loadFilters: function (grid, status) { var vals = status.gridHeaderFilters; if (vals) { if (this.cfgFilterInit) { if (this.filtersInitMode === 'merge') Ext.apply(vals, this.filters); } else this.filters = vals; } }, isFiltered: function () { for (var k in this.filters) { if (/*this.filterFields && this.filterFields[k] && */!Ext.isEmpty(this.filters[k])) return true; } return false; }, highlightFilters: function (enable) { if (!this.highlightOnFilter) return; if (!this.filterContainers) return; if (!this.grid.getView().mainHd) return; var tr = this.grid.getView().mainHd.child('.x-grid3-hd-row'); if (!Ext.isEmpty(this.highlightCls)) { if (enable) tr.addClass(this.highlightCls); else tr.removeClass(this.highlightCls); } else { tr.setStyle('background-color', enable ? this.highlightColor : ''); } /*for(var i=0; i < this.grid.getColumnModel().getColumnCount(); i++) { var hc = Ext.get(this.grid.getView().getHeaderCell(i)); if(!Ext.isEmpty(this.highlightCls)) { if(enable) hc.addClass(this.highlightCls); else hc.removeClass(this.highlightCls); } else { hc.setStyle('background-color',enable ? this.highlightColor : 'transparent'); } }*/ /*var color = enable ? this.highlightColor : 'transparent'; for(var fn in this.filterContainers) { var fc = this.filterContainers[fn]; if(fc.rendered) { if(!Ext.isEmpty(this.highlightCls)) { if(enable) fc.getEl().addClass(this.highlightCls); else fc.getEl().removeClass(this.highlightCls); } else fc.getEl().setStyle('backgroundColor',color); } }*/ }, getFieldValue: function (eField) { if (Ext.isFunction(eField.filterEncoder)) return eField.filterEncoder.call(eField, eField.getValue()); else return eField.getValue(); }, setFieldValue: function (eField, value) { if (Ext.isFunction(eField.filterDecoder)) value = eField.filterDecoder.call(eField, value); eField.setValue(value); }, applyFilter: function (el, bLoad) { if (arguments.length < 2) bLoad = true; if (!el) return; if (!el.isValid()) return; if (el.disabled && !Ext.isDefined(this.grid.store.baseParams[el.filterName])) return; var sValue = this.getFieldValue(el); if (el.disabled || Ext.isEmpty(sValue)) { delete this.grid.store.baseParams[el.filterName]; delete this.filters[el.filterName]; } else { /*this.grid.store.baseParams[el.filterName] = sValue; this.filters[el.filterName] = sValue;*/ // Put code here if (el.callbackFunction != null) { el.callbackFunction(sValue); if (el.getXType() == 'textfield') el.setValue(''); } if (this.ensureFilteredVisible) { //Controllo che la colonna del filtro applicato sia visibile var ci = this.grid.getColumnModel().getIndexById(el.columnId); if ((ci >= 0) && (this.grid.getColumnModel().isHidden(ci))) this.grid.getColumnModel().setHidden(ci, false); } } //Evidenza filtri se almeno uno attivo this.highlightFilters(this.isFiltered()); this.grid.fireEvent("filterupdate", el.filterName, sValue, el); /*if (bLoad) this.storeReload();*/ }, applyFilters: function (bLoad) { if (arguments.length < 1) bLoad = true; for (var fn in this.filterFields) { this.applyFilter(this.filterFields[fn], false); } if (bLoad) this.storeReload(); }, storeReload: function () { if (!this.grid.store.lastOptions) return; var slp = { start: 0 }; if (this.grid.store.lastOptions.params && this.grid.store.lastOptions.params.limit) slp.limit = this.grid.store.lastOptions.params.limit; this.grid.store.load({ params: slp }); }, getFilterContainer: function (columnId) { return this.filterContainers ? this.filterContainers[columnId] : null; }, destroyFilters: function () { if (this.filterFields) { for (var ff in this.filterFields) { Ext.destroy(this.filterFields[ff]); delete this.filterFields[ff]; } } if (this.filterContainers) { for (var ff in this.filterContainers) { Ext.destroy(this.filterContainers[ff]); delete this.filterContainers[ff]; } } } }); /** * Ext.ux.ToastWindow * * @author Edouard Fattal * @date March 14, 2008 * * @class Ext.ux.ToastWindow * @extends Ext.Window */ Ext.namespace("Ext.ux"); Ext.ux.NotificationMgr = { positions: [] }; Ext.ux.Notification = Ext.extend(Ext.Window, { shadow: false, slideDirection : 'b', alignPosition : 'bl-bl', alignAnchorX : -1, alignAnchorY : -1, isManualControl : false, isSlideIn : false, closable: false, resizable: false, width : 200, thumbIcon : null, hideTitle : false, myConfig : null, initComponent: function(){ var theThis = this; if (theThis.thumbIcon == null) { Ext.apply(this, { iconCls: this.hideTitle == true ? '' : (this.iconCls || 'icon-notify-information'), cls: 'x-notification', width: theThis.width, autoHeight: true, plain: false, draggable: false, bodyStyle: 'text-align:center' }); } else { var message = theThis.html; theThis.title = '
'+theThis.title+'
'; Ext.apply(this, { //iconCls: this.hideTitle == true ? '' : (this.iconCls || 'icon-notify-information'), iconCls : '', cls: 'x-notification', width: theThis.width, autoHeight: true, plain: false, draggable: false }); } if (this.myConfig != null){ Ext.apply(this, this.myConfig); } if(this.autoDestroy) { this.task = new Ext.util.DelayedTask(this.hide, this); } else { this.closable = true; } if (theThis.isManualControl){ theThis.bbar = [ { xtype : 'button', iconCls : 'icon-item-edit', text : 'Show/Hide control panel', tooltip : String.format('Show/Hide control panel'), handler : function(){ if (!theThis.isSlideIn) theThis.runSlideIn(); else theThis.runSlideOut(); } }, '->', theThis.lbl_WhereYouAre = new Ext.form.Label({ text : 'Loading...', style : 'color:red;font-weight:bold;', listeners : { afterrender : function(lbl_This){ lbl_This.askWhereIAm = function(){ if(GLOBAL_CURRENT_OUTLETNAME && GLOBAL_CURRENT_OUTLETNAME !=='Unknown'){ lbl_This.setText("You are at " + GLOBAL_CURRENT_OUTLETNAME); window.currentOutlet = GLOBAL_CURRENT_OUTLETNAME; Ext.get('outlet-name').update("You are at " + GLOBAL_CURRENT_OUTLETNAME); } else { lbl_This.setText(''); window.currentOutlet = GLOBAL_CURRENT_OUTLETNAME; Ext.get('outlet-name').update(''); } // lbl_This.setText("You are at " + GLOBAL_CURRENT_OUTLETNAME); // window.currentOutlet = GLOBAL_CURRENT_OUTLETNAME; // Ext.get('outlet-name').update("You are at " + GLOBAL_CURRENT_OUTLETNAME); // Ext.Ajax.request({ // method: 'POST', // url: '/OutletsHierarchy/WhereIAm', // params: // { // // }, // success : function(result, request) { // //theThis.leftLoadMask.hide(); // var jsonData = Ext.util.JSON.decode(result.responseText); // if (jsonData.message.IsSuccess) // { // lbl_This.setText("You are at " + jsonData.data); // window.currentOutlet = jsonData.data; // Ext.get('outlet-name').update("You are at " + jsonData.data); // } // else { // //showErrorMessageWithEmailNotify(jsonData.message.Info); // } // setTimeout(function(){ // lbl_This.askWhereIAm(); // }, 10000); // }, // failure : function(result, request) { // //theThis.leftLoadMask.hide(); // Ext.get('outlet-name').update(''); // setTimeout(function(){ // lbl_This.askWhereIAm(); // }, 10000); // } // }); }; lbl_This.askWhereIAm(); } } }) ] } Ext.ux.Notification.superclass.initComponent.call(this); }, setMessage: function(msg){ this.body.update(msg); }, setTitle: function(title, iconCls){ Ext.ux.Notification.superclass.setTitle.call(this, title, iconCls||this.iconCls); }, onRender:function(ct, position) { var theThis = this; Ext.ux.Notification.superclass.onRender.call(this, ct, position); }, onDestroy: function(){ Ext.ux.NotificationMgr.positions.remove(this.pos); Ext.ux.Notification.superclass.onDestroy.call(this); }, cancelHiding: function(){ this.addClass('fixed'); if(this.autoDestroy) { this.task.cancel(); } }, afterShow: function(){ var theThis = this; Ext.ux.Notification.superclass.afterShow.call(this); if (!theThis.isManualControl) //Ext.fly(this.body.dom).on('click', this.cancelHiding, this); Ext.fly(Ext.get(theThis.id)).on('click', this.cancelHiding, this); // apply click event for any part of the notification if(this.autoDestroy) { this.task.delay(this.hideDelay || 5000); } }, animShow: function(){ var theThis = this; if (!theThis.isManualControl) { this.pos = 0; while(Ext.ux.NotificationMgr.positions.indexOf(this.pos)>-1) this.pos++; Ext.ux.NotificationMgr.positions.push(this.pos); this.setSize(theThis.width,100); if (this.alignAnchorX == -1 && this.alignAnchorY == -1) this.el.alignTo(document, this.alignPosition, [ 30, -60-((this.getSize().height+10)*this.pos) ]); else this.el.alignTo(document, this.alignPosition, [ this.alignAnchorX, this.alignAnchorY ]); this.el.slideIn(this.slideDirection, { duration: 1, callback: this.afterShow, scope: this }); // TR849: Add box-shadow for notification on light theme when sliding in if (CTB && CTB.init && CTB.init.user && CTB.init.user.theme == CTB_STYLE_THEME.LIGHT) { var styleBoxShadow = "rgba(0, 0, 0, 0.25) 0px 0px 14px 0px"; for (var i = 0; i < jQuery(".x-notification").length; i++) { if (jQuery(".x-notification")[i].parentElement.style.boxShadow !== styleBoxShadow) { jQuery(".x-notification")[i].parentElement.style.boxShadow = styleBoxShadow; } } } } else { this.setSize(theThis.width,100); this.el.alignTo(document, this.alignPosition, [ this.alignAnchorX, this.alignAnchorY - 25 ]); this.el.slideIn(this.slideDirection, { duration: 1, callback: this.afterShow, scope: this }); // TR849: Add box-shadow for notification on light theme when sliding in if (CTB && CTB.init && CTB.init.user && CTB.init.user.theme == CTB_STYLE_THEME.LIGHT) { var styleBoxShadow = "rgba(0, 0, 0, 0.25) 0px 0px 14px 0px"; for (var i = 0; i < jQuery(".x-notification").length; i++) { if (jQuery(".x-notification")[i].parentElement.style.boxShadow !== styleBoxShadow) { jQuery(".x-notification")[i].parentElement.style.boxShadow = styleBoxShadow; } } } } }, animHide: function(){ var theThis = this; if (!theThis.isManualControl) { Ext.ux.NotificationMgr.positions.remove(this.pos); this.el.ghost(this.slideDirection, { duration: 1, remove: true }); } }, runSlideIn: function(){ var theThis = this; this.setSize(theThis.width,100); this.el.alignTo(document, this.alignPosition, [ this.alignAnchorX, this.alignAnchorY + 50]); this.el.slideIn(this.slideDirection, { duration: 1, callback: this.afterShow, scope: this }); theThis.isSlideIn = true; }, runSlideOut: function(){ var theThis = this; this.setSize(theThis.width,100); this.el.alignTo(document, this.alignPosition, [ this.alignAnchorX, this.alignAnchorY - 25]); this.el.slideOut(this.slideDirection, { duration: 1, callback: this.afterShow, scope: this }); theThis.isSlideIn = false; }, focus: Ext.emptyFn }); function destroyNotification(id) { var notification = Ext.getCmp(id); if (notification) { notification.destroy(); } } Ext.ux.Notification.ICON_THUMB_UP = 'icon-v3-thumb-up'; Ext.ux.Notification.ICON_THUMB_DOWN = 'icon-v3-thumb-down'; // Permanent Ext.ux.PermanentNotificationMgr = { positions: [] }; Ext.ux.PermanentNotification = Ext.extend(Ext.Window, { shadow: false, width: 200, height: 100, notificationId : -1, callback_AfterHide : null, initComponent: function(){ Ext.apply(this, { iconCls: this.iconCls || 'x-icon-information', cls: 'x-notification ' + this.cls, //width: 200, autoHeight: true, plain: false, draggable: false, bodyStyle: 'text-align:center;' }); if(this.autoDestroy) { this.task = new Ext.util.DelayedTask(this.hide, this); } else { this.addClass('fixed'); this.closable = true; } Ext.ux.PermanentNotification.superclass.initComponent.call(this); }, setMessage: function(msg){ this.body.update(msg); }, setTitle: function(title, iconCls){ Ext.ux.PermanentNotification.superclass.setTitle.call(this, title, iconCls||this.iconCls); }, onRender:function(ct, position) { Ext.ux.PermanentNotification.superclass.onRender.call(this, ct, position); }, onDestroy: function(){ Ext.ux.PermanentNotificationMgr.positions.remove(this.pos); Ext.ux.PermanentNotification.superclass.onDestroy.call(this); }, cancelHiding: function(){ this.addClass('fixed'); if(this.autoDestroy) { this.task.cancel(); } }, afterShow: function(){ Ext.ux.PermanentNotification.superclass.afterShow.call(this); Ext.fly(this.body.dom).on('click', this.cancelHiding, this); if(this.autoDestroy) { this.task.delay(this.hideDelay || 5000); } }, afterHide: function(){ Ext.ux.PermanentNotification.superclass.afterHide.call(this); if (this.callback_AfterHide != null) { this.callback_AfterHide(this.notificationId); } }, animShow: function(){ this.pos = 0; while(Ext.ux.PermanentNotificationMgr.positions.indexOf(this.pos)>-1) this.pos++; Ext.ux.PermanentNotificationMgr.positions.push(this.pos); this.setSize(this.getWidth(),this.getHeight()); this.el.alignTo(document, "br-br", [ -20, -20-((this.getSize().height+10)*this.pos) ]); this.el.slideIn('b', { duration: 1, callback: this.afterShow, scope: this }); }, animHide: function(){ Ext.ux.PermanentNotificationMgr.positions.remove(this.pos); this.el.ghost("b", { duration: 1, remove: true }); }, focus: Ext.emptyFn }); /*! * Ext JS Library 3.3.1 * Copyright(c) 2006-2010 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ /** * @class Ext.ux.Spinner * @extends Ext.util.Observable * Creates a Spinner control utilized by Ext.ux.form.SpinnerField */ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { incrementValue: 1, alternateIncrementValue: 5, triggerClass: 'x-form-spinner-trigger', splitterClass: 'x-form-spinner-splitter', alternateKey: Ext.EventObject.shiftKey, defaultValue: 0, accelerate: false, constructor: function (config) { Ext.ux.Spinner.superclass.constructor.call(this, config); Ext.apply(this, config); this.mimicing = false; }, init: function (field) { this.field = field; field.afterMethod('onRender', this.doRender, this); field.afterMethod('onEnable', this.doEnable, this); field.afterMethod('onDisable', this.doDisable, this); field.afterMethod('afterRender', this.doAfterRender, this); field.afterMethod('onResize', this.doResize, this); field.afterMethod('onFocus', this.doFocus, this); field.beforeMethod('onDestroy', this.doDestroy, this); }, doRender: function (ct, position) { var el = this.el = this.field.getEl(); var f = this.field; if (!f.wrap) { f.wrap = this.wrap = el.wrap({ cls: "x-form-field-wrap" }); } else { this.wrap = f.wrap.addClass('x-form-field-wrap'); } this.trigger = this.wrap.createChild({ tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.triggerClass }); if (!f.width) { this.wrap.setWidth(el.getWidth() + this.trigger.getWidth()); } this.splitter = this.wrap.createChild({ tag: 'div', cls: this.splitterClass, style: 'width:13px; height:2px;' }); this.splitter.setRight((Ext.isIE) ? 1 : 2).setTop(10).show(); this.proxy = this.trigger.createProxy('', this.splitter, true); this.proxy.addClass("x-form-spinner-proxy"); this.proxy.setStyle('left', '0px'); this.proxy.setSize(14, 1); this.proxy.hide(); this.dd = new Ext.dd.DDProxy(this.splitter.dom.id, "SpinnerDrag", { dragElId: this.proxy.id }); this.initTrigger(); this.initSpinner(); }, doAfterRender: function () { var y; if (Ext.isIE && this.el.getY() != (y = this.trigger.getY())) { this.el.position(); this.el.setY(y); } }, doEnable: function () { if (this.wrap) { this.disabled = false; this.wrap.removeClass(this.field.disabledClass); } }, doDisable: function () { if (this.wrap) { this.disabled = true; this.wrap.addClass(this.field.disabledClass); this.el.removeClass(this.field.disabledClass); } }, doResize: function (w, h) { if (typeof w == 'number') { this.el.setWidth(w - this.trigger.getWidth()); } this.wrap.setWidth(this.el.getWidth() + this.trigger.getWidth()); }, doFocus: function () { if (!this.mimicing) { this.wrap.addClass('x-trigger-wrap-focus'); this.mimicing = true; Ext.get(Ext.isIE ? document.body : document).on("mousedown", this.mimicBlur, this, { delay: 10 }); this.el.on('keydown', this.checkTab, this); } }, // private checkTab: function (e) { if (e.getKey() == e.TAB) { this.triggerBlur(); } }, // private mimicBlur: function (e) { if (!this.wrap.contains(e.target) && this.field.validateBlur(e)) { this.triggerBlur(); } }, // private triggerBlur: function () { this.mimicing = false; Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this); this.el.un("keydown", this.checkTab, this); this.field.beforeBlur(); this.wrap.removeClass('x-trigger-wrap-focus'); this.field.onBlur.call(this.field); }, initTrigger: function () { this.trigger.addClassOnOver('x-form-trigger-over'); this.trigger.addClassOnClick('x-form-trigger-click'); }, initSpinner: function () { this.field.addEvents({ 'spin': true, 'spinup': true, 'spindown': true }); this.keyNav = new Ext.KeyNav(this.el, { "up": function (e) { e.preventDefault(); this.onSpinUp(); }, "down": function (e) { e.preventDefault(); this.onSpinDown(); }, "pageUp": function (e) { e.preventDefault(); this.onSpinUpAlternate(); }, "pageDown": function (e) { e.preventDefault(); this.onSpinDownAlternate(); }, scope: this }); this.repeater = new Ext.util.ClickRepeater(this.trigger, { accelerate: this.accelerate }); this.field.mon(this.repeater, "click", this.onTriggerClick, this, { preventDefault: true }); this.field.mon(this.trigger, { mouseover: this.onMouseOver, mouseout: this.onMouseOut, mousemove: this.onMouseMove, mousedown: this.onMouseDown, mouseup: this.onMouseUp, scope: this, preventDefault: true }); this.field.mon(this.wrap, "mousewheel", this.handleMouseWheel, this); this.dd.setXConstraint(0, 0, 10) this.dd.setYConstraint(1500, 1500, 10); this.dd.endDrag = this.endDrag.createDelegate(this); this.dd.startDrag = this.startDrag.createDelegate(this); this.dd.onDrag = this.onDrag.createDelegate(this); }, onMouseOver: function () { if (this.disabled) { return; } var middle = this.getMiddle(); this.tmpHoverClass = (Ext.EventObject.getPageY() < middle) ? 'x-form-spinner-overup' : 'x-form-spinner-overdown'; this.trigger.addClass(this.tmpHoverClass); }, //private onMouseOut: function () { this.trigger.removeClass(this.tmpHoverClass); }, //private onMouseMove: function () { if (this.disabled) { return; } var middle = this.getMiddle(); if (((Ext.EventObject.getPageY() > middle) && this.tmpHoverClass == "x-form-spinner-overup") || ((Ext.EventObject.getPageY() < middle) && this.tmpHoverClass == "x-form-spinner-overdown")) { } }, //private onMouseDown: function () { if (this.disabled) { return; } var middle = this.getMiddle(); this.tmpClickClass = (Ext.EventObject.getPageY() < middle) ? 'x-form-spinner-clickup' : 'x-form-spinner-clickdown'; this.trigger.addClass(this.tmpClickClass); }, //private onMouseUp: function () { this.trigger.removeClass(this.tmpClickClass); }, //private onTriggerClick: function () { if (this.disabled || this.el.dom.readOnly) { return; } var middle = this.getMiddle(); var ud = (Ext.EventObject.getPageY() < middle) ? 'Up' : 'Down'; this['onSpin' + ud](); }, //private getMiddle: function () { var t = this.trigger.getTop(); var h = this.trigger.getHeight(); var middle = t + (h / 2); return middle; }, //private //checks if control is allowed to spin isSpinnable: function () { if (this.disabled || this.el.dom.readOnly) { Ext.EventObject.preventDefault(); //prevent scrolling when disabled/readonly return false; } return true; }, handleMouseWheel: function (e) { //disable scrolling when not focused if (this.wrap.hasClass('x-trigger-wrap-focus') == false) { return; } var delta = e.getWheelDelta(); if (delta > 0) { this.onSpinUp(); e.stopEvent(); } else if (delta < 0) { this.onSpinDown(); e.stopEvent(); } }, //private startDrag: function () { this.proxy.show(); this._previousY = Ext.fly(this.dd.getDragEl()).getTop(); }, //private endDrag: function () { this.proxy.hide(); }, //private onDrag: function () { if (this.disabled) { return; } var y = Ext.fly(this.dd.getDragEl()).getTop(); var ud = ''; if (this._previousY > y) { ud = 'Up'; } //up if (this._previousY < y) { ud = 'Down'; } //down if (ud != '') { this['onSpin' + ud](); } this._previousY = y; }, //private onSpinUp: function () { if (this.isSpinnable() == false) { return; } if (Ext.EventObject.shiftKey == true) { this.onSpinUpAlternate(); return; } else { this.spin(false, false); } this.field.fireEvent("spin", this); this.field.fireEvent("spinup", this); }, //private onSpinDown: function () { if (this.isSpinnable() == false) { return; } if (Ext.EventObject.shiftKey == true) { this.onSpinDownAlternate(); return; } else { this.spin(true, false); } this.field.fireEvent("spin", this); this.field.fireEvent("spindown", this); }, //private onSpinUpAlternate: function () { if (this.isSpinnable() == false) { return; } this.spin(false, true); this.field.fireEvent("spin", this); this.field.fireEvent("spinup", this); }, //private onSpinDownAlternate: function () { if (this.isSpinnable() == false) { return; } this.spin(true, true); this.field.fireEvent("spin", this); this.field.fireEvent("spindown", this); }, spin: function (down, alternate) { var v = parseFloat(this.field.getValue()); var incr = (alternate == true) ? this.alternateIncrementValue : this.incrementValue; (down == true) ? v -= incr : v += incr; v = (isNaN(v)) ? this.defaultValue : v; v = this.fixBoundries(v); this.field.setRawValue(v); }, fixBoundries: function (value) { var v = value; if (this.field.minValue != undefined && v < this.field.minValue) { v = this.field.minValue; } if (this.field.maxValue != undefined && v > this.field.maxValue) { v = this.field.maxValue; } return this.fixPrecision(v); }, // private fixPrecision: function (value) { var nan = isNaN(value); if (!this.field.allowDecimals || this.field.decimalPrecision == -1 || nan || !value) { return nan ? '' : value; } return parseFloat(parseFloat(value).toFixed(this.field.decimalPrecision)); }, doDestroy: function () { if (this.trigger) { this.trigger.remove(); } if (this.wrap) { this.wrap.remove(); delete this.field.wrap; } if (this.splitter) { this.splitter.remove(); } if (this.dd) { this.dd.unreg(); this.dd = null; } if (this.proxy) { this.proxy.remove(); } if (this.repeater) { this.repeater.purgeListeners(); } if (this.mimicing) { Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this); } } }); //backwards compat Ext.form.Spinner = Ext.ux.Spinner; /*! * Ext JS Library 3.3.1 * Copyright(c) 2006-2010 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ Ext.ns('Ext.ux.form'); /** * @class Ext.ux.form.SpinnerField * @extends Ext.form.NumberField * Creates a field utilizing Ext.ux.Spinner * @xtype spinnerfield */ Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, { actionMode: 'wrap', deferHeight: true, autoSize: Ext.emptyFn, onBlur: Ext.emptyFn, adjustSize: Ext.BoxComponent.prototype.adjustSize, constructor: function(config) { var spinnerConfig = Ext.copyTo({}, config, 'incrementValue,alternateIncrementValue,accelerate,defaultValue,triggerClass,splitterClass'); var spl = this.spinner = new Ext.ux.Spinner(spinnerConfig); var plugins = config.plugins ? (Ext.isArray(config.plugins) ? config.plugins.push(spl) : [config.plugins, spl]) : spl; Ext.ux.form.SpinnerField.superclass.constructor.call(this, Ext.apply(config, {plugins: plugins})); }, // private getResizeEl: function(){ return this.wrap; }, // private getPositionEl: function(){ return this.wrap; }, // private alignErrorIcon: function(){ if (this.wrap) { this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]); } }, validateBlur: function(){ return true; } }); Ext.reg('spinnerfield', Ext.ux.form.SpinnerField); //backwards compat Ext.form.SpinnerField = Ext.ux.form.SpinnerField; /** * @author Shea Frederick - http://www.vinylfox.com * @contributor Nigel (Animal) White *

A 'Shake' effect for the ExtJS Fx class

*/ Ext.apply(Ext.Fx, { /** * Shakes an element left to right or up and down. Shaking decreases until the element settles back into its original position. * Usage: *

// default: shake left to right (x) five times with an excitement level of 2
el.shake();

// custom: shake up and down 10 times with an excitement level of 4
el.shake({ direction: 'y', shakes: 10, excitement: 4 });
* @param {Object} options (optional) Object literal with any of the Shake config options (direction of 'x' or 'y', shakes, and excitement) * @return {Ext.Element} The Element */ shake: function(o){ o = Ext.applyIf(o || {}, { shakes: 5, excitement: 2, direction: 'x', componentId : '', firstTime : true }); var me = this, dom = me.dom, c = o.direction.toUpperCase(), a = Ext.fly(dom).getStyle("position") == 'absolute', pos = a ? Ext.fly(dom)['get' + c]() : 0, attr = (c == 'X') ? 'left' : 'top', s = o.shakes, r = s * 2, e = o.excitement * 2, sp = Ext.fly(dom).getPositioning(), animArg = {}, t; t = animArg[attr] = { to: 0 }; if (!a) { me.position(); } function animFn(){ if (o.componentId != '' && o.firstTime){ o.firstTime = false; if (Ext.getCmp(o.componentId).IsShaking) { return; } else { Ext.getCmp(o.componentId).IsShaking = true; } } t.to = (r & 1) ? pos - (s-- * e) : pos + (s * e); arguments.callee.anim = Ext.fly(dom).fxanim(animArg, o, 'motion', 0.02, 'easeNone', function(){ if (--r > 0) { me.queueFx({ concurrent: true }, animFn); } else { if (o.componentId != ''){ Ext.getCmp(o.componentId).IsShaking = false; } Ext.fly(dom).setPositioning(sp).afterFx(o); } }); } me.queueFx({ concurrent: true }, animFn); return me; } }); Ext.Element.addMethods(Ext.Fx); /*! * Ext JS Library 3.3.1 * Copyright(c) 2006-2010 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ /** * @class Ext.DataView.LabelEditor * @extends Ext.Editor * */ Ext.DataView.LabelEditor = Ext.extend(Ext.Editor, { alignment: 'tl-tl', hideEl: false, cls: 'x-small-editor', shim: false, completeOnEnter: true, cancelOnEsc: true, labelSelector: 'span.x-editable', constructor: function(cfg, field) { Ext.DataView.LabelEditor.superclass.constructor.call( this, field || new Ext.form.TextField({ allowBlank: false, growMin: 90, growMax: 240, grow: true, selectOnFocus: true }), cfg ); }, init: function(view) { this.view = view; view.on('render', this.initEditor, this); this.on('complete', this.onSave, this); }, initEditor: function() { this.view.on({ scope: this, containerclick: this.doBlur, click: this.doBlur }); this.view.getEl().on('mousedown', this.onMouseDown, this, { delegate: this.labelSelector }); }, doBlur: function() { if (this.editing) { this.field.blur(); } }, onMouseDown: function(e, target) { if (!e.ctrlKey && !e.shiftKey) { var item = this.view.findItemFromChild(target); e.stopEvent(); var record = this.view.store.getAt(this.view.indexOf(item)); this.startEdit(target, record.data[this.dataIndex]); this.activeRecord = record; } else { e.preventDefault(); } }, onSave: function(ed, value) { this.activeRecord.set(this.dataIndex, value); } }); Ext.DataView.DragSelector = function(cfg) { cfg = cfg || {}; var view, proxy, tracker; var rs, bodyRegion, dragRegion = new Ext.lib.Region(0, 0, 0, 0); var dragSafe = cfg.dragSafe === true; this.init = function(dataView) { view = dataView; view.on('render', onRender); }; function fillRegions() { rs = []; view.all.each(function(el) { rs[rs.length] = el.getRegion(); }); bodyRegion = view.el.getRegion(); } function cancelClick() { return false; } function onBeforeStart(e) { return !dragSafe || e.target == view.el.dom; } function onStart(e) { view.ignoreContainerClick = true; view.on('containerclick', cancelClick, view, { single: true }); if (!proxy) { proxy = view.el.createChild({ cls: 'x-view-selector' }); } else { if (proxy.dom.parentNode !== view.el.dom) { view.el.dom.appendChild(proxy.dom); } proxy.setDisplayed('block'); } fillRegions(); view.clearSelections(); } function onDrag(e) { var startXY = tracker.startXY; var xy = tracker.getXY(); var x = Math.min(startXY[0], xy[0]); var y = Math.min(startXY[1], xy[1]); var w = Math.abs(startXY[0] - xy[0]); var h = Math.abs(startXY[1] - xy[1]); dragRegion.left = x; dragRegion.top = y; dragRegion.right = x + w; dragRegion.bottom = y + h; dragRegion.constrainTo(bodyRegion); proxy.setRegion(dragRegion); for (var i = 0, len = rs.length; i < len; i++) { var r = rs[i], sel = dragRegion.intersect(r); if (sel && !r.selected) { r.selected = true; view.select(i, true); } else if (!sel && r.selected) { r.selected = false; view.deselect(i); } } } function onEnd(e) { setTimeout(revertViewFlag, 100); if (!Ext.isIE) { view.un('containerclick', cancelClick, view); } if (proxy) { proxy.setDisplayed(false); } } function revertViewFlag() { view.ignoreContainerClick = false; } function onRender(view) { tracker = new Ext.dd.DragTracker({ onBeforeStart: onBeforeStart, onStart: onStart, onDrag: onDrag, onEnd: onEnd }); tracker.initEl(view.el); } }; /*! * Ext JS Library 3.3.1 * Copyright(c) 2006-2010 Sencha Inc. * licensing@sencha.com * http://www.sencha.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 file-upload-field'}); this.el.addClass('x-form-file-text'); this.el.dom.removeAttribute('name'); this.createFileInput(); 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.bindListeners(); this.resizeEl = this.positionEl = this.wrap; }, bindListeners: function(){ this.fileInput.on({ scope: this, mouseenter: function() { this.button.addClass(['x-btn-over','x-btn-focus']) }, mouseleave: function(){ this.button.removeClass(['x-btn-over','x-btn-focus','x-btn-click']) }, mousedown: function(){ this.button.addClass('x-btn-click') }, mouseup: function(){ this.button.removeClass(['x-btn-over','x-btn-focus','x-btn-click']) }, change: function(){ var v = this.fileInput.dom.value; this.setValue(v); this.fireEvent('fileselected', this, v); } }); }, createFileInput : function() { this.fileInput = this.wrap.createChild({ id: this.getFileInputId(), name: this.name||this.getId(), cls: 'x-form-file', tag: 'input', type: 'file', size: 1 }); }, reset : function(){ this.fileInput.remove(); this.createFileInput(); this.bindListeners(); Ext.ux.form.FileUploadField.superclass.reset.call(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); }, onDisable: function(){ Ext.ux.form.FileUploadField.superclass.onDisable.call(this); this.doDisable(true); }, onEnable: function(){ Ext.ux.form.FileUploadField.superclass.onEnable.call(this); this.doDisable(false); }, // private doDisable: function(disabled){ this.fileInput.dom.disabled = disabled; this.button.setDisabled(disabled); }, // private preFocus : Ext.emptyFn, // 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.3.1 * Copyright(c) 2006-2010 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ Ext.ns("Ext.ux"); /** * @class Ext.ux.FieldLabeler *

A plugin for Field Components which renders standard Ext form wrapping and labels * round the Field at render time regardless of the layout of the Container.

*

Usage:

*

    {
        xtype: 'combo',
        plugins: [ Ext.ux.FieldLabeler ],
        triggerAction: 'all',
        fieldLabel: 'Select type',
        store: typeStore
    }
 * 
*/ Ext.ux.FieldLabeler = (function(){ // Pulls a named property down from the first ancestor Container it's found in function getParentProperty(propName) { for (var p = this.ownerCt; p; p = p.ownerCt) { if (p[propName]) { return p[propName]; } } } return { // Add behaviour at important points in the Field's lifecycle. init: function(f) { // Replace the Field's onRender method with a sequence that calls the plugin's onRender after the Field's onRender f.onRender = f.onRender.createSequence(this.onRender); // We need to completely override the onResize method because of the complexity f.onResize = this.onResize; // Replace the Field's onDestroy method with a sequence that calls the plugin's onDestroy after the Field's onRender f.onDestroy = f.onDestroy.createSequence(this.onDestroy); }, onRender: function() { // Do nothing if being rendered by a form layout if (this.ownerCt) { if (this.ownerCt.layout instanceof Ext.layout.FormLayout) { return; } } this.resizeEl = (this.wrap || this.el).wrap({ cls: 'x-form-element', style: (Ext.isIE || Ext.isOpera) ? 'position:absolute;top:0;left:0;overflow:visible' : '' }); this.positionEl = this.itemCt = this.resizeEl.wrap({ cls: 'x-form-item ' }); if (this.nextSibling()) { this.margins = { top: 0, right: 0, bottom: this.positionEl.getMargins('b'), left: 0 }; } this.actionMode = 'itemCt'; // If our Container is hiding labels, then we're done! if (!Ext.isDefined(this.hideLabels)) { this.hideLabels = getParentProperty.call(this, "hideLabels"); } if (this.hideLabels) { this.resizeEl.setStyle('padding-left', '0px'); return; } // Collect the info we need to render the label from our Container. if (!Ext.isDefined(this.labelSeparator)) { this.labelSeparator = getParentProperty.call(this, "labelSeparator"); } if (!Ext.isDefined(this.labelPad)) { this.labelPad = getParentProperty.call(this, "labelPad"); } if (!Ext.isDefined(this.labelAlign)) { this.labelAlign = getParentProperty.call(this, "labelAlign") || 'left'; } this.itemCt.addClass('x-form-label-' + this.labelAlign); if(this.labelAlign == 'top'){ if (!this.labelWidth) { this.labelWidth = 'auto'; } this.resizeEl.setStyle('padding-left', '0px'); } else { if (!Ext.isDefined(this.labelWidth)) { this.labelWidth = getParentProperty.call(this, "labelWidth") || 100; } this.resizeEl.setStyle('padding-left', (this.labelWidth + (this.labelPad || 5)) + 'px'); this.labelWidth += 'px'; } this.label = this.itemCt.insertFirst({ tag: 'label', cls: 'x-form-item-label', style: { width: this.labelWidth }, html: this.fieldLabel + (this.labelSeparator || ':') }); }, // private // Ensure the input field is sized to fit in the content area of the resizeEl (to the right of its padding-left) // We perform all necessary sizing here. We do NOT call the current class's onResize because we need this control // we skip that and go up the hierarchy to Ext.form.Field onResize: function(w, h) { Ext.form.Field.prototype.onResize.apply(this, arguments); w -= this.resizeEl.getPadding('l'); if (this.getTriggerWidth) { this.wrap.setWidth(w); this.el.setWidth(w - this.getTriggerWidth()); } else { this.el.setWidth(w); } if (this.el.dom.tagName.toLowerCase() == 'textarea') { var h = this.resizeEl.getHeight(true); if (!this.hideLabels && (this.labelAlign == 'top')) { h -= this.label.getHeight(); } this.el.setHeight(h); } }, // private // Ensure that we clean up on destroy. onDestroy: function() { this.itemCt.remove(); } }; })(); /*! * Ext JS Library 3.3.1 * Copyright(c) 2006-2010 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ Ext.ns("Ext.ux"); /** * @class Ext.ux.FieldReplicator *

A plugin for Field Components which creates clones of the Field for as * long as the user keeps filling them. Leaving the final one blank ends the repeating series.

*

Usage:

*

    {
        xtype: 'combo',
        plugins: [ Ext.ux.FieldReplicator ],
        triggerAction: 'all',
        fieldLabel: 'Select recipient',
        store: recipientStore
    }
 * 
*/ Ext.ux.FieldReplicator = { init: function(f) { f.replicator = this; f.enableKeyEvents = true; f.on('change', this.onChange, this); f.onKeyDown = f.onKeyDown.createInterceptor(this.onKeyDown); }, // If tabbing out and the change event will be fired, flag that // the change handler must focus the correct sibling Field. onKeyDown: function(e) { if ((e.getKey() == Ext.EventObject.TAB) && (String(this.startValue) !== String(this.getValue()))) { if (e.shiftKey) { this.focusPrev = true; } else if (!e.shiftKey && !e.altKey) { this.focusNext = true; } } }, // Handle the field either being changed to blank or from blank. onChange: function(f, n, o) { // Ensure that "change" is only fired once. f.startValue = n; var c = f.ownerCt, l, ps = f.previousSibling(), ns = f.nextSibling(); if (Ext.isEmpty(n)) { if (!Ext.isEmpty(o)) { // The Field has been blanked, and it is not the only one left, remove it if ((ps && (ps.replicator === this)) || (ns && (ns.replicator === this))) { l = f.findParentBy(function(p) { return !Ext.isDefined(p.ownerCt); }); c.remove(f); l.doLayout(); } } } else { if (Ext.isEmpty(o)) { // Field filled, insert a clone as the next sibling ns = new f.constructor(f.cloneConfig()); c.insert(c.items.indexOf(f) + 1, ns); c.doLayout(); l = f.findParentBy(function(p) { return !Ext.isDefined(p.ownerCt); }); l.doLayout(); } } if (f.focusPrev) { delete f.focusPrev; ps.focus(false, true); } else if (f.focusNext) { delete f.focusNext; ns.focus(false, true); } } }; /*! * Ext JS Library 3.3.1 * Copyright(c) 2006-2010 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ Ext.ns('Ext.ux.form'); /** * @class Ext.ux.form.MoneyField * @extends Ext.form.NumberField * Creates a field utilizing Ext.ux.MoneySpinner * @xtype spinnerfield */ /*! * Ext JS Library 3.3.1 * Copyright(c) 2006-2010 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ /** * @class Ext.ux.MoneySpinner * @extends Ext.util.Observable * Creates a Spinner control utilized by Ext.ux.form.SpinnerField */ Ext.ux.MoneySpinner = Ext.extend(Ext.util.Observable, { incrementValue: 1, minValue: 0, decimalPrecision: 2, alternateIncrementValue: 5, triggerClass: 'x-form-spinner-trigger', splitterClass: 'x-form-spinner-splitter', alternateKey: Ext.EventObject.shiftKey, defaultValue: 0, prefixSign: '', accelerate: false, moneySign: '$', disabledSpinner: false, mydata : 0, constructor: function (config) { Ext.ux.MoneySpinner.superclass.constructor.call(this, config); Ext.apply(this, config); this.mimicing = false; }, init: function (field) { this.field = field; field.afterMethod('onRender', this.doRender, this); field.afterMethod('onEnable', this.doEnable, this); field.afterMethod('onDisable', this.doDisable, this); field.afterMethod('afterRender', this.doAfterRender, this); field.afterMethod('onResize', this.doResize, this); field.afterMethod('onFocus', this.doFocus, this); field.beforeMethod('onDestroy', this.doDestroy, this); }, doRender: function (ct, position) { var el = this.el = this.field.getEl(); var f = this.field; if (!f.wrap) { f.wrap = this.wrap = el.wrap({ cls: "x-form-field-wrap" }); } else { this.wrap = f.wrap.addClass('x-form-field-wrap'); } if (!this.disabledSpinner) { this.trigger = this.wrap.createChild({ tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.triggerClass }); } else { this.trigger = this.wrap.createChild({ tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-text x-form-spinner-trigger-hide" }); this.wrap = this.el.addClass('disabled-spinner') } if (!f.width) { this.wrap.setWidth(el.getWidth() + this.trigger.getWidth()); } if (!this.disabledSpinner) { this.splitter = this.wrap.createChild({ tag: 'div', cls: this.splitterClass, style: 'width:13px; height:2px;' }); } else { this.splitter = this.wrap.createChild({ tag: 'div', style: 'width:13px; height:2px;' }); } this.splitter.setRight((Ext.isIE) ? 1 : 2).setTop(10).show(); this.proxy = this.trigger.createProxy('', this.splitter, true); this.proxy.addClass("x-form-spinner-proxy"); this.proxy.setStyle('left', '0px'); this.proxy.setSize(14, 1); this.proxy.hide(); this.dd = new Ext.dd.DDProxy(this.splitter.dom.id, "SpinnerDrag", { dragElId: this.proxy.id }); this.initTrigger(); this.initSpinner(); }, doAfterRender: function () { var y; if (Ext.isIE && this.el.getY() != (y = this.trigger.getY())) { this.el.position(); this.el.setY(y); } }, doEnable: function () { if (this.wrap) { this.disabled = false; this.wrap.removeClass(this.field.disabledClass); } }, doDisable: function () { if (this.wrap) { this.disabled = true; this.wrap.addClass(this.field.disabledClass); this.el.removeClass(this.field.disabledClass); } }, doResize: function (w, h) { if (typeof w == 'number') { this.el.setWidth(w - this.trigger.getWidth()); } this.wrap.setWidth(this.el.getWidth() + this.trigger.getWidth()); }, doFocus: function () { if (!this.mimicing) { if (isNaN(this.field.getRawValue())) { var rawValue = this.field.getRawValue(); var moneySignLength = this.moneySign.length; var prefixSignLength = this.prefixSign.length; v = parseFloat(rawValue.substr(prefixSignLength + moneySignLength, rawValue.length - 1)); this.field.setRawValue(v); } this.wrap.addClass('x-trigger-wrap-focus'); this.mimicing = true; Ext.get(Ext.isIE ? document.body : document).on("mousedown", this.mimicBlur, this, { delay: 10 }); this.el.on('keydown', this.checkTab, this); } }, // private checkTab: function (e) { if (e.getKey() == e.TAB) { this.triggerBlur(); } }, // private mimicBlur: function (e) { if (!this.wrap.contains(e.target) && this.field.validateBlur(e)) { this.triggerBlur(); } }, // private triggerBlur: function () { this.mimicing = false; Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this); this.el.un("keydown", this.checkTab, this); this.field.beforeBlur(); this.wrap.removeClass('x-trigger-wrap-focus'); this.field.onBlur.call(this.field); }, initTrigger: function () { this.trigger.addClassOnOver('x-form-trigger-over'); this.trigger.addClassOnClick('x-form-trigger-click'); }, initSpinner: function () { this.field.addEvents({ 'spin': true, 'spinup': true, 'spindown': true }); this.keyNav = new Ext.KeyNav(this.el, { "up": function (e) { e.preventDefault(); this.onSpinUp(); }, "down": function (e) { e.preventDefault(); this.onSpinDown(); }, "pageUp": function (e) { e.preventDefault(); this.onSpinUpAlternate(); }, "pageDown": function (e) { e.preventDefault(); this.onSpinDownAlternate(); }, scope: this }); this.repeater = new Ext.util.ClickRepeater(this.trigger, { accelerate: this.accelerate }); this.field.mon(this.repeater, "click", this.onTriggerClick, this, { preventDefault: true }); this.field.mon(this.trigger, { mouseover: this.onMouseOver, mouseout: this.onMouseOut, mousemove: this.onMouseMove, mousedown: this.onMouseDown, mouseup: this.onMouseUp, scope: this, preventDefault: true }); this.field.mon(this.wrap, "mousewheel", this.handleMouseWheel, this); this.dd.setXConstraint(0, 0, 10) this.dd.setYConstraint(1500, 1500, 10); this.dd.endDrag = this.endDrag.createDelegate(this); this.dd.startDrag = this.startDrag.createDelegate(this); this.dd.onDrag = this.onDrag.createDelegate(this); }, onMouseOver: function () { if (this.disabled) { return; } var middle = this.getMiddle(); this.tmpHoverClass = (Ext.EventObject.getPageY() < middle) ? 'x-form-spinner-overup' : 'x-form-spinner-overdown'; this.trigger.addClass(this.tmpHoverClass); }, //private onMouseOut: function () { this.trigger.removeClass(this.tmpHoverClass); }, //private onMouseMove: function () { if (this.disabled) { return; } var middle = this.getMiddle(); if (((Ext.EventObject.getPageY() > middle) && this.tmpHoverClass == "x-form-spinner-overup") || ((Ext.EventObject.getPageY() < middle) && this.tmpHoverClass == "x-form-spinner-overdown")) { } }, //private onMouseDown: function () { if (this.disabled) { return; } var middle = this.getMiddle(); this.tmpClickClass = (Ext.EventObject.getPageY() < middle) ? 'x-form-spinner-clickup' : 'x-form-spinner-clickdown'; this.trigger.addClass(this.tmpClickClass); }, //private onMouseUp: function () { this.trigger.removeClass(this.tmpClickClass); }, //private onTriggerClick: function () { if (this.disabled || this.el.dom.readOnly) { return; } var middle = this.getMiddle(); var ud = (Ext.EventObject.getPageY() < middle) ? 'Up' : 'Down'; this['onSpin' + ud](); }, //private getMiddle: function () { var t = this.trigger.getTop(); var h = this.trigger.getHeight(); var middle = t + (h / 2); return middle; }, //private //checks if control is allowed to spin isSpinnable: function () { if (this.disabled || this.el.dom.readOnly) { Ext.EventObject.preventDefault(); //prevent scrolling when disabled/readonly return false; } return true; }, handleMouseWheel: function (e) { //disable scrolling when not focused if (this.wrap.hasClass('x-trigger-wrap-focus') == false) { return; } var delta = e.getWheelDelta(); if (delta > 0) { this.onSpinUp(); e.stopEvent(); } else if (delta < 0) { this.onSpinDown(); e.stopEvent(); } }, //private startDrag: function () { this.proxy.show(); this._previousY = Ext.fly(this.dd.getDragEl()).getTop(); }, //private endDrag: function () { this.proxy.hide(); }, //private onDrag: function () { if (this.disabled) { return; } var y = Ext.fly(this.dd.getDragEl()).getTop(); var ud = ''; if (this._previousY > y) { ud = 'Up'; } //up if (this._previousY < y) { ud = 'Down'; } //down if (ud != '') { this['onSpin' + ud](); } this._previousY = y; }, //private onSpinUp: function () { if (this.isSpinnable() == false) { return; } if (Ext.EventObject.shiftKey == true) { this.onSpinUpAlternate(); return; } else { this.spin(false, false); } this.field.fireEvent("spin", this); this.field.fireEvent("spinup", this); }, //private onSpinDown: function () { if (this.isSpinnable() == false) { return; } if (Ext.EventObject.shiftKey == true) { this.onSpinDownAlternate(); return; } else { this.spin(true, false); } this.field.fireEvent("spin", this); this.field.fireEvent("spindown", this); }, //private onSpinUpAlternate: function () { if (this.isSpinnable() == false) { return; } this.spin(false, true); this.field.fireEvent("spin", this); this.field.fireEvent("spinup", this); }, //private onSpinDownAlternate: function () { if (this.isSpinnable() == false) { return; } this.spin(true, true); this.field.fireEvent("spin", this); this.field.fireEvent("spindown", this); }, spin: function (down, alternate) { var v; this.field.focus(); v = parseFloat(this.field.getRawValue()); // if (isNaN(this.field.getRawValue())) { // var rawValue = this.field.getRawValue(); // v = parseFloat(rawValue.substr(1, rawValue.length - 1)); // } // else v = parseFloat(this.field.getRawValue()); var incr = (alternate == true) ? this.alternateIncrementValue : this.incrementValue; (down == true) ? v -= incr : v += incr; v = (isNaN(v)) ? this.defaultValue : v; v = this.fixBoundries(v); this.field.setRawValue(v); }, fixBoundries: function (value) { var v = value; if (this.field.minValue != undefined && v < this.field.minValue) { v = this.field.minValue; } if (this.field.maxValue != undefined && v > this.field.maxValue) { v = this.field.maxValue; } return this.fixPrecision(v); }, // private fixPrecision: function (value) { var nan = isNaN(value); if (!this.field.allowDecimals || this.field.decimalPrecision == -1 || nan || !value) { return nan ? '' : value; } return roundNumber(value, this.field.decimalPrecision); //return parseFloat(parseFloat(value).toFixed(this.field.decimalPrecision)); }, doDestroy: function () { if (this.trigger) { this.trigger.remove(); } if (this.wrap) { this.wrap.remove(); delete this.field.wrap; } if (this.splitter) { this.splitter.remove(); } if (this.dd) { this.dd.unreg(); this.dd = null; } if (this.proxy) { this.proxy.remove(); } if (this.repeater) { this.repeater.purgeListeners(); } if (this.mimicing) { Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this); } } }); //backwards compat Ext.form.Spinner = Ext.ux.MoneySpinner; Ext.ux.form.MoneyField = Ext.extend(Ext.form.NumberField, { actionMode: 'wrap', deferHeight: true, autoSize: Ext.emptyFn, cls:'ctb-money-field', mydata : 0, setMoneySign: function(currencySymbol) { this.moneySign = currencySymbol; this.spinner.moneySign = currencySymbol; this.spinner.field.setValue(this.spinner.field.getValue()); }, onBlur: function () { if (!isNaN(this.spinner.field.getRawValue())) { var rawValue = this.spinner.field.fixPrecision(this.spinner.field.getRawValue()); //v = parseFloat(rawValue.substr(1, rawValue.length - 1)); this.spinner.field.setRawValue(this.spinner.prefixSign + this.spinner.moneySign + addFullDigitToNumber(rawValue, this.decimalPrecision)); } }, adjustSize: Ext.BoxComponent.prototype.adjustSize, constructor: function (config) { var spinnerConfig = Ext.copyTo({}, config, 'incrementValue,alternateIncrementValue,decimalPrecious,accelerate,defaultValue,triggerClass,splitterClass,moneySign,disabledSpinner,prefixSign,mydata'); var spl = this.spinner = new Ext.ux.MoneySpinner(spinnerConfig); var plugins = config.plugins ? (Ext.isArray(config.plugins) ? config.plugins.push(spl) : [config.plugins, spl]) : spl; Ext.ux.form.MoneyField.superclass.constructor.call(this, Ext.apply(config, { plugins: plugins })); }, // private getResizeEl: function () { return this.wrap; }, // private getPositionEl: function () { return this.wrap; }, // private alignErrorIcon: function () { if (this.wrap) { this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]); } }, validateBlur: function () { return true; }, setPrefixSign: function (val) { var value = this.getValue(); this.spinner.prefixSign = val; this.setValue(value); }, setValue: function (val) { if (!isNaN(val)) { val = this.spinner.field.fixPrecision(val); this.spinner.field.setRawValue(this.spinner.prefixSign + this.spinner.moneySign + addFullDigitToNumber(val, this.decimalPrecision)); } else this.spinner.field.setRawValue(this.spinner.prefixSign + this.spinner.moneySign + addFullDigitToNumber(0, this.decimalPrecision)); }, getValue: function () { var rawValue = this.spinner.field.getRawValue(); if (isNaN(rawValue)) { var moneySignLength = this.spinner.moneySign.length; var prefixSignLength = this.spinner.prefixSign.length; rawValue = parseFloat(rawValue.substr(prefixSignLength + moneySignLength, rawValue.length - 1)); return rawValue; } return parseFloat(rawValue); }, validateValue : function(value){ if(this.allowNegative && value.length > 2 && value[0] === '-') { value = value.substring(1, value.length); } if (value.length >= 2 && value[0] == '$' && isNaN(value.substring(1, value.length))){ this.markInvalid(String.format("{0} is not a number", value.substring(1, value.length))); return false; } if (value.length == '' && !this.allowBlank) { this.markInvalid(String.format("Value can not be empty", value)); return false; } if (value.length > 0 && isNaN(value) && value[0] != '$') { this.markInvalid(String.format("{0} is not a number", value)); return false; } return true; } }); Ext.reg('moneyfield', Ext.ux.form.MoneyField); //backwards compat Ext.form.MoneyField = Ext.ux.form.MoneyField; /*! * Ext JS Library 3.3.0 * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license */ Ext.ns('Ext.ux.form'); Ext.ux.form.SearchField = Ext.extend(Ext.form.TwinTriggerField, { initComponent: function () { Ext.ux.form.SearchField.superclass.initComponent.call(this); this.on('specialkey', function (f, e) { if (e.getKey() == e.ENTER) { this.onTrigger2Click(); } }, this); }, ctCls: 'search-field', validationEvent: false, validateOnBlur: false, trigger1Class: 'x-form-clear-trigger', trigger2Class: 'x-form-search-trigger', hideTrigger1: true, width: 180, hasSearch: false, paramName: 'query', onTrigger1Click: function () { if (this.hasSearch) { this.el.dom.value = ''; var o = { start: 0 }; this.store.baseParams = this.store.baseParams || {}; this.store.baseParams[this.paramName] = ''; this.store.filter('stockDesc', '', true); //this.store.reload({ params: o }); this.triggers[0].hide(); this.hasSearch = false; } }, onTrigger2Click: function () { var v = this.getRawValue(); if (v.length < 1) { this.onTrigger1Click(); return; } var o = { start: 0 }; this.store.baseParams = this.store.baseParams || {}; this.store.baseParams[this.paramName] = v; this.store.filter('stockDesc', v, true); //this.store.reload({ params: o }); this.hasSearch = true; this.triggers[0].show(); } }); /* CTB Search field */ Ext.ux.form.CTBSearchField = Ext.extend(Ext.form.TriggerField, { initComponent: function () { Ext.ux.form.CTBSearchField.superclass.initComponent.call(this); }, ctCls: 'search-field', validationEvent: false, validateOnBlur: false, triggerClass: 'x-form-search-trigger', hasSearch: false, paramName: 'query' }); /* CTB Text field */ Ext.ux.form.CTBTextField = Ext.extend(Ext.form.TriggerField, { initComponent: function () { Ext.ux.form.CTBSearchField.superclass.initComponent.call(this); }, ctCls: 'search-field', validationEvent: false, validateOnBlur: false, triggerClass: 'x-form-clear-trigger', hasSearch: false, paramName: 'query', onTriggerClick: function (e) { this.reset(); } }); // Same as above but with TextField as the name Ext.ux.form.TextField = Ext.extend(Ext.form.TriggerField, { initComponent: function () { Ext.ux.form.CTBSearchField.superclass.initComponent.call(this); }, ctCls: 'search-field', validationEvent: false, validateOnBlur: false, triggerClass: 'x-form-clear-trigger', hasSearch: false, paramName: 'query', onTriggerClick: function (e) { this.reset(); } }); Ext.CTBTemplatePanel = Ext.extend(Ext.Panel, { //layout : 'border', loadMask: null, value : '', frame : false, width : 150, bodyBorder : false, tpl : new Ext.XTemplate( '', '
', '', '', '', '', '
{value}
', '
', '
' ), fontSize : 11, roundDecimal : 2, textAlign : 'center', tableWidth : 'auto', height : 30, listeners : { afterrender : function(theThis){ // Init loadMask theThis.loadMask = new Ext.LoadMask(this.getEl(), {msg:"Please wait..."}); theThis.setValue(theThis.value); } }, setValue : function(val){ var theThis = this; theThis.value = val; if (theThis.rendered) { theThis.update({tableWidth : theThis.tableWidth, textAlign : theThis.textAlign, fontSize : theThis.fontSize, value : theThis.value}); } }, getValue : function(val){ var theThis = this; return theThis.value; }, initComponent: function(){ var theThis = this; //theThis.items = [theThis.pnl_FoodCostTable, theThis.pnl_ExtraButtons]; // Call super class to initialize componenets Ext.CTBTemplatePanel.superclass.initComponent.call(this); } }); Ext.reg('CTBTemplatePanel', Ext.CTBTemplatePanel); Ext.CTBTemplateNumberPanel = Ext.extend(Ext.Panel, { //layout : 'border', loadMask: null, value : 0, frame : true, bodyBorder : false, postfix : null, prefix : null, setPostfix: function(postfix){ var theThis = this; theThis.postfix = postfix; }, setPrefix: function(prefix){ var theThis = this; theThis.prefix = prefix; }, showEditor : false, fontSize : 15, labelField : '', hideLabel : false, roundDecimal : 2, textAlign : 'center', tableWidth : 'auto', formatClass : Ext.util.Format.usMoney, height : 30, txt_Value : null, callback_Update : null, callback_MarkChanges : null, listeners : { afterrender : function(theThis){ // Init loadMask theThis.loadMask = new Ext.LoadMask(this.getEl(), {msg:"Please wait..."}); theThis.setValue(theThis.value); } }, setValue : function(val){ var theThis = this; theThis.value = roundNumber(val, theThis.roundDecimal); if (theThis.rendered) { var displayValue = theThis.formatClass == null ? theThis.value : theThis.formatClass(theThis.value); if (theThis.postfix != null) displayValue += (' ' + theThis.postfix); theThis.update({uniqueId : theThis.id, tableWidth : theThis.tableWidth, textAlign : theThis.textAlign, fontSize : theThis.fontSize, labelField : theThis.labelField, value : displayValue}); if (theThis.showEditor) { theThis.txt_Value = new Ext.form.NumberField({ renderTo : theThis.id + '_Value', allowBlank: false, allowNegative: false, minValue: 0, allowDecimals: false, decimalPrecision: 0, incrementValue: 1, alternateIncrementValue: 2.1, accelerate: true, width : 140, enableKeyEvents: true, value : theThis.value, listeners : { spin : function(p_field, p_down, p_alternative){ if (theThis.callback_Update != null) theThis.callback_Update(); //theThis.parent_RecipeBook.tab_Costing2.updateCostingCalculationInternal(); }, keypress : function(textField, eventObject){ if (theThis.callback_MarkChanges != null) theThis.callback_MarkChanges(); //theThis.parent_RecipeBook.doWeHaveChanges = true; }, keyup : function(textField, eventObject){ if (theThis.callback_MarkChanges != null) theThis.callback_MarkChanges(); if (textField.isValid()) { if (theThis.callback_Update != null) theThis.callback_Update(); } //theThis.parent_RecipeBook.doWeHaveChanges = true; }, specialkey: function(f,e){ if (e.getKey() == e.ENTER) { if (theThis.callback_Update != null) theThis.callback_Update(); } }, change : function(textField, newValue, oldValue){ if (theThis.callback_MarkChanges != null) theThis.callback_MarkChanges(); //theThis.parent_RecipeBook.doWeHaveChanges = true; } }, onBlur : function(p_field){ if (theThis.callback_Update != null) theThis.callback_Update(); //theThis.parent_RecipeBook.tab_Costing2.updateCostingCalculationInternal(); } }); } } }, getValue : function(val){ var theThis = this; if (theThis.txt_Value != null && theThis.txt_Value.isValid()) theThis.value = theThis.txt_Value.getValue(); return theThis.value; }, initComponent: function(){ var theThis = this; if (theThis.hideLabel) theThis.tpl = new Ext.XTemplate( '', '
', '', '', '', '', '
{value}
', '
', '
' ); else { theThis.tpl = new Ext.XTemplate( '', '
', '', '', '', '', '', '
{labelField}:', theThis.showEditor == false ? '{value}' : '
', '
', '
', '
' ); } //theThis.items = [theThis.pnl_FoodCostTable, theThis.pnl_ExtraButtons]; // Call super class to initialize componenets Ext.CTBTemplateNumberPanel.superclass.initComponent.call(this); } }); Ext.reg('CTBTemplateNumberPanel', Ext.CTBTemplateNumberPanel); Ext.CTBUploadFileDialog = Ext.extend(Ext.Window, { layout: 'fit', cls: '', width: 500, height: 220, //height: 500, closeAction: 'hide', closable: false, resizable: false, modal: true, plain: true, title: 'Please select an image in your computer ..', description: '(Only JPG, PNG, and GIF images under 500 KB will be accepted)', uploadURL: '', uploadParams : {}, waitingMessage: 'Uploading the new image...', isUpload: false, isUploadPurchaseOrderTemplate: false, callback_UploadSuccess: null, callback_BeforeSave: null, buttonAlign: 'left', listeners : { scope : this, beforeshow : function(p_This){ }, beforehide : function(p_This){ }, show : function(p_This){ }, hide : function(p_This){ } }, initComponent : function(){ var theThis = this; theThis.frm_Upload = theThis.getUploadForm(theThis.description); this.items = [theThis.frm_Upload]; this.buttons = [ // theThis_btnUploadTemplate = new Ext.Button({ // text: 'Download Template', // iconCls: '', scale: 'large', // hidden: !theThis.isUploadPurchaseOrderTemplate, // handler: function(){ // window.open('ExcelTemplate/StockOrderTemplate.xlsx', '_blank'); // } // }), theThis.isUploadPurchaseOrderTemplate ? 'Download Template' : '', '->', theThis.btn_Save = new Ext.Button({ text: theThis.isUpload ? 'Upload' : 'Save', iconCls: 'icon-save-large', scale: 'large', handler: function() { if (theThis.callback_BeforeSave != null) theThis.callback_BeforeSave(); if (theThis.frm_Upload.getForm().isValid()) { theThis.frm_Upload.getForm().submit({ url: theThis.uploadURL, params: theThis.uploadParams, waitMsg: theThis.waitingMessage, success: function(form, action) { if (action.result.message.IsSuccess) { if (theThis.callback_UploadSuccess != null) theThis.callback_UploadSuccess(action.result); } else { showErrorMessageWithEmailNotify(action.result.message.Info); } }, failure: function(form, action) { showErrorMessageWithEmailNotify(action.result.message.Info); } }); theThis.hide(); } } }), theThis.btn_Cancel = new Ext.Button({ text: 'Cancel', iconCls: 'icon-cancel-large', scale: 'large', handler: function() { theThis.hide(); } }) ]; 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(); } }, getUploadForm : function(description){ var frm_Upload = new Ext.FormPanel({ fileUpload: true, width: 400, frame: true, title: String.format('{0}', description), height: 175, //region: 'center', bodyStyle: 'padding: 10px 5px 0 0;', labelWidth: 40, defaults: { anchor: '100%', allowBlank: false, msgTarget: 'side' }, items: [ { xtype: 'fileuploadfield', // id: 'form-file', emptyText: '', fieldLabel: 'Name', name: 'photo-path', accept : 'jpg;png', buttonText: 'Add file', validator: function(val) { return (val != null && val.trim().length > 0) ? true : "Please select a file"; }, buttonCfg: { //iconCls: 'icon-upload-image' } } ] }); // End frm_UploadForm return frm_Upload; } }); Ext.reg('CTBUploadFileDialog', Ext.CTBUploadFileDialog); Ext.CTBSWFUploadFileDialog = Ext.extend(Ext.Window, { layout: 'border', width: 440, height: 300, closeAction: 'hide', closable: false, resizable: false, modal: true, plain: true, title: 'Upload Photo', description: 'Please select an image in your computer.
(only JPG, PNG and GIF images will be accepted)', uploadURL: '', uploadParams : {}, waitingMessage: 'Uploading the new image...', file_types : "*.jpg;*.gif;*.png", file_types_description : "Image Files", callback_UploadSuccess : null, callback_BeforeSave : null, callback_BeforeShow : null, mediaFolderId : null, listeners : { scope : this, beforeshow : function(p_This){ }, beforehide : function(p_This){ }, show : function(p_This){ if (p_This.callback_BeforeShow != null) p_This.callback_BeforeShow(); if (p_This.swfUpload != null) delete p_This.swfUpload; p_This.tpl_SWFUploader.overwrite(p_This.pnl_TestSWF.body, {description:p_This.description}); p_This.swfUpload = p_This.getSWFUpload(Global_DatabaseName, p_This.mediaFolderId); }, hide : function(p_This){ } }, initComponent : function(){ var theThis = this; theThis.tpl_SWFUploader = new Ext.XTemplate( '
', '
{description}
', '
', 'Upload Media File', '
', '
', '', '', '
', '
', '
' ); theThis.pnl_TestSWF = new Ext.Panel({ //title : theThis.description, region : 'center', tpl : theThis.tpl_SWFUploader, autoScroll : true, listeners : { } }); this.items = [theThis.pnl_TestSWF]; this.buttons = [ /*theThis.btn_Save = new Ext.Button({ text: 'Save', iconCls: 'icon-save-large', scale: 'large', handler: function() { if (theThis.callback_BeforeSave != null) theThis.callback_BeforeSave(); if (theThis.frm_Upload.getForm().isValid()) { theThis.frm_Upload.getForm().submit({ url: theThis.uploadURL, params: theThis.uploadParams, waitMsg: theThis.waitingMessage, success: function(form, action) { if (action.result.message.IsSuccess) { if (theThis.callback_UploadSuccess != null) theThis.callback_UploadSuccess(action.result); } else { showErrorMessageWithEmailNotify(action.result.message.Info); } }, failure: function(form, action) { showErrorMessageWithEmailNotify(action.result.message.Info); } }); } theThis.hide(); } }),*/ theThis.btn_Cancel = new Ext.Button({ text: 'Close', iconCls: 'icon-cancel-large', scale: 'large', handler: function() { theThis.hide(); if (theThis.swfUpload != null) cancelQueue(theThis.swfUpload); if (theThis.callback_Cancel != null) theThis.callback_Cancel(); } }) ]; 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(); } }, getSWFUpload : function(databaseName, mediaFolderId){ var theThis = this; var swfUploader = new SWFUpload({ // Backend Settings upload_url: theThis.uploadURL,//"/MediaManager/TestSWFUpload", post_params: { "databaseName" : databaseName, "mediaFolderId" : mediaFolderId }, // File Upload Settings file_size_limit : "10240", // 10MB file_types : theThis.file_types, file_types_description : theThis.file_types_description, file_upload_limit : "100", file_queue_limit : "100", // Event Handler Settings (all my handlers are in the Handler.js file) file_dialog_start_handler : fileDialogStart, file_queued_handler : fileQueued, file_queue_error_handler : fileQueueError, file_dialog_complete_handler : fileDialogComplete, upload_start_handler : uploadStart, upload_progress_handler : uploadProgress, upload_error_handler : uploadError, upload_success_handler : uploadSuccess, upload_complete_handler : uploadComplete, // Button Settings button_image_url : "/Content/custom/images/XPButtonUploadText_61x22.png", button_placeholder_id : "spanButtonPlaceholder1", button_width: 61, button_height: 22, // Flash Settings flash_url : "/Scripts/custom/swfupload/swfupload.swf", swfupload_element_id : "flashUI1", // Setting from graceful degradation plugin degraded_element_id : "degradedUI1", // Setting from graceful degradation plugin custom_settings : { progressTarget : "fsUploadProgress1", cancelButtonId : "btnCancel1" }, // Debug Settings debug: false }); return swfUploader; } }); Ext.reg('CTBSWFUploadFileDialog', Ext.CTBSWFUploadFileDialog); Ext.CTBReportDownloader = Ext.extend(Ext.Window, { id: 'CTBReportDownloader_CMP', layout: 'border', closeAction: 'close', expandOnShow: true, closable: false, resizable: false, modal: true, plain: true, minimizable: false, maximizable: false, monitorResize: true, width: 750, height: 500, shadow: false, cls: 'ctb-report-download-dialog', bodyBorder: false, frame: false, alignToComponentID: null, unstyled: true, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, pageSize: CTB.init.itemPerPage || 100, isHiding: false, // This is using for pending the hiding event for 3 seconds afterHideCallBack: null, advertisementRecord: null, reportId: null, hideDownloadExcel: true, hideDownloadPdf: false, hideSendEmail: false, setReportId: function (reportId, isUsedDefault) { console.log(isUsedDefault,reportId); if(typeof isUsedDefault != 'undefined' && isUsedDefault == true) { this.reportId = reportId; this.pdfUrl = reportId; this.excelUrl = reportId; } else { this.reportId = reportId; this.pdfUrl = '/aspx/DisplayReport.aspx?r_id=' + reportId; this.excelUrl = '/aspx/DisplayReportXLS.aspx?r_id=' + reportId; } }, setPdfUrl: function(pdfUrl) { this.pdfUrl = pdfUrl; this.hideDownloadPdf = false; }, setExcelUrl: function(excelUrl) { this.excelUrl = excelUrl; this.hideDownloadExcel = false; }, callbackFunc: null, setAdsData: function (advertisementRecord) { var theThis = this; //this.adsPanel.tpl.overwrite(this.adsPanel.getEl(), advertisementRecord); theThis.advertisementRecord = advertisementRecord; //theThis.findOutMoreButton.videoID = advertisementRecord.advertisementVideoID; theThis.pnl_Content.update({ uniqueId: theThis.id, advertisementRecord: theThis.advertisementRecord, //reportId: theThis.reportId, pdfUrl: theThis.pdfUrl, excelUrl: theThis.excelUrl, hideDownloadExcel: theThis.hideDownloadExcel, hideDownloadPdf: theThis.hideDownloadPdf, hideSendEmail: theThis.hideSendEmail }); //TOM UPDATE // Is ads from somewhere else if (Global_Ads_From_CTBAds == false) { Ext.get(theThis.id + '_MoreInfo').on('click', function (theButton) { if (theThis.advertisementRecord.advertisementVideoID != null) showHelpVideo(theThis.advertisementRecord.advertisementVideoID, false); }); Ext.get(theThis.id + '_Contact').on('click', function (theButton) { if (theThis.advertisementRecord != null) { theThis.loadMask.show(); var advertisementId = theThis.advertisementRecord.advertisementId; Ext.Ajax.request({ method: 'POST', url: '/Advertisement/GetContactLetter', params: { advertisementId: advertisementId }, success: function (result, request) { theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { Ext.getCmp('dlg_Mailbox').setMailbox_Recipients(jsonData.data.recipients); Ext.getCmp('dlg_Mailbox').setReportCode(RP_AdvertisementContact); Ext.getCmp('dlg_Mailbox').setSubject('Cooking the Books - Contact about Advertisement'); Ext.getCmp('dlg_Mailbox').setContent(decodeURI(jsonData.data.contactLetterContent)); Ext.getCmp('dlg_Mailbox').setMailbox_RecordId(advertisementId); Ext.getCmp('dlg_Mailbox').show(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { theThis.loadMask.hide(); } }); // End ajax } }); theThis.GetAdvertisementStockOrderForClient = function (isAllowImportSupplier) { theThis.loadMask.show(); var advertisementId = theThis.advertisementRecord.advertisementId; Ext.Ajax.request({ method: 'POST', url: '/Advertisement/GetAdvertisementStockOrderForClient', params: { advertisementId: advertisementId, isAllowImportSupplier: isAllowImportSupplier }, success: function (result, request) { theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { if (jsonData.data.isHavingOrder) { if (jsonData.data.isNeedImportSupplier) { showConfirmMessage(String.format('Do you want to import the supplier "{0}" to your database ?', jsonData.data.supplierName), function () { theThis.GetAdvertisementStockOrderForClient(true); }); } else { showConfirmMessage('Do you want to place an order now ?', function () { var cookie = new Ext.state.CookieProvider; cookie.set("page", "newElectronicOrder"); cookie.set("stockOrderId", jsonData.data.stockOrderId); window.location = "/Stock/Index"; }); } } else { showErrorNotification('Notice', 'This ads didn\'t include order.'); } } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { theThis.loadMask.hide(); } }); // End ajax } Ext.get(theThis.id + '_Order').on('click', function (theButton) { theThis.GetAdvertisementStockOrderForClient(false); }); } var btnCancel = Ext.get(theThis.id + '_Cancel'); if(btnCancel) btnCancel.on('click', function (theButton) { theThis.hide(); }); var btnSendEmail = Ext.get(theThis.id + '_SendEmail'); if(btnSendEmail) btnSendEmail.on('click', function (theButton) { Global_ContactBrowser_CallbackFunction = function (selectedRecords) { var recipients = ""; for (var i = 0; i < selectedRecords.length; i++) { var contactEmail = selectedRecords[i].data.email; if (contactEmail != null && validateEmail(contactEmail)) { recipients += (contactEmail + ";"); } } // Init the mail data setMailbox_ReportCode(theThis.reportId); setMailbox_Recipients(recipients); setMailbox_Subject('CTB Report'); Ext.getCmp('dlg_Mailbox').show(); } Ext.getCmp('dlg_ContactBrowser').show(); }); // Is ads from central if (Global_Ads_From_CTBAds == true) { //TOM WORKING //order var ctbAdsOrders = null; if(Ext.get(theThis.id + '_Order') != null) { Ext.get(theThis.id + '_Order').on('click', function (theButton) { //register window ctbAdsOrders = new Ext.CTBAdsOrdersWindow(); var arData = []; //fill data for (var index = 0; index < Global_RandomAds_Record.APIProductAds.length; index++) { var product = Global_RandomAds_Record.APIProductAds[index]; var itemArr = [ Global_RandomAds_Record.AdvSupplierId, Global_RandomAds_Record.AdvSupplierABNNo, Global_RandomAds_Record.AdvSupplierCompany, Global_RandomAds_Record.AdvSupplierWebsite, product.AdvProductId, product.AdvProductCode, product.AdvProductName, product.AdvProductDescription, product.AdvProductAmount, product.AdvProductUnit, product.AdvProductPackageType, product.AdvProductPrice, 0, 0, product.AdvProductTypeId, Global_RandomAds_Record.AdvId ]; arData.push(itemArr); } var store = ctbAdsOrders.grid_CTBAdsOrders.grid_AdsOrders.getStore(); store.loadData(arData); ctbAdsOrders.show(); //add click event for statistic Ext.Ajax.request({ useDefaultXhrHeader: false, cors: true, method: "POST", url: CTB_ADS_HOST + '/api/APIAdvertisement/ClickEvent/' + Global_RandomAds_Record.AdvId, success: function (result, request) { }, failure: function (result, request) { //setTimeout("GetRandomAdvertisement()", 60000); } }); }); } //contact var ctbAdsContact = null; if(Ext.get(theThis.id + '_Contact') != null) { Ext.get(theThis.id + '_Contact').on('click', function (theButton) { ctbAdsContact = new Ext.CTBAdsContactWindow(); ctbAdsContact.AdvId = Global_RandomAds_Record.AdvId ctbAdsContact.lbl_To_Label.setValue(Global_RandomAds_Record.AdvTitle + " Provider"); ctbAdsContact.show(); //add click event for statistic Ext.Ajax.request({ useDefaultXhrHeader: false, cors: true, method: "POST", url: CTB_ADS_HOST + '/api/APIAdvertisement/ClickEvent/' + Global_RandomAds_Record.AdvId, success: function (result, request) { }, failure: function (result, request) { //setTimeout("GetRandomAdvertisement()", 60000); } }); }); } //contact var ctbAdsSample = null; if(Ext.get(theThis.id + '_Sample') != null) { Ext.get(theThis.id + '_Sample').on('click', function (theButton) { ctbAdsSample = new Ext.CTBAdsSampleWindow(); ctbAdsSample.AdvId = Global_RandomAds_Record.AdvId ctbAdsSample.show(); //add click event for statistic Ext.Ajax.request({ useDefaultXhrHeader: false, cors: true, method: "POST", url: CTB_ADS_HOST + '/api/APIAdvertisement/ClickEvent/' + Global_RandomAds_Record.AdvId, success: function (result, request) { }, failure: function (result, request) { //setTimeout("GetRandomAdvertisement()", 60000); } }); }); } //more infor var ctbAdsMoreInfo = null; if(Ext.get(theThis.id + '_MoreInfo') != null) { Ext.get(theThis.id + '_MoreInfo').on('click', function(theButton) { //window.open("http://"+ Global_RandomAds_Record.AdvProLink, '_blank'); ctbAdsMoreInfo = new Ext.CTBAdsMoreInfoWindow(); ctbAdsMoreInfo.setData(Global_RandomAds_Record); ctbAdsMoreInfo.show(); //add click event for statistic Ext.Ajax.request({ useDefaultXhrHeader: false, cors: true, method: "POST", url: CTB_ADS_HOST + '/api/APIAdvertisement/ClickEvent/' + Global_RandomAds_Record.AdvId, success: function (result, request) { }, failure: function (result, request) { //setTimeout("GetRandomAdvertisement()", 60000); } }); }); } } }, setAfterHideCallbackFunction: function (callbackFunction) { this.afterHideCallBack = callbackFunction; }, listeners: { beforehide: function (theThis) { theThis.pnl_ContentContainer && theThis.pnl_ContentContainer.destroy() theThis.pnl_ContentContainer = null; }, show: function (theThis) { // Fit this window to the client browser screen with 90% theThis.isHiding = false; if (Global_RandomAds_Record != null) { if (Global_RandomAds_Record.advertisementImageWidth < 400 && Global_RandomAds_Record.advertisementImageWidth != 0) { var percentChange = roundNumber(400 / Global_RandomAds_Record.advertisementImageWidth, 2); Global_RandomAds_Record.advertisementImageWidth = 400; Global_RandomAds_Record.advertisementImageHeight = roundNumber(Global_RandomAds_Record.advertisementImageHeight * percentChange, 2); } theThis.setAdsData(Global_RandomAds_Record); } else { GetRandomAdvertisement(function () { if (Global_RandomAds_Record != null) { if (Global_RandomAds_Record.advertisementImageWidth < 400 && Global_RandomAds_Record.advertisementImageWidth != 0) { var percentChange = roundNumber(400 / Global_RandomAds_Record.advertisementImageWidth, 2); Global_RandomAds_Record.advertisementImageWidth = 400; Global_RandomAds_Record.advertisementImageHeight = roundNumber(Global_RandomAds_Record.advertisementImageHeight * percentChange, 2); } theThis.setAdsData(Global_RandomAds_Record); } }); } }, hide: function(theThis){ if(theThis.callbackFunc) { theThis.callbackFunc(); } } }, initComponent: function () { var theThis = this; theThis.tpl_PinBoard = theThis.getTemplate(); theThis.items = [ theThis.pnl_ContentContainer = new Ext.Panel({ region: 'center', items: [ new Ext.Panel({ tpl: theThis.tpl_PinBoard, listeners: { afterrender: function(pThis){ theThis.pnl_Content = pThis; } } }) ], frame: false, bodyCfg: { cls: 'x-panel-custombody-transparent' // Default class not applied if Custom element specified }, border: false, autoScroll: false, listeners: { afterrender: function (p_This) { theThis.loadMask = new Ext.LoadMask(p_This.getEl(), { msg: "Please wait..." }); } } }) ]; // BUTTONS var myButtons = theThis.initButtons(); this.buttons = myButtons; this.initTools(); Ext.CTBReportDownloader.superclass.initComponent.call(this); }, getTemplate: function () { //TOM UPDATE var theThis = this; var iconLoadMaskAdsCTBLogo = '';//'/Content/custom/images/icon-loadmaskads-ctblogo.png'; var iconPinBoardClose = '/Content/custom/images/pinboard/icon-pinboard-close-white.png'; var iconOrder = '/Content/custom/images/ads/order_icon.png'; var iconContact = '/Content/custom/images/ads/contact_icon.png'; var iconMoreInfo = '/Content/custom/images/ads/more_info_icon.png'; var iconDownloadXLS = '/Content/custom/images/ads/download-xls_icon.png'; var iconDownloadPdf = '/Content/custom/images/ads/download_pdf_icon.png'; var iconSendEmail = '/Content/custom/images/ads/send_email_icon.png'; var iconCancel = '/Content/custom/images/ads/cancel_icon.png'; var tpl_PinBoard = null; // Is ads from somewhere else if (Global_Ads_From_CTBAds == false) { tpl_PinBoard = new Ext.XTemplate( '', '', '', '', '', '
', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', //'', '', '', '
CONTACTMORE INFO   ORDER
{advertisementDescription}
Your report is ready
', 'Download XLS       ', 'Download PDF       ', 'Cancel       ', 'Send email', '
', '
', '
' ); } // Is ads from central else { var templateHtml = ''; var templateHtmlBtn = ''; //var btn_MoreInfoHtml = ''; var btn_MoreInfoHtml = ''; var btn_Contact = ''; var iconTopLeft = ''; var btn_Sample = ''; if (Global_RandomAds_Record != null && Global_RandomAds_Record.APIProductAds != null) { btn_MoreInfoHtml = 'MORE INFO'; btn_Sample = 'SAMPLE'; btn_Contact = 'CONTACT'; iconTopLeft = '/Content/custom/images/ads/check_it_out_icon.png'; //debug('Global_RandomAds_Record' + 'not null'); //Image if(Global_RandomAds_Record.AdvHTML != null) { Global_RandomAds_Record.AdvHTML= 'https://' + Global_RandomAds_Record.AdvHTML.replace(/^https?\:\/\//i, ''); templateHtml = ''; } else if (Global_RandomAds_Record.AdvUploadType == 1 || Global_RandomAds_Record.AdvUploadType == 2) { templateHtml = '{AdvProductDescription}'; } else { templateHtml = ''; } // product => order if (Global_RandomAds_Record.APIProductAds != null && Global_RandomAds_Record.APIProductAds.length > 0 && Global_RandomAds_Record.APIProductAds[0].AdvProductTypeId == 1) { //templateHtmlBtn = ''; templateHtmlBtn = 'ORDER' } } tpl_PinBoard = new Ext.XTemplate( '', '', '', '', '', '
', '', //'', // '', //'', //'', // '', // '', // '', // '', //'', '', '', templateHtml, '', '', '', '', '', //'', // //'', //'', '
CONTACTMORE INFO   ORDER
', //'
Your report is ready
', '
', 'Download XLS', //'', 'Download PDF', //'', //'Cancel', 'Send Email', '
', '
', '
', '
', templateHtmlBtn, '
', '
', btn_Contact,'
', '
', btn_Sample, '
', '
', btn_MoreInfoHtml, '
', //'
', '
', '
', '
' ); } return tpl_PinBoard; }, initButtons: function () { var theThis = this; var buttons = []; return buttons; } }); Ext.reg('CTBReportDownloader', Ext.CTBReportDownloader); Ext.CTBAdsOrdersWindow = Ext.extend(Ext.Window, { //id: 'myWin', title: 'Order Form', layout: 'border', closeAction: 'hide', iconCls: '', cls: 'ctb-report-download-form', modal: true, //lain: true, minimizable: true, maximizable: true, monitorResize: true, width: 750, height: 440, shawdow: false, //rame: false, //nstyled: true, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, initComponent: function () { var theThis = this; theThis.items = [ theThis.grid_CTBAdsOrders = new Ext.CTBAdsOrdersGrid(), ]; // BUTTONS var myButtons = theThis.initButtons(); this.buttons = myButtons; this.initTools(); Ext.CTBAdsOrdersWindow.superclass.initComponent.call(this); }, initButtons: function () { var theThis = this; var buttons = [ //order button theThis.btn_Order = new Ext.Button({ text: 'Order', iconCls: 'icon-ok-large ', scale: 'large', handler: function () { theThis.save(); theThis.grid_CTBAdsOrders.getGrid_Orders().stopEditing(); } }), //cancel button theThis.btn_Cancel = new Ext.Button({ text: 'Cancel', iconCls: 'icon-cancel-large', scale: 'large', handler: function () { theThis.hide(); } }) ]; return buttons; }, save: function (callbackFunction) { var theThis = this; var stockOrders = null; var notes = theThis.grid_CTBAdsOrders.txt_Contents.getValue(); var modifiedRecords = theThis.grid_CTBAdsOrders.grid_AdsOrders.getStore().getModifiedRecords(); if (modifiedRecords.length > 0) { var stockOrders = new Array(); var stockOrderTotal = 0; var arrOrderLine = []; for (var i = 0; i < modifiedRecords.length; i++){ stockOrders[i] = { stockGUID: modifiedRecords[i].data.AdvProductId, stockCode: modifiedRecords[i].data.AdvProductCode, stockDesc: modifiedRecords[i].data.AdvProductName, stockUnit: modifiedRecords[i].data.AdvProductAmount, stockUnitOfMeasurement: modifiedRecords[i].data.AdvProductUnit, stockSupplierCost: modifiedRecords[i].data.AdvProductPrice, stockSupplierSellingUnit: modifiedRecords[i].data.AdvProductAmount, stockSupplierUnitMeasurement: modifiedRecords[i].data.AdvProductPackageType, stockQty: modifiedRecords[i].data.AdvProductQuantity, stockOrderCost: modifiedRecords[i].data.AdvProductPrice, stockOrderSubtotal: modifiedRecords[i].data.AdvProductTotal, notes: notes }; stockOrderTotal += (modifiedRecords[i].data.AdvProductQuantity * modifiedRecords[i].data.AdvProductPrice); var orderLine = { productId: modifiedRecords[i].data.AdvProductId, orderLineQuantity: modifiedRecords[i].data.AdvProductQuantity, orderLineUnitPrice: modifiedRecords[i].data.AdvProductPrice, orderLineTotalPrice: modifiedRecords[i].data.AdvProductTotal }; arrOrderLine.push(orderLine); } var orderForCTB = { supplierGUID: modifiedRecords[0].data.AdvSupplierId, supplierName: modifiedRecords[0].data.AdvSupplierCompany, supplierABNNo: modifiedRecords[0].data.AdvSupplierABNNo, supplierWebsite: modifiedRecords[0].data.AdvSupplierWebsite, stockOrderNo: getUniqueTime(), stockOrderTotal: stockOrderTotal, stockOrders: stockOrders }; var userInfo = getUserInfoForOrder(function(userInfo){ var order = { orderTotalPrice: stockOrderTotal, orderCusName: userInfo.userName, orderCusPhone: userInfo.companyPhoneNo, orderCusEmail: userInfo.userEmail, orderCusAddress: userInfo.companyAddress, orderCusCompany : userInfo.companyName, advertisementId: modifiedRecords[0].data.AdvertisementId, OrderLines: arrOrderLine, orderNotes: notes }; //request to CTB Ext.Ajax.request({ method: 'POST', url: '/AdsStockOrder/AddNewStockOrderFromCTBAds', params: { orderForCTB: Ext.util.JSON.encode(orderForCTB) }, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { //showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); //theThis.Global_StockBrowser_SelectedRecords = jsonData.data; //callback_Function(); // jsonData.data is a list of stockSupplierIds returned //request to CTB Ads Ext.lib.Ajax.useDefaultXhrHeader = false; Ext.Ajax.request({ method: "POST", url: CTB_ADS_HOST + '/api/APIAdvertisement/AddOrder', jsonData: Ext.util.JSON.encode(order), success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); //alert messages success showSuccessNotification("Order Successfully !", NOTIFICATION.ICON_INFORMATION); theThis.hide(); }, failure: function (result, request) { //setTimeout("GetRandomAdvertisement()", 60000); } }); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { theThis.tab_Recipe.loadMask.hide(); } }); }); } else { //error message var myToolTip = new Ext.ToolTip({ target: '', html: "Quantity has to be greater than 0", title: 'We have a problem', autoHide: true, anchor: 'right', closable: true, draggable: true, dismissDelay: 5000 // Close in 5 seconds }); var x = theThis.getEl().getX(); var y = theThis.getEl().getY(); var width = theThis.getEl().getWidth(); x = x + width; y = y; myToolTip.showAt([x, y]); theThis.getEl().frame('#FF0000'); } } }); Ext.reg('CTBAdsOrdersWindow', Ext.CTBAdsOrdersWindow); Ext.CTBAdsOrdersGrid = Ext.extend(Ext.Panel, { //itemId : 'CTBAdsOrdersGridPanel', layout: 'border', region: 'center', pageSize: CTB.init.itemPerPage || 100, border: false, loadMask: null, initComponent: function () { var theThis = this; // gen Items theThis.grid_AdsOrders = theThis.getGrid_Orders(); // add Items theThis.items = [ theThis.grid_AdsOrders, theThis.panel_Notes = new Ext.Panel({ layout: 'border', region: 'center', border: false, items: [ { xtype: 'container', html: 'Notes:', region: 'north', margins: '15 10 0 10' }, theThis.txt_Contents = new Ext.form.TextArea({ margins: '10 10 10 10', region: "center", fieldLabel: 'Notes', value: '', anchor: '100% 70%', }) ] }) ]; // Ext.CTBAdsOrdersGrid.superclass.initComponent.call(this); }, getGrid_Orders: function () { var theThis = this; // shorthand alias var fm = Ext.form; // *************************************************************************************************** // Data Fields // *************************************************************************************************** theThis.recordObject = Ext.data.Record.create([ { name: 'AdvSupplierId', type: 'string' }, { name: 'AdvSupplierABNNo', type: 'string' }, { name: 'AdvSupplierCompany', type: 'string' }, { name: 'AdvSupplierWebsite', type: 'string' }, { name: 'AdvProductId', type: 'string' }, { name: 'AdvProductCode', type: 'string' }, { name: 'AdvProductName', type: 'string' }, { name: 'AdvProductDescription', type: 'string' }, { name: 'AdvProductAmount', type: 'number' }, { name: 'AdvProductUnit', type: 'string' }, { name: 'AdvProductPackageType', type: 'string' }, { name: 'AdvProductPrice', type: 'number' }, { name: 'AdvProductQuantity', type: 'number' }, { name: 'AdvProductTotal', type: 'number' }, { name: 'AdvProductTypeId', type: 'number' }, { name: 'AdvertisementId', type: 'string' } ]); // *************************************************************************************************** // Store Fields // *************************************************************************************************** theThis.store = new Ext.data.ArrayStore({ autoDestroy: true, idIndex: 4, fields: theThis.recordObject, listeners: { load: function(store, records) { console.log(records.length); } } }); // *************************************************************************************************** // Selection model // *************************************************************************************************** var sm = new Ext.grid.CheckboxSelectionModel({ listeners: { // On selection change, set enabled state of the removeButton // which was placed into the GridPanel using the ref config selectionchange: function (sm) { } } }); // *************************************************************************************************** // Column model // *************************************************************************************************** // Column Models var cm = new Ext.grid.ColumnModel({ // specify any defaults for each column columns: [ { header: 'AdvSupplierId', dataIndex: 'AdvSupplierId', hidden: true, width: 5 }, { header: 'AdvSupplierABNNo', dataIndex: 'AdvSupplierABNNo', hidden: true, width: 5 }, { header: 'AdvSupplierCompany', dataIndex: 'AdvSupplierCompany', hidden: true, width: 5 }, { header: 'Product Id', dataIndex: 'AdvertisementId', hidden: true, width: 5 }, { header: 'Product Id', dataIndex: 'AdvProductId', hidden: true, width: 5 }, { header: 'Product Type Id', dataIndex: 'AdvProductTypeId', hidden: true, width: 5 }, { header: 'Code', dataIndex: 'AdvProductCode', width: 10 }, { header: 'Name', dataIndex: 'AdvProductName', width: 30 }, { header: 'Description', dataIndex: 'AdvProductDescription', hidden: true, width: 30 }, { header: 'Amount', dataIndex: 'AdvProductAmount', width: 15 }, { header: 'Unit', dataIndex: 'AdvProductUnit', width: 15 }, { header: 'Package Type', dataIndex: 'AdvProductPackageType', width: 15 }, { header: 'Price', dataIndex: 'AdvProductPrice', width: 15, renderer: Ext.util.Format.usMoney }, { header: 'Quantity' + CTB_SYMBOL.EDIT, dataIndex: 'AdvProductQuantity', width: 15, editor: new Ext.grid.GridEditor( new Ext.form.SpinnerField({ xtype: 'spinnerfield', allowBlank: false, allowNegative: false, minValue: 0, //allowDecimals : true, //decimalPrecision: 3, onFocus: function (txt, e) { this.getEl().dom.select(); } }), { listeners: { beforestartedit: function (editor) { editor.field.currentRecord = editor.record; }, complete: function (p_This, p_Value, p_StartValue) { // Value has been changed by user if (p_Value > 0) { if (p_Value != p_StartValue) { var total = p_This.record.get('AdvProductPrice') * p_Value; p_This.record.set('AdvProductTotal', total); } } } } } ) }, { header: 'Total Cost', dataIndex: 'AdvProductTotal', width: 15, renderer: Ext.util.Format.usMoney } ] }); // *************************************************************************************************** // Grid // *************************************************************************************************** var grid = new Ext.grid.EditorGridPanel({ region: 'north', margins: '15 10 0 5', frame: false, //plugins: [new Ext.ux.grid.GridHeaderFilters()], UpdateTotalCost: function (theRecord) { UpdateTotalCost(theRecord); }, listeners: { rowclick: function (p_this, p_rowIndex, p_eventObject) { /* var selectedRow = p_this.getView().getRow(p_rowIndex); Ext.get(selectedRow).highlight(); if (theThis.parentWindowContainer != null && theThis.isCalculateParentField) { theThis.parentWindowContainer.pnl_InvoiceDetail_NumberPad.callback_Assign = function(value){ theThis.getGrid().stopEditing(); var selectedRecords = theThis.getGrid().getSelectionModel().getSelections(); if (selectedRecords.length > 0){ for (var i = 0; i < selectedRecords.length; i++){ UpdateTotalCost(selectedRecords[i]); } } }; }*/ //theThis.getGrid().startEditing(p_rowIndex, 7); // Only stop editing if user's using iPad // We don't want them to see the default keyboard in iPad //if (Global_IsiPad) //theThis.getGrid().stopEditing(); } }, sm: sm, cm: cm, store: theThis.store, width: 800, height: 200, autoHeight: false, clicksToEdit: 1, loadMask: true, viewConfig: { enableRowBody: true, forceFit: true // IMPORTANT (USE THIS ATTRIBUTE TO USE PERCENTAGE IN COLUMN MODEL) } }); return grid; } }); Ext.reg('CTBAdsOrdersGrid', Ext.CTBAdsOrdersGrid); // window Ext.CTBAdsContactWindow = Ext.extend(Ext.Window, { //: 'myCTBAdsContactWindow', title: 'Contact Form', layout: 'border', closeAction: 'hide', cls: 'ctb-report-download-form', iconCls: '', //losable: false, //esizable: false, modal: true, //lain: true, monitorResize: true, width: 750, height: 380, minWidth: 300, minHeight: 200, shawdow: false, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, initComponent: function () { var theThis = this; //theThis.form_CTBAdsContactPanel = new Ext.CTBAdsContactPanel(); theThis.items = new Ext.form.FormPanel({ frame: true, region: 'center', labelWidth: 100, padding: 10, items: [ theThis.lbl_To_Label = new Ext.form.DisplayField({ fieldLabel: 'Send to', value: '', anchor: '100%' }), theThis.txt_Subject = new Ext.form.TextField({ fieldLabel: 'Subject', value: '', anchor: '100%' }), theThis.txt_Contents = new Ext.form.TextArea({ fieldLabel: 'Contents', value: '', anchor: '100% 59%', height: 140 }) ] }); // BUTTONS theThis.buttons = [ //order button theThis.btn_Send = new Ext.Button({ text: 'Send', iconCls: 'icon-ok-large', scale: 'large', handler: function () { theThis.send(); //theThis.grid_CTBAdsOrders.getGrid_Orders().stopEditing(); } }), //cancel button theThis.btn_Cancel = new Ext.Button({ text: 'Cancel', iconCls: 'icon-cancel-large', scale: 'large', handler: function () { theThis.hide(); } }) ]; //this.initTools(); theThis.AdvId = null; Ext.CTBAdsContactWindow.superclass.initComponent.call(this); }, send: function (callbackFunction) { var theThis = this; //validation var validateFields = new Array(); validateFields[0] = { ID: theThis.txt_Subject.id, VALIDATION_TYPE: VALIDATION_CONSTANTS.EMPTY }; validateFields[1] = { ID: theThis.txt_Contents.id, VALIDATION_TYPE: VALIDATION_CONSTANTS.EMPTY }; if (validateFieldGroup(validateFields) && theThis.AdvId != null) { var userInfo = getUserInfoForOrder(function(userInfo){ var contact = { contactSubject: theThis.txt_Subject.getValue(), contactContents: theThis.txt_Contents.getValue(), contactEmail: userInfo.userEmail, contactName: userInfo.userName, contactPhone: userInfo.companyPhoneNo, advertisementId: theThis.AdvId, contactAddress: userInfo.companyAddress, contactCompany : userInfo.companyName }; //request to CTB Ext.lib.Ajax.useDefaultXhrHeader = false; Ext.Ajax.request({ method: "POST", url: CTB_ADS_HOST + '/api/APIAdvertisement/AddContact', jsonData: Ext.util.JSON.encode(contact), success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); //alert messages success showSuccessNotification("Send Contact Successfully !", NOTIFICATION.ICON_INFORMATION); theThis.hide(); }, failure: function (result, request) { //setTimeout("GetRandomAdvertisement()", 60000); } }); }); } } }); Ext.reg('CTBAdsContactWindow', Ext.CTBAdsContactWindow); // window Ext.CTBAdsMoreInfoWindow = Ext.extend(Ext.Window, { //: 'myCTBAdsMoreInfoWindow', title: 'Description', layout: 'border', closeAction: 'hide', iconCls: '', cls: 'ctb-report-download-form', //losable: false, //esizable: false, modal: true, //lain: true, monitorResize: true, width: 750, height: 400, minWidth: 300, minHeight: 200, shawdow: false, advertisementRecord: null, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, listeners: { scope: this, show: function(pThis){ pThis.loadData(); } }, initComponent: function () { var theThis = this; theThis.tpl_PinBoard = theThis.getTemplate(); //theThis.form_CTBAdsMoreInfoPanel = new Ext.CTBAdsMoreInfoPanel(); theThis.items = [ theThis.txt_Description = new Ext.form.TextArea({ margins: '15 10 10 10', region: "center", value: "", anchor: "100% 70%", readOnly: true, style: 'padding: 20px' }) ]; // BUTTONS theThis.buttons = [ //order button theThis.btn_Send = new Ext.Button({ text: 'Go To Website', iconCls: 'icon-cancel-large ', scale: 'large', handler: function () { window.open("http://" + theThis.advertisementRecord.AdvProLink.replace("http://","").replace("https://",""), '_blank'); } }), //cancel button //order button theThis.btn_Contact = new Ext.Button({ text: 'Contact', iconCls: 'icon-cancel-large ', scale: 'large', handler: function () { //theThis.send(); //theThis.grid_CTBAdsOrders.getGrid_Orders().stopEditing(); var ctbAdsContact = null; ctbAdsContact = new Ext.CTBAdsContactWindow(); ctbAdsContact.AdvId = theThis.advertisementRecord.AdvId ctbAdsContact.lbl_To_Label.setValue(theThis.advertisementRecord.AdvTitle + " Provider"); ctbAdsContact.show(); } }), //order button theThis.btn_Order = new Ext.Button({ text: 'Order', iconCls: 'icon-cancel-large ', scale: 'large', handler: function () { //theThis.send(); //theThis.grid_CTBAdsOrders.getGrid_Orders().stopEditing(); //register window var ctbAdsOrders = new Ext.CTBAdsOrdersWindow(); var arData = []; //fill data for (var index = 0; index < theThis.advertisementRecord.APIProductAds.length; index++) { var product = theThis.advertisementRecord.APIProductAds[index]; var itemArr = [ theThis.advertisementRecord.AdvSupplierId, theThis.advertisementRecord.AdvSupplierABNNo, theThis.advertisementRecord.AdvSupplierCompany, theThis.advertisementRecord.AdvSupplierWebsite, product.AdvProductId, product.AdvProductCode, product.AdvProductName, product.AdvProductDescription, product.AdvProductAmount, product.AdvProductUnit, product.AdvProductPackageType, product.AdvProductPrice, 0, 0, product.AdvProductTypeId, theThis.advertisementRecord.AdvId ]; arData.push(itemArr); } var store = ctbAdsOrders.grid_CTBAdsOrders.grid_AdsOrders.getStore(); store.loadData(arData); ctbAdsOrders.show(); } }), theThis.btn_Cancel = new Ext.Button({ text: 'Cancel', iconCls: 'icon-cancel-large', scale: 'large', handler: function () { theThis.hide(); } }) ]; //this.initTools(); theThis.AdvId = null; Ext.CTBAdsMoreInfoWindow.superclass.initComponent.call(this); }, loadData: function(){ var theThis = this; theThis.txt_Description.setValue(theThis.advertisementRecord.AdvDescription); if(theThis.advertisementRecord.APIProductAds[0].AdvProductTypeId == 1) { theThis.btn_Order.setVisible(true); } else { theThis.btn_Order.setVisible(false); } }, setData: function (advertisementRecord) { var theThis = this; theThis.advertisementRecord = advertisementRecord; theThis.txt_Description.setValue(advertisementRecord.AdvDescription); if(advertisementRecord.APIProductAds[0].AdvProductTypeId == 1) { theThis.btn_Order.setVisible(true); } else { theThis.btn_Order.setVisible(false); } //theThis.advertisementRecord.uniqueId = theThis.id; // debugger; // console.log(advertisementRecord); // theThis.pnl_Content.update({ uniqueId: theThis.id, advertisementRecord: }); }, send: function (callbackFunction) { }, getTemplate: function () { var theThis = this; var tpl_PinBoard = null; tpl_PinBoard = new Ext.XTemplate( '', '', '', '', '', '', '
', '', '
', '
', '
' ); return tpl_PinBoard; }, initButtons: function () { var theThis = this; var buttons = [ ]; return buttons; } }); Ext.reg('CTBAdsMoreInfoWindow', Ext.CTBAdsMoreInfoWindow); // window Ext.CTBAdsSampleWindow = Ext.extend(Ext.Window, { //: 'myCTBAdsContactWindow', title: 'Sample Form', layout: 'border', closeAction: 'hide', cls: 'ctb-report-download-form', iconCls: '', //losable: false, //esizable: false, modal: true, //lain: true, monitorResize: true, width: 750, height: 400, minWidth: 300, minHeight: 200, shawdow: false, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, initComponent: function () { var theThis = this; //theThis.form_CTBAdsContactPanel = new Ext.CTBAdsContactPanel(); theThis.items = new Ext.form.FormPanel({ frame: true, region: 'center', labelWidth: 150, padding: 10, items: [ theThis.txt_Name = new Ext.form.TextField({ fieldLabel: 'Name', value: '', anchor: '100%' }), theThis.txt_Email = new Ext.form.TextField({ fieldLabel: 'Email', value: '', anchor: '100%' }), theThis.txt_PhoneNumber = new Ext.form.TextField({ fieldLabel: 'Phone number ', value: '', anchor: '100%' }), theThis.txt_Address = new Ext.form.TextArea({ fieldLabel: 'Address', value: '', anchor: '100% 40%' }) ] }); // BUTTONS theThis.buttons = [ //order button theThis.btn_Send = new Ext.Button({ text: 'Send', iconCls: 'icon-ok-large', scale: 'large', handler: function () { theThis.send(); //theThis.grid_CTBAdsOrders.getGrid_Orders().stopEditing(); } }), //cancel button theThis.btn_Cancel = new Ext.Button({ text: 'Cancel', iconCls: 'icon-cancel-large', scale: 'large', handler: function () { theThis.hide(); } }) ]; //this.initTools(); theThis.AdvId = null; Ext.CTBAdsSampleWindow.superclass.initComponent.call(this); }, send: function (callbackFunction) { var theThis = this; //validation var validateFields = new Array(); validateFields[0] = { ID: theThis.txt_Name.id, VALIDATION_TYPE: VALIDATION_CONSTANTS.EMPTY }; validateFields[1] = { ID: theThis.txt_Email.id, VALIDATION_TYPE: VALIDATION_CONSTANTS.EMPTY }; validateFields[2] = { ID: theThis.txt_PhoneNumber.id, VALIDATION_TYPE: VALIDATION_CONSTANTS.EMPTY }; validateFields[3] = { ID: theThis.txt_Address.id, VALIDATION_TYPE: VALIDATION_CONSTANTS.EMPTY }; if (validateFieldGroup(validateFields) && theThis.AdvId != null) { var contact = { contactSubject: 'Sample request', contactContents: 'Sample request', contactEmail: theThis.txt_Email.getValue(), contactName: theThis.txt_Name.getValue(), contactPhone: theThis.txt_PhoneNumber.getValue(), advertisementId: theThis.AdvId, contactAddress: theThis.txt_Address.getValue() }; //request to CTB Ext.lib.Ajax.useDefaultXhrHeader = false; Ext.Ajax.request({ method: "POST", url: CTB_ADS_HOST + '/api/APIAdvertisement/AddContact', jsonData: Ext.util.JSON.encode(contact), success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); //alert messages success showSuccessNotification("Send Sample Successfully !", NOTIFICATION.ICON_INFORMATION); theThis.hide(); }, failure: function (result, request) { //setTimeout("GetRandomAdvertisement()", 60000); } }); } } }); Ext.reg('CTBAdsSampleWindow', Ext.CTBAdsSampleWindow); var T = Ext.Toolbar; Ext.CTBPagingToolbar = Ext.extend(Ext.Toolbar, { pageSize : CTB && CTB.init && CTB.init.itemPerPage || 100, ctCls: 'paging-toolbar', displayMsg : 'Displaying {0} - {1} of {2}', emptyMsg : 'No data to display', beforePageText : 'Page', afterPageText : 'Page {0} of {1}', firstText : 'First Page', prevText : 'Previous Page', nextText : 'Next Page', lastText : 'Last Page', refreshText : 'Refresh', pageSizeData: [ [25, 25], [50, 50], [100, 100], [200, 200], [500, 500] ], initComponent : function(){ var pagingItems = [ 'Items per page: ', this.itemPerPage = new Ext.form.ComboBox({ store: new Ext.data.ArrayStore({ fields: [ {name: 'value', type: 'number'}, {name: 'display', type: 'number'} ], data: this.pageSizeData }), displayField: 'display', valueField: 'value', ctCls: 'input-items-per-page', fieldLabel: 'Items per page', width: 75, typeAhead: true, triggerAction: 'all', enableKeyEvents: true, lazyRender: true, mode: 'local', emptyText: '...', listeners : { scope : this, select : this.onItemPerPageSelect, keydown : this.onItemPerPageKeyDown, afterrender : this.onItemPerPageAfterRender } }),'-', '->', this.inputItem = new Ext.form.NumberField({ cls: 'x-tbar-page-number', allowDecimals: false, allowNegative: false, enableKeyEvents: true, selectOnFocus: true, submitValue: false, hidden: true, listeners: { scope: this, keydown: this.onPagingKeyDown, blur: this.onPagingBlur } }), this.afterTextItem = new T.TextItem({ text: String.format(this.afterPageText, 1, 1) }), '-', this.first = new T.Button({ tooltip: this.firstText, overflowText: this.firstText, iconCls: 'icon-paging-first', scale: 'large', disabled: true, handler: this.moveFirst, scope: this }), this.prev = new T.Button({ tooltip: this.prevText, overflowText: this.prevText, iconCls: 'arraw-icon icon-ic-arrow-left', scale: 'large', disabled: true, handler: this.movePrevious, scope: this }), '-', //this.beforePageText, this.numberToolbar = new Ext.Toolbar({ ctCls: 'btn-number-toolbar', items : [ { xtype: 'button', text: '1', scale: 'large', width: 25, style: { color: 'white', } } ] }), '-', this.next = new T.Button({ tooltip: this.nextText, overflowText: this.nextText, iconCls: 'arraw-icon icon-ic-arrow-right', scale: 'large', disabled: true, handler: this.moveNext, scope: this }), this.last = new T.Button({ tooltip: this.lastText, overflowText: this.lastText, iconCls: 'icon-paging-last', scale: 'large', disabled: true, handler: this.moveLast, scope: this }), this.refresh = new T.Button({ tooltip: this.refreshText, overflowText: this.refreshText, iconCls: 'icon-paging-refresh', scale: 'large', handler: this.doRefresh, scope: this }),'-', ]; var userItems = this.items || this.buttons || []; if (this.prependButtons) { this.items = userItems.concat(pagingItems); }else{ this.items = pagingItems.concat(userItems); } delete this.buttons; if(this.displayInfo){ //this.items.push('<-'); this.items.push(this.displayItem = new T.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 count = this.store.getCount(); var msg = count == 0 ? this.emptyMsg : String.format( this.displayMsg, this.cursor+1, this.cursor+count, this.store.getTotalCount() ); this.displayItem.setText(msg); } }, onLoad : function(store, r, o){ if(!this.rendered){ this.dsLoaded = [store, r, o]; return; } var p = this.getParams(); this.cursor = (o.params && o.params[p.start]) ? o.params[p.start] : 0; var d = this.getPageData(), ap = d.activePage, ps = d.pages; this.afterTextItem.setText(String.format(this.afterPageText, d.activePage, d.pages)); this.inputItem.setValue(ap); this.first.setDisabled(ap == 1); this.prev.setDisabled(ap == 1); this.next.setDisabled(ap == ps); this.last.setDisabled(ap == ps); this.refresh.enable(); this.updateInfo(); this.fireEvent('change', this, d); // Set up page numbers this.numberToolbar.removeAll(); //var destNumber = d.activePage + 7; if (destNumber > d.pages) destNumber = d.pages; var startNumber = d.activePage - 3 <= 0 ? 1 : d.activePage - 3; var destNumber = startNumber + 6 > d.pages ? d.pages : startNumber + 6; var theToolbar = this; for (var i = startNumber; i <= destNumber; i++) { var buttonNumber = new Ext.Button({ text: '' + i + '', scale: 'large', numberId: i, width: 25, handler: function(p_This){ theToolbar.inputItem.setValue(p_This.numberId); pageNum = theToolbar.readPage(d); if(pageNum !== false){ pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1; theToolbar.doLoad(pageNum * theToolbar.pageSize); } } }); this.numberToolbar.add(buttonNumber); } this.doLayout(); }, getPageData : function(){ var total = this.store.getTotalCount(); //this.cursor = parseFloat(this.cursor); //this.pageSize = parseFloat(this.pageSize); return { total : total, activePage : Math.ceil((this.cursor+this.pageSize)/this.pageSize), pages : total < this.pageSize ? 1 : Math.ceil(total/this.pageSize) }; }, changePage : function(page){ this.doLoad(((page-1) * this.pageSize).constrain(0, this.store.getTotalCount())); }, onLoadError : function(){ if(!this.rendered){ return; } this.refresh.enable(); }, readPage : function(d){ var v = this.inputItem.getValue(), pageNum; if (!v || isNaN(pageNum = parseInt(v, 10))) { this.inputItem.setValue(d.activePage); return false; } return pageNum; }, onPagingFocus : function(){ this.inputItem.select(); }, onPagingBlur : function(e){ this.inputItem.setValue(this.getPageData().activePage); }, onPagingKeyDown : function(field, e){ var k = e.getKey(), d = this.getPageData(), pageNum; if (k == e.RETURN) { e.stopEvent(); pageNum = this.readPage(d); if(pageNum !== false){ pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1; this.doLoad(pageNum * this.pageSize); } }else if (k == e.HOME || k == e.END){ e.stopEvent(); pageNum = k == e.HOME ? 1 : d.pages; field.setValue(pageNum); }else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){ e.stopEvent(); if((pageNum = this.readPage(d))){ var increment = e.shiftKey ? 10 : 1; if(k == e.DOWN || k == e.PAGEDOWN){ increment *= -1; } pageNum += increment; if(pageNum >= 1 & pageNum <= d.pages){ field.setValue(pageNum); } } } }, onItemPerPageSelect : function(p_This){ this.pageSize = p_This.getValue(); var d = this.getPageData(); this.doLoad(((d.activePage-1) * this.pageSize).constrain(0, this.store.getTotalCount())); }, onItemPerPageKeyDown : function(p_This, e){ var k = e.getKey(); var d = this.getPageData(); if (k == e.RETURN) { e.stopEvent(); try{ this.pageSize = parseInt(p_This.getRawValue()); var d = this.getPageData(); this.doLoad(((d.activePage-1) * this.pageSize).constrain(0, this.store.getTotalCount())); }catch(e){} } }, onItemPerPageAfterRender : function(p_This){ p_This.setValue(this.pageSize); }, getParams : function(){ return this.paramNames || this.store.paramNames; }, beforeLoad : function(){ if(this.rendered && this.refresh){ this.refresh.disable(); } }, doLoad : function(start){ var o = {}, pn = this.getParams(); o[pn.start] = start; o[pn.limit] = this.pageSize; if(this.fireEvent('beforechange', this, o) !== false){ this.store.load({params:o}); } }, 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 total = this.store.getTotalCount(), extra = total % this.pageSize; this.doLoad(extra ? (total - extra) : total - this.pageSize); }, doRefresh : function(){ this.doLoad(this.cursor); }, bindStore : function(store, initial){ var doLoad; if(!initial && this.store){ if(store !== 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(!store){ this.store = null; } } if(store){ store = Ext.StoreMgr.lookup(store); store.on({ scope: this, beforeload: this.beforeLoad, load: this.onLoad, exception: this.onLoadError }); doLoad = true; } this.store = store; if(doLoad){ this.onLoad(store, null, {}); } }, unbind : function(store){ this.bindStore(null); }, bind : function(store){ this.bindStore(store); }, onDestroy : function(){ this.bindStore(null); Ext.PagingToolbar.superclass.onDestroy.call(this); } }); Ext.reg('CTBpaging', Ext.CTBPagingToolbar); Ext.CTBLoadMaskAds = Ext.extend(Ext.Window, { //title: 'THE PINBOARD', layout: 'border', closeAction: 'hide', //iconCls: 'icon-stock', expandOnShow: true, closable: false, resizable: false, modal: true, plain: true, minimizable: false, maximizable: false, monitorResize: true, width: 750, height: 505, shadow: false, cls: 'ctb-report-download-dialog', bodyBorder: false, frame: false, alignToComponentID: null, unstyled: true, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, pageSize: CTB.init.itemPerPage || 100, isHiding: false, // This is using for pending the hiding event for 3 seconds afterHideCallBack: null, advertisementRecord: null, reportId: null, setReportId: function (reportId) { this.reportId = reportId; }, setAdsData: function (advertisementRecord) { //@TOM var theThis = this; //if can not get advertisement from supplier.cookingthebooks.com.au using default template if(typeof advertisementRecord.AdvUploadType == "undefined") { theThis.pnl_Content.tpl = theThis.getTemplate(1); theThis.advertisementRecord = advertisementRecord; if(theThis.advertisementRecord.AdvHTML) { theThis.advertisementRecord.AdvHTML = 'https://' + theThis.advertisementRecord.AdvHTML.replace(/^https?\:\/\//i, ''); } //add unique id theThis.advertisementRecord.uniqueId = theThis.id; //update content after request ajax finished theThis.pnl_Content.update({ uniqueId: theThis.id, advertisementRecord: theThis.advertisementRecord }); Ext.get(theThis.id + '_MoreInfo').on('click', function (theButton) { if (theThis.advertisementRecord.advertisementVideoID != null) showHelpVideo(theThis.advertisementRecord.advertisementVideoID, false); }); Ext.get(theThis.id + '_Contact').on('click', function (theButton) { if (theThis.advertisementRecord != null) { theThis.loadMask.show(); var advertisementId = theThis.advertisementRecord.advertisementId; Ext.Ajax.request({ method: 'POST', url: '/Advertisement/GetContactLetter', params: { advertisementId: advertisementId }, success: function (result, request) { theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { Ext.getCmp('dlg_Mailbox').setMailbox_Recipients(jsonData.data.recipients); Ext.getCmp('dlg_Mailbox').setReportCode(RP_AdvertisementContact); Ext.getCmp('dlg_Mailbox').setSubject('Cooking the Books - Contact about Advertisement'); Ext.getCmp('dlg_Mailbox').setContent(decodeURI(jsonData.data.contactLetterContent)); Ext.getCmp('dlg_Mailbox').setMailbox_RecordId(advertisementId); Ext.getCmp('dlg_Mailbox').show(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { theThis.loadMask.hide(); } }); // End ajax } }); theThis.GetAdvertisementStockOrderForClient = function (isAllowImportSupplier) { theThis.loadMask.show(); var advertisementId = theThis.advertisementRecord.advertisementId; Ext.Ajax.request({ method: 'POST', url: '/Advertisement/GetAdvertisementStockOrderForClient', params: { advertisementId: advertisementId, isAllowImportSupplier: isAllowImportSupplier }, success: function (result, request) { theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { if (jsonData.data.isHavingOrder) { if (jsonData.data.isNeedImportSupplier) { showConfirmMessage(String.format('Do you want to import the supplier "{0}" to your database ?', jsonData.data.supplierName), function () { theThis.GetAdvertisementStockOrderForClient(true); }); } else { showConfirmMessage('Do you want to place an order now ?', function () { var cookie = new Ext.state.CookieProvider; cookie.set("page", "newElectronicOrder"); cookie.set("stockOrderId", jsonData.data.stockOrderId); window.location = "/Stock/Index"; }); } } else { showErrorNotification('Notice', 'This ads didn\'t include order.'); } } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { theThis.loadMask.hide(); } }); // End ajax } Ext.get(theThis.id + '_Order').on('click', function (theButton) { theThis.GetAdvertisementStockOrderForClient(false); }); } else { theThis.advertisementRecord = advertisementRecord; //add unique id theThis.advertisementRecord.uniqueId = theThis.id; //update content after request ajax finished theThis.pnl_Content.update({ uniqueId: theThis.id, advertisementRecord: theThis.advertisementRecord }); var ctbAdsOrders = null; if (Ext.get(theThis.id + '_Order') != null) { Ext.get(theThis.id + '_Order').on('click', function (theButton) { //register window ctbAdsOrders = new Ext.CTBAdsOrdersWindow(); var arData = []; //fill data for (var index = 0; index < Global_RandomAds_Record.APIProductAds.length; index++) { var product = Global_RandomAds_Record.APIProductAds[index]; var itemArr = [ Global_RandomAds_Record.AdvSupplierId, Global_RandomAds_Record.AdvSupplierABNNo, Global_RandomAds_Record.AdvSupplierCompany, Global_RandomAds_Record.AdvSupplierWebsite, product.AdvProductId, product.AdvProductCode, product.AdvProductName, product.AdvProductDescription, product.AdvProductAmount, product.AdvProductUnit, product.AdvProductPackageType, product.AdvProductPrice, 0, 0, product.AdvProductTypeId, Global_RandomAds_Record.AdvId ]; arData.push(itemArr); } //console.log(arData); var store = ctbAdsOrders.grid_CTBAdsOrders.grid_AdsOrders.getStore(); store.loadData(arData); ctbAdsOrders.show(); //add click event for statistic Ext.Ajax.request({ useDefaultXhrHeader: false, cors: true, method: "POST", url: CTB_ADS_HOST + '/api/APIAdvertisement/ClickEvent/' + Global_RandomAds_Record.AdvId }); }); } //contact var ctbAdsContact = null; if (Ext.get(theThis.id + '_Contact') != null) { Ext.get(theThis.id + '_Contact').on('click', function (theButton) { ctbAdsContact = new Ext.CTBAdsContactWindow(); ctbAdsContact.AdvId = Global_RandomAds_Record.AdvId ctbAdsContact.lbl_To_Label.setValue(Global_RandomAds_Record.AdvTitle + " Provider"); ctbAdsContact.show(); //add click event for statistic Ext.Ajax.request({ useDefaultXhrHeader: false, cors: true, method: "POST", url: CTB_ADS_HOST + '/api/APIAdvertisement/ClickEvent/' + Global_RandomAds_Record.AdvId }); }); } //more infor var ctbAdsMoreInfo = null; if (Ext.get(theThis.id + '_MoreInfo') != null) { Ext.get(theThis.id + '_MoreInfo').on('click', function (theButton) { ctbAdsMoreInfo = new Ext.CTBAdsMoreInfoWindow(); ctbAdsMoreInfo.setData(theThis.advertisementRecord); ctbAdsMoreInfo.show(); // }); } //close Ext.get(theThis.id + '_Close').on('click', function (theButton) { theThis.afterHideCallBack = null; // Remove the callback function theThis.hide(); }); } }, setAfterHideCallbackFunction: function (callbackFunction) { this.afterHideCallBack = callbackFunction; }, listeners: { scope: this, 'beforehide': function (theThis) { if (theThis.isHiding == false && theThis.afterHideCallBack != null) { setTimeout(function () { theThis.hide(); }, 3000); theThis.isHiding = true; return false; } //theThis.progressBar.stopLoadingProgress(); }, 'show': function (theThis) { // Fit this window to the client browser screen with 90% theThis.isHiding = false; GetRandomAdvertisement(function () { if (Global_RandomAds_Record != null) { theThis.setAdsData(Global_RandomAds_Record); } if (theThis.progressBar != null) { theThis.progressBar.showLoadingProgress(); } }); }, 'hide': function (theThis) { if (theThis.reportId == null) { if (theThis.afterHideCallBack != null) theThis.afterHideCallBack(); } else { showReportMessageBox(theThis.reportId); theThis.reportId = null; } } }, initComponent: function () { var theThis = this; theThis.tpl_PinBoard = theThis.getTemplate(); theThis.items = [ theThis.pnl_Content = new Ext.Panel({ region: 'center', tpl: theThis.tpl_PinBoard, frame: false, border: false, autoScroll: false, listeners: { afterrender: function (p_This) { theThis.loadMask = new Ext.LoadMask(p_This.getEl(), { msg: "Please wait..." }); } } }) ]; // BUTTONS var myButtons = theThis.initButtons(); this.buttons = myButtons; this.initTools(); Ext.CTBLoadMaskAds.superclass.initComponent.call(this); }, getTemplate: function (templateCode) { var theThis = this; var iconLoadMaskAdsCTBLogo = '';//'/Content/custom/images/icon-loadmaskads-ctblogo.png'; var iconPinBoardClose = '/Content/v5/custom/images/themes/report/ic-report-close.svg'; var iconOrder = '/Content/custom/images/ads/order_icon.png'; var iconContact = '/Content/custom/images/ads/contact_icon.png'; var iconTopLeft = '/Content/custom/images/ads/check_it_out_icon.png'; var iconDownloadPdf = '/Content/custom/images/ads/download_pdf_icon.png'; var iconSendEmail = '/Content/custom/images/ads/send_email_icon.png'; var iconCancel = '/Content/custom/images/ads/cancel_icon.png'; var tpl_PinBoard = null; if (templateCode == 1) // { tpl_PinBoard = new Ext.XTemplate( '', '', '', '', '', '
', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '
CONTACTMORE INFO   ORDER
{advertisementDescription}
Please wait while your report is loading...
', '', '', '', '', '', '
', '
', '
', '
' ); } else { var templateHtml = ''; var templateHtmlBtn = ''; tpl_PinBoard = new Ext.XTemplate( '', '', '', '', '', '', '
', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '
{AdvProductDescription}
Please wait while your report is loading...
', '', '', '', '', '', '
', '
', '
', '', '', '', '', '', '', '', '', /* '', '
', '
', '
', */ '
', '
', '
' ); } return tpl_PinBoard; }, initButtons: function () { var theThis = this; var buttons = [ ]; return buttons; } }); Ext.reg('CTBLoadMaskAds', Ext.CTBLoadMaskAds); Ext.CTBResetPasswordSendEmail = Ext.extend(Ext.Window, { title: 'Reset password', layout: 'border', closeAction: 'close', expandOnShow : false, closable: false, resizable: false, modal: true, plain: false, minimizable : false, maximizable : false, monitorResize : true, width:410, height:170, loadMask : null, message : '', cookieProvider : new Ext.state.CookieProvider({ path: "/", expires: new Date(new Date().getTime()+(1000*60*60*24*30)), //30 days domain: "" }), listeners : { scope : this, beforeshow : function(theThis){ }, beforehide : function(theThis){ }, hide : function(theThis){ }, afterrender : function(theThis){ theThis.loadMask = new Ext.LoadMask(theThis.getEl(), {msg:"Please wait..."}); } }, initComponent : function(){ var theThis = this; theThis.frm_ResetPassword = theThis.getResetPasswordForm('center'); theThis.items = [ theThis.pnl_Message = new Ext.Panel({ region : 'north', height : 50, frame : true, html : '
  
' + theThis.message + '
' }), theThis.frm_ResetPassword ]; theThis.buttons = [ theThis.btn_ResetPassword = new Ext.Button({ text: 'Reset password', iconCls : 'icon-ok-large', scale : 'large', handler : function(){ theThis.frm_ResetPassword.getForm().submit(); } }) ]; this.initTools(); Ext.CTBResetPasswordSendEmail.superclass.initComponent.call(this); }, getResetPasswordForm: function(region){ var theThis = this; var frm_ResetPassword = new Ext.form.FormPanel({ xtype : 'form', url : '/Account/SendResetPasswordEmail', baseCls: 'x-plain', margins : '5 5 5 5', region : region, frame : true, listeners : { afterrender : function(p_This){ var userEmail = theThis.cookieProvider.get('userEmail', null); if (userEmail != null) { theThis.txt_ResetPassword_Email.setValue(userEmail); } }, beforeaction : function(p_This, p_Action){ theThis.loadMask.show(); }, actioncomplete : function(p_This, p_Action){ theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(p_Action.result); }, actionfailed : function(p_This, p_Action){ theThis.loadMask.hide(); if (p_Action.result.message.IsSuccess){ showInfoMessage(p_Action.result.message.Info); theThis.hide(); } else { Ext.Msg.show({ title:'Cooking the books - Reset password', msg: p_Action.result.message.Info, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } } }, labelWidth: 100, width : 390, defaultType: 'textfield', items : [ theThis.txt_ResetPassword_Email = new Ext.form.TextField({ fieldLabel : 'Email', width : 260, allowBlank : false, emptyText : 'Enter your email here ...', msgTarget : 'side', name : 'userEmail' }) ] }); return frm_ResetPassword; }, // This function checking login status of the user checkResetPassword: function(){ var theThis = this; theThis.loadMask.show(); Ext.Ajax.request({ method: "POST", url: '/Account/CheckCurrentResetPassword', params: { }, success : function(result, request) { theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.IsSuccess) { showSuccessNotification(jsonData.Info, NOTIFICATION.ICON_INFORMATION); Ext.Msg.show({ title:'Cooking the books - ResetPassword status', msg: 'Welcome ' + jsonData.AdditionalData.UserName + '
You come back at ' + jsonData.AdditionalData.ResetPasswordDate + '', buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO, modal : false, fn: function(btn){ theThis.hide(); } }); } else{ theThis.show(); } }, failure : function(result, request) { theThis.loadMask.hide(); } }); } }); Ext.reg('CTBResetPasswordSendEmail', Ext.CTBResetPasswordSendEmail); Ext.CTBResetPassword = Ext.extend(Ext.Window, { title: 'Reset password', layout: 'border', closeAction: 'close', expandOnShow : false, closable: false, resizable: false, modal: true, plain: false, minimizable : false, maximizable : false, monitorResize : true, width:410, height:220, loadMask : null, isShowForgetPasswordButton : false, resetPasswordToken : '', message : 'Enter your new password below :', cookieProvider : new Ext.state.CookieProvider({ path: "/", expires: new Date(new Date().getTime()+(1000*60*60*24*30)), //30 days domain: "" }), listeners : { scope : this, show : function(theThis) { theThis.txt_ResetPassword_TokenResetPassword.setValue(theThis.resetPasswordToken); }, beforeshow : function(theThis){ }, beforehide : function(theThis){ }, hide : function(theThis){ }, afterrender : function(theThis){ theThis.loadMask = new Ext.LoadMask(theThis.getEl(), {msg:"Please wait..."}); } }, initComponent : function(){ var theThis = this; theThis.frm_ResetPassword = theThis.getResetPasswordForm('center'); theThis.items = [ theThis.pnl_Message = new Ext.Panel({ region : 'north', height : 50, frame : true, html : '
  
' + theThis.message + '
' }), theThis.frm_ResetPassword ]; theThis.buttons = [ theThis.btn_ResetPassword = new Ext.Button({ text: 'Reset', iconCls : 'icon-ok-large', scale : 'large', handler : function(){ theThis.frm_ResetPassword.getForm().submit(); } }) ]; this.initTools(); Ext.CTBResetPassword.superclass.initComponent.call(this); }, getResetPasswordForm: function(region){ var theThis = this; var frm_ResetPassword = new Ext.form.FormPanel({ xtype : 'form', url : '/Account/ResetPassword', baseCls: 'x-plain', margins : '5 5 5 5', region : region, frame : true, listeners : { afterrender : function(p_This){ }, beforeaction : function(p_This, p_Action){ if (!theThis.validateBeforeSave()) return false; else { theThis.loadMask.show(); } }, actioncomplete : function(p_This, p_Action){ theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(p_Action.result); }, actionfailed : function(p_This, p_Action){ theThis.loadMask.hide(); if (p_Action.result.message.IsSuccess){ showInfoMessage(p_Action.result.message.Info); theThis.hide(); var loginForm = new Ext.CTBLoginForm({ message : '' + p_Action.result.message.Info + '', refreshAfterLoginSuccess : true, listeners : { show : function(){ isShowingAnErrorMessage = true; }, beforehide : function(){ isShowingAnErrorMessage = false; } } }); loginForm.show(); } else { Ext.Msg.show({ title:'Cooking the books - Reset password', msg: p_Action.result.message.Info, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } } }, labelWidth: 120, width : 390, defaultType: 'textfield', items : [ theThis.txt_ResetPassword_NewPassword = new Ext.form.TextField({ fieldLabel : 'New password', width : 240, inputType : 'password', allowBlank : false, msgTarget : 'side', name : 'userPasswordNew' }), theThis.txt_ResetPassword_ConfirmNewPassword = new Ext.form.TextField({ fieldLabel : 'Confirm new password', width : 240, inputType : 'password', allowBlank : false, msgTarget : 'side', name : 'userPasswordNewConfirm' }), theThis.txt_ResetPassword_TokenResetPassword = new Ext.form.Hidden({ width : 240, allowBlank : false, msgTarget : 'side', name : 'tokenResetPassword' }) ] }); return frm_ResetPassword; }, validateBeforeSave : function() { var theThis = this; var validateFields = new Array(); validateFields[0] = { ID : theThis.txt_ResetPassword_NewPassword.id, VALIDATION_TYPE : VALIDATION_CONSTANTS.EMPTY }; validateFields[1] = { ID : theThis.txt_ResetPassword_ConfirmNewPassword.id, CUSTOM_FUNCTION : function(){ var userPasswordNew = theThis.txt_ResetPassword_NewPassword.getValue(); var userPasswordNewConfirm = theThis.txt_ResetPassword_ConfirmNewPassword.getValue(); if (userPasswordNew != userPasswordNewConfirm){ return false; } return true; }, CUSTOM_MESSAGE : 'Password is not match.', VALIDATION_TYPE : VALIDATION_CONSTANTS.CUSTOM }; // Call global validate field group return validateFieldGroup(validateFields); } }); Ext.reg('CTBResetPassword', Ext.CTBResetPassword); Ext.CTBLoginForm = Ext.extend(Ext.Window, { title: 'Login', layout: 'border', closeAction: 'close', expandOnShow : false, iconCls : '', closable: false, resizable: false, modal: true, plain: false, minimizable : false, maximizable : false, monitorResize : true, width:410, height:250, loadMask : null, isShowForgetPasswordButton : true, refreshAfterLoginSuccess : false, prefilledUserEmail : null, redirectTo : null, message : '', isShowErrorSign : true, cookieProvider : new Ext.state.CookieProvider({ path: "/", expires: new Date(new Date().getTime()+(1000*60*60*24*30)), //30 days domain: "" }), listeners : { scope : this, beforeshow : function(theThis){ }, beforehide : function(theThis){ }, hide : function(theThis){ }, show : function(theThis){ if (theThis.prefilledUserEmail != null) { theThis.txt_Login_Email.setValue(theThis.prefilledUserEmail); } }, afterrender : function(theThis){ theThis.loadMask = new Ext.LoadMask(theThis.getEl(), {msg:"Please wait..."}); } }, initComponent : function(){ var theThis = this; theThis.frm_Login = theThis.getLoginForm('center'); var htmlMessage = ''; if (theThis.isShowErrorSign) htmlMessage = '
  
' + theThis.message + '
'; else htmlMessage = '
  
' + theThis.message + '
'; theThis.items = [ theThis.pnl_Message = new Ext.Panel({ region : 'north', height : 50, frame : true, html : htmlMessage }), theThis.frm_Login ]; theThis.buttons = [ theThis.btn_Login = new Ext.Button({ text: 'Login', iconCls : 'icon-ok-large', scale : 'large', handler : function(){ theThis.frm_Login.getForm().submit(); } }), theThis.btn_ForgetPassword = new Ext.Button({ text: 'Reset password', tooltip : 'Click here to reset your password if you forget it', //hidden : !theThis.isShowForgetPasswordButton, iconCls : 'icon-password', scale : 'large', handler : function(){ if (theThis.dlg_ResetPasswordSendEmail == null) { theThis.dlg_ResetPasswordSendEmail = new Ext.CTBResetPasswordSendEmail({ message : 'Enter your registered email below :' }); } theThis.dlg_ResetPasswordSendEmail.show(); } }) ]; this.initTools(); Ext.CTBLoginForm.superclass.initComponent.call(this); }, getLoginForm: function(region){ var theThis = this; var frm_Login = new Ext.form.FormPanel({ xtype : 'form', url : '/Account/Login', timeout : 1800000, baseCls: 'x-plain', margins : '5 5 5 5', region : region, frame : true, listeners : { afterrender : function(p_This){ var userEmail = theThis.cookieProvider.get('userEmail', null); var userPassword = theThis.cookieProvider.get('userPassword', null); if (userEmail != null) { theThis.txt_Login_RememberMe.setValue(true); theThis.txt_Login_Email.setValue(userEmail); } if (userPassword != null) { theThis.txt_Login_SavePassword.setValue(true); theThis.txt_Login_Password.setValue(userPassword); } }, beforeaction : function(p_This, p_Action){ theThis.loadMask.show(); // Save user email to cookie if selected if (theThis.txt_Login_RememberMe.getValue() == true){ theThis.cookieProvider.set('userEmail', theThis.txt_Login_Email.getValue()); } else { theThis.cookieProvider.clear('userEmail'); } // Save user password to cookie if selected if (theThis.txt_Login_SavePassword.getValue() == true){ theThis.cookieProvider.set('userPassword', theThis.txt_Login_Password.getValue()); } else { theThis.cookieProvider.clear('userPassword'); } }, actioncomplete : function(p_This, p_Action){ theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(p_Action.result); }, actionfailed : function(p_This, p_Action){ theThis.loadMask.hide(); if (p_Action.result.IsSuccess){ if(p_Action.result.AdditionalData != null && p_Action.result.AdditionalData.isDirectToUrl == true){ var cookie = new Ext.state.CookieProvider; cookie.set("page", p_Action.result.AdditionalData.pageSetting); if(p_Action.result.AdditionalData.outletId != null || p_Action.result.AdditionalData.outletId != "") cookie.set("outletId", p_Action.result.AdditionalData.outletId); window.location = p_Action.result.AdditionalData.redirectToUrl; } else { if (theThis.refreshAfterLoginSuccess) { if (theThis.redirectTo != null) window.location = theThis.redirectTo; else window.location = window.location; } else { theThis.checkLogin(); } } } else { if (p_Action.result.Info.indexOf('need to be activated') != -1) { theThis.frm_Activation.show(); } else { Ext.Msg.show({ title:'Cooking the books - Login', msg: p_Action.result.Info, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } } } }, labelWidth: 100, width : 390, defaultType: 'textfield', items : [ theThis.txt_Login_Email = new Ext.form.TextField({ fieldLabel : 'Email', width : 260, allowBlank : false, emptyText : 'Enter your email here ...', msgTarget : 'side', name : 'userEmail' }), theThis.txt_Login_Password = new Ext.form.TextField({ fieldLabel : 'Password', width : 260, inputType : 'password', allowBlank : false, msgTarget : 'side', name : 'userPassword', listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { theThis.btn_Login.handler.call(theThis.btn_Login.scope); } } } }), theThis.txt_Login_RememberMe = new Ext.form.Checkbox({ fieldLabel : 'Save my email', width : 150, msgTarget : 'side', name : 'rememberMe' }), theThis.txt_Login_SavePassword = new Ext.form.Checkbox({ fieldLabel : 'Save my password', width : 150, msgTarget : 'side', name : 'savePassword' }) ] }); return frm_Login; }, // This function checking login status of the user checkLogin: function(){ var theThis = this; theThis.loadMask.show(); Ext.Ajax.request({ method: "POST", url: '/Account/CheckCurrentLogin', timeout : 1800000, params: { }, success : function(result, request) { theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.IsSuccess) { showSuccessNotification(jsonData.Info, NOTIFICATION.ICON_INFORMATION); Ext.Msg.show({ title:'Cooking the books - Login status', msg: 'Welcome ' + jsonData.AdditionalData.UserName + '
You come back at ' + jsonData.AdditionalData.LoginDate + '', buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO, modal : false, fn: function(btn){ theThis.hide(); } }); } else{ theThis.show(); } }, failure : function(result, request) { theThis.loadMask.hide(); } }); } }); Ext.reg('CTBLoginForm', Ext.CTBLoginForm); Ext.CTBDateSelectorDialog = Ext.extend(Ext.Window, { title: 'Please select a date', layout: 'border', closeAction: 'hide', iconCls: '', cls: 'ctbwindow-detail-general', expandOnShow: true, closable: true, resizable: true, modal: true, minimizable: false, maximizable: false, monitorResize: true, labelText: null, width: 300, height: 200, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, pageSize: CTB.init.itemPerPage || 100, currentValue : new Date(), callback_AfterSelect : function(selectedDate) { var theThis = this; }, listeners: { show: function() { this.txt_DateSelector.setValue(this.currentValue); } }, initComponent : function(){ var theThis = this; theThis.items = [ new Ext.Panel ({ region : 'center', margins: '15 5 5 10', layout: 'anchor', bodyStyle: { padding: '0 5px 0 0', }, frame: true, items : [ { xtype: 'label', text: theThis.labelText ? theThis.labelText : '', hidden: theThis.labelText ? false : true, anchor: '100%' }, { xtype:'panel', height: 10, hidden: theThis.labelText ? false : true }, theThis.txt_DateSelector = new Ext.form.DateField({ format : "j/n/Y", altFormats : 'j/n/y', value : new Date(), anchor: '100%' }) ] }) ]; // BUTTONS var myButtons = theThis.initButtons(); this.buttons = myButtons; this.initTools(); Ext.CTBDateSelectorDialog.superclass.initComponent.call(this); }, initButtons : function(){ var theThis = this; var buttons = [ theThis.btn_Cancel = new Ext.Button({ text: 'Select', iconCls : 'icon-ok-large ', scale : 'large', handler : function(){ if (!theThis.txt_DateSelector.isValid() || theThis.txt_DateSelector.getValue() == ''){ showErrorNotification('Notice', 'Please select a valid date'); } else { theThis.callback_AfterSelect(theThis.txt_DateSelector.getValue()); theThis.hide(); } } }), theThis.btn_Cancel = new Ext.Button({ text: 'Cancel', iconCls : 'icon-cancel-large', scale : 'large', handler : function(){ theThis.hide(); } }) ]; return buttons; } }); Ext.reg('CTBDateSelectorDialog', Ext.CTBDateSelectorDialog); Ext.CTBDateRangeSelectorDialog = Ext.extend(Ext.Window, { isSearchTypeHidden : true, title: 'Please select the date range', cls: 'dlg-date-range-selector', layout: 'border', closeAction: 'hide', iconCls: 'icon-stock', expandOnShow: true, closable: true, resizable: true, modal: true, plain: true, minimizable: true, maximizable: true, monitorResize: true, width: 400, height: 350, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, pageSize: CTB.init.itemPerPage || 100, defaultStartDate : new Date(), defaultEndDate : new Date(), currentValue : new Date(), callback_AfterSelect : function(selectedDate) { var theThis = this; }, listeners: { scope : this, 'beforehide': function(theThis){ }, 'beforeshow': function(theThis){ // Fit this window to the client browser screen with 90% // fitWindowSize(theThis, 90); }, 'show': function(theThis){ //theThis.txt_DateSelector.setValue(theThis.currentValue); } }, initComponent : function(){ var theThis = this; //............. /****************************/ /* Searching Stock Combobox */ /****************************/ var data_SearchType = [ ['By Invoice Date Range', 1], ['By Created Date Range', 2] ]; theThis.cmb_SearchInvoice = new Ext.form.ComboBox({ store: new Ext.data.ArrayStore({ fields: [ {name: 'searchTypeDesc'}, {name: 'searchType', type: 'int'} ] }), editable: false, displayField: 'searchTypeDesc', valueField: 'searchType', typeAhead: true, triggerAction: 'all', lazyRender: true, mode: 'local', emptyText: 'Choose search by ...', width: 200, fieldLabel: 'Search Type', getSelectedRecord: function() { return this.findRecord(this.valueField || this.displayField, this.getValue()); }, getSelectedIndex: function() { return this.store.indexOf(this.getSelectedRecord()); } }); // manually load local data theThis.cmb_SearchInvoice.getStore().loadData(data_SearchType); theThis.cmb_SearchInvoice.setValue(1); theThis.cmb_SearchInvoice.hidden = this.isSearchTypeHidden; //............. theThis.items = [ new Ext.form.FormPanel ({ region : 'center', frame : false, margins:'10 10 0 10', items : [ { xtype:'fieldset', bodyStyle:'padding:15px 10px 10px 10px', items: [ theThis.txt_StartDateSelector = new Ext.form.DateField({ fieldLabel : 'Start date', format : "j/n/Y", altFormats : 'j/n/y', value : theThis.defaultStartDate, width : 200 }), theThis.txt_EndDateSelector = new Ext.form.DateField({ fieldLabel : 'End date', format : "j/n/Y", altFormats : 'j/n/y', value : theThis.defaultEndDate, width : 200 }), theThis.cmb_SearchInvoice, ] } ] }) ]; // BUTTONS var myButtons = theThis.initButtons(); this.buttons = myButtons; this.initTools(); Ext.CTBDateRangeSelectorDialog.superclass.initComponent.call(this); }, initButtons : function(){ var theThis = this; var buttons = [ theThis.btn_Select = new Ext.Button({ text: 'Select', iconCls : 'icon-ok-large ', scale : 'large', handler : function(){ if (!theThis.txt_StartDateSelector.isValid() || theThis.txt_StartDateSelector.getValue() == '') { showErrorNotification('Notice', 'Please select a valid start date'); } else if (!theThis.txt_EndDateSelector.isValid() || theThis.txt_EndDateSelector.getValue() == '') { showErrorNotification('Notice', 'Please select a valid end date'); } else { if(this.isSearchTypeHidden) theThis.callback_AfterSelect(theThis.txt_StartDateSelector.getValue(), theThis.txt_EndDateSelector.getValue()); else { var searchType = theThis.cmb_SearchInvoice.getValue(); theThis.callback_AfterSelect(theThis.txt_StartDateSelector.getValue(), theThis.txt_EndDateSelector.getValue(), searchType); } theThis.hide(); } } }), theThis.btn_Cancel = new Ext.Button({ text: 'Cancel', iconCls : 'icon-cancel-large', scale : 'large', handler : function(){ theThis.hide(); } }) ]; return buttons; } }); Ext.reg('CTBDateRangeSelectorDialog', Ext.CTBDateRangeSelectorDialog); Ext.CTBStockDetector = Ext.extend(Ext.Window, { title: 'Stock Detector', layout: 'border', closeAction: 'hide', iconCls : '', cls : 'ctbwindow-detail-general', expandOnShow : true, closable: true, resizable: true, modal: true, plain: true, minimizable : true, maximizable : true, monitorResize : true, //maximized : true, width:800, height:500, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, pageSize : 100, stockDesc : '', supplierId : -1, activeItem : 0, instructionText : 'Select the supplied product', instructionBackgroundColor : '#549363', callback_AfterHide : null, callback_AfterSelect : null, callback_Cancel : null, isSingleSelect : false, listeners : { scope : this, 'hide' : function(theThis){ if (theThis.callback_AfterHide != null){ theThis.callback_AfterHide(); } }, 'beforehide' : function(theThis){ theThis.Global_StockBrowser_AssignedSupplierId = -1; }, 'beforeshow' : function(theThis){ // Fit this window to the client browser screen with 90% fitWindowSize(theThis, 80); theThis.clearSelections(); }, 'show' : function(theThis){ theThis.resetState(); } }, resetState : function(){ var theThis = this; theThis.pnl_Title.tpl.overwrite(theThis.pnl_Title.body, {instructionText : String.format('Select the supplied product for \'{0}\'', theThis.stockDesc), instructionBackgroundColor : theThis.instructionBackgroundColor}); theThis.tab_StockBySuppliers.txt_StockBySupplier_SearchStockValue.setValue(theThis.stockDesc); theThis.tab_StockBySuppliers.cmbSupplier.setValue(theThis.supplierId); theThis.tab_StockBySuppliers.btn_Dialog_StockBySupplier_SearchStock.handler.call(theThis.tab_StockBySuppliers.btn_Dialog_StockBySupplier_SearchStock.scope); theThis.tab_StockBySuppliers.cmbSupplier.disable(); }, initComponent : function(){ var theThis = this; // Init buttons var myButtons = theThis.initButtons(); theThis.pnl_Title = new Ext.Panel({ region : 'north', height : 70, margins:'10 10 0 10', frame : true, tpl : new Ext.XTemplate( '', '
', '', '', '', '', '
', '{instructionText}', '
', '
', '
' ) }); theThis.tab_StockBySuppliers = new Ext.CTBStockBySuppliers({ region : 'center', Global_StockBrowser_Parent : theThis, Global_StockBrowser_PageSize : theThis.pageSize, HideColumn_StockCode : true, HideColumn_SupplierStockCode : true, HideColumn_ParLevel : true, HideColumn_GST : true, HideColumn_Nutrition : true, HideColumn_Report : true, HideColumn_Wastage : true, readOnly : true, isSingleSelect : theThis.isSingleSelect, //frame : true, //margins :'0 10 0 10', title: '' }); theThis.items = [theThis.tab_StockBySuppliers, theThis.pnl_Title]; this.buttons = myButtons; this.initTools(); Ext.CTBStockDetector.superclass.initComponent.call(this); }, clearSelections : function(){ var theThis = this; if (theThis.tab_StockBySuppliers.rendered) theThis.tab_StockBySuppliers.clearSelections(); }, initButtons : function(){ var theThis = this; var buttons = [ theThis.btn_Select = new Ext.Button({ text: 'Select', iconCls : 'icon-ok-large', scale : 'large', handler : function(){ var selectedRecords = theThis.tab_StockBySuppliers.getGrid_StockBySuppliers().getSelectionModel().getSelections(); if (selectedRecords.length == 0){ showErrorNotification('Notice', 'You haven\'t choose any stock.'); return; } else { if (theThis.callback_AfterSelect != null){ theThis.callback_AfterSelect(selectedRecords); } } theThis.tab_StockBySuppliers.clearSelections(); } }), theThis.btn_Cancel = new Ext.Button({ text: 'Cancel', iconCls : 'icon-cancel-large', scale : 'large', handler : function(){ theThis.hide(); } }) ]; return buttons; } }); Ext.reg('CTBStockDetector', Ext.CTBStockDetector); Ext.CTBMediaManagerPanel = Ext.extend(Ext.Panel, { layout: 'border', loadMask: null, pageSize: CTB.init.itemPerPage || 100, selectedFolderId: -1, newAlbumIndex: 0, cachedChanges: "", parentDialog: null, isAutoLoad: false, isFirstRun: false, listeners: { afterrender: function(theThis) { // Init loadMask theThis.loadMask = new Ext.LoadMask(theThis.getEl(), {msg: "Please wait..."}); } }, initComponent: function() { var theThis = this; // MAIN GRID theThis.treePanel_Media = theThis.getTreePanel_Media(); theThis.pnl_ImagesViewer = theThis.getPanel_ImagesViewer(); theThis.dlg_UploadMedia = theThis.getDialog_UploadMedia(); theThis.items = [ /* new Ext.Panel({ items:[theThis.treePanel_Media], region: 'west', width: 270, layout:'border' }), */ new Ext.Panel({ title: 'Photo Manager', layout: 'border', margins : '10 15 15 15', cls: 'raise-tab-panel', region : 'center', frame : true, items: [ theThis.treePanel_Media, theThis.pnl_ImagesViewer ] }) ]; // Call super class to initialize components Ext.CTBMediaManagerPanel.superclass.initComponent.call(this); }, getTreePanel_Media: function() { var theThis = this; // set up the Album tree var tree = new Ext.tree.TreePanel({ // tree animate: true, enableDD: true, containerScroll: true, ddGroup: 'organizerDD', cls:'ctbScrollBarPanel pnl-treeview ctb-recipe-manager', // layout region: 'west', width: 375, split: true, loadMask: null, listeners: { nodedrop: function(e) { // Treat as a temporary album var data = e.dropNode.toString().split(','); var targetId = getNumberIdFromStringId(e.target.id) == -1 ? 0 : getNumberIdFromStringId(e.target.id); var mediaIds = new Array(); for (var i = 0; i < data.length; i++) { var mediaId = data[i].replace("[Node", ""); mediaId = mediaId.replace("]",""); mediaId = getNumberIdFromStringId(mediaId); mediaIds[mediaIds.length] = mediaId; /*if (targetId > 100000){ theThis.cachedChanges += '[{"command":"MoveMediaToMediaFolder","id":"' + mediaId + '","tmpFolderId":"' + targetId + '"}]'; } // Treat as an existing album else { theThis.cachedChanges += '[{"command":"MoveMediaToMediaFolder","id":"' + mediaId + '","folderId":"' + targetId + '"}]'; }*/ } theThis.treePanel_Media.loadMask.show(); Ext.Ajax.request({ method: "POST", url: '/MediaManager/MoveMediasToMediaFolder', params: { mediaIds: Ext.util.JSON.encode(mediaIds), mediaFolderId: targetId }, success : function(result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { theThis.treePanel_Media.loader.load(theThis.treePanel_Media.root, function(){}); theThis.treePanel_Media.getSelectionModel().select(e.target); theThis.dataView_Media.getStore().baseParams = {mediaFolderId : targetId}; theThis.dataView_Media.getStore().load(); if(targetId==0) theThis.lbl_FolderNameLink.setText(String.format('',e.target.text), false); else theThis.lbl_FolderNameLink.setText(String.format('',e.target.text), false); } else { showErrorMessageWithEmailNotify(jsonData.Info); } theThis.treePanel_Media.loadMask.hide(); }, failure: function(result, request) { theThis.treePanel_Media.loadMask.hide(); } }); // End ajax }, afterrender: function(p_This) { // Init loadMask p_This.loadMask = new Ext.LoadMask(p_This.getEl(), {msg:"Please wait..."}); } }, // panel title: 'My Albums', loader: theThis.treeLoader_Media = new Ext.tree.TreeLoader({ dataUrl: '/MediaFolder/GetAllMediaFolders', requestMethod: 'POST', preloadChildren: false, listeners: { beforeload: function() { if (!theThis.isAutoLoad && !theThis.isFirstRun) { theThis.isFirstRun = true; return false; } if (theThis.treePanel_Media.loadMask) theThis.treePanel_Media.loadMask.show(); }, load: function() { if (theThis.treePanel_Media.loadMask) theThis.treePanel_Media.loadMask.hide(); // Select the first node if (tree.root.item(0)) { theThis.treePanel_Media.getSelectionModel().select(tree.root.item(0)); theThis.dataView_Media.getStore().baseParams = { mediaFolderId: getNumberIdFromStringId(tree.root.item(0).id) }; theThis.dataView_Media.getStore().load(); } setScrollBarToControl(theThis.treePanel_Media.el.dom.querySelector(".x-panel-body"), true); }, loadexception: function() { showStoreLoadingErrorMessage(null); } } }), autoScroll: true, tbar: [ theThis.btn_AddMediaFolder = new Ext.Button({ text: 'Add Album', iconCls: 'icon-add', scale: 'large', handler: function() { showInputMessage('Enter new album name', function(inputValue) { if (inputValue.length > 0) { theThis.treePanel_Media.loadMask.show(); Ext.Ajax.request({ method: "POST", url: '/MediaFolder/AddMediaFolder', params: { mediaFolderName: inputValue }, success: function(result) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); var node = theThis.treePanel_Media.root.item(0).appendChild(new Ext.tree.TreeNode({ text: jsonData.data.mediaFolderName, cls: 'album-node', //leaf:false, id: "folder;"+jsonData.data.mediaFolderId, allowDrag: false })); theThis.treePanel_Media.getSelectionModel().select(node); theThis.dataView_Media.getStore().baseParams = {mediaFolderId: jsonData.data.mediaFolderId}; theThis.dataView_Media.getStore().load(); setTimeout(function() { theThis.treeEditor_Media.editNode = node; theThis.treeEditor_Media.startEdit(node.ui.textNode); }, 10); } else { showErrorMessageWithEmailNotify(jsonData.Info); } theThis.treePanel_Media.loadMask.hide(); }, failure: function(result, request) { theThis.treePanel_Media.loadMask.hide(); } }); // End ajax } else { showErrorNotification('Notice', 'Please enter a valid album name'); } } ); } }), theThis.btn_AddMedia = new Ext.Button({ text:'Add Media', iconCls:'icon-add', scale : 'large', hidden: true, handler: function() { var sn = theThis.treePanel_Media.selModel.selNode || null; // selNode is null on initial selection if (getNumberIdFromStringId(sn.id) > 100000) { Ext.Msg.show({ title:'Notice', msg: 'Please save this album before using it!', buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING }); return; } if (sn == null) { Ext.Msg.show({ title:'Notice', msg: 'Please select an album to add media!', buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING }); } else { var objectId = sn != null ? getNumberIdFromStringId(sn.id) : -1; var prefix = sn != null ? getPrefixFromStringId(sn.id) : -1; if (prefix == "media") { // Get the folder that store this media var parentNode = sn.parentNode; if (parentNode != null) { var objectId = getNumberIdFromStringId(parentNode.id); } } theThis.selectedFolderId = objectId; if (theThis.parentDialog != null) theThis.parentDialog.selectedFolderId = theThis.selectedFolderId; theThis.dlg_UploadMedia.show(); } } }), theThis.btn_DeleteMedia = new Ext.Button({ text: 'Delete Album', iconCls: 'icon-delete', scale: 'large', handler: function() { var sn = theThis.treePanel_Media.selModel.selNode || null; // selNode is null on initial selection var prefix = sn != null ? getPrefixFromStringId(sn.id) : -1; Ext.Msg.show({ title: 'Confirm', msg: 'Are you sure you want to delete the media folder ' + sn.text + '?

Warning: All photos under this folder will be deleted!', buttons: Ext.Msg.YESNO, icon: Ext.MessageBox.QUESTION, fn: function(btn) { if (btn === "yes") { var loadMask = new Ext.LoadMask(theThis.getEl(), {msg:"Removing ..."}); var objectId = sn != null ? getNumberIdFromStringId(sn.id) : -1; var prefix = sn != null ? getPrefixFromStringId(sn.id) : -1; loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/MediaFolder/DeleteMediaFolder', params: { mediaFolderId : objectId }, success: function(result, request) { loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); var parentNode = sn.parentNode; var node = sn.removeChild(sn); theThis.treePanel_Media.getSelectionModel().select(parentNode); var parentNodeId = parentNode != null ? getNumberIdFromStringId(parentNode.id) : 0; theThis.dataView_Media.getStore().baseParams = {mediaFolderId : parentNodeId}; theThis.dataView_Media.getStore().load(); } else { if(jsonData.data && jsonData.data.isRecipeUsed) { showWarningMessage(jsonData.message.Info); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } } }, failure: function() { loadMask.hide(); } }); // End ajax } } }); } }), // End button_DeleteMedia theThis.btn_MediaManagerCancel = new Ext.Button({ iconCls: 'icon-stop-search', tooltip: 'Reload the tree', handler: function() { theThis.cachedChanges = ""; // Reload the tree theThis.treePanel_Media.loader.load(tree.root, Ext.emptyFn); } }) ], bbar: [ /*theThis.btn_MediaManagerSave = new Ext.Button({ text:'Save All', iconCls:'icon-save-large', scale : 'large', hidden : true, handler : function(){ Ext.Ajax.request({ method: "POST", url: '/MediaManager/SaveMediaManagerChanges', params: { cachedChanges: theThis.cachedChanges }, success : function(result, request) { theThis.cachedChanges = ""; // Reload the tree theThis.treePanel_Media.loader.load(tree.root, function(){}); }, failure : function(result, request) { } }); } }),*/ ], margins: '5 0 25 15', rootVisible: false, root: new Ext.tree.AsyncTreeNode({ text: 'root', //draggable:false, // disable root node dragging allowDrag: false, allowDrop: false, id: 'src' }) }); // Item click handler tree.on('click', function(n) { var sn = this.selModel.selNode || {}; // selNode is null on initial selection if (n.leaf && n.id !== sn.id) { // ignore clicks on folders and currently selected node //alert(n.id); // We need to assign the data to baseParams because we will need this recipeId later on //ingredientFromStockGrid.getStore().baseParams = {recipeId : n.id}; //ingredientFromStockGrid.getStore().load(); } else if (!n.leaf && n.id !== sn.id) { if (getNumberIdFromStringId(n.id) === -1) theThis.dataView_Media.getStore().baseParams = { mediaFolderId: 0 }; else theThis.dataView_Media.getStore().baseParams = { mediaFolderId: getNumberIdFromStringId(n.id)}; theThis.loadMask.show(); theThis.dataView_Media.getStore().load(); theThis.loadMask.hide(); theThis.lbl_FolderNameLink.setText(String.format('', n.text), false); } }); // add an inline editor for the nodes theThis.treeEditor_Media = new Ext.tree.TreeEditor(tree, {/* fieldconfig here */ }, { allowBlank: false, blankText: 'A name is required', selectOnFocus: true, listeners: { complete: function(p_editor, p_value, p_startValue) { // eslint-disable-line var prefix = getPrefixFromStringId(p_editor.editNode.id); if (prefix !== "media") { theThis.treePanel_Media.loadMask.show(); Ext.Ajax.request({ method: "POST", url: '/MediaFolder/UpdateMediaFolderName', params: { mediaFolderId: getNumberIdFromStringId(p_editor.editNode.id), mediaFolderName: p_value }, success: function(result) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); } else { showErrorMessageWithEmailNotify(jsonData.Info); } theThis.treePanel_Media.loadMask.hide(); }, failure: function() { theThis.treePanel_Media.loadMask.hide(); } }); // End ajax } else { //theThis.cachedChanges += '[{"command":"RenameMedia","id":"'+getNumberIdFromStringId(p_editor.editNode.id)+'","name":"'+ p_value +'"}]'; theThis.treePanel_Media.loadMask.show(); Ext.Ajax.request({ method: "POST", url: '/MediaManager/UpdateMediaName', params: { mediaId: getNumberIdFromStringId(p_editor.editNode.id), mediaName: p_value }, success: function(result) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); } else { showErrorMessageWithEmailNotify(jsonData.Info); } theThis.treePanel_Media.loadMask.hide(); }, failure: function() { theThis.treePanel_Media.loadMask.hide(); } }); // End ajax } } } }); return tree; }, // End getTreePanel_Media() initDragZone: function() { var theThis = this; if (theThis.dataView_Media.getEl()) { new theThis.ImageDragZone(theThis.dataView_Media, { containerScroll: true, ddGroup: 'organizerDD' }); theThis.loadTreePanel(); } else { setTimeout(function() { theThis.initDragZone(); }, 500); } }, loadTreePanel: function() { this.treePanel_Media.loader.load(this.treePanel_Media.root, Ext.emptyFn); }, getPanel_ImagesViewer: function() { var theThis = this; // Set up images view theThis.dataView_Media = new Ext.DataView({ id:'pnl_ImageViewerMediaManager', bubbleEvents: ['mediaselected'], itemSelector: 'div.thumb-wrap-fit-height', style: 'overflow:auto', region: 'center', multiSelect: true, plugins: new Ext.DataView.DragSelector({ dragSafe: true }), store: new Ext.data.JsonStore({ url: '/MediaManager/GetMediaURLsByMediaFolderId', baseParams: { mediaFolderId: -1 }, autoLoad: false, root: 'images', id: 'name', fields: [ 'name', 'url', 'id', { name: 'shortName', mapping: 'name', convert: shortName } ], listeners: { loadexception: function(store) { showStoreLoadingErrorMessage(store); theThis.pnl_ImagesViewer.loadMask.hide(); }, beforeload: function() { theThis.pnl_ImagesViewer.loadMask.show(); }, load: function() { theThis.pnl_ImagesViewer.loadMask.hide(); alwaySetScrollBarToFirstElement('#pnl_ImageViewerMediaManager'); } } }), tpl: new Ext.XTemplate( '', '
', '
', '{shortName}', '
', '
' ), listeners: { dblclick: function(view, idx) { var record = this.store.getAt(idx); if (!record) return; var mediaId = record.data.id; view.fireEvent('mediaselected', mediaId); }, contextmenu: function(view, idx, node, e) { e.preventDefault(); Ext.create({ xtype: 'menu', items: [ { text: 'Delete', handler: this.deleteSelections, scope: this} ], listeners: { hide: Ext.destroy } }).showAt(e.getXY()); }, containercontextmenu: function(_, e) { e.preventDefault(); }, afterrender: function(){ } }, getByMediaId: function(id) { var store = this.getStore(); for (var i = 0, ii = store.getCount(); i < ii; ++i) { var item = store.getAt(i); if (item.get('id') === id) return item; } return null; }, deleteSelections: function() { var selections = this.getSelectedRecords(); if (selections.length) { this.promptConfirmDelete(selections); } }, promptConfirmDelete: function(recs) { recs = Ext.isArray(recs) ? recs : [recs]; if (!recs.length) return; var msg = 'Are you sure want to delete: ' + recs.map(function(rec) { return '
' + rec.get('name') + ''; }, theThis.dataView_Media); showConfirmMessage( msg, this.doDeleteMedia, Ext.emptyFn, this, [recs] ); }, /**@private */ doDeleteMedia: function(recs) { var _recs = Ext.isArray(recs) ? recs : [recs]; var mediaIds = _recs.map(function(rec) { return rec.get('id'); }); theThis.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/MediaManager/DeleteMedias', params: { mediaIds: JSON.stringify(mediaIds) }, scope: this, callback: function() { theThis.loadMask.hide(); }, success: function(result) { var res = result.json(); if (res.message.IsSuccess) { showSuccessNotification(res.message.Info, NOTIFICATION.ICON_INFORMATION); this.getStore().remove(recs); } else { showErrorMessageWithEmailNotify(res.message.Info); } } }); } }); var pnl_ImagesViewer = new Ext.Panel({ //id:'images', cls: 'thumbImage ctb-panel-in-tab', region: 'center', margins : '5 10 25 5', layout: 'border', items: [ theThis.topPanel = new Ext.Panel({ height: 0, region: 'north', margins: '10 0 0 0', frame: true, tbar: [ theThis.lbl_FolderNameLink = new Ext.form.Label({ html: '
All media
' }), '->', theThis.btn_SendEmailPhoto = new Ext.Button({ text: 'Send Email', handler: function() { var selNodes = theThis.dataView_Media.getSelectedNodes(); var mediaList = []; var mediaIdList = []; if (!selNodes || !selNodes.length) { Ext.Msg.alert('Warning', 'Please select at least a photo to send email.'); return; } for (var i = 0; i < selNodes.length; i++) { mediaList.push({ mediaId: selNodes[i].id, mediaFileName: jQuery('#' + selNodes[i].id).find('span').html() }); mediaIdList.push(selNodes[i].id); } var reportCode = RP_PhotoEmail; setMailbox_ReportCode(reportCode); setMailbox_Subject(''); setMailbox_AdditionalData(mediaIdList); setMailbox_Recipients(Ext.getCmp('txt_Mailbox_Recipients').getValue()); setMailBox_Body(''); Ext.getCmp('btn_Email_SelectRecipient').setDisabled(false); Ext.getCmp('dlg_Mailbox').isIncludedAttachemnt = true; Ext.getCmp('dlg_Mailbox').callback_AfterShow = function() { setMailBox_Attachment(mediaList); }; Ext.getCmp('dlg_Mailbox').show(); } }), theThis.btn_UploadPhoto = new Ext.Button({ text: 'Upload Photo', iconCls: 'icon-ok-large', handler: function() { var sn = theThis.treePanel_Media.selModel.selNode || null; // selNode is null on initial selection var objectId = sn ? getNumberIdFromStringId(sn.id) : -1; var prefix = sn ? getPrefixFromStringId(sn.id) : -1; if (prefix === 'media') { // Get the folder that store this media // var parentNode = sn.parentNode; // if (parentNode) { // var objectId = getNumberIdFromStringId(parentNode.id); // } } theThis.selectedFolderId = objectId; if (theThis.parentDialog) theThis.parentDialog.selectedFolderId = theThis.selectedFolderId; theThis.dlg_UploadMedia.show(); } }), theThis.btn_DeletePhoto = new Ext.Button({ text: 'Delete Photo', handler: theThis.dataView_Media.deleteSelections, scope: theThis.dataView_Media }), '-', '-' ] }), theThis.dataView_Media ], loadMask: null, listeners: { afterrender: function(p_This) { // Init loadMask p_This.loadMask = new Ext.LoadMask(p_This.getEl(), { msg: 'Please wait...' }); theThis.initDragZone(); } } }); /** * Create a DragZone instance for our JsonView */ theThis.ImageDragZone = function(view, config) { this.view = view; theThis.ImageDragZone.superclass.constructor.call(this, theThis.dataView_Media.getEl(), config); }; Ext.extend(theThis.ImageDragZone, Ext.dd.DragZone, { // We don't want to register our image elements, so let's // override the default registry lookup to fetch the image // from the event instead getDragData: function(e) { var target = e.getTarget('.thumb-wrap-fit-height'); if (target) { var view = this.view; if (!view.isSelected(target)) { theThis.dataView_Media.onClick(e); } var selNodes = theThis.dataView_Media.getSelectedNodes(); var dragData = { nodes: selNodes }; if (selNodes.length === 1) { dragData.ddel = target; dragData.single = true; } else { var div = document.createElement('div'); // create the multi element drag "ghost" div.className = 'multi-proxy'; for (var i = 0, len = selNodes.length; i < len; i++) { div.appendChild(selNodes[i].firstChild.firstChild.cloneNode(true)); // image nodes only if ((i+1) % 3 === 0) { div.appendChild(document.createElement('br')); } } var count = document.createElement('div'); // selected image count count.innerHTML = i + ' images selected'; div.appendChild(count); dragData.ddel = div; dragData.multi = true; } return dragData; } return false; }, // this method is called by the TreeDropZone after a node drop // to get the new tree node (there are also other way, but this is easiest) getTreeNode: function() { var treeNodes = []; var nodeData = this.view.getRecords(this.dragData.nodes); for (var i = 0, len = nodeData.length; i < len; i++) { var data = nodeData[i].data; treeNodes.push(new Ext.tree.TreeNode({ text: data.name, icon: data.url, id: "recipe;"+data.id, data: data, allowDrag: false, allowDrop: false, leaf: true, cls: 'image-node' })); } return treeNodes; }, // the default action is to "highlight" after a bad drop // but since an image can't be highlighted, let's frame it afterRepair: function() { for (var i = 0, len = this.dragData.nodes.length; i < len; i++) { Ext.fly(this.dragData.nodes[i]).frame('#8db2e3', 1); } this.dragging = false; }, // override the default repairXY with one offset for the margins and padding getRepairXY: function(/*e*/) { if (!this.dragData.multi) { var xy = Ext.Element.fly(this.dragData.ddel).getXY(); xy[0]+=3;xy[1]+=3; return xy; } return false; } }); return pnl_ImagesViewer; }, // End getPanel_ImagesViewer getDialog_UploadMedia: function() { // var theThis = this; return new CTB.upload.Window({ closeAction: 'hide', accept: 'image', listeners: { scope: this, beforeshow: function(win) { win.setUploadParams({ endPoint: '/MediaManager/SaveMedia', mediaFolderId: this.selectedFolderId }); } }, scope: this, onFileUploaded: function(store, rec, response) { if (!response.message.IsSuccess) { var isError = /[Ee]rror/.test(response.message.Info); isError ? showErrorMessageWithEmailNotify(response.message.Info) : showNotification('Error', response.message.Info); rec.data.progress = 100; rec.set('error', true); return; } var data = response.data; /** * Dont add if user selected another folder */ if (data.mediaFolderId !== parseInt(this.selectedFolderId)) return; var mediaStore = this.dataView_Media.getStore(); mediaStore.add(new mediaStore.recordType({ name: data.mediaName, url: '/MediaManager/GetMediaByMediaId?mediaId=' + data.mediaId + '&height=150', id: data.mediaId, shortName: shortName(data.mediaName) }, data.mediaName)); } }); /************************************************************************************************/ // ---------------------------------------------------------------------------------- // Upload Image Dialog // ---------------------------------------------------------------------------------- /************************************************************************************************/ // var dlg_UploadMedia = new Ext.CTBSWFUploadFileDialog({ // description: 'Please select an image in your computer.
(only JPG, PNG, and GIF images will be accepted)', // uploadURL: '/MediaManager/TestSWFUpload', // waitingMessage: 'Uploading the new media ...', // iconCls: '', // cls: 'ctbwindow-detail-general', // callback_BeforeShow: function(){ // Because the selected folder is dynamic, we need to assign it again each time user click Save // this.mediaFolderId = theThis.selectedFolderId; // }, // callback_Cancel: function() { // theThis.dataView_Media.getStore().baseParams = {mediaFolderId : theThis.selectedFolderId}; // theThis.dataView_Media.getStore().load(); // }, // callback_UploadSuccess: function(returnJSON) { // // Get selected node // var sn = theThis.treePanel_Media.selModel.selNode || null; // selNode is null on initial selection // var mediaFolderId = 0; // if (sn != null) { // var prefix = getPrefixFromStringId(sn.id); // if (prefix == "media") { // sn = sn.parentNode; // } // mediaFolderId = getNumberIdFromStringId(sn.id); // } // else { // sn = theThis.treePanel_Media.root.item(0); // } // // Reload the folder // theThis.treePanel_Media.getSelectionModel().select(sn); // theThis.dataView_Media.getStore().baseParams = { mediaFolderId : mediaFolderId }; // theThis.dataView_Media.getStore().load(); // var node = sn.appendChild(new Ext.tree.TreeNode({ // text: returnJSON.data.mediaName, // icon: String.format('/MediaManager/GetMediaByMediaId?mediaId={0}&height=32&loc=mediamanager', returnJSON.data.mediaId), // id : "media;" + returnJSON.data.mediaId, // leaf : true, // allowDrag:false, // allowDrop:false // })); // } // }); // // return dlg_UploadMedia; } // End getDialog_UploadMedia() }); Ext.reg('CTBMediaManagerPanel', Ext.CTBMediaManagerPanel); Ext.CTBMediaManager = Ext.extend(Ext.Window, { title: 'Media Manager', layout: 'border', closeAction: 'hide', iconCls: 'icon-stock ', expandOnShow: true, closable: true, resizable: true, modal: true, plain: true, minimizable: true, maximizable: true, monitorResize: true, width: 800, height: 500, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, pageSize: CTB.init.itemPerPage || 100, isShowedFirstTime: false, selectedMediaId: -1, selectedFolderId: -1, callback_Select: null, newAlbumIndex: 0, cachedChanges: "", listeners: { hide: function() { this.pnl_MediaManager.dataView_Media.clearSelections(); }, beforeshow: function(theThis) { // Fit this window to the client browser screen with 90% fitWindowSize(theThis, 90); }, show: function() { /*if (!this.isShowedFirstTime){ this.isShowedFirstTime = true; var dragZone = new this.ImageDragZone(this.dataView_Media, {containerScroll:true, ddGroup: 'organizerDD'}); }*/ }, mediaselected: function(mediaId) { this.onChooseMedia(mediaId); } }, initComponent: function() { var theThis = this; // MAIN GRID /*theThis.treePanel_Media = theThis.getTreePanel_Media(); theThis.pnl_ImagesViewer = theThis.getPanel_ImagesViewer(); theThis.dlg_UploadMedia = theThis.getDialog_UploadMedia(); theThis.items = [theThis.treePanel_Media, theThis.pnl_ImagesViewer];*/ theThis.pnl_MediaManager = new Ext.CTBMediaManagerPanel({ region: 'center' }); theThis.items = [theThis.pnl_MediaManager]; // BUTTONS var myButtons = theThis.initButtons(); this.buttons = myButtons; this.initTools(); Ext.CTBMediaManager.superclass.initComponent.call(this); }, initButtons: function() { var theThis = this; var buttons = [ { text: 'Select', iconCls: 'icon-ok-large ', scale: 'large', handler: function() { var selectMediaNodes = theThis.pnl_MediaManager.dataView_Media.getSelectedNodes(); if (selectMediaNodes.length > 0) { var mediaId = (theThis.selectedMediaId = parseInt(selectMediaNodes[0].id)); theThis.onChooseMedia(mediaId); // Call the callback function // if (theThis.callback_Select != null) // theThis.callback_Select(theThis.selectedMediaId); //changeRecipePicture(view.getSelectedNodes()[0].id) } // theThis.hide(); } }, { text: 'Cancel', iconCls: 'icon-cancel-large', scale: 'large', handler: this.onClose, scope: this } ]; return buttons; }, // End initButtons() onClose: function() { this[this.closeAction](); }, onChooseMedia: function(mediaId) { var t = typeof mediaId; if (t !== 'number') return; if (typeof this.callback_Select === 'function') { this.callback_Select(mediaId); } this.hide(); } }); function shortName(name) { if (name.length > 15) { return name.substr(0, 12) + '...'; } return name; } Ext.reg('CTBMediaManager', Ext.CTBMediaManager); Ext.tree.AsyncTreeNode.path = ""; Ext.tree.TreeNode.path = ""; Ext.CTBDocumentManager = Ext.extend(Ext.Window, { title: 'Document Manager', layout: 'border', closeAction: 'hide', iconCls: '', cls: 'ctbwindow-detail-general', expandOnShow: true, closable: true, resizable: true, modal: true, plain: true, minimizable: true, maximizable: true, monitorResize: true, width: 800, height: 500, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, pageSize: CTB.init.itemPerPage || 100, isShowedFirstTime: false, selectedDocumentId: -1, selectedFolderId: -1, callback_Select: null, newAlbumIndex: 0, cachedChanges: "", instructionText: '', instructionBackgroundColor: '#549363', refreshSelectedFolder: false, setInstruction: function(instructionText) { var theThis = this; theThis.instructionText = instructionText; }, listeners: { beforehide: function(theThis) { // Reset data theThis.instructionText = ''; theThis.callback_Select = null; theThis.refreshSelectedFolder = false; }, beforeshow: function(theThis) { // Fit this window to the client browser screen with 90% fitWindowSize(theThis, 90); }, show: function(theThis) { if (!theThis.isShowedFirstTime) { theThis.isShowedFirstTime = true; new theThis.ImageDragZone(theThis.dataView_Document, { containerScroll: true, ddGroup: 'organizerDD' }); } // Instruction panel if (theThis.pnl_Instruction.rendered) { if (theThis.instructionText) { theThis.pnl_Instruction.setVisible(true); theThis.pnl_Instruction.update({ instructionBackgroundColor: theThis.instructionBackgroundColor, instructionText: theThis.instructionText }); } else { theThis.pnl_Instruction.setVisible(false); } } // Select button if (theThis.callback_Select) { theThis.btn_Select.setVisible(true); } else { theThis.btn_Select.setVisible(false); } }, afterrender: function(theThis) { theThis.loadMask = new Ext.LoadMask(theThis.getEl(), { msg: "Please wait..." }); theThis.dataView_Document.getStore().baseParams = { path: '' }; theThis.dataView_Document.getStore().load(); // theThis.autoCheckingSelectedDataViewNodes(); } }, initComponent: function() { var theThis = this; // MAIN GRID theThis.treePanel_Document = theThis.getTreePanel_Document(); theThis.pnl_ImagesViewer = theThis.getPanel_ImagesViewer(); theThis.dlg_UploadDocument = theThis.getDialog_UploadDocument(); theThis.tpl_Instruction = new Ext.XTemplate('', '
', '', '', '', '', '
', '{instructionText}', '
', '
', '
'); theThis.pnl_Instruction = new Ext.Panel({ region: 'north', margins: '10 10 0 10', frame: true, height: 50, tpl: theThis.tpl_Instruction, listeners: { afterrender: function(p_This) { if (theThis.instructionText) { p_This.setVisible(true); p_This.update({ instructionBackgroundColor: theThis.instructionBackgroundColor, instructionText: theThis.instructionText }); } else { p_This.setVisible(false); } } } }); theThis.items = [theThis.treePanel_Document, theThis.pnl_ImagesViewer, theThis.pnl_Instruction]; // BUTTONS var myButtons = theThis.initButtons(); this.buttons = myButtons; this.initTools(); Ext.CTBDocumentManager.superclass.initComponent.call(this); }, autoCheckingSelectedDataViewNodes: function() { var theThis = this; function checkNow() { if (theThis.isVisible()) { var selectedNodes = theThis.getSelectedDataViewNodes(); var count = 0; if (selectedNodes.length > 0) { // If all selected file is excel, set visible Import recipe and Import stock buttno for (var i = 0; i < selectedNodes.length; i++) { if (selectedNodes[i].data && selectedNodes[i].data.path) { var fileExt = GetFileExtension(selectedNodes[i].data.path); if (fileExt && (fileExt.toUpperCase() === 'XLSX' || fileExt.toUpperCase() === 'DOC' || fileExt.toUpperCase() === 'DOCX')) { count++; } } } } if (count > 0 && count === selectedNodes.length) { theThis.btn_ImportRecipe.setVisible(true); theThis.btn_SwitchSupplier.setVisible(true); //theThis.btn_ImportRecipeAndFixUpUnit.setVisible(true); theThis.btn_ImportStock.setVisible(true); theThis.btn_Delete.setVisible(true); } else { theThis.btn_ImportRecipe.setVisible(false); theThis.btn_SwitchSupplier.setVisible(false); //theThis.btn_ImportRecipeAndFixUpUnit.setVisible(false); theThis.btn_ImportStock.setVisible(false); theThis.btn_Delete.setVisible(false); } } theThis.checkTimeout = setTimeout(checkNow, 500); } checkNow(); }, initButtons: function() { var theThis = this; var buttons = [ theThis.btn_SwitchSupplier = new Ext.Button({ text: 'Switch supplier', tooltip: 'Switch supplier', iconCls: 'icon-import-large', scale: 'large', hidden: true, handler: function() { // Do import recipe using selected excel files var selectedNodes = theThis.getSelectedDataViewNodes(); if (!selectedNodes.length) { showErrorNotification('Notice', 'Please select file(s) to start importing'); return; } var filePaths = []; for (var i = 0; i < selectedNodes.length; i++) { if (selectedNodes[i].data && selectedNodes[i].data.path) { filePaths[filePaths.length] = selectedNodes[i].data.path; } } if (!filePaths.length) return; var dlg_SwitchSupplier = new Ext.CTBSwitchingSupplierWindow(); dlg_SwitchSupplier.callback_AfterSubmit = function(fromSupplierId, toSupplierId) { theThis.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/SwitchSupplier', timeout: 1800000, params: { filePaths: Ext.util.JSON.encode(filePaths), fromSupplierId: fromSupplierId, toSupplierId: toSupplierId }, success: function(result) { theThis.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { theThis.dlg_AffectedRecipes = theThis.getConfirmRecipesAffectedWindow(jsonData.data); theThis.dlg_AffectedRecipes.show(); /* if (theThis.dlg_ImportRecipeApproval == null) { theThis.dlg_ImportRecipeApproval = new Ext.CTBImportRecipeApprovalWindow({ }); } theThis.dlg_ImportRecipeApproval.setRecipeRecords(jsonData.data); theThis.dlg_ImportRecipeApproval.show();*/ } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function() { theThis.loadMask.hide(); } }); }; dlg_SwitchSupplier.show(); } }), theThis.btn_ImportRecipeAndFixUpUnit = new Ext.Button({ text: 'Import recipes and fix up unit issue', tooltip: 'Import recipe and fix it unit issue', iconCls: 'icon-import-large', scale: 'large', hidden: true, handler: function() { // Do import recipe using selected excel files var selectedNodes = theThis.getSelectedDataViewNodes(); if (!selectedNodes.length) { showErrorNotification('Notice', 'Please select file(s) to start importing'); return; } var filePaths = []; for (var i = 0; i < selectedNodes.length; i++) { if (selectedNodes[i].data && selectedNodes[i].data.path) { filePaths[filePaths.length] = selectedNodes[i].data.path; } } if (filePaths.length > 0) { // Send ajax request theThis.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/ImportRecipes', timeout: 1800000, params: { filePaths: Ext.util.JSON.encode(filePaths), isForFixingUpUnit: true }, success: function(result) { theThis.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { if (!theThis.dlg_ImportRecipeApproval) { theThis.dlg_ImportRecipeApproval = new Ext.CTBImportRecipeApprovalWindow({}); } theThis.dlg_ImportRecipeApproval.RecipeBookController = '/RecipeBook'; theThis.dlg_ImportRecipeApproval.RecipeFolderController = '/RecipeFolder'; theThis.dlg_ImportRecipeApproval.setRecipeRecords(jsonData.data); theThis.dlg_ImportRecipeApproval.show(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function() { theThis.loadMask.hide(); } }); } } }), theThis.btn_ImportRecipe = new Ext.Button({ text: 'Import recipes', tooltip: 'Import recipe into your recipe book by excel template', iconCls: 'icon-import-large', scale: 'large', hidden: true, handler: function() { // Do import recipe using selected excel files var selectedNodes = theThis.getSelectedDataViewNodes(); if (!selectedNodes.length) { showErrorNotification('Notice', 'Please select file(s) to start importing'); return; } var filePaths = []; for (var i = 0; i < selectedNodes.length; i++) { if (selectedNodes[i].data && selectedNodes[i].data.path) { filePaths[filePaths.length] = selectedNodes[i].data.path; } } if (filePaths.length > 0) { // Send ajax request theThis.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/ImportRecipes', timeout: 1800000, params: { filePaths: Ext.util.JSON.encode(filePaths) }, success: function(result) { theThis.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { if (!theThis.dlg_ImportRecipeApproval) { theThis.dlg_ImportRecipeApproval = new Ext.CTBImportRecipeApprovalWindow({}); } theThis.dlg_ImportRecipeApproval.RecipeBookController = '/RecipeBook'; theThis.dlg_ImportRecipeApproval.RecipeFolderController = '/RecipeFolder'; theThis.dlg_ImportRecipeApproval.setRecipeRecords(jsonData.data); theThis.dlg_ImportRecipeApproval.show(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function() { theThis.loadMask.hide(); } }); } } }), theThis.btn_ImportStock = new Ext.Button({ text: 'Import stocks', tooltip: 'Import stock into your CTB by excel template', iconCls: 'icon-import-large', scale: 'large', hidden: true, disabled: (!CheckAuthothority(AU_Admin_AddressBook) || CheckAuthothority(AU_ReadOnly_Admin_AddressBook)), handler: function() { // Do import stocks using selected excel files var selectedNodes = theThis.getSelectedDataViewNodes(); if (!selectedNodes.length) { showErrorNotification('Notice', 'Please select file(s) to start importing'); return; } var filePaths = []; for (var i = 0; i < selectedNodes.length; i++) { if (selectedNodes[i].data && selectedNodes[i].data.path) { filePaths[filePaths.length] = selectedNodes[i].data.path; } } if (filePaths.length > 0) { // Send ajax request theThis.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/ImportStocks', timeout: 1800000, params: { filePaths: Ext.util.JSON.encode(filePaths) }, success: function(result) { theThis.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { if (!theThis.dlg_ImportStockApproval) { theThis.dlg_ImportStockApproval = new Ext.CTBImportStockApprovalWindow(); } theThis.dlg_ImportStockApproval.setStockRecords(jsonData.data); theThis.dlg_ImportStockApproval.show(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function() { theThis.loadMask.hide(); } }); } } }), theThis.btn_Download = new Ext.Button({ text: 'Download', iconCls: 'icon-download-large', scale: 'large', hidden: true, handler: function() { var selectedNodes = theThis.getSelectedDataViewNodes(); if (!selectedNodes.length) { showErrorNotification('Notice', 'Please select file(s) to download'); } } }), theThis.btn_Select = new Ext.Button({ text: 'Select', iconCls: 'icon-ok-large', scale: 'large', handler: function() { var selectedFolderNode = theThis.getSelectedFolderNode(); if (selectedFolderNode) { if (theThis.callback_Select) theThis.callback_Select(selectedFolderNode); if (!theThis.refreshSelectedFolder) theThis.hide(); else { // Not hiding } } else { showErrorNotification('Notice', 'Please select a folder'); } } }), theThis.btn_Delete = new Ext.Button({ text: 'Delete', iconCls: 'icon-ok-large', scale: 'large', hidden: true, handler: function() { var selectedNodes = theThis.getSelectedDataViewNodes(); Ext.Msg.show({ title: 'Confirm', msg: 'Are you sure you want to delete the document files ?', buttons: Ext.Msg.YESNO, icon: Ext.MessageBox.QUESTION, fn: function(btn) { if (btn === 'yes') { //theThis.deleteFiles([selectedNodes[0].data.id]); var filePaths = []; filePaths.push(selectedNodes[0].data.id); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/DeleteFiles', params: { filePaths: Ext.util.JSON.encode(filePaths) }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { theThis.reloadFilesInSelectedNode(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); return false; } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); } } }); } }), { text: 'Cancel', iconCls: 'icon-cancel-large', scale: 'large', handler: function() { theThis.hide(); } } ]; return buttons; }, // End initButtons() loadData: function() { var theThis = this; theThis.treePanel_Document.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/GetAllDocumentFolders', params: {}, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { // set the root node var root = new Tree.AsyncTreeNode({ text: 'root', draggable: false, //id:'source', children: jsonData.data }); theThis.treePanel_Document.setRootNode(root); theThis.treePanel_Document.render(); // Select the root node if (theThis.rendered) { if (theThis.treePanel_Document.root.item(0)) { theThis.treePanel_Document.getSelectionModel().select(theThis.treePanel_Document.root.item(0)); } theThis.loadMask.hide(); } } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); } }); // End ajax }, reloadFilesInSelectedNode: function() { var theThis = this; var sn = theThis.treePanel_Document.selModel.selNode || null; // selNode is null on initial selection if (sn) { if (sn.attributes.type === 'folder') { theThis.dataView_Document.getStore().baseParams = { path: sn.attributes.path }; theThis.dataView_Document.getStore().load(); } } }, getSelectedFolderNode: function(returnNULLWhenNoNodeDetected) { var theThis = this; if (!returnNULLWhenNoNodeDetected) returnNULLWhenNoNodeDetected = false; var sn = theThis.treePanel_Document.selModel.selNode || null; // selNode is null on initial selection if (sn ) { if (sn.leaf) sn = sn.parentNode; sn.expand(); return sn; } else { if (returnNULLWhenNoNodeDetected) return null; else return theThis.treePanel_Document.root.item(0); } }, getSelectedNode: function() { return this.treePanel_Document.selModel.selNode || this.treePanel_Document.root.item(0); }, // This function will return selected nodes from the image viewer panel getSelectedDataViewNodes: function() { var theThis = this; return theThis.dataView_Document.getRecords(theThis.dataView_Document.getSelectedNodes()); }, moveFolderToFolder: function(folderNode, targetNode) { var theThis = this; theThis.treePanel_Document.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/MoveFolderToFolder', params: { fromPath: folderNode.attributes.path, toPath: targetNode.attributes.path }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { // Change the path folderNode.attributes.path = jsonData.data.path; theThis.treePanel_Document.getSelectionModel().select(folderNode); theThis.reloadFilesInSelectedNode(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); return false; } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); }, moveFilesToFolder: function(fileNodes, targetNode) { var theThis = this; var selectedFolderNode = theThis.getSelectedFolderNode(true); // Ignore if move to the same folder if (selectedFolderNode && selectedFolderNode.attributes.path === targetNode.attributes.path) { return; } // Get all the paths of the file nodes var filePaths = []; for (var i = 0; i < fileNodes.length; i++) { filePaths[filePaths.length] = fileNodes[i].attributes.path; } theThis.treePanel_Document.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/MoveFilesToFolder', params: { filePaths: Ext.util.JSON.encode(filePaths), folderPath: targetNode.attributes.path }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { theThis.treePanel_Document.getSelectionModel().select(targetNode); // Delete the old nodes in the old folder if (selectedFolderNode) { var deletedNodes = []; selectedFolderNode.eachChild(function(p_Node) { for (var j = 0; j < fileNodes.length; j++) { if (fileNodes[j].attributes.path === p_Node.attributes.path) { //oldFolderNode.removeChild(oldFolderNode.childNodes[i]); deletedNodes[deletedNodes.length] = p_Node; break; } } }); // Real deletion process for (var j = 0; j < deletedNodes.length; j++) { deletedNodes[j].remove(); } } // Change the path for (j = 0; j < fileNodes.length; j++) { fileNodes[j].attributes.path = targetNode.attributes.path + '\\' + fileNodes[j].text; } // Reload the image viewer theThis.reloadFilesInSelectedNode(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); return false; } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); }, deleteFolders: function(folderNodes, targetNode) { var theThis = this; // Get all the paths of the file nodes var folderPaths = []; for (var i = 0; i < folderNodes.length; i++) { folderPaths[folderPaths.length] = folderNodes[i].attributes.path; } theThis.treePanel_Document.loadMask.show(); var sn = theThis.getSelectedFolderNode(); // console.log("folderPaths",folderPaths); // console.log("snSelectionNode",sn); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/DeleteFolders', params: { folderPaths: Ext.util.JSON.encode(folderPaths), path: sn.attributes.path, folderName: sn.attributes.text }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); theThis.treePanel_Document.getSelectionModel().select(theThis.getSelectedFolderNode()); // Reload the image viewer //theThis.reloadFilesInSelectedNode(); theThis.loadData(); } else { //showErrorMessageWithEmailNotify(jsonData.message.Info); showWarningMessage(jsonData.message.Info); return false; } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); }, deleteFiles: function(fileNodes, targetNode) { var theThis = this; var selectedFolderNode = theThis.getSelectedFolderNode(); // Get all the paths of the file nodes var filePaths = []; for (var i = 0; i < fileNodes.length; i++) { filePaths[filePaths.length] = fileNodes[i].attributes.path; } theThis.treePanel_Document.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/DeleteFiles', params: { filePaths: Ext.util.JSON.encode(filePaths) }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { // Remove the file nodes for (var j = 0; j < fileNodes.length; j++) { fileNodes[j].remove(); } // Select the folder theThis.treePanel_Document.getSelectionModel().select(selectedFolderNode); // Reload the image viewer theThis.reloadFilesInSelectedNode(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); return false; } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); }, getTreePanel_Document: function() { var theThis = this; // set up the Album tree var tree = new Ext.tree.TreePanel({ frame: true, animate: true, border: true, enableDD: true, containerScroll: true, ddGroup: 'organizerDD', margins: '5 5 10 10', region: 'west', width: 345, title: 'My Documents', loadMask: null, listeners: { nodedrop: function(e) { if (e.dropNode instanceof Array) { theThis.moveFilesToFolder(e.dropNode, e.target); } else { if (e.dropNode.attributes.type === 'folder') theThis.moveFolderToFolder(e.dropNode, e.target); else if (e.dropNode.attributes.type === 'file') theThis.moveFilesToFolder([e.dropNode], e.target); } }, afterrender: function(p_This) { // Init loadMask p_This.loadMask = new Ext.LoadMask(p_This.getEl(), { msg: 'Please wait...' }); theThis.loadData(); } }, autoScroll: true, tbar: [ theThis.btn_AddDocumentFolder = new Ext.Button({ text: 'Add folder', iconCls: 'icon-add-folder-large icon-add', scale: 'large', handler: function() { showInputMessage("Please enter the folder's name", function(val) { if (!val) return; // Get selection node var sn = theThis.getSelectedFolderNode(); theThis.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/AddNewFolder', params: { folderName: val, path: sn.attributes.path }, success: function(result) { theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); var node = sn.appendChild( new Ext.tree.TreeNode({ text: jsonData.data.folderName, cls: 'album-node', //leaf:false, //id: "documentfolder;"+jsonData.data.folderName, allowDrag: true, allowDrop: true, path: jsonData.data.path, type: 'folder' }) ); theThis.treePanel_Document.getSelectionModel().select(node); //theThis.dataView_Document.getStore().baseParams = {documentFolderId : -1}; //theThis.dataView_Document.getStore().load(); setTimeout(function() { theThis.treeEditor_Document.editNode = node; theThis.treeEditor_Document.startEdit(node.ui.textNode); }, 100); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function() { theThis.loadMask.hide(); } }); // End ajax }); } }), theThis.btn_AddDocument = new Ext.Button({ text: 'Add document', iconCls: 'icon-add', scale: 'large', handler: function() { //var selectedFolder = theThis.getSelectedFolderNode(); theThis.dlg_UploadDocument.show(); } }), theThis.btn_DeleteDocument = new Ext.Button({ text: 'Delete', iconCls: 'icon-delete', scale: 'large', handler: function() { var sn = theThis.getSelectedNode(); Ext.Msg.show({ title: 'Confirm', msg: sn.attributes.type === 'file' ? 'Are you sure you want to delete the document files ?' : 'Are you sure you want to delete the document folders ?', buttons: Ext.Msg.YESNO, icon: Ext.MessageBox.QUESTION, fn: function(btn) { if (btn === 'yes') { if (sn.attributes.type === 'file') theThis.deleteFiles([sn]); else if (sn.attributes.type === 'folder') theThis.deleteFolders([sn]); } } }); } }) // End button_DeleteDocument ], bbar: [ /*theThis.btn_DocumentManagerSave = new Ext.Button({ text:'Save All', iconCls:'icon-save-large', scale : 'large' }),*/ theThis.btn_DocumentManagerCancel = new Ext.Button({ text: 'Reload', iconCls: 'btn-refresh', scale: 'large', handler: function() { // Reload the tree // theThis.treePanel_Document.loader.load(tree.root, function(){}); theThis.loadData(); } }) ], rootVisible: false, root: new Ext.tree.AsyncTreeNode({ text: 'root', //draggable:false, // disable root node dragging allowDrag: false, allowDrop: false }) }); // Item click handler tree.on('click', function(n) { var sn = this.selModel.selNode || null; // selNode is null on initial selection if (n.leaf && n.id !== sn.id) { // ignore clicks on folders and currently selected node //alert(n.id); // We need to assign the data to baseParams because we will need this recipeId later on //ingredientFromStockGrid.getStore().baseParams = {recipeId : n.id}; //ingredientFromStockGrid.getStore().load(); } else if (!n.leaf && n.id !== sn.id) { if (n.attributes.type === 'folder') { theThis.dataView_Document.getStore().baseParams = { path: n.attributes.path }; theThis.dataView_Document.getStore().load(); } /*if (getNumberIdFromStringId(n.id) == -1) theThis.dataView_Document.getStore().baseParams = {documentFolderId : 0}; else theThis.dataView_Document.getStore().baseParams = {documentFolderId : getNumberIdFromStringId(n.id)}; theThis.dataView_Document.getStore().load();*/ } }); // add an inline editor for the nodes theThis.treeEditor_Document = new Ext.tree.TreeEditor(tree, {/* fieldconfig here */}, { allowBlank: false, blankText: 'A name is required', selectOnFocus: true, listeners: { startedit: function() { var theEditor = theThis.treeEditor_Document; if (theEditor.editNode.attributes.type === 'file') { // Only display the name part, not the extension part if (theEditor.editNode.text.indexOf('.') !== -1) { theEditor.setValue(theEditor.editNode.text.substring(0, theEditor.editNode.text.lastIndexOf('.'))); } } }, complete: function(p_editor, p_value, p_startValue) { var theStartValue = p_startValue; // The start value will be different the if the node presented a file if (p_editor.editNode.attributes.type === 'file') { if (theStartValue.indexOf('.') !== -1) { theStartValue = theStartValue.substring(0, theStartValue.lastIndexOf('.')); } } if (theStartValue == p_value) { p_editor.editNode.setText(p_startValue); return false; } else if (theStartValue != p_value) { theThis.treePanel_Document.loadMask.show(); if (p_editor.editNode.attributes.type === 'folder') { Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/RenameFolder', params: { folderName: p_startValue, newName: p_value, path: p_editor.editNode.attributes.path }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { // Change the path p_editor.editNode.attributes.path = jsonData.data.path; } else { showErrorMessageWithEmailNotify(jsonData.message.Info); return false; } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); // End ajax } else if (p_editor.editNode.attributes.type === 'file') { Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/RenameFile', params: { fileName: p_startValue, newName: p_value, path: p_editor.editNode.attributes.path }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { // Do nothing p_editor.editNode.attributes.path = jsonData.data.path; p_editor.editNode.setText(jsonData.data.fileName); // Reload the folder } else { showErrorMessageWithEmailNotify(jsonData.message.Info); return false; } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); // End ajax } } } } }); return tree; }, // End getTreePanel_Document() getPanel_ImagesViewer: function() { var theThis = this; // Set up images view theThis.dataView_Document = new Ext.DataView({ itemSelector: 'div.thumb-wrap-fit-height', style: 'overflow: auto', region: 'center', multiSelect: true, plugins: new Ext.DataView.DragSelector({ dragSafe: true }), store: new Ext.data.JsonStore({ url: '/DocumentManager/GetDocumentsInDocumentFolder', baseParams: { path: '' }, autoLoad: false, root: 'data', id: 'name', fields: [ 'name', 'url', 'id', 'path', 'download_path', { name: 'shortName', mapping: 'name', convert: shortName } ], listeners: { loadexception: function() { showStoreLoadingErrorMessage(theThis.dataView_Document.getStore()); theThis.pnl_ImagesViewer.loadMask.hide(); }, beforeload: function() { theThis.pnl_ImagesViewer.loadMask.show(); }, load: function() { theThis.pnl_ImagesViewer.loadMask.hide(); } } }), tpl: new Ext.XTemplate( '', '
', '
', '{shortName}', '
', '
' ), listeners: { scope: this, selectionchange: function(view, selections) { var shouldShowBtns = selections.length > 0; theThis.btn_ImportRecipe.setVisible(shouldShowBtns); theThis.btn_SwitchSupplier.setVisible(shouldShowBtns); //theThis.btn_ImportRecipeAndFixUpUnit.setVisible(true); theThis.btn_ImportStock.setVisible(shouldShowBtns); theThis.btn_Delete.setVisible(shouldShowBtns); } } }); var pnl_ImagesViewer = new Ext.Panel({ //id:'images', cls: 'thumbImage', title: 'My documents', region: 'center', margins: '5 10 5 0', layout: 'border', frame: true, items: theThis.dataView_Document, loadMask: null, listeners: { afterrender: function(p_This) { // Init loadMask p_This.loadMask = new Ext.LoadMask(p_This.getEl(), { msg: 'Please wait...' }); } } }); /** * Create a DragZone instance for our JsonView */ theThis.ImageDragZone = function(view, config) { this.view = view; theThis.ImageDragZone.superclass.constructor.call(this, theThis.dataView_Document.getEl(), config); }; Ext.extend(theThis.ImageDragZone, Ext.dd.DragZone, { // We don't want to register our image elements, so let's // override the default registry lookup to fetch the image // from the event instead getDragData: function(e) { var target = e.getTarget('.thumb-wrap-fit-height'); if (target) { var view = this.view; if (!view.isSelected(target)) { theThis.dataView_Document.onClick(e); } var selNodes = theThis.dataView_Document.getSelectedNodes(); var dragData = { nodes: selNodes }; if (selNodes.length === 1) { dragData.ddel = target; dragData.single = true; } else { var div = document.createElement('div'); // create the multi element drag "ghost" div.className = 'multi-proxy'; for (var i = 0, len = selNodes.length; i < len; i++) { div.appendChild(selNodes[i].firstChild.firstChild.cloneNode(true)); // image nodes only if ((i + 1) % 3 === 0) { div.appendChild(document.createElement('br')); } } var count = document.createElement('div'); // selected image count count.innerHTML = i + ' documents selected'; div.appendChild(count); dragData.ddel = div; dragData.multi = true; } return dragData; } return false; }, // this method is called by the TreeDropZone after a node drop // to get the new tree node (there are also other way, but this is easiest) getTreeNode: function() { var treeNodes = []; var nodeData = this.view.getRecords(this.dragData.nodes); for (var i = 0, len = nodeData.length; i < len; i++) { var data = nodeData[i].data; treeNodes.push( new Ext.tree.TreeNode({ text: data.name, icon: data.url, //id : "documentfile;"+data.id, //data: data, allowDrag: true, allowDrop: true, leaf: true, cls: 'image-node', path: data.path, type: 'file' }) ); } return treeNodes; }, // the default action is to "highlight" after a bad drop // but since an image can't be highlighted, let's frame it afterRepair: function() { for (var i = 0, len = this.dragData.nodes.length; i < len; i++) { Ext.fly(this.dragData.nodes[i]).frame('#8db2e3', 1); } this.dragging = false; }, // override the default repairXY with one offset for the margins and padding getRepairXY: function() { if (!this.dragData.multi) { var xy = Ext.Element.fly(this.dragData.ddel).getXY(); xy[0] += 3; xy[1] += 3; return xy; } return false; } }); return pnl_ImagesViewer; }, // End getPanel_ImagesViewer getDialog_UploadDocument: function() { return new CTB.upload.Window({ title: 'Upload Document', closeAction: 'hide', maxFileSizeKB: 10280, accept: (function() { var types = CTB.upload.types; return [types.excel, types.word, types.pdf, types.text, types.csv]; })(), listeners: { scope: this, beforeshow: function(win) { var selectedFolder = this.getSelectedFolderNode(); win.setUploadParams({ endPoint: '/DocumentManager/UploadDocuments', mediaFolderId: selectedFolder.attributes.path }); } }, scope: this, onFileUploaded: function(store, rec, response) { if (!response.message.IsSuccess) { var isError = /[Ee]rror/.test(response.message.Info); isError ? showErrorMessageWithEmailNotify(response.message.Info) : showNotification('Error', response.message.Info); rec.data.progress = 100; rec.set('error', true); return; } var data = response.data; /** * Dont add if user selected another folder */ var selectedFolder = this.getSelectedFolderNode(); var mediaStore = this.dataView_Document.getStore(); if (mediaStore.baseParams.path !== selectedFolder.attributes.path) return; mediaStore.add(new mediaStore.recordType({ name: data.name, url: data.url, id: data.id, path: data.download_path, download_path: data.download_path, shortName: shortName(data.name) })); } }); }, getConfirmRecipesAffectedWindow: function(theAffectedRecipes) { // var theThis = this; var data = []; for (var i = 0; i < theAffectedRecipes.length; i++) { var detail = []; detail.push(theAffectedRecipes[i].recipeId); detail.push(theAffectedRecipes[i].recipeName); data.push(detail); } var store = new Ext.data.ArrayStore({ fields: [ { name: 'recipeId', type: 'int' }, { name: 'recipeName', type: 'string' } ], data: data }); var colModel = new Ext.grid.ColumnModel([ { header: 'ID', dataIndex: 'recipeId', width: 10, hidden: true }, { header: 'Recipe Name', dataIndex: 'recipeName', width: 100 } ]); var confirmWindow = new Ext.Window({ iconCls: '', cls: 'ctbwindow-detail-general', layout: 'border', width: 600, height: 350, items: [ { margins: '10 10 10 10', xtype: 'label', region: 'north', text: 'There are the recipes have been affected by switching supplier' }, { xtype: 'grid', region: 'center', margins: '10 10 10 10', store: store, cm: colModel, height: 300, listeners: {}, view: new Ext.grid.GridView({ enableRowBody: true, forceFit: true // IMPORTANT (USE THIS ATTRIBUTE TO USE PERCENTAGE IN COLUMN MODEL) }) } ], buttons: [ { xtype: 'button', text: 'Close', handler: function() { confirmWindow.hide(); } } ] }); return confirmWindow; } }); function shortName(name) { if (name.length > 30) { return name.substr(0, 27) + '...'; } return name; } Ext.reg('CTBDocumentManager', Ext.CTBDocumentManager); Ext.tree.AsyncTreeNode.path = ""; Ext.tree.TreeNode.path = ""; Ext.CTBRecipeManager = Ext.extend(Ext.Window, { title: 'Recipe Manager', layout: 'border', closeAction: 'hide', iconCls: '', cls: 'ctbwindow-detail-general', expandOnShow: true, closable: true, resizable: true, modal: true, plain: true, minimizable: true, maximizable: true, monitorResize: true, width: 800, height: 500, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, pageSize: CTB.init.itemPerPage || 100, isShowedFirstTime: false, selectedDocumentId: -1, selectedFolderId: -1, callback_Select: null, newAlbumIndex: 0, cachedChanges: "", instructionText: '', instructionBackgroundColor: '#549363', refreshSelectedFolder: false, RecipeBookController: '/RecipeBook', RecipeDetailController: '/RecipeDetail', RecipeFolderController: '/RecipeFolder', tempRecipeFolderId : -1, setInstruction: function(instructionText) { var theThis = this; theThis.instructionText = instructionText; }, reloadData: function(){ this.searchRecipeName = ''; this.searchType = -1; this.loadData(true); }, listeners: { beforehide: function(theThis) { // Reset data theThis.instructionText = ''; theThis.callback_Select = null; theThis.refreshSelectedFolder = false; }, beforeshow: function(theThis) { // Fit this window to the client browser screen with 90% fitWindowSize(theThis, 90); }, show: function(theThis) { if (!theThis.isShowedFirstTime) { theThis.isShowedFirstTime = true; new theThis.ImageDragZone(theThis.dataView_Document, { containerScroll: true, ddGroup: 'organizerDD' }); } // Instruction panel if (theThis.pnl_Instruction.rendered) { if (theThis.instructionText) { theThis.pnl_Instruction.setVisible(true); theThis.pnl_Instruction.update({ instructionBackgroundColor: theThis.instructionBackgroundColor, instructionText: theThis.instructionText }); } else { theThis.pnl_Instruction.setVisible(false); } } // Select button // if (theThis.callback_Select) { // theThis.btn_Select.setVisible(true); // } else { // theThis.btn_Select.setVisible(false); // } }, afterrender: function(theThis) { theThis.loadMask = new Ext.LoadMask(theThis.getEl(), { msg: "Please wait..." }); theThis.reloadRecipeForRootNode(); // theThis.autoCheckingSelectedDataViewNodes(); } }, initComponent: function() { var theThis = this; this.searchRecipeName = ''; this.searchType = -1; // MAIN GRID theThis.treePanel_Document = theThis.getTreePanel_Document(); theThis.pnl_ImagesViewer = theThis.getPanel_ImagesViewer(); theThis.dlg_UploadDocument = theThis.getDialog_UploadDocument(); theThis.tpl_Instruction = new Ext.XTemplate('', '
', '', '', '', '', '
', '{instructionText}', '
', '
', '
'); theThis.pnl_Instruction = new Ext.Panel({ region: 'north', margins: '10 15 0 15', frame: true, height: 50, tpl: theThis.tpl_Instruction, listeners: { afterrender: function(p_This) { if (theThis.instructionText) { p_This.setVisible(true); p_This.update({ instructionBackgroundColor: theThis.instructionBackgroundColor, instructionText: theThis.instructionText }); } else { p_This.setVisible(false); } } } }); theThis.items = [theThis.treePanel_Document, theThis.pnl_ImagesViewer, theThis.pnl_Instruction]; // BUTTONS var myButtons = theThis.initButtons(); this.buttons = myButtons; this.initTools(); Ext.CTBRecipeManager.superclass.initComponent.call(this); }, initButtons: function() { var theThis = this; var buttons = [ { text: 'Cancel', iconCls: 'icon-cancel-large', scale: 'large', handler: function() { theThis.hide(); } } ]; return buttons; }, // End initButtons() loadData: function(isLoadRecipeForRootNode) { var theThis = this; theThis.treePanel_Document.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/RecipeFolder/GetTreeFolderUnderRecipeFolder', params: { recipeName: theThis.searchRecipeName, searchType: theThis.searchType }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData != null) { // set the root node var root = new Tree.AsyncTreeNode({ text: 'All Recipe Folders', draggable: false, //id:'source', children: jsonData, //type: 'folder' }); theThis.treePanel_Document.setRootNode(root); theThis.treePanel_Document.render(); // Select the root node if (theThis.rendered) { if (theThis.treePanel_Document.root.item(0)) { theThis.treePanel_Document.getSelectionModel().select(theThis.treePanel_Document.root.item(0)); } theThis.loadMask.hide(); } if(isLoadRecipeForRootNode){ theThis.reloadRecipeForRootNode(); } } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); } }); // End ajax }, reloadRecipeForRootNode: function(){ this.dataView_Document.getStore().baseParams = { path: '' }; this.dataView_Document.getStore().load(); }, reloadFilesInSelectedNode: function() { var theThis = this; var sn = theThis.treePanel_Document.selModel.selNode || null; // selNode is null on initial selection if (sn) { if (sn.attributes.type === 'folder') { theThis.dataView_Document.getStore().baseParams = { path: sn.attributes.path }; theThis.dataView_Document.getStore().load(); } } }, getSelectedFolderNode: function(returnNULLWhenNoNodeDetected) { var theThis = this; if (!returnNULLWhenNoNodeDetected) returnNULLWhenNoNodeDetected = false; var sn = theThis.treePanel_Document.selModel.selNode || null; // selNode is null on initial selection if (sn ) { if (sn.leaf) sn = sn.parentNode; sn.expand(); return sn; } else { if (returnNULLWhenNoNodeDetected) return null; else return theThis.treePanel_Document.root.item(0); } }, getSelectedNode: function() { return this.treePanel_Document.selModel.selNode || this.treePanel_Document.root.item(0); }, // This function will return selected nodes from the image viewer panel getSelectedDataViewNodes: function() { var theThis = this; return theThis.dataView_Document.getRecords(theThis.dataView_Document.getSelectedNodes()); }, moveFolderToFolder: function(folderNode, targetNode) { var theThis = this; theThis.treePanel_Document.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/RecipeFolder/MoveFolderToFolder', params: { fromPath: folderNode.attributes.path, toPath: targetNode.attributes.path }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { // Change the path folderNode.attributes.path = jsonData.data.path; theThis.treePanel_Document.getSelectionModel().select(folderNode); theThis.reloadFilesInSelectedNode(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); return false; } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); }, moveRecipesToFolder: function(nodeIds, targetId) { var theThis = this; var selectedFolderNode = theThis.getSelectedFolderNode(true); // Ignore if move to the same folder theThis.treePanel_Document.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/RecipeFolder/MoveRecipesToFolder', params: { nodeIds : Ext.util.JSON.encode(nodeIds), targetId : targetId }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); // var jsonData = result.json(); // if (jsonData.message.IsSuccess) { // Change the path // folderNode.attributes.path = jsonData.data.path; // theThis.treePanel_Document.getSelectionModel().select(folderNode); // theThis.dataView_Document.getStore().load(); // } else { // showErrorMessageWithEmailNotify(jsonData.message.Info); // return false; // } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); }, deleteFolders: function(folderNodes, targetNode) { var theThis = this; // Get all the paths of the file nodes var folderPaths = []; for (var i = 0; i < folderNodes.length; i++) { folderPaths[folderPaths.length] = folderNodes[i].attributes.path; } theThis.treePanel_Document.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/DeleteFolders', params: { folderPaths: Ext.util.JSON.encode(folderPaths) }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { theThis.treePanel_Document.getSelectionModel().select(theThis.getSelectedFolderNode()); // Reload the image viewer theThis.reloadFilesInSelectedNode(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); return false; } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); }, deleteFiles: function(fileNodes, targetNode) { var theThis = this; var selectedFolderNode = theThis.getSelectedFolderNode(); // Get all the paths of the file nodes var filePaths = []; for (var i = 0; i < fileNodes.length; i++) { filePaths[filePaths.length] = fileNodes[i].attributes.path; } theThis.treePanel_Document.loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/DocumentManager/DeleteFiles', params: { filePaths: Ext.util.JSON.encode(filePaths) }, success: function(result) { theThis.treePanel_Document.loadMask.hide(); var jsonData = result.json(); if (jsonData.message.IsSuccess) { // Remove the file nodes for (var j = 0; j < fileNodes.length; j++) { fileNodes[j].remove(); } // Select the folder theThis.treePanel_Document.getSelectionModel().select(selectedFolderNode); // Reload the image viewer theThis.reloadFilesInSelectedNode(); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); return false; } }, failure: function() { theThis.treePanel_Document.loadMask.hide(); return false; } }); }, getTreePanel_Document: function() { var theThis = this; // set up the Album tree var data_SearchType = [ ['By recipe name', 1], ['By folder', 2] ]; // Search panel var tree = new Ext.tree.TreePanel({ id:String.format('recipebooktree;{0}', theThis.id), frame: true, animate: true, border: true, enableDD: true, containerScroll: true, cls: 'x-panel-whitebgcolor pnl-treeview ctb-recipe-manager', ddGroup: 'organizerDD', margins: '5 0 5 15', region: 'west', width: 455, title: 'My Recipe Folders', loadMask: null, autoScroll: true, listeners: { expandnode: function(node, deep, anim){ if (node.id == "recipe;loadingindicator") { if (node.parentNode.id.indexOf('folder;') != -1) { var recipeFolderId = getNumberIdFromStringId(node.parentNode.id); tempRecipeFolderId = recipeFolderId; // Load the selected folder theThis.expandTreeData(node, node.parentNode, recipeFolderId); } } }, nodedrop: function(e) { var data = e.dropNode.toString().split(','); var nodeIds = new Array(); for (var i = 0;i', '
', '
', '{shortName}', '
', '' ), listeners: { scope: this, selectionchange: function(view, selections) { } } }); var pnl_ImagesViewer = new Ext.Panel({ //id:'images', cls: 'thumbImage', title: 'My Recipes', region: 'center', margins: '5 15 5 5', layout: 'border', frame: true, items: theThis.dataView_Document, loadMask: null, listeners: { afterrender: function(p_This) { // Init loadMask p_This.loadMask = new Ext.LoadMask(p_This.getEl(), { msg: 'Please wait...' }); } } }); /** * Create a DragZone instance for our JsonView */ theThis.ImageDragZone = function(view, config) { this.view = view; theThis.ImageDragZone.superclass.constructor.call(this, theThis.dataView_Document.getEl(), config); }; Ext.extend(theThis.ImageDragZone, Ext.dd.DragZone, { // We don't want to register our image elements, so let's // override the default registry lookup to fetch the image // from the event instead getDragData: function(e) { var target = e.getTarget('.thumb-wrap-fit-height'); if (target) { var view = this.view; if (!view.isSelected(target)) { theThis.dataView_Document.onClick(e); } var selNodes = theThis.dataView_Document.getSelectedNodes(); var dragData = { nodes: selNodes }; if (selNodes.length === 1) { dragData.ddel = target; dragData.single = true; } else { var div = document.createElement('div'); // create the multi element drag "ghost" div.className = 'multi-proxy'; for (var i = 0, len = selNodes.length; i < len; i++) { div.appendChild(selNodes[i].firstChild.firstChild.cloneNode(true)); // image nodes only if ((i + 1) % 3 === 0) { div.appendChild(document.createElement('br')); } } var count = document.createElement('div'); // selected image count count.innerHTML = i + ' documents selected'; div.appendChild(count); dragData.ddel = div; dragData.multi = true; } return dragData; } return false; }, // this method is called by the TreeDropZone after a node drop // to get the new tree node (there are also other way, but this is easiest) getTreeNode: function() { var treeNodes = []; var nodeData = this.view.getRecords(this.dragData.nodes); for (var i = 0, len = nodeData.length; i < len; i++) { var data = nodeData[i].data; treeNodes.push( new Ext.tree.TreeNode({ text: data.name, icon: data.url, id : data.recipeId, //data: data, allowDrag: true, allowDrop: true, leaf: true, cls: 'image-node', path: data.path, type: 'file' }) ); } return treeNodes; }, // the default action is to "highlight" after a bad drop // but since an image can't be highlighted, let's frame it afterRepair: function() { for (var i = 0, len = this.dragData.nodes.length; i < len; i++) { Ext.fly(this.dragData.nodes[i]).frame('#8db2e3', 1); } this.dragging = false; }, // override the default repairXY with one offset for the margins and padding getRepairXY: function() { if (!this.dragData.multi) { var xy = Ext.Element.fly(this.dragData.ddel).getXY(); xy[0] += 3; xy[1] += 3; return xy; } return false; } }); return pnl_ImagesViewer; }, // End getPanel_ImagesViewer getDialog_UploadDocument: function() { return new CTB.upload.Window({ title: 'Upload Document', closeAction: 'hide', maxFileSizeKB: 10280, accept: (function() { var types = CTB.upload.types; return [types.excel, types.word, types.pdf, types.text, types.csv]; })(), listeners: { scope: this, beforeshow: function(win) { var selectedFolder = this.getSelectedFolderNode(); win.setUploadParams({ endPoint: '/DocumentManager/UploadDocuments', mediaFolderId: selectedFolder.attributes.path }); } }, scope: this, onFileUploaded: function(store, rec, response) { if (!response.message.IsSuccess) { var isError = /[Ee]rror/.test(response.message.Info); isError ? showErrorMessageWithEmailNotify(response.message.Info) : showNotification('Error', response.message.Info); rec.data.progress = 100; rec.set('error', true); return; } var data = response.data; /** * Dont add if user selected another folder */ var selectedFolder = this.getSelectedFolderNode(); var mediaStore = this.dataView_Document.getStore(); if (mediaStore.baseParams.path !== selectedFolder.attributes.path) return; mediaStore.add(new mediaStore.recordType({ name: data.name, url: data.url, id: data.id, path: data.download_path, download_path: data.download_path, shortName: shortName(data.name) })); } }); }, getConfirmRecipesAffectedWindow: function(theAffectedRecipes) { // var theThis = this; var data = []; for (var i = 0; i < theAffectedRecipes.length; i++) { var detail = []; detail.push(theAffectedRecipes[i].recipeId); detail.push(theAffectedRecipes[i].recipeName); data.push(detail); } var store = new Ext.data.ArrayStore({ fields: [ { name: 'recipeId', type: 'int' }, { name: 'recipeName', type: 'string' } ], data: data }); var colModel = new Ext.grid.ColumnModel([ { header: 'ID', dataIndex: 'recipeId', width: 10, hidden: true }, { header: 'Recipe Name', dataIndex: 'recipeName', width: 100 } ]); var confirmWindow = new Ext.Window({ iconCls: '', cls: 'ctbwindow-detail-general', layout: 'border', width: 600, height: 350, items: [ { margins: '10 10 10 10', xtype: 'label', region: 'north', text: 'There are the recipes have been affected by switching supplier' }, { xtype: 'grid', region: 'center', margins: '10 10 10 10', store: store, cm: colModel, height: 300, listeners: {}, view: new Ext.grid.GridView({ enableRowBody: true, forceFit: true // IMPORTANT (USE THIS ATTRIBUTE TO USE PERCENTAGE IN COLUMN MODEL) }) } ], buttons: [ { xtype: 'button', text: 'Close', handler: function() { confirmWindow.hide(); } } ] }); return confirmWindow; }, expandTreeData : function(loadingIndicatorNode, recipeFolderNode, recipeFolderId){ var theThis = this; theThis.loadMask.show(); Ext.Ajax.request({ method: "POST", url: '/RecipeFolder/GetTreeFolderUnderRecipeFolder', params: { isShowCheckbox : false, recipeFolderId : recipeFolderId }, success : function(result, request) { theThis.loadMask.hide(); var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData != null && jsonData.length == 1 && jsonData[0].children != null) { for(var i = 0; i < jsonData[0].children.length; i++) { recipeFolderNode.appendChild(jsonData[0].children[i]); } recipeFolderNode.removeChild(loadingIndicatorNode, true); } }, failure : function(result, request) { theThis.loadMask.hide(); } }); // End ajax }, }); function shortName(name) { if (name.length > 30) { return name.substr(0, 27) + '...'; } return name; } Ext.reg('CTBRecipeManager', Ext.CTBRecipeManager); // ********************************************************** // Some commands // ********************************************************** var COMMAND_NOAUTHORITY = 'You don\'t have authority to perform this action.'; // 'You don\'t have authority to do this'; // ********************************************************** // Authority constraint // ********************************************************** var AU_NumOfConstants = 106; // var AU_AdminSection = 1; var AU_StockSection = 2; var AU_PantrySection = 3; var AU_RevenueSection = 4; var AU_Admin_Settings = 5; var AU_Admin_AddressBook = 6; var AU_Admin_BusinessDepartment = 7; var AU_Admin_StockCategory = 8; var AU_Admin_UnitOfMeasurement = 9; var AU_Admin_Report = 10; var AU_Stock_Requisition = 11; var AU_Stock_Invoice = 12; var AU_Stock_StockMaintenance = 13; var AU_Stock_Stocktake = 14; var AU_Stock_Order = 15; var AU_Stock_Report = 16; var AU_Pantry_RecipeOrder = 17; var AU_Pantry_RecipeBook = 18; var AU_Pantry_Report = 19; var AU_Revenue_KitchenRevenue = 20; var AU_Revenue_KitchenReport = 21; var AU_DatabaseSection = 22; var AU_UserSection = 23; var AU_Pantry_Tafe = 24; var AU_Admin_InvoiceHistory = 101; var AU_Admin_RequestHistory = 102; var AU_Admin_PhotoManager = 104; var AU_Pantry_YieldTesting = 103; var AU_Stock_PriceUpdate = 105; var AU_Stock_Tendering = 106; // Read only constants var AU_ReadOnly_Admin_Settings = 25; var AU_ReadOnly_Admin_AddressBook = 26; var AU_ReadOnly_Admin_BusinessDepartment = 27; var AU_ReadOnly_Admin_StockCategory = 28; var AU_ReadOnly_Admin_UnitOfMeasurement = 29; var AU_ReadOnly_Admin_Report = 30; var AU_ReadOnly_Stock_Requisition = 31; var AU_ReadOnly_Stock_Invoice = 32; var AU_ReadOnly_Stock_StockMaintenance = 33; var AU_ReadOnly_Stock_Stocktake = 34; var AU_ReadOnly_Stock_Order = 35; var AU_ReadOnly_Stock_Report = 36; var AU_ReadOnly_Pantry_RecipeOrder = 37; var AU_ReadOnly_Pantry_RecipeBook = 38; var AU_ReadOnly_Pantry_Report = 39; var AU_ReadOnly_Revenue_KitchenRevenue = 40; var AU_ReadOnly_Revenue_KitchenReport = 41; var AU_ReadOnly_DatabaseSection = 42; var AU_ReadOnly_UserSection = 43; var AU_ReadOnly_Pantry_Tafe = 44; var AU_FuturaSection = 46; var AU_AdvertisementSection = 47; // Personal recipe book var AU_Pantry_PersonalRecipeBook = 48; var AU_Pantry_PersonalRecipeBook_Limit = 49; // Authority to limit number of recipes the user can have in their personal recipe book var AU_Pantry_PersonalRecipeBook_CleanAfterLogin = 50; // Authority that clean up every recipes in the user's personal recipe book when they login // Media Manager var AU_ReadOnly_MediaManager = 51; // Databases var AU_Database_Jumper = 52; //Menu Builder var AU_MenuBuilder_Section = 57; var AU_MenuBuilder_Menu = 58; var AU_MenuBuilder_Special = 59; var AU_ReadOnly_MenuBuilder_Menu = 60; var AU_ReadOnly_MenuBuilder_Special = 61; //Captured var AU_CapturedSection = 62; //Show or Hide Dashboard // AUTHORITIES var AUTHORITY = { AU_AdvanceSecuritySection : 45, PANTRY_RECIPEBOOK_REQUIREAPPROVALPERMISSION : 53, STOCK_STOCKMAINTENANCE_REQUIREAPPROVALPERMISSION : 54, CTB_SUPPLIER_VERSION : 55, RECEIVE_WASTAGE_RECORD_WARNING : 56, MENUBUILDER_MENU_REQUIREAPPROVALPERMISSION: 62, MENUBUILDER_SPECIAL_REQUIREAPPROVALPERMISSION: 63, STOCK_STOCKMAINTENANCE_ALLOWSTOCKALLOCATION : 64, RECEIVE_SALEDATA_NOTIFICATION: 65, AU_ERRORLOG_ADMIN: 66, //Error log access AU_LISENCE_SECTION : 67, MISSING_SALEDATA_NOTIFICATION: 68, RECEIVE_NEW_PDF_INVOICE_ITEM_ADDED : 69, AU_STOCK_CUSTOMER_ORDER: 70, //show customer order section for suppliers STOCK_NOT_ALLOW_MODIFY_LOCK_IN_PRICING: 71, // Authority to not allow change price of stock in stock maintenance when the item is locked in pricing STOCK_ALLOW_MODIFY_PRICE_WHEN_READ_ONLY: 72, AU_READONLY_STOCK_RECEIVING_ORDER: 73, NOT_ALLOW_ALL_ORDER_ACTIONS: 74, SEND_ORDER: 75, FINISH_COMPARE_ORDER: 76, STOCK_NOT_ALLOW_ACTIONS_ON_NEW_STOCK_ITEMS: 77, RECIPE_SECTION_CONTROL: 79, AU_Stock_Statement: 80, //Statement in Stock AU_ReadOnly_Stock_Invoice_Netsuite_Approval: 81, AU_BudgetSection: 83, AU_Stock_Invoice_Not_Allow_Amend_Exported_Invoices: 84, AU_Stock_Invoice_Not_Allow_Delete_Invoices: 85, AU_Stock_StockOrder_Not_Allow_Delete_StockOrders: 86, AU_Stock_StockOrder_Not_Allow_Delete_ReceivingOrders: 87, AU_Stock_Allow_Change_Locked_Supplier: 88, AU_Stock_Allow_Push_Stock_Detail_To_Corporate: 89, AU_ReadOnly_Stock_Invoice_Basware_Approval: 91, AU_ReadOnly_Stock_Invoice_Techone_Approval: 92, NOT_ALLOW_TO_PROCESS_NO_MATCH_ORDER: 93, //this will hide the buttons No Match Order & Delete Invoice NOT_ALLOW_TO_PROCESS_PO_WITHOUT_LINKING_TO_INVOICE: 94, // this will hide the button No Match Invoice Allow_To_Assign_Advance_Security: 95, Allow_To_Modify_Database: 96, Allow_To_Modify_Outlet: 97, Allow_To_Modify_User: 98, Allow_To_Access_User_Database: 99, Allow_To_Access_Outside_Office: 100, Allow_To_Edit_Wastage_Of_Ingredient: 112 }; // Integration section var AU_Integration_Section = 90; // ********************************************************** // Authority constraint // ********************************************************** // USER ROLES var ROLES = { STUDENT : 'STUDENT', TEACHER : 'TEACHER' }; var CTB_CODE = { NO_AUTH: 401 }; // Help video var C_RECIPEBOOK_VIDEO_ID = "xEPqgJzVk44"; var C_RECIPEBOOK_VIDEO_DESC = "Recipe Book - Video Help"; // CTB Symbols var CTB_SYMBOL = { // Luc Huynh - 17/06/2020 - Remove all config img from all grid headers // EDIT : ' This can be edited' EDIT: '' }; // ********************************************************** // Report constraint // ********************************************************** var RP_StockElectronicOrderEmail = 1; var RP_NormalEmail = 2; var RP_TenderEmail = 3; var RP_AdvertisementContact = 4; var RP_CreditNoteRequestEmail = 5; var RP_OrderEmailWithPackagingTypeQuantity = 7; var RP_RecipeApprovalEmail = 8; var RP_ConfirmRecipeAprrovalEmail = 9; var RP_RecipeMenuApprovalEmail = 10; var RP_ConfirmRecipeMenuApprovalEmail = 11; var RP_ElectronicCreditNoteRequest = 12; var RP_PhotoEmail = 13; var RP_InvoiceReminder = 14; var RP_ForwardInvoice = 15; // ********************************************************** // Validation content // ********************************************************** var VALIDATION_CONSTANTS = { DATE : 0, EMPTY : 1, EMAIL : 2, NUMBER : 3, CUSTOM : 4, MAX_VALUE : 5, NEGATIVE : 6, ARRAY_EMPTY : 7, NUMBER_ID : 8 }; // ********************************************************** // NOTIFICATION // ********************************************************** var NOTIFICATION = { ICON_ERROR : 'icon-notify-error', ICON_INFORMATION : 'icon-notify-information' }; // ********************************************************** // RECIPE_STATUS // ********************************************************** var RECIPE_STATUS = { WAIT_FOR_APPROVAL : "WAIT_FOR_APPROVAL", // The recipe still waiting for approval APPROVAL_CANCELLED : "APPROVAL_CANCELLED", // The recipe approval request has been cancelled APPROVAL_SUCCEEDED : "APPROVAL_SUCCEEDED", // The recipe has been approved but still waiting to export to the main recipe book APPROVED_AND_EXPORTED : "APPROVED_AND_EXPORTED" // The recipe has been approved and has been copied to the main recipe book }; var RECIPE_MENU_STATUS = { WAIT_FOR_APPROVAL : "WAIT_FOR_APPROVAL", // The recipe menu still waiting for approval APPROVAL_CANCELLED : "APPROVAL_CANCELLED", // The recipe menu approval request has been cancelled APPROVAL_SUCCEEDED : "APPROVAL_SUCCEEDED", // The recipe menu has been approved but still waiting to export to the main recipe book APPROVED_AND_EXPORTED : "APPROVED_AND_EXPORTED" // The recipe menu has been approved and has been copied to the main recipe book }; // ********************************************************** // RETURN_MESSAGE // ********************************************************** var RETURN_MESSAGE = { CONFIRM : "CONFIRM", PROMPT : "PROMPT" }; // ********************************************************** // NOTIFICATION // ********************************************************** var INITIAL_COMMAND = { NEW : 'NEW', APRROVE : 'APPROVE', EDIT : 'EDIT' }; // ********************************************************** // NOTIFICATION // ********************************************************** var BESTBUY_SUPPLIER_TYPE = { VEGETABLE : 1, MEAT : 2, SEAFOOD : 3, NUTS : 4 }; // ********************************************************** // NOTIFICATION // ********************************************************** var GLOBAL_URL = { CTB_HOME_DOMAIN : '/Default/Home2', CTB_HOME_CONTACT_PAGE : '/Home/Contact', CTB_HOME_HOSTNAME : 'www.cookingthebooks.com.au', CTB_HOME_HTTP_PROTOCOL: 'http://', CTB_LOGIN_PAGE : '/Default/Login' }; // ********************************************************** // STICKER_DISPLAY_STYLE // ********************************************************** var STICKER_DISPLAY_STYLE = { PIN_BOARD_ONLY : "PIN_BOARD_ONLY", INTERACTION_DIALOG : "INTERACTION_DIALOG", NOTIFICATION : "NOTIFICATION" }; // ********************************************************** // STOCK_ORDER_STATUS // ********************************************************** var ORDER_STATUS = { WAIT_FOR_PROCESSING : "WAIT_FOR_PROCESSING", WAIT_FOR_INVOICE : "WAIT_FOR_INVOICE", ACK_ELECTRONIC_INVOICE : "ACK_ELECTRONIC_INVOICE", CANCELLED : "CANCELLED", INVOICE_SENT : "INVOICE_SENT", CREDIT_NOTE_REQUEST : "CREDIT_NOTE_REQUEST", MARKED_AS_PROCESSED : "MARKED_AS_PROCESSED", NONE : "NONE", EMAIL_SENT : "EMAIL_SENT", REQUISITION_IN : "REQUISITION_IN", REQUISITION_IN_PENDING : "REQUISITION_IN_PENDING", REQUISITION_IN_APPROVED : "REQUISITION_IN_APPROVED", ORDER_RECEIVED : "ORDER_RECEIVED", SPLIT_ORDER : "SPLIT_ORDER", WAIT_FOR_PROFORMA_INVOICE_TO_BE_LINKED : "WAIT_FOR_PROFORMA_INVOICE_TO_BE_LINKED", MULTI_SUPPLIERS_ORDER : "MULTI_SUPPLIERS_ORDER", MULTI_SUPPLIERS_ORDER_SENT : "MULTI_SUPPLIERS_ORDER_SENT", INCOMPLETE_INVOICE: "INCOMPLETE_INVOICE", WAIT_FOR_PDF_INV: 'WAIT_FOR_PDF_INV' }; // ********************************************************** // RECEIVING_ORDER_TYPE // ********************************************************** var RECEIVING_ORDER_TYPE = { ELECTRONIC_INVOICE : "ELECTRONIC_INVOICE", ELECTRONIC_CREDIT_NOTE : "ELECTRONIC_CREDIT_NOTE", ELECTRONIC_CREDIT_NOTE_RECEIVED: "ELECTRONIC_CREDIT_NOTE_RECEIVED", NORMAL_ORDER : "NORMAL_ORDER", REQUISITION_IN : "REQUISITION_IN", PDF_INVOICE : "PDF_INVOICE", INCOMPLETE_INVOICE: "INCOMPLETE_INVOICE", SPLIT_ORDER: "SPLIT_ORDER", ORDER_RECEIVED: 'ORDER_RECEIVED', NEED_CHECK_AGAINST_ORDER: 'NEED_CHECK_AGAINST_ORDER' }; // ********************************************************** // ADVERTISEMENT_LOCATION // ********************************************************** var ADVERTISEMENT_LOCATION = { REPORT : "REPORT", ELECTRONIC_ORDER_SIDE_BANNDER : "ELECTRONIC_ORDER_SIDE_BANNDER" }; // ********************************************************** // XERO MESSAGE // ********************************************************** var XERO_MESSAGE = { ACCESS_TOKEN_EXPIRED : 'The access token has expired', INVALID_ACCESS_TOKEN : 'The token repository doesn\'t contain a valid access token' }; // ********************************************************** // XERO PROCESSING STATUS // ********************************************************** var XERO_PROCESSING_STATUS = { PROCESSING : 'PROCESSING', SUCCEED : 'SUCCEED', FAILED : 'FAILED' }; var DAY_SELECTION = { MONDAY : 0, TUESDAY : 1, WEDNESDAY : 2, THURSDAY : 3, FRIDAY : 4, SATURDAY : 5, SUNDAY : 6 }; var FRIDGE_COMPONENT_TYPE = { SECTION : 1, CONTAINER : 2, UNKNOWN : 3 }; // Type of displaying recipe card var RECIPE_CARD_DISPLAY_TYPE = { METHOD_INGREDIENTS : 1, MURPHY : 2, MULTI_PHOTO : 3, THE_LENNA : 4, MANUAL : 5, SIMPLE: 6, OSCAR_PLUS: 7 }; // Type of database var DATABASE_TYPE = { TRIAL : "TRIAL", TEST : "TEST", PRODUCTION : "PRODUCTION", SIMPLOT : "SIMPLOT", COLES : "COLES" }; // Type of group of stocks var STOCK_SUPPLIER_GROUP_TYPE = { VARIANCE_REPORT_FAVOURITE : "VARIANCE_REPORT_FAVOURITE" }; // This is type of variance report value // Red is negative value // Black is 0 value // Red Block is positive value var VARIANCE_REPORT_VARIANCE_VALUE_TYPE = { NONE : "NONE", POSITIVE : "POSITIVE", ZERO : "ZERO", NEGATIVE : "NEGATIVE" }; // This is report constants var REPORT_CONSTANT = { SUPPLIER_DETAILS_REPORT : 1, SIMPLE_SUPPLIER_LIST_REPORT : 2, REQUISITION_HISTORY_REPORT : 3, STOCKTAKE_VALUATION_REPORT : 4, STOCKTAKE_SHEET : 5, STOCKTAKE_SHEET_WITH_BARCODE : 6, ORDER_SHEET_REPORT : 7, PAR_LEVEL_ORDER_SHEET_REPORT : 8, INVOICE_TRANSACTION_REPORT : 9, STOCK_ITEM_PURCHASE_REPORT : 10, ITEM_SPENT_REPORT : 11, STOCK_ORDER_REPORT : 12, LEENA_TRANSACTION_HISTORY_REPORT : 13, STOCK_CONFIRMATION_ORDER_SHEET : 14, PRICE_MOVEMENT_REPORT : 15, TENDERING_REPORT : 16, RECIPE_COST_AND_GROSS_PROFIT_REPORT : 17, RECIPE_COST_GROUP_REPORT : 18, RECIPE_COST_SHEET_REPORT : 19, RECIPE_CARD_REPORT : 20, RECIPE_LIMIT_REPORT : 21, WAITERS_FRIEND_REPORT : 22, MISE_EN_PLACE_REPORT : 23, FUNCTION_MENU_PRINTOUT : 24, DIETARY_REQUIREMENT_FILTER_REPORT : 25, JOSH_REPORT_YOUNG_CHEF_OF_THE_YEAR : 26, STOCK_USED_REPORT : 27, FOOD_COST_REPORT : 28, SALES_REPORT : 29, KITCHEN_REQUISITIONS_SHEET : 30, RECIPE_PRICE_MOVEMENT : 31, STOCK_PERFORMANCE_REPORT : 32, PURCHASES_TO_REVENUE_FOOD_COST : 33, THE_BIG_GROUP_REPORT : 34, GROSS_PROFIT_REPORT : 35, KITCHEN_PERFORMANCE_REPORT : 36, INVOICE_TRANSACTION_REPORT_FOR_MYOB : 37, THEORECTICAL_STOCK_ON_HAND_REPORT : 39, SPENT_BY_SUPPLIER_REPORT : 40, SPENT_BY_STOCK_CATEGORY_REPORT : 41, INVOICE_SUNSYSTEMEXPORT_REPORT : 42, WASTAGE_EFFECT_ON_FOODCOST_REPORT : 43, INVOICE_LABEL_REPORT : 44, CREDIT_NOTE_REPORT : 45, PRODUCT_TEMPERATURE_REPORT : 46, UNUSED_RECIPES_REPORT : 47, VARIATION_ORDER_INVOICE_REPORT : 50, STOCK_ORDER_PROCESS_HISTORY_REPORT : 51, LIVE_FOOD_COST_REPORT : 52, SUPPLIER_PRICE_UPDATE_SCHEDULE : 53, REQUISITION_RECEIVED_VARIANCE_REPORT: 54, WASTAGE_TO_PURCHASE_REPORT : 55, RECIPE_SECTION_FILTER_REPORT : 56, INVENTORY_TURNS : 58, INVOICE_ACTION_HISTORY : 60, OUSTANDING_INVOICES_REPORT : 62, MISSING_REVENUE_REPORT : 64, PROCESS_NEW_STOCK_REPORT : 67 }; // This is recipe fact type constants var RECIPE_FACT = { MENU_CATEGORY: 'MENU_CATEGORY', MAJOR_FLAVOUR: 'MAJOR_FLAVOUR', MAJOR_INGREDIENT: 'MAJOR_INGREDIENT', COOKING_METHOD: 'COOKING_METHOD', SECTION: 'SECTION', UNKNOWN: 'UNKNOWN' }; /* var RECIPE_FACT = { MENU_CATEGORY : "MENU_CATEGORY", MAJOR_FLAVOUR : "MAJOR_FLAVOUR", MAJOR_INGREDIENT : "MAJOR_INGREDIENT", COOKING_METHOD : "COOKING_METHOD", SECTION : "SECTION", UNKNOWN : "UNKNOWN" }; */ var PROFORMA_INVOICE_STATUS = { NEED_CHECK_AGAINST_ORDER: 'NEED_CHECK_AGAINST_ORDER', NEED_CHECK_AGAINST_PHYSICALINVOICE: 'NEED_CHECK_AGAINST_PHYSICALINVOICE', DELETED: 'DELETED', COMPLETED_PROCESSING: 'COMPLETED_PROCESSING', CREDIT_NOTE_REQUESTED: 'CREDIT_NOTE_REQUESTED', CREDIT_NOTE: 'CREDIT_NOTE', // The proforma invoice is a credit note CREDIT_NOTE_SENT_TO_SUPPLIER: 'CREDIT_NOTE_SENT_TO_SUPPLIER', // The proforma invoice is a credit note CREDIT_NOTE_TURNED_TO_RETURN_INVOICE: 'CREDIT_NOTE_TURNED_TO_RETURN_INVOICE' // The proforma invoice is a credit note }; var ERROR_CONSTANTS = { ERROR_AUTHENTICATION: 'ERROR_AUTHENTICATION', ERROR_MYOB_AUTHENTICATION: 'ERROR_MYOB_AUTHENTICATION', ERROR_MYOB_COMPANY_FILE_MISSING: 'ERROR_MYOB_COMPANY_FILE_MISSING', ERROR_MYOB_CONNECTION_LOST: 'ERROR_MYOB_CONNECTION_LOST' }; var REQUISITION_STATUS = { NONE: 'NONE', APPROVED: 'APPROVED', WAIT_FOR_APPROVAL: 'WAIT_FOR_APPROVAL', DECLINED: 'DECLINED' }; var DICTIONARY_KEYS = { BUDGET_PURCHASE_TAG_VALUE: 'BUDGET_PURCHASE_TAG_VALUE', ELECTRONIC_ORDER_INCLUDE_COST: 'ELECTRONIC_ORDER_INCLUDE_COST', ELECTRONIC_ORDER_DELIVERY_NOTE: 'ELECTRONIC_ORDER_DELIVERY_NOTE', LOCK_IN_PRICING_SUPPLIERS_LIST: 'LOCK_IN_PRICING_SUPPLIERS_LIST', DISPLAY_ALL_INGREDIENTS_FROM_CORPORATE_DB: 'DISPLAY_ALL_INGREDIENTS_FROM_CORPORATE_DB', IS_CHECKING_AFFECTED_RECIPES_BY_STOCK_PRICE_CHANGES: 'IS_CHECKING_AFFECTED_RECIPES_BY_STOCK_PRICE_CHANGES', AUTO_ARCHIVE_RECIPE_SETTING: 'AUTO_ARCHIVE_RECIPE_SETTING', AUTO_ARCHIVE_RECIPE_SETTING_POSTPONE: 'AUTO_ARCHIVE_RECIPE_SETTING_POSTPONE', FOODCOST_LIVE_START_DATE_OF_THE_YEAR: 'FOODCOST_LIVE_START_DATE_OF_THE_YEAR', IS_GENERATE_REPORT_USING_INVOICE_CREATED_DATE: 'IS_GENERATE_REPORT_USING_INVOICE_CREATED_DATE', FOODCOST_LIVE_PERIOD_TIME: 'FOODCOST_LIVE_PERIOD_TIME', AUTO_PUSH_STOCKPRICE_DETAILS_TO_OUTLETS: 'AUTO_PUSH_STOCKPRICE_DETAILS_TO_OUTLETS', PROJECTED_REVENUE_CALENDAR_DATA: 'PROJECTED_REVENUE_CALENDAR_DATA', // This key has prefix of _[year]_[month]. The key is dependent upon year and month properties. PROJECTED_REVENUE_MAX_VALUE: 'PROJECTED_REVENUE_MAX_VALUE', // This key is in Admin->Settings to indicate maxium value of projected revenue before a reduce percentage need to be applied to par level PROJECTED_REVENUE_MAX_VALUE_REACHED_PAR_LEVEL_PERCENTAGE_REDUCE: 'PROJECTED_REVENUE_MAX_VALUE_REACHED_PAR_LEVEL_PERCENTAGE_REDUCE', // This key is the reduce percentage need to be applied to par level after the maxium projected revenue is reached. GRID_COLUMNS_SETTING: 'GRID_COLUMNS_SETTING', OSCAR_NUMBER_OF_RESIDENTS: 'OSCAR_NUMBER_OF_RESIDENTS', DISABLE_POPUP_NOTIFICATION: 'DISABLE_POPUP_NOTIFICATION', DEFAULT_RECIPE_PACKAGING_TYPE: 'DEFAULT_RECIPE_PACKAGING_TYPE', DEFAULT_CURRENCY: 'DEFAULT_CURRENCY', DEFAULT_CURRENCY_BY_SUPPLIER: 'DEFAULT_CURRENCY_BY_SUPPLIER', DEFAULT_SYSTEM_GL_ACCOUNT_CODE: 'DEFAULT_SYSTEM_GL_ACCOUNT_CODE', TENDERING_LINK_DATABASE: 'TENDERING_LINK_DATABASE', ENABLE_STOCKTAKE_LOCK_IN_PRICING_BY_BATCH: 'ENABLE_STOCKTAKE_LOCK_IN_PRICING_BY_BATCH', UPDATE_CURRENT_COST_FROM_REQ_SUPPLIER: 'UPDATE_CURRENT_COST_FROM_REQ_SUPPLIER', START_DATE_OF_THE_WEEK: 'START_DATE_OF_THE_WEEK', EXPENSE_TAXFIELD_NAME: 'EXPENSE_TAXFIELD_NAME', REVENUE_TAXFIELD_NAME: 'REVENUE_TAXFIELD_NAME', INCLUDE_NONFOOD: 'INCLUDE_NONFOOD', //TR899 : Add include non-food option ENABLE_GEMERATE_PDF_ON_REQUISITION_OUT: 'ENABLE_GEMERATE_PDF_ON_REQUISITION_OUT', OVERWRITE_MYOB_PURCHASENUMBER_WITH_INVOICENUMBER: 'OVERWRITE_MYOB_PURCHASENUMBER_WITH_INVOICENUMBER', LOAD_ALL_SUPPLIER_STOCK_LIST_FROM_REQUISITION_SUPPLIER: 'LOAD_ALL_SUPPLIER_STOCK_LIST_FROM_REQUISITION_SUPPLIER', RECIPE_DESIRED_SELLING_PRICES: 'RECIPE_DESIRED_SELLING_PRICES', }; var CASE_WIZARD_FIELDS = { STOCK_DESCRIPTION: 'STOCK_DESCRIPTION', RECIPE_NAME: 'RECIPE_NAME' }; var CASE_WIZARD_TYPES = { UPPER_CASE: 'UPPER_CASE', LOWER_CASE: 'LOWER_CASE', PROPER_CASE: 'PROPER_CASE', WORD_CAPS: 'WORD_CAPS' }; var STOCK_ANALYSIS_CATEGORIES = { SIMILAR_NAMED_STOCK: 'SIMILAR_NAMED_STOCK', SIMILAR_CODE_STOCK: 'SIMILAR_CODE_STOCK', NOT_LINK_STOCK_TO_RECIPE: 'NOT_LINK_STOCK_TO_RECIPE', UNUSED_STOCK: 'UNUSED_STOCK', IDLE_STOCK: 'IDLE_STOCK', HIGH_USED_STOCK_REPORT: 'HIGH_USED_STOCK_REPORT' }; var GRID_LAYOUT_STATES = { GRID_REQUISITION_STATE_ID: 'GRID_REQUISITION_STATE_ID', GRID_REQUISITION_DETAIL_STATE_ID: 'GRID_REQUISITION_DETAIL_STATE_ID', GRID_STOCKBYSUPPLIER_STATE_ID: 'GRID_STOCKBYSUPPLIER_STATE_ID', GRID_STOCKORDER_STATE_ID: 'GRID_STOCKORDER_STATE_ID', GRID_STOCKORDER_DETAIL_STATE_ID: 'GRID_STOCKORDER_DETAIL_STATE_ID', GRID_STOCKORDER_TEMPLATE_STATE_ID: 'GRID_STOCKORDER_TEMPLATE_STATE_ID', GRID_INVOICE_DETAIL_STATE_ID: 'GRID_INVOICE_DETAIL_STATE_ID', GRID_RECIPEMENU_ANALYSIS_DETAIL_STATE_ID: 'GRID_RECIPEMENU_ANALYSIS_DETAIL_STATE_ID', GRID_INVOICE_STATE_ID: 'GRID_INVOICE_STATE_ID', GRID_MENUANALYSISDETAIL_STATE_ID: 'GRID_MENUANALYSISDETAIL_STATE_ID', GRID_MENU_EVOLUTION: 'GRID_MENU_EVOLUTION', GRID_RECEIVINGORDER_PROFORMA_INVOICE_DATE: 'GRID_RECEIVINGORDER_PROFORMA_INVOICE_DATE', GRID_RECEIVINGORDER_PROFORMA_INVOICE_RECEIVED_DATE: 'GRID_RECEIVINGORDER_PROFORMA_INVOICE_RECEIVED_DATE', GRID_RECEIVINGORDER_PROFORMA_DEFAULT_FOOD_BEVERAGE_RELATED: 'GRID_RECEIVINGORDER_PROFORMA_DEFAULT_FOOD_BEVERAGE_RELATED', GRID_RECEIVINGORDER_PROFORMA_DETAIL_PARK_COLUMN: 'GRID_RECEIVINGORDER_PROFORMA_DETAIL_PARK_COLUMN', GRID_STOCKMAINTENANCE_GLCODE: 'GRID_STOCKMAINTENANCE_GLCODE', GRID_STOCKMAINTENANCE_BARCODE: 'GRID_STOCKMAINTENANCE_BARCODE', GRID_CYCLEMENU_PROTEIN_COLOR_CODE: 'GRID_CYCLEMENU_PROTEIN_COLOR_CODE' }; var GRID_STATE_ENABLED = false; var MESSAGE_OBJECT_STATUS = { SUCCESS: 'SUCCESS', UNSUCCESS: 'UNSUCCESS', UNAUTHORIZED: 'UNAUTHORIZED', DATABASE_EXPIRED: 'DATABASE_EXPIRED' }; var RECIPE_FACTS_DATA = ['Boiling','Poaching','Braising','Stewing','Steaming','Grilling','Shallow frying', 'Deep frying', 'Baking', 'Roasting']; // Type of activity calendar var ACTIVITY_CALENDAR_TYPE = { PUBLIC_HOLIDAY: 1 }; /******************************************* This is used to forward emails when sending an email to one of the below section *******************************************/ var EMAIL_DIRECTION_SECTION = { INVOICE_SECTION: 'Invoice', REQUISITION_SECTION: 'Requisition', STOCKORDER_SECTION: 'Stock order' }; /***************************************** * the interval time to auto save stocktake ****************************************/ var GLOBAL_INTERVAL_AUTOSAVE = 20000; //20 seconds // TRUE, will turn on auto save function var TURN_ON_AUTO_SAVE = true; // /***************************************** * TON UPDATE 22/07/2015 * CTB ADS SERVER HOST ADDRESS ****************************************/ var CTB_ADS_HOST = "https://supplier.cookingthebooks.com.au"; //var CTB_ADS_HOST = "http://localhost:53130"; /*****************************************] * Added by Andy on 20/6/2016 */ var RESPONSE_CODE = { ErrorRequest: 503, // standard code for internal server error SuccessRequest: 200, // standard code for successful request NoAuth: 401, // standard code for non auth request NoDirectSupplier: 507, NoOrder: 707, NoSupplier: 307, ItemNotAvailable: 407 // Items are no longer available from the supplier }; var CTB_APPLICATION_THEME = { CTB : 'CTBWeb', DTP : 'DTPWeb', IRP : 'IRPWeb', STOCKWIZ : 'SWDWeb', HEALTH : 'HealthWeb', MINING : 'MiningWeb' } /* Nutritional database */ var CTB_NUTRITIONAL_DATABASE = { 1: "Australia New Zealand - Food Standards (NUTTAB_2010)", 2: "United States Department Of Agriculture (USDA Release 23)", 3: "Australia Nutrition Survey Database (AUSNUT 2007)", 4: "Cooking the Books - Sharing database", 5: "Australia Nutrition Survey Database (AUSNUT 2011-2013)", 6: "Australia Food Composition Database (Release 1 - 2019)" } /* Color picker*/ var COLORS_PICKER_OLD = ['#ff5252','#ff4081','#e040fb','#448aff','#64ffda','#69f0ae','#eeff41','#ffd740','lightgrey']; var COLORS_PICKER_NEW = ['#a30f04','#d260b7','#4370b7','#499edc','#549363','#549363','#dfa504','#d66834','#b7b7b7']; var CTB_STYLE_THEME = { DARK: 'dark', LIGHT: 'light' } var WIDTH_OF_SMALL_SCREENS = 1790; var CTB_ENV = { DEV: 'DEVELOPMENT', PRO: 'PRODUCTION' } // -------------------------------------- // Renderer for column model : Combobox // -------------------------------------- Ext.util.Format.comboRenderer = function (objComboBox) { return function (value) { var record = objComboBox.findRecord(objComboBox.valueField, value); return record ? record.get(objComboBox.displayField) : objComboBox.valueNotFoundText; } } var global_stateStore = new Ext.data.ArrayStore({ fields: ['ID', 'abbr', 'state'], data: getStateArray() }); function getStateArray() { Ext.namespace('Ext.stateData'); Ext.stateData.states = [ [1, 'VIC', 'Victoria'], [2, 'NSW', 'New South Wales'], [3, 'ACT', 'Australian Capital Teritory'], [4, 'QLD', 'Queensland'], [5, 'NT', 'Northern Teritory'], [6, 'WA', 'Western Australia'], [7, 'SA', 'South Australia'], [8, 'TAS', 'Tasmania'] ]; return Ext.stateData.states; } // Automatically function get random ads from CTB server var Global_RandomAds_Record = null; function GetRandomAdvertisement(callback_Function) { Ext.Ajax.request({ method: "POST", url: '/Advertisement/GetAdvertisementForUser_Report', params: { }, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { Global_RandomAds_Record = jsonData.data; if (callback_Function != null) callback_Function(); } //setTimeout("GetRandomAdvertisement()", 60000); }, failure: function (result, request) { //setTimeout("GetRandomAdvertisement()", 60000); } }); // End ajax } /******************************************************************************/ /* Useful functions for math */ /******************************************************************************/ function roundNumber(num, dec) { var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec); return result; } function roundNumberUp(n, digits) { if (digits === undefined) { digits = 0; } var multiplicator = Math.pow(10, digits); n = parseFloat((n * multiplicator).toFixed(11)); var test = (Math.round(n) / multiplicator); return +(test.toFixed(digits)); } function addFullDigitToNumber(num, numOfZero) { var result = num + ""; var dotPosition = result.lastIndexOf('.'); if (dotPosition == -1) { var lastPortion = "."; for (var i = 0; i < numOfZero; i++) { lastPortion += '0'; } result = result + lastPortion; } else { var lastPortion = result.substring(dotPosition, result.length); var firstPortion = result.substring(0, dotPosition); for (var i = lastPortion.length - 1; i < numOfZero; i++) { lastPortion += '0'; } result = firstPortion + lastPortion; } return result; } function truncate(n) { return n | 0; // bitwise operators convert operands to 32-bit integers } // Return a random number between 1 and 1000000000 function getRandomNumber() { return Math.floor(Math.random() * 1000000000 + 1); } // This function need Global_MeasurementConversion_Store to be active function convertMeasurement(convertFrom, convertTo, value) { var numOfRecords = Global_MeasurementConversion_Store.getCount(); for (var i = 0; i < numOfRecords; i++) { var theRecord = Global_MeasurementConversion_Store.getAt(i); // Check the record match the conversion that user want if (theRecord.get('convertFrom') == convertFrom) { if (theRecord.get('convertTo') == convertTo) { return value * theRecord.get('multiplicator'); } } } return value; } // This function convert from a string id to a number id // For example : folder;999 // will be converted to 999 // Another example : recipe;2026 // will be converted to 2026 function getNumberIdFromStringId(string_id) { try { var a = string_id.split(";"); if (a.length == 1) return -1; // Not in right format //alert("Hi :"+a[1]); return a[1]; } catch (e) { return -1; } } // This function try to get the prefix of a string id // For example : folder;999 // return : folder // Another example : recipe;2026 // return : recipe function getPrefixFromStringId(string_id) { try { var a = string_id.split(";"); if (a.length == 1) return -1; // Not in right format //alert("Hi :"+a[1]); return a[0]; } catch (e) { return -1; } } // This function try to get the prefix of a string id // For example : folder;99;2026 // return : 2026 // Another example : folder;1989;2001 // return : 2001 function getLastIdFromStringId(string_id) { try { var a = string_id.split(";"); if (a.length == 1) return -1; // Not in right format return a[a.length - 1]; // Return the last portion } catch (e) { return -1; } } // This function resize a window to fix the percentage param // of the client browser screen function fitWindowSize(p_Window, p_percentage) { if (!p_Window.maximized) { var clientWidth = Ext.getBody().getViewSize().width; var clientHeight = Ext.getBody().getViewSize().height; var ourWidth = clientWidth * p_percentage / 100; var outHeight = clientHeight * p_percentage / 100; p_Window.setWidth(ourWidth); p_Window.setHeight(outHeight); p_Window.center(); } } // This function resize a window to fix the dimension param // of the client browser screen function fitWindowDimension(p_Window, width, height) { if (!p_Window.maximized) { p_Window.setWidth(width); p_Window.setHeight(height); p_Window.center(); } } // Format for string with number place holder String.prototype.format = function () { var formatted = this; for (arg in arguments) { formatted = formatted.replace("{" + arg + "}", arguments[arg]); } return formatted; }; // This function return a date after today a number of dates function getDateAfterToday(numOfDates) { var today = new Date(); today.setDate(today.getDate() + numOfDates); return today; } // This function return a date after an input date function getDateAfterADate(aDate, numOfDates) { var result = aDate; result.setDate(result.getDate() + numOfDates); return result; } // This function return a date after today a number of dates function getDateBeforeToday(numOfDates) { var today = new Date(); today.setDate(today.getDate() - numOfDates); return today; } // Show tool tip function setToolTip(target, html, trackMouse) { var myToolTip = new Ext.ToolTip({ target: target, html: html, title: 'Tip', autoHide: true, anchor: 'left', closable: true, draggable: true, trackMouse: trackMouse == null ? false : true //dismissDelay: 1 // Close in 5 seconds }); } function setToolTipWithMouseTrack(target, html, trackMouse) { var myToolTip = new Ext.ToolTip({ target: target, html: html, title: 'Tip', width: 200, trackMouse: trackMouse == null ? false : true //dismissDelay: 1 // Close in 5 seconds }); } // Show tool tip function showToolTip(target, html, returnBool, title, anchor) { var myToolTip = new Ext.ToolTip({ cls: 'invalid-tooltip', target: '', html: html, title: title == null ? 'We have a problem' : title, autoHide: true, anchor: anchor == null ? 'left' : anchor, closable: true, draggable: true, dismissDelay: 5000 // Close in 5 seconds }); var x = Ext.getCmp(target).getEl().getX(); var y = Ext.getCmp(target).getEl().getY(); var width = Ext.getCmp(target).getEl().getWidth(); var height = Ext.getCmp(target).getEl().getHeight(); x = x + width + 20; y = y - height / 3; myToolTip.showAt([x, y]); Ext.getCmp(target).getEl().frame('#FF0000'); return returnBool; } /******************************************************************************/ /* Useful functions for VALIDATION */ /******************************************************************************/ // Validate email function validateEmail(elementValue) { var emailPattern = /^[a-zA-Z0-9._\-\']+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; return emailPattern.test(elementValue); } // Validate for common fields function validateFieldGroup(listOfFields, anchor) { var isValidated = true; for (var i = 0; i < listOfFields.length; i++) { if (!Ext.getCmp(listOfFields[i].ID).disabled) { if (listOfFields[i].VALIDATION_TYPE == VALIDATION_CONSTANTS.DATE) { if (!Ext.getCmp(listOfFields[i].ID).isValid() || Ext.getCmp(listOfFields[i].ID).getValue() === '') { var msg = typeof (listOfFields[i].CUSTOM_MESSAGE) === 'undefined' ? 'Date value is not in correct format !' : listOfFields[i].CUSTOM_MESSAGE; isValidated = showToolTip(listOfFields[i].ID, msg, false, null, anchor); } } else if (listOfFields[i].VALIDATION_TYPE == VALIDATION_CONSTANTS.EMPTY) { if (Ext.getCmp(listOfFields[i].ID).getValue() == null || Ext.getCmp(listOfFields[i].ID).getValue().toString().length == 0) { var msg = typeof (listOfFields[i].CUSTOM_MESSAGE) === 'undefined' ? 'Value can not be empty !' : listOfFields[i].CUSTOM_MESSAGE; isValidated = showToolTip(listOfFields[i].ID, msg, false, null, anchor); } } else if (listOfFields[i].VALIDATION_TYPE == VALIDATION_CONSTANTS.NUMBER) { if (Ext.getCmp(listOfFields[i].ID).getRawValue() == null || isNaN(Ext.getCmp(listOfFields[i].ID).getRawValue())) { var msg = typeof (listOfFields[i].CUSTOM_MESSAGE) === 'undefined' ? 'Value is not in number format !' : listOfFields[i].CUSTOM_MESSAGE; isValidated = showToolTip(listOfFields[i].ID, msg, false, null, anchor); } } else if (listOfFields[i].VALIDATION_TYPE == VALIDATION_CONSTANTS.MAX_VALUE) { if (!isNaN(Ext.getCmp(listOfFields[i].ID).getRawValue()) && Ext.getCmp(listOfFields[i].ID).getValue() > listOfFields[i].MAX_VALUE) { var msg = typeof (listOfFields[i].CUSTOM_MESSAGE) === 'undefined' ? String.format('Value is over maximum value of {0} !', listOfFields[i].MAX_VALUE) : listOfFields[i].CUSTOM_MESSAGE; isValidated = showToolTip(listOfFields[i].ID, msg, false, null, anchor); } } else if (listOfFields[i].VALIDATION_TYPE == VALIDATION_CONSTANTS.NEGATIVE) { if (!isNaN(Ext.getCmp(listOfFields[i].ID).getRawValue()) && Ext.getCmp(listOfFields[i].ID).getValue() < 0) { var msg = typeof (listOfFields[i].CUSTOM_MESSAGE) === 'undefined' ? 'Value can not be negative !' : listOfFields[i].CUSTOM_MESSAGE; isValidated = showToolTip(listOfFields[i].ID, msg, false, null, anchor); } } else if (listOfFields[i].VALIDATION_TYPE == VALIDATION_CONSTANTS.EMAIL) { if (!validateEmail(Ext.getCmp(listOfFields[i].ID).getValue())) { var msg = typeof (listOfFields[i].CUSTOM_MESSAGE) === 'undefined' ? 'Email is not in correct format !' : listOfFields[i].CUSTOM_MESSAGE; isValidated = showToolTip(listOfFields[i].ID, msg, false, null, anchor); } } else if (listOfFields[i].VALIDATION_TYPE == VALIDATION_CONSTANTS.CUSTOM) { if (!listOfFields[i].CUSTOM_FUNCTION()) { isValidated = showToolTip(listOfFields[i].ID, listOfFields[i].CUSTOM_MESSAGE, false, null, anchor); } } } } return isValidated; } // Mark a string as deleted using strikethrough of html function markDeleted(str, isUsingImage) { if (isUsingImage != null && isUsingImage == true) return ''; return '' + str + ''; } // Mark a string as green color stand for new entry function markNew(str, isUsingImage) { if (isUsingImage != null && isUsingImage == true) return ''; return '' + str + ''; } // Mark a string or an item as normal function markNormal(str, isUsingImage) { if (isUsingImage != null && isUsingImage == true) return ''; return '' + str + ''; } // Show a message box function showMessageBox(title, content, icon, redirect) { if (icon == null) icon = Ext.MessageBox.INFO; Ext.Msg.show({ title: title, msg: content, buttons: Ext.Msg.OK, fn: okClick, icon: icon }); function okClick(btn) { if (btn == 'ok' && redirect != null && redirect == true) { window.location = '/Default/Index'; } } return 1; } // Show a report message box function showReportMessageBox(report_id) { var msgDialog = new Ext.Window({ title: 'Report', layout: 'fit', closeAction: 'close', expandOnShow: false, closable: false, resizable: false, modal: true, plain: false, minimizable: false, maximizable: false, monitorResize: true, width: 400, height: 100, html: '

Your report is ready. Click show button to see your report
Please turn off popup blocker in order to view the report

', buttons: [ { xtype: 'box', cls: 'x-btn x-btn-noicon', autoEl: { tag: 'a', target: '_blank', href: '/aspx/DisplayReport.aspx?r_id=' + report_id, html: 'Show' } }, { xtype: 'button', text: 'Cancel', handler: function () { msgDialog.close(); } } // , // { // xtype : 'button', // text : 'Send email', // handler : function(){ // Global_ContactBrowser_CallbackFunction = function(selectedRecords) // { // var recipients = ""; // for(var i = 0;i', '
{advertisementDescription}
', '' ) }) ], listeners: { beforeshow: function (p_This) { if (Global_RandomAds_Record != null) { fitWindowDimension(p_This, Global_RandomAds_Record.advertisementImageWidth + 20, Global_RandomAds_Record.advertisementImageHeight + 130); p_This.items.each(function (item, index) { if (index == 0) { item.tpl.overwrite(item.getEl(), Global_RandomAds_Record); } }); } } }, tbar: [ /*{ xtype : 'panel', html : '

Your report is ready.
Click Show to download.

', frame : true },*/ '->', new Ext.Button({ text: 'Contact', iconCls: 'icon-person', tooltip: 'Contact a rep about the product', scale: 'large', handler: function (p_This) { showErrorNotification('Notice', 'Under construction'); } }), new Ext.Button({ xtype: 'button', text: 'Find out more', iconCls: 'icon-video', scale: 'large', handler: function () { if (Global_RandomAds_Record != null) showHelpVideo(Global_RandomAds_Record.advertisementVideoID, false); } }), new Ext.Button({ text: 'Order', iconCls: 'icon-truck', scale: 'large', tooltip: 'Order the product / Service', handler: function (p_This) { showErrorNotification('Notice', 'Under construction'); } }) ], buttons: [ /*{ xtype: 'box', cls : 'x-btn x-btn-noicon', autoEl: {tag: 'a', target: '_blank', href: '/aspx/DisplayReport.aspx?r_id='+report_id, html: ''} },*/ /*{ xtype: 'box', autoEl: {tag: 'a', target: '_blank', href: '/aspx/DisplayReport.aspx?r_id='+report_id, html: '
Your report is ready to view.
Click here to download.
'} },*/ { xtype: 'box', hidden: hideDownloadExcel, html: '
' }, { xtype: 'box', html: '
' }, { xtype: 'button', text: 'Cancel', iconCls: 'icon-cancel-large', scale: 'large', handler: function () { msgDialog.close(); } }, { xtype: 'button', text: 'Send email', iconCls: 'icon-send-large', scale: 'large', handler: function () { Global_ContactBrowser_CallbackFunction = function (selectedRecords) { var recipients = ""; for (var i = 0; i < selectedRecords.length; i++) { var contactEmail = selectedRecords[i].data.email; if (contactEmail != null && validateEmail(contactEmail)) { recipients += (contactEmail + ";"); } } // Init the mail data setMailbox_ReportCode(report_id); setMailbox_Recipients(recipients); setMailbox_Subject('Stock order'); Ext.getCmp('dlg_Mailbox').show(); } Ext.getCmp('dlg_ContactBrowser').show(); } } ] }); msgDialog.show(); return 1; } // Hide the report message box function hideReportMessageBox(dlgId) { Ext.getCmp(dlgId).close(); } // Show a pop up window function showPopUpWindow(windowName, url) { var popUp = window.open(url, windowName, 'width=1000, height=700, left=24, top=24, scrollbars, resizable'); if (popUp == null || typeof (popUp) == 'undefined') { alert('Please disable your pop-up blocker and click the "Open" link again.'); } else { popUp.focus(); } } // Get a specific value of an item in a combobox function getComboboxValueById(objComboBox, id) { var record = objComboBox.findRecord(objComboBox.valueField, id); return record ? record.get(objComboBox.displayField) : objComboBox.valueNotFoundText; } var Global_ShowedDatabaseErrorMessage = false; // A flag use when an error message being displayed // To make sure we didn't display too much message box // Showing store loading error message function showStoreLoadingErrorMessage(store) { if (store == null) { Ext.Msg.show({ title: 'Notice', msg: 'Database expired or didn\' exist !', buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING }); return; } if (store.reader.jsonData.message.IsSuccess == false) { if (!Global_ShowedDatabaseErrorMessage) { Global_ShowedDatabaseErrorMessage = true; Ext.Msg.show({ title: 'Notice', msg: store.reader.jsonData.message.Info, buttons: Ext.Msg.OK, fn: function (btn) { Global_ShowedDatabaseErrorMessage = false; }, icon: Ext.MessageBox.WARNING }); } } else { Ext.Msg.show({ title: 'Notice', msg: 'Database doesn\'t exist', buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING }); } } // Show a message dialog with warning icon function showWarningMessage(message) { Ext.Msg.show({ title: 'Warning', msg: message, buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING }); } // Show a message dialog with info icon function showInfoMessage(message) { Ext.Msg.show({ title: 'Info', msg: message, buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); } // Show a message dialig to let user choose YES or NO function showConfirmMessage(message, callBackFunctionForYes) { Ext.Msg.show({ title: 'Notice', msg: message, buttons: Ext.Msg.YESNO, icon: Ext.MessageBox.WARNING, fn: function (btn) { if (btn == "yes" && callBackFunctionForYes != null) { callBackFunctionForYes(); } } }); } // Show an message dialog present for an error appear // Let user send us email to specify how they meet the error var isShowingAnErrorMessage = false; function showErrorMessageWithEmailNotify(content, status) { if (isShowingAnErrorMessage == true) return; if (typeof (content) === 'undefined' || content == null) return; if (content.indexOf("Your session has been expired") != -1 || content.indexOf("Authentication require !") != -1) { if (typeof (GLOBAL_RESET_PASSWORD_TOKEN) === 'undefined' || GLOBAL_RESET_PASSWORD_TOKEN == null || GLOBAL_RESET_PASSWORD_TOKEN == "") { if (typeof (DISPLAY_LOGIN_FORM_WHEN_SESSION_OUT) === 'undefined' || DISPLAY_LOGIN_FORM_WHEN_SESSION_OUT == true) { // Check if the database is expired if (typeof (GLOBAL_LOGIN_STATUS) !== 'undefined' && GLOBAL_LOGIN_STATUS != null && GLOBAL_LOGIN_STATUS == MESSAGE_OBJECT_STATUS.DATABASE_EXPIRED) { Ext.Msg.show({ title: 'Cooking the books - Login', msg: 'Your database has been expired. Please contact info@cookingthebooks.com.au to renew your license.', buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); } else { window.location.href = '/'; } } else if (DISPLAY_LOGIN_FORM_WHEN_SESSION_OUT == false) { // Do nothing } } else { var resetPasswordForm = new Ext.CTBResetPassword({ resetPasswordToken: GLOBAL_RESET_PASSWORD_TOKEN, listeners: { show: function () { isShowingAnErrorMessage = true; }, beforehide: function () { isShowingAnErrorMessage = false; } } }); resetPasswordForm.show(); } return 1; } else if (content.indexOf("You don't have authority to perform this action.") != -1) { showAuthorityMessage(content); return 1; } else if (status != null && status == "INFORMATION") { showAuthorityMessage(content); return 1; } else { var inputId = getRandomNumber(); var webBrowserAdvertisement = 'For optimal performance and compatiablity, Google Chrome is our recommended web browser. Click the logo below to download the newest version of Google Chrome:' + '' + '' + '' + '' + '' + '
Click to download
'; var msgDialog = new Ext.Window({ title: 'We got a problem.', iconCls: '', layout: 'border', closeAction: 'close', expandOnShow: false, closable: false, resizable: false, modal: true, plain: false, minimizable: false, maximizable: false, monitorResize: true, width: 580, height: 320, defaults: { split: false, animFloat: false, autoHide: false, useSplitTips: true }, items: [ { xtype: 'panel', region: 'center', frame: true, html: '
' + content + '
', height: 120, margins: '10 5 0 5' }, { xtype: 'panel', layout: 'border', region: 'south', // title: 'Can you tell us what you were doing when this happened ?', // id: 'input-content-error-common', html: '
Can you tell us what you were doing when this happened?
', margins: '0 0 0 60', height: 130, items: [ { xtype: 'textarea', id: 'txt_' + inputId, //title : 'How did you meet this error ?', region: 'center', margins: '40 10 0 0' }, { xtype: 'panel', html: webBrowserAdvertisement, hidden: true, region: 'south', height: 110, frame: true } ] } ], listeners: { show: function () { isShowingAnErrorMessage = true; }, beforehide: function () { isShowingAnErrorMessage = false; } }, buttons: [ { xtype: 'button', text: 'Send to us', iconCls: 'icon-ok-large ', id: 'btn_Error_SendToUs;' + inputId, scale: 'large', handler: function (p_This) { // Check if user have given detail for the error var validateFields = new Array(); validateFields[0] = { ID: 'txt_' + getNumberIdFromStringId(p_This.getId()), VALIDATION_TYPE: VALIDATION_CONSTANTS.EMPTY, CUSTOM_MESSAGE: 'Please give us more detail about what you were doing when this error happen! We will answer your email as soon as possible. Thank you very much !' }; if (!validateFieldGroup(validateFields)) { return; } // Only send email if user type something in the notification area var loadMask = new Ext.LoadMask(Ext.getBody(), { msg: "Please wait..." }); loadMask.show(); Ext.Ajax.request({ method: 'POST', url: '/Account/SendErrorAnnoucementEmail', params: { userNotify: Ext.getCmp('txt_' + inputId).getValue() }, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); // Do nothing Ext.Msg.show({ title: 'Feedback Submitted', msg: '

Thank you for your feedback. We will attend to this matter as soon as practicable.


' + webBrowserAdvertisement, width: 500, buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } loadMask.hide(); }, failure: function (result, request) { loadMask.hide(); } }); // End ajax msgDialog.close(); } }, { xtype: 'button', text: 'Cancel', iconCls: 'icon-cancel-large', scale: 'large', handler: function () { msgDialog.close(); } } ] }); msgDialog.show(); return 1; } } // This function show a tab in a tab panel function showTabInTabPanel(tabPanel, showingChild) { tabPanel.unhideTabStripItem(showingChild); } // This function hide a tab in a tab panel function hideTabInTabPanel(tabPanel, hidingChild) { tabPanel.hideTabStripItem(hidingChild); } // Help video var Global_Help_CurrentVideo_ID = null; var Global_Help_CurrentVideo_Description = null; // Set video help function setVideoHelp(VIDEO_ID, VIDEO_DESC) { Global_Help_CurrentVideo_ID = VIDEO_ID; Global_Help_CurrentVideo_Description = VIDEO_DESC; } // Fix IE 7 - Iframe problem with tree panel Ext.override(Ext.EventObjectImpl, { getTarget: function (selector, maxDepth, returnEl) { var targetElement; try { targetElement = selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target); } catch (e) { targetElement = returnEl ? Ext.get(this.target) : this.target; } return targetElement; } }); //--------------------------------------------------- // NOTIFICATION //--------------------------------------------------- function showNotification(title, message, icon, config) { var notification = new Ext.ux.Notification({ iconCls: icon, title: title, myConfig: config, html: message, thumbIcon: icon, autoDestroy: true, hideDelay: 3000, listeners: { 'beforerender': function () { /*Sound.enable(); Sound.play('notify.wav'); Sound.disable();*/ } } }).show(document); notification.show(document); } // Show a drop down notification (Top - Center) function showDropDownNotification(title, message, icon, items) { new Ext.ux.Notification({ iconCls: icon, title: title, html: message, autoDestroy: true, hideDelay: 5000, items: items, slideDirection: 't', alignPosition: 'c-t', alignAnchorX: 0, alignAnchorY: 60 }).show(document); } function showSuccessNotification(message, icon, config) { if (message != null && message != '') //showNotification('Success', message, icon, config); showNotification('Success', message, Ext.ux.Notification.ICON_THUMB_UP, config); } function showErrorNotification(title, message, config) { if (message != null && message != '') //showNotification(title, message, NOTIFICATION.ICON_ERROR, config); showNotification(title, message, Ext.ux.Notification.ICON_THUMB_DOWN, config); } //--------------------------------------------------- // GET FILE EXTENSION //--------------------------------------------------- function GetFileExtension(filename) { return filename.split('.').pop(); } /* Custom Date object addHours method */ Date.prototype.addHours = function (h) { this.setHours(this.getHours() + h); return this; } /** * Licensed under GNU LESSER GENERAL PUBLIC LICENSE Version 3 * * @author Thorsten Suckow-Homberg * @url http://www.siteartwork.de/youtubeplayer */ Ext.namespace('Ext.ux.YoutubePlayer'); /** * A component utilizing the Youtube chromeless API. * * When loading the file into your application, the function "onYouTubePlayerReady" * will be added automatically into the window's scope. If a function with the same * name within that scope already exists, an exception will be thrown. * * Flaws: Mozilla https://bugzilla.mozilla.org/show_bug.cgi?id=262354 * * Example usage:
    var youtubePlayerPanel = new Ext.ux.YoutubePlayer({
        developerKey : [your developer key here],
        playerId     : 'myplayer',
        ratioMode    : 'strict',
        bgColor      : "#000000",
        cls          : 'ext-ux-youtubeplayer'
    });

    var w = new Ext.Window({
        width  : 400,
        height : 400,
        title  : "Test",
        layout : 'fit',
        items  : [
            youtubePlayerPanel
        ],
        bbar : new Ext.ux.YoutubePlayer.Control({
            player : youtubePlayerPanel,
            border : false,
            id     : 'control',
            style  : 'border:none;'
        })
    });
* * * * @class Ext.ux.YoutubePlayer * @extends Ext.FlashComponent * @author Thorsten Suckow-Homberg * @version 0.3 */ Ext.ux.YoutubePlayer = Ext.extend(Ext.FlashComponent, { /** * @cfg {String} ratioMode * Possible values: *
    *
  • 'strict' - The video will always show at 320x400 (w x h), * but if the overall parent's container size is smaller than this value, the video * will be proportional resized to keep the aspect ratio. *
  • *
  • 'stretch' - The video will be strethced in width and height according * to the parent's container width and height *
  • *
* Defaults to 'stretch'. */ /** * @cfg {String} playerId * The id of the flash object. The id attribute of the embedded flash object * will be set to this property. */ /** * @cfg {String} bgColor * The background color of the flash player */ /** * @param {HTMLElement} * The flash player controlled by this component * @private */ player: null, /** * The id of the last video requested. Will be stored even if an error loading the video * occured. */ videoId: null, /** * Sets default confg operations and attaches new events to this component so * interaction with the flash player works. */ initComponent: function () { this.addEvents( /** * @event ready * Fires after the youtube flash player has been loaded and is accessible * via javascript * @param {Ext.ux.YoutubePlayer} panel The Ext.BoxComponent derivat holding the flash object * @param {HTMLElement} player The DOM Node representing the flash player */ 'ready', /** * @event stateChange * Fires whenever the player's state changes. * @param {String} state Possible values are 'unstarted', 'ended', 'playing', 'paused', * 'buffering', 'video_cued'. When the SWF is first loaded, it will broadcast an 'unstarted' event. * When the video is cued and ready to play, it will broadcast a 'video_cued'. * @param {Ext.ux.YoutubePlayer} panel The Ext.BoxComponent that holds the flash player * @param {HTMLElement} player The Dom node representing the flash player */ 'stateChange', /** * @event error * Fired when an error in the player occurs. * @param {Number} errorCode Currently there is only one error code, which is 'video_not_found'. * This occurs when a video has been removed (for any reason), or it has been marked as private or * non-embeddable by the user. * @param {Ext.ux.YoutubePlayer} panel The Ext.BoxComponent that holds the flash player * @param {HTMLElement} player The Dom node representing the flash player */ 'error' ); Ext.apply(this, { ratioMode: this.ratioMode || 'normal', id: this.playerId, swfId: this.playerId, style: this.ratioMode == 'strict' ? 'position:relative' : 'position:static' }); Ext.applyIf(this, { url: location.protocol + "//www.youtube.com/apiplayer?" + "&enablejsapi=1&version=3&playerapiid=" + this.playerId, start: false, controls: false, cls: 'ext-ux-youtubeplayer ' + this.ratioMode, scripting: 'always', params: { wmode: 'opaque', bgcolor: this.bgColor || "#cccccc" } }); if (!Ext.ux.YoutubePlayer.Players) { Ext.ux.YoutubePlayer.Players = []; } Ext.ux.YoutubePlayer.Players[this.playerId] = this; }, /** * Sets the player controlled by this component once the flash object is * fully initialized. * This method is API reserved. * * @private */ _initPlayer: function () { this.player = this.swf; }, /** * Due to the nature of passig a callback to the youtube player, another method has to * intercept the state events and translate them into ext-events. * @param {Number} state The state of the player, which translates into it's string representation * for easier identifying the events. If the state number is not known yet by this api, the * state "unknown" will be passed as the state event identifier. * * This method is API reserved. * @private */ _delegateStateEvent: function (state) { switch (state) { case -1: state = 'unstarted'; break; case 0: state = 'ended'; break; case 1: state = 'playing'; break; case 2: state = 'paused'; break; case 3: state = 'buffering'; break; case 5: state = 'video_cued'; break; default: state = 'unknown'; break; } this.fireEvent('stateChange', state, this, this.player); }, /** * Due to the nature of passig a callback to the youtube player, another method has to * intercept the error events and translate them into ext-events. * @param {Number} errorCode The code as passed by the flash playerstate of the player, * which translates into it's string representation for easier identifying the events. * If the error number is not known yet by this api, the * state "unknown" will be passed as the error event identifier. * * This method is API reserved. * @private */ _delegateErrorEvent: function (errorCode) { switch (errorCode) { case 100: errorCode = 'video_not_found'; break; default: errorCode = 'unknown'; break; } this.fireEvent('error', errorCode, this, this.player); }, /** * Overwrites parent implemenmtation to keep aspect ratio of the player window * if needed. */ onResize: function (w, h, w1, h1) { if (this.playerAvailable()) { this.adjustRatio(this.getWidth(), this.getHeight()); } }, /** * Adjusts the width and height of the video according to the ratioMode * property. */ adjustRatio: function (width, height) { var pStyle = this.player.style; switch (this.ratioMode) { case 'strict': if (width < 400 || height < 320) { var newHeight = Math.floor(width * 0.8); if (newHeight > height) { width = Math.floor(height / 0.8); } else { height = newHeight; } } else { if (height > 320) { height = 320; width = 400; } } pStyle.marginTop = -Math.floor(height / 2) + 'px'; pStyle.marginLeft = -Math.floor(width / 2) + 'px'; pStyle.height = height + 'px'; pStyle.width = width + 'px'; pStyle.top = '50%'; pStyle.left = '50%'; this.setPlayerSize(width, height); break; case 'stretch': pStyle.margin = 'auto'; pStyle.height = height + 'px'; pStyle.width = width + 'px'; this.setPlayerSize(width, height); break; } }, /** * Helper function for checking if the flash movie is still available. */ playerAvailable: function () { return (this.player && this.player.getPlayerState) ? true : false; }, //-------------------------- Youtube API /** * Load the specified video and starts playing the video. If startSeconds (number can be a float) * is specified, the video will start from the closest keyframe to the specified time. * * @param {String} videoId * @param {Number/Float} startSeconds */ loadVideoById: function (videoId, startSeconds) { this.player.loadVideoById(videoId, startSeconds); this.videoId = videoId; }, /** * Loads the specified video's thumbnail and prepares the player to play the video. * The player does not request the FLV until playVideo() or seekTo() is called. * startSeconds accepts a float/integer and specifies the time that the video should * start playing from when playVideo() is called. If you specify startSeconds and then * call seekTo(), the startSeconds is forgotten and the player plays from the time specified * in the seekTo() call. When the video is cued and ready to play, the player will * broadcast the 'video_cued' event. * * @param {String} videoId * @param {Number/Float} startSeconds */ cueVideoById: function (videoId, startSeconds) { this.player.cueVideoById(videoId, startSeconds); this.videoId = videoId; }, cueVideoByUrl: function (videoUrl, startSeconds) { this.player.cueVideoById(this._parseVideoId(videoUrl), startSeconds); this.videoId = videoId; }, /** * Helper function for parsing a given string for a youtube video id * Allowed strings are f.e. * http://www.youtube.com/watch?v=-dsdsdsd&sdfsf * http://www.youtube.com/watch/v/-dsdsdsd * -sdsdjh78sdds * fsfddsffdsd-sdf324243 * * @return {String} the parsed video id or "null" if no video id * could be found. */ _parseVideoId: function (text) { var mpos = text.indexOf('v='); var mpos1 = text.indexOf('/v/'); if (mpos != -1 || mpos1 != -1) { text = text.replace( /(.*)(v=|\/v\/)([^&]+)(.*)/gi, "$3" ); } else { text = /^[a-zA-Z0-9_\-]+$/.test(text) === false ? null : text; } return text; }, /** * Sets the size of the chromeless player. This method should be used in favor of setting * the width + height of the MovieClip directly. Note that this method does not constrain * the proportions of the video player, so you will need to maintain a 4:3 aspect ratio. * When embedding the player directly in HTML, the size is updated automatically to the * Stage.width and Stage.height values, so there is no need to call setSize() when * embedding the chromeless player directly into an HTML page. The default size of the SWF * when loaded into another SWF is 320px by 240px * * @param {Number} width * @param {Number} height */ setPlayerSize: function (width, height) { if (!this.playerAvailable()) { return; } this.player.setSize(width, height); }, /** * Plays the currently cued/loaded video. */ playVideo: function () { if (!this.playerAvailable()) { return; } this.player.playVideo(); }, /** * Pauses the currently playing video. */ pauseVideo: function () { if (!this.playerAvailable()) { return; } this.player.pauseVideo(); }, /** * Stops the current video. This also closes the NetStream object and cancels * the loading of the video. Once stopVideo() is called, a video cannot be resumed * without reloading the player or loading a new video. * When calling stopVideo(), the player will first broadcast an 'ended' event, * followed by an 'unstarted' event. */ stopVideo: function () { if (!this.playerAvailable()) { return; } this.player.stopVideo(); }, /** * Clears the video display. Useful if you want to clear the video remnant after * calling stopVideo(). */ clearVideo: function () { if (!this.playerAvailable()) { return; } this.videoId = null; this.player.clearVideo(); }, /** * Returns the number of bytes loaded for the current video. * * @return {Number} */ getVideoBytesLoaded: function () { if (!this.playerAvailable()) { return 0; } return this.player.getVideoBytesLoaded(); }, /** * Returns the size in bytes of the currently loaded/playing video. * * @return {Number} */ getVideoBytesTotal: function () { if (!this.playerAvailable()) { return 0; } return this.player.getVideoBytesTotal(); }, /** * Returns the number of bytes the video file started loading from. * Example scenario: the user seeks ahead to a point that hasn't loaded yet, * and the player makes a new request to play a segment of the video that hasn't loaded yet. * * @return {Number} */ getVideoStartBytes: function () { if (!this.playerAvailable()) { return 0; } return this.player.getVideoStartBytes(); }, /** * Mutes/unmutes the player. * * @param {Boolean} mute true to mute the player, false to unmute the * player */ mute: function (mute) { if (!this.playerAvailable()) { return; } if (mute === false) { this.player.unMute(); // hack: on some systems, the API does not recognize a unMute directly, // but setting the actual volume value again helps. this.setVolume(this.getVolume()); } else { this.player.mute(); } }, /** * Returns true if the player is muted, false if not. * * @return {Boolean} */ isMuted: function (mute) { if (!this.playerAvailable()) { return true; } return this.player.isMuted(); }, /** * Sets the volume. Accepts an integer between 0-100. * * @param {Number} volume */ setVolume: function (volume) { if (!this.playerAvailable()) { return; } this.player.setVolume(volume); }, /** * Returns the player's current volume, an integer between 0-100. Note that * getVolume() will return the volume even if the player is muted. * * @return {Number} */ getVolume: function () { if (!this.playerAvailable()) { return 0; } return this.player.getVolume(); }, /** * Seeks to the specified time of the video in seconds. The allowSeekAhead * determines whether or not the player will make a new request to the server * if seconds is beyond the currently loaded video data. Note that seekTo() will * attempt to seek to the closest keyframe to the seconds specified. This means that * sometimes the play head may actually seek to just before or just after the requested * time, usually no more than ~2 seconds. * * @param {Number} seconds * @param {Boolean} allowSeekAhead */ seekTo: function (seconds, allowSeekAhead) { if (!this.playerAvailable()) { return; } this.player.seekTo(seconds, allowSeekAhead); }, /** * Returns the state of the player. Possible values are 'unstarted', 'ended', * 'playing', 'paused', 'buffering', 'video_cued'. Returns 'unknown' if the player's * state is not yet known by this api. * * @return {String} */ getPlayerState: function () { var state = -9999; if (!this.playerAvailable()) { return; } else { state = this.player.getPlayerState(); } switch (state) { case -1: state = 'unstarted'; break; case 0: state = 'ended'; break; case 1: state = 'playing'; break; case 2: state = 'paused'; break; case 3: state = 'buffering'; break; case 5: state = 'video_cued'; break; default: state = 'unknown'; break; } return state; }, /** * Returns the available quality levels of the loaded video, or an empty array * if no current video is available. * * @return {Array} */ getAvailableQualityLevels: function () { if (!this.playerAvailable()) { return []; } return this.player.getAvailableQualityLevels(); }, /** * Sets the playback quality for the currently available video. * * @param {String} level "small", "medium", "large" or "hd720" */ setPlaybackQuality: function (level) { if (!this.playerAvailable()) { return; } return this.player.setPlaybackQuality(level); }, /** * Returns the playback quality for the currently available video, * or undefined. * * @return {mixed} "small", "medium", "large", "hd720" or undefined */ getPlaybackQuality: function () { if (!this.playerAvailable()) { return undefined; } return this.player.getPlaybackQuality(); }, /** * Returns the current time in seconds of the current video. * * @return {Number} */ getCurrentTime: function () { if (!this.playerAvailable()) { return 0; } return this.player.getCurrentTime(); }, /** * Returns the duration in seconds of the currently playing video. Note that * getDuration() will return 0 until the video's metadata is loaded, which * normally happens just after the video starts playing. * * @return {Number} */ getDuration: function () { if (!this.playerAvailable()) { return 0; } return this.player.getDuration(); }, /** * Returns the YouTube.com URL for the currently loaded/playing video. * * @return {String} */ getVideoUrl: function () { if (!this.playerAvailable()) { return ""; } return this.player.getVideoUrl(); }, /** * Returns the embed code for the currently loaded/playing video. * * @return {String} */ getVideoEmbedCode: function () { if (!this.playerAvailable()) { return ""; } return this.player.getVideoEmbedCode(); } }); // create a sequence if onYouTubePlayerReady is already available var _onYouTubePlayerReady = function(playerId) { var panel = Ext.ux.YoutubePlayer.Players[playerId]; if (panel) { var player = document.getElementById(playerId); panel._initPlayer(); player.addEventListener('onStateChange', "Ext.ux.YoutubePlayer.Players['"+playerId+"']._delegateStateEvent"); player.addEventListener('onError', "Ext.ux.YoutubePlayer.Players['"+playerId+"']._delegateErrorEvent"); panel.adjustRatio(panel.getWidth(), panel.getHeight()); panel.fireEvent('ready', panel, player); } }; if (!window.onYouTubePlayerReady) { window.onYouTubePlayerReady = _onYouTubePlayerReady; } else { throw("\"onYouTubePlayerReady\" is already defined. Cannot use Ext.ux.YoutubePlayer.") } /** * Licensed under GNU LESSER GENERAL PUBLIC LICENSE Version 3 * * @author Thorsten Suckow-Homberg * @url http://www.siteartwork.de/youtubeplayer */ Ext.namespace('Ext.ux.YoutubePlayer'); /** * An example implementation of a control for the Ext.ux.YoutubePlayer. * It provides functionality for loading videos, muting/unmuting a video, * setting the volume and paging between items in a playlist (though a playlist * is neither part of the Ext.ux.YoutubePlayer nor the Ext.ux.YoutubePlayer.Control). * * Developers Note: This version was enhanced to be used with Ext3.0RC1. You may find a few * workarounds in here, which should be checked against a later release of Ext3.0. * * @class {Ext.ux.YoutubePlayer.Control} * @extends {Ext.Toolbar} * * @author Thorsten Suckow-Homberg * * Released as a sub project of conjoon */ Ext.ux.YoutubePlayer.Control = Ext.extend(Ext.Toolbar, { /** * The youtube player this control should take care of. * @cfg {Ext.ux.YoutubePlayer} player */ /** * The task that is responsible for reading out different states from the video * such as bytesLoaded */ task : null, /** * The table cell in the toolbar that holds information about the runtime * of the video */ elRuntime : null, /** * An ext button providing actions for loading a video. */ ejectButton : null, /** * An ext button for starting the video. */ playButton : null, /** * An ext button for stopping the currently playing video */ stopButton : null, /** * An ext button for playing the previous item in a playlist (if any) */ previousButton : null, /** * An ext button for playing the next item in a playlist (if any) */ nextButton : null, /** * The button to mute/unmute the sound of the video. */ muteButton : null, /** * Slider to control the volume of the video */ volumeSlider : null, /** * Controls the playback of the video. */ sliderField : null, /** * tells if the user is currently adjusting the play position in the stream */ isAdjusting : false, /** * @type {Ext.Button} Menubutton for selecting playback quality */ qualityButton : null, /** * @type {Ext.menu.Item} menu item for quality "small" entry */ qualitySmallItem : null, /** * @type {Ext.menu.Item} menu item for quality "medium" entry */ qualityMediumItem : null, /** * @type {Ext.menu.Item} menu item for quality "large" entry */ qualityLargeItem : null, /** * @type {Ext.menu.Item} menu item for quality "HD720" entry */ qualityHd720Item : null, /** * @type {Ext.menu.Item} menu item for letting the player auto chose quality */ qualityAutoItem : null, /** * Listener for the eject button. Will show a dialog which prompts the user * for a video id or video url to play. * The parser for the video is very simple. Much room for improvements here. */ _onEject : function() { var control = this; Ext.Msg.prompt('Load video', 'Please enter the video id or url:', function(btn, text){ if (btn == 'ok'){ var id = control._parseVideoId(text); if (!id) { Ext.Msg.alert( 'Load video', "id \""+id+"\" does not seem to be a valid video id" ); return; } control.player.stopVideo(); control.player.clearVideo(); control.player.cueVideoById(id); } }); }, /** * Helper function for parsing a given string for a youtube video id * Allowed strings are f.e. * http://www.youtube.com/watch?v=-dsdsdsd&sdfsf * http://www.youtube.com/watch/v/-dsdsdsd * -sdsdjh78sdds * fsfddsffdsd-sdf324243 * * @return {String} the parsed video id or "null" if no video id * could be found. */ _parseVideoId : function(text) { var mpos = text.indexOf('v='); var mpos1 = text.indexOf('/v/'); if (mpos != -1 || mpos1 != -1) { text =text.replace( /(.*)(v=|\/v\/)([^&]+)(.*)/gi, "$3" ); } else { text = /^[a-zA-Z0-9_\-]+$/.test(text) === false ? null : text; } return text; }, /** * Listener or the error-event of the player. If any error occurs, the player * will be stopped. */ _onError : function(errorCode, playerPanel, player) { playerPanel.stopVideo(); Ext.Msg.alert('Error', 'The video you requested could not be played. Error code '+errorCode); }, /** * Listener for the progress slider, i.e. when the slider gets dragged and the user * wants to skip to a new position in the video stream. */ _onSeekPosition : function() { this.player.seekTo(this.sliderField.getValue()); }, /** * Listener for the volume slider. */ _onSetVolume : function() { this.muteButton.toggle(false); this.player.setVolume(this.volumeSlider.getValue()); }, /** * Listener for the mute button toggle event. * Since Ext3.0, Toolbars come with a layout manager which is capable of hiding * items if the containers enableOverfloe is set to true (defaults to true). * This method can either be called from a menu item in a more menu, or the * split button directly. * * @param {Ext.Toolbar.SplitButton}|{Ext.menu.Item} */ _onMuteToggle : function(button) { var pressed = this.muteButton.pressed; var isMore = false; if (button instanceof Ext.menu.Item) { isMore = true; pressed = !pressed; } if (pressed) { button.setIconClass('ext-ux-youtubeplayer-control-muteIcon'); if (isMore) { this.muteButton.toggle(true); return; } this.player.mute(true); } else { button.setIconClass('ext-ux-youtubeplayer-control-volumeIcon'); if (isMore) { this.muteButton.toggle(false); return; } this.player.mute(false); } }, /** * Listener for the play button */ _onPlay : function(button) { var state = this.player.getPlayerState(); if (state == 'playing') { this.player.pauseVideo(); } else if (state == 'paused' || state == 'video_cued') { this.player.playVideo(); } }, /** * Listener for the stop button. * This implementation will not directly stop the vide (i.e. unloading it), * but rather pause the video and reset its position to 0. */ _onStop : function(button) { this.player.pauseVideo(); this.player.seekTo(0); this.stopButton.setDisabled(true); this._updateVideoInfo.defer(100, this, [true]); }, /** * Inits this component. */ initComponent : function() { var tb = Ext.Toolbar.Button; this.ejectButton = new tb({ iconCls : 'eject', disabled : true }); this.playButton = new tb({ iconCls : 'play', disabled : true }); this.stopButton = new tb({ iconCls : 'stop', disabled : true }); this.previousButton = new tb({ iconCls : 'start', disabled : true }); this.nextButton = new tb({ iconCls : 'end', disabled : true }); this.qualityHd720Item = new Ext.menu.CheckItem({ text : '720p', group : 'quality', disabled : true }); this.qualityLargeItem = new Ext.menu.CheckItem({ text : '480p', group : 'quality', disabled : true }); this.qualityMediumItem = new Ext.menu.CheckItem({ text : '360p', group : 'quality', disabled : true }); this.qualitySmallItem = new Ext.menu.CheckItem({ text : '< 360p', group : 'quality', disabled : true }); this.qualityAutoItem = new Ext.menu.CheckItem({ text : 'Auto', checked : true }); this.qualityButton = new Ext.Button({ iconCls : 'quality', menu : [ this.qualityHd720Item, this.qualityLargeItem, this.qualityMediumItem, this.qualitySmallItem, '-', this.qualityAutoItem ] }); this.volumeSlider = new Ext.Slider({ minValue : 0, maxValue : 100, width : 110, disabled : true }); this.sliderField = new Ext.ux.YoutubePlayer.Control.Slider({ minValue : 0, maxValue : 0, disabled : true, listeners : { render : function() { this.el.dom.parentNode.style.width = '100%'; } } }); this.muteButton = new Ext.Toolbar.SplitButton({ iconCls : 'ext-ux-youtubeplayer-control-volumeIcon', enableToggle : true, disabled : true, width : 36, menu : new Ext.menu.Menu({ enableScrolling : false, plain : true, showSeparator : false, items : [this.volumeSlider] }), handler : this._onMuteToggle, scope : this }); this.elRuntime = new Ext.Toolbar.TextItem({text:"00:00"}); Ext.apply(this, { cls : 'ext-ux-youtubeplayer-control', items : [ this.ejectButton, this.playButton, this.stopButton, this.previousButton, this.nextButton, ' ', this.sliderField, ' ', this.elRuntime, new Ext.Toolbar.Spacer(), this.qualityButton, this.muteButton ] }); Ext.ux.YoutubePlayer.Control.superclass.initComponent.call(this); this.on('beforerender', this._initListeners, this); this.player.on('ready', function() { this.ejectButton.setDisabled(false); }, this); }, /** * Inits the listener for this control. * */ _initListeners : function() { // hack for working around the overflow functionality - if the method // does not get altered, the mute button would not get rendered properly all the time this.on('afterlayout', function() { this.getLayout().onLayout = this.getLayout().onLayout.createInterceptor(function() { this.container.sliderField.el.dom.parentNode.style.width ="1px"; }); this.getLayout().onLayout = this.getLayout().onLayout.createSequence(function() { this.container.sliderField.el.dom.parentNode.style.width ='100%'; }); }, this, {single : true}); this.muteButton.menu.on('beforeshow', function(){ var state = this.player.getState(); if (state != 'ended' && state != 'unstarted') { this.volumeSlider.setDisabled(false); this.volumeSlider.setValue(this.player.getVolume(), false); } }, this); this.playButton.on('click', this._onPlay, this); this.stopButton.on('click', this._onStop, this); this.muteButton.on('toggle', this._onMuteToggle, this); this.on('hide', this._onHide, this); this.on('destroy', this._onDestroy, this); var c = this; this.player.on('stateChange', function(state, panel, player){c._processPlayerEvents.defer(1, c, [state, panel, player]);}, this); this.sliderField.on('dragstart', function(){this.isAdjusting = true;}, this); this.sliderField.on('drag', this._onSeekPosition, this); this.sliderField.on('dragend', function(){this.isAdjusting = false;}, this); this.volumeSlider.on('drag', this._onSetVolume, this); this.player.on('error', this._onError, this); this.ejectButton.on('click', this._onEject, this); this.qualitySmallItem.on('checkchange', this._onQualityItemCheckChange, this); this.qualityMediumItem.on('checkchange', this._onQualityItemCheckChange, this); this.qualityLargeItem.on('checkchange', this._onQualityItemCheckChange, this); this.qualityHd720Item.on('checkchange', this._onQualityItemCheckChange, this); this.qualityAutoItem.on('checkchange', this._onQualityItemCheckChange, this); }, /** * Stops the task manager, removes the fx element and destroys the volume * panel. */ _onDestroy : function() { if (this.task) { Ext.TaskMgr.stop(this.task); } }, /** * Updates the menu items representing the quality levels of the crrently * playing video. * * @param {Array} levels An array with any of the following values: * small, medium, large, hd720 */ _updateAvailableQualityLevels : function(levels) { this.qualitySmallItem.setDisabled(levels.indexOf('small') == -1); this.qualityMediumItem.setDisabled(levels.indexOf('medium') == -1); this.qualityLargeItem.setDisabled(levels.indexOf('large') == -1); this.qualityHd720Item.setDisabled(levels.indexOf('hd720') == -1); }, /** * Sets the quality of the video based on the chosen quality settings. * * @param {Array} levels An array with any of the following values: * small, medium, large, hd720 */ _autoAdjustQualityLevel : function(levels) { // first, check if autoQuality is activated. if (this.qualityAutoItem.checked) { this.player.setPlaybackQuality('default'); } else { if (this.qualitySmallItem.checked) { this.player.setPlaybackQuality('small'); return; } if (this.qualityMediumItem.checked) { this.player.setPlaybackQuality('medium'); return; } if (this.qualityLargeItem.checked) { this.player.setPlaybackQuality('large'); return; } if (this.qualityHd720Item.checked) { this.player.setPlaybackQuality('hd720'); return; } } }, /** * Checks the menu item for the quality level based on the passed argument. * Will not fire any events from the menu items. * * @apram {String} level any of "small", "medium", "large", "hd720". */ _updateCurrentQualityItem : function(level) { this.qualitySmallItem.setChecked(false, true); this.qualityMediumItem.setChecked(false, true); this.qualityLargeItem.setChecked(false, true); this.qualityHd720Item.setChecked(false, true); switch (level) { case 'small': this.qualitySmallItem.setChecked(true, true); break; case 'medium': this.qualityMediumItem.setChecked(true, true); break; case 'large': this.qualityLargeItem.setChecked(true, true); break; case 'hd720': this.qualityHd720Item.setChecked(true, true); break; } }, /** * Called when a quality menu items has been checked/unchecked. * * @param {Ext.menu.Item} item * @param {Boolean} checked */ _onQualityItemCheckChange : function(item, checked) { switch (item) { case this.qualitySmallItem: this.player.setPlaybackQuality('small'); break; case this.qualityMediumItem: this.player.setPlaybackQuality('medium'); break; case this.qualityLargeItem: this.player.setPlaybackQuality('large'); break; case this.qualityHd720Item: this.player.setPlaybackQuality('hd720'); break; case this.qualityAutoItem: if (checked) { this.player.setPlaybackQuality('default'); } break; } }, /** * Callback for the task querying the player's state every 500 ms. * Note that in mozilla, a maximize or collapse of a window the player sits * in will reload the whole movie under certain circumstances, thus resultig in * the current task runnning to be invalid. The task will check for a valid * player-instance and end itself if none found. * * @param {Boolean} ignorePaused if set to true and the player is paused, * only the progress bg of the sliderField will be updated, in case the video * is still buffering */ _updateVideoInfo : function(ignorePaused) { if (!this.player.playerAvailable()) { this._processPlayerEvents('ended', this.player, null); return; } var player = this.player; var slider = this.sliderField; var loaded = player.getVideoBytesLoaded(); if (loaded != -1) { slider.updateSliderBg( Math.floor((slider.getWidth()/100)* Math.floor(((loaded/player.getVideoBytesTotal())*100))) ); } if (ignorePaused !== true && player.getPlayerState() == 'paused') { return; } var currentTime = Math.max(0, player.getCurrentTime()); var totalTime = Math.max(0, player.getDuration()); if (totalTime != 0) { var rem = Math.floor(totalTime - currentTime); var minutes = Math.max(0, Math.floor(rem / 60)); var seconds = Math.max(0, (rem%60)); this.elRuntime.setText((minutes < 10 ? '0'+minutes : minutes)+':'+(seconds < 10 ? '0'+seconds : seconds)); this.sliderField.maxValue = totalTime; if (!this.isAdjusting) { this.sliderField.setValue(currentTime, false); } } }, /** * Gateway for the player events. */ _processPlayerEvents : function(state, panel, player) { switch (state) { case 'unstarted': this._un = true; if (this.task) { Ext.TaskMgr.stop(this.task); this.task = null; } break; case 'ended': if (this.task) { Ext.TaskMgr.stop(this.task); this.task = null; } this.playButton.setIconClass('play'); this.sliderField.setValue(0); this.sliderField.setDisabled(true); this.sliderField.updateSliderBg(0); this.elRuntime.setText("00:00"); if (this.volumeField) { this.volumeField.setDisabled(true); } this.playButton.setDisabled(true); this.stopButton.setDisabled(true); this.muteButton.setDisabled(true); if (panel.videoId && !this._un) { this._un = true; panel.cueVideoById(panel.videoId, 0); } break; case 'playing': this._updateCurrentQualityItem(player.getPlaybackQuality()); if (!this.task) { var levels = panel.getAvailableQualityLevels(); this._updateAvailableQualityLevels(levels); this._autoAdjustQualityLevel(levels); var c = this; this.task = { run: function(){ c._updateVideoInfo(); }, interval: 500 }; Ext.TaskMgr.start(this.task); } this._un = false; this.sliderField.setDisabled(false); if (this.volumeField) { this.volumeField.setDisabled(false); } this.playButton.setIconClass('pause'); this.playButton.setDisabled(false); this.stopButton.setDisabled(false); this.muteButton.setDisabled(false); break; case 'paused': this.playButton.setIconClass('play'); break; case 'buffering': break; case 'video_cued': this.playButton.setDisabled(false); break; case 'unknown': break; } } }); /** * @class Ext.ux.YoutubePlayer.Control.Slider * @extends Ext.Slider * Slider which supports showing the loading progress of a youtube video */ Ext.ux.YoutubePlayer.Control.Slider = Ext.extend(Ext.Slider, { cls : 'ext-ux-youtubeplayer-control-slider', // private override onRender : function() { Ext.ux.YoutubePlayer.Control.Slider.superclass.onRender.apply(this, arguments); this.progress = document.createElement('div'); this.progress.className = 'hbar'; this.el.dom.appendChild(this.progress); }, updateSliderBg : function(percentage) { try{ this.progress.style.backgroundPosition = '-'+(1280-percentage)+'px 0'; }catch(e){ } } }); var Global_Help_VideoURL = null; var Global_Help_Player = null; var Global_Help_VideoID = null; function showHelpVideo(videoUrl, isUsingForHelp){ if (isUsingForHelp) { Global_Help_VideoID = Global_Help_CurrentVideo_ID; Ext.getCmp('dlg_HelpPlayer').show(); Ext.getCmp('dlg_HelpPlayer').setTitle(Global_Help_CurrentVideo_Description); } else { Global_Help_VideoID = videoUrl; Ext.getCmp('dlg_HelpPlayer').show(); Ext.getCmp('dlg_HelpPlayer').setTitle("Advertisement Video"); } } function playHelpVideo(videoUrl){ if (Global_Help_Player.player == null) { setTimeout('playHelpVideo(\''+videoUrl+'\')', 100); } else { Global_Help_Player.loadVideoById(Global_Help_Player._parseVideoId(videoUrl), 0); } } Ext.onReady(function () { var loadMask = new Ext.LoadMask(Ext.getBody(), { msg: "Please wait..." }); var DEVELOPER_KEY = 'AI39si4UFtTDsY4S0DJhY-YUEFvKD3yDqtJgrc37j3ARF-_6wdOxp-vAnLjsrKrV5kve0MHOj5U9WmfKSU4L4VJ7Iuaw3kFjlQ'; var playerPanel = new Ext.ux.YoutubePlayer({ developerKey : DEVELOPER_KEY, playerId : 'player_helpvideo', border : false, ratioMode : 'stretch', hideMode : 'visibility', bgColor : "#000000", bodyStyle : 'background-color:#000000;', region : 'center' }); Global_Help_Player = playerPanel; playerPanel.on('ready', function(panel, player) { //panel.cueVideoById(playerPanel._parseVideoId('http://www.youtube.com/watch?v=CD2LRROpph0'), 0); }, playerPanel); var dlg_HelpPlayer = new Ext.Window({ title: 'Help video', layout: 'border', id: 'dlg_HelpPlayer', closeAction: 'hide', tbar : [ '->', { xtype : 'panel', id : 'pnl_HelpPlayer_Title', width : 780, tpl : new Ext.XTemplate('{title}'), html : 'Cooking the Books - Youtube Channel', frame : true, callback_AfterRender : null, listeners : { afterrender : function(p_This){ if (p_This.callback_AfterRender != null) p_This.callback_AfterRender(); } } } ], expandOnShow: false, closable: true, resizable: true, modal: false, plain: false, minimizable: false, maximizable: true, monitorResize: true, width: 800, height: 500, defaults: { split: true, animFloat: false, autoHide: false, useSplitTips: true }, bbar : new Ext.ux.YoutubePlayer.Control({ player : playerPanel, border : false, id : 'helpVideoPlayerControl', style : 'border:none;' }), items: [ playerPanel ], listeners : { 'resize' : function(){this.bottomToolbar.fireEvent('resize')}, 'beforehide' : function(){ try{ playerPanel.clearVideo(); playerPanel.stopVideo(); }catch(e){} }, 'show' : function(){ //var videoUrl = Global_Help_VideoURL == null ? "http://www.youtube.com/watch?v=xEPqgJzVk44" : Global_Help_VideoURL; //var videoID = C_RECIPEBOOK_VIDEO_ID; playHelpVideo(Global_Help_VideoID); } } }); }); // End Ext.Ready Ext.namespace('Ext.ux.form'); Ext.ux.form.CheckboxCombo = Ext.extend(Ext.form.TriggerField, { /** * @cfg {String} title If supplied, a header element is created containing this text and added into the top of * the dropdown list (defaults to undefined, with no header element) */ // private defaultAutoCreate: {tag: "input", type: "text", size: "24", autocomplete: "off"}, /** * @cfg {String} listClass The CSS class to add to the predefined 'x-checkboxcombo-list' class * applied the dropdown list element (defaults to ''). */ listClass: '', /** * @cfg {String} listEmptyText The empty text to display in the data view if no items are found. * (defaults to '') */ listEmptyText: '', /** * @cfg {String} triggerClass An additional CSS class used to style the trigger button. The trigger will always * get the class 'x-form-trigger' and triggerClass will be appended if specified * (defaults to 'x-form-arrow-trigger' which displays a downward arrow icon). */ triggerClass: 'x-form-arrow-trigger', /** * @cfg {Boolean/String} shadow true or "sides" for the default effect, "frame" for * 4-way shadow, and "drop" for bottom-right */ shadow: 'sides', /** * @cfg {String/Array} listAlign A valid anchor position value. See {@link Ext.Element#alignTo} for details * on supported anchor positions and offsets. To specify x/y offsets as well, this value * may be specified as an Array of {@link Ext.Element#alignTo} method arguments. * [ 'tl-bl?', [6,0] ] (defaults to 'tl-bl?') */ listAlign: 'tl-bl?', /** * @cfg {Number} maxHeight The maximum height in pixels of the dropdown list before scrollbars are shown * (defaults to 300) */ maxHeight: 300, /** * @cfg {Number} minHeight The minimum height in pixels of the dropdown list when the list is constrained by its * distance to the viewport edges (defaults to 90) */ minHeight: 90, /** * @cfg {Boolean} selectOnFocus true to select any existing text in the field immediately on focus. * Only applies when {@link Ext.form.TriggerField#editable editable} = true (defaults to * false). */ selectOnFocus: false, /** * @cfg {Boolean} false to prevent the user from typing text directly into the field, the field will only respond to a click on the trigger to set the value. (defaults to false). */ editable: false, /** * @cfg {String} loadingText The text to display in the dropdown list while data is loading. Only applies * when {@link #mode} = 'remote' (defaults to 'Loading...') */ loadingText: 'Loading...', /** * @cfg {String} mode Acceptable values are 'remote' (Default) or 'local' */ mode: 'remote', /** * @cfg {Number} minListWidth The minimum width of the dropdown list in pixels (defaults to 70, will * be ignored if {@link #listWidth} has a higher value) */ minListWidth: 70, /** * @cfg {Boolean} lazyInit true to not initialize the list for this combo until the field is focused * (defaults to true) */ lazyInit: true, /** * @cfg {Boolean} submitValue False to clear the name attribute on the field so that it is not submitted during a form post. * If a hiddenName is specified, setting this to true will cause both the hidden field and the element to be submitted. * Defaults to undefined. */ submitValue: undefined, // private initComponent: function() { Ext.ux.form.CheckboxCombo.superclass.initComponent.call(this); this.addEvents( 'expand', 'collapse', 'change' ); //auto-configure store from local array data if (this.store) { this.store = Ext.StoreMgr.lookup(this.store); if (this.store.autoCreated){ this.displayField = this.valueField = 'field1'; if (!this.store.expandData){ this.displayField = 'field2'; } this.mode = 'local'; } } if (!this.tpl) { this.tpl = this.tpl = '{' + this.displayField + '}'; } this.selectedIndex = -1; }, // private onRender: function(ct, position){ if (this.hiddenName && !Ext.isDefined(this.submitValue)){ this.submitValue = false; } Ext.ux.form.CheckboxCombo.superclass.onRender.call(this, ct, position); if (this.hiddenName){ this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName, id: (this.hiddenId||this.hiddenName)}, 'before', true); } if (Ext.isGecko){ this.el.dom.setAttribute('autocomplete', 'off'); } if (!this.lazyInit){ this.initList(); } else { this.on('focus', this.initList, this, {single: true}); } }, // private initValue: function() { Ext.ux.form.CheckboxCombo.superclass.initValue.call(this); if (this.hiddenField){ this.hiddenField.value = Ext.value(Ext.isDefined(this.hiddenValue) ? this.hiddenValue : this.value, ''); } }, // private initList: function() { if (!this.list){ var cls = 'x-checkboxcombo-list', listParent = Ext.getDom(this.getListParent() || Ext.getBody()), zindex = parseInt(Ext.fly(listParent).getStyle('z-index') ,10); if (this.ownerCt && !zindex){ this.findParentBy(function(ct){ zindex = parseInt(ct.getPositionEl().getStyle('z-index'), 10); return !!zindex; }); } this.list = new Ext.Layer({ parentEl: listParent, shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false, zindex: (zindex || 12000) + 5 }); var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth); this.list.setWidth(lw); this.list.swallowEvent('mousewheel'); this.assetHeight = 0; if (this.syncFont !== false){ this.list.setStyle('font-size', this.el.getStyle('font-size')); } this.innerList = this.list.createChild({cls:cls + '-inner'}); this.innerList.setWidth(lw - this.list.getFrameWidth('lr')); this.mon(this.innerList, 'mouseover', this.onListOver, this, {delegate: '.x-form-item'}); this.mon(this.innerList, 'mousemove', this.onListMove, this, {delegate: '.x-form-item'}); this.mon(this.innerList, 'click', this.onListClick, this, {delegate: '.x-form-item'}); /*this.cbgroup = new Ext.form.CheckboxGroup({ renderTo: this.innerList, columns: 1, border: false, items: [{}] });*/ this.bindStore(this.store, true); this.restrictHeight(); } }, getListParent: function() { return document.body; }, /** * Returns the store associated with this combo. * @return {Ext.data.Store} The store */ getStore: function() { return this.store; }, // private bindStore: function(store, initial){ if (this.store && !initial){ if (this.store !== store && 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 (!store){ this.store = null; } } if (store){ if (!initial) { this.lastQuery = null; } this.store = Ext.StoreMgr.lookup(store); this.store.on({ scope: this, beforeload: this.onBeforeLoad, load: this.onLoad, exception: this.collapse }); this.removeCheckboxes(); this.addCheckboxes(); } }, // private initEvents: function() { Ext.ux.form.CheckboxCombo.superclass.initEvents.call(this); this.keyNav = new Ext.KeyNav(this.el, { 'up': function(e){ this.inKeyMode = true; this.selectPrev(); }, 'down': function(e){ if (!this.isExpanded()){ this.onTriggerClick(); } else { this.inKeyMode = true; this.selectNext(); } }, 'enter': function(e) { this.onListEnter(); }, 'esc': function(e){ this.collapse(); }, 'tab': function(e){ this.collapse(); return true; }, scope: this, doRelay: function(e, h, hname){ if (hname == 'down' || this.scope.isExpanded()){ // this MUST be called before ComboBox#fireKey() var relay = Ext.KeyNav.prototype.doRelay.apply(this, arguments); if (!Ext.isIE && Ext.EventManager.useKeydown){ // call Combo#fireKey() for browsers which use keydown event (except IE) this.scope.fireKey(e); } return relay; } return true; }, forceKeyDown: true, defaultEventAction: 'stopEvent' }); if (!this.enableKeyEvents){ this.mon(this.el, 'keyup', this.onKeyUp, this); } }, // private onDestroy: function() { this.bindStore(null); Ext.destroy( this.resizer, this.cbgroup, this.list ); Ext.destroyMembers(this, 'hiddenField'); Ext.ux.form.CheckboxCombo.superclass.onDestroy.call(this); }, // private fireKey: function(e){ if (!this.isExpanded()) { Ext.ux.form.CheckboxCombo.superclass.fireKey.call(this, e); } }, // private onResize: function(w, h){ Ext.ux.form.CheckboxCombo.superclass.onResize.apply(this, arguments); if (this.isVisible() && this.list){ this.doResize(w); } else { this.bufferSize = w; } }, doResize: function(w){ if (!Ext.isDefined(this.listWidth)){ var lw = Math.max(w, this.minListWidth); this.list.setWidth(lw); this.innerList.setWidth(lw - this.list.getFrameWidth('lr')); } }, // private onEnable: function() { Ext.ux.form.CheckboxCombo.superclass.onEnable.apply(this, arguments); if (this.hiddenField){ this.hiddenField.disabled = false; } }, // private onDisable: function() { Ext.ux.form.CheckboxCombo.superclass.onDisable.apply(this, arguments); if (this.hiddenField){ this.hiddenField.disabled = true; } }, // private onBeforeLoad: function() { if (!this.hasFocus){ return; } // Setup a temp var so we can recheck on load this.checkboxValues = this.cbgroup.getValue(); this.removeCheckboxes(); }, // private onLoad: function() { if (!this.hasFocus){ return; } // If there were old checkbox values, make sure they are still checked if (this.checkboxValues) { Ext.each(this.checkboxValues, function(v) { if (this.valueField){ var r = this.findRecord(this.valueField, v.inputValue); if (r) { r.checked = true; } } }, this); } if (this.store.getCount() > 0 || this.listEmptyText){ this.addCheckboxes(); this.expand(); this.restrictHeight(); } else { this.collapse(); } }, // inherit docs getName: function() { var hf = this.hiddenField; return hf && hf.name ? hf.name : this.hiddenName || Ext.ux.form.CheckboxCombo.superclass.getName.call(this); }, // private assertValue: function() { var checkboxValues = this.cbgroup.getValue(); if (checkboxValues) { var vals = []; Ext.each(checkboxValues, function(cb) { vals.push(cb.inputValue); }); this.setValue(vals); } else { this.clearValue(); } }, /** * Sets the specified value into the field. If the value finds a match, the corresponding record text * will be displayed in the field. If the value does not match the data value of an existing item, * and the valueNotFoundText config option is defined, it will be displayed as the default field text. * Otherwise the field will be blank (although the value will still be set). * @param {String} value The value to match * @return {Ext.form.Field} this */ setValue: function(vals) { vals = vals || []; if (typeof vals === 'string') { vals = vals.split(','); } var text = []; // First set everything to false Ext.each(this.store.data.items, function(rec) { rec.checked = false; }, this); // Now only check the values that were explicitly set Ext.each(vals, function(v) { if (this.valueField){ var r = this.findRecord(this.valueField, v); if (r) { text.push(r.data[this.displayField]); r.checked = true; } } }, this); if (typeof vals === 'array' || typeof vals === 'object') { vals = vals.join(','); } // Make sure the cbgroup gets updated if (this.cbgroup) { this.cbgroup.setValue(Ext.pluck(this.store.data.items, 'checked')); } if (this.hiddenField) { this.hiddenField.value = Ext.value(vals, ''); } this.lastSelectionText = text.join(', '); Ext.ux.form.CheckboxCombo.superclass.setValue.call(this, text.join(', ')); this.value = vals; return this; }, /** * Returns the currently selected field value or empty string if no value is set. * @return {String} value The selected value */ getValue: function() { if (this.valueField){ return Ext.isDefined(this.value) ? this.value : ''; } else { return Ext.ux.form.CheckboxCombo.superclass.getValue.call(this); } }, /** * Clears any text/value currently set in the field */ clearValue: function() { if (this.hiddenField){ this.hiddenField.value = ''; } this.setRawValue(''); this.lastSelectionText = ''; this.applyEmptyText(); this.value = ''; }, // private findRecord: function(prop, value){ var record; if (this.store.getCount() > 0) { record = this.store.getAt(this.store.findExact(prop, value)); return (record ? record : false); } }, // private onListMove: function(e, t) { this.inKeyMode = false; }, // private onListOver: function(e, t) { var target = e.getTarget('div.x-form-item'); if (target) { target = Ext.get(target); target.radioClass('x-checkboxcombo-item-over'); } }, // private onListClick: function(e, t) { if (Ext.get(e.getTarget()).dom.tagName == 'INPUT' || Ext.get(e.getTarget()).dom.tagName == 'LABEL') { return; } var target = e.getTarget('div.x-form-item'); if (target) { target = Ext.get(target); var cb = target.child('input'); cb = Ext.getCmp(cb.id); cb.setValue(cb.getValue() ? false : true); // Fire an event for this check event } }, // private onListEnter: function(e, t) { var target = Ext.DomQuery.selectNode('.x-checkboxcombo-item-over', this.list.dom); if (target) { target = Ext.get(target); var cb = target.child('input'); cb = Ext.getCmp(cb.id); cb.setValue(cb.getValue() ? false : true); } }, // private restrictHeight: function() { this.innerList.dom.style.height = ''; var inner = this.innerList.dom, pad = this.list.getFrameWidth('tb') + this.assetHeight, h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight), ha = this.getPosition()[1]-Ext.getBody().getScroll().top, hb = Ext.lib.Dom.getViewHeight()-ha-this.getSize().height, space = Math.max(ha, hb, this.minHeight || 0)-this.list.shadowOffset-pad-5; h = Math.min(h, space, this.maxHeight); this.innerList.setHeight(h); this.list.beginUpdate(); this.list.setHeight(h+pad); this.list.alignTo.apply(this.list, [this.el].concat(this.listAlign)); this.list.endUpdate(); }, /** * Returns true if the dropdown list is expanded, else false. */ isExpanded: function() { return this.list && this.list.isVisible(); }, // private selectNext: function() { var ct = this.store.getCount(); if (ct > 0) { var el = Ext.DomQuery.selectNode('.x-checkboxcombo-item-over', this.list.dom); if (!el) { this.innerList.child('.x-form-item').radioClass('x-checkboxcombo-item-over'); } else { Ext.get(el).next().radioClass('x-checkboxcombo-item-over'); } } }, // private selectPrev: function() { var ct = this.store.getCount(); if (ct > 0) { var el = Ext.DomQuery.selectNode('.x-checkboxcombo-item-over', this.list.dom); if (!el) { this.innerList.child('.x-form-item').radioClass('x-checkboxcombo-item-over'); } else { Ext.get(el).prev().radioClass('x-checkboxcombo-item-over'); } } }, // private validateBlur: function() { return !this.list || !this.list.isVisible(); }, // private beforeBlur: function() { this.assertValue(); }, // private postBlur: function() { Ext.ux.form.CheckboxCombo.superclass.postBlur.call(this); this.collapse(); this.inKeyMode = false; }, /** * Hides the dropdown list if it is currently expanded. Fires the {@link #collapse} event on completion. */ collapse: function() { if (!this.isExpanded()){ return; } this.list.hide(); Ext.getDoc().un('mousewheel', this.collapseIf, this); Ext.getDoc().un('mousedown', this.collapseIf, this); this.beforeBlur(); this.fireEvent('collapse', this); }, // private collapseIf: function(e){ if (!e.within(this.wrap) && !e.within(this.list)){ this.collapse(); } }, /** * Expands the dropdown list if it is currently hidden. Fires the {@link #expand} event on completion. */ expand: function() { if (this.isExpanded() || !this.hasFocus){ return; } if (this.bufferSize){ this.doResize(this.bufferSize); delete this.bufferSize; } this.list.alignTo.apply(this.list, [this.el].concat(this.listAlign)); this.list.show(); if (Ext.isGecko2){ this.innerList.setOverflow('auto'); // necessary for FF 2.0/Mac } this.mon(Ext.getDoc(), { scope: this, mousewheel: this.collapseIf, mousedown: this.collapseIf }); this.fireEvent('expand', this); }, removeCheckboxes: function() { if (this.cbgroup) { this.cbgroup.destroy(); } }, addCheckboxes: function() { var checkboxes = []; // Add new checkboxes from store Ext.each(this.store.data.items, function(rec) { checkboxes.push({name: rec.id, boxLabel: this.tpl.apply(rec.data), inputValue: rec.data[this.valueField], checked: (rec.checked ? rec.checked : false)}); }, this); this.cbgroup = new Ext.form.CheckboxGroup({ renderTo: this.innerList, columns: 1, autoHeight: true, border: false, items: checkboxes }); this.cbgroup.mon(this.cbgroup, 'change', function(cbg, arr) { this.fireEvent('change', this, arr); }, this, {buffer: 50}); }, /** * @method onTriggerClick * @hide */ // private // Implements the default empty TriggerField.onTriggerClick function onTriggerClick: function() { if (this.readOnly || this.disabled){ return; } if (this.isExpanded()){ this.collapse(); this.el.focus(); } else { this.onFocus({}); if (this.triggerAction == 'all') { this.store.reload(); } this.expand(); this.el.focus(); } }, // A renderer for displaying the values in a grid gridRenderer: function(value) { if (typeof value == 'string') { value = value.split(','); } var text = []; Ext.each(value, function(v) { if (this.valueField){ var r = this.findRecord(this.valueField, v); if (r) { text.push(r.data[this.displayField]); } } }, this); return text.join(', '); } }); Ext.reg('checkboxcombo', Ext.ux.form.CheckboxCombo); Ext.ns('CTB.store').Holidays = new Ext.data.Store({ autoLoad: true, proxy: new Ext.data.HttpProxy({ url: '/Supplier/GetAllPublicHolidays', dataType: 'json', method: 'post' }), reader: new Ext.data.JsonReader({ fields: [ 'name', { name: 'states', convert: function(val, data) { var parts = data.name.split(' '), states = parts[parts.length - 1]; return parts.length > 1 ? states.replace(/^\(|\)$/g, '').split('|') : []; }}, { name: 'date', convert: function(val) { return new Date(val) }} ], root: 'data' }), /** * Helper to determine if a given date is public holiday of given state * State are expected to be in their abbreviation form * @param {Date} date * @param {string} stateShortName ex. "VIC", "QLD" */ isPublicHoliday: function(date, stateShortName) { var isPublicHoliday = false; this.data.each(function(publicHoliday) { if (publicHoliday.get('date').isSameDate(date) && publicHoliday.get('states').indexOf(stateShortName) !== -1) { isPublicHoliday = true; return false; } }); return isPublicHoliday; }, /** * Get all registered holidays for given state. * State is expected to be in their abbreviation form * @param {string} stateShortName ex. "VIC" */ getStatePublicHolidays: function(stateShortName) { return this.data.items .map(function(publicHoliday) { return publicHoliday.get('states').indexOf(stateShortName) !== -1 ? publicHoliday.get('date') : null; }) .filter(Ext.identityFn); }, /** * IMPORTANT: * Get public holidays based on USER's COMPANY STATE * Consider get public holidays based on supplier state if ever get a request from customers * Dependencies: CTB.init.companyInformation - MasterPage */ getCompanyPublicHolidays: function() { if (this._companyStatePublicHolidays) { return this._companyStatePublicHolidays; } var companyInformation = CTB.init.companyInformation, companyState = companyInformation.stateName, companyStatePublicHolidays = this.getStatePublicHolidays(companyState); this._companyStatePublicHolidays = companyStatePublicHolidays; return companyStatePublicHolidays; } }); var Global_Help_CurrentVideo_ID = null; var Global_Help_CurrentVideo_Description = null; var Global_Money_NumberOfDigits = 2; var Global_Money_RoundUpTo = 2; var Global_GSTPercentage = 10; var Global_IncludingLabourInFoodCost = false; var Global_DatabaseName = null; var Global_DatabaseSettings = null; // Is an object contained all the setting of the database (enableFoodCostLimit, foodCostLimit) var Global_TimeLine_Paging_Start = 0; var global_month_string = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; Ext.chart.Chart.CHART_URL = '../Scripts/extjs/ux/charts/charts.swf'; // This function will get the GST percentage of the system function GetGSTPercentage() { Ext.Ajax.request({ method: "POST", url: '/Setting/GetSettings', success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.IsSuccess) { showSuccessNotification(jsonData.Info, NOTIFICATION.ICON_INFORMATION); Global_GSTPercentage = jsonData.AdditionalData.GSTPercentage; Global_IncludingLabourInFoodCost = jsonData.AdditionalData.includingLabourInFoodCost; Global_DatabaseSettings = jsonData.AdditionalData; } else { showErrorMessageWithEmailNotify(jsonData.Info); } }, failure: function (result, request) { } }); } function GetActiveDatabaseName() { Ext.Ajax.request({ method: "POST", url: '/Database/GetActiveDatabaseName', success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { Global_DatabaseName = jsonData.data; } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { } }); } function GetActiveUserData() { //if (Ext.get('divUserFullName') != null) { Ext.Ajax.request({ method: "POST", url: '/User/GetActiveUserData', success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { Global_UserFullname = jsonData.data.firstname + ' ' + jsonData.data.lastname; // Ext.get('divUserFullName').update(jsonData.data.firstname + ' ' + jsonData.data.lastname); // if (Ext.get('spanUserFullName') != null) Ext.get('spanUserFullName').update('Hi, ' + Global_UserFullname + '!'); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { } }); //} } function setUpWarningWhenClosePage() { function closeEditorWarning() { return 'Have you made any changes that haven\'t been saved ?'; } window.onbeforeunload = closeEditorWarning; } function disableWarningWhenClosePage() { window.onbeforeunload = null; } function ShowPolicyAgreement() { var getPolicyURL = 'GetCookingTheBooksPolicy'; var agreeWithPolicyURL = 'AgreeWithCookingTheBooksPolicy'; var isHidden = true; //var containerHeight = 630; if (typeof GLOBAL_APPLICATION_NAME != 'undefined' && GLOBAL_APPLICATION_NAME != null && GLOBAL_APPLICATION_NAME == 'FCWeb') { getPolicyURL = "GetFoodConsortiumPolicy"; agreeWithPolicyURL = "AgreeWithFoodConsortiumPolicyAndPaymentInformation"; isHidden = false; //containerHeight = 550; } Ext.Ajax.request({ method: "POST", url: '/Setting/' + getPolicyURL, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { var dlg = new Ext.Window({ width: 600, height: 775, autoScroll: true, closable: false, modal: true, title: 'CTB AND CO. Agreement', bodyStyle: 'padding: 10px', items: [ { xtype: 'container', width: 'auto', height: 'auto',//containerHeight, autoScroll: true, items: [ { xtype: 'label', html: decodeURI(jsonData.message.Info) } ] }, { xtype: 'label', html: 'Payment Information', hidden: isHidden }, { xtype: 'textarea', width: 'auto', height: 50, id: 'txtPaymentInformation', hidden: isHidden } ], buttons: [ { xtype: 'checkbox', boxLabel: 'I have read and agree to this policy', listeners: { render: function(p_This) { var boxLabel = Ext.DomQuery.selectNode('LABEL', this.getEl().dom.parentNode); boxLabel.style.top = '-2px'; }, afterrender: function (p_This) { dlg.chk_Agree = p_This; }, } }, { xtype: 'button', scale: 'large', iconCls: 'icon-ok-large', text: 'I Accept', handler: function () { if (!dlg.chk_Agree.checked) { showWarningMessage('You have to agree with our policy in order to continue using Cooking the Books.'); } else { Ext.Ajax.request({ method: "POST", url: '/Setting/' + agreeWithPolicyURL, params: { paymentInfo: Ext.getCmp('txtPaymentInformation').getValue() }, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); } dlg.hide(); } }); } } } ] }); dlg.show(); } else { // showErrorMessageWithEmailNotify(jsonData.Info); } }, failure: function (result, request) { } }); } setTimeout(function () { ShowPolicyAgreement(); }, 1000); // This is to fix the DayLight saving problem with Safari function ConvertTicksToDate(pTicks) { var theDate = new Date((pTicks - 621355968000000000) / 10000); return theDate; } Ext.util.Format.percentage = function (val) { return addFullDigitToNumber(roundNumber(val, 2), 2) + '%'; }; Ext.util.Format.twoDecimalPoint = function (val) { return addFullDigitToNumber(roundNumber(val, 2), 2); }; Ext.util.Format.foodWeight = function (val) { return addFullDigitToNumber(roundNumber(val, 3), 3); }; Ext.util.Format.CTBMoneyFormat = function (val, isBold) { var html = '
{0}
{1}
'; if (isBold != null && isBold == true) html = '
{0}
{1}
'; if (val >= 0) return String.format(html, '$', Ext.util.Format.twoDecimalPoint(val)); else return String.format(html, '-$', Ext.util.Format.twoDecimalPoint(-val)); }; Ext.util.Format.CTBPercentageFormat = function (val, isBold) { var html = '
{0}
 {1}
'; if (isBold != null && isBold == true) html = '
{0}
 {1}
'; return String.format(html, Ext.util.Format.twoDecimalPoint(val), '%'); }; /** * Clone Function * @param {Object/Array} o Object or array to clone * @return {Object/Array} Deep clone of an object or an array * @author Ing. Jozef Sakáloš */ Ext.ux.clone = function (o) { if (!o || 'object' !== typeof o) { return o; } if ('function' === typeof o.clone) { return o.clone(); } var c = '[object Array]' === Object.prototype.toString.call(o) ? [] : {}; var p, v; for (p in o) { if (o.hasOwnProperty(p)) { v = o[p]; if (v && 'object' === typeof v) { c[p] = Ext.ux.clone(v); } else { c[p] = v; } } } return c; }; // eo function clone function GetNotifications() { Ext.Ajax.request({ method: "POST", url: '/Notification/GetNotifications', success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { if (jsonData.data != null) { for (var i = 0; i < jsonData.data.length; i++) { showPermanentNotification(jsonData.data[i].title, jsonData.data[i].message, jsonData.data[i].notificationId, function (notificationId) { // Callback after hide Ext.Ajax.request({ method: "POST", url: '/Notification/ReadNotification', params: { notificationId: notificationId }, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { // Do nothing } else { //showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { } }); }); // Show only 1 notification to make it less distractive break; } } } else { //showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { } }); } function GetBudgetTagDataForHomePage() { if (Ext.get('divBudgetTag_HomePage') != null) { Ext.Ajax.request({ method: "POST", url: '/Invoice/GetBoard_InvoiceFoodCost', params: { weekIndex: 0, startDayOfTheWeek: 0, //Start from Monday }, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { var wrapperData = { startDateOfTheWeek: jsonData.data.startDateOfTheWeekForHomePage, endDateOfTheWeek: jsonData.data.endDateOfTheWeekForHomePage, purchaseThisWeek: Ext.util.Format.usMoney(addFullDigitToNumber(roundNumber(jsonData.data.purchaseThisWeek, 2), 2)), kitchenRevenueThisWeek: Ext.util.Format.usMoney(addFullDigitToNumber(roundNumber(jsonData.data.kitchenRevenueThisWeek, 2), 2)), foodCostThisWeek: jsonData.data.kitchenRevenueThisWeek == 0 ? '0' : addFullDigitToNumber(roundNumber(jsonData.data.purchaseThisWeek / jsonData.data.kitchenRevenueThisWeek * 100, 2), 2) }; var pnl_BudgetTag = new Ext.Panel({ plain: true, frame: false, modal: false, bodyBorder: false, bodyCfg: { cls: 'x-panel-custombody-transparent' // Default class not applied if Custom element specified }, border: false, tpl: new Ext.XTemplate( '', '
', '', '
{startDateOfTheWeek} - {endDateOfTheWeek}
', '', '', '', '', '', '', '', '', '', '', '', '', '', String.format('', CTB.init.languageDictionary.GetValue("FOOD_COST")), '', '', '
Purchases{purchaseThisWeek}
Revenue{kitchenRevenueThisWeek}
{0} %redgreen;font-weight:bold;">{foodCostThisWeek} %
', '
', '
', '
' ), listeners: { afterrender: function (p_This) { // Update the big number on the budget tag p_This.update({ budgetTagDataRecord: wrapperData }); } } }); pnl_BudgetTag.render('divBudgetTag_HomePage'); } else { showErrorMessageWithEmailNotify(jsonData.Info); } }, failure: function (result, request) { } }); } }; function GetBudgetTagData() { jQuery.ajax({ type: 'post', url: '/Revenue/GetBudgetTagData', success: function (r) { if (r.message.IsSuccess) { var remainingSpend = parseFloat(r.data.remainingSpend, 10) || 0; var formattedRemainingSpend = Ext.util.Format.usMoney(remainingSpend); jQuery('#budgetRemain').text(formattedRemainingSpend).css('background-color', remainingSpend < 0 ? '#be1b21' : ''); jQuery('#budgetChangeWindowRowDateRange').html('' + r.data.startDate + ' -- ' + r.data.endDate + ''); jQuery('#budgetTotalAmount').text(Ext.util.Format.usMoney(r.data.budgetPurchase)); jQuery('#budgetTotalSpent').text(Ext.util.Format.usMoney(r.data.purchasesToDate)); jQuery('#budgetDetailRemaining').text(formattedRemainingSpend).css('color', remainingSpend < 0 ? '#be1b21' : ''); } } }); if (Ext.get('divBudgetTag') != null) { Ext.Ajax.request({ method: "POST", url: '/Revenue/GetBudgetTagData', success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { //showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); var pnl_BudgetTag = new Ext.Panel({ width: 130, height: 31, plain: true, frame: false, modal: false, bodyBorder: false, showBudgetTag: false, bodyCfg: { cls: 'x-panel-custombody-transparent' // Default class not applied if Custom element specified }, border: false, tpl: new Ext.XTemplate( '', '
{remainingSpendDisplay}
', '
' ), listeners: { afterrender: function (p_This) { // Update the big number on the budget tag jsonData.data.remainingSpendDisplay = Ext.util.Format.usMoney(jsonData.data.remainingSpend); p_This.update(jsonData.data); // Turn the tag into clickable object if (Ext.get('btnBudgetTag') != null) { Ext.get('btnBudgetTag').on('click', function () { if (p_This.dlg_BudgetTag == null) { p_This.dlg_BudgetTag = new Ext.CTBBudgetTagWindow({ callback_AfterUpdateBudgetPurchase: function (remainingSpend) { var remainingSpendDisplay = Ext.util.Format.usMoney(remainingSpend); Ext.get('btnBudgetTag').update(String.format('{0}', remainingSpendDisplay)); //p_This.update({remainingSpendDisplay : remainingSpendDisplay}); } }); } // Check if the dialog is opening, if yes, close it, if not open it if (!p_This.showBudgetTag) { if (!Ext.get('btnBudgetTag').hasClass('divBudgetTagArrowUp')) { Ext.get('btnBudgetTag').addClass('divBudgetTagArrowUp'); } p_This.showBudgetTag = true; //p_This.dlg_BudgetTag.hide(); p_This.dlg_BudgetTag.budgetTagDataRecord = jsonData.data; p_This.dlg_BudgetTag.show(); p_This.dlg_BudgetTag.anchorTo('btnBudgetTag', 'tl-tr', [-220, 35]); } else { if (Ext.get('btnBudgetTag').hasClass('divBudgetTagArrowUp')) { Ext.get('btnBudgetTag').removeClass('divBudgetTagArrowUp'); } p_This.showBudgetTag = false; p_This.dlg_BudgetTag.hide(); } }); } } } }); pnl_BudgetTag.render('divBudgetTag'); } else { showErrorMessageWithEmailNotify(jsonData.Info); } }, failure: function (result, request) { } }); } } function GetUserStatisticTimeLineData(start) { var timeline_data = []; jQuery.ajax({ async: false, url: "/UserStatistic/GetUserStatisticForTimeLine", dataType: "json", type: "POST", data: { start: start, limit: 50 }, success: function (data) { if (data.success) { jQuery.each(data.data, function (index, entry) { timeline_data.push({ type: 'blog_post', date: entry.date, dateFormat: 'DD MMMM YYYY', title: entry.title, content: entry.content, width: 280 }); }); } else { jQuery('#ctb-home-page-timeline-loadmore').addClass('timeline_no_data').text(data.message.Info); } } }); return timeline_data; } function DisplayUserStatisticTimeLineHomePage() { var timeline_data = GetUserStatisticTimeLineData(Global_TimeLine_Paging_Start); if (timeline_data.length > 0) { var timeline = new Timeline(jQuery('#ctb-home-page-timeline'), timeline_data); timeline.setOptions({ animation: true, lightbox: true, allowDelete: false, separator: 'month_year', columnMode: 'dual', order: 'desc' }); timeline.display(); // load more click jQuery('#ctb-home-page-timeline-loadmore').on('click', function (e) { var button = jQuery(this); if (button.hasClass('loading') || button.hasClass('loading_no_data')) { return; } button.addClass('loading').text('Loading...'); setTimeout(function () { button.removeClass('loading').text('Load More'); Global_TimeLine_Paging_Start = Global_TimeLine_Paging_Start + 50; var new_data = GetUserStatisticTimeLineData(Global_TimeLine_Paging_Start); if (new_data.length > 0) { timeline.appendData(new_data); } else { button.addClass('loading_no_data').text('No more data'); } }, 1000); }); } else { jQuery('#ctb-home-page-timeline-loadmore').addClass('timeline_no_data').text('No Time Line data to display!'); } } function DisplayHomePageCalendar() { if (Ext.get('ctb-home-page-calendar') != null) { var theThis = 'ctb-home-page-calendar'; var today = new Date(); Ext.Ajax.request({ method: 'POST', url: '/RecipeMenu/GetRecipeMenuForSpecialCalendar', params: { currentMonth: today.getMonth() + 1, currentYear: today.getFullYear() }, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { var pnl_Calendar = new Ext.Panel({ plain: true, frame: false, modal: false, bodyBorder: false, bodyCfg: { cls: 'x-panel-custombody-transparent' // Default class not applied if Custom element specified }, border: false, tpl: new Ext.XTemplate( '', '
', '
{month}
', '
', '', '', '', '', '', '', '', '', '', '', '', '
MONTUEWEDTHUFRISATSUN
#ffffff;#FFFFFF;">', '1px solid #FFB62A;1px solid #e6e6e6;">', '', '', '', '', '', '', '
color:#969494;">', '{day}', '', '{day}', '', '
', '', '', String.format('
', theThis), '', '', '', '
', '
', '
', '
', '
', '
' ), listeners: { afterrender: function (p_This) { p_This.update({ rows: jsonData.data.rows, month: global_month_string[jsonData.data.month] }); } } }); pnl_Calendar.render('ctb-home-page-calendar'); } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { } }); } } function GetListOfRecipesWaitingForApproval() { if (Ext.get('lbl_RecipeWaitingForApproval') != null) { Ext.Ajax.request({ method: 'POST', url: '/RecipeBook/GetRecipesWaitingForApproval', params: {}, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.totalCount >= 0) { Ext.get('lbl_RecipeWaitingForApproval').update(jsonData.totalCount == 0 ? '0' : jsonData.totalCount); jQuery('#lbl_RecipeWaitingForApproval').attr('title', String.format('You have {0} recipe(s) waiting for approval', jsonData.totalCount)); } else { //the user doesn't have authority to approve recipe jQuery('#qk_ApproveRecipe').parent().css({ 'display': 'none' }); } }, failure: function (result, request) { } }); } } //the user click a link from Pinboard to approve the recipe function ctb_recipe_approval_from_pinboard() { var cookie = new Ext.state.CookieProvider; cookie.set("page", "approveRecipe"); window.location = "/Pantry/Index"; } function ctb_recipe_menu_approval_from_pinboard(outletId) { var cookie = new Ext.state.CookieProvider; cookie.set("page", "approveSpecialMenu"); cookie.set("outletId", outletId); window.location = "/RecipeMenu/Index"; } function getListOfRecipeNotBeenModifiedForMonths() { //remove this when actual implementing /*if(true){ //if has recipes, call the RecipeBookAutoArchivePopupWindow // sample static data for the store var myData = [ [1,'3m Co', '12 Aug 2013'], [2,'Alcoa Inc', '12 Aug 2013'], [3,'Altria Group Inc', '12 Aug 2013'], [4,'American Express Company', '12 Aug 2013'], ]; var ctbRecipeBookArchivePopUpWindow = new Ext.CTBRecipeBookAutoArchivePopUpWindow({ recipeRecord: myData }); ctbRecipeBookArchivePopUpWindow.show(); }*/ Ext.Ajax.request({ method: 'POST', url: '/RecipeBook/GetRecipesHaveNotBeenModifiedBasedOnTimeSetting', //Add the Action here params: {}, //Add parameters here success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { if (jsonData.data != null && jsonData.data.length > 0) { var ctbRecipeBookArchivePopUpWindow = new Ext.CTBRecipeBookAutoArchivePopUpWindow({ recipeRecord: jsonData }); ctbRecipeBookArchivePopUpWindow.show(); } } else { showErrorMessageWithEmailNotify(jsonData.message.Info); } }, failure: function (result, request) { } }); } function hideDashboard() { Ext.Ajax.request({ method: 'POST', url: '/User/GetUserAuthorityById', //Add the Action here params: { authorityId: AU_DASHBOARD_SECTION }, //Add parameters here success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { if (!jsonData.data.isAuthoried) { jQuery('#master_Menu_Dashboard').parent().remove(); } } else { jQuery('#master_Menu_Dashboard').parent().remove(); } }, failure: function (result, request) { jQuery('#master_Menu_Dashboard').parent().remove(); } }); } // getRepeatingOrderNotificationsForTomorrow This function checking if there is any repeating order tomorrow need to be processed function getRepeatingOrderNotificationsForTomorrow(callback_AfterFinish) { var cookie = new Ext.state.CookieProvider; var today = new Date(); var repeatingOrderReminderTimeFormat = String.format(String.format('{0}-{1}-{2}', today.getDate(), today.getMonth(), today.getFullYear())); var isShowingReminder = true; // Check if the last time the reminder pop up is the same date, so we don't pop up again var lastTimeReminderRepeatingOrder = cookie.get('lastTimeReminderRepeatingOrder'); if (lastTimeReminderRepeatingOrder != null) { if (lastTimeReminderRepeatingOrder == repeatingOrderReminderTimeFormat) isShowingReminder = false; // Not showing the reminder for the same date } if (isShowingReminder) { Ext.Ajax.request({ method: "POST", url: '/StockOrder/GetRepeatingOrdersReminderForToday', params: { }, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { if (jsonData.data.length > 0) { var reminders = ""; for (var i = 0; i < jsonData.data.length; i++) { reminders += jsonData.data[i] + "
"; } showInfoMessage(reminders, function () { cookie.set("lastTimeReminderRepeatingOrder", repeatingOrderReminderTimeFormat); if (callback_AfterFinish != null) callback_AfterFinish(); } ); } else { if (callback_AfterFinish != null) callback_AfterFinish(); } } }, failure: function (result, request) { if (callback_AfterFinish != null) callback_AfterFinish(); } }); /*Ext.Ajax.request({ method: "POST", url: '/StockOrder/ViewWhiteboardOrderByDate', params : { whiteboardDate : getDateAfterToday(1) }, success : function(result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { var listOfRepeatingOrders = new Array(); var listOfOrders = jsonData.data.listOfOrders; for (var i = 0; i < listOfOrders.length; i++) { var orderRecord = listOfOrders[i]; if (orderRecord.isRepeatingOrder) { listOfRepeatingOrders.push(orderRecord); } } if (listOfRepeatingOrders.length > 0) { //showSuccessNotification(jsonData.message.Info, NOTIFICATION.ICON_INFORMATION); showInfoMessage(String.format("Reminder: You have {0} repeating orders need to be processed for tomorrow. Please see your whiteboard for more details.", listOfRepeatingOrders.length), function() { cookie.set("lastTimeReminderRepeatingOrder", repeatingOrderReminderTimeFormat); if (callback_AfterFinish != null) callback_AfterFinish(); } ); } else { if (callback_AfterFinish != null) callback_AfterFinish(); } } }, failure : function(result, request) { if (callback_AfterFinish != null) callback_AfterFinish(); } });*/ } else { if (callback_AfterFinish != null) callback_AfterFinish(); } } // getPriceUpdateScheduleReminderForToday This function checking if there is any supplier price update request need to be sent out today function getPriceUpdateScheduleReminderForToday(callback_AfterFinish) { var cookie = new Ext.state.CookieProvider; var today = new Date(); var repeatingOrderReminderTimeFormat = String.format(String.format('{0}-{1}-{2}', today.getDate(), today.getMonth(), today.getFullYear())); var isShowingReminder = true; // Check if the last time the reminder pop up is the same date, so we don't pop up again var lastTimeReminderRepeatingOrder = cookie.get('lastTimeReminderPriceUpdate'); if (lastTimeReminderRepeatingOrder != null) { if (lastTimeReminderRepeatingOrder == repeatingOrderReminderTimeFormat) isShowingReminder = false; // Not showing the reminder for the same date } if (isShowingReminder) { Ext.Ajax.request({ method: "POST", url: '/PriceUpdate/GetPriceUpdateScheduleReminderForToday', params: { }, success: function (result, request) { var jsonData = Ext.util.JSON.decode(result.responseText); if (jsonData.message.IsSuccess) { if (jsonData.data.length > 0) { var reminders = ""; for (var i = 0; i < jsonData.data.length; i++) { reminders += String.format('Reminder: Send price update request for supplier "{1}" today
', jsonData.data[i].quoteName, jsonData.data[i].supplierName) } showInfoMessage(reminders, function () { cookie.set("lastTimeReminderPriceUpdate", repeatingOrderReminderTimeFormat); if (callback_AfterFinish != null) callback_AfterFinish(); } ); } else { if (callback_AfterFinish != null) callback_AfterFinish(); } } }, failure: function (result, request) { if (callback_AfterFinish != null) callback_AfterFinish(); } }); } else { if (callback_AfterFinish != null) callback_AfterFinish(); } } // showPriceUpdateForSupplier this function show the tendering editor directly to be used for request price update (of a particular supplier based on quote name) var dlg_Global_TenderingEditor = null; function showPriceUpdateForSupplier(quoteName) { if (dlg_Global_TenderingEditor == null) { dlg_Global_TenderingEditor = new Ext.CTBTenderingEditorWindow({ title: 'Price update editor', isForSupplierPriceUpdate: true, //quoteName: quoteName, callback_AfterSave: function () { } }); } dlg_Global_TenderingEditor.quoteName = quoteName; dlg_Global_TenderingEditor.show(); } Ext.onReady(function () { Ext.QuickTips.init(); try { //GetServerUpdateAnnouncement(); GetMessageFromCTB(); //GetRandomAdvertisement(); GetGSTPercentage(); GetActiveDatabaseName(); GetActiveUserData(); if (jQuery('#budgetRemain').length == 1) { new BudgetManager(document.querySelector('#divBudgetTagCtb')); } else { new BudgetManager(document.querySelector('#divBudgetTagCtb')); } new UserProfile(); new StickerManager(document.querySelector('#sticker')); GetBudgetTagDataForHomePage(); GetListOfRecipesWaitingForApproval(); setTimeout(function () { GetNotifications(); }, 10000); // Delay get notifications until everything is displayed // hideDashboard(); //Added by Andy C on 8/6/2016 // setTimeout(function(){ // UpdateStockOrderStatus(); // }, 10000); //Added by Mike on 03/08/2016 setTimeout(function () { getRepeatingOrderNotificationsForTomorrow(); }, 5000); setTimeout(function () { getPriceUpdateScheduleReminderForToday(); }, 5000); /* if(document.getElementById('choose-theme') !== null ) { new Ext.CTBTheme(); } */ } catch (e) { } }); // End Ext.Ready var Global_MediaManagerDialog = new Ext.CTBMediaManager({ id: 'dlg_MediaManager' }); if (Ext.ux && Ext.ux.Lightbox) { // Lightbox Ext.ux.Lightbox.register('a[rel^=lightbox]'); }