Ext.ux.ColorField=Ext.extend(Ext.form.TriggerField,{invalidText:"'{0}' is not a valid color - it must be in a the hex format (# followed by 3 or 6 letters/numbers 0-9 A-F)",triggerClass:"x-form-color-trigger",defaultAutoCreate:{tag:"input",type:"text",size:"10",maxlength:"7",autocomplete:"off"},maskRe:/[#a-f0-9]/i,validateValue:function(value){if(!Ext.ux.ColorField.superclass.validateValue.call(this,value)){return false;
}if(value.length<1){this.setColor("");
return true;
}var parseOK=this.parseColor(value);
if(!value||(parseOK==false)){this.markInvalid(String.format(this.invalidText,value));
return false;
}this.setColor(value);
return true;
},setColor:function(color){if(color==""||color==undefined){if(this.emptyText!=""&&this.parseColor(this.emptyText)){color=this.emptyText;
}else{color="transparent";
}}if(this.trigger){this.trigger.setStyle({"background-color":color});
}else{this.on("render",function(){this.setColor(color);
},this);
}},validateBlur:function(){return !this.menu||!this.menu.isVisible();
},getValue:function(){return Ext.ux.ColorField.superclass.getValue.call(this)||"";
},setValue:function(color){Ext.ux.ColorField.superclass.setValue.call(this,this.formatColor(color));
this.setColor(this.formatColor(color));
},parseColor:function(value){return(!value||(value.substring(0,1)!="#"))?false:(value.length==4||value.length==7);
},formatColor:function(value){if(!value||this.parseColor(value)){return value;
}if(value.length==3||value.length==6){return"#"+value;
}return"";
},menuListeners:{select:function(e,c){this.setValue(c);
},show:function(){this.onFocus();
},hide:function(){this.focus.defer(10,this);
var ml=this.menuListeners;
this.menu.un("select",ml.select,this);
this.menu.un("show",ml.show,this);
this.menu.un("hide",ml.hide,this);
}},onTriggerClick:function(){if(this.disabled){return;
}if(this.menu==null){this.menu=new Ext.menu.ColorMenu();
}this.menu.on(Ext.apply({},this.menuListeners,{scope:this}));
this.menu.show(this.el,"tl-bl?");
}});
Ext.reg("colorfield",Ext.ux.ColorField);
Ext.namespace("Ext.ux.form");
Ext.ux.form.ComboBoxAdd=function(config){Ext.ux.form.ComboBoxAdd.superclass.constructor.apply(this,arguments);
};
Ext.extend(Ext.ux.form.ComboBoxAdd,Ext.form.ComboBox,{trigger1Class:"",trigger2Class:"x-form-add-trigger",initComponent:function(){Ext.ux.form.ComboBoxAdd.superclass.initComponent.call(this);
this.addEvents({add:true});
this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",cn:[{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger1Class},{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger2Class}]};
},getTrigger:function(index){return this.triggers[index];
},initTrigger:function(){var ts=this.trigger.select(".x-form-trigger",true);
this.wrap.setStyle("overflow","hidden");
var triggerField=this;
ts.each(function(t,all,index){t.hide=function(){var w=triggerField.wrap.getWidth();
this.dom.style.display="none";
triggerField.el.setWidth(w-triggerField.trigger.getWidth());
};
t.show=function(){var w=triggerField.wrap.getWidth();
this.dom.style.display="";
triggerField.el.setWidth(w-triggerField.trigger.getWidth());
};
var triggerIndex="Trigger"+(index+1);
if(this["hide"+triggerIndex]){t.dom.style.display="none";
}t.on("click",this["on"+triggerIndex+"Click"],this,{preventDefault:true});
t.addClassOnOver("x-form-trigger-over");
t.addClassOnClick("x-form-trigger-click");
},this);
this.triggers=ts.elements;
},onTrigger1Click:function(){this.onTriggerClick();
},onTrigger2Click:function(){this.fireEvent("add",{field:this,button:this.triggers[1]});
},insert:function(index,data){this.reset();
var rec=new this.store.recordType(data);
rec.id=rec.data.id;
this.store.insert(index,rec);
this.setValue(rec.data.id);
this.fireEvent("select",this,rec,index);
}});
/*
 * Ext JS Library 3.1.1
 * Copyright(c) 2006-2010 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.ns("Ext.ux.form");
Ext.ux.form.FileUploadField=Ext.extend(Ext.form.TextField,{buttonText:"Browse...",buttonOnly:false,buttonOffset:3,readOnly:true,autoSize:Ext.emptyFn,initComponent:function(){Ext.ux.form.FileUploadField.superclass.initComponent.call(this);
this.addEvents("fileselected");
},onRender:function(ct,position){Ext.ux.form.FileUploadField.superclass.onRender.call(this,ct,position);
this.wrap=this.el.wrap({cls:"x-form-field-wrap x-form-file-wrap"});
this.el.addClass("x-form-file-text");
this.el.dom.removeAttribute("name");
this.createFileInput();
var btnCfg=Ext.applyIf(this.buttonCfg||{},{text:this.buttonText});
this.button=new Ext.Button(Ext.apply(btnCfg,{renderTo:this.wrap,cls:"x-form-file-btn"+(btnCfg.iconCls?" x-btn-icon":"")}));
if(this.buttonOnly){this.el.hide();
this.wrap.setWidth(this.button.getEl().getWidth());
}this.bindListeners();
this.resizeEl=this.positionEl=this.wrap;
},bindListeners:function(){this.fileInput.on({scope:this,mouseenter:function(){this.button.addClass(["x-btn-over","x-btn-focus"]);
},mouseleave:function(){this.button.removeClass(["x-btn-over","x-btn-focus","x-btn-click"]);
},mousedown:function(){this.button.addClass("x-btn-click");
},mouseup:function(){this.button.removeClass(["x-btn-over","x-btn-focus","x-btn-click"]);
},change:function(){var v=this.fileInput.dom.value;
this.setValue(v);
this.fireEvent("fileselected",this,v);
}});
},createFileInput:function(){this.fileInput=this.wrap.createChild({id:this.getFileInputId(),name:this.name||this.getId(),cls:"x-form-file",tag:"input",type:"file",size:1});
},reset:function(){this.fileInput.remove();
this.createFileInput();
this.bindListeners();
Ext.ux.form.FileUploadField.superclass.reset.call(this);
},getFileInputId:function(){return this.id+"-file";
},onResize:function(w,h){Ext.ux.form.FileUploadField.superclass.onResize.call(this,w,h);
this.wrap.setWidth(w);
if(!this.buttonOnly){var w=this.wrap.getWidth()-this.button.getEl().getWidth()-this.buttonOffset;
this.el.setWidth(w);
}},onDestroy:function(){Ext.ux.form.FileUploadField.superclass.onDestroy.call(this);
Ext.destroy(this.fileInput,this.button,this.wrap);
},onDisable:function(){Ext.ux.form.FileUploadField.superclass.onDisable.call(this);
this.doDisable(true);
},onEnable:function(){Ext.ux.form.FileUploadField.superclass.onEnable.call(this);
this.doDisable(false);
},doDisable:function(disabled){this.fileInput.dom.disabled=disabled;
this.button.setDisabled(disabled);
},preFocus:Ext.emptyFn,alignErrorIcon:function(){this.errorIcon.alignTo(this.wrap,"tl-tr",[2,0]);
}});
Ext.reg("fileuploadfield",Ext.ux.form.FileUploadField);
Ext.form.FileUploadField=Ext.ux.form.FileUploadField;
Ext.namespace("Ext.ux.Andrie");
Ext.ux.Andrie.pPageSize=function(config){Ext.apply(this,config);
};
Ext.extend(Ext.ux.Andrie.pPageSize,Ext.util.Observable,{beforeText:"Show",afterText:"items",addBefore:"-",addAfter:null,dynamic:false,variations:[5,10,20,50,100,200,500,1000],comboCfg:undefined,position:11,init:function(pagingToolbar){this.pagingToolbar=pagingToolbar;
this.pagingToolbar.pageSizeCombo=this;
this.pagingToolbar.setPageSize=this.setPageSize.createDelegate(this);
this.pagingToolbar.getPageSize=function(){return this.pageSize;
};
this.pagingToolbar.on("render",this.onRender,this);
},addSize:function(value){if(value>0){this.sizes.push([value]);
}},updateStore:function(){if(this.dynamic){var middleValue=this.pagingToolbar.pageSize,start;
middleValue=(middleValue>0)?middleValue:1;
this.sizes=[];
var v=this.variations;
for(var i=0,len=v.length;
i<len;
i++){this.addSize(middleValue-v[v.length-1-i]);
}this.addToStore(middleValue);
for(var i=0,len=v.length;
i<len;
i++){this.addSize(middleValue+v[i]);
}}else{if(!this.staticSizes){this.sizes=[];
var v=this.variations;
var middleValue=0;
for(var i=0,len=v.length;
i<len;
i++){this.addSize(middleValue+v[i]);
}this.staticSizes=this.sizes.slice(0);
}else{this.sizes=this.staticSizes.slice(0);
}}this.combo.store.loadData(this.sizes);
this.combo.collapse();
this.combo.setValue(this.pagingToolbar.pageSize);
},setPageSize:function(value,forced){var pt=this.pagingToolbar;
this.combo.collapse();
value=parseInt(value)||parseInt(this.combo.getValue());
value=(value>0)?value:1;
if(value==pt.pageSize){return;
}else{if(value<pt.pageSize){pt.pageSize=value;
var ap=Math.round(pt.cursor/value)+1;
var cursor=(ap-1)*value;
var store=pt.store;
if(cursor>store.getTotalCount()){this.pagingToolbar.pageSize=value;
this.pagingToolbar.doLoad(cursor-value);
}else{store.suspendEvents();
for(var i=0,len=cursor-pt.cursor;
i<len;
i++){store.remove(store.getAt(0));
}while(store.getCount()>value){store.remove(store.getAt(store.getCount()-1));
}store.resumeEvents();
store.fireEvent("datachanged",store);
pt.cursor=cursor;
var d=pt.getPageData();
pt.afterTextItem.setText(String.format(pt.afterPageText,d.pages));
pt.inputItem.value=ap;
pt.first.setDisabled(ap==1);
pt.prev.setDisabled(ap==1);
pt.next.setDisabled(ap==d.pages);
pt.last.setDisabled(ap==d.pages);
pt.updateInfo();
}}else{this.pagingToolbar.pageSize=value;
this.pagingToolbar.doLoad(Math.floor(this.pagingToolbar.cursor/this.pagingToolbar.pageSize)*this.pagingToolbar.pageSize);
}}this.updateStore();
},onRender:function(){this.combo=Ext.ComponentMgr.create(Ext.applyIf(this.comboCfg||{},{store:new Ext.data.SimpleStore({fields:["pageSize"],data:[]}),displayField:"pageSize",valueField:"pageSize",mode:"local",triggerAction:"all",width:50,xtype:"combo"}));
this.combo.on("select",this.setPageSize,this);
this.updateStore();
if(this.addBefore){this.pagingToolbar.insert(this.position,this.addBefore);
this.position++;
}if(this.beforeText){this.pagingToolbar.insert(this.position,this.beforeText);
this.position++;
}this.pagingToolbar.insert(this.position,this.combo);
this.position++;
if(this.afterText){this.pagingToolbar.insert(this.position,this.afterText);
this.position++;
}if(this.addAfter){this.pagingToolbar.insert(this.position,this.addAfter);
}}});
Ext.namespace("Ext.ux.grid");
Ext.ux.grid.PropertyRecord=Ext.data.Record.create([{name:"name",type:"string"},"value","header","field"]);
Ext.ux.grid.PropertyStore=function(grid,source){this.grid=grid;
this.store=new Ext.data.Store({recordType:Ext.grid.PropertyRecord});
this.store.loadRecords=function(o,options,success){if(!o||success===false){if(success!==false){this.fireEvent("load",this,[],options);
}if(options.callback){options.callback.call(options.scope||this,[],options,false);
}return;
}var r=o.records,t=o.totalRecords||r.length;
if(!options||options.add!==true){if(this.pruneModifiedRecords){this.modified=[];
}for(var i=0,len=r.length;
i<len;
i++){r[i].join(this);
}if(this.snapshot){this.data=this.snapshot;
delete this.snapshot;
}this.data.clear();
this.data.addAll(r);
this.totalLength=t;
this.fireEvent("datachanged",this);
}else{this.totalLength=Math.max(t,this.data.length+r.length);
this.add(r);
}this.fireEvent("load",this,r,options);
if(options.callback){options.callback.call(options.scope||this,r,options,true);
}};
this.store.on("update",this.onUpdate,this);
if(source){this.setSource(source);
}Ext.ux.grid.PropertyStore.superclass.constructor.call(this);
};
Ext.extend(Ext.ux.grid.PropertyStore,Ext.util.Observable,{setSource:function(o,fields){this.source=o;
this.store.removeAll();
var data=[];
if(fields){for(var k in fields){k=fields[k];
if(typeof(k)=="object"){data.push(new Ext.grid.PropertyRecord({name:k.dataIndex,value:o[k.dataIndex],header:k.header,field:k},k.id));
}}}else{for(var k in o){if(this.isEditableValue(o[k])){data.push(new Ext.grid.PropertyRecord({name:k,value:o[k],header:k},k));
}}}this.store.loadRecords({records:data},{},true);
},onUpdate:function(ds,record,type){if(type==Ext.data.Record.EDIT){var v=record.data.value;
var oldValue=record.modified.value;
if(this.grid.fireEvent("beforepropertychange",this.source,record.id,v,oldValue)!==false){this.source[record.id]=v;
record.commit();
this.grid.fireEvent("propertychange",this.source,record.id,v,oldValue);
}else{record.reject();
}}},getProperty:function(row){return this.store.getAt(row);
},isEditableValue:function(val){if(Ext.isDate(val)){return true;
}else{if(typeof val=="object"||typeof val=="function"){return false;
}}return true;
},setValue:function(prop,value){this.source[prop]=value;
this.store.getById(prop).set("value",value);
},getSource:function(){return this.source;
}});
Ext.ux.grid.PropertyColumnModel=function(grid,store){this.grid=grid;
var g=Ext.grid;
Ext.ux.grid.PropertyColumnModel.superclass.constructor.call(this,[{header:this.nameText,width:grid.nameWidth,sortable:true,dataIndex:"header",id:"name",menuDisabled:true},{header:this.valueText,width:grid.valueWidth,resizable:false,dataIndex:"value",id:"value",menuDisabled:true}]);
this.store=store;
this.bselect=Ext.DomHelper.append(document.body,{tag:"select",cls:"x-grid-editor x-hide-display",children:[{tag:"option",value:"true",html:"true"},{tag:"option",value:"false",html:"false"}]});
var f=Ext.form;
var bfield=new f.Field({el:this.bselect,bselect:this.bselect,autoShow:true,getValue:function(){return this.bselect.value=="true";
}});
this.editors={date:new g.GridEditor(new f.DateField({selectOnFocus:true})),string:new g.GridEditor(new f.TextField({selectOnFocus:true})),number:new g.GridEditor(new f.NumberField({selectOnFocus:true,style:"text-align:left;"})),"boolean":new g.GridEditor(bfield)};
this.renderCellDelegate=this.renderCell.createDelegate(this);
this.renderPropDelegate=this.renderProp.createDelegate(this);
};
Ext.extend(Ext.ux.grid.PropertyColumnModel,Ext.grid.ColumnModel,{nameText:"Name",valueText:"Value",dateFormat:"m/j/Y",renderDate:function(dateVal){return dateVal.dateFormat(this.dateFormat);
},renderBool:function(bVal){return bVal?"true":"false";
},isCellEditable:function(colIndex,rowIndex){var p=this.store.getProperty(rowIndex);
if(p.data.field&&p.data.field.editable==false){return false;
}return colIndex==1;
},getRenderer:function(col){return col==1?this.renderCellDelegate:this.renderPropDelegate;
},renderProp:function(v){return this.getPropertyName(v);
},renderCell:function(val,metadata,record,rowIndex,colIndex,store){if(record.data.field&&typeof(record.data.field.renderer)=="function"){return record.data.field.renderer.call(this,val,metadata,record,rowIndex,colIndex,store);
}var rv=val;
if(Ext.isDate(val)){rv=this.renderDate(val);
}else{if(typeof val=="boolean"){rv=this.renderBool(val);
}}return Ext.util.Format.htmlEncode(rv);
},getPropertyName:function(name){var pn=this.grid.propertyNames;
return pn&&pn[name]?pn[name]:name;
},getCellEditor:function(colIndex,rowIndex){var p=this.store.getProperty(rowIndex);
var n=p.data.name,val=p.data.value;
if(p.data.field&&typeof(p.data.field.editor)=="object"){return p.data.field.editor;
}if(typeof(this.grid.customEditors)=="function"){return this.grid.customEditors(n);
}if(Ext.isDate(val)){return this.editors.date;
}else{if(typeof val=="number"){return this.editors.number;
}else{if(typeof val=="boolean"){return this.editors["boolean"];
}else{return this.editors.string;
}}}}});
Ext.ux.grid.PropertyGrid=Ext.extend(Ext.grid.EditorGridPanel,{enableColumnMove:false,stripeRows:false,trackMouseOver:false,clicksToEdit:1,enableHdMenu:false,editable:true,nameWidth:50,valueWidth:50,source:{},autoExpandColumn:"value",initComponent:function(){this.customEditors=this.customEditors||{};
this.lastEditRow=null;
var store=new Ext.ux.grid.PropertyStore(this);
this.propStore=store;
var cm=new Ext.ux.grid.PropertyColumnModel(this,store);
store.store.sort("name","ASC");
this.addEvents("beforepropertychange","propertychange");
this.cm=cm;
this.ds=store.store;
Ext.ux.grid.PropertyGrid.superclass.initComponent.call(this);
this.selModel.on("beforecellselect",function(sm,rowIndex,colIndex){if(colIndex===0){this.startEditing.defer(200,this,[rowIndex,1]);
return false;
}},this);
if(!this.editable){this.on("beforeedit",function(){return false;
});
}},onRender:function(){Ext.ux.grid.PropertyGrid.superclass.onRender.apply(this,arguments);
this.getGridEl().addClass("x-props-grid");
},afterRender:function(){Ext.ux.grid.PropertyGrid.superclass.afterRender.apply(this,arguments);
if(this.source){this.setSource(this.source);
}},setSource:function(source){this.propStore.setSource(source,this.fields);
},load:function(source){this.setSource(source);
},loadRecord:function(record){record.data&&this.setSource(record.data);
},getSource:function(){return this.propStore.getSource();
}});
Ext.reg("propertygrid2",Ext.ux.grid.PropertyGrid);
Ext.namespace("Ext.ux","Ext.ux.plugins");
Ext.ux.plugins.RemoteValidator={init:function(field){var isValid=field.isValid;
var validate=field.validate;
Ext.apply(field,{remoteValid:false,isValid:function(preventMark){return isValid.call(this,preventMark)&&this.remoteValid;
},validate:function(){var clientValid=validate.call(this);
if(!this.disabled&&!clientValid){return false;
}if(this.disabled||(clientValid&&this.remoteValid)){this.clearInvalid();
return true;
}if(!this.remoteValid){this.markInvalid(this.reason);
return false;
}return false;
},validateRemote:function(){this.rvOptions.params=this.rvOptions.params||{};
this.rvOptions.params.field=this.name;
this.rvOptions.params.value=this.getValue();
Ext.Ajax.request(this.rvOptions);
},rvSuccess:function(response,options){var o;
try{o=Ext.decode(response.responseText);
}catch(e){throw this.cannotDecodeText;
}if("object"!==typeof o){throw this.notObjectText;
}if(true!==o.success){throw this.serverErrorText+": "+o.error;
}var names=this.rvOptions.paramNames;
this.remoteValid=true===o[names.valid];
this.reason=o[names.reason];
this.validate();
},rvFailure:function(response,options){throw this.requestFailText;
},filterRemoteValidation:function(e){if(!e.isNavKeyPress()){this.remoteValidationTask.delay(this.remoteValidationDelay);
}}});
Ext.applyIf(field,{remoteValidationDelay:500,reason:"Server has not yet validated the value",cannotDecodeText:"Cannot decode json object",notObjectText:"Server response is not an object",serverErrorText:"Server error",requestFailText:"Server request failed"});
field.on({render:{single:true,scope:field,fn:function(){this.remoteValidationTask=new Ext.util.DelayedTask(this.validateRemote,this);
this.el.on("keyup",this.filterRemoteValidation,this);
}}});
field.rvOptions=field.rvOptions||{};
Ext.applyIf(field.rvOptions,{method:"post",scope:field,success:field.rvSuccess,failure:field.rvFailure,paramNames:{valid:"valid",reason:"reason"}});
}};
Ext.grid.RowExpander=Ext.extend(Ext.util.Observable,{header:"",width:20,sortable:false,fixed:true,menuDisabled:true,dataIndex:"",id:"expander",lazyRender:true,enableCaching:true,expandOnEnter:true,expandOnDblClick:true,constructor:function(config){Ext.apply(this,config);
this.addEvents({beforeexpand:true,expand:true,beforecollapse:true,collapse:true});
Ext.grid.RowExpander.superclass.constructor.call(this);
if(this.tpl){if(typeof this.tpl=="string"){this.tpl=new Ext.Template(this.tpl);
}this.tpl.compile();
}this.state={};
this.bodyContent={};
},getRowClass:function(record,rowIndex,p,ds){p.cols=p.cols-1;
var content=this.bodyContent[record.id];
if(!content&&!this.lazyRender){content=this.getBodyContent(record,rowIndex);
}if(content){p.body=content;
}return this.state[record.id]?"x-grid3-row-expanded":"x-grid3-row-collapsed";
},init:function(grid){this.grid=grid;
var view=grid.getView();
view.getRowClass=this.getRowClass.createDelegate(this);
view.enableRowBody=true;
grid.on("render",this.onRender,this);
},onRender:function(){var grid=this.grid;
var mainBody=grid.getView().mainBody;
mainBody.on("mousedown",this.onMouseDown,this,{delegate:".x-grid3-row-expander"});
if(this.expandOnEnter){this.keyNav=new Ext.KeyNav(this.grid.getGridEl(),{enter:this.onEnter,scope:this});
}if(this.expandOnDblClick){grid.on("rowdblclick",this.onRowDblClick,this);
}},onRowDblClick:function(grid,rowIdx,e){this.toggleRow(rowIdx);
},onEnter:function(e){var g=this.grid;
var sm=g.getSelectionModel();
var sels=sm.getSelections();
for(var i=0,len=sels.length;
i<len;
i++){var rowIdx=g.getStore().indexOf(sels[i]);
this.toggleRow(rowIdx);
}},getBodyContent:function(record,index){if(!this.enableCaching){return this.tpl.apply(record.data);
}var content=this.bodyContent[record.id];
if(!content){content=this.tpl.apply(record.data);
this.bodyContent[record.id]=content;
}return content;
},onMouseDown:function(e,t){e.stopEvent();
var row=e.getTarget(".x-grid3-row");
this.toggleRow(row);
},renderer:function(v,p,record){p.cellAttr='rowspan="2"';
return'<div class="x-grid3-row-expander">&#160;</div>';
},beforeExpand:function(record,body,rowIndex){if(this.fireEvent("beforeexpand",this,record,body,rowIndex)!==false){if(this.tpl&&this.lazyRender){body.innerHTML=this.getBodyContent(record,rowIndex);
}return true;
}else{return false;
}},toggleRow:function(row){if(typeof row=="number"){row=this.grid.view.getRow(row);
}this[Ext.fly(row).hasClass("x-grid3-row-collapsed")?"expandRow":"collapseRow"](row);
},expandRow:function(row){if(typeof row=="number"){row=this.grid.view.getRow(row);
}var record=this.grid.store.getAt(row.rowIndex);
var body=Ext.DomQuery.selectNode("tr:nth(2) div.x-grid3-row-body",row);
if(this.beforeExpand(record,body,row.rowIndex)){this.state[record.id]=true;
Ext.fly(row).replaceClass("x-grid3-row-collapsed","x-grid3-row-expanded");
this.fireEvent("expand",this,record,body,row.rowIndex);
}},collapseRow:function(row){if(typeof row=="number"){row=this.grid.view.getRow(row);
}var record=this.grid.store.getAt(row.rowIndex);
var body=Ext.fly(row).child("tr:nth(1) div.x-grid3-row-body",true);
if(this.fireEvent("beforecollapse",this,record,body,row.rowIndex)!==false){this.state[record.id]=false;
Ext.fly(row).replaceClass("x-grid3-row-expanded","x-grid3-row-collapsed");
this.fireEvent("collapse",this,record,body,row.rowIndex);
}}});
Ext.override(Ext.grid.GridView,{layout:function(){if(!this.mainBody){return;
}var g=this.grid;
var c=g.getGridEl();
var csize=c.getSize(true);
var vw=csize.width;
if(vw<20||csize.height<20){return;
}if(g.autoHeight){this.scroller.dom.style.overflow="visible";
this.scroller.dom.style.position="static";
}else{this.el.setSize(csize.width,csize.height);
var hdHeight=this.mainHd.getHeight();
var vh=csize.height-(hdHeight);
this.scroller.setSize(vw,vh);
if(this.innerHd){this.innerHd.style.width=(vw)+"px";
}}if(this.forceFit){if(this.lastViewWidth!=vw){this.fitColumns(false,false);
this.lastViewWidth=vw;
}}else{this.autoExpand();
this.syncHeaderScroll();
}this.onLayout(vw,vh);
}});
Ext.apply(Ext.DataView.prototype,{deselect:function(node,suppressEvent){if(this.isSelected(node)){var node=this.getNode(node);
this.selected.removeElement(node);
if(this.last==node.viewIndex){this.last=false;
}Ext.fly(node).removeClass(this.selectedClass);
if(!suppressEvent){this.fireEvent("selectionchange",this,this.selected.elements);
}}}});
Ext.namespace("Ext.ux.Andrie");
Ext.ux.Andrie.Select=function(config){if(config.transform&&typeof config.multiSelect=="undefined"){var o=Ext.getDom(config.transform);
config.multiSelect=(Ext.isIE?o.getAttributeNode("multiple").specified:o.hasAttribute("multiple"));
}if(config.multiSelect){config.selectOnFocus=false;
}config.hideTrigger2=config.hideTrigger2||config.hideTrigger;
Ext.ux.Andrie.Select.superclass.constructor.call(this,config);
};
Ext.extend(Ext.ux.Andrie.Select,Ext.form.ComboBox,{multiSelect:false,minLength:0,minLengthText:"Minimum {0} items required",maxLength:Number.MAX_VALUE,maxLengthText:"Maximum {0} items allowed",clearTrigger:true,history:false,historyMaxLength:0,initComponent:function(){this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",cn:[{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger1Class},{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger2Class}]};
Ext.ux.Andrie.Select.superclass.initComponent.call(this);
if(this.multiSelect){this.typeAhead=false;
this.editable=false;
this.triggerAction="all";
}this.valueArray=this.getValue()?[this.getValue()]:[];
},hideTrigger1:true,getTrigger:Ext.form.TwinTriggerField.prototype.getTrigger,initTrigger:Ext.form.TwinTriggerField.prototype.initTrigger,trigger1Class:"x-form-clear-trigger",onTrigger2Click:function(){this.onTriggerClick();
},onTrigger1Click:function(){this.clearValue();
},clearValue:function(){this.setValue("");
Ext.ux.Andrie.Select.superclass.clearValue.call(this);
this.valueArray=[];
var nodes=Ext.apply([],this.view.getSelectedNodes());
for(var i=0,len=nodes.length;
i<len;
i++){this.view.deselect(nodes[i],true);
}},reset:function(){var nodes=Ext.apply([],this.view.getSelectedNodes());
for(var i=0,len=nodes.length;
i<len;
i++){this.view.deselect(nodes[i],true);
}Ext.ux.Andrie.Select.superclass.reset.call(this);
},initList:function(){if(!this.list){var cls="x-combo-list";
this.list=new Ext.Layer({shadow:this.shadow,cls:[cls,this.listClass].join(" "),constrain:false});
var lw=this.listWidth||Math.max(this.wrap.getWidth(),this.minListWidth);
this.list.setWidth(lw);
this.list.swallowEvent("mousewheel");
this.assetHeight=0;
if(this.title){this.header=this.list.createChild({cls:cls+"-hd",html:this.title});
this.assetHeight+=this.header.getHeight();
}this.innerList=this.list.createChild({cls:cls+"-inner"});
this.innerList.on("mouseover",this.onViewOver,this);
this.innerList.on("mousemove",this.onViewMove,this);
this.innerList.setWidth(lw-this.list.getFrameWidth("lr"));
if(this.pageSize){this.footer=this.list.createChild({cls:cls+"-ft"});
this.pageTb=new Ext.PagingToolbar({store:this.store,pageSize:this.pageSize,renderTo:this.footer});
this.assetHeight+=this.footer.getHeight();
}if(!this.tpl){this.tpl='<tpl for="."><div class="'+cls+'-item">{'+this.displayField+"}</div></tpl>";
}this.view=new Ext.DataView({applyTo:this.innerList,tpl:this.tpl,singleSelect:true,multiSelect:this.multiSelect,simpleSelect:true,overClass:cls+"-cursor",selectedClass:this.selectedClass,itemSelector:this.itemSelector||"."+cls+"-item"});
this.view.on("click",this.onViewClick,this);
this.view.on("beforeClick",this.onViewBeforeClick,this);
this.bindStore(this.store,true);
if(this.valueArray.length){this.selectByValue(this.valueArray);
}if(this.resizable){this.resizer=new Ext.Resizable(this.list,{pinned:true,handles:"se"});
this.resizer.on("resize",function(r,w,h){this.maxHeight=h-this.handleHeight-this.list.getFrameWidth("tb")-this.assetHeight;
this.listWidth=w;
this.innerList.setWidth(w-this.list.getFrameWidth("lr"));
this.restrictHeight();
},this);
this[this.pageSize?"footer":"innerList"].setStyle("margin-bottom",this.handleHeight+"px");
}}},onViewOver:function(e,t){if(this.inKeyMode){return;
}},initEvents:function(){Ext.form.ComboBox.superclass.initEvents.call(this);
this.keyNav=new Ext.KeyNav(this.el,{up:function(e){this.inKeyMode=true;
this.hoverPrev();
},down:function(e){if(!this.isExpanded()){this.onTriggerClick();
}else{this.inKeyMode=true;
this.hoverNext();
}},enter:function(e){if(this.isExpanded()){this.inKeyMode=true;
var hoveredIndex=this.view.indexOf(this.view.lastItem);
this.onViewBeforeClick(this.view,hoveredIndex,this.view.getNode(hoveredIndex),e);
this.onViewClick(this.view,hoveredIndex,this.view.getNode(hoveredIndex),e);
}else{this.onSingleBlur();
}return true;
},esc:function(e){this.collapse();
},tab:function(e){this.collapse();
return true;
},home:function(e){this.hoverFirst();
return false;
},end:function(e){this.hoverLast();
return false;
},scope:this,doRelay:function(foo,bar,hname){if(hname=="down"||this.scope.isExpanded()){return Ext.KeyNav.prototype.doRelay.apply(this,arguments);
}if(hname=="enter"||this.scope.isExpanded()){return Ext.KeyNav.prototype.doRelay.apply(this,arguments);
}return true;
},forceKeyDown:true});
this.queryDelay=Math.max(this.queryDelay||10,this.mode=="local"?10:250);
this.dqTask=new Ext.util.DelayedTask(this.initQuery,this);
if(this.typeAhead){this.taTask=new Ext.util.DelayedTask(this.onTypeAhead,this);
}if(this.editable!==false){this.el.on("keyup",this.onKeyUp,this);
}if(this.forceSelection){this.on("blur",this.doForce,this);
}else{if(!this.multiSelect){this.on("focus",this.onSingleFocus,this);
this.on("blur",this.onSingleBlur,this);
}}this.on("change",this.onChange,this);
},onChange:function(){if(!this.clearTrigger){return;
}if(this.getValue()!=""){this.triggers[0].show();
}else{this.triggers[0].hide();
}},selectFirst:function(){var ct=this.store.getCount();
if(ct>0){this.select(0);
}},selectLast:function(){var ct=this.store.getCount();
if(ct>0){this.select(ct);
}},hover:function(index,scrollIntoView){if(!this.view){return;
}this.hoverOut();
var node=this.view.getNode(index);
this.view.lastItem=node;
Ext.fly(node).addClass(this.view.overClass);
if(scrollIntoView!==false){var el=this.view.getNode(index);
if(el){this.innerList.scrollChildIntoView(el,false);
}}},hoverOut:function(){if(!this.view){return;
}if(this.view.lastItem){Ext.fly(this.view.lastItem).removeClass(this.view.overClass);
delete this.view.lastItem;
}},hoverNext:function(){if(!this.view){return;
}var ct=this.store.getCount();
if(ct>0){if(!this.view.lastItem){this.hover(0);
}else{var hoveredIndex=this.view.indexOf(this.view.lastItem);
if(hoveredIndex<ct-1){this.hover(hoveredIndex+1);
}}}},hoverPrev:function(){if(!this.view){return;
}var ct=this.store.getCount();
if(ct>0){if(!this.view.lastItem){this.hover(0);
}else{var hoveredIndex=this.view.indexOf(this.view.lastItem);
if(hoveredIndex!=0){this.hover(hoveredIndex-1);
}}}},hoverFirst:function(){var ct=this.store.getCount();
if(ct>0){this.hover(0);
}},hoverLast:function(){var ct=this.store.getCount();
if(ct>0){this.hover(ct);
}},collapse:function(){this.hoverOut();
Ext.ux.Andrie.Select.superclass.collapse.call(this);
},expand:function(){Ext.ux.Andrie.Select.superclass.expand.call(this);
},onSelect:function(record,index){if(this.fireEvent("beforeselect",this,record,index)!==false){this.addValue(record.data[this.valueField||this.displayField]);
this.fireEvent("select",this,record,index);
if(!this.multiSelect){this.collapse();
}}},addValue:function(v){v=String(v);
if(!this.multiSelect){this.setValue(v);
return;
}if(this.valueArray.indexOf(v)==-1){this.valueArray.push(v);
this.setValue(this.valueArray);
}},removeValue:function(v){v=String(v);
if(this.list){var r=this.findRecord(this.valueField,v);
this.deselect(this.store.indexOf(r));
}this.valueArray.remove(v);
this.setValue(this.valueArray);
},setValue:function(v){var result=[],resultRaw=[];
if(!(v instanceof Array)){v=[v];
}if(!this.multiSelect&&v instanceof Array){v=v.slice(0,1);
}for(var i=0,len=v.length;
i<len;
i++){var value=v[i];
var text=value;
if(this.valueField){var r=this.findRecord(this.valueField,value);
if(r){text=r.data[this.displayField];
}}resultRaw.push(value);
result.push(text);
}v=resultRaw.join(",");
text=result.join(",");
this.lastSelectionText=text;
this.valueArray=resultRaw;
if(this.hiddenField){this.hiddenField.value=v;
}Ext.form.ComboBox.superclass.setValue.call(this,text);
this.value=v;
if(this.view){this.view.clearSelections();
this.selectByValue(this.valueArray);
}if(this.oldValueArray!=this.valueArray){this.fireEvent("change",this,this.oldValueArray,this.valueArray);
}this.oldValueArray=Ext.apply([],this.valueArray);
if(this.history&&!this.multiSelect&&this.mode=="local"){this.addHistory(this.getRawValue());
}},onLoad:function(){if(!this.hasFocus){return;
}if(this.store.getCount()>0){this.expand();
this.restrictHeight();
if(this.lastQuery==this.allQuery){if(this.editable){this.el.dom.select();
}this.selectByValue(this.value,true);
}else{this.selectNext();
if(this.typeAhead&&this.lastKey!=Ext.EventObject.BACKSPACE&&this.lastKey!=Ext.EventObject.DELETE){this.taTask.delay(this.typeAheadDelay);
}}}else{this.onEmptyResults();
}},selectByValue:function(v,scrollIntoView){this.hoverOut();
if(v!==undefined&&v!==null){if(!(v instanceof Array)){v=[v];
}var result=[];
for(var i=0,len=v.length;
i<len;
i++){var value=v[i];
var r=this.findRecord(this.valueField||this.displayField,value);
if(r){this.select(this.store.indexOf(r),scrollIntoView);
result.push(value);
}}return result.join(",");
}return false;
},onViewBeforeClick:function(vw,index,node,e){this.preClickSelections=this.view.getSelectedIndexes();
},onViewClick:function(vw,index,node,e){if(typeof index!="undefined"){var arrayIndex=this.preClickSelections.indexOf(index);
if(arrayIndex!=-1&&this.multiSelect){this.removeValue(this.store.getAt(index).data[this.valueField||this.displayField]);
if(this.inKeyMode){this.view.deselect(index,true);
}}else{var r=this.store.getAt(index);
if(r){if(this.inKeyMode){this.view.select(index,true);
}this.onSelect(r,index);
}}}if(vw!==false){this.el.focus();
}},validateValue:function(value){if(!Ext.ux.Andrie.Select.superclass.validateValue.call(this,value)){return false;
}if(this.valueArray.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));
return false;
}if(this.valueArray.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));
return false;
}return true;
},select:function(index,scrollIntoView){this.selectedIndex=index;
if(!this.view){return;
}this.view.select(index,this.multiSelect);
if(scrollIntoView!==false){var el=this.view.getNode(index);
if(el){this.innerList.scrollChildIntoView(el,false);
}}},deselect:function(index,scrollIntoView){this.selectedIndex=index;
this.view.deselect(index,this.multiSelect);
if(scrollIntoView!==false){var el=this.view.getNode(index);
if(el){this.innerList.scrollChildIntoView(el,false);
}}},doForce:function(){if(this.el.dom.value.length>0){if(this.el.dom.value==this.emptyText){this.clearValue();
}else{this.el.dom.value=this.lastSelectionText===undefined?"":this.lastSelectionText;
this.applyEmptyText();
}}},onSingleBlur:function(){var r=this.findRecord(this.displayField,this.getRawValue());
if(r){this.select(this.store.indexOf(r));
return;
}if(String(this.oldValue)!=String(this.getRawValue())){this.setValue(this.getRawValue());
this.fireEvent("change",this,this.oldValue,this.getRawValue());
}this.oldValue=String(this.getRawValue());
},onSingleFocus:function(){this.oldValue=this.getRawValue();
},addHistory:function(value){if(!value.length){return;
}var r=this.findRecord(this.displayField,value);
if(r){this.store.remove(r);
}else{var o=this.store.reader.readRecords([[value]]);
r=o.records[0];
}this.store.clearFilter();
this.store.insert(0,r);
this.pruneHistory();
},pruneHistory:function(){if(this.historyMaxLength==0){return;
}if(this.store.getCount()>this.historyMaxLength){var overflow=this.store.getRange(this.historyMaxLength,this.store.getCount());
for(var i=0,len=overflow.length;
i<len;
i++){this.store.remove(overflow[i]);
}}}});
Ext.reg("select",Ext.ux.Andrie.Select);
Ext.form.MultiSelectField=Ext.extend(Ext.form.TriggerField,{triggerClass:"x-form-trigger",defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"off"},readOnly:true,lazyInit:false,hiddenValue:"",value:null,valueSeparator:";",textSeparator:", ",loadingText:"Loading list...",containerHeight:"",containerWidth:"",store:null,mode:"remote",valueField:"value",displayField:"text",initComponent:function(){Ext.QuickTips.init();
Ext.form.MultiSelectField.superclass.initComponent.call(this);
if(Ext.isArray(this.store)){if(Ext.isArray(this.store[0])){this.store=new Ext.data.SimpleStore({id:"value",fields:["value","text"],data:this.store});
this.valueField="value";
}else{this.store=new Ext.data.Store({id:"text",fields:["text"],data:this.store,expandData:true});
this.valueField="text";
}this.displayField="text";
this.mode="local";
}},onRender:function(ct,position){Ext.form.MultiSelectField.superclass.onRender.call(this,ct,position);
if(this.hiddenName){this.hiddenField=this.el.insertSibling({tag:"input",type:"hidden",name:this.hiddenName,id:(this.hiddenId||this.hiddenName)},"before",true);
this.hiddenField.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:"";
this.el.dom.removeAttribute("name");
}if(this.menu==null){this.menu=new Ext.menu.Menu({enableScrolling:false});
this.menu.on("hide",function(){if(this.tmp!=this.lastSelectionText&&this.lastSelectionText!=""){this.tmp=this.lastSelectionText;
this.fireEvent("change",this);
}},this);
this.store.each(function(r){this.menu.add(new Ext.menu.CheckItem({text:r.data[this.displayField],value:r.data[this.valueField],hideOnClick:false})).on("click",this.clickHandler,this);
},this);
}if(!this.lazyInit){}else{}},onTriggerClick:function(){if(this.disabled){return;
}this.menu.show(this.el,"tl");
this.menu.el.setTop(this.menu.el.getTop()+this.el.getHeight());
if(this.containerHeight!=""&&this.menu.el.getHeight()>this.containerHeight){this.menu.el.setHeight(this.containerHeight);
this.menu.el.dom.style.overflowY="auto";
}var width=this.containerWidth!=""?this.containerWidth:(this.width>this.menu.el.getWidth()?this.width-1:this.menu.el.getWidth());
this.menu.items.each(function(r){r.el.setWidth(width);
r.el.dom.style.overflowX="hidden";
},this);
this.menu.el.setWidth(width);
this.menu.el.dom.style.overflowX="hidden";
this.populateList(this.value);
},validateBlur:function(){return !this.menu||!this.menu.isVisible();
},getValue:function(){if(this.hiddenField){return this.hiddenField.value||"";
}else{if(this.valueField){return typeof this.value!="undefined"?this.value:"";
}else{return Ext.form.MultiSelectField.superclass.getValue.call(this);
}}},setValue:function(value,text){if(text==undefined&&value!=undefined){this.setValues(value.split(this.valueSeparator));
return;
}if(value==undefined){value="";
text="";
}this.lastSelectionText=text;
if(this.hiddenField){this.hiddenField.value=value;
}Ext.form.MultiSelectField.superclass.setValue.call(this,text);
this.value=value;
if(text.trim()==""){Ext.QuickTips.getQuickTip().unregister(this.el);
}else{Ext.QuickTips.getQuickTip().register({target:this.el,text:text});
}},setValues:function(keys){var text="";
var value="";
for(var i=0;
i<keys.length;
i++){if(keys[i]!=undefined&&keys[i]!=""){var item=this.store.query(this.valueField,keys[i]).items[0];
if(item!=undefined){value+=(value!=""?this.valueSeparator:"")+item.data[this.valueField];
text+=(text!=""?this.textSeparator:"")+item.data[this.displayField];
}}}this.setValue(value,text);
},selPush:function(key){var keys=this.value==""?new Array():this.value.split(this.valueSeparator);
var i=keys.length++;
keys[i]=key;
this.setValues(keys);
},selDrop:function(key){var keys=this.value.split(this.valueSeparator);
for(var i=0;
i<keys.length;
i++){if(keys[i].toString()==key.toString()){keys[i]=undefined;
}}this.setValues(keys);
},onDestroy:function(){if(this.menu){this.menu.destroy();
}if(this.wrap){this.wrap.remove();
}Ext.form.MultiSelectField.superclass.onDestroy.call(this);
},clickHandler:function(i,c){if(i.checked==false){this.selPush(i.value,i.text);
}else{this.selDrop(i.value);
}},populateList:function(v){if(v==undefined||v==null){v=this.value;
}if(this.menu){this.menu.items.each(function(item){item.setChecked(false);
});
}if(v!=undefined&&v!=""&&v!=null){var sel=v.split(this.valueSeparator);
for(i=0;
i<sel.length;
i++){try{var value=this.store.query(this.valueField,sel[i]).items[0].data[this.valueField];
this.menu.items.each(function(mi){if(mi.value==value){mi.setChecked(true);
}},this);
}catch(e){}}}}});
Ext.reg("multiselect",Ext.form.MultiSelectField);
Ext.ns("Ext.ux");
Ext.ux.Lightbox=(function(){var els={},images=[],activeImage,initialized=false,selectors=[];
return{overlayOpacity:0.85,animate:true,resizeSpeed:8,borderSize:10,labelImage:"Image",labelOf:"of",init:function(){this.resizeDuration=this.animate?((11-this.resizeSpeed)*0.15):0;
this.overlayDuration=this.animate?0.2:0;
if(!initialized){Ext.apply(this,Ext.util.Observable.prototype);
Ext.util.Observable.constructor.call(this);
this.addEvents("open","close");
this.initMarkup();
this.initEvents();
initialized=true;
}},initMarkup:function(){els.shim=Ext.DomHelper.append(document.body,{tag:"iframe",id:"ux-lightbox-shim"},true);
els.overlay=Ext.DomHelper.append(document.body,{id:"ux-lightbox-overlay"},true);
var lightboxTpl=new Ext.Template(this.getTemplate());
els.lightbox=lightboxTpl.append(document.body,{},true);
var ids=["outerImageContainer","imageContainer","image","hoverNav","navPrev","navNext","loading","loadingLink","outerDataContainer","dataContainer","data","details","caption","imageNumber","bottomNav","navClose"];
Ext.each(ids,function(id){els[id]=Ext.get("ux-lightbox-"+id);
});
Ext.each([els.overlay,els.lightbox,els.shim],function(el){el.setVisibilityMode(Ext.Element.DISPLAY);
el.hide();
});
var size=(this.animate?250:1)+"px";
els.outerImageContainer.setStyle({width:size,height:size});
},getTemplate:function(){return['<div id="ux-lightbox">','<div id="ux-lightbox-outerImageContainer">','<div id="ux-lightbox-imageContainer">','<img id="ux-lightbox-image">','<div id="ux-lightbox-hoverNav">','<a href="#" id="ux-lightbox-navPrev"></a>','<a href="#" id="ux-lightbox-navNext"></a>',"</div>",'<div id="ux-lightbox-loading">','<a id="ux-lightbox-loadingLink"></a>',"</div>","</div>","</div>",'<div id="ux-lightbox-outerDataContainer">','<div id="ux-lightbox-dataContainer">','<div id="ux-lightbox-data">','<div id="ux-lightbox-details">','<span id="ux-lightbox-caption"></span>','<span id="ux-lightbox-imageNumber"></span>',"</div>",'<div id="ux-lightbox-bottomNav">','<a href="#" id="ux-lightbox-navClose"></a>',"</div>","</div>","</div>","</div>","</div>"];
},initEvents:function(){var close=function(ev){ev.preventDefault();
this.close();
};
els.overlay.on("click",close,this);
els.loadingLink.on("click",close,this);
els.navClose.on("click",close,this);
els.lightbox.on("click",function(ev){if(ev.getTarget().id=="ux-lightbox"){this.close();
}},this);
els.navPrev.on("click",function(ev){ev.preventDefault();
this.setImage(activeImage-1);
},this);
els.navNext.on("click",function(ev){ev.preventDefault();
this.setImage(activeImage+1);
},this);
},register:function(sel,group){if(selectors.indexOf(sel)===-1){selectors.push(sel);
Ext.fly(document).on("click",function(ev){var target=ev.getTarget(sel);
if(target){ev.preventDefault();
this.open(target,sel,group);
}},this);
}},open:function(image,sel,group){group=group||false;
this.setViewSize();
els.overlay.fadeIn({duration:this.overlayDuration,endOpacity:this.overlayOpacity,callback:function(){images=[];
var index=0;
if(!group){images.push([image.href,image.title]);
}else{var setItems=Ext.query(sel);
Ext.each(setItems,function(item){if(item.href){images.push([item.href,item.title]);
}});
while(images[index][0]!=image.href){index++;
}}var pageScroll=Ext.fly(document).getScroll();
var lightboxTop=pageScroll.top+(Ext.lib.Dom.getViewportHeight()/10);
var lightboxLeft=pageScroll.left;
els.lightbox.setStyle({top:lightboxTop+"px",left:lightboxLeft+"px"}).show();
this.setImage(index);
this.fireEvent("open",images[index]);
},scope:this});
},setViewSize:function(){var viewSize=this.getViewSize();
els.overlay.setStyle({width:viewSize[0]+"px",height:viewSize[1]+"px"});
els.shim.setStyle({width:viewSize[0]+"px",height:viewSize[1]+"px"}).show();
},setImage:function(index){activeImage=index;
this.disableKeyNav();
if(this.animate){els.loading.show();
}els.image.hide();
els.hoverNav.hide();
els.navPrev.hide();
els.navNext.hide();
els.dataContainer.setOpacity(0.0001);
els.imageNumber.hide();
var preload=new Image();
preload.onload=(function(){els.image.dom.src=images[activeImage][0];
this.resizeImage(preload.width,preload.height);
}).createDelegate(this);
preload.src=images[activeImage][0];
},resizeImage:function(w,h){var wCur=els.outerImageContainer.getWidth();
var hCur=els.outerImageContainer.getHeight();
var wNew=(w+this.borderSize*2);
var hNew=(h+this.borderSize*2);
var wDiff=wCur-wNew;
var hDiff=hCur-hNew;
var queueLength=0;
if(hDiff!=0||wDiff!=0){els.outerImageContainer.syncFx().shift({height:hNew,duration:this.resizeDuration}).shift({width:wNew,duration:this.resizeDuration});
queueLength++;
}var timeout=0;
if((hDiff==0)&&(wDiff==0)){timeout=(Ext.isIE)?250:100;
}(function(){els.hoverNav.setWidth(els.imageContainer.getWidth()+"px");
els.navPrev.setHeight(h+"px");
els.navNext.setHeight(h+"px");
els.outerDataContainer.setWidth(wNew+"px");
this.showImage();
}).createDelegate(this).defer((this.resizeDuration*1000)+timeout);
},showImage:function(){els.loading.hide();
els.image.fadeIn({duration:this.resizeDuration,scope:this,callback:function(){this.updateDetails();
}});
this.preloadImages();
},updateDetails:function(){els.details.setWidth((els.data.getWidth(true)-els.navClose.getWidth()-10)+"px");
els.caption.update(images[activeImage][1]);
els.caption.show();
if(images.length>1){els.imageNumber.update(this.labelImage+" "+(activeImage+1)+" "+this.labelOf+"  "+images.length);
els.imageNumber.show();
}els.dataContainer.syncFx().slideIn("t",{duration:this.resizeDuration/2}).fadeIn({duration:this.resizeDuration/2,scope:this,callback:function(){var viewSize=this.getViewSize();
els.overlay.setHeight(viewSize[1]+"px");
this.updateNav();
}});
},updateNav:function(){this.enableKeyNav();
els.hoverNav.show();
if(activeImage>0){els.navPrev.show();
}if(activeImage<(images.length-1)){els.navNext.show();
}},enableKeyNav:function(){Ext.fly(document).on("keydown",this.keyNavAction,this);
},disableKeyNav:function(){Ext.fly(document).un("keydown",this.keyNavAction,this);
},keyNavAction:function(ev){var keyCode=ev.getKey();
if(keyCode==88||keyCode==67||keyCode==27){this.close();
}else{if(keyCode==80||keyCode==37){if(activeImage!=0){this.setImage(activeImage-1);
}}else{if(keyCode==78||keyCode==39){if(activeImage!=(images.length-1)){this.setImage(activeImage+1);
}}}}},preloadImages:function(){var next,prev;
if(images.length>activeImage+1){next=new Image();
next.src=images[activeImage+1][0];
}if(activeImage>0){prev=new Image();
prev.src=images[activeImage-1][0];
}},close:function(){this.disableKeyNav();
els.lightbox.hide();
els.overlay.fadeOut({duration:this.overlayDuration});
els.shim.hide();
this.fireEvent("close",activeImage);
},getViewSize:function(){return[Ext.lib.Dom.getViewWidth(),Ext.lib.Dom.getViewHeight()];
}};
})();
Ext.onReady(Ext.ux.Lightbox.init,Ext.ux.Lightbox);
Ext.ns("Ext.ux.window");
Ext.ux.window.MessageWindowGroup=function(config){config=config||{};
var mgr=new Ext.WindowGroup();
mgr.positions=[];
Ext.apply(mgr,config);
return mgr;
};
Ext.ux.window.MessageWindowMgr=Ext.ux.window.MessageWindowGroup();
Ext.ux.window.MessageWindow=Ext.extend(Ext.Window,{autoDestroy:true,autoHide:true,autoHeight:false,bodyStyle:"text-align:left;padding:10px;",buttonAlign:"center",cls:"x-notification",constrain:true,constrainHeader:true,draggable:true,floating:true,frame:true,handleHelp:Ext.emptyFn,help:true,hideFx:{delay:5000},hoverCls:"msg-over",iconCls:"x-icon-information",minHeight:40,minWidth:200,msgs:[],monitorResize:true,pinOnClick:true,pinState:"unpin",plain:false,resizable:false,textHelp:"Get help",textPin:"Pin this to prevent closing",textUnpin:"Unpin this to close",initHidden:true,initComponent:function(){Ext.apply(this,{collapsible:false,footer:false,minHeight:20,stateful:false});
if(this.interval){this.startAutoRefresh();
}if(this.autoHide){if(this.pinState==="unpin"){this.task=new Ext.util.DelayedTask(this.hide,this);
}}else{this.closable=true;
}Ext.ux.window.MessageWindow.superclass.initComponent.call(this);
this.on({hide:{scope:this,fn:function(){if(this.autoDestroy){if(this.fireEvent("beforeclose",this)!==false){this.fireEvent("close",this);
this.destroy();
}}}},mouseout:{scope:this,fn:this.onMouseout}});
this.addEvents("afterpin","afterunpin","click");
},initEvents:function(){this.manager=this.manager||Ext.ux.window.MessageWindowMgr;
Ext.ux.window.MessageWindow.superclass.initEvents.call(this);
},focus:function(){Ext.ux.window.MessageWindow.superclass.focus.call(this);
},toFront:function(){if(this.manager.bringToFront(this)){if(this.focusOnShow){this.focus();
}}return this;
},initTools:function(){this.addTool({id:"unpin",handler:this.handlePin,hidden:(!this.pinState||this.pinState==="pin"),qtip:this.textPin,scope:this});
this.addTool({id:"pin",handler:this.handleUnpin,hidden:(!this.pinState||this.pinState==="unpin"),qtip:this.textUnpin,scope:this});
if(this.help){this.addTool({id:"help",handler:this.handleHelp,qtip:this.textHelp,scope:this});
}},onRender:function(ct,position){Ext.ux.window.MessageWindow.superclass.onRender.call(this,ct,position);
if(this.clip){switch(this.clip){case"bottom":Ext.destroy(this.getEl().child("."+this.baseCls+"-bl"));
break;
}}if(true){this.el.addClassOnOver(this.hoverCls);
}Ext.fly(this.body.dom).on("click",this.handleClick,this);
},togglePinState:function(event){if(this.tools.unpin.isVisible()){this.handlePin(event,this.tools.unpin,this);
}else{this.handleUnpin(event,this.tools.pin,this);
}},createElement:function(name,pnode){if(this.shiftHeader){switch(name){case"header":return;
case"tbar":Ext.ux.window.MessageWindow.superclass.createElement.call(this,"header",pnode);
Ext.ux.window.MessageWindow.superclass.createElement.call(this,name,pnode);
return;
}}Ext.ux.window.MessageWindow.superclass.createElement.call(this,name,pnode);
},focus:Ext.emptyFn,getState:function(){return Ext.apply(Ext.ux.window.MessageWindow.superclass.getState.call(this)||{},this.getBox());
},handleClick:function(event){this.fireEvent("click",this,this.msg);
this.togglePinState(event);
},handlePin:function(event,toolEl,panel){toolEl.hide();
this.tools.pin.show();
this.cancelHiding();
this.fireEvent("afterpin",this);
},handleUnpin:function(event,toolEl,panel){toolEl.hide();
this.tools.unpin.show();
this.hide();
this.fireEvent("afterunpin",this);
},cancelHiding:function(){this.addClass("fixed");
if(this.autoHide){if(this.pinState==="unpin"){this.task.cancel();
}}this.tools.pin.show();
this.tools.unpin.hide();
},animHide:function(){this.manager.positions.remove(this.pos);
var w,fx=this.hideFx||{};
if(fx.useProxy){w=this.proxy;
this.proxy.setOpacity(0.5);
this.proxy.show();
var tb=this.getBox(false);
this.proxy.setBox(tb);
this.el.hide();
Ext.apply(fx,tb);
}else{w=this.el;
}Ext.applyIf(fx,{block:false,callback:this.afterHide,easing:"easeOut",remove:true,scope:this});
switch(fx.mode){case"none":break;
case"slideIn":w[fx.mode]("b",fx);
break;
case"custom":Ext.callback(fx.callback,fx.scope,[this,w,fx]);
break;
case"standard":fx.duration=fx.duration||0.25;
fx.opacity=0;
w.shift(fx);
break;
default:fx.duration=fx.duration||1;
w.ghost("b",fx);
break;
}},afterShow:function(){Ext.ux.window.MessageWindow.superclass.afterShow.call(this);
this.on("move",function(){this.manager.positions.remove(this.pos);
this.cancelHiding();
},this);
if(this.autoHide){if(this.pinState==="unpin"){this.task.delay(this.hideFx.delay);
}}},animShow:function(){if(this.el.isVisible()&&this.el.hasClass(this.hoverCls)){return;
}if(this.msgs.length>1){this.updateMsg();
}var w=this.el,fx=this.showFx||{};
this.origin=this.origin||{};
Ext.applyIf(this.origin,{el:Ext.getDoc(),increment:true,pos:"br-br",offX:-20,offY:-20,spaY:5});
this.pos=0;
if(this.origin.increment){while(this.manager.positions.indexOf(this.pos)>-1){this.pos++;
}this.manager.positions.push(this.pos);
}var y=this.origin.offY-((this.getSize().height+this.origin.spaY)*this.pos);
this.setSize(this.width||this.minWidth,this.height||this.minHeight);
if(this.origin.increment){y=this.origin.offY-((this.getSize().height+this.origin.spaY)*this.pos);
}else{y=0;
}w.alignTo(this.origin.el,this.origin.pos,[this.origin.offX,y]);
w.slideIn("b",{duration:fx.duration||1,callback:this.afterShow,scope:this});
},onMouseout:function(){},positionPanel:function(el,x,y){if(x&&typeof x[1]=="number"){y=x[1];
x=x[0];
}el.pageX=x;
el.pageY=y;
if(x===undefined||y===undefined){return;
}if(y<0){y=10;
}var p=el.translatePoints(x,y);
el.setLocation(p.left,p.top);
return el;
},setMessage:function(msg){this.body.update(msg);
},setTitle:function(title,iconCls){Ext.ux.window.MessageWindow.superclass.setTitle.call(this,title,iconCls||this.iconCls);
},startAutoRefresh:function(update){if(update){this.updateMsg(true);
}if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);
}this.autoRefreshProcId=setInterval(this.animShow.createDelegate(this,[]),this.interval);
},stopAutoRefresh:function(){if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);
}},updateMsg:function(msg){if(this.el&&!this.el.hasClass(this.hoverCls)){if(msg){}else{this.msgIndex=this.msgs[this.msgIndex+1]?this.msgIndex+1:0;
this.msg=this.msgs[this.msgIndex];
}this.body.update(this.msg.text);
}else{}}});
Ext.reg("message-window",Ext.ux.window.MessageWindow);
Ext.ns("Ext.ux.form");
Ext.ux.form.XCheckboxGroup=Ext.extend(Ext.form.CheckboxGroup,{dataReplace:false,defaultItems:[{boxLabel:"No options",disabled:true}],fields:["id","name","boxLabel","checked","disabled"],iconAll:"icon-add",iconInvert:"icon-revolve",iconNone:"icon-delete",textAll:"All",textInvert:"Invert",textNone:"None",panelTools:["all","-","none","-","invert"],initComponent:function(){this.panelCfg=Ext.apply({bodyStyle:"padding:0px 0px 0px 5px",margins:"10 0 0 0",height:160,autoScroll:true},this.panelCfg||{});
if(this.panelTools){this.setTools();
}if(!this.data){this.items=this.items||this.defaultItems;
}else{this.reader=new Ext.data.JsonReader({totalProperty:this.data.totalProperty,successProperty:"success",root:this.data.data,fields:this.fields});
var result=this.reader.readRecords(this.data);
var records=result.records;
if(this.dataReplace||!this.items){this.items=[];
}for(var i=0;
i<records.length;
i++){this.items[i]=records[i].data;
}}Ext.ux.form.XCheckboxGroup.superclass.initComponent.call(this);
},onRender:function(ct,position){if(!this.el){var panelCfg=Ext.apply({cls:this.groupCls,layout:"column",border:false,renderTo:ct},this.panelCfg||{});
var colCfg={defaultType:this.defaultType,layout:"form",border:false,defaults:{hideLabel:true,anchor:"100%"}};
if(this.items[0].items){Ext.apply(panelCfg,{layoutConfig:{columns:this.items.length},defaults:this.defaults,items:this.items});
for(var i=0,len=this.items.length;
i<len;
i++){Ext.applyIf(this.items[i],colCfg);
}}else{var numCols,cols=[];
if(typeof this.columns=="string"){this.columns=this.items.length;
}if(!Ext.isArray(this.columns)){var cs=[];
for(var i=0;
i<this.columns;
i++){cs.push((100/this.columns)*0.01);
}this.columns=cs;
}numCols=this.columns.length;
var columnCount=numCols>this.items.length?this.items.length:numCols;
for(var i=0;
i<columnCount;
i++){var cc=Ext.apply({items:[]},colCfg);
cc[this.columns[i]<=1?"columnWidth":"width"]=this.columns[i];
if(this.defaults){cc.defaults=Ext.apply(cc.defaults||{},this.defaults);
}cols.push(cc);
}if(this.vertical){var rows=Math.ceil(this.items.length/numCols),ri=0;
for(var i=0,len=this.items.length;
i<len;
i++){if(i>0&&i%rows==0){ri++;
}if(this.items[i].fieldLabel){this.items[i].hideLabel=false;
}cols[ri].items.push(this.items[i]);
}}else{for(var i=0,len=this.items.length;
i<len;
i++){var ci=i%numCols;
if(this.items[i].fieldLabel){this.items[i].hideLabel=false;
}cols[ci].items.push(this.items[i]);
}}Ext.apply(panelCfg,{layoutConfig:{columns:numCols},items:cols});
}this.panel=new Ext.Panel(panelCfg);
this.el=this.panel.getEl();
if(this.forId&&this.itemCls){var l=this.el.up(this.itemCls).child("label",true);
if(l){l.setAttribute("htmlFor",this.forId);
}}var fields=this.panel.findBy(function(c){return c.isFormField;
},this);
this.items=new Ext.util.MixedCollection();
this.items.addAll(fields);
}Ext.form.CheckboxGroup.superclass.onRender.call(this,ct,position);
},invert:function(){this.items.each(function(c){if(!c.disabled){c.setValue(!c.checked);
}},this);
},setAll:function(v){this.items.each(function(c){if(c.setValue&&!c.disabled){c.setValue(v);
}},this);
},setTools:function(){var t=this.toolCfg={all:{text:this.textAll,handler:this.setAll.createDelegate(this,[true]),iconCls:this.iconAll},none:{text:this.textNone,handler:this.setAll.createDelegate(this),iconCls:this.iconNone},invert:{text:this.textInvert,handler:this.invert.createDelegate(this),iconCls:this.iconInvert}};
var tools=[];
Ext.each(this.panelTools,function(i){if(typeof i=="string"&&(t[i]!==undefined)){i=t[i];
}if(i){tools.push(i);
}});
this.panelCfg.tbar=tools;
}});
Ext.ComponentMgr.registerType("xcheckboxgroup",Ext.ux.form.XCheckboxGroup);
Ext.override(Ext.form.Field,{afterRender:function(){if(this.helpText){var label=findLabel(this);
if(label){var helpImage=label.createChild({tag:"img",src:"../images/extjs/extjs-information.png",cls:"info-tooltip",style:"margin-bottom: 0px; margin-left: 5px; padding: 0px;"});
Ext.QuickTips.register({target:helpImage,title:"",text:this.helpText,enabled:true});
}}Ext.form.Field.superclass.afterRender.call(this);
this.initEvents();
this.initValue();
}});
var findLabel=function(field){var wrapDiv=null;
var label=null;
wrapDiv=field.getEl().up("div.x-form-item");
if(wrapDiv){label=wrapDiv.child("label");
}if(label){return label;
}};
var GridCtxMenuPlugin=Ext.extend(Object,{constructor:function(config){config=config||{};
Ext.apply(this,config);
},init:function(parent){this.parent=parent;
if(parent instanceof Ext.grid.GridPanel){if(!(this.menu instanceof Ext.menu.Menu)){this.menu=new Ext.menu.Menu(this.menu);
}parent.on({scope:this,cellcontextmenu:this.onCellContextMenu,destroy:this.onDestroy});
Ext.apply(parent,this.parentOverrides);
}},onCellContextMenu:function(grid,rowIndex,cellIndex,evtObj){evtObj.stopEvent();
if(grid.selModel instanceof Ext.grid.RowSelectionModel){grid.selModel.selectRow(rowIndex);
}else{if(grid.selModel instanceof Ext.grid.CellSelectionModel){grid.selModel.select(rowIndex,cellIndex);
}}this.menu.stopEvent(evtObj.getXY());
},onDestroy:function(){if(this.menu&&this.menu.destroy){this.menu.destroy();
}},parentOverrides:{getSelectedRecord:function(){if(this.selModel instanceof Ext.grid.RowSelectionModel){return this.selModel.getSelected();
}else{if(this.selModel instanceof Ext.grid.CellSelectionModel){var selectedCell=this.selModel.getSelectedCell();
return this.store.getAt(selectedCell[0]);
}}}}});
Ext.preg("gridCtxMenuPlugin",GridCtxMenuPlugin);
Ext.ux.TextBox=Ext.extend(Ext.BoxComponent,{constructor:function(cfg){cfg=cfg||{};
this.autoEl={tag:"div",html:cfg.text};
Ext.ux.TextBox.superclass.constructor.apply(this,arguments);
}});
Ext.reg("textbox",Ext.ux.TextBox);
if("function"!==typeof RegExp.escape){RegExp.escape=function(s){if("string"!==typeof s){return s;
}return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1");
};
}Ext.ns("Ext.ux.form");
Ext.ux.form.LovCombo=Ext.extend(Ext.form.ComboBox,{checkField:"checked",separator:",",initComponent:function(){if(!this.tpl){this.tpl='<tpl for="."><div class="x-combo-list-item"><img src="'+Ext.BLANK_IMAGE_URL+'" class="ux-lovcombo-icon ux-lovcombo-icon-{[values.'+this.checkField+'?"checked":"unchecked"]}"><div class="ux-lovcombo-item-text">{'+(this.displayField||"text")+"}</div></div></tpl>";
}Ext.ux.form.LovCombo.superclass.initComponent.apply(this,arguments);
this.on({scope:this,beforequery:this.onBeforeQuery,blur:this.onRealBlur});
this.onLoad=this.onLoad.createSequence(function(){if(this.el){var v=this.el.dom.value;
this.el.dom.value="";
this.el.dom.value=v;
}});
},initEvents:function(){Ext.ux.form.LovCombo.superclass.initEvents.apply(this,arguments);
this.keyNav.tab=false;
},clearValue:function(){this.value="";
this.setRawValue(this.value);
this.store.clearFilter();
this.store.each(function(r){r.set(this.checkField,false);
},this);
if(this.hiddenField){this.hiddenField.value="";
}this.applyEmptyText();
},getCheckedDisplay:function(){var re=new RegExp(this.separator,"g");
return this.getCheckedValue(this.displayField).replace(re,this.separator+" ");
},getCheckedValue:function(field){field=field||this.valueField;
var c=[];
var snapshot=this.store.snapshot||this.store.data;
snapshot.each(function(r){if(r.get(this.checkField)){c.push(r.get(field));
}},this);
return c.join(this.separator);
},onBeforeQuery:function(qe){qe.query=qe.query.replace(new RegExp(this.getCheckedDisplay()+"[ "+this.separator+"]*"),"");
},onRealBlur:function(){this.list.hide();
var rv=this.getRawValue();
var rva=rv.split(new RegExp(RegExp.escape(this.separator)+" *"));
var va=[];
var snapshot=this.store.snapshot||this.store.data;
Ext.each(rva,function(v){snapshot.each(function(r){if(v===r.get(this.displayField)){va.push(r.get(this.valueField));
}},this);
},this);
this.setValue(va.join(this.separator));
this.store.clearFilter();
},onSelect:function(record,index){if(this.fireEvent("beforeselect",this,record,index)!==false){record.set(this.checkField,!record.get(this.checkField));
if(this.store.isFiltered()){this.doQuery(this.allQuery);
}this.setValue(this.getCheckedValue());
this.fireEvent("select",this,record,index);
}},setValue:function(v){if(v){v=""+v;
if(this.valueField){this.store.clearFilter();
this.store.each(function(r){var checked=!(!v.match("(^|"+this.separator+")"+RegExp.escape(r.get(this.valueField))+"("+this.separator+"|$)"));
r.set(this.checkField,checked);
},this);
this.value=this.getCheckedValue();
this.setRawValue(this.getCheckedDisplay());
if(this.hiddenField){this.hiddenField.value=this.value;
}}else{this.value=v;
this.setRawValue(v);
if(this.hiddenField){this.hiddenField.value=v;
}}if(this.el){this.el.removeClass(this.emptyClass);
}}else{this.clearValue();
}},selectAll:function(){this.store.each(function(record){record.set(this.checkField,true);
},this);
this.doQuery(this.allQuery);
this.setValue(this.getCheckedValue());
},deselectAll:function(){this.clearValue();
}});
Ext.override(Ext.ux.form.LovCombo,{beforeBlur:Ext.emptyFn});
Ext.reg("lovcombo",Ext.ux.form.LovCombo);
Ext.ux.GridPrinter={print:function(grid){var columns=grid.getColumnModel().config;
var data=[];
grid.store.data.each(function(item){var convertedData=[];
for(var key in item.data){var value=item.data[key];
Ext.each(columns,function(column){if(column.dataIndex==key){value=column.renderer?column.renderer(value,null,item):value;
convertedData[key]=value;
}},this);
}data.push(convertedData);
});
var headings=Ext.ux.GridPrinter.headerTpl.apply(columns);
var body=Ext.ux.GridPrinter.bodyTpl.apply(columns);
var html=new Ext.XTemplate('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',"<html>","<head>",'<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />','<link href="'+Ext.ux.GridPrinter.stylesheetPath+'" rel="stylesheet" type="text/css" media="screen,print" />',"<title>"+grid.title+"</title>","</head>","<body>","<table>",headings,'<tpl for=".">',body,"</tpl>","</table>","</body>","</html>").apply(data);
html=html.split('<th><div class="x-grid3-hd-checker">&#160;</div></th>').join("");
html=html.split("<td>{}</td>").join("");
var win=window.open("","_blank");
win.document.write(html);
win.document.close();
win.print();
},stylesheetPath:"/css/printgrid.css",headerTpl:new Ext.XTemplate("<tr>",'<tpl for=".">',"<th>{header}</th>","</tpl>","</tr>"),bodyTpl:new Ext.XTemplate("<tr>",'<tpl for=".">',"<td>{{dataIndex}}</td>","</tpl>","</tr>")};
Ext.namespace("Ext.ux.grid.livegrid");
Ext.ux.grid.livegrid.GridPanel=Ext.extend(Ext.grid.GridPanel,{initComponent:function(){if(this.cls){this.cls+=" ext-ux-livegrid";
}else{this.cls="ext-ux-livegrid";
}Ext.ux.grid.livegrid.GridPanel.superclass.initComponent.call(this);
},onRender:function(ct,position){Ext.ux.grid.livegrid.GridPanel.superclass.onRender.call(this,ct,position);
var ds=this.getStore();
if(ds._autoLoad===true){delete ds._autoLoad;
ds.load();
}},walkCells:function(row,col,step,fn,scope){var ds=this.store;
var _oF=ds.getCount;
ds.getCount=ds.getTotalCount;
var ret=Ext.ux.grid.livegrid.GridPanel.superclass.walkCells.call(this,row,col,step,fn,scope);
ds.getCount=_oF;
return ret;
}});
Ext.namespace("Ext.ux.grid.livegrid");
Ext.ux.grid.livegrid.GridView=function(config){this.addEvents({beforebuffer:true,buffer:true,bufferfailure:true,cursormove:true,abortrequest:true});
this.horizontalScrollOffset=17;
this._checkEmptyBody=true;
Ext.apply(this,config);
this.templates={};
this.templates.master=new Ext.Template('<div class="x-grid3" hidefocus="true"><div class="liveScroller"><div></div><div></div><div></div></div>','<div class="x-grid3-viewport"">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{ostyle}">{header}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller" style="overflow-y:hidden !important;"><div class="x-grid3-body" style="{bstyle}">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',"</div>",'<div class="x-grid3-resize-marker">&#160;</div>','<div class="x-grid3-resize-proxy">&#160;</div>',"</div>");
this._gridViewSuperclass=Ext.ux.grid.livegrid.GridView.superclass;
this._gridViewSuperclass.constructor.call(this);
};
Ext.extend(Ext.ux.grid.livegrid.GridView,Ext.grid.GridView,{hdHeight:0,rowClipped:0,liveScroller:null,liveScrollerInsets:null,rowHeight:-1,visibleRows:1,lastIndex:-1,lastRowIndex:0,lastScrollPos:0,rowIndex:0,isBuffering:false,requestQueue:-1,loadMask:false,loadMaskDisplayed:false,isPrebuffering:false,_loadMaskAnchor:null,reset:function(forceReload){if(forceReload===false){this.ds.modified=[];
this.rowIndex=0;
this.lastScrollPos=0;
this.lastRowIndex=0;
this.lastIndex=0;
this.adjustVisibleRows();
this.adjustScrollerPos(-this.liveScroller.dom.scrollTop,true);
this.showLoadMask(false);
var _ofn=this.processRows;
this.processRows=Ext.emptyFn;
this.refresh(true);
this.processRows=_ofn;
this.processRows(0);
this.fireEvent("cursormove",this,0,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);
return false;
}else{var params={};
var sInfo=this.ds.sortInfo;
if(sInfo){params={dir:sInfo.direction,sort:sInfo.field};
}return this.ds.load({params:params});
}},renderUI:function(){var g=this.grid;
var dEnabled=g.enableDragDrop||g.enableDrag;
g.enableDragDrop=false;
g.enableDrag=false;
this._gridViewSuperclass.renderUI.call(this);
var g=this.grid;
g.enableDragDrop=dEnabled;
g.enableDrag=dEnabled;
if(dEnabled){this.dragZone=new Ext.ux.grid.livegrid.DragZone(g,{ddGroup:g.ddGroup||"GridDD"});
}if(this.loadMask){this._loadMaskAnchor=Ext.get(this.mainBody.dom.parentNode.parentNode);
Ext.apply(this.loadMask,{msgCls:"x-mask-loading"});
this._loadMaskAnchor.mask(this.loadMask.msg,this.loadMask.msgCls);
var dom=this._loadMaskAnchor.dom;
var data=Ext.Element.data;
data(dom,"mask").addClass("ext-ux-livegrid");
data(dom,"mask").setDisplayed(false);
data(dom,"maskMsg").setDisplayed(false);
}},init:function(grid){this._gridViewSuperclass.init.call(this,grid);
grid.on("expand",this._onExpand,this);
},initData:function(ds,cm){if(this.ds){this.ds.un("bulkremove",this.onBulkRemove,this);
this.ds.un("beforeload",this.onBeforeLoad,this);
}if(ds){ds.on("bulkremove",this.onBulkRemove,this);
ds.on("beforeload",this.onBeforeLoad,this);
}this._gridViewSuperclass.initData.call(this,ds,cm);
},renderBody:function(){var markup=this.renderRows(0,this.visibleRows-1);
return this.templates.body.apply({rows:markup});
},doRender:function(cs,rs,ds,startRow,colCount,stripe){return this._gridViewSuperclass.doRender.call(this,cs,rs,ds,startRow+this.ds.bufferRange[0],colCount,stripe);
},initElements:function(){var E=Ext.Element;
var el=this.grid.getGridEl().dom.firstChild;
var cs=el.childNodes;
this.el=new E(el);
this.mainWrap=new E(cs[1]);
this.liveScroller=new E(cs[0]);
var f=this.liveScroller.dom.firstChild;
this.liveScrollerInsets=[f,f.nextSibling,f.nextSibling.nextSibling];
this.liveScroller.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay});
var thd=this.mainWrap.dom.firstChild;
this.mainHd=new E(thd);
this.hdHeight=thd.offsetHeight;
this.innerHd=this.mainHd.dom.firstChild;
this.scroller=new E(this.mainWrap.dom.childNodes[1]);
if(this.forceFit){this.scroller.setStyle("overflow-x","hidden");
}this.mainBody=new E(this.scroller.dom.firstChild);
this.mainBody.on("mousewheel",this.handleWheel,this);
this.focusEl=new E(this.scroller.dom.childNodes[1]);
this.focusEl.swallowEvent("click",true);
this.resizeMarker=new E(cs[2]);
this.resizeProxy=new E(cs[3]);
},layout:function(){if(!this.mainBody){return;
}var g=this.grid;
var c=g.getGridEl(),cm=this.cm,expandCol=g.autoExpandColumn,gv=this;
var csize=c.getSize(true);
var vw=csize.width;
if(!g.hideHeaders&&vw<20||csize.height<20){return;
}if(g.autoHeight){this.scroller.dom.style.overflow="visible";
if(Ext.isWebKit){this.scroller.dom.style.position="static";
}}else{this.el.setSize(csize.width,csize.height);
var hdHeight=this.mainHd.getHeight();
var vh=csize.height-(hdHeight);
this.scroller.setSize(vw,vh);
if(this.innerHd){this.innerHd.style.width=(vw)+"px";
}}this.liveScroller.dom.style.top=this.hdHeight+"px";
if(this.forceFit){if(this.lastViewWidth!=vw){this.fitColumns(false,false);
this.lastViewWidth=vw;
}}else{this.autoExpand();
}this.adjustVisibleRows();
this.adjustBufferInset();
this.onLayout(vw,vh);
},removeRow:function(row){Ext.removeNode(this.getRow(row));
},removeRows:function(firstRow,lastRow){var bd=this.mainBody.dom;
for(var rowIndex=firstRow;
rowIndex<=lastRow;
rowIndex++){Ext.removeNode(bd.childNodes[firstRow]);
}},_onExpand:function(panel){this.adjustVisibleRows();
this.adjustBufferInset();
this.adjustScrollerPos(this.rowHeight*this.rowIndex,true);
},onColumnMove:function(cm,oldIndex,newIndex){this.indexMap=null;
this.replaceLiveRows(this.rowIndex,true);
this.updateHeaders();
this.updateHeaderSortState();
this.afterMove(newIndex);
this.grid.fireEvent("columnmove",oldIndex,newIndex);
},onColumnWidthUpdated:function(col,w,tw){this.adjustVisibleRows();
this.adjustBufferInset();
},onAllColumnWidthsUpdated:function(ws,tw){this.adjustVisibleRows();
this.adjustBufferInset();
},onRowSelect:function(row){if(row<this.rowIndex||row>this.rowIndex+this.visibleRows){return;
}this.addRowClass(row,this.selectedRowClass);
},onRowDeselect:function(row){if(row<this.rowIndex||row>this.rowIndex+this.visibleRows){return;
}this.removeRowClass(row,this.selectedRowClass);
},onClear:function(){this.reset(false);
},onBulkRemove:function(store,removedData){var record=null;
var index=0;
var viewIndex=0;
var len=removedData.length;
var removedInView=false;
var removedAfterView=false;
var scrollerAdjust=0;
if(len==0){return;
}var tmpRowIndex=this.rowIndex;
var removedBefore=0;
var removedAfter=0;
var removedIn=0;
for(var i=0;
i<len;
i++){record=removedData[i][0];
index=removedData[i][1];
viewIndex=(index!=Number.MIN_VALUE&&index!=Number.MAX_VALUE)?index+this.ds.bufferRange[0]:index;
if(viewIndex<this.rowIndex){removedBefore++;
}else{if(viewIndex>=this.rowIndex&&viewIndex<=this.rowIndex+(this.visibleRows-1)){removedIn++;
}else{if(viewIndex>=this.rowIndex+this.visibleRows){removedAfter++;
}}}this.fireEvent("beforerowremoved",this,viewIndex,record);
this.fireEvent("rowremoved",this,viewIndex,record);
}var totalLength=this.ds.totalLength;
this.rowIndex=Math.max(0,Math.min(this.rowIndex-removedBefore,totalLength-(this.visibleRows-1)));
this.lastRowIndex=this.rowIndex;
this.adjustScrollerPos(-(removedBefore*this.rowHeight),true);
this.updateLiveRows(this.rowIndex,true);
this.adjustBufferInset();
this.processRows(0,undefined,false);
},onRemove:function(ds,record,index){this.onBulkRemove(ds,[[record,index]]);
},onAdd:function(ds,records,index){if(this._checkEmptyBody){if(this.mainBody.dom.innerHTML=="&nbsp;"){this.mainBody.dom.innerHTML="";
}this._checkEmptyBody=false;
}var recordLen=records.length;
if(index==Number.MAX_VALUE||index==Number.MIN_VALUE){this.fireEvent("beforerowsinserted",this,index,index);
if(index==Number.MIN_VALUE){this.rowIndex=this.rowIndex+recordLen;
this.lastRowIndex=this.rowIndex;
this.adjustBufferInset();
this.adjustScrollerPos(this.rowHeight*recordLen,true);
this.fireEvent("rowsinserted",this,index,index,recordLen);
this.processRows(0,undefined,false);
this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);
return;
}this.adjustBufferInset();
this.fireEvent("rowsinserted",this,index,index,recordLen);
return;
}var start=index+this.ds.bufferRange[0];
var end=start+(recordLen-1);
var len=this.getRows().length;
var firstRow=0;
var lastRow=0;
if(start>this.rowIndex+(this.visibleRows-1)){this.fireEvent("beforerowsinserted",this,start,end);
this.fireEvent("rowsinserted",this,start,end,recordLen);
this.adjustVisibleRows();
this.adjustBufferInset();
}else{if(start>=this.rowIndex&&start<=this.rowIndex+(this.visibleRows-1)){firstRow=index;
lastRow=index+(recordLen-1);
this.lastRowIndex=this.rowIndex;
this.rowIndex=(start>this.rowIndex)?this.rowIndex:start;
this.insertRows(ds,firstRow,lastRow);
if(this.lastRowIndex!=this.rowIndex){this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);
}this.adjustVisibleRows();
this.adjustBufferInset();
}else{if(start<this.rowIndex){this.fireEvent("beforerowsinserted",this,start,end);
this.rowIndex=this.rowIndex+recordLen;
this.lastRowIndex=this.rowIndex;
this.adjustVisibleRows();
this.adjustBufferInset();
this.adjustScrollerPos(this.rowHeight*recordLen,true);
this.fireEvent("rowsinserted",this,start,end,recordLen);
this.processRows(0,undefined,true);
this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);
}}}},onBeforeLoad:function(store,options){var proxy=store.proxy;
if(proxy.activeRequest&&proxy.activeRequest[Ext.data.Api.actions.read]){proxy.getConnection().abort(proxy.activeRequest[Ext.data.Api.actions.read]);
}this.fireEvent("abortrequest",store,options);
this.isBuffering=false;
this.isPreBuffering=false;
options.params=options.params||{};
var apply=Ext.apply;
apply(options,{scope:this,callback:function(){this.reset(false);
},suspendLoadEvent:false});
apply(options.params,{start:0,limit:this.ds.bufferSize});
return true;
},onLoad:function(o1,o2,options){this.adjustBufferInset();
},onDataChange:function(store){this.updateHeaderSortState();
},liveBufferUpdate:function(records,options,success){if(success===true){this.adjustBufferInset();
this.fireEvent("buffer",this,this.ds,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength,options);
this.grid.selModel.replaceSelections(records);
this.isBuffering=false;
this.isPrebuffering=false;
this.showLoadMask(false);
if(this.requestQueue>=0){var offset=this.requestQueue;
this.requestQueue=-1;
this.updateLiveRows(offset);
return;
}if(this.isInRange(this.rowIndex)){this.replaceLiveRows(this.rowIndex,options.forceRepaint);
}else{this.updateLiveRows(this.rowIndex);
}return;
}else{this.fireEvent("bufferfailure",this,this.ds,options);
}this.requestQueue=-1;
this.isBuffering=false;
this.isPrebuffering=false;
this.showLoadMask(false);
},handleWheel:function(e){if(this.rowHeight==-1){e.stopEvent();
return;
}var d=e.getWheelDelta();
this.adjustScrollerPos(-(d*this.rowHeight));
e.stopEvent();
},onLiveScroll:function(){var scrollTop=this.liveScroller.dom.scrollTop;
var cursor=Math.floor((scrollTop)/this.rowHeight);
this.rowIndex=cursor;
if(cursor==this.lastRowIndex){return;
}this.updateLiveRows(cursor);
this.lastScrollPos=this.liveScroller.dom.scrollTop;
},refreshRow:function(record){var ds=this.ds,index;
if(typeof record=="number"){index=record;
record=ds.getAt(index);
}else{index=ds.indexOf(record);
}var viewIndex=index+this.ds.bufferRange[0];
if(viewIndex<this.rowIndex||viewIndex>=this.rowIndex+this.visibleRows){this.fireEvent("rowupdated",this,viewIndex,record);
return;
}this.insertRows(ds,index,index,true);
this.fireEvent("rowupdated",this,viewIndex,record);
},processRows:function(startRow,skipStripe,paintSelections){if(!this.ds||this.ds.getCount()<1){return;
}skipStripe=skipStripe||!this.grid.stripeRows;
var cursor=this.rowIndex;
var rows=this.getRows();
var index=0;
var row=null;
for(var idx=0,len=rows.length;
idx<len;
idx++){row=rows[idx];
row.rowIndex=index=cursor+idx;
row.className=row.className.replace(this.rowClsRe," ");
if(!skipStripe&&(index+1)%2===0){row.className+=" x-grid3-row-alt";
}if(paintSelections!==false){if(this.grid.selModel.isSelected(this.ds.getAt(index))===true){this.addRowClass(index,this.selectedRowClass);
}else{this.removeRowClass(index,this.selectedRowClass);
}this.fly(row).removeClass("x-grid3-row-over");
}}if(cursor===0){Ext.fly(rows[0]).addClass(this.firstRowCls);
}else{if(cursor+rows.length==this.ds.totalLength){Ext.fly(rows[rows.length-1]).addClass(this.lastRowCls);
}}},insertRows:function(dm,firstRow,lastRow,isUpdate){var viewIndexFirst=firstRow+this.ds.bufferRange[0];
var viewIndexLast=lastRow+this.ds.bufferRange[0];
if(!isUpdate){this.fireEvent("beforerowsinserted",this,viewIndexFirst,viewIndexLast);
}if(isUpdate!==true&&(this.getRows().length+(lastRow-firstRow))>=this.visibleRows){this.removeRows((this.visibleRows-1)-(lastRow-firstRow),this.visibleRows-1);
}else{if(isUpdate){this.removeRows(viewIndexFirst-this.rowIndex,viewIndexLast-this.rowIndex);
}}var lastRenderRow=(firstRow==lastRow)?lastRow:Math.min(lastRow,(this.rowIndex-this.ds.bufferRange[0])+(this.visibleRows-1));
var html=this.renderRows(firstRow,lastRenderRow);
var before=this.getRow(viewIndexFirst);
if(before){Ext.DomHelper.insertHtml("beforeBegin",before,html);
}else{Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,html);
}if(isUpdate===true){var rows=this.getRows();
var cursor=this.rowIndex;
for(var i=0,max_i=rows.length;
i<max_i;
i++){rows[i].rowIndex=cursor+i;
}}if(!isUpdate){this.fireEvent("rowsinserted",this,viewIndexFirst,viewIndexLast,(viewIndexLast-viewIndexFirst)+1);
this.processRows(0,undefined,true);
}},getRow:function(row){if(row-this.rowIndex<0){return null;
}return this.getRows()[row-this.rowIndex];
},getCell:function(row,col){var row=this.getRow(row);
return row?row.getElementsByTagName("td")[col]:null;
},focusCell:function(row,col,hscroll){var xy=this.ensureVisible(row,col,hscroll);
if(!xy){return;
}this.focusEl.setXY(xy);
if(Ext.isGecko){this.focusEl.focus();
}else{this.focusEl.focus.defer(1,this.focusEl);
}},ensureVisible:function(row,col,hscroll){if(typeof row!="number"){row=row.rowIndex;
}if(row<0||row>=this.ds.totalLength){return;
}col=(col!==undefined?col:0);
var rowInd=row-this.rowIndex;
if(this.rowClipped&&row==this.rowIndex+this.visibleRows-1){this.adjustScrollerPos(this.rowHeight);
}else{if(row>=this.rowIndex+this.visibleRows){this.adjustScrollerPos(((row-(this.rowIndex+this.visibleRows))+1)*this.rowHeight);
}else{if(row<=this.rowIndex){this.adjustScrollerPos((rowInd)*this.rowHeight);
}}}var rowEl=this.getRow(row),cellEl;
if(!rowEl){return;
}if(!(hscroll===false&&col===0)){while(this.cm.isHidden(col)){col++;
}cellEl=this.getCell(row,col);
}var c=this.scroller.dom;
if(hscroll!==false){var cleft=parseInt(cellEl.offsetLeft,10);
var cright=cleft+cellEl.offsetWidth;
var sleft=parseInt(c.scrollLeft,10);
var sright=sleft+c.clientWidth;
if(cleft<sleft){c.scrollLeft=cleft;
}else{if(cright>sright){c.scrollLeft=cright-c.clientWidth;
}}}return cellEl?Ext.fly(cellEl).getXY():[c.scrollLeft+this.el.getX(),Ext.fly(rowEl).getY()];
},isRecordRendered:function(record){var ind=this.ds.indexOf(record);
if(ind>=this.rowIndex&&ind<this.rowIndex+this.visibleRows){return true;
}return false;
},isInRange:function(rowIndex){var lastRowIndex=Math.min(this.ds.totalLength-1,rowIndex+(this.visibleRows-1));
return(rowIndex>=this.ds.bufferRange[0])&&(lastRowIndex<=this.ds.bufferRange[1]);
},getPredictedBufferIndex:function(index,inRange,down){if(!inRange){if(index+this.ds.bufferSize>=this.ds.totalLength){return this.ds.totalLength-this.ds.bufferSize;
}return Math.max(0,(index+this.visibleRows)-Math.round(this.ds.bufferSize/2));
}if(!down){return Math.max(0,(index-this.ds.bufferSize)+this.visibleRows);
}if(down){return Math.max(0,Math.min(index,this.ds.totalLength-this.ds.bufferSize));
}},updateLiveRows:function(index,forceRepaint,forceReload){var inRange=this.isInRange(index);
if(this.isBuffering){if(this.isPrebuffering){if(inRange){this.replaceLiveRows(index,forceRepaint);
}else{this.showLoadMask(true);
}}this.fireEvent("cursormove",this,index,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);
this.requestQueue=index;
return;
}var lastIndex=this.lastIndex;
this.lastIndex=index;
var inRange=this.isInRange(index);
var down=false;
if(inRange&&forceReload!==true){this.replaceLiveRows(index,forceRepaint);
this.fireEvent("cursormove",this,index,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);
if(index>lastIndex){down=true;
var totalCount=this.ds.totalLength;
if(index+this.visibleRows+this.nearLimit<=this.ds.bufferRange[1]){return;
}if(this.ds.bufferRange[1]+1>=totalCount){return;
}}else{if(index<lastIndex){down=false;
if(this.ds.bufferRange[0]<=0){return;
}if(index-this.nearLimit>this.ds.bufferRange[0]){return;
}}else{return;
}}this.isPrebuffering=true;
}this.isBuffering=true;
var bufferOffset=this.getPredictedBufferIndex(index,inRange,down);
if(!inRange){this.showLoadMask(true);
}this.ds.suspendEvents();
var sInfo=this.ds.sortInfo;
var params={};
if(this.ds.lastOptions){Ext.apply(params,this.ds.lastOptions.params);
}params.start=bufferOffset;
params.limit=this.ds.bufferSize;
if(sInfo){params.dir=sInfo.direction;
params.sort=sInfo.field;
}var opts={forceRepaint:forceRepaint,callback:this.liveBufferUpdate,scope:this,params:params,suspendLoadEvent:true};
this.fireEvent("beforebuffer",this,this.ds,index,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength,opts);
this.ds.load(opts);
this.ds.resumeEvents();
},showLoadMask:function(show){if(!this.loadMask||show==this.loadMaskDisplayed){return;
}var dom=this._loadMaskAnchor.dom;
var data=Ext.Element.data;
var mask=data(dom,"mask");
var maskMsg=data(dom,"maskMsg");
if(show){mask.setDisplayed(true);
maskMsg.setDisplayed(true);
maskMsg.center(this._loadMaskAnchor);
if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this._loadMaskAnchor.getStyle("height")=="auto"){mask.setSize(undefined,this._loadMaskAnchor.getHeight());
}}else{mask.setDisplayed(false);
maskMsg.setDisplayed(false);
}this.loadMaskDisplayed=show;
},replaceLiveRows:function(cursor,forceReplace,processRows){var spill=cursor-this.lastRowIndex;
if(spill==0&&forceReplace!==true){return;
}var append=spill>0;
spill=Math.abs(spill);
var bufferRange=this.ds.bufferRange;
var cursorBuffer=cursor-bufferRange[0];
var lpIndex=Math.min(cursorBuffer+this.visibleRows-1,bufferRange[1]-bufferRange[0]);
if(spill>=this.visibleRows||spill==0){this.mainBody.update(this.renderRows(cursorBuffer,lpIndex));
}else{if(append){this.removeRows(0,spill-1);
if(cursorBuffer+this.visibleRows-spill<=bufferRange[1]-bufferRange[0]){var html=this.renderRows(cursorBuffer+this.visibleRows-spill,lpIndex);
Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,html);
}}else{this.removeRows(this.visibleRows-spill,this.visibleRows-1);
var html=this.renderRows(cursorBuffer,cursorBuffer+spill-1);
Ext.DomHelper.insertHtml("beforeBegin",this.mainBody.dom.firstChild,html);
}}if(processRows!==false){this.processRows(0,undefined,true);
}this.lastRowIndex=cursor;
},adjustBufferInset:function(){var liveScrollerDom=this.liveScroller.dom;
var g=this.grid,ds=g.store;
var c=g.getGridEl();
var elWidth=c.getSize().width;
var hiddenRows=(ds.totalLength==this.visibleRows-this.rowClipped)?0:Math.max(0,ds.totalLength-(this.visibleRows-this.rowClipped));
if(hiddenRows==0){this.scroller.setWidth(elWidth);
liveScrollerDom.style.display="none";
return;
}else{this.scroller.setWidth(elWidth-this.getScrollOffset());
liveScrollerDom.style.display="";
}var scrollbar=this.cm.getTotalWidth()+this.getScrollOffset()>elWidth;
var contHeight=liveScrollerDom.parentNode.offsetHeight+((ds.totalLength>0&&scrollbar)?-this.horizontalScrollOffset:0)-this.hdHeight;
liveScrollerDom.style.height=Math.max(contHeight,this.horizontalScrollOffset*2)+"px";
if(this.rowHeight==-1){return;
}var h=(hiddenRows==0?0:contHeight+(hiddenRows*this.rowHeight));
var oh=h;
var len=this.liveScrollerInsets.length;
if(h==0){h=0;
}else{h=Math.round(h/len);
}for(var i=0;
i<len;
i++){if(i==len-1&&h!=0){h-=(h*3)-oh;
}this.liveScrollerInsets[i].style.height=h+"px";
}},adjustVisibleRows:function(){if(this.rowHeight==-1){if(this.getRows()[0]){this.rowHeight=this.getRows()[0].offsetHeight;
if(this.rowHeight<=0){this.rowHeight=-1;
return;
}}else{return;
}}var g=this.grid,ds=g.store;
var c=g.getGridEl();
var cm=this.cm;
var size=c.getSize();
var width=size.width;
var vh=size.height;
var vw=width-this.getScrollOffset();
if(cm.getTotalWidth()>vw){vh-=this.horizontalScrollOffset;
}vh-=this.mainHd.getHeight();
var totalLength=ds.totalLength||0;
var visibleRows=Math.max(1,Math.floor(vh/this.rowHeight));
this.rowClipped=0;
if(totalLength>visibleRows&&this.rowHeight/3<(vh-(visibleRows*this.rowHeight))){visibleRows=Math.min(visibleRows+1,totalLength);
this.rowClipped=1;
}if(this.visibleRows==visibleRows){return;
}this.visibleRows=visibleRows;
if(this.isBuffering&&!this.isPrebuffering){return;
}if(this.rowIndex+(visibleRows-this.rowClipped)>totalLength){this.rowIndex=Math.max(0,totalLength-(visibleRows-this.rowClipped));
this.lastRowIndex=this.rowIndex;
}this.updateLiveRows(this.rowIndex,true);
},adjustScrollerPos:function(pixels,suspendEvent){if(pixels==0){return;
}var liveScroller=this.liveScroller;
var scrollDom=liveScroller.dom;
if(suspendEvent===true){liveScroller.un("scroll",this.onLiveScroll,this);
}this.lastScrollPos=scrollDom.scrollTop;
scrollDom.scrollTop+=pixels;
if(suspendEvent===true){scrollDom.scrollTop=scrollDom.scrollTop;
liveScroller.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay});
}}});
Ext.namespace("Ext.ux.grid.livegrid");
Ext.ux.grid.livegrid.JsonReader=function(meta,recordType){Ext.ux.grid.livegrid.JsonReader.superclass.constructor.call(this,meta,recordType);
};
Ext.extend(Ext.ux.grid.livegrid.JsonReader,Ext.data.JsonReader,{buildExtractors:function(){if(this.ef){return;
}var s=this.meta;
if(s.versionProperty){this.getVersion=this.createAccessor(s.versionProperty);
}Ext.ux.grid.livegrid.JsonReader.superclass.buildExtractors.call(this);
},readRecords:function(o){if(!this.__readRecords){this.__readRecords=Ext.ux.grid.livegrid.JsonReader.superclass.readRecords;
}var intercept=this.__readRecords.call(this,o);
if(this.meta.versionProperty){var v=this.getVersion(o);
intercept.version=(v===undefined||v==="")?null:v;
}return intercept;
}});
Ext.namespace("Ext.ux.grid.livegrid");
Ext.ux.grid.livegrid.RowSelectionModel=function(config){this.addEvents({selectiondirty:true});
Ext.apply(this,config);
this.pendingSelections={};
Ext.ux.grid.livegrid.RowSelectionModel.superclass.constructor.call(this);
};
Ext.extend(Ext.ux.grid.livegrid.RowSelectionModel,Ext.grid.RowSelectionModel,{initEvents:function(){Ext.ux.grid.livegrid.RowSelectionModel.superclass.initEvents.call(this);
this.grid.view.on("rowsinserted",this.onAdd,this);
this.grid.store.on("selectionsload",this.onSelectionsLoad,this);
},onRemove:function(v,index,r){var ranges=this.getPendingSelections();
var rangesLength=ranges.length;
var selectionChanged=false;
if(index==Number.MIN_VALUE||index==Number.MAX_VALUE){if(r){if(this.isIdSelected(r.id)&&index==Number.MIN_VALUE){this.shiftSelections(this.grid.store.bufferRange[1],-1);
}this.selections.remove(r);
selectionChanged=true;
}if(index==Number.MIN_VALUE){this.clearPendingSelections(0,this.grid.store.bufferRange[0]);
}else{this.clearPendingSelections(this.grid.store.bufferRange[1]);
}if(rangesLength!=0){this.fireEvent("selectiondirty",this,index,1);
}}else{selectionChanged=this.isIdSelected(r.id);
if(!selectionChanged){return;
}this.selections.remove(r);
if(rangesLength!=0){var startRange=ranges[0];
var endRange=ranges[rangesLength-1];
if(index<=endRange||index<=startRange){this.shiftSelections(index,-1);
this.fireEvent("selectiondirty",this,index,1);
}}}if(selectionChanged){this.fireEvent("selectionchange",this);
}},onAdd:function(store,index,endIndex,recordLength){var ranges=this.getPendingSelections();
var rangesLength=ranges.length;
if((index==Number.MIN_VALUE||index==Number.MAX_VALUE)){if(index==Number.MIN_VALUE){this.clearPendingSelections(0,this.grid.store.bufferRange[0]);
this.shiftSelections(this.grid.store.bufferRange[1],recordLength);
}else{this.clearPendingSelections(this.grid.store.bufferRange[1]);
}if(rangesLength!=0){this.fireEvent("selectiondirty",this,index,r);
}return;
}var startRange=ranges[0];
var endRange=ranges[rangesLength-1];
var viewIndex=index;
if(viewIndex<=endRange||viewIndex<=startRange){this.fireEvent("selectiondirty",this,viewIndex,recordLength);
this.shiftSelections(viewIndex,recordLength);
}},shiftSelections:function(startRow,length){var index=0;
var newIndex=0;
var newRequests={};
var ds=this.grid.store;
var storeIndex=startRow-ds.bufferRange[0];
var newStoreIndex=0;
var totalLength=this.grid.store.totalLength;
var rec=null;
var ranges=this.getPendingSelections();
var rangesLength=ranges.length;
if(rangesLength==0){return;
}for(var i=0;
i<rangesLength;
i++){index=ranges[i];
if(index<startRow){continue;
}newIndex=index+length;
newStoreIndex=storeIndex+length;
if(newIndex>=totalLength){break;
}rec=ds.getAt(newStoreIndex);
if(rec){this.selections.add(rec);
}else{newRequests[newIndex]=true;
}}this.pendingSelections=newRequests;
},onSelectionsLoad:function(store,records,ranges){this.replaceSelections(records);
},hasNext:function(){return this.last!==false&&(this.last+1)<this.grid.store.getTotalCount();
},getCount:function(){return this.selections.length+this.getPendingSelections().length;
},isSelected:function(index){if(typeof index=="number"){var orgInd=index;
index=this.grid.store.getAt(orgInd);
if(!index){var ind=this.getPendingSelections().indexOf(orgInd);
if(ind!=-1){return true;
}return false;
}}var r=index;
return(r&&this.selections.key(r.id)?true:false);
},deselectRecord:function(record,preventViewNotify){if(this.locked){return;
}var isSelected=this.selections.key(record.id);
if(!isSelected){return;
}var store=this.grid.store;
var index=store.indexOfId(record.id);
if(index==-1){index=store.findInsertIndex(record);
if(index!=Number.MIN_VALUE&&index!=Number.MAX_VALUE){index+=store.bufferRange[0];
}}else{delete this.pendingSelections[index];
}if(this.last==index){this.last=false;
}if(this.lastActive==index){this.lastActive=false;
}this.selections.remove(record);
if(!preventViewNotify){this.grid.getView().onRowDeselect(index);
}this.fireEvent("rowdeselect",this,index,record);
this.fireEvent("selectionchange",this);
},deselectRow:function(index,preventViewNotify){if(this.locked){return;
}if(this.last==index){this.last=false;
}if(this.lastActive==index){this.lastActive=false;
}var r=this.grid.store.getAt(index);
delete this.pendingSelections[index];
if(r){this.selections.remove(r);
}if(!preventViewNotify){this.grid.getView().onRowDeselect(index);
}this.fireEvent("rowdeselect",this,index,r);
this.fireEvent("selectionchange",this);
},selectRow:function(index,keepExisting,preventViewNotify){if(this.locked||index<0||index>=this.grid.store.getTotalCount()){return;
}var r=this.grid.store.getAt(index);
if(this.fireEvent("beforerowselect",this,index,keepExisting,r)!==false){if(!keepExisting||this.singleSelect){this.clearSelections();
}if(r){this.selections.add(r);
delete this.pendingSelections[index];
}else{this.pendingSelections[index]=true;
}this.last=this.lastActive=index;
if(!preventViewNotify){this.grid.getView().onRowSelect(index);
}this.fireEvent("rowselect",this,index,r);
this.fireEvent("selectionchange",this);
}},clearPendingSelections:function(startIndex,endIndex){if(endIndex==undefined){endIndex=Number.MAX_VALUE;
}var newSelections={};
var ranges=this.getPendingSelections();
var rangesLength=ranges.length;
var index=0;
for(var i=0;
i<rangesLength;
i++){index=ranges[i];
if(index<=endIndex&&index>=startIndex){continue;
}newSelections[index]=true;
}this.pendingSelections=newSelections;
},replaceSelections:function(records){if(!records||records.length==0){return;
}var ds=this.grid.store;
var rec=null;
var assigned=[];
var ranges=this.getPendingSelections();
var rangesLength=ranges.length;
var selections=this.selections;
var index=0;
for(var i=0;
i<rangesLength;
i++){index=ranges[i];
rec=ds.getAt(index);
if(rec){selections.add(rec);
assigned.push(rec.id);
delete this.pendingSelections[index];
}}var id=null;
for(i=0,len=records.length;
i<len;
i++){rec=records[i];
id=rec.id;
if(assigned.indexOf(id)==-1&&selections.containsKey(id)){selections.add(rec);
}}},getPendingSelections:function(asRange){var index=1;
var ranges=[];
var currentRange=0;
var tmpArray=[];
for(var i in this.pendingSelections){tmpArray.push(parseInt(i));
}tmpArray.sort(function(o1,o2){if(o1>o2){return 1;
}else{if(o1<o2){return -1;
}else{return 0;
}}});
if(!asRange){return tmpArray;
}var max_i=tmpArray.length;
if(max_i==0){return[];
}ranges[currentRange]=[tmpArray[0],tmpArray[0]];
for(var i=0,max_i=max_i-1;
i<max_i;
i++){if(tmpArray[i+1]-tmpArray[i]==1){ranges[currentRange][1]=tmpArray[i+1];
}else{currentRange++;
ranges[currentRange]=[tmpArray[i+1],tmpArray[i+1]];
}}return ranges;
},clearSelections:function(fast){if(this.locked){return;
}if(fast!==true){var ds=this.grid.store;
var s=this.selections;
var ind=-1;
s.each(function(r){ind=ds.indexOfId(r.id);
if(ind!=-1){this.deselectRow(ind+ds.bufferRange[0]);
}},this);
s.clear();
this.pendingSelections={};
}else{this.selections.clear();
this.pendingSelections={};
}this.last=false;
},selectRange:function(startRow,endRow,keepExisting){if(this.locked){return;
}if(!keepExisting){this.clearSelections();
}if(startRow<=endRow){for(var i=startRow;
i<=endRow;
i++){this.selectRow(i,true);
}}else{for(var i=startRow;
i>=endRow;
i--){this.selectRow(i,true);
}}}});
Ext.namespace("Ext.ux.grid.livegrid");
Ext.ux.grid.livegrid.Store=function(config){config=config||{};
config.remoteSort=true;
this._autoLoad=config.autoLoad?true:false;
config.autoLoad=false;
this.addEvents("bulkremove","versionchange","beforeselectionsload","selectionsload");
Ext.ux.grid.livegrid.Store.superclass.constructor.call(this,config);
this.totalLength=0;
this.bufferRange=[-1,-1];
this.on("clear",function(){this.bufferRange=[-1,-1];
},this);
if(this.url&&!this.selectionsProxy){this.selectionsProxy=new Ext.data.HttpProxy({url:this.url});
}};
Ext.extend(Ext.ux.grid.livegrid.Store,Ext.data.Store,{version:null,insert:function(index,records){records=[].concat(records);
index=index>=this.bufferSize?Number.MAX_VALUE:index;
if(index==Number.MIN_VALUE||index==Number.MAX_VALUE){var l=records.length;
if(index==Number.MIN_VALUE){this.bufferRange[0]+=l;
this.bufferRange[1]+=l;
}this.totalLength+=l;
this.fireEvent("add",this,records,index);
return;
}var split=false;
var insertRecords=records;
if(records.length+index>=this.bufferSize){split=true;
insertRecords=records.splice(0,this.bufferSize-index);
}this.totalLength+=insertRecords.length;
if(this.bufferRange[0]<=-1){this.bufferRange[0]=0;
}if(this.bufferRange[1]<(this.bufferSize-1)){this.bufferRange[1]=Math.min(this.bufferRange[1]+insertRecords.length,this.bufferSize-1);
}for(var i=0,len=insertRecords.length;
i<len;
i++){this.data.insert(index,insertRecords[i]);
insertRecords[i].join(this);
}while(this.getCount()>this.bufferSize){this.data.remove(this.data.last());
}this.fireEvent("add",this,insertRecords,index);
if(split==true){this.fireEvent("add",this,records,Number.MAX_VALUE);
}},remove:function(record,suspendEvent){var index=this._getIndex(record);
if(index<0){this.totalLength-=1;
if(this.pruneModifiedRecords){this.modified.remove(record);
}this.bufferRange[0]=Math.max(-1,this.bufferRange[0]-1);
this.bufferRange[1]=Math.max(-1,this.bufferRange[1]-1);
if(suspendEvent!==true){this.fireEvent("remove",this,record,index);
}return index;
}this.bufferRange[1]=Math.max(-1,this.bufferRange[1]-1);
this.data.removeAt(index);
if(this.pruneModifiedRecords){this.modified.remove(record);
}this.totalLength-=1;
if(suspendEvent!==true){this.fireEvent("remove",this,record,index);
}return index;
},_getIndex:function(record){var index=this.indexOfId(record.id);
if(index<0){index=this.findInsertIndex(record);
}return index;
},bulkRemove:function(records){var rec=null;
var recs=[];
var ind=0;
var len=records.length;
var orgIndexes=[];
for(var i=0;
i<len;
i++){rec=records[i];
orgIndexes[rec.id]=this._getIndex(rec);
}for(var i=0;
i<len;
i++){rec=records[i];
this.remove(rec,true);
recs.push([rec,orgIndexes[rec.id]]);
}this.fireEvent("bulkremove",this,recs);
},removeAll:function(){this.totalLength=0;
this.bufferRange=[-1,-1];
this.data.clear();
if(this.pruneModifiedRecords){this.modified=[];
}this.fireEvent("clear",this);
},loadRanges:function(ranges){var max_i=ranges.length;
if(max_i>0&&!this.selectionsProxy.activeRequest[Ext.data.Api.actions.read]&&this.fireEvent("beforeselectionsload",this,ranges)!==false){var lParams=this.lastOptions.params;
var params={};
params.ranges=Ext.encode(ranges);
if(lParams){if(lParams.sort){params.sort=lParams.sort;
}if(lParams.dir){params.dir=lParams.dir;
}}var options={};
for(var i in this.lastOptions){options.i=this.lastOptions.i;
}options.ranges=params.ranges;
this.selectionsProxy.doRequest(Ext.data.Api.actions.read,null,options,this.reader,this.selectionsLoaded,this,options);
}},loadSelections:function(ranges){if(ranges.length==0){return;
}this.loadRanges(ranges);
},selectionsLoaded:function(o,options,success){if(this.checkVersionChange(o,options,success)!==false){var r=o.records;
for(var i=0,len=r.length;
i<len;
i++){r[i].join(this);
}this.fireEvent("selectionsload",this,o.records,Ext.decode(options.ranges));
}else{this.fireEvent("selectionsload",this,[],Ext.decode(options.ranges));
}},checkVersionChange:function(o,options,success){if(o&&success!==false){if(o.version!==undefined){var old=this.version;
this.version=o.version;
if(this.version!==old){return this.fireEvent("versionchange",this,old,this.version);
}}}},findInsertIndex:function(record){this.remoteSort=false;
var index=Ext.ux.grid.livegrid.Store.superclass.findInsertIndex.call(this,record);
this.remoteSort=true;
if(this.bufferRange[0]<=0&&index==0){return index;
}else{if(this.bufferRange[0]>0&&index==0){return Number.MIN_VALUE;
}else{if(index>=this.bufferSize){return Number.MAX_VALUE;
}}}return index;
},sortData:function(f,direction){direction=direction||"ASC";
var st=this.fields.get(f).sortType;
var fn=function(r1,r2){var v1=st(r1.data[f]),v2=st(r2.data[f]);
return v1>v2?1:(v1<v2?-1:0);
};
this.data.sort(direction,fn);
},onMetaChange:function(meta,rtype,o){this.version=null;
Ext.ux.grid.livegrid.Store.superclass.onMetaChange.call(this,meta,rtype,o);
},loadRecords:function(o,options,success){this.checkVersionChange(o,options,success);
if(!o){this.bufferRange=[-1,-1];
}else{this.bufferRange=[options.params.start,Math.max(0,Math.min((options.params.start+options.params.limit)-1,o.totalRecords-1))];
}if(options.suspendLoadEvent===true){this.suspendEvents();
}Ext.ux.grid.livegrid.Store.superclass.loadRecords.call(this,o,options,success);
if(options.suspendLoadEvent===true){this.resumeEvents();
}},getAt:function(index){if(this.bufferRange[0]==-1){return undefined;
}var modelIndex=index-this.bufferRange[0];
return this.data.itemAt(modelIndex);
},clearFilter:function(){},isFiltered:function(){},collect:function(){},createFilterFn:function(){},sum:function(){},filter:function(){},filterBy:function(){},query:function(){},queryBy:function(){},find:function(){},findBy:function(){}});
Ext.namespace("Ext.ux.grid.livegrid");
Ext.ux.grid.livegrid.Toolbar=Ext.extend(Ext.Toolbar,{displayMsg:"Displaying {0} - {1} of {2}",emptyMsg:"No data to display",refreshText:"Refresh",initComponent:function(){Ext.ux.grid.livegrid.Toolbar.superclass.initComponent.call(this);
if(this.grid){this.view=this.grid.getView();
}var me=this;
this.view.init=this.view.init.createSequence(function(){me.bind(this);
},this.view);
},updateInfo:function(rowIndex,visibleRows,totalCount){if(this.displayEl){var msg=totalCount==0?this.emptyMsg:String.format(this.displayMsg,rowIndex+1,rowIndex+visibleRows,totalCount);
this.displayEl.update(msg);
}},unbind:function(view){var st;
var vw;
if(view instanceof Ext.grid.GridView){vw=view;
}else{vw=view.getView();
}st=view.ds;
st.un("loadexception",this.enableLoading,this);
st.un("beforeload",this.disableLoading,this);
st.un("load",this.enableLoading,this);
vw.un("rowremoved",this.onRowRemoved,this);
vw.un("rowsinserted",this.onRowsInserted,this);
vw.un("beforebuffer",this.beforeBuffer,this);
vw.un("cursormove",this.onCursorMove,this);
vw.un("buffer",this.onBuffer,this);
vw.un("bufferfailure",this.enableLoading,this);
this.view=undefined;
},bind:function(view){this.view=view;
var st=view.ds;
st.on("loadexception",this.enableLoading,this);
st.on("beforeload",this.disableLoading,this);
st.on("load",this.enableLoading,this);
view.on("rowremoved",this.onRowRemoved,this);
view.on("rowsinserted",this.onRowsInserted,this);
view.on("beforebuffer",this.beforeBuffer,this);
view.on("cursormove",this.onCursorMove,this);
view.on("buffer",this.onBuffer,this);
view.on("bufferfailure",this.enableLoading,this);
},enableLoading:function(){this.loading.setDisabled(false);
},disableLoading:function(){this.loading.setDisabled(true);
},onCursorMove:function(view,rowIndex,visibleRows,totalCount){this.updateInfo(rowIndex,visibleRows,totalCount);
},onRowsInserted:function(view,start,end){this.updateInfo(view.rowIndex,Math.min(view.ds.totalLength,view.visibleRows-view.rowClipped),view.ds.totalLength);
},onRowRemoved:function(view,index,record){this.updateInfo(view.rowIndex,Math.min(view.ds.totalLength,view.visibleRows-view.rowClipped),view.ds.totalLength);
},beforeBuffer:function(view,store,rowIndex,visibleRows,totalCount,options){this.loading.disable();
this.updateInfo(rowIndex,visibleRows,totalCount);
},onBuffer:function(view,store,rowIndex,visibleRows,totalCount){this.loading.enable();
this.updateInfo(rowIndex,visibleRows,totalCount);
},onClick:function(type){switch(type){case"refresh":if(this.view.reset(true)){this.loading.disable();
}else{this.loading.enable();
}break;
}},onRender:function(ct,position){Ext.PagingToolbar.superclass.onRender.call(this,ct,position);
this.loading=new Ext.Toolbar.Button({tooltip:this.refreshText,iconCls:"x-tbar-loading",handler:this.onClick.createDelegate(this,["refresh"])});
this.addButton(this.loading);
this.addSeparator();
if(this.displayInfo){this.displayEl=Ext.fly(this.el.dom).createChild({cls:"x-paging-info"});
}}});
Ext.namespace("Ext.ux.grid.livegrid");
Ext.ux.grid.livegrid.DragZone=function(grid,config){Ext.ux.grid.livegrid.DragZone.superclass.constructor.call(this,grid,config);
this.view.ds.on("beforeselectionsload",this._onBeforeSelectionsLoad,this);
this.view.ds.on("selectionsload",this._onSelectionsLoad,this);
};
Ext.extend(Ext.ux.grid.livegrid.DragZone,Ext.grid.GridDragZone,{isDropValid:true,onInitDrag:function(e){this.view.ds.loadSelections(this.grid.selModel.getPendingSelections(true));
Ext.ux.grid.livegrid.DragZone.superclass.onInitDrag.call(this,e);
},_onBeforeSelectionsLoad:function(){this.isDropValid=false;
Ext.fly(this.proxy.el.dom.firstChild).addClass("ext-ux-livegrid-drop-waiting");
},_onSelectionsLoad:function(){this.isDropValid=true;
this.ddel.innerHTML=this.grid.getDragDropText();
Ext.fly(this.proxy.el.dom.firstChild).removeClass("ext-ux-livegrid-drop-waiting");
}});
Ext.namespace("Ext.ux.grid.livegrid");
Ext.ux.grid.livegrid.EditorGridPanel=Ext.extend(Ext.grid.EditorGridPanel,{initEvents:function(){Ext.ux.grid.livegrid.EditorGridPanel.superclass.initEvents.call(this);
this.view.on("cursormove",this.stopEditing,this,[true]);
},startEditing:function(row,col){this.stopEditing();
if(this.colModel.isCellEditable(col,row)){this.view.ensureVisible(row,col,true);
if(!this.store.getAt(row)){return;
}}return Ext.ux.grid.livegrid.EditorGridPanel.superclass.startEditing.call(this,row,col);
},walkCells:function(row,col,step,fn,scope){return Ext.ux.grid.livegrid.GridPanel.prototype.walkCells.call(this,row,col,step,fn,scope);
},onRender:function(ct,position){return Ext.ux.grid.livegrid.GridPanel.prototype.onRender.call(this,ct,position);
},initComponent:function(){if(this.cls){this.cls+=" ext-ux-livegrid";
}else{this.cls="ext-ux-livegrid";
}return Ext.ux.grid.livegrid.EditorGridPanel.superclass.initComponent.call(this);
}});
var Showdown={};
Showdown.converter=function(){var _1;
var _2;
var _3;
var _4=0;
this.makeHtml=function(_5){_1=new Array();
_2=new Array();
_3=new Array();
_5=_5.replace(/~/g,"~T");
_5=_5.replace(/\$/g,"~D");
_5=_5.replace(/\r\n/g,"\n");
_5=_5.replace(/\r/g,"\n");
_5="\n\n"+_5+"\n\n";
_5=_6(_5);
_5=_5.replace(/^[ \t]+$/mg,"");
_5=_7(_5);
_5=_8(_5);
_5=_9(_5);
_5=_a(_5);
_5=_5.replace(/~D/g,"$$");
_5=_5.replace(/~T/g,"~");
return _5;
};
var _8=function(_b){var _b=_b.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(_c,m1,m2,m3,m4){m1=m1.toLowerCase();
_1[m1]=_11(m2);
if(m3){return m3+m4;
}else{if(m4){_2[m1]=m4.replace(/"/g,"&quot;");
}}return"";
});
return _b;
};
var _7=function(_12){_12=_12.replace(/\n/g,"\n\n");
var _13="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del";
var _14="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";
_12=_12.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,_15);
_12=_12.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,_15);
_12=_12.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,_15);
_12=_12.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,_15);
_12=_12.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,_15);
_12=_12.replace(/\n\n/g,"\n");
return _12;
};
var _15=function(_16,m1){var _18=m1;
_18=_18.replace(/\n\n/g,"\n");
_18=_18.replace(/^\n/,"");
_18=_18.replace(/\n+$/g,"");
_18="\n\n~K"+(_3.push(_18)-1)+"K\n\n";
return _18;
};
var _9=function(_19){_19=_1a(_19);
var key=_1c("<hr />");
_19=_19.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,key);
_19=_19.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,key);
_19=_19.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,key);
_19=_1d(_19);
_19=_1e(_19);
_19=_1f(_19);
_19=_7(_19);
_19=_20(_19);
return _19;
};
var _21=function(_22){_22=_23(_22);
_22=_24(_22);
_22=_25(_22);
_22=_26(_22);
_22=_27(_22);
_22=_28(_22);
_22=_11(_22);
_22=_29(_22);
_22=_22.replace(/  +\n/g," <br />\n");
return _22;
};
var _24=function(_2a){var _2b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;
_2a=_2a.replace(_2b,function(_2c){var tag=_2c.replace(/(.)<\/?code>(?=.)/g,"$1`");
tag=_2e(tag,"\\`*_");
return tag;
});
return _2a;
};
var _27=function(_2f){_2f=_2f.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,_30);
_2f=_2f.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,_30);
_2f=_2f.replace(/(\[([^\[\]]+)\])()()()()()/g,_30);
return _2f;
};
var _30=function(_31,m1,m2,m3,m4,m5,m6,m7){if(m7==undefined){m7="";
}var _39=m1;
var _3a=m2;
var _3b=m3.toLowerCase();
var url=m4;
var _3d=m7;
if(url==""){if(_3b==""){_3b=_3a.toLowerCase().replace(/ ?\n/g," ");
}url="#"+_3b;
if(_1[_3b]!=undefined){url=_1[_3b];
if(_2[_3b]!=undefined){_3d=_2[_3b];
}}else{if(_39.search(/\(\s*\)$/m)>-1){url="";
}else{return _39;
}}}url=_2e(url,"*_");
var _3e='<a href="'+url+'"';
if(_3d!=""){_3d=_3d.replace(/"/g,"&quot;");
_3d=_2e(_3d,"*_");
_3e+=' title="'+_3d+'"';
}_3e+=">"+_3a+"</a>";
return _3e;
};
var _26=function(_3f){_3f=_3f.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,_40);
_3f=_3f.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,_40);
return _3f;
};
var _40=function(_41,m1,m2,m3,m4,m5,m6,m7){var _49=m1;
var _4a=m2;
var _4b=m3.toLowerCase();
var url=m4;
var _4d=m7;
if(!_4d){_4d="";
}if(url==""){if(_4b==""){_4b=_4a.toLowerCase().replace(/ ?\n/g," ");
}url="#"+_4b;
if(_1[_4b]!=undefined){url=_1[_4b];
if(_2[_4b]!=undefined){_4d=_2[_4b];
}}else{return _49;
}}_4a=_4a.replace(/"/g,"&quot;");
url=_2e(url,"*_");
var _4e='<img src="'+url+'" alt="'+_4a+'"';
_4d=_4d.replace(/"/g,"&quot;");
_4d=_2e(_4d,"*_");
_4e+=' title="'+_4d+'"';
_4e+=" />";
return _4e;
};
var _1a=function(_4f){_4f=_4f.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(_50,m1){return _1c("<h1>"+_21(m1)+"</h1>");
});
_4f=_4f.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(_52,m1){return _1c("<h2>"+_21(m1)+"</h2>");
});
_4f=_4f.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(_54,m1,m2){var _57=m1.length;
return _1c("<h"+_57+">"+_21(m2)+"</h"+_57+">");
});
return _4f;
};
var _58;
var _1d=function(_59){_59+="~0";
var _5a=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
if(_4){_59=_59.replace(_5a,function(_5b,m1,m2){var _5e=m1;
var _5f=(m2.search(/[*+-]/g)>-1)?"ul":"ol";
_5e=_5e.replace(/\n{2,}/g,"\n\n\n");
var _60=_58(_5e);
_60=_60.replace(/\s+$/,"");
_60="<"+_5f+">"+_60+"</"+_5f+">\n";
return _60;
});
}else{_5a=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;
_59=_59.replace(_5a,function(_61,m1,m2,m3){var _65=m1;
var _66=m2;
var _67=(m3.search(/[*+-]/g)>-1)?"ul":"ol";
var _66=_66.replace(/\n{2,}/g,"\n\n\n");
var _68=_58(_66);
_68=_65+"<"+_67+">\n"+_68+"</"+_67+">\n";
return _68;
});
}_59=_59.replace(/~0/,"");
return _59;
};
_58=function(_69){_4++;
_69=_69.replace(/\n{2,}$/,"\n");
_69+="~0";
_69=_69.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(_6a,m1,m2,m3,m4){var _6f=m4;
var _70=m1;
var _71=m2;
if(_70||(_6f.search(/\n{2,}/)>-1)){_6f=_9(_72(_6f));
}else{_6f=_1d(_72(_6f));
_6f=_6f.replace(/\n$/,"");
_6f=_21(_6f);
}return"<li>"+_6f+"</li>\n";
});
_69=_69.replace(/~0/g,"");
_4--;
return _69;
};
var _1e=function(_73){_73+="~0";
_73=_73.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(_74,m1,m2){var _77=m1;
var _78=m2;
_77=_79(_72(_77));
_77=_6(_77);
_77=_77.replace(/^\n+/g,"");
_77=_77.replace(/\n+$/g,"");
_77="<pre><code>"+_77+"\n</code></pre>";
return _1c(_77)+_78;
});
_73=_73.replace(/~0/,"");
return _73;
};
var _1c=function(_7a){_7a=_7a.replace(/(^\n+|\n+$)/g,"");
return"\n\n~K"+(_3.push(_7a)-1)+"K\n\n";
};
var _23=function(_7b){_7b=_7b.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(_7c,m1,m2,m3,m4){var c=m3;
c=c.replace(/^([ \t]*)/g,"");
c=c.replace(/[ \t]*$/g,"");
c=_79(c);
return m1+"<code>"+c+"</code>";
});
return _7b;
};
var _79=function(_82){_82=_82.replace(/&/g,"&amp;");
_82=_82.replace(/</g,"&lt;");
_82=_82.replace(/>/g,"&gt;");
_82=_2e(_82,"*_{}[]\\",false);
return _82;
};
var _29=function(_83){_83=_83.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>");
_83=_83.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>");
return _83;
};
var _1f=function(_84){_84=_84.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(_85,m1){var bq=m1;
bq=bq.replace(/^[ \t]*>[ \t]?/gm,"~0");
bq=bq.replace(/~0/g,"");
bq=bq.replace(/^[ \t]+$/gm,"");
bq=_9(bq);
bq=bq.replace(/(^|\n)/g,"$1  ");
bq=bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(_88,m1){var pre=m1;
pre=pre.replace(/^  /mg,"~0");
pre=pre.replace(/~0/g,"");
return pre;
});
return _1c("<blockquote>\n"+bq+"\n</blockquote>");
});
return _84;
};
var _20=function(_8b){_8b=_8b.replace(/^\n+/g,"");
_8b=_8b.replace(/\n+$/g,"");
var _8c=_8b.split(/\n{2,}/g);
var _8d=new Array();
var end=_8c.length;
for(var i=0;
i<end;
i++){var str=_8c[i];
if(str.search(/~K(\d+)K/g)>=0){_8d.push(str);
}else{if(str.search(/\S/)>=0){str=_21(str);
str=str.replace(/^([ \t]*)/g,"<p>");
str+="</p>";
_8d.push(str);
}}}end=_8d.length;
for(var i=0;
i<end;
i++){while(_8d[i].search(/~K(\d+)K/)>=0){var _91=_3[RegExp.$1];
_91=_91.replace(/\$/g,"$$$$");
_8d[i]=_8d[i].replace(/~K\d+K/,_91);
}}return _8d.join("\n\n");
};
var _11=function(_92){_92=_92.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;");
_92=_92.replace(/<(?![a-z\/?\$!])/gi,"&lt;");
return _92;
};
var _25=function(_93){_93=_93.replace(/\\(\\)/g,_94);
_93=_93.replace(/\\([`*_{}\[\]()>#+-.!])/g,_94);
return _93;
};
var _28=function(_95){_95=_95.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>');
_95=_95.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(_96,m1){return _98(_a(m1));
});
return _95;
};
var _98=function(_99){function char2hex(ch){var _9b="0123456789ABCDEF";
var dec=ch.charCodeAt(0);
return(_9b.charAt(dec>>4)+_9b.charAt(dec&15));
}var _9d=[function(ch){return"&#"+ch.charCodeAt(0)+";";
},function(ch){return"&#x"+char2hex(ch)+";";
},function(ch){return ch;
}];
_99="mailto:"+_99;
_99=_99.replace(/./g,function(ch){if(ch=="@"){ch=_9d[Math.floor(Math.random()*2)](ch);
}else{if(ch!=":"){var r=Math.random();
ch=(r>0.9?_9d[2](ch):r>0.45?_9d[1](ch):_9d[0](ch));
}}return ch;
});
_99='<a href="'+_99+'">'+_99+"</a>";
_99=_99.replace(/">.+:/g,'">');
return _99;
};
var _a=function(_a3){_a3=_a3.replace(/~E(\d+)E/g,function(_a4,m1){var _a6=parseInt(m1);
return String.fromCharCode(_a6);
});
return _a3;
};
var _72=function(_a7){_a7=_a7.replace(/^(\t|[ ]{1,4})/gm,"~0");
_a7=_a7.replace(/~0/g,"");
return _a7;
};
var _6=function(_a8){_a8=_a8.replace(/\t(?=\t)/g,"    ");
_a8=_a8.replace(/\t/g,"~A~B");
_a8=_a8.replace(/~B(.+?)~A/g,function(_a9,m1,m2){var _ac=m1;
var _ad=4-_ac.length%4;
for(var i=0;
i<_ad;
i++){_ac+=" ";
}return _ac;
});
_a8=_a8.replace(/~A/g,"    ");
_a8=_a8.replace(/~B/g,"");
return _a8;
};
var _2e=function(_af,_b0,_b1){var _b2="(["+_b0.replace(/([\[\]\\])/g,"\\$1")+"])";
if(_b1){_b2="\\\\"+_b2;
}var _b3=new RegExp(_b2,"g");
_af=_af.replace(_b3,_94);
return _af;
};
var _94=function(_b4,m1){var _b6=m1.charCodeAt(0);
return"~E"+_b6+"E";
};
};
