
/* - anzi18n.js - */
Ext.namespace("Anz");Anz.i18n={};function _(a){if(Anz.i18n[a]){a=Anz.i18n[a]}return a}var Utf8={encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}return b}};
/* - Portal.js - */
/*
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ux.Portal=Ext.extend(Ext.Panel,{layout:"portalcolumn",layoutConfig:{margin:5,split:true},autoScroll:true,cls:"x-portal",defaultType:"portalcolumn",initComponent:function(){Ext.ux.Portal.superclass.initComponent.call(this);this.addEvents({validatedrop:true,beforedragover:true,dragover:true,beforedrop:true,drop:true,columnresize:true})},initEvents:function(){Ext.ux.Portal.superclass.initEvents.call(this);this.dd=new Ext.ux.Portal.DropZone(this,this.dropConfig)},beforeDestroy:function(){if(this.dd){this.dd.unreg()}Ext.ux.Portal.superclass.beforeDestroy.call(this)}});Ext.reg("portal",Ext.ux.Portal);Ext.ux.Portal.DropZone=function(a,b){this.portal=a;Ext.dd.ScrollManager.register(a.body);Ext.ux.Portal.DropZone.superclass.constructor.call(this,a.bwrap.dom,b);a.body.ddScrollConfig=this.ddScrollConfig};Ext.extend(Ext.ux.Portal.DropZone,Ext.dd.DropTarget,{ddScrollConfig:{vthresh:50,hthresh:-1,animate:true,increment:200},createEvent:function(a,f,d,b,h,g){return{portal:this.portal,panel:d.panel,columnIndex:b,column:h,position:g,data:d,source:a,rawEvent:f,status:this.dropAllowed}},notifyOver:function(v,t,w){var f=t.getXY();var a=this.portal;var n=v.proxy;if(!this.grid){this.grid=this.getGrid()}var b=a.body.dom.clientWidth;if(!this.lastCW){this.lastCW=b}else{if(this.lastCW!=b){this.lastCW=b;a.doLayout();this.grid=this.getGrid()}}var d=0;var l=this.grid.columnX;var m=false;for(var s=l.length;d<s;d++){if(f[0]<(l[d].x+l[d].w)){m=true;break}}if(!m){d--}var q;var k=false;var i=0;var u=a.items.itemAt(d);var o=u.items.items;var j=false;for(var s=o.length;i<s;i++){q=o[i];var r=q.el.getHeight();if(r===0){j=true}else{if((q.el.getY()+(r/2))>f[1]){k=true;break}}}i=(k&&q?i:u.items.getCount())+(j?-1:0);var g=this.createEvent(v,t,w,d,u,i);if(a.fireEvent("validatedrop",g)!==false&&a.fireEvent("beforedragover",g)!==false){n.getProxy().setWidth("auto");if(q){n.moveProxy(q.el.dom.parentNode,k?q.el.dom:null)}else{n.moveProxy(u.el.dom,null)}this.lastPos={c:u,col:d,p:j||(k&&q)?i:false};this.scrollPos=a.body.getScroll();a.fireEvent("dragover",g);return g.status}else{return g.status}},notifyOut:function(){delete this.grid},notifyDrop:function(k,g,f){delete this.grid;if(!this.lastPos){return}var i=this.lastPos.c;var b=this.lastPos.col;var j=this.lastPos.p;var a=this.createEvent(k,g,f,b,i,j!==false?j:i.items.getCount());if(this.portal.fireEvent("validatedrop",a)!==false&&this.portal.fireEvent("beforedrop",a)!==false){k.proxy.getProxy().remove();k.panel.el.dom.parentNode.removeChild(k.panel.el.dom);if(j!==false){if(i==k.panel.ownerCt&&(i.items.items.indexOf(k.panel)<=j)){j++}i.insert(j,k.panel)}else{i.add(k.panel)}i.doLayout();this.portal.fireEvent("drop",a);var l=this.scrollPos.top;if(l){var h=this.portal.body.dom;setTimeout(function(){h.scrollTop=l},10)}}delete this.lastPos},getGrid:function(){var a=this.portal.bwrap.getBox();a.columnX=[];this.portal.items.each(function(b){a.columnX.push({x:b.el.getX(),w:b.el.getWidth()})});return a},unreg:function(){Ext.ux.Portal.DropZone.superclass.unreg.call(this)}});
/* - PortalColumn.js - */
/*
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ux.PortalColumn=Ext.extend(Ext.Panel,{layout:"anchor",frame:false,border:false,closable:true,defaultType:"portlet",cls:"x-column-portal"});Ext.reg("portalcolumn",Ext.ux.PortalColumn);
/* - columnlayout-ux.js - */
Ext.layout.PortalColumnLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,extraCls:"x-column",scrollOffset:0,margin:0,split:false,fitHeight:false,isValidParent:function(b,a){return b.getEl().dom.parentNode==this.innerCt.dom},renderAll:function(a,b){if(this.split&&!this.splitBars){this.splitBars=[];this.margin=5}Ext.layout.PortalColumnLayout.superclass.renderAll.apply(this,arguments)},onLayout:function(g,m){var j=g.items.items,k=j.length,n,o,d;if(!this.innerCt){m.addClass("x-column-layout-ct");this.innerCt=m.createChild({cls:"x-column-inner",style:{position:"relative"}});this.innerCt.createChild({cls:"x-clear"})}this.renderAll(g,this.innerCt);var r=Ext.isIE&&m.dom!=Ext.getBody().dom?m.getStyleSize():m.getViewSize();if(r.width<1&&r.height<1){return}var p=r.width-m.getPadding("lr")-this.scrollOffset,e=r.height-m.getPadding("tb");var q=this.availableWidth=p;if(this.split){this.minWidth=Math.min(q/k,100);this.maxWidth=q-((this.minWidth+5)*(k?(k-1):1))}this.innerCt.setSize(p,this.fitHeight?e:undefined);if(this.fitHeight){this.innerCt.setSize(p,e)}else{this.innerCt.setWidth(p)}var f;for(d=0;d<k;d++){n=j[d];o=n.getEl();if(this.margin&&(d<(k-1))){o.setStyle("margin-right",this.margin+"px")}if(n.columnWidth){f=d}else{q-=(n.getSize().width+o.getMargins("lr"))}}var a=(q=q<0?0:q);var l=0;for(d=0;d<k;d++){n=j[d];o=n.getEl();if(n.columnWidth){var p=(d==f)?a:Math.floor(n.columnWidth*q);if(this.fitHeight){n.setSize(p-o.getMargins("lr"),e)}else{n.setWidth(p-o.getMargins("lr"))}a-=p}else{if(this.fitHeight){n.setHeight(e)}}if(this.split){var b=o.getWidth();if(d<(k-1)){l+=b;if(this.splitBars[d]){this.splitBars[d].el.setHeight(e)}else{this.splitBars[d]=new Ext.SplitBar(this.innerCt.createChild({cls:"x-layout-split x-layout-split-west",style:{top:"0px",left:l+"px",height:e+"px"}}),o);this.splitBars[d].index=d;this.splitBars[d].leftComponent=n;this.splitBars[d].addListener("resize",this.onColumnResize,this);this.splitBars[d].minSize=this.minWidth}l+=this.splitBars[d].el.getWidth()}delete n.columnWidth}}if(this.split){this.setMaxWidths()}},onColumnResize:function(j,g){if(j.dragSpecs.startSize){j.leftComponent.setWidth(g);var d=this.container.items.items;var f=g-j.dragSpecs.startSize;for(var e=j.index+1,a=d.length;f&&e<a;e++){var h=d[e];var b=h.el.getWidth();var g=b-f;if(g<this.minWidth){h.setWidth(this.minWidth)}else{if(g>this.maxWidth){f-=(g-this.maxWidth);h.setWidth(this.maxWidth)}else{h.setWidth(h.el.getWidth()-f);break}}}this.setMaxWidths();this.container.fireEvent("columnresize",this.container)}},setMaxWidths:function(){var a=this.container.items.items;var d=a[a.length-1].el.dom.offsetWidth-100;for(var b=a.length-2;b>-1;b--){var j=this.splitBars[b],f=j.el,h=a[b],e=h.el;var g=e.dom.offsetWidth;f.setStyle("left",(e.getX()-Ext.fly(e.dom.parentNode).getX()+g)+"px");j.maxSize=g+d;d=g-100}},onResize:function(){if(this.split){var b=this.container.items.items;if(b[0].rendered){var a=0;for(var d=0;d<b.length;d++){var e=b[d];a+=e.el.getWidth()+e.el.getMargins("lr")}for(var d=0;d<b.length;d++){var e=b[d];e.columnWidth=(e.el.getWidth()+e.el.getMargins("lr"))/a}}}Ext.layout.PortalColumnLayout.superclass.onResize.apply(this,arguments)}});Ext.Container.LAYOUTS.portalcolumn=Ext.layout.PortalColumnLayout;
/* - carousel.js - */
/*
 * Ext Core Library 3.0
 * http://extjs.com/
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * 
 * MIT Licensed - http://extjs.com/license/mit.txt
 */
Ext.ns("Ext.ux");Ext.ux.Carousel=Ext.extend(Ext.util.Observable,{interval:3,transitionDuration:1,transitionType:"carousel",transitionEasing:"easeOut",itemSelector:"img",activeSlide:0,autoPlay:false,showPlayButton:false,pauseOnNavigate:false,wrap:false,freezeOnHover:false,navigationOnHover:false,hideNavigation:false,width:null,height:null,constructor:function(b,a){a=a||{};Ext.apply(this,a);Ext.ux.Carousel.superclass.constructor.call(this,a);this.addEvents("beforeprev","prev","beforenext","next","change","play","pause","freeze","unfreeze");this.el=Ext.get(b);this.slides=this.els=[];if(this.autoPlay||this.showPlayButton){this.wrap=true}if(this.autoPlay&&typeof a.showPlayButton==="undefined"){this.showPlayButton=true}this.initMarkup();this.initEvents();if(this.carouselSize>0){this.refresh()}},initMarkup:function(){var b=Ext.DomHelper;this.carouselSize=0;var a=this.el.select(this.itemSelector);this.els.container=b.append(this.el,{cls:"ux-carousel-container"},true);this.els.slidesWrap=b.append(this.els.container,{cls:"ux-carousel-slides-wrap"},true);this.els.navigation=b.append(this.els.container,{cls:"ux-carousel-nav"},true).hide();this.els.caption=b.append(this.els.navigation,{tag:"h2",cls:"ux-carousel-caption"},true);this.els.navNext=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-next"},true);if(this.showPlayButton){this.els.navPlay=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-play"},true)}this.els.navPrev=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-prev"},true);this.slideWidth=this.width||this.el.getWidth(true);this.slideHeight=this.height||this.el.getHeight(true);this.els.container.setStyle({width:this.slideWidth+"px",height:this.slideHeight+"px"});this.els.caption.setWidth((this.slideWidth-(this.els.navNext.getWidth()*2)-(this.showPlayButton?this.els.navPlay.getWidth():0)-20)+"px");a.appendTo(this.els.slidesWrap).each(function(c){c=c.wrap({cls:"ux-carousel-slide"});this.slides.push(c);c.setWidth(this.slideWidth+"px").setHeight(this.slideHeight+"px")},this);this.carouselSize=this.slides.length;if(this.navigationOnHover){this.els.navigation.setStyle("top",(-1*this.els.navigation.getHeight())+"px")}this.el.clip()},initEvents:function(){this.els.navPrev.on("click",function(a){a.preventDefault();var b=a.getTarget();b.blur();if(Ext.fly(b).hasClass("ux-carousel-nav-disabled")){return}this.prev()},this);this.els.navNext.on("click",function(a){a.preventDefault();var b=a.getTarget();b.blur();if(Ext.fly(b).hasClass("ux-carousel-nav-disabled")){return}this.next()},this);if(this.showPlayButton){this.els.navPlay.on("click",function(a){a.preventDefault();a.getTarget().blur();if(this.playing){this.pause()}else{this.play()}},this)}if(this.freezeOnHover){this.els.container.on("mouseenter",function(){if(this.playing){this.fireEvent("freeze",this.slides[this.activeSlide]);Ext.TaskMgr.stop(this.playTask)}},this);this.els.container.on("mouseleave",function(){if(this.playing){this.fireEvent("unfreeze",this.slides[this.activeSlide]);Ext.TaskMgr.start(this.playTask)}},this,{buffer:(this.interval/2)*1000})}if(this.navigationOnHover){this.els.container.on("mouseenter",function(){if(!this.navigationShown){this.navigationShown=true;this.els.navigation.stopFx(false).shift({y:this.els.container.getY(),duration:this.transitionDuration})}},this);this.els.container.on("mouseleave",function(){if(this.navigationShown){this.navigationShown=false;this.els.navigation.stopFx(false).shift({y:this.els.navigation.getHeight()-this.els.container.getY(),duration:this.transitionDuration})}},this)}if(this.interval&&this.autoPlay){this.play()}},prev:function(){if(this.fireEvent("beforeprev")===false){return}if(this.pauseOnNavigate){this.pause()}this.setSlide(this.activeSlide-1);this.fireEvent("prev",this.activeSlide);return this},next:function(){if(this.fireEvent("beforenext")===false){return}if(this.pauseOnNavigate){this.pause()}this.setSlide(this.activeSlide+1);this.fireEvent("next",this.activeSlide);return this},play:function(){if(!this.playing){this.playTask=this.playTask||{run:function(){this.playing=true;this.setSlide(this.activeSlide+1)},interval:this.interval*1000,scope:this};this.playTaskBuffer=this.playTaskBuffer||new Ext.util.DelayedTask(function(){Ext.TaskMgr.start(this.playTask)},this);this.playTaskBuffer.delay(this.interval*1000);this.playing=true;if(this.showPlayButton){this.els.navPlay.addClass("ux-carousel-playing")}this.fireEvent("play")}return this},pause:function(){if(this.playing){Ext.TaskMgr.stop(this.playTask);this.playTaskBuffer.cancel();this.playing=false;if(this.showPlayButton){this.els.navPlay.removeClass("ux-carousel-playing")}this.fireEvent("pause")}return this},clear:function(){this.els.slidesWrap.update("");this.slides=[];this.carouselSize=0;this.pause();return this},add:function(b,a){var c=Ext.fly(b).appendTo(this.els.slidesWrap).wrap({cls:"ux-carousel-slide"});c.setWidth(this.slideWidth+"px").setHeight(this.slideHeight+"px");this.slides.push(c);if(a){this.refresh()}return this},refresh:function(){this.carouselSize=this.slides.length;this.els.slidesWrap.setWidth((this.slideWidth*this.carouselSize)+"px");if(this.carouselSize>0){if(!this.hideNavigation){this.els.navigation.show()}this.activeSlide=0;this.setSlide(0,true)}return this},setSlide:function(b,a){if(!this.wrap&&!this.slides[b]){return}else{if(this.wrap){if(b<0){b=this.carouselSize-1}else{if(b>this.carouselSize-1){b=0}}}}if(!this.slides[b]){return}this.els.caption.update(this.slides[b].child(":first-child",true).title||"");var d=b*this.slideWidth;if(!a){switch(this.transitionType){case"fade":this.slides[b].setOpacity(0);this.slides[this.activeSlide].stopFx(false).fadeOut({duration:this.transitionDuration/2,callback:function(){this.els.slidesWrap.setStyle("left",(-1*d)+"px");this.slides[this.activeSlide].setOpacity(1);this.slides[b].fadeIn({duration:this.transitionDuration/2})},scope:this});break;default:var c=(-1*d)+this.els.container.getX();this.els.slidesWrap.stopFx(false);this.els.slidesWrap.shift({duration:this.transitionDuration,x:c,easing:this.transitionEasing});break}}else{this.els.slidesWrap.setStyle("left","0")}this.activeSlide=b;this.updateNav();this.fireEvent("change",this.slides[b],b)},updateNav:function(){this.els.navPrev.removeClass("ux-carousel-nav-disabled");this.els.navNext.removeClass("ux-carousel-nav-disabled");if(!this.wrap){if(this.activeSlide===0){this.els.navPrev.addClass("ux-carousel-nav-disabled")}if(this.activeSlide===this.carouselSize-1){this.els.navNext.addClass("ux-carousel-nav-disabled")}}}});
/* - XCheckbox.js - */
Ext.ns("Ext.ux.form");Ext.ux.form.XCheckbox=Ext.extend(Ext.form.Checkbox,{offCls:"xcheckbox-off",onCls:"xcheckbox-on",disabledClass:"xcheckbox-disabled",submitOffValue:"false",submitOnValue:"true",checked:false,hiddenName:null,onRender:function(c){Ext.ux.form.XCheckbox.superclass.onRender.apply(this,arguments);var a=this.el.dom.tabIndex;var d=this.el.dom.id;this.el.remove();this.el=c.createChild({tag:"input",type:"hidden",name:this.hiddenName||this.name,id:d});if(!this.checked){this.checked=this.value===this.submitOnValue}this.updateHidden();this.wrap.replaceClass("x-form-check-wrap","xcheckbox-wrap");this.cbEl=this.wrap.createChild({tag:"a",cls:this.checked?this.onCls:this.offCls});var b=this.wrap.down("label");if(b){this.wrap.appendChild(b)}if(this.tooltip){this.cbEl.set({qtip:this.tooltip})}this.wrap.on({click:{scope:this,fn:this.onClick,delegate:"a"}});this.wrap.on({keyup:{scope:this,fn:this.onClick,delegate:"a"}});this.cbEl.dom.tabIndex=a},onClick:function(a){if(this.disabled||this.readOnly){return}if(!a.isNavKeyPress()){this.setValue(!this.checked)}},onDisable:function(){this.cbEl.addClass(this.disabledClass);this.el.dom.disabled=true},onEnable:function(){this.cbEl.removeClass(this.disabledClass);this.el.dom.disabled=false},setValue:function(a){if("string"==typeof a){this.checked=a===this.submitOnValue}else{this.checked=!(!a)}if(this.rendered&&this.cbEl){this.updateHidden();this.cbEl.removeClass([this.offCls,this.onCls]);this.cbEl.addClass(this.checked?this.onCls:this.offCls)}this.fireEvent("check",this,this.checked)},updateHidden:function(){this.el.dom.value=this.checked?this.submitOnValue:this.submitOffValue},getValue:function(){return this.checked}});Ext.reg("xcheckbox",Ext.ux.form.XCheckbox);
/* - anz_widget.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.base=Ext.extend(Ext.Panel,{draggable:true,loaded:false,maxRetryTimes:6,options:null,retried:0,cls:"x-widget",frame:false,style:"margin: 5px 0 0",initComponent:function(){Anz.widget.base.superclass.initComponent.call(this);var a=this.initialConfig;this.options=a.options;this.portalUrl=a.portalUrl;this.contextUrl=a.contextUrl;this.on({render:{scope:this,fn:function(b){if(!this.collapsed){this.display()}}},expand:{scope:this,fn:function(b){if(!this.loaded){this.display()}}}})},getCommonPreferences:function(){return[{xtype:"textfield",name:"title",fieldLabel:_("Title"),value:"Widget title"},{xtype:"xcheckbox",name:"showTitle",fieldLabel:_("Show title?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"showTitle:int"}]},getCustomisePreferences:function(){return[]},getPreferences:function(){return this.getCommonPreferences().concat(this.getCustomisePreferences())},updateOptions:function(a){},display:function(){},retryDisplay:function(){if(!this.loaded){if(this.retried<this.maxRetryTimes){this.retried+=1;this.display.defer(Math.pow(2,this.retried)*1000,this)}else{this.body.update(_("Sorry, we can not get data successfully now, you should refresh the whole page later to try again."))}}},getValue:function(b){var a=this.options[b];if(a===undefined){a=this.getDefaultValues()[b]}return a},getDefaultValues:function(){return{}}});
/* - widget_static_text.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.staticText=Ext.extend(Anz.widget.base,{bodyStyle:"padding: 5px",iconCls:"widget_postit_icon",getCustomisePreferences:function(){return[{xtype:"htmleditor",name:"text",fieldLabel:_("body"),value:_("Type text here")}]},updateOptions:function(a){this.options=a;this.setTitle(Utf8.decode(a.title));this.display()},display:function(){var a=this.getValue("text");if(!a){a=_("Type text here")}this.body.update(Utf8.decode(a))},convertTextToHTML:function(a){a=a.replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>").replace(/  /g,"&nbsp; ");return a},convertHTMLToText:function(a){a=a.replace(/\&amp;/g,"&").replace(/\&lt;/g,"<").replace(/&gt;/g,">").replace(/<br>/g,"\n").replace(/\&nbsp;/g," ");return a}});Ext.reg("widget_static_text",Anz.widget.staticText);
/* - widget_rss.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.rss=Ext.extend(Anz.widget.base,{bodyStyle:"padding: 5px",iconCls:"widget_rss_icon",entries:[],page:0,pageCount:1,count:null,getCustomisePreferences:function(){return[{xtype:"textfield",name:"feed",fieldLabel:_("Feed"),value:""},{xtype:"xcheckbox",name:"paging",fieldLabel:_("Paging?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"paging:int"},{xtype:"numberfield",name:"count",fieldLabel:_("Count"),value:5,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Normal",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Normal",_("Normal")],["Magazine",_("Magazine")],["Slideshow",_("Slideshow")],["Headline",_("Headline")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{count:5,paging:1,view:"Normal"}},updateOptions:function(d){var b=this.options;this.options=d;this.count=parseInt(this.getValue("count"));this.setTitle(Utf8.decode(this.getValue("title")));if(!this.collapsed){var e=b.feed;var c=b.view;var a=b.paging;if(e!==this.getValue("feed")){this.display()}else{if(c!==this.getValue("view")||a!==this.getValue("paging")){if(this.loaded){this.buildContents()}else{this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');this.loaded=false;var b=this.getValue("feed");var a=this.getValue("count");Ext.Ajax.request({url:this.initialConfig.contextUrl+"/@@rssWidget/entries",method:"POST",params:{url:b,"count:int":a},timeout:5000,scope:this,success:function(c,e){var d=Ext.decode(c.responseText);if(d.success){this.entries=d.entries;this.count=parseInt(this.getValue("count"));this.pageCount=Math.ceil(d.entries.length/this.count);this.buildContents();this.loaded=true}else{if(d.msg){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(c,e){var d=c.responseText;if(d){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachPagingHandler:function(){var a=this.body.child("a[class=prePage]");if(a){a.on("click",this.prePage,this)}var b=this.body.child("a[class=nextPage]");if(b){b.on("click",this.nextPage,this)}},prePage:function(){this.page-=1;this.buildContents()},nextPage:function(){this.page+=1;this.buildContents()},buildContents:function(){var c="";var a=this.getValue("view");switch(a){case"Normal":c=this.buildNormalHtml();break;case"Magazine":c=this.buildMagazineHtml();break;case"Slideshow":c=this.buildSlideshowHtml();break;case"Headline":c=this.buildHeadlineHtml();break;default:c=this.buildNormalHtml()}var d=this.getValue("paging")&&(this.pageCount>1)&&(a!=="Slideshow");if(d){c+='<div class="paging-bottom">';if(this.page!==0){c+=String.format('<a class="prePage" href="javascript:;">{0}</a>',_("prev"))}if(this.page<this.pageCount-1){c+=String.format('<a class="nextPage" href="javascript:;">{0}</a>',_("next"))}c+="<div>"}this.body.update(c);if(a==="Slideshow"){var b=this.getId()+"_slideshow";new Ext.ux.Carousel(b,{itemSelector:"div.item",interval:10,autoPlay:true,transitionEasing:"easeIn"})}if(d){this.attachPagingHandler()}},buildNormalHtml:function(){var h=this.page*this.count;var c=this.entries.slice(h,h+this.count);var f='<ul class="feedList">';var b=new Ext.Template("<li>",'<a href="{link}" title="{desc}" target="_blank">','{title}<span class="feedItemDate"> - {date}</span>',"</a>","</li>");for(var e=0,a=c.length;e<a;++e){var g=c[e];var d=this.convertDate(g.updated);f+=b.applyTemplate({title:g.title,desc:g.summary,link:g.link,date:this.getTimeDiff(d)})}f+="</ul>";return f},buildMagazineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="magazineView">'];var f=new Ext.Template('<div class="left">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="article">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"<p>{desc}</p>","</div>","</div>");var c=e[0];var j=this.convertDate(c.updated);d.push(f.applyTemplate({title:c.title,desc:c.summary,img:this.portalUrl+"/default_news.png",link:c.link,date:this.getTimeDiff(j)}));d.push('<div class="right">');var h=new Ext.Template('<div class="item">','<div class="thumbnail">','<img height="50" width="50" src="{img}"/>',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"</div>",'<div class="description">',"<p>{desc}</p>","</div>","</div>");for(var b=1,g=e.length;b<g;++b){var k=e[b];var j=this.convertDate(k.updated);d.push(h.applyTemplate({title:k.title,desc:k.summary,img:this.portalUrl+"/default_news.png",link:k.link,date:this.getTimeDiff(j)}))}d.push("</div></div>");return d.join("")},buildSlideshowHtml:function(){var c=this.entries;var d=this.getId()+"_slideshow";var g=[String.format('<div class="slideshowView" id="{0}">',d)];var b=new Ext.Template('<div class="item">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="content">','<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>',"</div>",'<div class="description">','<small class="feedItemDate">{date}</small>',"<p>{desc}</p>","</div>","</div>","</div>");for(var f=0,a=c.length;f<a;++f){var h=c[f];var e=this.convertDate(h.updated);g.push(b.applyTemplate({img:this.portalUrl+"/default_news.png",title:h.title,desc:h.summary,link:h.link,date:this.getTimeDiff(e)}))}g.push("</div>");return g.join("")},buildHeadlineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="headlineView">'];var f=new Ext.Template('<div class="top">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"</div>","</div>",'<div class="middle odd">','<div class="description">{desc}</div>',"</div>");var c=e[0];var j=this.convertDate(c.updated);d.push(f.applyTemplate({img:this.portalUrl+"/default_news.png",title:c.title,desc:c.summary,link:c.link,date:this.getTimeDiff(j)}));d.push('<ul class="bottom">');var h=new Ext.Template('<li class="item {cls}">','<div class="thumbnail">','<img height="50" width="50" src="{img}">',"</div>",'<h3><a href="{link}" target="_blank">{title}<small class="feedItemDate">{date}</small></a></h3>','<p class="description">{desc}</p>',"</li>");for(var b=1,g=e.length;b<g;++b){var k=e[b];var j=this.convertDate(k.updated);d.push(h.applyTemplate({cls:b%2?"even":"odd",img:this.portalUrl+"/default_news.png",title:k.title,desc:k.summary,link:k.link,date:this.getTimeDiff(j)}))}d.push("</ul></div>");return d.join("")},convertDate:function(a){var b=null;if(a){b=a.split("-").join("/")}return b},getTimeDiff:function(e){if(!e){return""}var d=new Date(e);var h=new Date();var c=h.valueOf()-d.valueOf();var i=c/86400000;i=parseInt(i);c=c-(i*86400000);var f=c/3600000;f=parseInt(f);c=c-(f*3600000);var b=c/60000;b=parseInt(b);c=c-(b*60000);var g=c/1000;g=parseInt(g);var a="";if(i>0){a=i+_("days before")}else{if(f>0){a=f+_("hours before")}else{if(b>0){a=b+_("minutes before")}}}return a}});Ext.reg("widget_rss",Anz.widget.rss);
/* - widget_weather.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.weather=Ext.extend(Anz.widget.base,{iconCls:"widget_weather_icon",getCustomisePreferences:function(){return[{xtype:"widget.weather.woeidfield",name:"woeid",fieldLabel:_("City"),value:""},{xtype:"combo",name:"units",hiddenName:"units",fieldLabel:_("Units"),value:"c",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["c",_("Celsius")],["f",_("Fahrenheit")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Compact",_("Compact")],["Today",_("Today")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},updateOptions:function(c){var a=this.options;this.options=c;this.setTitle(Utf8.decode(c.title));if(!this.collapsed){var d=a.woeid;var e=a.units;var b=a.view;if(d!==c.woeid){this.display()}else{if(e!==c.units){this.display()}else{if(b!==c.view){this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');var a=this.getValue("feed");Ext.Ajax.request({url:this.contextUrl+"/@@weatherWidget/weather",method:"POST",params:{woeid:this.options.woeid,units:this.options.units},timeout:5000,scope:this,success:function(b,f){var d=Ext.decode(b.responseText);if(d.success){var g=d.info;var c=this.options.view;var e=this.buildContents(g,c);this.body.update(e);this.loaded=true}else{if(d.msg){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(b,d){var c=b.responseText;if(c){this.body.update(c.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},buildContents:function(a,b){var c=null;switch(b){case"Compact":c=this.buildCompactHtml(a);break;case"Today":c=this.buildTodayHtml(a);break;default:c=this.buildTodayHtml(a)}return c},buildTodayHtml:function(b){var a=new Ext.Template('<div class="yw-forecast">','<div class="yw-loc">','<a target="_blank" href="{link}">{location}</a>',"</div>",'<div class="yw-date">{time}</div>','<div class="yw-cond">{condition_text}</div>',"<dl>","<dt>{Feels_Like}:</dt><dd>{temp}&deg;{temp_unit}</dd>","<dt>{Barometer}:</dt><dd>{pressure} {pressure_unit}</dd>","<dt>{Humidity}:</dt><dd>{humidity} %</dd>","<dt>{Visibility}:</dt><dd>{visibility} {visibility_unit}</dd>","<dt>{Wind}:</dt><dd>{wind_direction} {wind_speed} {speed_unit}</dd>","<dt>{Sunrise}:</dt><dd>{sunrise}</dd>","<dt>{Sunset}:</dt><dd>{sunset}</dd>","</dl>",'<div class="forecast-icon" style="background: transparent url(images/weather/{code}d-s.png) no-repeat scroll 0% 0%;"></div>','<div class="forecast-temp">','<div class="yw-temp">{temp}&deg;</div>',"<p>{High}: {high_temp}&deg; {Low}: {low_temp}&deg;</p>","</div>","</div>");return a.applyTemplate({Feels_Like:_("Feels Like"),Barometer:_("Barometer"),Humidity:_("Humidity"),Visibility:_("Visibility"),Wind:_("Wind"),Sunrise:_("Sunrise"),Sunset:_("Sunset"),High:_("High"),Low:_("Low"),location:b.location.city+","+b.location.country,time:b.condition.date,condition_text:this._conditionMap()[b.condition.code],temp:b.condition.temp,temp_unit:b.units.temperature,pressure:b.atmosphere.pressure,pressure_unit:b.units.pressure,humidity:b.atmosphere.humidity,visibility:b.atmosphere.visibility,visibility_unit:b.units.distance,wind_direction:b.wind.direction,wind_speed:b.wind.speed,speed_unit:b.units.speed,sunrise:b.astronomy.sunrise,sunset:b.astronomy.sunset,high_temp:b.forecast[0].high,low_temp:b.forecast[0].low,code:b.condition.code,link:b.link,Detailed_Forecast:_("Detailed Forecast")})},buildCompactHtml:function(b){var a=new Ext.Template('<div class="weather-compact">','<div class="yw-loc">','<a target="_blank" href="{link}">{location}</a>',"</div>",'<div class="today-weather">','<div class="weather-icon">','<img src="images/weather/{today_code}d-s.png" title="{today_code_text}" alt="{condition_text}">',"</div>",'<div class="weather-text">','<span class="weather-day">{today_date}<br>{today_weekday}</span>','<span class="weather-temp">{today_low_temp}/{today_high_temp}&deg;</span>',"</div>","</div>",'<div class="tomorrow-weather">','<div class="weather-icon">','<img src="images/weather/{next_code}d-s.png" title="{next_code_text}" alt="{next_code_text}">',"</div>",'<div class="weather-text">','<span class="weather-day">{next_weekday}</span>','<span class="weather-temp">{next_low_temp}/{next_high_temp}&deg;</span>',"</div>","</div>","</div>");return a.applyTemplate({link:b.link,location:b.location.city+","+b.location.country,today_code:b.forecast[0].code,today_code_text:this._conditionMap()[b.forecast[0].code],today_low_temp:b.forecast[0].low,today_high_temp:b.forecast[0].high,today_date:b.forecast[0].date,today_weekday:_(b.forecast[0].day),next_code:b.forecast[1].code,next_code_text:this._conditionMap()[b.forecast[1].code],next_low_temp:b.forecast[1].low,next_high_temp:b.forecast[1].high,next_date:b.forecast[1].date,next_weekday:_(b.forecast[1].day)})},_conditionMap:function(){return{"0":_("Tornado"),"1":_("Tropical storm"),"2":_("Hurricane"),"3":_("Severe thunderstorms"),"4":_("Thunderstorms"),"5":_("Mixed rain and snow"),"6":_("Mixed rain and sleet"),"7":_("Mixed snow and sleet"),"8":_("Freezing drizzle"),"9":_("Drizzle"),"10":_("Freezing rain"),"11":_("Showers"),"12":_("Showers"),"13":_("Snow flurries"),"14":_("Light snow showers"),"15":_("Blowing snow"),"16":_("Snow"),"17":_("Hail"),"18":_("Sleet"),"19":_("Dust"),"20":_("Foggy"),"21":_("Haze"),"22":_("Smoky"),"23":_("Blustery"),"24":_("Windy"),"25":_("Cold"),"26":_("Cloudy"),"27":_("Mostly cloudy"),"28":_("Mostly cloudy"),"29":_("Partly cloudy"),"30":_("Partly cloudy"),"31":_("Clear"),"32":_("Sunny"),"33":_("Fair"),"34":_("Fair"),"35":_("Mixed rain and hail"),"36":_("Hot"),"37":_("Isolated thunderstorms"),"38":_("Scattered thunderstorms"),"39":_("Scattered thunderstorms"),"40":_("Scattered showers"),"41":_("Heavy snow"),"42":_("Scattered snow showers"),"43":_("Heavy snow"),"44":_("Partly cloudy"),"45":_("Thundershowers"),"46":_("Snow showers"),"47":_("Isolated thundershowers")}}});Ext.reg("widget_weather",Anz.widget.weather);Anz.widget.weather.woeidfield=function(b){var c=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:"http://where.yahooapis.com/v1",listeners:{beforeload:{scope:this,fn:function(e,f){e.setApi(Ext.data.Api.actions.read,String.format("http://where.yahooapis.com/v1/places.q({0});count=0?format=json&appid=1dIus9DV34GjOFTpNt_pwV465FOtJItUDeDMDR2bLWox6hTqUHPrVtvCnvDBfYg-",f.query))}}}}),reader:new Ext.data.JsonReader({root:"places.place",id:"woeid"},[{name:"woeid",mapping:"woeid"},{name:"name",mapping:"name"}])});var d=new Ext.XTemplate('<tpl for="."><div class="search-item">',"<h3><span>{woeid}-{name}</span></h3>","</div></tpl>");var a={store:c,displayField:"title",typeAhead:false,loadingText:"Searching...",width:570,hideTrigger:true,tpl:d,itemSelector:"div.search-item",listeners:{select:{scope:this,fn:function(g,e,f){g.setValue(e.get("woeid"))}}}};if(b){Ext.apply(a,b)}Ext.apply(this,a);Anz.widget.weather.woeidfield.superclass.constructor.apply(this,arguments)};Ext.extend(Anz.widget.weather.woeidfield,Ext.form.ComboBox,{});Ext.reg("widget.weather.woeidfield",Anz.widget.weather.woeidfield);
/* - widget_calendar.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.calendar=Ext.extend(Anz.widget.base,{iconCls:"widget_calendar_icon",bodyStyle:"padding: 5px",view:"Month",tips:[],tipsCfg:[],getCustomisePreferences:function(){return[{xtype:"combo",name:"weekStart",hiddenName:"weekStart",fieldLabel:_("Start day of week"),value:"Mon",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Sun",_("Sun")],["Mon",_("Mon")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Month",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Month",_("Month")],["Week",_("Week")],["Agenda",_("Agenda")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{view:"Month",weekStart:"Mon"}},updateOptions:function(c){var a=this.options;this.options=c;this.setTitle(Utf8.decode(c.title));if(!this.collapsed){var d=a.weekStart;var b=a.view;if(d!==c.weekStart){this.display()}else{if(b!==c.view){this.display()}}}},display:function(c){this.body.update('<div class="loading-indicator">Loading...</div>');if(!c){c=new Date()}this.view=this.getValue("view");this.weekStart=this.getValue("weekStart");var d=null;var a=null;switch(this.view){case"Month":d=c.getFirstDateOfMonth();a=c.getLastDateOfMonth();break;case"Week":case"Agenda":var b=c.format("w");if(this.weekStart=="Sun"){d=c.add(Date.DAY,-b)}else{if(b==0){d=c.add(Date.DAY,-6)}else{d=c.add(Date.DAY,1-b)}}a=d.add(Date.DAY,6);break;default:break}Ext.Ajax.request({url:this.contextUrl+"/@@mergedRequest/getMergedData",method:"POST",params:{"requests:list":["events@@calendarWidget/events?start:date="+d.format("Y/m/d")+"&end:date="+a.format("Y/m/d"),"stateStr@@calendarWidget/getReviewStateString"]},timeout:5000,scope:this,success:function(f,i){var g=Ext.decode(f.responseText);var j=g.events;if(j.success){this.eventsInfo=j.events;this.startDate=d;var e=g.stateStr;if(e.success){this.stateStr=e.stateStr}var h=this.buildContents();this.destroyEventTips();this.body.update(h);this.createEventTips();this.attachListener();this.loaded=true}else{if(g.msg){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(e,g){var f=e.responseText;if(f){this.body.update(f.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachListener:function(){var a=this.view;switch(a){case"Month":this.buildMonthListener();break;case"Week":case"Agenda":this.buildWeekListener();break;default:break}},destroyEventTips:function(){var b=this.tips;for(var c=0,a=b.length;c<a;++c){Ext.QuickTips.unregister(b[c].target)}this.tips=[]},createEventTips:function(){var e=this.tipsCfg;for(var c=0,a=e.length;c<a;++c){var b=e[c];var d=new Ext.ToolTip({target:b.target,title:_("Events in this day"),width:"auto",dismissDelay:0,html:b.html,trackMouse:true});this.tips.push(d)}this.tipsCfg=[]},buildMonthListener:function(){var a=this.body.child("a[class=preTimeCycle]");a.on("click",this.preMonth,this);var b=this.body.child("a[class=nextTimeCycle]");b.on("click",this.nextMonth,this)},preMonth:function(){var a=this.startDate.add(Date.MONTH,-1);this.display(a)},nextMonth:function(){var a=this.startDate.add(Date.MONTH,1);this.display(a)},buildWeekListener:function(){var b=this.body.child("a[class=preTimeCycle]");b.on("click",this.preWeek,this);var a=this.body.child("a[class=nextTimeCycle]");a.on("click",this.nextWeek,this)},preWeek:function(){var a=this.startDate.add(Date.DAY,-7);this.display(a)},nextWeek:function(){var a=this.startDate.add(Date.DAY,7);this.display(a)},buildContents:function(){var a=this.view;var b=null;switch(a){case"Month":b=this.buildMonthHtml();break;case"Week":b=this.buildWeekHtml();break;case"Agenda":b=this.buildAgendaHtml();break;default:b=this.buildMonthHtml()}return b},buildMonthHtml:function(){var d=this.eventsInfo;var u=this.weekStart;var e=this.startDate;var m=e.getFirstDayOfMonth();var f=e.getLastDayOfMonth();var q=0;var s=0;if(u==="Sun"){q=m;s=6-f}else{if(m===0){q=6;s=0}else{q=m-1;s=7-f}}var r=e.getDaysInMonth();var h=[];for(var z=0;z<q;++z){h.push(0)}for(var z=1;z<=r;++z){h.push(z)}for(var z=0;z<s;++z){h.push(0)}var l=[];var y=new Ext.Template('<div class="calendar_month_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{month}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<table class="calendar_table">',"<thead><tr>",'<td class="theader">{day1}</td>','<td class="theader">{day2}</td>','<td class="theader">{day3}</td>','<td class="theader">{day4}</td>','<td class="theader">{day5}</td>','<td class="theader">{day6}</td>','<td class="theader">{day7}</td>',"</tr></thead>","<tbody>");if(u==="Sun"){l.push(y.applyTemplate({month:e.format("Y-m"),day1:_("Sun"),day2:_("Mon"),day3:_("Tue"),day4:_("Wed"),day5:_("Thu"),day6:_("Fri"),day7:_("Sat")}))}else{l.push(y.applyTemplate({month:e.format("Y-m"),day1:_("Mon"),day2:_("Tue"),day3:_("Wed"),day4:_("Thu"),day5:_("Fri"),day6:_("Sat"),day7:_("Sun")}))}var a=new Ext.Template('<td class="{dateCls}" id="date_{id}">{day}</td>');var C=new Ext.Template('<td class="{dateCls}" id="date_{id}">','<a target="_blank" href="{url}">{day}</a>','<img index="0" class="event" src="ext3/resources/images/default/s.gif">',"</td>");var w=new Ext.Template('<div class="eventCls"><h6>{title}   {start}-{end}</h6><p>{desc}</p></div>');for(var z=0,A=h.length;z<A;++z){if((z%7)==0){l.push("<tr>")}var x=h[z];if(x==0){l.push('<td class="blank_day"></td>')}else{var o=e.add(Date.DAY,x-1);var n=o.format("w");var p=false;if(n==0||n==6){p=true}var c=d[o.format("Ymd")];var g=c&&c.length;if(g){var b=o.format("Y/m/d");l.push(C.applyTemplate({dateCls:p?"weekend":"",id:o.format("Y_m_d"),day:x,url:this.portalUrl+"/search?"+this.stateStr+"start.query:record:list:date="+b+"+23%3A59%3A59&amp;start.range:record=max&amp;end.query:record:list:date="+b+"+00%3A00%3A00&amp;end.range:record=min"}));var t=[];for(var v=0,k=c.length;v<k;++v){var B=c[v];t.push(w.applyTemplate({title:B.title,start:B.start,end:B.end,desc:B.desc}))}this.tipsCfg.push({target:"date_"+o.format("Y_m_d"),html:t.join("")})}else{l.push(a.applyTemplate({dateCls:p?"weekend":"",id:o.format("Y_m_d"),day:x}))}}if((z%7)==6){l.push("</tr>")}}l.push("</tbody></table></div>");return l.join("")},buildWeekHtml:function(){var b=this.eventsInfo;var n=this.weekStart;var e=this.startDate;var d=e.add(Date.DAY,6);var h=[];var r=new Ext.Template('<div class="calendar_week_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{range}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<table class="calendar_table">',"<thead><tr>",'<td class="theader">{day1}</td>','<td class="theader">{day2}</td>','<td class="theader">{day3}</td>','<td class="theader">{day4}</td>','<td class="theader">{day5}</td>','<td class="theader">{day6}</td>','<td class="theader">{day7}</td>',"</tr></thead>","<tbody>");if(n==="Sun"){h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d"),day1:_("Sun"),day2:_("Mon"),day3:_("Tue"),day4:_("Wed"),day5:_("Thu"),day6:_("Fri"),day7:_("Sat")}))}else{h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d"),day1:_("Mon"),day2:_("Tue"),day3:_("Wed"),day4:_("Thu"),day5:_("Fri"),day6:_("Sat"),day7:_("Sun")}))}var a=new Ext.Template('<td class="weekDay {dateCls}" id="date_{id}">{day}</td>');var u=new Ext.Template('<td class="weekDay {dateCls}" id="date_{id}">','<a target="_blank" href="{url}">{day}</a>','<img index="0" class="event" src="ext3/resources/images/default/s.gif">',"</td>");var q=new Ext.Template('<div class="eventCls"><h6>{title}   {start}-{end}</h6><p>{desc}</p></div>');for(var s=0;s<7;++s){var l=e.add(Date.DAY,s);var k=l.format("w");var m=false;if(k==0||k==6){m=true}var c=b[l.format("Ymd")];var f=c&&c.length;if(f){h.push(u.applyTemplate({dateCls:m?"weekend":"",id:l.format("Y_m_d"),day:l.format("d"),url:""}));var o=[];for(var p=0,g=c.length;p<g;++p){var t=c[p];o.push(q.applyTemplate({title:t.title,start:t.start,end:t.end,desc:t.desc}))}this.tipsCfg.push({target:"date_"+l.format("Y_m_d"),html:o.join("")})}}h.push("</tbody></table></div>");return h.join("")},buildAgendaHtml:function(){var b=this.eventsInfo;var o=this.weekStart;var e=this.startDate;var d=e.add(Date.DAY,6);var h=[];var r=new Ext.Template('<div class="calendar_week_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{range}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<div class="">');h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d")}));var q=new Ext.Template('<div class="{eventCls}">','<span class="{dateCls}">{date}</span>','<span class="dayCls">{day}</span>','<a target="_blank" href="{url}" title="{desc}">{title}</a>',"</div>");var u=new Ext.Template('<div class="{eventCls}">','<span class="dateCls">{date}</span>','<span class="dayCls">{day}</span>','<span class="hint">{title}</span>',"</div>");for(var s=0;s<7;++s){var m=e.add(Date.DAY,s);var k=m.format("w");var n=false;if(k==0||k==6){n=true}var l=m.format("Y/m/d");var a=m.format("D");var c=b[m.format("Ymd")];var f=c&&c.length;if(f){for(var p=0,g=c.length;p<g;++p){var t=c[p];h.push(q.applyTemplate({eventCls:n?"eventItem weekend":"eventItem",dateCls:p==0?"dateCls":"dateHidden",dayCls:p==0?"dayCls":"dayHidden",date:l,day:_(a),url:t.url,title:t.title,desc:t.start+"-"+t.end+"    "+t.title}))}}else{h.push(u.applyTemplate({eventCls:n?"eventItem weekend":"eventItem",date:l,day:_(a),title:_("No event today.")}))}}h.push("</div></div>");return h.join("")}});Ext.reg("widget_calendar",Anz.widget.calendar);
/* - MultiSelect.js - */
/*
 * Ext JS Library 3.1.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ns("Ext.ux.form");Ext.ux.form.MultiSelect=Ext.extend(Ext.form.Field,{ddReorder:false,appendOnly:false,width:100,height:100,displayField:0,valueField:1,allowBlank:true,minSelections:0,maxSelections:Number.MAX_VALUE,blankText:Ext.form.TextField.prototype.blankText,minSelectionsText:"Minimum {0} item(s) required",maxSelectionsText:"Maximum {0} item(s) allowed",delimiter:",",defaultAutoCreate:{tag:"div"},initComponent:function(){Ext.ux.form.MultiSelect.superclass.initComponent.call(this);if(Ext.isArray(this.store)){if(Ext.isArray(this.store[0])){this.store=new Ext.data.ArrayStore({fields:["value","text"],data:this.store});this.valueField="value"}else{this.store=new Ext.data.ArrayStore({fields:["text"],data:this.store,expandData:true});this.valueField="text"}this.displayField="text"}else{this.store=Ext.StoreMgr.lookup(this.store)}this.addEvents({dblclick:true,click:true,change:true,drop:true})},onRender:function(c,b){Ext.ux.form.MultiSelect.superclass.onRender.call(this,c,b);var a=this.fs=new Ext.form.FieldSet({renderTo:this.el,title:this.legend,height:this.height,width:this.width,style:"padding:0;",tbar:this.tbar});a.body.addClass("ux-mselect");this.view=new Ext.ListView({multiSelect:true,store:this.store,columns:[{header:"Value",width:1,dataIndex:this.displayField}],hideHeaders:true});a.add(this.view);this.view.on("click",this.onViewClick,this);this.view.on("beforeclick",this.onViewBeforeClick,this);this.view.on("dblclick",this.onViewDblClick,this);this.hiddenName=this.name||Ext.id();var d={tag:"input",type:"hidden",value:"",name:this.hiddenName};this.hiddenField=this.el.createChild(d);this.hiddenField.dom.disabled=this.hiddenName!=this.name;a.doLayout()},afterRender:function(){Ext.ux.form.MultiSelect.superclass.afterRender.call(this);if(this.ddReorder&&!this.dragGroup&&!this.dropGroup){this.dragGroup=this.dropGroup="MultiselectDD-"+Ext.id()}if(this.draggable||this.dragGroup){this.dragZone=new Ext.ux.form.MultiSelect.DragZone(this,{ddGroup:this.dragGroup})}if(this.droppable||this.dropGroup){this.dropZone=new Ext.ux.form.MultiSelect.DropZone(this,{ddGroup:this.dropGroup})}},onViewClick:function(c,a,b,d){this.fireEvent("change",this,this.getValue(),this.hiddenField.dom.value);this.hiddenField.dom.value=this.getValue();this.fireEvent("click",this,d);this.validate()},onViewBeforeClick:function(c,a,b,d){if(this.disabled){return false}},onViewDblClick:function(c,a,b,d){return this.fireEvent("dblclick",c,a,b,d)},getValue:function(a){var d=[];var c=this.view.getSelectedIndexes();if(c.length==0){return""}for(var b=0;b<c.length;b++){d.push(this.store.getAt(c[b]).get((a!=null)?a:this.valueField))}return d.join(this.delimiter)},setValue:function(a){var b;var d=[];this.view.clearSelections();this.hiddenField.dom.value="";if(!a||(a=="")){return}if(!Ext.isArray(a)){a=a.split(this.delimiter)}for(var c=0;c<a.length;c++){b=this.view.store.indexOf(this.view.store.query(this.valueField,new RegExp("^"+a[c]+"$","i")).itemAt(0));d.push(b)}this.view.select(d);this.hiddenField.dom.value=this.getValue();this.validate()},reset:function(){this.setValue("")},getRawValue:function(a){var b=this.getValue(a);if(b.length){b=b.split(this.delimiter)}else{b=[]}return b},setRawValue:function(a){setValue(a)},validateValue:function(a){if(a.length<1){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}if(a.length<this.minSelections){this.markInvalid(String.format(this.minSelectionsText,this.minSelections));return false}if(a.length>this.maxSelections){this.markInvalid(String.format(this.maxSelectionsText,this.maxSelections));return false}return true},disable:function(){this.disabled=true;this.hiddenField.dom.disabled=true;this.fs.disable()},enable:function(){this.disabled=false;this.hiddenField.dom.disabled=false;this.fs.enable()},destroy:function(){Ext.destroy(this.fs,this.dragZone,this.dropZone);Ext.ux.form.MultiSelect.superclass.destroy.call(this)}});Ext.reg("multiselect",Ext.ux.form.MultiSelect);Ext.ux.Multiselect=Ext.ux.form.MultiSelect;Ext.ux.form.MultiSelect.DragZone=function(d,c){this.ms=d;this.view=d.view;var b=c.ddGroup||"MultiselectDD";var a;if(Ext.isArray(b)){a=b.shift()}else{a=b;b=null}Ext.ux.form.MultiSelect.DragZone.superclass.constructor.call(this,this.ms.fs.body,{containerScroll:true,ddGroup:a});this.setDraggable(b)};Ext.extend(Ext.ux.form.MultiSelect.DragZone,Ext.dd.DragZone,{onInitDrag:function(a,c){var b=Ext.get(this.dragData.ddel.cloneNode(true));this.proxy.update(b.dom);b.setWidth(b.child("em").getWidth());this.onStartDrag(a,c);return true},collectSelection:function(b){b.repairXY=Ext.fly(this.view.getSelectedNodes()[0]).getXY();var a=0;this.view.store.each(function(d){if(this.view.isSelected(a)){var e=this.view.getNode(a);var c=e.cloneNode(true);c.id=Ext.id();b.ddel.appendChild(c);b.records.push(this.view.store.getAt(a));b.viewNodes.push(e)}a++},this)},onEndDrag:function(a,b){var c=Ext.get(this.dragData.ddel);if(c&&c.hasClass("multi-proxy")){c.remove()}},getDragData:function(d){var c=this.view.findItemFromChild(d.getTarget());if(c){if(!this.view.isSelected(c)&&!d.ctrlKey&&!d.shiftKey){this.view.select(c);this.ms.setValue(this.ms.getValue())}if(this.view.getSelectionCount()==0||d.ctrlKey||d.shiftKey){return false}var b={sourceView:this.view,viewNodes:[],records:[]};if(this.view.getSelectionCount()==1){var a=this.view.getSelectedIndexes()[0];var f=this.view.getNode(a);b.viewNodes.push(b.ddel=f);b.records.push(this.view.store.getAt(a));b.repairXY=Ext.fly(f).getXY()}else{b.ddel=document.createElement("div");b.ddel.className="multi-proxy";this.collectSelection(b)}return b}return false},getRepairXY:function(a){return this.dragData.repairXY},setDraggable:function(a){if(!a){return}if(Ext.isArray(a)){Ext.each(a,this.setDraggable,this);return}this.addToGroup(a)}});Ext.ux.form.MultiSelect.DropZone=function(d,c){this.ms=d;this.view=d.view;var b=c.ddGroup||"MultiselectDD";var a;if(Ext.isArray(b)){a=b.shift()}else{a=b;b=null}Ext.ux.form.MultiSelect.DropZone.superclass.constructor.call(this,this.ms.fs.body,{containerScroll:true,ddGroup:a});this.setDroppable(b)};Ext.extend(Ext.ux.form.MultiSelect.DropZone,Ext.dd.DropZone,{getTargetFromEvent:function(b){var a=b.getTarget();return a},getDropPoint:function(g,j,d){if(j==this.ms.fs.body.dom){return"below"}var f=Ext.lib.Dom.getY(j),a=f+j.offsetHeight;var i=f+(a-f)/2;var h=Ext.lib.Event.getPageY(g);if(h<=i){return"above"}else{return"below"}},isValidDropPoint:function(b,e,a){if(!a.viewNodes||(a.viewNodes.length!=1)){return true}var c=a.viewNodes[0];if(c==e){return false}if((b=="below")&&(e.nextSibling==c)){return false}if((b=="above")&&(e.previousSibling==c)){return false}return true},onNodeEnter:function(d,a,c,b){return false},onNodeOver:function(h,a,g,d){var b=this.dropNotAllowed;var f=this.getDropPoint(g,h,a);if(this.isValidDropPoint(f,h,d)){if(this.ms.appendOnly){return"x-tree-drop-ok-below"}if(f){var c;if(f=="above"){b=h.previousSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-above";c="x-view-drag-insert-above"}else{b=h.nextSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-below";c="x-view-drag-insert-below"}if(this.lastInsertClass!=c){Ext.fly(h).replaceClass(this.lastInsertClass,c);this.lastInsertClass=c}}}return b},onNodeOut:function(d,a,c,b){this.removeDropIndicators(d)},onNodeDrop:function(b,k,j,g){if(this.ms.fireEvent("drop",this,b,k,j,g)===false){return false}var l=this.getDropPoint(j,b,k);if(b!=this.ms.fs.body.dom){b=this.view.findItemFromChild(b)}var c=(this.ms.appendOnly||(b==this.ms.fs.body.dom))?this.view.store.getCount():this.view.indexOf(b);if(l=="below"){c++}var d=false;if(g.sourceView==this.view){if(l=="below"){if(g.viewNodes[0]==b){g.viewNodes.shift()}}else{if(g.viewNodes[g.viewNodes.length-1]==b){g.viewNodes.pop()}}if(!g.viewNodes.length){return false}if(c>this.view.store.indexOf(g.records[0])){d="down";c--}}for(var h=0;h<g.records.length;h++){var a=g.records[h];if(g.sourceView){g.sourceView.store.remove(a)}this.view.store.insert(d=="down"?c:c++,a);var f=this.view.store.sortInfo;if(f){this.view.store.sort(f.field,f.direction)}}return true},removeDropIndicators:function(a){if(a){Ext.fly(a).removeClass(["x-view-drag-insert-above","x-view-drag-insert-left","x-view-drag-insert-right","x-view-drag-insert-below"]);this.lastInsertClass="_noclass"}},setDroppable:function(a){if(!a){return}if(Ext.isArray(a)){Ext.each(a,this.setDroppable,this);return}this.addToGroup(a)}});
/* - TreeComboSuperBox.js - */
Ext.namespace("Ext.ux","Ext.ux.form");Ext.ux.form.TreeComboSuperBox=Ext.extend(Ext.form.TriggerField,{displayField:null,displayFieldTpl:null,forceFormValue:false,hiddenName:null,multiSelect:true,navigateItemsWithTab:true,resizable:false,treeConfig:{rootVisible:false,border:false,autoScroll:true,loaded:false,root:{nodeType:"async",expanded:true,uiProvider:false},loader:{url:"request.php"}},valueDelimiter:",",valueField:null,initComponent:function(){Ext.apply(this,{editable:false,triggerConfig:{cls:"x-superboxselect-btns",children:[{tag:"div",cls:"x-superboxselect-btn-expand"}]},items:new Ext.util.MixedCollection(false)});Ext.ux.form.TreeComboSuperBox.superclass.initComponent.call(this);this.constructTree()},onRender:function(b,a){var c=this.hiddenName;this.hiddenName=null;Ext.ux.form.TreeComboSuperBox.superclass.onRender.call(this,b,a);this.hiddenName=c;this.el.removeClass("x-form-text").addClass("x-superboxselect-input-field");this.wrapEl=this.el.wrap({tag:"ul"});this.outerWrapEl=this.wrapEl.wrap({tag:"div",cls:"x-form-text x-superboxselect"});this.inputEl=this.el.wrap({tag:"li",cls:"x-superboxselect-input"});this.setupFormInterception()},constructTree:function(){if(!this.treePanel){if(!this.treeWidth){this.treeWidth=Math.max(200,this.width||200)}if(!this.treeHeight){this.treeHeight=200}Ext.apply(this.treeConfig,{renderTo:Ext.getBody(),floating:true,autoScroll:true,minWidth:200,minHeight:200,width:this.treeWidth,height:this.treeHeight});if(!this.treeConfig.listeners){this.treeConfig.listeners={}}Ext.apply(this.treeConfig.listeners,{hide:this.onTreeHide,show:this.onTreeShow,expandnode:this.onExpandOrCollapseNode,collapsenode:this.onExpandOrCollapseNode,resize:this.onTreeResize,scope:this});this.treePanel=new Ext.tree.TreePanel(this.treeConfig);this.treePanel.show();this.treePanel.hide();this.relayEvents(this.treePanel.loader,["beforeload","load","loadexception"]);if(this.resizable){this.resizer=new Ext.Resizable(this.treePanel.getEl(),{pinned:true,handles:"se"});this.mon(this.resizer,"resize",function(c,a,b){this.treePanel.setSize(a,b)},this)}}},onTriggerClick:function(){this.treePanel.show();this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")},onExpandOrCollapseNode:function(){if(!this.maxHeight||this.resizable){return}var a=this.treePanel.getTreeEl();var d=a.getHeight()-a.dom.clientHeight;var c=a.child("ul");var b=c.getHeight()+d;if(b>this.maxHeight){b=this.maxHeight}this.treePanel.setHeight(b)},onTreeResize:function(){if(this.treePanel){this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")}},onTreeShow:function(){Ext.getDoc().on("mousewheel",this.collapseIf,this);Ext.getDoc().on("mousedown",this.collapseIf,this)},onTreeHide:function(){Ext.getDoc().un("mousewheel",this.collapseIf,this);Ext.getDoc().un("mousedown",this.collapseIf,this)},collapseIf:function(a){if(!a.within(this.wrap)&&!a.within(this.treePanel.getEl())){this.collapse()}},collapse:function(){this.treePanel.hide()},getValue:function(){var a=[];this.items.each(function(b){a.push(b.value)});return a.join(this.valueDelimiter)},setValue:function(e){if(!this.rendered){this.value=e;return}this.removeAllItems();if(Ext.isEmpty(e)){return}var a=e;if(!Ext.isArray(e)){e=""+e;a=e.split(this.valueDelimiter)}if(this.multiSelect){Ext.each(a,function(m){var j=m;var n=m;var i=m;var l="";var k="";this.addItemBox(j,n,i,l,k)},this)}else{var g=a[0];var c=g;var h=g;var b=g;var f="";var d="";this.addItemBox(c,h,b,f,d)}},removeAllItems:function(){this.items.each(function(a){a.preDestroy(true)},this);return this},getCaption:function(b){if(typeof this.displayFieldTpl==="string"){this.displayFieldTpl=new Ext.XTemplate(this.displayFieldTpl)}var a;if(this.displayFieldTpl){a=this.displayFieldTpl.apply(b.attributes)}else{if(this.displayField){a=b.attributes[this.displayField]}}return a},addItemBox:function(d,h,l,k,e){var j=this.items;for(var b=0,f=j.getCount();b<f;++b){var c=j.get(b);if(c.value===d){return}}if(!this.multiSelect){this.removeAllItems()}var g;var a=Ext.id(null,"sbx-item");var c=new Ext.ux.form.SuperBoxSelectItem({owner:this,renderTo:this.wrapEl,caption:l,display:h,value:d,key:a,listeners:{remove:function(i){if(this.fireEvent("beforeremoveitem",this,i.value)===false){return}this.items.removeKey(i.key)},destroy:function(){this.collapse();this.autoSize().validateValue()},scope:this}});c.render();g={tag:"input",type:"hidden",value:d,name:(this.hiddenName||this.name)};if(this.disabled){Ext.apply(g,{disabled:"disabled"})}c.hidden=this.el.insertSibling(g,"before");this.items.add(a,c);this.applyEmptyText().autoSize().validateValue();if(this.multiSelect){this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")}else{this.collapse()}},applyEmptyText:function(){this.setRawValue("");if(this.items.getCount()>0){this.el.removeClass(this.emptyClass);this.setRawValue("");return this}if(this.rendered&&this.emptyText&&this.getRawValue().length<1){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass)}return this},validateValue:function(a){if(this.items.getCount()===0){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}this.clearInvalid();return true},markInvalid:function(c){var b,a;if(!this.rendered||this.preventMark){return}this.outerWrapEl.addClass(this.invalidClass);c=c||this.invalidText;switch(this.msgTarget){case"qtip":Ext.apply(this.el.dom,{qtip:c,qclass:"x-form-invalid-tip"});Ext.apply(this.wrapEl.dom,{qtip:c,qclass:"x-form-invalid-tip"});if(Ext.QuickTips){Ext.QuickTips.enable()}break;case"title":this.el.dom.title=c;this.wrapEl.dom.title=c;this.outerWrapEl.dom.title=c;break;case"under":if(!this.errorEl){b=this.getErrorCt();if(!b){this.el.dom.title=c;break}this.errorEl=b.createChild({cls:"x-form-invalid-msg"});this.errorEl.setWidth(b.getWidth(true)-20)}this.errorEl.update(c);Ext.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case"side":if(!this.errorIcon){b=this.getErrorCt();if(!b){this.el.dom.title=c;break}this.errorIcon=b.createChild({cls:"x-form-invalid-icon"})}this.alignErrorIcon();Ext.apply(this.errorIcon.dom,{qtip:c,qclass:"x-form-invalid-tip"});this.errorIcon.show();this.on("resize",this.alignErrorIcon,this);break;default:a=Ext.getDom(this.msgTarget);a.innerHTML=c;a.style.display=this.msgDisplay;break}this.fireEvent("invalid",this,c)},clearInvalid:function(){if(!this.rendered||this.preventMark){return}this.outerWrapEl.removeClass(this.invalidClass);switch(this.msgTarget){case"qtip":this.el.dom.qtip="";this.wrapEl.dom.qtip="";break;case"title":this.el.dom.title="";this.wrapEl.dom.title="";this.outerWrapEl.dom.title="";break;case"under":if(this.errorEl){Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl,this)}break;case"side":if(this.errorIcon){this.errorIcon.dom.qtip="";this.errorIcon.hide();this.un("resize",this.alignErrorIcon,this)}break;default:var a=Ext.getDom(this.msgTarget);a.innerHTML="";a.style.display="none";break}this.fireEvent("valid",this)},alignErrorIcon:function(){if(this.wrap){this.errorIcon.alignTo(this.wrap,"tl-tr",[Ext.isIE?5:2,3])}},clearCurrentFocus:function(){if(this.currentFocus){this.currentFocus.onLnkBlur();this.currentFocus=null}return this},setupFormInterception:function(){var a;this.findParentBy(function(c){if(c.getForm){a=c.getForm()}});if(a){var b=a.getValues;a.getValues=function(d){this.el.dom.disabled=true;var c=this.el.dom.value;this.setRawValue("");var e=b.call(a);this.el.dom.disabled=false;this.setRawValue(c);if(this.forceFormValue&&this.items.getCount()===0){e[this.name]=""}return d?Ext.urlEncode(e):e}.createDelegate(this)}},onResize:function(a,c,e,b){var d=Ext.isIE6?4:Ext.isIE7?1:Ext.isIE8?1:0;if(this.wrapEl){this._width=a;this.outerWrapEl.setWidth(a-d)}Ext.ux.form.TreeComboSuperBox.superclass.onResize.call(this,a,c,e,b);this.autoSize()},autoSize:function(){if(!this.rendered){return this}if(!this.metrics){this.metrics=Ext.util.TextMetrics.createInstance(this.el)}var c=this.el,b=c.dom.value,e=document.createElement("div");if(b===""&&this.emptyText&&this.items.getCount()<1){b=this.emptyText}e.appendChild(document.createTextNode(b));b=e.innerHTML;e=null;b+="&#160;";var a=Math.max(this.metrics.getWidth(b)+24,24);if(typeof this._width!="undefined"){a=Math.min(this._width,a)}this.el.setWidth(a);if(Ext.isIE){this.el.dom.style.top="0"}this.fireEvent("autosize",this,a);return this}});Ext.reg("treecombosuperbox",Ext.ux.form.TreeComboSuperBox);Ext.ux.form.SuperBoxSelectItem=function(a){Ext.apply(this,a);Ext.ux.form.SuperBoxSelectItem.superclass.constructor.call(this)};Ext.ux.form.SuperBoxSelectItem=Ext.extend(Ext.ux.form.SuperBoxSelectItem,Ext.Component,{initComponent:function(){Ext.ux.form.SuperBoxSelectItem.superclass.initComponent.call(this)},onElClick:function(b){var c=this.owner;c.clearCurrentFocus().collapse();if(c.navigateItemsWithTab){this.focus()}else{c.el.dom.focus();var a=this;(function(){this.onLnkFocus();c.currentFocus=this}).defer(10,this)}},onLnkClick:function(a){if(a){a.stopEvent()}this.preDestroy();if(!this.owner.navigateItemsWithTab){this.owner.el.focus()}},onLnkFocus:function(){this.el.addClass("x-superboxselect-item-focus");this.owner.outerWrapEl.addClass("x-form-focus")},onLnkBlur:function(){this.el.removeClass("x-superboxselect-item-focus");this.owner.outerWrapEl.removeClass("x-form-focus")},enableElListeners:function(){this.el.on("click",this.onElClick,this,{stopEvent:true});this.el.addClassOnOver("x-superboxselect-item x-superboxselect-item-hover")},enableLnkListeners:function(){this.lnk.on({click:this.onLnkClick,focus:this.onLnkFocus,blur:this.onLnkBlur,scope:this})},enableAllListeners:function(){this.enableElListeners();this.enableLnkListeners()},disableAllListeners:function(){this.el.removeAllListeners();this.lnk.un("click",this.onLnkClick,this);this.lnk.un("focus",this.onLnkFocus,this);this.lnk.un("blur",this.onLnkBlur,this)},onRender:function(c,a){Ext.ux.form.SuperBoxSelectItem.superclass.onRender.call(this,c,a);var e=this.el;if(e){e.remove()}this.el=e=c.createChild({tag:"li"},c.last());e.addClass("x-superboxselect-item");var d=this.owner.navigateItemsWithTab?(Ext.isSafari?"button":"a"):"span";var f=this.key;Ext.apply(e,{focus:function(){var g=this.down(d+".x-superboxselect-item-close");if(g){g.focus()}},preDestroy:function(){this.preDestroy()}.createDelegate(this)});this.enableElListeners();e.update(this.caption);var b={tag:d,"class":"x-superboxselect-item-close",tabIndex:this.owner.navigateItemsWithTab?"0":"-1"};if(d==="a"){b.href="#"}this.lnk=e.createChild(b);if(!this.disabled){this.enableLnkListeners()}else{this.disableAllListeners()}this.on({disable:this.disableAllListeners,enable:this.enableAllListeners,scope:this});this.setupKeyMap()},setupKeyMap:function(){this.keyMap=new Ext.KeyMap(this.lnk,[{key:[Ext.EventObject.BACKSPACE,Ext.EventObject.DELETE,Ext.EventObject.SPACE],fn:this.preDestroy,scope:this},{key:[Ext.EventObject.RIGHT,Ext.EventObject.DOWN],fn:function(){this.moveFocus("right")},scope:this},{key:[Ext.EventObject.LEFT,Ext.EventObject.UP],fn:function(){this.moveFocus("left")},scope:this},{key:[Ext.EventObject.HOME],fn:function(){var a=this.owner.items.get(0).el.focus();if(a){a.el.focus()}},scope:this},{key:[Ext.EventObject.END],fn:function(){this.owner.el.focus()},scope:this},{key:Ext.EventObject.ENTER,fn:function(){}}]);this.keyMap.stopEvent=true},moveFocus:function(a){var b=this.el[a=="left"?"prev":"next"]()||this.owner.el;b.focus.defer(100,b)},preDestroy:function(a){if(this.fireEvent("remove",this)===false){return}var b=function(){if(this.owner.navigateItemsWithTab){this.moveFocus("right")}this.hidden.remove();this.hidden=null;this.destroy()};if(a){b.call(this)}else{this.el.hide({duration:0.2,callback:b,scope:this})}return this},kill:function(){this.hidden.remove();this.hidden=null;this.purgeListeners();this.destroy()},onDisable:function(){if(this.hidden){this.hidden.dom.setAttribute("disabled","disabled")}this.keyMap.disable();Ext.ux.form.SuperBoxSelectItem.superclass.onDisable.call(this)},onEnable:function(){if(this.hidden){this.hidden.dom.removeAttribute("disabled")}this.keyMap.enable();Ext.ux.form.SuperBoxSelectItem.superclass.onEnable.call(this)},onDestroy:function(){Ext.destroy(this.lnk,this.el);Ext.ux.form.SuperBoxSelectItem.superclass.onDestroy.call(this)}});
/* - widget_folder_contents.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.folderContents=Ext.extend(Anz.widget.base,{iconCls:"widget_folder_contents_icon",entries:[],page:0,pageCount:1,count:null,getCustomisePreferences:function(){var a=this.portalUrl.split("/").pop();return[{xtype:"treecombosuperbox",name:"paths",fieldLabel:_("Paths"),hiddenName:"paths:list",navigateItemsWithTab:true,resizable:true,allowBlank:false,msgTarget:"under",displayFieldTpl:"{text}",value:"/"+a,multiSelect:true,treeWidth:353,treeConfig:{height:110,rootVisible:true,autoScroll:true,root:{nodeType:"async",text:_("Root"),id:"root",expanded:true,path:"/"+a},loader:{url:this.portalUrl+"/@@folderContentsView/getChildNodesData"},listeners:{beforeload:{fn:function(c){var b=c.getOwnerTree().getLoader();b.baseParams.path=c.attributes.path}},click:{fn:function(d,g){var c=d.attributes.path;var i=d.text;var b=this.getCaption(d);var h="";var f="";this.addItemBox(c,i,b,h,f)}}}}},{xtype:"xcheckbox",name:"searchSub",fieldLabel:_("Search sub-directory?"),submitOffValue:0,submitOnValue:1,value:0,hiddenName:"searchSub:int"},{xtype:"multiselect",fieldLabel:_("Types"),name:"types",width:360,height:"auto",allowBlank:true,displayField:"name",valueField:"id",store:new Ext.data.JsonStore({autoDestroy:true,autoLoad:true,url:this.contextUrl+"/@@folderContentsWidget/types",root:"types",fields:["id","name"]})},{xtype:"numberfield",name:"recentDays",fieldLabel:_("Recent days"),value:0,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"numberfield",name:"sort_limit",fieldLabel:_("Max count"),value:0,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"xcheckbox",name:"paging",fieldLabel:_("Paging?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"paging:int"},{xtype:"numberfield",name:"count",fieldLabel:_("Count"),value:5,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Normal",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Normal",_("Normal")],["Magazine",_("Magazine")],["Slideshow",_("Slideshow")],["Headline",_("Headline")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{searchSub:0,recentDays:0,sort_limit:0,count:5,paging:1,view:"Normal"}},updateOptions:function(i){var a=this.options;this.options=i;this.count=parseInt(this.getValue("count"));this.setTitle(Utf8.decode(this.getValue("title")));if(!this.collapsed){var c=a.paths;var g=a.types;var d=a.searchSub;var h=a.recentDays;var e=a.sort_limit;var f=a.view;var b=a.paging;if((c!==this.getValue("paths"))||(g!==this.getValue("types"))||(d!==this.getValue("searchSub"))||(h!==this.getValue("recentDays"))||(e!==this.getValue("sort_limit"))){this.display()}else{if((f!==this.getValue("view"))||(b!==this.getValue("paging"))){if(this.loaded){this.buildContents()}else{this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');this.loaded=false;var d=this.getValue("paths");var b=this.getValue("types");var c=this.getValue("searchSub");var e=this.getValue("recentDays");var a=this.getValue("sort_limit");Ext.Ajax.request({url:this.contextUrl+"/@@folderContentsWidget/items",method:"POST",params:{"paths:list":d,searchSub:c,types:b,"recentDays:int":e,"sort_limit:int":a},timeout:5000,scope:this,success:function(f,h){var g=Ext.decode(f.responseText);if(g.success){this.entries=g.items;this.count=parseInt(this.getValue("count"));this.pageCount=Math.ceil(this.entries.length/this.count);this.buildContents();this.loaded=true}else{if(g.msg){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(f,h){var g=f.responseText;if(g){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachPagingHandler:function(){var a=this.body.child("a[class=prePage]");if(a){a.on("click",this.prePage,this)}var b=this.body.child("a[class=nextPage]");if(b){b.on("click",this.nextPage,this)}},prePage:function(){this.page-=1;this.buildContents()},nextPage:function(){this.page+=1;this.buildContents()},buildContents:function(){var c="";var a=this.getValue("view");switch(a){case"Normal":c=this.buildNormalHtml();break;case"Magazine":c=this.buildMagazineHtml();break;case"Slideshow":c=this.buildSlideshowHtml();break;case"Headline":c=this.buildHeadlineHtml();break;default:c=this.buildNormalHtml()}var d=this.getValue("paging")&&(this.pageCount>1)&&(a!=="Slideshow");if(d){c+='<div class="paging-bottom">';if(this.page!==0){c+=String.format('<a class="prePage" href="javascript:;">{0}</a>',_("prev"))}if(this.page<this.pageCount-1){c+=String.format('<a class="nextPage" href="javascript:;">{0}</a>',_("next"))}c+="<div>"}this.body.update(c);if(a==="Slideshow"){var b=this.getId()+"_slideshow";new Ext.ux.Carousel(b,{itemSelector:"div.item",interval:10,autoPlay:true,transitionEasing:"easeIn"})}if(d){this.attachPagingHandler()}},buildNormalHtml:function(){var g=this.page*this.count;var c=this.entries.slice(g,g+this.count);var e='<ul class="itemList">';var b=new Ext.Template("<li>",'<img width="16" height="16" src="{iconSrc}">','<a href="{link}" title="{desc}" target="_blank">',"{title}","</a>",'<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</li>");for(var d=0,a=c.length;d<a;++d){var f=c[d];e+=b.applyTemplate({iconSrc:this.portalUrl+"/"+f.icon,title:f.title,desc:f.desc,link:f.url,authorLink:this.portalUrl+"/author/"+f.author_id,author:f.author,date:f.modified,shortDate:new Date(f.modified).format("Y/m/d")})}e+="</ul>";return e},buildMagazineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="magazineView">'];var f=new Ext.Template('<div class="left">','<div class="crop">','<img height="234" width="234" src="{img}"/>',"</div>",'<div class="article">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</div>","</div>");var c=e[0];d.push(f.applyTemplate({title:c.title,desc:c.desc,img:this.portalUrl+"/default_news.png",link:c.link,authorLink:this.portalUrl+"/author/"+c.author_id,author:c.author,date:c.modified,shortDate:new Date(c.modified).format("Y/m/d")}));d.push('<div class="right">');var g=new Ext.Template('<div class="item">','<div class="thumbnail">','<img height="50" width="50" src="{img}"/>',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</div>","<p>{desc}</p>","</div>");for(var b=1,h=e.length;b<h;++b){var j=e[b];d.push(g.applyTemplate({title:j.title,desc:j.desc,img:this.portalUrl+"/default_news.png",link:j.link,authorLink:portalUrl+"/author/"+j.author_id,author:j.author,date:j.modified,shortDate:new Date(j.modified).format("Y/m/d")}))}d.push("</div></div>");return d.join("")},buildSlideshowHtml:function(c){var c=this.entries;var d=this.getId()+"_slideshow";var f=[String.format('<div class="slideshowView" id="{0}">',d)];var b=new Ext.Template('<div class="item">','<div class="crop">','<img src="{img}">',"</div>",'<div class="content">','<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>',"</div>",'<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</div>","</div>");for(var e=0,a=c.length;e<a;++e){var g=c[e];f.push(b.applyTemplate({img:this.portalUrl+"/default_news.png",title:g.title,desc:g.desc,link:g.link,authorLink:this.portalUrl+"/author/"+g.author_id,author:g.author,date:g.modified,shortDate:new Date(g.modified).format("Y/m/d")}))}f.push("</div>");return f.join("")},buildHeadlineHtml:function(e){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="headlineView">'];var f=new Ext.Template('<div class="top">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</div>","</div>",'<div class="middle odd">',"<p>{desc}</p>","</div>");var c=e[0];d.push(f.applyTemplate({img:this.portalUrl+"/default_news.png",title:c.title,desc:c.desc,link:c.link,authorLink:this.portalUrl+"/author/"+c.author_id,author:c.author,date:c.modified,shortDate:new Date(c.modified).format("Y/m/d")}));d.push('<ul class="bottom">');var g=new Ext.Template('<li class="item {cls}">','<div class="thumbnail">','<img height="50" width="50" src="{img}">',"</div>",'<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</li>");for(var b=1,h=e.length;b<h;++b){var j=e[b];d.push(g.applyTemplate({cls:b%2?"even":"odd",img:this.portalUrl+"/default_news.png",title:j.title,desc:j.desc,link:j.link,authorLink:this.portalUrl+"/author/"+j.author_id,author:j.author,date:j.modified,shortDate:new Date(j.modified).format("Y/m/d")}))}d.push("</ul></div>");return d.join("")},getTimeDiff:function(e){if(!e){return""}var d=new Date(e);var h=new Date();var c=h.valueOf()-d.valueOf();var i=c/86400000;i=parseInt(i);c=c-(i*86400000);var f=c/3600000;f=parseInt(f);c=c-(f*3600000);var b=c/60000;b=parseInt(b);c=c-(b*60000);var g=c/1000;g=parseInt(g);var a="";if(i>0){a=i+"days before"}else{if(f>0){a=f+"hours before"}else{if(b>0){a=b+"minutes before"}}}return a}});Ext.reg("widget_folder_contents",Anz.widget.folderContents);
/* - widgetsview.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.dashboard");Anz.dashboard.WidgetsView=function(a){this.config=a};Anz.dashboard.WidgetsView.prototype={lookup:{},show:function(b,d){if(!this.win){this.initTemplates();this.store=new Ext.data.JsonStore({url:this.config.url,root:"widgets",fields:["id","title","desc","icon"]});this.store.load();var c=function(e){e.icon=this.config.portalUrl+"/"+e.icon+"64.png";e.Widget_Name=_("Widget name");e.Description=_("Description");this.lookup[e.id]=e;return e};this.view=new Ext.DataView({tpl:this.thumbTemplate,singleSelect:true,overClass:"x-view-over",itemSelector:"div.thumb-wrap",emptyText:'<div style="padding:10px;">No images match the specified filter</div>',store:this.store,listeners:{selectionchange:{fn:this.showDetails,scope:this,buffer:100},dblclick:{fn:this.doCallback,scope:this},loadexception:{fn:this.onLoadException,scope:this},beforeselect:{fn:function(e){return e.store.getRange().length>0}}},prepareData:c.createDelegate(this)});var a={title:_("Widgets list"),id:"widgets-chooser-dlg",layout:"border",minWidth:500,minHeight:300,modal:true,closeAction:"hide",border:false,items:[{id:"widget-chooser-view",region:"center",autoScroll:true,items:this.view},{id:"widget-detail-panel",region:"east",split:true,width:150,minWidth:150,maxWidth:250}],buttons:[{id:"ok-btn",text:_("OK"),handler:this.doCallback,scope:this},{text:_("Cancel"),handler:function(){this.win.hide()},scope:this}],keys:{key:27,handler:function(){this.win.hide()},scope:this}};Ext.apply(a,this.config);this.win=new Ext.Window(a)}this.reset();this.win.show(b);this.callback=d;this.animateTarget=b},initTemplates:function(){this.thumbTemplate=new Ext.XTemplate('<tpl for=".">','<div class="thumb-wrap" id="{id}">','<div class="thumb"><img src="{icon}" title="{title}"></div>',"<span>{title}</span></div>","</tpl>");this.thumbTemplate.compile();this.detailsTemplate=new Ext.XTemplate('<div class="details">','<tpl for=".">','<div class="thumb"><img src="{icon}"></div>','<div class="details-info">',"<div><b>{Widget_Name}: </b>","<span>{title}</span></div>","<div><b>{Description}: </b>","<span>{desc}</span></div>","</div>","</tpl>","</div>");this.detailsTemplate.compile()},showDetails:function(){var b=this.view.getSelectedNodes();var c=Ext.getCmp("widget-detail-panel").body;if(b&&b.length>0){b=b[0];Ext.getCmp("ok-btn").enable();var a=this.lookup[b.id];c.hide();this.detailsTemplate.overwrite(c,a);c.slideIn("l",{stopFx:true,duration:0.2})}else{Ext.getCmp("ok-btn").disable();c.update("")}},sortImages:function(){var a=Ext.getCmp("sortSelect").getValue();this.view.store.sort(a,a=="name"?"asc":"desc");this.view.select(0)},reset:function(){this.view.select(0)},doCallback:function(){var a=this.view.getSelectedNodes()[0];var c=this.callback;var b=this.lookup;this.win.hide(this.animateTarget,function(){if(a&&c){var d=b[a.id];c(d)}})},onLoadException:function(a,b){this.view.getEl().update('<div style="padding:10px;">Error loading images.</div>')}};
/* - TabMoreMenu.js - */
Ext.ux.TabMoreMenu=function(a){a=a||{};Ext.apply(this,a);Ext.ux.TabMoreMenu.superclass.constructor.call(this)};Ext.extend(Ext.ux.TabMoreMenu,Ext.util.Observable,{menuAlign:"tr-br?",menuOffsets:[0,-5],init:function(a){a.getTemplateArgs=this.getTemplateArgs.createDelegate(a);a.findTargets=this.findTargets.createDelegate(a);a.onStripMouseDown=this.onStripMouseDown.createDelegate(a);a.on("beforedestroy",this.beforedestroy,this);a.on("more",this.onMore,this);this.tab=a;if(this.menu){this.menu=Ext.menu.MenuMgr.get(this.menu);Ext.apply(this.menu,{defaultOffsets:this.menuOffsets,afterRender:function(){Ext.menu.Menu.superclass.afterRender.call(this);this.items.each(function(b){b.un("click",b.handler,b.scope)},this)}});this.menu.on("click",this.onMenuClick,this)}},onMenuClick:function(c,a,b){b.stopEvent();if(a.handler){a.handler.call(a.scope||this,this.menu.tabItem)}},onMore:function(c,a,b){c.stopEvent();this.menu.tabItem=a.item;if(this.menu){this.menu.show(b,this.menuAlign)}},getTemplateArgs:function(a){var b=Ext.TabPanel.prototype.getTemplateArgs.call(this,a);b.cls="x-tab-strip-more";return b},findTargets:function(b){var a=Ext.TabPanel.prototype.findTargets.call(this,b);a.close=false;a.more=b.getTarget(".x-tab-strip-close",this.strip);return a},onStripMouseDown:function(b){Ext.TabPanel.prototype.onStripMouseDown.call(this,b);var a=this.findTargets(b);if(a.more&&a.item){this.fireEvent("more",b,a,a.el)}},beforedestroy:function(){Ext.destroy(this.menu)}});
/* - anz_dashboard.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.dashboard");Anz.dashboard.app=function(){return{portalUrl:null,contextUrl:null,container:null,currentPage:null,pageLayout:null,currentWidget:null,pageTools:[],columnTools:[],widgetTools:[],widgetContextMenu:null,widgetsPanel:null,init:function(b,a){this.portalUrl=b;this.contextUrl=a;Ext.QuickTips.init();Ext.Ajax.request({url:this.contextUrl+"/@@mergedRequest/getMergedData",method:"POST",params:{"requests:list":["pageLayout@@dashboardView/getPageLayout","layoutCfg@@dashboardView/getLayoutConfig","widgets@@widgetView/getWidgets","i18n@@msgCatalog/catalogMapping?domain=anz.dashboard"]},scope:this,success:function(l,d){var h=Ext.decode(l.responseText);this.pageLayout=h.pageLayout.layout;var c=h.layoutCfg.config;Anz.i18n=h.i18n.texts;var k=h.widgets.widgets;var j={};for(var e=0,g=k.length;e<g;++e){var f=k[e];j[f.id]=f}this.constructPageTools();this.constructColumnTools();this.constructWidgetTools();this.constructPages(c,j)},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},destroy:function(){if(this.container){this.container.removeAll()}},calcPageIndex:function(g){var d=null;var c=null;if(this.pageLayout==="tile"){c=this.container.items;for(var f=0,b=c.getCount();f<b;++f){if(g.getId()===c.get(f).id){d=f;break}}}else{var a=this.container.getActiveTab();var e=this.container.items;for(var f=0;f<e.getCount();f++){if(a==e.get(f)){d=f;break}}}return d},calcColumnIndex:function(d){var b=null;var e=d.ownerCt.items;for(var c=0,a=e.getCount();c<a;++c){if(d.getId()===e.get(c).id){b=c;break}}return b},calcWidgetPos:function(h){var g=h.findParentByType("portal");var b=this.calcPageIndex(g);var f=this.calcColumnIndex(h.ownerCt);var e=null;var c=h.ownerCt.items;for(var d=0,a=c.getCount();d<a;++d){if(h.getId()===c.get(d).getId()){e=d;break}}return{page:b,col:f,pos:e,pageCount:g.ownerCt.items.getCount(),colCount:g.items.getCount()}},constructPageTools:function(){this.pageTools=[{id:"add_widget",qtip:_("Add widget"),scope:this,handler:function(c,b,a){this.showWidgetsView(a)}},{id:"add_page",qtip:_("Add page"),scope:this,handler:function(c,b,a){this.addPage(this.calcPageIndex(a)+1)}},{id:"save",qtip:_("Edit page"),scope:this,handler:function(c,b,a){this.editPage(a)}},{id:"up",qtip:_("Move page up"),scope:this,handler:function(c,b,a){this.movePage(a,"up")}},{id:"down",qtip:_("Move page down"),scope:this,handler:function(c,b,a){this.movePage(a,"down")}},{id:"close",qtip:_("Delete page"),scope:this,handler:function(c,b,a){this.delPage(a)}}]},constructColumnTools:function(){this.columnTools=[{id:"add_column",qtip:_("Add column"),scope:this,handler:function(d,c,a){var e=a.findParentByType("portal");var b=this.calcColumnIndex(a);this.addColumn(e,b+1)}},{id:"left",qtip:_("Move column left"),scope:this,handler:function(c,b,a){this.moveColumn(a,"left")}},{id:"right",qtip:_("Move column right"),scope:this,handler:function(c,b,a){this.moveColumn(a,"right")}},{id:"close",qtip:_("Delete the column"),scope:this,handler:function(c,b,a){this.delColumn(a)}}]},constructWidgetTools:function(){this.widgetTools=[{id:"toggle",qtip:_("Collapse the widget"),scope:this,handler:function(c,b,a){this.collapseWidget(a)}},{id:"gear",qtip:_("Config the widget"),scope:this,handler:function(c,b,a){this.currentWidget=a;if(!this.widgetContextMenu){this.widgetContextMenu=new Ext.menu.Menu({shadow:false,style:{background:"white none repeat scroll 0 0",textAlign:"left",border:"1px solid #999"},items:[{id:"menuitem_color",text:_("color"),iconCls:"color_widget",menu:{xtype:"colormenu",colors:["D96666","E67399","B373B3","8C66D9","668CB3","668CD9","59BFB3","65AD89","4CB052","8CBF40","BFBF4D","E0C240","F2A640","E6804D","BE9494","A992A9","8997A5","94A2BE","85AAA5","A7A77D","C4A883"],scope:this,handler:function(d,e){this.changeWidgetColor(e)}}},{id:"menuitem_up",text:_("up"),iconCls:"move_up",scope:this,handler:function(d,f){this.moveWidget("up");f.stopEvent()}},{id:"menuitem_right",text:_("right"),iconCls:"move_right",scope:this,handler:function(d,f){this.moveWidget("right");f.stopEvent()}},{id:"menuitem_down",text:_("down"),iconCls:"move_down",scope:this,handler:function(d,f){this.moveWidget("down");f.stopEvent()}},{id:"menuitem_left",text:_("left"),iconCls:"move_left",scope:this,handler:function(d,f){this.moveWidget("left");f.stopEvent()}}]})}this.widgetContextMenu.showAt(c.getPoint())}},{id:"refresh",qtip:_("Refresh the widget"),scope:this,handler:function(d,b,a){var c=1+2}},{id:"save",qtip:_("Edit the widget"),scope:this,handler:function(c,b,a){this.changeWidgetOptions(a)}},{id:"close",qtip:_("Delete the widget"),scope:this,handler:function(c,b,a){this.delWidget(a)}}]},constructPages:function(t,p){var d={};if(this.pageLayout==="tile"){Ext.apply(d,{renderTo:"region-content"})}else{var m=Ext.get("region-content");var q=m.getWidth(true);Ext.apply(d,{renderTo:"region-content",activeTab:0,minTabWidth:115,tabWidth:135,width:q,autoHeight:true,plain:true,enableTabScroll:true,plugins:[new Ext.ux.TabMoreMenu({menu:[{id:"menuitem_edit_page",text:_("Edit page"),iconCls:"edit_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.editPage(j)}},{id:"menuitem_left",text:_("left"),iconCls:"move_left",scope:this,handler:function(i){var k=this.container.getActiveTab();var j=this.container.setActiveTab.createDelegate(this.container,[k]);this.movePage(k,"left",j)}},{id:"menuitem_right",text:_("right"),iconCls:"move_right",scope:this,handler:function(i){var k=this.container.getActiveTab();var j=this.container.setActiveTab.createDelegate(this.container,[k]);this.movePage(k,"right",j)}},{id:"menuitem_add_widget",text:_("Add widget"),iconCls:"add_widget",scope:this,handler:function(i){var j=this.container.getActiveTab();this.showWidgetsView(j)}},{id:"menuitem_add_page",text:_("Add page"),iconCls:"add_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.addPage(this.calcPageIndex(j)+1)}},{id:"menuitem_delete_page",text:_("Delete page"),iconCls:"delete_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.delPage(this.calcPageIndex(j)+1)}}]})]})}var l=[];for(var u=0,v=t.length;u<v;++u){var f=t[u];var h=f.columns.length;var x=[];for(var s=0;s<h;++s){var c=f.columns[s];var g={};g.title=_("column");g.columnWidth=parseFloat(c.width);g.style=c.style;g.tools=this.columnTools;var n=[];var o=c.widgets;var b=o.length;for(var r=0;r<b;++r){var e=o[r];var a={};a.portalUrl=this.portalUrl;a.contextUrl=this.contextUrl;a.xtype=e.id;a.options=e.options;a.title=Utf8.decode(e.options.title);a.collapsed=e.collapse;if(e.color){a.baseCls="x-panel-green"}if(p[e.id]){a.iconCls=p[e.id].icon}a.tools=this.widgetTools;n.push(a)}g.items=n;x.push(g)}var w=this._buildPortalCfg(x,Utf8.decode(f.title));l.push(w)}d.items=l;if(this.pageLayout==="tile"){this.container=new Ext.Panel(d)}else{this.container=new Ext.TabPanel(d)}},constructPage:function(c,a){var b=this._buildPortalCfg(c,"untitled page");if(a){this.container.insert(a,b)}else{this.container.add(b)}},addPage:function(a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addPage",method:"POST",params:{"pageIndex:int":a},scope:this,success:function(b,e){var d=Ext.decode(b.responseText);if(d.success){var c=[{title:_("column"),columnWidth:0.5,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]},{title:_("column"),columnWidth:0.5,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]}];this.constructPage(c,a);this.container.doLayout()}else{alert(d.msg)}},failure:function(b,c){Ext.MessageBox.alert("failure",b.responseText)}})},editPage:function(b){var a=new Ext.FormPanel({labelWidth:80,bodyStyle:"padding:15px;",border:false,width:500,autoHeight:true,defaults:{anchor:"100%"},defaultType:"textfield",items:[{name:"title",fieldLabel:"title",value:b.title},{name:"width",fieldLabel:"width",value:""},{xtype:"textarea",name:"style",fieldLabel:"style",value:""}]});var c=new Ext.Window({layout:"fit",title:_("Edit page"),width:640,autoHeight:true,modal:true,items:a,buttons:[{text:_("Save"),iconCls:"icon-save",handler:function(f,i){var g=a.getForm();f.disable();var h=f.nextSibling();h.disable();var d=g.getValues();if(g.isValid()){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/editPage",method:"POST",form:g.id,params:{"pageIndex:int":this.calcPageIndex(b)},scope:this,success:function(e,k){var j=Ext.decode(e.responseText);if(j.success){b.setTitle(d.title)}else{alert(j.msg)}},failure:function(e,j){alert(e.responseText)}})}else{f.enable();h.enable()}c.close()},scope:this},{text:_("Cancel"),scope:this,handler:function(d,f){c.close()}}]});c.show()},movePage:function(f,b,h){var a=this.container;var c=this.container.items.length-1;var e=this.calcPageIndex(f);var g=null;var d=false;if(b=="up"){if(e>0){g=e-1;d=true}}else{if(b=="down"){if(e<c){g=e+1;d=true}}else{if(b=="left"){if(e>0){g=e-1;d=true}}else{if(b=="right"){if(e<c){g=e+1;d=true}}}}}if(d){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/movePage",method:"POST",params:{"pageIndex:int":e,"toPage:int":g},scope:this,success:function(i,k){var j=Ext.decode(i.responseText);if(j.success){a.remove(f,false);var l=f.getPositionEl().dom;l.parentNode.removeChild(l);a.insert(g,f);a.doLayout();if(h){h()}}else{alert(j.msg)}},failure:function(i,j){Ext.MessageBox.alert("failure",i.responseText)}})}},delPage:function(a){if(this.container.items.length==1){alert(_("Can not delete the last page!"));return}Ext.Msg.confirm("Confirm",_("Are you sure you want to delete this page?"),function(c){if(c=="yes"){var b=this.calcPageIndex(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delPage",method:"POST",params:{"pageIndex:int":b},scope:this,success:function(d,g){var e=Ext.decode(d.responseText);if(e.success){if(this.pageLayout==="tile"){this.container.remove(a,true)}else{var f=this.container.getActiveTab();this.container.remove(f,true)}}else{alert(e.msg)}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})}},this)},addColumn:function(b,a){var a=a?a:0;Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(b),"columnIndex:int":a},scope:this,success:function(u,k){var o=Ext.decode(u.responseText);if(o.success){var p=b.items;var s=p.getCount()+1;var g=1/s;var t=null;var h=[];for(var l=0,m=p.getCount();l<m;++l){var r=p.get(l);if(!t){var n=r.container;t=n.getViewSize().width-n.getPadding("lr")}var q=r.getEl();var j=r.getSize().width+q.getMargins("lr");var f=(j/t)*(1-g);r.columnWidth=f;h.push(f)}var e={xtype:"portalcolumn",title:_("column"),columnWidth:g,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]};h.splice(a,0,g);b.insert(a,e);var d=p.get(s-1);this._adjustLastColumn(d,h);b.doLayout();this.changeColumnsWidth(b,h)}else{alert(o.msg)}},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},_adjustLastColumn:function(c,e){c.getEl().setStyle("margin-right",0);var d=0;for(var b=0,a=e.length-1;b<a;++b){d+=e[b]}c.columnWidth=1-d;e[e.length-1]=1-d},changeColumnsWidth:function(b,a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeColumnsWidth",method:"POST",params:{"pageIndex:int":this.calcPageIndex(b),"widths:list":a},scope:this,success:function(c,e){var d=Ext.decode(c.responseText);if(!d.success){alert(d.msg)}},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},moveColumn:function(e,a){var f=e.findParentByType("portal");var b=f.items.getCount()-1;var d=this.calcColumnIndex(e);var g=null;var c=false;if(a=="left"){if(d>0){g=d-1;c=true}}else{if(a=="right"){if(d<b){g=d+1;c=true}}}if(c){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(f),"columnIndex:int":d,"toColumn:int":g},scope:this,success:function(i,k){var j=Ext.decode(i.responseText);if(j.success){f.remove(e,false);var l=e.getPositionEl().dom;l.parentNode.removeChild(l);f.insert(g,e);var h=f.items.get(b);h.getEl().setStyle("margin-right",0);f.doLayout()}else{alert(j.msg)}},failure:function(h,i){Ext.MessageBox.alert("failure",h.responseText)}})}},delColumn:function(a){Ext.Msg.confirm("Confirm",_("Are you sure you want to delete this column?"),function(c){if(c=="yes"){var d=a.findParentByType("portal");var b=this.calcColumnIndex(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(d),"columnIndex:int":b},scope:this,success:function(v,j){var p=Ext.decode(v.responseText);if(p.success){var o=a.container;var u=o.getViewSize();var t=u.width-o.getPadding("lr");var l=(a.getSize().width+a.getEl().getMargins("lr"))/t;var g=[];var q=d.items;for(var k=0,n=q.getCount();k<n;++k){var s=q.get(k);if(k!==b){var r=s.getEl();var h=s.getSize().width+r.getMargins("lr");var f=(h/t)/(1-l);s.columnWidth=f;g.push(f)}}var m=d.getLayout();if(m.splitBars){m.splitBars[b].destroy(true)}a.ownerCt.remove(a,true);var e=q.get(g.length-1);this._adjustLastColumn(e,g);d.doLayout();this.changeColumnsWidth(d,g)}else{alert(p.msg)}},failure:function(e,f){Ext.MessageBox.alert("failure",e.responseText)}})}},this)},showWidgetsView:function(a){if(!this.widgetsPanel){this.widgetsPanel=new Anz.dashboard.WidgetsView({portalUrl:this.portalUrl,url:this.contextUrl+"/@@widgetView/getWidgets",width:515,height:350})}this.currentPage=a;this.widgetsPanel.show(null,this.addWidget.createDelegate(this))},addWidget:function(a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addWidget",method:"POST",params:{"pageIndex:int":this.calcPageIndex(this.currentPage),"columnIndex:int":0,"widgetIndex:int":0,widgetId:a.id},scope:this,success:function(b,e){var d=Ext.decode(b.responseText);if(d.success){var c=this.currentPage.getComponent(0);c.insert(0,{xtype:a.id,options:{},title:a.title,iconCls:a.icon,tools:this.widgetTools,contextUrl:this.contextUrl});c.doLayout()}else{alert(d.msg)}},failure:function(b,c){Ext.MessageBox.alert("failure",b.responseText)}})},moveWidget:function(e){var h=this.currentWidget;var i=h.findParentByType("portal");var j=this.calcWidgetPos(h);var f=j.page;var c=j.col;var d=j.pos;var k=null;var b=null;if(e=="left"){k=c-1;k=k>0?k:0;var a=i.getComponent(k);var g=a.items.getCount();b=d<g?d:g}else{if(e=="right"){k=c+1;k=k<j.colCount?k:j.colCount;var a=i.getComponent(k);var g=a.items.getCount();b=d<g?d:g}else{if(e=="up"){k=c;b=d-1;b=b>0?b:0}else{if(e=="down"){k=c;var a=i.getComponent(k);var g=a.items.getCount();b=d+1;b=b<g?b:g}}}}if((c!==k)||(d!==b)){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveWidget",method:"POST",params:{"pageIndex:int":f,"columnIndex:int":c,"widgetIndex:int":j.pos,"toPage:int":f,"toColumn:int":k,"toWidget:int":b},scope:this,success:function(l,n){var m=Ext.decode(l.responseText);if(m.success){var o=i.getComponent(c);o.remove(h,false);var q=h.getPositionEl().dom;q.parentNode.removeChild(q);var p=i.getComponent(k);p.insert(b,h);i.doLayout()}else{alert("move widget failure.")}},failure:function(l,m){Ext.MessageBox.alert("failure",l.responseText)}})}},changeWidgetColor:function(b){var c=this.currentWidget;var a=this.calcWidgetPos(c);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeWidgetColor",method:"POST",params:{"pageIndex:int":a.page,"columnIndex:int":a.col,"widgetIndex:int":a.pos,color:b},scope:this,success:function(m,g){var k=Ext.decode(m.responseText);if(k.success){var e=c.getEl().query("*[class*=x-panel]");for(var h=0,j=e.length;h<j;++h){var d=e[h];var l=d.className;var f=l.split(c.baseCls);d.className=f.join("x-panel-green")}}else{alert("change color failure")}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})},changeWidgetOptions:function(a){var g=a.getPreferences();var n=a.options;var l=[];var h=[];for(var e=0,k=g.length;e<k;++e){var d=g[e];var b=d.name;l.push(b);var f=n[b];if(typeof f==="string"){f=Utf8.decode(f)}var m={};Ext.apply(m,d);m.value=(f!==undefined)?f:d.value;h.push(m)}var c=new Ext.FormPanel({labelWidth:80,bodyStyle:"padding:15px;",border:false,width:500,autoHeight:true,defaults:{anchor:"100%"},defaultType:"textfield",items:h});var j=new Ext.Window({layout:"fit",title:"Edit "+a.title,width:640,autoHeight:true,modal:true,items:c,buttons:[{text:_("Save"),iconCls:"icon-save",handler:function(o,r){var p=c.getForm();o.disable();var q=o.nextSibling();q.disable();if(p.isValid()){var i=this.calcWidgetPos(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeWidgetOptions",method:"POST",form:p.id,params:{"pageIndex:int":i.page,"columnIndex:int":i.col,"widgetIndex:int":i.pos,"names:list":l},scope:this,success:function(s,u){var t=Ext.decode(s.responseText);if(t.success){a.updateOptions(t.options)}else{alert(t.msg)}},failure:function(s,t){Ext.MessageBox.alert("failure",s.responseText)}})}else{o.enable();q.enable()}j.close()},scope:this},{text:_("Cancel"),scope:this,handler:function(i,o){j.close()}}]});j.show()},collapseWidget:function(b){var c=!b.collapsed;b.toggleCollapse(true);var a=this.calcWidgetPos(b);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/collapseWidget",method:"POST",params:{"pageIndex:int":a.page,"columnIndex:int":a.col,"widgetIndex:int":a.pos,"collapse:int":c?1:0},scope:this,success:function(d,f){var e=Ext.decode(d.responseText);if(!e.success){alert(e.msg)}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})},delWidget:function(a){var b=new Ext.Window({layout:"fit",title:a.title,width:300,autoHeight:true,modal:true,html:_("Are you sure to delete this widget?"),buttons:[{text:_("Delete"),width:"auto",iconCls:"icon-delete",handler:function(d,f){var c=this.calcWidgetPos(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delWidget",method:"POST",params:{"pageIndex:int":c.page,"columnIndex:int":c.col,"widgetIndex:int":c.pos},scope:this,success:function(e,h){var g=Ext.decode(e.responseText);if(g.success){a.ownerCt.remove(a,true)}else{alert(g.msg)}},failure:function(e,g){Ext.MessageBox.alert("failure",e.responseText)}});b.close()},scope:this},{text:_("Collapse"),scope:this,handler:function(c,d){this.collapseWidget(a);b.close()}},{text:_("Cancel"),scope:this,handler:function(c,d){b.close()}}]});b.show()},_buildPortalCfg:function(a,c){var b={xtype:"portal",title:c,frame:false,autoHeight:true,style:"padding: 10px 10px 0 10px;",bodyStyle:"padding: 5px 5px 5px 0",tools:this.pageTools,toolscope:["search","pin","gear"],items:a,listeners:{validatedrop:{scope:this,fn:function(f){var d=f.panel;d.lastPos=this.calcWidgetPos(d)}},drop:{scope:this,fn:function(h){var d=h.panel;var g=d.lastPos;var f=d.findParentByType("portal");Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveWidget",method:"POST",params:{"pageIndex:int":g.page,"columnIndex:int":g.col,"widgetIndex:int":g.pos,"toPage:int":this.calcPageIndex(f),"toColumn:int":h.columnIndex,"toWidget:int":h.position},scope:this,success:function(e,j){var i=Ext.decode(e.responseText);if(i.success){delete d.lastPos}else{alert("move widget failure.")}},failure:function(e,i){Ext.MessageBox.alert("failure",e.responseText)}})}},columnresize:{scope:this,fn:function(k){var n=null;var e=[];var l=k.items;for(var g=0,h=l.getCount();g<h;++g){var m=l.get(g);if(!n){var j=m.container;var o=j.getViewSize();n=o.width-j.getPadding("lr")}var f=m.el.getWidth();e.push(f/n)}var d=l.get(e.length-1);this._adjustLastColumn(d,e);this.changeColumnsWidth(k,e)}}}};return b}}}();
/* - anzi18n.js - */
Ext.namespace("Anz");Anz.i18n={};function _(a){if(Anz.i18n[a]){a=Anz.i18n[a]}return a}var Utf8={encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}return b}};
/* - Portal.js - */
/*
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ux.Portal=Ext.extend(Ext.Panel,{layout:"portalcolumn",layoutConfig:{margin:5,split:true},autoScroll:true,cls:"x-portal",defaultType:"portalcolumn",initComponent:function(){Ext.ux.Portal.superclass.initComponent.call(this);this.addEvents({validatedrop:true,beforedragover:true,dragover:true,beforedrop:true,drop:true,columnresize:true})},initEvents:function(){Ext.ux.Portal.superclass.initEvents.call(this);this.dd=new Ext.ux.Portal.DropZone(this,this.dropConfig)},beforeDestroy:function(){if(this.dd){this.dd.unreg()}Ext.ux.Portal.superclass.beforeDestroy.call(this)}});Ext.reg("portal",Ext.ux.Portal);Ext.ux.Portal.DropZone=function(a,b){this.portal=a;Ext.dd.ScrollManager.register(a.body);Ext.ux.Portal.DropZone.superclass.constructor.call(this,a.bwrap.dom,b);a.body.ddScrollConfig=this.ddScrollConfig};Ext.extend(Ext.ux.Portal.DropZone,Ext.dd.DropTarget,{ddScrollConfig:{vthresh:50,hthresh:-1,animate:true,increment:200},createEvent:function(a,f,d,b,h,g){return{portal:this.portal,panel:d.panel,columnIndex:b,column:h,position:g,data:d,source:a,rawEvent:f,status:this.dropAllowed}},notifyOver:function(v,t,w){var f=t.getXY();var a=this.portal;var n=v.proxy;if(!this.grid){this.grid=this.getGrid()}var b=a.body.dom.clientWidth;if(!this.lastCW){this.lastCW=b}else{if(this.lastCW!=b){this.lastCW=b;a.doLayout();this.grid=this.getGrid()}}var d=0;var l=this.grid.columnX;var m=false;for(var s=l.length;d<s;d++){if(f[0]<(l[d].x+l[d].w)){m=true;break}}if(!m){d--}var q;var k=false;var i=0;var u=a.items.itemAt(d);var o=u.items.items;var j=false;for(var s=o.length;i<s;i++){q=o[i];var r=q.el.getHeight();if(r===0){j=true}else{if((q.el.getY()+(r/2))>f[1]){k=true;break}}}i=(k&&q?i:u.items.getCount())+(j?-1:0);var g=this.createEvent(v,t,w,d,u,i);if(a.fireEvent("validatedrop",g)!==false&&a.fireEvent("beforedragover",g)!==false){n.getProxy().setWidth("auto");if(q){n.moveProxy(q.el.dom.parentNode,k?q.el.dom:null)}else{n.moveProxy(u.el.dom,null)}this.lastPos={c:u,col:d,p:j||(k&&q)?i:false};this.scrollPos=a.body.getScroll();a.fireEvent("dragover",g);return g.status}else{return g.status}},notifyOut:function(){delete this.grid},notifyDrop:function(k,g,f){delete this.grid;if(!this.lastPos){return}var i=this.lastPos.c;var b=this.lastPos.col;var j=this.lastPos.p;var a=this.createEvent(k,g,f,b,i,j!==false?j:i.items.getCount());if(this.portal.fireEvent("validatedrop",a)!==false&&this.portal.fireEvent("beforedrop",a)!==false){k.proxy.getProxy().remove();k.panel.el.dom.parentNode.removeChild(k.panel.el.dom);if(j!==false){if(i==k.panel.ownerCt&&(i.items.items.indexOf(k.panel)<=j)){j++}i.insert(j,k.panel)}else{i.add(k.panel)}i.doLayout();this.portal.fireEvent("drop",a);var l=this.scrollPos.top;if(l){var h=this.portal.body.dom;setTimeout(function(){h.scrollTop=l},10)}}delete this.lastPos},getGrid:function(){var a=this.portal.bwrap.getBox();a.columnX=[];this.portal.items.each(function(b){a.columnX.push({x:b.el.getX(),w:b.el.getWidth()})});return a},unreg:function(){Ext.ux.Portal.DropZone.superclass.unreg.call(this)}});
/* - PortalColumn.js - */
/*
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ux.PortalColumn=Ext.extend(Ext.Panel,{layout:"anchor",frame:false,border:false,closable:true,defaultType:"portlet",cls:"x-column-portal"});Ext.reg("portalcolumn",Ext.ux.PortalColumn);
/* - columnlayout-ux.js - */
Ext.layout.PortalColumnLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,extraCls:"x-column",scrollOffset:0,margin:0,split:false,fitHeight:false,isValidParent:function(b,a){return b.getEl().dom.parentNode==this.innerCt.dom},renderAll:function(a,b){if(this.split&&!this.splitBars){this.splitBars=[];this.margin=5}Ext.layout.PortalColumnLayout.superclass.renderAll.apply(this,arguments)},onLayout:function(g,m){var j=g.items.items,k=j.length,n,o,d;if(!this.innerCt){m.addClass("x-column-layout-ct");this.innerCt=m.createChild({cls:"x-column-inner",style:{position:"relative"}});this.innerCt.createChild({cls:"x-clear"})}this.renderAll(g,this.innerCt);var r=Ext.isIE&&m.dom!=Ext.getBody().dom?m.getStyleSize():m.getViewSize();if(r.width<1&&r.height<1){return}var p=r.width-m.getPadding("lr")-this.scrollOffset,e=r.height-m.getPadding("tb");var q=this.availableWidth=p;if(this.split){this.minWidth=Math.min(q/k,100);this.maxWidth=q-((this.minWidth+5)*(k?(k-1):1))}this.innerCt.setSize(p,this.fitHeight?e:undefined);if(this.fitHeight){this.innerCt.setSize(p,e)}else{this.innerCt.setWidth(p)}var f;for(d=0;d<k;d++){n=j[d];o=n.getEl();if(this.margin&&(d<(k-1))){o.setStyle("margin-right",this.margin+"px")}if(n.columnWidth){f=d}else{q-=(n.getSize().width+o.getMargins("lr"))}}var a=(q=q<0?0:q);var l=0;for(d=0;d<k;d++){n=j[d];o=n.getEl();if(n.columnWidth){var p=(d==f)?a:Math.floor(n.columnWidth*q);if(this.fitHeight){n.setSize(p-o.getMargins("lr"),e)}else{n.setWidth(p-o.getMargins("lr"))}a-=p}else{if(this.fitHeight){n.setHeight(e)}}if(this.split){var b=o.getWidth();if(d<(k-1)){l+=b;if(this.splitBars[d]){this.splitBars[d].el.setHeight(e)}else{this.splitBars[d]=new Ext.SplitBar(this.innerCt.createChild({cls:"x-layout-split x-layout-split-west",style:{top:"0px",left:l+"px",height:e+"px"}}),o);this.splitBars[d].index=d;this.splitBars[d].leftComponent=n;this.splitBars[d].addListener("resize",this.onColumnResize,this);this.splitBars[d].minSize=this.minWidth}l+=this.splitBars[d].el.getWidth()}delete n.columnWidth}}if(this.split){this.setMaxWidths()}},onColumnResize:function(j,g){if(j.dragSpecs.startSize){j.leftComponent.setWidth(g);var d=this.container.items.items;var f=g-j.dragSpecs.startSize;for(var e=j.index+1,a=d.length;f&&e<a;e++){var h=d[e];var b=h.el.getWidth();var g=b-f;if(g<this.minWidth){h.setWidth(this.minWidth)}else{if(g>this.maxWidth){f-=(g-this.maxWidth);h.setWidth(this.maxWidth)}else{h.setWidth(h.el.getWidth()-f);break}}}this.setMaxWidths();this.container.fireEvent("columnresize",this.container)}},setMaxWidths:function(){var a=this.container.items.items;var d=a[a.length-1].el.dom.offsetWidth-100;for(var b=a.length-2;b>-1;b--){var j=this.splitBars[b],f=j.el,h=a[b],e=h.el;var g=e.dom.offsetWidth;f.setStyle("left",(e.getX()-Ext.fly(e.dom.parentNode).getX()+g)+"px");j.maxSize=g+d;d=g-100}},onResize:function(){if(this.split){var b=this.container.items.items;if(b[0].rendered){var a=0;for(var d=0;d<b.length;d++){var e=b[d];a+=e.el.getWidth()+e.el.getMargins("lr")}for(var d=0;d<b.length;d++){var e=b[d];e.columnWidth=(e.el.getWidth()+e.el.getMargins("lr"))/a}}}Ext.layout.PortalColumnLayout.superclass.onResize.apply(this,arguments)}});Ext.Container.LAYOUTS.portalcolumn=Ext.layout.PortalColumnLayout;
/* - carousel.js - */
/*
 * Ext Core Library 3.0
 * http://extjs.com/
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * 
 * MIT Licensed - http://extjs.com/license/mit.txt
 */
Ext.ns("Ext.ux");Ext.ux.Carousel=Ext.extend(Ext.util.Observable,{interval:3,transitionDuration:1,transitionType:"carousel",transitionEasing:"easeOut",itemSelector:"img",activeSlide:0,autoPlay:false,showPlayButton:false,pauseOnNavigate:false,wrap:false,freezeOnHover:false,navigationOnHover:false,hideNavigation:false,width:null,height:null,constructor:function(b,a){a=a||{};Ext.apply(this,a);Ext.ux.Carousel.superclass.constructor.call(this,a);this.addEvents("beforeprev","prev","beforenext","next","change","play","pause","freeze","unfreeze");this.el=Ext.get(b);this.slides=this.els=[];if(this.autoPlay||this.showPlayButton){this.wrap=true}if(this.autoPlay&&typeof a.showPlayButton==="undefined"){this.showPlayButton=true}this.initMarkup();this.initEvents();if(this.carouselSize>0){this.refresh()}},initMarkup:function(){var b=Ext.DomHelper;this.carouselSize=0;var a=this.el.select(this.itemSelector);this.els.container=b.append(this.el,{cls:"ux-carousel-container"},true);this.els.slidesWrap=b.append(this.els.container,{cls:"ux-carousel-slides-wrap"},true);this.els.navigation=b.append(this.els.container,{cls:"ux-carousel-nav"},true).hide();this.els.caption=b.append(this.els.navigation,{tag:"h2",cls:"ux-carousel-caption"},true);this.els.navNext=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-next"},true);if(this.showPlayButton){this.els.navPlay=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-play"},true)}this.els.navPrev=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-prev"},true);this.slideWidth=this.width||this.el.getWidth(true);this.slideHeight=this.height||this.el.getHeight(true);this.els.container.setStyle({width:this.slideWidth+"px",height:this.slideHeight+"px"});this.els.caption.setWidth((this.slideWidth-(this.els.navNext.getWidth()*2)-(this.showPlayButton?this.els.navPlay.getWidth():0)-20)+"px");a.appendTo(this.els.slidesWrap).each(function(c){c=c.wrap({cls:"ux-carousel-slide"});this.slides.push(c);c.setWidth(this.slideWidth+"px").setHeight(this.slideHeight+"px")},this);this.carouselSize=this.slides.length;if(this.navigationOnHover){this.els.navigation.setStyle("top",(-1*this.els.navigation.getHeight())+"px")}this.el.clip()},initEvents:function(){this.els.navPrev.on("click",function(a){a.preventDefault();var b=a.getTarget();b.blur();if(Ext.fly(b).hasClass("ux-carousel-nav-disabled")){return}this.prev()},this);this.els.navNext.on("click",function(a){a.preventDefault();var b=a.getTarget();b.blur();if(Ext.fly(b).hasClass("ux-carousel-nav-disabled")){return}this.next()},this);if(this.showPlayButton){this.els.navPlay.on("click",function(a){a.preventDefault();a.getTarget().blur();if(this.playing){this.pause()}else{this.play()}},this)}if(this.freezeOnHover){this.els.container.on("mouseenter",function(){if(this.playing){this.fireEvent("freeze",this.slides[this.activeSlide]);Ext.TaskMgr.stop(this.playTask)}},this);this.els.container.on("mouseleave",function(){if(this.playing){this.fireEvent("unfreeze",this.slides[this.activeSlide]);Ext.TaskMgr.start(this.playTask)}},this,{buffer:(this.interval/2)*1000})}if(this.navigationOnHover){this.els.container.on("mouseenter",function(){if(!this.navigationShown){this.navigationShown=true;this.els.navigation.stopFx(false).shift({y:this.els.container.getY(),duration:this.transitionDuration})}},this);this.els.container.on("mouseleave",function(){if(this.navigationShown){this.navigationShown=false;this.els.navigation.stopFx(false).shift({y:this.els.navigation.getHeight()-this.els.container.getY(),duration:this.transitionDuration})}},this)}if(this.interval&&this.autoPlay){this.play()}},prev:function(){if(this.fireEvent("beforeprev")===false){return}if(this.pauseOnNavigate){this.pause()}this.setSlide(this.activeSlide-1);this.fireEvent("prev",this.activeSlide);return this},next:function(){if(this.fireEvent("beforenext")===false){return}if(this.pauseOnNavigate){this.pause()}this.setSlide(this.activeSlide+1);this.fireEvent("next",this.activeSlide);return this},play:function(){if(!this.playing){this.playTask=this.playTask||{run:function(){this.playing=true;this.setSlide(this.activeSlide+1)},interval:this.interval*1000,scope:this};this.playTaskBuffer=this.playTaskBuffer||new Ext.util.DelayedTask(function(){Ext.TaskMgr.start(this.playTask)},this);this.playTaskBuffer.delay(this.interval*1000);this.playing=true;if(this.showPlayButton){this.els.navPlay.addClass("ux-carousel-playing")}this.fireEvent("play")}return this},pause:function(){if(this.playing){Ext.TaskMgr.stop(this.playTask);this.playTaskBuffer.cancel();this.playing=false;if(this.showPlayButton){this.els.navPlay.removeClass("ux-carousel-playing")}this.fireEvent("pause")}return this},clear:function(){this.els.slidesWrap.update("");this.slides=[];this.carouselSize=0;this.pause();return this},add:function(b,a){var c=Ext.fly(b).appendTo(this.els.slidesWrap).wrap({cls:"ux-carousel-slide"});c.setWidth(this.slideWidth+"px").setHeight(this.slideHeight+"px");this.slides.push(c);if(a){this.refresh()}return this},refresh:function(){this.carouselSize=this.slides.length;this.els.slidesWrap.setWidth((this.slideWidth*this.carouselSize)+"px");if(this.carouselSize>0){if(!this.hideNavigation){this.els.navigation.show()}this.activeSlide=0;this.setSlide(0,true)}return this},setSlide:function(b,a){if(!this.wrap&&!this.slides[b]){return}else{if(this.wrap){if(b<0){b=this.carouselSize-1}else{if(b>this.carouselSize-1){b=0}}}}if(!this.slides[b]){return}this.els.caption.update(this.slides[b].child(":first-child",true).title||"");var d=b*this.slideWidth;if(!a){switch(this.transitionType){case"fade":this.slides[b].setOpacity(0);this.slides[this.activeSlide].stopFx(false).fadeOut({duration:this.transitionDuration/2,callback:function(){this.els.slidesWrap.setStyle("left",(-1*d)+"px");this.slides[this.activeSlide].setOpacity(1);this.slides[b].fadeIn({duration:this.transitionDuration/2})},scope:this});break;default:var c=(-1*d)+this.els.container.getX();this.els.slidesWrap.stopFx(false);this.els.slidesWrap.shift({duration:this.transitionDuration,x:c,easing:this.transitionEasing});break}}else{this.els.slidesWrap.setStyle("left","0")}this.activeSlide=b;this.updateNav();this.fireEvent("change",this.slides[b],b)},updateNav:function(){this.els.navPrev.removeClass("ux-carousel-nav-disabled");this.els.navNext.removeClass("ux-carousel-nav-disabled");if(!this.wrap){if(this.activeSlide===0){this.els.navPrev.addClass("ux-carousel-nav-disabled")}if(this.activeSlide===this.carouselSize-1){this.els.navNext.addClass("ux-carousel-nav-disabled")}}}});
/* - XCheckbox.js - */
Ext.ns("Ext.ux.form");Ext.ux.form.XCheckbox=Ext.extend(Ext.form.Checkbox,{offCls:"xcheckbox-off",onCls:"xcheckbox-on",disabledClass:"xcheckbox-disabled",submitOffValue:"false",submitOnValue:"true",checked:false,hiddenName:null,onRender:function(c){Ext.ux.form.XCheckbox.superclass.onRender.apply(this,arguments);var a=this.el.dom.tabIndex;var d=this.el.dom.id;this.el.remove();this.el=c.createChild({tag:"input",type:"hidden",name:this.hiddenName||this.name,id:d});if(!this.checked){this.checked=this.value===this.submitOnValue}this.updateHidden();this.wrap.replaceClass("x-form-check-wrap","xcheckbox-wrap");this.cbEl=this.wrap.createChild({tag:"a",cls:this.checked?this.onCls:this.offCls});var b=this.wrap.down("label");if(b){this.wrap.appendChild(b)}if(this.tooltip){this.cbEl.set({qtip:this.tooltip})}this.wrap.on({click:{scope:this,fn:this.onClick,delegate:"a"}});this.wrap.on({keyup:{scope:this,fn:this.onClick,delegate:"a"}});this.cbEl.dom.tabIndex=a},onClick:function(a){if(this.disabled||this.readOnly){return}if(!a.isNavKeyPress()){this.setValue(!this.checked)}},onDisable:function(){this.cbEl.addClass(this.disabledClass);this.el.dom.disabled=true},onEnable:function(){this.cbEl.removeClass(this.disabledClass);this.el.dom.disabled=false},setValue:function(a){if("string"==typeof a){this.checked=a===this.submitOnValue}else{this.checked=!(!a)}if(this.rendered&&this.cbEl){this.updateHidden();this.cbEl.removeClass([this.offCls,this.onCls]);this.cbEl.addClass(this.checked?this.onCls:this.offCls)}this.fireEvent("check",this,this.checked)},updateHidden:function(){this.el.dom.value=this.checked?this.submitOnValue:this.submitOffValue},getValue:function(){return this.checked}});Ext.reg("xcheckbox",Ext.ux.form.XCheckbox);
/* - anz_widget.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.base=Ext.extend(Ext.Panel,{draggable:true,loaded:false,maxRetryTimes:6,options:null,retried:0,cls:"x-widget",frame:false,style:"margin: 5px 0 0",initComponent:function(){Anz.widget.base.superclass.initComponent.call(this);var a=this.initialConfig;this.options=a.options;this.portalUrl=a.portalUrl;this.contextUrl=a.contextUrl;this.on({render:{scope:this,fn:function(b){if(!this.collapsed){this.display()}}},expand:{scope:this,fn:function(b){if(!this.loaded){this.display()}}}})},getCommonPreferences:function(){return[{xtype:"textfield",name:"title",fieldLabel:_("Title"),value:"Widget title"},{xtype:"xcheckbox",name:"showTitle",fieldLabel:_("Show title?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"showTitle:int"}]},getCustomisePreferences:function(){return[]},getPreferences:function(){return this.getCommonPreferences().concat(this.getCustomisePreferences())},updateOptions:function(a){},display:function(){},retryDisplay:function(){if(!this.loaded){if(this.retried<this.maxRetryTimes){this.retried+=1;this.display.defer(Math.pow(2,this.retried)*1000,this)}else{this.body.update(_("Sorry, we can not get data successfully now, you should refresh the whole page later to try again."))}}},getValue:function(b){var a=this.options[b];if(a===undefined){a=this.getDefaultValues()[b]}return a},getDefaultValues:function(){return{}}});
/* - widget_static_text.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.staticText=Ext.extend(Anz.widget.base,{bodyStyle:"padding: 5px",iconCls:"widget_postit_icon",getCustomisePreferences:function(){return[{xtype:"htmleditor",name:"text",fieldLabel:_("body"),value:_("Type text here")}]},updateOptions:function(a){this.options=a;this.setTitle(Utf8.decode(a.title));this.display()},display:function(){var a=this.getValue("text");if(!a){a=_("Type text here")}this.body.update(Utf8.decode(a))},convertTextToHTML:function(a){a=a.replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>").replace(/  /g,"&nbsp; ");return a},convertHTMLToText:function(a){a=a.replace(/\&amp;/g,"&").replace(/\&lt;/g,"<").replace(/&gt;/g,">").replace(/<br>/g,"\n").replace(/\&nbsp;/g," ");return a}});Ext.reg("widget_static_text",Anz.widget.staticText);
/* - widget_rss.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.rss=Ext.extend(Anz.widget.base,{bodyStyle:"padding: 5px",iconCls:"widget_rss_icon",entries:[],page:0,pageCount:1,count:null,getCustomisePreferences:function(){return[{xtype:"textfield",name:"feed",fieldLabel:_("Feed"),value:""},{xtype:"xcheckbox",name:"paging",fieldLabel:_("Paging?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"paging:int"},{xtype:"numberfield",name:"count",fieldLabel:_("Count"),value:5,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Normal",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Normal",_("Normal")],["Magazine",_("Magazine")],["Slideshow",_("Slideshow")],["Headline",_("Headline")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{count:5,paging:1,view:"Normal"}},updateOptions:function(d){var b=this.options;this.options=d;this.count=parseInt(this.getValue("count"));this.setTitle(Utf8.decode(this.getValue("title")));if(!this.collapsed){var e=b.feed;var c=b.view;var a=b.paging;if(e!==this.getValue("feed")){this.display()}else{if(c!==this.getValue("view")||a!==this.getValue("paging")){if(this.loaded){this.buildContents()}else{this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');this.loaded=false;var b=this.getValue("feed");var a=this.getValue("count");Ext.Ajax.request({url:this.initialConfig.contextUrl+"/@@rssWidget/entries",method:"POST",params:{url:b,"count:int":a},timeout:5000,scope:this,success:function(c,e){var d=Ext.decode(c.responseText);if(d.success){this.entries=d.entries;this.count=parseInt(this.getValue("count"));this.pageCount=Math.ceil(d.entries.length/this.count);this.buildContents();this.loaded=true}else{if(d.msg){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(c,e){var d=c.responseText;if(d){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachPagingHandler:function(){var a=this.body.child("a[class=prePage]");if(a){a.on("click",this.prePage,this)}var b=this.body.child("a[class=nextPage]");if(b){b.on("click",this.nextPage,this)}},prePage:function(){this.page-=1;this.buildContents()},nextPage:function(){this.page+=1;this.buildContents()},buildContents:function(){var c="";var a=this.getValue("view");switch(a){case"Normal":c=this.buildNormalHtml();break;case"Magazine":c=this.buildMagazineHtml();break;case"Slideshow":c=this.buildSlideshowHtml();break;case"Headline":c=this.buildHeadlineHtml();break;default:c=this.buildNormalHtml()}var d=this.getValue("paging")&&(this.pageCount>1)&&(a!=="Slideshow");if(d){c+='<div class="paging-bottom">';if(this.page!==0){c+=String.format('<a class="prePage" href="javascript:;">{0}</a>',_("prev"))}if(this.page<this.pageCount-1){c+=String.format('<a class="nextPage" href="javascript:;">{0}</a>',_("next"))}c+="<div>"}this.body.update(c);if(a==="Slideshow"){var b=this.getId()+"_slideshow";new Ext.ux.Carousel(b,{itemSelector:"div.item",interval:10,autoPlay:true,transitionEasing:"easeIn"})}if(d){this.attachPagingHandler()}},buildNormalHtml:function(){var h=this.page*this.count;var c=this.entries.slice(h,h+this.count);var f='<ul class="feedList">';var b=new Ext.Template("<li>",'<a href="{link}" title="{desc}" target="_blank">','{title}<span class="feedItemDate"> - {date}</span>',"</a>","</li>");for(var e=0,a=c.length;e<a;++e){var g=c[e];var d=this.convertDate(g.updated);f+=b.applyTemplate({title:g.title,desc:g.summary,link:g.link,date:this.getTimeDiff(d)})}f+="</ul>";return f},buildMagazineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="magazineView">'];var f=new Ext.Template('<div class="left">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="article">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"<p>{desc}</p>","</div>","</div>");var c=e[0];var j=this.convertDate(c.updated);d.push(f.applyTemplate({title:c.title,desc:c.summary,img:this.portalUrl+"/default_news.png",link:c.link,date:this.getTimeDiff(j)}));d.push('<div class="right">');var h=new Ext.Template('<div class="item">','<div class="thumbnail">','<img height="50" width="50" src="{img}"/>',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"</div>",'<div class="description">',"<p>{desc}</p>","</div>","</div>");for(var b=1,g=e.length;b<g;++b){var k=e[b];var j=this.convertDate(k.updated);d.push(h.applyTemplate({title:k.title,desc:k.summary,img:this.portalUrl+"/default_news.png",link:k.link,date:this.getTimeDiff(j)}))}d.push("</div></div>");return d.join("")},buildSlideshowHtml:function(){var c=this.entries;var d=this.getId()+"_slideshow";var g=[String.format('<div class="slideshowView" id="{0}">',d)];var b=new Ext.Template('<div class="item">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="content">','<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>',"</div>",'<div class="description">','<small class="feedItemDate">{date}</small>',"<p>{desc}</p>","</div>","</div>","</div>");for(var f=0,a=c.length;f<a;++f){var h=c[f];var e=this.convertDate(h.updated);g.push(b.applyTemplate({img:this.portalUrl+"/default_news.png",title:h.title,desc:h.summary,link:h.link,date:this.getTimeDiff(e)}))}g.push("</div>");return g.join("")},buildHeadlineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="headlineView">'];var f=new Ext.Template('<div class="top">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"</div>","</div>",'<div class="middle odd">','<div class="description">{desc}</div>',"</div>");var c=e[0];var j=this.convertDate(c.updated);d.push(f.applyTemplate({img:this.portalUrl+"/default_news.png",title:c.title,desc:c.summary,link:c.link,date:this.getTimeDiff(j)}));d.push('<ul class="bottom">');var h=new Ext.Template('<li class="item {cls}">','<div class="thumbnail">','<img height="50" width="50" src="{img}">',"</div>",'<h3><a href="{link}" target="_blank">{title}<small class="feedItemDate">{date}</small></a></h3>','<p class="description">{desc}</p>',"</li>");for(var b=1,g=e.length;b<g;++b){var k=e[b];var j=this.convertDate(k.updated);d.push(h.applyTemplate({cls:b%2?"even":"odd",img:this.portalUrl+"/default_news.png",title:k.title,desc:k.summary,link:k.link,date:this.getTimeDiff(j)}))}d.push("</ul></div>");return d.join("")},convertDate:function(a){var b=null;if(a){b=a.split("-").join("/")}return b},getTimeDiff:function(e){if(!e){return""}var d=new Date(e);var h=new Date();var c=h.valueOf()-d.valueOf();var i=c/86400000;i=parseInt(i);c=c-(i*86400000);var f=c/3600000;f=parseInt(f);c=c-(f*3600000);var b=c/60000;b=parseInt(b);c=c-(b*60000);var g=c/1000;g=parseInt(g);var a="";if(i>0){a=i+_("days before")}else{if(f>0){a=f+_("hours before")}else{if(b>0){a=b+_("minutes before")}}}return a}});Ext.reg("widget_rss",Anz.widget.rss);
/* - widget_weather.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.weather=Ext.extend(Anz.widget.base,{iconCls:"widget_weather_icon",getCustomisePreferences:function(){return[{xtype:"widget.weather.woeidfield",name:"woeid",fieldLabel:_("City"),value:""},{xtype:"combo",name:"units",hiddenName:"units",fieldLabel:_("Units"),value:"c",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["c",_("Celsius")],["f",_("Fahrenheit")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Compact",_("Compact")],["Today",_("Today")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},updateOptions:function(c){var a=this.options;this.options=c;this.setTitle(Utf8.decode(c.title));if(!this.collapsed){var d=a.woeid;var e=a.units;var b=a.view;if(d!==c.woeid){this.display()}else{if(e!==c.units){this.display()}else{if(b!==c.view){this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');var a=this.getValue("feed");Ext.Ajax.request({url:this.contextUrl+"/@@weatherWidget/weather",method:"POST",params:{woeid:this.options.woeid,units:this.options.units},timeout:5000,scope:this,success:function(b,f){var d=Ext.decode(b.responseText);if(d.success){var g=d.info;var c=this.options.view;var e=this.buildContents(g,c);this.body.update(e);this.loaded=true}else{if(d.msg){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(b,d){var c=b.responseText;if(c){this.body.update(c.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},buildContents:function(a,b){var c=null;switch(b){case"Compact":c=this.buildCompactHtml(a);break;case"Today":c=this.buildTodayHtml(a);break;default:c=this.buildTodayHtml(a)}return c},buildTodayHtml:function(b){var a=new Ext.Template('<div class="yw-forecast">','<div class="yw-loc">','<a target="_blank" href="{link}">{location}</a>',"</div>",'<div class="yw-date">{time}</div>','<div class="yw-cond">{condition_text}</div>',"<dl>","<dt>{Feels_Like}:</dt><dd>{temp}&deg;{temp_unit}</dd>","<dt>{Barometer}:</dt><dd>{pressure} {pressure_unit}</dd>","<dt>{Humidity}:</dt><dd>{humidity} %</dd>","<dt>{Visibility}:</dt><dd>{visibility} {visibility_unit}</dd>","<dt>{Wind}:</dt><dd>{wind_direction} {wind_speed} {speed_unit}</dd>","<dt>{Sunrise}:</dt><dd>{sunrise}</dd>","<dt>{Sunset}:</dt><dd>{sunset}</dd>","</dl>",'<div class="forecast-icon" style="background: transparent url(images/weather/{code}d-s.png) no-repeat scroll 0% 0%;"></div>','<div class="forecast-temp">','<div class="yw-temp">{temp}&deg;</div>',"<p>{High}: {high_temp}&deg; {Low}: {low_temp}&deg;</p>","</div>","</div>");return a.applyTemplate({Feels_Like:_("Feels Like"),Barometer:_("Barometer"),Humidity:_("Humidity"),Visibility:_("Visibility"),Wind:_("Wind"),Sunrise:_("Sunrise"),Sunset:_("Sunset"),High:_("High"),Low:_("Low"),location:b.location.city+","+b.location.country,time:b.condition.date,condition_text:this._conditionMap()[b.condition.code],temp:b.condition.temp,temp_unit:b.units.temperature,pressure:b.atmosphere.pressure,pressure_unit:b.units.pressure,humidity:b.atmosphere.humidity,visibility:b.atmosphere.visibility,visibility_unit:b.units.distance,wind_direction:b.wind.direction,wind_speed:b.wind.speed,speed_unit:b.units.speed,sunrise:b.astronomy.sunrise,sunset:b.astronomy.sunset,high_temp:b.forecast[0].high,low_temp:b.forecast[0].low,code:b.condition.code,link:b.link,Detailed_Forecast:_("Detailed Forecast")})},buildCompactHtml:function(b){var a=new Ext.Template('<div class="weather-compact">','<div class="yw-loc">','<a target="_blank" href="{link}">{location}</a>',"</div>",'<div class="today-weather">','<div class="weather-icon">','<img src="images/weather/{today_code}d-s.png" title="{today_code_text}" alt="{condition_text}">',"</div>",'<div class="weather-text">','<span class="weather-day">{today_date}<br>{today_weekday}</span>','<span class="weather-temp">{today_low_temp}/{today_high_temp}&deg;</span>',"</div>","</div>",'<div class="tomorrow-weather">','<div class="weather-icon">','<img src="images/weather/{next_code}d-s.png" title="{next_code_text}" alt="{next_code_text}">',"</div>",'<div class="weather-text">','<span class="weather-day">{next_weekday}</span>','<span class="weather-temp">{next_low_temp}/{next_high_temp}&deg;</span>',"</div>","</div>","</div>");return a.applyTemplate({link:b.link,location:b.location.city+","+b.location.country,today_code:b.forecast[0].code,today_code_text:this._conditionMap()[b.forecast[0].code],today_low_temp:b.forecast[0].low,today_high_temp:b.forecast[0].high,today_date:b.forecast[0].date,today_weekday:_(b.forecast[0].day),next_code:b.forecast[1].code,next_code_text:this._conditionMap()[b.forecast[1].code],next_low_temp:b.forecast[1].low,next_high_temp:b.forecast[1].high,next_date:b.forecast[1].date,next_weekday:_(b.forecast[1].day)})},_conditionMap:function(){return{"0":_("Tornado"),"1":_("Tropical storm"),"2":_("Hurricane"),"3":_("Severe thunderstorms"),"4":_("Thunderstorms"),"5":_("Mixed rain and snow"),"6":_("Mixed rain and sleet"),"7":_("Mixed snow and sleet"),"8":_("Freezing drizzle"),"9":_("Drizzle"),"10":_("Freezing rain"),"11":_("Showers"),"12":_("Showers"),"13":_("Snow flurries"),"14":_("Light snow showers"),"15":_("Blowing snow"),"16":_("Snow"),"17":_("Hail"),"18":_("Sleet"),"19":_("Dust"),"20":_("Foggy"),"21":_("Haze"),"22":_("Smoky"),"23":_("Blustery"),"24":_("Windy"),"25":_("Cold"),"26":_("Cloudy"),"27":_("Mostly cloudy"),"28":_("Mostly cloudy"),"29":_("Partly cloudy"),"30":_("Partly cloudy"),"31":_("Clear"),"32":_("Sunny"),"33":_("Fair"),"34":_("Fair"),"35":_("Mixed rain and hail"),"36":_("Hot"),"37":_("Isolated thunderstorms"),"38":_("Scattered thunderstorms"),"39":_("Scattered thunderstorms"),"40":_("Scattered showers"),"41":_("Heavy snow"),"42":_("Scattered snow showers"),"43":_("Heavy snow"),"44":_("Partly cloudy"),"45":_("Thundershowers"),"46":_("Snow showers"),"47":_("Isolated thundershowers")}}});Ext.reg("widget_weather",Anz.widget.weather);Anz.widget.weather.woeidfield=function(b){var c=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:"http://where.yahooapis.com/v1",listeners:{beforeload:{scope:this,fn:function(e,f){e.setApi(Ext.data.Api.actions.read,String.format("http://where.yahooapis.com/v1/places.q({0});count=0?format=json&appid=1dIus9DV34GjOFTpNt_pwV465FOtJItUDeDMDR2bLWox6hTqUHPrVtvCnvDBfYg-",f.query))}}}}),reader:new Ext.data.JsonReader({root:"places.place",id:"woeid"},[{name:"woeid",mapping:"woeid"},{name:"name",mapping:"name"}])});var d=new Ext.XTemplate('<tpl for="."><div class="search-item">',"<h3><span>{woeid}-{name}</span></h3>","</div></tpl>");var a={store:c,displayField:"title",typeAhead:false,loadingText:"Searching...",width:570,hideTrigger:true,tpl:d,itemSelector:"div.search-item",listeners:{select:{scope:this,fn:function(g,e,f){g.setValue(e.get("woeid"))}}}};if(b){Ext.apply(a,b)}Ext.apply(this,a);Anz.widget.weather.woeidfield.superclass.constructor.apply(this,arguments)};Ext.extend(Anz.widget.weather.woeidfield,Ext.form.ComboBox,{});Ext.reg("widget.weather.woeidfield",Anz.widget.weather.woeidfield);
/* - widget_calendar.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.calendar=Ext.extend(Anz.widget.base,{iconCls:"widget_calendar_icon",bodyStyle:"padding: 5px",view:"Month",tips:[],tipsCfg:[],getCustomisePreferences:function(){return[{xtype:"combo",name:"weekStart",hiddenName:"weekStart",fieldLabel:_("Start day of week"),value:"Mon",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Sun",_("Sun")],["Mon",_("Mon")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Month",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Month",_("Month")],["Week",_("Week")],["Agenda",_("Agenda")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{view:"Month",weekStart:"Mon"}},updateOptions:function(c){var a=this.options;this.options=c;this.setTitle(Utf8.decode(c.title));if(!this.collapsed){var d=a.weekStart;var b=a.view;if(d!==c.weekStart){this.display()}else{if(b!==c.view){this.display()}}}},display:function(c){this.body.update('<div class="loading-indicator">Loading...</div>');if(!c){c=new Date()}this.view=this.getValue("view");this.weekStart=this.getValue("weekStart");var d=null;var a=null;switch(this.view){case"Month":d=c.getFirstDateOfMonth();a=c.getLastDateOfMonth();break;case"Week":case"Agenda":var b=c.format("w");if(this.weekStart=="Sun"){d=c.add(Date.DAY,-b)}else{if(b==0){d=c.add(Date.DAY,-6)}else{d=c.add(Date.DAY,1-b)}}a=d.add(Date.DAY,6);break;default:break}Ext.Ajax.request({url:this.contextUrl+"/@@mergedRequest/getMergedData",method:"POST",params:{"requests:list":["events@@calendarWidget/events?start:date="+d.format("Y/m/d")+"&end:date="+a.format("Y/m/d"),"stateStr@@calendarWidget/getReviewStateString"]},timeout:5000,scope:this,success:function(f,i){var g=Ext.decode(f.responseText);var j=g.events;if(j.success){this.eventsInfo=j.events;this.startDate=d;var e=g.stateStr;if(e.success){this.stateStr=e.stateStr}var h=this.buildContents();this.destroyEventTips();this.body.update(h);this.createEventTips();this.attachListener();this.loaded=true}else{if(g.msg){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(e,g){var f=e.responseText;if(f){this.body.update(f.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachListener:function(){var a=this.view;switch(a){case"Month":this.buildMonthListener();break;case"Week":case"Agenda":this.buildWeekListener();break;default:break}},destroyEventTips:function(){var b=this.tips;for(var c=0,a=b.length;c<a;++c){Ext.QuickTips.unregister(b[c].target)}this.tips=[]},createEventTips:function(){var e=this.tipsCfg;for(var c=0,a=e.length;c<a;++c){var b=e[c];var d=new Ext.ToolTip({target:b.target,title:_("Events in this day"),width:"auto",dismissDelay:0,html:b.html,trackMouse:true});this.tips.push(d)}this.tipsCfg=[]},buildMonthListener:function(){var a=this.body.child("a[class=preTimeCycle]");a.on("click",this.preMonth,this);var b=this.body.child("a[class=nextTimeCycle]");b.on("click",this.nextMonth,this)},preMonth:function(){var a=this.startDate.add(Date.MONTH,-1);this.display(a)},nextMonth:function(){var a=this.startDate.add(Date.MONTH,1);this.display(a)},buildWeekListener:function(){var b=this.body.child("a[class=preTimeCycle]");b.on("click",this.preWeek,this);var a=this.body.child("a[class=nextTimeCycle]");a.on("click",this.nextWeek,this)},preWeek:function(){var a=this.startDate.add(Date.DAY,-7);this.display(a)},nextWeek:function(){var a=this.startDate.add(Date.DAY,7);this.display(a)},buildContents:function(){var a=this.view;var b=null;switch(a){case"Month":b=this.buildMonthHtml();break;case"Week":b=this.buildWeekHtml();break;case"Agenda":b=this.buildAgendaHtml();break;default:b=this.buildMonthHtml()}return b},buildMonthHtml:function(){var d=this.eventsInfo;var u=this.weekStart;var e=this.startDate;var m=e.getFirstDayOfMonth();var f=e.getLastDayOfMonth();var q=0;var s=0;if(u==="Sun"){q=m;s=6-f}else{if(m===0){q=6;s=0}else{q=m-1;s=7-f}}var r=e.getDaysInMonth();var h=[];for(var z=0;z<q;++z){h.push(0)}for(var z=1;z<=r;++z){h.push(z)}for(var z=0;z<s;++z){h.push(0)}var l=[];var y=new Ext.Template('<div class="calendar_month_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{month}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<table class="calendar_table">',"<thead><tr>",'<td class="theader">{day1}</td>','<td class="theader">{day2}</td>','<td class="theader">{day3}</td>','<td class="theader">{day4}</td>','<td class="theader">{day5}</td>','<td class="theader">{day6}</td>','<td class="theader">{day7}</td>',"</tr></thead>","<tbody>");if(u==="Sun"){l.push(y.applyTemplate({month:e.format("Y-m"),day1:_("Sun"),day2:_("Mon"),day3:_("Tue"),day4:_("Wed"),day5:_("Thu"),day6:_("Fri"),day7:_("Sat")}))}else{l.push(y.applyTemplate({month:e.format("Y-m"),day1:_("Mon"),day2:_("Tue"),day3:_("Wed"),day4:_("Thu"),day5:_("Fri"),day6:_("Sat"),day7:_("Sun")}))}var a=new Ext.Template('<td class="{dateCls}" id="date_{id}">{day}</td>');var C=new Ext.Template('<td class="{dateCls}" id="date_{id}">','<a target="_blank" href="{url}">{day}</a>','<img index="0" class="event" src="ext3/resources/images/default/s.gif">',"</td>");var w=new Ext.Template('<div class="eventCls"><h6>{title}   {start}-{end}</h6><p>{desc}</p></div>');for(var z=0,A=h.length;z<A;++z){if((z%7)==0){l.push("<tr>")}var x=h[z];if(x==0){l.push('<td class="blank_day"></td>')}else{var o=e.add(Date.DAY,x-1);var n=o.format("w");var p=false;if(n==0||n==6){p=true}var c=d[o.format("Ymd")];var g=c&&c.length;if(g){var b=o.format("Y/m/d");l.push(C.applyTemplate({dateCls:p?"weekend":"",id:o.format("Y_m_d"),day:x,url:this.portalUrl+"/search?"+this.stateStr+"start.query:record:list:date="+b+"+23%3A59%3A59&amp;start.range:record=max&amp;end.query:record:list:date="+b+"+00%3A00%3A00&amp;end.range:record=min"}));var t=[];for(var v=0,k=c.length;v<k;++v){var B=c[v];t.push(w.applyTemplate({title:B.title,start:B.start,end:B.end,desc:B.desc}))}this.tipsCfg.push({target:"date_"+o.format("Y_m_d"),html:t.join("")})}else{l.push(a.applyTemplate({dateCls:p?"weekend":"",id:o.format("Y_m_d"),day:x}))}}if((z%7)==6){l.push("</tr>")}}l.push("</tbody></table></div>");return l.join("")},buildWeekHtml:function(){var b=this.eventsInfo;var n=this.weekStart;var e=this.startDate;var d=e.add(Date.DAY,6);var h=[];var r=new Ext.Template('<div class="calendar_week_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{range}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<table class="calendar_table">',"<thead><tr>",'<td class="theader">{day1}</td>','<td class="theader">{day2}</td>','<td class="theader">{day3}</td>','<td class="theader">{day4}</td>','<td class="theader">{day5}</td>','<td class="theader">{day6}</td>','<td class="theader">{day7}</td>',"</tr></thead>","<tbody>");if(n==="Sun"){h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d"),day1:_("Sun"),day2:_("Mon"),day3:_("Tue"),day4:_("Wed"),day5:_("Thu"),day6:_("Fri"),day7:_("Sat")}))}else{h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d"),day1:_("Mon"),day2:_("Tue"),day3:_("Wed"),day4:_("Thu"),day5:_("Fri"),day6:_("Sat"),day7:_("Sun")}))}var a=new Ext.Template('<td class="weekDay {dateCls}" id="date_{id}">{day}</td>');var u=new Ext.Template('<td class="weekDay {dateCls}" id="date_{id}">','<a target="_blank" href="{url}">{day}</a>','<img index="0" class="event" src="ext3/resources/images/default/s.gif">',"</td>");var q=new Ext.Template('<div class="eventCls"><h6>{title}   {start}-{end}</h6><p>{desc}</p></div>');for(var s=0;s<7;++s){var l=e.add(Date.DAY,s);var k=l.format("w");var m=false;if(k==0||k==6){m=true}var c=b[l.format("Ymd")];var f=c&&c.length;if(f){h.push(u.applyTemplate({dateCls:m?"weekend":"",id:l.format("Y_m_d"),day:l.format("d"),url:""}));var o=[];for(var p=0,g=c.length;p<g;++p){var t=c[p];o.push(q.applyTemplate({title:t.title,start:t.start,end:t.end,desc:t.desc}))}this.tipsCfg.push({target:"date_"+l.format("Y_m_d"),html:o.join("")})}}h.push("</tbody></table></div>");return h.join("")},buildAgendaHtml:function(){var b=this.eventsInfo;var o=this.weekStart;var e=this.startDate;var d=e.add(Date.DAY,6);var h=[];var r=new Ext.Template('<div class="calendar_week_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{range}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<div class="">');h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d")}));var q=new Ext.Template('<div class="{eventCls}">','<span class="{dateCls}">{date}</span>','<span class="dayCls">{day}</span>','<a target="_blank" href="{url}" title="{desc}">{title}</a>',"</div>");var u=new Ext.Template('<div class="{eventCls}">','<span class="dateCls">{date}</span>','<span class="dayCls">{day}</span>','<span class="hint">{title}</span>',"</div>");for(var s=0;s<7;++s){var m=e.add(Date.DAY,s);var k=m.format("w");var n=false;if(k==0||k==6){n=true}var l=m.format("Y/m/d");var a=m.format("D");var c=b[m.format("Ymd")];var f=c&&c.length;if(f){for(var p=0,g=c.length;p<g;++p){var t=c[p];h.push(q.applyTemplate({eventCls:n?"eventItem weekend":"eventItem",dateCls:p==0?"dateCls":"dateHidden",dayCls:p==0?"dayCls":"dayHidden",date:l,day:_(a),url:t.url,title:t.title,desc:t.start+"-"+t.end+"    "+t.title}))}}else{h.push(u.applyTemplate({eventCls:n?"eventItem weekend":"eventItem",date:l,day:_(a),title:_("No event today.")}))}}h.push("</div></div>");return h.join("")}});Ext.reg("widget_calendar",Anz.widget.calendar);
/* - MultiSelect.js - */
/*
 * Ext JS Library 3.1.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ns("Ext.ux.form");Ext.ux.form.MultiSelect=Ext.extend(Ext.form.Field,{ddReorder:false,appendOnly:false,width:100,height:100,displayField:0,valueField:1,allowBlank:true,minSelections:0,maxSelections:Number.MAX_VALUE,blankText:Ext.form.TextField.prototype.blankText,minSelectionsText:"Minimum {0} item(s) required",maxSelectionsText:"Maximum {0} item(s) allowed",delimiter:",",defaultAutoCreate:{tag:"div"},initComponent:function(){Ext.ux.form.MultiSelect.superclass.initComponent.call(this);if(Ext.isArray(this.store)){if(Ext.isArray(this.store[0])){this.store=new Ext.data.ArrayStore({fields:["value","text"],data:this.store});this.valueField="value"}else{this.store=new Ext.data.ArrayStore({fields:["text"],data:this.store,expandData:true});this.valueField="text"}this.displayField="text"}else{this.store=Ext.StoreMgr.lookup(this.store)}this.addEvents({dblclick:true,click:true,change:true,drop:true})},onRender:function(c,b){Ext.ux.form.MultiSelect.superclass.onRender.call(this,c,b);var a=this.fs=new Ext.form.FieldSet({renderTo:this.el,title:this.legend,height:this.height,width:this.width,style:"padding:0;",tbar:this.tbar});a.body.addClass("ux-mselect");this.view=new Ext.ListView({multiSelect:true,store:this.store,columns:[{header:"Value",width:1,dataIndex:this.displayField}],hideHeaders:true});a.add(this.view);this.view.on("click",this.onViewClick,this);this.view.on("beforeclick",this.onViewBeforeClick,this);this.view.on("dblclick",this.onViewDblClick,this);this.hiddenName=this.name||Ext.id();var d={tag:"input",type:"hidden",value:"",name:this.hiddenName};this.hiddenField=this.el.createChild(d);this.hiddenField.dom.disabled=this.hiddenName!=this.name;a.doLayout()},afterRender:function(){Ext.ux.form.MultiSelect.superclass.afterRender.call(this);if(this.ddReorder&&!this.dragGroup&&!this.dropGroup){this.dragGroup=this.dropGroup="MultiselectDD-"+Ext.id()}if(this.draggable||this.dragGroup){this.dragZone=new Ext.ux.form.MultiSelect.DragZone(this,{ddGroup:this.dragGroup})}if(this.droppable||this.dropGroup){this.dropZone=new Ext.ux.form.MultiSelect.DropZone(this,{ddGroup:this.dropGroup})}},onViewClick:function(c,a,b,d){this.fireEvent("change",this,this.getValue(),this.hiddenField.dom.value);this.hiddenField.dom.value=this.getValue();this.fireEvent("click",this,d);this.validate()},onViewBeforeClick:function(c,a,b,d){if(this.disabled){return false}},onViewDblClick:function(c,a,b,d){return this.fireEvent("dblclick",c,a,b,d)},getValue:function(a){var d=[];var c=this.view.getSelectedIndexes();if(c.length==0){return""}for(var b=0;b<c.length;b++){d.push(this.store.getAt(c[b]).get((a!=null)?a:this.valueField))}return d.join(this.delimiter)},setValue:function(a){var b;var d=[];this.view.clearSelections();this.hiddenField.dom.value="";if(!a||(a=="")){return}if(!Ext.isArray(a)){a=a.split(this.delimiter)}for(var c=0;c<a.length;c++){b=this.view.store.indexOf(this.view.store.query(this.valueField,new RegExp("^"+a[c]+"$","i")).itemAt(0));d.push(b)}this.view.select(d);this.hiddenField.dom.value=this.getValue();this.validate()},reset:function(){this.setValue("")},getRawValue:function(a){var b=this.getValue(a);if(b.length){b=b.split(this.delimiter)}else{b=[]}return b},setRawValue:function(a){setValue(a)},validateValue:function(a){if(a.length<1){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}if(a.length<this.minSelections){this.markInvalid(String.format(this.minSelectionsText,this.minSelections));return false}if(a.length>this.maxSelections){this.markInvalid(String.format(this.maxSelectionsText,this.maxSelections));return false}return true},disable:function(){this.disabled=true;this.hiddenField.dom.disabled=true;this.fs.disable()},enable:function(){this.disabled=false;this.hiddenField.dom.disabled=false;this.fs.enable()},destroy:function(){Ext.destroy(this.fs,this.dragZone,this.dropZone);Ext.ux.form.MultiSelect.superclass.destroy.call(this)}});Ext.reg("multiselect",Ext.ux.form.MultiSelect);Ext.ux.Multiselect=Ext.ux.form.MultiSelect;Ext.ux.form.MultiSelect.DragZone=function(d,c){this.ms=d;this.view=d.view;var b=c.ddGroup||"MultiselectDD";var a;if(Ext.isArray(b)){a=b.shift()}else{a=b;b=null}Ext.ux.form.MultiSelect.DragZone.superclass.constructor.call(this,this.ms.fs.body,{containerScroll:true,ddGroup:a});this.setDraggable(b)};Ext.extend(Ext.ux.form.MultiSelect.DragZone,Ext.dd.DragZone,{onInitDrag:function(a,c){var b=Ext.get(this.dragData.ddel.cloneNode(true));this.proxy.update(b.dom);b.setWidth(b.child("em").getWidth());this.onStartDrag(a,c);return true},collectSelection:function(b){b.repairXY=Ext.fly(this.view.getSelectedNodes()[0]).getXY();var a=0;this.view.store.each(function(d){if(this.view.isSelected(a)){var e=this.view.getNode(a);var c=e.cloneNode(true);c.id=Ext.id();b.ddel.appendChild(c);b.records.push(this.view.store.getAt(a));b.viewNodes.push(e)}a++},this)},onEndDrag:function(a,b){var c=Ext.get(this.dragData.ddel);if(c&&c.hasClass("multi-proxy")){c.remove()}},getDragData:function(d){var c=this.view.findItemFromChild(d.getTarget());if(c){if(!this.view.isSelected(c)&&!d.ctrlKey&&!d.shiftKey){this.view.select(c);this.ms.setValue(this.ms.getValue())}if(this.view.getSelectionCount()==0||d.ctrlKey||d.shiftKey){return false}var b={sourceView:this.view,viewNodes:[],records:[]};if(this.view.getSelectionCount()==1){var a=this.view.getSelectedIndexes()[0];var f=this.view.getNode(a);b.viewNodes.push(b.ddel=f);b.records.push(this.view.store.getAt(a));b.repairXY=Ext.fly(f).getXY()}else{b.ddel=document.createElement("div");b.ddel.className="multi-proxy";this.collectSelection(b)}return b}return false},getRepairXY:function(a){return this.dragData.repairXY},setDraggable:function(a){if(!a){return}if(Ext.isArray(a)){Ext.each(a,this.setDraggable,this);return}this.addToGroup(a)}});Ext.ux.form.MultiSelect.DropZone=function(d,c){this.ms=d;this.view=d.view;var b=c.ddGroup||"MultiselectDD";var a;if(Ext.isArray(b)){a=b.shift()}else{a=b;b=null}Ext.ux.form.MultiSelect.DropZone.superclass.constructor.call(this,this.ms.fs.body,{containerScroll:true,ddGroup:a});this.setDroppable(b)};Ext.extend(Ext.ux.form.MultiSelect.DropZone,Ext.dd.DropZone,{getTargetFromEvent:function(b){var a=b.getTarget();return a},getDropPoint:function(g,j,d){if(j==this.ms.fs.body.dom){return"below"}var f=Ext.lib.Dom.getY(j),a=f+j.offsetHeight;var i=f+(a-f)/2;var h=Ext.lib.Event.getPageY(g);if(h<=i){return"above"}else{return"below"}},isValidDropPoint:function(b,e,a){if(!a.viewNodes||(a.viewNodes.length!=1)){return true}var c=a.viewNodes[0];if(c==e){return false}if((b=="below")&&(e.nextSibling==c)){return false}if((b=="above")&&(e.previousSibling==c)){return false}return true},onNodeEnter:function(d,a,c,b){return false},onNodeOver:function(h,a,g,d){var b=this.dropNotAllowed;var f=this.getDropPoint(g,h,a);if(this.isValidDropPoint(f,h,d)){if(this.ms.appendOnly){return"x-tree-drop-ok-below"}if(f){var c;if(f=="above"){b=h.previousSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-above";c="x-view-drag-insert-above"}else{b=h.nextSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-below";c="x-view-drag-insert-below"}if(this.lastInsertClass!=c){Ext.fly(h).replaceClass(this.lastInsertClass,c);this.lastInsertClass=c}}}return b},onNodeOut:function(d,a,c,b){this.removeDropIndicators(d)},onNodeDrop:function(b,k,j,g){if(this.ms.fireEvent("drop",this,b,k,j,g)===false){return false}var l=this.getDropPoint(j,b,k);if(b!=this.ms.fs.body.dom){b=this.view.findItemFromChild(b)}var c=(this.ms.appendOnly||(b==this.ms.fs.body.dom))?this.view.store.getCount():this.view.indexOf(b);if(l=="below"){c++}var d=false;if(g.sourceView==this.view){if(l=="below"){if(g.viewNodes[0]==b){g.viewNodes.shift()}}else{if(g.viewNodes[g.viewNodes.length-1]==b){g.viewNodes.pop()}}if(!g.viewNodes.length){return false}if(c>this.view.store.indexOf(g.records[0])){d="down";c--}}for(var h=0;h<g.records.length;h++){var a=g.records[h];if(g.sourceView){g.sourceView.store.remove(a)}this.view.store.insert(d=="down"?c:c++,a);var f=this.view.store.sortInfo;if(f){this.view.store.sort(f.field,f.direction)}}return true},removeDropIndicators:function(a){if(a){Ext.fly(a).removeClass(["x-view-drag-insert-above","x-view-drag-insert-left","x-view-drag-insert-right","x-view-drag-insert-below"]);this.lastInsertClass="_noclass"}},setDroppable:function(a){if(!a){return}if(Ext.isArray(a)){Ext.each(a,this.setDroppable,this);return}this.addToGroup(a)}});
/* - TreeComboSuperBox.js - */
Ext.namespace("Ext.ux","Ext.ux.form");Ext.ux.form.TreeComboSuperBox=Ext.extend(Ext.form.TriggerField,{displayField:null,displayFieldTpl:null,forceFormValue:false,hiddenName:null,multiSelect:true,navigateItemsWithTab:true,resizable:false,treeConfig:{rootVisible:false,border:false,autoScroll:true,loaded:false,root:{nodeType:"async",expanded:true,uiProvider:false},loader:{url:"request.php"}},valueDelimiter:",",valueField:null,initComponent:function(){Ext.apply(this,{editable:false,triggerConfig:{cls:"x-superboxselect-btns",children:[{tag:"div",cls:"x-superboxselect-btn-expand"}]},items:new Ext.util.MixedCollection(false)});Ext.ux.form.TreeComboSuperBox.superclass.initComponent.call(this);this.constructTree()},onRender:function(b,a){var c=this.hiddenName;this.hiddenName=null;Ext.ux.form.TreeComboSuperBox.superclass.onRender.call(this,b,a);this.hiddenName=c;this.el.removeClass("x-form-text").addClass("x-superboxselect-input-field");this.wrapEl=this.el.wrap({tag:"ul"});this.outerWrapEl=this.wrapEl.wrap({tag:"div",cls:"x-form-text x-superboxselect"});this.inputEl=this.el.wrap({tag:"li",cls:"x-superboxselect-input"});this.setupFormInterception()},constructTree:function(){if(!this.treePanel){if(!this.treeWidth){this.treeWidth=Math.max(200,this.width||200)}if(!this.treeHeight){this.treeHeight=200}Ext.apply(this.treeConfig,{renderTo:Ext.getBody(),floating:true,autoScroll:true,minWidth:200,minHeight:200,width:this.treeWidth,height:this.treeHeight});if(!this.treeConfig.listeners){this.treeConfig.listeners={}}Ext.apply(this.treeConfig.listeners,{hide:this.onTreeHide,show:this.onTreeShow,expandnode:this.onExpandOrCollapseNode,collapsenode:this.onExpandOrCollapseNode,resize:this.onTreeResize,scope:this});this.treePanel=new Ext.tree.TreePanel(this.treeConfig);this.treePanel.show();this.treePanel.hide();this.relayEvents(this.treePanel.loader,["beforeload","load","loadexception"]);if(this.resizable){this.resizer=new Ext.Resizable(this.treePanel.getEl(),{pinned:true,handles:"se"});this.mon(this.resizer,"resize",function(c,a,b){this.treePanel.setSize(a,b)},this)}}},onTriggerClick:function(){this.treePanel.show();this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")},onExpandOrCollapseNode:function(){if(!this.maxHeight||this.resizable){return}var a=this.treePanel.getTreeEl();var d=a.getHeight()-a.dom.clientHeight;var c=a.child("ul");var b=c.getHeight()+d;if(b>this.maxHeight){b=this.maxHeight}this.treePanel.setHeight(b)},onTreeResize:function(){if(this.treePanel){this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")}},onTreeShow:function(){Ext.getDoc().on("mousewheel",this.collapseIf,this);Ext.getDoc().on("mousedown",this.collapseIf,this)},onTreeHide:function(){Ext.getDoc().un("mousewheel",this.collapseIf,this);Ext.getDoc().un("mousedown",this.collapseIf,this)},collapseIf:function(a){if(!a.within(this.wrap)&&!a.within(this.treePanel.getEl())){this.collapse()}},collapse:function(){this.treePanel.hide()},getValue:function(){var a=[];this.items.each(function(b){a.push(b.value)});return a.join(this.valueDelimiter)},setValue:function(e){if(!this.rendered){this.value=e;return}this.removeAllItems();if(Ext.isEmpty(e)){return}var a=e;if(!Ext.isArray(e)){e=""+e;a=e.split(this.valueDelimiter)}if(this.multiSelect){Ext.each(a,function(m){var j=m;var n=m;var i=m;var l="";var k="";this.addItemBox(j,n,i,l,k)},this)}else{var g=a[0];var c=g;var h=g;var b=g;var f="";var d="";this.addItemBox(c,h,b,f,d)}},removeAllItems:function(){this.items.each(function(a){a.preDestroy(true)},this);return this},getCaption:function(b){if(typeof this.displayFieldTpl==="string"){this.displayFieldTpl=new Ext.XTemplate(this.displayFieldTpl)}var a;if(this.displayFieldTpl){a=this.displayFieldTpl.apply(b.attributes)}else{if(this.displayField){a=b.attributes[this.displayField]}}return a},addItemBox:function(d,h,l,k,e){var j=this.items;for(var b=0,f=j.getCount();b<f;++b){var c=j.get(b);if(c.value===d){return}}if(!this.multiSelect){this.removeAllItems()}var g;var a=Ext.id(null,"sbx-item");var c=new Ext.ux.form.SuperBoxSelectItem({owner:this,renderTo:this.wrapEl,caption:l,display:h,value:d,key:a,listeners:{remove:function(i){if(this.fireEvent("beforeremoveitem",this,i.value)===false){return}this.items.removeKey(i.key)},destroy:function(){this.collapse();this.autoSize().validateValue()},scope:this}});c.render();g={tag:"input",type:"hidden",value:d,name:(this.hiddenName||this.name)};if(this.disabled){Ext.apply(g,{disabled:"disabled"})}c.hidden=this.el.insertSibling(g,"before");this.items.add(a,c);this.applyEmptyText().autoSize().validateValue();if(this.multiSelect){this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")}else{this.collapse()}},applyEmptyText:function(){this.setRawValue("");if(this.items.getCount()>0){this.el.removeClass(this.emptyClass);this.setRawValue("");return this}if(this.rendered&&this.emptyText&&this.getRawValue().length<1){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass)}return this},validateValue:function(a){if(this.items.getCount()===0){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}this.clearInvalid();return true},markInvalid:function(c){var b,a;if(!this.rendered||this.preventMark){return}this.outerWrapEl.addClass(this.invalidClass);c=c||this.invalidText;switch(this.msgTarget){case"qtip":Ext.apply(this.el.dom,{qtip:c,qclass:"x-form-invalid-tip"});Ext.apply(this.wrapEl.dom,{qtip:c,qclass:"x-form-invalid-tip"});if(Ext.QuickTips){Ext.QuickTips.enable()}break;case"title":this.el.dom.title=c;this.wrapEl.dom.title=c;this.outerWrapEl.dom.title=c;break;case"under":if(!this.errorEl){b=this.getErrorCt();if(!b){this.el.dom.title=c;break}this.errorEl=b.createChild({cls:"x-form-invalid-msg"});this.errorEl.setWidth(b.getWidth(true)-20)}this.errorEl.update(c);Ext.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case"side":if(!this.errorIcon){b=this.getErrorCt();if(!b){this.el.dom.title=c;break}this.errorIcon=b.createChild({cls:"x-form-invalid-icon"})}this.alignErrorIcon();Ext.apply(this.errorIcon.dom,{qtip:c,qclass:"x-form-invalid-tip"});this.errorIcon.show();this.on("resize",this.alignErrorIcon,this);break;default:a=Ext.getDom(this.msgTarget);a.innerHTML=c;a.style.display=this.msgDisplay;break}this.fireEvent("invalid",this,c)},clearInvalid:function(){if(!this.rendered||this.preventMark){return}this.outerWrapEl.removeClass(this.invalidClass);switch(this.msgTarget){case"qtip":this.el.dom.qtip="";this.wrapEl.dom.qtip="";break;case"title":this.el.dom.title="";this.wrapEl.dom.title="";this.outerWrapEl.dom.title="";break;case"under":if(this.errorEl){Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl,this)}break;case"side":if(this.errorIcon){this.errorIcon.dom.qtip="";this.errorIcon.hide();this.un("resize",this.alignErrorIcon,this)}break;default:var a=Ext.getDom(this.msgTarget);a.innerHTML="";a.style.display="none";break}this.fireEvent("valid",this)},alignErrorIcon:function(){if(this.wrap){this.errorIcon.alignTo(this.wrap,"tl-tr",[Ext.isIE?5:2,3])}},clearCurrentFocus:function(){if(this.currentFocus){this.currentFocus.onLnkBlur();this.currentFocus=null}return this},setupFormInterception:function(){var a;this.findParentBy(function(c){if(c.getForm){a=c.getForm()}});if(a){var b=a.getValues;a.getValues=function(d){this.el.dom.disabled=true;var c=this.el.dom.value;this.setRawValue("");var e=b.call(a);this.el.dom.disabled=false;this.setRawValue(c);if(this.forceFormValue&&this.items.getCount()===0){e[this.name]=""}return d?Ext.urlEncode(e):e}.createDelegate(this)}},onResize:function(a,c,e,b){var d=Ext.isIE6?4:Ext.isIE7?1:Ext.isIE8?1:0;if(this.wrapEl){this._width=a;this.outerWrapEl.setWidth(a-d)}Ext.ux.form.TreeComboSuperBox.superclass.onResize.call(this,a,c,e,b);this.autoSize()},autoSize:function(){if(!this.rendered){return this}if(!this.metrics){this.metrics=Ext.util.TextMetrics.createInstance(this.el)}var c=this.el,b=c.dom.value,e=document.createElement("div");if(b===""&&this.emptyText&&this.items.getCount()<1){b=this.emptyText}e.appendChild(document.createTextNode(b));b=e.innerHTML;e=null;b+="&#160;";var a=Math.max(this.metrics.getWidth(b)+24,24);if(typeof this._width!="undefined"){a=Math.min(this._width,a)}this.el.setWidth(a);if(Ext.isIE){this.el.dom.style.top="0"}this.fireEvent("autosize",this,a);return this}});Ext.reg("treecombosuperbox",Ext.ux.form.TreeComboSuperBox);Ext.ux.form.SuperBoxSelectItem=function(a){Ext.apply(this,a);Ext.ux.form.SuperBoxSelectItem.superclass.constructor.call(this)};Ext.ux.form.SuperBoxSelectItem=Ext.extend(Ext.ux.form.SuperBoxSelectItem,Ext.Component,{initComponent:function(){Ext.ux.form.SuperBoxSelectItem.superclass.initComponent.call(this)},onElClick:function(b){var c=this.owner;c.clearCurrentFocus().collapse();if(c.navigateItemsWithTab){this.focus()}else{c.el.dom.focus();var a=this;(function(){this.onLnkFocus();c.currentFocus=this}).defer(10,this)}},onLnkClick:function(a){if(a){a.stopEvent()}this.preDestroy();if(!this.owner.navigateItemsWithTab){this.owner.el.focus()}},onLnkFocus:function(){this.el.addClass("x-superboxselect-item-focus");this.owner.outerWrapEl.addClass("x-form-focus")},onLnkBlur:function(){this.el.removeClass("x-superboxselect-item-focus");this.owner.outerWrapEl.removeClass("x-form-focus")},enableElListeners:function(){this.el.on("click",this.onElClick,this,{stopEvent:true});this.el.addClassOnOver("x-superboxselect-item x-superboxselect-item-hover")},enableLnkListeners:function(){this.lnk.on({click:this.onLnkClick,focus:this.onLnkFocus,blur:this.onLnkBlur,scope:this})},enableAllListeners:function(){this.enableElListeners();this.enableLnkListeners()},disableAllListeners:function(){this.el.removeAllListeners();this.lnk.un("click",this.onLnkClick,this);this.lnk.un("focus",this.onLnkFocus,this);this.lnk.un("blur",this.onLnkBlur,this)},onRender:function(c,a){Ext.ux.form.SuperBoxSelectItem.superclass.onRender.call(this,c,a);var e=this.el;if(e){e.remove()}this.el=e=c.createChild({tag:"li"},c.last());e.addClass("x-superboxselect-item");var d=this.owner.navigateItemsWithTab?(Ext.isSafari?"button":"a"):"span";var f=this.key;Ext.apply(e,{focus:function(){var g=this.down(d+".x-superboxselect-item-close");if(g){g.focus()}},preDestroy:function(){this.preDestroy()}.createDelegate(this)});this.enableElListeners();e.update(this.caption);var b={tag:d,"class":"x-superboxselect-item-close",tabIndex:this.owner.navigateItemsWithTab?"0":"-1"};if(d==="a"){b.href="#"}this.lnk=e.createChild(b);if(!this.disabled){this.enableLnkListeners()}else{this.disableAllListeners()}this.on({disable:this.disableAllListeners,enable:this.enableAllListeners,scope:this});this.setupKeyMap()},setupKeyMap:function(){this.keyMap=new Ext.KeyMap(this.lnk,[{key:[Ext.EventObject.BACKSPACE,Ext.EventObject.DELETE,Ext.EventObject.SPACE],fn:this.preDestroy,scope:this},{key:[Ext.EventObject.RIGHT,Ext.EventObject.DOWN],fn:function(){this.moveFocus("right")},scope:this},{key:[Ext.EventObject.LEFT,Ext.EventObject.UP],fn:function(){this.moveFocus("left")},scope:this},{key:[Ext.EventObject.HOME],fn:function(){var a=this.owner.items.get(0).el.focus();if(a){a.el.focus()}},scope:this},{key:[Ext.EventObject.END],fn:function(){this.owner.el.focus()},scope:this},{key:Ext.EventObject.ENTER,fn:function(){}}]);this.keyMap.stopEvent=true},moveFocus:function(a){var b=this.el[a=="left"?"prev":"next"]()||this.owner.el;b.focus.defer(100,b)},preDestroy:function(a){if(this.fireEvent("remove",this)===false){return}var b=function(){if(this.owner.navigateItemsWithTab){this.moveFocus("right")}this.hidden.remove();this.hidden=null;this.destroy()};if(a){b.call(this)}else{this.el.hide({duration:0.2,callback:b,scope:this})}return this},kill:function(){this.hidden.remove();this.hidden=null;this.purgeListeners();this.destroy()},onDisable:function(){if(this.hidden){this.hidden.dom.setAttribute("disabled","disabled")}this.keyMap.disable();Ext.ux.form.SuperBoxSelectItem.superclass.onDisable.call(this)},onEnable:function(){if(this.hidden){this.hidden.dom.removeAttribute("disabled")}this.keyMap.enable();Ext.ux.form.SuperBoxSelectItem.superclass.onEnable.call(this)},onDestroy:function(){Ext.destroy(this.lnk,this.el);Ext.ux.form.SuperBoxSelectItem.superclass.onDestroy.call(this)}});
/* - widget_folder_contents.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.folderContents=Ext.extend(Anz.widget.base,{iconCls:"widget_folder_contents_icon",entries:[],page:0,pageCount:1,count:null,getCustomisePreferences:function(){var a=this.portalUrl.split("/").pop();return[{xtype:"treecombosuperbox",name:"paths",fieldLabel:_("Paths"),hiddenName:"paths:list",navigateItemsWithTab:true,resizable:true,allowBlank:false,msgTarget:"under",displayFieldTpl:"{text}",value:"/"+a,multiSelect:true,treeWidth:353,treeConfig:{height:110,rootVisible:true,autoScroll:true,root:{nodeType:"async",text:_("Root"),id:"root",expanded:true,path:"/"+a},loader:{url:this.portalUrl+"/@@folderContentsView/getChildNodesData"},listeners:{beforeload:{fn:function(c){var b=c.getOwnerTree().getLoader();b.baseParams.path=c.attributes.path}},click:{fn:function(d,g){var c=d.attributes.path;var i=d.text;var b=this.getCaption(d);var h="";var f="";this.addItemBox(c,i,b,h,f)}}}}},{xtype:"xcheckbox",name:"searchSub",fieldLabel:_("Search sub-directory?"),submitOffValue:0,submitOnValue:1,value:0,hiddenName:"searchSub:int"},{xtype:"multiselect",fieldLabel:_("Types"),name:"types",width:360,height:"auto",allowBlank:true,displayField:"name",valueField:"id",store:new Ext.data.JsonStore({autoDestroy:true,autoLoad:true,url:this.contextUrl+"/@@folderContentsWidget/types",root:"types",fields:["id","name"]})},{xtype:"numberfield",name:"recentDays",fieldLabel:_("Recent days"),value:0,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"numberfield",name:"sort_limit",fieldLabel:_("Max count"),value:0,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"xcheckbox",name:"paging",fieldLabel:_("Paging?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"paging:int"},{xtype:"numberfield",name:"count",fieldLabel:_("Count"),value:5,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Normal",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Normal",_("Normal")],["Magazine",_("Magazine")],["Slideshow",_("Slideshow")],["Headline",_("Headline")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{searchSub:0,recentDays:0,sort_limit:0,count:5,paging:1,view:"Normal"}},updateOptions:function(i){var a=this.options;this.options=i;this.count=parseInt(this.getValue("count"));this.setTitle(Utf8.decode(this.getValue("title")));if(!this.collapsed){var c=a.paths;var g=a.types;var d=a.searchSub;var h=a.recentDays;var e=a.sort_limit;var f=a.view;var b=a.paging;if((c!==this.getValue("paths"))||(g!==this.getValue("types"))||(d!==this.getValue("searchSub"))||(h!==this.getValue("recentDays"))||(e!==this.getValue("sort_limit"))){this.display()}else{if((f!==this.getValue("view"))||(b!==this.getValue("paging"))){if(this.loaded){this.buildContents()}else{this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');this.loaded=false;var d=this.getValue("paths");var b=this.getValue("types");var c=this.getValue("searchSub");var e=this.getValue("recentDays");var a=this.getValue("sort_limit");Ext.Ajax.request({url:this.contextUrl+"/@@folderContentsWidget/items",method:"POST",params:{"paths:list":d,searchSub:c,portal_types:b,"recentDays:int":e,"sort_limit:int":a},timeout:5000,scope:this,success:function(f,h){var g=Ext.decode(f.responseText);if(g.success){this.entries=g.items;this.count=parseInt(this.getValue("count"));this.pageCount=Math.ceil(this.entries.length/this.count);this.buildContents();this.loaded=true}else{if(g.msg){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(f,h){var g=f.responseText;if(g){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachPagingHandler:function(){var a=this.body.child("a[class=prePage]");if(a){a.on("click",this.prePage,this)}var b=this.body.child("a[class=nextPage]");if(b){b.on("click",this.nextPage,this)}},prePage:function(){this.page-=1;this.buildContents()},nextPage:function(){this.page+=1;this.buildContents()},buildContents:function(){var c="";var a=this.getValue("view");switch(a){case"Normal":c=this.buildNormalHtml();break;case"Magazine":c=this.buildMagazineHtml();break;case"Slideshow":c=this.buildSlideshowHtml();break;case"Headline":c=this.buildHeadlineHtml();break;default:c=this.buildNormalHtml()}var d=this.getValue("paging")&&(this.pageCount>1)&&(a!=="Slideshow");if(d){c+='<div class="paging-bottom">';if(this.page!==0){c+=String.format('<a class="prePage" href="javascript:;">{0}</a>',_("prev"))}if(this.page<this.pageCount-1){c+=String.format('<a class="nextPage" href="javascript:;">{0}</a>',_("next"))}c+="<div>"}this.body.update(c);if(a==="Slideshow"){var b=this.getId()+"_slideshow";new Ext.ux.Carousel(b,{itemSelector:"div.item",interval:10,autoPlay:true,transitionEasing:"easeIn"})}if(d){this.attachPagingHandler()}},buildNormalHtml:function(){var g=this.page*this.count;var c=this.entries.slice(g,g+this.count);var e='<ul class="itemList">';var b=new Ext.Template("<li>",'<img width="16" height="16" src="{iconSrc}">','<a href="{link}" title="{desc}" target="_blank">',"{title}","</a>",'<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</li>");for(var d=0,a=c.length;d<a;++d){var f=c[d];e+=b.applyTemplate({iconSrc:this.portalUrl+"/"+f.icon,title:f.title,desc:f.desc,link:f.url,authorLink:this.portalUrl+"/author/"+f.author_id,author:f.author,date:f.modified,shortDate:new Date(f.modified).format("Y/m/d")})}e+="</ul>";return e},buildMagazineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="magazineView">'];var f=new Ext.Template('<div class="left">','<div class="crop">','<img height="234" width="234" src="{img}"/>',"</div>",'<div class="article">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</div>","</div>");var c=e[0];d.push(f.applyTemplate({title:c.title,desc:c.desc,img:this.portalUrl+"/default_news.png",link:c.link,authorLink:this.portalUrl+"/author/"+c.author_id,author:c.author,date:c.modified,shortDate:new Date(c.modified).format("Y/m/d")}));d.push('<div class="right">');var g=new Ext.Template('<div class="item">','<div class="thumbnail">','<img height="50" width="50" src="{img}"/>',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</div>","<p>{desc}</p>","</div>");for(var b=1,h=e.length;b<h;++b){var j=e[b];d.push(g.applyTemplate({title:j.title,desc:j.desc,img:this.portalUrl+"/default_news.png",link:j.link,authorLink:portalUrl+"/author/"+j.author_id,author:j.author,date:j.modified,shortDate:new Date(j.modified).format("Y/m/d")}))}d.push("</div></div>");return d.join("")},buildSlideshowHtml:function(c){var c=this.entries;var d=this.getId()+"_slideshow";var f=[String.format('<div class="slideshowView" id="{0}">',d)];var b=new Ext.Template('<div class="item">','<div class="crop">','<img src="{img}">',"</div>",'<div class="content">','<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>',"</div>",'<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</div>","</div>");for(var e=0,a=c.length;e<a;++e){var g=c[e];f.push(b.applyTemplate({img:this.portalUrl+"/default_news.png",title:g.title,desc:g.desc,link:g.link,authorLink:this.portalUrl+"/author/"+g.author_id,author:g.author,date:g.modified,shortDate:new Date(g.modified).format("Y/m/d")}))}f.push("</div>");return f.join("")},buildHeadlineHtml:function(e){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="headlineView">'];var f=new Ext.Template('<div class="top">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</div>","</div>",'<div class="middle odd">',"<p>{desc}</p>","</div>");var c=e[0];d.push(f.applyTemplate({img:this.portalUrl+"/default_news.png",title:c.title,desc:c.desc,link:c.link,authorLink:this.portalUrl+"/author/"+c.author_id,author:c.author,date:c.modified,shortDate:new Date(c.modified).format("Y/m/d")}));d.push('<ul class="bottom">');var g=new Ext.Template('<li class="item {cls}">','<div class="thumbnail">','<img height="50" width="50" src="{img}">',"</div>",'<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</li>");for(var b=1,h=e.length;b<h;++b){var j=e[b];d.push(g.applyTemplate({cls:b%2?"even":"odd",img:this.portalUrl+"/default_news.png",title:j.title,desc:j.desc,link:j.link,authorLink:this.portalUrl+"/author/"+j.author_id,author:j.author,date:j.modified,shortDate:new Date(j.modified).format("Y/m/d")}))}d.push("</ul></div>");return d.join("")},getTimeDiff:function(e){if(!e){return""}var d=new Date(e);var h=new Date();var c=h.valueOf()-d.valueOf();var i=c/86400000;i=parseInt(i);c=c-(i*86400000);var f=c/3600000;f=parseInt(f);c=c-(f*3600000);var b=c/60000;b=parseInt(b);c=c-(b*60000);var g=c/1000;g=parseInt(g);var a="";if(i>0){a=i+"days before"}else{if(f>0){a=f+"hours before"}else{if(b>0){a=b+"minutes before"}}}return a}});Ext.reg("widget_folder_contents",Anz.widget.folderContents);
/* - widgetsview.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.dashboard");Anz.dashboard.WidgetsView=function(a){this.config=a};Anz.dashboard.WidgetsView.prototype={lookup:{},show:function(b,d){if(!this.win){this.initTemplates();this.store=new Ext.data.JsonStore({url:this.config.url,root:"widgets",fields:["id","title","desc","icon"]});this.store.load();var c=function(e){e.icon=this.config.portalUrl+"/"+e.icon+"64.png";e.Widget_Name=_("Widget name");e.Description=_("Description");this.lookup[e.id]=e;return e};this.view=new Ext.DataView({tpl:this.thumbTemplate,singleSelect:true,overClass:"x-view-over",itemSelector:"div.thumb-wrap",emptyText:'<div style="padding:10px;">No images match the specified filter</div>',store:this.store,listeners:{selectionchange:{fn:this.showDetails,scope:this,buffer:100},dblclick:{fn:this.doCallback,scope:this},loadexception:{fn:this.onLoadException,scope:this},beforeselect:{fn:function(e){return e.store.getRange().length>0}}},prepareData:c.createDelegate(this)});var a={title:_("Widgets list"),id:"widgets-chooser-dlg",layout:"border",minWidth:500,minHeight:300,modal:true,closeAction:"hide",border:false,items:[{id:"widget-chooser-view",region:"center",autoScroll:true,items:this.view},{id:"widget-detail-panel",region:"east",split:true,width:150,minWidth:150,maxWidth:250}],buttons:[{id:"ok-btn",text:_("OK"),handler:this.doCallback,scope:this},{text:_("Cancel"),handler:function(){this.win.hide()},scope:this}],keys:{key:27,handler:function(){this.win.hide()},scope:this}};Ext.apply(a,this.config);this.win=new Ext.Window(a)}this.reset();this.win.show(b);this.callback=d;this.animateTarget=b},initTemplates:function(){this.thumbTemplate=new Ext.XTemplate('<tpl for=".">','<div class="thumb-wrap" id="{id}">','<div class="thumb"><img src="{icon}" title="{title}"></div>',"<span>{title}</span></div>","</tpl>");this.thumbTemplate.compile();this.detailsTemplate=new Ext.XTemplate('<div class="details">','<tpl for=".">','<div class="thumb"><img src="{icon}"></div>','<div class="details-info">',"<div><b>{Widget_Name}: </b>","<span>{title}</span></div>","<div><b>{Description}: </b>","<span>{desc}</span></div>","</div>","</tpl>","</div>");this.detailsTemplate.compile()},showDetails:function(){var b=this.view.getSelectedNodes();var c=Ext.getCmp("widget-detail-panel").body;if(b&&b.length>0){b=b[0];Ext.getCmp("ok-btn").enable();var a=this.lookup[b.id];c.hide();this.detailsTemplate.overwrite(c,a);c.slideIn("l",{stopFx:true,duration:0.2})}else{Ext.getCmp("ok-btn").disable();c.update("")}},sortImages:function(){var a=Ext.getCmp("sortSelect").getValue();this.view.store.sort(a,a=="name"?"asc":"desc");this.view.select(0)},reset:function(){this.view.select(0)},doCallback:function(){var a=this.view.getSelectedNodes()[0];var c=this.callback;var b=this.lookup;this.win.hide(this.animateTarget,function(){if(a&&c){var d=b[a.id];c(d)}})},onLoadException:function(a,b){this.view.getEl().update('<div style="padding:10px;">Error loading images.</div>')}};
/* - TabMoreMenu.js - */
Ext.ux.TabMoreMenu=function(a){a=a||{};Ext.apply(this,a);Ext.ux.TabMoreMenu.superclass.constructor.call(this)};Ext.extend(Ext.ux.TabMoreMenu,Ext.util.Observable,{menuAlign:"tr-br?",menuOffsets:[0,-5],init:function(a){a.getTemplateArgs=this.getTemplateArgs.createDelegate(a);a.findTargets=this.findTargets.createDelegate(a);a.onStripMouseDown=this.onStripMouseDown.createDelegate(a);a.on("beforedestroy",this.beforedestroy,this);a.on("more",this.onMore,this);this.tab=a;if(this.menu){this.menu=Ext.menu.MenuMgr.get(this.menu);Ext.apply(this.menu,{defaultOffsets:this.menuOffsets,afterRender:function(){Ext.menu.Menu.superclass.afterRender.call(this);this.items.each(function(b){b.un("click",b.handler,b.scope)},this)}});this.menu.on("click",this.onMenuClick,this)}},onMenuClick:function(c,a,b){b.stopEvent();if(a.handler){a.handler.call(a.scope||this,this.menu.tabItem)}},onMore:function(c,a,b){c.stopEvent();this.menu.tabItem=a.item;if(this.menu){this.menu.show(b,this.menuAlign)}},getTemplateArgs:function(a){var b=Ext.TabPanel.prototype.getTemplateArgs.call(this,a);b.cls="x-tab-strip-more";return b},findTargets:function(b){var a=Ext.TabPanel.prototype.findTargets.call(this,b);a.close=false;a.more=b.getTarget(".x-tab-strip-close",this.strip);return a},onStripMouseDown:function(b){Ext.TabPanel.prototype.onStripMouseDown.call(this,b);var a=this.findTargets(b);if(a.more&&a.item){this.fireEvent("more",b,a,a.el)}},beforedestroy:function(){Ext.destroy(this.menu)}});
/* - anz_dashboard.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.dashboard");Anz.dashboard.app=function(){return{portalUrl:null,contextUrl:null,container:null,currentPage:null,pageLayout:null,currentWidget:null,pageTools:[],columnTools:[],widgetTools:[],widgetContextMenu:null,widgetsPanel:null,init:function(b,a){this.portalUrl=b;this.contextUrl=a;Ext.QuickTips.init();Ext.Ajax.request({url:this.contextUrl+"/@@mergedRequest/getMergedData",method:"POST",params:{"requests:list":["pageLayout@@dashboardView/getPageLayout","layoutCfg@@dashboardView/getLayoutConfig","widgets@@widgetView/getWidgets","i18n@@msgCatalog/catalogMapping?domain=anz.dashboard"]},scope:this,success:function(l,d){var h=Ext.decode(l.responseText);this.pageLayout=h.pageLayout.layout;var c=h.layoutCfg.config;Anz.i18n=h.i18n.texts;var k=h.widgets.widgets;var j={};for(var e=0,g=k.length;e<g;++e){var f=k[e];j[f.id]=f}this.constructPageTools();this.constructColumnTools();this.constructWidgetTools();this.constructPages(c,j)},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},destroy:function(){if(this.container){this.container.removeAll()}},calcPageIndex:function(g){var d=null;var c=null;if(this.pageLayout==="tile"){c=this.container.items;for(var f=0,b=c.getCount();f<b;++f){if(g.getId()===c.get(f).id){d=f;break}}}else{var a=this.container.getActiveTab();var e=this.container.items;for(var f=0;f<e.getCount();f++){if(a==e.get(f)){d=f;break}}}return d},calcColumnIndex:function(d){var b=null;var e=d.ownerCt.items;for(var c=0,a=e.getCount();c<a;++c){if(d.getId()===e.get(c).id){b=c;break}}return b},calcWidgetPos:function(h){var g=h.findParentByType("portal");var b=this.calcPageIndex(g);var f=this.calcColumnIndex(h.ownerCt);var e=null;var c=h.ownerCt.items;for(var d=0,a=c.getCount();d<a;++d){if(h.getId()===c.get(d).getId()){e=d;break}}return{page:b,col:f,pos:e,pageCount:g.ownerCt.items.getCount(),colCount:g.items.getCount()}},constructPageTools:function(){this.pageTools=[{id:"add_widget",qtip:_("Add widget"),scope:this,handler:function(c,b,a){this.showWidgetsView(a)}},{id:"add_page",qtip:_("Add page"),scope:this,handler:function(c,b,a){this.addPage(this.calcPageIndex(a)+1)}},{id:"save",qtip:_("Edit page"),scope:this,handler:function(c,b,a){this.editPage(a)}},{id:"up",qtip:_("Move page up"),scope:this,handler:function(c,b,a){this.movePage(a,"up")}},{id:"down",qtip:_("Move page down"),scope:this,handler:function(c,b,a){this.movePage(a,"down")}},{id:"close",qtip:_("Delete page"),scope:this,handler:function(c,b,a){this.delPage(a)}}]},constructColumnTools:function(){this.columnTools=[{id:"add_column",qtip:_("Add column"),scope:this,handler:function(d,c,a){var e=a.findParentByType("portal");var b=this.calcColumnIndex(a);this.addColumn(e,b+1)}},{id:"left",qtip:_("Move column left"),scope:this,handler:function(c,b,a){this.moveColumn(a,"left")}},{id:"right",qtip:_("Move column right"),scope:this,handler:function(c,b,a){this.moveColumn(a,"right")}},{id:"close",qtip:_("Delete the column"),scope:this,handler:function(c,b,a){this.delColumn(a)}}]},constructWidgetTools:function(){this.widgetTools=[{id:"toggle",qtip:_("Collapse the widget"),scope:this,handler:function(c,b,a){this.collapseWidget(a)}},{id:"gear",qtip:_("Config the widget"),scope:this,handler:function(c,b,a){this.currentWidget=a;if(!this.widgetContextMenu){this.widgetContextMenu=new Ext.menu.Menu({shadow:false,style:{background:"white none repeat scroll 0 0",textAlign:"left",border:"1px solid #999"},items:[{id:"menuitem_color",text:_("color"),iconCls:"color_widget",menu:{xtype:"colormenu",colors:["D96666","E67399","B373B3","8C66D9","668CB3","668CD9","59BFB3","65AD89","4CB052","8CBF40","BFBF4D","E0C240","F2A640","E6804D","BE9494","A992A9","8997A5","94A2BE","85AAA5","A7A77D","C4A883"],scope:this,handler:function(d,e){this.changeWidgetColor(e)}}},{id:"menuitem_up",text:_("up"),iconCls:"move_up",scope:this,handler:function(d,f){this.moveWidget("up");f.stopEvent()}},{id:"menuitem_right",text:_("right"),iconCls:"move_right",scope:this,handler:function(d,f){this.moveWidget("right");f.stopEvent()}},{id:"menuitem_down",text:_("down"),iconCls:"move_down",scope:this,handler:function(d,f){this.moveWidget("down");f.stopEvent()}},{id:"menuitem_left",text:_("left"),iconCls:"move_left",scope:this,handler:function(d,f){this.moveWidget("left");f.stopEvent()}}]})}this.widgetContextMenu.showAt(c.getPoint())}},{id:"refresh",qtip:_("Refresh the widget"),scope:this,handler:function(d,b,a){var c=1+2}},{id:"save",qtip:_("Edit the widget"),scope:this,handler:function(c,b,a){this.changeWidgetOptions(a)}},{id:"close",qtip:_("Delete the widget"),scope:this,handler:function(c,b,a){this.delWidget(a)}}]},constructPages:function(t,p){var d={};if(this.pageLayout==="tile"){Ext.apply(d,{renderTo:"region-content"})}else{var m=Ext.get("region-content");var q=m.getWidth(true);Ext.apply(d,{renderTo:"region-content",activeTab:0,minTabWidth:115,tabWidth:135,width:q,autoHeight:true,plain:true,enableTabScroll:true,plugins:[new Ext.ux.TabMoreMenu({menu:[{id:"menuitem_edit_page",text:_("Edit page"),iconCls:"edit_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.editPage(j)}},{id:"menuitem_left",text:_("left"),iconCls:"move_left",scope:this,handler:function(i){var k=this.container.getActiveTab();var j=this.container.setActiveTab.createDelegate(this.container,[k]);this.movePage(k,"left",j)}},{id:"menuitem_right",text:_("right"),iconCls:"move_right",scope:this,handler:function(i){var k=this.container.getActiveTab();var j=this.container.setActiveTab.createDelegate(this.container,[k]);this.movePage(k,"right",j)}},{id:"menuitem_add_widget",text:_("Add widget"),iconCls:"add_widget",scope:this,handler:function(i){var j=this.container.getActiveTab();this.showWidgetsView(j)}},{id:"menuitem_add_page",text:_("Add page"),iconCls:"add_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.addPage(this.calcPageIndex(j)+1)}},{id:"menuitem_delete_page",text:_("Delete page"),iconCls:"delete_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.delPage(this.calcPageIndex(j)+1)}}]})]})}var l=[];for(var u=0,v=t.length;u<v;++u){var f=t[u];var h=f.columns.length;var x=[];for(var s=0;s<h;++s){var c=f.columns[s];var g={};g.title=_("column");g.columnWidth=parseFloat(c.width);g.style=c.style;g.tools=this.columnTools;var n=[];var o=c.widgets;var b=o.length;for(var r=0;r<b;++r){var e=o[r];var a={};a.portalUrl=this.portalUrl;a.contextUrl=this.contextUrl;a.xtype=e.id;a.options=e.options;a.title=Utf8.decode(e.options.title);a.collapsed=e.collapse;if(e.color){a.baseCls="x-panel-green"}if(p[e.id]){a.iconCls=p[e.id].icon}a.tools=this.widgetTools;n.push(a)}g.items=n;x.push(g)}var w=this._buildPortalCfg(x,Utf8.decode(f.title));l.push(w)}d.items=l;if(this.pageLayout==="tile"){this.container=new Ext.Panel(d)}else{this.container=new Ext.TabPanel(d)}},constructPage:function(c,a){var b=this._buildPortalCfg(c,"untitled page");if(a){this.container.insert(a,b)}else{this.container.add(b)}},addPage:function(a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addPage",method:"POST",params:{"pageIndex:int":a},scope:this,success:function(b,e){var d=Ext.decode(b.responseText);if(d.success){var c=[{title:_("column"),columnWidth:0.5,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]},{title:_("column"),columnWidth:0.5,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]}];this.constructPage(c,a);this.container.doLayout()}else{alert(d.msg)}},failure:function(b,c){Ext.MessageBox.alert("failure",b.responseText)}})},editPage:function(b){var a=new Ext.FormPanel({labelWidth:80,bodyStyle:"padding:15px;",border:false,width:500,autoHeight:true,defaults:{anchor:"100%"},defaultType:"textfield",items:[{name:"title",fieldLabel:"title",value:b.title},{name:"width",fieldLabel:"width",value:""},{xtype:"textarea",name:"style",fieldLabel:"style",value:""}]});var c=new Ext.Window({layout:"fit",title:_("Edit page"),width:640,autoHeight:true,modal:true,items:a,buttons:[{text:_("Save"),iconCls:"icon-save",handler:function(f,i){var g=a.getForm();f.disable();var h=f.nextSibling();h.disable();var d=g.getValues();if(g.isValid()){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/editPage",method:"POST",form:g.id,params:{"pageIndex:int":this.calcPageIndex(b)},scope:this,success:function(e,k){var j=Ext.decode(e.responseText);if(j.success){b.setTitle(d.title)}else{alert(j.msg)}},failure:function(e,j){alert(e.responseText)}})}else{f.enable();h.enable()}c.close()},scope:this},{text:_("Cancel"),scope:this,handler:function(d,f){c.close()}}]});c.show()},movePage:function(f,b,h){var a=this.container;var c=this.container.items.length-1;var e=this.calcPageIndex(f);var g=null;var d=false;if(b=="up"){if(e>0){g=e-1;d=true}}else{if(b=="down"){if(e<c){g=e+1;d=true}}else{if(b=="left"){if(e>0){g=e-1;d=true}}else{if(b=="right"){if(e<c){g=e+1;d=true}}}}}if(d){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/movePage",method:"POST",params:{"pageIndex:int":e,"toPage:int":g},scope:this,success:function(i,k){var j=Ext.decode(i.responseText);if(j.success){a.remove(f,false);var l=f.getPositionEl().dom;l.parentNode.removeChild(l);a.insert(g,f);a.doLayout();if(h){h()}}else{alert(j.msg)}},failure:function(i,j){Ext.MessageBox.alert("failure",i.responseText)}})}},delPage:function(a){if(this.container.items.length==1){alert(_("Can not delete the last page!"));return}Ext.Msg.confirm("Confirm",_("Are you sure you want to delete this page?"),function(c){if(c=="yes"){var b=this.calcPageIndex(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delPage",method:"POST",params:{"pageIndex:int":b},scope:this,success:function(d,g){var e=Ext.decode(d.responseText);if(e.success){if(this.pageLayout==="tile"){this.container.remove(a,true)}else{var f=this.container.getActiveTab();this.container.remove(f,true)}}else{alert(e.msg)}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})}},this)},addColumn:function(b,a){var a=a?a:0;Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(b),"columnIndex:int":a},scope:this,success:function(u,k){var o=Ext.decode(u.responseText);if(o.success){var p=b.items;var s=p.getCount()+1;var g=1/s;var t=null;var h=[];for(var l=0,m=p.getCount();l<m;++l){var r=p.get(l);if(!t){var n=r.container;t=n.getViewSize().width-n.getPadding("lr")}var q=r.getEl();var j=r.getSize().width+q.getMargins("lr");var f=(j/t)*(1-g);r.columnWidth=f;h.push(f)}var e={xtype:"portalcolumn",title:_("column"),columnWidth:g,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]};h.splice(a,0,g);b.insert(a,e);var d=p.get(s-1);this._adjustLastColumn(d,h);b.doLayout();this.changeColumnsWidth(b,h)}else{alert(o.msg)}},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},_adjustLastColumn:function(c,e){c.getEl().setStyle("margin-right",0);var d=0;for(var b=0,a=e.length-1;b<a;++b){d+=e[b]}c.columnWidth=1-d;e[e.length-1]=1-d},changeColumnsWidth:function(b,a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeColumnsWidth",method:"POST",params:{"pageIndex:int":this.calcPageIndex(b),"widths:list":a},scope:this,success:function(c,e){var d=Ext.decode(c.responseText);if(!d.success){alert(d.msg)}},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},moveColumn:function(e,a){var f=e.findParentByType("portal");var b=f.items.getCount()-1;var d=this.calcColumnIndex(e);var g=null;var c=false;if(a=="left"){if(d>0){g=d-1;c=true}}else{if(a=="right"){if(d<b){g=d+1;c=true}}}if(c){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(f),"columnIndex:int":d,"toColumn:int":g},scope:this,success:function(i,k){var j=Ext.decode(i.responseText);if(j.success){f.remove(e,false);var l=e.getPositionEl().dom;l.parentNode.removeChild(l);f.insert(g,e);var h=f.items.get(b);h.getEl().setStyle("margin-right",0);f.doLayout()}else{alert(j.msg)}},failure:function(h,i){Ext.MessageBox.alert("failure",h.responseText)}})}},delColumn:function(a){Ext.Msg.confirm("Confirm",_("Are you sure you want to delete this column?"),function(c){if(c=="yes"){var d=a.findParentByType("portal");var b=this.calcColumnIndex(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(d),"columnIndex:int":b},scope:this,success:function(v,j){var p=Ext.decode(v.responseText);if(p.success){var o=a.container;var u=o.getViewSize();var t=u.width-o.getPadding("lr");var l=(a.getSize().width+a.getEl().getMargins("lr"))/t;var g=[];var q=d.items;for(var k=0,n=q.getCount();k<n;++k){var s=q.get(k);if(k!==b){var r=s.getEl();var h=s.getSize().width+r.getMargins("lr");var f=(h/t)/(1-l);s.columnWidth=f;g.push(f)}}var m=d.getLayout();if(m.splitBars){m.splitBars[b].destroy(true)}a.ownerCt.remove(a,true);var e=q.get(g.length-1);this._adjustLastColumn(e,g);d.doLayout();this.changeColumnsWidth(d,g)}else{alert(p.msg)}},failure:function(e,f){Ext.MessageBox.alert("failure",e.responseText)}})}},this)},showWidgetsView:function(a){if(!this.widgetsPanel){this.widgetsPanel=new Anz.dashboard.WidgetsView({portalUrl:this.portalUrl,url:this.contextUrl+"/@@widgetView/getWidgets",width:515,height:350})}this.currentPage=a;this.widgetsPanel.show(null,this.addWidget.createDelegate(this))},addWidget:function(a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addWidget",method:"POST",params:{"pageIndex:int":this.calcPageIndex(this.currentPage),"columnIndex:int":0,"widgetIndex:int":0,widgetId:a.id},scope:this,success:function(b,e){var d=Ext.decode(b.responseText);if(d.success){var c=this.currentPage.getComponent(0);c.insert(0,{xtype:a.id,options:{},title:a.title,iconCls:a.icon,tools:this.widgetTools,contextUrl:this.contextUrl});c.doLayout()}else{alert(d.msg)}},failure:function(b,c){Ext.MessageBox.alert("failure",b.responseText)}})},moveWidget:function(e){var h=this.currentWidget;var i=h.findParentByType("portal");var j=this.calcWidgetPos(h);var f=j.page;var c=j.col;var d=j.pos;var k=null;var b=null;if(e=="left"){k=c-1;k=k>0?k:0;var a=i.getComponent(k);var g=a.items.getCount();b=d<g?d:g}else{if(e=="right"){k=c+1;k=k<j.colCount?k:j.colCount;var a=i.getComponent(k);var g=a.items.getCount();b=d<g?d:g}else{if(e=="up"){k=c;b=d-1;b=b>0?b:0}else{if(e=="down"){k=c;var a=i.getComponent(k);var g=a.items.getCount();b=d+1;b=b<g?b:g}}}}if((c!==k)||(d!==b)){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveWidget",method:"POST",params:{"pageIndex:int":f,"columnIndex:int":c,"widgetIndex:int":j.pos,"toPage:int":f,"toColumn:int":k,"toWidget:int":b},scope:this,success:function(l,n){var m=Ext.decode(l.responseText);if(m.success){var o=i.getComponent(c);o.remove(h,false);var q=h.getPositionEl().dom;q.parentNode.removeChild(q);var p=i.getComponent(k);p.insert(b,h);i.doLayout()}else{alert("move widget failure.")}},failure:function(l,m){Ext.MessageBox.alert("failure",l.responseText)}})}},changeWidgetColor:function(b){var c=this.currentWidget;var a=this.calcWidgetPos(c);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeWidgetColor",method:"POST",params:{"pageIndex:int":a.page,"columnIndex:int":a.col,"widgetIndex:int":a.pos,color:b},scope:this,success:function(m,g){var k=Ext.decode(m.responseText);if(k.success){var e=c.getEl().query("*[class*=x-panel]");for(var h=0,j=e.length;h<j;++h){var d=e[h];var l=d.className;var f=l.split(c.baseCls);d.className=f.join("x-panel-green")}}else{alert("change color failure")}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})},changeWidgetOptions:function(a){var g=a.getPreferences();var n=a.options;var l=[];var h=[];for(var e=0,k=g.length;e<k;++e){var d=g[e];var b=d.name;l.push(b);var f=n[b];if(typeof f==="string"){f=Utf8.decode(f)}var m={};Ext.apply(m,d);m.value=(f!==undefined)?f:d.value;h.push(m)}var c=new Ext.FormPanel({labelWidth:80,bodyStyle:"padding:15px;",border:false,width:500,autoHeight:true,defaults:{anchor:"100%"},defaultType:"textfield",items:h});var j=new Ext.Window({layout:"fit",title:"Edit "+a.title,width:640,autoHeight:true,modal:true,items:c,buttons:[{text:_("Save"),iconCls:"icon-save",handler:function(o,r){var p=c.getForm();o.disable();var q=o.nextSibling();q.disable();if(p.isValid()){var i=this.calcWidgetPos(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeWidgetOptions",method:"POST",form:p.id,params:{"pageIndex:int":i.page,"columnIndex:int":i.col,"widgetIndex:int":i.pos,"names:list":l},scope:this,success:function(s,u){var t=Ext.decode(s.responseText);if(t.success){a.updateOptions(t.options)}else{alert(t.msg)}},failure:function(s,t){Ext.MessageBox.alert("failure",s.responseText)}})}else{o.enable();q.enable()}j.close()},scope:this},{text:_("Cancel"),scope:this,handler:function(i,o){j.close()}}]});j.show()},collapseWidget:function(b){var c=!b.collapsed;b.toggleCollapse(true);var a=this.calcWidgetPos(b);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/collapseWidget",method:"POST",params:{"pageIndex:int":a.page,"columnIndex:int":a.col,"widgetIndex:int":a.pos,"collapse:int":c?1:0},scope:this,success:function(d,f){var e=Ext.decode(d.responseText);if(!e.success){alert(e.msg)}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})},delWidget:function(a){var b=new Ext.Window({layout:"fit",title:a.title,width:300,autoHeight:true,modal:true,html:_("Are you sure to delete this widget?"),buttons:[{text:_("Delete"),width:"auto",iconCls:"icon-delete",handler:function(d,f){var c=this.calcWidgetPos(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delWidget",method:"POST",params:{"pageIndex:int":c.page,"columnIndex:int":c.col,"widgetIndex:int":c.pos},scope:this,success:function(e,h){var g=Ext.decode(e.responseText);if(g.success){a.ownerCt.remove(a,true)}else{alert(g.msg)}},failure:function(e,g){Ext.MessageBox.alert("failure",e.responseText)}});b.close()},scope:this},{text:_("Collapse"),scope:this,handler:function(c,d){this.collapseWidget(a);b.close()}},{text:_("Cancel"),scope:this,handler:function(c,d){b.close()}}]});b.show()},_buildPortalCfg:function(a,c){var b={xtype:"portal",title:c,frame:false,autoHeight:true,style:"padding: 10px 10px 0 10px;",bodyStyle:"padding: 5px 5px 5px 0",tools:this.pageTools,toolscope:["search","pin","gear"],items:a,listeners:{validatedrop:{scope:this,fn:function(f){var d=f.panel;d.lastPos=this.calcWidgetPos(d)}},drop:{scope:this,fn:function(h){var d=h.panel;var g=d.lastPos;var f=d.findParentByType("portal");Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveWidget",method:"POST",params:{"pageIndex:int":g.page,"columnIndex:int":g.col,"widgetIndex:int":g.pos,"toPage:int":this.calcPageIndex(f),"toColumn:int":h.columnIndex,"toWidget:int":h.position},scope:this,success:function(e,j){var i=Ext.decode(e.responseText);if(i.success){delete d.lastPos}else{alert("move widget failure.")}},failure:function(e,i){Ext.MessageBox.alert("failure",e.responseText)}})}},columnresize:{scope:this,fn:function(k){var n=null;var e=[];var l=k.items;for(var g=0,h=l.getCount();g<h;++g){var m=l.get(g);if(!n){var j=m.container;var o=j.getViewSize();n=o.width-j.getPadding("lr")}var f=m.el.getWidth();e.push(f/n)}var d=l.get(e.length-1);this._adjustLastColumn(d,e);this.changeColumnsWidth(k,e)}}}};return b}}}();
/* - anzi18n.js - */
Ext.namespace("Anz");Anz.i18n={};function _(a){if(Anz.i18n[a]){a=Anz.i18n[a]}return a}var Utf8={encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}return b}};
/* - Portal.js - */
/*
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ux.Portal=Ext.extend(Ext.Panel,{layout:"portalcolumn",layoutConfig:{margin:5,split:true},autoScroll:true,cls:"x-portal",defaultType:"portalcolumn",initComponent:function(){Ext.ux.Portal.superclass.initComponent.call(this);this.addEvents({validatedrop:true,beforedragover:true,dragover:true,beforedrop:true,drop:true,columnresize:true})},initEvents:function(){Ext.ux.Portal.superclass.initEvents.call(this);this.dd=new Ext.ux.Portal.DropZone(this,this.dropConfig)},beforeDestroy:function(){if(this.dd){this.dd.unreg()}Ext.ux.Portal.superclass.beforeDestroy.call(this)}});Ext.reg("portal",Ext.ux.Portal);Ext.ux.Portal.DropZone=function(a,b){this.portal=a;Ext.dd.ScrollManager.register(a.body);Ext.ux.Portal.DropZone.superclass.constructor.call(this,a.bwrap.dom,b);a.body.ddScrollConfig=this.ddScrollConfig};Ext.extend(Ext.ux.Portal.DropZone,Ext.dd.DropTarget,{ddScrollConfig:{vthresh:50,hthresh:-1,animate:true,increment:200},createEvent:function(a,f,d,b,h,g){return{portal:this.portal,panel:d.panel,columnIndex:b,column:h,position:g,data:d,source:a,rawEvent:f,status:this.dropAllowed}},notifyOver:function(v,t,w){var f=t.getXY();var a=this.portal;var n=v.proxy;if(!this.grid){this.grid=this.getGrid()}var b=a.body.dom.clientWidth;if(!this.lastCW){this.lastCW=b}else{if(this.lastCW!=b){this.lastCW=b;a.doLayout();this.grid=this.getGrid()}}var d=0;var l=this.grid.columnX;var m=false;for(var s=l.length;d<s;d++){if(f[0]<(l[d].x+l[d].w)){m=true;break}}if(!m){d--}var q;var k=false;var i=0;var u=a.items.itemAt(d);var o=u.items.items;var j=false;for(var s=o.length;i<s;i++){q=o[i];var r=q.el.getHeight();if(r===0){j=true}else{if((q.el.getY()+(r/2))>f[1]){k=true;break}}}i=(k&&q?i:u.items.getCount())+(j?-1:0);var g=this.createEvent(v,t,w,d,u,i);if(a.fireEvent("validatedrop",g)!==false&&a.fireEvent("beforedragover",g)!==false){n.getProxy().setWidth("auto");if(q){n.moveProxy(q.el.dom.parentNode,k?q.el.dom:null)}else{n.moveProxy(u.el.dom,null)}this.lastPos={c:u,col:d,p:j||(k&&q)?i:false};this.scrollPos=a.body.getScroll();a.fireEvent("dragover",g);return g.status}else{return g.status}},notifyOut:function(){delete this.grid},notifyDrop:function(k,g,f){delete this.grid;if(!this.lastPos){return}var i=this.lastPos.c;var b=this.lastPos.col;var j=this.lastPos.p;var a=this.createEvent(k,g,f,b,i,j!==false?j:i.items.getCount());if(this.portal.fireEvent("validatedrop",a)!==false&&this.portal.fireEvent("beforedrop",a)!==false){k.proxy.getProxy().remove();k.panel.el.dom.parentNode.removeChild(k.panel.el.dom);if(j!==false){if(i==k.panel.ownerCt&&(i.items.items.indexOf(k.panel)<=j)){j++}i.insert(j,k.panel)}else{i.add(k.panel)}i.doLayout();this.portal.fireEvent("drop",a);var l=this.scrollPos.top;if(l){var h=this.portal.body.dom;setTimeout(function(){h.scrollTop=l},10)}}delete this.lastPos},getGrid:function(){var a=this.portal.bwrap.getBox();a.columnX=[];this.portal.items.each(function(b){a.columnX.push({x:b.el.getX(),w:b.el.getWidth()})});return a},unreg:function(){Ext.ux.Portal.DropZone.superclass.unreg.call(this)}});
/* - PortalColumn.js - */
/*
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ux.PortalColumn=Ext.extend(Ext.Panel,{layout:"anchor",frame:false,border:false,closable:true,defaultType:"portlet",cls:"x-column-portal"});Ext.reg("portalcolumn",Ext.ux.PortalColumn);
/* - columnlayout-ux.js - */
Ext.layout.PortalColumnLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,extraCls:"x-column",scrollOffset:0,margin:0,split:false,fitHeight:false,isValidParent:function(b,a){return b.getEl().dom.parentNode==this.innerCt.dom},renderAll:function(a,b){if(this.split&&!this.splitBars){this.splitBars=[];this.margin=5}Ext.layout.PortalColumnLayout.superclass.renderAll.apply(this,arguments)},onLayout:function(g,m){var j=g.items.items,k=j.length,n,o,d;if(!this.innerCt){m.addClass("x-column-layout-ct");this.innerCt=m.createChild({cls:"x-column-inner",style:{position:"relative"}});this.innerCt.createChild({cls:"x-clear"})}this.renderAll(g,this.innerCt);var r=Ext.isIE&&m.dom!=Ext.getBody().dom?m.getStyleSize():m.getViewSize();if(r.width<1&&r.height<1){return}var p=r.width-m.getPadding("lr")-this.scrollOffset,e=r.height-m.getPadding("tb");var q=this.availableWidth=p;if(this.split){this.minWidth=Math.min(q/k,100);this.maxWidth=q-((this.minWidth+5)*(k?(k-1):1))}this.innerCt.setSize(p,this.fitHeight?e:undefined);if(this.fitHeight){this.innerCt.setSize(p,e)}else{this.innerCt.setWidth(p)}var f;for(d=0;d<k;d++){n=j[d];o=n.getEl();if(this.margin&&(d<(k-1))){o.setStyle("margin-right",this.margin+"px")}if(n.columnWidth){f=d}else{q-=(n.getSize().width+o.getMargins("lr"))}}var a=(q=q<0?0:q);var l=0;for(d=0;d<k;d++){n=j[d];o=n.getEl();if(n.columnWidth){var p=(d==f)?a:Math.floor(n.columnWidth*q);if(this.fitHeight){n.setSize(p-o.getMargins("lr"),e)}else{n.setWidth(p-o.getMargins("lr"))}a-=p}else{if(this.fitHeight){n.setHeight(e)}}if(this.split){var b=o.getWidth();if(d<(k-1)){l+=b;if(this.splitBars[d]){this.splitBars[d].el.setHeight(e)}else{this.splitBars[d]=new Ext.SplitBar(this.innerCt.createChild({cls:"x-layout-split x-layout-split-west",style:{top:"0px",left:l+"px",height:e+"px"}}),o);this.splitBars[d].index=d;this.splitBars[d].leftComponent=n;this.splitBars[d].addListener("resize",this.onColumnResize,this);this.splitBars[d].minSize=this.minWidth}l+=this.splitBars[d].el.getWidth()}delete n.columnWidth}}if(this.split){this.setMaxWidths()}},onColumnResize:function(j,g){if(j.dragSpecs.startSize){j.leftComponent.setWidth(g);var d=this.container.items.items;var f=g-j.dragSpecs.startSize;for(var e=j.index+1,a=d.length;f&&e<a;e++){var h=d[e];var b=h.el.getWidth();var g=b-f;if(g<this.minWidth){h.setWidth(this.minWidth)}else{if(g>this.maxWidth){f-=(g-this.maxWidth);h.setWidth(this.maxWidth)}else{h.setWidth(h.el.getWidth()-f);break}}}this.setMaxWidths();this.container.fireEvent("columnresize",this.container)}},setMaxWidths:function(){var a=this.container.items.items;var d=a[a.length-1].el.dom.offsetWidth-100;for(var b=a.length-2;b>-1;b--){var j=this.splitBars[b],f=j.el,h=a[b],e=h.el;var g=e.dom.offsetWidth;f.setStyle("left",(e.getX()-Ext.fly(e.dom.parentNode).getX()+g)+"px");j.maxSize=g+d;d=g-100}},onResize:function(){if(this.split){var b=this.container.items.items;if(b[0].rendered){var a=0;for(var d=0;d<b.length;d++){var e=b[d];a+=e.el.getWidth()+e.el.getMargins("lr")}for(var d=0;d<b.length;d++){var e=b[d];e.columnWidth=(e.el.getWidth()+e.el.getMargins("lr"))/a}}}Ext.layout.PortalColumnLayout.superclass.onResize.apply(this,arguments)}});Ext.Container.LAYOUTS.portalcolumn=Ext.layout.PortalColumnLayout;
/* - carousel.js - */
/*
 * Ext Core Library 3.0
 * http://extjs.com/
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * 
 * MIT Licensed - http://extjs.com/license/mit.txt
 */
Ext.ns("Ext.ux");Ext.ux.Carousel=Ext.extend(Ext.util.Observable,{interval:3,transitionDuration:1,transitionType:"carousel",transitionEasing:"easeOut",itemSelector:"img",activeSlide:0,autoPlay:false,showPlayButton:false,pauseOnNavigate:false,wrap:false,freezeOnHover:false,navigationOnHover:false,hideNavigation:false,width:null,height:null,constructor:function(b,a){a=a||{};Ext.apply(this,a);Ext.ux.Carousel.superclass.constructor.call(this,a);this.addEvents("beforeprev","prev","beforenext","next","change","play","pause","freeze","unfreeze");this.el=Ext.get(b);this.slides=this.els=[];if(this.autoPlay||this.showPlayButton){this.wrap=true}if(this.autoPlay&&typeof a.showPlayButton==="undefined"){this.showPlayButton=true}this.initMarkup();this.initEvents();if(this.carouselSize>0){this.refresh()}},initMarkup:function(){var b=Ext.DomHelper;this.carouselSize=0;var a=this.el.select(this.itemSelector);this.els.container=b.append(this.el,{cls:"ux-carousel-container"},true);this.els.slidesWrap=b.append(this.els.container,{cls:"ux-carousel-slides-wrap"},true);this.els.navigation=b.append(this.els.container,{cls:"ux-carousel-nav"},true).hide();this.els.caption=b.append(this.els.navigation,{tag:"h2",cls:"ux-carousel-caption"},true);this.els.navNext=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-next"},true);if(this.showPlayButton){this.els.navPlay=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-play"},true)}this.els.navPrev=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-prev"},true);this.slideWidth=this.width||this.el.getWidth(true);this.slideHeight=this.height||this.el.getHeight(true);this.els.container.setStyle({width:this.slideWidth+"px",height:this.slideHeight+"px"});this.els.caption.setWidth((this.slideWidth-(this.els.navNext.getWidth()*2)-(this.showPlayButton?this.els.navPlay.getWidth():0)-20)+"px");a.appendTo(this.els.slidesWrap).each(function(c){c=c.wrap({cls:"ux-carousel-slide"});this.slides.push(c);c.setWidth(this.slideWidth+"px").setHeight(this.slideHeight+"px")},this);this.carouselSize=this.slides.length;if(this.navigationOnHover){this.els.navigation.setStyle("top",(-1*this.els.navigation.getHeight())+"px")}this.el.clip()},initEvents:function(){this.els.navPrev.on("click",function(a){a.preventDefault();var b=a.getTarget();b.blur();if(Ext.fly(b).hasClass("ux-carousel-nav-disabled")){return}this.prev()},this);this.els.navNext.on("click",function(a){a.preventDefault();var b=a.getTarget();b.blur();if(Ext.fly(b).hasClass("ux-carousel-nav-disabled")){return}this.next()},this);if(this.showPlayButton){this.els.navPlay.on("click",function(a){a.preventDefault();a.getTarget().blur();if(this.playing){this.pause()}else{this.play()}},this)}if(this.freezeOnHover){this.els.container.on("mouseenter",function(){if(this.playing){this.fireEvent("freeze",this.slides[this.activeSlide]);Ext.TaskMgr.stop(this.playTask)}},this);this.els.container.on("mouseleave",function(){if(this.playing){this.fireEvent("unfreeze",this.slides[this.activeSlide]);Ext.TaskMgr.start(this.playTask)}},this,{buffer:(this.interval/2)*1000})}if(this.navigationOnHover){this.els.container.on("mouseenter",function(){if(!this.navigationShown){this.navigationShown=true;this.els.navigation.stopFx(false).shift({y:this.els.container.getY(),duration:this.transitionDuration})}},this);this.els.container.on("mouseleave",function(){if(this.navigationShown){this.navigationShown=false;this.els.navigation.stopFx(false).shift({y:this.els.navigation.getHeight()-this.els.container.getY(),duration:this.transitionDuration})}},this)}if(this.interval&&this.autoPlay){this.play()}},prev:function(){if(this.fireEvent("beforeprev")===false){return}if(this.pauseOnNavigate){this.pause()}this.setSlide(this.activeSlide-1);this.fireEvent("prev",this.activeSlide);return this},next:function(){if(this.fireEvent("beforenext")===false){return}if(this.pauseOnNavigate){this.pause()}this.setSlide(this.activeSlide+1);this.fireEvent("next",this.activeSlide);return this},play:function(){if(!this.playing){this.playTask=this.playTask||{run:function(){this.playing=true;this.setSlide(this.activeSlide+1)},interval:this.interval*1000,scope:this};this.playTaskBuffer=this.playTaskBuffer||new Ext.util.DelayedTask(function(){Ext.TaskMgr.start(this.playTask)},this);this.playTaskBuffer.delay(this.interval*1000);this.playing=true;if(this.showPlayButton){this.els.navPlay.addClass("ux-carousel-playing")}this.fireEvent("play")}return this},pause:function(){if(this.playing){Ext.TaskMgr.stop(this.playTask);this.playTaskBuffer.cancel();this.playing=false;if(this.showPlayButton){this.els.navPlay.removeClass("ux-carousel-playing")}this.fireEvent("pause")}return this},clear:function(){this.els.slidesWrap.update("");this.slides=[];this.carouselSize=0;this.pause();return this},add:function(b,a){var c=Ext.fly(b).appendTo(this.els.slidesWrap).wrap({cls:"ux-carousel-slide"});c.setWidth(this.slideWidth+"px").setHeight(this.slideHeight+"px");this.slides.push(c);if(a){this.refresh()}return this},refresh:function(){this.carouselSize=this.slides.length;this.els.slidesWrap.setWidth((this.slideWidth*this.carouselSize)+"px");if(this.carouselSize>0){if(!this.hideNavigation){this.els.navigation.show()}this.activeSlide=0;this.setSlide(0,true)}return this},setSlide:function(b,a){if(!this.wrap&&!this.slides[b]){return}else{if(this.wrap){if(b<0){b=this.carouselSize-1}else{if(b>this.carouselSize-1){b=0}}}}if(!this.slides[b]){return}this.els.caption.update(this.slides[b].child(":first-child",true).title||"");var d=b*this.slideWidth;if(!a){switch(this.transitionType){case"fade":this.slides[b].setOpacity(0);this.slides[this.activeSlide].stopFx(false).fadeOut({duration:this.transitionDuration/2,callback:function(){this.els.slidesWrap.setStyle("left",(-1*d)+"px");this.slides[this.activeSlide].setOpacity(1);this.slides[b].fadeIn({duration:this.transitionDuration/2})},scope:this});break;default:var c=(-1*d)+this.els.container.getX();this.els.slidesWrap.stopFx(false);this.els.slidesWrap.shift({duration:this.transitionDuration,x:c,easing:this.transitionEasing});break}}else{this.els.slidesWrap.setStyle("left","0")}this.activeSlide=b;this.updateNav();this.fireEvent("change",this.slides[b],b)},updateNav:function(){this.els.navPrev.removeClass("ux-carousel-nav-disabled");this.els.navNext.removeClass("ux-carousel-nav-disabled");if(!this.wrap){if(this.activeSlide===0){this.els.navPrev.addClass("ux-carousel-nav-disabled")}if(this.activeSlide===this.carouselSize-1){this.els.navNext.addClass("ux-carousel-nav-disabled")}}}});
/* - XCheckbox.js - */
Ext.ns("Ext.ux.form");Ext.ux.form.XCheckbox=Ext.extend(Ext.form.Checkbox,{offCls:"xcheckbox-off",onCls:"xcheckbox-on",disabledClass:"xcheckbox-disabled",submitOffValue:"false",submitOnValue:"true",checked:false,hiddenName:null,onRender:function(c){Ext.ux.form.XCheckbox.superclass.onRender.apply(this,arguments);var a=this.el.dom.tabIndex;var d=this.el.dom.id;this.el.remove();this.el=c.createChild({tag:"input",type:"hidden",name:this.hiddenName||this.name,id:d});if(!this.checked){this.checked=this.value===this.submitOnValue}this.updateHidden();this.wrap.replaceClass("x-form-check-wrap","xcheckbox-wrap");this.cbEl=this.wrap.createChild({tag:"a",cls:this.checked?this.onCls:this.offCls});var b=this.wrap.down("label");if(b){this.wrap.appendChild(b)}if(this.tooltip){this.cbEl.set({qtip:this.tooltip})}this.wrap.on({click:{scope:this,fn:this.onClick,delegate:"a"}});this.wrap.on({keyup:{scope:this,fn:this.onClick,delegate:"a"}});this.cbEl.dom.tabIndex=a},onClick:function(a){if(this.disabled||this.readOnly){return}if(!a.isNavKeyPress()){this.setValue(!this.checked)}},onDisable:function(){this.cbEl.addClass(this.disabledClass);this.el.dom.disabled=true},onEnable:function(){this.cbEl.removeClass(this.disabledClass);this.el.dom.disabled=false},setValue:function(a){if("string"==typeof a){this.checked=a===this.submitOnValue}else{this.checked=!(!a)}if(this.rendered&&this.cbEl){this.updateHidden();this.cbEl.removeClass([this.offCls,this.onCls]);this.cbEl.addClass(this.checked?this.onCls:this.offCls)}this.fireEvent("check",this,this.checked)},updateHidden:function(){this.el.dom.value=this.checked?this.submitOnValue:this.submitOffValue},getValue:function(){return this.checked}});Ext.reg("xcheckbox",Ext.ux.form.XCheckbox);
/* - anz_widget.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.base=Ext.extend(Ext.Panel,{draggable:true,loaded:false,maxRetryTimes:6,options:null,retried:0,cls:"x-widget",frame:false,style:"margin: 5px 0 0",initComponent:function(){Anz.widget.base.superclass.initComponent.call(this);var a=this.initialConfig;this.options=a.options;this.portalUrl=a.portalUrl;this.contextUrl=a.contextUrl;this.on({render:{scope:this,fn:function(b){if(!this.collapsed){this.display()}}},expand:{scope:this,fn:function(b){if(!this.loaded){this.display()}}}})},getCommonPreferences:function(){return[{xtype:"textfield",name:"title",fieldLabel:_("Title"),value:"Widget title"},{xtype:"xcheckbox",name:"showTitle",fieldLabel:_("Show title?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"showTitle:int"}]},getCustomisePreferences:function(){return[]},getPreferences:function(){return this.getCommonPreferences().concat(this.getCustomisePreferences())},updateOptions:function(a){},display:function(){},retryDisplay:function(){if(!this.loaded){if(this.retried<this.maxRetryTimes){this.retried+=1;this.display.defer(Math.pow(2,this.retried)*1000,this)}else{this.body.update(_("Sorry, we can not get data successfully now, you should refresh the whole page later to try again."))}}},getValue:function(b){var a=this.options[b];if(a===undefined){a=this.getDefaultValues()[b]}return a},getDefaultValues:function(){return{}}});
/* - widget_static_text.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.staticText=Ext.extend(Anz.widget.base,{bodyStyle:"padding: 5px",iconCls:"widget_postit_icon",getCustomisePreferences:function(){return[{xtype:"htmleditor",name:"text",fieldLabel:_("body"),value:_("Type text here")}]},updateOptions:function(a){this.options=a;this.setTitle(Utf8.decode(a.title));this.display()},display:function(){var a=this.getValue("text");if(!a){a=_("Type text here")}this.body.update(Utf8.decode(a))},convertTextToHTML:function(a){a=a.replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>").replace(/  /g,"&nbsp; ");return a},convertHTMLToText:function(a){a=a.replace(/\&amp;/g,"&").replace(/\&lt;/g,"<").replace(/&gt;/g,">").replace(/<br>/g,"\n").replace(/\&nbsp;/g," ");return a}});Ext.reg("widget_static_text",Anz.widget.staticText);
/* - widget_rss.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.rss=Ext.extend(Anz.widget.base,{bodyStyle:"padding: 5px",iconCls:"widget_rss_icon",entries:[],page:0,pageCount:1,count:null,getCustomisePreferences:function(){return[{xtype:"textfield",name:"feed",fieldLabel:_("Feed"),value:""},{xtype:"xcheckbox",name:"paging",fieldLabel:_("Paging?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"paging:int"},{xtype:"numberfield",name:"count",fieldLabel:_("Count"),value:5,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Normal",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Normal",_("Normal")],["Magazine",_("Magazine")],["Slideshow",_("Slideshow")],["Headline",_("Headline")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{count:5,paging:1,view:"Normal"}},updateOptions:function(d){var b=this.options;this.options=d;this.count=parseInt(this.getValue("count"));this.setTitle(Utf8.decode(this.getValue("title")));if(!this.collapsed){var e=b.feed;var c=b.view;var a=b.paging;if(e!==this.getValue("feed")){this.display()}else{if(c!==this.getValue("view")||a!==this.getValue("paging")){if(this.loaded){this.buildContents()}else{this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');this.loaded=false;var b=this.getValue("feed");var a=this.getValue("count");Ext.Ajax.request({url:this.initialConfig.contextUrl+"/@@rssWidget/entries",method:"POST",params:{url:b,"count:int":a},timeout:5000,scope:this,success:function(c,e){var d=Ext.decode(c.responseText);if(d.success){this.entries=d.entries;this.count=parseInt(this.getValue("count"));this.pageCount=Math.ceil(d.entries.length/this.count);this.buildContents();this.loaded=true}else{if(d.msg){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(c,e){var d=c.responseText;if(d){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachPagingHandler:function(){var a=this.body.child("a[class=prePage]");if(a){a.on("click",this.prePage,this)}var b=this.body.child("a[class=nextPage]");if(b){b.on("click",this.nextPage,this)}},prePage:function(){this.page-=1;this.buildContents()},nextPage:function(){this.page+=1;this.buildContents()},buildContents:function(){var c="";var a=this.getValue("view");switch(a){case"Normal":c=this.buildNormalHtml();break;case"Magazine":c=this.buildMagazineHtml();break;case"Slideshow":c=this.buildSlideshowHtml();break;case"Headline":c=this.buildHeadlineHtml();break;default:c=this.buildNormalHtml()}var d=this.getValue("paging")&&(this.pageCount>1)&&(a!=="Slideshow");if(d){c+='<div class="paging-bottom">';if(this.page!==0){c+=String.format('<a class="prePage" href="javascript:;">{0}</a>',_("prev"))}if(this.page<this.pageCount-1){c+=String.format('<a class="nextPage" href="javascript:;">{0}</a>',_("next"))}c+="<div>"}this.body.update(c);if(a==="Slideshow"){var b=this.getId()+"_slideshow";new Ext.ux.Carousel(b,{itemSelector:"div.item",interval:10,autoPlay:true,transitionEasing:"easeIn"})}if(d){this.attachPagingHandler()}},buildNormalHtml:function(){var h=this.page*this.count;var c=this.entries.slice(h,h+this.count);var f='<ul class="feedList">';var b=new Ext.Template("<li>",'<a href="{link}" title="{desc}" target="_blank">','{title}<span class="feedItemDate"> - {date}</span>',"</a>","</li>");for(var e=0,a=c.length;e<a;++e){var g=c[e];var d=this.convertDate(g.updated);f+=b.applyTemplate({title:g.title,desc:g.summary,link:g.link,date:this.getTimeDiff(d)})}f+="</ul>";return f},buildMagazineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="magazineView">'];var f=new Ext.Template('<div class="left">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="article">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"<p>{desc}</p>","</div>","</div>");var c=e[0];var j=this.convertDate(c.updated);d.push(f.applyTemplate({title:c.title,desc:c.summary,img:this.portalUrl+"/default_news.png",link:c.link,date:this.getTimeDiff(j)}));d.push('<div class="right">');var h=new Ext.Template('<div class="item">','<div class="thumbnail">','<img height="50" width="50" src="{img}"/>',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"</div>",'<div class="description">',"<p>{desc}</p>","</div>","</div>");for(var b=1,g=e.length;b<g;++b){var k=e[b];var j=this.convertDate(k.updated);d.push(h.applyTemplate({title:k.title,desc:k.summary,img:this.portalUrl+"/default_news.png",link:k.link,date:this.getTimeDiff(j)}))}d.push("</div></div>");return d.join("")},buildSlideshowHtml:function(){var c=this.entries;var d=this.getId()+"_slideshow";var g=[String.format('<div class="slideshowView" id="{0}">',d)];var b=new Ext.Template('<div class="item">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="content">','<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>',"</div>",'<div class="description">','<small class="feedItemDate">{date}</small>',"<p>{desc}</p>","</div>","</div>","</div>");for(var f=0,a=c.length;f<a;++f){var h=c[f];var e=this.convertDate(h.updated);g.push(b.applyTemplate({img:this.portalUrl+"/default_news.png",title:h.title,desc:h.summary,link:h.link,date:this.getTimeDiff(e)}))}g.push("</div>");return g.join("")},buildHeadlineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="headlineView">'];var f=new Ext.Template('<div class="top">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"</div>","</div>",'<div class="middle odd">','<div class="description">{desc}</div>',"</div>");var c=e[0];var j=this.convertDate(c.updated);d.push(f.applyTemplate({img:this.portalUrl+"/default_news.png",title:c.title,desc:c.summary,link:c.link,date:this.getTimeDiff(j)}));d.push('<ul class="bottom">');var h=new Ext.Template('<li class="item {cls}">','<div class="thumbnail">','<img height="50" width="50" src="{img}">',"</div>",'<h3><a href="{link}" target="_blank">{title}<small class="feedItemDate">{date}</small></a></h3>','<p class="description">{desc}</p>',"</li>");for(var b=1,g=e.length;b<g;++b){var k=e[b];var j=this.convertDate(k.updated);d.push(h.applyTemplate({cls:b%2?"even":"odd",img:this.portalUrl+"/default_news.png",title:k.title,desc:k.summary,link:k.link,date:this.getTimeDiff(j)}))}d.push("</ul></div>");return d.join("")},convertDate:function(a){var b=null;if(a){b=a.split("-").join("/")}return b},getTimeDiff:function(e){if(!e){return""}var d=new Date(e);var h=new Date();var c=h.valueOf()-d.valueOf();var i=c/86400000;i=parseInt(i);c=c-(i*86400000);var f=c/3600000;f=parseInt(f);c=c-(f*3600000);var b=c/60000;b=parseInt(b);c=c-(b*60000);var g=c/1000;g=parseInt(g);var a="";if(i>0){a=i+_("days before")}else{if(f>0){a=f+_("hours before")}else{if(b>0){a=b+_("minutes before")}}}return a}});Ext.reg("widget_rss",Anz.widget.rss);
/* - widget_weather.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.weather=Ext.extend(Anz.widget.base,{iconCls:"widget_weather_icon",getCustomisePreferences:function(){return[{xtype:"widget.weather.woeidfield",name:"woeid",fieldLabel:_("City"),value:""},{xtype:"combo",name:"units",hiddenName:"units",fieldLabel:_("Units"),value:"c",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["c",_("Celsius")],["f",_("Fahrenheit")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Compact",_("Compact")],["Today",_("Today")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},updateOptions:function(c){var a=this.options;this.options=c;this.setTitle(Utf8.decode(c.title));if(!this.collapsed){var d=a.woeid;var e=a.units;var b=a.view;if(d!==c.woeid){this.display()}else{if(e!==c.units){this.display()}else{if(b!==c.view){this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');var a=this.getValue("feed");Ext.Ajax.request({url:this.contextUrl+"/@@weatherWidget/weather",method:"POST",params:{woeid:this.options.woeid,units:this.options.units},timeout:5000,scope:this,success:function(b,f){var d=Ext.decode(b.responseText);if(d.success){var g=d.info;var c=this.options.view;var e=this.buildContents(g,c);this.body.update(e);this.loaded=true}else{if(d.msg){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(b,d){var c=b.responseText;if(c){this.body.update(c.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},buildContents:function(a,b){var c=null;switch(b){case"Compact":c=this.buildCompactHtml(a);break;case"Today":c=this.buildTodayHtml(a);break;default:c=this.buildTodayHtml(a)}return c},buildTodayHtml:function(b){var a=new Ext.Template('<div class="yw-forecast">','<div class="yw-loc">','<a target="_blank" href="{link}">{location}</a>',"</div>",'<div class="yw-date">{time}</div>','<div class="yw-cond">{condition_text}</div>',"<dl>","<dt>{Feels_Like}:</dt><dd>{temp}&deg;{temp_unit}</dd>","<dt>{Barometer}:</dt><dd>{pressure} {pressure_unit}</dd>","<dt>{Humidity}:</dt><dd>{humidity} %</dd>","<dt>{Visibility}:</dt><dd>{visibility} {visibility_unit}</dd>","<dt>{Wind}:</dt><dd>{wind_direction} {wind_speed} {speed_unit}</dd>","<dt>{Sunrise}:</dt><dd>{sunrise}</dd>","<dt>{Sunset}:</dt><dd>{sunset}</dd>","</dl>",'<div class="forecast-icon" style="background: transparent url(weather/{code}d-s.png) no-repeat scroll 0% 0%;"></div>','<div class="forecast-temp">','<div class="yw-temp">{temp}&deg;</div>',"<p>{High}: {high_temp}&deg; {Low}: {low_temp}&deg;</p>","</div>","</div>");return a.applyTemplate({Feels_Like:_("Feels Like"),Barometer:_("Barometer"),Humidity:_("Humidity"),Visibility:_("Visibility"),Wind:_("Wind"),Sunrise:_("Sunrise"),Sunset:_("Sunset"),High:_("High"),Low:_("Low"),location:b.location.city+","+b.location.country,time:b.condition.date,condition_text:this._conditionMap()[b.condition.code],temp:b.condition.temp,temp_unit:b.units.temperature,pressure:b.atmosphere.pressure,pressure_unit:b.units.pressure,humidity:b.atmosphere.humidity,visibility:b.atmosphere.visibility,visibility_unit:b.units.distance,wind_direction:b.wind.direction,wind_speed:b.wind.speed,speed_unit:b.units.speed,sunrise:b.astronomy.sunrise,sunset:b.astronomy.sunset,high_temp:b.forecast[0].high,low_temp:b.forecast[0].low,code:b.condition.code,link:b.link,Detailed_Forecast:_("Detailed Forecast")})},buildCompactHtml:function(b){var a=new Ext.Template('<div class="weather-compact">','<div class="yw-loc">','<a target="_blank" href="{link}">{location}</a>',"</div>",'<div class="today-weather">','<div class="weather-icon">','<img src="weather/{today_code}d-s.png" title="{today_code_text}" alt="{condition_text}">',"</div>",'<div class="weather-text">','<span class="weather-day">{today_date}<br>{today_weekday}</span>','<span class="weather-temp">{today_low_temp}/{today_high_temp}&deg;</span>',"</div>","</div>",'<div class="tomorrow-weather">','<div class="weather-icon">','<img src="weather/{next_code}d-s.png" title="{next_code_text}" alt="{next_code_text}">',"</div>",'<div class="weather-text">','<span class="weather-day">{next_weekday}</span>','<span class="weather-temp">{next_low_temp}/{next_high_temp}&deg;</span>',"</div>","</div>","</div>");return a.applyTemplate({link:b.link,location:b.location.city+","+b.location.country,today_code:b.forecast[0].code,today_code_text:this._conditionMap()[b.forecast[0].code],today_low_temp:b.forecast[0].low,today_high_temp:b.forecast[0].high,today_date:b.forecast[0].date,today_weekday:_(b.forecast[0].day),next_code:b.forecast[1].code,next_code_text:this._conditionMap()[b.forecast[1].code],next_low_temp:b.forecast[1].low,next_high_temp:b.forecast[1].high,next_date:b.forecast[1].date,next_weekday:_(b.forecast[1].day)})},_conditionMap:function(){return{"0":_("Tornado"),"1":_("Tropical storm"),"2":_("Hurricane"),"3":_("Severe thunderstorms"),"4":_("Thunderstorms"),"5":_("Mixed rain and snow"),"6":_("Mixed rain and sleet"),"7":_("Mixed snow and sleet"),"8":_("Freezing drizzle"),"9":_("Drizzle"),"10":_("Freezing rain"),"11":_("Showers"),"12":_("Showers"),"13":_("Snow flurries"),"14":_("Light snow showers"),"15":_("Blowing snow"),"16":_("Snow"),"17":_("Hail"),"18":_("Sleet"),"19":_("Dust"),"20":_("Foggy"),"21":_("Haze"),"22":_("Smoky"),"23":_("Blustery"),"24":_("Windy"),"25":_("Cold"),"26":_("Cloudy"),"27":_("Mostly cloudy"),"28":_("Mostly cloudy"),"29":_("Partly cloudy"),"30":_("Partly cloudy"),"31":_("Clear"),"32":_("Sunny"),"33":_("Fair"),"34":_("Fair"),"35":_("Mixed rain and hail"),"36":_("Hot"),"37":_("Isolated thunderstorms"),"38":_("Scattered thunderstorms"),"39":_("Scattered thunderstorms"),"40":_("Scattered showers"),"41":_("Heavy snow"),"42":_("Scattered snow showers"),"43":_("Heavy snow"),"44":_("Partly cloudy"),"45":_("Thundershowers"),"46":_("Snow showers"),"47":_("Isolated thundershowers")}}});Ext.reg("widget_weather",Anz.widget.weather);Anz.widget.weather.woeidfield=function(b){var c=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:"http://where.yahooapis.com/v1",listeners:{beforeload:{scope:this,fn:function(e,f){e.setApi(Ext.data.Api.actions.read,String.format("http://where.yahooapis.com/v1/places.q({0});count=0?format=json&appid=1dIus9DV34GjOFTpNt_pwV465FOtJItUDeDMDR2bLWox6hTqUHPrVtvCnvDBfYg-",f.query))}}}}),reader:new Ext.data.JsonReader({root:"places.place",id:"woeid"},[{name:"woeid",mapping:"woeid"},{name:"name",mapping:"name"}])});var d=new Ext.XTemplate('<tpl for="."><div class="search-item">',"<h3><span>{woeid}-{name}</span></h3>","</div></tpl>");var a={store:c,displayField:"title",typeAhead:false,loadingText:"Searching...",width:570,hideTrigger:true,tpl:d,itemSelector:"div.search-item",listeners:{select:{scope:this,fn:function(g,e,f){g.setValue(e.get("woeid"))}}}};if(b){Ext.apply(a,b)}Ext.apply(this,a);Anz.widget.weather.woeidfield.superclass.constructor.apply(this,arguments)};Ext.extend(Anz.widget.weather.woeidfield,Ext.form.ComboBox,{});Ext.reg("widget.weather.woeidfield",Anz.widget.weather.woeidfield);
/* - widget_calendar.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.calendar=Ext.extend(Anz.widget.base,{iconCls:"widget_calendar_icon",bodyStyle:"padding: 5px",view:"Month",tips:[],tipsCfg:[],getCustomisePreferences:function(){return[{xtype:"combo",name:"weekStart",hiddenName:"weekStart",fieldLabel:_("Start day of week"),value:"Mon",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Sun",_("Sun")],["Mon",_("Mon")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Month",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Month",_("Month")],["Week",_("Week")],["Agenda",_("Agenda")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{view:"Month",weekStart:"Mon"}},updateOptions:function(c){var a=this.options;this.options=c;this.setTitle(Utf8.decode(c.title));if(!this.collapsed){var d=a.weekStart;var b=a.view;if(d!==c.weekStart){this.display()}else{if(b!==c.view){this.display()}}}},display:function(c){this.body.update('<div class="loading-indicator">Loading...</div>');if(!c){c=new Date()}this.view=this.getValue("view");this.weekStart=this.getValue("weekStart");var d=null;var a=null;switch(this.view){case"Month":d=c.getFirstDateOfMonth();a=c.getLastDateOfMonth();break;case"Week":case"Agenda":var b=c.format("w");if(this.weekStart=="Sun"){d=c.add(Date.DAY,-b)}else{if(b==0){d=c.add(Date.DAY,-6)}else{d=c.add(Date.DAY,1-b)}}a=d.add(Date.DAY,6);break;default:break}Ext.Ajax.request({url:this.contextUrl+"/@@mergedRequest/getMergedData",method:"POST",params:{"requests:list":["events@@calendarWidget/events?start:date="+d.format("Y/m/d")+"&end:date="+a.format("Y/m/d"),"stateStr@@calendarWidget/getReviewStateString"]},timeout:5000,scope:this,success:function(f,i){var g=Ext.decode(f.responseText);var j=g.events;if(j.success){this.eventsInfo=j.events;this.startDate=d;var e=g.stateStr;if(e.success){this.stateStr=e.stateStr}var h=this.buildContents();this.destroyEventTips();this.body.update(h);this.createEventTips();this.attachListener();this.loaded=true}else{if(g.msg){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(e,g){var f=e.responseText;if(f){this.body.update(f.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachListener:function(){var a=this.view;switch(a){case"Month":this.buildMonthListener();break;case"Week":case"Agenda":this.buildWeekListener();break;default:break}},destroyEventTips:function(){var b=this.tips;for(var c=0,a=b.length;c<a;++c){Ext.QuickTips.unregister(b[c].target)}this.tips=[]},createEventTips:function(){var e=this.tipsCfg;for(var c=0,a=e.length;c<a;++c){var b=e[c];var d=new Ext.ToolTip({target:b.target,title:_("Events in this day"),width:"auto",dismissDelay:0,html:b.html,trackMouse:true});this.tips.push(d)}this.tipsCfg=[]},buildMonthListener:function(){var a=this.body.child("a[class=preTimeCycle]");a.on("click",this.preMonth,this);var b=this.body.child("a[class=nextTimeCycle]");b.on("click",this.nextMonth,this)},preMonth:function(){var a=this.startDate.add(Date.MONTH,-1);this.display(a)},nextMonth:function(){var a=this.startDate.add(Date.MONTH,1);this.display(a)},buildWeekListener:function(){var b=this.body.child("a[class=preTimeCycle]");b.on("click",this.preWeek,this);var a=this.body.child("a[class=nextTimeCycle]");a.on("click",this.nextWeek,this)},preWeek:function(){var a=this.startDate.add(Date.DAY,-7);this.display(a)},nextWeek:function(){var a=this.startDate.add(Date.DAY,7);this.display(a)},buildContents:function(){var a=this.view;var b=null;switch(a){case"Month":b=this.buildMonthHtml();break;case"Week":b=this.buildWeekHtml();break;case"Agenda":b=this.buildAgendaHtml();break;default:b=this.buildMonthHtml()}return b},buildMonthHtml:function(){var d=this.eventsInfo;var u=this.weekStart;var e=this.startDate;var m=e.getFirstDayOfMonth();var f=e.getLastDayOfMonth();var q=0;var s=0;if(u==="Sun"){q=m;s=6-f}else{if(m===0){q=6;s=0}else{q=m-1;s=7-f}}var r=e.getDaysInMonth();var h=[];for(var z=0;z<q;++z){h.push(0)}for(var z=1;z<=r;++z){h.push(z)}for(var z=0;z<s;++z){h.push(0)}var l=[];var y=new Ext.Template('<div class="calendar_month_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{month}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<table class="calendar_table">',"<thead><tr>",'<td class="theader">{day1}</td>','<td class="theader">{day2}</td>','<td class="theader">{day3}</td>','<td class="theader">{day4}</td>','<td class="theader">{day5}</td>','<td class="theader">{day6}</td>','<td class="theader">{day7}</td>',"</tr></thead>","<tbody>");if(u==="Sun"){l.push(y.applyTemplate({month:e.format("Y-m"),day1:_("Sun"),day2:_("Mon"),day3:_("Tue"),day4:_("Wed"),day5:_("Thu"),day6:_("Fri"),day7:_("Sat")}))}else{l.push(y.applyTemplate({month:e.format("Y-m"),day1:_("Mon"),day2:_("Tue"),day3:_("Wed"),day4:_("Thu"),day5:_("Fri"),day6:_("Sat"),day7:_("Sun")}))}var a=new Ext.Template('<td class="{dateCls}" id="date_{id}">{day}</td>');var C=new Ext.Template('<td class="{dateCls}" id="date_{id}">','<a target="_blank" href="{url}">{day}</a>','<img index="0" class="event" src="ext3/resources/images/default/s.gif">',"</td>");var w=new Ext.Template('<div class="eventCls"><h6>{title}   {start}-{end}</h6><p>{desc}</p></div>');for(var z=0,A=h.length;z<A;++z){if((z%7)==0){l.push("<tr>")}var x=h[z];if(x==0){l.push('<td class="blank_day"></td>')}else{var o=e.add(Date.DAY,x-1);var n=o.format("w");var p=false;if(n==0||n==6){p=true}var c=d[o.format("Ymd")];var g=c&&c.length;if(g){var b=o.format("Y/m/d");l.push(C.applyTemplate({dateCls:p?"weekend":"",id:o.format("Y_m_d"),day:x,url:this.portalUrl+"/search?"+this.stateStr+"start.query:record:list:date="+b+"+23%3A59%3A59&amp;start.range:record=max&amp;end.query:record:list:date="+b+"+00%3A00%3A00&amp;end.range:record=min"}));var t=[];for(var v=0,k=c.length;v<k;++v){var B=c[v];t.push(w.applyTemplate({title:B.title,start:B.start,end:B.end,desc:B.desc}))}this.tipsCfg.push({target:"date_"+o.format("Y_m_d"),html:t.join("")})}else{l.push(a.applyTemplate({dateCls:p?"weekend":"",id:o.format("Y_m_d"),day:x}))}}if((z%7)==6){l.push("</tr>")}}l.push("</tbody></table></div>");return l.join("")},buildWeekHtml:function(){var b=this.eventsInfo;var n=this.weekStart;var e=this.startDate;var d=e.add(Date.DAY,6);var h=[];var r=new Ext.Template('<div class="calendar_week_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{range}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<table class="calendar_table">',"<thead><tr>",'<td class="theader">{day1}</td>','<td class="theader">{day2}</td>','<td class="theader">{day3}</td>','<td class="theader">{day4}</td>','<td class="theader">{day5}</td>','<td class="theader">{day6}</td>','<td class="theader">{day7}</td>',"</tr></thead>","<tbody>");if(n==="Sun"){h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d"),day1:_("Sun"),day2:_("Mon"),day3:_("Tue"),day4:_("Wed"),day5:_("Thu"),day6:_("Fri"),day7:_("Sat")}))}else{h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d"),day1:_("Mon"),day2:_("Tue"),day3:_("Wed"),day4:_("Thu"),day5:_("Fri"),day6:_("Sat"),day7:_("Sun")}))}var a=new Ext.Template('<td class="weekDay {dateCls}" id="date_{id}">{day}</td>');var u=new Ext.Template('<td class="weekDay {dateCls}" id="date_{id}">','<a target="_blank" href="{url}">{day}</a>','<img index="0" class="event" src="ext3/resources/images/default/s.gif">',"</td>");var q=new Ext.Template('<div class="eventCls"><h6>{title}   {start}-{end}</h6><p>{desc}</p></div>');for(var s=0;s<7;++s){var l=e.add(Date.DAY,s);var k=l.format("w");var m=false;if(k==0||k==6){m=true}var c=b[l.format("Ymd")];var f=c&&c.length;if(f){h.push(u.applyTemplate({dateCls:m?"weekend":"",id:l.format("Y_m_d"),day:l.format("d"),url:""}));var o=[];for(var p=0,g=c.length;p<g;++p){var t=c[p];o.push(q.applyTemplate({title:t.title,start:t.start,end:t.end,desc:t.desc}))}this.tipsCfg.push({target:"date_"+l.format("Y_m_d"),html:o.join("")})}else{h.push(a.applyTemplate({dateCls:m?"weekend":"",id:l.format("Y_m_d"),day:l.format("d")}))}}h.push("</tbody></table></div>");return h.join("")},buildAgendaHtml:function(){var b=this.eventsInfo;var o=this.weekStart;var e=this.startDate;var d=e.add(Date.DAY,6);var h=[];var r=new Ext.Template('<div class="calendar_week_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{range}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<div class="">');h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d")}));var q=new Ext.Template('<div class="{eventCls}">','<span class="{dateCls}">{date}</span>','<span class="dayCls">{day}</span>','<a target="_blank" href="{url}" title="{desc}">{title}</a>',"</div>");var u=new Ext.Template('<div class="{eventCls}">','<span class="dateCls">{date}</span>','<span class="dayCls">{day}</span>','<span class="hint">{title}</span>',"</div>");for(var s=0;s<7;++s){var m=e.add(Date.DAY,s);var k=m.format("w");var n=false;if(k==0||k==6){n=true}var l=m.format("Y/m/d");var a=m.format("D");var c=b[m.format("Ymd")];var f=c&&c.length;if(f){for(var p=0,g=c.length;p<g;++p){var t=c[p];h.push(q.applyTemplate({eventCls:n?"eventItem weekend":"eventItem",dateCls:p==0?"dateCls":"dateHidden",dayCls:p==0?"dayCls":"dayHidden",date:l,day:_(a),url:t.url,title:t.title,desc:t.start+"-"+t.end+"    "+t.title}))}}else{h.push(u.applyTemplate({eventCls:n?"eventItem weekend":"eventItem",date:l,day:_(a),title:_("No event today.")}))}}h.push("</div></div>");return h.join("")}});Ext.reg("widget_calendar",Anz.widget.calendar);
/* - MultiSelect.js - */
/*
 * Ext JS Library 3.1.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ns("Ext.ux.form");Ext.ux.form.MultiSelect=Ext.extend(Ext.form.Field,{ddReorder:false,appendOnly:false,width:100,height:100,displayField:0,valueField:1,allowBlank:true,minSelections:0,maxSelections:Number.MAX_VALUE,blankText:Ext.form.TextField.prototype.blankText,minSelectionsText:"Minimum {0} item(s) required",maxSelectionsText:"Maximum {0} item(s) allowed",delimiter:",",defaultAutoCreate:{tag:"div"},initComponent:function(){Ext.ux.form.MultiSelect.superclass.initComponent.call(this);if(Ext.isArray(this.store)){if(Ext.isArray(this.store[0])){this.store=new Ext.data.ArrayStore({fields:["value","text"],data:this.store});this.valueField="value"}else{this.store=new Ext.data.ArrayStore({fields:["text"],data:this.store,expandData:true});this.valueField="text"}this.displayField="text"}else{this.store=Ext.StoreMgr.lookup(this.store)}this.addEvents({dblclick:true,click:true,change:true,drop:true})},onRender:function(c,b){Ext.ux.form.MultiSelect.superclass.onRender.call(this,c,b);var a=this.fs=new Ext.form.FieldSet({renderTo:this.el,title:this.legend,height:this.height,width:this.width,style:"padding:0;",tbar:this.tbar});a.body.addClass("ux-mselect");this.view=new Ext.ListView({multiSelect:true,store:this.store,columns:[{header:"Value",width:1,dataIndex:this.displayField}],hideHeaders:true});a.add(this.view);this.view.on("click",this.onViewClick,this);this.view.on("beforeclick",this.onViewBeforeClick,this);this.view.on("dblclick",this.onViewDblClick,this);this.hiddenName=this.name||Ext.id();var d={tag:"input",type:"hidden",value:"",name:this.hiddenName};this.hiddenField=this.el.createChild(d);this.hiddenField.dom.disabled=this.hiddenName!=this.name;a.doLayout()},afterRender:function(){Ext.ux.form.MultiSelect.superclass.afterRender.call(this);if(this.ddReorder&&!this.dragGroup&&!this.dropGroup){this.dragGroup=this.dropGroup="MultiselectDD-"+Ext.id()}if(this.draggable||this.dragGroup){this.dragZone=new Ext.ux.form.MultiSelect.DragZone(this,{ddGroup:this.dragGroup})}if(this.droppable||this.dropGroup){this.dropZone=new Ext.ux.form.MultiSelect.DropZone(this,{ddGroup:this.dropGroup})}},onViewClick:function(c,a,b,d){this.fireEvent("change",this,this.getValue(),this.hiddenField.dom.value);this.hiddenField.dom.value=this.getValue();this.fireEvent("click",this,d);this.validate()},onViewBeforeClick:function(c,a,b,d){if(this.disabled){return false}},onViewDblClick:function(c,a,b,d){return this.fireEvent("dblclick",c,a,b,d)},getValue:function(a){var d=[];var c=this.view.getSelectedIndexes();if(c.length==0){return""}for(var b=0;b<c.length;b++){d.push(this.store.getAt(c[b]).get((a!=null)?a:this.valueField))}return d.join(this.delimiter)},setValue:function(a){var b;var d=[];this.view.clearSelections();this.hiddenField.dom.value="";if(!a||(a=="")){return}if(!Ext.isArray(a)){a=a.split(this.delimiter)}for(var c=0;c<a.length;c++){b=this.view.store.indexOf(this.view.store.query(this.valueField,new RegExp("^"+a[c]+"$","i")).itemAt(0));d.push(b)}this.view.select(d);this.hiddenField.dom.value=this.getValue();this.validate()},reset:function(){this.setValue("")},getRawValue:function(a){var b=this.getValue(a);if(b.length){b=b.split(this.delimiter)}else{b=[]}return b},setRawValue:function(a){setValue(a)},validateValue:function(a){if(a.length<1){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}if(a.length<this.minSelections){this.markInvalid(String.format(this.minSelectionsText,this.minSelections));return false}if(a.length>this.maxSelections){this.markInvalid(String.format(this.maxSelectionsText,this.maxSelections));return false}return true},disable:function(){this.disabled=true;this.hiddenField.dom.disabled=true;this.fs.disable()},enable:function(){this.disabled=false;this.hiddenField.dom.disabled=false;this.fs.enable()},destroy:function(){Ext.destroy(this.fs,this.dragZone,this.dropZone);Ext.ux.form.MultiSelect.superclass.destroy.call(this)}});Ext.reg("multiselect",Ext.ux.form.MultiSelect);Ext.ux.Multiselect=Ext.ux.form.MultiSelect;Ext.ux.form.MultiSelect.DragZone=function(d,c){this.ms=d;this.view=d.view;var b=c.ddGroup||"MultiselectDD";var a;if(Ext.isArray(b)){a=b.shift()}else{a=b;b=null}Ext.ux.form.MultiSelect.DragZone.superclass.constructor.call(this,this.ms.fs.body,{containerScroll:true,ddGroup:a});this.setDraggable(b)};Ext.extend(Ext.ux.form.MultiSelect.DragZone,Ext.dd.DragZone,{onInitDrag:function(a,c){var b=Ext.get(this.dragData.ddel.cloneNode(true));this.proxy.update(b.dom);b.setWidth(b.child("em").getWidth());this.onStartDrag(a,c);return true},collectSelection:function(b){b.repairXY=Ext.fly(this.view.getSelectedNodes()[0]).getXY();var a=0;this.view.store.each(function(d){if(this.view.isSelected(a)){var e=this.view.getNode(a);var c=e.cloneNode(true);c.id=Ext.id();b.ddel.appendChild(c);b.records.push(this.view.store.getAt(a));b.viewNodes.push(e)}a++},this)},onEndDrag:function(a,b){var c=Ext.get(this.dragData.ddel);if(c&&c.hasClass("multi-proxy")){c.remove()}},getDragData:function(d){var c=this.view.findItemFromChild(d.getTarget());if(c){if(!this.view.isSelected(c)&&!d.ctrlKey&&!d.shiftKey){this.view.select(c);this.ms.setValue(this.ms.getValue())}if(this.view.getSelectionCount()==0||d.ctrlKey||d.shiftKey){return false}var b={sourceView:this.view,viewNodes:[],records:[]};if(this.view.getSelectionCount()==1){var a=this.view.getSelectedIndexes()[0];var f=this.view.getNode(a);b.viewNodes.push(b.ddel=f);b.records.push(this.view.store.getAt(a));b.repairXY=Ext.fly(f).getXY()}else{b.ddel=document.createElement("div");b.ddel.className="multi-proxy";this.collectSelection(b)}return b}return false},getRepairXY:function(a){return this.dragData.repairXY},setDraggable:function(a){if(!a){return}if(Ext.isArray(a)){Ext.each(a,this.setDraggable,this);return}this.addToGroup(a)}});Ext.ux.form.MultiSelect.DropZone=function(d,c){this.ms=d;this.view=d.view;var b=c.ddGroup||"MultiselectDD";var a;if(Ext.isArray(b)){a=b.shift()}else{a=b;b=null}Ext.ux.form.MultiSelect.DropZone.superclass.constructor.call(this,this.ms.fs.body,{containerScroll:true,ddGroup:a});this.setDroppable(b)};Ext.extend(Ext.ux.form.MultiSelect.DropZone,Ext.dd.DropZone,{getTargetFromEvent:function(b){var a=b.getTarget();return a},getDropPoint:function(g,j,d){if(j==this.ms.fs.body.dom){return"below"}var f=Ext.lib.Dom.getY(j),a=f+j.offsetHeight;var i=f+(a-f)/2;var h=Ext.lib.Event.getPageY(g);if(h<=i){return"above"}else{return"below"}},isValidDropPoint:function(b,e,a){if(!a.viewNodes||(a.viewNodes.length!=1)){return true}var c=a.viewNodes[0];if(c==e){return false}if((b=="below")&&(e.nextSibling==c)){return false}if((b=="above")&&(e.previousSibling==c)){return false}return true},onNodeEnter:function(d,a,c,b){return false},onNodeOver:function(h,a,g,d){var b=this.dropNotAllowed;var f=this.getDropPoint(g,h,a);if(this.isValidDropPoint(f,h,d)){if(this.ms.appendOnly){return"x-tree-drop-ok-below"}if(f){var c;if(f=="above"){b=h.previousSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-above";c="x-view-drag-insert-above"}else{b=h.nextSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-below";c="x-view-drag-insert-below"}if(this.lastInsertClass!=c){Ext.fly(h).replaceClass(this.lastInsertClass,c);this.lastInsertClass=c}}}return b},onNodeOut:function(d,a,c,b){this.removeDropIndicators(d)},onNodeDrop:function(b,k,j,g){if(this.ms.fireEvent("drop",this,b,k,j,g)===false){return false}var l=this.getDropPoint(j,b,k);if(b!=this.ms.fs.body.dom){b=this.view.findItemFromChild(b)}var c=(this.ms.appendOnly||(b==this.ms.fs.body.dom))?this.view.store.getCount():this.view.indexOf(b);if(l=="below"){c++}var d=false;if(g.sourceView==this.view){if(l=="below"){if(g.viewNodes[0]==b){g.viewNodes.shift()}}else{if(g.viewNodes[g.viewNodes.length-1]==b){g.viewNodes.pop()}}if(!g.viewNodes.length){return false}if(c>this.view.store.indexOf(g.records[0])){d="down";c--}}for(var h=0;h<g.records.length;h++){var a=g.records[h];if(g.sourceView){g.sourceView.store.remove(a)}this.view.store.insert(d=="down"?c:c++,a);var f=this.view.store.sortInfo;if(f){this.view.store.sort(f.field,f.direction)}}return true},removeDropIndicators:function(a){if(a){Ext.fly(a).removeClass(["x-view-drag-insert-above","x-view-drag-insert-left","x-view-drag-insert-right","x-view-drag-insert-below"]);this.lastInsertClass="_noclass"}},setDroppable:function(a){if(!a){return}if(Ext.isArray(a)){Ext.each(a,this.setDroppable,this);return}this.addToGroup(a)}});
/* - TreeComboSuperBox.js - */
Ext.namespace("Ext.ux","Ext.ux.form");Ext.ux.form.TreeComboSuperBox=Ext.extend(Ext.form.TriggerField,{displayField:null,displayFieldTpl:null,forceFormValue:false,hiddenName:null,multiSelect:true,navigateItemsWithTab:true,resizable:false,treeConfig:{rootVisible:false,border:false,autoScroll:true,loaded:false,root:{nodeType:"async",expanded:true,uiProvider:false},loader:{url:"request.php"}},valueDelimiter:",",valueField:null,initComponent:function(){Ext.apply(this,{editable:false,triggerConfig:{cls:"x-superboxselect-btns",children:[{tag:"div",cls:"x-superboxselect-btn-expand"}]},items:new Ext.util.MixedCollection(false)});Ext.ux.form.TreeComboSuperBox.superclass.initComponent.call(this);this.constructTree()},onRender:function(b,a){var c=this.hiddenName;this.hiddenName=null;Ext.ux.form.TreeComboSuperBox.superclass.onRender.call(this,b,a);this.hiddenName=c;this.el.removeClass("x-form-text").addClass("x-superboxselect-input-field");this.wrapEl=this.el.wrap({tag:"ul"});this.outerWrapEl=this.wrapEl.wrap({tag:"div",cls:"x-form-text x-superboxselect"});this.inputEl=this.el.wrap({tag:"li",cls:"x-superboxselect-input"});this.setupFormInterception()},constructTree:function(){if(!this.treePanel){if(!this.treeWidth){this.treeWidth=Math.max(200,this.width||200)}if(!this.treeHeight){this.treeHeight=200}Ext.apply(this.treeConfig,{renderTo:Ext.getBody(),floating:true,autoScroll:true,minWidth:200,minHeight:200,width:this.treeWidth,height:this.treeHeight});if(!this.treeConfig.listeners){this.treeConfig.listeners={}}Ext.apply(this.treeConfig.listeners,{hide:this.onTreeHide,show:this.onTreeShow,expandnode:this.onExpandOrCollapseNode,collapsenode:this.onExpandOrCollapseNode,resize:this.onTreeResize,scope:this});this.treePanel=new Ext.tree.TreePanel(this.treeConfig);this.treePanel.show();this.treePanel.hide();this.relayEvents(this.treePanel.loader,["beforeload","load","loadexception"]);if(this.resizable){this.resizer=new Ext.Resizable(this.treePanel.getEl(),{pinned:true,handles:"se"});this.mon(this.resizer,"resize",function(c,a,b){this.treePanel.setSize(a,b)},this)}}},onTriggerClick:function(){this.treePanel.show();this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")},onExpandOrCollapseNode:function(){if(!this.maxHeight||this.resizable){return}var a=this.treePanel.getTreeEl();var d=a.getHeight()-a.dom.clientHeight;var c=a.child("ul");var b=c.getHeight()+d;if(b>this.maxHeight){b=this.maxHeight}this.treePanel.setHeight(b)},onTreeResize:function(){if(this.treePanel){this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")}},onTreeShow:function(){Ext.getDoc().on("mousewheel",this.collapseIf,this);Ext.getDoc().on("mousedown",this.collapseIf,this)},onTreeHide:function(){Ext.getDoc().un("mousewheel",this.collapseIf,this);Ext.getDoc().un("mousedown",this.collapseIf,this)},collapseIf:function(a){if(!a.within(this.wrap)&&!a.within(this.treePanel.getEl())){this.collapse()}},collapse:function(){this.treePanel.hide()},getValue:function(){var a=[];this.items.each(function(b){a.push(b.value)});return a.join(this.valueDelimiter)},setValue:function(e){if(!this.rendered){this.value=e;return}this.removeAllItems();if(Ext.isEmpty(e)){return}var a=e;if(!Ext.isArray(e)){e=""+e;a=e.split(this.valueDelimiter)}if(this.multiSelect){Ext.each(a,function(m){var j=m;var n=m;var i=m;var l="";var k="";this.addItemBox(j,n,i,l,k)},this)}else{var g=a[0];var c=g;var h=g;var b=g;var f="";var d="";this.addItemBox(c,h,b,f,d)}},removeAllItems:function(){this.items.each(function(a){a.preDestroy(true)},this);return this},getCaption:function(b){if(typeof this.displayFieldTpl==="string"){this.displayFieldTpl=new Ext.XTemplate(this.displayFieldTpl)}var a;if(this.displayFieldTpl){a=this.displayFieldTpl.apply(b.attributes)}else{if(this.displayField){a=b.attributes[this.displayField]}}return a},addItemBox:function(d,h,l,k,e){var j=this.items;for(var b=0,f=j.getCount();b<f;++b){var c=j.get(b);if(c.value===d){return}}if(!this.multiSelect){this.removeAllItems()}var g;var a=Ext.id(null,"sbx-item");var c=new Ext.ux.form.SuperBoxSelectItem({owner:this,renderTo:this.wrapEl,caption:l,display:h,value:d,key:a,listeners:{remove:function(i){if(this.fireEvent("beforeremoveitem",this,i.value)===false){return}this.items.removeKey(i.key)},destroy:function(){this.collapse();this.autoSize().validateValue()},scope:this}});c.render();g={tag:"input",type:"hidden",value:d,name:(this.hiddenName||this.name)};if(this.disabled){Ext.apply(g,{disabled:"disabled"})}c.hidden=this.el.insertSibling(g,"before");this.items.add(a,c);this.applyEmptyText().autoSize().validateValue();if(this.multiSelect){this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")}else{this.collapse()}},applyEmptyText:function(){this.setRawValue("");if(this.items.getCount()>0){this.el.removeClass(this.emptyClass);this.setRawValue("");return this}if(this.rendered&&this.emptyText&&this.getRawValue().length<1){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass)}return this},validateValue:function(a){if(this.items.getCount()===0){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}this.clearInvalid();return true},markInvalid:function(c){var b,a;if(!this.rendered||this.preventMark){return}this.outerWrapEl.addClass(this.invalidClass);c=c||this.invalidText;switch(this.msgTarget){case"qtip":Ext.apply(this.el.dom,{qtip:c,qclass:"x-form-invalid-tip"});Ext.apply(this.wrapEl.dom,{qtip:c,qclass:"x-form-invalid-tip"});if(Ext.QuickTips){Ext.QuickTips.enable()}break;case"title":this.el.dom.title=c;this.wrapEl.dom.title=c;this.outerWrapEl.dom.title=c;break;case"under":if(!this.errorEl){b=this.getErrorCt();if(!b){this.el.dom.title=c;break}this.errorEl=b.createChild({cls:"x-form-invalid-msg"});this.errorEl.setWidth(b.getWidth(true)-20)}this.errorEl.update(c);Ext.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case"side":if(!this.errorIcon){b=this.getErrorCt();if(!b){this.el.dom.title=c;break}this.errorIcon=b.createChild({cls:"x-form-invalid-icon"})}this.alignErrorIcon();Ext.apply(this.errorIcon.dom,{qtip:c,qclass:"x-form-invalid-tip"});this.errorIcon.show();this.on("resize",this.alignErrorIcon,this);break;default:a=Ext.getDom(this.msgTarget);a.innerHTML=c;a.style.display=this.msgDisplay;break}this.fireEvent("invalid",this,c)},clearInvalid:function(){if(!this.rendered||this.preventMark){return}this.outerWrapEl.removeClass(this.invalidClass);switch(this.msgTarget){case"qtip":this.el.dom.qtip="";this.wrapEl.dom.qtip="";break;case"title":this.el.dom.title="";this.wrapEl.dom.title="";this.outerWrapEl.dom.title="";break;case"under":if(this.errorEl){Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl,this)}break;case"side":if(this.errorIcon){this.errorIcon.dom.qtip="";this.errorIcon.hide();this.un("resize",this.alignErrorIcon,this)}break;default:var a=Ext.getDom(this.msgTarget);a.innerHTML="";a.style.display="none";break}this.fireEvent("valid",this)},alignErrorIcon:function(){if(this.wrap){this.errorIcon.alignTo(this.wrap,"tl-tr",[Ext.isIE?5:2,3])}},clearCurrentFocus:function(){if(this.currentFocus){this.currentFocus.onLnkBlur();this.currentFocus=null}return this},setupFormInterception:function(){var a;this.findParentBy(function(c){if(c.getForm){a=c.getForm()}});if(a){var b=a.getValues;a.getValues=function(d){this.el.dom.disabled=true;var c=this.el.dom.value;this.setRawValue("");var e=b.call(a);this.el.dom.disabled=false;this.setRawValue(c);if(this.forceFormValue&&this.items.getCount()===0){e[this.name]=""}return d?Ext.urlEncode(e):e}.createDelegate(this)}},onResize:function(a,c,e,b){var d=Ext.isIE6?4:Ext.isIE7?1:Ext.isIE8?1:0;if(this.wrapEl){this._width=a;this.outerWrapEl.setWidth(a-d)}Ext.ux.form.TreeComboSuperBox.superclass.onResize.call(this,a,c,e,b);this.autoSize()},autoSize:function(){if(!this.rendered){return this}if(!this.metrics){this.metrics=Ext.util.TextMetrics.createInstance(this.el)}var c=this.el,b=c.dom.value,e=document.createElement("div");if(b===""&&this.emptyText&&this.items.getCount()<1){b=this.emptyText}e.appendChild(document.createTextNode(b));b=e.innerHTML;e=null;b+="&#160;";var a=Math.max(this.metrics.getWidth(b)+24,24);if(typeof this._width!="undefined"){a=Math.min(this._width,a)}this.el.setWidth(a);if(Ext.isIE){this.el.dom.style.top="0"}this.fireEvent("autosize",this,a);return this}});Ext.reg("treecombosuperbox",Ext.ux.form.TreeComboSuperBox);Ext.ux.form.SuperBoxSelectItem=function(a){Ext.apply(this,a);Ext.ux.form.SuperBoxSelectItem.superclass.constructor.call(this)};Ext.ux.form.SuperBoxSelectItem=Ext.extend(Ext.ux.form.SuperBoxSelectItem,Ext.Component,{initComponent:function(){Ext.ux.form.SuperBoxSelectItem.superclass.initComponent.call(this)},onElClick:function(b){var c=this.owner;c.clearCurrentFocus().collapse();if(c.navigateItemsWithTab){this.focus()}else{c.el.dom.focus();var a=this;(function(){this.onLnkFocus();c.currentFocus=this}).defer(10,this)}},onLnkClick:function(a){if(a){a.stopEvent()}this.preDestroy();if(!this.owner.navigateItemsWithTab){this.owner.el.focus()}},onLnkFocus:function(){this.el.addClass("x-superboxselect-item-focus");this.owner.outerWrapEl.addClass("x-form-focus")},onLnkBlur:function(){this.el.removeClass("x-superboxselect-item-focus");this.owner.outerWrapEl.removeClass("x-form-focus")},enableElListeners:function(){this.el.on("click",this.onElClick,this,{stopEvent:true});this.el.addClassOnOver("x-superboxselect-item x-superboxselect-item-hover")},enableLnkListeners:function(){this.lnk.on({click:this.onLnkClick,focus:this.onLnkFocus,blur:this.onLnkBlur,scope:this})},enableAllListeners:function(){this.enableElListeners();this.enableLnkListeners()},disableAllListeners:function(){this.el.removeAllListeners();this.lnk.un("click",this.onLnkClick,this);this.lnk.un("focus",this.onLnkFocus,this);this.lnk.un("blur",this.onLnkBlur,this)},onRender:function(c,a){Ext.ux.form.SuperBoxSelectItem.superclass.onRender.call(this,c,a);var e=this.el;if(e){e.remove()}this.el=e=c.createChild({tag:"li"},c.last());e.addClass("x-superboxselect-item");var d=this.owner.navigateItemsWithTab?(Ext.isSafari?"button":"a"):"span";var f=this.key;Ext.apply(e,{focus:function(){var g=this.down(d+".x-superboxselect-item-close");if(g){g.focus()}},preDestroy:function(){this.preDestroy()}.createDelegate(this)});this.enableElListeners();e.update(this.caption);var b={tag:d,"class":"x-superboxselect-item-close",tabIndex:this.owner.navigateItemsWithTab?"0":"-1"};if(d==="a"){b.href="#"}this.lnk=e.createChild(b);if(!this.disabled){this.enableLnkListeners()}else{this.disableAllListeners()}this.on({disable:this.disableAllListeners,enable:this.enableAllListeners,scope:this});this.setupKeyMap()},setupKeyMap:function(){this.keyMap=new Ext.KeyMap(this.lnk,[{key:[Ext.EventObject.BACKSPACE,Ext.EventObject.DELETE,Ext.EventObject.SPACE],fn:this.preDestroy,scope:this},{key:[Ext.EventObject.RIGHT,Ext.EventObject.DOWN],fn:function(){this.moveFocus("right")},scope:this},{key:[Ext.EventObject.LEFT,Ext.EventObject.UP],fn:function(){this.moveFocus("left")},scope:this},{key:[Ext.EventObject.HOME],fn:function(){var a=this.owner.items.get(0).el.focus();if(a){a.el.focus()}},scope:this},{key:[Ext.EventObject.END],fn:function(){this.owner.el.focus()},scope:this},{key:Ext.EventObject.ENTER,fn:function(){}}]);this.keyMap.stopEvent=true},moveFocus:function(a){var b=this.el[a=="left"?"prev":"next"]()||this.owner.el;b.focus.defer(100,b)},preDestroy:function(a){if(this.fireEvent("remove",this)===false){return}var b=function(){if(this.owner.navigateItemsWithTab){this.moveFocus("right")}this.hidden.remove();this.hidden=null;this.destroy()};if(a){b.call(this)}else{this.el.hide({duration:0.2,callback:b,scope:this})}return this},kill:function(){this.hidden.remove();this.hidden=null;this.purgeListeners();this.destroy()},onDisable:function(){if(this.hidden){this.hidden.dom.setAttribute("disabled","disabled")}this.keyMap.disable();Ext.ux.form.SuperBoxSelectItem.superclass.onDisable.call(this)},onEnable:function(){if(this.hidden){this.hidden.dom.removeAttribute("disabled")}this.keyMap.enable();Ext.ux.form.SuperBoxSelectItem.superclass.onEnable.call(this)},onDestroy:function(){Ext.destroy(this.lnk,this.el);Ext.ux.form.SuperBoxSelectItem.superclass.onDestroy.call(this)}});
/* - widget_folder_contents.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.folderContents=Ext.extend(Anz.widget.base,{iconCls:"widget_folder_contents_icon",entries:[],page:0,pageCount:1,count:null,getCustomisePreferences:function(){var a=this.portalUrl.split("/").pop();return[{xtype:"treecombosuperbox",name:"paths",fieldLabel:_("Paths"),hiddenName:"paths:list",navigateItemsWithTab:true,resizable:true,allowBlank:false,msgTarget:"under",displayFieldTpl:"{text}",value:"/"+a,multiSelect:true,treeWidth:353,treeConfig:{height:110,rootVisible:true,autoScroll:true,root:{nodeType:"async",text:_("Root"),id:"root",expanded:true,path:"/"+a},loader:{url:this.portalUrl+"/@@folderContentsView/getChildNodesData"},listeners:{beforeload:{fn:function(c){var b=c.getOwnerTree().getLoader();b.baseParams.path=c.attributes.path}},click:{fn:function(d,g){var c=d.attributes.path;var i=d.text;var b=this.getCaption(d);var h="";var f="";this.addItemBox(c,i,b,h,f)}}}}},{xtype:"xcheckbox",name:"searchSub",fieldLabel:_("Search sub-directory?"),submitOffValue:0,submitOnValue:1,value:0,hiddenName:"searchSub:int"},{xtype:"multiselect",fieldLabel:_("Types"),name:"types",width:360,height:"auto",allowBlank:true,displayField:"name",valueField:"id",store:new Ext.data.JsonStore({autoDestroy:true,autoLoad:true,url:this.contextUrl+"/@@folderContentsWidget/types",root:"types",fields:["id","name"]})},{xtype:"numberfield",name:"recentDays",fieldLabel:_("Recent days"),value:0,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"numberfield",name:"sort_limit",fieldLabel:_("Max count"),value:0,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"xcheckbox",name:"paging",fieldLabel:_("Paging?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"paging:int"},{xtype:"numberfield",name:"count",fieldLabel:_("Count"),value:5,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Normal",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Normal",_("Normal")],["Magazine",_("Magazine")],["Slideshow",_("Slideshow")],["Headline",_("Headline")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{searchSub:0,recentDays:0,sort_limit:0,count:5,paging:1,view:"Normal"}},updateOptions:function(i){var a=this.options;this.options=i;this.count=parseInt(this.getValue("count"));this.setTitle(Utf8.decode(this.getValue("title")));if(!this.collapsed){var c=a.paths;var g=a.types;var d=a.searchSub;var h=a.recentDays;var e=a.sort_limit;var f=a.view;var b=a.paging;if((c!==this.getValue("paths"))||(g!==this.getValue("types"))||(d!==this.getValue("searchSub"))||(h!==this.getValue("recentDays"))||(e!==this.getValue("sort_limit"))){this.display()}else{if((f!==this.getValue("view"))||(b!==this.getValue("paging"))){if(this.loaded){this.buildContents()}else{this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');this.loaded=false;var d=this.getValue("paths");var b=this.getValue("types");var c=this.getValue("searchSub");var e=this.getValue("recentDays");var a=this.getValue("sort_limit");Ext.Ajax.request({url:this.contextUrl+"/@@folderContentsWidget/items",method:"POST",params:{"paths:list":d,searchSub:c,portal_types:b,"recentDays:int":e,"sort_limit:int":a},timeout:5000,scope:this,success:function(f,h){var g=Ext.decode(f.responseText);if(g.success){this.entries=g.items;this.count=parseInt(this.getValue("count"));this.pageCount=Math.ceil(this.entries.length/this.count);this.buildContents();this.loaded=true}else{if(g.msg){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(f,h){var g=f.responseText;if(g){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachPagingHandler:function(){var a=this.body.child("a[class=prePage]");if(a){a.on("click",this.prePage,this)}var b=this.body.child("a[class=nextPage]");if(b){b.on("click",this.nextPage,this)}},prePage:function(){this.page-=1;this.buildContents()},nextPage:function(){this.page+=1;this.buildContents()},buildContents:function(){var c="";var a=this.getValue("view");switch(a){case"Normal":c=this.buildNormalHtml();break;case"Magazine":c=this.buildMagazineHtml();break;case"Slideshow":c=this.buildSlideshowHtml();break;case"Headline":c=this.buildHeadlineHtml();break;default:c=this.buildNormalHtml()}var d=this.getValue("paging")&&(this.pageCount>1)&&(a!=="Slideshow");if(d){c+='<div class="paging-bottom">';if(this.page!==0){c+=String.format('<a class="prePage" href="javascript:;">{0}</a>',_("prev"))}if(this.page<this.pageCount-1){c+=String.format('<a class="nextPage" href="javascript:;">{0}</a>',_("next"))}c+="<div>"}this.body.update(c);if(a==="Slideshow"){var b=this.getId()+"_slideshow";new Ext.ux.Carousel(b,{itemSelector:"div.item",interval:10,autoPlay:true,transitionEasing:"easeIn"})}if(d){this.attachPagingHandler()}},buildNormalHtml:function(){var g=this.page*this.count;var c=this.entries.slice(g,g+this.count);var e='<ul class="itemList">';var b=new Ext.Template("<li>",'<img width="16" height="16" src="{iconSrc}">','<a href="{link}" title="{desc}" target="_blank">',"{title}","</a>",'<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</li>");for(var d=0,a=c.length;d<a;++d){var f=c[d];e+=b.applyTemplate({iconSrc:this.portalUrl+"/"+f.icon,title:f.title,desc:f.desc,link:f.url,authorLink:this.portalUrl+"/author/"+f.author_id,author:f.author,date:f.modified,shortDate:new Date(f.modified).format("Y/m/d")})}e+="</ul>";return e},buildMagazineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="magazineView">'];var f=new Ext.Template('<div class="left">','<div class="crop">','<img height="234" width="234" src="{img}"/>',"</div>",'<div class="article">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</div>","</div>");var c=e[0];d.push(f.applyTemplate({title:c.title,desc:c.desc,img:this.portalUrl+"/default_news.png",link:c.link,authorLink:this.portalUrl+"/author/"+c.author_id,author:c.author,date:c.modified,shortDate:new Date(c.modified).format("Y/m/d")}));d.push('<div class="right">');var g=new Ext.Template('<div class="item">','<div class="thumbnail">','<img height="50" width="50" src="{img}"/>',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</div>","<p>{desc}</p>","</div>");for(var b=1,h=e.length;b<h;++b){var j=e[b];d.push(g.applyTemplate({title:j.title,desc:j.desc,img:this.portalUrl+"/default_news.png",link:j.link,authorLink:portalUrl+"/author/"+j.author_id,author:j.author,date:j.modified,shortDate:new Date(j.modified).format("Y/m/d")}))}d.push("</div></div>");return d.join("")},buildSlideshowHtml:function(c){var c=this.entries;var d=this.getId()+"_slideshow";var f=[String.format('<div class="slideshowView" id="{0}">',d)];var b=new Ext.Template('<div class="item">','<div class="crop">','<img src="{img}">',"</div>",'<div class="content">','<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>',"</div>",'<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</div>","</div>");for(var e=0,a=c.length;e<a;++e){var g=c[e];f.push(b.applyTemplate({img:this.portalUrl+"/default_news.png",title:g.title,desc:g.desc,link:g.link,authorLink:this.portalUrl+"/author/"+g.author_id,author:g.author,date:g.modified,shortDate:new Date(g.modified).format("Y/m/d")}))}f.push("</div>");return f.join("")},buildHeadlineHtml:function(e){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="headlineView">'];var f=new Ext.Template('<div class="top">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</div>","</div>",'<div class="middle odd">',"<p>{desc}</p>","</div>");var c=e[0];d.push(f.applyTemplate({img:this.portalUrl+"/default_news.png",title:c.title,desc:c.desc,link:c.link,authorLink:this.portalUrl+"/author/"+c.author_id,author:c.author,date:c.modified,shortDate:new Date(c.modified).format("Y/m/d")}));d.push('<ul class="bottom">');var g=new Ext.Template('<li class="item {cls}">','<div class="thumbnail">','<img height="50" width="50" src="{img}">',"</div>",'<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</li>");for(var b=1,h=e.length;b<h;++b){var j=e[b];d.push(g.applyTemplate({cls:b%2?"even":"odd",img:this.portalUrl+"/default_news.png",title:j.title,desc:j.desc,link:j.link,authorLink:this.portalUrl+"/author/"+j.author_id,author:j.author,date:j.modified,shortDate:new Date(j.modified).format("Y/m/d")}))}d.push("</ul></div>");return d.join("")},getTimeDiff:function(e){if(!e){return""}var d=new Date(e);var h=new Date();var c=h.valueOf()-d.valueOf();var i=c/86400000;i=parseInt(i);c=c-(i*86400000);var f=c/3600000;f=parseInt(f);c=c-(f*3600000);var b=c/60000;b=parseInt(b);c=c-(b*60000);var g=c/1000;g=parseInt(g);var a="";if(i>0){a=i+"days before"}else{if(f>0){a=f+"hours before"}else{if(b>0){a=b+"minutes before"}}}return a}});Ext.reg("widget_folder_contents",Anz.widget.folderContents);
/* - widgetsview.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.dashboard");Anz.dashboard.WidgetsView=function(a){this.config=a};Anz.dashboard.WidgetsView.prototype={lookup:{},show:function(b,d){if(!this.win){this.initTemplates();this.store=new Ext.data.JsonStore({url:this.config.url,root:"widgets",fields:["id","title","desc","icon"]});this.store.load();var c=function(e){e.icon=this.config.portalUrl+"/"+e.icon+"64.png";e.Widget_Name=_("Widget name");e.Description=_("Description");this.lookup[e.id]=e;return e};this.view=new Ext.DataView({tpl:this.thumbTemplate,singleSelect:true,overClass:"x-view-over",itemSelector:"div.thumb-wrap",emptyText:'<div style="padding:10px;">No images match the specified filter</div>',store:this.store,listeners:{selectionchange:{fn:this.showDetails,scope:this,buffer:100},dblclick:{fn:this.doCallback,scope:this},loadexception:{fn:this.onLoadException,scope:this},beforeselect:{fn:function(e){return e.store.getRange().length>0}}},prepareData:c.createDelegate(this)});var a={title:_("Widgets list"),id:"widgets-chooser-dlg",layout:"border",minWidth:500,minHeight:300,modal:true,closeAction:"hide",border:false,items:[{id:"widget-chooser-view",region:"center",autoScroll:true,items:this.view},{id:"widget-detail-panel",region:"east",split:true,width:150,minWidth:150,maxWidth:250}],buttons:[{id:"ok-btn",text:_("OK"),handler:this.doCallback,scope:this},{text:_("Cancel"),handler:function(){this.win.hide()},scope:this}],keys:{key:27,handler:function(){this.win.hide()},scope:this}};Ext.apply(a,this.config);this.win=new Ext.Window(a)}this.reset();this.win.show(b);this.callback=d;this.animateTarget=b},initTemplates:function(){this.thumbTemplate=new Ext.XTemplate('<tpl for=".">','<div class="thumb-wrap" id="{id}">','<div class="thumb"><img src="{icon}" title="{title}"></div>',"<span>{title}</span></div>","</tpl>");this.thumbTemplate.compile();this.detailsTemplate=new Ext.XTemplate('<div class="details">','<tpl for=".">','<div class="thumb"><img src="{icon}"></div>','<div class="details-info">',"<div><b>{Widget_Name}: </b>","<span>{title}</span></div>","<div><b>{Description}: </b>","<span>{desc}</span></div>","</div>","</tpl>","</div>");this.detailsTemplate.compile()},showDetails:function(){var b=this.view.getSelectedNodes();var c=Ext.getCmp("widget-detail-panel").body;if(b&&b.length>0){b=b[0];Ext.getCmp("ok-btn").enable();var a=this.lookup[b.id];c.hide();this.detailsTemplate.overwrite(c,a);c.slideIn("l",{stopFx:true,duration:0.2})}else{Ext.getCmp("ok-btn").disable();c.update("")}},sortImages:function(){var a=Ext.getCmp("sortSelect").getValue();this.view.store.sort(a,a=="name"?"asc":"desc");this.view.select(0)},reset:function(){this.view.select(0)},doCallback:function(){var a=this.view.getSelectedNodes()[0];var c=this.callback;var b=this.lookup;this.win.hide(this.animateTarget,function(){if(a&&c){var d=b[a.id];c(d)}})},onLoadException:function(a,b){this.view.getEl().update('<div style="padding:10px;">Error loading images.</div>')}};
/* - TabMoreMenu.js - */
Ext.ux.TabMoreMenu=function(a){a=a||{};Ext.apply(this,a);Ext.ux.TabMoreMenu.superclass.constructor.call(this)};Ext.extend(Ext.ux.TabMoreMenu,Ext.util.Observable,{menuAlign:"tr-br?",menuOffsets:[0,-5],init:function(a){a.getTemplateArgs=this.getTemplateArgs.createDelegate(a);a.findTargets=this.findTargets.createDelegate(a);a.onStripMouseDown=this.onStripMouseDown.createDelegate(a);a.on("beforedestroy",this.beforedestroy,this);a.on("more",this.onMore,this);this.tab=a;if(this.menu){this.menu=Ext.menu.MenuMgr.get(this.menu);Ext.apply(this.menu,{defaultOffsets:this.menuOffsets,afterRender:function(){Ext.menu.Menu.superclass.afterRender.call(this);this.items.each(function(b){b.un("click",b.handler,b.scope)},this)}});this.menu.on("click",this.onMenuClick,this)}},onMenuClick:function(c,a,b){b.stopEvent();if(a.handler){a.handler.call(a.scope||this,this.menu.tabItem)}},onMore:function(c,a,b){c.stopEvent();this.menu.tabItem=a.item;if(this.menu){this.menu.show(b,this.menuAlign)}},getTemplateArgs:function(a){var b=Ext.TabPanel.prototype.getTemplateArgs.call(this,a);b.cls="x-tab-strip-more";return b},findTargets:function(b){var a=Ext.TabPanel.prototype.findTargets.call(this,b);a.close=false;a.more=b.getTarget(".x-tab-strip-close",this.strip);return a},onStripMouseDown:function(b){Ext.TabPanel.prototype.onStripMouseDown.call(this,b);var a=this.findTargets(b);if(a.more&&a.item){this.fireEvent("more",b,a,a.el)}},beforedestroy:function(){Ext.destroy(this.menu)}});
/* - anz_dashboard.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.dashboard");Anz.dashboard.app=function(){return{portalUrl:null,contextUrl:null,container:null,currentPage:null,pageLayout:null,currentWidget:null,pageTools:[],columnTools:[],widgetTools:[],widgetContextMenu:null,widgetsPanel:null,init:function(b,a){this.portalUrl=b;this.contextUrl=a;Ext.QuickTips.init();Ext.Ajax.request({url:this.contextUrl+"/@@mergedRequest/getMergedData",method:"POST",params:{"requests:list":["pageLayout@@dashboardView/getPageLayout","layoutCfg@@dashboardView/getLayoutConfig","widgets@@widgetView/getWidgets","i18n@@msgCatalog/catalogMapping?domain=anz.dashboard"]},scope:this,success:function(l,d){var h=Ext.decode(l.responseText);this.pageLayout=h.pageLayout.layout;var c=h.layoutCfg.config;Anz.i18n=h.i18n.texts;var k=h.widgets.widgets;var j={};for(var e=0,g=k.length;e<g;++e){var f=k[e];j[f.id]=f}this.constructPageTools();this.constructColumnTools();this.constructWidgetTools();this.constructPages(c,j)},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},destroy:function(){if(this.container){this.container.removeAll()}},calcPageIndex:function(g){var d=null;var c=null;if(this.pageLayout==="tile"){c=this.container.items;for(var f=0,b=c.getCount();f<b;++f){if(g.getId()===c.get(f).id){d=f;break}}}else{var a=this.container.getActiveTab();var e=this.container.items;for(var f=0;f<e.getCount();f++){if(a==e.get(f)){d=f;break}}}return d},calcColumnIndex:function(d){var b=null;var e=d.ownerCt.items;for(var c=0,a=e.getCount();c<a;++c){if(d.getId()===e.get(c).id){b=c;break}}return b},calcWidgetPos:function(h){var g=h.findParentByType("portal");var b=this.calcPageIndex(g);var f=this.calcColumnIndex(h.ownerCt);var e=null;var c=h.ownerCt.items;for(var d=0,a=c.getCount();d<a;++d){if(h.getId()===c.get(d).getId()){e=d;break}}return{page:b,col:f,pos:e,pageCount:g.ownerCt.items.getCount(),colCount:g.items.getCount()}},constructPageTools:function(){this.pageTools=[{id:"add_widget",qtip:_("Add widget"),scope:this,handler:function(c,b,a){this.showWidgetsView(a)}},{id:"add_page",qtip:_("Add page"),scope:this,handler:function(c,b,a){this.addPage(this.calcPageIndex(a)+1)}},{id:"save",qtip:_("Edit page"),scope:this,handler:function(c,b,a){this.editPage(a)}},{id:"up",qtip:_("Move page up"),scope:this,handler:function(c,b,a){this.movePage(a,"up")}},{id:"down",qtip:_("Move page down"),scope:this,handler:function(c,b,a){this.movePage(a,"down")}},{id:"close",qtip:_("Delete page"),scope:this,handler:function(c,b,a){this.delPage(a)}}]},constructColumnTools:function(){this.columnTools=[{id:"add_column",qtip:_("Add column"),scope:this,handler:function(d,c,a){var e=a.findParentByType("portal");var b=this.calcColumnIndex(a);this.addColumn(e,b+1)}},{id:"left",qtip:_("Move column left"),scope:this,handler:function(c,b,a){this.moveColumn(a,"left")}},{id:"right",qtip:_("Move column right"),scope:this,handler:function(c,b,a){this.moveColumn(a,"right")}},{id:"close",qtip:_("Delete the column"),scope:this,handler:function(c,b,a){this.delColumn(a)}}]},constructWidgetTools:function(){this.widgetTools=[{id:"toggle",qtip:_("Collapse the widget"),scope:this,handler:function(c,b,a){this.collapseWidget(a)}},{id:"gear",qtip:_("Config the widget"),scope:this,handler:function(c,b,a){this.currentWidget=a;if(!this.widgetContextMenu){this.widgetContextMenu=new Ext.menu.Menu({shadow:false,style:{background:"white none repeat scroll 0 0",textAlign:"left",border:"1px solid #999"},items:[{id:"menuitem_color",text:_("color"),iconCls:"color_widget",menu:{xtype:"colormenu",colors:["D96666","E67399","B373B3","8C66D9","668CB3","668CD9","59BFB3","65AD89","4CB052","8CBF40","BFBF4D","E0C240","F2A640","E6804D","BE9494","A992A9","8997A5","94A2BE","85AAA5","A7A77D","C4A883"],scope:this,handler:function(d,e){this.changeWidgetColor(e)}}},{id:"menuitem_up",text:_("up"),iconCls:"move_up",scope:this,handler:function(d,f){this.moveWidget("up");f.stopEvent()}},{id:"menuitem_right",text:_("right"),iconCls:"move_right",scope:this,handler:function(d,f){this.moveWidget("right");f.stopEvent()}},{id:"menuitem_down",text:_("down"),iconCls:"move_down",scope:this,handler:function(d,f){this.moveWidget("down");f.stopEvent()}},{id:"menuitem_left",text:_("left"),iconCls:"move_left",scope:this,handler:function(d,f){this.moveWidget("left");f.stopEvent()}}]})}this.widgetContextMenu.showAt(c.getPoint())}},{id:"refresh",qtip:_("Refresh the widget"),scope:this,handler:function(d,b,a){var c=1+2}},{id:"save",qtip:_("Edit the widget"),scope:this,handler:function(c,b,a){this.changeWidgetOptions(a)}},{id:"close",qtip:_("Delete the widget"),scope:this,handler:function(c,b,a){this.delWidget(a)}}]},constructPages:function(t,p){var d={};if(this.pageLayout==="tile"){Ext.apply(d,{renderTo:"region-content"})}else{var m=Ext.get("region-content");var q=m.getWidth(true);Ext.apply(d,{renderTo:"region-content",activeTab:0,minTabWidth:115,tabWidth:135,width:q,autoHeight:true,plain:true,enableTabScroll:true,plugins:[new Ext.ux.TabMoreMenu({menu:[{id:"menuitem_edit_page",text:_("Edit page"),iconCls:"edit_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.editPage(j)}},{id:"menuitem_left",text:_("left"),iconCls:"move_left",scope:this,handler:function(i){var k=this.container.getActiveTab();var j=this.container.setActiveTab.createDelegate(this.container,[k]);this.movePage(k,"left",j)}},{id:"menuitem_right",text:_("right"),iconCls:"move_right",scope:this,handler:function(i){var k=this.container.getActiveTab();var j=this.container.setActiveTab.createDelegate(this.container,[k]);this.movePage(k,"right",j)}},{id:"menuitem_add_widget",text:_("Add widget"),iconCls:"x-tool-add_widget",scope:this,handler:function(i){var j=this.container.getActiveTab();this.showWidgetsView(j)}},{id:"menuitem_add_page",text:_("Add page"),iconCls:"x-tool-add_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.addPage(this.calcPageIndex(j)+1)}},{id:"menuitem_delete_page",text:_("Delete page"),iconCls:"delete_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.delPage(this.calcPageIndex(j)+1)}}]})]})}var l=[];for(var u=0,v=t.length;u<v;++u){var f=t[u];var h=f.columns.length;var x=[];for(var s=0;s<h;++s){var c=f.columns[s];var g={};g.title=_("column");g.columnWidth=parseFloat(c.width);g.style=c.style;g.tools=this.columnTools;var n=[];var o=c.widgets;var b=o.length;for(var r=0;r<b;++r){var e=o[r];var a={};a.portalUrl=this.portalUrl;a.contextUrl=this.contextUrl;a.xtype=e.id;a.options=e.options;a.title=Utf8.decode(e.options.title);a.collapsed=e.collapse;if(e.color){a.baseCls="x-panel-green"}if(p[e.id]){a.iconCls=p[e.id].icon}a.tools=this.widgetTools;n.push(a)}g.items=n;x.push(g)}var w=this._buildPortalCfg(x,Utf8.decode(f.title));l.push(w)}d.items=l;if(this.pageLayout==="tile"){this.container=new Ext.Panel(d)}else{this.container=new Ext.TabPanel(d)}},constructPage:function(c,a){var b=this._buildPortalCfg(c,"untitled page");if(a){this.container.insert(a,b)}else{this.container.add(b)}},addPage:function(a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addPage",method:"POST",params:{"pageIndex:int":a},scope:this,success:function(b,e){var d=Ext.decode(b.responseText);if(d.success){var c=[{title:_("column"),columnWidth:0.5,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]},{title:_("column"),columnWidth:0.5,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]}];this.constructPage(c,a);this.container.doLayout()}else{alert(d.msg)}},failure:function(b,c){Ext.MessageBox.alert("failure",b.responseText)}})},editPage:function(b){var a=new Ext.FormPanel({labelWidth:80,bodyStyle:"padding:15px;",border:false,width:500,autoHeight:true,defaults:{anchor:"100%"},defaultType:"textfield",items:[{name:"title",fieldLabel:"title",value:b.title},{name:"width",fieldLabel:"width",value:""},{xtype:"textarea",name:"style",fieldLabel:"style",value:""}]});var c=new Ext.Window({layout:"fit",title:_("Edit page"),width:640,autoHeight:true,modal:true,items:a,buttons:[{text:_("Save"),iconCls:"icon-save",handler:function(f,i){var g=a.getForm();f.disable();var h=f.nextSibling();h.disable();var d=g.getValues();if(g.isValid()){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/editPage",method:"POST",form:g.id,params:{"pageIndex:int":this.calcPageIndex(b)},scope:this,success:function(e,k){var j=Ext.decode(e.responseText);if(j.success){b.setTitle(d.title)}else{alert(j.msg)}},failure:function(e,j){alert(e.responseText)}})}else{f.enable();h.enable()}c.close()},scope:this},{text:_("Cancel"),scope:this,handler:function(d,f){c.close()}}]});c.show()},movePage:function(f,b,h){var a=this.container;var c=this.container.items.length-1;var e=this.calcPageIndex(f);var g=null;var d=false;if(b=="up"){if(e>0){g=e-1;d=true}}else{if(b=="down"){if(e<c){g=e+1;d=true}}else{if(b=="left"){if(e>0){g=e-1;d=true}}else{if(b=="right"){if(e<c){g=e+1;d=true}}}}}if(d){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/movePage",method:"POST",params:{"pageIndex:int":e,"toPage:int":g},scope:this,success:function(i,k){var j=Ext.decode(i.responseText);if(j.success){a.remove(f,false);var l=f.getPositionEl().dom;l.parentNode.removeChild(l);a.insert(g,f);a.doLayout();if(h){h()}}else{alert(j.msg)}},failure:function(i,j){Ext.MessageBox.alert("failure",i.responseText)}})}},delPage:function(a){if(this.container.items.length==1){alert(_("Can not delete the last page!"));return}Ext.Msg.confirm("Confirm",_("Are you sure you want to delete this page?"),function(c){if(c=="yes"){var b=this.calcPageIndex(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delPage",method:"POST",params:{"pageIndex:int":b},scope:this,success:function(d,g){var e=Ext.decode(d.responseText);if(e.success){if(this.pageLayout==="tile"){this.container.remove(a,true)}else{var f=this.container.getActiveTab();this.container.remove(f,true)}}else{alert(e.msg)}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})}},this)},addColumn:function(b,a){var a=a?a:0;Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(b),"columnIndex:int":a},scope:this,success:function(u,k){var o=Ext.decode(u.responseText);if(o.success){var p=b.items;var s=p.getCount()+1;var g=1/s;var t=null;var h=[];for(var l=0,m=p.getCount();l<m;++l){var r=p.get(l);if(!t){var n=r.container;t=n.getViewSize().width-n.getPadding("lr")}var q=r.getEl();var j=r.getSize().width+q.getMargins("lr");var f=(j/t)*(1-g);r.columnWidth=f;h.push(f)}var e={xtype:"portalcolumn",title:_("column"),columnWidth:g,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]};h.splice(a,0,g);b.insert(a,e);var d=p.get(s-1);this._adjustLastColumn(d,h);b.doLayout();this.changeColumnsWidth(b,h)}else{alert(o.msg)}},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},_adjustLastColumn:function(c,e){c.getEl().setStyle("margin-right",0);var d=0;for(var b=0,a=e.length-1;b<a;++b){d+=e[b]}c.columnWidth=1-d;e[e.length-1]=1-d},changeColumnsWidth:function(b,a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeColumnsWidth",method:"POST",params:{"pageIndex:int":this.calcPageIndex(b),"widths:list":a},scope:this,success:function(c,e){var d=Ext.decode(c.responseText);if(!d.success){alert(d.msg)}},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},moveColumn:function(e,a){var f=e.findParentByType("portal");var b=f.items.getCount()-1;var d=this.calcColumnIndex(e);var g=null;var c=false;if(a=="left"){if(d>0){g=d-1;c=true}}else{if(a=="right"){if(d<b){g=d+1;c=true}}}if(c){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(f),"columnIndex:int":d,"toColumn:int":g},scope:this,success:function(i,k){var j=Ext.decode(i.responseText);if(j.success){f.remove(e,false);var l=e.getPositionEl().dom;l.parentNode.removeChild(l);f.insert(g,e);var h=f.items.get(b);h.getEl().setStyle("margin-right",0);f.doLayout()}else{alert(j.msg)}},failure:function(h,i){Ext.MessageBox.alert("failure",h.responseText)}})}},delColumn:function(a){Ext.Msg.confirm("Confirm",_("Are you sure you want to delete this column?"),function(c){if(c=="yes"){var d=a.findParentByType("portal");var b=this.calcColumnIndex(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(d),"columnIndex:int":b},scope:this,success:function(v,j){var p=Ext.decode(v.responseText);if(p.success){var o=a.container;var u=o.getViewSize();var t=u.width-o.getPadding("lr");var l=(a.getSize().width+a.getEl().getMargins("lr"))/t;var g=[];var q=d.items;for(var k=0,n=q.getCount();k<n;++k){var s=q.get(k);if(k!==b){var r=s.getEl();var h=s.getSize().width+r.getMargins("lr");var f=(h/t)/(1-l);s.columnWidth=f;g.push(f)}}var m=d.getLayout();if(m.splitBars){m.splitBars[b].destroy(true)}a.ownerCt.remove(a,true);var e=q.get(g.length-1);this._adjustLastColumn(e,g);d.doLayout();this.changeColumnsWidth(d,g)}else{alert(p.msg)}},failure:function(e,f){Ext.MessageBox.alert("failure",e.responseText)}})}},this)},showWidgetsView:function(a){if(!this.widgetsPanel){this.widgetsPanel=new Anz.dashboard.WidgetsView({portalUrl:this.portalUrl,url:this.contextUrl+"/@@widgetView/getWidgets",width:515,height:350})}this.currentPage=a;this.widgetsPanel.show(null,this.addWidget.createDelegate(this))},addWidget:function(a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addWidget",method:"POST",params:{"pageIndex:int":this.calcPageIndex(this.currentPage),"columnIndex:int":0,"widgetIndex:int":0,widgetId:a.id},scope:this,success:function(b,e){var d=Ext.decode(b.responseText);if(d.success){var c=this.currentPage.getComponent(0);c.insert(0,{xtype:a.id,options:{},title:a.title,iconCls:a.icon,tools:this.widgetTools,contextUrl:this.contextUrl});c.doLayout()}else{alert(d.msg)}},failure:function(b,c){Ext.MessageBox.alert("failure",b.responseText)}})},moveWidget:function(e){var h=this.currentWidget;var i=h.findParentByType("portal");var j=this.calcWidgetPos(h);var f=j.page;var c=j.col;var d=j.pos;var k=null;var b=null;if(e=="left"){k=c-1;k=k>0?k:0;var a=i.getComponent(k);var g=a.items.getCount();b=d<g?d:g}else{if(e=="right"){k=c+1;k=k<j.colCount?k:j.colCount;var a=i.getComponent(k);var g=a.items.getCount();b=d<g?d:g}else{if(e=="up"){k=c;b=d-1;b=b>0?b:0}else{if(e=="down"){k=c;var a=i.getComponent(k);var g=a.items.getCount();b=d+1;b=b<g?b:g}}}}if((c!==k)||(d!==b)){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveWidget",method:"POST",params:{"pageIndex:int":f,"columnIndex:int":c,"widgetIndex:int":j.pos,"toPage:int":f,"toColumn:int":k,"toWidget:int":b},scope:this,success:function(l,n){var m=Ext.decode(l.responseText);if(m.success){var o=i.getComponent(c);o.remove(h,false);var q=h.getPositionEl().dom;q.parentNode.removeChild(q);var p=i.getComponent(k);p.insert(b,h);i.doLayout()}else{alert("move widget failure.")}},failure:function(l,m){Ext.MessageBox.alert("failure",l.responseText)}})}},changeWidgetColor:function(b){var c=this.currentWidget;var a=this.calcWidgetPos(c);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeWidgetColor",method:"POST",params:{"pageIndex:int":a.page,"columnIndex:int":a.col,"widgetIndex:int":a.pos,color:b},scope:this,success:function(m,g){var k=Ext.decode(m.responseText);if(k.success){var e=c.getEl().query("*[class*=x-panel]");for(var h=0,j=e.length;h<j;++h){var d=e[h];var l=d.className;var f=l.split(c.baseCls);d.className=f.join("x-panel-green")}}else{alert("change color failure")}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})},changeWidgetOptions:function(a){var g=a.getPreferences();var n=a.options;var l=[];var h=[];for(var e=0,k=g.length;e<k;++e){var d=g[e];var b=d.name;l.push(b);var f=n[b];if(typeof f==="string"){f=Utf8.decode(f)}var m={};Ext.apply(m,d);m.value=(f!==undefined)?f:d.value;h.push(m)}var c=new Ext.FormPanel({labelWidth:80,bodyStyle:"padding:15px;",border:false,width:500,autoHeight:true,defaults:{anchor:"100%"},defaultType:"textfield",items:h});var j=new Ext.Window({layout:"fit",title:"Edit "+a.title,width:640,autoHeight:true,modal:true,items:c,buttons:[{text:_("Save"),iconCls:"icon-save",handler:function(o,r){var p=c.getForm();o.disable();var q=o.nextSibling();q.disable();if(p.isValid()){var i=this.calcWidgetPos(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeWidgetOptions",method:"POST",form:p.id,params:{"pageIndex:int":i.page,"columnIndex:int":i.col,"widgetIndex:int":i.pos,"names:list":l},scope:this,success:function(s,u){var t=Ext.decode(s.responseText);if(t.success){a.updateOptions(t.options)}else{alert(t.msg)}},failure:function(s,t){Ext.MessageBox.alert("failure",s.responseText)}})}else{o.enable();q.enable()}j.close()},scope:this},{text:_("Cancel"),scope:this,handler:function(i,o){j.close()}}]});j.show()},collapseWidget:function(b){var c=!b.collapsed;b.toggleCollapse(true);var a=this.calcWidgetPos(b);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/collapseWidget",method:"POST",params:{"pageIndex:int":a.page,"columnIndex:int":a.col,"widgetIndex:int":a.pos,"collapse:int":c?1:0},scope:this,success:function(d,f){var e=Ext.decode(d.responseText);if(!e.success){alert(e.msg)}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})},delWidget:function(a){var b=new Ext.Window({layout:"fit",title:a.title,width:300,autoHeight:true,modal:true,html:_("Are you sure to delete this widget?"),buttons:[{text:_("Delete"),width:"auto",iconCls:"icon-delete",handler:function(d,f){var c=this.calcWidgetPos(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delWidget",method:"POST",params:{"pageIndex:int":c.page,"columnIndex:int":c.col,"widgetIndex:int":c.pos},scope:this,success:function(e,h){var g=Ext.decode(e.responseText);if(g.success){a.ownerCt.remove(a,true)}else{alert(g.msg)}},failure:function(e,g){Ext.MessageBox.alert("failure",e.responseText)}});b.close()},scope:this},{text:_("Collapse"),scope:this,handler:function(c,d){this.collapseWidget(a);b.close()}},{text:_("Cancel"),scope:this,handler:function(c,d){b.close()}}]});b.show()},_buildPortalCfg:function(a,c){var b={xtype:"portal",title:c,frame:false,autoHeight:true,style:"padding: 10px 10px 0 10px;",bodyStyle:"padding: 5px 5px 5px 0",tools:this.pageTools,toolscope:["search","pin","gear"],items:a,listeners:{validatedrop:{scope:this,fn:function(f){var d=f.panel;d.lastPos=this.calcWidgetPos(d)}},drop:{scope:this,fn:function(h){var d=h.panel;var g=d.lastPos;var f=d.findParentByType("portal");Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveWidget",method:"POST",params:{"pageIndex:int":g.page,"columnIndex:int":g.col,"widgetIndex:int":g.pos,"toPage:int":this.calcPageIndex(f),"toColumn:int":h.columnIndex,"toWidget:int":h.position},scope:this,success:function(e,j){var i=Ext.decode(e.responseText);if(i.success){delete d.lastPos}else{alert("move widget failure.")}},failure:function(e,i){Ext.MessageBox.alert("failure",e.responseText)}})}},columnresize:{scope:this,fn:function(k){var n=null;var e=[];var l=k.items;for(var g=0,h=l.getCount();g<h;++g){var m=l.get(g);if(!n){var j=m.container;var o=j.getViewSize();n=o.width-j.getPadding("lr")}var f=m.el.getWidth();e.push(f/n)}var d=l.get(e.length-1);this._adjustLastColumn(d,e);this.changeColumnsWidth(k,e)}}}};return b}}}();
/* - anzi18n.js - */
Ext.namespace("Anz");Anz.i18n={};function _(a){if(Anz.i18n[a]){a=Anz.i18n[a]}return a}var Utf8={encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}return b}};
/* - Portal.js - */
/*
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ux.Portal=Ext.extend(Ext.Panel,{layout:"portalcolumn",layoutConfig:{margin:5,split:true},autoScroll:true,cls:"x-portal",defaultType:"portalcolumn",initComponent:function(){Ext.ux.Portal.superclass.initComponent.call(this);this.addEvents({validatedrop:true,beforedragover:true,dragover:true,beforedrop:true,drop:true,columnresize:true})},initEvents:function(){Ext.ux.Portal.superclass.initEvents.call(this);this.dd=new Ext.ux.Portal.DropZone(this,this.dropConfig)},beforeDestroy:function(){if(this.dd){this.dd.unreg()}Ext.ux.Portal.superclass.beforeDestroy.call(this)}});Ext.reg("portal",Ext.ux.Portal);Ext.ux.Portal.DropZone=function(a,b){this.portal=a;Ext.dd.ScrollManager.register(a.body);Ext.ux.Portal.DropZone.superclass.constructor.call(this,a.bwrap.dom,b);a.body.ddScrollConfig=this.ddScrollConfig};Ext.extend(Ext.ux.Portal.DropZone,Ext.dd.DropTarget,{ddScrollConfig:{vthresh:50,hthresh:-1,animate:true,increment:200},createEvent:function(a,f,d,b,h,g){return{portal:this.portal,panel:d.panel,columnIndex:b,column:h,position:g,data:d,source:a,rawEvent:f,status:this.dropAllowed}},notifyOver:function(v,t,w){var f=t.getXY();var a=this.portal;var n=v.proxy;if(!this.grid){this.grid=this.getGrid()}var b=a.body.dom.clientWidth;if(!this.lastCW){this.lastCW=b}else{if(this.lastCW!=b){this.lastCW=b;a.doLayout();this.grid=this.getGrid()}}var d=0;var l=this.grid.columnX;var m=false;for(var s=l.length;d<s;d++){if(f[0]<(l[d].x+l[d].w)){m=true;break}}if(!m){d--}var q;var k=false;var i=0;var u=a.items.itemAt(d);var o=u.items.items;var j=false;for(var s=o.length;i<s;i++){q=o[i];var r=q.el.getHeight();if(r===0){j=true}else{if((q.el.getY()+(r/2))>f[1]){k=true;break}}}i=(k&&q?i:u.items.getCount())+(j?-1:0);var g=this.createEvent(v,t,w,d,u,i);if(a.fireEvent("validatedrop",g)!==false&&a.fireEvent("beforedragover",g)!==false){n.getProxy().setWidth("auto");if(q){n.moveProxy(q.el.dom.parentNode,k?q.el.dom:null)}else{n.moveProxy(u.el.dom,null)}this.lastPos={c:u,col:d,p:j||(k&&q)?i:false};this.scrollPos=a.body.getScroll();a.fireEvent("dragover",g);return g.status}else{return g.status}},notifyOut:function(){delete this.grid},notifyDrop:function(k,g,f){delete this.grid;if(!this.lastPos){return}var i=this.lastPos.c;var b=this.lastPos.col;var j=this.lastPos.p;var a=this.createEvent(k,g,f,b,i,j!==false?j:i.items.getCount());if(this.portal.fireEvent("validatedrop",a)!==false&&this.portal.fireEvent("beforedrop",a)!==false){k.proxy.getProxy().remove();k.panel.el.dom.parentNode.removeChild(k.panel.el.dom);if(j!==false){if(i==k.panel.ownerCt&&(i.items.items.indexOf(k.panel)<=j)){j++}i.insert(j,k.panel)}else{i.add(k.panel)}i.doLayout();this.portal.fireEvent("drop",a);var l=this.scrollPos.top;if(l){var h=this.portal.body.dom;setTimeout(function(){h.scrollTop=l},10)}}delete this.lastPos},getGrid:function(){var a=this.portal.bwrap.getBox();a.columnX=[];this.portal.items.each(function(b){a.columnX.push({x:b.el.getX(),w:b.el.getWidth()})});return a},unreg:function(){Ext.ux.Portal.DropZone.superclass.unreg.call(this)}});
/* - PortalColumn.js - */
/*
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ux.PortalColumn=Ext.extend(Ext.Panel,{layout:"anchor",frame:false,border:false,closable:true,defaultType:"portlet",cls:"x-column-portal"});Ext.reg("portalcolumn",Ext.ux.PortalColumn);
/* - columnlayout-ux.js - */
Ext.layout.PortalColumnLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,extraCls:"x-column",scrollOffset:0,margin:0,split:false,fitHeight:false,isValidParent:function(b,a){return b.getEl().dom.parentNode==this.innerCt.dom},renderAll:function(a,b){if(this.split&&!this.splitBars){this.splitBars=[];this.margin=5}Ext.layout.PortalColumnLayout.superclass.renderAll.apply(this,arguments)},onLayout:function(g,m){var j=g.items.items,k=j.length,n,o,d;if(!this.innerCt){m.addClass("x-column-layout-ct");this.innerCt=m.createChild({cls:"x-column-inner",style:{position:"relative"}});this.innerCt.createChild({cls:"x-clear"})}this.renderAll(g,this.innerCt);var r=Ext.isIE&&m.dom!=Ext.getBody().dom?m.getStyleSize():m.getViewSize();if(r.width<1&&r.height<1){return}var p=r.width-m.getPadding("lr")-this.scrollOffset,e=r.height-m.getPadding("tb");var q=this.availableWidth=p;if(this.split){this.minWidth=Math.min(q/k,100);this.maxWidth=q-((this.minWidth+5)*(k?(k-1):1))}this.innerCt.setSize(p,this.fitHeight?e:undefined);if(this.fitHeight){this.innerCt.setSize(p,e)}else{this.innerCt.setWidth(p)}var f;for(d=0;d<k;d++){n=j[d];o=n.getEl();if(this.margin&&(d<(k-1))){o.setStyle("margin-right",this.margin+"px")}if(n.columnWidth){f=d}else{q-=(n.getSize().width+o.getMargins("lr"))}}var a=(q=q<0?0:q);var l=0;for(d=0;d<k;d++){n=j[d];o=n.getEl();if(n.columnWidth){var p=(d==f)?a:Math.floor(n.columnWidth*q);if(this.fitHeight){n.setSize(p-o.getMargins("lr"),e)}else{n.setWidth(p-o.getMargins("lr"))}a-=p}else{if(this.fitHeight){n.setHeight(e)}}if(this.split){var b=o.getWidth();if(d<(k-1)){l+=b;if(this.splitBars[d]){this.splitBars[d].el.setHeight(e)}else{this.splitBars[d]=new Ext.SplitBar(this.innerCt.createChild({cls:"x-layout-split x-layout-split-west",style:{top:"0px",left:l+"px",height:e+"px"}}),o);this.splitBars[d].index=d;this.splitBars[d].leftComponent=n;this.splitBars[d].addListener("resize",this.onColumnResize,this);this.splitBars[d].minSize=this.minWidth}l+=this.splitBars[d].el.getWidth()}delete n.columnWidth}}if(this.split){this.setMaxWidths()}},onColumnResize:function(j,g){if(j.dragSpecs.startSize){j.leftComponent.setWidth(g);var d=this.container.items.items;var f=g-j.dragSpecs.startSize;for(var e=j.index+1,a=d.length;f&&e<a;e++){var h=d[e];var b=h.el.getWidth();var g=b-f;if(g<this.minWidth){h.setWidth(this.minWidth)}else{if(g>this.maxWidth){f-=(g-this.maxWidth);h.setWidth(this.maxWidth)}else{h.setWidth(h.el.getWidth()-f);break}}}this.setMaxWidths();this.container.fireEvent("columnresize",this.container)}},setMaxWidths:function(){var a=this.container.items.items;var d=a[a.length-1].el.dom.offsetWidth-100;for(var b=a.length-2;b>-1;b--){var j=this.splitBars[b],f=j.el,h=a[b],e=h.el;var g=e.dom.offsetWidth;f.setStyle("left",(e.getX()-Ext.fly(e.dom.parentNode).getX()+g)+"px");j.maxSize=g+d;d=g-100}},onResize:function(){if(this.split){var b=this.container.items.items;if(b[0].rendered){var a=0;for(var d=0;d<b.length;d++){var e=b[d];a+=e.el.getWidth()+e.el.getMargins("lr")}for(var d=0;d<b.length;d++){var e=b[d];e.columnWidth=(e.el.getWidth()+e.el.getMargins("lr"))/a}}}Ext.layout.PortalColumnLayout.superclass.onResize.apply(this,arguments)}});Ext.Container.LAYOUTS.portalcolumn=Ext.layout.PortalColumnLayout;
/* - carousel.js - */
/*
 * Ext Core Library 3.0
 * http://extjs.com/
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * 
 * MIT Licensed - http://extjs.com/license/mit.txt
 */
Ext.ns("Ext.ux");Ext.ux.Carousel=Ext.extend(Ext.util.Observable,{interval:3,transitionDuration:1,transitionType:"carousel",transitionEasing:"easeOut",itemSelector:"img",activeSlide:0,autoPlay:false,showPlayButton:false,pauseOnNavigate:false,wrap:false,freezeOnHover:false,navigationOnHover:false,hideNavigation:false,width:null,height:null,constructor:function(b,a){a=a||{};Ext.apply(this,a);Ext.ux.Carousel.superclass.constructor.call(this,a);this.addEvents("beforeprev","prev","beforenext","next","change","play","pause","freeze","unfreeze");this.el=Ext.get(b);this.slides=this.els=[];if(this.autoPlay||this.showPlayButton){this.wrap=true}if(this.autoPlay&&typeof a.showPlayButton==="undefined"){this.showPlayButton=true}this.initMarkup();this.initEvents();if(this.carouselSize>0){this.refresh()}},initMarkup:function(){var b=Ext.DomHelper;this.carouselSize=0;var a=this.el.select(this.itemSelector);this.els.container=b.append(this.el,{cls:"ux-carousel-container"},true);this.els.slidesWrap=b.append(this.els.container,{cls:"ux-carousel-slides-wrap"},true);this.els.navigation=b.append(this.els.container,{cls:"ux-carousel-nav"},true).hide();this.els.caption=b.append(this.els.navigation,{tag:"h2",cls:"ux-carousel-caption"},true);this.els.navNext=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-next"},true);if(this.showPlayButton){this.els.navPlay=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-play"},true)}this.els.navPrev=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-prev"},true);this.slideWidth=this.width||this.el.getWidth(true);this.slideHeight=this.height||this.el.getHeight(true);this.els.container.setStyle({width:this.slideWidth+"px",height:this.slideHeight+"px"});this.els.caption.setWidth((this.slideWidth-(this.els.navNext.getWidth()*2)-(this.showPlayButton?this.els.navPlay.getWidth():0)-20)+"px");a.appendTo(this.els.slidesWrap).each(function(c){c=c.wrap({cls:"ux-carousel-slide"});this.slides.push(c);c.setWidth(this.slideWidth+"px").setHeight(this.slideHeight+"px")},this);this.carouselSize=this.slides.length;if(this.navigationOnHover){this.els.navigation.setStyle("top",(-1*this.els.navigation.getHeight())+"px")}this.el.clip()},initEvents:function(){this.els.navPrev.on("click",function(a){a.preventDefault();var b=a.getTarget();b.blur();if(Ext.fly(b).hasClass("ux-carousel-nav-disabled")){return}this.prev()},this);this.els.navNext.on("click",function(a){a.preventDefault();var b=a.getTarget();b.blur();if(Ext.fly(b).hasClass("ux-carousel-nav-disabled")){return}this.next()},this);if(this.showPlayButton){this.els.navPlay.on("click",function(a){a.preventDefault();a.getTarget().blur();if(this.playing){this.pause()}else{this.play()}},this)}if(this.freezeOnHover){this.els.container.on("mouseenter",function(){if(this.playing){this.fireEvent("freeze",this.slides[this.activeSlide]);Ext.TaskMgr.stop(this.playTask)}},this);this.els.container.on("mouseleave",function(){if(this.playing){this.fireEvent("unfreeze",this.slides[this.activeSlide]);Ext.TaskMgr.start(this.playTask)}},this,{buffer:(this.interval/2)*1000})}if(this.navigationOnHover){this.els.container.on("mouseenter",function(){if(!this.navigationShown){this.navigationShown=true;this.els.navigation.stopFx(false).shift({y:this.els.container.getY(),duration:this.transitionDuration})}},this);this.els.container.on("mouseleave",function(){if(this.navigationShown){this.navigationShown=false;this.els.navigation.stopFx(false).shift({y:this.els.navigation.getHeight()-this.els.container.getY(),duration:this.transitionDuration})}},this)}if(this.interval&&this.autoPlay){this.play()}},prev:function(){if(this.fireEvent("beforeprev")===false){return}if(this.pauseOnNavigate){this.pause()}this.setSlide(this.activeSlide-1);this.fireEvent("prev",this.activeSlide);return this},next:function(){if(this.fireEvent("beforenext")===false){return}if(this.pauseOnNavigate){this.pause()}this.setSlide(this.activeSlide+1);this.fireEvent("next",this.activeSlide);return this},play:function(){if(!this.playing){this.playTask=this.playTask||{run:function(){this.playing=true;this.setSlide(this.activeSlide+1)},interval:this.interval*1000,scope:this};this.playTaskBuffer=this.playTaskBuffer||new Ext.util.DelayedTask(function(){Ext.TaskMgr.start(this.playTask)},this);this.playTaskBuffer.delay(this.interval*1000);this.playing=true;if(this.showPlayButton){this.els.navPlay.addClass("ux-carousel-playing")}this.fireEvent("play")}return this},pause:function(){if(this.playing){Ext.TaskMgr.stop(this.playTask);this.playTaskBuffer.cancel();this.playing=false;if(this.showPlayButton){this.els.navPlay.removeClass("ux-carousel-playing")}this.fireEvent("pause")}return this},clear:function(){this.els.slidesWrap.update("");this.slides=[];this.carouselSize=0;this.pause();return this},add:function(b,a){var c=Ext.fly(b).appendTo(this.els.slidesWrap).wrap({cls:"ux-carousel-slide"});c.setWidth(this.slideWidth+"px").setHeight(this.slideHeight+"px");this.slides.push(c);if(a){this.refresh()}return this},refresh:function(){this.carouselSize=this.slides.length;this.els.slidesWrap.setWidth((this.slideWidth*this.carouselSize)+"px");if(this.carouselSize>0){if(!this.hideNavigation){this.els.navigation.show()}this.activeSlide=0;this.setSlide(0,true)}return this},setSlide:function(b,a){if(!this.wrap&&!this.slides[b]){return}else{if(this.wrap){if(b<0){b=this.carouselSize-1}else{if(b>this.carouselSize-1){b=0}}}}if(!this.slides[b]){return}this.els.caption.update(this.slides[b].child(":first-child",true).title||"");var d=b*this.slideWidth;if(!a){switch(this.transitionType){case"fade":this.slides[b].setOpacity(0);this.slides[this.activeSlide].stopFx(false).fadeOut({duration:this.transitionDuration/2,callback:function(){this.els.slidesWrap.setStyle("left",(-1*d)+"px");this.slides[this.activeSlide].setOpacity(1);this.slides[b].fadeIn({duration:this.transitionDuration/2})},scope:this});break;default:var c=(-1*d)+this.els.container.getX();this.els.slidesWrap.stopFx(false);this.els.slidesWrap.shift({duration:this.transitionDuration,x:c,easing:this.transitionEasing});break}}else{this.els.slidesWrap.setStyle("left","0")}this.activeSlide=b;this.updateNav();this.fireEvent("change",this.slides[b],b)},updateNav:function(){this.els.navPrev.removeClass("ux-carousel-nav-disabled");this.els.navNext.removeClass("ux-carousel-nav-disabled");if(!this.wrap){if(this.activeSlide===0){this.els.navPrev.addClass("ux-carousel-nav-disabled")}if(this.activeSlide===this.carouselSize-1){this.els.navNext.addClass("ux-carousel-nav-disabled")}}}});
/* - XCheckbox.js - */
Ext.ns("Ext.ux.form");Ext.ux.form.XCheckbox=Ext.extend(Ext.form.Checkbox,{offCls:"xcheckbox-off",onCls:"xcheckbox-on",disabledClass:"xcheckbox-disabled",submitOffValue:"false",submitOnValue:"true",checked:false,hiddenName:null,onRender:function(c){Ext.ux.form.XCheckbox.superclass.onRender.apply(this,arguments);var a=this.el.dom.tabIndex;var d=this.el.dom.id;this.el.remove();this.el=c.createChild({tag:"input",type:"hidden",name:this.hiddenName||this.name,id:d});if(!this.checked){this.checked=this.value===this.submitOnValue}this.updateHidden();this.wrap.replaceClass("x-form-check-wrap","xcheckbox-wrap");this.cbEl=this.wrap.createChild({tag:"a",cls:this.checked?this.onCls:this.offCls});var b=this.wrap.down("label");if(b){this.wrap.appendChild(b)}if(this.tooltip){this.cbEl.set({qtip:this.tooltip})}this.wrap.on({click:{scope:this,fn:this.onClick,delegate:"a"}});this.wrap.on({keyup:{scope:this,fn:this.onClick,delegate:"a"}});this.cbEl.dom.tabIndex=a},onClick:function(a){if(this.disabled||this.readOnly){return}if(!a.isNavKeyPress()){this.setValue(!this.checked)}},onDisable:function(){this.cbEl.addClass(this.disabledClass);this.el.dom.disabled=true},onEnable:function(){this.cbEl.removeClass(this.disabledClass);this.el.dom.disabled=false},setValue:function(a){if("string"==typeof a){this.checked=a===this.submitOnValue}else{this.checked=!(!a)}if(this.rendered&&this.cbEl){this.updateHidden();this.cbEl.removeClass([this.offCls,this.onCls]);this.cbEl.addClass(this.checked?this.onCls:this.offCls)}this.fireEvent("check",this,this.checked)},updateHidden:function(){this.el.dom.value=this.checked?this.submitOnValue:this.submitOffValue},getValue:function(){return this.checked}});Ext.reg("xcheckbox",Ext.ux.form.XCheckbox);
/* - anz_widget.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.base=Ext.extend(Ext.Panel,{draggable:true,loaded:false,maxRetryTimes:6,options:null,retried:0,cls:"x-widget",frame:false,style:"margin: 5px 0 0",initComponent:function(){Anz.widget.base.superclass.initComponent.call(this);var a=this.initialConfig;this.options=a.options;this.portalUrl=a.portalUrl;this.contextUrl=a.contextUrl;this.on({render:{scope:this,fn:function(b){if(!this.collapsed){this.display()}}},expand:{scope:this,fn:function(b){if(!this.loaded){this.display()}}}})},getCommonPreferences:function(){return[{xtype:"textfield",name:"title",fieldLabel:_("Title"),value:"Widget title"},{xtype:"xcheckbox",name:"showTitle",fieldLabel:_("Show title?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"showTitle:int"}]},getCustomisePreferences:function(){return[]},getPreferences:function(){return this.getCommonPreferences().concat(this.getCustomisePreferences())},updateOptions:function(a){},display:function(){},retryDisplay:function(){if(!this.loaded){if(this.retried<this.maxRetryTimes){this.retried+=1;this.display.defer(Math.pow(2,this.retried)*1000,this)}else{this.body.update(_("Sorry, we can not get data successfully now, you should refresh the whole page later to try again."))}}},getValue:function(b){var a=this.options[b];if(a===undefined){a=this.getDefaultValues()[b]}return a},getDefaultValues:function(){return{}}});
/* - widget_static_text.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.staticText=Ext.extend(Anz.widget.base,{bodyStyle:"padding: 5px",iconCls:"widget_postit_icon",getCustomisePreferences:function(){return[{xtype:"htmleditor",name:"text",fieldLabel:_("body"),value:_("Type text here")}]},updateOptions:function(a){this.options=a;this.setTitle(Utf8.decode(a.title));this.display()},display:function(){var a=this.getValue("text");if(!a){a=_("Type text here")}else{a=Utf8.decode(a)}this.body.update(a)},convertTextToHTML:function(a){a=a.replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>").replace(/  /g,"&nbsp; ");return a},convertHTMLToText:function(a){a=a.replace(/\&amp;/g,"&").replace(/\&lt;/g,"<").replace(/&gt;/g,">").replace(/<br>/g,"\n").replace(/\&nbsp;/g," ");return a}});Ext.reg("widget_static_text",Anz.widget.staticText);
/* - widget_rss.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.rss=Ext.extend(Anz.widget.base,{bodyStyle:"padding: 5px",iconCls:"widget_rss_icon",entries:[],page:0,pageCount:1,count:null,getCustomisePreferences:function(){return[{xtype:"textfield",name:"feed",fieldLabel:_("Feed"),value:""},{xtype:"xcheckbox",name:"paging",fieldLabel:_("Paging?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"paging:int"},{xtype:"numberfield",name:"count",fieldLabel:_("Count"),value:5,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Normal",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Normal",_("Normal")],["Magazine",_("Magazine")],["Slideshow",_("Slideshow")],["Headline",_("Headline")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{count:5,paging:1,view:"Normal"}},updateOptions:function(d){var b=this.options;this.options=d;this.count=parseInt(this.getValue("count"));this.setTitle(Utf8.decode(this.getValue("title")));if(!this.collapsed){var e=b.feed;var c=b.view;var a=b.paging;if(e!==this.getValue("feed")){this.display()}else{if(c!==this.getValue("view")||a!==this.getValue("paging")){if(this.loaded){this.buildContents()}else{this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');this.loaded=false;var b=this.getValue("feed");var a=this.getValue("count");Ext.Ajax.request({url:this.initialConfig.contextUrl+"/@@rssWidget/entries",method:"POST",params:{url:b,"count:int":a},timeout:5000,scope:this,success:function(c,e){var d=Ext.decode(c.responseText);if(d.success){this.entries=d.entries;this.count=parseInt(this.getValue("count"));this.pageCount=Math.ceil(d.entries.length/this.count);this.buildContents();this.loaded=true}else{if(d.msg){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(c,e){var d=c.responseText;if(d){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachPagingHandler:function(){var a=this.body.child("a[class=prePage]");if(a){a.on("click",this.prePage,this)}var b=this.body.child("a[class=nextPage]");if(b){b.on("click",this.nextPage,this)}},prePage:function(){this.page-=1;this.buildContents()},nextPage:function(){this.page+=1;this.buildContents()},buildContents:function(){var c="";var a=this.getValue("view");switch(a){case"Normal":c=this.buildNormalHtml();break;case"Magazine":c=this.buildMagazineHtml();break;case"Slideshow":c=this.buildSlideshowHtml();break;case"Headline":c=this.buildHeadlineHtml();break;default:c=this.buildNormalHtml()}var d=this.getValue("paging")&&(this.pageCount>1)&&(a!=="Slideshow");if(d){c+='<div class="paging-bottom">';if(this.page!==0){c+=String.format('<a class="prePage" href="javascript:;">{0}</a>',_("prev"))}if(this.page<this.pageCount-1){c+=String.format('<a class="nextPage" href="javascript:;">{0}</a>',_("next"))}c+="<div>"}this.body.update(c);if(a==="Slideshow"){var b=this.getId()+"_slideshow";new Ext.ux.Carousel(b,{itemSelector:"div.item",interval:10,autoPlay:true,transitionEasing:"easeIn"})}if(d){this.attachPagingHandler()}},buildNormalHtml:function(){var h=this.page*this.count;var c=this.entries.slice(h,h+this.count);var f='<ul class="feedList">';var b=new Ext.Template("<li>",'<a href="{link}" title="{desc}" target="_blank">','{title}<span class="feedItemDate"> - {date}</span>',"</a>","</li>");for(var e=0,a=c.length;e<a;++e){var g=c[e];var d=this.convertDate(g.updated);f+=b.applyTemplate({title:g.title,desc:g.summary,link:g.link,date:this.getTimeDiff(d)})}f+="</ul>";return f},buildMagazineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="magazineView">'];var f=new Ext.Template('<div class="left">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="article">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"<p>{desc}</p>","</div>","</div>");var c=e[0];var j=this.convertDate(c.updated);d.push(f.applyTemplate({title:c.title,desc:c.summary,img:this.portalUrl+"/default_news.png",link:c.link,date:this.getTimeDiff(j)}));d.push('<div class="right">');var h=new Ext.Template('<div class="item">','<div class="thumbnail">','<img height="50" width="50" src="{img}"/>',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"</div>",'<div class="description">',"<p>{desc}</p>","</div>","</div>");for(var b=1,g=e.length;b<g;++b){var k=e[b];var j=this.convertDate(k.updated);d.push(h.applyTemplate({title:k.title,desc:k.summary,img:this.portalUrl+"/default_news.png",link:k.link,date:this.getTimeDiff(j)}))}d.push("</div></div>");return d.join("")},buildSlideshowHtml:function(){var c=this.entries;var d=this.getId()+"_slideshow";var g=[String.format('<div class="slideshowView" id="{0}">',d)];var b=new Ext.Template('<div class="item">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="content">','<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>',"</div>",'<div class="description">','<small class="feedItemDate">{date}</small>',"<p>{desc}</p>","</div>","</div>","</div>");for(var f=0,a=c.length;f<a;++f){var h=c[f];var e=this.convertDate(h.updated);g.push(b.applyTemplate({img:this.portalUrl+"/default_news.png",title:h.title,desc:h.summary,link:h.link,date:this.getTimeDiff(e)}))}g.push("</div>");return g.join("")},buildHeadlineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="headlineView">'];var f=new Ext.Template('<div class="top">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<small class="feedItemDate">{date}</small>',"</div>","</div>",'<div class="middle odd">','<div class="description">{desc}</div>',"</div>");var c=e[0];var j=this.convertDate(c.updated);d.push(f.applyTemplate({img:this.portalUrl+"/default_news.png",title:c.title,desc:c.summary,link:c.link,date:this.getTimeDiff(j)}));d.push('<ul class="bottom">');var h=new Ext.Template('<li class="item {cls}">','<div class="thumbnail">','<img height="50" width="50" src="{img}">',"</div>",'<h3><a href="{link}" target="_blank">{title}<small class="feedItemDate">{date}</small></a></h3>','<p class="description">{desc}</p>',"</li>");for(var b=1,g=e.length;b<g;++b){var k=e[b];var j=this.convertDate(k.updated);d.push(h.applyTemplate({cls:b%2?"even":"odd",img:this.portalUrl+"/default_news.png",title:k.title,desc:k.summary,link:k.link,date:this.getTimeDiff(j)}))}d.push("</ul></div>");return d.join("")},convertDate:function(a){var b=null;if(a){b=a.split("-").join("/")}return b},getTimeDiff:function(e){if(!e){return""}var d=new Date(e);var h=new Date();var c=h.valueOf()-d.valueOf();var i=c/86400000;i=parseInt(i);c=c-(i*86400000);var f=c/3600000;f=parseInt(f);c=c-(f*3600000);var b=c/60000;b=parseInt(b);c=c-(b*60000);var g=c/1000;g=parseInt(g);var a="";if(i>0){a=i+_("days before")}else{if(f>0){a=f+_("hours before")}else{if(b>0){a=b+_("minutes before")}}}return a}});Ext.reg("widget_rss",Anz.widget.rss);
/* - widget_weather.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.weather=Ext.extend(Anz.widget.base,{iconCls:"widget_weather_icon",getCustomisePreferences:function(){return[{xtype:"widget.weather.woeidfield",name:"woeid",fieldLabel:_("City"),value:""},{xtype:"combo",name:"units",hiddenName:"units",fieldLabel:_("Units"),value:"c",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["c",_("Celsius")],["f",_("Fahrenheit")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Compact",_("Compact")],["Today",_("Today")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},updateOptions:function(c){var a=this.options;this.options=c;this.setTitle(Utf8.decode(c.title));if(!this.collapsed){var d=a.woeid;var e=a.units;var b=a.view;if(d!==c.woeid){this.display()}else{if(e!==c.units){this.display()}else{if(b!==c.view){this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');var a=this.getValue("feed");Ext.Ajax.request({url:this.contextUrl+"/@@weatherWidget/weather",method:"POST",params:{woeid:this.options.woeid,units:this.options.units},timeout:5000,scope:this,success:function(b,f){var d=Ext.decode(b.responseText);if(d.success){var g=d.info;var c=this.options.view;var e=this.buildContents(g,c);this.body.update(e);this.loaded=true}else{if(d.msg){this.body.update(d.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(b,d){var c=b.responseText;if(c){this.body.update(c.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},buildContents:function(a,b){var c=null;switch(b){case"Compact":c=this.buildCompactHtml(a);break;case"Today":c=this.buildTodayHtml(a);break;default:c=this.buildTodayHtml(a)}return c},buildTodayHtml:function(b){var a=new Ext.Template('<div class="yw-forecast">','<div class="yw-loc">','<a target="_blank" href="{link}">{location}</a>',"</div>",'<div class="yw-date">{time}</div>','<div class="yw-cond">{condition_text}</div>',"<dl>","<dt>{Feels_Like}:</dt><dd>{temp}&deg;{temp_unit}</dd>","<dt>{Barometer}:</dt><dd>{pressure} {pressure_unit}</dd>","<dt>{Humidity}:</dt><dd>{humidity} %</dd>","<dt>{Visibility}:</dt><dd>{visibility} {visibility_unit}</dd>","<dt>{Wind}:</dt><dd>{wind_direction} {wind_speed} {speed_unit}</dd>","<dt>{Sunrise}:</dt><dd>{sunrise}</dd>","<dt>{Sunset}:</dt><dd>{sunset}</dd>","</dl>",'<div class="forecast-icon" style="background: transparent url(weather/{code}d-s.png) no-repeat scroll 0% 0%;"></div>','<div class="forecast-temp">','<div class="yw-temp">{temp}&deg;</div>',"<p>{High}: {high_temp}&deg; {Low}: {low_temp}&deg;</p>","</div>","</div>");return a.applyTemplate({Feels_Like:_("Feels Like"),Barometer:_("Barometer"),Humidity:_("Humidity"),Visibility:_("Visibility"),Wind:_("Wind"),Sunrise:_("Sunrise"),Sunset:_("Sunset"),High:_("High"),Low:_("Low"),location:b.location.city+","+b.location.country,time:b.condition.date,condition_text:this._conditionMap()[b.condition.code],temp:b.condition.temp,temp_unit:b.units.temperature,pressure:b.atmosphere.pressure,pressure_unit:b.units.pressure,humidity:b.atmosphere.humidity,visibility:b.atmosphere.visibility,visibility_unit:b.units.distance,wind_direction:b.wind.direction,wind_speed:b.wind.speed,speed_unit:b.units.speed,sunrise:b.astronomy.sunrise,sunset:b.astronomy.sunset,high_temp:b.forecast[0].high,low_temp:b.forecast[0].low,code:b.condition.code,link:b.link,Detailed_Forecast:_("Detailed Forecast")})},buildCompactHtml:function(b){var a=new Ext.Template('<div class="weather-compact">','<div class="yw-loc">','<a target="_blank" href="{link}">{location}</a>',"</div>",'<div class="today-weather">','<div class="weather-icon">','<img src="weather/{today_code}d-s.png" title="{today_code_text}" alt="{condition_text}">',"</div>",'<div class="weather-text">','<span class="weather-day">{today_date}<br>{today_weekday}</span>','<span class="weather-temp">{today_low_temp}/{today_high_temp}&deg;</span>',"</div>","</div>",'<div class="tomorrow-weather">','<div class="weather-icon">','<img src="weather/{next_code}d-s.png" title="{next_code_text}" alt="{next_code_text}">',"</div>",'<div class="weather-text">','<span class="weather-day">{next_weekday}</span>','<span class="weather-temp">{next_low_temp}/{next_high_temp}&deg;</span>',"</div>","</div>","</div>");return a.applyTemplate({link:b.link,location:b.location.city+","+b.location.country,today_code:b.forecast[0].code,today_code_text:this._conditionMap()[b.forecast[0].code],today_low_temp:b.forecast[0].low,today_high_temp:b.forecast[0].high,today_date:b.forecast[0].date,today_weekday:_(b.forecast[0].day),next_code:b.forecast[1].code,next_code_text:this._conditionMap()[b.forecast[1].code],next_low_temp:b.forecast[1].low,next_high_temp:b.forecast[1].high,next_date:b.forecast[1].date,next_weekday:_(b.forecast[1].day)})},_conditionMap:function(){return{"0":_("Tornado"),"1":_("Tropical storm"),"2":_("Hurricane"),"3":_("Severe thunderstorms"),"4":_("Thunderstorms"),"5":_("Mixed rain and snow"),"6":_("Mixed rain and sleet"),"7":_("Mixed snow and sleet"),"8":_("Freezing drizzle"),"9":_("Drizzle"),"10":_("Freezing rain"),"11":_("Showers"),"12":_("Showers"),"13":_("Snow flurries"),"14":_("Light snow showers"),"15":_("Blowing snow"),"16":_("Snow"),"17":_("Hail"),"18":_("Sleet"),"19":_("Dust"),"20":_("Foggy"),"21":_("Haze"),"22":_("Smoky"),"23":_("Blustery"),"24":_("Windy"),"25":_("Cold"),"26":_("Cloudy"),"27":_("Mostly cloudy"),"28":_("Mostly cloudy"),"29":_("Partly cloudy"),"30":_("Partly cloudy"),"31":_("Clear"),"32":_("Sunny"),"33":_("Fair"),"34":_("Fair"),"35":_("Mixed rain and hail"),"36":_("Hot"),"37":_("Isolated thunderstorms"),"38":_("Scattered thunderstorms"),"39":_("Scattered thunderstorms"),"40":_("Scattered showers"),"41":_("Heavy snow"),"42":_("Scattered snow showers"),"43":_("Heavy snow"),"44":_("Partly cloudy"),"45":_("Thundershowers"),"46":_("Snow showers"),"47":_("Isolated thundershowers")}}});Ext.reg("widget_weather",Anz.widget.weather);Anz.widget.weather.woeidfield=function(b){var c=new Ext.data.Store({proxy:new Ext.data.ScriptTagProxy({url:"http://where.yahooapis.com/v1",listeners:{beforeload:{scope:this,fn:function(e,f){e.setApi(Ext.data.Api.actions.read,String.format("http://where.yahooapis.com/v1/places.q({0});count=0?format=json&appid=1dIus9DV34GjOFTpNt_pwV465FOtJItUDeDMDR2bLWox6hTqUHPrVtvCnvDBfYg-",f.query))}}}}),reader:new Ext.data.JsonReader({root:"places.place",id:"woeid"},[{name:"woeid",mapping:"woeid"},{name:"name",mapping:"name"}])});var d=new Ext.XTemplate('<tpl for="."><div class="search-item">',"<h3><span>{woeid}-{name}</span></h3>","</div></tpl>");var a={store:c,displayField:"title",typeAhead:false,loadingText:"Searching...",width:570,hideTrigger:true,tpl:d,itemSelector:"div.search-item",listeners:{select:{scope:this,fn:function(g,e,f){g.setValue(e.get("woeid"))}}}};if(b){Ext.apply(a,b)}Ext.apply(this,a);Anz.widget.weather.woeidfield.superclass.constructor.apply(this,arguments)};Ext.extend(Anz.widget.weather.woeidfield,Ext.form.ComboBox,{});Ext.reg("widget.weather.woeidfield",Anz.widget.weather.woeidfield);
/* - widget_calendar.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.calendar=Ext.extend(Anz.widget.base,{iconCls:"widget_calendar_icon",bodyStyle:"padding: 5px",view:"Month",tips:[],tipsCfg:[],getCustomisePreferences:function(){return[{xtype:"combo",name:"weekStart",hiddenName:"weekStart",fieldLabel:_("Start day of week"),value:"Mon",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Sun",_("Sun")],["Mon",_("Mon")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Month",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Month",_("Month")],["Week",_("Week")],["Agenda",_("Agenda")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{view:"Month",weekStart:"Mon"}},updateOptions:function(c){var a=this.options;this.options=c;this.setTitle(Utf8.decode(c.title));if(!this.collapsed){var d=a.weekStart;var b=a.view;if(d!==c.weekStart){this.display()}else{if(b!==c.view){this.display()}}}},display:function(c){this.body.update('<div class="loading-indicator">Loading...</div>');if(!c){c=new Date()}this.view=this.getValue("view");this.weekStart=this.getValue("weekStart");var d=null;var a=null;switch(this.view){case"Month":d=c.getFirstDateOfMonth();a=c.getLastDateOfMonth();break;case"Week":case"Agenda":var b=c.format("w");if(this.weekStart=="Sun"){d=c.add(Date.DAY,-b)}else{if(b==0){d=c.add(Date.DAY,-6)}else{d=c.add(Date.DAY,1-b)}}a=d.add(Date.DAY,6);break;default:break}Ext.Ajax.request({url:this.contextUrl+"/@@mergedRequest/getMergedData",method:"POST",params:{"requests:list":["events@@calendarWidget/events?start:date="+d.format("Y/m/d")+"&end:date="+a.format("Y/m/d"),"stateStr@@calendarWidget/getReviewStateString"]},timeout:5000,scope:this,success:function(f,i){var g=Ext.decode(f.responseText);var j=g.events;if(j.success){this.eventsInfo=j.events;this.startDate=d;var e=g.stateStr;if(e.success){this.stateStr=e.stateStr}var h=this.buildContents();this.destroyEventTips();this.body.update(h);this.createEventTips();this.attachListener();this.loaded=true}else{if(g.msg){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(e,g){var f=e.responseText;if(f){this.body.update(f.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachListener:function(){var a=this.view;switch(a){case"Month":this.buildMonthListener();break;case"Week":case"Agenda":this.buildWeekListener();break;default:break}},destroyEventTips:function(){var b=this.tips;for(var c=0,a=b.length;c<a;++c){Ext.QuickTips.unregister(b[c].target)}this.tips=[]},createEventTips:function(){var e=this.tipsCfg;for(var c=0,a=e.length;c<a;++c){var b=e[c];var d=new Ext.ToolTip({target:b.target,title:_("Events in this day"),width:"auto",dismissDelay:0,html:b.html,trackMouse:true});this.tips.push(d)}this.tipsCfg=[]},buildMonthListener:function(){var a=this.body.child("a[class=preTimeCycle]");a.on("click",this.preMonth,this);var b=this.body.child("a[class=nextTimeCycle]");b.on("click",this.nextMonth,this)},preMonth:function(){var a=this.startDate.add(Date.MONTH,-1);this.display(a)},nextMonth:function(){var a=this.startDate.add(Date.MONTH,1);this.display(a)},buildWeekListener:function(){var b=this.body.child("a[class=preTimeCycle]");b.on("click",this.preWeek,this);var a=this.body.child("a[class=nextTimeCycle]");a.on("click",this.nextWeek,this)},preWeek:function(){var a=this.startDate.add(Date.DAY,-7);this.display(a)},nextWeek:function(){var a=this.startDate.add(Date.DAY,7);this.display(a)},buildContents:function(){var a=this.view;var b=null;switch(a){case"Month":b=this.buildMonthHtml();break;case"Week":b=this.buildWeekHtml();break;case"Agenda":b=this.buildAgendaHtml();break;default:b=this.buildMonthHtml()}return b},buildMonthHtml:function(){var d=this.eventsInfo;var u=this.weekStart;var e=this.startDate;var m=e.getFirstDayOfMonth();var f=e.getLastDayOfMonth();var q=0;var s=0;if(u==="Sun"){q=m;s=6-f}else{if(m===0){q=6;s=0}else{q=m-1;s=7-f}}var r=e.getDaysInMonth();var h=[];for(var z=0;z<q;++z){h.push(0)}for(var z=1;z<=r;++z){h.push(z)}for(var z=0;z<s;++z){h.push(0)}var l=[];var y=new Ext.Template('<div class="calendar_month_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{month}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<table class="calendar_table">',"<thead><tr>",'<td class="theader">{day1}</td>','<td class="theader">{day2}</td>','<td class="theader">{day3}</td>','<td class="theader">{day4}</td>','<td class="theader">{day5}</td>','<td class="theader">{day6}</td>','<td class="theader">{day7}</td>',"</tr></thead>","<tbody>");if(u==="Sun"){l.push(y.applyTemplate({month:e.format("Y-m"),day1:_("Sun"),day2:_("Mon"),day3:_("Tue"),day4:_("Wed"),day5:_("Thu"),day6:_("Fri"),day7:_("Sat")}))}else{l.push(y.applyTemplate({month:e.format("Y-m"),day1:_("Mon"),day2:_("Tue"),day3:_("Wed"),day4:_("Thu"),day5:_("Fri"),day6:_("Sat"),day7:_("Sun")}))}var a=new Ext.Template('<td class="{dateCls}" id="date_{id}">{day}</td>');var C=new Ext.Template('<td class="{dateCls}" id="date_{id}">','<a target="_blank" href="{url}">{day}</a>','<img index="0" class="event" src="ext3/resources/images/default/s.gif">',"</td>");var w=new Ext.Template('<div class="eventCls"><h6>{title}   {start}-{end}</h6><p>{desc}</p></div>');for(var z=0,A=h.length;z<A;++z){if((z%7)==0){l.push("<tr>")}var x=h[z];if(x==0){l.push('<td class="blank_day"></td>')}else{var o=e.add(Date.DAY,x-1);var n=o.format("w");var p=false;if(n==0||n==6){p=true}var c=d[o.format("Ymd")];var g=c&&c.length;if(g){var b=o.format("Y/m/d");l.push(C.applyTemplate({dateCls:p?"weekend":"",id:o.format("Y_m_d"),day:x,url:this.portalUrl+"/search?"+this.stateStr+"start.query:record:list:date="+b+"+23%3A59%3A59&amp;start.range:record=max&amp;end.query:record:list:date="+b+"+00%3A00%3A00&amp;end.range:record=min"}));var t=[];for(var v=0,k=c.length;v<k;++v){var B=c[v];t.push(w.applyTemplate({title:B.title,start:B.start,end:B.end,desc:B.desc}))}this.tipsCfg.push({target:"date_"+o.format("Y_m_d"),html:t.join("")})}else{l.push(a.applyTemplate({dateCls:p?"weekend":"",id:o.format("Y_m_d"),day:x}))}}if((z%7)==6){l.push("</tr>")}}l.push("</tbody></table></div>");return l.join("")},buildWeekHtml:function(){var b=this.eventsInfo;var n=this.weekStart;var e=this.startDate;var d=e.add(Date.DAY,6);var h=[];var r=new Ext.Template('<div class="calendar_week_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{range}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<table class="calendar_table">',"<thead><tr>",'<td class="theader">{day1}</td>','<td class="theader">{day2}</td>','<td class="theader">{day3}</td>','<td class="theader">{day4}</td>','<td class="theader">{day5}</td>','<td class="theader">{day6}</td>','<td class="theader">{day7}</td>',"</tr></thead>","<tbody>");if(n==="Sun"){h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d"),day1:_("Sun"),day2:_("Mon"),day3:_("Tue"),day4:_("Wed"),day5:_("Thu"),day6:_("Fri"),day7:_("Sat")}))}else{h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d"),day1:_("Mon"),day2:_("Tue"),day3:_("Wed"),day4:_("Thu"),day5:_("Fri"),day6:_("Sat"),day7:_("Sun")}))}var a=new Ext.Template('<td class="weekDay {dateCls}" id="date_{id}">{day}</td>');var u=new Ext.Template('<td class="weekDay {dateCls}" id="date_{id}">','<a target="_blank" href="{url}">{day}</a>','<img index="0" class="event" src="ext3/resources/images/default/s.gif">',"</td>");var q=new Ext.Template('<div class="eventCls"><h6>{title}   {start}-{end}</h6><p>{desc}</p></div>');for(var s=0;s<7;++s){var l=e.add(Date.DAY,s);var k=l.format("w");var m=false;if(k==0||k==6){m=true}var c=b[l.format("Ymd")];var f=c&&c.length;if(f){h.push(u.applyTemplate({dateCls:m?"weekend":"",id:l.format("Y_m_d"),day:l.format("d"),url:""}));var o=[];for(var p=0,g=c.length;p<g;++p){var t=c[p];o.push(q.applyTemplate({title:t.title,start:t.start,end:t.end,desc:t.desc}))}this.tipsCfg.push({target:"date_"+l.format("Y_m_d"),html:o.join("")})}else{h.push(a.applyTemplate({dateCls:m?"weekend":"",id:l.format("Y_m_d"),day:l.format("d")}))}}h.push("</tbody></table></div>");return h.join("")},buildAgendaHtml:function(){var b=this.eventsInfo;var o=this.weekStart;var e=this.startDate;var d=e.add(Date.DAY,6);var h=[];var r=new Ext.Template('<div class="calendar_week_view">','<table class="calendar_header_table"><tbody><tr>','<td class="alignLeft"><a class="preTimeCycle">&lt;&lt;</a></td>','<td class="alignCenter">{range}</td>','<td class="alignRight"><a class="nextTimeCycle">&gt;&gt;</a></td>',"</tr></tbody></table>",'<div class="">');h.push(r.applyTemplate({range:e.format("Y/m/d")+" - "+d.format("Y/m/d")}));var q=new Ext.Template('<div class="{eventCls}">','<span class="{dateCls}">{date}</span>','<span class="dayCls">{day}</span>','<a target="_blank" href="{url}" title="{desc}">{title}</a>',"</div>");var u=new Ext.Template('<div class="{eventCls}">','<span class="dateCls">{date}</span>','<span class="dayCls">{day}</span>','<span class="hint">{title}</span>',"</div>");for(var s=0;s<7;++s){var m=e.add(Date.DAY,s);var k=m.format("w");var n=false;if(k==0||k==6){n=true}var l=m.format("Y/m/d");var a=m.format("D");var c=b[m.format("Ymd")];var f=c&&c.length;if(f){for(var p=0,g=c.length;p<g;++p){var t=c[p];h.push(q.applyTemplate({eventCls:n?"eventItem weekend":"eventItem",dateCls:p==0?"dateCls":"dateHidden",dayCls:p==0?"dayCls":"dayHidden",date:l,day:_(a),url:t.url,title:t.title,desc:t.start+"-"+t.end+"    "+t.title}))}}else{h.push(u.applyTemplate({eventCls:n?"eventItem weekend":"eventItem",date:l,day:_(a),title:_("No event today.")}))}}h.push("</div></div>");return h.join("")}});Ext.reg("widget_calendar",Anz.widget.calendar);
/* - MultiSelect.js - */
/*
 * Ext JS Library 3.1.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ns("Ext.ux.form");Ext.ux.form.MultiSelect=Ext.extend(Ext.form.Field,{ddReorder:false,appendOnly:false,width:100,height:100,displayField:0,valueField:1,allowBlank:true,minSelections:0,maxSelections:Number.MAX_VALUE,blankText:Ext.form.TextField.prototype.blankText,minSelectionsText:"Minimum {0} item(s) required",maxSelectionsText:"Maximum {0} item(s) allowed",delimiter:",",defaultAutoCreate:{tag:"div"},initComponent:function(){Ext.ux.form.MultiSelect.superclass.initComponent.call(this);if(Ext.isArray(this.store)){if(Ext.isArray(this.store[0])){this.store=new Ext.data.ArrayStore({fields:["value","text"],data:this.store});this.valueField="value"}else{this.store=new Ext.data.ArrayStore({fields:["text"],data:this.store,expandData:true});this.valueField="text"}this.displayField="text"}else{this.store=Ext.StoreMgr.lookup(this.store)}this.addEvents({dblclick:true,click:true,change:true,drop:true})},onRender:function(c,b){Ext.ux.form.MultiSelect.superclass.onRender.call(this,c,b);var a=this.fs=new Ext.form.FieldSet({renderTo:this.el,title:this.legend,height:this.height,width:this.width,style:"padding:0;",tbar:this.tbar});a.body.addClass("ux-mselect");this.view=new Ext.ListView({multiSelect:true,store:this.store,columns:[{header:"Value",width:1,dataIndex:this.displayField}],hideHeaders:true});a.add(this.view);this.view.on("click",this.onViewClick,this);this.view.on("beforeclick",this.onViewBeforeClick,this);this.view.on("dblclick",this.onViewDblClick,this);this.hiddenName=this.name||Ext.id();var d={tag:"input",type:"hidden",value:"",name:this.hiddenName};this.hiddenField=this.el.createChild(d);this.hiddenField.dom.disabled=this.hiddenName!=this.name;a.doLayout()},afterRender:function(){Ext.ux.form.MultiSelect.superclass.afterRender.call(this);if(this.ddReorder&&!this.dragGroup&&!this.dropGroup){this.dragGroup=this.dropGroup="MultiselectDD-"+Ext.id()}if(this.draggable||this.dragGroup){this.dragZone=new Ext.ux.form.MultiSelect.DragZone(this,{ddGroup:this.dragGroup})}if(this.droppable||this.dropGroup){this.dropZone=new Ext.ux.form.MultiSelect.DropZone(this,{ddGroup:this.dropGroup})}},onViewClick:function(c,a,b,d){this.fireEvent("change",this,this.getValue(),this.hiddenField.dom.value);this.hiddenField.dom.value=this.getValue();this.fireEvent("click",this,d);this.validate()},onViewBeforeClick:function(c,a,b,d){if(this.disabled){return false}},onViewDblClick:function(c,a,b,d){return this.fireEvent("dblclick",c,a,b,d)},getValue:function(a){var d=[];var c=this.view.getSelectedIndexes();if(c.length==0){return""}for(var b=0;b<c.length;b++){d.push(this.store.getAt(c[b]).get((a!=null)?a:this.valueField))}return d.join(this.delimiter)},setValue:function(a){var b;var d=[];this.view.clearSelections();this.hiddenField.dom.value="";if(!a||(a=="")){return}if(!Ext.isArray(a)){a=a.split(this.delimiter)}for(var c=0;c<a.length;c++){b=this.view.store.indexOf(this.view.store.query(this.valueField,new RegExp("^"+a[c]+"$","i")).itemAt(0));d.push(b)}this.view.select(d);this.hiddenField.dom.value=this.getValue();this.validate()},reset:function(){this.setValue("")},getRawValue:function(a){var b=this.getValue(a);if(b.length){b=b.split(this.delimiter)}else{b=[]}return b},setRawValue:function(a){setValue(a)},validateValue:function(a){if(a.length<1){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}if(a.length<this.minSelections){this.markInvalid(String.format(this.minSelectionsText,this.minSelections));return false}if(a.length>this.maxSelections){this.markInvalid(String.format(this.maxSelectionsText,this.maxSelections));return false}return true},disable:function(){this.disabled=true;this.hiddenField.dom.disabled=true;this.fs.disable()},enable:function(){this.disabled=false;this.hiddenField.dom.disabled=false;this.fs.enable()},destroy:function(){Ext.destroy(this.fs,this.dragZone,this.dropZone);Ext.ux.form.MultiSelect.superclass.destroy.call(this)}});Ext.reg("multiselect",Ext.ux.form.MultiSelect);Ext.ux.Multiselect=Ext.ux.form.MultiSelect;Ext.ux.form.MultiSelect.DragZone=function(d,c){this.ms=d;this.view=d.view;var b=c.ddGroup||"MultiselectDD";var a;if(Ext.isArray(b)){a=b.shift()}else{a=b;b=null}Ext.ux.form.MultiSelect.DragZone.superclass.constructor.call(this,this.ms.fs.body,{containerScroll:true,ddGroup:a});this.setDraggable(b)};Ext.extend(Ext.ux.form.MultiSelect.DragZone,Ext.dd.DragZone,{onInitDrag:function(a,c){var b=Ext.get(this.dragData.ddel.cloneNode(true));this.proxy.update(b.dom);b.setWidth(b.child("em").getWidth());this.onStartDrag(a,c);return true},collectSelection:function(b){b.repairXY=Ext.fly(this.view.getSelectedNodes()[0]).getXY();var a=0;this.view.store.each(function(d){if(this.view.isSelected(a)){var e=this.view.getNode(a);var c=e.cloneNode(true);c.id=Ext.id();b.ddel.appendChild(c);b.records.push(this.view.store.getAt(a));b.viewNodes.push(e)}a++},this)},onEndDrag:function(a,b){var c=Ext.get(this.dragData.ddel);if(c&&c.hasClass("multi-proxy")){c.remove()}},getDragData:function(d){var c=this.view.findItemFromChild(d.getTarget());if(c){if(!this.view.isSelected(c)&&!d.ctrlKey&&!d.shiftKey){this.view.select(c);this.ms.setValue(this.ms.getValue())}if(this.view.getSelectionCount()==0||d.ctrlKey||d.shiftKey){return false}var b={sourceView:this.view,viewNodes:[],records:[]};if(this.view.getSelectionCount()==1){var a=this.view.getSelectedIndexes()[0];var f=this.view.getNode(a);b.viewNodes.push(b.ddel=f);b.records.push(this.view.store.getAt(a));b.repairXY=Ext.fly(f).getXY()}else{b.ddel=document.createElement("div");b.ddel.className="multi-proxy";this.collectSelection(b)}return b}return false},getRepairXY:function(a){return this.dragData.repairXY},setDraggable:function(a){if(!a){return}if(Ext.isArray(a)){Ext.each(a,this.setDraggable,this);return}this.addToGroup(a)}});Ext.ux.form.MultiSelect.DropZone=function(d,c){this.ms=d;this.view=d.view;var b=c.ddGroup||"MultiselectDD";var a;if(Ext.isArray(b)){a=b.shift()}else{a=b;b=null}Ext.ux.form.MultiSelect.DropZone.superclass.constructor.call(this,this.ms.fs.body,{containerScroll:true,ddGroup:a});this.setDroppable(b)};Ext.extend(Ext.ux.form.MultiSelect.DropZone,Ext.dd.DropZone,{getTargetFromEvent:function(b){var a=b.getTarget();return a},getDropPoint:function(g,j,d){if(j==this.ms.fs.body.dom){return"below"}var f=Ext.lib.Dom.getY(j),a=f+j.offsetHeight;var i=f+(a-f)/2;var h=Ext.lib.Event.getPageY(g);if(h<=i){return"above"}else{return"below"}},isValidDropPoint:function(b,e,a){if(!a.viewNodes||(a.viewNodes.length!=1)){return true}var c=a.viewNodes[0];if(c==e){return false}if((b=="below")&&(e.nextSibling==c)){return false}if((b=="above")&&(e.previousSibling==c)){return false}return true},onNodeEnter:function(d,a,c,b){return false},onNodeOver:function(h,a,g,d){var b=this.dropNotAllowed;var f=this.getDropPoint(g,h,a);if(this.isValidDropPoint(f,h,d)){if(this.ms.appendOnly){return"x-tree-drop-ok-below"}if(f){var c;if(f=="above"){b=h.previousSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-above";c="x-view-drag-insert-above"}else{b=h.nextSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-below";c="x-view-drag-insert-below"}if(this.lastInsertClass!=c){Ext.fly(h).replaceClass(this.lastInsertClass,c);this.lastInsertClass=c}}}return b},onNodeOut:function(d,a,c,b){this.removeDropIndicators(d)},onNodeDrop:function(b,k,j,g){if(this.ms.fireEvent("drop",this,b,k,j,g)===false){return false}var l=this.getDropPoint(j,b,k);if(b!=this.ms.fs.body.dom){b=this.view.findItemFromChild(b)}var c=(this.ms.appendOnly||(b==this.ms.fs.body.dom))?this.view.store.getCount():this.view.indexOf(b);if(l=="below"){c++}var d=false;if(g.sourceView==this.view){if(l=="below"){if(g.viewNodes[0]==b){g.viewNodes.shift()}}else{if(g.viewNodes[g.viewNodes.length-1]==b){g.viewNodes.pop()}}if(!g.viewNodes.length){return false}if(c>this.view.store.indexOf(g.records[0])){d="down";c--}}for(var h=0;h<g.records.length;h++){var a=g.records[h];if(g.sourceView){g.sourceView.store.remove(a)}this.view.store.insert(d=="down"?c:c++,a);var f=this.view.store.sortInfo;if(f){this.view.store.sort(f.field,f.direction)}}return true},removeDropIndicators:function(a){if(a){Ext.fly(a).removeClass(["x-view-drag-insert-above","x-view-drag-insert-left","x-view-drag-insert-right","x-view-drag-insert-below"]);this.lastInsertClass="_noclass"}},setDroppable:function(a){if(!a){return}if(Ext.isArray(a)){Ext.each(a,this.setDroppable,this);return}this.addToGroup(a)}});
/* - TreeComboSuperBox.js - */
Ext.namespace("Ext.ux","Ext.ux.form");Ext.ux.form.TreeComboSuperBox=Ext.extend(Ext.form.TriggerField,{displayField:null,displayFieldTpl:null,forceFormValue:false,hiddenName:null,multiSelect:true,navigateItemsWithTab:true,resizable:false,treeConfig:{rootVisible:false,border:false,autoScroll:true,loaded:false,root:{nodeType:"async",expanded:true,uiProvider:false},loader:{url:"request.php"}},valueDelimiter:",",valueField:null,initComponent:function(){Ext.apply(this,{editable:false,triggerConfig:{cls:"x-superboxselect-btns",children:[{tag:"div",cls:"x-superboxselect-btn-expand"}]},items:new Ext.util.MixedCollection(false)});Ext.ux.form.TreeComboSuperBox.superclass.initComponent.call(this);this.constructTree()},onRender:function(b,a){var c=this.hiddenName;this.hiddenName=null;Ext.ux.form.TreeComboSuperBox.superclass.onRender.call(this,b,a);this.hiddenName=c;this.el.removeClass("x-form-text").addClass("x-superboxselect-input-field");this.wrapEl=this.el.wrap({tag:"ul"});this.outerWrapEl=this.wrapEl.wrap({tag:"div",cls:"x-form-text x-superboxselect"});this.inputEl=this.el.wrap({tag:"li",cls:"x-superboxselect-input"});this.setupFormInterception()},constructTree:function(){if(!this.treePanel){if(!this.treeWidth){this.treeWidth=Math.max(200,this.width||200)}if(!this.treeHeight){this.treeHeight=200}Ext.apply(this.treeConfig,{renderTo:Ext.getBody(),floating:true,autoScroll:true,minWidth:200,minHeight:200,width:this.treeWidth,height:this.treeHeight});if(!this.treeConfig.listeners){this.treeConfig.listeners={}}Ext.apply(this.treeConfig.listeners,{hide:this.onTreeHide,show:this.onTreeShow,expandnode:this.onExpandOrCollapseNode,collapsenode:this.onExpandOrCollapseNode,resize:this.onTreeResize,scope:this});this.treePanel=new Ext.tree.TreePanel(this.treeConfig);this.treePanel.show();this.treePanel.hide();this.relayEvents(this.treePanel.loader,["beforeload","load","loadexception"]);if(this.resizable){this.resizer=new Ext.Resizable(this.treePanel.getEl(),{pinned:true,handles:"se"});this.mon(this.resizer,"resize",function(c,a,b){this.treePanel.setSize(a,b)},this)}}},onTriggerClick:function(){this.treePanel.show();this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")},onExpandOrCollapseNode:function(){if(!this.maxHeight||this.resizable){return}var a=this.treePanel.getTreeEl();var d=a.getHeight()-a.dom.clientHeight;var c=a.child("ul");var b=c.getHeight()+d;if(b>this.maxHeight){b=this.maxHeight}this.treePanel.setHeight(b)},onTreeResize:function(){if(this.treePanel){this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")}},onTreeShow:function(){Ext.getDoc().on("mousewheel",this.collapseIf,this);Ext.getDoc().on("mousedown",this.collapseIf,this)},onTreeHide:function(){Ext.getDoc().un("mousewheel",this.collapseIf,this);Ext.getDoc().un("mousedown",this.collapseIf,this)},collapseIf:function(a){if(!a.within(this.wrap)&&!a.within(this.treePanel.getEl())){this.collapse()}},collapse:function(){this.treePanel.hide()},getValue:function(){var a=[];this.items.each(function(b){a.push(b.value)});return a.join(this.valueDelimiter)},setValue:function(e){if(!this.rendered){this.value=e;return}this.removeAllItems();if(Ext.isEmpty(e)){return}var a=e;if(!Ext.isArray(e)){e=""+e;a=e.split(this.valueDelimiter)}if(this.multiSelect){Ext.each(a,function(m){var j=m;var n=m;var i=m;var l="";var k="";this.addItemBox(j,n,i,l,k)},this)}else{var g=a[0];var c=g;var h=g;var b=g;var f="";var d="";this.addItemBox(c,h,b,f,d)}},removeAllItems:function(){this.items.each(function(a){a.preDestroy(true)},this);return this},getCaption:function(b){if(typeof this.displayFieldTpl==="string"){this.displayFieldTpl=new Ext.XTemplate(this.displayFieldTpl)}var a;if(this.displayFieldTpl){a=this.displayFieldTpl.apply(b.attributes)}else{if(this.displayField){a=b.attributes[this.displayField]}}return a},addItemBox:function(d,h,l,k,e){var j=this.items;for(var b=0,f=j.getCount();b<f;++b){var c=j.get(b);if(c.value===d){return}}if(!this.multiSelect){this.removeAllItems()}var g;var a=Ext.id(null,"sbx-item");var c=new Ext.ux.form.SuperBoxSelectItem({owner:this,renderTo:this.wrapEl,caption:l,display:h,value:d,key:a,listeners:{remove:function(i){if(this.fireEvent("beforeremoveitem",this,i.value)===false){return}this.items.removeKey(i.key)},destroy:function(){this.collapse();this.autoSize().validateValue()},scope:this}});c.render();g={tag:"input",type:"hidden",value:d,name:(this.hiddenName||this.name)};if(this.disabled){Ext.apply(g,{disabled:"disabled"})}c.hidden=this.el.insertSibling(g,"before");this.items.add(a,c);this.applyEmptyText().autoSize().validateValue();if(this.multiSelect){this.treePanel.getEl().alignTo(this.wrap,"tl-bl?")}else{this.collapse()}},applyEmptyText:function(){this.setRawValue("");if(this.items.getCount()>0){this.el.removeClass(this.emptyClass);this.setRawValue("");return this}if(this.rendered&&this.emptyText&&this.getRawValue().length<1){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass)}return this},validateValue:function(a){if(this.items.getCount()===0){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}this.clearInvalid();return true},markInvalid:function(c){var b,a;if(!this.rendered||this.preventMark){return}this.outerWrapEl.addClass(this.invalidClass);c=c||this.invalidText;switch(this.msgTarget){case"qtip":Ext.apply(this.el.dom,{qtip:c,qclass:"x-form-invalid-tip"});Ext.apply(this.wrapEl.dom,{qtip:c,qclass:"x-form-invalid-tip"});if(Ext.QuickTips){Ext.QuickTips.enable()}break;case"title":this.el.dom.title=c;this.wrapEl.dom.title=c;this.outerWrapEl.dom.title=c;break;case"under":if(!this.errorEl){b=this.getErrorCt();if(!b){this.el.dom.title=c;break}this.errorEl=b.createChild({cls:"x-form-invalid-msg"});this.errorEl.setWidth(b.getWidth(true)-20)}this.errorEl.update(c);Ext.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case"side":if(!this.errorIcon){b=this.getErrorCt();if(!b){this.el.dom.title=c;break}this.errorIcon=b.createChild({cls:"x-form-invalid-icon"})}this.alignErrorIcon();Ext.apply(this.errorIcon.dom,{qtip:c,qclass:"x-form-invalid-tip"});this.errorIcon.show();this.on("resize",this.alignErrorIcon,this);break;default:a=Ext.getDom(this.msgTarget);a.innerHTML=c;a.style.display=this.msgDisplay;break}this.fireEvent("invalid",this,c)},clearInvalid:function(){if(!this.rendered||this.preventMark){return}this.outerWrapEl.removeClass(this.invalidClass);switch(this.msgTarget){case"qtip":this.el.dom.qtip="";this.wrapEl.dom.qtip="";break;case"title":this.el.dom.title="";this.wrapEl.dom.title="";this.outerWrapEl.dom.title="";break;case"under":if(this.errorEl){Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl,this)}break;case"side":if(this.errorIcon){this.errorIcon.dom.qtip="";this.errorIcon.hide();this.un("resize",this.alignErrorIcon,this)}break;default:var a=Ext.getDom(this.msgTarget);a.innerHTML="";a.style.display="none";break}this.fireEvent("valid",this)},alignErrorIcon:function(){if(this.wrap){this.errorIcon.alignTo(this.wrap,"tl-tr",[Ext.isIE?5:2,3])}},clearCurrentFocus:function(){if(this.currentFocus){this.currentFocus.onLnkBlur();this.currentFocus=null}return this},setupFormInterception:function(){var a;this.findParentBy(function(c){if(c.getForm){a=c.getForm()}});if(a){var b=a.getValues;a.getValues=function(d){this.el.dom.disabled=true;var c=this.el.dom.value;this.setRawValue("");var e=b.call(a);this.el.dom.disabled=false;this.setRawValue(c);if(this.forceFormValue&&this.items.getCount()===0){e[this.name]=""}return d?Ext.urlEncode(e):e}.createDelegate(this)}},onResize:function(a,c,e,b){var d=Ext.isIE6?4:Ext.isIE7?1:Ext.isIE8?1:0;if(this.wrapEl){this._width=a;this.outerWrapEl.setWidth(a-d)}Ext.ux.form.TreeComboSuperBox.superclass.onResize.call(this,a,c,e,b);this.autoSize()},autoSize:function(){if(!this.rendered){return this}if(!this.metrics){this.metrics=Ext.util.TextMetrics.createInstance(this.el)}var c=this.el,b=c.dom.value,e=document.createElement("div");if(b===""&&this.emptyText&&this.items.getCount()<1){b=this.emptyText}e.appendChild(document.createTextNode(b));b=e.innerHTML;e=null;b+="&#160;";var a=Math.max(this.metrics.getWidth(b)+24,24);if(typeof this._width!="undefined"){a=Math.min(this._width,a)}this.el.setWidth(a);if(Ext.isIE){this.el.dom.style.top="0"}this.fireEvent("autosize",this,a);return this}});Ext.reg("treecombosuperbox",Ext.ux.form.TreeComboSuperBox);Ext.ux.form.SuperBoxSelectItem=function(a){Ext.apply(this,a);Ext.ux.form.SuperBoxSelectItem.superclass.constructor.call(this)};Ext.ux.form.SuperBoxSelectItem=Ext.extend(Ext.ux.form.SuperBoxSelectItem,Ext.Component,{initComponent:function(){Ext.ux.form.SuperBoxSelectItem.superclass.initComponent.call(this)},onElClick:function(b){var c=this.owner;c.clearCurrentFocus().collapse();if(c.navigateItemsWithTab){this.focus()}else{c.el.dom.focus();var a=this;(function(){this.onLnkFocus();c.currentFocus=this}).defer(10,this)}},onLnkClick:function(a){if(a){a.stopEvent()}this.preDestroy();if(!this.owner.navigateItemsWithTab){this.owner.el.focus()}},onLnkFocus:function(){this.el.addClass("x-superboxselect-item-focus");this.owner.outerWrapEl.addClass("x-form-focus")},onLnkBlur:function(){this.el.removeClass("x-superboxselect-item-focus");this.owner.outerWrapEl.removeClass("x-form-focus")},enableElListeners:function(){this.el.on("click",this.onElClick,this,{stopEvent:true});this.el.addClassOnOver("x-superboxselect-item x-superboxselect-item-hover")},enableLnkListeners:function(){this.lnk.on({click:this.onLnkClick,focus:this.onLnkFocus,blur:this.onLnkBlur,scope:this})},enableAllListeners:function(){this.enableElListeners();this.enableLnkListeners()},disableAllListeners:function(){this.el.removeAllListeners();this.lnk.un("click",this.onLnkClick,this);this.lnk.un("focus",this.onLnkFocus,this);this.lnk.un("blur",this.onLnkBlur,this)},onRender:function(c,a){Ext.ux.form.SuperBoxSelectItem.superclass.onRender.call(this,c,a);var e=this.el;if(e){e.remove()}this.el=e=c.createChild({tag:"li"},c.last());e.addClass("x-superboxselect-item");var d=this.owner.navigateItemsWithTab?(Ext.isSafari?"button":"a"):"span";var f=this.key;Ext.apply(e,{focus:function(){var g=this.down(d+".x-superboxselect-item-close");if(g){g.focus()}},preDestroy:function(){this.preDestroy()}.createDelegate(this)});this.enableElListeners();e.update(this.caption);var b={tag:d,"class":"x-superboxselect-item-close",tabIndex:this.owner.navigateItemsWithTab?"0":"-1"};if(d==="a"){b.href="#"}this.lnk=e.createChild(b);if(!this.disabled){this.enableLnkListeners()}else{this.disableAllListeners()}this.on({disable:this.disableAllListeners,enable:this.enableAllListeners,scope:this});this.setupKeyMap()},setupKeyMap:function(){this.keyMap=new Ext.KeyMap(this.lnk,[{key:[Ext.EventObject.BACKSPACE,Ext.EventObject.DELETE,Ext.EventObject.SPACE],fn:this.preDestroy,scope:this},{key:[Ext.EventObject.RIGHT,Ext.EventObject.DOWN],fn:function(){this.moveFocus("right")},scope:this},{key:[Ext.EventObject.LEFT,Ext.EventObject.UP],fn:function(){this.moveFocus("left")},scope:this},{key:[Ext.EventObject.HOME],fn:function(){var a=this.owner.items.get(0).el.focus();if(a){a.el.focus()}},scope:this},{key:[Ext.EventObject.END],fn:function(){this.owner.el.focus()},scope:this},{key:Ext.EventObject.ENTER,fn:function(){}}]);this.keyMap.stopEvent=true},moveFocus:function(a){var b=this.el[a=="left"?"prev":"next"]()||this.owner.el;b.focus.defer(100,b)},preDestroy:function(a){if(this.fireEvent("remove",this)===false){return}var b=function(){if(this.owner.navigateItemsWithTab){this.moveFocus("right")}this.hidden.remove();this.hidden=null;this.destroy()};if(a){b.call(this)}else{this.el.hide({duration:0.2,callback:b,scope:this})}return this},kill:function(){this.hidden.remove();this.hidden=null;this.purgeListeners();this.destroy()},onDisable:function(){if(this.hidden){this.hidden.dom.setAttribute("disabled","disabled")}this.keyMap.disable();Ext.ux.form.SuperBoxSelectItem.superclass.onDisable.call(this)},onEnable:function(){if(this.hidden){this.hidden.dom.removeAttribute("disabled")}this.keyMap.enable();Ext.ux.form.SuperBoxSelectItem.superclass.onEnable.call(this)},onDestroy:function(){Ext.destroy(this.lnk,this.el);Ext.ux.form.SuperBoxSelectItem.superclass.onDestroy.call(this)}});
/* - widget_folder_contents.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.widget");Anz.widget.folderContents=Ext.extend(Anz.widget.base,{iconCls:"widget_folder_contents_icon",entries:[],page:0,pageCount:1,count:null,getCustomisePreferences:function(){var a=this.portalUrl.split("/").pop();return[{xtype:"treecombosuperbox",name:"paths",fieldLabel:_("Paths"),hiddenName:"paths:list",navigateItemsWithTab:true,resizable:true,allowBlank:false,msgTarget:"under",displayFieldTpl:"{text}",value:"/"+a,multiSelect:true,treeWidth:353,treeConfig:{height:110,rootVisible:true,autoScroll:true,root:{nodeType:"async",text:_("Root"),id:"root",expanded:true,path:"/"+a},loader:{url:this.contextUrl+"/@@folderContentsWidget/getChildNodesData"},listeners:{beforeload:{fn:function(c){var b=c.getOwnerTree().getLoader();b.baseParams.path=c.attributes.path}},click:{fn:function(d,g){var c=d.attributes.path;var i=d.text;var b=this.getCaption(d);var h="";var f="";this.addItemBox(c,i,b,h,f)}}}}},{xtype:"xcheckbox",name:"searchSub",fieldLabel:_("Search sub-directory?"),submitOffValue:0,submitOnValue:1,value:0,hiddenName:"searchSub:int"},{xtype:"multiselect",fieldLabel:_("Types"),name:"types",width:360,height:"auto",allowBlank:true,displayField:"name",valueField:"id",store:new Ext.data.JsonStore({autoDestroy:true,autoLoad:true,url:this.contextUrl+"/@@folderContentsWidget/types",root:"types",fields:["id","name"]})},{xtype:"numberfield",name:"recentDays",fieldLabel:_("Recent days"),value:0,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"numberfield",name:"sort_limit",fieldLabel:_("Max count"),value:0,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"xcheckbox",name:"paging",fieldLabel:_("Paging?"),submitOffValue:0,submitOnValue:1,value:1,hiddenName:"paging:int"},{xtype:"numberfield",name:"count",fieldLabel:_("Count"),value:5,allowBlank:false,allowDecimals:false,allowNegative:false},{xtype:"combo",name:"view",hiddenName:"view",fieldLabel:_("View"),value:"Normal",mode:"local",store:{xtype:"arraystore",fields:["id","name"],data:[["Normal",_("Normal")],["Magazine",_("Magazine")],["Slideshow",_("Slideshow")],["Headline",_("Headline")]]},displayField:"name",valueField:"id",triggerAction:"all",editable:false}]},getDefaultValues:function(){return{searchSub:0,recentDays:0,sort_limit:0,count:5,paging:1,view:"Normal"}},updateOptions:function(i){var a=this.options;this.options=i;this.count=parseInt(this.getValue("count"));this.setTitle(Utf8.decode(this.getValue("title")));if(!this.collapsed){var c=a.paths;var g=a.types;var d=a.searchSub;var h=a.recentDays;var e=a.sort_limit;var f=a.view;var b=a.paging;if((c!==this.getValue("paths"))||(g!==this.getValue("types"))||(d!==this.getValue("searchSub"))||(h!==this.getValue("recentDays"))||(e!==this.getValue("sort_limit"))){this.display()}else{if((f!==this.getValue("view"))||(b!==this.getValue("paging"))){if(this.loaded){this.buildContents()}else{this.display()}}}}},display:function(){this.body.update('<div class="loading-indicator">Loading...</div>');this.loaded=false;var d=this.getValue("paths");var b=this.getValue("types");var c=this.getValue("searchSub");var e=this.getValue("recentDays");var a=this.getValue("sort_limit");Ext.Ajax.request({url:this.contextUrl+"/@@folderContentsWidget/items",method:"POST",params:{"paths:list":d,searchSub:c,portal_types:b,"recentDays:int":e,"sort_limit:int":a},timeout:5000,scope:this,success:function(f,h){var g=Ext.decode(f.responseText);if(g.success){this.entries=g.items;this.count=parseInt(this.getValue("count"));this.pageCount=Math.ceil(this.entries.length/this.count);this.buildContents();this.loaded=true}else{if(g.msg){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}},failure:function(f,h){var g=f.responseText;if(g){this.body.update(g.msg)}else{this.body.update(_("Sorry, get data fail, rettry later."))}this.retryDisplay()}})},attachPagingHandler:function(){var a=this.body.child("a[class=prePage]");if(a){a.on("click",this.prePage,this)}var b=this.body.child("a[class=nextPage]");if(b){b.on("click",this.nextPage,this)}},prePage:function(){this.page-=1;this.buildContents()},nextPage:function(){this.page+=1;this.buildContents()},buildContents:function(){var c="";var a=this.getValue("view");switch(a){case"Normal":c=this.buildNormalHtml();break;case"Magazine":c=this.buildMagazineHtml();break;case"Slideshow":c=this.buildSlideshowHtml();break;case"Headline":c=this.buildHeadlineHtml();break;default:c=this.buildNormalHtml()}var d=this.getValue("paging")&&(this.pageCount>1)&&(a!=="Slideshow");if(d){c+='<div class="paging-bottom">';if(this.page!==0){c+=String.format('<a class="prePage" href="javascript:;">{0}</a>',_("prev"))}if(this.page<this.pageCount-1){c+=String.format('<a class="nextPage" href="javascript:;">{0}</a>',_("next"))}c+="<div>"}this.body.update(c);if(a==="Slideshow"){var b=this.getId()+"_slideshow";new Ext.ux.Carousel(b,{itemSelector:"div.item",interval:10,autoPlay:true,transitionEasing:"easeIn"})}if(d){this.attachPagingHandler()}},buildNormalHtml:function(){var h=this.page*this.count;var c=this.entries.slice(h,h+this.count);var f='<ul class="itemList">';var b=new Ext.Template("<li>",'<img width="16" height="16" src="{iconSrc}">','<a href="{link}" title="{desc}" target="_blank">',"{title}","</a>",'<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</li>");for(var e=0,a=c.length;e<a;++e){var g=c[e];var d="";if(g.icon){d=this.portalUrl+"/"+g.icon}f+=b.applyTemplate({iconSrc:d,title:g.title,desc:g.desc,link:g.url,authorLink:this.portalUrl+"/author/"+g.author_id,author:g.author,date:g.modified,shortDate:new Date(g.modified).format("Y/m/d")})}f+="</ul>";return f},buildMagazineHtml:function(){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="magazineView">'];var f=new Ext.Template('<div class="left">','<div class="crop">','<img height="234" width="234" src="{img}"/>',"</div>",'<div class="article">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</div>","</div>");var c=e[0];d.push(f.applyTemplate({title:c.title,desc:c.desc,img:this.portalUrl+"/default_news.png",link:c.link,authorLink:this.portalUrl+"/author/"+c.author_id,author:c.author,date:c.modified,shortDate:new Date(c.modified).format("Y/m/d")}));d.push('<div class="right">');var g=new Ext.Template('<div class="item">','<div class="thumbnail">','<img height="50" width="50" src="{img}"/>',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</div>","<p>{desc}</p>","</div>");for(var b=1,h=e.length;b<h;++b){var j=e[b];d.push(g.applyTemplate({title:j.title,desc:j.desc,img:this.portalUrl+"/default_news.png",link:j.link,authorLink:portalUrl+"/author/"+j.author_id,author:j.author,date:j.modified,shortDate:new Date(j.modified).format("Y/m/d")}))}d.push("</div></div>");return d.join("")},buildSlideshowHtml:function(c){var c=this.entries;var d=this.getId()+"_slideshow";var f=[String.format('<div class="slideshowView" id="{0}">',d)];var b=new Ext.Template('<div class="item">','<div class="crop">','<img src="{img}">',"</div>",'<div class="content">','<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>',"</div>",'<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</div>","</div>");for(var e=0,a=c.length;e<a;++e){var g=c[e];f.push(b.applyTemplate({img:this.portalUrl+"/default_news.png",title:g.title,desc:g.desc,link:g.link,authorLink:this.portalUrl+"/author/"+g.author_id,author:g.author,date:g.modified,shortDate:new Date(g.modified).format("Y/m/d")}))}f.push("</div>");return f.join("")},buildHeadlineHtml:function(e){var a=this.page*this.count;var e=this.entries.slice(a,a+this.count);var d=['<div class="headlineView">'];var f=new Ext.Template('<div class="top">','<div class="crop">','<img height="234" width="234" src="{img}">',"</div>",'<div class="title">','<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","</div>","</div>",'<div class="middle odd">',"<p>{desc}</p>","</div>");var c=e[0];d.push(f.applyTemplate({img:this.portalUrl+"/default_news.png",title:c.title,desc:c.desc,link:c.link,authorLink:this.portalUrl+"/author/"+c.author_id,author:c.author,date:c.modified,shortDate:new Date(c.modified).format("Y/m/d")}));d.push('<ul class="bottom">');var g=new Ext.Template('<li class="item {cls}">','<div class="thumbnail">','<img height="50" width="50" src="{img}">',"</div>",'<h3><a href="{link}" target="_blank">{title}</a></h3>','<span class="byline">',' - <a href="{authorLink}" target="_blank">',"{author}","</a>",'<span title="{date}" class="itemDate"> - {shortDate}</span>',"</span>","<p>{desc}</p>","</li>");for(var b=1,h=e.length;b<h;++b){var j=e[b];d.push(g.applyTemplate({cls:b%2?"even":"odd",img:this.portalUrl+"/default_news.png",title:j.title,desc:j.desc,link:j.link,authorLink:this.portalUrl+"/author/"+j.author_id,author:j.author,date:j.modified,shortDate:new Date(j.modified).format("Y/m/d")}))}d.push("</ul></div>");return d.join("")},getTimeDiff:function(e){if(!e){return""}var d=new Date(e);var h=new Date();var c=h.valueOf()-d.valueOf();var i=c/86400000;i=parseInt(i);c=c-(i*86400000);var f=c/3600000;f=parseInt(f);c=c-(f*3600000);var b=c/60000;b=parseInt(b);c=c-(b*60000);var g=c/1000;g=parseInt(g);var a="";if(i>0){a=i+"days before"}else{if(f>0){a=f+"hours before"}else{if(b>0){a=b+"minutes before"}}}return a}});Ext.reg("widget_folder_contents",Anz.widget.folderContents);
/* - widgetsview.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.dashboard");Anz.dashboard.WidgetsView=function(a){this.config=a};Anz.dashboard.WidgetsView.prototype={lookup:{},show:function(b,d){if(!this.win){this.initTemplates();this.store=new Ext.data.JsonStore({url:this.config.url,root:"widgets",fields:["id","title","desc","icon"]});this.store.load();var c=function(e){e.iconCls=e.icon;e.icon=this.config.portalUrl+"/"+e.icon+"64.png";e.Widget_Name=_("Widget name");e.Description=_("Description");this.lookup[e.id]=e;return e};this.view=new Ext.DataView({tpl:this.thumbTemplate,singleSelect:true,overClass:"x-view-over",itemSelector:"div.thumb-wrap",emptyText:'<div style="padding:10px;">No images match the specified filter</div>',store:this.store,listeners:{selectionchange:{fn:this.showDetails,scope:this,buffer:100},dblclick:{fn:this.doCallback,scope:this},loadexception:{fn:this.onLoadException,scope:this},beforeselect:{fn:function(e){return e.store.getRange().length>0}}},prepareData:c.createDelegate(this)});var a={title:_("Widgets list"),id:"widgets-chooser-dlg",layout:"border",minWidth:500,minHeight:300,modal:true,closeAction:"hide",border:false,items:[{id:"widget-chooser-view",region:"center",autoScroll:true,items:this.view},{id:"widget-detail-panel",region:"east",split:true,width:150,minWidth:150,maxWidth:250}],buttons:[{id:"ok-btn",text:_("OK"),handler:this.doCallback,scope:this},{text:_("Cancel"),handler:function(){this.win.hide()},scope:this}],keys:{key:27,handler:function(){this.win.hide()},scope:this}};Ext.apply(a,this.config);this.win=new Ext.Window(a)}this.reset();this.win.show(b);this.callback=d;this.animateTarget=b},initTemplates:function(){this.thumbTemplate=new Ext.XTemplate('<tpl for=".">','<div class="thumb-wrap" id="{id}">','<div class="thumb"><img src="{icon}" title="{title}"></div>',"<span>{title}</span></div>","</tpl>");this.thumbTemplate.compile();this.detailsTemplate=new Ext.XTemplate('<div class="details">','<tpl for=".">','<div class="thumb"><img src="{icon}"></div>','<div class="details-info">',"<div><b>{Widget_Name}: </b>","<span>{title}</span></div>","<div><b>{Description}: </b>","<span>{desc}</span></div>","</div>","</tpl>","</div>");this.detailsTemplate.compile()},showDetails:function(){var b=this.view.getSelectedNodes();var c=Ext.getCmp("widget-detail-panel").body;if(b&&b.length>0){b=b[0];Ext.getCmp("ok-btn").enable();var a=this.lookup[b.id];c.hide();this.detailsTemplate.overwrite(c,a);c.slideIn("l",{stopFx:true,duration:0.2})}else{Ext.getCmp("ok-btn").disable();c.update("")}},sortImages:function(){var a=Ext.getCmp("sortSelect").getValue();this.view.store.sort(a,a=="name"?"asc":"desc");this.view.select(0)},reset:function(){this.view.select(0)},doCallback:function(){var a=this.view.getSelectedNodes()[0];var c=this.callback;var b=this.lookup;this.win.hide(this.animateTarget,function(){if(a&&c){var d=b[a.id];c(d)}})},onLoadException:function(a,b){this.view.getEl().update('<div style="padding:10px;">Error loading images.</div>')}};
/* - TabMoreMenu.js - */
Ext.ux.TabMoreMenu=function(a){a=a||{};Ext.apply(this,a);Ext.ux.TabMoreMenu.superclass.constructor.call(this)};Ext.extend(Ext.ux.TabMoreMenu,Ext.util.Observable,{menuAlign:"tr-br?",menuOffsets:[0,-5],init:function(a){a.getTemplateArgs=this.getTemplateArgs.createDelegate(a);a.findTargets=this.findTargets.createDelegate(a);a.onStripMouseDown=this.onStripMouseDown.createDelegate(a);a.on("beforedestroy",this.beforedestroy,this);a.on("more",this.onMore,this);this.tab=a;if(this.menu){this.menu=Ext.menu.MenuMgr.get(this.menu);Ext.apply(this.menu,{defaultOffsets:this.menuOffsets,afterRender:function(){Ext.menu.Menu.superclass.afterRender.call(this);this.items.each(function(b){b.un("click",b.handler,b.scope)},this)}});this.menu.on("click",this.onMenuClick,this)}},onMenuClick:function(c,a,b){b.stopEvent();if(a.handler){a.handler.call(a.scope||this,this.menu.tabItem)}},onMore:function(c,a,b){c.stopEvent();this.menu.tabItem=a.item;if(this.menu){this.menu.show(b,this.menuAlign)}},getTemplateArgs:function(a){var b=Ext.TabPanel.prototype.getTemplateArgs.call(this,a);b.cls="x-tab-strip-more";return b},findTargets:function(b){var a=Ext.TabPanel.prototype.findTargets.call(this,b);a.close=false;a.more=b.getTarget(".x-tab-strip-close",this.strip);return a},onStripMouseDown:function(b){Ext.TabPanel.prototype.onStripMouseDown.call(this,b);var a=this.findTargets(b);if(a.more&&a.item){this.fireEvent("more",b,a,a.el)}},beforedestroy:function(){Ext.destroy(this.menu)}});
/* - anz_dashboard.js - */
Ext.BLANK_IMAGE_URL="ext3/resources/images/default/s.gif";Ext.namespace("Anz","Anz.dashboard");Anz.dashboard.app=function(){return{portalUrl:null,contextUrl:null,container:null,currentPage:null,pageLayout:null,currentWidget:null,pageTools:[],columnTools:[],widgetTools:[],widgetContextMenu:null,widgetsPanel:null,init:function(b,a){this.portalUrl=b;this.contextUrl=a;Ext.QuickTips.init();Ext.Ajax.request({url:this.contextUrl+"/@@mergedRequest/getMergedData",method:"POST",params:{"requests:list":["pageLayout@@dashboardView/getPageLayout","layoutCfg@@dashboardView/getLayoutConfig","widgets@@widgetView/getWidgets","i18n@@msgCatalog/catalogMapping?domain=anz.dashboard"]},scope:this,success:function(l,d){var h=Ext.decode(l.responseText);this.pageLayout=h.pageLayout.layout;var c=h.layoutCfg.config;Anz.i18n=h.i18n.texts;var k=h.widgets.widgets;var j={};for(var e=0,g=k.length;e<g;++e){var f=k[e];j[f.id]=f}this.constructPageTools();this.constructColumnTools();this.constructWidgetTools();this.constructPages(c,j)},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},destroy:function(){if(this.container){this.container.removeAll()}},calcPageIndex:function(g){var d=null;var c=null;if(this.pageLayout==="tile"){c=this.container.items;for(var f=0,b=c.getCount();f<b;++f){if(g.getId()===c.get(f).id){d=f;break}}}else{var a=this.container.getActiveTab();var e=this.container.items;for(var f=0;f<e.getCount();f++){if(a==e.get(f)){d=f;break}}}return d},calcColumnIndex:function(d){var b=null;var e=d.ownerCt.items;for(var c=0,a=e.getCount();c<a;++c){if(d.getId()===e.get(c).id){b=c;break}}return b},calcWidgetPos:function(h){var g=h.findParentByType("portal");var b=this.calcPageIndex(g);var f=this.calcColumnIndex(h.ownerCt);var e=null;var c=h.ownerCt.items;for(var d=0,a=c.getCount();d<a;++d){if(h.getId()===c.get(d).getId()){e=d;break}}return{page:b,col:f,pos:e,pageCount:g.ownerCt.items.getCount(),colCount:g.items.getCount()}},constructPageTools:function(){this.pageTools=[{id:"add_widget",qtip:_("Add widget"),scope:this,handler:function(c,b,a){this.showWidgetsView(a)}},{id:"add_page",qtip:_("Add page"),scope:this,handler:function(c,b,a){this.addPage(this.calcPageIndex(a)+1)}},{id:"save",qtip:_("Edit page"),scope:this,handler:function(c,b,a){this.editPage(a)}},{id:"up",qtip:_("Move page up"),scope:this,handler:function(c,b,a){this.movePage(a,"up")}},{id:"down",qtip:_("Move page down"),scope:this,handler:function(c,b,a){this.movePage(a,"down")}},{id:"close",qtip:_("Delete page"),scope:this,handler:function(c,b,a){this.delPage(a)}}]},constructColumnTools:function(){this.columnTools=[{id:"add_column",qtip:_("Add column"),scope:this,handler:function(d,c,a){var e=a.findParentByType("portal");var b=this.calcColumnIndex(a);this.addColumn(e,b+1)}},{id:"left",qtip:_("Move column left"),scope:this,handler:function(c,b,a){this.moveColumn(a,"left")}},{id:"right",qtip:_("Move column right"),scope:this,handler:function(c,b,a){this.moveColumn(a,"right")}},{id:"close",qtip:_("Delete the column"),scope:this,handler:function(c,b,a){this.delColumn(a)}}]},constructWidgetTools:function(){this.widgetTools=[{id:"toggle",qtip:_("Collapse the widget"),scope:this,handler:function(c,b,a){this.collapseWidget(a)}},{id:"gear",qtip:_("Config the widget"),scope:this,handler:function(c,b,a){this.currentWidget=a;if(!this.widgetContextMenu){this.widgetContextMenu=new Ext.menu.Menu({shadow:false,style:{background:"white none repeat scroll 0 0",textAlign:"left",border:"1px solid #999"},items:[{id:"menuitem_color",text:_("color"),iconCls:"color_widget",menu:{xtype:"colormenu",colors:["D96666","E67399","B373B3","8C66D9","668CB3","668CD9","59BFB3","65AD89","4CB052","8CBF40","BFBF4D","E0C240","F2A640","E6804D","BE9494","A992A9","8997A5","94A2BE","85AAA5","A7A77D","C4A883"],scope:this,handler:function(d,e){this.changeWidgetColor(e)}}},{id:"menuitem_up",text:_("up"),iconCls:"move_up",scope:this,handler:function(d,f){this.moveWidget("up");f.stopEvent()}},{id:"menuitem_right",text:_("right"),iconCls:"move_right",scope:this,handler:function(d,f){this.moveWidget("right");f.stopEvent()}},{id:"menuitem_down",text:_("down"),iconCls:"move_down",scope:this,handler:function(d,f){this.moveWidget("down");f.stopEvent()}},{id:"menuitem_left",text:_("left"),iconCls:"move_left",scope:this,handler:function(d,f){this.moveWidget("left");f.stopEvent()}}]})}this.widgetContextMenu.showAt(c.getPoint())}},{id:"refresh",qtip:_("Refresh the widget"),scope:this,handler:function(d,b,a){var c=1+2}},{id:"save",qtip:_("Edit the widget"),scope:this,handler:function(c,b,a){this.changeWidgetOptions(a)}},{id:"close",qtip:_("Delete the widget"),scope:this,handler:function(c,b,a){this.delWidget(a)}}]},constructPages:function(u,q){var e={};var b="content";if(this.pageLayout==="tile"){Ext.apply(e,{renderTo:b})}else{var n=Ext.get(b);var r=n.getWidth(true);Ext.apply(e,{renderTo:b,activeTab:0,minTabWidth:115,tabWidth:135,width:r,autoHeight:true,plain:true,enableTabScroll:true,plugins:[new Ext.ux.TabMoreMenu({menu:[{id:"menuitem_edit_page",text:_("Edit page"),iconCls:"edit_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.editPage(j)}},{id:"menuitem_left",text:_("left"),iconCls:"move_left",scope:this,handler:function(i){var k=this.container.getActiveTab();var j=this.container.setActiveTab.createDelegate(this.container,[k]);this.movePage(k,"left",j)}},{id:"menuitem_right",text:_("right"),iconCls:"move_right",scope:this,handler:function(i){var k=this.container.getActiveTab();var j=this.container.setActiveTab.createDelegate(this.container,[k]);this.movePage(k,"right",j)}},{id:"menuitem_add_widget",text:_("Add widget"),iconCls:"x-tool-add_widget",scope:this,handler:function(i){var j=this.container.getActiveTab();this.showWidgetsView(j)}},{id:"menuitem_add_page",text:_("Add page"),iconCls:"x-tool-add_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.addPage(this.calcPageIndex(j)+1)}},{id:"menuitem_delete_page",text:_("Delete page"),iconCls:"delete_page",scope:this,handler:function(i){var j=this.container.getActiveTab();this.delPage(this.calcPageIndex(j)+1)}}]})]})}var m=[];for(var v=0,w=u.length;v<w;++v){var g=u[v];var l=g.columns.length;var y=[];for(var t=0;t<l;++t){var d=g.columns[t];var h={};h.title=_("column");h.columnWidth=parseFloat(d.width);h.style=d.style;h.tools=this.columnTools;var o=[];var p=d.widgets;var c=p.length;for(var s=0;s<c;++s){var f=p[s];var a={};a.portalUrl=this.portalUrl;a.contextUrl=this.contextUrl;a.xtype=f.id;a.options=f.options;a.title=Utf8.decode(f.options.title);a.collapsed=f.collapse;if(f.color){a.baseCls="x-panel-green"}if(q[f.id]){a.iconCls=q[f.id].icon}a.tools=this.widgetTools;o.push(a)}h.items=o;y.push(h)}var x=this._buildPortalCfg(y,Utf8.decode(g.title));m.push(x)}e.items=m;if(this.pageLayout==="tile"){this.container=new Ext.Panel(e)}else{this.container=new Ext.TabPanel(e)}},constructPage:function(c,a){var b=this._buildPortalCfg(c,"untitled page");if(a){this.container.insert(a,b)}else{this.container.add(b)}},addPage:function(a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addPage",method:"POST",params:{"pageIndex:int":a},scope:this,success:function(b,e){var d=Ext.decode(b.responseText);if(d.success){var c=[{title:_("column"),columnWidth:0.5,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]},{title:_("column"),columnWidth:0.5,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]}];this.constructPage(c,a);this.container.doLayout()}else{alert(d.msg)}},failure:function(b,c){Ext.MessageBox.alert("failure",b.responseText)}})},editPage:function(b){var a=new Ext.FormPanel({labelWidth:80,bodyStyle:"padding:15px;",border:false,width:500,autoHeight:true,defaults:{anchor:"100%"},defaultType:"textfield",items:[{name:"title",fieldLabel:"title",value:b.title},{name:"width",fieldLabel:"width",value:""},{xtype:"textarea",name:"style",fieldLabel:"style",value:""}]});var c=new Ext.Window({layout:"fit",title:_("Edit page"),width:640,autoHeight:true,modal:true,items:a,buttons:[{text:_("Save"),iconCls:"icon-save",handler:function(f,i){var g=a.getForm();f.disable();var h=f.nextSibling();h.disable();var d=g.getValues();if(g.isValid()){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/editPage",method:"POST",form:g.id,params:{"pageIndex:int":this.calcPageIndex(b)},scope:this,success:function(e,k){var j=Ext.decode(e.responseText);if(j.success){b.setTitle(d.title)}else{alert(j.msg)}},failure:function(e,j){alert(e.responseText)}})}else{f.enable();h.enable()}c.close()},scope:this},{text:_("Cancel"),scope:this,handler:function(d,f){c.close()}}]});c.show()},movePage:function(f,b,h){var a=this.container;var c=this.container.items.length-1;var e=this.calcPageIndex(f);var g=null;var d=false;if(b=="up"){if(e>0){g=e-1;d=true}}else{if(b=="down"){if(e<c){g=e+1;d=true}}else{if(b=="left"){if(e>0){g=e-1;d=true}}else{if(b=="right"){if(e<c){g=e+1;d=true}}}}}if(d){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/movePage",method:"POST",params:{"pageIndex:int":e,"toPage:int":g},scope:this,success:function(i,k){var j=Ext.decode(i.responseText);if(j.success){a.remove(f,false);var l=f.getPositionEl().dom;l.parentNode.removeChild(l);a.insert(g,f);a.doLayout();if(h){h()}}else{alert(j.msg)}},failure:function(i,j){Ext.MessageBox.alert("failure",i.responseText)}})}},delPage:function(a){if(this.container.items.length==1){alert(_("Can not delete the last page!"));return}Ext.Msg.confirm("Confirm",_("Are you sure you want to delete this page?"),function(c){if(c=="yes"){var b=this.calcPageIndex(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delPage",method:"POST",params:{"pageIndex:int":b},scope:this,success:function(d,g){var e=Ext.decode(d.responseText);if(e.success){if(this.pageLayout==="tile"){this.container.remove(a,true)}else{var f=this.container.getActiveTab();this.container.remove(f,true)}}else{alert(e.msg)}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})}},this)},addColumn:function(b,a){var a=a?a:0;Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(b),"columnIndex:int":a},scope:this,success:function(u,k){var o=Ext.decode(u.responseText);if(o.success){var p=b.items;var s=p.getCount()+1;var g=1/s;var t=null;var h=[];for(var l=0,m=p.getCount();l<m;++l){var r=p.get(l);if(!t){var n=r.container;t=n.getViewSize().width-n.getPadding("lr")}var q=r.getEl();var j=r.getSize().width+q.getMargins("lr");var f=(j/t)*(1-g);r.columnWidth=f;h.push(f)}var e={xtype:"portalcolumn",title:_("column"),columnWidth:g,style:"padding:5px 0 5px 5px",tools:this.columnTools,items:[]};h.splice(a,0,g);b.insert(a,e);var d=p.get(s-1);this._adjustLastColumn(d,h);b.doLayout();this.changeColumnsWidth(b,h)}else{alert(o.msg)}},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},_adjustLastColumn:function(c,e){c.getEl().setStyle("margin-right",0);var d=0;for(var b=0,a=e.length-1;b<a;++b){d+=e[b]}c.columnWidth=1-d;e[e.length-1]=1-d},changeColumnsWidth:function(b,a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeColumnsWidth",method:"POST",params:{"pageIndex:int":this.calcPageIndex(b),"widths:list":a},scope:this,success:function(c,e){var d=Ext.decode(c.responseText);if(!d.success){alert(d.msg)}},failure:function(c,d){Ext.MessageBox.alert("failure",c.responseText)}})},moveColumn:function(e,a){var f=e.findParentByType("portal");var b=f.items.getCount()-1;var d=this.calcColumnIndex(e);var g=null;var c=false;if(a=="left"){if(d>0){g=d-1;c=true}}else{if(a=="right"){if(d<b){g=d+1;c=true}}}if(c){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(f),"columnIndex:int":d,"toColumn:int":g},scope:this,success:function(i,k){var j=Ext.decode(i.responseText);if(j.success){f.remove(e,false);var l=e.getPositionEl().dom;l.parentNode.removeChild(l);f.insert(g,e);var h=f.items.get(b);h.getEl().setStyle("margin-right",0);f.doLayout()}else{alert(j.msg)}},failure:function(h,i){Ext.MessageBox.alert("failure",h.responseText)}})}},delColumn:function(a){Ext.Msg.confirm("Confirm",_("Are you sure you want to delete this column?"),function(c){if(c=="yes"){var d=a.findParentByType("portal");var b=this.calcColumnIndex(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delColumn",method:"POST",params:{"pageIndex:int":this.calcPageIndex(d),"columnIndex:int":b},scope:this,success:function(v,j){var p=Ext.decode(v.responseText);if(p.success){var o=a.container;var u=o.getViewSize();var t=u.width-o.getPadding("lr");var l=(a.getSize().width+a.getEl().getMargins("lr"))/t;var g=[];var q=d.items;for(var k=0,n=q.getCount();k<n;++k){var s=q.get(k);if(k!==b){var r=s.getEl();var h=s.getSize().width+r.getMargins("lr");var f=(h/t)/(1-l);s.columnWidth=f;g.push(f)}}var m=d.getLayout();if(m.splitBars){m.splitBars[b].destroy(true)}a.ownerCt.remove(a,true);var e=q.get(g.length-1);this._adjustLastColumn(e,g);d.doLayout();this.changeColumnsWidth(d,g)}else{alert(p.msg)}},failure:function(e,f){Ext.MessageBox.alert("failure",e.responseText)}})}},this)},showWidgetsView:function(a){if(!this.widgetsPanel){this.widgetsPanel=new Anz.dashboard.WidgetsView({portalUrl:this.portalUrl,url:this.contextUrl+"/@@widgetView/getWidgets",width:515,height:350})}this.currentPage=a;this.widgetsPanel.show(null,this.addWidget.createDelegate(this))},addWidget:function(a){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/addWidget",method:"POST",params:{"pageIndex:int":this.calcPageIndex(this.currentPage),"columnIndex:int":0,"widgetIndex:int":0,widgetId:a.id},scope:this,success:function(b,e){var d=Ext.decode(b.responseText);if(d.success){var c=this.currentPage.getComponent(0);c.insert(0,{xtype:a.id,options:{},title:a.title,iconCls:a.iconCls,tools:this.widgetTools,contextUrl:this.contextUrl,portalUrl:this.portalUrl});c.doLayout()}else{alert(d.msg)}},failure:function(b,c){Ext.MessageBox.alert("failure",b.responseText)}})},moveWidget:function(e){var h=this.currentWidget;var i=h.findParentByType("portal");var j=this.calcWidgetPos(h);var f=j.page;var c=j.col;var d=j.pos;var k=null;var b=null;if(e=="left"){k=c-1;k=k>0?k:0;var a=i.getComponent(k);var g=a.items.getCount();b=d<g?d:g}else{if(e=="right"){k=c+1;k=k<j.colCount?k:j.colCount;var a=i.getComponent(k);var g=a.items.getCount();b=d<g?d:g}else{if(e=="up"){k=c;b=d-1;b=b>0?b:0}else{if(e=="down"){k=c;var a=i.getComponent(k);var g=a.items.getCount();b=d+1;b=b<g?b:g}}}}if((c!==k)||(d!==b)){Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveWidget",method:"POST",params:{"pageIndex:int":f,"columnIndex:int":c,"widgetIndex:int":j.pos,"toPage:int":f,"toColumn:int":k,"toWidget:int":b},scope:this,success:function(l,n){var m=Ext.decode(l.responseText);if(m.success){var o=i.getComponent(c);o.remove(h,false);var q=h.getPositionEl().dom;q.parentNode.removeChild(q);var p=i.getComponent(k);p.insert(b,h);i.doLayout()}else{alert("move widget failure.")}},failure:function(l,m){Ext.MessageBox.alert("failure",l.responseText)}})}},changeWidgetColor:function(b){var c=this.currentWidget;var a=this.calcWidgetPos(c);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeWidgetColor",method:"POST",params:{"pageIndex:int":a.page,"columnIndex:int":a.col,"widgetIndex:int":a.pos,color:b},scope:this,success:function(m,g){var k=Ext.decode(m.responseText);if(k.success){var e=c.getEl().query("*[class*=x-panel]");for(var h=0,j=e.length;h<j;++h){var d=e[h];var l=d.className;var f=l.split(c.baseCls);d.className=f.join("x-panel-green")}}else{alert("change color failure")}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})},changeWidgetOptions:function(a){var g=a.getPreferences();var n=a.options;var l=[];var h=[];for(var e=0,k=g.length;e<k;++e){var d=g[e];var b=d.name;l.push(b);var f=n[b];if(typeof f==="string"){f=Utf8.decode(f)}var m={};Ext.apply(m,d);m.value=(f!==undefined)?f:d.value;h.push(m)}var c=new Ext.FormPanel({labelWidth:80,bodyStyle:"padding:15px;",border:false,width:500,autoHeight:true,defaults:{anchor:"100%"},defaultType:"textfield",items:h});var j=new Ext.Window({layout:"fit",title:"Edit "+a.title,width:640,autoHeight:true,modal:true,items:c,buttons:[{text:_("Save"),iconCls:"icon-save",handler:function(o,r){var p=c.getForm();o.disable();var q=o.nextSibling();q.disable();if(p.isValid()){var i=this.calcWidgetPos(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/changeWidgetOptions",method:"POST",form:p.id,params:{"pageIndex:int":i.page,"columnIndex:int":i.col,"widgetIndex:int":i.pos,"names:list":l},scope:this,success:function(s,u){var t=Ext.decode(s.responseText);if(t.success){a.updateOptions(t.options)}else{alert(t.msg)}},failure:function(s,t){Ext.MessageBox.alert("failure",s.responseText)}})}else{o.enable();q.enable()}j.close()},scope:this},{text:_("Cancel"),scope:this,handler:function(i,o){j.close()}}]});j.show()},collapseWidget:function(b){var c=!b.collapsed;b.toggleCollapse(true);var a=this.calcWidgetPos(b);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/collapseWidget",method:"POST",params:{"pageIndex:int":a.page,"columnIndex:int":a.col,"widgetIndex:int":a.pos,"collapse:int":c?1:0},scope:this,success:function(d,f){var e=Ext.decode(d.responseText);if(!e.success){alert(e.msg)}},failure:function(d,e){Ext.MessageBox.alert("failure",d.responseText)}})},delWidget:function(a){var b=new Ext.Window({layout:"fit",title:a.title,width:300,autoHeight:true,modal:true,html:_("Are you sure to delete this widget?"),buttons:[{text:_("Delete"),width:"auto",iconCls:"icon-delete",handler:function(d,f){var c=this.calcWidgetPos(a);Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/delWidget",method:"POST",params:{"pageIndex:int":c.page,"columnIndex:int":c.col,"widgetIndex:int":c.pos},scope:this,success:function(e,h){var g=Ext.decode(e.responseText);if(g.success){a.ownerCt.remove(a,true)}else{alert(g.msg)}},failure:function(e,g){Ext.MessageBox.alert("failure",e.responseText)}});b.close()},scope:this},{text:_("Collapse"),scope:this,handler:function(c,d){this.collapseWidget(a);b.close()}},{text:_("Cancel"),scope:this,handler:function(c,d){b.close()}}]});b.show()},_buildPortalCfg:function(a,c){var b={xtype:"portal",title:c,frame:false,autoHeight:true,style:"padding: 10px 10px 0 10px;",bodyStyle:"padding: 5px 5px 5px 0",tools:this.pageTools,toolscope:["search","pin","gear"],items:a,listeners:{validatedrop:{scope:this,fn:function(f){var d=f.panel;d.lastPos=this.calcWidgetPos(d)}},drop:{scope:this,fn:function(h){var d=h.panel;var g=d.lastPos;var f=d.findParentByType("portal");Ext.Ajax.request({url:this.contextUrl+"/@@dashboardEdit/moveWidget",method:"POST",params:{"pageIndex:int":g.page,"columnIndex:int":g.col,"widgetIndex:int":g.pos,"toPage:int":this.calcPageIndex(f),"toColumn:int":h.columnIndex,"toWidget:int":h.position},scope:this,success:function(e,j){var i=Ext.decode(e.responseText);if(i.success){delete d.lastPos}else{alert("move widget failure.")}},failure:function(e,i){Ext.MessageBox.alert("failure",e.responseText)}})}},columnresize:{scope:this,fn:function(k){var n=null;var e=[];var l=k.items;for(var g=0,h=l.getCount();g<h;++g){var m=l.get(g);if(!n){var j=m.container;var o=j.getViewSize();n=o.width-j.getPadding("lr")}var f=m.el.getWidth();e.push(f/n)}var d=l.get(e.length-1);this._adjustLastColumn(d,e);this.changeColumnsWidth(k,e)}}}};return b}}}();