/*
 * Nitobi Complete UI 1.0
 * Copyright(c) 2009, Nitobi
 * support@nitobi.com
 * 
 * http://www.nitobi.com/license
 */
if(typeof (nitobi)=="undefined"||typeof (nitobi.lang)=="undefined"){
alert("The Nitobi framework source could not be found. Is it included before any other Nitobi components?");
}
nitobi.lang.defineNs("nitobi.ui");
nitobi.ui.Scrollbar=function(){
this.uid="scroll"+nitobi.base.getUid();
};
nitobi.ui.Scrollbar.prototype.render=function(){
};
nitobi.ui.Scrollbar.prototype.attachToParent=function(_1,_2,_3){
this.UiContainer=_1;
this.element=_2||nitobi.html.getFirstChild(this.UiContainer);
if(this.element==null){
this.render();
}
this.surface=_3||nitobi.html.getFirstChild(this.element);
this.element.onclick="";
this.element.onmouseover="";
this.element.onmouseout="";
this.element.onscroll="";
nitobi.html.attachEvent(this.element,"scroll",this.scrollByUser,this);
};
nitobi.ui.Scrollbar.prototype.align=function(){
var vs=document.getElementById("vscroll"+this.uid);
var dx=-1;
if(nitobi.browser.MOZ){
dx=-3;
}
nitobi.drawing.align(vs,this.UiContainer.childNodes[0],269484288,-42,0,24,dx,false);
};
nitobi.ui.Scrollbar.prototype.scrollByUser=function(){
this.fire("ScrollByUser",this.getScrollPercent());
};
nitobi.ui.Scrollbar.prototype.setScroll=function(_6){
};
nitobi.ui.Scrollbar.prototype.getScrollPercent=function(){
};
nitobi.ui.Scrollbar.prototype.setRange=function(_7){
};
nitobi.ui.Scrollbar.prototype.getWidth=function(){
return nitobi.html.getScrollBarWidth();
};
nitobi.ui.Scrollbar.prototype.getHeight=function(){
return nitobi.html.getScrollBarWidth();
};
nitobi.ui.Scrollbar.prototype.fire=function(_8,_9){
return nitobi.event.notify(_8+this.uid,_9);
};
nitobi.ui.Scrollbar.prototype.subscribe=function(_a,_b,_c){
if(typeof (_c)=="undefined"){
_c=this;
}
return nitobi.event.subscribe(_a+this.uid,nitobi.lang.close(_c,_b));
};
nitobi.ui.VerticalScrollbar=function(){
this.uid="vscroll"+nitobi.base.getUid();
};
nitobi.lang.extend(nitobi.ui.VerticalScrollbar,nitobi.ui.Scrollbar);
nitobi.ui.VerticalScrollbar.prototype.setScrollPercent=function(_d){
this.element.scrollTop=(this.surface.offsetHeight-this.element.offsetHeight)*_d;
return false;
};
nitobi.ui.VerticalScrollbar.prototype.getScrollPercent=function(){
return (this.element.scrollTop/(this.surface.offsetHeight-this.element.offsetHeight));
};
nitobi.ui.VerticalScrollbar.prototype.setRange=function(_e){
if(_e>=0&&_e<=1){
var st=this.element.scrollTop;
this.surface.style.height=Math.floor(this.element.offsetHeight/_e)+"px";
this.element.scrollTop=st;
this.element.scrollTop=this.element.scrollTop;
}
};
nitobi.lang.defineNs("nitobi.ui");
nitobi.ui.HorizontalScrollbar=function(){
this.uid="hscroll"+nitobi.base.getUid();
};
nitobi.lang.extend(nitobi.ui.HorizontalScrollbar,nitobi.ui.Scrollbar);
nitobi.ui.HorizontalScrollbar.prototype.getScrollPercent=function(){
return (this.element.scrollLeft/(this.surface.clientWidth-this.element.clientWidth));
};
nitobi.ui.HorizontalScrollbar.prototype.setScrollPercent=function(_10){
this.element.scrollLeft=(this.surface.clientWidth-this.element.clientWidth)*_10;
return false;
};
nitobi.ui.HorizontalScrollbar.prototype.setRange=function(_11){
this.surface.style.width=Math.floor(this.element.offsetWidth/_11)+"px";
};
nitobi.lang.defineNs("nitobi.ui");
nitobi.ui.IDataBoundList=function(){
};
nitobi.ui.IDataBoundList.prototype.getGetHandler=function(){
return this.getHandler;
};
nitobi.ui.IDataBoundList.prototype.setGetHandler=function(_12){
this.column.getModel().setAttribute("GetHandler",_12);
this.getHandler=_12;
};
nitobi.ui.IDataBoundList.prototype.getDataSourceId=function(){
return this.datasourceId;
};
nitobi.ui.IDataBoundList.prototype.setDataSourceId=function(_13){
this.column.getModel().setAttribute("DatasourceId",_13);
this.datasourceId=_13;
};
nitobi.ui.IDataBoundList.prototype.getDisplayFields=function(){
return this.displayFields;
};
nitobi.ui.IDataBoundList.prototype.setDisplayFields=function(_14){
this.column.getModel().setAttribute("DisplayFields",_14);
this.displayFields=_14;
};
nitobi.ui.IDataBoundList.prototype.getValueField=function(){
return this.valueField;
};
nitobi.ui.IDataBoundList.prototype.setValueField=function(_15){
this.column.getModel().setAttribute("ValueField",_15);
this.valueField=_15;
};
nitobi.lang.defineNs("nitobi.collections");
nitobi.collections.CacheMap=function(){
this.tail=null;
this.debug=new Array();
};
nitobi.collections.CacheMap.prototype.insert=function(low,_17){
low=Number(low);
_17=Number(_17);
this.debug.push("insert("+low+","+_17+")");
var _18=new nitobi.collections.CacheNode(low,_17);
if(this.head==null){
this.debug.push("empty cache, adding first node");
this.head=_18;
this.tail=_18;
}else{
var n=this.head;
while(n!=null&&low>n.high+1){
n=n.next;
}
if(n==null){
this.debug.push("appending node to end");
this.tail.next=_18;
_18.prev=this.tail;
this.tail=_18;
}else{
this.debug.push("inserting new node before "+n.toString());
if(n.prev!=null){
_18.prev=n.prev;
n.prev.next=_18;
}
_18.next=n;
n.prev=_18;
while(_18.mergeNext()){
}
if(_18.prev==null){
this.head=_18;
}
if(_18.next==null){
this.tail=_18;
}
}
}
};
nitobi.collections.CacheMap.prototype.remove=function(low,_1b){
low=Number(low);
_1b=Number(_1b);
this.debug.push("insert("+low+","+_1b+")");
if(this.head==null){
}else{
if(_1b<this.head.low||low>this.tail.high){
return;
}
var _1c=this.head;
while(_1c!=null&&low>_1c.high){
_1c=_1c.next;
}
if(_1c==null){
this.debug.push("the range was not found");
}else{
var end=_1c;
var _1e=null;
while(end!=null&&_1b>end.high){
if((end.next!=null&&_1b<end.next.low)||end.next==null){
break;
}
_1e=end.next;
if(end!=_1c){
this.removeNode(end);
}
end=_1e;
}
if(_1c!=end){
if(_1b>=end.high){
this.removeNode(end);
}
if(low<=_1c.low){
this.removeNode(_1c);
}
}else{
if(_1c.low>=low&&_1c.high<=_1b){
this.removeNode(_1c);
return;
}else{
if(low>_1c.low&&_1b<_1c.high){
var _1f=_1c.low;
var _20=_1c.high;
this.removeNode(_1c);
this.insert(_1f,low-1);
this.insert(_1b+1,_20);
return;
}
}
}
if(end!=null&&_1b<end.high){
end.low=_1b+1;
}
if(_1c!=null&&low>_1c.low){
_1c.high=low-1;
}
}
}
};
nitobi.collections.CacheMap.prototype.gaps=function(low,_22){
var g=new Array();
var n=this.head;
if(n==null||n.low>_22||this.tail.high<low){
g.push(new nitobi.collections.Range(low,_22));
return g;
}
var _25=0;
while(n!=null&&n.high<low){
_25=n.high+1;
n=n.next;
}
if(n!=null){
do{
if(g.length==0){
if(low<n.low){
g.push(new nitobi.collections.Range(Math.max(low,_25),Math.min(n.low-1,_22)));
}
}
if(_22>n.high){
if(n.next==null||n.next.low>_22){
g.push(new nitobi.collections.Range(n.high+1,_22));
}else{
g.push(new nitobi.collections.Range(n.high+1,n.next.low-1));
}
}
n=n.next;
}while(n!=null&&n.high<_22);
}else{
g.push(new nitobi.collections.Range(this.tail.high+1,_22));
}
return g;
};
nitobi.collections.CacheMap.prototype.ranges=function(low,_27){
var g=new Array();
var n=this.head;
if(n==null||n.low>_27||this.tail.high<low){
return g;
}
while(n!=null&&n.high<low){
minLow=n.high+1;
n=n.next;
}
if(n!=null){
do{
g.push(new nitobi.collections.Range(n.low,n.high));
n=n.next;
}while(n!=null&&n.high<_27);
}
return g;
};
nitobi.collections.CacheMap.prototype.gapsString=function(low,_2b){
var gs=this.gaps(low,_2b);
var a=new Array();
for(var i=0;i<gs.length;i++){
a.push(gs[i].toString());
}
return a.join(",");
};
nitobi.collections.CacheMap.prototype.removeNode=function(_2f){
if(_2f.prev!=null){
_2f.prev.next=_2f.next;
}else{
this.head=_2f.next;
}
if(_2f.next!=null){
_2f.next.prev=_2f.prev;
}else{
this.tail=_2f.prev;
}
_2f=null;
};
nitobi.collections.CacheMap.prototype.toString=function(){
var n=this.head;
var s=new Array();
while(n!=null){
s.push(n.toString());
n=n.next;
}
return s.join(",");
};
nitobi.collections.CacheMap.prototype.flush=function(){
var _32=this.head;
while(Boolean(_32)){
var _33=_32.next;
delete (_32);
_32=_33;
}
this.head=null;
this.tail=null;
};
nitobi.collections.CacheMap.prototype.insertIntoRange=function(_34){
var n=this.head;
var inc=0;
while(n!=null){
if(_34>=n.low&&_34<=n.high){
inc=1;
n.high+=inc;
}else{
n.low+=inc;
n.high+=inc;
}
n=n.next;
}
if(inc==0){
this.insert(_34,_34);
}
};
nitobi.collections.CacheMap.prototype.removeFromRange=function(_37){
var n=this.head;
var inc=0;
while(n!=null){
if(_37>=n.low&&_37<=n.high){
inc=-1;
if(n.low==n.high){
this.remove(_37,_37);
}else{
n.high+=inc;
}
}else{
n.low+=inc;
n.high+=inc;
}
n=n.next;
}
ntbAssert(inc!=0,"Tried to remove something from a range where the range does not exist");
};
nitobi.lang.defineNs("nitobi.collections");
nitobi.collections.BlockMap=function(){
this.head=null;
this.tail=null;
this.debug=new Array();
};
nitobi.lang.extend(nitobi.collections.BlockMap,nitobi.collections.CacheMap);
nitobi.collections.BlockMap.prototype.insert=function(low,_3b){
low=Number(low);
_3b=Number(_3b);
this.debug.push("insert("+low+","+_3b+")");
if(this.head==null){
var _3c=new nitobi.collections.CacheNode(low,_3b);
this.debug.push("empty cache, adding first node");
this.head=_3c;
this.tail=_3c;
}else{
var n=this.head;
while(n!=null&&low>n.high){
n=n.next;
}
if(n==null){
var _3c=new nitobi.collections.CacheNode(low,_3b);
this.debug.push("appending node to end");
this.tail.next=_3c;
_3c.prev=this.tail;
this.tail=_3c;
}else{
this.debug.push("inserting new node into or before "+n.toString());
if(low<n.low||_3b>n.high){
if(low<n.low){
var _3c=new nitobi.collections.CacheNode(low,_3b);
_3c.prev=n.prev;
_3c.next=n;
if(n.prev!=null){
n.prev.next=_3c;
}
n.prev=_3c;
_3c.high=Math.min(_3c.high,n.low-1);
}else{
var _3c=new nitobi.collections.CacheNode(n.high+1,_3b);
_3c.prev=n;
_3c.next=n.next;
if(n.next!=null){
n.next.prev=_3c;
_3c.high=Math.min(_3b,_3c.next.low-1);
}
n.next=_3c;
}
if(_3c.prev==null){
this.head=_3c;
}
if(_3c.next==null){
this.tail=_3c;
}
}
}
}
};
nitobi.collections.BlockMap.prototype.blocks=function(low,_3f){
var g=new Array();
var n=this.head;
if(n==null||n.low>_3f||this.tail.high<low){
g.push(new nitobi.collections.Range(low,_3f));
return g;
}
var _42=0;
while(n!=null&&n.high<low){
_42=n.high+1;
n=n.next;
}
if(n!=null){
do{
if(g.length==0){
if(low<n.low){
g.push(new nitobi.collections.Range(Math.max(low,_42),Math.min(n.low-1,_3f)));
}
}
if(_3f>n.high){
if(n.next==null||n.next.low>_3f){
g.push(new nitobi.collections.Range(n.high+1,_3f));
}else{
g.push(new nitobi.collections.Range(n.high+1,n.next.low-1));
}
}
n=n.next;
}while(n!=null&&n.high<_3f);
}else{
g.push(new nitobi.collections.Range(this.tail.high+1,_3f));
}
return g;
};
nitobi.lang.defineNs("nitobi.collections");
nitobi.collections.CellSet=function(_43,_44,_45,_46,_47){
this.owner=_43;
if(_44!=null&&_45!=null&&_46!=null&&_47!=null){
this.setRange(_44,_45,_46,_47);
}else{
this.setRange(0,0,0,0);
}
};
nitobi.collections.CellSet.prototype.toString=function(){
var str="";
for(var i=this._topRow;i<=this._bottomRow;i++){
str+="[";
for(var j=this._leftColumn;j<=this._rightColumn;j++){
str+="("+i+","+j+")";
}
str+="]";
}
return str;
};
nitobi.collections.CellSet.prototype.setRange=function(_4b,_4c,_4d,_4e){
ntbAssert(_4b!=null&&_4c!=null&&_4d!=null&&_4e!=null,"nitobi.collections.CellSet.setRange requires startRow, startColumn, endRow, endColumn as integers",null,EBA_THROW);
this._startRow=_4b;
this._startColumn=_4c;
this._endRow=_4d;
this._endColumn=_4e;
this._leftColumn=Math.min(_4c,_4e);
this._rightColumn=Math.max(_4c,_4e);
this._topRow=Math.min(_4b,_4d);
this._bottomRow=Math.max(_4b,_4d);
};
nitobi.collections.CellSet.prototype.changeStartCell=function(_4f,_50){
this._startRow=_4f;
this._startColumn=_50;
this._leftColumn=Math.min(_50,this._endColumn);
this._rightColumn=Math.max(_50,this._endColumn);
this._topRow=Math.min(_4f,this._endRow);
this._bottomRow=Math.max(_4f,this._endRow);
};
nitobi.collections.CellSet.prototype.changeEndCell=function(_51,_52){
this._endRow=_51;
this._endColumn=_52;
this._leftColumn=Math.min(_52,this._startColumn);
this._rightColumn=Math.max(_52,this._startColumn);
this._topRow=Math.min(_51,this._startRow);
this._bottomRow=Math.max(_51,this._startRow);
};
nitobi.collections.CellSet.prototype.getRowCount=function(){
return this._bottomRow-this._topRow+1;
};
nitobi.collections.CellSet.prototype.getColumnCount=function(){
return this._rightColumn-this._leftColumn+1;
};
nitobi.collections.CellSet.prototype.getCoords=function(){
return {"top":new nitobi.drawing.Point(this._leftColumn,this._topRow),"bottom":new nitobi.drawing.Point(this._rightColumn,this._bottomRow)};
};
nitobi.collections.CellSet.prototype.getCellObjectByOffset=function(_53,_54){
return this.owner.getCellObject(this._topRow+_53,this._leftColumn+_54);
};
nitobi.lang.defineNs("nitobi.collections");
nitobi.collections.CacheNode=function(low,_56){
this.low=low;
this.high=_56;
this.next=null;
this.prev=null;
};
nitobi.collections.CacheNode.prototype.isIn=function(val){
return ((val>=this.low)&&(val<=this.high));
};
nitobi.collections.CacheNode.prototype.mergeNext=function(){
var _58=this.next;
if(_58!=null&&_58.low<=this.high+1){
this.high=Math.max(this.high,_58.high);
this.low=Math.min(this.low,_58.low);
var _59=_58.next;
this.next=_59;
if(_59!=null){
_59.prev=this;
}
_58.clear();
return true;
}else{
return false;
}
};
nitobi.collections.CacheNode.prototype.clear=function(){
this.next=null;
this.prev=null;
};
nitobi.collections.CacheNode.prototype.toString=function(){
return "["+this.low+","+this.high+"]";
};
nitobi.lang.defineNs("nitobi.collections");
nitobi.collections.Range=function(low,_5b){
this.low=low;
this.high=_5b;
};
nitobi.collections.Range.prototype.isIn=function(val){
return ((val>=this.low)&&(val<=this.high));
};
nitobi.collections.Range.prototype.toString=function(){
return "["+this.low+","+this.high+"]";
};
nitobi.lang.defineNs("nitobi.grid");
if(false){
nitobi.grid=function(){
};
}
nitobi.grid.PAGINGMODE_NONE="none";
nitobi.grid.PAGINGMODE_STANDARD="standard";
nitobi.grid.PAGINGMODE_LIVESCROLLING="livescrolling";
nitobi.grid.Grid=function(uid){
nitobi.prepare();
EBAAutoRender=false;
this.disposal=[];
this.uid=uid||nitobi.base.getUid();
this.modelNodes={};
this.cachedCells={};
this.configureDefaults();
if(nitobi.browser.IE6){
nitobi.html.addUnload(nitobi.lang.close(this,this.dispose));
}
this.subscribe("AttachToParent",this.initialize);
this.subscribe("DataReady",this.layout);
this.subscribe("AfterCellEdit",this.autoSave);
this.subscribe("AfterRowInsert",this.autoSave);
this.subscribe("AfterRowDelete",this.autoSave);
this.subscribe("AfterPaste",this.autoSave);
this.subscribe("AfterPaste",this.focus);
this.subscribeOnce("HtmlReady",this.adjustHorizontalScrollBars);
this.subscribe("AfterGridResize",this.adjustHorizontalScrollBars);
this.events=[];
this.scrollerEvents=[];
this.cellEvents=[];
this.headerEvents=[];
this.keyEvents=[];
};
nitobi.lang.implement(nitobi.grid.Grid,nitobi.Object);
var ntb_gridp=nitobi.grid.Grid.prototype;
nitobi.grid.Grid.prototype.properties={id:{n:"ID",t:"",d:"",p:"j"},selection:{n:"Selection",t:"",d:null,p:"j"},bound:{n:"Bound",t:"",d:false,p:"j"},registeredto:{n:"RegisteredTo",t:"",d:true,p:"j"},licensekey:{n:"LicenseKey",t:"",d:true,p:"j"},columns:{n:"Columns",t:"",d:true,p:"j"},columnsdefined:{n:"ColumnsDefined",t:"",d:false,p:"j"},declaration:{n:"Declaration",t:"",d:"",p:"j"},datasource:{n:"Datasource",t:"",d:true,p:"j"},keygenerator:{n:"KeyGenerator",t:"",d:"",p:"j"},version:{n:"Version",t:"",d:3.01,p:"j"},cellclicked:{n:"CellClicked",t:"",d:false,p:"j"},uid:{n:"uid",t:"s",d:"",p:"x"},datasourceid:{n:"DatasourceId",t:"s",d:"",p:"x"},currentpageindex:{n:"CurrentPageIndex",t:"i",d:0,p:"x"},columnindicatorsenabled:{n:"ColumnIndicatorsEnabled",t:"b",d:true,p:"x"},rowindicatorsenabled:{n:"RowIndicatorsEnabled",t:"b",d:false,p:"x"},toolbarenabled:{n:"ToolbarEnabled",t:"b",d:true,p:"x"},toolbarheight:{n:"ToolbarHeight",t:"i",d:25,p:"x"},rowhighlightenabled:{n:"RowHighlightEnabled",t:"b",d:false,p:"x"},rowselectenabled:{n:"RowSelectEnabled",t:"b",d:false,p:"x"},gridresizeenabled:{n:"GridResizeEnabled",t:"b",d:false,p:"x"},widthfixed:{n:"WidthFixed",t:"b",d:false,p:"x"},heightfixed:{n:"HeightFixed",t:"b",d:false,p:"x"},minwidth:{n:"MinWidth",t:"i",d:20,p:"x"},minheight:{n:"MinHeight",t:"i",d:0,p:"x"},singleclickeditenabled:{n:"SingleClickEditEnabled",t:"b",d:false,p:"x"},autokeyenabled:{n:"AutoKeyEnabled",t:"b",d:false,p:"x"},tooltipsenabled:{n:"ToolTipsEnabled",t:"b",d:false,p:"x"},entertab:{n:"EnterTab",t:"s",d:"down",p:"x"},hscrollbarenabled:{n:"HScrollbarEnabled",t:"b",d:true,p:"x"},vscrollbarenabled:{n:"VScrollbarEnabled",t:"b",d:true,p:"x"},rowheight:{n:"RowHeight",t:"i",d:23,p:"x"},headerheight:{n:"HeaderHeight",t:"i",d:23,p:"x"},top:{n:"top",t:"i",d:0,p:"x"},left:{n:"left",t:"i",d:0,p:"x"},scrollbarwidth:{n:"scrollbarWidth",t:"i",d:22,p:"x"},scrollbarheight:{n:"scrollbarHeight",t:"i",d:22,p:"x"},freezetop:{n:"freezetop",t:"i",d:0,p:"x"},frozenleftcolumncount:{n:"FrozenLeftColumnCount",t:"i",d:0,p:"x"},rowinsertenabled:{n:"RowInsertEnabled",t:"b",d:true,p:"x"},rowdeleteenabled:{n:"RowDeleteEnabled",t:"b",d:true,p:"x"},asynchronous:{n:"Asynchronous",t:"b",d:true,p:"x"},autosaveenabled:{n:"AutoSaveEnabled",t:"b",d:false,p:"x"},columncount:{n:"ColumnCount",t:"i",d:0,p:"x"},rowsperpage:{n:"RowsPerPage",t:"i",d:20,p:"x"},forcevalidate:{n:"ForceValidate",t:"b",d:false,p:"x"},height:{n:"Height",t:"i",d:100,p:"x"},lasterror:{n:"LastError",t:"s",d:"",p:"x"},multirowselectenabled:{n:"MultiRowSelectEnabled",t:"b",d:false,p:"x"},multirowselectfield:{n:"MultiRowSelectField",t:"s",d:"",p:"x"},multirowselectattr:{n:"MultiRowSelectAttr",t:"s",d:"",p:"x"},gethandler:{n:"GetHandler",t:"s",d:"",p:"x"},savehandler:{n:"SaveHandler",t:"s",d:"",p:"x"},width:{n:"Width",t:"i",d:"",p:"x"},pagingmode:{n:"PagingMode",t:"s",d:"LiveScrolling",p:"x"},datamode:{n:"DataMode",t:"s",d:"Caching",p:"x"},rendermode:{n:"RenderMode",t:"s",d:"",p:"x"},copyenabled:{n:"CopyEnabled",t:"b",d:true,p:"x"},pasteenabled:{n:"PasteEnabled",t:"b",d:true,p:"x"},sortenabled:{n:"SortEnabled",t:"b",d:true,p:"x"},sortmode:{n:"SortMode",t:"s",d:"default",p:"x"},editmode:{n:"EditMode",t:"b",d:false,p:"x"},expanding:{n:"Expanding",t:"b",d:false,p:"x"},theme:{n:"Theme",t:"s",d:"nitobi",p:"x"},cellborder:{n:"CellBorder",t:"i",d:0,p:"x"},cellborderheight:{n:"CellBorderHeight",t:"i",d:0,p:"x"},innercellborder:{n:"InnerCellBorder",t:"i",d:0,p:"x"},dragfillenabled:{n:"DragFillEnabled",t:"b",d:true,p:"x"},oncellclickevent:{n:"OnCellClickEvent",t:"",p:"e"},onbeforecellclickevent:{n:"OnBeforeCellClickEvent",t:"",p:"e"},oncelldblclickevent:{n:"OnCellDblClickEvent",t:"",p:"e"},ondatareadyevent:{n:"OnDataReadyEvent",t:"",p:"e"},onhtmlreadyevent:{n:"OnHtmlReadyEvent",t:"",p:"e"},ondatarenderedevent:{n:"OnDataRenderedEvent",t:"",p:"e"},oncelldoubleclickevent:{n:"OnCellDoubleClickEvent",t:"",p:"e"},onafterloaddatapageevent:{n:"OnAfterLoadDataPageEvent",t:"",p:"e"},onbeforeloaddatapageevent:{n:"OnBeforeLoadDataPageEvent",t:"",p:"e"},onafterloadpreviouspageevent:{n:"OnAfterLoadPreviousPageEvent",t:"",p:"e"},onbeforeloadpreviouspageevent:{n:"OnBeforeLoadPreviousPageEvent",t:"",p:"e"},onafterloadnextpageevent:{n:"OnAfterLoadNextPageEvent",t:"",p:"e"},onbeforeloadnextpageevent:{n:"OnBeforeLoadNextPageEvent",t:"",p:"e"},onbeforecelleditevent:{n:"OnBeforeCellEditEvent",t:"",p:"e"},onaftercelleditevent:{n:"OnAfterCellEditEvent",t:"",p:"e"},onbeforerowinsertevent:{n:"OnBeforeRowInsertEvent",t:"",p:"e"},onafterrowinsertevent:{n:"OnAfterRowInsertEvent",t:"",p:"e"},onbeforesortevent:{n:"OnBeforeSortEvent",t:"",p:"e"},onaftersortevent:{n:"OnAfterSortEvent",t:"",p:"e"},onbeforerefreshevent:{n:"OnBeforeRefreshEvent",t:"",p:"e"},onafterrefreshevent:{n:"OnAfterRefreshEvent",t:"",p:"e"},onbeforesaveevent:{n:"OnBeforeSaveEvent",t:"",p:"e"},onaftersaveevent:{n:"OnAfterSaveEvent",t:"",p:"e"},onhandlererrorevent:{n:"OnHandlerErrorEvent",t:"",p:"e"},onrowblurevent:{n:"OnRowBlurEvent",t:"",p:"e"},oncellfocusevent:{n:"OnCellFocusEvent",t:"",p:"e"},onfocusevent:{n:"OnFocusEvent",t:"",p:"e"},oncellblurevent:{n:"OnCellBlurEvent",t:"",p:"e"},onafterrowdeleteevent:{n:"OnAfterRowDeleteEvent",t:"",p:"e"},onbeforerowdeleteevent:{n:"OnBeforeRowDeleteEvent",t:"",p:"e"},oncellupdateevent:{n:"OnCellUpdateEvent",t:"",p:"e"},onrowfocusevent:{n:"OnRowFocusEvent",t:"",p:"e"},onbeforecopyevent:{n:"OnBeforeCopyEvent",t:"",p:"e"},onaftercopyevent:{n:"OnAfterCopyEvent",t:"",p:"e"},onbeforepasteevent:{n:"OnBeforePasteEvent",t:"",p:"e"},onafterpasteevent:{n:"OnAfterPasteEvent",t:"",p:"e"},onerrorevent:{n:"OnErrorEvent",t:"",p:"e"},oncontextmenuevent:{n:"OnContextMenuEvent",t:"",p:"e"},oncellvalidateevent:{n:"OnCellValidateEvent",t:"",p:"e"},onkeydownevent:{n:"OnKeyDownEvent",t:"",p:"e"},onkeyupevent:{n:"OnKeyUpEvent",t:"",p:"e"},onkeypressevent:{n:"OnKeyPressEvent",t:"",p:"e"},onmouseoverevent:{n:"OnMouseOverEvent",t:"",p:"e"},onmouseoutevent:{n:"OnMouseOutEvent",t:"",p:"e"},onmousemoveevent:{n:"OnMouseMoveEvent",t:"",p:"e"},onhitrowendevent:{n:"OnHitRowEndEvent",t:"",p:"e"},onhitrowstartevent:{n:"OnHitRowStartEvent",t:"",p:"e"},onafterdragfillevent:{n:"OnAfterDragFillEvent",t:"",p:"e"},onbeforedragfillevent:{n:"OnBeforeDragFillEvent",t:"",p:"e"},onafterresizeevent:{n:"OnAfterResizeEvent",t:"",p:"e"},onbeforeresizeevent:{n:"OnBeforeResizeEvent",t:"",p:"e"}};
nitobi.grid.Grid.prototype.xColumnProperties={column:{align:{n:"Align",t:"s",d:"left"},headeralign:{n:"HeaderAlign",t:"s",d:"left"},classname:{n:"ClassName",t:"s",d:""},cssstyle:{n:"CssStyle",t:"s",d:""},columnname:{n:"ColumnName",t:"s",d:""},type:{n:"Type",t:"s",d:"text"},datatype:{n:"DataType",t:"s",d:"text"},editable:{n:"Editable",t:"b",d:true},initial:{n:"Initial",t:"s",d:""},label:{n:"Label",t:"s",d:""},gethandler:{n:"GetHandler",t:"s",d:""},datasource:{n:"DataSource",t:"s",d:""},template:{n:"Template",t:"s",d:""},templateurl:{n:"TemplateUrl",t:"s",d:""},maxlength:{n:"MaxLength",t:"i",d:255},sortdirection:{n:"SortDirection",t:"s",d:"Desc"},sortenabled:{n:"SortEnabled",t:"b",d:true},width:{n:"Width",t:"i",d:100},visible:{n:"Visible",t:"b",d:true},xdatafld:{n:"xdatafld",t:"s",d:""},value:{n:"Value",t:"s",d:""},wrap:{n:"Wrap",t:"b",d:false},hidden:{n:"Hidden",t:"b",d:false},xi:{n:"xi",t:"i",d:100},oncellclickevent:{n:"OnCellClickEvent"},onbeforecellclickevent:{n:"OnBeforeCellClickEvent"},oncelldblclickevent:{n:"OnCellDblClickEvent"},onheaderdoubleclickevent:{n:"OnHeaderDoubleClickEvent"},onheaderclickevent:{n:"OnHeaderClickEvent"},onbeforeresizeevent:{n:"OnBeforeResizeEvent"},onafterresizeevent:{n:"OnAfterResizeEvent"},oncellvalidateevent:{n:"OnCellValidateEvent"},onbeforecelleditevent:{n:"OnBeforeCellEditEvent"},onaftercelleditevent:{n:"OnAfterCellEditEvent"},oncellblurevent:{n:"OnCellBlurEvent"},oncellfocusevent:{n:"OnCellFocusEvent"},onbeforesortevent:{n:"OnBeforeSortEvent"},onaftersortevent:{n:"OnAfterSortEvent"},oncellupdateevent:{n:"OnCellUpdateEvent"},onkeydownevent:{n:"OnKeyDownEvent"},onkeyupevent:{n:"OnKeyUpEvent"},onkeypressevent:{n:"OnKeyPressEvent"},onchangeevent:{n:"OnChangeEvent"}},textcolumn:{},numbercolumn:{align:{n:"Align",t:"s",d:"right"},headeralign:{n:"HeaderAlign",t:"s",d:"right"},mask:{n:"Mask",t:"s",d:"#,###.00"},negativemask:{n:"NegativeMask",t:"s",d:""},groupingseparator:{n:"GroupingSeparator",t:"s",d:","},decimalseparator:{n:"DecimalSeparator",t:"s",d:"."},onkeydownevent:{n:"OnKeyDownEvent"},onkeyupevent:{n:"OnKeyUpEvent"},onkeypressevent:{n:"OnKeyPressEvent"},onchangeevent:{n:"OnChangeEvent"}},datecolumn:{mask:{n:"Mask",t:"s",d:"M/d/yyyy"},calendarenabled:{n:"CalendarEnabled",t:"b",d:true}},listboxeditor:{datasourceid:{n:"DatasourceId",t:"s",d:""},datasource:{n:"Datasource",t:"s",d:""},gethandler:{n:"GetHandler",t:"s",d:""},displayfields:{n:"DisplayFields",t:"s",d:""},valuefield:{n:"ValueField",t:"s",d:""},onkeydownevent:{n:"OnKeyDownEvent"},onkeyupevent:{n:"OnKeyUpEvent"},onkeypressevent:{n:"OnKeyPressEvent"},onchangeevent:{n:"OnChangeEvent"}},lookupeditor:{datasourceid:{n:"DatasourceId",t:"s",d:""},datasource:{n:"Datasource",t:"s",d:""},gethandler:{n:"GetHandler",t:"s",d:""},displayfields:{n:"DisplayFields",t:"s",d:""},valuefield:{n:"ValueField",t:"s",d:""},delay:{n:"Delay",t:"s",d:""},size:{n:"Size",t:"s",d:6},onkeydownevent:{n:"OnKeyDownEvent"},onkeyupevent:{n:"OnKeyUpEvent"},onkeypressevent:{n:"OnKeyPressEvent"},onchangeevent:{n:"OnChangeEvent"},forcevalidoption:{n:"ForceValidOption",t:"b",d:false},autocomplete:{n:"AutoComplete",t:"b",d:true},autoclear:{n:"AutoClear",t:"b",d:false},getonenter:{n:"GetOnEnter",t:"b",d:false},referencecolumn:{n:"ReferenceColumn",t:"s",d:""}},checkboxeditor:{datasourceid:{n:"DatasourceId",t:"s",d:""},datasource:{n:"Datasource",t:"s",d:""},gethandler:{n:"GetHandler",t:"s",d:""},displayfields:{n:"DisplayFields",t:"s",d:""},valuefield:{n:"ValueField",t:"s",d:""},checkedvalue:{n:"CheckedValue",t:"s",d:""},uncheckedvalue:{n:"UnCheckedValue",t:"s",d:""}},linkeditor:{openwindow:{n:"OpenWindow",t:"b",d:true}},texteditor:{maxlength:{n:"MaxLength",t:"i",d:255},onkeydownevent:{n:"OnKeyDownEvent"},onkeyupevent:{n:"OnKeyUpEvent"},onkeypressevent:{n:"OnKeyPressEvent"},onchangeevent:{n:"OnChangeEvent"}},numbereditor:{onkeydownevent:{n:"OnKeyDownEvent"},onkeyupevent:{n:"OnKeyUpEvent"},onkeypressevent:{n:"OnKeyPressEvent"},onchangeevent:{n:"OnChangeEvent"}},textareaeditor:{maxlength:{n:"MaxLength",t:"i",d:255},onkeydownevent:{n:"OnKeyDownEvent"},onkeyupevent:{n:"OnKeyUpEvent"},onkeypressevent:{n:"OnKeyPressEvent"},onchangeevent:{n:"OnChangeEvent"}},dateeditor:{mask:{n:"Mask",t:"s",d:"M/d/yyyy"},calendarenabled:{n:"CalendarEnabled",t:"b",d:true},onkeydownevent:{n:"OnKeyDownEvent"},onkeyupevent:{n:"OnKeyUpEvent"},onkeypressevent:{n:"OnKeyPressEvent"},onchangeevent:{n:"OnChangeEvent"}},imageeditor:{imageurl:{n:"ImageUrl",t:"s",d:""}},passwordeditor:{}};
nitobi.grid.Grid.prototype.typeAccessorCreators={s:function(){
},b:function(){
},i:function(){
},n:function(){
}};
nitobi.grid.Grid.prototype.createAccessors=function(_5e){
var _5f=nitobi.grid.Grid.prototype.properties[_5e];
nitobi.grid.Grid.prototype["set"+_5f.n]=function(){
this[_5f.p+_5f.t+"SET"](_5f.n,arguments);
};
nitobi.grid.Grid.prototype["get"+_5f.n]=function(){
return this[_5f.p+_5f.t+"GET"](_5f.n,arguments);
};
nitobi.grid.Grid.prototype["is"+_5f.n]=function(){
return this[_5f.p+_5f.t+"GET"](_5f.n,arguments);
};
nitobi.grid.Grid.prototype[_5f.n]=_5f.d;
};
for(var name in nitobi.grid.Grid.prototype.properties){
nitobi.grid.Grid.prototype.createAccessors(name);
}
nitobi.grid.Grid.prototype.initialize=function(){
this.fire("Preinitialize");
this.initializeFromCss();
this.createChildren();
this.fire("AfterInitialize");
this.fire("CreationComplete");
};
nitobi.grid.Grid.prototype.initializeFromCss=function(){
this.CellHoverColor=this.getThemedStyle("ntb-cell-hover","backgroundColor")||"#6699CC";
this.RowHoverColor=this.getThemedStyle("ntb-row-hover","backgroundColor")||"#FFFFC0";
this.CellActiveColor=this.getThemedStyle("ntb-cell-active","backgroundColor")||"#DDD9D5";
this.RowActiveColor=this.getThemedStyle("ntb-row-active","backgroundColor")||"#DDD9D5";
var _60=this.getThemedStyle("ntb-row","height");
if(_60!=null&&_60!=""){
this.setRowHeight(parseInt(_60));
}
var _61=this.getThemedStyle("ntb-grid-header","height");
if(_61!=null&&_61!=""){
this.setHeaderHeight(parseInt(_61));
}
if(nitobi.browser.IE&&nitobi.lang.isStandards()){
var _62=this.getThemedClass("ntb-cell-border");
if(_62!=null){
this.setCellBorder(parseInt(_62.borderLeftWidth+0)+parseInt(_62.borderRightWidth+0)+parseInt(_62.paddingLeft+0)+parseInt(_62.paddingRight+0));
}
}
var _62=this.getThemedClass("ntb-cell-border");
if(_62!=null){
this.setCellBorder(parseInt(_62.borderTopWidth+0)+parseInt(_62.borderBottomWidth+0)+parseInt(_62.paddingTop+0)+parseInt(_62.paddingBottom+0));
}
if(nitobi.browser.MOZ){
var _62=this.getThemedClass("ntb-cell");
if(_62!=null){
this.setInnerCellBorder(parseInt(_62.borderLeftWidth+0)+parseInt(_62.borderRightWidth+0)+parseInt(_62.paddingLeft+0)+parseInt(_62.paddingRight+0));
}
}
};
nitobi.grid.Grid.prototype.getThemedClass=function(_63){
var C=nitobi.html.Css;
var r=C.getRule("."+this.getTheme()+" ."+_63)||C.getRule("."+_63);
var ret=null;
if(r!=null&&r.style!=null){
ret=r.style;
}
return ret;
};
nitobi.grid.Grid.prototype.getThemedStyle=function(_67,_68){
return nitobi.html.Css.getClassStyle("."+this.getTheme()+" ."+_67,_68);
};
nitobi.grid.Grid.prototype.connectRenderersToDataSet=function(_69){
this.TopLeftRenderer.xmlDataSource=_69;
this.TopCenterRenderer.xmlDataSource=_69;
this.MidLeftRenderer.xmlDataSource=_69;
this.MidCenterRenderer.xmlDataSource=_69;
};
nitobi.grid.Grid.prototype.connectToDataSet=function(_6a,_6b){
this.data=_6a;
if(this.TopLeftRenderer){
this.connectRenderersToDataSet(_6a);
}
this.connectToTable(_6b);
};
nitobi.grid.Grid.prototype.connectToTable=function(_6c){
if(typeof (_6c)=="string"){
this.datatable=this.data.getTable(_6c);
}else{
if(typeof (_6c)=="object"){
this.datatable=_6c;
}else{
if(this.data.getTable("_default")+""!="undefined"){
this.datatable=this.data.getTable("_default");
}else{
return false;
}
}
}
this.connected=true;
this.updateStructure();
var dt=this.datatable;
var L=nitobi.lang;
dt.subscribe("DataReady",L.close(this,this.handleHandlerError));
dt.subscribe("DataReady",L.close(this,this.syncWithData));
dt.subscribe("DataSorted",L.close(this,this.syncWithData));
dt.subscribe("RowInserted",L.close(this,this.syncWithData));
dt.subscribe("RowDeleted",L.close(this,this.syncWithData));
dt.subscribe("RowCountChanged",L.close(this,this.setRowCount));
dt.subscribe("PastEndOfData",L.close(this,this.adjustRowCount));
dt.subscribe("RowCountKnown",L.close(this,this.finalizeRowCount));
dt.subscribe("StructureChanged",L.close(this,this.updateStructure));
dt.subscribe("ColumnsInitialized",L.close(this,this.updateStructure));
this.dataTableId=this.datatable.id;
this.datatable.setOnGenerateKey(this.getKeyGenerator());
this.fire("TableConnected",this.datatable);
return true;
};
nitobi.grid.Grid.prototype.ensureConnected=function(){
if(this.data==null){
this.data=new nitobi.data.DataSet();
this.data.initialize();
this.datatable=new nitobi.data.DataTable(this.getDataMode(),this.getPagingMode()==nitobi.grid.PAGINGMODE_LIVESCROLLING,{GridId:this.getID()},{GridId:this.getID()},this.isAutoKeyEnabled());
this.datatable.initialize("_default",this.getGetHandler(),this.getSaveHandler());
this.data.add(this.datatable);
this.connectToDataSet(this.data);
}
if(this.datatable==null){
this.datatable=this.data.getTable("_default");
if(this.datatable==null){
this.datatable=new nitobi.data.DataTable(this.getDataMode(),this.getPagingMode()==nitobi.grid.PAGINGMODE_LIVESCROLLING,{GridId:this.getID()},{GridId:this.getID()},this.isAutoKeyEnabled());
this.datatable.initialize("_default",this.getGetHandler(),this.getSaveHandler());
this.data.add(this.datatable);
}
this.connectToDataSet(this.data);
}
this.connected=true;
};
nitobi.grid.Grid.prototype.updateStructure=function(){
if(this.inferredColumns){
this.defineColumns(this.datatable);
}
this.mapColumns();
if(this.TopLeftRenderer){
this.defineColumnBindings();
this.defineColumnsFinalize();
}
};
nitobi.grid.Grid.prototype.mapColumns=function(){
this.fieldMap=this.datatable.fieldMap;
};
nitobi.grid.Grid.prototype.configureDefaults=function(){
this.initializeModel();
this.displayedFirstRow=0;
this.displayedRowCount=0;
this.localFilter=null;
this.columns=[];
this.fieldMap={};
this.frameRendered=false;
this.connected=false;
this.inferredColumns=true;
this.selectedRows=[];
this.minHeight=20;
this.minWidth=20;
this.setRowCount(0);
this.layoutValid=false;
this.oldVersion=false;
this.frameCssXslProc=nitobi.grid.frameCssXslProc;
this.frameXslProc=nitobi.grid.frameXslProc;
};
nitobi.grid.Grid.prototype.attachDomEvents=function(){
ntbAssert(this.UiContainer!=null&&nitobi.html.getFirstChild(this.UiContainer)!=null,"The Grid has not been attached to the DOM yet using attachToDom method. Therefore, attachDomEvents cannot proceed.",null,EBA_THROW);
var _6f=this.getGridContainer();
var he=this.headerEvents;
he.push({type:"mousedown",handler:this.handleHeaderMouseDown});
he.push({type:"mouseup",handler:this.handleHeaderMouseUp});
he.push({type:"mousemove",handler:this.handleHeaderMouseMove});
nitobi.html.attachEvents(this.getHeaderContainer(),he,this);
var ce=this.cellEvents;
ce.push({type:"mousedown",handler:this.handleCellMouseDown});
ce.push({type:"mousemove",handler:this.handleCellMouseMove});
nitobi.html.attachEvents(this.getDataContainer(),ce,this);
var ge=this.events;
ge.push({type:"contextmenu",handler:this.handleContextMenu});
ge.push({type:"mousedown",handler:this.handleMouseDown});
ge.push({type:"mouseup",handler:this.handleMouseUp});
ge.push({type:"mousemove",handler:this.handleMouseMove});
ge.push({type:"mouseout",handler:this.handleMouseOut});
ge.push({type:"mouseover",handler:this.handleMouseOver});
if(!nitobi.browser.MOZ){
ge.push({type:"mousewheel",handler:this.handleMouseWheel});
}else{
nitobi.html.attachEvent($ntb("vscrollclip"+this.uid),"mousedown",this.focus,this);
nitobi.html.attachEvent($ntb("hscrollclip"+this.uid),"mousedown",this.focus,this);
ge.push({type:"DOMMouseScroll",handler:this.handleMouseWheel});
}
nitobi.html.attachEvents(_6f,ge,this,false);
if(nitobi.browser.IE){
_6f.onselectstart=function(){
var id=window.event.srcElement.id;
if(id.indexOf("selectbox")==0||id.indexOf("cell")==0){
return false;
}
};
}
if(nitobi.browser.IE){
this.keyNav=this.getScrollerContainer();
}else{
this.keyNav=$ntb("ntb-grid-keynav"+this.uid);
}
this.keyEvents=[{type:"keydown",handler:this.handleKey},{type:"keyup",handler:this.handleKeyUp},{type:"keypress",handler:this.handleKeyPress}];
nitobi.html.attachEvents(this.keyNav,this.keyEvents,this);
var _74=$ntb("ntb-grid-resizeright"+this.uid);
var _75=$ntb("ntb-grid-resizebottom"+this.uid);
if(_74!=null){
nitobi.html.attachEvent(_74,"mousedown",this.beforeResize,this);
nitobi.html.attachEvent(_75,"mousedown",this.beforeResize,this);
}
};
nitobi.grid.Grid.prototype.hoverCell=function(_76){
var h=this.hovered;
if(h){
var hs=h.style;
if(hs.backgroundColor==this.CellHoverColor){
hs.backgroundColor=this.hoveredbg;
}
}
if(_76==null||_76==this.activeCell){
return;
}
var cs=_76.style;
this.hoveredbg=cs.backgroundColor;
this.hovered=_76;
cs.backgroundColor=this.CellHoverColor;
};
nitobi.grid.Grid.prototype.hoverRow=function(row){
if(!this.isRowHighlightEnabled()){
return;
}
var C=nitobi.html.Css;
if(this.leftrowhovered&&this.leftrowhovered!=this.leftActiveRow){
this.leftrowhovered.style.backgroundColor=this.leftrowhoveredbg;
}
if(this.midrowhovered&&this.midrowhovered!=this.midActiveRow){
this.midrowhovered.style.backgroundColor=this.midrowhoveredbg;
}
if(row==this.activeRow||row==null){
return;
}
var _7c=-1;
var _7d=nitobi.html.getFirstChild(row);
var _7e=nitobi.grid.Row.getRowNumber(row);
var _7f=nitobi.grid.Row.getRowElements(this,_7e);
if(_7f.left!=null&&_7f.left!=this.leftActiveRow){
this.leftrowhoveredbg=_7f.left.style.backgroundColor;
this.leftrowhovered=_7f.left;
_7f.left.style.backgroundColor=this.RowHoverColor;
}
if(_7f.mid!=null&&_7f.mid!=this.midActiveRow){
this.midrowhoveredbg=_7f.mid.style.backgroundColor;
this.midrowhovered=_7f.mid;
_7f.mid.style.backgroundColor=this.RowHoverColor;
}
};
nitobi.grid.Grid.prototype.clearHover=function(){
this.hoverCell();
this.hoverRow();
};
nitobi.grid.Grid.prototype.handleMouseOver=function(evt){
this.fire("MouseOver",evt);
};
nitobi.grid.Grid.prototype.handleMouseOut=function(evt){
this.clearHover();
this.fire("MouseOut",evt);
};
nitobi.grid.Grid.prototype.handleMouseDown=function(evt){
};
nitobi.grid.Grid.prototype.handleHeaderMouseDown=function(evt){
var _84=this.findActiveCell(evt.srcElement);
if(_84==null){
return;
}
var _85=nitobi.grid.Cell.getColumnNumber(_84);
if(this.headerResizeHover(evt,_84)){
var col=this.getColumnObject(_85);
var _87=new nitobi.grid.OnBeforeColumnResizeEventArgs(this,col);
if(!nitobi.event.evaluate(col.getOnBeforeResizeEvent(),_87)){
return;
}
this.columnResizer.startResize(this,_85,_84,evt);
return false;
}else{
this.dragDropColumn.pickUp(this,_85,_84,evt);
this.fire("HeaderDown",_85);
}
};
nitobi.grid.Grid.prototype.handleCellMouseDown=function(evt){
var _89=this.findActiveCell(evt.srcElement)||this.activeCell;
if(_89==null){
return;
}
if(!evt.shiftKey){
var _8a=this.getSelectedColumnObject();
var _8b=new nitobi.grid.OnCellClickEventArgs(this,this.getSelectedCellObject());
if(!this.fire("BeforeCellClick",_8b)||(!!_8a&&!nitobi.event.evaluate(_8a.getOnBeforeCellClickEvent(),_8b))){
return;
}
this.waitt=true;
this.setCellClicked(true);
this.setActiveCell(_89,evt.ctrlKey||evt.metaKey);
if(this.waitt==true){
this.selection.selecting=true;
}
var _8a=this.getSelectedColumnObject();
var _8b=new nitobi.grid.OnCellClickEventArgs(this,this.getSelectedCellObject());
this.fire("CellClick",_8b);
if(!!_8a){
nitobi.event.evaluate(_8a.getOnCellClickEvent(),_8b);
}
}
};
nitobi.grid.Grid.prototype.handleMouseUp=function(_8c){
if(this.selection.selected()){
this.getSelection().handleSelectionMouseUp(_8c);
}
};
nitobi.grid.Grid.prototype.handleHeaderMouseUp=function(evt){
var _8e=this.findActiveCell(evt.srcElement);
if(!_8e){
this.focus();
return;
}
var _8f=parseInt(_8e.getAttribute("col"));
var _90=this.headerResizeHover(evt,_8e);
this.fire("HeaderUp",_8f);
};
nitobi.grid.Grid.prototype.handleMouseMove=function(evt){
this.fire("MouseMove",evt);
};
nitobi.grid.Grid.prototype.handleHeaderMouseMove=function(evt){
var _93=this.findActiveCell(evt.srcElement);
if(_93==null){
return;
}
if(this.headerResizeHover(evt,_93)){
_93.style.cursor="w-resize";
}else{
(nitobi.browser.IE?_93.style.cursor="hand":_93.style.cursor="pointer");
}
};
nitobi.grid.Grid.prototype.headerResizeHover=function(evt,_95){
var x=evt.clientX;
var _97=nitobi.html.getBoundingClientRect(_95,0,(nitobi.grid.Cell.getColumnNumber(_95)>this.getFrozenLeftColumnCount()?this.scroller.getScrollLeft():0));
return (x<_97.right&&x>_97.right-10);
};
nitobi.grid.Grid.prototype.handleHeaderMouseOver=function(e){
e.className=e.className.replace(/(ntb-column-indicator-border)(.*?)(\s|$)/g,function(){
return arguments[1]+arguments[2]+"hover ";
});
};
nitobi.grid.Grid.prototype.handleHeaderMouseOut=function(e){
e.className=e.className.replace(/(ntb-column-indicator-border)(.*?)(\s|$)/g,function(){
return arguments[0].replace("hover","");
});
};
nitobi.grid.Grid.prototype.handleCellMouseMove=function(evt){
this.setCellClicked(false);
var _9b=this.findActiveCell(evt.srcElement);
if(_9b==null){
return;
}
var sel=this.selection;
if(sel.selecting){
var _9d=evt.button;
var _9e=nitobi.html.getEventCoords(evt);
var x=_9e.x,y=_9e.y;
if(nitobi.browser.IE){
x=evt.clientX,y=evt.clientY;
}
if(_9d==1||(_9d==0&&!nitobi.browser.IE)){
if(!sel.expanding){
sel.redraw(_9b);
}else{
var _a1=sel.expandStartCoords;
var _a2=0;
if(x>_a1.right){
_a2=Math.abs(x-_a1.right);
}else{
if(x<_a1.left){
_a2=Math.abs(x-_a1.left);
}
}
var _a3=0;
if(y>_a1.bottom){
_a3=Math.abs(y-_a1.bottom);
}else{
if(y<_a1.top){
_a3=Math.abs(y-_a1.top);
}
}
if(_a3>_a2){
expandDir="vert";
}else{
expandDir="horiz";
}
sel.expand(_9b,expandDir);
}
this.ensureCellInView(_9b);
}else{
this.selection.selecting=false;
}
}else{
this.hoverCell(_9b);
this.hoverRow(_9b.parentNode);
}
};
nitobi.grid.Grid.prototype.handleMouseWheel=function(_a4){
this.focus();
var _a5=0;
if(_a4.wheelDelta){
_a5=_a4.wheelDelta/120;
}else{
if(_a4.detail){
_a5=-_a4.detail/3;
}
}
this.scrollVerticalRelative(-20*_a5);
nitobi.html.cancelEvent(_a4);
};
nitobi.grid.Grid.prototype.setActiveCell=function(_a6,_a7){
if(!_a6){
return;
}
this.blurActiveCell(this.activeCell);
this.focus();
this.activateCell(_a6);
var _a8=this.activeColumnObject;
this.selection.collapse(this.activeCell);
if(!this.isCellClicked()){
this.ensureCellInView(this.activeCell);
this.setCellClicked(false);
}
var row=_a6.parentNode;
this.setActiveRow(row,_a7);
var _aa=new nitobi.grid.OnCellFocusEventArgs(this,this.getSelectedCellObject());
this.fire("CellFocus",_aa);
if(!!_a8){
nitobi.event.evaluate(_a8.getOnCellFocusEvent(),_aa);
}
};
nitobi.grid.Grid.prototype.activateCell=function(_ab){
this.activeCell=_ab;
this.activeCellObject=new nitobi.grid.Cell(this,_ab);
this.activeColumnObject=this.getSelectedColumnObject();
};
nitobi.grid.Grid.prototype.blurActiveCell=function(_ac){
this.oldCell=_ac;
var _ad=this.activeColumnObject;
var _ae=new nitobi.grid.OnCellBlurEventArgs(this,this.getSelectedCellObject());
if(!!_ad){
if(!this.fire("CellBlur",_ae)||!nitobi.event.evaluate(_ad.getOnCellBlurEvent(),_ae)){
return;
}
}
};
nitobi.grid.Grid.prototype.getRowNodes=function(row){
return nitobi.grid.Row.getRowElements(this,nitobi.grid.Row.getRowNumber(row));
};
nitobi.grid.Grid.prototype.setActiveRow=function(row,_b1){
var Row=nitobi.grid.Row;
var _b3=Row.getRowNumber(row);
var _b4=-1;
if(this.oldCell!=null){
_b4=Row.getRowNumber(this.oldCell);
}
if(this.selectedRows[0]!=null){
_b4=Row.getRowNumber(this.selectedRows[0]);
}
if(!_b1||!this.isMultiRowSelectEnabled()){
if(_b3!=_b4&&_b4!=-1){
var _b5=new nitobi.grid.OnRowBlurEventArgs(this,this.getRowObject(_b4));
if(!this.fire("RowBlur",_b5)||!nitobi.event.evaluate(this.getOnRowBlurEvent(),_b5)){
return;
}
}
this.clearActiveRows();
}
if(this.isRowSelectEnabled()){
var _b6=Row.getRowElements(this,_b3);
this.midActiveRow=_b6.mid;
this.leftActiveRow=_b6.left;
if(row.getAttribute("select")=="1"){
this.clearActiveRow(row);
}else{
this.selectedRows.push(row);
if(this.leftActiveRow!=null){
this.leftActiveRow.setAttribute("select","1");
this.applyRowStyle(this.leftActiveRow);
}
if(this.midActiveRow!=null){
this.midActiveRow.setAttribute("select","1");
this.applyRowStyle(this.midActiveRow);
}
}
}
if(_b3!=_b4){
var _b7=new nitobi.grid.OnRowFocusEventArgs(this,this.getRowObject(_b3));
this.fire("RowFocus",_b7);
nitobi.event.evaluate(this.getOnRowFocusEvent(),_b7);
}
};
nitobi.grid.Grid.prototype.getSelectedRows=function(){
return this.selectedRows;
};
nitobi.grid.Grid.prototype.clearActiveRows=function(){
for(var i=0;i<this.selectedRows.length;i++){
var row=this.selectedRows[i];
this.clearActiveRow(row);
}
this.selectedRows=[];
};
nitobi.grid.Grid.prototype.selectAllRows=function(){
this.clearActiveRows();
for(var i=0;i<this.getDisplayedRowCount();i++){
var _bb=this.getCellElement(i,0);
if(_bb!=null){
var row=_bb.parentNode;
this.setActiveRow(row,true);
}
}
return this.selectedRows;
};
nitobi.grid.Grid.prototype.clearActiveRow=function(row){
var _be=nitobi.grid.Row.getRowNumber(row);
var _bf=nitobi.grid.Row.getRowElements(this,_be);
if(_bf.left!=null){
_bf.left.removeAttribute("select");
this.removeRowStyle(_bf.left);
}
if(_bf.mid!=null){
_bf.mid.removeAttribute("select");
this.removeRowStyle(_bf.mid);
}
};
nitobi.grid.Grid.prototype.applyCellStyle=function(_c0){
if(_c0==null){
return;
}
_c0.style.background=this.CellActiveColor;
};
nitobi.grid.Grid.prototype.removeCellStyle=function(_c1){
if(_c1==null){
return;
}
_c1.style.background="";
};
nitobi.grid.Grid.prototype.applyRowStyle=function(row){
if(row==null){
return;
}
row.style.background=this.RowActiveColor;
};
nitobi.grid.Grid.prototype.removeRowStyle=function(row){
if(row==null){
return;
}
row.style.background="";
};
nitobi.grid.Grid.prototype.findActiveCell=function(_c4){
var _c5=5;
_c4==null;
for(var i=0;i<_c5&&_c4.getAttribute;i++){
var t=_c4.getAttribute("ebatype");
if(t=="cell"||t=="columnheader"){
return _c4;
}
_c4=_c4.parentNode;
}
return null;
};
nitobi.grid.Grid.prototype.attachToParentDomElement=function(_c8){
this.UiContainer=_c8;
this.fire("AttachToParent");
};
nitobi.grid.Grid.prototype.getToolbars=function(){
return this.toolbars;
};
nitobi.grid.Grid.prototype.adjustHorizontalScrollBars=function(){
var _c9=this.calculateWidth();
var _ca=$ntb("ntb-grid-hscrollshow"+this.uid);
var C=nitobi.html.Css;
var _cc=parseInt(C.getStyle(this.getScrollSurface(),"width"));
if((_c9<=_cc)){
_ca.style.display="none";
}else{
_ca.style.display="block";
this.resizeScroller();
var _cd=_cc/_c9;
this.hScrollbar.setRange(_cd);
}
};
nitobi.grid.Grid.prototype.createChildren=function(){
var L=nitobi.lang;
ntbAssert((this.UiContainer!=null),"Grid must have a UI Container");
if(this.UiContainer!=null&&this.getGridContainer()==null){
this.renderFrame();
}
this.generateFrameCss();
var ls=this.loadingScreen=new nitobi.grid.LoadingScreen(this);
this.subscribe("Preinitialize",L.close(ls,ls.show));
this.subscribe("HtmlReady",L.close(ls,ls.hide));
this.subscribe("AfterGridResize",L.close(ls,ls.resize));
ls.initialize();
if(nitobi.browser.IE7&&nitobi.lang.isStandards()){
ls.attachToElement($ntb("grid"+this.uid));
}else{
ls.attachToElement($ntb("ntb-grid-overlay"+this.uid));
}
ls.show();
var cr=new nitobi.grid.ColumnResizer(this);
cr.onAfterResize.subscribe(L.close(this,this.afterColumnResize));
this.columnResizer=cr;
var db=new nitobi.grid.DragDropColumn(this);
db.onAfterDragDrop.subscribe(L.close(this,this.afterDragDropColumn));
this.dragDropColumn=db;
var gr=new nitobi.grid.GridResizer(this);
gr.widthFixed=this.isWidthFixed();
gr.heightFixed=this.isHeightFixed();
gr.minWidth=this.getMinWidth();
gr.minHeight=Math.max(this.getMinHeight(),(this.getHeaderHeight()+this.getscrollbarHeight()));
gr.onAfterResize.subscribe(L.close(this,this.afterResize));
this.gridResizer=gr;
var sc=this.Scroller=this.scroller=new nitobi.grid.Scroller3x3(this,this.getHeight(),this.getDisplayedRowCount(),this.getColumnCount(),this.getfreezetop(),this.getFrozenLeftColumnCount());
sc.setRowHeight(this.getRowHeight());
sc.setHeaderHeight(this.getHeaderHeight());
this.populateColumnList();
sc.onHtmlReady.subscribe(this.handleHtmlReady,this);
this.subscribe("TableConnected",L.close(sc,sc.setDataTable));
sc.setDataTable(this.datatable);
this.initializeSelection();
this.createRenderers();
var sv=this.Scroller.view;
sv.midleft.rowRenderer=this.MidLeftRenderer;
sv.midcenter.rowRenderer=this.MidCenterRenderer;
sv.topleft.rowRenderer=this.TopLeftRenderer;
sv.topcenter.rowRenderer=this.TopCenterRenderer;
this.mapToHtml();
var vs=this.vScrollbar=new nitobi.ui.VerticalScrollbar();
vs.attachToParent(this.element,$ntb("vscroll"+this.uid));
vs.subscribe("ScrollByUser",L.close(this,this.scrollVertical));
this.subscribe("PercentHeightChanged",L.close(vs,vs.setRange));
this.subscribe("ScrollVertical",L.close(vs,vs.setScrollPercent));
this.setscrollbarWidth(vs.getWidth());
var hs=this.hScrollbar=new nitobi.ui.HorizontalScrollbar();
hs.attachToParent(this.element,$ntb("hscroll"+this.uid));
hs.subscribe("ScrollByUser",L.close(this,this.scrollHorizontal));
this.subscribe("PercentWidthChanged",L.close(hs,hs.setRange));
this.subscribe("ScrollHorizontal",L.close(hs,hs.setScrollPercent));
this.setscrollbarHeight(hs.getHeight());
};
nitobi.grid.Grid.prototype.createToolbars=function(_d7){
var tb=this.toolbars=new nitobi.ui.Toolbars(this,(this.isToolbarEnabled()?_d7:0));
var _d9=document.getElementById("toolbarContainer"+this.uid);
tb.setWidth(this.getWidth());
tb.setHeight(this.getToolbarHeight());
tb.setRowInsertEnabled(this.isRowInsertEnabled());
tb.setRowDeleteEnabled(this.isRowDeleteEnabled());
tb.attachToParent(_d9);
var L=nitobi.lang;
tb.subscribe("InsertRow",L.close(this,this.insertAfterCurrentRow));
tb.subscribe("DeleteRow",L.close(this,this.deleteCurrentRow));
tb.subscribe("Save",L.close(this,this.save));
tb.subscribe("Refresh",L.close(this,this.refresh));
this.subscribe("AfterGridResize",L.close(this,this.resizeToolbars));
};
nitobi.grid.Grid.prototype.populateColumnList=function(){
var uid=this.uid;
var _dc=$ntb("ntb-grid-showhide"+uid);
var _dd=$ntb("ntb-grid-colcheck"+uid);
var _de=this.getColumnCount();
for(var i=0;i<_de;++i){
var hdr=this.getColumnObject(i);
if(hdr.getHidden()=="0"){
var _e1=hdr.getLabel();
var _e2=document.createElement("li");
var id="ntb-hidecol_"+i+"_"+uid;
_e2.innerHTML="<input type=\"checkbox\" id=\""+id+"\"> "+_e1;
_dd.appendChild(_e2);
if(!hdr.isVisible()){
_e2.children[0].checked=true;
}
nitobi.html.attachEvent($ntb("ntb-hidecol_"+i+"_"+this.uid),"mouseup",hdr.toggleVis,hdr);
}
}
};
nitobi.grid.Grid.prototype.refreshColumnList=function(){
var _e4=$ntb("ntb-grid-colcheck"+this.uid);
while(_e4.childNodes[0]){
_e4.removeChild(_e4.childNodes[0]);
}
this.populateColumnList();
};
nitobi.grid.Grid.prototype.resizeToolbars=function(){
this.toolbars.setWidth(this.getWidth());
this.toolbars.resize();
};
nitobi.grid.Grid.prototype.scrollVerticalRelative=function(_e5){
var st=this.scroller.getScrollTop()+_e5;
var mc=this.Scroller.view.midcenter;
percent=st/(mc.container.offsetHeight-mc.element.offsetHeight);
this.scrollVertical(percent);
};
nitobi.grid.Grid.prototype.scrollVertical=function(_e8){
this.focus();
this.clearHover();
var _e9=this.scroller.getScrollTopPercent();
this.scroller.setScrollTopPercent(_e8);
this.fire("ScrollVertical",_e8);
if(_e8>0.99&&_e9<0.99){
this.fire("ScrollHitBottom",_e8);
}
if(_e8<0.01){
this.fire("ScrollHitTop",_e8);
}
};
nitobi.grid.Grid.prototype.scrollHorizontalRelative=function(_ea){
var sl=this.scroller.getScrollLeft()+_ea;
var mc=this.scroller.view.midcenter;
percent=sl/(mc.container.offsetWidth-mc.element.offsetWidth);
this.scrollHorizontal(percent);
};
nitobi.grid.Grid.prototype.scrollHorizontal=function(_ed){
this.focus();
this.clearHover();
this.scroller.setScrollLeftPercent(_ed);
this.fire("ScrollHorizontal",_ed);
if(_ed>0.99){
this.fire("ScrollHitRight",_ed);
}
if(_ed<0.01){
this.fire("ScrollHitLeft",_ed);
}
};
nitobi.grid.Grid.prototype.getScrollSurface=function(){
if(this.Scroller!=null){
return this.Scroller.view.midcenter.element;
}
};
nitobi.grid.Grid.prototype.getActiveView=function(){
var C=nitobi.grid.Cell;
return this.Scroller.getViewportByCoords(C.getRowNumber(this.activeCell),C.getColumnNumber(this.activeCell));
};
nitobi.grid.Grid.prototype.ensureCellInView=function(_ef){
var SS=this.getScrollSurface();
var AC=_ef||this.activeCell;
if(AC==null){
return;
}
var sct=0;
var scl=0;
if(!nitobi.browser.IE){
sct=SS.scrollTop;
scl=SS.scrollLeft;
}
var R1=nitobi.html.getBoundingClientRect(AC);
var R2=nitobi.html.getBoundingClientRect(SS);
var B=EBA_SELECTION_BUFFER||0;
var up=R1.top-R2.top-B-sct;
var _f8=R1.bottom-R2.bottom+B-sct;
var _f9=R1.left-R2.left-B-scl;
var _fa=R1.right-R2.right+B-scl;
if(up<0){
this.scrollVerticalRelative(up);
}
if(_f8>0){
this.scrollVerticalRelative(_f8);
}
if(nitobi.grid.Cell.getColumnNumber(AC)>this.getFrozenLeftColumnCount()-1){
if(_f9<0){
this.scrollHorizontalRelative(_f9);
}
if(_fa>0){
this.scrollHorizontalRelative(_fa);
}
}
this.fire("CellCoordsChanged",R1);
};
nitobi.grid.Grid.prototype.updateCellRanges=function(){
if(this.frameRendered){
var _fb=this.getRowCount();
this.Scroller.updateCellRanges(this.getColumnCount(),_fb,this.getFrozenLeftColumnCount(),this.getfreezetop());
this.measure();
this.resizeScroller();
var _fc=this.isToolbarEnabled()?this.getHeight()-this.getToolbarHeight():this.getHeight();
var _fd=$ntb("ntb-grid-hscrollshow"+this.uid);
_fc=_fc-_fd.clientHeight;
this.fire("PercentHeightChanged",(_fc)/this.calculateHeight());
this.fire("PercentWidthChanged",this.getWidth()/this.calculateWidth());
}
};
nitobi.grid.Grid.prototype.measure=function(){
this.measureViews();
this.sizeValid=true;
};
nitobi.grid.Grid.prototype.measureViews=function(){
this.measureRows();
this.measureColumns();
};
nitobi.grid.Grid.prototype.measureColumns=function(){
var fL=this.getFrozenLeftColumnCount();
var wL=0;
var wT=0;
var _101=this.getColumnDefinitions();
var cols=_101.length;
for(var i=0;i<cols;i++){
if(nitobi.lang.toBool(_101[i].getAttribute("Visible"),false)==true||nitobi.lang.toBool(_101[i].getAttribute("visible"),false)==true){
var w=Number(_101[i].getAttribute("Width"));
wT+=w;
if(i<fL){
wL+=w;
}
}
}
this.setleft(wL);
};
nitobi.grid.Grid.prototype.measureRows=function(){
var hdrH=this.isColumnIndicatorsEnabled()?this.getHeaderHeight():0;
this.settop(this.calculateHeight(0,this.getfreezetop()-1)+hdrH);
};
nitobi.grid.Grid.prototype.resizeScroller=function(){
var C=nitobi.html.Css;
var _107=parseInt(C.getStyle(this.getScrollSurface(),"height"));
var _108=(this.getToolbars()!=null&&this.isToolbarEnabled()?this.getToolbarHeight():0);
var hdrH=this.isColumnIndicatorsEnabled()?this.getHeaderHeight():0;
var _10a=$ntb("ntb-grid-hscrollshow"+this.uid);
var _10b=_10a.clientHeight;
var _10c=this.getHeight()-_108-hdrH-_10b;
this.Scroller.resize(_10c);
};
nitobi.grid.Grid.prototype.resize=function(_10d,_10e){
this.setWidth(_10d);
this.setHeight(_10e);
var _10f=this.Declaration.grid.selectSingleNode("ntb:grid");
if(_10d!=undefined){
_10f.setAttribute("width",_10d);
}
if(_10e!=undefined){
_10f.setAttribute("height",_10e);
}
this.generateCss();
this.fire("AfterGridResize",{source:this,width:_10d,height:_10e});
};
nitobi.grid.Grid.prototype.beforeResize=function(evt){
var _111=new nitobi.base.EventArgs(this);
if(!nitobi.event.evaluate(this.getOnBeforeResizeEvent(),_111)){
return;
}
this.gridResizer.startResize(this,evt);
};
nitobi.grid.Grid.prototype.afterResize=function(){
this.resize(this.gridResizer.newWidth,this.gridResizer.newHeight);
this.syncWithData();
};
nitobi.grid.Grid.prototype.afterColumnResize=function(_112){
var col=this.getColumnObject(_112.column);
var _114=col.getWidth();
this.columnResize(col,_114+_112.dx);
this.syncViewports();
};
nitobi.grid.Grid.prototype.afterDragDropColumn=function(_115){
var _116=this.getColumnObject(_115.column);
if(this.targetCol==null){
var _117=this.findColumnWithX(_115.x);
}else{
var _117=this.targetCol;
}
if(_116==_117||_117==null){
this.headerClicked(_115.column);
}else{
if(_117=="last"){
this.moveColumns(_116,this.getColumnObject(this.getColumnCount()-1),true);
}else{
this.moveColumns(_116,_117,false);
}
}
};
nitobi.grid.Grid.prototype.columnResize=function(_118,_119){
if(isNaN(_119)){
return;
}
_118=(typeof _118=="object"?_118:this.getColumnObject(_118));
var _11a=_118.getWidth();
_118.setWidth(_119);
var _11b=_118.column;
this.Declaration.columns.firstChild.childNodes[_11b].setAttribute("width",_119);
this.Declaration.grid.firstChild.firstChild.childNodes[_11b].setAttribute("width",_119);
this.updateCellRanges();
if(nitobi.browser.IE7){
this.generateCss();
}else{
var dx=_119-_11a;
var C=nitobi.html.Css;
if(_11b<this.getFrozenLeftColumnCount()){
var _11e=C.getClass(".ntb-grid-leftwidth"+this.uid);
_11e.width=(parseInt(_11e.width)+dx)+"px";
var _11f=C.getClass(".ntb-grid-centerwidth"+this.uid);
_11f.width=(parseInt(_11f.width)-dx)+"px";
}else{
var _120=C.getClass(".ntb-grid-surfacewidth"+this.uid);
_120.width=(parseInt(_120.width)+dx)+"px";
}
var _121=C.getClass(".ntb-column"+this.uid+"_"+(_11b+1));
_121.width=(parseInt(_121.width)+dx)+"px";
this.adjustHorizontalScrollBars();
}
this.Selection.collapse(this.activeCell);
var _122=new nitobi.grid.OnAfterColumnResizeEventArgs(this,_118);
nitobi.event.evaluate(_118.getOnAfterResizeEvent(),_122);
};
nitobi.grid.Grid.prototype.moveColumns=function(_123,dest,_125){
var _126=_123.column;
var _127=dest.column;
var _128=this.Declaration.columns.firstChild;
var _129=_128.childNodes[_127];
var _12a=_128.childNodes[_126];
var _12b=_12a.cloneNode(true);
_128.removeChild(_12a);
if(!_125){
_128.insertBefore(_12b,_129);
}else{
_128.appendChild(_12b);
}
var _12c=this.Declaration.grid.firstChild;
_12b=_128.cloneNode(true);
_12c.removeChild(_12c.childNodes[0]);
_12c.appendChild(_12b);
this.columns=[];
this.defineColumns(_128);
this.refreshColumnList();
this.bind();
this.Scroller.setScrollLeft(this.Scroller.getScrollLeft());
};
nitobi.grid.Grid.prototype.reloadColumnDef=function(){
this.columns=[];
this.defineColumns(columns);
this.bind();
};
nitobi.grid.Grid.prototype.findColumnWithX=function(x){
var C=nitobi.html.Css;
var _12f=this.getColumnObject(this.getColumnCount()-1);
if(nitobi.browser.IE){
var _130=this.scroller.view.topleft.element.clientWidth;
}else{
var _130=parseInt(C.getClass(".ntb-grid-leftwidth"+this.uid).width);
}
var _131=C.getClass(".ntb-grid-centerwidth"+this.uid);
var _132=this.scroller.view.topcenter;
var _133=this.getFrozenLeftColumnCount();
if(_133>0&&_130<x){
var _134=nitobi.html.getBoundingClientRect(this.UiContainer).left;
var _135=((x-_134)-_130)+this.scroller.getScrollLeft();
for(var i=_133;i<this.getColumnCount();++i){
if(this.getColumnObject(i).inRange(_135)){
return this.getColumnObject(i);
}
}
if(_135>(_12f.getHeaderElement().offsetLeft+_12f.getWidth())){
return "last";
}
}else{
var _134=this.getScrollSurface().scrollLeft;
for(var i=0;i<this.getColumnCount();++i){
if(this.getColumnObject(i).inRange(x+_134)){
return this.getColumnObject(i);
}
}
if((x+_134)>(_12f.getHeaderElement().offsetLeft+_12f.getWidth())){
return "last";
}
}
return null;
};
nitobi.grid.Grid.prototype.resizePanes=function(dx,_138){
var C=nitobi.html.Css;
if(_138<this.getFrozenLeftColumnCount()){
var _13a=C.getClass(".ntb-grid-leftwidth"+this.uid,true);
var _13b=parseInt(_13a.width);
var _13c=_13b+dx;
_13a.width=_13c+"px";
var _13d=C.getClass(".ntb-grid-centerwidth"+this.uid,true);
var _13e=parseInt(_13d.width);
var _13f=_13e-dx;
_13d.width=_13f+"px";
}else{
var _140=C.getClass(".ntb-grid-surfacewidth"+this.uid,true);
_140.width=(parseInt(_140.width)+dx)+"px";
}
};
nitobi.grid.Grid.prototype.initializeModel=function(){
this.model=nitobi.xml.createXmlDoc(nitobi.xml.serialize(nitobi.grid.modelDoc));
this.modelNode=this.model.documentElement.selectSingleNode("//nitobi.grid.Grid");
var _141=nitobi.html.getScrollBarWidth();
if(_141){
this.setscrollbarWidth(_141);
this.setscrollbarHeight(_141);
}
var xDec=this.model.selectSingleNode("state/nitobi.grid.Columns");
if(xDec==null){
var xDec=this.model.createElement("nitobi.grid.Columns");
this.model.documentElement.appendChild(nitobi.xml.importNode(this.model,xDec,true));
}
var cols=this.getColumnCount();
if(cols>0){
this.defineColumns(cols);
}else{
this.columnsDefined=false;
this.inferredColumns=true;
}
this.model.documentElement.setAttribute("ID",this.uid);
this.model.documentElement.setAttribute("uniqueID",this.uid);
};
nitobi.grid.Grid.prototype.clearDefaultData=function(rows){
for(var i=0;i<rows;i++){
var e=this.model.createElement("e");
e.setAttribute("xi",i+1);
xDec.appendChild(e);
}
};
nitobi.grid.Grid.prototype.createRenderers=function(){
var _147=this.uid;
var _148=this.getRowHeight();
var _149=["TopLeftRenderer","TopCenterRenderer","MidLeftRenderer","MidCenterRenderer"];
for(var i=0;i<4;i++){
this[_149[i]]=new nitobi.grid.RowRenderer(this.data,null,_148,null,null,_147);
}
};
nitobi.grid.Grid.prototype.bind=function(){
if(this.isBound()){
this.clear();
this.datatable.descriptor.reset();
}
};
nitobi.grid.Grid.prototype.dataBind=function(){
this.bind();
};
nitobi.grid.Grid.prototype.getDataSource=function(_14b){
var _14c=this.dataTableId||"_default";
if(_14b){
_14c=_14b;
}
return this.data.getTable(_14c);
};
nitobi.grid.Grid.prototype.getChangeLogXmlDoc=function(_14d){
return this.getDataSource(_14d).getChangeLogXmlDoc();
};
nitobi.grid.Grid.prototype.getComplete=function(_14e){
if(null==_14e.dataSource.xmlDoc){
ebaErrorReport("evtArgs.dataSource.xmlDoc is null or not defined. Likely the gethandler failed use fiddler to check the response","",EBA_ERROR);
this.fire("LoadingError");
return;
}
var _14f=_14e.dataSource.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+_14e.dataSource.id+"']");
ntbAssert((null!=_14f),"Datasource is not avialable in bindComplete handler.\n");
};
nitobi.grid.Grid.prototype.bindComplete=function(){
if(this.inferredColumns&&!this.columnsDefined){
this.defineColumns(this.datatable);
}
this.setRowCount(this.datatable.getRemoteRowCount());
this.toolbars.calculateRange();
this.toolbars.resetCounter();
this.toolbars.synchDropDown();
this.setBound(true);
this.syncWithData();
};
nitobi.grid.Grid.prototype.syncWithData=function(_150){
if(this.isBound()){
this.Scroller.render(true);
this.fire("DataReady",{"source":this});
}
};
nitobi.grid.Grid.prototype.finalizeRowCount=function(rows){
this.rowCountKnown=true;
this.setRowCount(rows);
};
nitobi.grid.Grid.prototype.adjustRowCount=function(pct){
this.scrollVertical(pct);
};
nitobi.grid.Grid.prototype.setRowCount=function(rows){
this.xSET("RowCount",arguments);
if(this.getPagingMode()==nitobi.grid.PAGINGMODE_STANDARD){
if(this.getDataMode()==nitobi.data.DATAMODE_LOCAL){
this.setDisplayedRowCount(this.getRowsPerPage());
}
}else{
this.setDisplayedRowCount(rows);
}
this.rowCount=rows;
this.updateCellRanges();
};
nitobi.grid.Grid.prototype.getRowCount=function(){
return this.rowCount;
};
nitobi.grid.Grid.prototype.layout=function(_154){
if(this.prevHeight!=this.getHeight()||this.prevWidth!=this.getWidth()){
this.prevHeight=this.getHeight();
this.prevWidth=this.getWidth();
this.layoutValid=false;
}
if(!this.layoutValid&&this.frameRendered){
this.layoutFrame();
this.generateFrameCss();
this.layoutValid=true;
}
};
nitobi.grid.Grid.prototype.layoutFrame=function(_155){
if(!this.frameRendered){
return;
}
if(!this.Scroller){
return;
}
this.minHeight=this.getMinHeight();
this.minWidth=this.getMinWidth();
var _156=false;
var _157=false;
var tbH=this.getToolbarHeight();
var rowH=this.getRowHeight();
var colW=20;
var sbH=this.getscrollbarHeight();
var sbW=this.getscrollbarWidth();
var hdrH=this.getHeaderHeight();
tbH=this.isToolbarEnabled()?tbH:0;
hdrH=this.isColumnIndicatorsEnabled?hdrH:0;
var minH=Math.max(this.minHeight,tbH+rowH+sbH+hdrH);
var maxH=this.Height;
var minW=Math.max(this.minWidth,colW+sbW);
var maxW=this.Width;
if(_156){
var _162=this.Scroller.minSurfaceWidth;
var _163=this.Scroller.maxSurfaceWidth;
}else{
var _162=this.Scroller.SurfaceWidth;
var _163=_162;
}
if(_157){
var _164=this.Scroller.minSurfaceHeight;
var _165=this.Scroller.maxSurfaceHeight;
}else{
var _164=this.Scroller.SurfaceHeight;
var _165=_164;
}
var _166=_164+(tbH)+(hdrH);
var _167=_162;
var _168=(_166>maxH);
var _169=(_167>maxW);
var _168=(_169&&((_166+20)>maxH))||_168;
var _169=(_168&&((_167+20)>maxW))||_169;
sbH=_169?sbH:0;
sbV=_168?sbV:0;
var vpH=_166-hdrH-tbH-sbH;
var vpW=_167-sbW;
this.resize();
};
nitobi.grid.Grid.prototype.defineColumns=function(_16c){
this.fire("BeforeColumnsDefined");
this.resetColumns();
var _16d=null;
var _16e=nitobi.lang.typeOf(_16c);
this.inferredColumns=false;
switch(_16e){
case "string":
_16d=this.defineColumnsFromString(_16c);
break;
case nitobi.lang.type.XMLNODE:
case nitobi.lang.type.XMLDOC:
case nitobi.lang.type.HTMLNODE:
_16d=this.defineColumnsFromXml(_16c);
break;
case nitobi.lang.type.ARRAY:
_16d=this.defineColumnsFromArray(_16c);
break;
case "object":
this.inferredColumns=true;
_16d=this.defineColumnsFromData(_16c);
break;
case "number":
_16d=this.defineColumnsCollection(_16c);
break;
default:
}
this.fire("AfterColumnsDefined");
this.defineColumnsFinalize();
return _16d;
};
nitobi.grid.Grid.prototype.defineColumnsFromXml=function(_16f){
if(_16f==null||_16f.childNodes.length==0){
return this.defineColumnsCollection(0);
}
if(_16f.childNodes[0].nodeName==nitobi.xml.nsPrefix+"columndefinition"){
var _170=nitobi.grid.declarationConverterXslProc;
_16f=nitobi.xml.transformToXml(_16f,_170);
}
var wL=0,wT=0,wR=0;
var _174=this.model.selectSingleNode("/state/Defaults/nitobi.grid.Column");
var _175=this.getColumnDefinitions().length;
var cols=_16f.childNodes.length;
var xDec=this.model.selectSingleNode("state/nitobi.grid.Columns");
ntbAssert((_16f&&_16f.xml!=""),"There are either no column definitions defined in the HTML declaration or they could not be parsed as valid XML.","",EBA_DEBUG);
var _178=_16f.childNodes;
var fL=this.getFrozenLeftColumnCount();
if(_175==0){
var cols=_178.length;
for(var i=0;i<cols;i++){
var col=_178[i];
var _17c="";
var _17d=col.nodeName;
var _17e=col.selectSingleNode("ntb:texteditor|ntb:numbereditor|ntb:textareaeditor|ntb:imageeditor|ntb:linkeditor|ntb:dateeditor|ntb:lookupeditor|ntb:listboxeditor|ntb:checkboxeditor|ntb:passwordeditor");
var _17f="TEXT";
var _180={"ntb:textcolumn":"EBATextColumn","ntb:numbercolumn":"EBANumberColumn","ntb:datecolumn":"EBADateColumn"};
var _17c=_180[_17d].replace("EBA","").replace("Column","").toLowerCase();
var _181={"ntb:numbereditor":"EBANumberEditor","ntb:textareaeditor":"EBATextareaEditor","ntb:imageeditor":"EBAImageEditor","ntb:linkeditor":"EBALinkEditor","ntb:dateeditor":"EBADateEditor","ntb:lookupeditor":"EBALookupEditor","ntb:listboxeditor":"EBAListboxEditor","ntb:passwordeditor":"EBAPasswordEditor","ntb:checkboxeditor":"EBACheckboxEditor"};
if(_17e!=null){
_17f=_181[_17e.nodeName]||_17f;
}else{
_17f=_180[_17d]||_17f;
}
_17f=_17f.replace("EBA","").replace("Editor","").replace("Column","").toUpperCase();
var e=this.model.selectSingleNode("/state/Defaults/nitobi.grid.Column[@DataType='"+(_17c)+"' and @type='"+_17f+"' and @editor='"+_17f+"']").cloneNode(true);
this.setModelValues(e,col);
var _183=_180[col.nodeName]||"EBATextColumn";
this.defineColumnDatasource(e);
this.defineColumnBinding(e);
xDec.appendChild(e);
var _184=e.getAttribute("GetHandler");
if(_184){
var _185=e.getAttribute("DatasourceId");
if(!_185||_185==""){
_185="columnDatasource_"+i+"_"+this.uid;
e.setAttribute("DatasourceId",_185);
}
var dt=new nitobi.data.DataTable("local",this.getPagingMode()==nitobi.grid.PAGINGMODE_LIVESCROLLING,{GridId:this.getID()},{GridId:this.getID()},this.isAutoKeyEnabled());
dt.initialize(_185,_184,null);
dt.async=false;
this.data.add(dt);
var _187=[];
_187[0]=e;
var _188=e.getAttribute("editor");
var _189=null;
var _18a=null;
if(e.getAttribute("editor")=="LOOKUP"){
_189=0;
_18a=1;
dt.async=true;
}
dt.get(_189,_18a,this,nitobi.lang.close(this,this.editorDataReady,[e]),function(){
ntbAssert(false,"Datasource for "+e.getAttribute("ColumnName"),"",EBA_WARN);
});
}
}
this.measureColumns();
this.setColumnCount(cols);
}
var _18b;
_18b=_16f.selectSingleNode("/"+nitobi.xml.nsPrefix+"grid/"+nitobi.xml.nsPrefix+"datasources");
if(_18b){
this.Declaration.datasources=nitobi.xml.createXmlDoc(_18b.xml);
}
return xDec;
};
nitobi.grid.Grid.prototype.defineColumnsFinalize=function(){
this.setColumnsDefined(true);
if(this.connected){
if(this.frameRendered){
this.makeXSL();
this.generateColumnCss();
this.renderHeaders();
}
}
};
nitobi.grid.Grid.prototype.defineColumnDatasource=function(_18c){
var val=_18c.getAttribute("Datasource");
if(val!=null){
var ds=new Array();
try{
ds=eval(val);
}
catch(e){
var _18f=val.split(",");
if(_18f.length>0){
for(var i=0;i<_18f.length;i++){
var item=_18f[i];
ds[i]={text:item.split(":")[0],display:item.split(":")[1]};
}
}
return;
}
if(typeof (ds)=="object"&&ds.length>0){
var _192=new nitobi.data.DataTable("unbound",this.getPagingMode()==nitobi.grid.PAGINGMODE_LIVESCROLLING,{GridId:this.getID()},{GridId:this.getID()},this.isAutoKeyEnabled());
var _193="columnDatasource"+new Date().getTime();
_192.initialize(_193);
_18c.setAttribute("DatasourceId",_193);
var _194="";
for(var item in ds[0]){
_194+=item+"|";
}
_194=_194.substring(0,_194.length-1);
_192.initializeColumns(_194);
for(var i=0;i<ds.length;i++){
_192.createRecord(null,i);
for(var item in ds[i]){
_192.updateRecord(i,item,ds[i][item]);
}
}
this.data.add(_192);
this.editorDataReady(_18c);
}
}
};
nitobi.grid.Grid.prototype.defineColumnsFromData=function(_195){
if(_195==null){
_195=this.datatable;
}
var _196=_195.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasourcestructure");
if(_196==null){
return this.defineColumnsCollection(0);
}
var _197=_196.getAttribute("FieldNames");
if(_197.length==0){
return this.defineColumnsCollection(0);
}
var _198=_196.getAttribute("defaults");
var _199=this.defineColumnsFromString(_197);
for(var i=0;i<_199.length;i++){
if(_198&&i<_198.length){
_199[i].setAttribute("initial",_198[i]||"");
}
_199[i].setAttribute("width",100);
}
this.inferredColumns=true;
return _199;
};
nitobi.grid.Grid.prototype.defineColumnsFromString=function(_19b){
return this.defineColumnsFromArray(_19b.split("|"));
};
nitobi.grid.Grid.prototype.defineColumnsFromArray=function(_19c){
var cols=_19c.length;
var _19e=this.defineColumnsCollection(cols);
for(var i=0;i<cols;i++){
var col=_19e[i];
if(typeof (_19c[i])=="string"){
col.setAttribute("ColumnName",_19c[i]);
col.setAttribute("xdatafld_orig",_19c[i]);
col.setAttribute("DataField_orig",_19c[i]);
col.setAttribute("Label",_19c[i]);
if(typeof (this.fieldMap[_19c[i]])!="undefined"){
col.setAttribute("xdatafld",this.fieldMap[_19c[i]]);
col.setAttribute("DataField",this.fieldMap[_19c[i]]);
}else{
col.setAttribute("xdatafld","unbound");
col.setAttribute("DataField","unbound");
}
}else{
if(_19c[i].name!="_xk"){
col.setAttribute("ColumnName",col.name);
col.setAttribute("xdatafld_orig",col.name);
col.setAttribute("DataField_orig",col.name);
col.setAttribute("xdatafld",this.fieldMap[_19c[i].name]);
col.setAttribute("DataField",this.fieldMap[_19c[i].name]);
col.setAttribute("Width",col.width);
col.setAttribute("Label",col.label);
col.setAttribute("Initial",col.initial);
col.setAttribute("Mask",col.mask);
}
}
}
this.setColumnCount(cols);
return _19e;
};
nitobi.grid.Grid.prototype.defineColumnBindings=function(){
var xslt=nitobi.grid.rowXslProc.stylesheet;
var cols=this.getColumnDefinitions();
for(var i=0;i<cols.length;i++){
var e=cols[i];
this.defineColumnBinding(e,xslt);
e.setAttribute("xi",i);
}
nitobi.grid.rowXslProc=nitobi.xml.createXslProcessor(xslt);
};
nitobi.grid.Grid.prototype.defineColumnBinding=function(_1a5,xslt){
if(this.fieldMap==null){
return;
}
var _1a7=_1a5.getAttribute("xdatafld");
var _1a8=_1a5.getAttribute("xdatafld_orig");
if(_1a8==null||_1a8==""){
_1a5.setAttribute("xdatafld_orig",_1a7);
_1a5.setAttribute("DataField_orig",_1a7);
}else{
_1a7=_1a5.getAttribute("xdatafld_orig");
}
_1a5.setAttribute("ColumnName",_1a7);
var _1a9=this.fieldMap[_1a7];
if(typeof (_1a9)!="undefined"){
_1a5.setAttribute("xdatafld",_1a9);
_1a5.setAttribute("DataField",_1a9);
}
this.formatBinding(_1a5,"CssStyle",xslt);
this.formatBinding(_1a5,"ClassName",xslt);
this.formatBinding(_1a5,"Value",xslt);
};
nitobi.grid.Grid.prototype.formatBinding=function(_1aa,_1ab,xslt){
var _1ad=_1aa.getAttribute(_1ab);
var _1ae=_1aa.getAttribute(_1ab+"_orig");
if(_1ad==null||_1ad==""){
return;
}
if(_1ae==null||_1ae==""){
_1aa.setAttribute(_1ab+"_orig",_1ad);
}
_1ad=_1aa.getAttribute(_1ab+"_orig");
var re=new RegExp("\\{.[^}]*}","gi");
var _1b0=_1ad.match(re);
if(_1b0==null){
return;
}
for(var i=0;i<_1b0.length;i++){
var _1b2=_1b0[i];
var _1b3=_1b2;
var _1b4=new RegExp("\\$.*?[^0-9a-zA-Z_]","gi");
var _1b5=_1b3.match(_1b4);
for(var j=0;j<_1b5.length;j++){
var _1b7=_1b5[j];
var _1b8=_1b7.substring(0,_1b7.length-1);
var _1b9=_1b8.substring(1);
var _1ba=this.fieldMap[_1b9]+"";
_1b3=_1b3.replace(_1b8,_1ba.substring(1)||"");
}
_1b3=_1b3.substring(1,_1b3.length-1);
_1ad=_1ad.replace(_1b2,_1b3).replace(/\{\}/g,"");
}
_1aa.setAttribute(_1ab,_1ad);
};
nitobi.grid.Grid.prototype.defineColumnsCollection=function(cols){
var xDec=this.model.selectSingleNode("state/nitobi.grid.Columns");
var _1bd=xDec.childNodes;
var _1be=this.model.selectSingleNode("/state/Defaults/nitobi.grid.Column");
for(var i=0;i<cols;i++){
var e=_1be.cloneNode(true);
xDec.appendChild(e);
e.setAttribute("xi",i);
e.setAttribute("title",(i>25?String.fromCharCode(Math.floor(i/26)+65):"")+(String.fromCharCode(i%26+65)));
}
this.setColumnCount(cols);
var _1bd=xDec.selectNodes("*");
return _1bd;
};
nitobi.grid.Grid.prototype.resetColumns=function(){
this.fire("BeforeClearColumns");
this.inferredColumns=true;
this.columnsDefined=false;
var _1c1=this.model.selectSingleNode("state/nitobi.grid.Columns");
var xDec=this.model.createElement("nitobi.grid.Columns");
if(_1c1==null){
this.model.documentElement.appendChild(xDec);
}else{
this.model.documentElement.replaceChild(xDec,_1c1);
}
this.setColumnCount(0);
this.fire("AfterClearColumns");
};
nitobi.grid.Grid.prototype.renderHeaders=function(){
if(this.getColumnDefinitions().length>0){
this.Scroller.clearSurfaces(false,true);
var _1c3=0;
endRow=this.getfreezetop()-1;
var tl=this.Scroller.view.topleft;
tl.top=this.getHeaderHeight();
tl.left=0;
tl.renderGap(_1c3,endRow,false,"*");
var tc=this.Scroller.view.topcenter;
tc.top=this.getHeaderHeight();
tc.left=0;
tc.renderGap(_1c3,endRow,false);
}
};
nitobi.grid.Grid.prototype.initializeSelection=function(){
var sel=new nitobi.grid.Selection(this,this.isDragFillEnabled());
sel.setRowHeight(this.getRowHeight());
sel.onAfterExpand.subscribe(this.afterExpandSelection,this);
sel.onBeforeExpand.subscribe(this.beforeExpandSelection,this);
sel.onMouseUp.subscribe(this.handleSelectionMouseUp,this);
this.selection=this.Selection=sel;
};
nitobi.grid.Grid.prototype.beforeExpandSelection=function(evt){
this.setExpanding(true);
this.fire("BeforeDragFill",new nitobi.base.EventArgs(this,evt));
};
nitobi.grid.Grid.prototype.afterExpandSelection=function(evt){
var sel=this.selection;
var _1ca=sel.getCoords();
var _1cb=_1ca.top.y;
var _1cc=_1ca.bottom.y;
var _1cd=_1ca.top.x;
var _1ce=_1ca.bottom.x;
var _1cf=this.getTableForSelection({top:{x:sel.expandStartLeftColumn,y:sel.expandStartTopRow},bottom:{x:sel.expandStartRightColumn,y:sel.expandStartBottomRow}});
var data="",_1d1=this.getClipboard();
if(sel.expandingVertical){
if(sel.expandStartBottomRow>_1cc&&_1cb>=sel.expandStartTopRow){
for(var i=sel.expandStartLeftColumn;i<=sel.expandStartRightColumn;i++){
for(var j=_1cc+1;j<sel.expandStartBottomRow+1;j++){
this.getCellObject(j,i).setValue("");
}
}
}else{
var _1d4=(sel.expandStartBottomRow<_1cc);
var _1d5=(sel.expandStartTopRow>_1cb);
var _1d6=(_1d4||_1d5);
if(_1d6){
if(_1cf.lastIndexOf("\n")==_1cf.length-1){
_1cf=_1cf.substring(0,_1cf.length-1);
}
var rep=(Math.floor((sel.getHeight()-!_1d6)/sel.expandStartHeight));
for(var i=0;i<rep;i++){
data+=_1cf+(!nitobi.browser.IE?"\n":"");
}
_1d8=_1cf.split("\n");
var mod=(sel.getHeight()-!_1d6)%sel.expandStartHeight;
var val="";
if(_1d4){
_1d8.splice(mod,_1d8.length-mod);
val=data+_1d8.join("\n")+(_1d8.length>0?"\n":"");
}else{
_1d8.splice(0,_1d8.length-mod);
val=_1d8.join("\n")+(_1d8.length>0?"\n":"")+data;
}
_1d1.value=val;
this.pasteDataReady(_1d1);
}
}
}else{
if(sel.expandStartRightColumn>_1ce&&_1cd>=sel.expandStartLeftColumn){
for(var i=_1cd+1;i<=sel.expandStartRightColumn+1;i++){
for(var j=sel.expandStartTopRow;j<sel.expandStartBottomRow;j++){
this.getCellObject(j,i).setValue("");
}
}
}else{
var _1db=sel.expandStartRightColumn<_1ce;
var _1dc=sel.expandStartLeftColumn>_1cd;
var _1d6=(_1db||_1dc);
if(_1d6){
var mod=(sel.getWidth()-!_1d6)%sel.expandStartWidth;
var _1dd=(!nitobi.browser.IE?"\n":"\r\n");
if(_1cf.lastIndexOf(_1dd)==_1cf.length-_1dd.length){
_1cf=_1cf.substring(0,_1cf.length-_1dd.length);
}
var _1d8=_1cf.replace(/\r/g,"").split("\n");
var data=new Array(_1d8.length);
var rep=(Math.floor((sel.getWidth()-!_1d6)/sel.expandStartWidth));
for(var i=0;i<_1d8.length;i++){
var _1de=_1d8[i].split("\t");
for(var j=0;j<rep;j++){
data[i]=(data[i]==null?[]:data[i]).concat(_1de);
}
if(mod!=0){
if(_1db){
data[i]=data[i].concat(_1de.splice(0,mod));
}else{
data[i]=_1de.splice(mod,_1de.length-mod).concat(data[i]);
}
}
data[i]=data[i].join("\t");
}
_1d1.value=data.join("\n")+"\n";
this.pasteDataReady(_1d1);
}
}
}
this.setExpanding(false);
this.fire("AfterDragFill",new nitobi.base.EventArgs(this,evt));
};
nitobi.grid.Grid.prototype.calculateHeight=function(_1df,end){
_1df=(_1df!=null)?_1df:0;
var _1e1=this.getDisplayedRowCount();
end=(end!=null)?end:_1e1;
var _1e2=0;
for(var i=0;i<end;i++){
if($ntb("row_"+i+"_"+this.uid)){
_1e2+=$ntb("row_"+i+"_"+this.uid).clientHeight;
}else{
_1e2+=this.getRowHeight();
}
}
return _1e2;
};
nitobi.grid.Grid.prototype.calculateWidth=function(_1e4,end){
var _1e6=this.getColumnDefinitions();
var cols=_1e6.length;
_1e4=_1e4||0;
end=(end!=null)?Math.min(end,cols):cols;
var wT=0;
for(var i=_1e4;i<end;i++){
if(nitobi.lang.toBool(_1e6[i].getAttribute("Visible"),false)==true||nitobi.lang.toBool(_1e6[i].getAttribute("visible"),false)==true){
wT+=Number(_1e6[i].getAttribute("Width"));
}
}
return (wT);
};
nitobi.grid.Grid.prototype.maximize=function(){
var x,y;
var _1ec=this.element.offsetParent;
x=_1ec.clientWidth;
y=_1ec.clientHeight;
this.resize(x,y);
};
nitobi.grid.Grid.prototype.editorDataReady=function(_1ed){
var _1ee=_1ed.getAttribute("DisplayFields").split("|");
var _1ef=_1ed.getAttribute("ValueField");
var _1f0=this.data.getTable(_1ed.getAttribute("DatasourceId"));
var _1f1=_1ed.getAttribute("Initial");
if(_1f1==""){
var _1f2=_1ed.getAttribute("type").toLowerCase();
switch(_1f2){
case "checkbox":
case "listbox":
var _1f3=_1f0.fieldMap[_1ef].substring(1);
var data=_1f0.getDataXmlDoc();
if(data!=null){
var val=data.selectSingleNode("//"+nitobi.xml.nsPrefix+"e[@"+_1f3+"='"+_1f1+"']");
if(val==null){
var _1f6=data.selectSingleNode("//"+nitobi.xml.nsPrefix+"e");
if(_1f6!=null){
_1f1=_1f6.getAttribute(_1f3);
}
}
}
break;
}
_1ed.setAttribute("Initial",_1f1);
}
if((_1ee.length==1&&_1ee[0]=="")&&(_1ef==null||_1ef=="")){
for(var item in _1f0.fieldMap){
_1ee[0]=_1f0.fieldMap[item].substring(1);
break;
}
}else{
for(var i=0;i<_1ee.length;i++){
_1ee[i]=_1f0.fieldMap[_1ee[i]].substring(1);
}
}
var _1f9=_1ee.join("|");
if(_1ef==null||_1ef==""){
_1ef=_1ee[0];
}else{
_1ef=_1f0.fieldMap[_1ef].substring(1);
}
_1ed.setAttribute("DisplayFields",_1f9);
_1ed.setAttribute("ValueField",_1ef);
};
nitobi.grid.Grid.prototype.headerClicked=function(_1fa){
var _1fb=this.getColumnObject(_1fa);
var _1fc=new nitobi.grid.OnHeaderClickEventArgs(this,_1fb);
if(!this.fire("HeaderClick",_1fc)||!nitobi.event.evaluate(_1fb.getOnHeaderClickEvent(),_1fc)){
return;
}
this.sort(_1fa);
};
nitobi.grid.Grid.prototype.addFilter=function(){
this.dataTable.addFilter(arguments);
};
nitobi.grid.Grid.prototype.clearFilter=function(){
this.dataTable.clearFilter();
};
nitobi.grid.Grid.prototype.setSortStyle=function(_1fd,_1fe,_1ff){
var _200=this.getColumnObject(_1fd);
if(_1ff){
this.sortColumn=null;
this.sortColumnCell=null;
this.Scroller.setSort(_1fd,"");
this.setColumnSortOrder(_1fd,"");
}else{
_200.setSortDirection(_1fe);
this.setColumnSortOrder(_1fd,_1fe);
this.sortColumn=_200;
this.sortColumnCell=_200.getHeaderElement();
this.Scroller.setSort(_1fd,_1fe);
}
};
nitobi.grid.Grid.prototype.sort=function(_201,_202){
ntbAssert(typeof (_201)!="undefined","No column to sort.");
var _203=this.getColumnObject(_201);
if(_203==null||!_203.isSortEnabled()||(!this.isSortEnabled())){
return;
}
var _204=new nitobi.grid.OnBeforeSortEventArgs(this,_203);
if(!this.fire("BeforeSort",_204)||!nitobi.event.evaluate(_203.getOnBeforeSortEvent(),_204)){
return;
}
if(_202==null||typeof (_202)=="undefined"){
_202=(_203.getSortDirection()=="Asc")?"Desc":"Asc";
}
this.setSortStyle(_201,_202);
var _205=_203.getColumnName();
var _206=_203.getDataType();
var _207=this.getSortMode()=="local"||(this.getDataMode()=="local"&&this.getSortMode()!="remote");
this.datatable.sort(_205,_202,_206,_207);
if(!_207){
this.datatable.flush();
}
this.clearSurfaces();
this.scrollVertical(0);
if(!_207){
this.loadDataPage(0);
}
this.subscribeOnce("HtmlReady",this.handleAfterSort,this,[_203]);
};
nitobi.grid.Grid.prototype.handleAfterSort=function(_208){
var _209=new nitobi.grid.OnAfterSortEventArgs(this,_208);
this.fire("AfterSort",_209);
nitobi.event.evaluate(_208.getOnAfterSortEvent(),_209);
};
nitobi.grid.Grid.prototype.handleDblClick=function(evt){
var cell=this.activeCellObject;
var col=this.activeColumnObject;
var _20d=new nitobi.grid.OnCellDblClickEventArgs(this,cell);
return this.fire("CellDblClick",_20d)&&nitobi.event.evaluate(col.getOnCellDblClickEvent(),_20d);
};
nitobi.grid.Grid.prototype.clearData=function(){
if(this.getDataMode()!="local"){
this.datatable.flush();
}
};
nitobi.grid.Grid.prototype.clearColumnHeaderSortOrder=function(){
if(this.sortColumn){
var _20e=this.sortColumn;
var _20f=_20e.getHeaderElement();
var css=_20f.className;
css=css.replace(/ascending/gi,"").replace(/descending/gi,"");
_20f.className=css;
this.sortColumn=null;
}
};
nitobi.grid.Grid.prototype.setColumnSortOrder=function(_211,_212){
this.clearColumnHeaderSortOrder();
var _213=this.getColumnObject(_211);
var _214=_213.getHeaderElement();
var C=nitobi.html.Css;
var css=_214.className;
if(_212==""){
_214.className=css.replace(/(ntb-column-indicator-border)(.*?)(\s|$)/g,"")+" ntb-column-indicator-border";
_212="Desc";
}else{
_214.className=css.replace(/(ntb-column-indicator-border)/g,function(m){
var repl=(_212=="Desc"?"descending":"ascending");
return (m.indexOf("hover")>0?m.replace("hover",repl+"hover"):m+repl);
});
}
_213.setSortDirection(_212);
this.sortColumn=_213;
this.sortColumnCell=_214;
};
nitobi.grid.Grid.prototype.initializeState=function(){
};
nitobi.grid.Grid.prototype.mapToHtml=function(_219){
if(_219==null){
_219=this.UiContainer;
}
this.Scroller.mapToHtml(_219);
this.element=document.getElementById("grid"+this.uid);
this.element.jsObject=this;
};
nitobi.grid.Grid.prototype.generateCss=function(){
this.generateFrameCss();
};
nitobi.grid.Grid.prototype.generateColumnCss=function(){
this.generateCss();
};
nitobi.grid.Grid.prototype.generateFrameCss=function(){
var _21a=nitobi.xml.serialize(this.model);
if(this.oldModel==_21a){
return;
}
this.oldModel=nitobi.xml.serialize(this.model);
if(nitobi.browser.IE&&document.compatMode=="CSS1Compat"){
this.frameCssXslProc.addParameter("IE","true","");
}
var _21b=nitobi.xml.transformToString(this.model,this.frameCssXslProc);
if(!nitobi.browser.SAFARI&&!nitobi.browser.CHROME&&this.stylesheet==null){
this.stylesheet=nitobi.html.Css.createStyleSheet();
}
var ss=this.getScrollSurface();
var _21d=0;
var _21e=0;
if(ss!=null){
_21d=ss.scrollTop;
_21e=ss.scrollLeft;
}
if(this.oldFrameCss!=_21b){
this.oldFrameCss=_21b;
if(nitobi.browser.SAFARI||nitobi.browser.CHROME){
this.generateFrameCssSafari();
}else{
try{
this.stylesheet.cssText=_21b;
}
catch(e){
}
if(ss!=null){
if(nitobi.browser.MOZ){
this.scrollVerticalRelative(_21d);
this.scrollHorizontalRelative(_21e);
}
ss.style.top="0px";
ss.style.left="0px";
}
}
}
};
nitobi.grid.Grid.prototype.generateFrameCssSafari=function(){
var ss=document.styleSheets[0];
var u=this.uid;
var t=this.getTheme();
var _222=this.getWidth();
var _223=this.getHeight();
var _224=(this.isVScrollbarEnabled()?1:0);
var _225=(this.isHScrollbarEnabled()?1:0);
var _226=(this.isToolbarEnabled()?1:0);
var _227=this.calculateWidth(0,this.getFrozenLeftColumnCount());
var _228=this.calculateWidth(this.getFrozenLeftColumnCount(),this.getColumnCount());
var _229=_227+_228;
var _22a=_223-this.getscrollbarHeight()*_225-this.getToolbarHeight()*_226;
var _22b=_222-this.getscrollbarWidth()*_224;
var _22c=_22a-this.gettop();
var _22d=nitobi.html.Css.addRule;
var p="ntb-grid-";
if(this.rules==null){
this.rules={};
this.rules[".ntb-grid-datablock"]=_22d(ss,".ntb-grid-datablock","table-layout:fixed;width:100%;");
this.rules[".ntb-grid-headerblock"]=_22d(ss,".ntb-grid-headerblock","table-layout:fixed;width:100%;");
_22d(ss,"."+p+"overlay"+u,"position:relative;z-index:1000;top:0px;left:0px;");
_22d(ss,"."+p+"scroller"+u,"overflow:hidden;text-align:left;");
_22d(ss,".ntb-grid","padding:0px;margin:0px;border:1px solid #cccccc;");
_22d(ss,".ntb-scroller","padding:0px;");
_22d(ss,".ntb-scrollcorner","padding:0px;");
_22d(ss,".ntb-input-border","table-layout:fixed;overflow:hidden;position:absolute;z-index:2000;top:-2000px;left:-2000px;;");
_22d(ss,".ntb-column-resize-surface","filter:alpha(opacity=1);background-color:white;position:absolute;visibility:hidden;top:0;left:0;width:100;height:100;z-index:800;");
_22d(ss,".ntb-column-indicator","overflow:hidden;white-space: nowrap;");
}
this.rules["#grid"+u]=_22d(ss,"#grid"+u,"overflow:hidden;text-align:left;-moz-user-select: none;-khtml-user-select: none;user-select: none;"+(nitobi.browser.IE?"position:relative;":""));
this.rules["#grid"+u].style.height=_223+"px";
this.rules["#grid"+u].style.width=_222+"px";
_22d(ss,".hScrollbarRange"+u,"width:"+_229+"px;");
_22d(ss,".vScrollbarRange"+u,"");
_22d(ss,"."+t+" .ntb-cell","overflow:hidden;white-space:nowrap;");
_22d(ss,"."+t+" .ntb-cell-border","overflow:hidden;white-space:nowrap;"+(nitobi.browser.IE?"height:auto;":"")+";");
_22d(ss,".ntb-grid-headershow"+u,"padding:0px;"+(this.isColumnIndicatorsEnabled()?"display:none;":"")+"");
_22d(ss,".ntb-grid-vscrollshow"+u,"padding:0px;"+(_224?"":"display:none;")+"");
_22d(ss,"#ntb-grid-hscrollshow"+u,"padding:0px;"+(_225?"":"display:none;")+"");
_22d(ss,".ntb-grid-toolbarshow"+u,""+(_226?"":"display:none;")+"");
_22d(ss,".ntb-grid-height"+u,"height:"+_223+"px;overflow:hidden;");
_22d(ss,".ntb-grid-width"+u,"width:"+_222+"px;overflow:hidden;");
_22d(ss,".ntb-grid-overlay"+u,"position:relative;z-index:1000;top:0px;left:0px;");
_22d(ss,".ntb-grid-scroller"+u,"overflow:hidden;text-align:left;");
_22d(ss,".ntb-grid-scrollerheight"+u,"height:"+(_229>_222?_22a:_22a+this.getscrollbarHeight())+"px;");
_22d(ss,".ntb-grid-scrollerwidth"+u,"width:"+_22b+"px;");
_22d(ss,".ntb-grid-topheight"+u,"height:"+this.gettop()+"px;overflow:hidden;"+(this.gettop()==0?"display:none;":"")+"");
_22d(ss,".ntb-grid-midheight"+u,"overflow:hidden;height:"+(_229>_222?_22c:_22c+this.getscrollbarHeight())+"px;");
_22d(ss,".ntb-grid-leftwidth"+u,"width:"+this.getleft()+"px;overflow:hidden;text-align:left;");
_22d(ss,".ntb-grid-centerwidth"+u,"width:"+(_222-this.getleft()-this.getscrollbarWidth()*_224)+"px;");
_22d(ss,".ntb-grid-scrollbarheight"+u,"height:"+this.getscrollbarHeight()+"px;");
_22d(ss,".ntb-grid-scrollbarwidth"+u,"width:"+this.getscrollbarWidth()+"px;");
_22d(ss,".ntb-grid-toolbarheight"+u,"height:"+this.getToolbarHeight()+"px;");
_22d(ss,".ntb-grid-surfacewidth"+u,"width:"+_228+"px;");
_22d(ss,".ntb-grid-surfaceheight"+u,"height:100px;");
_22d(ss,".ntb-hscrollbar"+u,(_229>_222?"display:block;":"display:none;"));
_22d(ss,".ntb-row"+u,"height:"+this.getRowHeight()+"px;margin:0px;line-height:"+this.getRowHeight()+"px;");
_22d(ss,".ntb-header-row"+u,"height:"+this.getHeaderHeight()+"px;");
var cols=this.getColumnDefinitions();
for(var i=1;i<=cols.length;i++){
var col=cols[i-1];
var _232=this.rules[".ntb-column"+u+"_"+(i)];
if(_232==null){
_232=this.rules[".ntb-column"+u+"_"+(i)]=_22d(ss,".ntb-column"+u+"_"+(i));
}
_232.style.width=col.getAttribute("Width")+"px";
var _233=this.rules[".ntb-column-data"+u+"_"+(i)];
if(_233==null){
this.rules[".ntb-column-data"+u+"_"+(i)]=_22d(ss,".ntb-column-data"+u+"_"+(i),"text-align:"+col.getAttribute("Align")+";");
}
}
};
nitobi.grid.Grid.prototype.clearSurfaces=function(){
this.selection.clearBoxes();
this.Scroller.clearSurfaces();
this.updateCellRanges();
this.cachedCells={};
};
nitobi.grid.Grid.prototype.renderFrame=function(){
var _234="IE";
if(nitobi.browser.MOZ){
_234="MOZ";
}else{
if(nitobi.browser.SAFARI||nitobi.browser.CHROME){
_234="SAFARI";
}
}
this.frameXslProc.addParameter("browser",_234,"");
this.UiContainer.innerHTML=nitobi.xml.transformToString(this.model,this.frameXslProc);
this.attachDomEvents();
this.frameRendered=true;
this.fire("AfterFrameRender");
};
nitobi.grid.Grid.prototype.renderMiddle=function(){
this.Scroller.view.midleft.flushCache();
this.Scroller.view.midcenter.flushCache();
};
nitobi.grid.Grid.prototype.refresh=function(){
var _235=null;
if(!this.fire("BeforeRefresh",_235)){
return;
}
ntbAssert(this.datatable!=null,"The Grid must be conntected to a DataTable to call refresh.","",EBA_THROW);
this.selectedRows=[];
this.clearSurfaces();
if(this.getDataMode()!="local"){
this.datatable.clearData();
}
this.Scroller.refresh=true;
this.syncWithData();
this.subscribeOnce("HtmlReady",this.handleAfterRefresh,this);
};
nitobi.grid.Grid.prototype.handleAfterRefresh=function(){
var _236=null;
this.fire("AfterRefresh",_236);
};
nitobi.grid.Grid.prototype.clear=function(){
this.selectedRows=[];
this.clearData();
this.clearSurfaces();
};
nitobi.grid.Grid.prototype.handleContextMenu=function(evt,obj){
if(!this.OnContextMenuEvent){
return true;
}else{
if(this.fire("ContextMenu")){
return true;
}else{
evt.cancelBubble=true;
evt.returnValue=false;
return false;
}
}
};
nitobi.grid.Grid.prototype.handleKeyPress=function(evt){
if(this.activeCell==null){
return;
}
var col=this.activeColumnObject;
this.fire("KeyPress",new nitobi.base.EventArgs(this,evt));
nitobi.event.evaluate(col.getOnKeyPressEvent(),evt);
nitobi.html.cancelEvent(evt);
return false;
};
nitobi.grid.Grid.prototype.handleKeyUp=function(evt){
if(this.activeCell==null){
return;
}
var col=this.activeColumnObject;
this.fire("KeyUp",new nitobi.base.EventArgs(this,evt));
nitobi.event.evaluate(col.getOnKeyUpEvent(),evt);
};
nitobi.grid.Grid.prototype.handleKey=function(evt,obj){
if(this.activeCell!=null){
var col=this.activeColumnObject;
var _240=new nitobi.base.EventArgs(this,evt);
if(!this.fire("KeyDown",_240)||!nitobi.event.evaluate(col.getOnKeyDownEvent(),_240)){
return;
}
}
var k=evt.keyCode;
k=k+(evt.shiftKey?256:0)+(evt.ctrlKey?512:0)+(evt.metaKey?1024:0);
switch(k){
case 529:
break;
case 35:
break;
case 36:
break;
case 547:
break;
case 548:
break;
case 34:
this.page(1);
break;
case 33:
this.page(-1);
break;
case 45:
this.insertAfterCurrentRow();
break;
case 46:
if(this.getSelectedRows().length>1){
this.deleteSelectedRows();
}else{
this.deleteCurrentRow();
}
break;
case 292:
this.selectHome();
break;
case 290:
this.pageSelect(1);
break;
case 289:
this.pageSelect(-1);
break;
case 296:
this.reselect(0,1);
break;
case 294:
this.reselect(0,-1);
break;
case 293:
this.reselect(-1,0);
break;
case 295:
this.reselect(1,0);
break;
case 577:
break;
case 579:
case 557:
this.copy(evt);
return true;
case 1091:
this.copy(evt);
return true;
case 600:
case 302:
break;
case 598:
case 301:
this.paste(evt);
return true;
break;
case 1110:
this.paste(evt);
return true;
case 35:
break;
case 36:
break;
case 547:
break;
case 548:
break;
case 13:
var et=this.getEnterTab().toLowerCase();
var _243=0;
var vert=1;
if(et=="left"){
_243=-1;
vert=0;
}else{
if(et=="right"){
_243=1;
vert=0;
}else{
if(et=="down"){
_243=0;
vert=1;
}else{
if(et=="up"){
_243=0;
vert=-1;
}
}
}
}
this.move(_243,vert);
break;
case 40:
this.move(0,1);
break;
case 269:
case 38:
this.move(0,-1);
break;
case 265:
case 37:
this.move(-1,0);
break;
case 9:
case 39:
this.move(1,0);
break;
case 577:
break;
case 595:
this.save();
break;
case 594:
this.refresh();
break;
case 590:
this.insertAfterCurrentRow();
break;
default:
this.edit(evt);
}
};
nitobi.grid.Grid.prototype.reselect=function(x,y){
var S=this.selection;
var row=nitobi.grid.Cell.getRowNumber(S.endCell)+y;
var _249=nitobi.grid.Cell.getColumnNumber(S.endCell)+x;
if(_249>=0&&_249<this.columnCount()&&row>=0){
var _24a=this.getCellElement(row,_249);
if(!_24a){
return;
}
S.changeEndCellWithDomNode(_24a);
S.alignBoxes();
this.ensureCellInView(_24a);
}
};
nitobi.grid.Grid.prototype.pageSelect=function(dir){
};
nitobi.grid.Grid.prototype.selectHome=function(){
var S=this.selection;
var row=nitobi.grid.Cell.getRowNumber(S.endCell);
this.reselect(0,-row);
};
nitobi.grid.Grid.prototype.edit=function(evt){
if(this.activeCell==null){
return;
}
var cell=this.activeCellObject;
var col=this.activeColumnObject;
var _251=new nitobi.grid.OnBeforeCellEditEventArgs(this,cell);
if(!this.fire("BeforeCellEdit",_251)||!nitobi.event.evaluate(col.getOnBeforeCellEditEvent(),_251)){
return;
}
var _252=null;
var _253=null;
var ctrl=null;
if(evt){
_252=evt.keyCode||null;
_253=evt.shiftKey||null;
ctrl=evt.ctrlKey||null;
}
var _255="";
var _256=null;
if((_253&&(_252>64)&&(_252<91))||(!_253&&((_252>47)&&(_252<58)))){
_256=0;
}
if(!_253){
if((_252>64)&&(_252<91)){
_256=32;
}else{
if(_252>95&&_252<106){
_256=-48;
}else{
if((_252==189)||(_252==109)){
_255="-";
}else{
if((_252>186)&&(_252<188)){
_256=-126;
}
}
}
}
}else{
}
if(_256!=null){
_255=String.fromCharCode(_252+_256);
}
if((!ctrl)&&(""!=_255)||(_252==113)||(_252==0)||(_252==null)||(_252==32)){
if(col.isEditable()){
this.cellEditor=nitobi.form.ControlFactory.instance.getEditor(this,col);
if(this.cellEditor==null){
return;
}
this.cellEditor.setEditCompleteHandler(this.editComplete);
this.cellEditor.attachToParent(this.getToolsContainer());
this.cellEditor.bind(this,cell,_255);
this.cellEditor.mimic();
this.setEditMode(true);
nitobi.html.cancelEvent(evt);
return false;
}
}else{
return;
}
};
nitobi.grid.Grid.prototype.editComplete=function(_257){
var cell=_257.cell;
var _259=cell.getColumnObject();
var _25a=_257.databaseValue;
var _25b=_257.displayValue;
var _25c=new nitobi.grid.OnCellValidateEventArgs(this,cell,_25a,cell.getValue());
if(!this.fire("CellValidate",_25c)||!nitobi.event.evaluate(_259.getOnCellValidateEvent(),_25c)){
return false;
}
cell.setValue(_25a,_25b);
_257.editor.hide();
this.setEditMode(false);
var _25d=new nitobi.grid.OnAfterCellEditEventArgs(this,cell);
this.fire("AfterCellEdit",_25d);
nitobi.event.evaluate(_259.getOnAfterCellEditEvent(),_25d);
try{
this.focus();
}
catch(e){
}
};
nitobi.grid.Grid.prototype.autoSave=function(){
if(this.isAutoSaveEnabled()){
return this.save();
}
return false;
};
nitobi.grid.Grid.prototype.selectCellByCoords=function(row,_25f){
this.setPosition(row,_25f);
};
nitobi.grid.Grid.prototype.setPosition=function(row,_261){
if(row>=0&&_261>=0){
var _262=this.getCellElement(row,_261);
this.setActiveCell(_262);
}
};
nitobi.grid.Grid.prototype.save=function(){
if(this.datatable.log.selectNodes("//"+nitobi.xml.nsPrefix+"data/*").length==0){
return;
}
if(!this.fire("BeforeSave")){
return;
}
this.datatable.save(nitobi.lang.close(this,this.saveCompleteHandler),this.getOnBeforeSaveEvent());
};
nitobi.grid.Grid.prototype.saveCompleteHandler=function(_263){
if(this.getDataSource().getHandlerError()){
this.fire("HandlerError",_263);
}
this.fire("AfterSave",_263);
};
nitobi.grid.Grid.prototype.focus=function(){
try{
this.keyNav.focus();
this.fire("Focus",new nitobi.base.EventArgs(this));
if(!nitobi.browser.SAFARI&&!nitobi.browser.CHROME){
nitobi.html.cancelEvent(nitobi.html.Event);
return false;
}
}
catch(e){
}
};
nitobi.grid.Grid.prototype.blur=function(){
this.clearActiveRows();
this.selection.clear();
this.blurActiveCell(null);
this.activateCell(null);
this.fire("Blur",new nitobi.base.EventArgs(this));
};
nitobi.grid.Grid.prototype.getRendererForColumn=function(col){
var _265=this.getColumnCount();
if(col>=_265){
col=_265-1;
}
var _266=this.getFrozenLeftColumnCount();
if(col<_266){
return this.MidLeftRenderer;
}else{
return this.MidCenterRenderer;
}
};
nitobi.grid.Grid.prototype.getColumnOuterTemplate=function(col){
return this.getRendererForColumn(col).xmlTemplate.selectSingleNode("//*[@match='ntb:e']/div/div["+col+"]");
};
nitobi.grid.Grid.prototype.getColumnInnerTemplate=function(col){
return this.getColumnOuterXslTemplate(col).selectSingleNode("*[2]");
};
nitobi.grid.Grid.prototype.makeXSL=function(){
var fL=this.getFrozenLeftColumnCount();
var cs=this.getColumnCount();
var rh=this.isRowHighlightEnabled();
var _26c="_default";
if(this.datatable!=null){
_26c=this.datatable.id;
}
var _26d=0;
var _26e=fL;
var _26f=this.model.selectSingleNode("state/nitobi.grid.Columns");
this.TopLeftRenderer.generateXslTemplate(_26f,null,_26d,_26e,this.isColumnIndicatorsEnabled(),this.isRowIndicatorsEnabled(),rh,this.isToolTipsEnabled());
this.TopLeftRenderer.dataTableId=_26c;
_26d=fL;
_26e=cs-fL;
this.TopCenterRenderer.generateXslTemplate(_26f,null,_26d,_26e,this.isColumnIndicatorsEnabled(),this.isRowIndicatorsEnabled(),rh,this.isToolTipsEnabled());
this.TopCenterRenderer.dataTableId=_26c;
this.MidLeftRenderer.generateXslTemplate(_26f,null,0,fL,0,this.isRowIndicatorsEnabled(),rh,this.isToolTipsEnabled(),"left");
this.MidLeftRenderer.dataTableId=_26c;
this.MidCenterRenderer.generateXslTemplate(_26f,null,fL,cs-fL,0,0,rh,this.isToolTipsEnabled());
this.MidCenterRenderer.dataTableId=_26c;
this.fire("AfterMakeXsl");
};
nitobi.grid.Grid.prototype.render=function(){
this.generateCss();
this.updateCellRanges();
};
nitobi.grid.Grid.prototype.refilter=nitobi.grid.Grid.prototype.render;
nitobi.grid.Grid.prototype.getColumnDefinitions=function(){
return this.model.selectNodes("state/nitobi.grid.Columns/*");
};
nitobi.grid.Grid.prototype.getVisibleColumnDefinitions=function(){
return this.model.selectNodes("state/nitobi.grid.Columns/*[@Visible='1']");
};
nitobi.grid.Grid.prototype.initializeModelFromDeclaration=function(){
var _270=this.Declaration.grid.documentElement.attributes;
var len=_270.length;
for(var i=0;i<len;i++){
var _273=_270[i];
var _274=this.properties[_273.nodeName];
if(_274!=null){
this["set"+_274.n](_273.nodeValue);
}
}
this.model.documentElement.setAttribute("ID",this.uid);
this.model.documentElement.setAttribute("uniqueID",this.uid);
};
nitobi.grid.Grid.prototype.setModelValues=function(_275,_276){
var _277=_275.getAttribute("DataType");
var _278=_275.getAttribute("type").toLowerCase();
var _279=_276.attributes;
for(var j=0;j<_279.length;j++){
var _27b=_279[j];
var _27c=_27b.nodeName.toLowerCase();
var _27d=this.xColumnProperties[_277+"column"][_27c]||this.xColumnProperties["column"][_27c];
var _27e=_27b.nodeValue;
if(_27d.t=="b"){
_27e=nitobi.lang.boolToStr(nitobi.lang.toBool(_27e));
}
_275.setAttribute(_27d.n,_27e);
}
var _27f=_276.selectSingleNode("./ntb:"+_278+"editor");
if(_27f==null){
return;
}
var _280=_27f.attributes;
for(var j=0;j<_280.length;j++){
var _27b=_280[j];
var _27c=_27b.nodeName.toLowerCase();
var _27d=this.xColumnProperties[_278+"editor"][_27c];
var _27e=_27b.nodeValue;
if(_27d.t=="b"){
_27e=nitobi.lang.boolToStr(nitobi.lang.toBool(_27e));
}
_275.setAttribute(_27d.n,_27e);
}
};
nitobi.grid.Grid.prototype.getNewRecordKey=function(){
var _281;
var key;
var _283;
do{
_281=new Date();
key=(_281.getTime()+"."+Math.round(Math.random()*99));
_283=this.datatable.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"e[@xk = '"+key+"']");
}while(_283!=null);
return key;
};
nitobi.grid.Grid.prototype.insertAfterCurrentRow=function(){
if(this.activeCell){
var _284=nitobi.grid.Cell.getRowNumber(this.activeCell);
this.insertRow(_284+1);
}else{
this.insertRow();
}
};
nitobi.grid.Grid.prototype.insertRow=function(_285){
var rows=parseInt(this.getDisplayedRowCount());
var xi=0;
if(_285!=null){
xi=parseInt((_285==null?rows:parseInt(_285)));
xi--;
}
var _288=new nitobi.grid.OnBeforeRowInsertEventArgs(this,this.getRowObject(xi));
if(!this.isRowInsertEnabled()||!this.fire("BeforeRowInsert",_288)){
return;
}
var _289=this.datatable.getTemplateNode();
for(var i=0;i<this.columnCount();i++){
var _28b=this.getColumnObject(i);
var _28c=_28b.getInitial();
if(_28c==null||_28c==""){
var _28d=_28b.getDataType();
if(_28d==null||_28d==""){
_28d="text";
}
switch(_28d){
case "text":
_28c="";
break;
case "number":
_28c=0;
break;
case "date":
_28c="1900-01-01";
break;
}
}
var att=_28b.getxdatafld().substr(1);
if(att!=null&&att!=""){
_289.setAttribute(att,_28c);
}
}
this.clearSurfaces();
this.datatable.createRecord(_289,xi);
this.subscribeOnce("HtmlReady",this.handleAfterRowInsert,this,[xi]);
};
nitobi.grid.Grid.prototype.handleAfterRowInsert=function(xi){
this.setActiveCell(this.getCellElement(xi,0));
this.fire("AfterRowInsert",new nitobi.grid.OnAfterRowInsertEventArgs(this,this.getRowObject(xi)));
};
nitobi.grid.Grid.prototype.deleteCurrentRow=function(){
if(this.activeCell){
this.deleteRow(nitobi.grid.Cell.getRowNumber(this.activeCell));
}else{
alert("First select a record to delete.");
}
};
nitobi.grid.Grid.prototype.deleteSelectedRows=function(){
var _290=new nitobi.grid.OnBeforeRowDeleteEventArgs(this,this.getSelectedRows());
if(!this.isRowDeleteEnabled()||!this.fire("BeforeRowDelete",_290)){
return;
}
var _291=this.getSelectedRows();
var _292=[];
for(row in _291){
_292.push(parseInt(_291[row].getAttribute("xi")));
}
_292.sort(function(a,b){
return a-b;
});
this.clearSurfaces();
var rows=this.getDisplayedRowCount();
try{
this.datatable.deleteRecordsArray(_292);
if(rows<=0){
this.activeCell=null;
}
this.subscribeOnce("HtmlReady",this.handleAfterRowDelete,this,_292);
}
catch(err){
this.dataBind();
}
};
nitobi.grid.Grid.prototype.deleteRow=function(_296){
ntbAssert(_296>=0,"Must specify a row to delete.");
var _297=new nitobi.grid.OnBeforeRowDeleteEventArgs(this,this.getRowObject(_296));
if(!this.isRowDeleteEnabled()||!this.fire("BeforeRowDelete",_297)){
return;
}
this.clearSurfaces();
var rows=this.getDisplayedRowCount();
try{
this.datatable.deleteRecord(_296);
rows--;
if(rows<=0){
this.activeCell=null;
}
this.subscribeOnce("HtmlReady",this.handleAfterRowDelete,this,[_296]);
}
catch(err){
this.dataBind();
}
};
nitobi.grid.Grid.prototype.handleAfterRowDelete=function(xi){
this.setActiveCell(this.getCellElement(xi,0));
this.fire("AfterRowDelete",new nitobi.grid.OnBeforeRowDeleteEventArgs(this,this.getRowObject(xi)));
};
nitobi.grid.Grid.prototype.page=function(dir){
};
nitobi.grid.Grid.prototype.move=function(h,v){
if(this.activeCell!=null){
var hs=1;
var vs=1;
h=(h*hs);
v=(v*vs);
var cell=nitobi.grid.Cell;
var _2a0=cell.getColumnNumber(this.activeCell);
var _2a1=cell.getRowNumber(this.activeCell);
this.selectCellByCoords(_2a1+v,_2a0+h);
var _2a2=new nitobi.grid.CellEventArgs(this,this.activeCell);
if(_2a0+1==this.getVisibleColumnDefinitions().length&&h==1){
this.fire("HitRowEnd",_2a2);
}else{
if(_2a0==0&&h==-1){
this.fire("HitRowStart",_2a2);
}
}
}
};
nitobi.grid.Grid.prototype.handleSelectionMouseUp=function(evt){
if(this.isCellClicked()){
this.ensureCellInView(this.activeCell);
}
this.setCellClicked(false);
if(this.isSingleClickEditEnabled()){
this.edit(evt);
}else{
if(!nitobi.browser.IE){
this.focus();
}
}
};
nitobi.grid.Grid.prototype.loadNextDataPage=function(){
this.loadDataPage(this.getCurrentPageIndex()+1);
};
nitobi.grid.Grid.prototype.loadPreviousDataPage=function(){
this.loadDataPage(this.getCurrentPageIndex()-1);
};
nitobi.grid.Grid.prototype.GetPage=function(_2a4){
ebaErrorReport("GetPage is deprecated please use loadDataPage instead","",EBA_DEBUG);
this.loadDataPage(_2a4);
};
nitobi.grid.Grid.prototype.loadDataPage=function(_2a5){
};
nitobi.grid.Grid.prototype.getSelectedRow=function(rel){
try{
var nRow=-1;
var AC=this.activeCell;
if(AC!=null){
nRow=nitobi.grid.Cell.getRowNumber(AC);
if(rel){
nRow-=this.getfreezetop();
}
}
return nRow;
}
catch(err){
_ntbAssert(false,err.message);
}
};
nitobi.grid.Grid.prototype.handleHandlerError=function(){
var _2a9=this.getDataSource().getHandlerError();
if(_2a9){
this.fire("HandlerError");
}
};
nitobi.grid.Grid.prototype.getRowObject=function(_2aa,_2ab){
var _2ac=_2ab;
if(_2ab==null&&_2aa!=null){
_2ac=_2aa;
}
return new nitobi.grid.Row(this,_2ac);
};
nitobi.grid.Grid.prototype.getSelectedColumn=function(rel){
try{
var nCol=-1;
var AC=this.activeCell;
if(AC!=null){
nCol=parseInt(AC.getAttribute("col"));
if(rel){
nCol-=this.getFrozenLeftColumnCount();
}
}
return nCol;
}
catch(err){
_ntbAssert(false,err.message);
}
};
nitobi.grid.Grid.prototype.getSelectedColumnName=function(){
var _2b0=this.getSelectedColumnObject();
return _2b0.getColumnName();
};
nitobi.grid.Grid.prototype.getSelectedColumnObject=function(){
return this.getColumnObject(this.getSelectedColumn());
};
nitobi.grid.Grid.prototype.columnCount=function(){
try{
var _2b1=this.getColumnDefinitions();
return _2b1.length;
}
catch(err){
_ntbAssert(false,err.message);
}
};
nitobi.grid.Grid.prototype.getCellObject=function(row,col){
var _2b4=col;
var cell=this.cachedCells[row+"_"+col];
if(cell==null){
if(typeof (col)=="string"){
var node=this.model.selectSingleNode("state/nitobi.grid.Columns/nitobi.grid.Column[@xdatafld_orig='"+col+"']");
if(node!=null){
col=parseInt(node.getAttribute("xi"));
}
}
if(typeof (col)=="number"){
cell=new nitobi.grid.Cell(this,row,col);
}else{
cell=null;
}
this.cachedCells[row+"_"+col]=this.cachedCells[row+"_"+_2b4]=cell||"";
}else{
if(cell==""){
cell=null;
}
}
return cell;
};
nitobi.grid.Grid.prototype.getCellText=function(row,col){
return this.getCellObject(row,col).getHtml();
};
nitobi.grid.Grid.prototype.getCellValue=function(row,col){
return this.getCellObject(row,col).getValue();
};
nitobi.grid.Grid.prototype.getCellElement=function(row,_2bc){
return nitobi.grid.Cell.getCellElement(this,row,_2bc);
};
nitobi.grid.Grid.prototype.getSelectedRowObject=function(xi){
var obj=null;
var r=nitobi.grid.Cell.getRowNumber(this.activeCell);
obj=new nitobi.grid.Row(this,r);
return obj;
};
nitobi.grid.Grid.prototype.getColumnObject=function(_2c0){
ntbAssert(_2c0>=0,"Invalid column accessed.");
var _2c1=null;
if(_2c0>=0&&_2c0<this.getColumnDefinitions().length){
_2c1=this.columns[_2c0];
if(_2c1==null){
var _2c2=this.getColumnDefinitions()[_2c0].getAttribute("DataType");
switch(_2c2){
case "number":
_2c1=new nitobi.grid.NumberColumn(this,_2c0);
break;
case "date":
_2c1=new nitobi.grid.DateColumn(this,_2c0);
break;
default:
_2c1=new nitobi.grid.TextColumn(this,_2c0);
break;
}
this.columns[_2c0]=_2c1;
}
}
if(_2c1==null||_2c1.getModel()==null){
return null;
}else{
return _2c1;
}
};
nitobi.grid.Grid.prototype.getSelectedCellObject=function(){
var obj=this.activeCellObject;
if(obj==null){
obj=this.activeCell;
if(obj!=null){
var Cell=nitobi.grid.Cell;
var r=Cell.getRowNumber(obj);
var c=Cell.getColumnNumber(obj);
obj=this.getCellObject(r,c);
}
}
return obj;
};
nitobi.grid.Grid.prototype.autoAddRow=function(){
if(this.activeCell.innerText.replace(/\s/g,"")!=""&&this.autoAdd){
this.deactivateCell();
if(this.active=="Y"){
this.freezeCell();
}
eval(this.getOnRowBlurEvent());
this.insertRow();
this.go("HOME");
this.editCell();
}
};
nitobi.grid.Grid.prototype.setDisplayedRowCount=function(_2c7){
ntbAssert(!isNaN(_2c7),"displayed row was set to nan");
if(this.Scroller){
this.Scroller.view.midcenter.rows=_2c7;
this.Scroller.view.midleft.rows=_2c7;
}
this.displayedRowCount=_2c7;
};
nitobi.grid.Grid.prototype.getDisplayedRowCount=function(){
ntbAssert(!isNaN(this.displayedRowCount),"displayed row count return nan");
return this.displayedRowCount;
};
nitobi.grid.Grid.prototype.getToolsContainer=function(){
this.toolsContainer=this.toolsContainer||document.getElementById("ntb-grid-toolscontainer"+this.uid);
return this.toolsContainer;
};
nitobi.grid.Grid.prototype.getHeaderContainer=function(){
return document.getElementById("ntb-grid-header"+this.uid);
};
nitobi.grid.Grid.prototype.getDataContainer=function(){
return document.getElementById("ntb-grid-data"+this.uid);
};
nitobi.grid.Grid.prototype.getScrollerContainer=function(){
return document.getElementById("ntb-grid-scroller"+this.uid);
};
nitobi.grid.Grid.prototype.getGridContainer=function(){
return nitobi.html.getFirstChild(this.UiContainer);
};
nitobi.grid.Grid.prototype.syncViewports=function(){
if(this.getPagingMode()!=nitobi.grid.PAGINGMODE_STANDARD){
return;
}
var _2c8=this.getFrozenLeftColumnCount();
if(_2c8==0){
return;
}
var _2c9=this.getColumnCount();
var _2ca=false;
var i=0;
while(_2ca==false&&i<_2c9){
var col=this.getColumnObject(i);
if(col.getWrap()>0){
_2ca=true;
}
++i;
}
if(_2ca){
var _2cd=this.scroller.view.midleft;
var _2ce=this.scroller.view.midcenter;
var _2cf=this.getRowsPerPage();
for(i=0;i<_2cf;++i){
left_row=$ntb("row_"+i+"left_"+this.uid);
right_row=$ntb("row_"+i+"_"+this.uid);
if(left_row.clientHeight>right_row.clientHeight){
right_row.style.height=left_row.clientHeight+"px";
}else{
left_row.style.height=right_row.clientHeight+"px";
}
}
}
};
nitobi.grid.Grid.prototype.copy=function(){
var _2d0=this.selection.getCoords();
var data=this.getTableForSelection(_2d0);
var _2d2=new nitobi.grid.OnCopyEventArgs(this,data,_2d0);
if(!this.isCopyEnabled()||!this.fire("BeforeCopy",_2d2)){
return;
}
if(!nitobi.browser.IE){
var _2d3=this.getClipboard();
_2d3.onkeyup=nitobi.lang.close(this,this.focus);
_2d3.value=data;
_2d3.focus();
_2d3.setSelectionRange(0,_2d3.value.length);
}else{
window.clipboardData.setData("Text",data);
}
this.fire("AfterCopy",_2d2);
};
nitobi.grid.Grid.prototype.getTableForSelection=function(_2d4){
var _2d5=this.getColumnMap(_2d4.top.x,_2d4.bottom.x);
var _2d6=nitobi.data.FormatConverter.convertEbaXmlToTsv(this.getDataSource().getDataXmlDoc(),_2d5,_2d4.top.y,_2d4.bottom.y);
return _2d6;
};
nitobi.grid.Grid.prototype.getColumnMap=function(_2d7,_2d8){
var _2d9=this.getColumnDefinitions();
_2d7=(_2d7==null)?0:_2d7;
_2d8=(_2d8==null)?_2d9.length-1:_2d8;
var map=new Array();
for(var i=_2d7;i<=_2d8&&(null!=_2d9[i]);i++){
map.push(_2d9[i].getAttribute("xdatafld").substr(1));
}
return map;
};
nitobi.grid.Grid.prototype.paste=function(){
if(!this.isPasteEnabled()){
return;
}
var _2dc=this.getClipboard();
_2dc.onkeyup=nitobi.lang.close(this,this.pasteDataReady,[_2dc]);
_2dc.focus();
return _2dc;
};
nitobi.grid.Grid.prototype.pasteDataReady=function(_2dd){
_2dd.onkeyup=null;
var _2de=this.selection;
var _2df=_2de.getCoords();
var _2e0=_2df.top.x;
var _2e1=_2e0+nitobi.data.FormatConverter.getDataColumns(_2dd.value)-1;
var _2e2=true;
for(var i=_2e0;i<=_2e1;i++){
var _2e4=this.getColumnObject(i);
if(_2e4){
if(!_2e4.isEditable()){
_2e2=false;
break;
}
}
}
if(!_2e2){
this.fire("PasteFailed",new nitobi.base.EventArgs(this));
this.handleAfterPaste();
return;
}else{
var _2e5=this.getColumnMap(_2e0,_2e1);
var _2e6=_2df.top.y;
var _2e7=Math.max(_2e6+nitobi.data.FormatConverter.getDataRows(_2dd.value)-1,0);
this.getSelection().selectWithCoords(_2e6,_2e0,_2e7,_2e0+_2e5.length-1);
var _2e8=new nitobi.grid.OnPasteEventArgs(this,_2dd.value,_2df);
if(!this.fire("BeforePaste",_2e8)){
return;
}
var _2e9=_2dd.value;
var _2ea=null;
if(_2e9.substr(0,1)=="<"){
_2ea=nitobi.data.FormatConverter.convertHtmlTableToEbaXml(_2e9,_2e5,_2e6);
}else{
_2ea=nitobi.data.FormatConverter.convertTsvToEbaXml(_2e9,_2e5,_2e6);
}
if(_2ea.documentElement!=null){
this.datatable.mergeFromXml(_2ea,nitobi.lang.close(this,this.pasteComplete,[_2ea,_2e6,_2e7,_2e8]));
}
}
};
nitobi.grid.Grid.prototype.pasteComplete=function(_2eb,_2ec,_2ed,_2ee){
this.Scroller.reRender(_2ec,_2ed);
this.subscribeOnce("HtmlReady",this.handleAfterPaste,this,[_2ee]);
};
nitobi.grid.Grid.prototype.handleAfterPaste=function(_2ef){
this.fire("AfterPaste",_2ef);
};
nitobi.grid.Grid.prototype.getClipboard=function(){
var _2f0=document.getElementById("ntb-clipboard"+this.uid);
_2f0.onkeyup=null;
_2f0.value="";
return _2f0;
};
nitobi.grid.Grid.prototype.getSelection=function(){
return this.selection;
};
nitobi.grid.Grid.prototype.handleHtmlReady=function(_2f1){
this.syncViewports();
this.fire("HtmlReady",new nitobi.base.EventArgs(this));
};
nitobi.grid.Grid.prototype.fire=function(evt,args){
return nitobi.event.notify(evt+this.uid,args);
};
nitobi.grid.Grid.prototype.subscribe=function(evt,func,_2f6){
if(this.subscribedEvents==null){
this.subscribedEvents={};
}
if(typeof (_2f6)=="undefined"){
_2f6=this;
}
var guid=nitobi.event.subscribe(evt+this.uid,nitobi.lang.close(_2f6,func));
this.subscribedEvents[guid]=evt+this.uid;
return guid;
};
nitobi.grid.Grid.prototype.subscribeOnce=function(evt,func,_2fa,_2fb){
var guid=null;
var _2fd=this;
var _2fe=function(){
func.apply(_2fa||this,_2fb||arguments);
_2fd.unsubscribe(evt,guid);
};
guid=this.subscribe(evt,_2fe);
};
nitobi.grid.Grid.prototype.unsubscribe=function(evt,guid){
return nitobi.event.unsubscribe(evt+this.uid,guid);
};
nitobi.grid.Grid.prototype.dispose=function(){
try{
this.element.jsObject=null;
editorXslProc=null;
var H=nitobi.html;
H.detachEvents(this.getGridContainer(),this.events);
H.detachEvents(this.getHeaderContainer(),this.headerEvents);
H.detachEvents(this.getDataContainer(),this.cellEvents);
H.detachEvents(this.getScrollerContainer(),this.scrollerEvents);
H.detachEvents(this.keyNav,this.keyEvents);
for(var item in this.subscribedEvents){
var _303=this.subscribedEvents[item];
this.unsubscribe(_303.substring(0,_303.length-this.uid.length),item);
}
this.UiContainer.parentNode.removeChild(this.UiContainer);
for(var item in this){
if(this[item]!=null){
if(this[item].dispose instanceof Function){
this[item].dispose();
}
this[item]=null;
}
}
nitobi.form.ControlFactory.instance.dispose();
}
catch(e){
}
};
nitobi.Grid=nitobi.grid.Grid;
nitobi.grid.Cell=function(grid,row,_306){
if(row==null||grid==null){
return null;
}
this.grid=grid;
var _307=null;
if(typeof (row)=="object"){
var cell=row;
row=Number(cell.getAttribute("xi"));
_306=cell.getAttribute("col");
_307=cell;
}else{
_307=this.grid.getCellElement(row,_306);
}
this.DomNode=_307;
this.row=Number(row);
this.Row=this.row;
this.column=Number(_306);
this.Column=this.column;
this.dataIndex=this.Row;
};
nitobi.grid.Cell.prototype.getData=function(){
if(this.DataNode==null){
this.DataNode=this.grid.datatable.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"e[@xi="+this.dataIndex+"]/"+this.grid.datatable.fieldMap[this.getColumnObject().getColumnName()]);
}
return this.DataNode;
};
nitobi.grid.Cell.prototype.getModel=function(){
if(this.ModelNode==null){
this.ModelNode=this.grid.model.selectSingleNode("//nitobi.grid.Columns/nitobi.grid.Column[@xi='"+this.column+"']");
}
return this.ModelNode;
};
nitobi.grid.Cell.prototype.setRow=function(){
this.jSET("Row",arguments);
};
nitobi.grid.Cell.prototype.getRow=function(){
return this.Row;
};
nitobi.grid.Cell.prototype.setColumn=function(){
this.jSET("Column",arguments);
};
nitobi.grid.Cell.prototype.getColumn=function(){
return this.Column;
};
nitobi.grid.Cell.prototype.setDomNode=function(){
this.jSET("DomNode",arguments);
};
nitobi.grid.Cell.prototype.getDomNode=function(){
return this.DomNode;
};
nitobi.grid.Cell.prototype.setDataNode=function(){
this.jSET("DataNode",arguments);
};
nitobi.grid.Cell.prototype.setValue=function(_309,_30a){
if(_309==this.getValue()){
return;
}
var _30b=this.getColumnObject();
var _30c="";
switch(_30b.getType()){
case "PASSWORD":
for(var i=0;i<_309.length;i++){
_30c+="*";
}
break;
case "NUMBER":
if(this.numberXsl==null){
this.numberXsl=nitobi.form.numberXslProc;
}
if(_309==""){
_309=_30b.getEditor().defaultValue||0;
}
if(this.DomNode!=null){
if(_309<0){
nitobi.html.Css.addClass(this.DomNode,"ntb-cell-negativenumber");
}else{
nitobi.html.Css.removeClass(this.DomNode,"ntb-cell-negativenumber");
}
}
var mask=_30b.getMask();
var _30f=_30b.getNegativeMask();
var _310=_309;
if(_309<0&&_30f!=""){
mask=_30f;
_310=(_309+"").replace("-","");
}
this.numberXsl.addParameter("number",_310,"");
this.numberXsl.addParameter("mask",mask,"");
this.numberXsl.addParameter("group",_30b.getGroupingSeparator(),"");
this.numberXsl.addParameter("decimal",_30b.getDecimalSeparator(),"");
_30c=nitobi.xml.transformToString(nitobi.xml.Empty,this.numberXsl);
if(""==_30c&&_309!=""){
_30c=nitobi.html.getFirstChild(this.DomNode).innerHTML;
_309=this.getValue();
}
break;
case "DATE":
if(this.dateXsl==null){
this.dateXsl=nitobi.form.dateXslProc.stylesheet;
}
var d=new Date();
var _312=nitobi.xml.createXmlDoc("<root><date>"+_309+"</date><year>"+(d.getFullYear())+"</year><mask>"+this.columnObject.getMask()+"</mask></root>");
_30c=nitobi.xml.transformToString(_312,this.dateXsl);
if(""==_30c){
_30c=nitobi.html.getFirstChild(this.DomNode).innerHTML;
_309=this.getValue();
}
break;
case "TEXTAREA":
_30c=nitobi.html.encode(_309);
break;
case "LOOKUP":
var _313=_30b.getModel();
var _314=_313.getAttribute("DatasourceId");
var _315=this.grid.data.getTable(_314);
var _316=_313.getAttribute("DisplayFields");
var _317=_313.getAttribute("ValueField");
var _318=_315.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"e[@"+_317+"='"+_309+"']/@"+_316);
if(_318!=null){
_30c=_318.nodeValue;
}else{
_30c=_309;
}
break;
case "CHECKBOX":
var _313=_30b.getModel();
var _314=_313.getAttribute("DatasourceId");
var _315=this.grid.data.getTable(_314);
var _316=_313.getAttribute("DisplayFields");
var _317=_313.getAttribute("ValueField");
var _319=_313.getAttribute("CheckedValue");
if(_319==""||_319==null){
_319=0;
}
var _31a=_315.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"e[@"+_317+"='"+_309+"']/@"+_316).nodeValue;
var _31b=(_309==_319)?"checked":"unchecked";
_30c="<div style=\"overflow:hidden;\"><div class=\"ntb-checkbox ntb-checkbox-"+_31b+"\" checked=\""+_309+"\">&nbsp;</div><div class=\"ntb-checkbox-text\">"+nitobi.html.encode(_31a)+"</div></div>";
break;
case "LISTBOX":
var _313=_30b.getModel();
var _314=_313.getAttribute("DatasourceId");
var _315=this.grid.data.getTable(_314);
var _316=_313.getAttribute("DisplayFields");
var _317=_313.getAttribute("ValueField");
_30c=_315.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"e[@"+_317+"='"+_309+"']/@"+_316).nodeValue;
break;
case "IMAGE":
_30c=nitobi.html.getFirstChild(this.DomNode).innerHTML;
if(nitobi.lang.typeOf(_309)==nitobi.lang.type.HTMLNODE){
_30c="<img border=\"0\" src=\""+_309.getAttribute("src")+"\" />";
}else{
if(typeof (_309)=="string"){
_30c="<img border=\"0\" src=\""+_309+"\" />";
}
}
break;
default:
_30c=_309;
}
_30c=_30c||"&nbsp;";
if(this.DomNode!=null){
var elem=nitobi.html.getFirstChild(this.DomNode);
elem.innerHTML=_30c||"&nbsp;";
elem.setAttribute("title",_309);
this.DomNode.setAttribute("value",_309);
}
this.grid.datatable.updateRecord(this.dataIndex,_30b.getColumnName(),_309);
};
nitobi.grid.Cell.prototype.getValue=function(){
var _31d=this.getColumnObject();
var val=this.GETDATA();
switch(_31d.getType()){
case "NUMBER":
val=parseFloat(val);
break;
default:
}
return val;
};
nitobi.grid.Cell.prototype.getHtml=function(){
return nitobi.html.getFirstChild(this.DomNode).innerHTML;
};
nitobi.grid.Cell.prototype.edit=function(){
this.grid.setActiveCell(this.DomNode);
this.grid.edit();
};
nitobi.grid.Cell.prototype.GETDATA=function(){
var node=this.getData();
if(node!=null){
return node.value;
}
};
nitobi.grid.Cell.prototype.xGETMETA=function(){
if(this.MetaNode==null){
return null;
}
var node=this.MetaNode;
node=node.selectSingleNode("@"+arguments[0]);
if(node!=null){
return node.value;
}
};
nitobi.grid.Cell.prototype.xSETMETA=function(){
var node=this.MetaNode;
if(node!=null){
node.setAttribute(arguments[0],arguments[1][0]);
}else{
alert("Cannot set property: "+arguments[0]);
}
};
nitobi.grid.Cell.prototype.xSETCSS=function(){
var node=this.DomNode;
if(node!=null){
node.style.setAttribute(arguments[0],arguments[1][0]);
}else{
alert("Cannot set property: "+arguments[0]);
}
};
nitobi.grid.Cell.prototype.xGET=function(){
var node=this.getModel();
node=node.selectSingleNode(arguments[0]);
if(node!=null){
return node.value;
}
};
nitobi.grid.Cell.prototype.xSET=function(){
var node=this.getModel();
node=node.selectSingleNode(arguments[0]);
if(node!=null){
node.nodeValue=arguments[1][0];
}
};
nitobi.grid.Cell.prototype.getStyle=function(){
return this.DomNode.style;
};
nitobi.grid.Cell.prototype.getColumnObject=function(){
if(typeof (this.columnObject)=="undefined"){
this.columnObject=this.grid.getColumnObject(this.getColumn());
}
return this.columnObject;
};
nitobi.grid.Cell.getCellElement=function(grid,row,_327){
return $ntb("cell_"+row+"_"+_327+"_"+grid.uid);
};
nitobi.grid.Cell.getRowNumber=function(_328){
return parseInt(_328.getAttribute("xi"));
};
nitobi.grid.Cell.getColumnNumber=function(_329){
return parseInt(_329.getAttribute("col"));
};
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.CellEventArgs=function(_32a,cell){
nitobi.grid.CellEventArgs.baseConstructor.call(this,_32a);
this.cell=cell;
};
nitobi.lang.extend(nitobi.grid.CellEventArgs,nitobi.base.EventArgs);
nitobi.grid.CellEventArgs.prototype.getCell=function(){
return this.cell;
};
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.RowEventArgs=function(_32c,row){
this.grid=_32c;
this.row=row;
this.event=nitobi.html.Event;
};
nitobi.grid.RowEventArgs.prototype.getSource=function(){
return this.grid;
};
nitobi.grid.RowEventArgs.prototype.getRow=function(){
return this.row;
};
nitobi.grid.RowEventArgs.prototype.getEvent=function(){
return this.event;
};
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.SelectionEventArgs=function(_32e,data,_330){
this.source=_32e;
this.coords=_330;
this.data=data;
};
nitobi.grid.SelectionEventArgs.prototype.getSource=function(){
return this.source;
};
nitobi.grid.SelectionEventArgs.prototype.getCoords=function(){
return this.coords;
};
nitobi.grid.SelectionEventArgs.prototype.getData=function(){
return this.data;
};
nitobi.grid.Column=function(grid,_332){
this.grid=grid;
this.column=_332;
this.uid=nitobi.base.getUid();
this.modelNodes={};
};
nitobi.grid.Column.prototype={setAlign:function(){
this.xSET("Align",arguments);
},getAlign:function(){
return this.xGET("Align",arguments);
},getWrap:function(){
return parseInt(this.xGET("Wrap",arguments));
},setClassName:function(){
this.xSET("ClassName",arguments);
},getClassName:function(){
return this.xGET("ClassName",arguments);
},setCssStyle:function(){
this.xSET("CssStyle",arguments);
},getCssStyle:function(){
return this.xGET("CssStyle",arguments);
},setColumnName:function(){
this.xSET("ColumnName",arguments);
},getColumnName:function(){
return this.xGET("ColumnName",arguments);
},setType:function(){
this.xSET("type",arguments);
},getType:function(){
return this.xGET("type",arguments);
},setDataType:function(){
this.xSET("DataType",arguments);
},getDataType:function(){
return this.xGET("DataType",arguments);
},setEditable:function(){
this.xSET("Editable",arguments);
},isEditable:function(){
return nitobi.lang.toBool(this.xGET("Editable",arguments),true);
},setInitial:function(){
this.xSET("Initial",arguments);
},getInitial:function(){
return this.xGET("Initial",arguments);
},getHidden:function(){
return this.xGET("Hidden",arguments);
},setHidden:function(){
return this.xSET("Hidden",arguments);
},getHeaderAlign:function(){
return this.xGET("HeaderAlign",arguments);
},setHeaderAlign:function(){
return this.xSET("HeaderAlign",arguments);
},setLabel:function(){
this.xSET("Label",arguments);
},getLabel:function(){
return this.xGET("Label",arguments);
},setGetHandler:function(){
this.xSET("GetHandler",arguments);
},getGetHandler:function(){
return this.xGET("GetHandler",arguments);
},setDatasourceId:function(){
this.xSET("DatasourceId",arguments);
},getDatasourceId:function(){
return this.xGET("DatasourceId",arguments);
},setTemplate:function(){
this.xSET("Template",arguments);
},getTemplate:function(){
return this.xGET("Template",arguments);
},setTemplateUrl:function(){
this.xSET("TemplateUrl",arguments);
},getTemplateUrl:function(){
return this.xGET("TemplateUrl",arguments);
},setMaxLength:function(){
this.xSET("maxlength",arguments);
},getMaxLength:function(){
return Number(this.xGET("maxlength",arguments));
},setSortDirection:function(){
this.xSET("SortDirection",arguments);
},getSortDirection:function(){
return this.xGET("SortDirection",arguments);
},setSortEnabled:function(){
this.xSET("SortEnabled",arguments);
},isSortEnabled:function(){
return nitobi.lang.toBool(this.xGET("SortEnabled",arguments),true);
},setWidth:function(){
this.xSET("Width",arguments);
},getWidth:function(){
return Number(this.xGET("Width",arguments));
},setSize:function(){
this.xSET("Size",arguments);
},getSize:function(){
return Number(this.xGET("Size",arguments));
},setVisible:function(){
this.xSET("Visible",arguments);
},isVisible:function(){
return nitobi.lang.toBool(this.xGET("Visible",arguments),true);
},setxdatafld:function(){
this.xSET("xdatafld",arguments);
},getxdatafld:function(){
return this.xGET("xdatafld",arguments);
},setValue:function(){
this.xSET("Value",arguments);
},getValue:function(){
return this.xGET("Value",arguments);
},setxi:function(){
this.xSET("xi",arguments);
},getxi:function(){
return Number(this.xGET("xi",arguments));
},setEditor:function(){
this.xSET("Editor",arguments);
},getEditor:function(){
return this.xGET("Editor",arguments);
},setDisplayFields:function(){
this.xSET("DisplayFields",arguments);
},getDisplayFields:function(){
return this.xGET("DisplayFields",arguments);
},setValueField:function(){
this.xSET("ValueField",arguments);
},getValueField:function(){
return this.xGET("ValueField",arguments);
},setDelay:function(){
this.xSET("Delay",arguments);
},getDelay:function(){
return Number(this.xGET("Delay",arguments));
},setReferenceColumn:function(){
this.xSET("ReferenceColumn",arguments);
},getReferenceColumn:function(){
return this.xGET("ReferenceColumn",arguments);
},setOnCellClickEvent:function(){
this.xSET("OnCellClickEvent",arguments);
},getOnCellClickEvent:function(){
return this.xGET("OnCellClickEvent",arguments);
},setOnBeforeCellClickEvent:function(){
this.xSET("OnBeforeCellClickEvent",arguments);
},getOnBeforeCellClickEvent:function(){
return this.xGET("OnBeforeCellClickEvent",arguments);
},setOnCellDblClickEvent:function(){
this.xSET("OnCellDblClickEvent",arguments);
},getOnCellDblClickEvent:function(){
return this.xGET("OnCellDblClickEvent",arguments);
},setOnHeaderDoubleClickEvent:function(){
this.xSET("OnHeaderDoubleClickEvent",arguments);
},getOnHeaderDoubleClickEvent:function(){
return this.xGET("OnHeaderDoubleClickEvent",arguments);
},setOnHeaderClickEvent:function(){
this.xSET("OnHeaderClickEvent",arguments);
},getOnHeaderClickEvent:function(){
return this.xGET("OnHeaderClickEvent",arguments);
},setOnBeforeResizeEvent:function(){
this.xSET("OnBeforeResizeEvent",arguments);
},getOnBeforeResizeEvent:function(){
return this.xGET("OnBeforeResizeEvent",arguments);
},setOnAfterResizeEvent:function(){
this.xSET("OnAfterResizeEvent",arguments);
},getOnAfterResizeEvent:function(){
return this.xGET("OnAfterResizeEvent",arguments);
},setOnCellValidateEvent:function(){
this.xSET("OnCellValidateEvent",arguments);
},getOnCellValidateEvent:function(){
return this.xGET("OnCellValidateEvent",arguments);
},setOnBeforeCellEditEvent:function(){
this.xSET("OnBeforeCellEditEvent",arguments);
},getOnBeforeCellEditEvent:function(){
return this.xGET("OnBeforeCellEditEvent",arguments);
},setOnAfterCellEditEvent:function(){
this.xSET("OnAfterCellEditEvent",arguments);
},getOnAfterCellEditEvent:function(){
return this.xGET("OnAfterCellEditEvent",arguments);
},setOnCellBlurEvent:function(){
this.xSET("OnCellBlurEvent",arguments);
},getOnCellBlurEvent:function(){
return this.xGET("OnCellBlurEvent",arguments);
},setOnCellFocusEvent:function(){
this.xSET("OnCellFocusEvent",arguments);
},getOnCellFocusEvent:function(){
return this.xGET("OnCellFocusEvent",arguments);
},setOnBeforeSortEvent:function(){
this.xSET("OnBeforeSortEvent",arguments);
},getOnBeforeSortEvent:function(){
return this.xGET("OnBeforeSortEvent",arguments);
},setOnAfterSortEvent:function(){
this.xSET("OnAfterSortEvent",arguments);
},getOnAfterSortEvent:function(){
return this.xGET("OnAfterSortEvent",arguments);
},setOnCellUpdateEvent:function(){
this.xSET("OnCellUpdateEvent",arguments);
},getOnCellUpdateEvent:function(){
return this.xGET("OnCellUpdateEvent",arguments);
},setOnKeyDownEvent:function(){
this.xSET("OnKeyDownEvent",arguments);
},getOnKeyDownEvent:function(){
return this.xGET("OnKeyDownEvent",arguments);
},setOnKeyUpEvent:function(){
this.xSET("OnKeyUpEvent",arguments);
},getOnKeyUpEvent:function(){
return this.xGET("OnKeyUpEvent",arguments);
},setOnKeyPressEvent:function(){
this.xSET("OnKeyPressEvent",arguments);
},getOnKeyPressEvent:function(){
return this.xGET("OnKeyPressEvent",arguments);
},setOnChangeEvent:function(){
this.xSET("OnChangeEvent",arguments);
},getOnChangeEvent:function(){
return this.xGET("OnChangeEvent",arguments);
},setGetOnEnter:function(){
this.xbSET("GetOnEnter",arguments);
},isGetOnEnter:function(){
return nitobi.lang.toBool(this.xGET("GetOnEnter",arguments),true);
},setAutoComplete:function(){
this.xbSET("AutoComplete",arguments);
},isAutoComplete:function(){
return nitobi.lang.toBool(this.xGET("AutoComplete",arguments),true);
},setAutoClear:function(){
this.xbSET("AutoClear",arguments);
},isAutoClear:function(){
return nitobi.lang.toBool(this.xGET("AutoClear",arguments),true);
}};
nitobi.grid.Column.prototype.getModel=function(){
if(this.ModelNode==null){
var _333=this.column;
this.ModelNode=this.grid.model.selectNodes("//state/nitobi.grid.Columns/nitobi.grid.Column")[_333];
}
return this.ModelNode;
};
nitobi.grid.Column.prototype.getHeaderElement=function(){
return nitobi.grid.Column.getColumnHeaderElement(this.grid,this.column);
};
nitobi.grid.Column.prototype.getEditor=function(){
};
nitobi.grid.Column.prototype.getStyle=function(){
var _334=this.getClassName();
return nitobi.html.getClass(_334);
};
nitobi.grid.Column.prototype.getHeaderStyle=function(){
var _335="ntb-column-header"+this.grid.uid+"_"+this.column;
return nitobi.html.getClass(_335);
};
nitobi.grid.Column.prototype.getDataStyle=function(){
var _336="ntb-column-data"+this.grid.uid+"_"+this.column;
return nitobi.html.getClass(_336);
};
nitobi.grid.Column.prototype.getEditor=function(){
return nitobi.form.ControlFactory.instance.getEditor(this.grid,this);
};
nitobi.grid.Column.prototype.hide=function(){
var _337=this.getWidth();
var _338="ntb-column"+this.grid.uid+"_"+String(this.column+1);
var _339=nitobi.html.getClass(_338,true);
_339.display="none";
this.grid.resizePanes(-_337,this.column);
this.grid.adjustHorizontalScrollBars();
};
nitobi.grid.Column.prototype.show=function(){
var _33a=this.getWidth();
var _33b="ntb-column"+this.grid.uid+"_"+String(this.column+1);
var _33c=nitobi.html.getClass(_33b,true);
_33c.display="";
this.grid.resizePanes(_33a,this.column);
this.grid.adjustHorizontalScrollBars();
};
nitobi.grid.Column.prototype.toggleVis=function(){
var _33d=this.grid.Declaration.columns.firstChild.childNodes[this.column];
var _33e=this.grid.Declaration.grid.firstChild.firstChild.childNodes[this.column];
var _33f=this.grid.getColumnDefinitions()[this.column];
var _340="ntb-column"+this.grid.uid+"_"+String(this.column+1);
var _341=nitobi.html.getClass(_340,true);
if(_341.display=="none"){
_33d.setAttribute("visible","true");
_33e.setAttribute("visible","true");
_33f.setAttribute("Visible","1");
this.show();
}else{
_33d.setAttribute("visible","false");
_33e.setAttribute("visible","false");
_33f.setAttribute("Visible","0");
this.hide();
}
};
nitobi.grid.Column.prototype.xGET=function(){
var node=null,_343="@"+arguments[0],val="";
var _345=this.modelNodes[_343];
if(_345!=null){
node=_345;
}else{
node=this.modelNodes[_343]=this.getModel().selectSingleNode(_343);
}
if(node!=null){
val=node.nodeValue;
}
return val;
};
nitobi.grid.Column.prototype.xSET=function(){
var node=this.getModel();
if(node!=null){
node.setAttribute(arguments[0],arguments[1][0]);
}
};
nitobi.grid.Column.prototype.xbSETMODEL=function(){
var node=this.getModel();
if(node!=null){
node.setAttribute(arguments[0],nitobi.lang.boolToStr(arguments[1][0]));
}
};
nitobi.grid.Column.prototype.eSET=function(name,_349){
var _34a=_349[0];
var _34b=_34a;
var _34c=name.substr(2);
_34c=_34c.substr(0,_34c.length-5);
if(typeof (_34a)=="string"){
_34b=function(_34d){
return eval(_34a);
};
}
if(typeof (this[name])!="undefined"){
alert("unsubscribe");
this.unsubscribe(_34c,this[name]);
}
var guid=this.subscribe(_34c,_34b);
this.jSET(name,[guid]);
};
nitobi.grid.Column.prototype.jSET=function(name,val){
this[name]=val[0];
};
nitobi.grid.Column.prototype.fire=function(evt,args){
return nitobi.event.notify(evt+this.uid,args);
};
nitobi.grid.Column.prototype.subscribe=function(evt,func,_355){
if(typeof (_355)=="undefined"){
_355=this;
}
return nitobi.event.subscribe(evt+this.uid,nitobi.lang.close(_355,func));
};
nitobi.grid.Column.prototype.unsubscribe=function(evt,func){
return nitobi.event.unsubscribe(evt+this.uid,func);
};
nitobi.grid.Column.getColumnHeaderElement=function(grid,_359){
return $ntb("columnheader_"+_359+"_"+grid.uid);
};
nitobi.grid.Column.prototype.inRange=function(x){
var left=this.getHeaderElement().offsetLeft;
var _35c=left+this.getWidth();
return left<x&&x<_35c;
};
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.ColumnEventArgs=function(_35d,_35e){
this.grid=_35d;
this.column=_35e;
this.event=nitobi.html.Event;
};
nitobi.grid.ColumnEventArgs.prototype.getSource=function(){
return this.grid;
};
nitobi.grid.ColumnEventArgs.prototype.getColumn=function(){
return this.column;
};
nitobi.grid.ColumnEventArgs.prototype.getEvent=function(){
return this.event;
};
nitobi.grid.ColumnEventArgs.prototype.getDirection=function(){
};
nitobi.grid.ColumnResizer=function(grid){
this.grid=grid;
this.hScrollClass=null;
this.grid_id=this.grid.UiContainer.parentid;
this.line=document.getElementById("ntb-column-resizeline"+this.grid.uid);
this.lineStyle=this.line.style;
if(nitobi.browser.IE){
this.surface=document.getElementById("ebagridresizesurface_");
if(this.surface==null){
this.surface=document.createElement("div");
this.surface.id="ebagridresizesurface_";
this.surface.className="ntb-column-resize-surface";
this.grid.UiContainer.appendChild(this.surface);
}
}
this.column;
this.onAfterResize=new nitobi.base.Event();
};
nitobi.grid.ColumnResizer.prototype.startResize=function(grid,_361,_362,evt){
this.grid=grid;
this.column=_361;
var x=nitobi.html.getEventCoords(evt).x;
if(nitobi.browser.IE){
this.surface.style.display="block";
nitobi.drawing.align(this.surface,this.grid.element,nitobi.drawing.align.SAMEHEIGHT|nitobi.drawing.align.SAMEWIDTH|nitobi.drawing.align.ALIGNTOP|nitobi.drawing.align.ALIGNLEFT);
}
this.x=x;
this.lineStyle.display="block";
var _365=nitobi.html.getBoundingClientRect(this.grid.UiContainer).left;
this.lineStyle.left=x-_365+"px";
this.lineStyle.height=this.grid.Scroller.scrollSurface.offsetHeight+"px";
nitobi.drawing.align(this.line,_362,nitobi.drawing.align.ALIGNTOP,0,0,nitobi.html.getHeight(_362)+1);
nitobi.ui.startDragOperation(this.line,evt,false,true,this,this.endResize);
};
nitobi.grid.ColumnResizer.prototype.endResize=function(_366){
var x=_366.x;
var Y=_366.y;
if(nitobi.browser.IE){
this.surface.style.display="none";
}
var ls=this.lineStyle;
ls.display="none";
ls.top="-3000px";
ls.left="-3000px";
this.dx=x-this.x;
this.onAfterResize.notify(this);
};
nitobi.grid.ColumnResizer.prototype.dispose=function(){
this.grid=null;
this.line=null;
this.lineStyle=null;
this.surface=null;
};
nitobi.grid.GridResizer=function(grid){
this.grid=grid;
this.widthFixed=false;
this.heightFixed=false;
this.minHeight=0;
this.minWidth=0;
this.box=document.getElementById("ntb-grid-resizebox"+grid.uid);
this.onAfterResize=new nitobi.base.Event();
};
nitobi.grid.GridResizer.prototype.startResize=function(grid,_36c){
this.grid=grid;
var _36d=null;
var x,y;
var _370=nitobi.html.getEventCoords(_36c);
x=_370.x;
y=_370.y;
this.x=x;
this.y=y;
var w=grid.getWidth();
var h=grid.getHeight();
var L=grid.element.offsetLeft;
var T=grid.element.offsetTop;
this.resizeW=!this.widthFixed;
this.resizeH=!this.heightFixed;
if(this.resizeW||this.resizeH){
this.box.style.cursor=(this.resizeW&&this.resizeH)?"nw-resize":(this.resizeW)?"w-resize":"n-resize";
this.box.style.display="block";
var _375=nitobi.drawing.align.SAMEWIDTH|nitobi.drawing.align.SAMEHEIGHT|nitobi.drawing.align.ALIGNTOP|nitobi.drawing.align.ALIGNLEFT;
nitobi.drawing.align(this.box,this.grid.element,_375,0,0,0,0,false);
this.dd=new nitobi.ui.DragDrop(this.box,false,false);
this.dd.onDragStop.subscribe(this.endResize,this);
this.dd.onMouseMove.subscribe(this.resize,this);
this.dd.startDrag(_36c);
}
};
nitobi.grid.GridResizer.prototype.resize=function(){
var x=this.dd.x;
var y=this.dd.y;
var rect=nitobi.html.getBoundingClientRect(this.grid.UiContainer);
var L=rect.left;
var T=rect.top;
this.box.style.display="block";
if((x-L)>this.minWidth){
this.box.style.width=(x-L)+"px";
}
if((y-T)>this.minHeight){
this.box.style.height=(y-T)+"px";
}
};
nitobi.grid.GridResizer.prototype.endResize=function(){
var x=this.dd.x;
var y=this.dd.y;
this.box.style.display="none";
var _37d=this.grid.getWidth();
var _37e=this.grid.getHeight();
this.newWidth=Math.max(parseInt(_37d)+(x-this.x),this.minWidth);
this.newHeight=Math.max(parseInt(_37e)+(y-this.y),this.minHeight);
if(isNaN(this.newWidth)||isNaN(this.newHeight)){
return;
}
this.onAfterResize.notify(this);
};
nitobi.grid.GridResizer.prototype.dispose=function(){
this.grid=null;
};
nitobi.data.FormatConverter={};
nitobi.data.FormatConverter.convertHtmlTableToEbaXml=function(_37f,_380,_381){
var s="<xsl:stylesheet version=\"1.0\" xmlns:ntb=\"http://www.nitobi.com\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output encoding=\"UTF-8\" method=\"xml\" omit-xml-declaration=\"no\" />";
s+="<xsl:template match=\"//TABLE\"><ntb:data id=\"_default\">";
s+="<xsl:apply-templates /></ntb:data> </xsl:template>";
s+="<xsl:template match = \"//TR\">  <xsl:element name=\"ntb:e\"> <xsl:attribute name=\"xi\"><xsl:value-of select=\"position()-1+"+parseInt(_381)+"\"/></xsl:attribute>";
for(var _383=0;_383<_380.length;_383++){
s+="<xsl:attribute name=\""+_380[_383]+"\" ><xsl:value-of select=\"TD["+parseInt(_383+1)+"]\"/></xsl:attribute>";
}
s+="</xsl:element></xsl:template>";
s+="</xsl:stylesheet>";
var _384=nitobi.xml.createXmlDoc(_37f);
var _385=nitobi.xml.createXslProcessor(s);
var _386=nitobi.xml.transformToXml(_384,_385);
return _386;
};
nitobi.data.FormatConverter.convertTsvToEbaXml=function(tsv,_388,_389){
if(!nitobi.browser.IE&&tsv[tsv.length-1]!="\n"){
tsv=tsv+"\n";
}
var _38a="<TABLE><TBODY>"+tsv.replace(/[\&\r]/g,"").replace(/([^\t\n]*)[\t]/g,"<TD>$1</TD>").replace(/([^\n]*?)\n/g,"<TR>$1</TR>").replace(/\>([^\<]*)\<\/TR/g,"><TD>$1</TD></TR")+"</TBODY></TABLE>";
if(_38a.indexOf("<TBODY><TR>")==-1){
_38a=_38a.replace(/TBODY\>(.*)\<\/TBODY/,"TBODY><TR><TD>$1</TD></TR></TBODY");
}
return nitobi.data.FormatConverter.convertHtmlTableToEbaXml(_38a,_388,_389);
};
nitobi.data.FormatConverter.convertTsvToJs=function(tsv){
var _38c="["+tsv.replace(/[\&\r]/g,"").replace(/([^\t\n]*)[\t]/g,"$1\",\"").replace(/([^\n]*?)\n/g,"[\"$1\"],")+"]";
return _38c;
};
nitobi.data.FormatConverter.convertEbaXmlToHtmlTable=function(_38d,_38e,_38f,_390){
var s="<xsl:stylesheet version=\"1.0\" xmlns:ntb=\"http://www.nitobi.com\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output encoding=\"UTF-8\" method=\"html\" omit-xml-declaration=\"yes\" /><xsl:template match = \"*\"><xsl:apply-templates /></xsl:template><xsl:template match = \"/\">";
s+="<TABLE><TBODY><xsl:for-each select=\"//ntb:e[@xi>"+parseInt(_38f-1)+" and @xi &lt; "+parseInt(_390+1)+"]\" ><TR>";
for(var _392=0;_392<_38e.length;_392++){
s+="<TD><xsl:value-of select=\"@"+_38e[_392]+"\" /></TD>";
}
s+="</TR></xsl:for-each></TBODY></TABLE></xsl:template></xsl:stylesheet>";
var _393=nitobi.xml.createXslProcessor(s);
return nitobi.xml.transformToXml(_38d,_393).xml.replace(/xmlns:ntb="http:\/\/www.nitobi.com"/,"");
};
nitobi.data.FormatConverter.convertEbaXmlToTsv=function(_394,_395,_396,_397){
var s="<xsl:stylesheet version=\"1.0\" xmlns:ntb=\"http://www.nitobi.com\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output encoding=\"UTF-8\" method=\"text\" omit-xml-declaration=\"yes\" /><xsl:template match = \"*\"><xsl:apply-templates /></xsl:template><xsl:template match = \"/\">";
s+="<xsl:for-each select=\"//ntb:e[@xi>"+parseInt(_396-1)+" and @xi &lt; "+parseInt(_397+1)+"]\" >\n";
for(var _399=0;_399<_395.length;_399++){
s+="<xsl:value-of select=\"@"+_395[_399]+"\" />";
if(_399<_395.length-1){
s+="<xsl:text>&#x09;</xsl:text>";
}
}
s+="<xsl:text>&#xa;</xsl:text></xsl:for-each></xsl:template></xsl:stylesheet>";
var _39a=nitobi.xml.createXslProcessor(s);
return nitobi.xml.transformToString(_394,_39a).replace(/xmlns:ntb="http:\/\/www.nitobi.com"/,"");
};
nitobi.data.FormatConverter.getDataColumns=function(data){
var _39c=0;
if(data!=null&&data!=""){
if(data.substr(0,1)=="<"){
_39c=data.toLowerCase().substr(0,data.toLowerCase().indexOf("</tr>")).split("</td>").length-1;
}else{
_39c=data.substr(0,data.indexOf("\n")).split("\t").length;
}
}else{
_39c=0;
}
return _39c;
};
nitobi.data.FormatConverter.getDataRows=function(data){
var _39e=0;
if(data!=null&&data!=""){
if(data.substr(0,1)=="<"){
_39e=data.toLowerCase().split("</tr>").length-1;
}else{
retValArray=data.split("\n");
_39e=retValArray.length;
if(retValArray[retValArray.length-1]==""){
_39e--;
}
}
}else{
_39e=0;
}
return _39e;
};
nitobi.grid.DateColumn=function(grid,_3a0){
nitobi.grid.DateColumn.baseConstructor.call(this,grid,_3a0);
};
nitobi.lang.extend(nitobi.grid.DateColumn,nitobi.grid.Column);
var ntb_datep=nitobi.grid.DateColumn.prototype;
nitobi.grid.DateColumn.prototype.setMask=function(){
this.xSET("Mask",arguments);
};
nitobi.grid.DateColumn.prototype.getMask=function(){
return this.xGET("Mask",arguments);
};
nitobi.grid.DateColumn.prototype.setCalendarEnabled=function(){
this.xSET("CalendarEnabled",arguments);
};
nitobi.grid.DateColumn.prototype.isCalendarEnabled=function(){
return nitobi.lang.toBool(this.xGET("CalendarEnabled",arguments),false);
};
nitobi.lang.defineNs("nitobi.grid.Declaration");
nitobi.grid.Declaration.parse=function(_3a1){
var _3a2={};
_3a2.grid=nitobi.xml.parseHtml(_3a1);
ntbAssert(!nitobi.xml.hasParseError(_3a2.grid),"The framework was not able to parse the declaration.\n"+"\n\nThe parse error was: "+nitobi.xml.getParseErrorReason(_3a2.grid)+"The declaration contents where:\n"+nitobi.html.getOuterHtml(_3a1),"",EBA_THROW);
var _3a3=_3a1.firstChild;
while(_3a3!=null){
if(typeof (_3a3.tagName)!="undefined"){
var tag=_3a3.tagName.replace(/ntb\:/gi,"").toLowerCase();
if(tag=="inlinehtml"){
_3a2[tag]=_3a3;
}else{
var _3a5="http://www.nitobi.com";
if(tag=="columndefinition"){
var sXml;
if(nitobi.browser.IE){
sXml=("<"+nitobi.xml.nsPrefix+"grid xmlns:ntb=\""+_3a5+"\"><"+nitobi.xml.nsPrefix+"columns>"+_3a3.parentNode.innerHTML.substring(31).replace(/\=\s*([^\"^\s^\>]+)/g,"=\"$1\" ")+"</"+nitobi.xml.nsPrefix+"columns></"+nitobi.xml.nsPrefix+"grid>");
}else{
sXml="<"+nitobi.xml.nsPrefix+"grid xmlns:ntb=\""+_3a5+"\"><"+nitobi.xml.nsPrefix+"columns>"+_3a3.parentNode.innerHTML.replace(/\=\s*([^\"^\s^\>]+)/g,"=\"$1\" ")+"</"+nitobi.xml.nsPrefix+"columns></"+nitobi.xml.nsPrefix+"grid>";
}
sXml=sXml.replace(/\&nbsp\;/gi," ");
_3a2["columndefinitions"]=nitobi.xml.createXmlDoc();
_3a2["columndefinitions"].validateOnParse=false;
_3a2["columndefinitions"]=nitobi.xml.loadXml(_3a2["columndefinitions"],sXml);
break;
}else{
_3a2[tag]=nitobi.xml.parseHtml(_3a3);
}
}
}
_3a3=_3a3.nextSibling;
}
return _3a2;
};
nitobi.grid.Declaration.loadDataSources=function(_3a7,grid){
var _3a9=new Array();
if(_3a7["datasources"]){
_3a9=_3a7.datasources.selectNodes("//"+nitobi.xml.nsPrefix+"datasources/*");
}
if(_3a9.length>0){
for(var i=0;i<_3a9.length;i++){
var id=_3a9[i].getAttribute("id");
if(id!="_default"){
var _3ac=_3a9[i].xml.replace(/fieldnames=/g,"FieldNames=").replace(/keys=/g,"Keys=");
_3ac="<ntb:grid xmlns:ntb=\"http://www.nitobi.com\"><ntb:datasources>"+_3ac+"</ntb:datasources></ntb:grid>";
var _3ad=new nitobi.data.DataTable("local",grid.getPagingMode()!=nitobi.grid.PAGINGMODE_NONE,{GridId:grid.getID()},{GridId:grid.getID()},grid.isAutoKeyEnabled());
_3ad.initialize(id,_3ac);
_3ad.initializeXml(_3ac);
grid.data.add(_3ad);
var _3ae=grid.model.selectNodes("//nitobi.grid.Column[@DatasourceId='"+id+"']");
for(var j=0;j<_3ae.length;j++){
grid.editorDataReady(_3ae[j]);
}
}
}
}
};
nitobi.grid.DragDropColumn=function(grid){
this.grid=grid;
this.grid_id=this.grid.UiContainer.parentid;
this.column;
this.targetCol;
this.onAfterDragDrop=new nitobi.base.Event();
this.dragbox=$ntb("ntb-column-dragbox"+this.grid.uid);
this.boxstyle=this.dragbox.style;
if(nitobi.browser.IE){
this.surface=document.getElementById("ebagridresizesurface_");
if(this.surface==null){
this.surface=document.createElement("div");
this.surface.id="ebagridresizesurface_";
this.surface.className="ntb-column-resize-surface";
this.grid.UiContainer.appendChild(this.surface);
}
}
};
nitobi.grid.DragDropColumn.prototype.pickUp=function(grid,_3b2,_3b3,evt){
var C=nitobi.html.Css;
this.grid=grid;
this.column=_3b2;
var _3b6=this.grid.scroller.getScrollLeft();
var _3b7=grid.getColumnObject(_3b2);
var _3b8=_3b7.getHeaderElement();
if(nitobi.browser.IE){
var _3b9=this.grid.scroller.view.topleft.element.clientWidth;
}else{
var _3b9=parseInt(C.getClass(".ntb-grid-leftwidth"+this.grid.uid).width);
}
var x=nitobi.html.getEventCoords(evt).x;
if(nitobi.browser.IE){
this.surface.style.display="block";
nitobi.drawing.align(this.surface,this.grid.element,nitobi.drawing.align.SAMEHEIGHT|nitobi.drawing.align.SAMEWIDTH|nitobi.drawing.align.ALIGNTOP|nitobi.drawing.align.ALIGNLEFT);
}
this.x=x;
this.boxstyle.display="block";
var _3bb=this.grid.getFrozenLeftColumnCount();
if(_3bb>0&&_3b2>=_3bb){
var _3bc=nitobi.html.getBoundingClientRect(this.grid.UiContainer).left;
var _3bd=_3b8.offsetLeft;
this.boxstyle.left=(_3bd+_3b9-_3b6)+"px";
}else{
this.boxstyle.left=(_3b7.getHeaderElement().offsetLeft-_3b6)+"px";
}
this.boxstyle.height=this.grid.Scroller.scrollSurface.offsetHeight+"px";
this.boxstyle.width=_3b7.getWidth()+"px";
nitobi.drawing.align(this.dragbox,_3b3,nitobi.drawing.align.ALIGNTOP,0,0,nitobi.html.getHeight(_3b3)+1);
nitobi.ui.startDragOperation(this.dragbox,evt,false,true,this,this.drop);
};
nitobi.grid.DragDropColumn.prototype.drop=function(_3be){
this.x=_3be.x;
this.y=_3be.y;
var _3bf=nitobi.grid.Cell.getColumnNumber(_3be.event.srcElement.parentNode);
if(_3bf!=null){
this.targetCol=this.grid.getColumnObject(_3bf);
}
if(nitobi.browser.IE){
this.surface.style.display="none";
}
var _3c0=nitobi.html.getBoundingClientRect(this.grid.UiContainer).left;
var ls=this.boxstyle;
ls.display="none";
ls.top="-3000px";
ls.left="-3000px";
this.onAfterDragDrop.notify(this);
};
nitobi.grid.DragDropColumn.prototype.dispose=function(){
this.grid=null;
this.dragbox=null;
this.boxstyle=null;
this.surface=null;
};
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.EditCompleteEventArgs=function(obj,_3c3,_3c4,cell){
this.editor=obj;
this.cell=cell;
this.databaseValue=_3c4;
this.displayValue=_3c3;
};
nitobi.grid.EditCompleteEventArgs.prototype.dispose=function(){
this.editor=null;
this.cell=null;
this.metadata=null;
};
nitobi.data.GetCompleteEventArgs=function(_3c6,_3c7,_3c8,_3c9,_3ca,_3cb,obj,_3cd,_3ce){
this.firstRow=_3c6;
this.lastRow=_3c7;
this.callback=_3cd;
this.dataSource=_3cb;
this.context=obj;
this.ajaxCallback=_3ca;
this.startXi=_3c8;
this.pageSize=_3c9;
this.lastPage=false;
this.numRowsReturned=_3ce;
this.lastRowReturned=_3c7;
};
nitobi.data.GetCompleteEventArgs.prototype.dispose=function(){
this.callback=null;
this.context=null;
this.dataSource=null;
this.ajaxCallback.clear();
this.ajaxCallback==null;
};
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.MODE_STANDARDPAGING="standard";
nitobi.grid.MODE_LOCALSTANDARDPAGING="localstandard";
nitobi.grid.MODE_LIVESCROLLING="livescrolling";
nitobi.grid.MODE_LOCALLIVESCROLLING="locallivescrolling";
nitobi.grid.MODE_NONPAGING="nonpaging";
nitobi.grid.MODE_LOCALNONPAGING="localnonpaging";
nitobi.grid.MODE_PAGEDLIVESCROLLING="pagedlivescrolling";
nitobi.grid.RENDERMODE_ONDEMAND="ondemand";
nitobi.lang.defineNs("nitobi.GridFactory");
nitobi.GridFactory.createGrid=function(_3cf,_3d0,_3d1){
var _3d2="";
var _3d3="";
var _3d4="";
_3d1=nitobi.html.getElement(_3d1);
if(_3d1!=null){
xDeclaration=nitobi.grid.Declaration.parse(_3d1);
_3cf=xDeclaration.grid.documentElement.getAttribute("mode").toLowerCase();
var _3d5=nitobi.GridFactory.isGetHandler(xDeclaration);
var _3d6=nitobi.GridFactory.isDatasourceId(xDeclaration);
var _3d7=false;
if(_3cf==nitobi.grid.MODE_LOCALLIVESCROLLING){
ntbAssert(_3d6||_3d5,"To use local LiveScrolling mode a DatasourceId must also be specified.","",EBA_THROW);
_3d2=nitobi.grid.PAGINGMODE_LIVESCROLLING;
_3d3=nitobi.data.DATAMODE_LOCAL;
}else{
if(_3cf==nitobi.grid.MODE_LIVESCROLLING){
ntbAssert(_3d5,"To use LiveScrolling mode a GetHandler must also be specified.","",EBA_THROW);
_3d2=nitobi.grid.PAGINGMODE_LIVESCROLLING;
_3d3=nitobi.data.DATAMODE_CACHING;
}else{
if(_3cf==nitobi.grid.MODE_NONPAGING){
ntbAssert(_3d5,"To use NonPaging mode a GetHandler must also be specified.","",EBA_THROW);
_3d7=true;
_3d2=nitobi.grid.PAGINGMODE_NONE;
_3d3=nitobi.data.DATAMODE_LOCAL;
}else{
if(_3cf==nitobi.grid.MODE_LOCALNONPAGING){
ntbAssert(_3d6,"To use local LiveScrolling mode a DatasourceId must also be specified.","",EBA_THROW);
_3d2=nitobi.grid.PAGINGMODE_NONE;
_3d3=nitobi.data.DATAMODE_LOCAL;
}else{
if(_3cf==nitobi.grid.MODE_LOCALSTANDARDPAGING){
_3d2=nitobi.grid.PAGINGMODE_STANDARD;
_3d3=nitobi.data.DATAMODE_LOCAL;
}else{
if(_3cf==nitobi.grid.MODE_STANDARDPAGING){
_3d2=nitobi.grid.PAGINGMODE_STANDARD;
_3d3=nitobi.data.DATAMODE_PAGING;
}else{
if(_3cf==nitobi.grid.MODE_PAGEDLIVESCROLLING){
_3d2=nitobi.grid.PAGINGMODE_STANDARD;
_3d3=nitobi.data.DATAMODE_PAGING;
_3d4=nitobi.grid.RENDERMODE_ONDEMAND;
}else{
}
}
}
}
}
}
}
}
var id=_3d1.getAttribute("id");
_3cf=(_3cf||nitobi.grid.MODE_STANDARDPAGING).toLowerCase();
var grid=null;
if(_3cf==nitobi.grid.MODE_LOCALSTANDARDPAGING){
grid=new nitobi.grid.GridLocalPage(id);
}else{
if(_3cf==nitobi.grid.MODE_LIVESCROLLING){
grid=new nitobi.grid.GridLiveScrolling(id);
}else{
if(_3cf==nitobi.grid.MODE_LOCALLIVESCROLLING){
grid=new nitobi.grid.GridLiveScrolling(id);
}else{
if(_3cf==nitobi.grid.MODE_NONPAGING||_3cf==nitobi.grid.MODE_LOCALNONPAGING){
grid=new nitobi.grid.GridNonpaging(id);
}else{
if(_3cf==nitobi.grid.MODE_STANDARDPAGING||_3cf==nitobi.grid.MODE_PAGEDLIVESCROLLING){
grid=new nitobi.grid.GridStandard(id);
}
}
}
}
}
grid.setPagingMode(_3d2);
grid.setDataMode(_3d3);
grid.setRenderMode(_3d4);
nitobi.GridFactory.processDeclaration(grid,_3d1,xDeclaration);
_3d1.jsObject=grid;
return grid;
};
nitobi.GridFactory.processDeclaration=function(grid,_3db,_3dc){
if(_3dc!=null){
grid.setDeclaration(_3dc);
if(typeof (_3dc.inlinehtml)=="undefined"){
var _3dd=document.createElement("ntb:inlinehtml");
_3dd.setAttribute("parentid","grid"+grid.uid);
nitobi.html.insertAdjacentElement(_3db,"beforeEnd",_3dd);
grid.Declaration.inlinehtml=_3dd;
}
if(this.data==null||this.data.tables==null||this.data.tables.length==0){
var _3de=new nitobi.data.DataSet();
_3de.initialize();
grid.connectToDataSet(_3de);
}
grid.initializeModelFromDeclaration();
var _3df=grid.Declaration.columndefinitions||grid.Declaration.columns;
if(typeof (_3df)!="undefined"&&_3df!=null&&_3df.childNodes.length!=0&&_3df.childNodes[0].childNodes.length!=0){
grid.defineColumns(_3df.documentElement);
}
nitobi.grid.Declaration.loadDataSources(_3dc,grid);
grid.attachToParentDomElement(grid.Declaration.inlinehtml);
var _3e0=grid.getDataMode();
var _3e1=grid.getDatasourceId();
var _3e2=grid.getGetHandler();
if(_3e1!=null&&_3e1!=""){
grid.connectToTable(grid.data.getTable(_3e1));
}else{
grid.ensureConnected();
if(grid.mode.toLowerCase()==nitobi.grid.MODE_LIVESCROLLING&&_3dc!=null&&_3dc.datasources!=null){
var _3e3=_3dc.datasources.selectNodes("//ntb:datasource[@id='_default']/ntb:data/ntb:e").length;
if(_3e3>0){
var _3e4=grid.data.getTable("_default");
_3e4.initializeXmlData(_3dc.grid.xml);
_3e4.initializeXml(_3dc.grid.xml);
_3e4.descriptor.leap(0,_3e3*2);
_3e4.syncRowCount();
}
}
}
window.setTimeout(function(){
grid.bind();
},50);
}
};
nitobi.GridFactory.isLocal=function(_3e5){
var _3e6=_3e5.grid.documentElement.getAttribute("datasourceid");
var _3e7=_3e5.grid.documentElement.getAttribute("gethandler");
if(_3e7!=null&&_3e7!=""){
return false;
}else{
if(_3e6!=null&&_3e6!=""){
return true;
}else{
throw ("Non-paging grid requires either a gethandler or a local datasourceid to be specified.");
}
}
};
nitobi.GridFactory.isGetHandler=function(_3e8){
var _3e9=_3e8.grid.documentElement.getAttribute("gethandler");
if(_3e9!=null&&_3e9!=""){
return true;
}
return false;
};
nitobi.GridFactory.isDatasourceId=function(_3ea){
var _3eb=_3ea.grid.documentElement.getAttribute("datasourceid");
if(_3eb!=null&&_3eb!=""){
return true;
}
return false;
};
nitobi.grid.hover=function(_3ec,_3ed,_3ee){
if(!_3ee){
return;
}
var id=_3ec.getAttribute("id");
var _3f0=id.replace(/__/g,"||");
var _3f1=_3f0.split("_");
var row=_3f1[3];
var uid=_3f1[5].replace(/\|\|/g,"__");
var _3f4=document.getElementById("cell_"+row+"_0_"+uid);
var _3f5=_3f4.parentNode;
var _3f6=_3f5.childNodes[_3f5.childNodes.length-1];
var id=_3f6.getAttribute("id");
var _3f1=id.split("_");
var _3f7=document.getElementById("cell_"+row+"_"+(Number(_3f1[4])+1)+"_"+uid);
var _3f8=null;
if(_3f7!=null){
_3f8=_3f7.parentNode;
}
if(_3ed){
var _3f9=nitobi.grid.RowHoverColor||"white";
_3f5.style.backgroundColor=_3f9;
if(_3f8){
_3f8.style.backgroundColor=_3f9;
}
}else{
_3f5.style.backgroundColor="";
if(_3f8){
_3f8.style.backgroundColor="";
}
}
if(_3ed){
nitobi.html.addClass(_3ec,"ntb-cell-hover");
}else{
nitobi.html.removeClass(_3ec,"ntb-cell-hover");
}
};
initEBAGrids=function(){
nitobi.initComponents();
};
nitobi.initGrids=function(){
var _3fa=[];
var _3fb=document.getElementsByTagName(!nitobi.browser.IE?"ntb:grid":"grid");
for(var i=0;i<_3fb.length;i++){
if(_3fb[i].jsObject==null){
nitobi.initGrid(_3fb[i].id);
_3fa.push(_3fb[i].jsObject);
}
}
return _3fa;
};
nitobi.initGrid=function(id){
var grid=nitobi.html.getElement(id);
if(grid!=null){
grid.jsObject=nitobi.GridFactory.createGrid(null,null,grid);
}
return grid.jsObject;
};
nitobi.initComponents=function(){
nitobi.initGrids();
};
nitobi.getGrid=function(_3ff){
return document.getElementById(_3ff).jsObject;
};
nitobi.base.Registry.getInstance().register(new nitobi.base.Profile("nitobi.initGrid",null,false,"ntb:grid"));
nitobi.grid.GridLiveScrolling=function(uid){
nitobi.grid.GridLiveScrolling.baseConstructor.call(this,uid);
this.mode="livescrolling";
this.setPagingMode(nitobi.grid.PAGINGMODE_LIVESCROLLING);
this.setDataMode(nitobi.data.DATAMODE_CACHING);
};
nitobi.lang.extend(nitobi.grid.GridLiveScrolling,nitobi.grid.Grid);
nitobi.grid.GridLiveScrolling.prototype.createChildren=function(){
var args=arguments;
nitobi.grid.GridLiveScrolling.base.createChildren.call(this,args);
nitobi.grid.GridLiveScrolling.base.createToolbars.call(this,nitobi.ui.Toolbars.VisibleToolbars.STANDARD);
};
nitobi.grid.GridLiveScrolling.prototype.bind=function(){
nitobi.grid.GridStandard.base.bind.call(this);
if(this.getGetHandler()!=""){
this.ensureConnected();
var rows=this.getRowsPerPage();
if(this.datatable.mode=="local"){
rows=null;
}
this.datatable.get(0,rows,this,this.getComplete);
}else{
this.finalizeRowCount(this.datatable.getRemoteRowCount());
this.bindComplete();
}
};
nitobi.grid.GridLiveScrolling.prototype.getComplete=function(_403){
nitobi.grid.GridLiveScrolling.base.getComplete.call(this,_403);
if(!this.columnsDefined){
this.defineColumnsFinalize();
}
this.bindComplete();
};
nitobi.grid.GridLiveScrolling.prototype.pageSelect=function(dir){
var _405=this.Scroller.getUnrenderedBlocks();
var rows=_405.last-_405.first;
this.reselect(0,rows*dir);
};
nitobi.grid.GridLiveScrolling.prototype.page=function(dir){
var _408=this.Scroller.getUnrenderedBlocks();
var rows=_408.last-_408.first;
this.move(0,rows*dir);
};
nitobi.grid.LoadingScreen=function(grid){
this.loadingScreen=null;
this.grid=grid;
this.loadingImg=null;
};
nitobi.grid.LoadingScreen.prototype.initialize=function(){
this.loadingScreen=document.createElement("div");
var _40b=this.findCssUrl();
var msg="";
if(_40b==null){
msg="Loading...";
}else{
msg="<img src='"+_40b+"loading.gif'  class='ntb-loading-Icon' valign='absmiddle'></img>";
}
this.loadingScreen.innerHTML="<table style='padding:0px;margin:0px;' border='0' width='100%' height='100%'><tr style='padding:0px;margin:0px;'><td id='ntb-loading-cell"+this.grid.uid+"' style='padding:0px;margin:0px;text-align:center;font:verdana;font-size:10pt;'>"+msg+"</td></tr></table>";
this.loadingScreen.className="ntb-loading";
var lss=this.loadingScreen.style;
lss.verticalAlign="middle";
lss.visibility="hidden";
lss.position="absolute";
lss.top="0px";
lss.left="0px";
};
nitobi.grid.LoadingScreen.prototype.attachToElement=function(_40e){
_40e.appendChild(this.loadingScreen);
};
nitobi.grid.LoadingScreen.prototype.findCssUrl=function(){
var _40f=nitobi.html.findParentStylesheet("."+this.grid.getTheme()+" .ntb-loading-Icon");
if(_40f==null){
return null;
}
var _410=nitobi.html.normalizeUrl(_40f.href);
if(nitobi.browser.IE){
while(_40f.parentStyleSheet){
_40f=_40f.parentStyleSheet;
_410=nitobi.html.normalizeUrl(_40f.href)+_410;
}
}
return _410;
};
nitobi.grid.LoadingScreen.prototype.show=function(){
try{
this.resize();
this.loadingScreen.style.visibility="visible";
this.loadingScreen.style.display="block";
}
catch(e){
}
};
nitobi.grid.LoadingScreen.prototype.resize=function(){
this.loadingScreen.style.width=this.grid.getWidth()+"px";
this.loadingScreen.style.height=this.grid.getHeight()+"px";
};
nitobi.grid.LoadingScreen.prototype.hide=function(){
this.loadingScreen.style.display="none";
};
nitobi.grid.GridLocalPage=function(uid){
nitobi.grid.GridLocalPage.baseConstructor.call(this,uid);
this.mode="localpaging";
this.setPagingMode(nitobi.grid.PAGINGMODE_STANDARD);
this.setDataMode("local");
};
nitobi.lang.extend(nitobi.grid.GridLocalPage,nitobi.grid.Grid);
nitobi.grid.GridLocalPage.prototype.createChildren=function(){
var args=arguments;
nitobi.grid.GridLocalPage.base.createChildren.call(this,args);
nitobi.grid.GridLiveScrolling.base.createToolbars.call(this,nitobi.ui.Toolbars.VisibleToolbars.STANDARD|nitobi.ui.Toolbars.VisibleToolbars.PAGING);
this.subscribe("EndOfData",function(pct){
this.toolbars.pagingToolbar.getUiElements()["nextPage"+this.toolbars.uid].disable();
});
this.subscribe("TopOfData",function(pct){
this.toolbars.pagingToolbar.getUiElements()["previousPage"+this.toolbars.uid].disable();
});
this.subscribe("NotTopOfData",function(pct){
this.toolbars.pagingToolbar.getUiElements()["previousPage"+this.toolbars.uid].enable();
});
this.subscribe("NotEndOfData",function(pct){
this.toolbars.pagingToolbar.getUiElements()["nextPage"+this.toolbars.uid].enable();
});
};
nitobi.grid.GridLocalPage.prototype.pagePrevious=function(){
this.fire("BeforeLoadPreviousPage");
this.loadDataPage(Math.max(this.getCurrentPageIndex()-1,0));
this.fire("AfterLoadPreviousPage");
};
nitobi.grid.GridLocalPage.prototype.pageNext=function(){
this.fire("BeforeLoadNextPage");
this.loadDataPage(this.getCurrentPageIndex()+1);
this.fire("AfterLoadNextPage");
};
nitobi.grid.GridLocalPage.prototype.loadDataPage=function(_417){
this.fire("BeforeLoadDataPage");
if(_417>-1){
this.setCurrentPageIndex(_417);
this.setDisplayedRowCount(this.getRowsPerPage());
var _418=this.getCurrentPageIndex()*this.getRowsPerPage();
var rows=this.getRowsPerPage()-this.getfreezetop();
this.setDisplayedRowCount(rows);
var _41a=_418+rows;
if(_41a>=this.getRowCount()){
this.fire("EndOfData");
}else{
this.fire("NotEndOfData");
}
if(_418==0){
this.fire("TopOfData");
}else{
this.fire("NotTopOfData");
}
this.clearSurfaces();
this.updateCellRanges();
this.scrollVertical(0);
}
this.fire("AfterLoadDataPage");
};
nitobi.grid.GridLocalPage.prototype.setRowsPerPage=function(rows){
this.setDisplayedRowCount(this.getRowsPerPage());
this.data.table.pageSize=this.getRowsPerPage();
};
nitobi.grid.GridLocalPage.prototype.pageStartIndexChanges=function(){
};
nitobi.grid.GridLocalPage.prototype.hitFirstPage=function(){
this.fire("FirstPage");
};
nitobi.grid.GridLocalPage.prototype.hitLastPage=function(){
this.fire("LastPage");
};
nitobi.grid.GridLocalPage.prototype.bind=function(){
nitobi.grid.GridLocalPage.base.bind.call(this);
this.finalizeRowCount(this.datatable.getRemoteRowCount());
this.bindComplete();
};
nitobi.grid.GridLocalPage.prototype.pageUpKey=function(){
this.pagePrevious();
};
nitobi.grid.GridLocalPage.prototype.pageDownKey=function(){
this.pageNext();
};
nitobi.grid.GridLocalPage.prototype.renderMiddle=function(){
nitobi.grid.GridLocalPage.base.renderMiddle.call(this,arguments);
var _41c=this.getfreezetop();
endRow=this.getRowsPerPage()-1;
this.Scroller.view.midcenter.renderGap(_41c,endRow,false);
};
nitobi.grid.GridNonpaging=function(uid){
nitobi.grid.GridNonpaging.baseConstructor.call(this);
this.mode="nonpaging";
this.setPagingMode(nitobi.grid.PAGINGMODE_NONE);
this.setDataMode(nitobi.data.DATAMODE_LOCAL);
};
nitobi.lang.extend(nitobi.grid.GridNonpaging,nitobi.grid.Grid);
nitobi.grid.GridNonpaging.prototype.createChildren=function(){
var args=arguments;
nitobi.grid.GridNonpaging.base.createChildren.call(this,args);
nitobi.grid.GridNonpaging.base.createToolbars.call(this,nitobi.ui.Toolbars.VisibleToolbars.STANDARD);
};
nitobi.grid.GridNonpaging.prototype.bind=function(){
nitobi.grid.GridStandard.base.bind.call(this);
if(this.getGetHandler()!=""){
this.ensureConnected();
this.datatable.get(0,null,this,this.getComplete);
}else{
this.finalizeRowCount(this.datatable.getRemoteRowCount());
this.bindComplete();
}
};
nitobi.grid.GridNonpaging.prototype.getComplete=function(_41f){
nitobi.grid.GridNonpaging.base.getComplete.call(this,_41f);
this.finalizeRowCount(_41f.numRowsReturned);
this.defineColumnsFinalize();
this.bindComplete();
};
nitobi.grid.GridNonpaging.prototype.renderMiddle=function(){
nitobi.grid.GridNonpaging.base.renderMiddle.call(this,arguments);
var _420=this.getfreezetop();
endRow=this.getRowCount();
this.Scroller.view.midcenter.renderGap(_420,endRow,false);
};
nitobi.grid.GridStandard=function(uid){
nitobi.grid.GridStandard.baseConstructor.call(this,uid);
this.mode="standard";
this.setPagingMode(nitobi.grid.PAGINGMODE_STANDARD);
this.setDataMode(nitobi.data.DATAMODE_PAGING);
};
nitobi.lang.extend(nitobi.grid.GridStandard,nitobi.grid.Grid);
nitobi.grid.GridStandard.prototype.createChildren=function(){
var args=arguments;
nitobi.grid.GridStandard.base.createChildren.call(this,args);
nitobi.grid.GridStandard.base.createToolbars.call(this,nitobi.ui.Toolbars.VisibleToolbars.STANDARD|nitobi.ui.Toolbars.VisibleToolbars.PAGING);
this.toolbars.subscribe("FirstPage",nitobi.lang.close(this,this.pageFirst));
this.toolbars.subscribe("LastPage",nitobi.lang.close(this,this.pageLast));
this.toolbars.subscribe("NextPage",nitobi.lang.close(this,this.pageNext));
this.toolbars.subscribe("PreviousPage",nitobi.lang.close(this,this.pagePrevious));
this.toolbars.subscribe("InputTextPage",nitobi.lang.close(this,this.pageTextInput));
this.subscribe("EndOfData",this.disableNextPage);
this.subscribe("TopOfData",this.disablePreviousPage);
this.subscribe("NotTopOfData",this.enablePreviousPage);
this.subscribe("NotEndOfData",this.enableNextPage);
this.subscribe("TableConnected",nitobi.lang.close(this,this.subscribeToRowCountReady));
};
nitobi.grid.GridStandard.prototype.connectToTable=function(_423){
if(nitobi.grid.GridStandard.base.connectToTable.call(this,_423)!=false){
this.datatable.subscribe("RowInserted",nitobi.lang.close(this,this.incrementDisplayedRowCount));
this.datatable.subscribe("RowDeleted",nitobi.lang.close(this,this.decrementDisplayedRowCount));
}
};
nitobi.grid.GridStandard.prototype.incrementDisplayedRowCount=function(_424){
this.setDisplayedRowCount(this.getDisplayedRowCount()+(_424||1));
this.updateCellRanges();
};
nitobi.grid.GridStandard.prototype.decrementDisplayedRowCount=function(_425){
this.setDisplayedRowCount(this.getDisplayedRowCount()-(_425||1));
this.updateCellRanges();
};
nitobi.grid.GridStandard.prototype.subscribeToRowCountReady=function(){
};
nitobi.grid.GridStandard.prototype.updateDisplayedRowCount=function(_426){
this.setDisplayedRowCount(_426.numRowsReturned);
};
nitobi.grid.GridStandard.prototype.disableNextPage=function(){
this.disableButton("nextPage");
};
nitobi.grid.GridStandard.prototype.disablePreviousPage=function(){
this.disableButton("previousPage");
};
nitobi.grid.GridStandard.prototype.disableButton=function(_427){
var t=this.getToolbars().pagingToolbar;
if(t!=null){
if(t.getUiElements()[_427+this.toolbars.uid]){
t.getUiElements()[_427+this.toolbars.uid].disable();
}
}
var s=this.getToolbars().standardToolbar;
if(s!=null){
if(s.getUiElements()[_427+this.toolbars.uid]){
s.getUiElements()[_427+this.toolbars.uid].disable();
}
}
};
nitobi.grid.GridStandard.prototype.enableNextPage=function(){
this.enableButton("nextPage");
};
nitobi.grid.GridStandard.prototype.enablePreviousPage=function(){
this.enableButton("previousPage");
};
nitobi.grid.GridStandard.prototype.enableButton=function(_42a){
var t=this.getToolbars().pagingToolbar;
if(t!=null){
if(t.getUiElements()[_42a+this.toolbars.uid]){
t.getUiElements()[_42a+this.toolbars.uid].enable();
}
}
var s=this.getToolbars().standardToolbar;
if(s!=null){
if(s.getUiElements()[_42a+this.toolbars.uid]){
s.getUiElements()[_42a+this.toolbars.uid].enable();
}
}
};
nitobi.grid.GridStandard.prototype.pageFirst=function(){
this.loadDataPage(0);
};
nitobi.grid.GridStandard.prototype.pagePrevious=function(){
this.loadDataPage(Math.max(this.getCurrentPageIndex()-1,0));
};
nitobi.grid.GridStandard.prototype.pageNext=function(){
this.loadDataPage(this.getCurrentPageIndex()+1);
};
nitobi.grid.GridStandard.prototype.pageLast=function(){
var _42d=Math.ceil(this.datatable.totalRowCount/this.getRowsPerPage());
this.loadDataPage(_42d-1);
};
nitobi.grid.GridStandard.prototype.pageTextInput=function(){
var _42e=$ntb("startPage"+this.toolbars.uid);
if(_42e){
var val=parseInt(_42e.value);
this.loadDataPage(val-1);
}
};
nitobi.grid.GridStandard.prototype.loadDataPage=function(_430){
this.fire("BeforeLoadDataPage");
if(_430>-1){
if(this.sortColumn){
if(this.datatable.sortColumn){
for(var i=0;i<this.getColumnCount();i++){
var _432=this.getColumnObject(i);
if(_432.getColumnName()==this.datatable.sortColumn){
this.setSortStyle(i,this.datatable.sortDir);
break;
}
}
}else{
this.setSortStyle(this.sortColumn.column,"",true);
}
}
this.setCurrentPageIndex(_430);
var _433=this.getCurrentPageIndex()*this.getRowsPerPage();
var rows=this.getRowsPerPage()-this.getfreezetop();
this.datatable.flush();
this.datatable.get(_433,rows,this,this.afterLoadDataPage);
}
this.fire("AfterLoadDataPage");
};
nitobi.grid.GridStandard.prototype.afterLoadDataPage=function(_435){
this.setDisplayedRowCount(_435.numRowsReturned);
this.setRowCount(_435.numRowsReturned);
if(_435.numRowsReturned!=this.getRowsPerPage()){
this.fire("EndOfData");
}else{
this.fire("NotEndOfData");
}
if(this.getCurrentPageIndex()==0){
this.fire("TopOfData");
}else{
this.fire("NotTopOfData");
}
this.clearSurfaces();
this.updateCellRanges();
this.scrollVertical(0);
};
nitobi.grid.GridStandard.prototype.bind=function(){
nitobi.grid.GridStandard.base.bind.call(this);
this.setCurrentPageIndex(0);
this.disablePreviousPage();
this.enableNextPage();
this.ensureConnected();
this.datatable.get(0,this.getRowsPerPage(),this,this.getComplete);
};
nitobi.grid.GridStandard.prototype.getComplete=function(_436){
this.afterLoadDataPage(_436);
nitobi.grid.GridStandard.base.getComplete.call(this,_436);
this.defineColumnsFinalize();
this.bindComplete();
};
nitobi.grid.GridStandard.prototype.renderMiddle=function(){
nitobi.grid.GridStandard.base.renderMiddle.call(this,arguments);
var _437=this.getfreezetop();
endRow=this.getRowsPerPage()-1;
this.Scroller.view.midcenter.renderGap(_437,endRow,false);
};
nitobi.grid.NumberColumn=function(grid,_439){
nitobi.grid.NumberColumn.baseConstructor.call(this,grid,_439);
};
nitobi.lang.extend(nitobi.grid.NumberColumn,nitobi.grid.Column);
var ntb_numberp=nitobi.grid.NumberColumn.prototype;
nitobi.grid.NumberColumn.prototype.setAlign=function(){
this.xSET("Align",arguments);
};
nitobi.grid.NumberColumn.prototype.getAlign=function(){
return this.xGET("Align",arguments);
};
nitobi.grid.NumberColumn.prototype.setMask=function(){
this.xSET("Mask",arguments);
};
nitobi.grid.NumberColumn.prototype.getMask=function(){
return this.xGET("Mask",arguments);
};
nitobi.grid.NumberColumn.prototype.setNegativeMask=function(){
this.xSET("NegativeMask",arguments);
};
nitobi.grid.NumberColumn.prototype.getNegativeMask=function(){
return this.xGET("NegativeMask",arguments);
};
nitobi.grid.NumberColumn.prototype.setGroupingSeparator=function(){
this.xSET("GroupingSeparator",arguments);
};
nitobi.grid.NumberColumn.prototype.getGroupingSeparator=function(){
return this.xGET("GroupingSeparator",arguments);
};
nitobi.grid.NumberColumn.prototype.setDecimalSeparator=function(){
this.xSET("DecimalSeparator",arguments);
};
nitobi.grid.NumberColumn.prototype.getDecimalSeparator=function(){
return this.xGET("DecimalSeparator",arguments);
};
nitobi.grid.NumberColumn.prototype.setOnKeyDownEvent=function(){
this.xSET("OnKeyDownEvent",arguments);
};
nitobi.grid.NumberColumn.prototype.getOnKeyDownEvent=function(){
return this.xGET("OnKeyDownEvent",arguments);
};
nitobi.grid.NumberColumn.prototype.setOnKeyUpEvent=function(){
this.xSET("OnKeyUpEvent",arguments);
};
nitobi.grid.NumberColumn.prototype.getOnKeyUpEvent=function(){
return this.xGET("OnKeyUpEvent",arguments);
};
nitobi.grid.NumberColumn.prototype.setOnKeyPressEvent=function(){
this.xSET("OnKeyPressEvent",arguments);
};
nitobi.grid.NumberColumn.prototype.getOnKeyPressEvent=function(){
return this.xGET("OnKeyPressEvent",arguments);
};
nitobi.grid.NumberColumn.prototype.setOnChangeEvent=function(){
this.xSET("OnChangeEvent",arguments);
};
nitobi.grid.NumberColumn.prototype.getOnChangeEvent=function(){
return this.xGET("OnChangeEvent",arguments);
};
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnCopyEventArgs=function(_43a,data,_43c){
nitobi.grid.OnCopyEventArgs.baseConstructor.apply(this,arguments);
};
nitobi.lang.extend(nitobi.grid.OnCopyEventArgs,nitobi.grid.SelectionEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnPasteEventArgs=function(_43d,data,_43f){
nitobi.grid.OnPasteEventArgs.baseConstructor.apply(this,arguments);
};
nitobi.lang.extend(nitobi.grid.OnPasteEventArgs,nitobi.grid.SelectionEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnAfterCellEditEventArgs=function(_440,cell){
nitobi.grid.OnAfterCellEditEventArgs.baseConstructor.call(this,_440,cell);
};
nitobi.lang.extend(nitobi.grid.OnAfterCellEditEventArgs,nitobi.grid.CellEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnAfterColumnResizeEventArgs=function(_442,_443){
nitobi.grid.OnAfterColumnResizeEventArgs.baseConstructor.call(this,_442,_443);
};
nitobi.lang.extend(nitobi.grid.OnAfterColumnResizeEventArgs,nitobi.grid.ColumnEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnAfterRowDeleteEventArgs=function(_444,row){
nitobi.grid.OnAfterRowDeleteEventArgs.baseConstructor.call(this,_444,row);
};
nitobi.lang.extend(nitobi.grid.OnAfterRowDeleteEventArgs,nitobi.grid.RowEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnAfterRowInsertEventArgs=function(_446,row){
nitobi.grid.OnAfterRowInsertEventArgs.baseConstructor.call(this,_446,row);
};
nitobi.lang.extend(nitobi.grid.OnAfterRowInsertEventArgs,nitobi.grid.RowEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnAfterSortEventArgs=function(_448,_449,_44a){
nitobi.grid.OnAfterSortEventArgs.baseConstructor.call(this,_448,_449);
this.direction=_44a;
};
nitobi.lang.extend(nitobi.grid.OnAfterSortEventArgs,nitobi.grid.ColumnEventArgs);
nitobi.grid.OnAfterSortEventArgs.prototype.getDirection=function(){
return this.direction;
};
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnBeforeCellEditEventArgs=function(_44b,cell){
nitobi.grid.OnBeforeCellEditEventArgs.baseConstructor.call(this,_44b,cell);
};
nitobi.lang.extend(nitobi.grid.OnBeforeCellEditEventArgs,nitobi.grid.CellEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnBeforeColumnResizeEventArgs=function(_44d,_44e){
nitobi.grid.OnBeforeColumnResizeEventArgs.baseConstructor.call(this,_44d,_44e);
};
nitobi.lang.extend(nitobi.grid.OnBeforeColumnResizeEventArgs,nitobi.grid.ColumnEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnBeforeRowDeleteEventArgs=function(_44f,row){
nitobi.grid.OnBeforeRowDeleteEventArgs.baseConstructor.call(this,_44f,row);
};
nitobi.lang.extend(nitobi.grid.OnBeforeRowDeleteEventArgs,nitobi.grid.RowEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnBeforeRowInsertEventArgs=function(_451,row){
nitobi.grid.OnBeforeRowInsertEventArgs.baseConstructor.call(this,_451,row);
};
nitobi.lang.extend(nitobi.grid.OnBeforeRowInsertEventArgs,nitobi.grid.RowEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnBeforeSortEventArgs=function(_453,_454,_455){
nitobi.grid.OnBeforeSortEventArgs.baseConstructor.call(this,_453,_454);
this.direction=_455;
};
nitobi.lang.extend(nitobi.grid.OnBeforeSortEventArgs,nitobi.grid.ColumnEventArgs);
nitobi.grid.OnBeforeSortEventArgs.prototype.getDirection=function(){
return this.direction;
};
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnBeforeCellClickEventArgs=function(_456,cell){
nitobi.grid.OnBeforeCellClickEventArgs.baseConstructor.call(this,_456,cell);
};
nitobi.lang.extend(nitobi.grid.OnBeforeCellClickEventArgs,nitobi.grid.CellEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnCellBlurEventArgs=function(_458,cell){
nitobi.grid.OnCellBlurEventArgs.baseConstructor.call(this,_458,cell);
};
nitobi.lang.extend(nitobi.grid.OnCellBlurEventArgs,nitobi.grid.CellEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnCellClickEventArgs=function(_45a,cell){
nitobi.grid.OnCellClickEventArgs.baseConstructor.call(this,_45a,cell);
};
nitobi.lang.extend(nitobi.grid.OnCellClickEventArgs,nitobi.grid.CellEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnCellDblClickEventArgs=function(_45c,cell){
nitobi.grid.OnCellDblClickEventArgs.baseConstructor.call(this,_45c,cell);
};
nitobi.lang.extend(nitobi.grid.OnCellDblClickEventArgs,nitobi.grid.CellEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnCellFocusEventArgs=function(_45e,cell){
nitobi.grid.OnCellFocusEventArgs.baseConstructor.call(this,_45e,cell);
};
nitobi.lang.extend(nitobi.grid.OnCellFocusEventArgs,nitobi.grid.CellEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnCellValidateEventArgs=function(_460,cell,_462,_463){
nitobi.grid.OnCellValidateEventArgs.baseConstructor.call(this,_460,cell);
this.oldValue=_463;
this.newValue=_462;
};
nitobi.lang.extend(nitobi.grid.OnCellValidateEventArgs,nitobi.grid.CellEventArgs);
nitobi.grid.OnCellValidateEventArgs.prototype.getOldValue=function(){
return this.oldValue;
};
nitobi.grid.OnCellValidateEventArgs.prototype.getNewValue=function(){
return this.newValue;
};
nitobi.grid.OnContextMenuEventArgs=function(){
};
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnHeaderClickEventArgs=function(_464,_465){
nitobi.grid.OnHeaderClickEventArgs.baseConstructor.call(this,_464,_465);
};
nitobi.lang.extend(nitobi.grid.OnHeaderClickEventArgs,nitobi.grid.ColumnEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnRowBlurEventArgs=function(_466,row){
nitobi.grid.OnRowBlurEventArgs.baseConstructor.call(this,_466,row);
};
nitobi.lang.extend(nitobi.grid.OnRowBlurEventArgs,nitobi.grid.RowEventArgs);
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.OnRowFocusEventArgs=function(_468,row){
nitobi.grid.OnRowFocusEventArgs.baseConstructor.call(this,_468,row);
};
nitobi.lang.extend(nitobi.grid.OnRowFocusEventArgs,nitobi.grid.RowEventArgs);
nitobi.grid.Row=function(grid,row){
this.grid=grid;
this.row=row;
this.Row=row;
this.DomNode=nitobi.grid.Row.getRowElement(grid,row);
};
nitobi.grid.Row.prototype.getData=function(){
if(this.DataNode==null){
this.DataNode=this.grid.datatable.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"data/"+nitobi.xml.nsPrefix+"e[@xi="+this.Row+"]");
}
return this.DataNode;
};
nitobi.grid.Row.prototype.getStyle=function(){
return this.DomNode.style;
};
nitobi.grid.Row.prototype.getCell=function(_46c){
return this.grid.getCellObject(this.row,_46c);
};
nitobi.grid.Row.prototype.getKey=function(_46d){
return this.grid.getCellObject(this.row,_46d);
};
nitobi.grid.Row.getRowElement=function(grid,row){
return nitobi.grid.Row.getRowElements(grid,row).mid;
};
nitobi.grid.Row.getRowElements=function(grid,row){
var _472=grid.getFrozenLeftColumnCount();
if(!_472){
return {left:null,mid:$ntb("row_"+row+"_"+grid.uid)};
}
var C=nitobi.grid.Cell;
var rows={};
try{
rows.left=C.getCellElement(grid,row,0).parentNode;
var cell=C.getCellElement(grid,row,_472);
rows.mid=cell?cell.parentNode:null;
return rows;
}
catch(e){
}
};
nitobi.grid.Row.getRowNumber=function(_476){
return parseInt(_476.getAttribute("xi"));
};
nitobi.grid.Row.prototype.xGETMETA=function(){
var node=this.MetaNode;
node=node.selectSingleNode("@"+arguments[0]);
if(node!=null){
return node.value;
}
};
nitobi.grid.Row.prototype.xSETMETA=function(){
var node=this.MetaNode;
if(null==node){
var meta=this.grid.data.selectSingleNode("//root/gridmeta");
var _47a=this.MetaNode=this.grid.data.createNode(1,"r","");
_47a.setAttribute("xi",this.row);
meta.appendChild(_47a);
node=this.MetaNode=_47a;
}
if(node!=null){
node.setAttribute(arguments[0],arguments[1][0]);
}else{
alert("Cannot set property: "+arguments[0]);
}
};
nitobi.grid.RowRenderer=function(_47b,_47c,_47d,_47e,_47f,_480){
this.rowHeight=_47d;
this.xmlDataSource=_47b;
this.dataTableId="";
this.firstColumn=_47e;
this.columns=_47f;
this.firstColumn=_47e;
this.uniqueId=_480;
this.mergeDoc=nitobi.xml.createXmlDoc("<ntb:root xmlns:ntb=\"http://www.nitobi.com\"><ntb:columns><ntb:stub/></ntb:columns><ntb:data><ntb:stub/></ntb:data></ntb:root>");
this.mergeDocCols=this.mergeDoc.selectSingleNode("//ntb:columns");
this.mergeDocData=this.mergeDoc.selectSingleNode("//ntb:data");
};
nitobi.grid.RowRenderer.prototype.render=function(_481,rows,_483,_484,_485,_486){
var _481=Number(_481)||0;
var rows=Number(rows)||0;
var xt=nitobi.grid.rowXslProc;
xt.addParameter("start",_481,"");
xt.addParameter("end",_481+rows,"");
xt.addParameter("sortColumn",_485,"");
xt.addParameter("sortDirection",_486,"");
xt.addParameter("dataTableId",this.dataTableId,"");
xt.addParameter("showHeaders",this.showHeaders+0,"");
xt.addParameter("firstColumn",this.firstColumn,"");
xt.addParameter("lastColumn",this.lastColumn,"");
xt.addParameter("uniqueId",this.uniqueId,"");
xt.addParameter("rowHover",this.rowHover,"");
xt.addParameter("frozenColumnId",this.frozenColumnId,"");
xt.addParameter("toolTipsEnabled",this.toolTipsEnabled,"");
var data=this.xmlDataSource.xmlDoc();
if(data.documentElement.firstChild==null){
return "";
}
var root=this.mergeDoc;
this.mergeDocCols.replaceChild((!nitobi.browser.IE?root.importNode(this.definitions,true):this.definitions.cloneNode(true)),this.mergeDocCols.firstChild);
this.mergeDocData.replaceChild((!nitobi.browser.IE?root.importNode(data.documentElement,true):data.documentElement.cloneNode(true)),this.mergeDocData.firstChild);
s2=nitobi.xml.transformToString(root,xt,"xml");
s2=s2.replace(/ATOKENTOREPLACE/g,"&nbsp;");
s2=s2.replace(/\#\&lt\;\#/g,"<").replace(/\#\&gt\;\#/g,">").replace(/\#\&amp;lt\;\#/g,"<").replace(/\#\&amp;gt\;\#/g,">").replace(/\#EQ\#/g,"=").replace(/\#\Q\#/g,"\"").replace(/\#\&amp\;\#/g,"&");
return s2;
};
nitobi.grid.RowRenderer.prototype.generateXslTemplate=function(_48a,_48b,_48c,_48d,_48e,_48f,_490,_491,id){
this.definitions=_48a;
this.showIndicators=_48f;
this.showHeaders=_48e;
this.firstColumn=_48c;
this.lastColumn=_48c+_48d;
this.rowHover=_490;
this.frozenColumnId=(id?id:"");
this.toolTipsEnabled=_491;
return;
try{
var path=(typeof (gApplicationPath)=="undefined"?window.location.href.substr(0,window.location.href.lastIndexOf("/")+1):gApplicationPath);
var imp=this.xmlTemplate.selectNodes("//xsl:import");
for(var i=0;i<imp.length;i++){
imp[i].setAttribute("href",path+"xsl/"+imp[i].getAttribute("href"));
}
}
catch(e){
}
};
nitobi.grid.RowRenderer.prototype.dispose=function(){
this.xslTemplate=null;
this.xmlDataSource=null;
};
EBAScroller_RENDERTIMEOUT=100;
EBAScroller_VIEWPANES=new Array("topleft","topcenter","midleft","midcenter");
nitobi.grid.Scroller3x3=function(_496,_497,rows,_499,_49a,_49b){
this.disposal=[];
this.height=_497;
this.rows=rows;
this.columns=_499;
this.freezetop=_49a;
this.freezeleft=_49b;
this.lastScrollTop=-1;
this.uid=nitobi.base.getUid();
this.onRenderComplete=new nitobi.base.Event();
this.onRangeUpdate=new nitobi.base.Event();
this.onHtmlReady=new nitobi.base.Event();
this.owner=_496;
var VP=nitobi.grid.Viewport;
this.view={topleft:new VP(this.owner,0),topcenter:new VP(this.owner,1),midleft:new VP(this.owner,3),midcenter:new VP(this.owner,4)};
this.view.midleft.onHtmlReady.subscribe(this.handleHtmlReady,this);
this.setCellRanges();
this.scrollSurface=null;
this.startRow=_49a;
this.headerHeight=23;
this.rowHeight=23;
this.lastTimeoutId=0;
this.scrollTopPercent=0;
this.dataTable=null;
this.cacheMap=new nitobi.collections.CacheMap(-1,-1);
this.refresh=false;
};
nitobi.grid.Scroller3x3.prototype.updateCellRanges=function(cols,rows,frzL,frzT){
this.columns=cols;
this.rows=rows;
this.freezetop=frzT;
this.freezeleft=frzL;
this.setCellRanges();
};
nitobi.grid.Scroller3x3.prototype.setCellRanges=function(){
var _4a1=null;
if(this.implementsStandardPaging()){
_4a1=this.getDisplayedRowCount();
}
this.view.topleft.setCellRanges(0,this.freezetop,0,this.freezeleft);
this.view.topcenter.setCellRanges(0,this.freezetop,this.freezeleft,this.columns-this.freezeleft);
this.view.midleft.setCellRanges(this.freezetop,(_4a1?_4a1:this.rows)-this.freezetop,0,this.freezeleft);
this.view.midcenter.setCellRanges(this.freezetop,(_4a1?_4a1:this.rows)-this.freezetop,this.freezeleft,this.columns-this.freezeleft);
};
nitobi.grid.Scroller3x3.prototype.resize=function(_4a2){
this.height=_4a2;
};
nitobi.grid.Scroller3x3.prototype.setScrollLeftRelative=function(_4a3){
this.setScrollLeft(this.scrollLeft+_4a3);
};
nitobi.grid.Scroller3x3.prototype.setScrollLeftPercent=function(_4a4){
this.setScrollLeft(Math.round((this.view.midcenter.element.scrollWidth-this.view.midcenter.element.clientWidth)*_4a4));
};
nitobi.grid.Scroller3x3.prototype.setScrollLeft=function(_4a5){
this.view.midcenter.element.scrollLeft=_4a5;
this.view.topcenter.element.scrollLeft=_4a5;
};
nitobi.grid.Scroller3x3.prototype.getScrollLeft=function(){
return this.scrollSurface.scrollLeft;
};
nitobi.grid.Scroller3x3.prototype.setScrollTopRelative=function(_4a6){
this.setScrollTop(this.getScrollTop()+_4a6);
};
nitobi.grid.Scroller3x3.prototype.setScrollTopPercent=function(_4a7){
ntbAssert(!isNaN(_4a7),"scrollPercent isNaN");
this.setScrollTop(Math.round((this.view.midcenter.element.scrollHeight-this.view.midcenter.element.clientHeight)*_4a7));
};
nitobi.grid.Scroller3x3.prototype.getScrollTopPercent=function(){
return this.scrollSurface.scrollTop/(this.view.midcenter.element.scrollHeight-this.view.midcenter.element.clientHeight);
};
nitobi.grid.Scroller3x3.prototype.setScrollTop=function(_4a8){
this.view.midcenter.element.scrollTop=_4a8;
this.view.midleft.element.scrollTop=_4a8;
this.render();
};
nitobi.grid.Scroller3x3.prototype.getScrollTop=function(){
return this.scrollSurface.scrollTop;
};
nitobi.grid.Scroller3x3.prototype.clearSurfaces=function(_4a9,_4aa,_4ab,_4ac){
this.flushCache();
_4ab=true;
if(_4a9){
_4aa=true;
_4ab=true;
_4ac=true;
}
if(_4aa){
this.view.topleft.clear(true);
this.view.topcenter.clear(true);
}
if(_4ab){
this.view.midleft.clear(true,true,false,false);
this.view.midcenter.clear(false,false,true);
}
if(_4ac){
}
};
nitobi.grid.Scroller3x3.prototype.mapToHtml=function(_4ad){
var uid=this.owner.uid;
for(var i=0;i<4;i++){
var node=$ntb("gridvp_"+i+"_"+uid);
this.view[EBAScroller_VIEWPANES[i]].mapToHtml(node,nitobi.html.getFirstChild(node),null);
}
this.scrollSurface=$ntb("gridvp_3_"+uid);
};
nitobi.grid.Scroller3x3.prototype.getUnrenderedBlocks=function(){
var pair={first:this.freezetop,last:this.rows-1-this.freezetop};
if(!this.implementsShowAll()){
var _4b2=this.getScrollTop()+this.getTop()-this.headerHeight;
var MC=this.view.midcenter;
var b0=MC.findBlockAtCoord(_4b2);
var b1=MC.findBlockAtCoord(_4b2+this.height);
var _4b6=null;
var _4b7=null;
if(b0==null){
return;
}
_4b6=b0.top+Math.floor((_4b2-b0.offsetTop)/this.rowHeight);
if(b1){
_4b7=b1.top+Math.floor((_4b2+this.height-b1.offsetTop)/this.rowHeight);
}else{
_4b7=_4b6+Math.floor(this.height/this.rowHeight);
}
_4b7=Math.min(_4b7,this.rows);
if(this.implementsStandardPaging()){
var _4b8=0;
if(this.owner.getRenderMode()==nitobi.grid.RENDERMODE_ONDEMAND){
var _4b9=_4b6+_4b8;
var last=Math.min(_4b7+_4b8,_4b8+this.getDisplayedRowCount()-1);
pair={first:_4b9,last:last};
}else{
var _4b9=_4b8;
var last=_4b9+this.getDisplayedRowCount()-1;
pair={first:_4b9,last:last};
}
}else{
pair={first:_4b6,last:_4b7};
}
this.onRangeUpdate.notify(pair);
}
return pair;
};
nitobi.grid.Scroller3x3.prototype.render=function(_4bb){
if(this.owner.isBound()&&(this.getScrollTop()!=this.lastScrollTop||_4bb||this.scrollTopPercent>0.9)){
var _4bc=nitobi.lang.close(this,this.performRender,[]);
window.clearTimeout(this.lastTimeoutId);
this.lastTimeoutId=window.setTimeout(_4bc,EBAScroller_RENDERTIMEOUT);
}
};
nitobi.grid.Scroller3x3.prototype.performRender=function(){
var _4bd=this.getUnrenderedBlocks();
if(_4bd==null){
return;
}
var _4be=this.getScrollTop();
var mc=this.view.midcenter;
var ml=this.view.midleft;
var _4c1=this.getDataTable();
var _4c2=_4bd.first;
var last=_4bd.last;
if(last>=_4c1.remoteRowCount-1&&!_4c1.rowCountKnown){
last+=2;
}
var gaps=this.cacheMap.gaps(_4c2,last);
var _4c5=(this.owner.mode.toLowerCase()==nitobi.grid.MODE_LIVESCROLLING?(_4c2+last<=0):(_4c2+last<=-1));
if(_4c5){
this.onHtmlReady.notify();
}else{
if(gaps[0]!=null){
var low=gaps[0].low;
var high=gaps[0].high;
var rows=high-low+1;
if(!_4c1.inCache(low,rows)){
if(low==null||rows==null){
alert("low or rows =null");
}
if(this.implementsStandardPaging()){
var _4c9=this.getCurrentPageIndex()*this.getRowsPerPage();
var _4ca=_4c9+this.getRowsPerPage();
if(this.refresh){
_4c1.get(_4c9,_4ca);
this.refresh=false;
}
}else{
_4c1.get(low,rows);
}
var _4cb=_4c1.cachedRanges(low,high);
for(var i=0;i<_4cb.length;i++){
var _4cd=this.cacheMap.gaps(_4cb[i].low,_4cb[i].high);
for(var j=0;j<_4cd.length;j++){
_4bd.first=_4cd[j].low;
_4bd.last=_4cd[j].high;
this.renderGap(_4cd[j].low,_4cd[j].high);
}
}
return false;
}else{
this.renderGap(low,high);
}
}
}
this.onRenderComplete.notify();
};
nitobi.grid.Scroller3x3.prototype.renderGap=function(low,high){
var gaps=this.cacheMap.gaps(low,high);
var mc=this.view.midcenter;
var ml=this.view.midleft;
if(gaps[0]!=null){
var low=gaps[0].low;
var high=gaps[0].high;
var rows=high-low+1;
this.cacheMap.insert(low,high);
mc.renderGap(low,high);
ml.renderGap(low,high);
}
};
nitobi.grid.Scroller3x3.prototype.renderSpecified=function(low,high){
var rows=high-low+1;
var _4d8=this.getUnrenderedBlocks();
var _4d9=this.getDataTable();
if(!_4d9.inCache(low,rows)){
if(low==null||rows==null){
alert("low or rows =null");
}
if(this.implementsStandardPaging()){
var _4da=this.getCurrentPageIndex()*this.getRowsPerPage();
var _4db=_4da+this.getRowsPerPage();
_4d9.get(_4da,_4db);
}else{
_4d9.get(low,rows);
}
var _4dc=_4d9.cachedRanges(low,high);
for(var i=0;i<_4dc.length;i++){
var _4de=this.cacheMap.gaps(_4dc[i].low,_4dc[i].high);
for(var j=0;j<_4de.length;j++){
_4d8.first=_4de[j].low;
_4d8.last=_4de[j].high;
this.renderGap(_4de[j].low,_4de[j].high);
}
}
return false;
}else{
this.renderGap(low,high);
}
};
nitobi.grid.Scroller3x3.prototype.flushCache=function(){
if(Boolean(this.cacheMap)){
this.cacheMap.flush();
}
};
nitobi.grid.Scroller3x3.prototype.reRender=function(_4e0,_4e1){
var _4e2=this.view.midleft.clearBlocks(_4e0,_4e1);
this.view.midcenter.clearBlocks(_4e0,_4e1);
this.cacheMap.remove(_4e2.top,_4e2.bottom);
this.render();
};
nitobi.grid.Scroller3x3.prototype.getViewportByCoords=function(row,_4e4){
var _4e5=0;
if(row>=_4e5&&row<this.owner.getfreezetop()&&_4e4>=0&&_4e4<this.owner.frozenLeftColumnCount()){
return this.view.topleft;
}
if(row>=_4e5&&row<this.owner.getfreezetop()&&_4e4>=this.owner.getFrozenLeftColumnCount()&&_4e4<this.owner.getColumnCount()){
return this.view.topcenter;
}
if(row>=this.owner.getfreezetop()+_4e5&&row<this.owner.getDisplayedRowCount()+_4e5&&_4e4>=0&&_4e4<this.owner.getFrozenLeftColumnCount()){
return this.view.midleft;
}
if(row>=this.owner.getfreezetop()+_4e5&&row<this.owner.getDisplayedRowCount()+_4e5&&_4e4>=this.owner.getFrozenLeftColumnCount()&&_4e4<this.owner.getColumnCount()){
return this.view.midcenter;
}
};
nitobi.grid.Scroller3x3.prototype.getRowsPerPage=function(){
return this.owner.getRowsPerPage();
};
nitobi.grid.Scroller3x3.prototype.getDisplayedRowCount=function(){
return this.owner.getDisplayedRowCount();
};
nitobi.grid.Scroller3x3.prototype.getCurrentPageIndex=function(){
return this.owner.getCurrentPageIndex();
};
nitobi.grid.Scroller3x3.prototype.implementsStandardPaging=function(){
return Boolean(this.owner.getPagingMode().toLowerCase()=="standard");
};
nitobi.grid.Scroller3x3.prototype.implementsShowAll=function(){
return Boolean(this.owner.getPagingMode().toLowerCase()==nitobi.grid.PAGINGMODE_NONE);
};
nitobi.grid.Scroller3x3.prototype.setDataTable=function(_4e6){
this.dataTable=_4e6;
};
nitobi.grid.Scroller3x3.prototype.getDataTable=function(){
return this.dataTable;
};
nitobi.grid.Scroller3x3.prototype.handleHtmlReady=function(){
this.onHtmlReady.notify();
};
nitobi.grid.Scroller3x3.prototype.getTop=function(){
return this.freezetop*this.rowHeight+this.headerHeight;
};
nitobi.grid.Scroller3x3.prototype.setSort=function(col,dir){
this.view.topleft.setSort(col,dir);
this.view.topcenter.setSort(col,dir);
this.view.midleft.setSort(col,dir);
this.view.midcenter.setSort(col,dir);
};
nitobi.grid.Scroller3x3.prototype.setRowHeight=function(_4e9){
this.rowHeight=_4e9;
this.setViewportProperty("RowHeight",_4e9);
};
nitobi.grid.Scroller3x3.prototype.setHeaderHeight=function(_4ea){
this.headerHeight=_4ea;
this.setViewportProperty("HeaderHeight",_4ea);
};
nitobi.grid.Scroller3x3.prototype.setViewportProperty=function(_4eb,_4ec){
var sv=this.view;
for(var i=0;i<EBAScroller_VIEWPANES.length;i++){
sv[EBAScroller_VIEWPANES[i]]["set"+_4eb](_4ec);
}
};
nitobi.grid.Scroller3x3.prototype.fire=function(evt,args){
return nitobi.event.notify(evt+this.uid,args);
};
nitobi.grid.Scroller3x3.prototype.subscribe=function(evt,func,_4f3){
if(typeof (_4f3)=="undefined"){
_4f3=this;
}
return nitobi.event.subscribe(evt+this.uid,nitobi.lang.close(_4f3,func));
};
nitobi.grid.Scroller3x3.prototype.dispose=function(){
try{
(this.cacheMap!=null?this.cacheMap.flush():"");
this.cacheMap=null;
var _4f4=this.disposal.length;
for(var i=0;i<_4f4;i++){
if(typeof (this.disposal[i])=="function"){
this.disposal[i].call(this);
}
this.disposal[i]=null;
}
for(var v in this.view){
this.view[v].dispose();
}
for(var item in this){
if(this[item]!=null&&this[item].dispose instanceof Function){
this[item].dispose();
}
}
}
catch(e){
}
};
nitobi.grid.Selection=function(_4f8,_4f9){
nitobi.grid.Selection.baseConstructor.call(this,_4f8);
this.owner=_4f8;
var t=new Date();
this.selecting=false;
this.expanding=false;
this.resizingRow=false;
this.created=false;
this.freezeTop=this.owner.getfreezetop();
this.freezeLeft=this.owner.getFrozenLeftColumnCount();
this.rowHeight=23;
this.onAfterExpand=new nitobi.base.Event();
this.onBeforeExpand=new nitobi.base.Event();
this.onMouseUp=new nitobi.base.Event();
this.expandEndCell=null;
this.expandStartCell=null;
this.dragFillEnabled=_4f9||false;
this.firstCellClick=false;
this.multiSelect=false;
};
nitobi.lang.extend(nitobi.grid.Selection,nitobi.collections.CellSet);
nitobi.grid.Selection.prototype.setRange=function(_4fb,_4fc,_4fd,_4fe){
nitobi.grid.Selection.base.setRange.call(this,_4fb,_4fc,_4fd,_4fe);
this.startCell=this.owner.getCellElement(_4fb,_4fc);
this.endCell=this.owner.getCellElement(_4fd,_4fe);
};
nitobi.grid.Selection.prototype.setRangeWithDomNodes=function(_4ff,_500){
this.setRange(nitobi.grid.Cell.getRowNumber(_4ff),nitobi.grid.Cell.getColumnNumber(_4ff),nitobi.grid.Cell.getRowNumber(_500),nitobi.grid.Cell.getColumnNumber(_500));
};
nitobi.grid.Selection.prototype.createBoxes=function(){
if(!this.created){
var uid=this.owner.uid;
var H=nitobi.html;
var _503=H.createElement("div",{"class":"ntb-grid-selection-grabby"});
this.expanderGrabbyEvents=[{type:"mousedown",handler:this.handleGrabbyMouseDown},{type:"mouseup",handler:this.handleGrabbyMouseUp},{type:"click",handler:this.handleGrabbyClick}];
H.attachEvents(_503,this.expanderGrabbyEvents,this);
this.boxexpanderGrabby=_503;
this.box=this.createBox("selectbox"+uid);
this.boxl=this.createBox("selectboxl"+uid);
this.events=[{type:"mousemove",handler:this.shrink},{type:"mouseup",handler:this.handleSelectionMouseUp},{type:"mousedown",handler:this.handleSelectionMouseDown},{type:"click",handler:this.handleSelectionClick},{type:"dblclick",handler:this.handleDblClick}];
H.attachEvents(this.box,this.events,this);
H.attachEvents(this.boxl,this.events,this);
var sv=this.owner.Scroller.view;
sv.midcenter.surface.appendChild(this.box);
sv.midleft.surface.appendChild(this.boxl);
this.clear();
this.created=true;
}
};
nitobi.grid.Selection.prototype.createBox=function(id){
var _506;
var cell;
if(nitobi.browser.IE){
cell=_506=document.createElement("div");
}else{
_506=nitobi.html.createTable({"cellpadding":0,"cellspacing":0,"border":0},{"backgroundColor":"transparent"});
cell=_506.rows[0].cells[0];
}
_506.className="ntb-grid-selection ntb-grid-selection-border";
_506.setAttribute("id","ntb-grid-selection-"+id);
var _508=nitobi.html.createElement("div",{"id":id,"class":"ntb-grid-selection-background"});
cell.appendChild(_508);
return _506;
};
nitobi.grid.Selection.prototype.clearBoxes=function(){
if(this.box!=null){
this.clearBox(this.box);
}
if(this.boxl!=null){
this.clearBox(this.boxl);
}
this.created=false;
delete this.box;
delete this.boxl;
this.box=null;
this.boxl=null;
};
nitobi.grid.Selection.prototype.clearBox=function(box){
nitobi.html.detachEvents(box,this.events);
if(box.parentNode!=null){
box.parentNode.removeChild(box);
}
box=null;
};
nitobi.grid.Selection.prototype.handleGrabbyMouseDown=function(evt){
this.selecting=true;
this.setExpanding(true,"vert");
var _50b=this.getTopLeftCell();
var _50c=this.getBottomRightCell();
this.expandStartCell=_50b;
this.expandEndCell=_50c;
var _50d=this.owner.getScrollSurface();
this.expandStartCoords=nitobi.html.getBoundingClientRect(this.box,_50d.scrollTop+document.body.scrollTop,_50d.scrollLeft+document.body.scrollLeft);
this.expandStartHeight=Math.abs(_50b.getRow()-_50c.getRow())+1;
this.expandStartWidth=Math.abs(_50b.getColumn()-_50c.getColumn())+1;
this.expandStartTopRow=_50b.getRow();
this.expandStartBottomRow=_50c.getRow();
this.expandStartLeftColumn=_50b.getColumn();
this.expandStartRightColumn=_50c.getColumn();
var Cell=nitobi.grid.Cell;
if(Cell.getRowNumber(this.startCell)>Cell.getRowNumber(this.endCell)){
var _50f=this.startCell;
this.startCell=this.endCell;
this.endCell=_50f;
}
this.onBeforeExpand.notify(this);
};
nitobi.grid.Selection.prototype.handleGrabbyMouseUp=function(evt){
if(this.expanding){
this.selecting=false;
(this._startRow==this._endRow)?this.setExpanding(false,"horiz"):this.setExpanding(false);
this.onAfterExpand.notify(this);
}
};
nitobi.grid.Selection.prototype.handleGrabbyClick=function(evt){
};
nitobi.grid.Selection.prototype.expand=function(cell,dir){
this.setExpanding(true,dir);
var Cell=nitobi.grid.Cell;
var _515;
var _516=this.expandStartTopRow,_517=this.expandStartLeftColumn;
var _518=this.expandStartBottomRow,_519=this.expandStartRightColumn;
var _51a=Cell.getRowNumber(this.endCell),_51b=Cell.getColumnNumber(this.endCell);
var _51c=Cell.getRowNumber(this.startCell),_51d=Cell.getColumnNumber(this.startCell);
var _51e=Cell.getColumnNumber(cell);
var _51f=Cell.getRowNumber(cell);
var _520=_51d,_521=_51c;
var o=this.owner;
if(dir=="horiz"){
if(_51d<_51b&_51e<_51d){
this.changeEndCellWithDomNode(o.getCellElement(_518,_51e));
this.changeStartCellWithDomNode(o.getCellElement(_516,_519));
}else{
if(_51d>_51b&&_51e>_51d){
this.changeEndCellWithDomNode(o.getCellElement(_518,_51e));
this.changeStartCellWithDomNode(o.getCellElement(_516,_517));
}else{
this.changeEndCellWithDomNode(o.getCellElement((_51c==_518?_516:_518),_51e));
}
}
}else{
if(_51c<_51a&_51f<_51c){
this.changeEndCellWithDomNode(o.getCellElement(_51f,_519));
this.changeStartCellWithDomNode(o.getCellElement(_518,_517));
}else{
if(_51c>_51a&&_51f>_51c){
this.changeEndCellWithDomNode(o.getCellElement(_51f,_519));
this.changeStartCellWithDomNode(o.getCellElement(_516,_517));
}else{
this.changeEndCellWithDomNode(o.getCellElement(_51f,(_51d==_519?_517:_519)));
}
}
}
this.alignBoxes();
};
nitobi.grid.Selection.prototype.shrink=function(evt){
if(nitobi.html.Css.hasClass(evt.srcElement,"ntb-grid-selection-border")||nitobi.html.Css.hasClass(evt.srcElement,"ntb-grid-selection-grabby")){
return;
}
if(this.endCell!=this.startCell&&this.selecting){
var _524=this.owner.getScrollSurface();
var Cell=nitobi.grid.Cell;
var _526=Cell.getRowNumber(this.endCell),_527=Cell.getColumnNumber(this.endCell);
var _528=Cell.getRowNumber(this.startCell),_529=Cell.getColumnNumber(this.startCell);
var _52a=nitobi.html.getEventCoords(evt);
var evtY=_52a.y,evtX=_52a.x;
if(nitobi.browser.IE||document.compatMode=="BackCompat"){
evtY=evt.clientY,evtX=evt.clientX;
}
var _52d=nitobi.html.getBoundingClientRect(this.endCell,_524.scrollTop+document.body.scrollTop,_524.scrollLeft+document.body.scrollLeft);
var _52e=_52d.top,_52f=_52d.left;
if(_526>_528&&evtY<_52e){
_526=_526-Math.floor(((_52e-4)-evtY)/this.rowHeight)-1;
}else{
if(evtY>_52d.bottom){
_526=_526+Math.floor((evtY-_52e)/this.rowHeight);
}
}
if(_527>_529&&evtX<_52f){
_527--;
}else{
if(evtX>_52d.right){
_527++;
}
}
if(this.expanding){
var _530=this.expandStartCell.getRow(),_531=this.expandStartCell.getColumn();
var _532=this.expandEndCell.getRow(),_533=this.expandEndCell.getColumn();
if(_527>=this.expandStartLeftColumn&&_527<=this.expandStartRightColumn){
if(_527>=_529&&_527<_533){
_527=_533;
}else{
if(_527<=_529&&_527>_531){
_527=_531;
}
}
if(_527>=_529&&_527<=this.expandStartRightColumn){
_527=this.expandStartRightColumn;
}
}
if(_526>=this.expandStartTopRow&&_526<=this.expandStartBottomRow){
if(_528<_526&&_526<=_532){
_526=_532;
}else{
if(_528>_526&&_526>=_530){
_526=_530;
}else{
if(_528==_526){
_526=(_528==_530?_532:_530);
}
}
}
}
}
var _534=this.owner.getCellElement(_526,_527);
var _535=this.owner.getCellElement(_528,_529);
if(_534!=null&&_534!=this.endCell||_535!=null&&_535!=this.startCell){
this.changeEndCellWithDomNode(_534);
this.changeStartCellWithDomNode(_535);
this.alignBoxes();
this.owner.ensureCellInView(_534);
}
}
};
nitobi.grid.Selection.prototype.getHeight=function(){
var rect=nitobi.html.getBoundingClientRect(this.box);
return rect.top-rect.bottom;
};
nitobi.grid.Selection.prototype.collapse=function(cell){
if(!cell){
cell=this.startCell;
}
if(!cell){
return;
}
this.setRangeWithDomNodes(cell,cell);
if((this.box==null)||(this.box.parentNode==null)||(this.boxl==null)||(this.boxl.parentNode==null)){
this.created=false;
this.createBoxes();
}
this.alignBoxes();
this.selecting=false;
};
nitobi.grid.Selection.prototype.startSelecting=function(_538,_539){
this.selecting=true;
this.setRangeWithDomNodes(_538,_539);
this.shrink();
};
nitobi.grid.Selection.prototype.clearSelection=function(cell){
this.collapse(cell);
};
nitobi.grid.Selection.prototype.resizeSelection=function(cell){
this.endCell=cell;
this.shrink();
};
nitobi.grid.Selection.prototype.moveSelection=function(cell){
this.collapse(cell);
};
nitobi.grid.Selection.prototype.alignBoxes=function(){
var _53d=this.endCell||this.startCell;
var sc=this.getCoords();
var _53f=sc.top.y;
var _540=sc.top.x;
var _541=sc.bottom.y;
var _542=sc.bottom.x;
var _543=nitobi.lang.isStandards();
var ox=oy=(nitobi.browser.IE?-1:0);
var ow=oh=(nitobi.browser.IE&&_543?-1:1);
if(nitobi.browser.SAFARI||nitobi.browser.CHROME){
oy=ox=-1;
if(_543){
oh=ow=-1;
}
}
if(_542>=this.freezeLeft&&_541>=this.freezeTop){
var e=this.box;
e.style.display="block";
this.align(e,this.startCell,_53d,286265344,oh,ow,oy,ox);
if(this.dragFillEnabled){
(e.rows!=null?e.rows[0].cells[0]:e).appendChild(this.boxexpanderGrabby);
}
}else{
this.box.style.display="none";
}
if(_542<this.freezeLeft||_540<this.freezeLeft){
var e=this.boxl;
e.style.display="block";
this.align(e,this.startCell,_53d,286265344,oh,ow,oy,ox);
if(this.box.style.display=="none"){
if(this.dragFillEnabled){
(e.rows!=null?e.rows[0].cells[0]:e).appendChild(this.boxexpanderGrabby);
}
}
}else{
this.boxl.style.display="none";
}
};
nitobi.grid.Selection.prototype.redraw=function(cell){
if(!this.selecting){
this.setRangeWithDomNodes(cell,cell);
}else{
this.changeEndCellWithDomNode(cell);
}
this.alignBoxes();
};
nitobi.grid.Selection.prototype.changeStartCellWithDomNode=function(cell){
this.startCell=cell;
var Cell=nitobi.grid.Cell;
this.changeStartCell(Cell.getRowNumber(cell),Cell.getColumnNumber(cell));
};
nitobi.grid.Selection.prototype.changeEndCellWithDomNode=function(cell){
this.endCell=cell;
var Cell=nitobi.grid.Cell;
this.changeEndCell(Cell.getRowNumber(cell),Cell.getColumnNumber(cell));
};
nitobi.grid.Selection.prototype.init=function(cell){
this.createBoxes();
var t=new Date();
this.selecting=true;
this.setRangeWithDomNodes(cell,cell);
};
nitobi.grid.Selection.prototype.clear=function(){
if(!this.box){
return;
}
var bs=this.box.style;
bs.display="none";
bs.top="-1000px";
bs.left="-1000px";
bs.width="1px";
bs.height="1px";
var bls=this.boxl.style;
bls.display="none";
bls.top="-1000px";
bls.left="-1000px";
bls.width="1px";
bls.height="1px";
this.selecting=false;
};
nitobi.grid.Selection.prototype.handleSelectionClick=function(evt){
if(!this.selected()){
if(NTB_SINGLECLICK==null&&!(this.firstCellClick)){
if(nitobi.browser.IE){
evt=nitobi.lang.copy(evt);
}
NTB_SINGLECLICK=window.setTimeout(nitobi.lang.close(this,this.edit,[evt]),400);
}
}else{
this.collapse();
this.owner.focus();
this.firstCellClick=false;
}
};
nitobi.grid.Selection.prototype.handleDblClick=function(evt){
if(!this.selected()){
window.clearTimeout(NTB_SINGLECLICK);
NTB_SINGLECLICK=null;
if(this.owner.handleDblClick(evt)){
this.edit(evt);
}
}else{
this.collapse();
}
};
nitobi.grid.Selection.prototype.edit=function(evt){
NTB_SINGLECLICK=null;
this.owner.edit(evt);
};
nitobi.grid.Selection.prototype.select=function(_553,_554){
this.selectWithCoords(_553.getRowNumber(),_553.getColumnNumber(),_554.getRowNumber(),_554.getColumnNumber());
};
nitobi.grid.Selection.prototype.selectWithCoords=function(_555,_556,_557,_558){
this.setRange(_555,_556,_557,_558);
this.createBoxes();
this.alignBoxes();
};
nitobi.grid.Selection.prototype.handleSelectionMouseUp=function(evt){
if(this.expanding){
this.handleGrabbyMouseUp(evt);
}
this.stopSelecting(evt);
this.onMouseUp.notify(this);
};
nitobi.grid.Selection.prototype.handleSelectionMouseDown=function(evt){
this.firstCellClick=true;
};
nitobi.grid.Selection.prototype.stopSelecting=function(evt){
this.owner.waitt=false;
if(!this.selected()){
var cell=this.owner.findActiveCell(evt.srcElement)||this.startCell;
var _55d=nitobi.grid.Cell;
if(this.owner.activeCell!=cell){
this.owner.setActiveCell(cell,evt.ctrlKey||evt.metaKey);
}
this.collapse(cell);
}
this.selecting=false;
};
nitobi.grid.Selection.prototype.getStartCell=function(){
return this.startCell;
};
nitobi.grid.Selection.prototype.getEndCell=function(){
return this.endCell;
};
nitobi.grid.Selection.prototype.getTopLeftCell=function(){
var _55e=this.getCoords();
return new nitobi.grid.Cell(this.owner,_55e.top.y,_55e.top.x);
};
nitobi.grid.Selection.prototype.getBottomRightCell=function(){
var _55f=this.getCoords();
return new nitobi.grid.Cell(this.owner,_55f.bottom.y,_55f.bottom.x);
};
nitobi.grid.Selection.prototype.getHeight=function(){
var _560=this.getCoords();
return _560.bottom.y-_560.top.y+1;
};
nitobi.grid.Selection.prototype.getWidth=function(){
var _561=this.getCoords();
return _561.bottom.x-_561.top.x+1;
};
nitobi.grid.Selection.prototype.getRowByCoords=function(_562){
return (_562.parentNode.offsetTop/_562.parentNode.offsetHeight);
};
nitobi.grid.Selection.prototype.getColumnByCoords=function(_563){
var _564=(this.indicator?-2:0);
if(_563.parentNode.parentNode.getAttribute("id").substr(0,6)!="freeze"){
_564+=2-(this.freezeColumn*3);
}else{
_564+=2;
}
return Math.floor((_563.sourceIndex-_563.parentNode.sourceIndex-_564)/3);
};
nitobi.grid.Selection.prototype.selected=function(){
return (this.endCell==this.startCell)?false:true;
};
nitobi.grid.Selection.prototype.setRowHeight=function(_565){
this.rowHeight=_565;
};
nitobi.grid.Selection.prototype.getRowHeight=function(){
return this.rowHeight;
};
nitobi.grid.Selection.prototype.setExpanding=function(val,dir){
if(val&&this.expanding){
return;
}
this.expanding=val;
this.expandingVertical=(dir=="horiz"?false:true);
var C=nitobi.html.Css;
var _569="ntb-grid-selection-border";
var _56a=_569+"-active";
if(val){
C.swapClass(this.box,_569,_56a);
C.swapClass(this.boxl,_569,_56a);
}else{
C.swapClass(this.box,_56a,_569);
C.swapClass(this.boxl,_56a,_569);
}
};
nitobi.grid.Selection.prototype.dispose=function(){
};
nitobi.grid.Selection.prototype.align=function(_56b,_56c,_56d,_56e,oh,ow,oy,ox,show){
oh=oh||0;
ow=ow||0;
oy=oy||0;
ox=ox||0;
var a=_56e;
var td,sd,tt,tb,tl,tr,th,tw,st,sb,sl,sr,sh,sw;
if(!_56c||(nitobi.lang.typeOf(_56c)!=nitobi.lang.type.HTMLNODE)){
return;
}
ntbAssert(Boolean(_56c.parentNode)&&Boolean(_56d.parentNode)&&Boolean(_56b.parentNode),"Couldn't align selection. The parentnode has vanished. Most likely this is due to refilter.");
ad=nitobi.html.getBoundingClientRect(_56c);
bd=nitobi.html.getBoundingClientRect(_56d);
sd=nitobi.html.getBoundingClientRect(_56b);
at=ad.top;
ab=ad.bottom;
al=ad.left;
ar=ad.right;
bt=bd.top;
bb=bd.bottom;
bl=bd.left;
br=bd.right;
tt=ad.top;
tb=bd.bottom;
tl=ad.left;
tr=bd.right;
th=Math.abs(tb-tt);
tw=Math.abs(tr-tl);
st=sd.top;
sb=sd.bottom;
sl=sd.left;
sr=sd.right;
sh=Math.abs(sb-st);
sw=Math.abs(sr-sl);
var H=nitobi.html;
var _584=(Math.max(bb-at,ab-bt)+oh);
_584=(_584<0)?_584=0:_584;
var _585=(Math.max(br-al,ar-bl)+ow);
_585=(_585<0)?_585=0:_585;
if(a&268435456){
_56b.style.height=_584+"px";
}
if(a&16777216){
_56b.style.width=_585+"px";
}
if(a&1048576){
_56b.style.top=(H.getStyleTop(_56b)+Math.min(tt,bt)-st+oy)+"px";
}
if(a&65536){
_56b.style.top=(H.getStyleTop(_56b)+tt-st+th-sh+oy)+"px";
}
if(a&4096){
_56b.style.left=(H.getStyleLeft(_56b)-sl+Math.min(tl,bl)+ox)+"px";
}
if(a&256){
_56b.style.left=(H.getStyleLeft(_56b)-sl+tl+tw-sw+ox)+"px";
}
if(a&16){
_56b.style.top=(H.getStyleTop(_56b)+tt-st+oy+Math.floor((th-sh)/2))+"px";
}
if(a&1){
_56b.style.left=(H.getStyleLeft(_56b)-sl+tl+ox+Math.floor((tw-sw)/2))+"px";
}
};
nitobi.grid.Surface=function(_586,_587,_588){
this.height=_587;
this.width=_586;
this.element=_588;
};
nitobi.grid.Surface.prototype.dispose=function(){
this.element=null;
};
nitobi.grid.TextColumn=function(grid,_58a){
nitobi.grid.TextColumn.baseConstructor.call(this,grid,_58a);
};
nitobi.lang.extend(nitobi.grid.TextColumn,nitobi.grid.Column);
nitobi.lang.defineNs("nitobi.ui");
nitobi.ui.Toolbars=function(_58b,_58c){
this.grid=_58b;
this.uid="nitobiToolbar_"+nitobi.base.getUid();
this.toolbars={};
this.visibleToolbars=_58c;
};
nitobi.ui.Toolbars.VisibleToolbars={};
nitobi.ui.Toolbars.VisibleToolbars.STANDARD=1;
nitobi.ui.Toolbars.VisibleToolbars.PAGING=1<<1;
nitobi.ui.Toolbars.prototype.initialize=function(){
this.enabled=true;
this.toolbarXml=nitobi.xml.createXmlDoc(nitobi.xml.serialize(nitobi.grid.toolbarDoc));
this.toolbarPagingXml=nitobi.xml.createXmlDoc(nitobi.xml.serialize(nitobi.grid.pagingToolbarDoc));
};
nitobi.ui.Toolbars.prototype.attachToParent=function(_58d){
this.initialize();
this.container=_58d;
if(this.standardToolbar==null&&this.visibleToolbars){
this.makeToolbar();
this.render();
}
};
nitobi.ui.Toolbars.prototype.setWidth=function(_58e){
this.width=_58e;
};
nitobi.ui.Toolbars.prototype.getWidth=function(){
return this.width;
};
nitobi.ui.Toolbars.prototype.setHeight=function(_58f){
this.height=_58f;
};
nitobi.ui.Toolbars.prototype.getHeight=function(){
return this.height;
};
nitobi.ui.Toolbars.prototype.setRowInsertEnabled=function(_590){
this.rowInsertEnabled=_590;
};
nitobi.ui.Toolbars.prototype.isRowInsertEnabled=function(){
return this.rowInsertEnabled;
};
nitobi.ui.Toolbars.prototype.setRowDeleteEnabled=function(_591){
this.rowDeleteEnabled=_591;
};
nitobi.ui.Toolbars.prototype.isRowDeleteEnabled=function(){
return this.rowDeleteEnabled;
};
nitobi.ui.Toolbars.prototype.makeToolbar=function(){
var _592=this.findCssUrl();
this.toolbarXml.documentElement.setAttribute("id","toolbar"+this.uid);
this.toolbarXml.documentElement.setAttribute("image_directory",_592);
var _593=this.toolbarXml.selectNodes("/toolbar/items/*");
for(var i=0;i<_593.length;i++){
if(_593[i].nodeType!=8){
_593[i].setAttribute("id",_593[i].getAttribute("id")+this.uid);
}
}
this.standardToolbar=new nitobi.ui.Toolbar(this.toolbarXml,"toolbar"+this.uid);
this.toolbarPagingXml.documentElement.setAttribute("id","toolbarpaging"+this.uid);
this.toolbarPagingXml.documentElement.setAttribute("image_directory",_592);
_593=(this.toolbarPagingXml.selectNodes("/toolbar/items/*"));
for(var i=0;i<_593.length;i++){
if(_593[i].nodeType!=8){
_593[i].setAttribute("id",_593[i].getAttribute("id")+this.uid);
}
}
this.pagingToolbar=new nitobi.ui.Toolbar(this.toolbarPagingXml,"toolbarpaging"+this.uid);
};
nitobi.ui.Toolbars.prototype.getToolbar=function(id){
return eval("this."+id);
};
nitobi.ui.Toolbars.prototype.findCssUrl=function(){
var _596=nitobi.html.Css.findParentStylesheet(".ntb-toolbar");
if(_596==null){
_596=nitobi.html.Css.findParentStylesheet(".ntb-grid");
if(_596==null){
nitobi.lang.throwError("The CSS for the toolbar could not be found.  Try moving the nitobi.grid.css file to a location accessible to the browser's javascript or moving it to the top of the stylesheet list. findParentStylesheet returned "+_596);
}
}
return nitobi.html.Css.getPath(_596);
};
nitobi.ui.Toolbars.prototype.isToolbarEnabled=function(){
return this.enabled;
};
nitobi.ui.Toolbars.prototype.render=function(){
var _597=this.container;
_597.style.visibility="hidden";
var xsl=nitobi.ui.ToolbarXsl;
if(xsl.indexOf("xsl:stylesheet")==-1){
xsl="<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output method=\"xml\" version=\"4.0\" />"+xsl+"</xsl:stylesheet>";
}
var _599=nitobi.xml.createXslDoc(xsl);
xsl=nitobi.ui.pagingToolbarXsl;
if(xsl.indexOf("xsl:stylesheet")==-1){
xsl="<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output method=\"xml\" version=\"4.0\" />"+xsl+"</xsl:stylesheet>";
}
var _59a=nitobi.xml.createXslDoc(xsl);
var _59b=nitobi.xml.transformToString(this.standardToolbar.getXml(),_599,"xml");
_597.innerHTML=_59b;
_597.style.zIndex="1000";
var _59c=nitobi.xml.transformToString(this.pagingToolbar.getXml(),_59a,"xml");
_597.innerHTML+=_59c;
_599=null;
xmlDoc=null;
this.standardToolbar.attachToTag();
this.pagingToolbar.attachToTag();
this.resize();
var _59d=this;
var _59e=this.standardToolbar.getUiElements();
for(eachbutton in _59e){
if(_59e[eachbutton].m_HtmlElementHandle==null){
continue;
}
_59e[eachbutton].toolbar=this;
_59e[eachbutton].grid=this.grid;
if(nitobi.browser.IE&&_59e[eachbutton].m_HtmlElementHandle.onbuttonload!=null){
var x=function(item,grid,tbar,iDom){
eval(_59e[eachbutton].m_HtmlElementHandle.onbuttonload);
};
x(_59e[eachbutton],this.grid,this,_59e[eachbutton].m_HtmlElementHandle);
}else{
if(!nitobi.browser.IE&&_59e[eachbutton].m_HtmlElementHandle.hasAttribute("onbuttonload")){
var x=function(item,grid,tbar,iDom){
eval(_59e[eachbutton].m_HtmlElementHandle.getAttribute("onbuttonload"));
};
x(_59e[eachbutton],this.grid,this,_59e[eachbutton].m_HtmlElementHandle);
}
}
switch(eachbutton){
case "save"+this.uid:
_59e[eachbutton].onClick=function(){
_59d.fire("Save");
};
break;
case "newRecord"+this.uid:
_59e[eachbutton].onClick=function(){
_59d.fire("InsertRow");
};
if(!this.isRowInsertEnabled()){
_59e[eachbutton].disable();
}
break;
case "deleteRecord"+this.uid:
_59e[eachbutton].onClick=function(){
_59d.fire("DeleteRow");
};
if(!this.isRowDeleteEnabled()){
_59e[eachbutton].disable();
}
break;
case "refresh"+this.uid:
_59e[eachbutton].onClick=function(){
var _5a8=confirm("Refreshing will discard any changes you have made. Is it OK to refresh?");
if(_5a8){
_59d.fire("Refresh");
}
};
break;
case "showhide"+this.uid:
this.show_hide_btn=_59e[eachbutton];
_59e[eachbutton].onClick=function(){
grid=_59d.grid;
element=_59d.show_hide_btn;
var menu=$ntb("ntb-grid-showhide-wrapper"+grid.uid);
nitobi.ui.Toolbars.showMenu(menu,element);
};
break;
case "showhide_master"+this.uid:
this.show_hide_btn=_59e[eachbutton];
_59e[eachbutton].onClick=function(){
grid=_59d.grid;
element=_59d.show_hide_btn;
var _5aa=grid.scroller.surface.columnSetId;
var menu=$ntb("ntb-treegrid-colmenu-"+_5aa);
nitobi.ui.Toolbars.showMenu(menu,element);
};
break;
case "showhide_detail"+this.uid:
this.show_hide_btn=_59e[eachbutton];
_59e[eachbutton].onClick=function(){
grid=_59d.grid;
element=_59d.show_hide_btn;
var _5ac=null;
var _5ad=null;
for(surf in grid.Scroller.surfaceMap){
if(surf.indexOf("0_")!=-1&&surf.length==3){
_5ac=grid.Scroller.surfaceMap[surf].columnSetId;
}
}
if(_5ac!=null&&grid.Scroller.isColSetVisible(_5ac)){
var menu=$ntb("ntb-treegrid-colmenu-"+_5ac);
nitobi.ui.Toolbars.showMenu(menu,element);
}
};
break;
case "firstPage"+this.uid:
_59e[eachbutton].onClick=function(){
_59d.fire("FirstPage");
_59d.resetCounter();
};
break;
case "lastPage"+this.uid:
_59e[eachbutton].onClick=function(){
_59d.fire("LastPage");
_59d.maxCounter();
};
break;
case "previousPage"+this.uid:
_59e[eachbutton].onClick=function(){
_59d.fire("PreviousPage");
_59d.decrementCounter();
};
_59e[eachbutton].disable();
break;
case "nextPage"+this.uid:
_59e[eachbutton].onClick=function(){
_59d.fire("NextPage");
_59d.incrementCounter();
};
break;
default:
}
}
var _5af=this.pagingToolbar.getUiElements();
var _59d=this;
for(eachPbutton in _5af){
if(_5af[eachPbutton].m_HtmlElementHandle==null){
continue;
}
_5af[eachPbutton].toolbar=this;
_5af[eachPbutton].grid=this.grid;
if(nitobi.browser.IE&&_5af[eachPbutton].m_HtmlElementHandle.onbuttonload!=null){
var x=function(item,grid,tbar,iDom){
eval(_5af[eachPbutton].m_HtmlElementHandle.onbuttonload);
};
x(_5af[eachPbutton],this.grid,this,_5af[eachPbutton].m_HtmlElementHandle);
}else{
if(!nitobi.browser.IE&&_5af[eachPbutton].m_HtmlElementHandle.hasAttribute("onbuttonload")){
var x=function(item,grid,tbar,iDom){
eval(_5af[eachPbutton].m_HtmlElementHandle.getAttribute("onbuttonload"));
};
x(_5af[eachPbutton],this.grid,this,_5af[eachPbutton].m_HtmlElementHandle);
}
}
switch(eachPbutton){
case "firstPage"+this.uid:
_5af[eachPbutton].onClick=function(){
_59d.fire("FirstPage");
_59d.resetCounter();
};
break;
case "previousPage"+this.uid:
_5af[eachPbutton].onClick=function(){
_59d.fire("PreviousPage");
_59d.decrementCounter();
};
_5af[eachPbutton].disable();
break;
case "nextPage"+this.uid:
_5af[eachPbutton].onClick=function(){
_59d.fire("NextPage");
_59d.incrementCounter();
};
break;
case "lastPage"+this.uid:
_5af[eachPbutton].onClick=function(){
_59d.fire("LastPage");
_59d.maxCounter();
};
break;
default:
}
}
if(this.visibleToolbars&nitobi.ui.Toolbars.VisibleToolbars.STANDARD){
this.standardToolbar.show();
}else{
this.standardToolbar.hide();
}
if(this.visibleToolbars&nitobi.ui.Toolbars.VisibleToolbars.PAGING){
this.pagingToolbar.show();
}else{
this.pagingToolbar.hide();
}
_597.style.visibility="visible";
};
nitobi.ui.Toolbars.showMenu=function(menu,_5b9){
if(nitobi.browser.IE){
menu.style.backgroundColor="#efefef";
menu.style.border="1px solid #000000";
}
if(menu.style.display=="none"){
menu.style.position="absolute";
menu.style.left="-5000";
menu.style.display="";
var _5ba=menu.clientHeight;
menu.style.display="none";
menu.style.top=(_5b9.m_HtmlElementHandle.parentNode.offsetTop-_5ba)+"px";
menu.style.left=(_5b9.m_HtmlElementHandle.offsetLeft+_5b9.m_HtmlElementHandle.offsetWidth)+"px";
menu.style.display="";
}else{
menu.style.position="relative";
menu.style.display="none";
}
};
nitobi.ui.Toolbars.prototype.resetCounter=function(){
var _5bb=$ntb("startPage"+this.uid);
var _5bc=$ntb("endRow"+this.uid);
var _5bd=$ntb("startRow"+this.uid);
var _5be=$ntb("numRows"+this.uid);
var _5bf=this.grid.getRowsPerPage();
if(_5bb){
_5bb.value=String(1);
}
if(_5bc){
_5bc.innerHTML="&nbsp;"+this.grid.datatable.totalRowCount;
}
if(_5bd){
_5bd.innerHTML="&nbsp;1";
}
if(_5be){
_5be.innerHTML="&nbsp;"+_5bf;
}
};
nitobi.ui.Toolbars.prototype.maxCounter=function(){
var _5c0=$ntb("startPage"+this.uid);
var _5c1=$ntb("startRow"+this.uid);
var _5c2=$ntb("numRows"+this.uid);
var _5c3=this.grid.getRowsPerPage();
var _5c4=this.grid.datatable.totalRowCount/this.grid.getRowsPerPage();
if(_5c0){
_5c0.value=String(Math.ceil(_5c4));
var val=parseInt(_5c0.value);
if(_5c1){
var _5c6=(val-1)*_5c3+1;
_5c1.innerHTML="&nbsp;"+_5c6;
}
if(_5c2){
var _5c7=_5c6+_5c3-1;
_5c2.innerHTML="&nbsp;"+_5c7;
}
}
};
nitobi.ui.Toolbars.prototype.incrementCounter=function(){
var _5c8=$ntb("startPage"+this.uid);
var _5c9=$ntb("startRow"+this.uid);
var _5ca=$ntb("numRows"+this.uid);
var _5cb=this.grid.getRowsPerPage();
if(_5c8){
var val=parseInt(_5c8.value);
_5c8.value=String(++val);
if(_5c9){
var _5cd=(val-1)*_5cb+1;
_5c9.innerHTML="&nbsp;"+_5cd;
}
if(_5ca){
var _5ce=_5cd+_5cb-1;
_5ca.innerHTML="&nbsp;"+_5ce;
}
}
};
nitobi.ui.Toolbars.prototype.decrementCounter=function(){
var _5cf=$ntb("startPage"+this.uid);
var _5d0=$ntb("startRow"+this.uid);
var _5d1=$ntb("numRows"+this.uid);
var _5d2=this.grid.getRowsPerPage();
if(_5cf){
var val=parseInt(_5cf.value);
_5cf.value=String(--val);
if(_5d0){
var _5d4=(val-1)*_5d2+1;
_5d0.innerHTML="&nbsp;"+_5d4;
}
if(_5d1){
var _5d5=_5d4+_5d2-1;
_5d1.innerHTML="&nbsp;"+_5d5;
}
}
};
nitobi.ui.Toolbars.prototype.inputCounter=function(){
var _5d6=$ntb("startPage"+this.uid);
var _5d7=$ntb("startRow"+this.uid);
var _5d8=$ntb("numRows"+this.uid);
var _5d9=this.grid.getRowsPerPage();
if(_5d6){
var _5da=Math.ceil(this.grid.datatable.totalRowCount/this.grid.getRowsPerPage());
var val=parseInt(_5d6.value);
var _5dc=isNaN(_5d6.value);
if(val<0||val>_5da||_5dc){
alert("Please enter a value within the ranges of 1 and "+_5da);
}else{
if(_5d7){
var _5dd=(val-1)*_5d9+1;
_5d7.innerHTML="&nbsp;"+_5dd;
}
if(_5d8){
var _5de=_5dd+_5d9-1;
_5d8.innerHTML="&nbsp;"+_5de;
}
this.fire("InputTextPage");
}
}
};
nitobi.ui.Toolbars.prototype.calculateRange=function(){
var _5df=this.grid.datatable.totalRowCount/this.grid.getRowsPerPage();
var _5e0=$ntb("endRow"+this.uid);
var _5e1=$ntb("endPage"+this.uid);
if(_5e0){
_5e0.innerHTML="&nbsp;"+this.grid.datatable.totalRowCount;
}
if(_5e1){
_5e1.innerHTML="&nbsp;"+Math.ceil(_5df);
}
};
nitobi.ui.Toolbars.prototype.synchDropDown=function(){
var rows=this.grid.getRowsPerPage();
var _5e3=$ntb("pageDrop"+this.uid);
if(_5e3){
_5e3.value=rows;
}
};
nitobi.ui.Toolbars.prototype.resize=function(){
var _5e4=this.getWidth();
if(this.visibleToolbars&nitobi.ui.Toolbars.VisibleToolbars.PAGING){
this.standardToolbar.setHeight(this.getHeight());
}
if(this.visibleToolbars&nitobi.ui.Toolbars.VisibleToolbars.STANDARD){
this.standardToolbar.setHeight(this.getHeight());
}
};
nitobi.ui.Toolbars.prototype.fire=function(evt,args){
return nitobi.event.notify(evt+this.uid,args);
};
nitobi.ui.Toolbars.prototype.subscribe=function(evt,func,_5e9){
if(typeof (_5e9)=="undefined"){
_5e9=this;
}
return nitobi.event.subscribe(evt+this.uid,nitobi.lang.close(_5e9,func));
};
nitobi.ui.Toolbars.prototype.dispose=function(){
this.toolbarXml=null;
this.toolbarPagingXml=null;
if(this.toolbar&&this.toolbar.dispose){
this.toolbar.dispose();
this.toolbar=null;
}
if(this.toolbarPaging&&this.toolbarPaging.dispose){
this.toolbarPaging.dispose();
this.toolbarPaging=null;
}
};
var EBA_SELECTION_BUFFER=15;
var NTB_SINGLECLICK=null;
nitobi.grid.Viewport=function(grid,_5eb){
this.disposal=[];
this.surface=null;
this.element=null;
this.rowHeight=23;
this.headerHeight=23;
this.sortColumn=0;
this.sortDir=1;
this.uid=nitobi.base.getUid();
this.region=_5eb;
this.scrollIncrement=0;
this.grid=grid;
this.startRow=0;
this.rows=0;
this.startColumn=0;
this.columns=0;
this.rowRenderer=null;
this.onHtmlReady=new nitobi.base.Event();
};
nitobi.grid.Viewport.prototype.mapToHtml=function(_5ec,_5ed,_5ee){
this.surface=_5ed;
this.element=_5ec;
this.container=nitobi.html.getFirstChild(_5ed);
this.makeLastBlock(0,this.grid.getRowsPerPage()*5);
};
nitobi.grid.Viewport.prototype.makeLastBlock=function(low,high){
if(this.lastEmptyBlock==null&&this.grid&&this.region>2&&this.region<5&&this.container){
if(this.container.lastChild){
low=Math.max(low,this.container.lastChild.bottom);
}
this.lastEmptyBlock=this.renderEmptyBlock(low,high);
}
};
nitobi.grid.Viewport.prototype.setCellRanges=function(_5f1,rows,_5f3,_5f4){
this.startRow=_5f1;
this.rows=rows;
this.startColumn=_5f3;
this.columns=_5f4;
this.makeLastBlock(this.startRow,this.startRow+rows-1);
if(this.lastEmptyBlock!=null&&this.region>2&&this.region<5&&this.rows>0){
var _5f5=this.startRow+this.rows-1;
if(this.lastEmptyBlock.top>_5f5){
this.container.removeChild(this.lastEmptyBlock);
this.lastEmptyBlock=null;
}else{
this.lastEmptyBlock.bottom=_5f5;
this.lastEmptyBlock.style.height=(this.rowHeight*(this.lastEmptyBlock.bottom-this.lastEmptyBlock.top+1))+"px";
if(this.lastEmptyBlock.bottom<this.lastEmptyBlock.top){
throw "blocks are miss aligned.";
}
}
}
};
nitobi.grid.Viewport.prototype.clear=function(_5f6,_5f7,_5f8,_5f9){
var uid=this.grid.uid;
if(this.surface&&_5f6){
this.surface.innerHTML="<div id=\"gridvpcontainer_"+this.region+"_"+uid+"\"></div>";
}
if(this.element&&_5f9){
this.element.innerHTML="<div id=\"gridvpsurface_"+this.region+"_"+uid+"\"><div id=\"gridvpcontainer_"+this.region+"_"+uid+"\"></div></div>";
}
if(this.surface&&_5f8){
this.surface.innerHTML="<div id=\"gridvpcontainer_"+this.region+"_"+uid+"\"></div>";
}
this.surface=nitobi.html.getFirstChild(this.element);
this.container=nitobi.html.getFirstChild(this.surface);
if(this.grid&&this.region>2&&this.region<5){
this.lastEmptyBlock=null;
}
this.makeLastBlock(0,this.grid.getRowsPerPage()*5);
};
nitobi.grid.Viewport.prototype.setSort=function(_5fb,_5fc){
this.sortColumn=_5fb;
this.sortDir=_5fc;
};
nitobi.grid.Viewport.prototype.renderGap=function(top,_5fe){
var _5ff=activeRow=null;
var _600=this.findBlock(top);
var o=this.renderInsideEmptyBlock(top,_5fe,_600);
if(o==null){
return;
}
o.setAttribute("rendered","true");
var rows=_5fe-top+1;
o.innerHTML=this.rowRenderer.render(top,rows,_5ff,activeRow,this.sortColumn,this.sortDir);
this.onHtmlReady.notify(this);
};
nitobi.grid.Viewport.prototype.findBlock=function(row){
var blk=this.container.childNodes;
for(var i=0;i<blk.length;i++){
if(row>=blk[i].top&&row<=blk[i].bottom){
return blk[i];
}
}
};
nitobi.grid.Viewport.prototype.findBlockAtCoord=function(top){
var blk=this.container.childNodes;
for(var i=0;i<blk.length;i++){
var rt=blk[i].offsetTop;
var rb=rt+blk[i].offsetHeight;
if(top>=rt&&top<=rb){
return blk[i];
}
}
};
nitobi.grid.Viewport.prototype.getBlocks=function(_60b,_60c){
var _60d=[];
var _60e=this.findBlock(_60b);
var _60f=_60e;
_60d.push(_60e);
while(_60c>_60f.bottom){
var _610=_60f.nextSibling;
if(_610!=null){
_60f=_610;
}else{
break;
}
_60d.push(_60f);
}
return _60d;
};
nitobi.grid.Viewport.prototype.clearBlocks=function(_611,_612){
var _613=this.getBlocks(_611,_612);
var len=_613.length;
var top=_613[0].top;
var _616=_613[len-1].bottom;
var _617=_613[len-1].nextSibling;
for(var i=0;i<len;i++){
_613[i].parentNode.removeChild(_613[i]);
}
this.renderEmptyBlock(top,_616,_617);
return {"top":top,"bottom":_616};
};
nitobi.grid.Viewport.prototype.renderInsideEmptyBlock=function(top,_61a,_61b){
if(_61b==null){
return this.renderBlock(top,_61a);
}
if(top==_61b.top&&_61a>=_61b.bottom){
var _61c=this.renderBlock(top,_61a,_61b);
this.container.replaceChild(_61c,_61b);
if(_61b.bottom<_61b.top){
throw "Render error";
}
return _61c;
}
if(top==_61b.top&&_61a<_61b.bottom){
_61b.top=_61a+1;
_61b.style.height=(this.rowHeight*(_61b.bottom-_61b.top+1))+"px";
_61b.rows=_61b.bottom-_61b.top+1;
if(_61b.bottom<_61b.top){
throw "Render error";
}
return this.renderBlock(top,_61a,_61b);
}
if(top>_61b.top&&_61a>=_61b.bottom){
_61b.bottom=top-1;
_61b.style.height=(this.rowHeight*(_61b.bottom-_61b.top+1))+"px";
if(_61b.bottom<_61b.top){
throw "Render error";
}
return this.renderBlock(top,_61a,_61b.nextSibling);
}
if(top>_61b.top&&_61a<_61b.bottom){
var _61d=this.renderEmptyBlock(_61b.top,top-1,_61b);
_61b.top=_61a+1;
_61b.style.height=(this.rowHeight*(_61b.bottom-_61b.top+1))+"px";
if(_61b.bottom<_61b.top){
throw "Render error";
}
return this.renderBlock(top,_61a,_61b);
}
throw "Could not insert "+top+"-"+_61a+_61b.outerHTML;
};
nitobi.grid.Viewport.prototype.renderEmptyBlock=function(top,_61f,_620){
var o=this.renderBlock(top,_61f,_620);
o.setAttribute("id","eba_grid_emptyblock_"+this.region+"_"+top+"_"+_61f+"_"+this.grid.uid);
if(top==0&&_61f==99){
crash;
}
o.setAttribute("rendered","false");
o.style.height=Math.max(((_61f-top+1)*this.rowHeight),0)+"px";
return o;
};
nitobi.grid.Viewport.prototype.renderBlock=function(top,_623,_624){
var o=document.createElement("div");
o.setAttribute("id","eba_grid_block_"+this.region+"_"+top+"_"+_623+"_"+this.grid.uid);
o.top=top;
o.bottom=_623;
o.left=this.startColumn;
o.right=this.startColumn+this.columns;
o.rows=_623-top+1;
o.columns=this.columns;
if(_624){
this.container.insertBefore(o,_624);
}else{
this.container.insertBefore(o,null);
}
return o;
};
nitobi.grid.Viewport.prototype.setHeaderHeight=function(_626){
this.headerHeight=_626;
};
nitobi.grid.Viewport.prototype.setRowHeight=function(_627){
this.rowHeight=_627;
};
nitobi.grid.Viewport.prototype.dispose=function(){
this.element=null;
this.container=null;
nitobi.lang.dispose(this,this.disposal);
return;
};
nitobi.grid.Viewport.prototype.fire=function(evt,args){
return nitobi.event.notify(evt+this.uid,args);
};
nitobi.grid.Viewport.prototype.subscribe=function(evt,func,_62c){
if(typeof (_62c)=="undefined"){
_62c=this;
}
return nitobi.event.subscribe(evt+this.uid,nitobi.lang.close(_62c,func));
};
nitobi.grid.Viewport.prototype.attach=function(evt,func,_62f){
return nitobi.html.attachEvent(_62f,evt,nitobi.lang.close(this,func));
};
nitobi.lang.defineNs("nitobi.data");
if(false){
nitobi.data=function(){
};
}
nitobi.data.DATAMODE_UNBOUND="unbound";
nitobi.data.DATAMODE_LOCAL="local";
nitobi.data.DATAMODE_REMOTE="remote";
nitobi.data.DATAMODE_CACHING="caching";
nitobi.data.DATAMODE_STATIC="static";
nitobi.data.DATAMODE_PAGING="paging";
nitobi.data.DataSet=function(){
var _630="http://www.nitobi.com";
this.doc=nitobi.xml.createXmlDoc("<"+nitobi.xml.nsPrefix+"datasources xmlns:ntb=\""+_630+"\"></"+nitobi.xml.nsPrefix+"datasources>");
};
nitobi.data.DataSet.prototype.initialize=function(){
this.tables=new Array();
};
nitobi.data.DataSet.prototype.add=function(_631){
ntbAssert(!this.tables[_631.id],"This table data source has already been added.","",EBA_THROW);
this.tables[_631.id]=_631;
};
nitobi.data.DataSet.prototype.getTable=function(_632){
return this.tables[_632];
};
nitobi.data.DataSet.prototype.xmlDoc=function(){
var root=this.doc.documentElement;
while(root.hasChildNodes()){
root.removeChild(root.firstChild);
}
for(var i in this.tables){
if(this.tables[i].xmlDoc&&this.tables[i].xmlDoc.documentElement){
var _635=this.tables[i].xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource").cloneNode(true);
this.doc.selectSingleNode("/"+nitobi.xml.nsPrefix+"datasources").appendChild(nitobi.xml.importNode(this.doc,_635,true));
}
}
return this.doc;
};
nitobi.data.DataSet.prototype.dispose=function(){
for(var _636 in this.tables){
this.tables[_636].dispose();
}
};
nitobi.lang.defineNs("nitobi.data");
nitobi.data.DataTable=function(mode,_638,_639,_63a,_63b){
if(_638==null){
ntbAssert(false,"Table needs estimateRowCount param");
}
this.estimateRowCount=_638;
this.version=3;
this.uid=nitobi.base.getUid();
this.mode=mode||"caching";
this.setAutoKeyEnabled(_63b);
this.columns=new Array();
this.keys=new Array();
this.types=new Array();
this.defaults=new Array();
this.columnsConfigured=false;
this.pagingConfigured=false;
this.id="_default";
this.fieldMap={};
if(_639){
this.saveHandlerArgs=_639;
}else{
this.saveHandlerArgs={};
}
if(_63a){
this.getHandlerArgs=_63a;
}else{
this.getHandlerArgs={};
}
this.setGetHandlerParameter("RequestType","GET");
this.setSaveHandlerParameter("RequestType","SAVE");
this.batchInsert=false;
this.batchInsertRowCount=0;
};
nitobi.data.DataTable.DEFAULT_LOG="<"+nitobi.xml.nsPrefix+"grid "+nitobi.xml.nsDecl+"><"+nitobi.xml.nsPrefix+"datasources id='id'><"+nitobi.xml.nsPrefix+"datasource id=\"{id}\"><"+nitobi.xml.nsPrefix+"datasourcestructure /><"+nitobi.xml.nsPrefix+"data id=\"_default\"></"+nitobi.xml.nsPrefix+"data></"+nitobi.xml.nsPrefix+"datasource></"+nitobi.xml.nsPrefix+"datasources></"+nitobi.xml.nsPrefix+"grid>";
nitobi.data.DataTable.DEFAULT_DATA="<"+nitobi.xml.nsPrefix+"datasource "+nitobi.xml.nsDecl+" id=\"{id}\"><"+nitobi.xml.nsPrefix+"datasourcestructure FieldNames=\"{fields}\" Keys=\"{keys}\" types=\"{types}\" defaults=\"{defaults}\"></"+nitobi.xml.nsPrefix+"datasourcestructure><"+nitobi.xml.nsPrefix+"data id=\"{id}\"></"+nitobi.xml.nsPrefix+"data></"+nitobi.xml.nsPrefix+"datasource>";
nitobi.data.DataTable.prototype.initialize=function(_63c,_63d,_63e,_63f,_640,sort,_642,_643,_644){
this.setGetHandlerParameter("TableId",_63c);
this.setSaveHandlerParameter("TableId",_63c);
this.id=_63c;
this.datastructure=null;
this.descriptor=new nitobi.data.DataTableDescriptor(this,nitobi.lang.close(this,this.syncRowCount),this.estimateRowCount);
this.pageFirstRow=0;
this.pageRowCount=0;
this.pageSize=_640;
this.minPageSize=10;
this.requestCache=new nitobi.collections.CacheMap(-1,-1);
this.dataCache=new nitobi.collections.CacheMap(-1,-1);
this.flush();
this.sortColumn=sort;
this.sortDir=_642||"Asc";
this.filter=new Array();
this.onGenerateKey=_643;
this.remoteRowCount=0;
this.setRowCountKnown(false);
if(_63f==null){
_63f=0;
}
if(this.mode!="unbound"){
ntbAssert(_63d!=null&&typeof (_63d)!="undefined","getHandler is not specified for the nitobi.data.DataTable","",EBA_THROW);
if(_63d!=null){
this.ajaxCallbackPool=new nitobi.ajax.HttpRequestPool(nitobi.ajax.HttpRequestPool_MAXCONNECTIONS);
this.ajaxCallbackPool.context=this;
this.setGetHandler(_63d);
this.setSaveHandler(_63e);
}
this.ajaxCallback=new nitobi.ajax.HttpRequest();
this.ajaxCallback.responseType="xml";
}else{
if(_63d!=null&&typeof (_63d)!="string"){
this.initializeXml(_63d);
}
}
this.sortXslProc=nitobi.xml.createXslProcessor(nitobi.data.sortXslProc.stylesheet);
this.requestQueue=new Array();
this.async=true;
};
nitobi.data.DataTable.prototype.setOnGenerateKey=function(_645){
this.onGenerateKey=_645;
};
nitobi.data.DataTable.prototype.getOnGenerateKey=function(){
return this.onGenerateKey;
};
nitobi.data.DataTable.prototype.setAutoKeyEnabled=function(val){
this.autoKeyEnabled=val;
};
nitobi.data.DataTable.prototype.isAutoKeyEnabled=function(){
return this.autoKeyEnabled;
};
nitobi.data.DataTable.prototype.initializeXml=function(oXml){
this.replaceData(oXml);
var rows=this.xmlDoc.selectNodes("//"+nitobi.xml.nsPrefix+"e").length;
if(rows>0){
var s=this.xmlDoc.xml;
s=nitobi.xml.transformToString(this.xmlDoc,this.sortXslProc,"xml");
this.xmlDoc=nitobi.xml.loadXml(this.xmlDoc,s);
this.dataCache.insert(0,rows-1);
if(this.mode=="local"){
this.setRowCountKnown(true);
}
}
this.setRemoteRowCount(rows);
this.fire("DataInitalized");
var _64a=this.xmlDoc.selectSingleNode("//ntb:datasource").getAttribute("totalrowcount");
_64a=parseInt(_64a);
if(!isNaN(_64a)){
this.totalRowCount=_64a;
}
this.fire("TotalRowCountReady",this.totalRowCount);
};
nitobi.data.DataTable.prototype.initializeXmlData=function(oXml){
var sXml=oXml;
if(typeof (oXml)=="object"){
sXml=oXml.xml;
}
sXml=sXml.replace(/fieldnames=/g,"FieldNames=").replace(/keys=/g,"Keys=");
this.xmlDoc=nitobi.xml.loadXml(this.xmlDoc,sXml);
this.datastructure=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"datasourcestructure");
};
nitobi.data.DataTable.prototype.replaceData=function(oXml){
this.initializeXmlData(oXml);
var _64e=this.datastructure.getAttribute("FieldNames");
var keys=this.datastructure.getAttribute("Keys");
var _650=this.datastructure.getAttribute("Defaults");
var _651=this.datastructure.getAttribute("Types");
this.initializeColumns(_64e,keys,_651,_650);
};
nitobi.data.DataTable.prototype.initializeSchema=function(){
var _652=this.columns.join("|");
var keys=this.keys.join("|");
var _654=this.defaults.join("|");
var _655=this.types.join("|");
this.dataCache.flush();
this.xmlDoc=nitobi.xml.loadXml(this.xmlDoc,nitobi.data.DataTable.DEFAULT_DATA.replace(/\{id\}/g,this.id).replace(/\{fields\}/g,_652).replace(/\{keys\}/g,keys).replace(/\{defaults\}/g,_654).replace(/\{types\}/g,_655));
this.datastructure=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"datasourcestructure");
};
nitobi.data.DataTable.prototype.initializeColumns=function(_656,keys,_658,_659){
if(null!=_656){
var _65a=this.columns.join("|");
if(_65a==_656){
return;
}
this.columns=_656.split("|");
}
if(null!=keys){
this.keys=keys.split("|");
}
if(null!=_658){
this.types=_658.split("|");
}
if(null!=_659){
this.defaults=_659.split("|");
}
if(this.xmlDoc.documentElement==null){
this.initializeSchema();
}
this.datastructure=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"datasourcestructure");
var ds=this.datastructure;
if(_656){
ds.setAttribute("FieldNames",_656);
}
if(keys){
ds.setAttribute("Keys",keys);
}
if(_659){
ds.setAttribute("Defaults",_659);
}
if(_658){
ds.setAttribute("Types",_658);
}
this.makeFieldMap();
this.fire("ColumnsInitialized");
};
nitobi.data.DataTable.prototype.getTemplateNode=function(_65c){
var _65d=null;
if(_65c==null){
_65c=this.defaults;
}
_65d=nitobi.xml.createElement(this.xmlDoc,"e");
for(var i=0;i<this.columns.length;i++){
var _65f=(i>25?String.fromCharCode(Math.floor(i/26)+97):"")+(String.fromCharCode(i%26+97));
if(this.defaults[i]==null){
_65d.setAttribute(_65f,"");
}else{
_65d.setAttribute(_65f,this.defaults[i]);
}
}
return _65d;
};
nitobi.data.DataTable.prototype.flush=function(){
this.flushCache();
this.flushLog();
this.xmlDoc=nitobi.xml.createXmlDoc();
};
nitobi.data.DataTable.prototype.clearData=function(){
this.flushCache();
this.flushLog();
if(this.xmlDoc){
var _660=this.xmlDoc.selectSingleNode("//ntb:data");
nitobi.xml.removeChildren(_660);
}
};
nitobi.data.DataTable.prototype.flushCache=function(){
if(this.mode=="caching"||this.mode=="paging"){
this.dataCache.flush();
}
if(this.mode!="unbound"){
this.requestCache.flush();
}
};
nitobi.data.DataTable.prototype.join=function(_661,_662,_663,_664){
};
nitobi.data.DataTable.prototype.merge=function(xd){
};
nitobi.data.DataTable.prototype.getField=function(_666,_667){
var r=this.getRecord(_666);
var a=this.fieldMap[_667];
if(a&&r){
return r.getAttribute(a.substring(1));
}else{
return null;
}
};
nitobi.data.DataTable.prototype.getRecord=function(_66a){
var data=this.xmlDoc.selectNodes("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data/"+nitobi.xml.nsPrefix+"e[@xi='"+_66a+"']");
if(data.length==0){
return null;
}
return data[0];
};
nitobi.data.DataTable.prototype.beginBatchInsert=function(){
this.batchInsert=true;
this.batchInsertRowCount=0;
};
nitobi.data.DataTable.prototype.commitBatchInsert=function(){
this.batchInsert=false;
var _66c=this.batchInsertRowCount;
this.batchInsertRowCount=0;
this.setRemoteRowCount(this.remoteRowCount+_66c);
if(_66c>0){
this.fire("RowInserted",_66c);
}
};
nitobi.data.DataTable.prototype.createRecord=function(_66d,_66e){
var xi=_66e;
this.adjustXi(parseInt(xi),1);
var data=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data");
var _671=_66d||this.getTemplateNode();
var _672=nitobi.component.getUniqueId();
var _673=_671.cloneNode(true);
_673.setAttribute("xi",xi);
_673.setAttribute("xid",_672);
_673.setAttribute("xac","i");
if(this.onGenerateKey){
var _674=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasourcestructure").getAttribute("Keys").split("|");
var xml=null;
for(var j=0;j<_674.length;j++){
var _677=this.fieldMap[_674[j]].substring(1);
var _678=_673.getAttribute(_677);
if(!_678||_678==""){
if(!xml){
xml=eval(this.onGenerateKey);
}
if(typeof (xml)=="string"||typeof (xml)=="number"){
_673.setAttribute(_677,xml);
}else{
try{
var ck1=j%26;
var ck2=Math.floor(j/26);
var _67b=(ck2>0?String.fromCharCode(96+ck2):"")+String.fromCharCode(97+ck1);
_673.setAttribute(_677,xml.selectSingleNode("//"+nitobi.xml.nsPrefix+"e").getAttribute(_67b));
}
catch(e){
ntbAssert(false,"Key generation failed.","",EBA_THROW);
}
}
}
}
}
data.appendChild(nitobi.xml.importNode(data.ownerDocument,_673,true));
if(this.log!=null){
var _67c=_673.cloneNode(true);
_67c.setAttribute("xac","i");
_67c.setAttribute("xid",_672);
this.logData.appendChild(nitobi.xml.importNode(this.logData.ownerDocument,_67c,true));
}
this.dataCache.insertIntoRange(_66e);
this.batchInsertRowCount++;
if(!this.batchInsert){
this.commitBatchInsert();
}
return _673;
};
nitobi.data.DataTable.prototype.updateRecord=function(xi,_67e,_67f){
var _680=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"e[@xi='"+xi+"']");
ntbAssert((null!=_680),"Could not find the specified node in the data source.\nTableDataSource: "+this.id+"\nRow: "+xi,"",EBA_THROW);
var xid=_680.getAttribute("xid")||"error - unknown xid";
ntbAssert(("error - unknown xid"!=xid),"Could not find the specified node in the update log.\nTableDataSource: "+this.id+"\nRow: "+xi,"",EBA_THROW);
var _682=(_680.getAttribute(_67e)!=_67f);
if(!_682){
return;
}
var _683="";
var _684=_67e;
if(_680.getAttribute(_67e)==null&&this.fieldMap[_67e]!=null){
_684=this.fieldMap[_67e].substring(1);
}
_683=_680.getAttribute(_684);
_680.setAttribute(_684,_67f);
var _685="u";
var _686="u";
if(null==this.log){
this.flushLog();
}
var _687=_680.cloneNode(true);
_687.setAttribute("xac","u");
this.logData=this.log.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data");
var _688=this.logData.selectSingleNode("./"+nitobi.xml.nsPrefix+"e[@xid='"+xid+"']");
_687=nitobi.xml.importNode(this.logData.ownerDocument,_687,true);
if(null==_688){
_687=nitobi.xml.importNode(this.logData.ownerDocument,_687,true);
this.logData.appendChild(_687);
_687.setAttribute("xid",xid);
}else{
_687.setAttribute("xac",_688.getAttribute("xac"));
this.logData.replaceChild(_687,_688);
}
if((true==this.AutoSave)){
this.save();
}
this.fire("RowUpdated",{"field":_67e,"newValue":_67f,"oldValue":_683,"record":_687});
};
nitobi.data.DataTable.prototype.deleteRecord=function(_689){
var data=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data");
this.logData=this.log.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data");
var _68b=data.selectSingleNode("*[@xi = '"+_689+"']");
this.removeRecordFromXml(_689,_68b,data);
this.setRemoteRowCount(this.remoteRowCount-1);
this.fire("RowDeleted");
};
nitobi.data.DataTable.prototype.deleteRecordsArray=function(_68c){
var data=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data");
this.logData=this.log.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data");
var _68e=null;
var _68f=null;
for(var i=0;i<_68c.length;i++){
var data=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data");
_68f=_68c[i]-i;
_68e=data.selectSingleNode("*[@xi = '"+_68f+"']");
this.removeRecordFromXml(_68f,_68e,data);
}
this.setRemoteRowCount(this.remoteRowCount-_68c.length);
this.fire("RowDeleted");
};
nitobi.data.DataTable.prototype.removeRecordFromXml=function(_691,_692,data){
if(_692==null){
throw "Index out of bounds in delete.";
}
var xid=_692.getAttribute("xid");
var xDel=this.logData.selectSingleNode("*[@xid='"+xid+"']");
var sTag="";
if(xDel!=null){
sTag=xDel.getAttribute("xac");
this.logData.removeChild(xDel);
}
if(sTag!="i"){
var _697=_692.cloneNode(true);
_697.setAttribute("xac","d");
this.logData.appendChild(_697);
}
data.removeChild(_692);
this.adjustXi(parseInt(_691)+1,-1);
this.dataCache.removeFromRange(_691);
};
nitobi.data.DataTable.prototype.adjustXi=function(_698,_699){
nitobi.data.adjustXiXslProc.addParameter("startingIndex",_698,"");
nitobi.data.adjustXiXslProc.addParameter("adjustment",_699,"");
this.xmlDoc=nitobi.xml.loadXml(this.xmlDoc,nitobi.xml.transformToString(this.xmlDoc,nitobi.data.adjustXiXslProc,"xml"));
if(this.log!=null){
this.log=nitobi.xml.loadXml(this.log,nitobi.xml.transformToString(this.log,nitobi.data.adjustXiXslProc,"xml"));
this.logData=this.log.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data");
}
};
nitobi.data.DataTable.prototype.setGetHandler=function(val){
this.getHandler=val;
for(var name in this.getHandlerArgs){
this.setGetHandlerParameter(name,this.getHandlerArgs[name]);
}
};
nitobi.data.DataTable.prototype.getGetHandler=function(){
return this.getHandler;
};
nitobi.data.DataTable.prototype.setSaveHandler=function(val){
this.postHandler=val;
for(var name in this.saveHandlerArgs){
this.setSaveHandlerParameter(name,this.saveHandlerArgs[name]);
}
};
nitobi.data.DataTable.prototype.getSaveHandler=function(){
return this.postHandler;
};
nitobi.data.DataTable.prototype.save=function(_69e,_69f){
ntbAssert(this.postHandler!=null&&this.postHandler!="","A postHandler must be defined on the DataTable for saving to work.","",EBA_THROW);
if(!eval(_69f||"true")){
return;
}
try{
if(this.version==2.8){
var _6a0=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasourcestructure").getAttribute("FieldNames").split("|");
var _6a1=this.log.selectNodes("//"+nitobi.xml.nsPrefix+"e[@xac = 'i']");
for(var i=0;i<_6a1.length;i++){
for(var j=0;j<_6a0.length;j++){
var _6a4=_6a1[i].getAttribute(this.fieldMap[_6a0[j]].substring(1));
if(!_6a4){
_6a1[i].setAttribute(this.fieldMap[_6a0[j]].substring(1),"");
}
}
_6a1[i].setAttribute("xf",this.parentValue);
}
var _6a5=this.log.selectNodes("//"+nitobi.xml.nsPrefix+"e[@xac = 'u']");
for(var i=0;i<_6a5.length;i++){
for(var j=0;j<_6a0.length;j++){
var _6a4=_6a5[i].getAttribute(this.fieldMap[_6a0[j]].substring(1));
if(!_6a4){
_6a5[i].setAttribute(this.fieldMap[_6a0[j]].substring(1),"");
}
}
}
nitobi.data.updategramTranslatorXslProc.addParameter("xkField",this.fieldMap["_xk"].substring(1),"");
nitobi.data.updategramTranslatorXslProc.addParameter("fields",_6a0.join("|").replace(/\|_xk/,""));
nitobi.data.updategramTranslatorXslProc.addParameter("datasourceId",this.id,"");
this.log=nitobi.xml.transformToXml(this.log,nitobi.data.updategramTranslatorXslProc);
}
var _6a6=this.getSaveHandler();
(_6a6.indexOf("?")==-1)?_6a6+="?":_6a6+="&";
_6a6+="TableId="+this.id;
_6a6+="&uid="+(new Date().getTime());
this.ajaxCallback=this.ajaxCallbackPool.reserve();
ntbAssert(Boolean(this.ajaxCallback),"The datasource is serving too many connections. Please try again later. # current connections: "+this.ajaxCallbackPool.inUse.length);
this.ajaxCallback.handler=_6a6;
this.ajaxCallback.responseType="xml";
this.ajaxCallback.context=this;
this.ajaxCallback.completeCallback=nitobi.lang.close(this,this.saveComplete);
this.ajaxCallback.params=new nitobi.data.SaveCompleteEventArgs(_69e);
if(this.version>2.8&&this.log.selectNodes("//"+nitobi.xml.nsPrefix+"e[@xac='i']").length>0&&this.isAutoKeyEnabled()){
this.ajaxCallback.async=false;
}
if(this.log.documentElement.nodeName=="root"){
this.log=nitobi.xml.loadXml(this.log,this.log.xml.replace(/xmlns:ntb=\"http:\/\/www.nitobi.com\"/g,""));
var _6a0=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasourcestructure").getAttribute("FieldNames").split("|");
_6a0.splice(_6a0.length-1,1);
_6a0=_6a0.join("|");
this.log.documentElement.setAttribute("fields",_6a0);
this.log.documentElement.setAttribute("keys",_6a0);
}
if(this.isAutoKeyEnabled()&&this.version<3){
}
this.ajaxCallback.post(this.log);
this.flushLog();
}
catch(err){
throw err;
}
};
nitobi.data.DataTable.prototype.flushLog=function(){
this.log=nitobi.xml.createXmlDoc(nitobi.data.DataTable.DEFAULT_LOG.replace(/\{id\}/g,this.id).replace(/\{fields\}/g,this.columns).replace(/\{keys\}/g,this.keys).replace(/\{defaults\}/g,this.defaults).replace(/\{types\}/g,this.types));
this.logData=this.log.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data");
};
nitobi.data.DataTable.prototype.updateAutoKeys=function(_6a7){
try{
var _6a8=_6a7.selectNodes("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data/"+nitobi.xml.nsPrefix+"e[@xac='i']");
if(typeof (_6a8)=="undefined"||_6a8==null){
nitobi.lang.throwError("When updating keys from the server for AutoKey support, the inserts could not be parsed.");
}
var keys=_6a7.selectNodes("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"datasourcestructure")[0].getAttribute("keys").split("|");
if(typeof (keys)=="undefined"||keys==null||keys.length==0){
nitobi.lang.throwError("When updating keys from the server for AutoKey support, no keys could be found. Ensure that the keys are sent in the request response.");
}
for(var i=0;i<_6a8.length;i++){
var _6ab=this.getRecord(_6a8[i].getAttribute("xi"));
for(var j=0;j<keys.length;j++){
var att=this.fieldMap[keys[j]].substring(1);
_6ab.setAttribute(att,_6a8[i].getAttribute(att));
}
}
}
catch(err){
nitobi.lang.throwError("When updating keys from the server for AutoKey support, the inserts could not be parsed.",err);
}
};
nitobi.data.DataTable.prototype.saveComplete=function(_6ae){
var xd=_6ae.response;
var _6ae=_6ae.params;
try{
if(this.isAutoKeyEnabled()&&this.version>2.8){
this.updateAutoKeys(xd);
}
if(this.version==2.8&&!this.onGenerateKey){
var rows=xd.selectNodes("//insert");
for(var i=0;i<rows.length;i++){
var xk=rows[i].getAttribute("xk");
if(xk!=null){
var _6b3=this.findWithoutMap("xid",rows[i].getAttribute("xid"))[0];
var key=this.fieldMap["_xk"].substring(1);
var _6b5=this.fieldMap[this.primaryField].substring(1);
_6b3.setAttribute(key,xk);
_6b3.setAttribute(_6b5,xk);
}
}
}
if(null!=_6ae.result){
ntbAssert((null==errorMessage),"Data Save Error:"+errorMessage,EBA_EM_ATTRIBUTE_ERROR,EBA_ERROR);
}
var node=xd.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource")||xd.selectSingleNode("/root");
var e=null;
if(node){
e=node.getAttribute("error");
}
if(e){
this.setHandlerError(e);
}else{
this.setHandlerError(null);
}
this.ajaxCallbackPool.release(this.ajaxCallback);
var _6b8=new nitobi.data.OnAfterSaveEventArgs(this,xd);
_6ae.callback.call(this,_6b8);
}
catch(err){
this.ajaxCallbackPool.release(this.ajaxCallback);
ebaErrorReport(err,"",EBA_ERROR);
}
};
nitobi.data.DataTable.prototype.makeFieldMap=function(){
var _6b9=this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource");
var cf=0;
var ck=0;
this.fieldMap=new Array();
var cF=this.columns.length;
for(var i=0;i<cF;i++){
var _6be=this.columns[i];
this.fieldMap[_6be]=this.getFieldName(ck);
ck++;
}
};
nitobi.data.DataTable.prototype.getFieldName=function(_6bf){
var ck1=_6bf%26;
var ck2=Math.floor(_6bf/26);
return "@"+(ck2>0?String.fromCharCode(96+ck2):"")+String.fromCharCode(97+ck1);
};
nitobi.data.DataTable.prototype.find=function(_6c2,_6c3){
var _6c4=this.fieldMap[_6c2];
if(_6c4){
return this.findWithoutMap(_6c4,_6c3);
}else{
return new Array();
}
};
nitobi.data.DataTable.prototype.findWithoutMap=function(_6c5,_6c6){
if(_6c5.charAt(0)!="@"){
_6c5="@"+_6c5;
}
return this.xmlDoc.selectNodes("//"+nitobi.xml.nsPrefix+"e["+_6c5+"=\""+_6c6+"\"]");
};
nitobi.data.DataTable.prototype.sort=function(_6c7,dir,type,_6ca){
if(_6ca){
_6c7=this.fieldMap[_6c7];
_6c7=_6c7.substring(1);
dir=(dir=="Desc")?"descending":"ascending";
type=(type=="number")?"number":"text";
this.sortXslProc.addParameter("column",_6c7,"");
this.sortXslProc.addParameter("dir",dir,"");
this.sortXslProc.addParameter("type",type,"");
this.xmlDoc=nitobi.xml.loadXml(this.xmlDoc,nitobi.xml.transformToString(this.xmlDoc,this.sortXslProc,"xml"));
this.fire("DataSorted");
}else{
this.sortColumn=_6c7;
this.sortDir=dir||"Asc";
}
};
nitobi.data.DataTable.prototype.syncRowCount=function(){
this.setRemoteRowCount(this.descriptor.estimatedRowCount);
};
nitobi.data.DataTable.prototype.setRemoteRowCount=function(rows){
var _6cc=this.remoteRowCount;
this.remoteRowCount=rows;
if(this.remoteRowCount!=_6cc){
this.fire("RowCountChanged",rows);
}
};
nitobi.data.DataTable.prototype.getRemoteRowCount=function(){
return this.remoteRowCount;
};
nitobi.data.DataTable.prototype.getRows=function(){
return this.xmlDoc.selectNodes("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data/"+nitobi.xml.nsPrefix+"e").length;
};
nitobi.data.DataTable.prototype.getXmlDoc=function(){
return this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']");
};
nitobi.data.DataTable.prototype.getRowNodes=function(){
return this.xmlDoc.selectNodes("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data/"+nitobi.xml.nsPrefix+"e");
};
nitobi.data.DataTable.prototype.getColumns=function(){
return this.fieldMap.length;
};
nitobi.data.DataTable.prototype.setGetHandlerParameter=function(name,_6ce){
if(this.getHandler!=null&&this.getHandler!=""){
this.getHandler=nitobi.html.setUrlParameter(this.getHandler,name,_6ce);
}
this.getHandlerArgs[name]=_6ce;
};
nitobi.data.DataTable.prototype.setSaveHandlerParameter=function(name,_6d0){
if(this.postHandler!=null&&this.postHandler!=""){
this.postHandler=nitobi.html.setUrlParameter(this.getSaveHandler(),name,_6d0);
}
this.saveHandlerArgs[name]=_6d0;
};
nitobi.data.DataTable.prototype.getChangeLogSize=function(){
if(null==this.log){
return 0;
}
return this.log.selectNodes("//"+nitobi.xml.nsPrefix+"e").length;
};
nitobi.data.DataTable.prototype.getChangeLogXmlDoc=function(){
return this.log;
};
nitobi.data.DataTable.prototype.getDataXmlDoc=function(){
return this.xmlDoc;
};
nitobi.data.DataTable.prototype.dispose=function(){
this.flush();
this.ajaxCallbackPool.context=null;
for(var item in this){
if(this[item]!=null&&this[item].dispose instanceof Function){
this[item].dispose();
}
this[item]=null;
}
};
nitobi.data.DataTable.prototype.getTable=function(_6d2,_6d3,_6d4){
this.errorCallback=_6d4;
var _6d5=this.ajaxCallbackPool.reserve();
ntbAssert(Boolean(_6d5),"The datasource is serving too many connections. Please try again later. # current connections: "+this.ajaxCallbackPool.inUse.length);
var _6d6=this.getGetHandler();
_6d5.handler=_6d6;
_6d5.responseType="xml";
_6d5.context=this;
_6d5.completeCallback=nitobi.lang.close(this,this.getComplete);
_6d5.async=this.async;
_6d5.params=new nitobi.data.GetCompleteEventArgs(null,null,0,null,_6d5,this,_6d2,_6d3);
if(typeof (_6d3)!="function"||this.async==false){
_6d5.async=false;
return this.getComplete({"response":_6d5.get(),"params":_6d5.params});
}else{
_6d5.get();
}
};
nitobi.data.DataTable.prototype.getComplete=function(_6d7){
var xd=_6d7.response;
var _6d9=_6d7.params;
if(this.mode!="caching"){
this.xmlDoc=nitobi.xml.createXmlDoc();
}
if(null==xd||null==xd.xml||""==xd.xml){
var _6da="No parse error.";
if(nitobi.xml.hasParseError(xd)){
if(xd==null){
_6da="Blank Response was Given";
}else{
_6da=nitobi.xml.getParseErrorReason(xd);
}
}
ntbAssert(null!=this.errorCallback,"The server returned either an error or invalid XML but there is no error handler in the DataTable.\nThe parse error content was:\n"+_6da);
if(this.errorCallback){
this.errorCallback.call(this.context);
}
this.fire("DataReady",_6d9);
return _6d9;
}else{
if(typeof (this.successCallback)=="function"){
this.successCallback.call(this.context);
}
}
if(!this.configured){
this.configureFromData(xd);
}
xd=this.parseResponse(xd,_6d9);
xd=this.assignRowIds(xd);
var _6db=null;
_6db=xd.selectNodes("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data/"+nitobi.xml.nsPrefix+"e");
var _6dc;
var _6dd=_6db.length;
if(_6d9.pageSize==null){
_6d9.pageSize=_6dd;
_6d9.lastRow=_6d9.startXi+_6d9.pageSize-1;
_6d9.firstRow=_6d9.startXi;
}
if(0!=_6dd){
ntbAssert(_6db[0].getAttribute("xi")==(_6d9.startXi),"The gethandler returned a different first row than requested.");
_6dc=parseInt(_6db[_6db.length-1].getAttribute("xi"));
if(this.mode=="paging"){
this.dataCache.insert(0,_6d9.pageSize-1);
}else{
this.dataCache.insert(_6d9.firstRow,_6dc);
}
}else{
_6dc=-1;
_6d9.pageSize=0;
if(this.totalRowCount==null){
var pct=this.descriptor.lastKnownRow/this.descriptor.estimatedRowCount||0;
this.fire("PastEndOfData",pct);
}
}
_6d9.numRowsReturned=_6dd;
_6d9.lastRowReturned=_6dc;
var _6df=_6d9.startXi;
var _6e0=_6d9.pageSize;
if(!isNaN(_6df)&&!isNaN(_6e0)&&_6df!=0){
this.requestCache.remove(_6df,_6df+_6e0-1);
}
if(this.mode!="caching"){
this.replaceData(xd);
}else{
this.mergeData(xd);
}
if(this.xmlDoc.selectSingleNode("//ntb:datasource").getAttribute("totalrowcount")!=""){
var _6e1=this.xmlDoc.selectSingleNode("//ntb:datasource").getAttribute("totalrowcount");
_6e1=parseInt(_6e1);
if(!isNaN(_6e1)){
this.totalRowCount=_6e1;
this.fire("TotalRowCountReady",this.totalRowCount);
}
}
var _6e2=this.xmlDoc.selectSingleNode("//ntb:datasource").getAttribute("parentfield");
var _6e3=this.xmlDoc.selectSingleNode("//ntb:datasource").getAttribute("primaryfield");
var _6e4=this.xmlDoc.selectSingleNode("//ntb:datasource").getAttribute("parentvalue");
this.parentField=_6e2||"";
this.parentValue=_6e4||"";
this.primaryField=_6e3||"";
this.updateFromDescriptor(_6d9);
this.fire("RowCountReady",_6d9);
if(null!=_6d9.ajaxCallback){
this.ajaxCallbackPool.release(_6d9.ajaxCallback);
}
this.executeRequests();
var node=xd.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource");
var e=null;
if(node){
e=node.getAttribute("error");
}
if(e){
this.setHandlerError(e);
}else{
this.setHandlerError(null);
}
this.fire("DataReady",_6d9);
if(null!=_6d9.callback&&null!=_6d9.context){
_6d9.callback.call(_6d9.context,_6d9);
_6d9.dispose();
_6d9=null;
}else{
return _6d9;
}
};
nitobi.data.DataTable.prototype.executeRequests=function(){
var _6e7=this.requestQueue;
this.requestQueue=new Array();
for(var i=0;i<_6e7.length;i++){
_6e7[i].call();
}
};
nitobi.data.DataTable.prototype.updateFromDescriptor=function(_6e9){
if(this.totalRowCount==null){
this.descriptor.update(_6e9);
}
if(this.mode=="paging"){
this.setRemoteRowCount(_6e9.numRowsReturned);
}else{
if(this.totalRowCount!=null){
this.setRemoteRowCount(this.getTotalRowCount());
}else{
this.setRemoteRowCount(this.descriptor.estimatedRowCount);
}
}
this.setRowCountKnown(this.descriptor.isAtEndOfTable);
};
nitobi.data.DataTable.prototype.setRowCountKnown=function(_6ea){
var _6eb=this.rowCountKnown;
this.rowCountKnown=_6ea;
if(_6ea&&this.rowCountKnown!=_6eb){
this.fire("RowCountKnown",this.remoteRowCount);
}
};
nitobi.data.DataTable.prototype.getRowCountKnown=function(){
return this.rowCountKnown;
};
nitobi.data.DataTable.prototype.configureFromData=function(xd){
this.version=this.inferDataVersion(xd);
if(this.mode=="unbound"){
}
if(this.mode=="static"){
}
if(this.mode=="paging"){
}
if(this.mode=="caching"){
}
};
nitobi.data.DataTable.prototype.mergeData=function(xd){
if(this.xmlDoc.xml==""){
this.initializeXml(xd);
return;
}
var p=nitobi.xml.nsPrefix;
var _6ef="//"+p+"datasource[@id = '"+this.id+"']/"+p+"data";
var _6f0=xd.selectNodes(_6ef+"//"+p+"e");
var _6f1=this.xmlDoc.selectSingleNode(_6ef);
var len=_6f0.length;
for(var i=0;i<len;i++){
if(this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data/"+nitobi.xml.nsPrefix+"e[@xi='"+_6f0[i].getAttribute("xi")+"']")){
continue;
}
_6f1.appendChild(nitobi.xml.importNode(_6f1.ownerDocument,_6f0[i],true));
}
};
nitobi.data.DataTable.prototype.assignRowIds=function(xd){
nitobi.data.addXidXslProc.addParameter("guid",nitobi.component.getUniqueId(),"");
var doc=nitobi.xml.loadXml(xd,nitobi.xml.transformToString(xd,nitobi.data.addXidXslProc,"xml"));
return doc;
};
nitobi.data.DataTable.prototype.inferDataVersion=function(xd){
if(xd.selectSingleNode("/root")){
return 2.8;
}
return 3;
};
nitobi.data.DataTable.prototype.parseResponse=function(xd,_6f8){
if(this.version==2.8){
return this.parseLegacyResponse(xd,_6f8);
}else{
return this.parseStructuredResponse(xd,_6f8);
}
};
nitobi.data.DataTable.prototype.parseLegacyResponse=function(xd,_6fa){
var _6fb=this.mode=="paging"?0:_6fa.startXi;
nitobi.data.dataTranslatorXslProc.addParameter("start",_6fb,"");
nitobi.data.dataTranslatorXslProc.addParameter("id",this.id,"");
var _6fc=xd.selectSingleNode("/root").getAttribute("fields");
var _6fd=_6fc.split("|");
var i=_6fd.length;
var _6ff=(i>25?String.fromCharCode(Math.floor(i/26)+96):"")+(String.fromCharCode(i%26+97));
nitobi.data.dataTranslatorXslProc.addParameter("xkField",_6ff,"");
xd=nitobi.xml.transformToXml(xd,nitobi.data.dataTranslatorXslProc);
return xd;
};
nitobi.data.DataTable.prototype.parseStructuredResponse=function(xd,_701){
xd=nitobi.xml.loadXml(xd,"<ntb:grid xmlns:ntb=\"http://www.nitobi.com\"><ntb:datasources>"+xd.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']").xml+"</ntb:datasources></ntb:grid>");
var _702=xd.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.id+"']/"+nitobi.xml.nsPrefix+"data/"+nitobi.xml.nsPrefix+"e");
var _703=this.mode=="paging"?0:_701.startXi;
if(_702){
ntbAssert(Boolean(_702.getAttribute("xi")),"No xi was returned in the data from the server. Server must return xi's in the new format.","",EBA_THROW);
ntbAssert(_703>=0,"startXI is incorrect.");
if(_702.getAttribute("xi")!=_703){
nitobi.data.adjustXiXslProc.addParameter("startingIndex","0","");
nitobi.data.adjustXiXslProc.addParameter("adjustment",_703,"");
xd=nitobi.xml.loadXml(xd,nitobi.xml.transformToString(xd,nitobi.data.adjustXiXslProc,"xml"));
}
}
return xd;
};
nitobi.data.DataTable.prototype.forceGet=function(_704,_705,_706,_707,_708,_709){
this.errorCallback=_708;
this.successCallback=_709;
this.context=_706;
var _70a=this.getGetHandler();
(_70a.indexOf("?")==-1)?_70a+="?":_70a+="&";
_70a+="StartRecordIndex=0&start=0&PageSize="+_705+"&SortColumn="+(this.sortColumn||"")+"&SortDirection="+this.sortDir+"&TableId="+this.id+"&uid="+(new Date().getTime());
var _70b=this.ajaxCallbackPool.reserve();
ntbAssert(Boolean(_70b),"The datasource is serving too many connections. Please try again later. # current connections: "+this.ajaxCallbackPool.inUse.length);
_70b.handler=_70a;
_70b.responseType="xml";
_70b.context=this;
_70b.completeCallback=nitobi.lang.close(this,this.getComplete);
_70b.params=new nitobi.data.GetCompleteEventArgs(0,_705-1,0,_705,_70b,this,_706,_707);
_70b.get();
return;
};
nitobi.data.DataTable.prototype.getPage=function(_70c,_70d,_70e,_70f,_710,_711){
ntbAssert(this.getHandler.indexOf("GridId")!=-1,"The gethandler has not gridId specified on it.");
var _712=_70c+_70d-1;
var _713=this.dataCache.gaps(0,_70d-1);
var _714=_713.length;
if(_714){
var _715=this.requestCache.gaps(_70c,_712);
if(_715.length==0){
var _716=nitobi.lang.close(this,this.get,arguments);
this.requestQueue.push(_716);
return;
}
this.getFromServer(_70c,_712,_70c,_712,_70e,_70f,_710);
}else{
this.getFromCache(_70c,_70d,_70e,_70f,_710);
}
};
nitobi.data.DataTable.prototype.get=function(_717,_718,_719,_71a,_71b){
this.errorCallback=_71b;
var _71c=null;
if(this.mode=="caching"){
_71c=this.getCached(_717,_718,_719,_71a,_71b);
}
if(this.mode=="local"||this.mode=="static"){
_71c=this.getTable(_719,_71a,_71b);
}
if(this.mode=="paging"){
_71c=this.getPage(_717,_718,_719,_71a,_71b);
}
return _71c;
};
nitobi.data.DataTable.prototype.inCache=function(_71d,_71e){
if(this.mode=="local"){
return true;
}
var _71f=_71d,_720=_71d+_71e-1;
var _721=this.getRemoteRowCount()-1;
if(this.getRowCountKnown()&&_721<_720){
_720=_721;
}
var _722=this.dataCache.gaps(_71f,_720);
var _723=_722.length;
return !(_723>0);
};
nitobi.data.DataTable.prototype.cachedRanges=function(_724,_725){
return this.dataCache.ranges(_724,_725);
};
nitobi.data.DataTable.prototype.getCached=function(_726,_727,_728,_729,_72a,_72b){
if(_727==null){
return this.getFromServer(_72c,null,_726,null,_728,_729,_72a);
}
var _72c=_726,_72d=_726+_727-1;
var _72e=this.dataCache.gaps(_72c,_72d);
var _72f=_72e.length;
ntbAssert(_72f==_72e.length,"numCacheGaps != gaps.length despite setting it so. Concurrency problem has arisen.");
if(this.mode!="unbound"&&_72f>0){
var low=_72e[_72f-1].low;
var high=_72e[_72f-1].high;
var _732=this.requestCache.gaps(low,high);
if(_732.length==0){
var _733=nitobi.lang.close(this,this.get,arguments);
return;
}
return this.getFromServer(_72c,_72d,low,high,_728,_729,_72a);
}else{
this.getFromCache(_726,_727,_728,_729,_72a);
}
};
nitobi.data.DataTable.prototype.getFromServer=function(_734,_735,low,high,_738,_739,_73a){
ntbAssert(this.getHandler!=null&&typeof (this.getHandler)!="undefined","getHandler not defined in table eba.datasource",EBA_THROW);
this.requestCache.insert(low,high);
var _73b=(_735==null?null:(high-low+1));
var _73c=(_73b==null?"":_73b);
var _73d=this.getGetHandler();
(_73d.indexOf("?")==-1)?_73d+="?":_73d+="&";
_73d+="StartRecordIndex="+low+"&start="+low+"&PageSize="+(_73c)+"&SortColumn="+(this.sortColumn||"")+"&SortDirection="+this.sortDir+"&uid="+(new Date().getTime());
var _73e=this.ajaxCallbackPool.reserve();
ntbAssert(Boolean(_73e),"The datasource is serving too many connections. Please try again later. # current connections: "+this.ajaxCallbackPool.inUse.length);
_73e.handler=_73d;
_73e.responseType="xml";
_73e.context=this;
_73e.completeCallback=nitobi.lang.close(this,this.getComplete);
_73e.async=this.async;
_73e.params=new nitobi.data.GetCompleteEventArgs(_734,_735,low,_73b,_73e,this,_738,_739);
return _73e.get();
};
nitobi.data.DataTable.prototype.getFromCache=function(_73f,_740,_741,_742,_743){
var _744=_73f,_745=_73f+_740-1;
if(_744>0||_745>0){
if(typeof (_742)=="function"){
var _746=new nitobi.data.GetCompleteEventArgs(_744,_745,_744,_745-_744+1,null,this,_741,_742);
_746.callback.call(_746.context,_746);
}
}
};
nitobi.data.DataTable.prototype.mergeFromXml=function(_747,_748){
var _749=Number(_747.documentElement.firstChild.getAttribute("xi"));
var _74a=Number(_747.documentElement.lastChild.getAttribute("xi"));
var _74b=this.dataCache.gaps(_749,_74a);
if(this.mode=="local"&&_74b.length==1){
this.dataCache.insert(_74b[0].low,_74b[0].high);
this.mergeFromXmlGetComplete(_747,_748,_749,_74a);
this.batchInsertRowCount=(_74b[0].high-_74b[0].low+1);
this.commitBatchInsert();
return;
}
if(_74b.length==0){
this.mergeFromXmlGetComplete(_747,_748,_749,_74a);
}else{
if(_74b.length==1){
this.get(_74b[0].low,_74b[0].high-_74b[0].low+1,this,nitobi.lang.close(this,this.mergeFromXmlGetComplete,[_747,_748,_749,_74a]));
}else{
this.forceGet(_749,_74a,this,nitobi.lang.close(this,this.mergeFromXmlGetComplete,[_747,_748,_749,_74a]));
}
}
};
nitobi.data.DataTable.prototype.mergeFromXmlGetComplete=function(_74c,_74d,_74e,_74f){
var _750=nitobi.xml.createElement(this.xmlDoc,"newdata");
_750.appendChild(_74c.documentElement.cloneNode(true));
this.xmlDoc.documentElement.appendChild(nitobi.xml.importNode(this.xmlDoc,_750,true));
nitobi.data.mergeEbaXmlXslProc.addParameter("startRowIndex",_74e,"");
nitobi.data.mergeEbaXmlXslProc.addParameter("endRowIndex",_74f,"");
nitobi.data.mergeEbaXmlXslProc.addParameter("guid",nitobi.component.getUniqueId(),"");
this.xmlDoc=nitobi.xml.loadXml(this.xmlDoc,nitobi.xml.transformToString(this.xmlDoc,nitobi.data.mergeEbaXmlXslProc,"xml"));
_750=nitobi.xml.createElement(this.log,"newdata");
var _751=_74c.selectNodes("//"+nitobi.xml.nsPrefix+"e");
var _752=0;
for(var i=0;i<_751.length;i++){
_752=_751[i].attributes.getNamedItem("xi").value;
_750.appendChild(this.xmlDoc.selectSingleNode("/"+nitobi.xml.nsPrefix+"grid/"+nitobi.xml.nsPrefix+"datasources/"+nitobi.xml.nsPrefix+"datasource/"+nitobi.xml.nsPrefix+"data/"+nitobi.xml.nsPrefix+"e[@xi="+_752+"]").cloneNode(true));
}
this.log.documentElement.appendChild(nitobi.xml.importNode(this.log,_750,true));
nitobi.data.mergeEbaXmlToLogXslProc.addParameter("defaultAction","u","");
this.log=nitobi.xml.loadXml(this.log,nitobi.xml.transformToString(this.log,nitobi.data.mergeEbaXmlToLogXslProc,"xml"));
this.xmlDoc.documentElement.removeChild(this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"newdata"));
this.log.documentElement.removeChild(this.log.selectSingleNode("//"+nitobi.xml.nsPrefix+"newdata"));
_74d.call();
};
nitobi.data.DataTable.prototype.fillColumn=function(_754,_755){
nitobi.data.fillColumnXslProc.addParameter("column",this.fieldMap[_754].substring(1));
nitobi.data.fillColumnXslProc.addParameter("value",_755);
this.xmlDoc.loadXML(nitobi.xml.transformToString(this.xmlDoc,nitobi.data.fillColumnXslProc,"xml"));
var _756=parseFloat((new Date()).getTime());
var _757=nitobi.xml.createElement(this.log,"newdata");
this.log.documentElement.appendChild(nitobi.xml.importNode(this.log,_757,true));
_757.appendChild(this.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"data").cloneNode(true));
nitobi.data.mergeEbaXmlToLogXslProc.addParameter("defaultAction","u");
this.log.loadXML(nitobi.xml.transformToString(this.log,nitobi.data.mergeEbaXmlToLogXslProc,"xml"));
nitobi.data.mergeEbaXmlToLogXslProc.addParameter("defaultAction","");
this.log.documentElement.removeChild(this.log.selectSingleNode("//"+nitobi.xml.nsPrefix+"newdata"));
};
nitobi.data.DataTable.prototype.getTotalRowCount=function(){
return this.totalRowCount;
};
nitobi.data.DataTable.prototype.setHandlerError=function(_758){
this.handlerError=_758;
};
nitobi.data.DataTable.prototype.getHandlerError=function(){
return this.handlerError;
};
nitobi.data.DataTable.prototype.dispose=function(){
this.sortXslProc=null;
this.requestQueue=null;
this.fieldMap=null;
};
nitobi.data.DataTable.prototype.fire=function(evt,args){
return nitobi.event.notify(evt+this.uid,args);
};
nitobi.data.DataTable.prototype.subscribe=function(evt,func,_75d){
if(typeof (_75d)=="undefined"){
_75d=this;
}
return nitobi.event.subscribe(evt+this.uid,nitobi.lang.close(_75d,func));
};
nitobi.lang.defineNs("nitobi.data");
nitobi.data.DataTableDescriptor=function(_75e,_75f,_760){
this.disposal=[];
this.estimatedRowCount=0;
this.leapMultiplier=2;
this.estimateRowCount=(_760==null?true:_760);
this.lastKnownRow=0;
this.isAtEndOfTable=false;
this.table=_75e;
this.lowestEmptyRow=0;
this.tableProjectionUpdatedEvent=_75f;
this.disposal.push(this.tableProjectionUpdatedEvent);
};
nitobi.data.DataTableDescriptor.prototype.startPeek=function(){
this.enablePeek=true;
this.peek();
};
nitobi.data.DataTableDescriptor.prototype.peek=function(){
var _761;
if(this.lowestEmptyRow>0){
var _762=this.lowestEmptyRow-this.lastKnownRow;
_761=this.lastKnownRow+Math.round(_762/2);
}else{
_761=(this.estimatedRowCount*this.leapMultiplier);
}
this.table.get(Math.round(_761),1,this,this.peekComplete);
};
nitobi.data.DataTableDescriptor.prototype.peekComplete=function(_763){
if(this.enablePeek){
window.setTimeout(nitobi.lang.close(this,this.peek),1000);
}
};
nitobi.data.DataTableDescriptor.prototype.stopPeek=function(){
this.enablePeek=false;
};
nitobi.data.DataTableDescriptor.prototype.leap=function(_764,_765){
if(this.lowestEmptyRow>0){
var _766=this.lowestEmptyRow-this.lastKnownRow;
this.estimatedRowCount=this.lastKnownRow+Math.round(_766/2);
}else{
if(_764==null||_765==null){
this.estimatedRowCount=0;
}else{
if(this.estimateRowCount){
this.estimatedRowCount=(this.estimatedRowCount*_764)+_765;
}
}
}
this.fireProjectionUpdatedEvent();
};
nitobi.data.DataTableDescriptor.prototype.update=function(_767,_768){
if(null==_768){
_768=false;
}
if(this.isAtEndOfTable&&!_768){
return false;
}
var _769=(_767!=null&&_767.numRowsReturned==0&&_767.startXi==0);
var _76a=(_767!=null&&_767.lastRow!=_767.lastRowReturned);
if(null==_767){
_767={lastPage:false,pageSize:1,firstRow:0,lastRow:0,startXi:0};
}
var _76b=(_769)||(_76a)||(this.isAtEndOfTable)||((this.lastKnownRow==this.estimatedRowCount-1)&&(this.estimatedRowCount==this.lowestEmptyRow));
if(_767.pageSize==0&&!_76b){
this.lowestEmptyRow=this.lowestEmptyRow>0?Math.min(_767.startXi,this.lowestEmptyRow):_767.startXi;
this.leap();
return true;
}
this.lastKnownRow=Math.max(_767.lastRowReturned,this.lastKnownRow);
if(_76b&&!_768){
if(_767.lastRowReturned>=0){
this.estimatedRowCount=_767.lastRowReturned+1;
this.isAtEndOfTable=true;
}else{
if(_769){
this.estimatedRowCount=0;
this.isAtEndOfTable=true;
}else{
this.estimatedRowCount=this.lastKnownRow+Math.ceil((_767.lastRow-this.lastKnownRow)/2);
}
}
this.fireProjectionUpdatedEvent();
this.stopPeek();
return true;
}
if(!this.estimateRowCount){
this.estimatedRowCount=this.lastKnownRow+1;
}
if(this.estimatedRowCount==0){
this.estimatedRowCount=(_767.lastRow+1)*(this.estimateRowCount?2:1);
}
if((this.estimatedRowCount>(_767.lastRow+1)&&!_768)||!this.estimateRowCount){
return false;
}
if(!this.isAtEndOfTable){
this.leap(this.leapMultiplier,0);
return true;
}
return false;
};
nitobi.data.DataTableDescriptor.prototype.reset=function(){
this.estimatedRowCount=0;
this.leapMultiplier=2;
this.lastKnownRow=0;
this.isAtEndOfTable=false;
this.lowestEmptyRow=0;
this.fireProjectionUpdatedEvent();
};
nitobi.data.DataTableDescriptor.prototype.fireProjectionUpdatedEvent=function(_76c){
if(this.tableProjectionUpdatedEvent!=null){
this.tableProjectionUpdatedEvent(_76c);
}
};
nitobi.data.DataTableDescriptor.prototype.dispose=function(){
nitobi.lang.dispose(this,this.disposal);
};
nitobi.lang.defineNs("nitobi.data");
if(false){
nitobi.data=function(){
};
}
nitobi.data.DataTableEventArgs=function(_76d){
this.source=_76d;
this.event=nitobi.html.Event;
};
nitobi.data.DataTableEventArgs.prototype.getSource=function(){
return this.source;
};
nitobi.data.DataTableEventArgs.prototype.getEvent=function(){
return this.event;
};
nitobi.data.GetCompleteEventArgs=function(_76e,_76f,_770,_771,_772,_773,obj,_775){
this.firstRow=_76e;
this.lastRow=_76f;
this.callback=_775;
this.dataSource=_773;
this.context=obj;
this.ajaxCallback=_772;
this.startXi=_770;
this.pageSize=_771;
this.lastPage=false;
this.status="success";
};
nitobi.data.GetCompleteEventArgs.prototype.dispose=function(){
this.callback=null;
this.context=null;
this.dataSource=null;
this.ajaxCallback.clear();
this.ajaxCallback==null;
};
nitobi.data.SaveCompleteEventArgs=function(_776){
this.callback=_776;
};
nitobi.data.SaveCompleteEventArgs.prototype.initialize=function(){
};
nitobi.data.OnAfterSaveEventArgs=function(_777,_778,_779){
nitobi.data.OnAfterSaveEventArgs.baseConstructor.call(this,_777);
this.success=_779;
this.responseData=_778;
};
nitobi.lang.extend(nitobi.data.OnAfterSaveEventArgs,nitobi.data.DataTableEventArgs);
nitobi.data.OnAfterSaveEventArgs.prototype.getResponseData=function(){
return this.responseData;
};
nitobi.data.OnAfterSaveEventArgs.prototype.getSuccess=function(){
return this.success;
};
nitobi.lang.defineNs("nitobi.form");
if(false){
nitobi.form=function(){
};
}
nitobi.form.Control=function(){
this.owner=null;
this.placeholder=null;
var div=nitobi.html.createElement("div");
div.innerHTML="<table border='0' cellpadding='0' cellspacing='0' class='ntb-input-border'><tr><td></td></tr></table>";
var ph=this.placeholder=div.firstChild;
this.cell=null;
this.ignoreBlur=false;
this.editCompleteHandler=function(){
};
this.onKeyUp=new nitobi.base.Event();
this.onKeyDown=new nitobi.base.Event();
this.onKeyPress=new nitobi.base.Event();
this.onChange=new nitobi.base.Event();
this.onCancel=new nitobi.base.Event();
this.onTab=new nitobi.base.Event();
this.onEnter=new nitobi.base.Event();
};
nitobi.form.Control.prototype.initialize=function(){
};
nitobi.form.Control.prototype.mimic=function(){
};
nitobi.form.Control.prototype.deactivate=function(evt){
if(this.ignoreBlur){
return false;
}
this.ignoreBlur=true;
};
nitobi.form.Control.prototype.bind=function(_77d,cell){
this.owner=_77d;
this.cell=cell;
this.ignoreBlur=false;
};
nitobi.form.Control.prototype.hide=function(){
this.placeholder.style.left="-2000px";
};
nitobi.form.Control.prototype.attachToParent=function(_77f){
_77f.appendChild(this.placeholder);
};
nitobi.form.Control.prototype.show=function(){
this.placeholder.style.display="block";
};
nitobi.form.Control.prototype.focus=function(){
this.control.focus();
this.ignoreBlur=false;
};
nitobi.form.Control.prototype.align=function(){
var oY=1,oX=1,oH=1,oW=1;
if(nitobi.browser.MOZ&&!nitobi.browser.FF3){
var _784=this.owner.getScrollSurface();
var _785=this.owner.getActiveView().region;
if(_785==3||_785==4){
oY=_784.scrollTop-nitobi.form.EDITOR_OFFSETY;
}
if(_785==1||_785==4){
oX=_784.scrollLeft-nitobi.form.EDITOR_OFFSETX;
}
}
nitobi.drawing.align(this.placeholder,this.cell.getDomNode(),286265344,oH,oW,-oY,-oX);
};
nitobi.form.Control.prototype.selectText=function(){
this.focus();
if(this.control&&this.control.createTextRange){
var _786=this.control.createTextRange();
_786.collapse(false);
_786.select();
}
};
nitobi.form.Control.prototype.checkValidity=function(evt){
var _788=this.deactivate(evt);
if(_788==false){
nitobi.html.cancelBubble(evt);
return false;
}
return true;
};
nitobi.form.Control.prototype.handleKey=function(evt){
var k=evt.keyCode;
if(this.onKeyDown.notify(evt)==false){
return;
}
var K=nitobi.form.Keys;
var y=0;
var x=0;
if(k==K.UP){
y=-1;
}else{
if(k==K.DOWN){
y=1;
}else{
if(k==K.TAB){
x=1;
if(evt.shiftKey){
x=-1;
}
if(nitobi.browser.IE){
evt.keyCode="";
}
}else{
if(k==K.ENTER){
y=1;
}else{
if(k==K.ESC){
this.ignoreBlur=true;
this.hide();
this.owner.focus();
this.onCancel.notify(this);
}
return;
}
}
}
}
if(!this.checkValidity(evt)){
return;
}
this.owner.move(x,y);
nitobi.html.cancelBubble(evt);
};
nitobi.form.Control.prototype.handleKeyUp=function(evt){
this.onKeyUp.notify(evt);
};
nitobi.form.Control.prototype.handleKeyPress=function(evt){
this.onKeyPress.notify(evt);
};
nitobi.form.Control.prototype.handleChange=function(evt){
this.onChange.notify(evt);
};
nitobi.form.Control.prototype.setEditCompleteHandler=function(_791){
this.editCompleteHandler=_791;
};
nitobi.form.Control.prototype.eSET=function(name,args){
var _794=args[0];
var _795=_794;
var _796=name.substr(2);
_796=_796.substr(0,_796.length-5);
if(typeof (_794)=="string"){
_795=function(){
return nitobi.event.evaluate(_794,arguments[0]);
};
}
if(this[_796]!=null){
this[name].unSubscribe(this[_796]);
}
var guid=this[name].subscribe(_795);
this.jSET(_796,[guid]);
return guid;
};
nitobi.form.Control.prototype.afterDeactivate=function(text,_799){
_799=_799||text;
if(this.editCompleteHandler!=null){
if(nitobi.grid){
var _79a=new nitobi.grid.EditCompleteEventArgs(this,text,_799,this.cell);
}else{
var _79a=new nitobi.treegrid.EditCompleteEventArgs(this,text,_799,this.cell);
}
var _79b=this.editCompleteHandler.call(this.owner,_79a);
if(!_79b){
this.ignoreBlur=false;
}
return _79b;
}
};
nitobi.form.Control.prototype.jSET=function(name,val){
this[name]=val[0];
};
nitobi.form.Control.prototype.dispose=function(){
for(var item in this){
}
};
nitobi.form.IBlurable=function(_79f,_7a0){
this.selfBlur=false;
this.elements=_79f;
var H=nitobi.html;
for(var i=0;i<this.elements.length;i++){
var e=this.elements[i];
H.attachEvent(e,"mousedown",this.handleMouseDown,this);
H.attachEvent(e,"blur",this.handleBlur,this);
H.attachEvent(e,"focus",this.handleFocus,this);
H.attachEvent(e,"mouseup",this.handleMouseUp,this);
}
this.blurFunc=_7a0;
this.lastFocus=null;
};
nitobi.form.IBlurable.prototype.removeBlurable=function(){
for(var i=0;i<elems.length;i++){
nitobi.html.detachEvent(elems[i],"mousedown",this.handleMouseDown,this);
}
};
nitobi.form.IBlurable.prototype.handleMouseDown=function(evt){
if(this.lastFocus!=evt.srcElement){
this.selfBlur=true;
}else{
this.selfBlur=false;
}
this.lastFocus=evt.srcElement;
};
nitobi.form.IBlurable.prototype.handleBlur=function(evt){
if(!this.selfBlur){
this.blurFunc(evt);
}
this.selfBlur=false;
};
nitobi.form.IBlurable.prototype.handleFocus=function(){
this.selfBlur=false;
};
nitobi.form.IBlurable.prototype.handleMouseUp=function(){
this.selfBlur=false;
};
nitobi.form.Text=function(){
nitobi.form.Text.baseConstructor.call(this);
var ph=this.placeholder;
ph.setAttribute("id","text_span");
ph.style.top="0px";
ph.style.left="-5000px";
var tc=this.control=nitobi.html.createElement("input",{"id":"ntb-textbox"},{"style":"width: 100px;"});
tc.setAttribute("maxlength",255);
this.events=[{type:"keydown",handler:this.handleKey},{type:"keyup",handler:this.handleKeyUp},{type:"keypress",handler:this.handleKeyPress},{type:"change",handler:this.handleChange},{type:"blur",handler:this.deactivate}];
};
nitobi.lang.extend(nitobi.form.Text,nitobi.form.Control);
nitobi.form.Text.prototype.initialize=function(){
var _7a9=this.placeholder.rows[0].cells[0];
_7a9.appendChild(this.control);
nitobi.html.attachEvents(this.control,this.events,this);
};
nitobi.form.Text.prototype.bind=function(_7aa,cell,_7ac){
nitobi.form.Text.base.bind.apply(this,arguments);
if(_7ac!=null&&_7ac!=""){
this.control.value=_7ac;
}else{
this.control.value=cell.getValue();
}
var _7ad=this.cell.getColumnObject().getModel();
this.eSET("onKeyPress",[_7ad.getAttribute("OnKeyPressEvent")]);
this.eSET("onKeyDown",[_7ad.getAttribute("OnKeyDownEvent")]);
this.eSET("onKeyUp",[_7ad.getAttribute("OnKeyUpEvent")]);
this.eSET("onChange",[_7ad.getAttribute("OnChangeEvent")]);
this.control.setAttribute("maxlength",_7ad.getAttribute("MaxLength"));
nitobi.html.Css.addClass(this.control,"ntb-column-data"+this.owner.uid+"_"+(this.cell.getColumn()+1));
};
nitobi.form.Text.prototype.mimic=function(){
if(nitobi.browser.MOZ||nitobi.browser.SAFARI){
var _7ae=this.cell.getDomNode();
this.control.style.width=_7ae.clientWidth+"px";
}
this.align();
nitobi.html.fitWidth(this.placeholder,this.control);
this.selectText();
};
nitobi.form.Text.prototype.focus=function(){
this.control.focus();
};
nitobi.form.Text.prototype.deactivate=function(evt){
if(nitobi.form.Text.base.deactivate.apply(this,arguments)==false){
return;
}
nitobi.html.Css.removeClass(this.control,"ntb-column-data"+this.owner.uid+"_"+(this.cell.getColumn()+1));
return this.afterDeactivate(this.control.value);
};
nitobi.form.Text.prototype.dispose=function(){
nitobi.html.detachEvents(this.control,this.events);
var _7b0=this.placeholder.parentNode;
_7b0.removeChild(this.placeholder);
this.control=null;
this.owner=null;
this.cell=null;
};
nitobi.form.Checkbox=function(){
};
nitobi.lang.extend(nitobi.form.Checkbox,nitobi.form.Control);
nitobi.form.Checkbox.prototype.mimic=function(){
if(false==eval(this.owner.getOnCellValidateEvent())){
return;
}
this.toggle();
this.deactivate();
};
nitobi.form.Checkbox.prototype.deactivate=function(){
this.afterDeactivate(this.value);
};
nitobi.form.Checkbox.prototype.attachToParent=function(){
};
nitobi.form.Checkbox.prototype.toggle=function(){
var _7b1=this.cell.getColumnObject();
var _7b2=_7b1.getModel();
var _7b3=_7b2.getAttribute("CheckedValue");
if(_7b3==""||_7b3==null){
_7b3=1;
}
var _7b4=_7b2.getAttribute("UnCheckedValue");
if(_7b4==""||_7b4==null){
_7b4=0;
}
this.value=(this.cell.getData().value==_7b3)?_7b4:_7b3;
};
nitobi.form.Checkbox.prototype.hide=function(){
};
nitobi.form.Checkbox.prototype.dispose=function(){
this.metadata=null;
this.owner=null;
this.context=null;
};
nitobi.form.Date=function(){
nitobi.form.Date.baseConstructor.call(this);
};
nitobi.lang.extend(nitobi.form.Date,nitobi.form.Text);
nitobi.lang.defineNs("nitobi.form");
nitobi.form.EDITOR_OFFSETX=0;
nitobi.form.EDITOR_OFFSETY=0;
nitobi.form.ControlFactory=function(){
this.editors={};
};
nitobi.form.ControlFactory.prototype.getEditor=function(_7b5,_7b6,_7b7){
var _7b8=null;
if(null==_7b6){
ebaErrorReport("getEditor: column parameter is null","",EBA_DEBUG);
return _7b8;
}
var _7b9=_7b6.getType();
var _7ba=_7b6.getType();
var _7bb="nitobi.Grid"+_7b9+_7ba+"Editor";
_7b8=this.editors[_7bb];
if(_7b8==null||_7b8.control==null){
switch(_7b9){
case "LINK":
case "HYPERLINK":
_7b8=new nitobi.form.Link;
break;
case "IMAGE":
return null;
case "BUTTON":
return null;
case "LOOKUP":
_7b8=new nitobi.form.Lookup();
break;
case "LISTBOX":
_7b8=new nitobi.form.ListBox();
break;
case "PASSWORD":
_7b8=new nitobi.form.Password();
break;
case "TEXTAREA":
_7b8=new nitobi.form.TextArea();
break;
case "CHECKBOX":
_7b8=new nitobi.form.Checkbox();
break;
default:
if(_7ba=="DATE"){
if(_7b6.isCalendarEnabled()){
_7b8=new nitobi.form.Calendar();
}else{
_7b8=new nitobi.form.Date();
}
}else{
if(_7ba=="NUMBER"){
_7b8=new nitobi.form.Number();
}else{
_7b8=new nitobi.form.Text();
}
}
break;
}
_7b8.initialize();
}
this.editors[_7bb]=_7b8;
return _7b8;
};
nitobi.form.ControlFactory.prototype.dispose=function(){
for(var _7bc in this.editors){
this.editors[_7bc].dispose();
}
};
nitobi.form.ControlFactory.instance=new nitobi.form.ControlFactory();
nitobi.form.Link=function(){
};
nitobi.lang.extend(nitobi.form.Link,nitobi.form.Control);
nitobi.form.Link.prototype.initialize=function(){
this.url="";
};
nitobi.form.Link.prototype.bind=function(_7bd,cell){
nitobi.form.Link.base.bind.apply(this,arguments);
this.url=this.cell.getValue();
};
nitobi.form.Link.prototype.mimic=function(){
if(false==eval(this.owner.getOnCellValidateEvent())){
return;
}
this.click();
this.deactivate();
};
nitobi.form.Link.prototype.deactivate=function(){
this.afterDeactivate(this.value);
};
nitobi.form.Link.prototype.click=function(){
this.control=window.open(this.url);
this.value=this.url;
};
nitobi.form.Link.prototype.hide=function(){
};
nitobi.form.Link.prototype.attachToParent=function(){
};
nitobi.form.Link.prototype.dispose=function(){
this.metadata=null;
this.owner=null;
this.context=null;
};
nitobi.form.ListBox=function(){
nitobi.form.ListBox.baseConstructor.call(this);
var ph=this.placeholder;
ph.setAttribute("id","listbox_span");
ph.style.top="0px";
ph.style.left="-5000px";
this.metadata=null;
this.keypress=false;
this.typedString=null;
this.events=[{type:"change",handler:this.deactivate},{type:"keydown",handler:this.handleKey},{type:"keyup",handler:this.handleKeyUp},{type:"keypress",handler:this.handleKeyPress},{type:"blur",handler:this.deactivate}];
};
nitobi.lang.extend(nitobi.form.ListBox,nitobi.form.Control);
nitobi.form.ListBox.prototype.initialize=function(){
};
nitobi.form.ListBox.prototype.bind=function(_7c0,cell){
nitobi.form.ListBox.base.bind.apply(this,arguments);
var _7c2=cell.getColumnObject().getModel();
var _7c3=_7c2.getAttribute("DatasourceId");
this.dataTable=this.owner.data.getTable(_7c3);
this.eSET("onKeyPress",[_7c2.getAttribute("OnKeyPressEvent")]);
this.eSET("onKeyDown",[_7c2.getAttribute("OnKeyDownEvent")]);
this.eSET("onKeyUp",[_7c2.getAttribute("OnKeyUpEvent")]);
this.eSET("onChange",[_7c2.getAttribute("OnChangeEvent")]);
this.bindComplete(cell.getValue());
};
nitobi.form.ListBox.prototype.bindComplete=function(_7c4){
var _7c5=this.dataTable.xmlDoc.selectSingleNode("//"+nitobi.xml.nsPrefix+"datasource[@id='"+this.dataTable.id+"']");
var _7c6=this.cell.getColumnObject();
var _7c7=_7c6.getModel();
var _7c8=_7c7.getAttribute("DisplayFields");
var _7c9=_7c7.getAttribute("ValueField");
var xsl=nitobi.form.listboxXslProc;
xsl.addParameter("DisplayFields",_7c8,"");
xsl.addParameter("ValueField",_7c9,"");
xsl.addParameter("val",_7c4,"");
this.listXml=nitobi.xml.transformToXml(nitobi.xml.createXmlDoc(_7c5.xml),xsl);
this.placeholder.rows[0].cells[0].innerHTML=nitobi.xml.serialize(this.listXml);
var tc=this.control=nitobi.html.getFirstChild(this.placeholder.rows[0].cells[0]);
tc.style.width="100%";
tc.style.height=(this.cell.DomNode.offsetHeight-2)+"px";
nitobi.html.attachEvents(tc,this.events,this);
nitobi.html.Css.addClass(tc.className,this.cell.getDomNode().className);
this.align();
this.focus();
if(typeof (_7c4)!="undefined"&&_7c4!=null&&_7c4!=""){
return this.searchComplete(_7c4);
}
};
nitobi.form.ListBox.prototype.deactivate=function(ok){
if(this.keypress){
this.keypress=false;
return;
}
if(nitobi.form.ListBox.base.deactivate.apply(this,arguments)==false){
return;
}
if(this.onChange.notify(this)==false){
return;
}
var c=this.control;
var text="",_7cf="";
if(ok||ok==null){
text=c.options[c.selectedIndex].text;
_7cf=c.options[c.selectedIndex].value;
}else{
_7cf=this.cell.getValue();
var len=c.options.length;
for(var i=0;i<len;i++){
if(c.options[i].value==_7cf){
text=c.options[i].text;
}
}
}
this.typedString=null;
return this.afterDeactivate(nitobi.html.encode(text),_7cf);
};
nitobi.form.ListBox.prototype.handleKey=function(evt){
var k=evt.keyCode;
this.keypress=false;
var K=nitobi.form.Keys;
switch(k){
case K.DOWN:
if(this.control.selectedIndex<this.control.options.length-1){
this.keypress=true;
}
break;
case K.UP:
if(this.control.selectedIndex>0){
this.keypress=true;
}
break;
case K.ENTER:
case K.TAB:
case K.ESC:
return nitobi.form.ListBox.base.handleKey.call(this,evt);
default:
nitobi.html.cancelEvent(evt);
return this.searchComplete(String.fromCharCode(k));
}
};
nitobi.form.ListBox.prototype.searchComplete=function(_7d5,_7d6){
if(typeof (_7d6)!="undefined"&&_7d6!=""){
this.typedString=_7d6;
this.maxLinearSearch=500;
}else{
this.typedString=this.typedString+_7d5;
}
var c=this.control;
var _7d8=c.options.length;
if(_7d8>this.maxLinearSearch){
var _7d9=this.searchBinary(this.typedString,0,(_7d8-1));
if(_7d9){
for(i=_7d9;i>0;i--){
if(c.options[i].text.toLowerCase().substr(0,this.typedString.length)!=this.typedString.toLowerCase()){
c.selectedIndex=i+1;
break;
}
}
}
}else{
for(i=1;i<_7d8;i++){
if(c.options[i].text.toLowerCase().substr(0,this.typedString.length)==this.typedString.toLowerCase()){
c.selectedIndex=i;
break;
}
}
}
clearTimeout(this.timerid);
var _7da=this;
this.timerid=setTimeout(function(){
_7da.typedString="";
},1000);
return false;
};
nitobi.form.ListBox.prototype.searchBinary=function(_7db,low,high){
if(low>high){
return null;
}
var c=this.control;
var mid=Math.floor((high+low)/2);
var _7e0=c.options[mid].text.toLowerCase().substr(0,_7db.length);
var _7e1=_7db.toLowerCase();
if(_7e1==_7e0){
return mid;
}else{
if(_7e1<_7e0){
return this.searchBinary(_7db,low,(mid-1));
}else{
if(_7e1>_7e0){
return this.searchBinary(_7db,(mid+1),high);
}else{
return null;
}
}
}
};
nitobi.form.ListBox.prototype.dispose=function(){
nitobi.html.detachEvents(this.control,this.events);
this.placeholder=null;
this.control=null;
this.listXml=null;
this.element=null;
this.metadata=null;
this.owner=null;
};
nitobi.form.Lookup=function(){
nitobi.form.Lookup.baseConstructor.call(this);
this.selectClicked=false;
this.bVisible=false;
var div=nitobi.html.createElement("div");
div.innerHTML="<table class='ntb-input-border' border='0' cellpadding='0' cellspacing='0'><tr><td class=\"ntb-lookup-text\"></td></tr><tr><td style=\"position:relative;\"><div style=\"position:relative;top:0px;left:0px;\"></div></td></tr></table>";
var ph=this.placeholder=div.firstChild;
ph.setAttribute("id","lookup_span");
ph.style.top="-0px";
ph.style.left="-5000px";
var tc=this.control=nitobi.html.createElement("input",{autocomplete:"off"},{zIndex:"2000",width:"100px"});
tc.setAttribute("id","ntb-lookup-text");
this.textEvents=[{type:"keydown",handler:this.handleKey},{type:"keyup",handler:this.filter},{type:"keypress",handler:this.handleKeyPress},{type:"change",handler:this.handleChange},{type:"blur",handler:function(){
}},{type:"focus",handler:function(){
}}];
ph.rows[0].cells[0].appendChild(tc);
this.selectPlaceholder=ph.rows[1].cells[0].firstChild;
this.selectEvents=[{"type":"click","handler":this.handleSelectClicked}];
this.firstKeyup=false;
this.autocompleted=false;
this.referenceColumn=null;
this.autoComplete=null;
this.autoClear=null;
this.getOnEnter=null;
this.listXml=null;
this.listXmlLower=null;
this.editCompleteHandler=null;
this.delay=0;
this.timeoutId=null;
var xsl="<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">";
xsl+="<xsl:output method=\"text\" version=\"4.0\"/><xsl:param name='searchValue'/>";
xsl+="<xsl:template match=\"/\"><xsl:apply-templates select='//option[starts-with(.,$searchValue)][1]' /></xsl:template>";
xsl+="<xsl:template match=\"option\"><xsl:value-of select='@rn' /></xsl:template></xsl:stylesheet>";
var _7e6=nitobi.xml.createXslDoc(xsl);
this.searchXslProc=nitobi.xml.createXslProcessor(_7e6);
_7e6=null;
};
nitobi.lang.extend(nitobi.form.Lookup,nitobi.form.Control);
nitobi.lang.implement(nitobi.form.Lookup,nitobi.ui.IDataBoundList);
nitobi.lang.implement(nitobi.form.Lookup,nitobi.form.IBlurable);
nitobi.form.Lookup.prototype.initialize=function(){
this.firstKeyup=false;
nitobi.html.attachEvents(this.control,this.textEvents,this);
nitobi.html.attachEvents(this.selectPlaceholder,this.selectEvents,this);
};
nitobi.form.Lookup.prototype.hideSelect=function(){
this.selectControl.style.display="none";
this.bVisible=false;
};
nitobi.form.Lookup.prototype.bind=function(_7e7,cell,_7e9){
nitobi.form.Lookup.base.bind.apply(this,arguments);
var col=this.column=this.cell.getColumnObject();
var _7eb=this.column.getModel();
this.datasourceId=col.getDatasourceId();
this.getHandler=col.getGetHandler();
this.delay=col.getDelay();
this.size=col.getSize();
this.referenceColumn=col.getReferenceColumn();
this.autoComplete=col.isAutoComplete();
this.autoClear=col.isAutoClear();
this.getOnEnter=col.isGetOnEnter();
this.displayFields=col.getDisplayFields();
this.valueField=col.getValueField();
this.eSET("onKeyPress",[col.getOnKeyPressEvent()]);
this.eSET("onKeyDown",[col.getOnKeyDownEvent()]);
this.eSET("onKeyUp",[col.getOnKeyUpEvent()]);
this.eSET("onChange",[col.getOnChangeEvent()]);
var _7ec=nitobi.form.listboxXslProc;
_7ec.addParameter("DisplayFields",this.displayFields,"");
_7ec.addParameter("ValueField",this.valueField,"");
this.dataTable=this.owner.data.getTable(this.datasourceId);
this.dataTable.setGetHandler(this.getHandler);
this.dataTable.async=false;
if(_7e9.length<=0){
_7e9=this.cell.getValue();
}
this.get(_7e9,true);
};
nitobi.form.Lookup.prototype.getComplete=function(_7ed){
var _7ee=this.dataTable.getXmlDoc();
var _7ef=nitobi.form.listboxXslProc;
_7ef.addParameter("DisplayFields",this.displayFields,"");
_7ef.addParameter("ValueField",this.valueField,"");
_7ef.addParameter("val",nitobi.xml.constructValidXpathQuery(this.cell.getValue(),false),"");
if(nitobi.browser.IE&&document.compatMode=="CSS1Compat"){
_7ef.addParameter("size",6,"");
}
this.listXml=nitobi.xml.transformToXml(nitobi.xml.createXmlDoc(_7ee.xml),nitobi.form.listboxXslProc);
this.listXmlLower=nitobi.xml.createXmlDoc(this.listXml.xml.toLowerCase());
if(nitobi.browser.IE&&document.compatMode=="CSS1Compat"){
_7ef.addParameter("size","","");
}
this.selectPlaceholder.innerHTML=nitobi.xml.serialize(this.listXml);
var tc=this.control;
var sc=this.selectControl=nitobi.html.getFirstChild(this.selectPlaceholder);
sc.setAttribute("id","ntb-lookup-options");
sc.setAttribute("size",this.size);
sc.style.display="none";
if(nitobi.browser.IE6&&document.compatMode!="CSS1Compat"){
sc.style.height="100%";
}
nitobi.form.IBlurable.call(this,[tc,sc],this.deactivate);
this.selectClicked=false;
this.bVisible=false;
this.align();
nitobi.html.fitWidth(this.placeholder,this.control);
if(this.autoComplete){
var rn=this.search(_7ed);
if(rn>0){
sc.selectedIndex=rn-1;
tc.value=sc[sc.selectedIndex].text;
nitobi.html.highlight(tc,tc.value.length-(tc.value.length-_7ed.length));
this.autocompleted=true;
}else{
var row=_7ee.selectSingleNode("//"+nitobi.xml.nsPrefix+"e[@"+this.valueField+"='"+_7ed+"']");
if(row!=null){
tc.value=row.getAttribute(this.displayFields);
var rn=this.search(tc.value);
sc.selectedIndex=parseInt(rn)-1;
}else{
tc.value=_7ed;
sc.selectedIndex=-1;
}
}
}else{
tc.value=_7ed;
sc.selectedIndex=-1;
}
tc.parentNode.style.height=nitobi.html.getHeight(this.cell.getDomNode())+"px";
sc.style.display="inline";
tc.focus();
};
nitobi.form.Lookup.prototype.handleSelectClicked=function(evt){
this.control.value=this.selectControl.selectedIndex!=-1?this.selectControl.options[this.selectControl.selectedIndex].text:"";
this.deactivate(evt);
};
nitobi.form.Lookup.prototype.focus=function(evt){
this.control.focus();
};
nitobi.form.Lookup.prototype.deactivate=function(evt){
if(nitobi.form.Lookup.base.deactivate.apply(this,arguments)==false){
return;
}
var sc=this.selectControl;
var tc=this.control;
var text="",_7fa="";
if(evt!=null&&evt!=false){
if(sc.selectedIndex>=0){
_7fa=sc.options[sc.selectedIndex].value;
text=sc.options[sc.selectedIndex].text;
}else{
if(this.column.getModel().getAttribute("ForceValidOption")!="true"){
_7fa=tc.value;
text=_7fa;
}else{
if(this.autoClear){
_7fa="";
text="";
}else{
_7fa=this.cell.getValue();
var len=sc.options.length;
for(var i=0;i<len;i++){
if(sc.options[i].value==_7fa){
text=sc.options[i].text;
}
}
}
}
}
}else{
_7fa=this.cell.getValue();
var len=sc.options.length;
var _7fd=false;
for(var i=0;i<len;i++){
if(sc.options[i].value==_7fa){
text=sc.options[i].text;
_7fd=true;
break;
}
}
if(!_7fd&&this.autoClear){
_7fa="";
text="";
}
}
nitobi.html.detachEvents(sc,this.textEvents);
window.clearTimeout(this.timeoutId);
return this.afterDeactivate(nitobi.html.encode(text),_7fa);
};
nitobi.form.Lookup.prototype.handleKey=function(evt,_7ff){
var k=evt.keyCode;
if(k!=40&&k!=38){
nitobi.form.Lookup.base.handleKey.call(this,evt);
}
};
nitobi.form.Lookup.prototype.search=function(_801){
_801=nitobi.xml.constructValidXpathQuery(_801,false);
this.searchXslProc.addParameter("searchValue",_801.toLowerCase(),"");
var _802=nitobi.xml.transformToString(this.listXmlLower,this.searchXslProc);
if(""==_802){
_802=0;
}else{
_802=parseInt(_802);
}
return _802;
};
nitobi.form.Lookup.prototype.filter=function(evt,o){
var k=evt.keyCode;
if(this.onKeyUp.notify(evt)==false){
return;
}
if(!this.firstKeyup&&k!=38&&k!=40){
this.firstKeyup=true;
return;
}
var tc=this.control;
var sc=this.selectControl;
switch(k){
case 38:
if(sc.selectedIndex==-1){
sc.selectedIndex=0;
}
if(sc.selectedIndex>0){
sc.selectedIndex--;
}
tc.value=sc.options[sc.selectedIndex].text;
nitobi.html.highlight(tc,tc.value.length);
tc.select();
break;
case 40:
if(sc.selectedIndex<(sc.length-1)){
sc.selectedIndex++;
}
tc.value=sc.options[sc.selectedIndex].text;
nitobi.html.highlight(tc,tc.value.length);
tc.select();
break;
default:
if((!this.getOnEnter&&((k<193&&k>46)||k==8||k==32))||(this.getOnEnter&&k==13)){
var _808=tc.value;
this.get(_808);
}
}
};
nitobi.form.Lookup.prototype.get=function(_809,_80a){
if(this.getHandler!=null&&this.getHandler!=""){
if(_80a||!this.delay){
this.doGet(_809);
}else{
if(this.timeoutId){
window.clearTimeout(this.timeoutId);
this.timeoutId=null;
}
this.timeoutId=window.setTimeout(nitobi.lang.close(this,this.doGet,[_809]),this.delay);
}
}else{
this.getComplete(_809);
}
};
nitobi.form.Lookup.prototype.doGet=function(_80b){
if(_80b){
this.dataTable.setGetHandlerParameter("SearchString",_80b);
}
if(this.referenceColumn!=null&&this.referenceColumn!=""){
var _80c=this.owner.getCellValue(this.cell.row,this.referenceColumn);
this.dataTable.setGetHandlerParameter("ReferenceColumn",_80c);
}
this.dataTable.get(null,this.pageSize,this);
this.timeoutId=null;
this.getComplete(_80b);
};
nitobi.form.Lookup.prototype.dispose=function(){
this.placeholder=null;
nitobi.html.detachEvents(this.textEvents,this);
this.selectControl=null;
this.control=null;
this.dataTable=null;
this.owner=null;
};
nitobi.form.Number=function(){
nitobi.form.Number.baseConstructor.call(this);
this.defaultValue=0;
};
nitobi.lang.extend(nitobi.form.Number,nitobi.form.Text);
nitobi.form.Number.prototype.handleKey=function(evt){
nitobi.form.Number.base.handleKey.call(this,evt);
var k=evt.keyCode;
if(!this.isValidKey(k)){
nitobi.html.cancelEvent(evt);
return false;
}
};
nitobi.form.Number.prototype.isValidKey=function(k){
if((k<48||k>57)&&(k<37||k>40)&&(k<96||k>105)&&k!=190&&k!=110&&k!=189&&k!=109&&k!=9&&k!=45&&k!=46&&k!=8){
return false;
}
return true;
};
nitobi.form.Number.prototype.bind=function(_810,cell,_812){
var _813=_812.charCodeAt(0);
if(_813>=97){
_813=_813-32;
}
var k=this.isValidKey(_813)?_812:"";
nitobi.form.Number.base.bind.call(this,_810,cell,k);
};
nitobi.form.Password=function(){
nitobi.form.Password.baseConstructor.call(this,true);
this.control.type="password";
};
nitobi.lang.extend(nitobi.form.Password,nitobi.form.Text);
nitobi.form.TextArea=function(){
nitobi.form.TextArea.baseConstructor.call(this);
var div=nitobi.html.createElement("div");
div.innerHTML="<table border='0' cellpadding='0' cellspacing='0' class='ntb-input-border'><tr><td></td></table>";
var ph=this.placeholder=div.firstChild;
ph.style.top="-3000px";
ph.style.left="-3000px";
this.control=nitobi.html.createElement("textarea",{},{width:"100px"});
};
nitobi.lang.extend(nitobi.form.TextArea,nitobi.form.Text);
nitobi.form.TextArea.prototype.initialize=function(){
this.placeholder.rows[0].cells[0].appendChild(this.control);
document.body.appendChild(this.placeholder);
nitobi.html.attachEvents(this.control,this.events,this);
};
nitobi.form.TextArea.prototype.mimic=function(){
nitobi.form.TextArea.base.mimic.call(this);
var phs=this.placeholder.style;
};
nitobi.form.TextArea.prototype.handleKey=function(evt){
var k=evt.keyCode;
if(k==40||k==38||k==37||k==39||(k==13&&evt.shiftKey)){
}else{
nitobi.form.TextArea.base.handleKey.call(this,evt);
}
};
nitobi.form.Calendar=function(){
nitobi.form.Calendar.baseConstructor.call(this);
var div=nitobi.html.createElement("div");
div.innerHTML="<table border='0' cellpadding='0' cellspacing='0' style='table-layout:fixed;' class='ntb-input-border'><tr><td>"+"<input id='ntb-datepicker-input' type='text' maxlength='255' style='width:100%;' />"+"</td><td class='ntb-datepicker-button'><a id='ntb-datepicker-button' href='#' onclick='return false;'></a></td></tr><tr><td colspan='2' style='width:1px;height:1px;position:absolute;'><!-- --></td></tr><colgroup><col></col><col style='width:20px;'></col></colgroup></table>";
this.control=div.getElementsByTagName("input")[0];
var ph=this.placeholder=div.firstChild;
ph.setAttribute("id","calendar_span");
ph.style.top="-3000px";
ph.style.left="-3000px";
var pd=this.pickerDiv=nitobi.html.createElement("div",{},{position:"absolute"});
this.isPickerVisible=false;
nitobi.html.Css.addClass(pd,NTB_CSS_HIDE);
ph.rows[1].cells[0].appendChild(pd);
};
nitobi.lang.extend(nitobi.form.Calendar,nitobi.form.Control);
nitobi.form.Calendar.prototype.initialize=function(){
var dp=this.datePicker=new nitobi.calendar.DatePicker(nitobi.component.getUniqueId());
dp.setAttribute("theme","flex");
dp.setObject(new nitobi.calendar.Calendar());
dp.onDateSelected.subscribe(this.handlePick,this);
dp.setContainer(this.pickerDiv);
var tc=this.control;
var H=nitobi.html;
H.attachEvent(tc,"keydown",this.handleKey,this,false);
H.attachEvent(tc,"blur",this.deactivate,this,false);
H.attachEvent(this.pickerDiv,"mousedown",this.handleCalendarMouseDown,this);
H.attachEvent(this.pickerDiv,"mouseup",this.handleCalendarMouseUp,this);
var a=this.placeholder.getElementsByTagName("a")[0];
H.attachEvent(a,"mousedown",this.handleClick,this);
H.attachEvent(a,"mouseup",this.handleMouseUp,this);
};
nitobi.form.Calendar.prototype.bind=function(_821,cell,_823){
this.isPickerVisible=false;
nitobi.html.Css.addClass(this.pickerDiv,NTB_CSS_HIDE);
nitobi.form.Calendar.base.bind.apply(this,arguments);
if(_823!=null&&_823!=""){
this.control.value=_823;
}else{
this.control.value=cell.getValue();
}
this.column=this.cell.getColumnObject();
this.control.maxlength=this.column.getModel().getAttribute("MaxLength");
};
nitobi.form.Calendar.prototype.mimic=function(){
this.align();
var _824=this.placeholder.offsetWidth;
var _825=this.placeholder.rows[0].cells[1].offsetWidth;
this.control.style.width=_824-_825-(document.compatMode=="BackCompat"?0:8)+"px";
this.selectText();
};
nitobi.form.Calendar.prototype.deactivate=function(){
if(nitobi.form.Calendar.base.deactivate.apply(this,arguments)==false){
return;
}
this.afterDeactivate(this.control.value);
};
nitobi.form.Calendar.prototype.handleClick=function(evt){
if(!this.isPickerVisible){
var dp=this.datePicker;
dp.setSelectedDate(nitobi.base.DateMath.parseIso8601(this.control.value));
dp.render();
dp.getCalendar().getHtmlNode().style.width="180px";
nitobi.html.Css.setStyle(dp.getCalendar().getHtmlNode(),"position","absolute");
nitobi.html.Css.setStyle(dp.getCalendar().getHtmlNode(),"z-index","9999");
}
this.ignoreBlur=true;
nitobi.ui.Effects.setVisible(this.pickerDiv,!this.isPickerVisible,"none",this.setVisibleComplete,this);
};
nitobi.form.Calendar.prototype.handleMouseUp=function(evt){
this.control.focus();
this.ignoreBlur=false;
};
nitobi.form.Calendar.prototype.handleCalendarMouseDown=function(evt){
this.ignoreBlur=true;
};
nitobi.form.Calendar.prototype.handleCalendarMouseUp=function(evt){
this.handleMouseUp(evt);
};
nitobi.form.Calendar.prototype.setVisibleComplete=function(){
this.isPickerVisible=!this.isPickerVisible;
};
nitobi.form.Calendar.prototype.handlePick=function(){
var date=this.datePicker.getSelectedDate();
var _82c=nitobi.base.DateMath.toIso8601(date);
this.control.value=_82c;
this.datePicker.hide();
};
nitobi.form.Calendar.prototype.dispose=function(){
nitobi.html.detachEvent(this.control,"keydown",this.handleKey);
nitobi.html.detachEvent(this.control,"blur",this.deactivate);
var _82d=this.placeholder.parentNode;
_82d.removeChild(this.placeholder);
this.control=null;
this.placeholder=null;
this.owner=null;
this.cell=null;
};
nitobi.lang.defineNs("nitobi.form");
nitobi.form.Keys={UP:38,DOWN:40,ENTER:13,TAB:9,ESC:27,RIGHT:39,LEFT:37};
nitobi.ui.UiElement=function(xml,xsl,id){
if(arguments.length>0){
this.initialize(xml,xsl,id);
}
};
nitobi.ui.UiElement.prototype.initialize=function(xml,xsl,id){
this.m_Xml=xml;
this.m_Xsl=xsl;
this.m_Id=id;
this.m_HtmlElementHandle=null;
};
nitobi.ui.UiElement.prototype.getHeight=function(){
return this.getHtmlElementHandle().style.height;
};
nitobi.ui.UiElement.prototype.setHeight=function(_834){
this.getHtmlElementHandle().style.height=_834+"px";
};
nitobi.ui.UiElement.prototype.getId=function(){
return this.m_Id;
};
nitobi.ui.UiElement.prototype.setId=function(id){
this.m_Id=id;
};
nitobi.ui.UiElement.prototype.getWidth=function(){
return this.getHtmlElementHandle().style.width;
};
nitobi.ui.UiElement.prototype.setWidth=function(_836){
if(_836>0){
this.getHtmlElementHandle().style.width=_836+"px";
}
};
nitobi.ui.UiElement.prototype.getXml=function(){
return this.m_Xml;
};
nitobi.ui.UiElement.prototype.setXml=function(xml){
this.m_Xml=xml;
};
nitobi.ui.UiElement.prototype.getXsl=function(){
return this.m_Xsl;
};
nitobi.ui.UiElement.prototype.setXsl=function(xsl){
this.m_Xsl=xsl;
};
nitobi.ui.UiElement.prototype.getHtmlElementHandle=function(){
if(!this.m_HtmlElementHandle){
this.m_HtmlElementHandle=document.getElementById(this.m_Id);
}
return this.m_HtmlElementHandle;
};
nitobi.ui.UiElement.prototype.setHtmlElementHandle=function(_839){
this.m_HtmlElementHandle=_839;
};
nitobi.ui.UiElement.prototype.hide=function(){
var tag=this.getHtmlElementHandle();
tag.style.visibility="hidden";
tag.style.position="absolute";
};
nitobi.ui.UiElement.prototype.show=function(){
var tag=this.getHtmlElementHandle();
tag.style.visibility="visible";
};
nitobi.ui.UiElement.prototype.isVisible=function(){
var tag=this.getHtmlElementHandle();
return tag.style.visibility=="visible";
};
nitobi.ui.UiElement.prototype.beginFloatMode=function(){
var tag=this.getHtmlElementHandle();
tag.style.position="absolute";
};
nitobi.ui.UiElement.prototype.isFloating=function(){
var tag=this.getHtmlElementHandle();
return tag.style.position=="absolute";
};
nitobi.ui.UiElement.prototype.setX=function(x){
var tag=this.getHtmlElementHandle();
tag.style.left=x+"px";
};
nitobi.ui.UiElement.prototype.getX=function(){
var tag=this.getHtmlElementHandle();
return tag.style.left;
};
nitobi.ui.UiElement.prototype.setY=function(y){
var tag=this.getHtmlElementHandle();
tag.style.top=y+"px";
};
nitobi.ui.UiElement.prototype.getY=function(){
var tag=this.getHtmlElementHandle();
return tag.style.top;
};
nitobi.ui.UiElement.prototype.render=function(_845,_846,_847){
var xsl=this.m_Xsl;
if(xsl!=null&&xsl.indexOf("xsl:stylesheet")==-1){
xsl="<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output method=\"html\" version=\"4.0\" />"+xsl+"</xsl:stylesheet>";
}
if(null==_846){
_846=nitobi.xml.createXslDoc(xsl);
}
if(null==_847){
_847=nitobi.xml.createXmlDoc(this.m_Xml);
}
Eba.Error.assert(nitobi.xml.isValidXml(_847),"Tried to render invalid XML according to Mozilla. The XML is "+_847.xml);
var html=nitobi.xml.transform(_847,_846);
if(html.xml){
html=html.xml;
}
if(null==_845){
nitobi.html.insertAdjacentHTML(document.body,"beforeEnd",html);
}else{
_845.innerHTML=html;
}
this.attachToTag();
};
nitobi.ui.UiElement.prototype.attachToTag=function(){
var _84a=this.getHtmlElementHandle();
if(_84a!=null){
_84a.object=this;
_84a.jsobject=this;
_84a.javascriptObject=this;
}
};
nitobi.ui.UiElement.prototype.dispose=function(){
var _84b=this.getHtmlElementHandle();
if(_84b!=null){
_84b.object=null;
}
this.m_Xml=null;
this.m_Xsl=null;
this.m_HtmlElementHandle=null;
};
nitobi.ui.InteractiveUiElement=function(_84c){
this.enable();
};
nitobi.lang.extend(nitobi.ui.InteractiveUiElement,nitobi.ui.UiElement);
nitobi.ui.InteractiveUiElement.prototype.enable=function(){
this.m_Enabled=true;
};
nitobi.ui.InteractiveUiElement.prototype.disable=function(){
this.m_Enabled=false;
};
nitobi.ui.ButtonXsl="<xsl:template match=\"button\">"+"<div class=\"ntb-button\" onmousemove=\"return false;\" onmousedown=\"if (this.object.m_Enabled) this.className='ntb-button-down';\" onmouseup=\"this.className='ntb-button';\" onmouseover=\"if (this.object.m_Enabled) this.className='ntb-button-highlight';\" onmouseout=\"this.className='ntb-button';\" align=\"center\">"+"<xsl:attribute name=\"image_disabled\">"+"<xsl:choose>"+"<xsl:when test=\"../../@image_directory and not(starts-with(@image_disabled,'/'))\">"+"<xsl:value-of select=\"concat(../../@image_directory,@image_disabled)\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"@image_disabled\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"<xsl:attribute name=\"image_enabled\">"+"<xsl:choose>"+"<xsl:when test=\"../../@image_directory and not(starts-with(@image,'/'))\">"+"<xsl:value-of select=\"concat(../../@image_directory,@image)\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"@image\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"<xsl:attribute name=\"title\">"+"<xsl:value-of select=\"@tooltip_text\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"onclick\">"+"<xsl:value-of select='concat(&quot;v&quot;,&quot;a&quot;,&quot;r&quot;,&quot; &quot;,&quot;e&quot;,&quot;=&quot;,&quot;&apos;&quot;,@onclick_event,&quot;&apos;&quot;,&quot;;&quot;,&quot;e&quot;,&quot;v&quot;,&quot;a&quot;,&quot;l&quot;,&quot;(&quot;,&quot;t&quot;,&quot;h&quot;,&quot;i&quot;,&quot;s&quot;,&quot;.&quot;,&quot;o&quot;,&quot;b&quot;,&quot;j&quot;,&quot;e&quot;,&quot;c&quot;,&quot;t&quot;,&quot;.&quot;,&quot;o&quot;,&quot;n&quot;,&quot;C&quot;,&quot;l&quot;,&quot;i&quot;,&quot;c&quot;,&quot;k&quot;,&quot;H&quot;,&quot;a&quot;,&quot;n&quot;,&quot;d&quot;,&quot;l&quot;,&quot;e&quot;,&quot;r&quot;,&quot;(&quot;,&quot;e&quot;,&quot;)&quot;,&quot;)&quot;,&quot;;&quot;,&apos;&apos;)' />"+"</xsl:attribute>"+"<xsl:attribute name=\"id\">"+"<xsl:value-of select=\"@id\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">"+"<xsl:choose>"+"<xsl:when test=\"../../@height\">"+"<xsl:value-of select=\"concat('margin-top: 1px; float:left;width:',../../@height,'px;height:',../../@height - 1,'px')\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"concat('margin-top: 1px; float:left;width:',@width,'px;height:',@height,'px')\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"<img border=\"0\">"+"<xsl:attribute name=\"src\">"+"<xsl:choose>"+"<xsl:when test=\"../../@image_directory and not(starts-with(@image,'/'))\">"+"<xsl:value-of select=\"concat(../../@image_directory,@image)\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"@image\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">"+"<xsl:variable name=\"top_offset\">"+"<xsl:choose>"+"<xsl:when test=\"@top_offset\">"+"<xsl:value-of select=\"@top_offset\" />"+"</xsl:when>"+"<xsl:otherwise>"+"0"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:variable>"+"<xsl:choose>"+"<xsl:when test=\"../../@height\">"+"<xsl:value-of select=\"concat('MARGIN-TOP:',((../../@height - @height) div 2) - 1 + number($top_offset),'px;MARGIN-BOTTOM:0px')\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"concat('MARGIN-TOP:',(@height - @image_height) div 2,'px;MARGIN-BOTTOM:0','px')\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"</img><![CDATA[ ]]>"+"</div>"+"</xsl:template>";
nitobi.ui.Button=function(xml,id){
this.initialize(xml,nitobi.ui.ButtonXsl,id);
this.enable();
};
nitobi.lang.extend(nitobi.ui.Button,nitobi.ui.InteractiveUiElement);
nitobi.ui.Button.prototype.onClickHandler=function(_84f){
if(this.m_Enabled){
eval(_84f);
}
};
nitobi.ui.Button.prototype.disable=function(){
nitobi.ui.Button.base.disable.call(this);
var _850=this.getHtmlElementHandle();
_850.childNodes[0].src=_850.getAttribute("image_disabled");
};
nitobi.ui.Button.prototype.enable=function(){
nitobi.ui.Button.base.enable.call(this);
var _851=this.getHtmlElementHandle();
_851.childNodes[0].src=_851.getAttribute("image_enabled");
};
nitobi.ui.Button.prototype.dispose=function(){
nitobi.ui.Button.base.dispose.call(this);
};
nitobi.ui.BinaryStateButtonXsl="<xsl:template match=\"binarystatebutton\">"+"<div class=\"ntb-binarybutton\" onmousemove=\"return false;\" onmousedown=\"if (this.object.m_Enabled) this.className='ntb-button-down';\" onmouseup=\"(this.object.isChecked()?this.object.check():this.object.uncheck())\" onmouseover=\"if (this.object.m_Enabled) this.className='ntb-button-highlight';\" onmouseout=\"(this.object.isChecked()?this.object.check():this.object.uncheck())\" align=\"center\">"+"<xsl:attribute name=\"image_disabled\">"+"<xsl:choose>"+"<xsl:when test=\"../../@image_directory\">"+"<xsl:value-of select=\"concat(../../@image_directory,@image_disabled)\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"@image_disabled\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"<xsl:attribute name=\"image_enabled\">"+"<xsl:choose>"+"<xsl:when test=\"../../@image_directory\">"+"<xsl:value-of select=\"concat(../../@image_directory,@image)\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"@image\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"<xsl:attribute name=\"title\">"+"<xsl:value-of select=\"@tooltip_text\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"onclick\">"+"<xsl:value-of select='concat(\"this.object.toggle();\",&quot;v&quot;,&quot;a&quot;,&quot;r&quot;,&quot; &quot;,&quot;e&quot;,&quot;=&quot;,&quot;&apos;&quot;,@onclick_event,&quot;&apos;&quot;,&quot;;&quot;,&quot;e&quot;,&quot;v&quot;,&quot;a&quot;,&quot;l&quot;,&quot;(&quot;,&quot;t&quot;,&quot;h&quot;,&quot;i&quot;,&quot;s&quot;,&quot;.&quot;,&quot;o&quot;,&quot;b&quot;,&quot;j&quot;,&quot;e&quot;,&quot;c&quot;,&quot;t&quot;,&quot;.&quot;,&quot;o&quot;,&quot;n&quot;,&quot;C&quot;,&quot;l&quot;,&quot;i&quot;,&quot;c&quot;,&quot;k&quot;,&quot;H&quot;,&quot;a&quot;,&quot;n&quot;,&quot;d&quot;,&quot;l&quot;,&quot;e&quot;,&quot;r&quot;,&quot;(&quot;,&quot;e&quot;,&quot;)&quot;,&quot;)&quot;,&quot;;&quot;,&apos;&apos;)' />"+"</xsl:attribute>"+"<xsl:attribute name=\"id\">"+"<xsl:value-of select=\"@id\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">"+"<xsl:choose>"+"<xsl:when test=\"../../@height\">"+"<xsl:value-of select=\"concat('float:left;width:',../../@height,'px;height:',../../@height - 1,'px')\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"concat('float:left;width:',@width,'px;height:',@height,'px')\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"<img border=\"0\">"+"<xsl:attribute name=\"src\">"+"<xsl:choose>"+"<xsl:when test=\"../../@image_directory\">"+"<xsl:value-of select=\"concat(../../@image_directory,@image)\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"@image\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">"+"<xsl:variable name=\"top_offset\">"+"<xsl:choose>"+"<xsl:when test=\"@top_offset\">"+"<xsl:value-of select=\"@top_offset\" />"+"</xsl:when>"+"<xsl:otherwise>"+"0"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:variable>"+"<xsl:choose>"+"<xsl:when test=\"../../@height\">"+"<xsl:value-of select=\"concat('MARGIN-TOP:',((../../@height - @height) div 2) - 1 + number($top_offset),'px;MARGIN-BOTTOM:0px')\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"concat('MARGIN-TOP:',(@height - @image_height) div 2,'px;MARGIN-BOTTOM:0','px')\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"</img><![CDATA[ ]]>"+"</div>"+"</xsl:template>";
nitobi.ui.BinaryStateButton=function(xml,id){
this.initialize(xml,nitobi.ui.BinaryStateButtonXsl,id);
this.m_Checked=false;
};
nitobi.lang.extend(nitobi.ui.BinaryStateButton,nitobi.ui.Button);
nitobi.ui.BinaryStateButton.prototype.isChecked=function(){
return this.m_Checked;
};
nitobi.ui.BinaryStateButton.prototype.check=function(){
var _854=this.getHtmlElementHandle();
_854.className="ntb-button-checked";
this.m_Checked=true;
};
nitobi.ui.BinaryStateButton.prototype.uncheck=function(){
var _855=this.getHtmlElementHandle();
_855.className="ntb-button";
this.m_Checked=false;
};
nitobi.ui.BinaryStateButton.prototype.toggle=function(){
var _856=this.getHtmlElementHandle();
if(_856.className=="ntb-button-checked"){
this.uncheck();
}else{
this.check();
}
};
nitobi.ui.InputXsl="<xsl:template match=\"//inputtext\">"+"<input type=\"text\" class=\"ntb-inputtext\" gridInput=\"true\">"+"<xsl:attribute name=\"value\" >"+"<xsl:value-of select=\"@value\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"onkeydown\">"+"<xsl:value-of select='concat(&quot;v&quot;,&quot;a&quot;,&quot;r&quot;,&quot; &quot;,&quot;e&quot;,&quot;=&quot;,&quot;e&quot;,&quot;v&quot;,&quot;e&quot;,&quot;n&quot;,&quot;t&quot;,&quot;;&quot;,&quot;e&quot;,&quot;v&quot;,&quot;a&quot;,&quot;l&quot;,&quot;(&quot;,&quot;t&quot;,&quot;h&quot;,&quot;i&quot;,&quot;s&quot;,&quot;.&quot;,&quot;o&quot;,&quot;b&quot;,&quot;j&quot;,&quot;e&quot;,&quot;c&quot;,&quot;t&quot;,&quot;.&quot;,&quot;O&quot;,&quot;n&quot;,&quot;K&quot;,&quot;e&quot;,&quot;y&quot;,&quot;D&quot;,&quot;o&quot;,&quot;w&quot;,&quot;n&quot;,&quot;H&quot;,&quot;a&quot;,&quot;n&quot;,&quot;d&quot;,&quot;l&quot;,&quot;e&quot;,&quot;r&quot;,&quot;(&quot;,&quot;e&quot;,&quot;)&quot;,&quot;)&quot;,&quot;;&quot;)' />"+"</xsl:attribute>"+"<xsl:attribute name=\"id\" >"+"<xsl:value-of select=\"@id\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">"+"<xsl:value-of select=\"concat('margin-top:6','px; margin-bottom:0','px;','width:',@width,'px;height:',@height,'px; float:',@float,';')\" />"+"</xsl:attribute>"+"</input>"+"</xsl:template>";
nitobi.ui.InputText=function(xml,id){
this.initialize(xml,nitobi.ui.InputText,id);
this.enable();
};
nitobi.lang.extend(nitobi.ui.InputText,nitobi.ui.InteractiveUiElement);
nitobi.ui.InputText.prototype.OnKeyDownHandler=function(_859){
if(_859.keyCode==13){
_859.returnValue=false;
_859.cancel=true;
_859.cancelBubble=true;
this.toolbar.inputCounter();
}
};
nitobi.ui.InputText.prototype.disable=function(){
nitobi.ui.InputText.base.disable.call(this);
var _85a=this.getHtmlElementHandle();
};
nitobi.ui.InputText.prototype.enable=function(){
nitobi.ui.InputText.base.enable.call(this);
var _85b=this.getHtmlElementHandle();
};
nitobi.ui.InputText.prototype.dispose=function(){
nitobi.ui.InputText.base.dispose.call(this);
};
nitobi.ui.DropDownXsl="<xsl:template match=\"//dropdown\">"+"<select class=\"ntb-dropdown\" >"+"<xsl:attribute name=\"id\" >"+"<xsl:value-of select=\"@id\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">"+"<xsl:choose>"+"<xsl:when test=\"../../@height\">"+"<xsl:value-of select=\"concat('float:left; margin-top: 4','px;','margin-bottom: 0; width:50px;height:17','px; margin-left: 5','px;')\" />"+"</xsl:when>"+"<xsl:otherwise>"+"<xsl:value-of select=\"concat('float:left;width:',@width,'px;height:',@height,'px')\" />"+"</xsl:otherwise>"+"</xsl:choose>"+"</xsl:attribute>"+"<xsl:attribute name=\"onchange\">"+"<xsl:value-of select=\"concat(&quot;v&quot;,&quot;a&quot;,&quot;r&quot;,&quot; &quot;,&quot;e&quot;,&quot;=&quot;,&quot;t&quot;,&quot;h&quot;,&quot;i&quot;,&quot;s&quot;,&quot;.&quot;,&quot;v&quot;,&quot;a&quot;,&quot;l&quot;,&quot;u&quot;,&quot;e&quot;,&quot;;&quot;,&quot;t&quot;,&quot;h&quot;,&quot;i&quot;,&quot;s&quot;,&quot;.&quot;,&quot;o&quot;,&quot;b&quot;,&quot;j&quot;,&quot;e&quot;,&quot;c&quot;,&quot;t&quot;,&quot;.&quot;,&quot;o&quot;,&quot;n&quot;,&quot;C&quot;,&quot;h&quot;,&quot;a&quot;,&quot;n&quot;,&quot;g&quot;,&quot;e&quot;,&quot;H&quot;,&quot;a&quot;,&quot;n&quot;,&quot;d&quot;,&quot;l&quot;,&quot;e&quot;,&quot;r&quot;,&quot;(&quot;,&quot;e&quot;,&quot;)&quot;,&quot;;&quot;)\" />"+"</xsl:attribute>"+"<option value=\"10\">10</option>"+"<option value=\"15\">15</option>"+"<option value=\"20\">20</option>"+"<option value=\"25\">25</option>"+"<option value=\"50\">50</option>"+"</select>"+"</xsl:template>";
nitobi.ui.DropDown=function(xml,id){
this.initialize(xml,nitobi.ui.DropDownXsl,id);
this.enable();
};
nitobi.lang.extend(nitobi.ui.DropDown,nitobi.ui.InteractiveUiElement);
nitobi.ui.DropDown.prototype.onChangeHandler=function(_85e){
if(_85e){
var grid=this.toolbar.grid;
grid.setRowsPerPage(_85e);
grid.Declaration.grid.firstChild.setAttribute("rowsperpage",_85e);
grid.bind();
this.toolbar.resetCounter();
}
};
nitobi.ui.DropDown.prototype.disable=function(){
nitobi.ui.DropDown.base.disable.call(this);
};
nitobi.ui.DropDown.prototype.enable=function(){
nitobi.ui.DropDown.base.enable.call(this);
};
nitobi.ui.DropDown.prototype.dispose=function(){
nitobi.ui.DropDown.base.dispose.call(this);
};
nitobi.ui.ToolbarDivItemXsl="<xsl:template match=\"div\"><xsl:copy-of select=\".\"/></xsl:template>";
nitobi.ui.RowCountXsl="<xsl:template match=\"//text\">"+"<div class=\"ntb-toolbar-text\" style=\"z-index:800\" padding=\"0px\" margin=\"0px\">"+"<xsl:attribute name=\"id\">"+"<xsl:value-of select=\"@id\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">"+"<xsl:value-of select=\"concat('float: left; margin-top: 7','px; margin-bottom: 0','px; padding-bottom: 2px;')\" />"+"</xsl:attribute>"+"&#xa0;<xsl:value-of select=\"@value\"/>"+"</div>"+"</xsl:template>";
nitobi.ui.ToolbarXsl="<xsl:template match=\"//toolbar\">"+"<div style=\"z-index:800\">"+"<xsl:attribute name=\"id\">"+"<xsl:value-of select=\"@id\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">float:left;position:relative;"+"<xsl:value-of select=\"concat('height:',@height,'px')\" />"+"</xsl:attribute>"+"<xsl:apply-templates />"+"</div>"+"</xsl:template>"+nitobi.ui.RowCountXsl+nitobi.ui.ToolbarDivItemXsl+nitobi.ui.ButtonXsl+nitobi.ui.BinaryStateButtonXsl+nitobi.ui.InputXsl+nitobi.ui.DropDownXsl+"<xsl:template match=\"separator\">"+"<div align='center'>"+"<xsl:attribute name=\"style\">"+"<xsl:value-of select=\"concat('float:left;width:',@width,';height:',@height)\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"id\">"+"<xsl:value-of select=\"@id\" />"+"</xsl:attribute>"+"<img border='0'>"+"<xsl:attribute name=\"src\">"+"<xsl:value-of select=\"concat(//@image_directory,@image)\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">"+"<xsl:value-of select=\"concat('MARGIN-TOP:3','px;MARGIN-BOTTOM:0','px')\" />"+"</xsl:attribute>"+"</img>"+"</div>"+"</xsl:template>";
nitobi.ui.pagingToolbarXsl="<xsl:template match=\"//toolbar\">"+"<div style=\"z-index:800\">"+"<xsl:attribute name=\"id\">"+"<xsl:value-of select=\"@id\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">float:right;position:relative;"+"<xsl:value-of select=\"concat('height:',@height,'px')\" />"+"</xsl:attribute>"+"<xsl:apply-templates />"+"</div>"+"</xsl:template>"+nitobi.ui.RowCountXsl+nitobi.ui.ToolbarDivItemXsl+nitobi.ui.ButtonXsl+nitobi.ui.BinaryStateButtonXsl+nitobi.ui.InputXsl+"<xsl:template match=\"separator\">"+"<div align='center'>"+"<xsl:attribute name=\"style\">"+"<xsl:value-of select=\"concat('float:right;width:',@width,';height:',@height)\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"id\">"+"<xsl:value-of select=\"@id\" />"+"</xsl:attribute>"+"<img border='0'>"+"<xsl:attribute name=\"src\">"+"<xsl:value-of select=\"concat(//@image_directory,@image)\" />"+"</xsl:attribute>"+"<xsl:attribute name=\"style\">"+"<xsl:value-of select=\"concat('MARGIN-TOP:3','px;MARGIN-BOTTOM:0','px')\" />"+"</xsl:attribute>"+"</img>"+"</div>"+"</xsl:template>";
nitobi.ui.Toolbar=function(xml,id){
nitobi.ui.Toolbar.baseConstructor.call(this);
this.initialize(xml,nitobi.ui.ToolbarXsl,id);
};
nitobi.lang.extend(nitobi.ui.Toolbar,nitobi.ui.InteractiveUiElement);
nitobi.ui.Toolbar.prototype.getUiElements=function(){
return this.m_UiElements;
};
nitobi.ui.Toolbar.prototype.setUiElements=function(_862){
this.m_UiElements=_862;
};
nitobi.ui.Toolbar.prototype.attachButtonObjects=function(){
if(!this.m_UiElements){
this.m_UiElements=new Array();
var tag=this.getHtmlElementHandle();
var _864=tag.childNodes;
for(var i=0;i<_864.length;i++){
var _866=_864[i];
if(_866.nodeType!=3){
var _867;
switch(_866.className){
case ("ntb-button"):
_867=new nitobi.ui.Button(null,_866.id);
break;
case ("ntb-binarybutton"):
_867=new nitobi.ui.BinaryStateButton(null,_866.id);
break;
case ("ntb-inputtext"):
_867=new nitobi.ui.InputText(null,_866.id);
break;
case ("ntb-dropdown"):
_867=new nitobi.ui.DropDown(null,_866.id);
break;
default:
_867=new nitobi.ui.UiElement(null,null,_866.id);
break;
}
_867.attachToTag();
this.m_UiElements[_866.id]=_867;
}
}
}
};
nitobi.ui.Toolbar.prototype.render=function(_868){
nitobi.ui.Toolbar.base.base.render.call(this,_868);
this.attachButtonObjects();
};
nitobi.ui.Toolbar.prototype.disableAllElements=function(){
for(var i in this.m_UiElements){
if(this.m_UiElements[i].disable){
this.m_UiElements[i].disable();
}
}
};
nitobi.ui.Toolbar.prototype.enableAllElements=function(){
for(var i in this.m_UiElements){
if(this.m_UiElements[i].enable){
this.m_UiElements[i].enable();
}
}
};
nitobi.ui.Toolbar.prototype.attachToTag=function(){
nitobi.ui.Toolbar.base.base.attachToTag.call(this);
this.attachButtonObjects();
};
nitobi.ui.Toolbar.prototype.dispose=function(){
if(typeof (this.m_UiElements)!="undefined"){
for(var _86b in this.m_UiElements){
this.m_UiElements[_86b].dispose();
}
this.m_UiElements=null;
}
nitobi.ui.Toolbar.base.dispose.call(this);
};
if(typeof (nitobi)=="undefined"||typeof (nitobi.lang)=="undefined"){
alert("The Nitobi framework source could not be found. Is it included before any other Nitobi components?");
}
nitobi.prepare=function(){
};
nitobi.lang.defineNs("nitobi.calendar");
nitobi.calendar.Calendar=function(_86c){
nitobi.calendar.Calendar.baseConstructor.call(this,_86c);
this.selectedDate;
this.renderer=new nitobi.calendar.CalRenderer();
this.onHide=new nitobi.base.Event();
this.eventMap["hide"]=this.onHide;
this.onShow=new nitobi.base.Event();
this.eventMap["show"]=this.onShow;
this.onDateClicked=new nitobi.base.Event();
this.eventMap["dateclicked"]=this.onDateClicked;
this.onMonthChanged=new nitobi.base.Event();
this.eventMap["monthchanged"]=this.onMonthChanged;
this.onYearChanged=new nitobi.base.Event();
this.eventMap["yearchanged"]=this.onYearChanged;
this.onRenderComplete=new nitobi.base.Event();
this.onSetVisible.subscribe(this.handleToggle,this);
this.showEffect=(this.isEffectEnabled()?nitobi.effects.families["shade"].show:null);
this.hideEffect=(this.isEffectEnabled()?nitobi.effects.families["shade"].hide:null);
this.htmlEvents={"body":[],"nav":[],"navconfirm":[],"navcancel":[],"navpanel":[],"nextmonth":[],"prevmonth":[]};
this.subscribeDeclarationEvents();
};
nitobi.lang.extend(nitobi.calendar.Calendar,nitobi.ui.Element);
nitobi.calendar.Calendar.profile=new nitobi.base.Profile("nitobi.calendar.Calendar",null,false,"ntb:calendar");
nitobi.base.Registry.getInstance().register(nitobi.calendar.Calendar.profile);
nitobi.calendar.Calendar.prototype.render=function(){
this.detachEvents();
this.setContainer(this.getHtmlNode());
nitobi.calendar.Calendar.base.render.call(this);
this.selectedDate=this.getParentObject().getSelectedDate();
var he=this.htmlEvents;
var H=nitobi.html;
var _86f=this.getHtmlNode("body");
H.attachEvent(_86f,"click",this.handleBodyClick,this);
H.attachEvent(_86f,"mousedown",this.handleMouseDown,this);
he.body.push({type:"click",handler:this.handleBodyClick});
he.body.push({type:"mousedown",handle:this.handleMouseDown});
var nav=this.getHtmlNode("nav");
var _871=this.getHtmlNode("navconfirm");
var _872=this.getHtmlNode("navcancel");
H.attachEvent(nav,"click",this.showNav,this);
H.attachEvent(_872,"click",this.handleNavCancel,this);
H.attachEvent(_871,"click",this.handleNavConfirm,this);
H.attachEvent(this.getHtmlNode("navpanel"),"keypress",this.handleNavKey,this);
he.nav.push({type:"click",handler:this.showNav});
he.navcancel.push({type:"click",handler:this.handleNavCancel});
he.navconfirm.push({type:"click",handler:this.handleNavConfirm});
he.navpanel.push({type:"keypress",handler:this.handleNavKey});
H.attachEvent(this.getHtmlNode("nextmonth"),"click",this.nextMonth,this);
H.attachEvent(this.getHtmlNode("prevmonth"),"click",this.prevMonth,this);
he.nextmonth.push({type:"click",handler:this.nextMonth});
he.prevmonth.push({type:"click",handler:this.prevMonth});
var _873=this.getHtmlNode();
var shim=this.getHtmlNode("shim");
var Css=nitobi.html.Css;
if(shim){
var _876=Css.hasClass(_873,"nitobi-hide");
if(_876){
Css.removeClass(_873,"nitobi-hide");
_873.style.top="-1000px";
}
var _877=_873.offsetWidth;
var _878=_873.offsetHeight;
shim.style.height=_878+"px";
shim.style.width=_877-1+"px";
if(_876){
Css.addClass(_873,"nitobi-hide");
_873.style.top="";
}
}
this.onRenderComplete.notify(new nitobi.ui.ElementEventArgs(this,this.onRenderComplete));
};
nitobi.calendar.Calendar.prototype.detachEvents=function(){
var he=this.htmlEvents;
for(var name in he){
var _87b=he[name];
var node=this.getHtmlNode(name);
nitobi.html.detachEvents(node,_87b);
}
};
nitobi.calendar.Calendar.prototype.handleMouseDown=function(_87d){
var _87e=this.getParentObject();
var _87f=this.findActiveDate(_87d.srcElement);
if(_87f&&nitobi.html.Css.hasClass(_87f,"ntb-calendar-thismonth")){
_87e.blurInput=false;
}else{
_87e.blurInput=true;
}
};
nitobi.calendar.Calendar.prototype.handleBodyClick=function(_880){
var _881=this.findActiveDate(_880.srcElement);
if(!_881||nitobi.html.Css.hasClass(_881,"ntb-calendar-lastmonth")||nitobi.html.Css.hasClass(_881,"ntb-calendar-nextmonth")){
return;
}
var _882=this.getParentObject();
var day=_881.getAttribute("ebadate");
var _884=_881.getAttribute("ebamonth");
var year=_881.getAttribute("ebayear");
var date=new Date(year,_884,day);
var _887=_882.getEventsManager();
if(_887.isDisabled(date)){
return;
}
_882._setSelectedDate(date);
this.onDateClicked.notify(new nitobi.ui.ElementEventArgs(this,this.onDateClicked));
this.toggle();
};
nitobi.calendar.Calendar.prototype.handleNavKey=function(e){
var code=e.keyCode;
if(code==27){
this.handleNavCancel();
}
if(code==13){
this.handleNavConfirm();
}
};
nitobi.calendar.Calendar.prototype.handleToggleClick=function(e){
this.toggle();
};
nitobi.calendar.Calendar.prototype.clearHighlight=function(){
if(this.selectedDate){
var _88b=this.findDateElement(this.selectedDate);
if(_88b){
nitobi.html.Css.removeClass(_88b,"ntb-calendar-currentday");
}
this.selectedDate=null;
}
};
nitobi.calendar.Calendar.prototype.highlight=function(date){
this.selectedDate=date;
var _88d=this.findDateElement(date);
if(_88d){
nitobi.html.Css.addClass(_88d,"ntb-calendar-currentday");
}
};
nitobi.calendar.Calendar.prototype.findDateElement=function(date){
var _88f=this.getHtmlNode(date.getMonth()+"."+date.getFullYear());
var dm=nitobi.base.DateMath;
if(_88f){
var _891=dm.getMonthStart(dm.clone(date));
_891=dm.subtract(_891,"d",_891.getDay());
var days=dm.getNumberOfDays(_891,date)-1;
if(days>=0&&days<42){
var row=1+Math.floor(days/7);
var col=days%7;
var _895=nitobi.html.getFirstChild(_88f.rows[row].cells[col]);
return _895;
}
}
return null;
};
nitobi.calendar.Calendar.prototype.showNav=function(){
var _896=this.getParentObject();
var _897=_896.getStartDate();
var _898=this.getHtmlNode("months");
_898.selectedIndex=_897.getMonth();
this.getHtmlNode("year").value=_897.getFullYear();
this.getHtmlNode("warning").style.display="none";
var _899=this.getHtmlNode("overlay");
var _89a=this.getHtmlNode("navpanel");
var _89b=new nitobi.effects.BlindDown(_89a,{duration:0.3});
var _89c=this.getHtmlNode("nav");
this.fitOverlay();
_899.style.display="block";
var D=nitobi.drawing;
D.align(_89a,_89c,D.align.ALIGNMIDDLEHORIZ);
D.align(_89a,this.getHtmlNode("body"),D.align.ALIGNTOP);
D.align(_899,this.getHtmlNode("body"),D.align.ALIGNTOP|D.align.ALIGNLEFT);
_89b.callback=function(){
_898.focus();
};
_89b.start();
};
nitobi.calendar.Calendar.prototype.hideNav=function(_89e){
var _89f=this.getHtmlNode("navpanel");
var _8a0=new nitobi.effects.BlindUp(_89f,{duration:0.2});
_8a0.callback=_89e||nitobi.lang.noop();
_8a0.start();
};
nitobi.calendar.Calendar.prototype.hideOverlay=function(){
var _8a1=this.getHtmlNode("overlay");
_8a1.style.display="none";
};
nitobi.calendar.Calendar.prototype.fitOverlay=function(){
var _8a2=this.getHtmlNode("body");
var _8a3=this.getHtmlNode("overlay");
var _8a4=_8a2.offsetWidth;
var _8a5=_8a2.offsetHeight;
_8a3.style.height=_8a5+"px";
_8a3.style.width=_8a4+"px";
};
nitobi.calendar.Calendar.prototype.handleNavConfirm=function(_8a6){
var _8a7=this.getParentObject();
var _8a8=this.getHtmlNode("months");
var _8a9=_8a8.options[_8a8.selectedIndex].value;
var year=this.getHtmlNode("year").value;
if(isNaN(year)){
var _8ab=this.getHtmlNode("warning");
_8ab.style.display="block";
_8ab.innerHTML=_8a7.getNavInvalidYearText();
return;
}
year=parseInt(year);
var _8ac=new Date(year,_8a9,1);
if(_8a7.isOutOfRange(_8ac)){
var _8ab=this.getHtmlNode("warning");
_8ab.style.display="block";
_8ab.innerHTML=_8a7.getNavOutOfRangeText();
return;
}
var _8ad=_8a7.getStartDate();
var _8ae=false;
var _8af=false;
if(year!=_8ad.getFullYear()){
_8af=true;
}
if(parseInt(_8a9)!=_8ad.getMonth()){
_8ae=true;
}
_8a7.setStartDate(_8ac);
var _8b0=nitobi.lang.close(this,this.render);
this.onRenderComplete.subscribeOnce(nitobi.lang.close(this,function(){
if(_8ae){
this.onMonthChanged.notify(new nitobi.ui.ElementEventArgs(this,this.onMonthChanged));
}
if(_8af){
this.onYearChanged.notify(new nitobi.ui.ElementEventArgs(this,this.onYearChanged));
}
}));
this.hideNav(_8b0);
};
nitobi.calendar.Calendar.prototype.handleNavCancel=function(_8b1){
var _8b2=nitobi.lang.close(this,this.hideOverlay);
this.hideNav(_8b2);
};
nitobi.calendar.Calendar.prototype.findActiveDate=function(_8b3){
var _8b4=5;
for(var i=0;i<_8b4&&_8b3.getAttribute;i++){
var t=_8b3.getAttribute("ebatype");
if(t=="date"){
return _8b3;
}
_8b3=_8b3.parentNode;
}
return null;
};
nitobi.calendar.Calendar.prototype.getState=function(){
return this;
};
nitobi.calendar.Calendar.prototype.nextMonth=function(){
var _8b7=this.getParentObject();
if(!_8b7.disNext){
var _8b8=this.getMonthColumns()*this.getMonthRows();
this.changeMonth(_8b8);
}
};
nitobi.calendar.Calendar.prototype.prevMonth=function(){
if(!this.getParentObject().disPrev){
var _8b9=this.getMonthColumns()*this.getMonthRows();
this.changeMonth(0-_8b9);
}
};
nitobi.calendar.Calendar.prototype.changeMonth=function(unit){
var _8bb=this.getParentObject();
var date=_8bb.getStartDate();
var dm=nitobi.base.DateMath;
date=dm._add(dm.clone(date),"m",unit);
var _8be=_8bb.getStartDate();
var _8bf=false;
if(_8be.getFullYear()!=date.getFullYear()){
_8bf=true;
}
_8bb.setStartDate(date);
this.render();
this.onMonthChanged.notify(new nitobi.ui.ElementEventArgs(this,this.onMonthChanged));
if(_8bf){
this.onYearChanged.notify(new nitobi.ui.ElementEventArgs(this,this.onYearChanged));
}
};
nitobi.calendar.Calendar.prototype.toggle=function(_8c0){
var _8c1=this.getParentObject();
if(_8c1.getInput()){
this.setVisible(!this.isVisible(),(this.isVisible()?this.hideEffect:this.showEffect),_8c0,{duration:0.3});
}
};
nitobi.calendar.Calendar.prototype.show=function(_8c2){
var _8c3=this.getParentObject();
if(_8c3.getInput()){
this.setVisible(true,this.showEffect,_8c2,{duration:0.3});
}
};
nitobi.calendar.Calendar.prototype.hide=function(_8c4){
var _8c5=this.getParentObject();
if(_8c5.getInput()){
this.setVisible(false,this.hideEffect,_8c4,{duration:0.3});
}
};
nitobi.calendar.Calendar.prototype.handleToggle=function(){
if(this.isVisible()){
this.onShow.notify(new nitobi.ui.ElementEventArgs(this,this.onShow));
}else{
this.onHide.notify(new nitobi.ui.ElementEventArgs(this,this.onHide));
}
};
nitobi.calendar.Calendar.prototype.getMonthColumns=function(){
return this.getIntAttribute("monthcolumns",1);
};
nitobi.calendar.Calendar.prototype.setMonthColumns=function(_8c6){
this.setAttribute("monthcolumns",_8c6);
};
nitobi.calendar.Calendar.prototype.getMonthRows=function(){
return this.getIntAttribute("monthrows",1);
};
nitobi.calendar.Calendar.prototype.setMonthRows=function(rows){
this.setAttribute("monthrows",rows);
};
nitobi.calendar.Calendar.prototype.isEffectEnabled=function(){
return this.getBoolAttribute("effectenabled",true);
};
nitobi.calendar.Calendar.prototype.setEffectEnabled=function(_8c8){
this.setAttribute("effectenabled",isEffectEnabled);
};
nitobi.lang.defineNs("nitobi.calendar");
if(false){
nitobi.calendar={};
}
nitobi.calendar.DatePicker=function(id){
nitobi.calendar.DatePicker.baseConstructor.call(this,id);
this.renderer.setTemplate(nitobi.calendar.datePickerTemplate);
this.blurInput=true;
this.onDateSelected=new nitobi.base.Event();
this.eventMap["dateselected"]=this.onDateSelected;
this.onSetInvalidDate=new nitobi.base.Event();
this.eventMap["setinvaliddate"]=this.onSetInvalidDate;
this.onSetDisabledDate=new nitobi.base.Event();
this.eventMap["setdisableddate"]=this.onSetDisabledDate;
this.onSetOutOfRangeDate=new nitobi.base.Event();
this.eventMap["setoutofrangedate"]=this.onSetOutOfRangeDate;
this.onEventDateSelected=new nitobi.base.Event();
this.eventMap["eventdateselected"]=this.onEventDateSelected;
this.eventsManager=new nitobi.calendar.EventsManager(this.getEventsUrl());
this.eventsManager.onDataReady.subscribe(this.renderChildren,this);
var _8ca=this.getSelectedDate();
if(_8ca&&!this.isOutOfRange(_8ca)&&!nitobi.base.DateMath.invalid(_8ca)){
this.setStartDate(nitobi.base.DateMath.getMonthStart(_8ca));
}else{
this.setDateAttribute("selecteddate",null);
var _8cb=this.getMinDate();
var _8cc;
if(_8cb){
_8cc=_8cb;
}else{
_8cc=new Date();
}
this.setStartDate(nitobi.base.DateMath.getMonthStart(_8cc));
}
this.subscribeDeclarationEvents();
};
nitobi.lang.extend(nitobi.calendar.DatePicker,nitobi.ui.Element);
nitobi.base.Registry.getInstance().register(new nitobi.base.Profile("nitobi.calendar.DatePicker",null,false,"ntb:datepicker"));
nitobi.calendar.DatePicker.prototype.render=function(){
var _8cd=this.getInput();
if(_8cd){
_8cd.detachEvents();
}
nitobi.calendar.DatePicker.base.render.call(this);
if(_8cd){
_8cd.attachEvents();
}
if(nitobi.browser.IE&&_8cd){
var _8ce=_8cd.getHtmlNode("input");
var _8cf=nitobi.html.Css.getStyle(_8ce,"height");
nitobi.html.Css.setStyle(_8ce,"height",parseInt(_8cf)-2+"px");
}
if(this.eventsManager){
this.eventsManager.getFromServer();
}else{
this.renderChildren();
}
};
nitobi.calendar.DatePicker.prototype.renderChildren=function(){
var cal=this.getCalendar();
var _8d1=this.getInput();
if(cal){
cal.render();
if(!_8d1){
var C=nitobi.html.Css;
var _8d3=cal.getHtmlNode();
var body=cal.getHtmlNode("body");
C.swapClass(_8d3,"nitobi-hide",NTB_CSS_SMALL);
cal.getHtmlNode().style.width=body.offsetWidth+"px";
C.removeClass(_8d3,NTB_CSS_SMALL);
}
}
if(this.getSelectedDate()&&_8d1){
_8d1.setValue(this.formatDate(this.getSelectedDate(),_8d1.getDisplayMask()));
}
if(this.getSelectedDate()){
var _8d5=this.getHtmlNode("value");
if(_8d5){
_8d5.value=this.formatDate(this.getSelectedDate(),this.getSubmitMask());
}
}
this.enableButton();
};
nitobi.calendar.DatePicker.prototype.getCalendar=function(){
return this.getObject(nitobi.calendar.Calendar.profile);
};
nitobi.calendar.DatePicker.prototype.getInput=function(){
return this.getObject(nitobi.calendar.DateInput.profile);
};
nitobi.calendar.DatePicker.prototype.getSelectedDate=function(){
return this.getDateAttr("selecteddate");
};
nitobi.calendar.DatePicker.prototype.getDateAttr=function(attr){
var _8d7=this.getAttribute(attr,null);
if(_8d7){
if(typeof (_8d7)=="string"){
return this.parseLanguage(_8d7);
}else{
return new Date(_8d7);
}
}
return null;
};
nitobi.calendar.DatePicker.prototype.setSelectedDate=function(date){
if(typeof (date)!="object"){
date=new Date(date);
}
if(this.validate(date)){
this._setSelectedDate(date);
}
};
nitobi.calendar.DatePicker.prototype._setSelectedDate=function(date,_8da){
this.setDateAttribute("selecteddate",date);
var _8db=this.getHtmlNode("value");
if(_8db){
_8db.value=this.formatDate(date,this.getSubmitMask());
}
var _8dc=this.getInput();
if(_8dc){
var _8dd=_8dc.getDisplayMask();
var _8de=this.formatDate(date,_8dd);
_8dc.setValue(_8de);
_8dc.setInvalidStyle(false);
}
var _8df=this.getCalendar();
if(_8df){
_8df.clearHighlight(date);
var dm=nitobi.base.DateMath;
var _8e1=dm.getMonthStart(this.getStartDate());
var _8e2=_8df.getMonthColumns()*_8df.getMonthRows()-1;
var _8e3=dm.getMonthEnd(dm.add(dm.clone(_8e1),"m",_8e2));
if(dm.between(date,_8e1,_8e3)){
_8df.highlight(date);
}
if(_8da){
this.setStartDate(dm.getMonthStart(dm.clone(date)));
_8df.render();
}
}
var _8e4=this.getEventsManager();
if(_8e4.isEvent(date)){
var _8e1=_8e4.eventsCache[date.valueOf()];
var _8e5=this.eventsManager.getEventInfo(_8e1);
this.onEventDateSelected.notify({events:_8e5});
}
this.onDateSelected.notify(new nitobi.ui.ElementEventArgs(this,this.onDateSelected));
};
nitobi.calendar.DatePicker.prototype.validate=function(_8e6){
var E=nitobi.ui.ElementEventArgs;
if(nitobi.base.DateMath.invalid(_8e6)){
this.onSetInvalidDate.notify(new E(this,this.onSetInvalidDate));
return false;
}
if(this.isOutOfRange(_8e6)){
this.onSetOutOfRangeDate.notify(new E(this,this.onSetOutOfRangeDate));
return false;
}
if(this.isDisabled(_8e6)){
this.onSetDisabledDate.notify(new E(this,this.onSetDisabledDate));
return false;
}
return true;
};
nitobi.calendar.DatePicker.prototype.isDisabled=function(date){
return this.getEventsManager().isDisabled(date);
};
nitobi.calendar.DatePicker.prototype.disableButton=function(){
var _8e9=this.getHtmlNode("button");
var cal=this.getCalendar();
if(_8e9){
nitobi.html.Css.swapClass(_8e9,"ntb-calendar-button","ntb-calendar-button-disabled");
nitobi.html.detachEvent(_8e9,"click",cal.handleToggleClick,cal);
}
};
nitobi.calendar.DatePicker.prototype.enableButton=function(){
var _8eb=this.getHtmlNode("button");
var cal=this.getCalendar();
if(_8eb){
nitobi.html.Css.swapClass(_8eb,"ntb-calendar-button-disabled","ntb-calendar-button");
nitobi.html.attachEvent(_8eb,"click",cal.handleToggleClick,cal);
}
};
nitobi.calendar.DatePicker.prototype.isOutOfRange=function(date){
var dm=nitobi.base.DateMath;
var _8ef=this.getMinDate();
var _8f0=this.getMaxDate();
var _8f1=false;
if(_8ef&&_8f0){
_8f1=!dm.between(date,_8ef,_8f0);
}else{
if(_8ef&&_8f0==null){
_8f1=dm.before(date,_8ef);
}else{
if(_8ef==null&&_8f0){
_8f1=dm.after(date,_8f0);
}
}
}
return _8f1;
};
nitobi.calendar.DatePicker.prototype.clear=function(){
var _8f2=this.getHtmlNode("value");
if(_8f2){
_8f2.value="";
}
this.setDateAttribute("selecteddate",null);
};
nitobi.calendar.DatePicker.prototype.getTheme=function(){
return this.getAttribute("theme","");
};
nitobi.calendar.DatePicker.prototype.getSubmitMask=function(){
return this.getAttribute("submitmask","yyyy-MM-dd");
};
nitobi.calendar.DatePicker.prototype.setSubmitMask=function(mask){
this.setAttribute("submitmask",mask);
};
nitobi.calendar.DatePicker.prototype.getStartDate=function(){
return this.getDateAttribute("startdate");
};
nitobi.calendar.DatePicker.prototype.setStartDate=function(date){
this.setDateAttribute("startdate",date);
};
nitobi.calendar.DatePicker.prototype.getEventsUrl=function(){
return this.getAttribute("eventsurl","");
};
nitobi.calendar.DatePicker.prototype.setEventsUrl=function(url){
this.setAttribute("eventsurl",url);
};
nitobi.calendar.DatePicker.prototype.getEventsManager=function(){
return this.eventsManager;
};
nitobi.calendar.DatePicker.prototype.isShimEnabled=function(){
return this.getBoolAttribute("shimenabled",false);
};
nitobi.calendar.DatePicker.prototype.getMinDate=function(){
return this.getDateAttr("mindate");
};
nitobi.calendar.DatePicker.prototype.setMinDate=function(_8f6){
this.setAttribute("mindate",_8f6);
};
nitobi.calendar.DatePicker.prototype.getMaxDate=function(){
return this.getDateAttr("maxdate");
};
nitobi.calendar.DatePicker.prototype.setMaxDate=function(_8f7){
this.setAttribute("maxdate",_8f7);
};
nitobi.calendar.DatePicker.prototype.parseLanguage=function(date){
var dm=nitobi.base.DateMath;
var _8fa=Date.parse(date);
if(_8fa&&typeof (_8fa)=="object"&&!isNaN(_8fa)&&!dm.invalid(_8fa)){
return _8fa;
}
if(date==""||date==null){
return null;
}
date=date.toLowerCase();
var _8fb=dm.resetTime(new Date());
switch(date){
case "today":
date=_8fb;
break;
case "tomorrow":
date=dm.add(_8fb,"d",1);
break;
case "yesterday":
date=dm.subtract(_8fb,"d",1);
break;
case "last week":
date=dm.subtract(_8fb,"d",7);
break;
case "next week":
date=dm.add(_8fb,"d",7);
break;
case "last year":
date=dm.subtract(_8fb,"y",1);
break;
case "last month":
date=dm.subtract(_8fb,"m",1);
break;
case "next month":
date=dm.add(_8fb,"m",1);
break;
case "next year":
date=dm.add(_8fb,"y",1);
break;
default:
date=dm.resetTime(new Date(date));
break;
}
if(dm.invalid(date)){
return null;
}else{
return date;
}
};
nitobi.calendar.DatePicker.longDayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
nitobi.calendar.DatePicker.shortDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
nitobi.calendar.DatePicker.minDayNames=["S","M","T","W","T","F","S"];
nitobi.calendar.DatePicker.longMonthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];
nitobi.calendar.DatePicker.shortMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
nitobi.calendar.DatePicker.navConfirmText="OK";
nitobi.calendar.DatePicker.navCancelText="Cancel";
nitobi.calendar.DatePicker.navOutOfRangeText="That date is out of range.";
nitobi.calendar.DatePicker.navInvalidYearText="You must enter a valid year.";
nitobi.calendar.DatePicker.quickNavTooltip="Click to change month and/or year";
nitobi.calendar.DatePicker.navSelectMonthText="Choose Month";
nitobi.calendar.DatePicker.navSelectYearText="Enter Year";
nitobi.calendar.DatePicker.prototype.getQuickNavTooltip=function(){
return this.initLocaleAttr("quickNavTooltip");
};
nitobi.calendar.DatePicker.prototype.getMinDayNames=function(){
return this.initJsAttr("minDayNames");
};
nitobi.calendar.DatePicker.prototype.getLongDayNames=function(){
return this.initJsAttr("longDayNames");
};
nitobi.calendar.DatePicker.prototype.getShortDayNames=function(){
return this.initJsAttr("shortDayNames");
};
nitobi.calendar.DatePicker.prototype.getLongMonthNames=function(){
return this.initJsAttr("longMonthNames");
};
nitobi.calendar.DatePicker.prototype.getShortMonthNames=function(){
return this.initJsAttr("shortMonthNames");
};
nitobi.calendar.DatePicker.prototype.getNavConfirmText=function(){
return this.initLocaleAttr("navConfirmText");
};
nitobi.calendar.DatePicker.prototype.getNavCancelText=function(){
return this.initLocaleAttr("navCancelText");
};
nitobi.calendar.DatePicker.prototype.getNavOutOfRangeText=function(){
return this.initLocaleAttr("navOutOfRangeText");
};
nitobi.calendar.DatePicker.prototype.getNavInvalidYearText=function(){
return this.initLocaleAttr("navInvalidYearText");
};
nitobi.calendar.DatePicker.prototype.getNavSelectMonthText=function(){
return this.initLocaleAttr("navSelectMonthText");
};
nitobi.calendar.DatePicker.prototype.getNavSelectYearText=function(){
return this.initLocaleAttr("navSelectYearText");
};
nitobi.calendar.DatePicker.prototype.initJsAttr=function(_8fc){
if(this[_8fc]){
return this[_8fc];
}
var attr=this.getAttribute(_8fc.toLowerCase(),"");
if(attr!=""){
attr=eval("("+attr+")");
return this[_8fc]=attr;
}
return this[_8fc]=nitobi.calendar.DatePicker[_8fc];
};
nitobi.calendar.DatePicker.prototype.initLocaleAttr=function(_8fe){
if(this[_8fe]){
return this[_8fe];
}
var text=this.getAttribute(_8fe.toLowerCase(),"");
if(text!=""){
return this[_8fe]=text;
}else{
return this[_8fe]=nitobi.calendar.DatePicker[_8fe];
}
};
nitobi.calendar.DatePicker.prototype.parseDate=function(date,mask){
var _902={};
while(mask.length>0){
var c=mask.charAt(0);
var _904=new RegExp(c+"+");
var _905=_904.exec(mask)[0];
if(c!="d"&&c!="y"&&c!="M"&&c!="N"&&c!="E"){
mask=mask.substring(_905.length);
date=date.substring(_905.length);
}else{
var _906=mask.charAt(_905.length);
var _907=(_906==""?date:date.substring(0,date.indexOf(_906)));
var _908=this.validateFormat(_907,_905);
if(_908.valid){
_902[_908.unit]=_908.value;
}else{
return null;
}
mask=mask.substring(_905.length);
date=date.substring(_907.length);
}
}
var date=new Date(_902.y,_902.m,_902.d);
return date;
};
nitobi.calendar.DatePicker.prototype.validateFormat=function(_909,_90a){
var _90b={valid:false,unit:"",value:""};
switch(_90a){
case "d":
case "dd":
var _90c=parseInt(_909);
var _90d;
if(_90a=="d"){
_90d=!isNaN(_909)&&_909.charAt(0)!="0"&&_909.length<=2;
}else{
_90d=!isNaN(_909)&&_909.length==2;
}
if(_90d){
_90b.valid=true;
_90b.unit="d";
_90b.value=_909;
}else{
_90b.valid=false;
}
break;
case "y":
case "yyyy":
if(isNaN(_909)){
_90b.valid=false;
}else{
_90b.valid=true;
_90b.unit="y";
_90b.value=_909;
}
break;
case "M":
case "MM":
var _90c=parseInt(_909,10);
var _90d;
if(_90a=="M"){
_90d=!isNaN(_909)&&_909.charAt(0)!="0"&&_909.length<=2&&_90c>=1&&_90c<=12;
}else{
_90d=!isNaN(_909)&_909.length==2&&_90c>=1&&_90c<=12;
}
if(_90d){
_90b.valid=true;
_90b.unit="m";
_90b.value=_90c-1;
}else{
_90b.valid=false;
}
break;
case "MMM":
case "NNN":
case "E":
case "EE":
var _90e;
if(_90a=="MMM"){
_90e=this.getLongMonthNames();
}else{
if(_90a=="NNN"){
_90e=this.getShortMonthNames();
}else{
if(_90a=="E"){
_90e=this.getShortDayNames();
}else{
_90e=this.getLongDayNames();
}
}
}
var i;
for(i=0;i<_90e.length;i++){
var _910=_90e[i];
if(_909.toLowerCase()==_910.toLowerCase()){
break;
}
}
if(i<_90e.length){
_90b.valid=true;
if(_90a=="MMM"||_90a=="NNN"){
_90b.unit="m";
}else{
_90b.unit="dl";
}
_90b.value=i;
}else{
_90b.valid=false;
}
break;
}
return _90b;
};
nitobi.calendar.DatePicker.prototype.formatDate=function(date,mask){
var _913={};
var year=date.getFullYear()+"";
var _915=date.getMonth()+1+"";
var _916=date.getDate()+"";
var day=date.getDay();
_913["y"]=_913["yyyy"]=year;
_913["yy"]=year.substring(2,4);
_913["M"]=_915+"";
_913["MM"]=nitobi.lang.padZeros(_915,2);
_913["MMM"]=this.getLongMonthNames()[_915-1];
_913["NNN"]=this.getShortMonthNames()[_915-1];
_913["d"]=_916;
_913["dd"]=nitobi.lang.padZeros(_916,2);
_913["EE"]=this.getLongDayNames()[day];
_913["E"]=this.getShortDayNames()[day];
var _918="";
while(mask.length>0){
var c=mask.charAt(0);
var _91a=new RegExp(c+"+");
var _91b=_91a.exec(mask)[0];
_918+=_913[_91b]||_91b;
mask=mask.substring(_91b.length);
}
return _918;
};
nitobi.lang.defineNs("nitobi.calendar");
nitobi.calendar.DateInput=function(_91c){
nitobi.calendar.DateInput.baseConstructor.call(this,_91c);
this.onBlur=new nitobi.base.Event();
this.eventMap["blur"]=this.onBlur;
this.onFocus=new nitobi.base.Event();
this.eventMap["focus"]=this.onFocus;
this.htmlEvents=[];
this.subscribeDeclarationEvents();
};
nitobi.lang.extend(nitobi.calendar.DateInput,nitobi.ui.Element);
nitobi.calendar.DateInput.profile=new nitobi.base.Profile("nitobi.calendar.DateInput",null,false,"ntb:dateinput");
nitobi.base.Registry.getInstance().register(nitobi.calendar.DateInput.profile);
nitobi.calendar.DateInput.prototype.attachEvents=function(){
var he=this.htmlEvents;
he.push({type:"focus",handler:this.handleOnFocus});
he.push({type:"blur",handler:this.handleOnBlur});
he.push({type:"keydown",handler:this.handleOnKeyDown});
nitobi.html.attachEvents(this.getHtmlNode("input"),he,this);
};
nitobi.calendar.DateInput.prototype.detachEvents=function(){
nitobi.html.detachEvents(this.getHtmlNode("input"),this.htmlEvents);
};
nitobi.calendar.DateInput.prototype.setValue=function(_91e){
var _91f=this.getHtmlNode("input");
_91f.value=_91e;
};
nitobi.calendar.DateInput.prototype.getValue=function(){
var _920=this.getHtmlNode("input");
return _920.value;
};
nitobi.calendar.DateInput.prototype.handleOnFocus=function(){
var _921=this.getEditMask();
var _922=this.getParentObject();
var _923=_922.getSelectedDate();
if(_923){
var _924=_922.formatDate(_923,_921);
this.setValue(_924);
var _922=this.getParentObject();
_922.blurInput=true;
}
this.onFocus.notify(new nitobi.ui.ElementEventArgs(this,this.onFocus));
};
nitobi.calendar.DateInput.prototype.handleOnBlur=function(){
var _925=this.getParentObject();
var _926=_925.getCalendar();
if(_925.blurInput){
var _927=this.getEditMask();
var _928=this.getValue();
_928=_925.parseDate(_928,_927);
if(_925.validate(_928)){
_925._setSelectedDate(_928,true);
if(_926){
_926.hide();
}
}else{
if(_926){
_926.clearHighlight();
}
_925.clear();
this.setInvalidStyle(true);
}
}
this.onBlur.notify(new nitobi.ui.ElementEventArgs(this,this.onBlur));
};
nitobi.calendar.DateInput.prototype.handleOnKeyDown=function(_929){
var key=_929.keyCode;
if(key==13){
this.getHtmlNode("input").blur();
}
};
nitobi.calendar.DateInput.prototype.setInvalidStyle=function(_92b){
var Css=nitobi.html.Css;
var _92d=this.getHtmlNode("container");
if(_92b){
Css.swapClass(_92d,"ntb-inputcontainer","ntb-invalid");
}else{
Css.swapClass(this.getHtmlNode("container"),"ntb-invalid","ntb-inputcontainer");
}
var _92e=Css.getStyle(_92d,"backgroundColor");
var _92f=this.getHtmlNode("input");
Css.setStyle(_92f,"backgroundColor",_92e);
};
nitobi.calendar.DateInput.prototype.getEditMask=function(){
return this.getAttribute("editmask",this.getDisplayMask());
};
nitobi.calendar.DateInput.prototype.setEditMask=function(mask){
this.setAttribute("editmask",mask);
};
nitobi.calendar.DateInput.prototype.getDisplayMask=function(){
return this.getAttribute("displaymask","MMM dd yyyy");
};
nitobi.calendar.DateInput.prototype.setDisplayMask=function(mask){
this.setAttribute("displaymask",mask);
};
nitobi.calendar.DateInput.prototype.isEditable=function(){
this.getBoolAttribute("editable",true);
};
nitobi.calendar.DateInput.prototype.setEditable=function(dis){
this.setBoolAttribute("editable",dis);
this.getHtmlNode("input").disabled=dis;
};
nitobi.calendar.DateInput.prototype.getWidth=function(){
this.getIntAttribute("width");
};
nitobi.calendar.DateInput.prototype.setWidth=function(_933){
this.setAttribute("width",_933);
};
nitobi.lang.defineNs("nitobi.calendar");
nitobi.calendar.CalRenderer=function(){
nitobi.html.IRenderer.call(this);
};
nitobi.lang.implement(nitobi.calendar.CalRenderer,nitobi.html.IRenderer);
nitobi.calendar.CalRenderer.prototype.renderToString=function(_934){
var _935=_934.getParentObject();
var _936=_935.getEventsManager();
var dm=nitobi.base.DateMath;
var sb=new nitobi.lang.StringBuilder();
var id=_934.getId();
var _93a=_934.getMonthColumns();
var _93b=_934.getMonthRows();
var _93c=_93a>1||_93b>1;
var _93d=dm.resetTime(dm.clone(_935.getStartDate()));
var _93e=_935.getSelectedDate();
if(_93e!=null){
_93e=dm.resetTime(_935.getSelectedDate());
}
var _93f=dm.resetTime(new Date());
var _940=_935.getMinDate();
var _941=_935.getMaxDate();
var _942=dm.subtract(dm.clone(_93d),"d",1);
var _943=dm.add(dm.clone(_93d),"m",_93a*_93b);
_935.disPrev=(_940&&dm.before(_942,_940)?true:false);
_935.disNext=(_941&&dm.after(_943,_941)?true:false);
var _944=_935.getLongMonthNames();
var _945=_935.getLongDayNames();
var _946=_935.getMinDayNames();
var _947=_935.getQuickNavTooltip();
var _948=(((nitobi.browser.MOZ&&!document.getElementsByClassName&&navigator.platform.indexOf("Mac")>=0)||nitobi.browser.IE6)&&_935.isShimEnabled())?true:false;
if(_948){
sb.append("<iframe id=\""+id+".shim\" style='position:absolute;top:0px;z-index:19999;'><!-- dummy --></iframe>");
}
sb.append("<div id=\""+id+".calendar\" style=\""+(_948?"position:relative;z-index:20000;":"")+"\">");
sb.append("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>");
if(_93c){
sb.append("<tr id=\""+id+".header\"><td>");
var _949=_944[_93d.getMonth()];
var _94a=_93d.getFullYear();
var _94b=dm.add(dm.clone(_93d),"m",(_93a*_93b)-1);
var _94c=_944[_94b.getMonth()];
var _94d=_94b.getFullYear();
sb.append("<div class=\"ntb-calendar-header\">");
sb.append("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"height:100%;width:100%;\"><tbody>");
sb.append("<tr><td><a id=\""+id+".prevmonth\" onclick=\"return false;\" href=\"#\" class=\"ntb-calendar-prev"+(_935.disPrev?" ntb-calendar-prevdis":"")+"\"></a</td>");
sb.append("<td style=\"width:70%;\"><span class=\"ntb-calendar-title\" title=\""+_947+"\" id=\""+id+".nav\">"+_949+" "+_94a+" - "+_94c+" "+_94d+"</span></td>");
sb.append("<td><a id=\""+id+".nextmonth\" onclick=\"return false;\" href=\"#\" class=\"ntb-calendar-next"+(_935.disNext?" ntb-calendar-nextdis":"")+"\"></a></td></tr>");
sb.append("</tbody></table></div></td></tr>");
}
sb.append("<tr id=\""+id+".body\"><td>");
sb.append("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>");
for(var i=0;i<_93b;i++){
sb.append("<tr>");
for(var j=0;j<_93a;j++){
var _950=dm.subtract(dm.clone(_93d),"d",_93d.getDay());
var _951=_93d.getMonth();
var _952=_93d.getFullYear();
sb.append("<td>");
sb.append("<div class=\"ntb-calendar\">");
sb.append("<div><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"width:100%;\"><tbody>");
sb.append("<tr class=\"ntb-calendar-monthheader\">");
if(!_93c){
sb.append("<td><a id=\""+id+".prevmonth\" onclick=\"return false;\" href=\"#\" class=\"ntb-calendar-prev"+(_935.disPrev?" ntb-calendar-prevdis":"")+"\"></a></td>");
}
sb.append("<td style=\"width:70%;\"><span title=\""+_947+"\" "+(!_93c?"id=\""+id+".nav\"":"")+"><a onclick=\"return false;\" href=\"#\" style=\""+(_93c?"cursor:default;":"")+"\" class=\"ntb-calendar-month\">"+_944[_951]+"</a>");
sb.append("<a onclick=\"return false;\" href=\"#\" style=\""+(_93c?"cursor:default;":"")+"\" class=\"ntb-calendar-year\">"+" "+_952+"</a></span></td>");
if(!_93c){
sb.append("<td><a id=\""+id+".nextmonth\" onclick=\"return false;\" href=\"#\" class=\"ntb-calendar-next"+(_935.disNext?" ntb-calendar-nextdis":"")+"\"></a></td>");
}
sb.append("</tbody></table></div>");
sb.append("<div><table id=\""+id+"."+_951+"."+_952+"\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"width: 100%;\"><tbody>");
sb.append("<tr>");
for(var k=0;k<7;k++){
sb.append("<th class=\"ntb-calendar-dayheader\">"+_946[k]+"</th>");
}
sb.append("</tr>");
for(var m=0;m<6;m++){
sb.append("<tr>");
for(var n=0;n<7;n++){
sb.append("<td>");
var _956=_945[_950.getDay()]+", "+_944[_950.getMonth()]+" "+_950.getDate()+", "+_950.getFullYear();
var _957=null;
var _958="";
if(_936&&_950.getMonth()==_93d.getMonth()){
var _957=_936.dates.events[_950.valueOf()];
if(_957!=null){
var nt="";
for(var p=0;p<_957.length;p++){
if(_957[p].tooltip!=null){
nt+=_957[p].tooltip+"\n";
}else{
if(_957[p].location!=null){
nt+=_957[p].location+"\n";
if(_957[p].description!=null){
nt+=_957[p].description;
}
}
}
if(_957[p].cssStyle!=null){
_958+=_957[p].cssStyle;
}
}
if(nt.length!=0){
_956=nt;
}
}
}
sb.append("<a ebatype=\"date\" ebamonth=\""+_950.getMonth()+"\" ebadate=\""+_950.getDate()+"\" ebayear=\""+_950.getFullYear()+"\" title=\""+_956+"\" href=\"#\" onclick=\"return false;\" style=\"display:block;text-decoration:none;"+_958+"\" class=\"");
if(_93e&&_950.valueOf()==_93e.valueOf()&&_950.getMonth()==_93d.getMonth()){
sb.append("ntb-calendar-currentday ");
}
if(_950.getMonth()<_93d.getMonth()||(_940&&_950.valueOf()<_940.valueOf())){
sb.append("ntb-calendar-lastmonth ");
}else{
if(_950.getMonth()>_93d.getMonth()||(_941&&_950.valueOf()>_941.valueOf())){
sb.append("ntb-calendar-nextmonth ");
}else{
if(_950.getMonth()==_93d.getMonth()){
sb.append("ntb-calendar-thismonth ");
}
}
}
if(_936&&_936.isDisabled(_950)&&_950.getMonth()==_93d.getMonth()){
sb.append("ntb-calendar-disabled ");
}else{
if(_936&&_936.isEvent(_950)&&_950.getMonth()==_93d.getMonth()){
sb.append("ntb-calendar-event ");
}
}
if(_93f.valueOf()==_950.valueOf()){
sb.append("ntb-calendar-today");
}
sb.append(" ntb-calendar-day");
if(_957!=null){
for(var p=0;p<_957.length;p++){
if(_957[p].cssClass!=null){
sb.append(" "+_957[p].cssClass+" ");
}
}
}
sb.append("\">"+_950.getDate()+"</a></td>");
_950=dm.add(_950,"d",1);
}
sb.append("</tr>");
}
sb.append("</tbody></table></div></div></td>");
_93d=dm.resetTime(dm.add(_93d,"m",1));
}
sb.append("</tr>");
}
sb.append("</tbody></table></td></tr></tbody></table></div></div>");
sb.append("</tbody><colgroup span=\"7\" style=\"width:17%\"></colgroup></table></div>");
sb.append("<div id=\""+id+".overlay\" class=\"ntb-calendar-overlay\" style=\""+(_948?"z-index:20001;":"")+"top:0px;left:0px;display:none;position:absolute;background-color:gray;filter:alpha(opacity=40);-moz-opacity:.50;opacity:.50;\"></div>");
sb.append(this.renderNavPanel(_934));
sb.append("</div></div>");
return sb.toString();
};
nitobi.calendar.CalRenderer.prototype.renderNavPanel=function(_95b){
var sb=new nitobi.lang.StringBuilder();
var _95d=_95b.getParentObject();
var _95e=_95d.getLongMonthNames();
var id=_95b.getId();
var _960=(nitobi.browser.MOZ&&!nitobi.browser.MOZ3)||(nitobi.browser.IE6&&!nitobi.browser.IE7)?true:false;
sb.append("<div id=\""+id+".navpanel\" style=\""+(_960?"z-index:20002;":"")+"position:absolute;top:0px;left:0px;overflow:hidden;\" class=\"ntb-calendar-navcontainer nitobi-hide\">");
sb.append("<div class=\"ntb-calendar-monthcontainer\">");
sb.append("<label style=\"display:block;\" for=\""+id+".months\">"+_95d.getNavSelectMonthText()+"</label>");
sb.append("<select id=\""+id+".months\" class=\"ntb-calendar-navms\" style=\"\" tabindex=\"1\">");
for(var i=0;i<_95e.length;i++){
sb.append("<option value=\""+i+"\">"+_95e[i]+"</option>");
}
sb.append("</select>");
sb.append("</div>");
sb.append("<div class=\"ntb-calendar-yearcontainer\">");
sb.append("<label style=\"display:block;\" for=\""+id+".year\">"+_95d.getNavSelectYearText()+"</label>");
sb.append("<input size=\"4\" maxlength=\"4\" id=\""+id+".year\" class=\"ntb-calendar-navinput\" style=\"-moz-user-select: normal;\" tabindex=\"2\"/>");
sb.append("</div>");
sb.append("<div class=\"ntb-calendar-controls\">");
sb.append("<button id=\""+id+".navconfirm\" type=\"button\">"+_95d.getNavConfirmText()+"</button>");
sb.append("<button id=\""+id+".navcancel\" type=\"button\">"+_95d.getNavCancelText()+"</button>");
sb.append("</div>");
sb.append("<div id=\""+id+".warning\" style=\"display:none;\" class=\"ntb-calendar-navwarning\">You must enter a valid year.</div>");
sb.append("</div>");
return sb.toString();
};
nitobi.lang.defineNs("nitobi.calendar");
nitobi.calendar.EventsManager=function(url){
this.connector=new nitobi.data.UrlConnector(url);
this.onDataReady=new nitobi.base.Event();
this.dates={events:{},disabled:{}};
this.eventsCache={};
this.disabledCache={};
};
nitobi.calendar.EventsManager.prototype.isEvent=function(date){
return (this.eventsCache[date.valueOf()]?true:false);
};
nitobi.calendar.EventsManager.prototype.isDisabled=function(date){
return (this.disabledCache[date.valueOf()]?true:false);
};
nitobi.calendar.EventsManager.prototype.getFromServer=function(){
if(this.connector.url!=null){
this.connector.get({},nitobi.lang.close(this,this.getComplete));
}else{
this.onDataReady.notify();
}
};
nitobi.calendar.EventsManager.prototype.getComplete=function(_965){
var data=_965.result;
var dm=nitobi.base.DateMath;
var root=data.documentElement;
var _969=nitobi.xml.getChildNodes(root);
for(var i=0;i<_969.length;i++){
var _96b=_969[i];
var type=_96b.getAttribute("e");
var _96d={};
if(type=="event"){
var _96e=_96b.getAttribute("a");
_96e=dm.parseIso8601(_96e);
_96d.startDate=_96e;
var _96f=_96b.getAttribute("b");
if(_96f){
_96f=dm.parseIso8601(_96f);
}else{
_96f=null;
}
_96d.endDate=_96f;
_96d.location=_96b.getAttribute("c");
_96d.description=_96b.getAttribute("d");
_96d.tooltip=_96b.getAttribute("f");
_96d.cssClass=_96b.getAttribute("g");
_96d.cssStyle=_96b.getAttribute("h");
var _970=this.dates.events[dm.resetTime(dm.clone(_96e)).valueOf()];
if(_970){
_970.push(_96d);
}else{
_970=[_96d];
this.dates.events[dm.resetTime(dm.clone(_96e)).valueOf()]=_970;
}
this.addEventDate(_96e,_96f);
}else{
var _96e=dm.parseIso8601(_96b.getAttribute("a"));
_96d.date=_96e;
this.addDisabledDate(dm.clone(_96e));
}
}
this.onDataReady.notify();
};
nitobi.calendar.EventsManager.prototype.addEventDate=function(_971,end){
var dm=nitobi.base.DateMath;
var _974=dm.clone(_971);
_974=dm.resetTime(_974);
if(!end){
return this.eventsCache[_974.valueOf()]=_971;
}
end=dm.clone(end);
end=dm.resetTime(end);
while(_974.valueOf()<=end.valueOf()){
this.eventsCache[_974.valueOf()]=_971;
_974=dm.add(_974,"d",1);
}
};
nitobi.calendar.EventsManager.prototype.addDisabledDate=function(date){
date=nitobi.base.DateMath.resetTime(date);
return this.disabledCache[date.valueOf()]=true;
};
nitobi.calendar.EventsManager.prototype.getEventInfo=function(date){
var dm=nitobi.base.DateMath;
var _978=this.dates.events;
date=dm.resetTime(date);
return _978[date.valueOf()];
};


var temp_ntb_modelDoc='<state	 xmlns:ntb="http://www.nitobi.com"	ID="mySheet"	Version="3.01" 	element="grid" 		uniqueID="_hkj342">    <nitobi.grid.Grid    	Theme="nitobi"    	CellBorder="0"		CellBorderHeight="1" 		Height="300"		Width="700"		skin="default"		RowHeight="23"					indicatorHeight="23"		HeaderHeight="23"		scrollbarWidth="26"		scrollbarHeight="26"		ToolbarHeight="25"				top="23"    		left="100"    		bottom="23"		minHeight="60"		minWidth="250"		PrimaryDatasourceSize="0" 		containerHeight=""		containerWidth=""		columnsdefined="0"		renderframe="0"		renderindicators="0"		renderheader="0"		renderfooter="0"		renderleft="0"		renderright="0"		rendercenter="0"		selected="1"		activeView=""		highlightCell=""		scrolling="0"		EditMode="0"		prevCell=""		prevText=""		prevData=""		FrozenLeftColumnCount="0"		DatasourceSizeEstimate="0"    		DatasourceId=""  		freezeright="0"		freezetop="0"		ToolbarEnabled="1"    		Expanding="0"			GridResizeEnabled="0"		RowHighlightEnabled="0"		RowSelectEnabled="0"		MultiRowSelectEnabled="0"		AutoKeyEnabled="0"			ToolbarContainerEmpty="false"			ToolTipsEnabled="1"		RowIndicatorsEnabled="0"		ColumnIndicatorsEnabled="1"		HScrollbarEnabled="1"		VScrollbarEnabled="1"		rowselect="0"		AutoSaveEnabled="0"		autoAdd="0"		remoteSort="0"		ForceValidate="1"		showErrors="0"		columnGraying="0"		keymode=""			keyboardPaging="0"		RowInsertEnabled="1"		RowDeleteEnabled="1"		allowEdit="1"		allowFormula="1"		PasteEnabled="1"		CopyEnabled="1"				expandRowsOnPaste="1"		expandColumnsOnPast="1"		datalog="myXMLLog"		xselect="//root"		xorder="@a"		asynchronous="1"		fieldMap=""    	GetHandler="" 		getHandler=""		SaveHandler=""		lastSaveHandlerResponse=""		sortColumn="0"		curSortColumn="0"		descending="0"		curSortColumnDesc="0"		RowCount="0"		ColumnCount="0"		nextXK="32"		CurrentPageIndex="0"		PagingMode="standard"		DataMode="caching"		RenderMode=""    	LiveScrollingMode="Leap"		RowsPerPage="20"		pageStart="0"		normalColor="#FFFFFF"		normalColor2="#FFFFFF"		activeColor="#FFFFFF"		selectionColor="#FFFFFF"		highlightColor="#FFFFFF"		columnGrayingColor="#FFFFFF"		SingleClickEditEnabled="0"		LastError=""		SortEnabled="1"    	SortMode="default"    	EnterTab="down"    	    	WidthFixed="0"     	HeightFixed="0"    	MinWidth="20"     	MinHeight="0"    	DragFillEnabled="1"		RightClickCopyEnabled="0"	>    </nitobi.grid.Grid>    <nitobi.grid.Columns>    </nitobi.grid.Columns>    <Defaults>    	<nitobi.grid.Grid></nitobi.grid.Grid>		<nitobi.grid.Column 			Width="100"			type="TEXT"			Visible="1"			SortEnabled="1"			/>    	<nitobi.grid.Column Align="right" ClassName="" CssStyle="" ColumnName="" DataType="number" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="#,###.00" NegativeMask="" GroupingSeparator="," DecimalSeparator="." type="TEXT" editor="TEXT" Wrap="0" Hidden="0" HeaderAlign="right" />    	<nitobi.grid.Column Align="right" ClassName="" CssStyle="" ColumnName="" DataType="number" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="#,###.00" NegativeMask="" GroupingSeparator="," DecimalSeparator="." type="NUMBER" editor="NUMBER" Wrap="0" Hidden="0" HeaderAlign="right" />    	<nitobi.grid.Column Align="right" ClassName="" CssStyle="" ColumnName="" DataType="number" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="#,###.00" NegativeMask="" GroupingSeparator="," DecimalSeparator="." type="TEXTAREA" editor="TEXTAREA" Wrap="0" Hidden="0" HeaderAlign="right" />    	<nitobi.grid.Column Align="right" ClassName="" CssStyle="" ColumnName="" DataType="number" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="#,###.00" NegativeMask="" GroupingSeparator="," DecimalSeparator="." ImageUrl="" type="IMAGE" editor="IMAGE" Wrap="0" Hidden="0" HeaderAlign="right" />    	<nitobi.grid.Column Align="right" ClassName="" CssStyle="" ColumnName="" DataType="number" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="#,###.00" NegativeMask="" GroupingSeparator="," DecimalSeparator="." OpenWindow="1" type="LINK" editor="LINK" Wrap="0" Hidden="0" HeaderAlign="right" />    	<nitobi.grid.Column Align="right" ClassName="" CssStyle="" ColumnName="" DataType="number" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" NegativeMask="" GroupingSeparator="," DecimalSeparator="." CalendarEnabled="1" type="DATE" editor="DATE" Wrap="0" Hidden="0" HeaderAlign="right" />    	<nitobi.grid.Column Align="right" ClassName="" CssStyle="" ColumnName="" DataType="number" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="#,###.00" NegativeMask="" GroupingSeparator="," DecimalSeparator="." DatasourceId="" Datasource="" DisplayFields="" ValueField="" Delay="" Size="6" ForceValidOption="0" AutoComplete="1" AutoClear="0" GetOnEnter="0" ReferenceColumn="" type="LOOKUP" editor="LOOKUP" Wrap="0" Hidden="0" HeaderAlign="right" />    	<nitobi.grid.Column Align="right" ClassName="" CssStyle="" ColumnName="" DataType="number" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="#,###.00" NegativeMask="" GroupingSeparator="," DecimalSeparator="." DatasourceId="" Datasource="" DisplayFields="" ValueField="" type="LISTBOX" editor="LISTBOX" Wrap="0" Hidden="0" HeaderAlign="right" />    	<nitobi.grid.Column Align="right" ClassName="" CssStyle="" ColumnName="" DataType="number" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="#,###.00" NegativeMask="" GroupingSeparator="," DecimalSeparator="." type="PASSWORD" editor="PASSWORD" Wrap="0" Hidden="0" HeaderAlign="right" />    	<nitobi.grid.Column Align="right" ClassName="" CssStyle="" ColumnName="" DataType="number" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="#,###.00" NegativeMask="" GroupingSeparator="," DecimalSeparator="." DatasourceId="" Datasource="" DisplayFields="" ValueField="" CheckedValue="" UnCheckedValue="" type="CHECKBOX" editor="CHECKBOX" Wrap="0" Hidden="0" HeaderAlign="right" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="date" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" type="TEXT" editor="TEXT" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="date" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" type="NUMBER" editor="NUMBER" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="date" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" type="TEXTAREA" editor="TEXTAREA" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="date" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" ImageUrl="" type="IMAGE" editor="IMAGE" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="date" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" OpenWindow="1" type="LINK" editor="LINK" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="date" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" type="DATE" editor="DATE" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="date" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" DatasourceId="" Datasource="" DisplayFields="" ValueField="" Delay="" Size="6" ForceValidOption="0" AutoComplete="1" AutoClear="0" GetOnEnter="0" ReferenceColumn="" type="LOOKUP" editor="LOOKUP" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="date" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" DatasourceId="" Datasource="" DisplayFields="" ValueField="" type="LISTBOX" editor="LISTBOX" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="date" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" type="PASSWORD" editor="PASSWORD" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="date" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" DatasourceId="" Datasource="" DisplayFields="" ValueField="" CheckedValue="" UnCheckedValue="" type="CHECKBOX" editor="CHECKBOX" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="text" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" type="TEXT" editor="TEXT" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="text" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" type="NUMBER" editor="NUMBER" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="text" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" type="TEXTAREA" editor="TEXTAREA" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="text" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" ImageUrl="" type="IMAGE" editor="IMAGE" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="text" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" OpenWindow="1" type="LINK" editor="LINK" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="text" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" Mask="M/d/yyyy" CalendarEnabled="1" type="DATE" editor="DATE" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="text" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" DatasourceId="" Datasource="" DisplayFields="" ValueField="" Delay="" Size="6" ForceValidOption="0" AutoComplete="1" AutoClear="0" GetOnEnter="0" ReferenceColumn="" type="LOOKUP" editor="LOOKUP" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="text" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" DatasourceId="" Datasource="" DisplayFields="" ValueField="" type="LISTBOX" editor="LISTBOX" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="text" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" type="PASSWORD" editor="PASSWORD" Wrap="0" Hidden="0" HeaderAlign="left" />    	<nitobi.grid.Column Align="left" ClassName="" CssStyle="" ColumnName="" DataType="text" Editable="1" Initial="" Label="" GetHandler="" DataSource="" Template="" TemplateUrl="" MaxLength="255" SortDirection="Desc" SortEnabled="1" Width="100" Visible="1" xdatafld="" Value="" xi="100" DatasourceId="" Datasource="" DisplayFields="" ValueField="" CheckedValue="" UnCheckedValue="" type="CHECKBOX" editor="CHECKBOX" Wrap="0" Hidden="0" HeaderAlign="left" />		<nitobi.grid.Row></nitobi.grid.Row>		<nitobi.grid.Cell></nitobi.grid.Cell>		<ntb:e />    </Defaults>    	<declaration>	</declaration>	<columnDefinitions>	</columnDefinitions></state>';
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.modelDoc = nitobi.xml.createXmlDoc(temp_ntb_modelDoc);

var temp_ntb_toolbarDoc='<?xml version="1.0" encoding="utf-8"?><toolbar id="toolbarthis.uid" title="Grid" height="25" width="110" image_directory="http://localhost/vss/EBALib/v13/Common/Toolbar/Styles/default">	<items>		<button id="save" onclick_event="this.onClick()" height="14" width="14" image="save.gif"			image_disabled="save_disabled.gif" tooltip_text="Save Changes" />		<!-- <button id="discardChanges" onclick_event="testclick(this);" height="17" width="16" top_offset="-2"			image="cancelsave.gif" image_disabled="cancelsave_disabled.gif" tooltip_text="Discard Changes" /> -->		<separator id="toolbar1_separator1" height="20" width="5" image="separator.jpg" />		<button id="newRecord" onclick_event="this.onClick()" height="11" width="14" image="newrecord.gif"			image_disabled="newrecord_disabled.gif" tooltip_text="New Record" />		<button id="deleteRecord" onclick_event="this.onClick()" height="11" width="14" image="deleterecord.gif"			image_disabled="deleterecord_disabled.gif" tooltip_text="Delete Record" />		<separator id="toolbar1_separator2" height="20" width="5" image="separator.jpg" />		<button id="refresh" onclick_event="this.onClick()" height="14" width="16" image="refresh.gif"			image_disabled="refresh_disabled.gif" tooltip_text="Refresh" />		<!--<separator id="toolbar1_separator3" height="20" width="5" image="separator.jpg" />		<button id="toolbar1_button4" onclick_event="testclick(this);" height="11" width="10" image="left.gif"			image_disabled="left_disabled.gif" tooltip_text="Previous Page" />		<button id="toolbar1_button5" onclick_event="testclick(this);" height="11" width="10" image="right.gif"			image_disabled="right_disabled.gif" tooltip_text="Next Page" />		-->	</items></toolbar>';
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.toolbarDoc = nitobi.xml.createXmlDoc(temp_ntb_toolbarDoc);

var temp_ntb_pagingToolbarDoc='<?xml version="1.0" encoding="utf-8"?><toolbar id="toolbarpagingthis.uid" title="Paging" height="25" width="60" image_directory="http://localhost/vss/EBALib/v13/Common/Toolbar/Styles/default">	<items>		<button id="previousPage" onclick_event="this.onClick()" height="14" width="14" image="left.gif"			image_disabled="left_disabled.gif" tooltip_text="Previous Page" />		<button id="nextPage" onclick_event="this.onClick()" height="14" width="16" image="right.gif"			image_disabled="right_disabled.gif" tooltip_text="Next Page" />	</items></toolbar>';
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.pagingToolbarDoc = nitobi.xml.createXmlDoc(temp_ntb_pagingToolbarDoc);


var temp_ntb_addXidXslProc='<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <x:p-x:n-guid"x:s-0"/><x:t- match="/"> <x:at-/></x:t-><x:t- match="node()|@*"> <xsl:copy> <xsl:if test="not(@xid)"> <x:a-x:n-xid" ><x:v-x:s-generate-id(.)"/><x:v-x:s-position()"/><x:v-x:s-$guid"/></x:a-> </xsl:if> <x:at-x:s-./* | text() | @*"> </x:at-> </xsl:copy></x:t-> <x:t- match="text()"> <x:v-x:s-."/></x:t-></xsl:stylesheet> ';
nitobi.lang.defineNs("nitobi.data");
nitobi.data.addXidXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_addXidXslProc));

var temp_ntb_adjustXiXslProc='<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <xsl:output method="xml" omit-xml-declaration="yes" /> <x:p-x:n-startingIndex"x:s-5"></x:p-> <x:p-x:n-startingGroup"x:s-5"></x:p-> <x:p-x:n-adjustment"x:s--1"></x:p-> <x:t- match="*|@*"> <xsl:copy> <x:at-x:s-@*|node()" /> </xsl:copy> </x:t-> <!--[@id=\'_default\']--> <x:t- match="//ntb:data/ntb:e|@*"> <x:c-> <x:wh- test="number(@xi) &gt;= number($startingIndex)"> <xsl:copy> <x:at-x:s-@*|node()" /> <x:ct-x:n-increment-xi" /> </xsl:copy> </x:wh-> <x:o-> <xsl:copy> <x:at-x:s-@*|node()" /> </xsl:copy> </x:o-> </x:c-> </x:t-> <x:t-x:n-increment-xi"> <x:a-x:n-xi"> <x:v-x:s-number(@xi) + number($adjustment)" /> </x:a-> </x:t-></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.data");
nitobi.data.adjustXiXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_adjustXiXslProc));

var temp_ntb_dataTranslatorXslProc='<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <xsl:output method="xml" omit-xml-declaration="yes" /> <x:p-x:n-start"x:s-0"></x:p-> <x:p-x:n-id"x:s-\'_default\'"></x:p-> <x:p-x:n-xkField"x:s-\'a\'"></x:p-> <x:p-x:n-totalRowCount"x:s-//root/@totalrowcount"/> <x:t- match="//root"> <ntb:grid xmlns:ntb="http://www.nitobi.com"> <ntb:datasources> <ntb:datasource id="{$id}" totalrowcount="{$totalRowCount}"> <xsl:if test="@error"> <x:a-x:n-error"><x:v-x:s-@error" /></x:a-> </xsl:if> <ntb:datasourcestructure id="{$id}"> <x:a-x:n-FieldNames"><x:v-x:s-@fields" />|_xk</x:a-> <x:a-x:n-Keys">_xk</x:a-> </ntb:datasourcestructure> <ntb:data id="{$id}"> <xsl:for-eachx:s-//e"> <x:at-x:s-."> <x:w-x:n-xi"x:s-position()-1"></x:w-> </x:at-> </xsl:for-each> </ntb:data> </ntb:datasource> </ntb:datasources> </ntb:grid> </x:t-> <x:t- match="e"> <x:p-x:n-xi"x:s-0"></x:p-> <ntb:e> <xsl:copy-ofx:s-@*[not(name() = \'xk\')]"></xsl:copy-of> <xsl:if test="not(@xi)"><x:a-x:n-xi"><x:v-x:s-$start + $xi" /></x:a-></xsl:if> <x:a-x:n-{$xkField}"><x:v-x:s-@xk" /></x:a-> </ntb:e> </x:t-> <x:t- match="lookups"></x:t-></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.data");
nitobi.data.dataTranslatorXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_dataTranslatorXslProc));

var temp_ntb_dateFormatTemplatesXslProc='<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com" xmlns:d="http://exslt.org/dates-and-times" xmlns:n="http://www.nitobi.com/exslt/numbers" extension-element-prefixes="d n"> <!-- http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html --><d:ms> <d:m i="1" l="31" a="Jan">January</d:m> <d:m i="2" l="28" a="Feb">February</d:m> <d:m i="3" l="31" a="Mar">March</d:m> <d:m i="4" l="30" a="Apr">April</d:m> <d:m i="5" l="31" a="May">May</d:m> <d:m i="6" l="30" a="Jun">June</d:m> <d:m i="7" l="31" a="Jul">July</d:m> <d:m i="8" l="31" a="Aug">August</d:m> <d:m i="9" l="30" a="Sep">September</d:m> <d:m i="10" l="31" a="Oct">October</d:m> <d:m i="11" l="30" a="Nov">November</d:m> <d:m i="12" l="31" a="Dec">December</d:m></d:ms><d:ds> <d:d a="Sun">Sunday</d:d> <d:d a="Mon">Monday</d:d> <d:d a="Tue">Tuesday</d:d> <d:d a="Wed">Wednesday</d:d> <d:d a="Thu">Thursday</d:d> <d:d a="Fri">Friday</d:d> <d:d a="Sat">Saturday</d:d></d:ds><x:t-x:n-d:format-date"> <x:p-x:n-date-time" /> <x:p-x:n-mask"x:s-\'MMM d, yy\'"/> <x:p-x:n-date-year" /> <x:va-x:n-formatted"> <x:va-x:n-date-time-length"x:s-string-length($date-time)" /> <x:va-x:n-timezone"x:s-\'\'" /> <x:va-x:n-dt"x:s-substring($date-time, 1, $date-time-length - string-length($timezone))" /> <x:va-x:n-dt-length"x:s-string-length($dt)" /> <x:c-> <x:wh- test="substring($dt, 3, 1) = \':\' and substring($dt, 6, 1) = \':\'"> <!--that means we just have a time--> <x:va-x:n-hour"x:s-substring($dt, 1, 2)" /> <x:va-x:n-min"x:s-substring($dt, 4, 2)" /> <x:va-x:n-sec"x:s-substring($dt, 7)" /> <xsl:if test="$hour &lt;= 23 and $min &lt;= 59 and $sec &lt;= 60"> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-\'NaN\'" /> <x:w-x:n-month"x:s-\'NaN\'" /> <x:w-x:n-day"x:s-\'NaN\'" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$min" /> <x:w-x:n-second"x:s-$sec" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </xsl:if> </x:wh-> <x:wh- test="substring($dt, 2, 1) = \'-\' or substring($dt, 3, 1) = \'-\'"> <x:c-> <x:wh- test="$dt-length = 5 or $dt-length = 6"> <!--D-MMM,DD-MMM--> <x:va-x:n-year"x:s-$date-year" /> <x:va-x:n-month"x:s-document(\'\')/*/d:ms/d:m[@a = substring-after($dt,\'-\')]/@i" /> <x:va-x:n-day"x:s-substring-before($dt,\'-\')" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> <x:wh- test="$dt-length = 8 or $dt-length = 9"> <!--D-MMM-YY,DD-MMM-YY--> <x:va-x:n-year"x:s-concat(\'20\',substring-after(substring-after($dt,\'-\'),\'-\'))" /> <x:va-x:n-month"x:s-document(\'\')/*/d:ms/d:m[@a = substring-before(substring-after($dt,\'-\'),\'-\')]/@i" /> <x:va-x:n-day"x:s-substring-before($dt,\'-\')" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> <x:o-> <!--D-MMM-YYYY,DD-MMM-YYYY--> <x:va-x:n-year"x:s-substring-after(substring-after($dt,\'-\'),\'-\')" /> <x:va-x:n-month"x:s-document(\'\')/*/d:ms/d:m[@a = substring-before(substring-after($dt,\'-\'),\'-\')]/@i" /> <x:va-x:n-day"x:s-substring-before($dt,\'-\')" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:o-> </x:c-> </x:wh-> <x:o-> <!--($neg * -2)--> <x:va-x:n-year"x:s-substring($dt, 1, 4) * (0 + 1)" /> <x:va-x:n-month"x:s-substring($dt, 6, 2)" /> <x:va-x:n-day"x:s-substring($dt, 9, 2)" /> <x:c-> <x:wh- test="$dt-length = 10"> <!--that means we just have a date--> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> <x:wh- test="substring($dt, 14, 1) = \':\' and substring($dt, 17, 1) = \':\'"> <!--that means we have a date + time--> <x:va-x:n-hour"x:s-substring($dt, 12, 2)" /> <x:va-x:n-min"x:s-substring($dt, 15, 2)" /> <x:va-x:n-sec"x:s-substring($dt, 18)" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$min" /> <x:w-x:n-second"x:s-$sec" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> </x:c-> </x:o-> </x:c-> </x:va-> <x:v-x:s-$formatted" /> </x:t-><x:t-x:n-d:_format-date"> <x:p-x:n-year" /> <x:p-x:n-month"x:s-1" /> <x:p-x:n-day"x:s-1" /> <x:p-x:n-hour"x:s-0" /> <x:p-x:n-minute"x:s-0" /> <x:p-x:n-second"x:s-0" /> <x:p-x:n-timezone"x:s-\'Z\'" /> <x:p-x:n-mask"x:s-\'\'" /> <x:va-x:n-char"x:s-substring($mask, 1, 1)" /> <x:c-> <x:wh- test="not($mask)" /> <!--replaced escaping with \' here/--> <x:wh- test="not(contains(\'GyMdhHmsSEDFwWakKz\', $char))"> <x:v-x:s-$char" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$minute" /> <x:w-x:n-second"x:s-$second" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-substring($mask, 2)" /> </x:ct-> </x:wh-> <x:o-> <x:va-x:n-next-different-char"x:s-substring(translate($mask, $char, \'\'), 1, 1)" /> <x:va-x:n-mask-length"> <x:c-> <x:wh- test="$next-different-char"> <x:v-x:s-string-length(substring-before($mask, $next-different-char))" /> </x:wh-> <x:o-> <x:v-x:s-string-length($mask)" /> </x:o-> </x:c-> </x:va-> <x:c-> <!--took our the era designator--> <x:wh- test="$char = \'M\'"> <x:c-> <x:wh- test="$mask-length >= 3"> <x:va-x:n-month-node"x:s-document(\'\')/*/d:ms/d:m[number($month)]" /> <x:c-> <x:wh- test="$mask-length >= 4"> <x:v-x:s-$month-node" /> </x:wh-> <x:o-> <x:v-x:s-$month-node/@a" /> </x:o-> </x:c-> </x:wh-> <x:wh- test="$mask-length = 2"> <x:v-x:s-format-number($month, \'00\')" /> </x:wh-> <x:o-> <x:v-x:s-$month" /> </x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'E\'"> <x:va-x:n-month-days"x:s-sum(document(\'\')/*/d:ms/d:m[position() &lt; $month]/@l)" /> <x:va-x:n-days"x:s-$month-days + $day + boolean(((not($year mod 4) and $year mod 100) or not($year mod 400)) and $month &gt; 2)" /> <x:va-x:n-y-1"x:s-$year - 1" /> <x:va-x:n-dow"x:s-(($y-1 + floor($y-1 div 4) - floor($y-1 div 100) + floor($y-1 div 400) + $days) mod 7) + 1" /> <x:va-x:n-day-node"x:s-document(\'\')/*/d:ds/d:d[number($dow)]" /> <x:c-> <x:wh- test="$mask-length >= 4"> <x:v-x:s-$day-node" /> </x:wh-> <x:o-> <x:v-x:s-$day-node/@a" /> </x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'a\'"> <x:c-> <x:wh- test="$hour >= 12">PM</x:wh-> <x:o->AM</x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'z\'"> <x:c-> <x:wh- test="$timezone = \'Z\'">UTC</x:wh-> <x:o->UTC<x:v-x:s-$timezone" /></x:o-> </x:c-> </x:wh-> <x:o-> <x:va-x:n-padding"x:s-\'00\'" /> <!--removed padding--> <x:c-> <x:wh- test="$char = \'y\'"> <x:c-> <x:wh- test="$mask-length &gt; 2"><x:v-x:s-format-number($year, $padding)" /></x:wh-> <x:o-><x:v-x:s-format-number(substring($year, string-length($year) - 1), $padding)" /></x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'d\'"> <x:v-x:s-format-number($day, $padding)" /> </x:wh-> <x:wh- test="$char = \'h\'"> <x:va-x:n-h"x:s-$hour mod 12" /> <x:c-> <x:wh- test="$h"><x:v-x:s-format-number($h, $padding)" /></x:wh-> <x:o-><x:v-x:s-format-number(12, $padding)" /></x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'H\'"> <x:v-x:s-format-number($hour, $padding)" /> </x:wh-> <x:wh- test="$char = \'k\'"> <x:c-> <x:wh- test="$hour"><x:v-x:s-format-number($hour, $padding)" /></x:wh-> <x:o-><x:v-x:s-format-number(24, $padding)" /></x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'K\'"> <x:v-x:s-format-number($hour mod 12, $padding)" /> </x:wh-> <x:wh- test="$char = \'m\'"> <x:v-x:s-format-number($minute, $padding)" /> </x:wh-> <x:wh- test="$char = \'s\'"> <x:v-x:s-format-number($second, $padding)" /> </x:wh-> <x:wh- test="$char = \'S\'"> <x:v-x:s-format-number(substring-after($second, \'.\'), $padding)" /> </x:wh-> <x:wh- test="$char = \'F\'"> <x:v-x:s-floor($day div 7) + 1" /> </x:wh-> <x:o-> <x:va-x:n-month-days"x:s-sum(document(\'\')/*/d:ms/d:m[position() &lt; $month]/@l)" /> <x:va-x:n-days"x:s-$month-days + $day + boolean(((not($year mod 4) and $year mod 100) or not($year mod 400)) and $month &gt; 2)" /> <x:v-x:s-format-number($days, $padding)" /> <!--removed week in year--> <!--removed week in month--> </x:o-> </x:c-> </x:o-> </x:c-> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$minute" /> <x:w-x:n-second"x:s-$second" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-substring($mask, $mask-length + 1)" /> </x:ct-> </x:o-> </x:c-></x:t-></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.dateFormatTemplatesXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_dateFormatTemplatesXslProc));

var temp_ntb_dateXslProc='<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com" xmlns:d="http://exslt.org/dates-and-times" extension-element-prefixes="d"> <xsl:output method="text" version="4.0" omit-xml-declaration="yes" /> <!-- http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html --><d:ms> <d:m i="1" l="31" a="Jan">January</d:m> <d:m i="2" l="28" a="Feb">February</d:m> <d:m i="3" l="31" a="Mar">March</d:m> <d:m i="4" l="30" a="Apr">April</d:m> <d:m i="5" l="31" a="May">May</d:m> <d:m i="6" l="30" a="Jun">June</d:m> <d:m i="7" l="31" a="Jul">July</d:m> <d:m i="8" l="31" a="Aug">August</d:m> <d:m i="9" l="30" a="Sep">September</d:m> <d:m i="10" l="31" a="Oct">October</d:m> <d:m i="11" l="30" a="Nov">November</d:m> <d:m i="12" l="31" a="Dec">December</d:m></d:ms><d:ds> <d:d a="Sun">Sunday</d:d> <d:d a="Mon">Monday</d:d> <d:d a="Tue">Tuesday</d:d> <d:d a="Wed">Wednesday</d:d> <d:d a="Thu">Thursday</d:d> <d:d a="Fri">Friday</d:d> <d:d a="Sat">Saturday</d:d></d:ds><x:t-x:n-d:format-date"> <x:p-x:n-date-time" /> <x:p-x:n-mask"x:s-\'MMM d, yy\'"/> <x:p-x:n-date-year" /> <x:va-x:n-formatted"> <x:va-x:n-date-time-length"x:s-string-length($date-time)" /> <x:va-x:n-timezone"x:s-\'\'" /> <x:va-x:n-dt"x:s-substring($date-time, 1, $date-time-length - string-length($timezone))" /> <x:va-x:n-dt-length"x:s-string-length($dt)" /> <x:c-> <x:wh- test="substring($dt, 3, 1) = \':\' and substring($dt, 6, 1) = \':\'"> <!--that means we just have a time--> <x:va-x:n-hour"x:s-substring($dt, 1, 2)" /> <x:va-x:n-min"x:s-substring($dt, 4, 2)" /> <x:va-x:n-sec"x:s-substring($dt, 7)" /> <xsl:if test="$hour &lt;= 23 and $min &lt;= 59 and $sec &lt;= 60"> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-\'NaN\'" /> <x:w-x:n-month"x:s-\'NaN\'" /> <x:w-x:n-day"x:s-\'NaN\'" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$min" /> <x:w-x:n-second"x:s-$sec" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </xsl:if> </x:wh-> <x:wh- test="substring($dt, 2, 1) = \'-\' or substring($dt, 3, 1) = \'-\'"> <x:c-> <x:wh- test="$dt-length = 5 or $dt-length = 6"> <!--D-MMM,DD-MMM--> <x:va-x:n-year"x:s-$date-year" /> <x:va-x:n-month"x:s-document(\'\')/*/d:ms/d:m[@a = substring-after($dt,\'-\')]/@i" /> <x:va-x:n-day"x:s-substring-before($dt,\'-\')" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> <x:wh- test="$dt-length = 8 or $dt-length = 9"> <!--D-MMM-YY,DD-MMM-YY--> <x:va-x:n-year"x:s-concat(\'20\',substring-after(substring-after($dt,\'-\'),\'-\'))" /> <x:va-x:n-month"x:s-document(\'\')/*/d:ms/d:m[@a = substring-before(substring-after($dt,\'-\'),\'-\')]/@i" /> <x:va-x:n-day"x:s-substring-before($dt,\'-\')" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> <x:o-> <!--D-MMM-YYYY,DD-MMM-YYYY--> <x:va-x:n-year"x:s-substring-after(substring-after($dt,\'-\'),\'-\')" /> <x:va-x:n-month"x:s-document(\'\')/*/d:ms/d:m[@a = substring-before(substring-after($dt,\'-\'),\'-\')]/@i" /> <x:va-x:n-day"x:s-substring-before($dt,\'-\')" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:o-> </x:c-> </x:wh-> <x:o-> <!--($neg * -2)--> <x:va-x:n-year"x:s-substring($dt, 1, 4) * (0 + 1)" /> <x:va-x:n-month"x:s-substring($dt, 6, 2)" /> <x:va-x:n-day"x:s-substring($dt, 9, 2)" /> <x:c-> <x:wh- test="$dt-length = 10"> <!--that means we just have a date--> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> <x:wh- test="substring($dt, 14, 1) = \':\' and substring($dt, 17, 1) = \':\'"> <!--that means we have a date + time--> <x:va-x:n-hour"x:s-substring($dt, 12, 2)" /> <x:va-x:n-min"x:s-substring($dt, 15, 2)" /> <x:va-x:n-sec"x:s-substring($dt, 18)" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$min" /> <x:w-x:n-second"x:s-$sec" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> </x:c-> </x:o-> </x:c-> </x:va-> <x:v-x:s-$formatted" /> </x:t-><x:t-x:n-d:_format-date"> <x:p-x:n-year" /> <x:p-x:n-month"x:s-1" /> <x:p-x:n-day"x:s-1" /> <x:p-x:n-hour"x:s-0" /> <x:p-x:n-minute"x:s-0" /> <x:p-x:n-second"x:s-0" /> <x:p-x:n-timezone"x:s-\'Z\'" /> <x:p-x:n-mask"x:s-\'\'" /> <x:va-x:n-char"x:s-substring($mask, 1, 1)" /> <x:c-> <x:wh- test="not($mask)" /> <!--replaced escaping with \' here/--> <x:wh- test="not(contains(\'GyMdhHmsSEDFwWakKz\', $char))"> <x:v-x:s-$char" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$minute" /> <x:w-x:n-second"x:s-$second" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-substring($mask, 2)" /> </x:ct-> </x:wh-> <x:o-> <x:va-x:n-next-different-char"x:s-substring(translate($mask, $char, \'\'), 1, 1)" /> <x:va-x:n-mask-length"> <x:c-> <x:wh- test="$next-different-char"> <x:v-x:s-string-length(substring-before($mask, $next-different-char))" /> </x:wh-> <x:o-> <x:v-x:s-string-length($mask)" /> </x:o-> </x:c-> </x:va-> <x:c-> <!--took our the era designator--> <x:wh- test="$char = \'M\'"> <x:c-> <x:wh- test="$mask-length >= 3"> <x:va-x:n-month-node"x:s-document(\'\')/*/d:ms/d:m[number($month)]" /> <x:c-> <x:wh- test="$mask-length >= 4"> <x:v-x:s-$month-node" /> </x:wh-> <x:o-> <x:v-x:s-$month-node/@a" /> </x:o-> </x:c-> </x:wh-> <x:wh- test="$mask-length = 2"> <x:v-x:s-format-number($month, \'00\')" /> </x:wh-> <x:o-> <x:v-x:s-$month" /> </x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'E\'"> <x:va-x:n-month-days"x:s-sum(document(\'\')/*/d:ms/d:m[position() &lt; $month]/@l)" /> <x:va-x:n-days"x:s-$month-days + $day + boolean(((not($year mod 4) and $year mod 100) or not($year mod 400)) and $month &gt; 2)" /> <x:va-x:n-y-1"x:s-$year - 1" /> <x:va-x:n-dow"x:s-(($y-1 + floor($y-1 div 4) - floor($y-1 div 100) + floor($y-1 div 400) + $days) mod 7) + 1" /> <x:va-x:n-day-node"x:s-document(\'\')/*/d:ds/d:d[number($dow)]" /> <x:c-> <x:wh- test="$mask-length >= 4"> <x:v-x:s-$day-node" /> </x:wh-> <x:o-> <x:v-x:s-$day-node/@a" /> </x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'a\'"> <x:c-> <x:wh- test="$hour >= 12">PM</x:wh-> <x:o->AM</x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'z\'"> <x:c-> <x:wh- test="$timezone = \'Z\'">UTC</x:wh-> <x:o->UTC<x:v-x:s-$timezone" /></x:o-> </x:c-> </x:wh-> <x:o-> <x:va-x:n-padding"x:s-\'00\'" /> <!--removed padding--> <x:c-> <x:wh- test="$char = \'y\'"> <x:c-> <x:wh- test="$mask-length &gt; 2"><x:v-x:s-format-number($year, $padding)" /></x:wh-> <x:o-><x:v-x:s-format-number(substring($year, string-length($year) - 1), $padding)" /></x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'d\'"> <x:v-x:s-format-number($day, $padding)" /> </x:wh-> <x:wh- test="$char = \'h\'"> <x:va-x:n-h"x:s-$hour mod 12" /> <x:c-> <x:wh- test="$h"><x:v-x:s-format-number($h, $padding)" /></x:wh-> <x:o-><x:v-x:s-format-number(12, $padding)" /></x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'H\'"> <x:v-x:s-format-number($hour, $padding)" /> </x:wh-> <x:wh- test="$char = \'k\'"> <x:c-> <x:wh- test="$hour"><x:v-x:s-format-number($hour, $padding)" /></x:wh-> <x:o-><x:v-x:s-format-number(24, $padding)" /></x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'K\'"> <x:v-x:s-format-number($hour mod 12, $padding)" /> </x:wh-> <x:wh- test="$char = \'m\'"> <x:v-x:s-format-number($minute, $padding)" /> </x:wh-> <x:wh- test="$char = \'s\'"> <x:v-x:s-format-number($second, $padding)" /> </x:wh-> <x:wh- test="$char = \'S\'"> <x:v-x:s-format-number(substring-after($second, \'.\'), $padding)" /> </x:wh-> <x:wh- test="$char = \'F\'"> <x:v-x:s-floor($day div 7) + 1" /> </x:wh-> <x:o-> <x:va-x:n-month-days"x:s-sum(document(\'\')/*/d:ms/d:m[position() &lt; $month]/@l)" /> <x:va-x:n-days"x:s-$month-days + $day + boolean(((not($year mod 4) and $year mod 100) or not($year mod 400)) and $month &gt; 2)" /> <x:v-x:s-format-number($days, $padding)" /> <!--removed week in year--> <!--removed week in month--> </x:o-> </x:c-> </x:o-> </x:c-> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$minute" /> <x:w-x:n-second"x:s-$second" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-substring($mask, $mask-length + 1)" /> </x:ct-> </x:o-> </x:c-></x:t-> <x:t- match="/"> <x:ct-x:n-d:format-date"> <x:w-x:n-date-time"x:s-//date" /> <x:w-x:n-date-year"x:s-//year" /> <x:w-x:n-mask"x:s-//mask" /> </x:ct-></x:t-></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.form");
nitobi.form.dateXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_dateXslProc));

var temp_ntb_declarationConverterXslProc='<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <xsl:output method="xml" omit-xml-declaration="yes" /> <x:t- match="/"> <ntb:grid xmlns:ntb="http://www.nitobi.com"> <ntb:columns> <x:at-x:s-//ntb:columndefinition" mode="columndef" /> </ntb:columns> <ntb:datasources> <x:at-x:s-//ntb:columndefinition" mode="datasources" /> </ntb:datasources> </ntb:grid> </x:t-> <x:t- match="ntb:columndefinition" mode="columndef"> <x:c-> <x:wh- test="@type=\'TEXT\' or @type=\'TEXTAREA\' or @type=\'LISTBOX\' or @type=\'LOOKUP\' or @type=\'CHECKBOX\' or @type=\'LINK\' or @type=\'IMAGE\' or @type=\'\' or not(@type)"> <ntb:textcolumn> <xsl:copy-ofx:s-@*" /> <x:c-> <x:wh- test="@type=\'TEXT\'"> <ntb:texteditor><xsl:copy-ofx:s-@*" /></ntb:texteditor> </x:wh-> <x:wh- test="@type=\'TEXTAREA\'"> <ntb:textareaeditor><xsl:copy-ofx:s-@*" /></ntb:textareaeditor> </x:wh-> <x:wh- test="@type=\'LISTBOX\'"> <ntb:listboxeditor> <xsl:copy-ofx:s-@*" /> <x:a-x:n-DatasourceId">id_<x:v-x:s-position()"/></x:a-> <x:a-x:n-DisplayFields"> <x:c-> <x:wh- test="@show=\'value\'">b</x:wh-> <x:wh- test="@show=\'key\'">a</x:wh-> <x:o-></x:o-> </x:c-> </x:a-> <x:a-x:n-ValueField"> <x:c-> <x:wh- test="@show">a</x:wh-> <x:o-></x:o-> </x:c-> </x:a-> </ntb:listboxeditor> </x:wh-> <x:wh- test="@type=\'CHECKBOX\'"> <ntb:checkboxeditor> <xsl:copy-ofx:s-@*" /> <x:a-x:n-DatasourceId">id_<x:v-x:s-position()"/></x:a-> <x:a-x:n-DisplayFields"> <x:c-> <x:wh- test="@show=\'value\'">b</x:wh-> <x:wh- test="@show=\'key\'">a</x:wh-> <x:o-></x:o-> </x:c-></x:a-> <x:a-x:n-ValueField">a</x:a-> </ntb:checkboxeditor> </x:wh-> <x:wh- test="@type=\'LOOKUP\'"> <ntb:lookupeditor> <xsl:copy-ofx:s-@*" /> <x:a-x:n-DatasourceId">id_<x:v-x:s-position()"/></x:a-> <x:a-x:n-DisplayFields"> <x:c-> <x:wh- test="@show=\'key\'">a</x:wh-> <x:wh- test="@show=\'value\'">b</x:wh-> <x:o-></x:o-> </x:c-></x:a-> <x:a-x:n-ValueField"> <x:c-> <x:wh- test="@show">a</x:wh-> <x:o-></x:o-> </x:c-> </x:a-> </ntb:lookupeditor> </x:wh-> <x:wh- test="@type=\'LINK\'"> <ntb:linkeditor><xsl:copy-ofx:s-@*" /></ntb:linkeditor> </x:wh-> <x:wh- test="@type=\'IMAGE\'"> <ntb:imageeditor><xsl:copy-ofx:s-@*" /></ntb:imageeditor> </x:wh-> </x:c-> </ntb:textcolumn> </x:wh-> <x:wh- test="@type=\'NUMBER\'"> <ntb:numbercolumn><xsl:copy-ofx:s-@*" /></ntb:numbercolumn> </x:wh-> <x:wh- test="@type=\'DATE\' or @type=\'CALENDAR\'"> <ntb:datecolumn> <xsl:copy-ofx:s-@*" /> <x:c-> <x:wh- test="@type=\'DATE\'"> <ntb:dateeditor><xsl:copy-ofx:s-@*" /></ntb:dateeditor> </x:wh-> <x:wh- test="@type=\'CALENDAR\'"> <ntb:calendareditor><xsl:copy-ofx:s-@*" /></ntb:calendareditor> </x:wh-> </x:c-> </ntb:datecolumn> </x:wh-> </x:c-> </x:t-> <x:t- match="ntb:columndefinition" mode="datasources"> <xsl:if test="@values and @values!=\'\'"> <ntb:datasource> <x:a-x:n-id">id_<x:v-x:s-position()" /></x:a-> <ntb:datasourcestructure> <x:a-x:n-id">id_<x:v-x:s-position()" /></x:a-> <x:a-x:n-FieldNames">a|b</x:a-> <x:a-x:n-Keys">a</x:a-> </ntb:datasourcestructure> <ntb:data> <x:a-x:n-id">id_<x:v-x:s-position()" /></x:a-> <x:ct-x:n-values"> <x:w-x:n-valuestring"x:s-@values" /> </x:ct-> </ntb:data> </ntb:datasource> </xsl:if> </x:t-> <x:t-x:n-values"> <x:p-x:n-valuestring" /> <x:va-x:n-bstring"> <x:c-> <x:wh- test="contains($valuestring,\',\')"><x:v-x:s-substring-after(substring-before($valuestring,\',\'),\':\')" /></x:wh-> <x:o-><x:v-x:s-substring-after($valuestring,\':\')" /></x:o-> </x:c-> </x:va-> <ntb:e> <x:a-x:n-a"><x:v-x:s-substring-before($valuestring,\':\')" /></x:a-> <x:a-x:n-b"><x:v-x:s-$bstring" /></x:a-> </ntb:e> <xsl:if test="contains($valuestring,\',\')"> <x:ct-x:n-values"> <x:w-x:n-valuestring"x:s-substring-after($valuestring,\',\')" /> </x:ct-> </xsl:if> </x:t-> </xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.declarationConverterXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_declarationConverterXslProc));

var temp_ntb_frameCssXslProc='<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:user="http://mycompany.com/mynamespace" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="text" omit-xml-declaration="yes"/><x:p-x:n-IE"x:s-\'false\'"/><x:va-x:n-g"x:s-//state/nitobi.grid.Grid"></x:va-><x:va-x:n-u"x:s-//state/@uniqueID"></x:va-><xsl:keyx:n-style" match="//s" use="@k" /><x:t- match = "/"> <x:va-x:n-t"x:s-$g/@Theme"></x:va-> <x:va-x:n-showvscroll"><x:c-><x:wh- test="($g/@VScrollbarEnabled=\'true\' or $g/@VScrollbarEnabled=1)">1</x:wh-><x:o->0</x:o-></x:c-></x:va-> <x:va-x:n-showhscroll"><x:c-><x:wh- test="($g/@HScrollbarEnabled=\'true\' or $g/@HScrollbarEnabled=1)">1</x:wh-><x:o->0</x:o-></x:c-></x:va-> <x:va-x:n-showtoolbar"><x:c-><x:wh- test="($g/@ToolbarEnabled=\'true\' or $g/@ToolbarEnabled=1)">1</x:wh-><x:o->0</x:o-></x:c-></x:va-> <x:va-x:n-frozen-columns-width"> <x:ct-x:n-get-pane-width"> <x:w-x:n-start-column"x:s-number(1)"/> <x:w-x:n-end-column"x:s-number($g/@FrozenLeftColumnCount)"/> <x:w-x:n-current-width"x:s-number(0)"/> </x:ct-> </x:va-> <x:va-x:n-unfrozen-columns-width"> <x:ct-x:n-get-pane-width"> <x:w-x:n-start-column"x:s-number($g/@FrozenLeftColumnCount)+1"/> <x:w-x:n-end-column"x:s-number($g/@ColumnCount)"/> <x:w-x:n-current-width"x:s-number(0)"/> </x:ct-> </x:va-> <x:va-x:n-total-columns-width"> <x:v-x:s-number($frozen-columns-width) + number($unfrozen-columns-width)"/> </x:va-> <x:va-x:n-scrollerHeight"x:s-number($g/@Height)-(number($g/@scrollbarHeight)*$showhscroll)-(number($g/@ToolbarHeight)*$showtoolbar)" /> <x:va-x:n-scrollerWidth"x:s-number($g/@Width)-(number($g/@scrollbarWidth)*number($g/@VScrollbarEnabled))" /> <x:va-x:n-midHeight"x:s-number($g/@Height)-(number($g/@scrollbarHeight)*$showhscroll)-(number($g/@ToolbarHeight)*$showtoolbar)-number($g/@top)"/> #grid<x:v-x:s-$u" /> { height:<x:v-x:s-$g/@Height" />px; width:<x:v-x:s-$g/@Width" />px; overflow:hidden;text-align:left; <xsl:if test="$IE=\'true\'"> position:relative; </xsl:if> } .hScrollbarRange<x:v-x:s-$u" /> { width:<x:v-x:s-$total-columns-width"/>px; } .vScrollbarRange<x:v-x:s-$u" /> {} .ntb-grid-datablock, .ntb-grid-headerblock { table-layout:fixed; <xsl:if test="$IE=\'true\'"> width:0px; </xsl:if> } .<x:v-x:s-$t"/> x:-moz-any-link, x:default {display: -moz-box;} .<x:v-x:s-$t"/> .ntb-cell-border {overflow:hidden;white-space:nowrap;<xsl:if test="$IE=\'true\'">height:auto;</xsl:if>} .ntb-grid-headershow<x:v-x:s-$u" /> {padding:0px;<xsl:if test="not($g/@ColumnIndicatorsEnabled=1)">display:none;</xsl:if>} .ntb-grid-vscrollshow<x:v-x:s-$u" /> {padding:0px;<xsl:if test="not($g/@VScrollbarEnabled=1)">display:none;</xsl:if>} #ntb-grid-hscrollshow<x:v-x:s-$u" /> {padding:0px;<xsl:if test="not($g/@HScrollbarEnabled=1)">display:none;</xsl:if>} .ntb-grid-toolbarshow<x:v-x:s-$u" /> {<xsl:if test="not($g/@ToolbarEnabled=1) and not($g/@ToolbarEnabled=\'true\')">display:none;</xsl:if>} .ntb-grid-height<x:v-x:s-$u" /> {height:<x:v-x:s-$g/@Height" />px;overflow:hidden;} .ntb-grid-width<x:v-x:s-$u" /> {width:<x:v-x:s-$g/@Width" />px;overflow:hidden;} .ntb-grid-overlay<x:v-x:s-$u" /> {position:relative;z-index:1000;top:0px;left:0px;} .ntb-grid-scroller<x:v-x:s-$u" /> { overflow:hidden; text-align:left; -moz-user-select: none; -webkit-user-select: none; -khtml-user-select: none; user-select: none; } .ntb-grid-scrollerheight<x:v-x:s-$u" /> {height: <x:c-><x:wh- test="($total-columns-width &gt; $g/@Width)"><x:v-x:s-$scrollerHeight"/></x:wh-><x:o-><x:v-x:s-number($scrollerHeight) + number($g/@scrollbarHeight)"/></x:o-></x:c->px;} .ntb-grid-scrollerwidth<x:v-x:s-$u" /> {width:<x:v-x:s-$scrollerWidth"/>px;} .ntb-grid-topheight<x:v-x:s-$u" /> {height:<x:v-x:s-$g/@top" />px;overflow:hidden;<xsl:if test="$g/@top=0">display:none;</xsl:if>} .ntb-grid-midheight<x:v-x:s-$u" /> {overflow:hidden;height:<x:c-><x:wh- test="($total-columns-width &gt; $g/@Width)"><x:v-x:s-$midHeight"/></x:wh-><x:o-><x:v-x:s-number($midHeight) + number($g/@scrollbarHeight)"/></x:o-></x:c->px;} <x:va-x:n-leftwidth"> <x:c-> <x:wh- test="$IE=\'true\'"> <x:v-x:s-number($g/@left+3)" /> </x:wh-> <x:o-> <x:v-x:s-$g/@left+3" /> </x:o-> </x:c-> </x:va-> .ntb-grid-leftwidth<x:v-x:s-$u" /> {width:<x:v-x:s-$leftwidth" />px;overflow:hidden;text-align:left;} .ntb-grid-centerwidth<x:v-x:s-$u" /> {width:<x:v-x:s-number($g/@Width)-number($leftwidth)-(number($g/@scrollbarWidth)*$showvscroll)" />px;} .ntb-grid-scrollbarheight<x:v-x:s-$u" /> {height:<x:v-x:s-$g/@scrollbarHeight" />px;} .ntb-grid-scrollbarwidth<x:v-x:s-$u" /> {width:<x:v-x:s-$g/@scrollbarWidth" />px;} .ntb-grid-toolbarheight<x:v-x:s-$u" /> {height:<x:v-x:s-$g/@ToolbarHeight" />px;} .ntb-grid-surfacewidth<x:v-x:s-$u" /> {width:<x:v-x:s-number($unfrozen-columns-width)"/>px;} .ntb-grid-surfaceheight<x:v-x:s-$u" /> {height:100px;} .ntb-grid {padding:0px;margin:0px;border:1px solid #cccccc} .ntb-scroller {padding:0px;} .ntb-scrollcorner {padding:0px;} .ntb-hscrollbar<x:v-x:s-$u" /> {<x:c-><x:wh- test="($total-columns-width &gt; $scrollerWidth)">display:block;</x:wh-><x:o->display:none;</x:o-></x:c->} .ntb-input-border { table-layout:fixed; overflow:hidden; position:absolute; z-index:2000; top:-2000px; left:-2000px; } .ntb-column-resize-surface { filter:alpha(opacity=1); background-color:white; position:absolute; display:none; top:-1000px; left:-5000px; width:100px; height:100px; z-index:800; } .<x:v-x:s-$t"/> .ntb-row<x:v-x:s-$u" /> {min-height:<x:v-x:s-number($g/@RowHeight)-number($g/@CellBorderHeight)" />px;line-height:<x:v-x:s-number($g/@RowHeight)-number($g/@InnerCellBorder)" />px;margin-left:5px;margin-right:5px;} .<x:v-x:s-$t"/> .ntb-header-row<x:v-x:s-$u" /> {height:<x:v-x:s-$g/@HeaderHeight" />px;} .<x:v-x:s-$t"/> .ntb-column-indicator<x:v-x:s-$u" /> {height:<x:v-x:s-number($g/@HeaderHeight)-2" />px;} .<x:v-x:s-$t"/> .ntb-column-header { overflow: hidden; white-space: nowrap;} <x:at-x:s-state/nitobi.grid.Columns" /></x:t-><x:t-x:n-get-pane-width"> <x:p-x:n-start-column"/> <x:p-x:n-end-column"/> <x:p-x:n-current-width"/> <x:c-> <x:wh- test="$start-column &lt;= $end-column"> <x:ct-x:n-get-pane-width"> <x:w-x:n-start-column"x:s-$start-column+1"/> <x:w-x:n-end-column"x:s-$end-column"/> <x:w-x:n-current-width"x:s-number($current-width) + number(//state/nitobi.grid.Columns/nitobi.grid.Column[$start-column]/@Width)*number(//state/nitobi.grid.Columns/nitobi.grid.Column[$start-column]/@Visible)"/> </x:ct-> </x:wh-> <x:o-> <x:v-x:s-$current-width"/> </x:o-> </x:c-> </x:t-><x:t- match="nitobi.grid.Columns"> <xsl:for-eachx:s-*"> <x:va-x:n-p"><x:v-x:s-position()"/></x:va-> <x:va-x:n-w"><x:v-x:s-@Width"/></x:va-> <x:va-x:n-wrap"><x:v-x:s-@Wrap" /></x:va-> <x:va-x:n-colw"><x:v-x:s-number($w)-number($g/@CellBorder)"/></x:va-> <x:va-x:n-coldataw"><x:v-x:s-number($w)-number($g/@InnerCellBorder)"/></x:va-> #grid<x:v-x:s-$u" /> .ntb-column<x:v-x:s-$u" />_<xsl:number value="$p" /> {width:<x:v-x:s-$colw" />px;text-align:<x:v-x:s-@Align"/>;<xsl:if test="@Visible=\'0\'">display:none;</xsl:if> }} #grid<x:v-x:s-$u" /> .ntb-column-data<x:v-x:s-$u" />_<xsl:number value="$p" /> {width:<x:v-x:s-$coldataw" />px;text-align:<x:v-x:s-@Align"/>;} #grid<x:v-x:s-$u" /> .ntb-cell-col_<x:v-x:s-$p" /> { <x:c-> <x:wh- test="$wrap=1 and $g/@PagingMode=\'standard\'"> white-space: normal; </x:wh-> <x:o-> overflow: hidden; white-space: nowrap; display: -moz-box; </x:o-> </x:c-> } </xsl:for-each></x:t-></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.frameCssXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_frameCssXslProc));

var temp_ntb_frameXslProc='<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:ntb="http://www.nitobi.com" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="text" omit-xml-declaration="yes"/><x:p-x:n-browser"x:s-\'IE\'"/><x:p-x:n-scrollbarWidth"x:s-17" /><x:t- match = "/"><x:va-x:n-u"x:s-state/@uniqueID" /><x:va-x:n-Id"x:s-state/@ID" /><x:va-x:n-resizeEnabled"x:s-state/nitobi.grid.Grid/@GridResizeEnabled" /><x:va-x:n-frozenLeft"x:s-state/nitobi.grid.Grid/@FrozenLeftColumnCount" /><x:va-x:n-offset"> <x:c-> <x:wh- test="$browser=\'IE\'">1</x:wh-> <x:o->0</x:o-> </x:c-></x:va-> &lt;div id="grid<x:v-x:s-$u" />" class="ntb-grid ntb-grid-reset <x:v-x:s-state/nitobi.grid.Grid/@Theme" />" style="overflow:visible;"&gt; &lt;div style="height:0px;width:0px;position:relative;"&gt; &lt;div id="ntb-grid-overlay<x:v-x:s-$u" />" class="ntb-grid-overlay<x:v-x:s-$u" />"&gt;&lt;/div&gt; <!-- Firefox or IE just uses a hidden div for keynav since on Mac at least it doesn\'t capture the paste event on an input --> <xsl:if test="not($browser=\'SAFARI\')">&lt;div id="ntb-grid-keynav<x:v-x:s-$u" />" tabindex="1" style="position:absolute;left:-3000px;width:1px;height:1px;border:0px;background-color:transparent;"&gt;&lt;/div&gt;</xsl:if> <!-- Safari can\'t capture key events on divs so need to use an input --> <xsl:if test="$browser=\'SAFARI\'">&lt;input type="text" id="ntb-grid-keynav<x:v-x:s-$u" />" tabindex="1" style="position:absolute;left:-3000px;width:1px;height:1px;border:0px;background-color:transparent;"&gt;&lt;/input&gt;</xsl:if> &lt;/div&gt; &lt;table cellpadding="0" cellspacing="0" border="0"&gt; &lt;tr&gt; &lt;td id="ntb-grid-scroller<x:v-x:s-$u" />" class="ntb-grid-scrollerheight<x:v-x:s-$u" /> ntb-grid-scrollerwidth<x:v-x:s-$u" />" &gt; &lt;div id="ntb-grid-scrollerarea<x:v-x:s-$u" />" class="ntb-grid-scrollerheight<x:v-x:s-$u" />" style="overflow:hidden;" &gt; &lt;div tabindex="2" class="ntb-grid-scroller<x:v-x:s-$u" /> ntb-grid-scrollerheight<x:v-x:s-$u" />" &gt; &lt;table class="ntb-grid-scroller" cellpadding="0" cellspacing="0" border="0" &gt; &lt;tr id="ntb-grid-header<x:v-x:s-$u" />" class="ntb-grid-topheight<x:v-x:s-$u" /> " &gt; &lt;td class="ntb-scroller ntb-grid-topheight<x:v-x:s-$u" /> ntb-grid-leftwidth<x:v-x:s-$u" />" &gt; &lt;div id="gridvp_0_<x:v-x:s-$u" />" class="ntb-grid-topheight<x:v-x:s-$u" /> ntb-grid-leftwidth<x:v-x:s-$u" /> ntb-grid-header"&gt; &lt;div id="gridvpsurface_0_<x:v-x:s-$u" />" &gt; &lt;div id="gridvpcontainer_0_<x:v-x:s-$u" />" &gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt; &lt;td class="ntb-scroller" &gt; &lt;div id="gridvp_1_<x:v-x:s-$u" />" class="ntb-grid-topheight<x:v-x:s-$u" /> ntb-grid-centerwidth<x:v-x:s-$u" /> ntb-grid-header"&gt; &lt;div id="gridvpsurface_1_<x:v-x:s-$u" />" class="ntb-grid-surfacewidth<x:v-x:s-$u" />" &gt; &lt;div id="gridvpcontainer_1_<x:v-x:s-$u" />" &gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr id="ntb-grid-data<x:v-x:s-$u" />"class="ntb-grid-scroller" &gt; &lt;td class="ntb-scroller ntb-grid-leftwidth<x:v-x:s-$u" />" &gt; &lt;div style="position:relative;"&gt; <xsl:if test="not($browser=\'IE\') and not($frozenLeft=\'0\')"> &lt;div style="z-index:100;position:absolute;height:100%;top:0px;overflow:hidden;" id="ntb-frozenshadow<x:v-x:s-$u" />" class="ntb-frozenshadow"&gt;&lt;/div&gt; </xsl:if> &lt;div id="gridvp_2_<x:v-x:s-$u" />" class="ntb-grid-midheight<x:v-x:s-$u" /> ntb-grid-leftwidth<x:v-x:s-$u" />" style="position:relative;"&gt; &lt;div id="gridvpsurface_2_<x:v-x:s-$u" />" &gt; &lt;div id="gridvpcontainer_2_<x:v-x:s-$u" />" &gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt; &lt;td class="ntb-scroller" &gt; &lt;div id="gridvp_3_<x:v-x:s-$u" />" class="ntb-grid-midheight<x:v-x:s-$u"/> ntb-grid-centerwidth<x:v-x:s-$u" />" style="position:relative;"&gt; &lt;div id="gridvpsurface_3_<x:v-x:s-$u" />" class="ntb-grid-surfacewidth<x:v-x:s-$u" />" &gt; &lt;div id="gridvpcontainer_3_<x:v-x:s-$u" />" &gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt; &lt;td id="ntb-grid-vscrollshow<x:v-x:s-$u" />" class="ntb-grid-scrollerheight<x:v-x:s-$u" />"&gt;&lt;div id="vscrollclip<x:v-x:s-$u" />" class="ntb-grid-scrollerheight<x:v-x:s-$u" /> ntb-grid-scrollbarwidth<x:v-x:s-$u"/> ntb-scrollbar" style="overflow:hidden;" &gt;&lt;div id="vscroll<x:v-x:s-$u" />" class="ntb-scrollbar" style="height:100%;width:<x:v-x:s-number($offset)+number(state/nitobi.grid.Grid/@scrollbarWidth)"/>px;position:relative;top:0px;left:-<x:v-x:s-$offset"/>px;overflow-x:hidden;overflow-y:scroll;" &gt;&lt;div class="vScrollbarRange<x:v-x:s-$u" />" style="WIDTH:1px;overflow:hidden;"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="ntb-grid-hscrollshow<x:v-x:s-$u" />" &gt; &lt;td &gt;&lt;div id="hscrollclip<x:v-x:s-$u" />" class="ntb-grid-scrollbarheight<x:v-x:s-$u" /> ntb-grid-scrollerwidth<x:v-x:s-$u" /> ntb-hscrollbar<x:v-x:s-$u" />" style="overflow:hidden;" &gt; &lt;div id="hscroll<x:v-x:s-$u" />" class="ntb-grid-scrollbarheight<x:v-x:s-$u" /> ntb-grid-scrollerwidth<x:v-x:s-$u" /> ntb-scrollbar" style="overflow-x:scroll;overflow-y:hidden;height:<x:v-x:s-number($offset)+number(state/nitobi.grid.Grid/@scrollbarHeight)"/>px;position:relative;top:-<x:v-x:s-$offset"/>px;left:0px;" &gt; &lt;div class="hScrollbarRange<x:v-x:s-$u" />" style="HEIGHT:1px;overflow:hidden;"&gt; &lt;/div&gt; &lt;/td&gt; &lt;td class="ntb-grid-vscrollshow<x:v-x:s-$u" /> ntb-scrollcorner" &gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div id="toolbarContainer<x:v-x:s-$u" />" style="overflow:hidden;" class="ntb-grid-toolbarshow<x:v-x:s-$u" /> ntb-grid-toolbarheight<x:v-x:s-$u" /> ntb-grid-width<x:v-x:s-$u" /> ntb-toolbar<x:v-x:s-$u" /> ntb-toolbar"&gt;&lt;/div&gt; &lt;div id="ntb-grid-toolscontainer<x:v-x:s-$u"/>" style="height:0px;position:relative;"&gt; <!-- In IE quirks the textarea has a forced height so need it to have a relative positioned container --> &lt;div style="position:relative;overflow:hidden;height:0px;"&gt; &lt;textarea id="ntb-clipboard<x:v-x:s-$u"/>" class="ntb-clipboard" &gt;&lt;/textarea&gt; &lt;/div&gt; &lt;div style="position:relative;"&gt; &lt;div id="ntb-column-resizeline<x:v-x:s-$u" />" class="ntb-column-resizeline"&gt;&lt;/div&gt; &lt;div id="ntb-grid-resizebox<x:v-x:s-$u" />" class="ntb-grid-resizebox"&gt;&lt;/div&gt; &lt;div id="ntb-column-dragbox<x:v-x:s-$u" />" class="ntb-column-dragbox"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="ntb-grid-showhide-wrapper<x:v-x:s-$u" />" style="display:none;" &gt; &lt;div id="ntb-grid-showhide<x:v-x:s-$u" />" class="ntb-showhide" &gt; &lt;ul id="ntb-grid-colcheck<x:v-x:s-$u" />"&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id="ntb-grid-showhide-close<x:v-x:s-$u" />" class="ntb-showhide-close-button" onclick="$ntb(&#39;ntb-grid-showhide-wrapper<x:v-x:s-$u" />&#39;).style.display=&#39;none&#39;" &gt; &lt;span&gt;close&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; <xsl:if test="$resizeEnabled = 1"> &lt;div id="ntb-grid-resizecontainer<x:v-x:s-$u"/>" style="height:0px;position:relative;"&gt; &lt;div id="ntb-grid-resizeright<x:v-x:s-$u" />" class="ntb-resize-indicator-right"&gt;&lt;/div&gt; &lt;div id="ntb-grid-resizebottom<x:v-x:s-$u" />" class="ntb-resize-indicator-bottom"&gt;&lt;/div&gt; &lt;/div&gt; </xsl:if> &lt;/div&gt;</x:t-></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.frameXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_frameXslProc));

var temp_ntb_listboxXslProc='<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <xsl:output method="xml" omit-xml-declaration="yes"/> <x:p-x:n-size"></x:p-> <x:p-x:n-DisplayFields"x:s-\'\'"></x:p-> <x:p-x:n-ValueField"x:s-\'\'"></x:p-> <x:p-x:n-val"x:s-\'\'"></x:p-> <x:t- match="/"> <!--<x:va-x:n-cell"x:s-/root/metadata/r[@xi=$row]/*[@xi=$col]"></x:va->--> <select id="ntb-listbox" class="ntb-input ntb-lookup-options"> <xsl:if test="$size"> <x:a-x:n-size">6</x:a-> </xsl:if> <!--<x:c-> <x:wh- test="$DatasourceId">--> <xsl:for-eachx:s-/ntb:datasource/ntb:data/*"> <xsl:sortx:s-@*[name(.)=substring-before($DisplayFields,\'|\')]" data-type="text" order="ascending" /> <option> <x:a-x:n-value"> <x:v-x:s-@*[name(.)=$ValueField]"></x:v-> </x:a-> <x:a-x:n-rn"> <x:v-x:s-position()"></x:v-> </x:a-> <xsl:if test="@*[name(.)=$ValueField and .=$val]"> <x:a-x:n-selected">true</x:a-> </xsl:if> <x:ct-x:n-print-displayfields"> <x:w-x:n-field"x:s-$DisplayFields" /> </x:ct-> </option> </xsl:for-each> <!--</x:wh-> <x:o-> </x:o-> </x:c->--> </select> </x:t-> <x:t-x:n-print-displayfields"> <x:p-x:n-field" /> <x:c-> <x:wh- test="contains($field,\'|\')" > <!-- Here we hardcode a spacer \', \' - this should probably be moved elsewhere. --> <x:v-x:s-concat(@*[name(.)=substring-before($field,\'|\')],\', \')"></x:v-> <x:ct-x:n-print-displayfields"> <x:w-x:n-field"x:s-substring-after($field,\'|\')" /> </x:ct-> </x:wh-> <x:o-> <x:v-x:s-@*[name(.)=$field]"></x:v-> </x:o-> </x:c-> </x:t-> </xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.form");
nitobi.form.listboxXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_listboxXslProc));

var temp_ntb_mergeEbaXmlToLogXslProc='<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <xsl:output method="xml" omit-xml-declaration="yes"/> <x:p-x:n-defaultAction"></x:p-> <x:p-x:n-startXid"x:s-100" ></x:p-> <xsl:keyx:n-newData" match="/ntb:grid/ntb:newdata/ntb:e" use="@xid" /> <xsl:keyx:n-oldData" match="/ntb:grid/ntb:datasources/ntb:datasource/ntb:data/ntb:e" use="@xid" /> <x:t- match="@* | node()" > <xsl:copy> <x:at-x:s-@*|node()" /> </xsl:copy> </x:t-> <x:t- match="/ntb:grid/ntb:datasources/ntb:datasource/ntb:data/ntb:e"> <xsl:if test="not(key(\'newData\',@xid))"> <xsl:copy> <xsl:copy-ofx:s-@*" /> </xsl:copy> </xsl:if> </x:t-> <x:t- match="/ntb:grid/ntb:datasources/ntb:datasource/ntb:data"> <xsl:copy> <x:at-x:s-@*|node()" /> <xsl:for-eachx:s-/ntb:grid/ntb:newdata/ntb:e"> <xsl:copy> <xsl:copy-ofx:s-@*" /> <xsl:if test="$defaultAction"> <x:va-x:n-oldNode"x:s-key(\'oldData\',@xid)" /> <x:c-> <x:wh- test="$oldNode"> <x:va- name=\'xid\'x:s-@xid" /> <x:a-x:n-xac"><x:v-x:s-$oldNode/@xac" /></x:a-> </x:wh-> <x:o-> <x:a-x:n-xac"><x:v-x:s-$defaultAction" /></x:a-> </x:o-> </x:c-> </xsl:if> </xsl:copy> </xsl:for-each> </xsl:copy> </x:t-></xsl:stylesheet> ';
nitobi.lang.defineNs("nitobi.data");
nitobi.data.mergeEbaXmlToLogXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_mergeEbaXmlToLogXslProc));

var temp_ntb_mergeEbaXmlXslProc='<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <xsl:output method="xml" omit-xml-declaration="no" /> <x:p-x:n-startRowIndex"x:s-100" ></x:p-> <x:p-x:n-endRowIndex"x:s-200" ></x:p-> <x:p-x:n-guid"x:s-1"></x:p-> <xsl:keyx:n-newData" match="/ntb:grid/ntb:newdata/ntb:data/ntb:e" use="@xi" /> <xsl:keyx:n-oldData" match="/ntb:grid/ntb:datasources/ntb:datasource/ntb:data/ntb:e" use="@xi" /> <x:t- match="@* | node()" > <xsl:copy> <x:at-x:s-@*|node()" /> </xsl:copy> </x:t-> <x:t- match="/ntb:grid/ntb:datasources/ntb:datasource/ntb:data/ntb:e"> <x:c-> <x:wh- test="(number(@xi) &gt;= $startRowIndex) and (number(@xi) &lt;= $endRowIndex)"> <xsl:copy> <xsl:copy-ofx:s-@*" /> <xsl:copy-ofx:s-key(\'newData\',@xi)/@*" /> </xsl:copy> </x:wh-> <x:o-> <xsl:copy> <x:at-x:s-@*|node()" /> </xsl:copy> </x:o-> </x:c-> </x:t-> <x:t- match="/ntb:grid/ntb:datasources/ntb:datasource/ntb:data"> <xsl:copy> <x:at-x:s-@*|node()" /> <xsl:for-eachx:s-/ntb:grid/ntb:newdata/ntb:data/ntb:e"> <xsl:if test="not(key(\'oldData\',@xi))"> <xsl:elementx:n-ntb:e" namespace="http://www.nitobi.com"> <xsl:copy-ofx:s-@*" /> <x:a-x:n-xid"><x:v-x:s-generate-id(.)"/><x:v-x:s-position()"/><x:v-x:s-$guid"/></x:a-> </xsl:element> </xsl:if> </xsl:for-each> </xsl:copy> </x:t-> <x:t- match="/ntb:grid/ntb:newdata/ntb:data/ntb:e"> <xsl:copy> <xsl:copy-ofx:s-@*" /> <x:va-x:n-oldData"x:s-key(\'oldData\',@xi)"/> <x:c-> <x:wh- test="$oldData"> <xsl:copy-ofx:s-$oldData/@*" /> <xsl:copy-ofx:s-@*" /> <x:a-x:n-xac">u</x:a-> <xsl:if test="$oldData/@xac=\'i\'"> <x:a-x:n-xac">i</x:a-> </xsl:if> </x:wh-> <x:o-> <x:a-x:n-xid"><x:v-x:s-generate-id(.)"/><x:v-x:s-position()"/><x:v-x:s-$guid"/></x:a-> <x:a-x:n-xac">i</x:a-> </x:o-> </x:c-> </xsl:copy> </x:t-> </xsl:stylesheet> ';
nitobi.lang.defineNs("nitobi.data");
nitobi.data.mergeEbaXmlXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_mergeEbaXmlXslProc));

var temp_ntb_numberFormatTemplatesXslProc='<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com" xmlns:d="http://exslt.org/dates-and-times" xmlns:n="http://www.nitobi.com/exslt/numbers" extension-element-prefixes="d n"> <!--http://www.w3schools.com/xsl/func_formatnumber.asp--><!-- <xsl:decimal-formatx:n-name" decimal-separator="char" grouping-separator="char" infinity="string" minus-sign="char" NaN="string" percent="char" per-mille="char" zero-digit="char" digit="char" pattern-separator="char"/> --><xsl:decimal-formatx:n-NA" decimal-separator="." grouping-separator="," /><xsl:decimal-formatx:n-EU" decimal-separator="," grouping-separator="." /><x:t-x:n-n:format"> <x:p-x:n-number"x:s-0" /> <x:p-x:n-mask"x:s-\'#.00\'" /> <x:p-x:n-group"x:s-\',\'" /> <x:p-x:n-decimal"x:s-\'.\'" /> <x:va-x:n-formattedNumber"> <x:c-> <x:wh- test="$group=\'.\' and $decimal=\',\'"> <x:v-x:s-format-number($number, $mask, \'EU\')" /> </x:wh-> <x:o-> <x:v-x:s-format-number($number, $mask, \'NA\')" /> </x:o-> </x:c-> </x:va-> <xsl:if test="not(string($formattedNumber) = \'NaN\')"> <x:v-x:s-$formattedNumber" /> </xsl:if></x:t-></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.numberFormatTemplatesXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_numberFormatTemplatesXslProc));

var temp_ntb_numberXslProc='<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com" xmlns:d="http://exslt.org/dates-and-times" xmlns:n="http://www.nitobi.com/exslt/numbers" extension-element-prefixes="d n"><xsl:output method="text" version="4.0" omit-xml-declaration="yes" /><x:p-x:n-number"x:s-0" /><x:p-x:n-mask"x:s-\'#.00\'" /><x:p-x:n-group"x:s-\',\'" /><x:p-x:n-decimal"x:s-\'.\'" /> <!--http://www.w3schools.com/xsl/func_formatnumber.asp--><!-- <xsl:decimal-formatx:n-name" decimal-separator="char" grouping-separator="char" infinity="string" minus-sign="char" NaN="string" percent="char" per-mille="char" zero-digit="char" digit="char" pattern-separator="char"/> --><xsl:decimal-formatx:n-NA" decimal-separator="." grouping-separator="," /><xsl:decimal-formatx:n-EU" decimal-separator="," grouping-separator="." /><x:t-x:n-n:format"> <x:p-x:n-number"x:s-0" /> <x:p-x:n-mask"x:s-\'#.00\'" /> <x:p-x:n-group"x:s-\',\'" /> <x:p-x:n-decimal"x:s-\'.\'" /> <x:va-x:n-formattedNumber"> <x:c-> <x:wh- test="$group=\'.\' and $decimal=\',\'"> <x:v-x:s-format-number($number, $mask, \'EU\')" /> </x:wh-> <x:o-> <x:v-x:s-format-number($number, $mask, \'NA\')" /> </x:o-> </x:c-> </x:va-> <xsl:if test="not(string($formattedNumber) = \'NaN\')"> <x:v-x:s-$formattedNumber" /> </xsl:if></x:t-><x:t- match="/"> <x:ct-x:n-n:format"> <x:w-x:n-number"x:s-$number" /> <x:w-x:n-mask"x:s-$mask" /> <x:w-x:n-group"x:s-$group" /> <x:w-x:n-decimal"x:s-$decimal" /> </x:ct-></x:t-></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.form");
nitobi.form.numberXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_numberXslProc));

var temp_ntb_rowXslProc='<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com" xmlns:d="http://exslt.org/dates-and-times" xmlns:n="http://www.nitobi.com/exslt/numbers" extension-element-prefixes="d n"><xsl:output method="xml" omit-xml-declaration="yes"/> <x:p-x:n-showHeaders"x:s-\'0\'" /><x:p-x:n-firstColumn"x:s-\'0\'" /><x:p-x:n-lastColumn"x:s-\'0\'" /><x:p-x:n-uniqueId"x:s-\'0\'" /><x:p-x:n-rowHover"x:s-\'0\'" /><x:p-x:n-frozenColumnId"x:s-\'\'" /><x:p-x:n-start" /><x:p-x:n-end" /><x:p-x:n-activeColumn"x:s-\'0\'" /><x:p-x:n-activeRow"x:s-\'0\'" /><x:p-x:n-sortColumn"x:s-\'0\'" /><x:p-x:n-toolTipsEnabled"x:s-\'0\'" /><x:p-x:n-sortDirection"x:s-\'Asc\'" /><x:p-x:n-dataTableId"x:s-\'_default\'" /><x:p-x:n-columns"x:s-/ntb:root/ntb:columns/*/*" /><xsl:keyx:n-data-source" match="//ntb:datasources/ntb:datasource" use="@id" /><xsl:keyx:n-group" match="ntb:e" use="@a" /><!-- <xsl:for-eachx:s-ntb:e[count(. | key(\'group\', @a)[1]) = 1]"> <xsl:sortx:s-@a" /> <x:v-x:s-@a" />,<br /> <xsl:for-eachx:s-key(\'group\', @a)"> <xsl:sortx:s-@b" /> <x:v-x:s-@b" /> (<x:v-x:s-@c" />)<br /> </xsl:for-each> </xsl:for-each>--><!--This is an incude for the date fromatting XSLT that gets replaced at compile time--> <!-- http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html --><d:ms> <d:m i="1" l="31" a="Jan">January</d:m> <d:m i="2" l="28" a="Feb">February</d:m> <d:m i="3" l="31" a="Mar">March</d:m> <d:m i="4" l="30" a="Apr">April</d:m> <d:m i="5" l="31" a="May">May</d:m> <d:m i="6" l="30" a="Jun">June</d:m> <d:m i="7" l="31" a="Jul">July</d:m> <d:m i="8" l="31" a="Aug">August</d:m> <d:m i="9" l="30" a="Sep">September</d:m> <d:m i="10" l="31" a="Oct">October</d:m> <d:m i="11" l="30" a="Nov">November</d:m> <d:m i="12" l="31" a="Dec">December</d:m></d:ms><d:ds> <d:d a="Sun">Sunday</d:d> <d:d a="Mon">Monday</d:d> <d:d a="Tue">Tuesday</d:d> <d:d a="Wed">Wednesday</d:d> <d:d a="Thu">Thursday</d:d> <d:d a="Fri">Friday</d:d> <d:d a="Sat">Saturday</d:d></d:ds><x:t-x:n-d:format-date"> <x:p-x:n-date-time" /> <x:p-x:n-mask"x:s-\'MMM d, yy\'"/> <x:p-x:n-date-year" /> <x:va-x:n-formatted"> <x:va-x:n-date-time-length"x:s-string-length($date-time)" /> <x:va-x:n-timezone"x:s-\'\'" /> <x:va-x:n-dt"x:s-substring($date-time, 1, $date-time-length - string-length($timezone))" /> <x:va-x:n-dt-length"x:s-string-length($dt)" /> <x:c-> <x:wh- test="substring($dt, 3, 1) = \':\' and substring($dt, 6, 1) = \':\'"> <!--that means we just have a time--> <x:va-x:n-hour"x:s-substring($dt, 1, 2)" /> <x:va-x:n-min"x:s-substring($dt, 4, 2)" /> <x:va-x:n-sec"x:s-substring($dt, 7)" /> <xsl:if test="$hour &lt;= 23 and $min &lt;= 59 and $sec &lt;= 60"> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-\'NaN\'" /> <x:w-x:n-month"x:s-\'NaN\'" /> <x:w-x:n-day"x:s-\'NaN\'" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$min" /> <x:w-x:n-second"x:s-$sec" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </xsl:if> </x:wh-> <x:wh- test="substring($dt, 2, 1) = \'-\' or substring($dt, 3, 1) = \'-\'"> <x:c-> <x:wh- test="$dt-length = 5 or $dt-length = 6"> <!--D-MMM,DD-MMM--> <x:va-x:n-year"x:s-$date-year" /> <x:va-x:n-month"x:s-document(\'\')/*/d:ms/d:m[@a = substring-after($dt,\'-\')]/@i" /> <x:va-x:n-day"x:s-substring-before($dt,\'-\')" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> <x:wh- test="$dt-length = 8 or $dt-length = 9"> <!--D-MMM-YY,DD-MMM-YY--> <x:va-x:n-year"x:s-concat(\'20\',substring-after(substring-after($dt,\'-\'),\'-\'))" /> <x:va-x:n-month"x:s-document(\'\')/*/d:ms/d:m[@a = substring-before(substring-after($dt,\'-\'),\'-\')]/@i" /> <x:va-x:n-day"x:s-substring-before($dt,\'-\')" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> <x:o-> <!--D-MMM-YYYY,DD-MMM-YYYY--> <x:va-x:n-year"x:s-substring-after(substring-after($dt,\'-\'),\'-\')" /> <x:va-x:n-month"x:s-document(\'\')/*/d:ms/d:m[@a = substring-before(substring-after($dt,\'-\'),\'-\')]/@i" /> <x:va-x:n-day"x:s-substring-before($dt,\'-\')" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:o-> </x:c-> </x:wh-> <x:o-> <!--($neg * -2)--> <x:va-x:n-year"x:s-substring($dt, 1, 4) * (0 + 1)" /> <x:va-x:n-month"x:s-substring($dt, 6, 2)" /> <x:va-x:n-day"x:s-substring($dt, 9, 2)" /> <x:c-> <x:wh- test="$dt-length = 10"> <!--that means we just have a date--> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> <x:wh- test="substring($dt, 14, 1) = \':\' and substring($dt, 17, 1) = \':\'"> <!--that means we have a date + time--> <x:va-x:n-hour"x:s-substring($dt, 12, 2)" /> <x:va-x:n-min"x:s-substring($dt, 15, 2)" /> <x:va-x:n-sec"x:s-substring($dt, 18)" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$min" /> <x:w-x:n-second"x:s-$sec" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-$mask" /> </x:ct-> </x:wh-> </x:c-> </x:o-> </x:c-> </x:va-> <x:v-x:s-$formatted" /> </x:t-><x:t-x:n-d:_format-date"> <x:p-x:n-year" /> <x:p-x:n-month"x:s-1" /> <x:p-x:n-day"x:s-1" /> <x:p-x:n-hour"x:s-0" /> <x:p-x:n-minute"x:s-0" /> <x:p-x:n-second"x:s-0" /> <x:p-x:n-timezone"x:s-\'Z\'" /> <x:p-x:n-mask"x:s-\'\'" /> <x:va-x:n-char"x:s-substring($mask, 1, 1)" /> <x:c-> <x:wh- test="not($mask)" /> <!--replaced escaping with \' here/--> <x:wh- test="not(contains(\'GyMdhHmsSEDFwWakKz\', $char))"> <x:v-x:s-$char" /> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$minute" /> <x:w-x:n-second"x:s-$second" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-substring($mask, 2)" /> </x:ct-> </x:wh-> <x:o-> <x:va-x:n-next-different-char"x:s-substring(translate($mask, $char, \'\'), 1, 1)" /> <x:va-x:n-mask-length"> <x:c-> <x:wh- test="$next-different-char"> <x:v-x:s-string-length(substring-before($mask, $next-different-char))" /> </x:wh-> <x:o-> <x:v-x:s-string-length($mask)" /> </x:o-> </x:c-> </x:va-> <x:c-> <!--took our the era designator--> <x:wh- test="$char = \'M\'"> <x:c-> <x:wh- test="$mask-length >= 3"> <x:va-x:n-month-node"x:s-document(\'\')/*/d:ms/d:m[number($month)]" /> <x:c-> <x:wh- test="$mask-length >= 4"> <x:v-x:s-$month-node" /> </x:wh-> <x:o-> <x:v-x:s-$month-node/@a" /> </x:o-> </x:c-> </x:wh-> <x:wh- test="$mask-length = 2"> <x:v-x:s-format-number($month, \'00\')" /> </x:wh-> <x:o-> <x:v-x:s-$month" /> </x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'E\'"> <x:va-x:n-month-days"x:s-sum(document(\'\')/*/d:ms/d:m[position() &lt; $month]/@l)" /> <x:va-x:n-days"x:s-$month-days + $day + boolean(((not($year mod 4) and $year mod 100) or not($year mod 400)) and $month &gt; 2)" /> <x:va-x:n-y-1"x:s-$year - 1" /> <x:va-x:n-dow"x:s-(($y-1 + floor($y-1 div 4) - floor($y-1 div 100) + floor($y-1 div 400) + $days) mod 7) + 1" /> <x:va-x:n-day-node"x:s-document(\'\')/*/d:ds/d:d[number($dow)]" /> <x:c-> <x:wh- test="$mask-length >= 4"> <x:v-x:s-$day-node" /> </x:wh-> <x:o-> <x:v-x:s-$day-node/@a" /> </x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'a\'"> <x:c-> <x:wh- test="$hour >= 12">PM</x:wh-> <x:o->AM</x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'z\'"> <x:c-> <x:wh- test="$timezone = \'Z\'">UTC</x:wh-> <x:o->UTC<x:v-x:s-$timezone" /></x:o-> </x:c-> </x:wh-> <x:o-> <x:va-x:n-padding"x:s-\'00\'" /> <!--removed padding--> <x:c-> <x:wh- test="$char = \'y\'"> <x:c-> <x:wh- test="$mask-length &gt; 2"><x:v-x:s-format-number($year, $padding)" /></x:wh-> <x:o-><x:v-x:s-format-number(substring($year, string-length($year) - 1), $padding)" /></x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'d\'"> <x:v-x:s-format-number($day, $padding)" /> </x:wh-> <x:wh- test="$char = \'h\'"> <x:va-x:n-h"x:s-$hour mod 12" /> <x:c-> <x:wh- test="$h"><x:v-x:s-format-number($h, $padding)" /></x:wh-> <x:o-><x:v-x:s-format-number(12, $padding)" /></x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'H\'"> <x:v-x:s-format-number($hour, $padding)" /> </x:wh-> <x:wh- test="$char = \'k\'"> <x:c-> <x:wh- test="$hour"><x:v-x:s-format-number($hour, $padding)" /></x:wh-> <x:o-><x:v-x:s-format-number(24, $padding)" /></x:o-> </x:c-> </x:wh-> <x:wh- test="$char = \'K\'"> <x:v-x:s-format-number($hour mod 12, $padding)" /> </x:wh-> <x:wh- test="$char = \'m\'"> <x:v-x:s-format-number($minute, $padding)" /> </x:wh-> <x:wh- test="$char = \'s\'"> <x:v-x:s-format-number($second, $padding)" /> </x:wh-> <x:wh- test="$char = \'S\'"> <x:v-x:s-format-number(substring-after($second, \'.\'), $padding)" /> </x:wh-> <x:wh- test="$char = \'F\'"> <x:v-x:s-floor($day div 7) + 1" /> </x:wh-> <x:o-> <x:va-x:n-month-days"x:s-sum(document(\'\')/*/d:ms/d:m[position() &lt; $month]/@l)" /> <x:va-x:n-days"x:s-$month-days + $day + boolean(((not($year mod 4) and $year mod 100) or not($year mod 400)) and $month &gt; 2)" /> <x:v-x:s-format-number($days, $padding)" /> <!--removed week in year--> <!--removed week in month--> </x:o-> </x:c-> </x:o-> </x:c-> <x:ct-x:n-d:_format-date"> <x:w-x:n-year"x:s-$year" /> <x:w-x:n-month"x:s-$month" /> <x:w-x:n-day"x:s-$day" /> <x:w-x:n-hour"x:s-$hour" /> <x:w-x:n-minute"x:s-$minute" /> <x:w-x:n-second"x:s-$second" /> <x:w-x:n-timezone"x:s-$timezone" /> <x:w-x:n-mask"x:s-substring($mask, $mask-length + 1)" /> </x:ct-> </x:o-> </x:c-></x:t-><!--This is an incude for the number fromatting XSLT that gets replaced at compile time--> <!--http://www.w3schools.com/xsl/func_formatnumber.asp--><!-- <xsl:decimal-formatx:n-name" decimal-separator="char" grouping-separator="char" infinity="string" minus-sign="char" NaN="string" percent="char" per-mille="char" zero-digit="char" digit="char" pattern-separator="char"/> --><xsl:decimal-formatx:n-NA" decimal-separator="." grouping-separator="," /><xsl:decimal-formatx:n-EU" decimal-separator="," grouping-separator="." /><x:t-x:n-n:format"> <x:p-x:n-number"x:s-0" /> <x:p-x:n-mask"x:s-\'#.00\'" /> <x:p-x:n-group"x:s-\',\'" /> <x:p-x:n-decimal"x:s-\'.\'" /> <x:va-x:n-formattedNumber"> <x:c-> <x:wh- test="$group=\'.\' and $decimal=\',\'"> <x:v-x:s-format-number($number, $mask, \'EU\')" /> </x:wh-> <x:o-> <x:v-x:s-format-number($number, $mask, \'NA\')" /> </x:o-> </x:c-> </x:va-> <xsl:if test="not(string($formattedNumber) = \'NaN\')"> <x:v-x:s-$formattedNumber" /> </xsl:if></x:t-><x:t- match = "/"> <div> <xsl:if test="$showHeaders = 1"> <table cellpadding="0" cellspacing="0" border="0" class="ntb-grid-headerblock"> <tr> <x:a-x:n-class">ntb-header-row<x:v-x:s-$uniqueId" /></x:a-> <xsl:for-eachx:s-$columns"> <xsl:if test="@Hidden = \'0\' and (position() &gt; $firstColumn and position() &lt;= $lastColumn)"> <td ebatype="columnheader" xi="{position()-1}" col="{position()-1}"> <x:a-x:n-id">columnheader_<x:v-x:s-position()-1"/>_<x:v-x:s-$uniqueId" /></x:a-> <x:a-x:n-onmouseover">$ntb(\'grid<x:v-x:s-$uniqueId" />\').jsObject.handleHeaderMouseOver(this);</x:a-> <x:a-x:n-onmouseout">$ntb(\'grid<x:v-x:s-$uniqueId" />\').jsObject.handleHeaderMouseOut(this);</x:a-> <x:a-x:n-style">text-align:<x:v-x:s-@HeaderAlign"/>;</x:a-> <!-- note that the ntb-columnUID_POSITION class is for a safari bug --> <x:a-x:n-class">ntb-column-header ntb-column-indicator-border<x:c-><x:wh- test="$sortColumn=position()-1 and $sortDirection=\'Asc\'">ascending</x:wh-><x:wh- test="$sortColumn=position()-1 and $sortDirection=\'Desc\'">descending</x:wh-><x:o-></x:o-></x:c-><xsl:text> </xsl:text>ntb-column<x:v-x:s-$uniqueId"/>_<x:v-x:s-position()" /></x:a-> <div> <x:a-x:n-class">ntb-column-indicator ntb-column-indicator<x:v-x:s-$uniqueId" /></x:a-> <x:c-> <x:wh- test="@Label and not(@Label = \'\') and not(@Label = \' \')"><x:v-x:s-@Label" /></x:wh-> <x:wh- test="ntb:label and not(ntb:label = \'\') and not(ntb:label = \' \')"><x:v-x:s-ntb:label" /></x:wh-> <x:o->ATOKENTOREPLACE</x:o-> </x:c-> </div> </td> </xsl:if> </xsl:for-each> </tr> <x:ct-x:n-colgroup" /> </table> </xsl:if> <table cellpadding="0" cellspacing="0" border="0" class="ntb-grid-datablock"> <x:at-x:s-key(\'data-source\', $dataTableId)/ntb:data/ntb:e[@xi &gt;= $start and @xi &lt; $end]" > <xsl:sortx:s-@xi" data-type="number" /> </x:at-> <x:ct-x:n-colgroup" /> </table> </div></x:t-><x:t-x:n-colgroup"> <colgroup> <xsl:for-eachx:s-$columns"> <xsl:if test="@Hidden = \'0\' and (position() &gt; $firstColumn and position() &lt;= $lastColumn)"> <col> </col> </xsl:if> </xsl:for-each> </colgroup></x:t-><x:t- match="ntb:e"> <x:va-x:n-rowClass"> <xsl:if test="@xi mod 2 = 0">ntb-row-alternate</xsl:if> <!-- <xsl:if test="<x:v-x:s-@rowselectattr=1"/>">ebarowselected</xsl:if> --> </x:va-> <x:va-x:n-xi"x:s-@xi" /> <x:va-x:n-row"x:s-." /> <tr class="ntb-row {$rowClass} ntb-row{$uniqueId}" xi="{$xi}"> <x:a-x:n-id">row_<x:v-x:s-$xi" /><x:v-x:s-$frozenColumnId"/>_<x:v-x:s-$uniqueId" /></x:a-> <xsl:for-eachx:s-$columns"> <xsl:if test="@Hidden = \'0\' and (position() &gt; $firstColumn and position() &lt;= $lastColumn)"> <x:ct-x:n-render-cell"> <x:w-x:n-row"x:s-$row"/> <x:w-x:n-xi"x:s-$xi"/> </x:ct-> </xsl:if> </xsl:for-each> </tr></x:t-> <x:t-x:n-render-cell"> <x:p-x:n-row" /> <x:p-x:n-xi" /> <x:va-x:n-xdatafld"x:s-substring-after(@xdatafld,\'@\')"/> <x:va-x:n-pos"x:s-position()-1"/> <x:va-x:n-value"><x:c-><x:wh- test="not(@xdatafld = \'\')"><x:v-x:s-$row/@*[name()=$xdatafld]" /></x:wh-><!-- @Value will actuall have some escaped XSLT in it like any other bound property --><x:o-><x:v-x:s-@Value" /></x:o-></x:c-></x:va-> <td ebatype="cell" style="vertical-align:middle;" id="cell_{$xi}_{$pos}_{$uniqueId}" xi="{$xi}" col="{$pos}"> <x:a-x:n-style"><x:ct-x:n-CssStyle"><x:w-x:n-row"x:s-$row"/></x:ct-></x:a-> <!-- note the use of the ntb-column<x:v-x:s-$uniqueId"/>_<x:v-x:s-position()" /> class ... that is for a safari bug --> <x:a-x:n-class">ntb-cell-border<xsl:text> </xsl:text>ntb-column-data<x:v-x:s-$uniqueId"/>_<x:v-x:s-position()" /><xsl:text> </xsl:text>ntb-column-<x:c-><x:wh- test="$sortColumn=$pos and $sortDirection=\'Asc\'">ascending</x:wh-><x:wh- test="$sortColumn=$pos and $sortDirection=\'Desc\'">descending</x:wh-><x:o-></x:o-></x:c-><xsl:text> </xsl:text>ntb-column-<x:v-x:s-@DataType"/><xsl:text> </xsl:text><x:ct-x:n-ClassName"><x:w-x:n-row"x:s-$row"/></x:ct-><xsl:text> </xsl:text><xsl:if test="@type = \'NUMBER\' and $value &lt; 0">ntb-cell-negativenumber</xsl:if><xsl:text> </xsl:text>ntb-column<x:v-x:s-$uniqueId"/>_<x:v-x:s-position()" /></x:a-> <div> <x:a-x:n-class">ntb-row<x:v-x:s-$uniqueId"/><xsl:text> </xsl:text>ntb-column-data<x:v-x:s-$uniqueId"/>_<x:v-x:s-position()" /><xsl:text> </xsl:text>ntb-cell-col_<x:v-x:s-position()" /></x:a-> <xsl:if test="$toolTipsEnabled=\'1\'"> <x:a-x:n-title"> <x:v-x:s-$value" /> </x:a-> </xsl:if> <x:at-x:s-."> <x:w-x:n-value"x:s-$value"/> </x:at-> </div> </td> </x:t-> <x:t- match="*[@type=\'TEXT\' or @type=\'\']"> <x:p-x:n-value" /> <x:ct-x:n-replaceblank"> <x:w-x:n-value"x:s-$value" /> </x:ct-> </x:t-> <x:t- match="*[@type=\'NUMBER\']"> <x:p-x:n-value" /> <x:va-x:n-number-mask"> <x:c-> <x:wh- test="@Mask"><x:v-x:s-@Mask" /></x:wh-> <x:o->#,###.00</x:o-> </x:c-> </x:va-> <x:va-x:n-negative-number-mask"> <x:c-> <x:wh- test="@NegativeMask and not(@NegativeMask=\'\')"><x:v-x:s-@NegativeMask" /></x:wh-> <x:o-><x:v-x:s-@NegativeMask" /></x:o-> </x:c-> </x:va-> <x:va-x:n-number"> <x:c-> <x:wh- test="$value &lt; 0"> <x:ct-x:n-n:format"> <x:w-x:n-number"x:s-translate($value,\'-\',\'\')" /> <x:w-x:n-mask"x:s-$negative-number-mask" /> <x:w-x:n-group"x:s-@GroupingSeparator" /> <x:w-x:n-decimal"x:s-@DecimalSeparator" /> </x:ct-> </x:wh-> <x:o-> <x:ct-x:n-n:format"> <x:w-x:n-number"x:s-$value" /> <x:w-x:n-mask"x:s-$number-mask" /> <x:w-x:n-group"x:s-@GroupingSeparator" /> <x:w-x:n-decimal"x:s-@DecimalSeparator" /> </x:ct-> </x:o-> </x:c-> </x:va-> <x:ct-x:n-replaceblank"> <x:w-x:n-value"x:s-$number" /> </x:ct-> </x:t-> <x:t- match="*[@type=\'LOOKUP\']"> <x:p-x:n-value" /> <x:va-x:n-valueField"x:s-@ValueField" /> <x:va-x:n-displayFields"x:s-@DisplayFields" /> <x:c-> <x:wh- test="$valueField = $displayFields"> <x:ct-x:n-replaceblank"> <x:w-x:n-value"x:s-$value" /> </x:ct-> </x:wh-> <x:o-> <x:ct-x:n-replaceblank"> <x:w-x:n-value"> <x:c-> <x:wh- test="@DatasourceId"> <x:va-x:n-preset-value" > <xsl:for-eachx:s-key(\'data-source\',@DatasourceId)//*"> <xsl:if test="@*[name(.)=$valueField and .=$value]"> <x:ct-x:n-print-displayfields"> <x:w-x:n-field"x:s-$displayFields" /> </x:ct-> </xsl:if> </xsl:for-each> </x:va-> <x:c-> <x:wh- test="$preset-value=\'\'"> <x:v-x:s-$value"/> </x:wh-> <x:o-> <x:v-x:s-$preset-value"/> </x:o-> </x:c-> </x:wh-> <x:o-> <x:v-x:s-$value"/> </x:o-> </x:c-> </x:w-> </x:ct-> </x:o-> </x:c-> </x:t-> <x:t- match="*[@type=\'LISTBOX\']"> <x:p-x:n-value" /> <x:va-x:n-valueField"x:s-@ValueField" /> <x:va-x:n-displayFields"x:s-@DisplayFields" /> <x:c-> <x:wh- test="@DatasourceId"> <x:va-x:n-temp-value"> <xsl:for-eachx:s-key(\'data-source\',@DatasourceId)//*"> <xsl:if test="@*[name(.)=$valueField and .=$value]"> <x:ct-x:n-replaceblank"> <x:w-x:n-value"> <x:ct-x:n-print-displayfields"> <x:w-x:n-field"x:s-$displayFields" /> </x:ct-> </x:w-> </x:ct-> </xsl:if> </xsl:for-each> </x:va-> <x:c-> <x:wh- test="not($temp-value = \'\')"> <x:v-x:s-$temp-value"/> </x:wh-> <x:o-> <x:ct-x:n-replaceblank"> <x:w-x:n-value"x:s-$value" /> </x:ct-> </x:o-> </x:c-> </x:wh-> <x:o-> <x:ct-x:n-replaceblank"> <x:w-x:n-value"x:s-$value" /> </x:ct-> </x:o-> </x:c-> </x:t-> <x:t- match="*[@type=\'CHECKBOX\']"> <x:p-x:n-value" /> <x:va-x:n-valueField"x:s-@ValueField" /> <x:va-x:n-displayFields"x:s-@DisplayFields" /> <x:va-x:n-checkedValue"x:s-@CheckedValue" /> <xsl:for-eachx:s-key(\'data-source\',@DatasourceId)//*"> <xsl:if test="@*[name(.)=$valueField and .=$value]"> <x:va-x:n-checkString"> <x:c-> <x:wh- test="$value=$checkedValue">checked</x:wh-> <x:o->unchecked</x:o-> </x:c-> </x:va-> <div style="overflow:hidden;"> <div class="ntb-checkbox ntb-checkbox-{$checkString}" checked="{$value}" width="10" >ATOKENTOREPLACE</div> <div class="ntb-checkbox-text"><x:v-x:s-@*[name(.)=$displayFields]" /></div> </div> </xsl:if> </xsl:for-each> </x:t-> <x:t- match="*[@type=\'IMAGE\']"> <x:p-x:n-value" /> <x:va-x:n-url"> <x:c-> <x:wh- test="@ImageUrl and not(@ImageUrl=\'\')"><x:v-x:s-@ImageUrl" /></x:wh-> <x:o-><x:v-x:s-$value" /></x:o-> </x:c-> </x:va-> <!-- image editor --> <div style="background-image:url(\'{$url}\');background-repeat:no-repeat;" class="ntb-image"> <img border="0" src="{$url}" align="middle" style="visibility:hidden;" /> </div> </x:t-> <x:t- match="*[@type=\'DATE\']"> <x:p-x:n-value" /> <x:va-x:n-date-mask"> <x:c-> <x:wh- test="@Mask"><x:v-x:s-@Mask" /></x:wh-> <x:o->MMM d, yy</x:o-> </x:c-> </x:va-> <x:va-x:n-date"> <x:ct-x:n-d:format-date"> <x:w-x:n-date-time"x:s-$value" /> <x:w-x:n-mask"x:s-$date-mask" /> </x:ct-> </x:va-> <x:ct-x:n-replaceblank"> <x:w-x:n-value"x:s-$date" /> </x:ct-> </x:t-> <x:t- match="*[@type=\'TEXTAREA\']"> <x:p-x:n-value" /> <x:ct-x:n-replace-break"> <x:w-x:n-text"> <x:ct-x:n-replaceblank"> <x:w-x:n-value"x:s-$value" /> </x:ct-> </x:w-> </x:ct-> </x:t-> <x:t- match="*[@type=\'PASSWORD\']">********</x:t-> <x:t- match="*[@type=\'LINK\']"> <x:p-x:n-value" /> <span class="ntb-hyperlink-editor"> <x:ct-x:n-replaceblank"> <x:w-x:n-value"x:s-$value" /> </x:ct-> </span> </x:t-> <x:t-x:n-placeholder"/><x:t-x:n-replaceblank"> <x:p-x:n-value" /> <x:c-> <x:wh- test="not($value) or $value = \'\' or $value = \' \'">ATOKENTOREPLACE</x:wh-> <x:o-><x:v-x:s-$value" /></x:o-> </x:c-></x:t-><x:t-x:n-replace"> <x:p-x:n-text"/> <x:p-x:n-search"/> <x:p-x:n-replacement"/> <x:c-> <x:wh- test="contains($text, $search)"> <x:v-x:s-substring-before($text, $search)"/> <x:v-x:s-$replacement"/> <x:ct-x:n-replace"> <x:w-x:n-text"x:s-substring-after($text,$search)"/> <x:w-x:n-search"x:s-$search"/> <x:w-x:n-replacement"x:s-$replacement"/> </x:ct-> </x:wh-> <x:o-> <x:v-x:s-$text"/> </x:o-> </x:c-></x:t-><x:t-x:n-print-displayfields"> <x:p-x:n-field" /> <x:c-> <x:wh- test="contains($field,\'|\')" > <!-- Here we hardcode a spacer \', \' - this should probably be moved elsewhere. --> <x:v-x:s-concat(@*[name(.)=substring-before($field,\'|\')],\', \')" /> <x:ct-x:n-print-displayfields"> <x:w-x:n-field"x:s-substring-after($field,\'|\')" /> </x:ct-> </x:wh-> <x:o-> <x:v-x:s-@*[name(.)=$field]" /> </x:o-> </x:c-></x:t-><x:t-x:n-replace-break"> <x:p-x:n-text"/> <x:ct-x:n-replace"> <x:w-x:n-text"x:s-$text"/> <x:w-x:n-search"x:s-\'&amp;amp;#xa;\'"/> <x:w-x:n-replacement"x:s-\'&amp;lt;br/&amp;gt;\'"/> </x:ct-></x:t-><x:t-x:n-ClassName"> <x:p-x:n-row"/> <x:va-x:n-class"x:s-@ClassName"/> <x:va-x:n-value"x:s-$row/@*[name()=$class]"/> <x:c-> <x:wh- test="$value"><x:v-x:s-$value"/></x:wh-> <x:o-><x:v-x:s-$class"/></x:o-> </x:c-></x:t-><x:t-x:n-CssStyle"> <x:p-x:n-row"/> <x:va-x:n-style"x:s-@CssStyle"/> <x:va-x:n-value"x:s-$row/@*[name()=$style]"/> <x:c-> <x:wh- test="$value"><x:v-x:s-$value"/></x:wh-> <x:o-><x:v-x:s-$style"/></x:o-> </x:c-></x:t-><!--This can be used as an insertion point for column templates--> <!--COLUMN-TYPE-TEMPLATES--></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.grid");
nitobi.grid.rowXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_rowXslProc));

var temp_ntb_sortXslProc='<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <xsl:output method="xml" omit-xml-declaration="yes" /> <x:p-x:n-column"x:s-@xi"> </x:p-> <x:p-x:n-dir"x:s-\'ascending\'"> </x:p-> <x:p-x:n-type"x:s-\'text\'"> </x:p-> <x:t- match="*|@*"> <xsl:copy> <x:at-x:s-@*|node()" /> </xsl:copy> </x:t-> <x:t- match="ntb:data"> <xsl:copy> <x:at-x:s-@*"/> <xsl:for-eachx:s-ntb:e"> <xsl:sortx:s-@*[name() =$column]" order="{$dir}" data-type="{$type}"/> <xsl:copy> <x:a-x:n-xi"> <x:v-x:s-position()-1" /> </x:a-> <x:at-x:s-@*" /> </xsl:copy> </xsl:for-each> </xsl:copy> </x:t-><x:t- match="@xi" /></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.data");
nitobi.data.sortXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_sortXslProc));

var temp_ntb_fillColumnXslProc='<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <xsl:output method="xml" omit-xml-declaration="no" /> <x:p-x:n-startRowIndex"x:s-0" ></x:p-> <x:p-x:n-endRowIndex"x:s-10000" ></x:p-> <x:p-x:n-value"x:s-test"></x:p-> <x:p-x:n-column"x:s-a"></x:p-> <x:t- match="@* | node()" > <xsl:copy> <x:at-x:s-@*|node()" /> </xsl:copy> </x:t-> <x:t- match="/ntb:grid/ntb:datasources/ntb:datasource/ntb:data/ntb:e"> <x:c-> <x:wh- test="(number(@xi) &gt;= $startRowIndex) and (number(@xi) &lt;= $endRowIndex)"> <xsl:copy> <xsl:copy-ofx:s-@*" /> <x:a-x:n-{$column}"><x:v-x:s-$value" /></x:a-> </xsl:copy> </x:wh-> <x:o-> <xsl:copy> <x:at-x:s-@*|node()" /> </xsl:copy> </x:o-> </x:c-> </x:t-></xsl:stylesheet> ';
nitobi.lang.defineNs("nitobi.data");
nitobi.data.fillColumnXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_fillColumnXslProc));

var temp_ntb_updategramTranslatorXslProc='<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes"/> <x:p-x:n-datasource-id"x:s-\'_default\'"></x:p-> <x:p-x:n-xkField" ></x:p-> <x:t- match="/"> <root> <x:at-x:s-//ntb:datasource[@id=$datasource-id]/ntb:data/ntb:e" /> </root> </x:t-> <x:t- match="ntb:e"> <x:c-> <x:wh- test="@xac=\'d\'"> <delete xi="{@xi}" xk="{@*[name() = $xkField]}"></delete> </x:wh-> <x:wh- test="@xac=\'i\'"> <insert><xsl:copy-ofx:s-@*[not(name() = $xkField) and not(name() = \'xac\')]" /><x:a-x:n-xk"><x:v-x:s-@*[name() = $xkField]" /></x:a-></insert> </x:wh-> <x:wh- test="@xac=\'u\'"> <update><xsl:copy-ofx:s-@*[not(name() = $xkField) and not(name() = \'xac\')]" /><x:a-x:n-xk"><x:v-x:s-@*[name() = $xkField]" /></x:a-></update> </x:wh-> </x:c-> </x:t-></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.data");
nitobi.data.updategramTranslatorXslProc = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_updategramTranslatorXslProc));

var temp_ntb_datePickerTemplate='<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntb="http://www.nitobi.com"> <xsl:output method="xml" omit-xml-declaration="yes" /> <xsl:strip-space elements="*"/> <x:t- match="ntb:datepicker"> <div id="{@id}"> <x:a-x:n-class"> ntb-calendar-reset <x:v-x:s-@theme"/> </x:a-> <x:at-x:s-ntb:dateinput"/> <xsl:if test="ntb:calendar and ntb:dateinput"> <div id="{@id}.button" style="float:left;" class="ntb-calendar-button"> <x:ct-x:n-dummy"></x:ct-> </div> </xsl:if> <div style="display:block;clear:both;float:none;height:0px;width:auto;overflow:hidden;"><xsl:comment>dummy</xsl:comment></div> <x:at-x:s-ntb:calendar"/> <input id="{@id}.value" type="hidden" value=""x:n-{@id}"/> </div> </x:t-> <x:t- match="ntb:dateinput"> <x:va-x:n-width"> <x:c-> <x:wh- test="contains(@width, \'px\')"> <x:v-x:s-substring-before(@width, \'px\')"/> </x:wh-> <x:o-> <x:v-x:s-@width" /> </x:o-> </x:c-> </x:va-> <div id="{@id}" style="float:left;"> <div id="{@id}.container" class="ntb-inputcontainer"> <x:a-x:n-style"> <xsl:if test="@width">width:<x:v-x:s-$width"/>px;</xsl:if> </x:a-> <input id="{@id}.input" type="text" class="ntb-dateinput"> <x:a-x:n-style"> font-size:100%;<xsl:if test="@cssstyle"><x:v-x:s-@cssstyle"/></xsl:if>; <xsl:if test="@width">width: <x:v-x:s-number($width) - 10"/>px;</xsl:if> </x:a-> <xsl:if test="@editable = \'false\'"> <x:a-x:n-disabled">true</x:a-> </xsl:if> </input> </div> </div> </x:t-> <x:t- match="ntb:calendar"> <div id="{@id}" onselectstart="return false;"> <x:a-x:n-style"> <xsl:if test="../ntb:dateinput">position:absolute;z-index:1000;</xsl:if>overflow:hidden; </x:a-> <x:a-x:n-class"> ntb-calendar-container nitobi-hide </x:a-> <x:ct-x:n-dummy"/> </div> </x:t-> <x:t-x:n-dummy"> <xsl:comment>dummy</xsl:comment> </x:t-></xsl:stylesheet>';
nitobi.lang.defineNs("nitobi.calendar");
nitobi.calendar.datePickerTemplate = nitobi.xml.createXslProcessor(nitobiXmlDecodeXslt(temp_ntb_datePickerTemplate));


