From 13b256cdf8e3cef810d1b3dcf580be751b94c9fe Mon Sep 17 00:00:00 2001 From: wei <> Date: Tue, 29 Aug 2006 11:12:33 +0000 Subject: Add separate debug javascript build. --- framework/Web/Javascripts/js/compressed/rico.js | 265 ++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 framework/Web/Javascripts/js/compressed/rico.js (limited to 'framework/Web/Javascripts/js/compressed/rico.js') diff --git a/framework/Web/Javascripts/js/compressed/rico.js b/framework/Web/Javascripts/js/compressed/rico.js new file mode 100644 index 00000000..ff75a9f9 --- /dev/null +++ b/framework/Web/Javascripts/js/compressed/rico.js @@ -0,0 +1,265 @@ + +var Rico={Version:'1.1rc1',prototypeVersion:parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])} +Rico.ArrayExtensions=new Array();if(Object.prototype.extend){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend;}else{Object.prototype.extend=function(object){return Object.extend.apply(this,[this,object]);} +Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend;} +if(Array.prototype.push){Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.push;} +if(!Array.prototype.remove){Array.prototype.remove=function(dx){if(isNaN(dx)||dx>this.length) +return false;for(var i=0,n=0;i=this.accordionTabs.length) +this.options.onLoadShowTab=0;for(var i=0;i"+el.innerHTML+""},_roundTopCorners:function(el,color,bgColor){var corner=this._createCorner(bgColor);for(var i=0;i=0;i--) +corner.appendChild(this._createCornerSlice(color,bgColor,i,"bottom"));el.style.paddingBottom=0;el.appendChild(corner);},_createCorner:function(bgColor){var corner=document.createElement("div");corner.style.backgroundColor=(this._isTransparent()?"transparent":bgColor);return corner;},_createCornerSlice:function(color,bgColor,n,position){var slice=document.createElement("span");var inStyle=slice.style;inStyle.backgroundColor=color;inStyle.display="block";inStyle.height="1px";inStyle.overflow="hidden";inStyle.fontSize="1px";var borderColor=this._borderColor(color,bgColor);if(this.options.border&&n==0){inStyle.borderTopStyle="solid";inStyle.borderTopWidth="1px";inStyle.borderLeftWidth="0px";inStyle.borderRightWidth="0px";inStyle.borderBottomWidth="0px";inStyle.height="0px";inStyle.borderColor=borderColor;} +else if(borderColor){inStyle.borderColor=borderColor;inStyle.borderStyle="solid";inStyle.borderWidth="0px 1px";} +if(!this.options.compact&&(n==(this.options.numSlices-1))) +inStyle.height="2px";this._setMargin(slice,n,position);this._setBorder(slice,n,position);return slice;},_setOptions:function(options){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false} +Object.extend(this.options,options||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()) +this.options.blend=false;},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")) +return"";if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0) +return"";if(this.options.corners.indexOf("tl")>=0) +return"left";else if(this.options.corners.indexOf("tr")>=0) +return"right";return"";},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")) +return"";if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0) +return"";if(this.options.corners.indexOf("bl")>=0) +return"left";else if(this.options.corners.indexOf("br")>=0) +return"right";return"";},_borderColor:function(color,bgColor){if(color=="transparent") +return bgColor;else if(this.options.border) +return this.options.border;else if(this.options.blend) +return this._blend(bgColor,color);else +return"";},_setMargin:function(el,n,corners){var marginSize=this._marginSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.marginLeft=marginSize+"px";el.style.marginRight="0px";} +else if(whichSide=="right"){el.style.marginRight=marginSize+"px";el.style.marginLeft="0px";} +else{el.style.marginLeft=marginSize+"px";el.style.marginRight=marginSize+"px";}},_setBorder:function(el,n,corners){var borderSize=this._borderSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth="0px";} +else if(whichSide=="right"){el.style.borderRightWidth=borderSize+"px";el.style.borderLeftWidth="0px";} +else{el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";} +if(this.options.border!=false) +el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";},_marginSize:function(n){if(this._isTransparent()) +return 0;var marginSizes=[5,3,2,1];var blendedMarginSizes=[3,2,1,0];var compactMarginSizes=[2,1];var smBlendedMarginSizes=[1,0];if(this.options.compact&&this.options.blend) +return smBlendedMarginSizes[n];else if(this.options.compact) +return compactMarginSizes[n];else if(this.options.blend) +return blendedMarginSizes[n];else +return marginSizes[n];},_borderSize:function(n){var transparentBorderSizes=[5,3,2,1];var blendedBorderSizes=[2,1,1,1];var compactBorderSizes=[1,0];var actualBorderSizes=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())) +return 1;else if(this.options.compact) +return compactBorderSizes[n];else if(this.options.blend) +return blendedBorderSizes[n];else if(this.options.border) +return actualBorderSizes[n];else if(this._isTransparent()) +return transparentBorderSizes[n];return 0;},_hasString:function(str){for(var i=1;i=0)return true;return false;},_blend:function(c1,c2){var cc1=Rico.Color.createFromHex(c1);cc1.blend(Rico.Color.createFromHex(c2));return cc1;},_background:function(el){try{return Rico.Color.createColorFromBackground(el).asHex();}catch(err){return"#ffffff";}},_isTransparent:function(){return this.options.color=="transparent";},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr");},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br");},_hasSingleTextChild:function(el){return el.childNodes.length==1&&el.childNodes[0].nodeType==3;}} +if(window.Effect==undefined) +Effect={};Effect.SizeAndPosition=Class.create();Effect.SizeAndPosition.prototype={initialize:function(element,x,y,w,h,duration,steps,options){this.element=$(element);this.x=x;this.y=y;this.w=w;this.h=h;this.duration=duration;this.steps=steps;this.options=arguments[7]||{};this.sizeAndPosition();},sizeAndPosition:function(){if(this.isFinished()){if(this.options.complete)this.options.complete(this);return;} +if(this.timer) +clearTimeout(this.timer);var stepDuration=Math.round(this.duration/this.steps);var currentX=this.element.offsetLeft;var currentY=this.element.offsetTop;var currentW=this.element.offsetWidth;var currentH=this.element.offsetHeight;this.x=(this.x)?this.x:currentX;this.y=(this.y)?this.y:currentY;this.w=(this.w)?this.w:currentW;this.h=(this.h)?this.h:currentH;var difX=this.steps>0?(this.x-currentX)/this.steps:0;var difY=this.steps>0?(this.y-currentY)/this.steps:0;var difW=this.steps>0?(this.w-currentW)/this.steps:0;var difH=this.steps>0?(this.h-currentH)/this.steps:0;this.moveBy(difX,difY);this.resizeBy(difW,difH);this.duration-=stepDuration;this.steps--;this.timer=setTimeout(this.sizeAndPosition.bind(this),stepDuration);},isFinished:function(){return this.steps<=0;},moveBy:function(difX,difY){var currentLeft=this.element.offsetLeft;var currentTop=this.element.offsetTop;var intDifX=parseInt(difX);var intDifY=parseInt(difY);var style=this.element.style;if(intDifX!=0) +style.left=(currentLeft+intDifX)+"px";if(intDifY!=0) +style.top=(currentTop+intDifY)+"px";},resizeBy:function(difW,difH){var currentWidth=this.element.offsetWidth;var currentHeight=this.element.offsetHeight;var intDifW=parseInt(difW);var intDifH=parseInt(difH);var style=this.element.style;if(intDifW!=0) +style.width=(currentWidth+intDifW)+"px";if(intDifH!=0) +style.height=(currentHeight+intDifH)+"px";}} +Effect.Size=Class.create();Effect.Size.prototype={initialize:function(element,w,h,duration,steps,options){new Effect.SizeAndPosition(element,null,null,w,h,duration,steps,options);}} +Effect.Position=Class.create();Effect.Position.prototype={initialize:function(element,x,y,duration,steps,options){new Effect.SizeAndPosition(element,x,y,null,null,duration,steps,options);}} +Effect.Round=Class.create();Effect.Round.prototype={initialize:function(tagName,className,options){var elements=document.getElementsByTagAndClassName(tagName,className);for(var i=0;i0?(this.opacity-currentOpacity)/this.steps:0;this.changeOpacityBy(delta);this.duration-=stepDuration;this.steps--;this.timer=setTimeout(this.fadeTo.bind(this),stepDuration);},changeOpacityBy:function(v){var currentOpacity=this.getElementOpacity();var newOpacity=Math.max(0,Math.min(currentOpacity+v,1));this.element.ricoOpacity=newOpacity;this.element.style.filter="alpha(opacity:"+Math.round(newOpacity*100)+")";this.element.style.opacity=newOpacity;;},isFinished:function(){return this.steps<=0;},getElementOpacity:function(){if(this.element.ricoOpacity==undefined){var opacity=RicoUtil.getElementsComputedStyle(this.element,'opacity');this.element.ricoOpacity=opacity!=undefined?opacity:1.0;} +return parseFloat(this.element.ricoOpacity);}} +Effect.AccordionSize=Class.create();Effect.AccordionSize.prototype={initialize:function(e1,e2,start,end,duration,steps,options){this.e1=$(e1);this.e2=$(e2);this.start=start;this.end=end;this.duration=duration;this.steps=steps;this.options=arguments[6]||{};this.accordionSize();},accordionSize:function(){if(this.isFinished()){this.e1.style.height=this.start+"px";this.e2.style.height=this.end+"px";if(this.options.complete) +this.options.complete(this);return;} +if(this.timer) +clearTimeout(this.timer);var stepDuration=Math.round(this.duration/this.steps);var diff=this.steps>0?(parseInt(this.e1.offsetHeight)-this.start)/this.steps:0;this.resizeBy(diff);this.duration-=stepDuration;this.steps--;this.timer=setTimeout(this.accordionSize.bind(this),stepDuration);},isFinished:function(){return this.steps<=0;},resizeBy:function(diff){var h1Height=this.e1.offsetHeight;var h2Height=this.e2.offsetHeight;var intDiff=parseInt(diff);if(diff!=0){this.e1.style.height=(h1Height-intDiff)+"px";this.e2.style.height=(h2Height+intDiff)+"px";}}};if(window.Effect==undefined) +Effect={};Effect.SizeAndPosition=Class.create();Effect.SizeAndPosition.prototype={initialize:function(element,x,y,w,h,duration,steps,options){this.element=$(element);this.x=x;this.y=y;this.w=w;this.h=h;this.duration=duration;this.steps=steps;this.options=arguments[7]||{};this.sizeAndPosition();},sizeAndPosition:function(){if(this.isFinished()){if(this.options.complete)this.options.complete(this);return;} +if(this.timer) +clearTimeout(this.timer);var stepDuration=Math.round(this.duration/this.steps);var currentX=this.element.offsetLeft;var currentY=this.element.offsetTop;var currentW=this.element.offsetWidth;var currentH=this.element.offsetHeight;this.x=(this.x)?this.x:currentX;this.y=(this.y)?this.y:currentY;this.w=(this.w)?this.w:currentW;this.h=(this.h)?this.h:currentH;var difX=this.steps>0?(this.x-currentX)/this.steps:0;var difY=this.steps>0?(this.y-currentY)/this.steps:0;var difW=this.steps>0?(this.w-currentW)/this.steps:0;var difH=this.steps>0?(this.h-currentH)/this.steps:0;this.moveBy(difX,difY);this.resizeBy(difW,difH);this.duration-=stepDuration;this.steps--;this.timer=setTimeout(this.sizeAndPosition.bind(this),stepDuration);},isFinished:function(){return this.steps<=0;},moveBy:function(difX,difY){var currentLeft=this.element.offsetLeft;var currentTop=this.element.offsetTop;var intDifX=parseInt(difX);var intDifY=parseInt(difY);var style=this.element.style;if(intDifX!=0) +style.left=(currentLeft+intDifX)+"px";if(intDifY!=0) +style.top=(currentTop+intDifY)+"px";},resizeBy:function(difW,difH){var currentWidth=this.element.offsetWidth;var currentHeight=this.element.offsetHeight;var intDifW=parseInt(difW);var intDifH=parseInt(difH);var style=this.element.style;if(intDifW!=0) +style.width=(currentWidth+intDifW)+"px";if(intDifH!=0) +style.height=(currentHeight+intDifH)+"px";}} +Effect.Size=Class.create();Effect.Size.prototype={initialize:function(element,w,h,duration,steps,options){new Effect.SizeAndPosition(element,null,null,w,h,duration,steps,options);}} +Effect.Position=Class.create();Effect.Position.prototype={initialize:function(element,x,y,duration,steps,options){new Effect.SizeAndPosition(element,x,y,null,null,duration,steps,options);}} +Effect.Round=Class.create();Effect.Round.prototype={initialize:function(tagName,className,options){var elements=document.getElementsByTagAndClassName(tagName,className);for(var i=0;i0?(this.opacity-currentOpacity)/this.steps:0;this.changeOpacityBy(delta);this.duration-=stepDuration;this.steps--;this.timer=setTimeout(this.fadeTo.bind(this),stepDuration);},changeOpacityBy:function(v){var currentOpacity=this.getElementOpacity();var newOpacity=Math.max(0,Math.min(currentOpacity+v,1));this.element.ricoOpacity=newOpacity;this.element.style.filter="alpha(opacity:"+Math.round(newOpacity*100)+")";this.element.style.opacity=newOpacity;;},isFinished:function(){return this.steps<=0;},getElementOpacity:function(){if(this.element.ricoOpacity==undefined){var opacity=RicoUtil.getElementsComputedStyle(this.element,'opacity');this.element.ricoOpacity=opacity!=undefined?opacity:1.0;} +return parseFloat(this.element.ricoOpacity);}} +Effect.AccordionSize=Class.create();Effect.AccordionSize.prototype={initialize:function(e1,e2,start,end,duration,steps,options){this.e1=$(e1);this.e2=$(e2);this.start=start;this.end=end;this.duration=duration;this.steps=steps;this.options=arguments[6]||{};this.accordionSize();},accordionSize:function(){if(this.isFinished()){this.e1.style.height=this.start+"px";this.e2.style.height=this.end+"px";if(this.options.complete) +this.options.complete(this);return;} +if(this.timer) +clearTimeout(this.timer);var stepDuration=Math.round(this.duration/this.steps);var diff=this.steps>0?(parseInt(this.e1.offsetHeight)-this.start)/this.steps:0;this.resizeBy(diff);this.duration-=stepDuration;this.steps--;this.timer=setTimeout(this.accordionSize.bind(this),stepDuration);},isFinished:function(){return this.steps<=0;},resizeBy:function(diff){var h1Height=this.e1.offsetHeight;var h2Height=this.e2.offsetHeight;var intDiff=parseInt(diff);if(diff!=0){this.e1.style.height=(h1Height-intDiff)+"px";this.e2.style.height=(h2Height+intDiff)+"px";}}};Rico.LiveGridMetaData=Class.create();Rico.LiveGridMetaData.prototype={initialize:function(pageSize,totalRows,columnCount,options){this.pageSize=pageSize;this.totalRows=totalRows;this.setOptions(options);this.ArrowHeight=16;this.columnCount=columnCount;},setOptions:function(options){this.options={largeBufferSize:7.0,nearLimitFactor:0.2};Object.extend(this.options,options||{});},getPageSize:function(){return this.pageSize;},getTotalRows:function(){return this.totalRows;},setTotalRows:function(n){this.totalRows=n;},getLargeBufferSize:function(){return parseInt(this.options.largeBufferSize*this.pageSize);},getLimitTolerance:function(){return parseInt(this.getLargeBufferSize()*this.options.nearLimitFactor);}};Rico.LiveGridScroller=Class.create();Rico.LiveGridScroller.prototype={initialize:function(liveGrid,viewPort){this.isIE=navigator.userAgent.toLowerCase().indexOf("msie")>=0;this.liveGrid=liveGrid;this.metaData=liveGrid.metaData;this.createScrollBar();this.scrollTimeout=null;this.lastScrollPos=0;this.viewPort=viewPort;this.rows=new Array();},isUnPlugged:function(){return this.scrollerDiv.onscroll==null;},plugin:function(){this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this);},unplug:function(){this.scrollerDiv.onscroll=null;},sizeIEHeaderHack:function(){if(!this.isIE)return;var headerTable=$(this.liveGrid.tableId+"_header");if(headerTable) +headerTable.rows[0].cells[0].style.width=(headerTable.rows[0].cells[0].offsetWidth+1)+"px";},createScrollBar:function(){var visibleHeight=this.liveGrid.viewPort.visibleHeight();this.scrollerDiv=document.createElement("div");var scrollerStyle=this.scrollerDiv.style;scrollerStyle.borderRight=this.liveGrid.options.scrollerBorderRight;scrollerStyle.position="relative";scrollerStyle.left=this.isIE?"-6px":"-3px";scrollerStyle.width="19px";scrollerStyle.height=visibleHeight+"px";scrollerStyle.overflow="auto";this.heightDiv=document.createElement("div");this.heightDiv.style.width="1px";this.heightDiv.style.height=parseInt(visibleHeight*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px";this.scrollerDiv.appendChild(this.heightDiv);this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this);var table=this.liveGrid.table;table.parentNode.parentNode.insertBefore(this.scrollerDiv,table.parentNode.nextSibling);var eventName=this.isIE?"mousewheel":"DOMMouseScroll";Event.observe(table,eventName,function(evt){if(evt.wheelDelta>=0||evt.detail<0) +this.scrollerDiv.scrollTop-=(2*this.viewPort.rowHeight);else +this.scrollerDiv.scrollTop+=(2*this.viewPort.rowHeight);this.handleScroll(false);}.bindAsEventListener(this),false);},updateSize:function(){var table=this.liveGrid.table;var visibleHeight=this.viewPort.visibleHeight();this.heightDiv.style.height=parseInt(visibleHeight*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px";},rowToPixel:function(rowOffset){return(rowOffset/this.metaData.getTotalRows())*this.heightDiv.offsetHeight},moveScroll:function(rowOffset){this.scrollerDiv.scrollTop=this.rowToPixel(rowOffset);if(this.metaData.options.onscroll) +this.metaData.options.onscroll(this.liveGrid,rowOffset);},handleScroll:function(){if(this.scrollTimeout) +clearTimeout(this.scrollTimeout);var scrollDiff=this.lastScrollPos-this.scrollerDiv.scrollTop;if(scrollDiff!=0.00){var r=this.scrollerDiv.scrollTop%this.viewPort.rowHeight;if(r!=0){this.unplug();if(scrollDiff<0){this.scrollerDiv.scrollTop+=(this.viewPort.rowHeight-r);}else{this.scrollerDiv.scrollTop-=r;} +this.plugin();}} +var contentOffset=parseInt(this.scrollerDiv.scrollTop/this.viewPort.rowHeight);this.liveGrid.requestContentRefresh(contentOffset);this.viewPort.scrollTo(this.scrollerDiv.scrollTop);if(this.metaData.options.onscroll) +this.metaData.options.onscroll(this.liveGrid,contentOffset);this.scrollTimeout=setTimeout(this.scrollIdle.bind(this),1200);this.lastScrollPos=this.scrollerDiv.scrollTop;},scrollIdle:function(){if(this.metaData.options.onscrollidle) +this.metaData.options.onscrollidle();}};Rico.LiveGridBuffer=Class.create();Rico.LiveGridBuffer.prototype={initialize:function(metaData,viewPort){this.startPos=0;this.size=0;this.metaData=metaData;this.rows=new Array();this.updateInProgress=false;this.viewPort=viewPort;this.maxBufferSize=metaData.getLargeBufferSize()*2;this.maxFetchSize=metaData.getLargeBufferSize();this.lastOffset=0;},getBlankRow:function(){if(!this.blankRow){this.blankRow=new Array();for(var i=0;ithis.startPos){if(this.startPos+this.rows.lengththis.maxBufferSize){var fullSize=this.rows.length;this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length) +this.startPos=this.startPos+(fullSize-this.rows.length);}}}else{if(start+newRows.lengththis.maxBufferSize) +this.rows=this.rows.slice(0,this.maxBufferSize)} +this.startPos=start;} +this.size=this.rows.length;},clear:function(){this.rows=new Array();this.startPos=0;this.size=0;},isOverlapping:function(start,size){return((start=this.startPos)&&(position+this.metaData.getPageSize()<=this.endPos());},isNearingTopLimit:function(position){return position-this.startPos=this.startPos){var endFetchOffset=this.maxFetchSize+adjustedOffset;if(endFetchOffset>this.metaData.totalRows) +endFetchOffset=this.metaData.totalRows;adjustedSize=endFetchOffset-adjustedOffset;if(adjustedOffset==0&&adjustedSizethis.maxFetchSize) +adjustedSize=this.maxFetchSize;} +return adjustedSize;},getFetchOffset:function(offset){var adjustedOffset=offset;if(offset>this.startPos) +adjustedOffset=(offset>this.endPos())?offset:this.endPos();else{if(offset+this.maxFetchSize>=this.startPos){var adjustedOffset=this.startPos-this.maxFetchSize;if(adjustedOffset<0) +adjustedOffset=0;}} +this.lastOffset=adjustedOffset;return adjustedOffset;},getRows:function(start,count){var begPos=start-this.startPos +var endPos=begPos+count +if(endPos>this.size) +endPos=this.size +var results=new Array() +var index=0;for(var i=begPos;istartPos +var contentStartPos=viewPrecedesBuffer?this.buffer.startPos:startPos;var contentEndPos=(this.buffer.startPos+this.buffer.size0;this.lastRowPos=startPos;this.liveGrid.table.className=this.liveGrid.options.tableClass;var onRefreshComplete=this.liveGrid.options.onRefreshComplete;if(onRefreshComplete!=null) +onRefreshComplete();},scrollTo:function(pixelOffset){if(this.lastPixelOffset==pixelOffset) +return;this.refreshContents(parseInt(pixelOffset/this.rowHeight)) +this.div.scrollTop=pixelOffset%this.rowHeight +this.lastPixelOffset=pixelOffset;},visibleHeight:function(){return parseInt(RicoUtil.getElementsComputedStyle(this.div,'height'));}};Rico.LiveGridRequest=Class.create();Rico.LiveGridRequest.prototype={initialize:function(requestOffset,options){this.requestOffset=requestOffset;}};Rico.LiveGrid=Class.create();Rico.LiveGrid.prototype={initialize:function(tableId,visibleRows,totalRows,url,options,ajaxOptions){this.options={tableClass:$(tableId).className,loadingClass:$(tableId).className,scrollerBorderRight:'1px solid #ababab',bufferTimeout:20000,sortAscendImg:'images/sort_asc.gif',sortDescendImg:'images/sort_desc.gif',sortImageWidth:9,sortImageHeight:5,ajaxSortURLParms:[],onRefreshComplete:null,requestParameters:null,inlineStyles:true};Object.extend(this.options,options||{});this.ajaxOptions={parameters:null};Object.extend(this.ajaxOptions,ajaxOptions||{});this.tableId=tableId;this.table=$(tableId);this.addLiveGridHtml();var columnCount=this.table.rows[0].cells.length;this.metaData=new Rico.LiveGridMetaData(visibleRows,totalRows,columnCount,options);this.buffer=new Rico.LiveGridBuffer(this.metaData);var rowCount=this.table.rows.length;this.viewPort=new Rico.GridViewPort(this.table,this.table.offsetHeight/rowCount,visibleRows,this.buffer,this);this.scroller=new Rico.LiveGridScroller(this,this.viewPort);this.options.sortHandler=this.sortHandler.bind(this);if($(tableId+'_header')) +this.sort=new Rico.LiveGridSort(tableId+'_header',this.options) +this.processingRequest=null;this.unprocessedRequest=null;this.initAjax(url);if(this.options.prefetchBuffer||this.options.prefetchOffset>0){var offset=0;if(this.options.offset){offset=this.options.offset;this.scroller.moveScroll(offset);this.viewPort.scrollTo(this.scroller.rowToPixel(offset));} +if(this.options.sortCol){this.sortCol=options.sortCol;this.sortDir=options.sortDir;} +this.requestContentRefresh(offset);}},addLiveGridHtml:function(){if(this.table.getElementsByTagName("thead").length>0){var tableHeader=this.table.cloneNode(true);tableHeader.setAttribute('id',this.tableId+'_header');tableHeader.setAttribute('class',this.table.className+'_header');for(var i=0;i");this.table.previousSibling.appendChild(this.table);new Insertion.Before(this.table,"
");this.table.previousSibling.appendChild(this.table);},resetContents:function(){this.scroller.moveScroll(0);this.buffer.clear();this.viewPort.clearContents();},sortHandler:function(column){this.sortCol=column.name;this.sortDir=column.currentSort;this.resetContents();this.requestContentRefresh(0)},setTotalRows:function(newTotalRows){this.resetContents();this.metaData.setTotalRows(newTotalRows);this.scroller.updateSize();},initAjax:function(url){ajaxEngine.registerRequest(this.tableId+'_request',url);ajaxEngine.registerAjaxObject(this.tableId+'_updater',this);},invokeAjax:function(){},handleTimedOut:function(){this.processingRequest=null;this.processQueuedRequest();},fetchBuffer:function(offset){if(this.buffer.isInRange(offset)&&!this.buffer.isNearingLimit(offset)){return;} +if(this.processingRequest){this.unprocessedRequest=new Rico.LiveGridRequest(offset);return;} +var bufferStartPos=this.buffer.getFetchOffset(offset);this.processingRequest=new Rico.LiveGridRequest(offset);this.processingRequest.bufferOffset=bufferStartPos;var fetchSize=this.buffer.getFetchSize(offset);var partialLoaded=false;var queryString +if(this.options.requestParameters) +queryString=this._createQueryString(this.options.requestParameters,0);queryString=(queryString==null)?'':queryString+'&';queryString=queryString+'id='+this.tableId+'&page_size='+fetchSize+'&offset='+bufferStartPos;if(this.sortCol) +queryString=queryString+'&sort_col='+escape(this.sortCol)+'&sort_dir='+this.sortDir;this.ajaxOptions.parameters=queryString;ajaxEngine.sendRequest(this.tableId+'_request',this.ajaxOptions);this.timeoutHandler=setTimeout(this.handleTimedOut.bind(this),this.options.bufferTimeout);},setRequestParams:function(){this.options.requestParameters=[];for(var i=0;i' ++'   ';}},headerCellClicked:function(evt){var eventTarget=evt.target?evt.target:evt.srcElement;var cellId=eventTarget.id;var columnNumber=parseInt(cellId.substring(cellId.lastIndexOf('_')+1));var sortedColumnIndex=this.getSortedColumnIndex();if(sortedColumnIndex!=-1){if(sortedColumnIndex!=columnNumber){this.removeColumnSort(sortedColumnIndex);this.setColumnSort(columnNumber,Rico.TableColumn.SORT_ASC);} +else +this.toggleColumnSort(sortedColumnIndex);} +else +this.setColumnSort(columnNumber,Rico.TableColumn.SORT_ASC);if(this.options.sortHandler){this.options.sortHandler(this.options.columns[columnNumber]);}},removeColumnSort:function(n){this.options.columns[n].setUnsorted();this.setSortImage(n);},setColumnSort:function(n,direction){this.options.columns[n].setSorted(direction);this.setSortImage(n);},toggleColumnSort:function(n){this.options.columns[n].toggleSort();this.setSortImage(n);},setSortImage:function(n){var sortDirection=this.options.columns[n].getSortDirection();var sortImageSpan=$(this.headerTableId+'_img_'+n);if(sortDirection==Rico.TableColumn.UNSORTED) +sortImageSpan.innerHTML='  ';else if(sortDirection==Rico.TableColumn.SORT_ASC) +sortImageSpan.innerHTML='  ';else if(sortDirection==Rico.TableColumn.SORT_DESC) +sortImageSpan.innerHTML='  ';},getSortedColumnIndex:function(){var cols=this.options.columns;for(var i=0;ithis.length) +return false;for(var i=0,n=0;i=0) +{var offset=this.options.initialOffset;this.scroller.moveScroll(offset);this.viewPort.scrollTo(this.scroller.rowToPixel(offset));if(this.options.sortCol){this.sortCol=options.sortCol;this.sortDir=options.sortDir;} +var grid=this;setTimeout(function(){grid.requestContentRefresh(offset);},100);}},fetchBuffer:function(offset) +{if(this.buffer.isInRange(offset)&&!this.buffer.isNearingLimit(offset)){return;} +if(this.processingRequest){this.unprocessedRequest=new Rico.LiveGridRequest(offset);return;} +var bufferStartPos=this.buffer.getFetchOffset(offset);this.processingRequest=new Rico.LiveGridRequest(offset);this.processingRequest.bufferOffset=bufferStartPos;var fetchSize=this.buffer.getFetchSize(offset);var partialLoaded=false;var param={'page_size':fetchSize,'offset':bufferStartPos};if(this.sortCol) +{Object.extend(param,{'sort_col':this.sortCol,'sort_dir':this.sortDir});} +Prado.Callback(this.tableId,param,this.ajaxUpdate.bind(this),this.options);this.timeoutHandler=setTimeout(this.handleTimedOut.bind(this),this.options.bufferTimeout);},ajaxUpdate:function(result,output) +{try{clearTimeout(this.timeoutHandler);this.buffer.update(result,this.processingRequest.bufferOffset);this.viewPort.bufferChanged();} +catch(err){} +finally{this.processingRequest=null;} +this.processQueuedRequest();}});Object.extend(Rico.LiveGridBuffer.prototype,{update:function(newRows,start) +{if(this.rows.length==0){this.rows=newRows;this.size=this.rows.length;this.startPos=start;return;} +if(start>this.startPos){if(this.startPos+this.rows.lengththis.maxBufferSize){var fullSize=this.rows.length;this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length) +this.startPos=this.startPos+(fullSize-this.rows.length);}}}else{if(start+newRows.lengththis.maxBufferSize) +this.rows=this.rows.slice(0,this.maxBufferSize)} +this.startPos=start;} +this.size=this.rows.length;}});Object.extend(Rico.GridViewPort.prototype,{populateRow:function(htmlRow,row) +{if(isdef(htmlRow)) +{for(var j=0;j