Rico.applyShadow=function(b,a){if(typeof a=="undefined"){a=true }if(a){Rico.addClass(b,"ricoShadow") }return b }; Rico._OpenPopupList=[]; Rico._RemoveOpenPopup=function(a){if(a.openIndex>=0&&a.openIndex0){var a=Rico._OpenPopupList.pop(); if(a&&a.visible()){a.openIndex=-1; Rico.eventStop(b); a.closeFunc(); return false }}return true }; Rico.eventBind(document,"keyup",Rico.eventHandle(Rico,"_checkEscKey")); Rico.Popup=function(b,a){this.initialize(b,a) }; Rico.Popup.prototype={initialize:function(b,a){this.options={hideOnClick:false,ignoreClicks:false,position:"absolute",shadow:true,zIndex:2,canDrag:false,dragElement:false,closeFunc:false}; this.openIndex=-1; if(b){this.setDiv(b,a) }},createContainer:function(a){this.setDiv(document.createElement("div"),a); if(a&&a.parent){a.parent.appendChild(this.container) }else{document.getElementsByTagName("body")[0].appendChild(this.container) }},setDiv:function(c,b){Rico.extend(this.options,b||{}); this.container=Rico.$(c); if(this.options.position=="auto"){this.position=Rico.getStyle(this.container,"position").toLowerCase() }else{this.position=this.container.style.position=this.options.position }this.content=document.createElement("div"); while(this.container.firstChild){this.content.appendChild(this.container.firstChild) }this.container.appendChild(this.content); this.content.className="RicoPopupContent"; this.content.style.position="relative"; if(this.position!="absolute"){return }if(this.options.closeFunc){this.closeFunc=this.options.closeFunc }else{var a=this; this.closeFunc=function(){a.closePopup() } }this.container.style.top="0px"; this.container.style.left="0px"; this.container.style.display="none"; if(this.options.zIndex>=0){this.container.style.zIndex=this.options.zIndex }this.content.style.zIndex=2; if(Rico.isIE&&Rico.ieVersion<7){this.ifr=document.createElement("iframe"); this.ifr.className="RicoShim"; this.ifr.frameBorder=0; this.ifr.src="javascript:'';"; this.container.appendChild(this.ifr) }Rico.applyShadow(this.container,this.options.shadow); if(this.options.hideOnClick){Rico.eventBind(document,"click",Rico.eventHandle(this,"_docClick")) }this.dragEnabled=false; this.mousedownHandler=Rico.eventHandle(this,"_startDrag"); this.dragHandler=Rico.eventHandle(this,"_drag"); this.dropHandler=Rico.eventHandle(this,"_endDrag"); if(this.options.canDrag){this.enableDragging() }if(this.options.ignoreClicks||this.options.canDrag){this.ignoreClicks() }},clearContent:function(){this.content.innerHTML="" },setContent:function(a){this.content.innerHTML=a },enableDragging:function(){if(!this.dragEnabled&&this.options.dragElement){Rico.eventBind(this.options.dragElement,"mousedown",this.mousedownHandler); this.dragEnabled=true }return this.dragEnabled },disableDragging:function(){if(!this.dragEnabled){return }Rico.eventUnbind(this.options.dragElement,"mousedown",this.mousedownHandler); this.dragEnabled=false },setZ:function(a){this.container.style.zIndex=a },ignoreClicks:function(){Rico.eventBind(this.container,"click",Rico.eventHandle(this,"_ignoreClick")) },_ignoreClick:function(a){if(a.stopPropagation){a.stopPropagation() }else{a.cancelBubble=true }return true },_docClick:function(a){this.closeFunc(); return true },move:function(b,a){if(typeof b=="number"){this.container.style.left=b+"px" }if(typeof a=="number"){this.container.style.top=a+"px" }},_startDrag:function(b){var a=Rico.eventElement(b); this.container.style.cursor="move"; this.lastMouse=Rico.eventClient(b); Rico.eventBind(document,"mousemove",this.dragHandler); Rico.eventBind(document,"mouseup",this.dropHandler); Rico.eventStop(b) },_drag:function(d){var b=Rico.eventClient(d); var c=parseInt(this.container.style.left,10)+b.x-this.lastMouse.x; var a=parseInt(this.container.style.top,10)+b.y-this.lastMouse.y; this.move(c,a); this.lastMouse=b; Rico.eventStop(d) },_endDrag:function(){this.container.style.cursor=""; Rico.eventUnbind(document,"mousemove",this.dragHandler); Rico.eventUnbind(document,"mouseup",this.dropHandler) },openPopup:function(b,a){if(typeof b=="number"){this.container.style.left=b+"px" }if(typeof a=="number"){this.container.style.top=a+"px" }this.container.style.display=""; if(this.container.id){Rico.log("openPopup "+this.container.id+" at "+b+","+a) }Rico._AddOpenPopup(this) },centerPopup:function(){this.openPopup(); var d=this.container.offsetWidth; var c=this.container.offsetHeight; var a=this.container.parentNode.offsetWidth; var b=this.container.parentNode.offsetHeight; this.move(parseInt(Math.max((a-d)/2,0),10),parseInt(Math.max((b-c)/2,0),10)) },visible:function(){return Rico.visible(this.container) },closePopup:function(){Rico._RemoveOpenPopup(this); if(!Rico.visible(this.container)){return }if(this.container.id){Rico.log("closePopup "+this.container.id) }if(this.dragEnabled){this._endDrag() }this.container.style.display="none"; if(this.options.onClose){this.options.onClose() }}}; Rico.closeButton=function(d){var b=document.createElement("a"); b.className="RicoCloseAnchor"; if(Rico.theme.closeAnchor){Rico.addClass(b,Rico.theme.closeAnchor) }var c=b.appendChild(document.createElement("span")); c.title=Rico.getPhraseById("close"); new Rico.HoverSet([b]); Rico.addClass(c,Rico.theme.close||"rico-icon RicoClose"); Rico.eventBind(b,"click",d); return b }; Rico.floatButton=function(b,e,f){var c=document.createElement("a"); c.className="RicoButtonAnchor"; Rico.addClass(c,Rico.theme.buttonAnchor||"RicoButtonAnchorNative"); var d=c.appendChild(document.createElement("span")); if(f){d.title=f }d.className=Rico.theme[b.toLowerCase()]||"rico-icon Rico"+b; Rico.eventBind(c,"click",e,false); new Rico.HoverSet([c]); return c }; Rico.clearButton=function(b){var a=document.createElement("span"); a.title=Rico.getPhraseById("clear"); a.className="ricoClear"; Rico.addClass(a,Rico.theme.clear||"rico-icon ricoClearNative"); Rico.eventBind(a,"click",b); return a }; Rico.Window=function(c,a,b){this.initialize(c,a,b) }; Rico.Window.prototype={initialize:function(c,a,b){a=a||{overflow:"auto"}; Rico.extend(this,new Rico.Popup()); this.titleDiv=document.createElement("div"); this.options.canDrag=true; this.options.dragElement=this.titleDiv; this.createContainer(a); this.content.appendChild(this.titleDiv); b=Rico.$(b); this.contentDiv=b||document.createElement("div"); this.content.appendChild(this.contentDiv); this.titleDiv.className="ricoTitle"; if(Rico.theme.dialogTitle){Rico.addClass(this.titleDiv,Rico.theme.dialogTitle) }this.titleDiv.style.position="relative"; this.titleContent=document.createElement("span"); this.titleContent.className="ricoTitleSpan"; this.titleDiv.appendChild(this.titleContent); this.titleDiv.appendChild(Rico.closeButton(Rico.eventHandle(this,"closeFunc"))); if(!c&&b){c=b.title; b.title="" }this.setTitle(c||" "); this.contentDiv.className="ricoContent"; if(Rico.theme.dialogContent){Rico.addClass(this.contentDiv,Rico.theme.dialogContent) }this.contentDiv.style.position="relative"; if(a.height){this.contentDiv.style.height=a.height }if(a.width){this.contentDiv.style.width=a.width }if(a.overflow){this.contentDiv.style.overflow=a.overflow }Rico.addClass(this.content,"ricoWindow"); if(Rico.theme.dialog){Rico.addClass(this.content,Rico.theme.dialog) }this.content=this.contentDiv },setTitle:function(a){this.titleContent.innerHTML=a }}; Rico.Menu=function(a){this.initialize(a) }; Rico.Menu.prototype={initialize:function(a){Rico.extend(this,new Rico.Popup()); Rico.extend(this.options,{width:"15em",arrowColor:"b",showDisabled:false,hideOnClick:true}); if(typeof a=="string"){this.options.width=a }else{Rico.extend(this.options,a||{}) }this.hideFunc=null; this.highlightElem=null },createDiv:function(a){if(this.container){return }var b=this; var c={closeFunc:function(){b.cancelmenu() }}; if(a){c.parent=a }this.createContainer(c); this.content.className=Rico.isWebKit?"ricoMenuSafari":"ricoMenu"; this.content.style.width=this.options.width; this.direction=Rico.getStyle(this.container,"direction")||"ltr"; this.direction=this.direction.toLowerCase(); this.hidemenu(); this.itemCount=0 },showmenu:function(b,c){Rico.eventStop(b); this.hideFunc=c; if(this.content.childNodes.length==0){this.cancelmenu(); return false }var a=Rico.eventClient(b); this.openmenu(a.x,a.y,0,0) },openmenu:function(g,f,j,e,a){var h=g+(a?0:Rico.docScrollLeft()); this.container.style.visibility="hidden"; this.container.style.display="block"; var i=this.container.offsetWidth; var b=this.content.offsetWidth; if(this.direction=="rtl"){if(h>i+j){h-=b+j }}else{if(g+i>Rico.windowWidth()){h-=b+j-2 }}var d=Rico.docScrollTop(); var c=f+(a?0:d); if(f+this.container.offsetHeight-d>Rico.windowHeight()){c=Math.max(c-this.content.offsetHeight+e,0) }this.openPopup(h,c); this.container.style.visibility="visible"; return false },clearMenu:function(){this.clearContent(); this.defaultAction=null; this.itemCount=0 },addMenuHeading:function(b){var a=document.createElement("div"); a.innerHTML=b; a.className="ricoMenuHeading"; this.content.appendChild(a) },addMenuBreak:function(){var a=document.createElement("div"); a.className="ricoMenuBreak"; this.content.appendChild(a) },addSubMenuItem:function(b,e,g){var d=this.direction=="rtl"?"left":"right"; var c=this.addMenuItem(b,null,true,null,g); c.className="ricoSubMenu"; var f=c.appendChild(document.createElement("div")); f.className="rico-icon rico-"+d+"-"+this.options.arrowColor; Rico.setStyle(f,{position:"absolute",top:"2px"}); f.style[d]="0px"; c.RicoSubmenu=e; Rico.eventBind(c,"mouseover",Rico.eventHandle(this,"showSubMenu")) },showSubMenu:function(c){if(this.openSubMenu){this.hideSubMenu() }var b=Rico.eventElement(c); if(!b.RicoSubmenu){b=b.parentNode }if(!b.RicoSubmenu){return }this.openSubMenu=b.RicoSubmenu; this.openMenuAnchor=b; if(Rico.hasClass(b,"ricoSubMenu")){Rico.removeClass(b,"ricoSubMenu"); Rico.addClass(b,"ricoSubMenuOpen") }b.RicoSubmenu.openmenu(parseInt(this.container.style.left)+b.offsetWidth,parseInt(this.container.style.top)+b.offsetTop,b.offsetWidth-2,b.offsetHeight+2,true) },hideSubMenu:function(){if(this.openMenuAnchor){Rico.removeClass(this.openMenuAnchor,"ricoSubMenuOpen"); Rico.addClass(this.openMenuAnchor,"ricoSubMenu"); this.openMenuAnchor=null }if(this.openSubMenu){this.openSubMenu.hidemenu(); this.openSubMenu=null }},addMenuItemId:function(c,b,a,e,d){if(arguments.length<3){a=true }this.addMenuItem(Rico.getPhraseById(c),b,a,e,d) },addMenuItem:function(b,e,d,g,f){if(arguments.length>=3&&!d&&!this.options.showDisabled){return null }this.itemCount++; var c=document.createElement(typeof e=="string"?"a":"div"); if(arguments.length<3||d){if(typeof e=="string"){c.href=e; if(f){c.target=f }}else{if(f=="event"){Rico.eventBind(c,"click",e) }else{c.onclick=e }}c.className="enabled"; if(this.defaultAction==null){this.defaultAction=e }}else{c.disabled=true; c.className="disabled" }c.innerHTML=b; if(typeof g=="string"){c.title=g }c=this.content.appendChild(c); Rico.eventBind(c,"mouseover",Rico.eventHandle(this,"mouseOver")); Rico.eventBind(c,"mouseout",Rico.eventHandle(this,"mouseOut")); return c },mouseOver:function(b){if(this.highlightElem&&this.highlightElem.className=="enabled-hover"){this.highlightElem.className="enabled"; this.highlightElem=null }var a=Rico.eventElement(b); if(a.parentNode==this.openMenuAnchor){a=a.parentNode }if(this.openMenuAnchor&&this.openMenuAnchor!=a){this.hideSubMenu() }if(a.className=="enabled"){a.className="enabled-hover"; this.highlightElem=a }},mouseOut:function(b){var a=Rico.eventElement(b); if(a.className=="enabled-hover"){a.className="enabled" }if(this.highlightElem==a){this.highlightElem=null }},cancelmenu:function(){if(!this.visible()){return }if(this.hideFunc){this.hideFunc() }this.hideFunc=null; this.hidemenu() },hidemenu:function(){if(this.openSubMenu){this.openSubMenu.hidemenu() }this.closePopup() }}; Rico.SelectionSet=function(b,a){this.initialize(b,a) }; Rico.SelectionSet.prototype={initialize:function(e,b){Rico.log("SelectionSet#initialize"); this.options=b||{}; if(typeof e=="string"){e=Rico.select(e) }this.previouslySelected=[]; this.selectionSet=[]; this.selectedClassName=this.options.selectedClass||Rico.theme.selected||"selected"; this.selectNode=this.options.selectNode||function(f){return f }; this.onSelect=this.options.onSelect; this.onFirstSelect=this.options.onFirstSelect; var a=this; this.clickHandler=function(f){a.selectIndex(f) }; this.selectedIndex=-1; for(var c=0; c=0){this.selectIndex(a) }},_notifySelected:function(a){if(a<0){return }var b=this.selectionSet[a]; if(this.options.cookieName){Rico.setCookie(this.options.cookieName,a,this.options.cookieDays,this.options.cookiePath,this.options.cookieDomain) }if(this.onFirstSelect&&!this.previouslySelected[a]){this.onFirstSelect(b,a); this.previouslySelected[a]=true }if(this.onSelect){try{this.onSelect(a) }catch(c){}}},selectIndex:function(a){if(this.selectedIndex==a||a>=this.selectionSet.length){return }this.clearSelected(); this._notifySelected(a); this.selectedIndex=a; this.selected=this.selectionSet[a].element; Rico.addClass(this.selectNode(this.selected),this.selectedClassName) },nextSelectIndex:function(){return(this.selectedIndex+1)%this.selectionSet.length },nextSelectItem:function(){return this.selectionSet[this.nextSelectIndex()] },selectNext:function(){this.selectIndex(this.nextSelectIndex()) },add:function(b){var a=this.selectionSet.length; this.selectionSet[a]=new Rico._SelectionItem(b,a,this.clickHandler) },remove:function(b){if(b==this.selected){this.clearSelected() }var a=this.getIndex(b); if(a<0){return }this.selectionSet[a].remove(); this.selectionSet.splice(a,1) },removeAll:function(){this.clearSelected(); while(this.selectionSet.length>0){this.selectionSet.pop().remove() }}}; Rico._SelectionItem=function(b,a,c){this.add(b,a,c) }; Rico._SelectionItem.prototype={add:function(b,a,c){this.element=b; this.index=a; this.callback=c; this.handle=Rico.eventHandle(this,"click"); Rico.eventBind(b,"click",this.handle) },click:function(a){this.callback(this.index) },remove:function(){Rico.eventUnbind(this.element,"click",this.handle) }}; Rico.HoverSet=function(b,a){this.initialize(b,a) }; Rico.HoverSet.prototype={initialize:function(c,a){Rico.log("HoverSet#initialize"); a=a||{}; this.hoverClass=a.hoverClass||Rico.theme.hover||"hover"; this.hoverFunc=a.hoverNodes||function(d){return[d] }; this.hoverSet=[]; if(!c){return }for(var b=0; b0){this.hoverSet.pop().remove() }}}; Rico._HoverItem=function(b,a,c){this.add(b,a,c) }; Rico._HoverItem.prototype={add:function(b,a,c){this.element=b; this.selectFunc=a; this.hoverClass=c; this.movehandle=Rico.eventHandle(this,"move"); this.outhandle=Rico.eventHandle(this,"mouseout"); Rico.eventBind(b,"mousemove",this.movehandle); Rico.eventBind(b,"mouseout",this.outhandle) },move:function(c){var a=this.selectFunc(this.element); for(var b=0; b=2){c[0].className=e.titleClass||Rico.theme.accTitle||"Rico_accTitle"; c[1].className=e.contentClass||Rico.theme.accContent||"Rico_accContent"; j.push(c[0]); h.push(c[1]); var b=Rico.wrapChildren(c[0],"","","a"); b.href="javascript:void(0)" }}Rico.log("creating Rico.Accordion for "+g.id+" with "+j.length+" panels"); this.initBase(j,h,e); this.selected.style.height=this.options.panelHeight+"px"; this.totSteps=(typeof e.duration=="number"?e.duration:200)/25 },transition:function(b){if(!this.options.noAnimate){this.closing=this.selected; this.opening=b; this.curStep=0; var a=this; this.timer=setInterval(function(){a.step() },25) }else{b.style.height=this.options.panelHeight+"px"; if(this.selected){Rico.hide(this.selected) }b.style.display="block" }},step:function(){this.curStep++; var a=Math.round(this.curStep/this.totSteps*this.options.panelHeight); this.opening.style.height=a+"px"; this.closing.style.height=(this.options.panelHeight-a)+"px"; if(this.curStep==1){this.opening.style.paddingTop=this.opening.style.paddingBottom="0px"; this.opening.style.display="block" }if(this.curStep==this.totSteps){clearInterval(this.timer); this.opening.style.paddingTop=this.opening.style.paddingBottom=""; Rico.hide(this.closing) }},setPanelHeight:function(a){this.options.panelHeight=a; this.selected.style.height=this.options.panelHeight+"px" }}); Rico.TabbedPanel=function(b,a){this.initialize(b,a) }; Rico.TabbedPanel.prototype=Rico.extend(new Rico.ContentTransitionBase(),{initialize:function(d,k){d=Rico.$(d); k=k||{}; if(typeof k.panelWidth=="number"){k.panelWidth+="px" }if(typeof k.panelHeight=="number"){k.panelHeight+="px" }d.className=k.tabClass||Rico.theme.tabPanel||"Rico_tabPanel"; if(k.panelWidth){d.style.width=k.panelWidth }var g=[]; var j=d.childNodes; for(var e=0; e=0){return true }}return false }}; Rico.toColorPart=function(a){return Rico.zFill(a,2,16) }; Rico.Color=function(c,b,a){this.initialize(c,b,a) }; Rico.Color.prototype={initialize:function(c,b,a){this.rgb={r:c,g:b,b:a} },setRed:function(a){this.rgb.r=a },setGreen:function(a){this.rgb.g=a },setBlue:function(a){this.rgb.b=a },setHue:function(b){var a=this.asHSB(); a.h=b; this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,a.b) },setSaturation:function(b){var a=this.asHSB(); a.s=b; this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,a.b) },setBrightness:function(a){var c=this.asHSB(); c.b=a; this.rgb=Rico.Color.HSBtoRGB(c.h,c.s,c.b) },darken:function(b){var a=this.asHSB(); this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,Math.max(a.b-b,0)) },brighten:function(b){var a=this.asHSB(); this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,Math.min(a.b+b,1)) },blend:function(a){this.rgb.r=Math.floor((this.rgb.r+a.rgb.r)/2); this.rgb.g=Math.floor((this.rgb.g+a.rgb.g)/2); this.rgb.b=Math.floor((this.rgb.b+a.rgb.b)/2) },isBright:function(){var a=this.asHSB(); return this.asHSB().b>0.5 },isDark:function(){return !this.isBright() },asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")" },asHex:function(){return"#"+Rico.toColorPart(this.rgb.r)+Rico.toColorPart(this.rgb.g)+Rico.toColorPart(this.rgb.b) },asHSB:function(){return Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b) },toString:function(){return this.asHex() }}; Rico.Color.createFromHex=function(d){if(d.length==4){var b=d; d="#"; for(var c=1; c<4; c++){d+=(b.charAt(c)+b.charAt(c)) }}if(d.indexOf("#")==0){d=d.substring(1) }if(!d.match(/^[0-9A-Fa-f]{6}$/)){return null }var f=d.substring(0,2); var e=d.substring(2,4); var a=d.substring(4,6); return new Rico.Color(parseInt(f,16),parseInt(e,16),parseInt(a,16)) }; Rico.Color.createColorFromBackground=function(d){if(!d.style){return new Rico.Color(255,255,255) }var b=Rico.getStyle(d,"background-color"); if(b.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i)&&d.parentNode){return Rico.Color.createColorFromBackground(d.parentNode) }if(b==null){return new Rico.Color(255,255,255) }if(b.indexOf("rgb(")==0){var a=b.substring(4,b.length-1); var c=a.split(","); return new Rico.Color(parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10)) }else{if(b.indexOf("#")==0){return Rico.Color.createFromHex(b) }else{return new Rico.Color(255,255,255) }}}; Rico.Color.HSBtoRGB=function(i,e,k){var c=0; var d=0; var l=0; if(e==0){c=parseInt(k*255+0.5,10); d=c; l=c }else{var g=(i-Math.floor(i))*6; var j=g-Math.floor(g); var b=k*(1-e); var a=k*(1-e*j); var m=k*(1-(e*(1-j))); switch(parseInt(g,10)){case 0:c=(k*255+0.5); d=(m*255+0.5); l=(b*255+0.5); break; case 1:c=(a*255+0.5); d=(k*255+0.5); l=(b*255+0.5); break; case 2:c=(b*255+0.5); d=(k*255+0.5); l=(m*255+0.5); break; case 3:c=(b*255+0.5); d=(a*255+0.5); l=(k*255+0.5); break; case 4:c=(m*255+0.5); d=(b*255+0.5); l=(k*255+0.5); break; case 5:c=(k*255+0.5); d=(b*255+0.5); l=(a*255+0.5); break }}return{r:parseInt(c,10),g:parseInt(d,10),b:parseInt(l,10)} }; Rico.Color.RGBtoHSB=function(a,f,l){var h; var e; var k; var m=(a>f)?a:f; if(l>m){m=l }var i=(athis.options.maxDate.getFullYear()){return false }if(a==this.options.maxDate.getFullYear()&&b>this.options.maxDate.getMonth()){return false }return true },incMonth:function(){var b=this.monthSelected+1; var a=this.yearSelected; if(b>11){b=0; a++ }if(!this.isValidMonth(a,b)){return }this.monthSelected=b; this.yearSelected=a; this.constructCalendar() },decMonth:function(){var b=this.monthSelected-1; var a=this.yearSelected; if(b<0){b=11; a-- }if(!this.isValidMonth(a,b)){return }this.monthSelected=b; this.yearSelected=a; this.constructCalendar() },selectMonth:function(b){var a=Rico.eventElement(b); this.monthSelected=parseInt(a.name,10); this.constructCalendar(); Rico.eventStop(b) },popUpMonth:function(a){Rico.eventStop(a); if(this.monthPopup.visible()){this.popDownMonth(); return }this.popDownYear(); if(Rico.isIE&&Rico.ieVersion<7){this.monthPopup.openPopup(null,this.heading.offsetHeight+2); this.monthPopup.container.style.left="" }else{this.monthPopup.openPopup(3,this.heading.offsetHeight+2) }return false },popDownMonth:function(){this.monthPopup.closePopup() },popDownYear:function(){this.yearPopup.closePopup(); this.yearInput.disabled=true },popUpYear:function(a){Rico.eventStop(a); if(this.yearPopup.visible()){this.popDownYear(); return }this.popDownMonth(); this.yearPopup.openPopup(null,this.heading.offsetHeight+2); this.yearInput.disabled=false; this.yearInput.value=""; this.yearInput.focus(); return false },yearKey:function(a){switch(Rico.eventKey(a)){case 27:this.popDownYear(); Rico.eventStop(a); return false; case 13:this.processPopUpYear(); Rico.eventStop(a); return false }return true },processPopUpYear:function(){var a=this.yearInput.value; a=parseInt(a,10); if(isNaN(a)||athis.options.maxDate.getFullYear()){alert(Rico.getPhraseById("calInvalidYear")) }else{this.yearSelected=a; this.popDownYear(); this.constructCalendar() }},incYear:function(){if(this.yearSelected>=this.options.maxDate.getFullYear()){return }this.yearSelected++; this.constructCalendar() },decYear:function(){if(this.yearSelected<=this.options.minDate.getFullYear()){return }this.yearSelected--; this.constructCalendar() },WeekNbr:function(h,f,j){var g=new Date(h,f,j); var c=new Date(h,0,1); var e=7+1-c.getDay(); if(e==8){e=1 }var b=((Date.UTC(h,g.getMonth(),g.getDate(),0,0,0)-Date.UTC(h,0,1,0,0,0))/1000/60/60/24)+1; var d=Math.floor((b-e+7)/7); if(d==0){h--; var a=new Date(h,0,1); var i=7+1-a.getDay(); d=(i==2||i==8)?53:52 }return d },constructCalendar:function(){var l=[31,0,31,30,31,30,31,31,30,31,30,31]; var d=new Date(this.yearSelected,this.monthSelected,1); var j,e,f,b; if(typeof this.monthSelected!="number"||this.monthSelected>=12||this.monthSelected<0){alert("ERROR in calendar: monthSelected="+this.monthSelected); return }if(this.monthSelected==1){j=new Date(this.yearSelected,this.monthSelected+1,1); j=new Date(j-(24*60*60*1000)); e=j.getDate() }else{e=l[this.monthSelected] }var n=d.getDay()-this.options.startAt; if(n<0){n+=7 }this.popDownMonth(); this.popDownYear(); if(this.options.showWeekNumber){for(f=1; f<7; f++){this.tbody.rows[f].cells[0].innerHTML=" " }}for(f=0; fe){this.oyearSelected-=100 }}}else{if(b){alert("ERROR: invalid date passed to calendar ("+b+")") }}}}if(this.oyearSelected>0){this.dateSelected=this.odateSelected; this.monthSelected=this.omonthSelected; this.yearSelected=this.oyearSelected }else{this.dateSelected=this.dateNow; this.monthSelected=this.monthNow; this.yearSelected=this.yearNow }this.constructCalendar(); this.openPopup() }}; Rico.ColorPicker=function(b,a){this.initialize(b,a) }; Rico.ColorPicker.prototype={initialize:function(h,c){this.id=h; this.currentValue="#FFFFFF"; Rico.extend(this,new Rico.Popup()); Rico.extend(this.options,{showColorCode:false,cellsPerRow:18,palette:[]}); var f=["00","33","66","99","CC","FF"]; for(var e=0; e" }d+=' '; if(((b+1)>=this.options.palette.length)||(((b+1)%c)==0)){d+="" }}var a=Math.floor(c/2); if(this.options.showColorCode){d+=" #FFFFFF" }else{d+=" " }d+=""; this.content.innerHTML=d; this.open=this.openPopup; this.close=this.closePopup; Rico.eventBind(this.container,"mouseover",Rico.eventHandle(this,"highlightColor"),false); Rico.eventBind(this.container,"click",Rico.eventHandle(this,"selectColor"),false); this.close() },selectColor:function(a){Rico.eventStop(a); if(this.returnValue){this.returnValue(this.currentValue) }this.close() },highlightColor:function(b){var a=Rico.eventElement(b); if(!a.tagName||a.tagName.toLowerCase()!="td"){return }var g=Rico.Color.createColorFromBackground(a).toString(); this.currentValue=g; Rico.setStyle("colorPickerSelectedColor",{backgroundColor:g}); var f=Rico.$("colorPickerSelectedColorValue"); if(f){f.innerHTML=g }}}; Rico.dndMgrList=[]; Rico.registerDraggable=function(b,a){if(typeof a!="number"){a=0 }if(typeof Rico.dndMgrList[a]!="object"){Rico.dndMgrList[a]=new Rico.dndMgr() }Rico.dndMgrList[a].registerDraggable(b) }; Rico.registerDropZone=function(b,a){if(typeof a!="number"){a=0 }if(typeof Rico.dndMgrList[a]!="object"){Rico.dndMgrList[a]=new Rico.dndMgr() }Rico.dndMgrList[a].registerDropZone(b) }; Rico.dndMgr=function(){this.initialize() }; Rico.dndMgr.prototype={initialize:function(){this.dropZones=[]; this.draggables=[]; this.currentDragObjects=[]; this.dragElement=null; this.lastSelectedDraggable=null; this.currentDragObjectVisible=false; this.interestedInMotionEvents=false; this._mouseDown=Rico.eventHandle(this,"_mouseDownHandler"); this._mouseMove=Rico.eventHandle(this,"_mouseMoveHandler"); this._mouseUp=Rico.eventHandle(this,"_mouseUpHandler") },registerDropZone:function(a){this.dropZones[this.dropZones.length]=a },deregisterDropZone:function(a){var d=new Array(); var b=0; for(var c=0; c0 },setStartDragFromElement:function(a,c){this.origPos=Rico.cumulativeOffset(c); var b=Rico.eventClient(a); this.startx=b.x-this.origPos.left; this.starty=b.y-this.origPos.top; this.interestedInMotionEvents=this.hasSelection(); Rico.eventStop(a) },updateSelection:function(a,b){if(!b){this.clearSelection() }if(a.isSelected()){this.currentDragObjects=this.currentDragObjects.without(a); a.deselect(); if(a==this.lastSelectedDraggable){this.lastSelectedDraggable=null }}else{a.select(); if(a.isSelected()){this.currentDragObjects.push(a); this.lastSelectedDraggable=a }}},_mouseDownHandler:function(f){if(!Rico.eventLeftClick(f)){return }var d=Rico.eventElement(f); var a=d.ricoDraggable; var c=d; while(a==null&&c.parentNode){c=c.parentNode; a=c.ricoDraggable }if(a==null){return }this.updateSelection(a,f.ctrlKey); if(this.hasSelection()){for(var b=0; b1){a=this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects) }else{a=this.currentDragObjects[0].getSingleObjectDragGUI() }this.dragElemPosition=Rico.getStyle(a,"position"); if(this.dragElemPosition!="absolute"){a.style.position="absolute" }if(a.parentNode==null||a.parentNode.nodeType==11){document.body.appendChild(a) }this.dragElement=a; this._updateDraggableLocation(b); this.currentDragObjectVisible=true },_leftOffset:function(a){return a.offsetX?document.body.scrollLeft:0 },_topOffset:function(a){return a.offsetY?document.body.scrollTop:0 },_updateDraggableLocation:function(b){var a=this.dragElement.style; var c=Rico.eventClient(b); a.left=(c.x+this._leftOffset(b)-this.startx)+"px"; a.top=(c.y+this._topOffset(b)-this.starty)+"px" },_updateDropZonesHover:function(b){var a,c=this.dropZones.length; for(a=0; aa.left+this._leftOffset(b)&&d.xa.top+this._topOffset(b)&&d.y=this.liveGrid.buffer.totalRows){return }this.selected=true; this.showingSelected=true },deselect:function(){this.selected=false; this.showingSelected=false },getSingleObjectDragGUI:function(){var a=document.createElement("div"); a.className="LiveGridDraggable"; a.style.width=(this.htmlElement.offsetWidth-10)+"px"; a.innerHTML=this.htmlElement.innerHTML; return a }}); Rico.Dropzone=function(a){this.initialize(a) }; Rico.Dropzone.prototype={initialize:function(a){this.htmlElement=Rico.$(a); this.absoluteRect=null },getHTMLElement:function(){return this.htmlElement },clearPositionCache:function(){this.absoluteRect=null },getAbsoluteRect:function(){if(this.absoluteRect==null){var a=this.getHTMLElement(); var b=Rico.viewportOffset(a); this.absoluteRect={top:b.top,left:b.left,bottom:b.top+a.offsetHeight,right:b.left+a.offsetWidth} }return this.absoluteRect },activate:function(){var c=this.getHTMLElement(); if(c==null||this.showingActive){return }this.showingActive=true; this.saveBackgroundColor=c.style.backgroundColor; var b="#ffea84"; var a=Rico.Color.createColorFromBackground(c); if(a==null){c.style.backgroundColor=b }else{a.isBright()?a.darken(0.2):a.brighten(0.2); c.style.backgroundColor=a.asHex() }},deactivate:function(){var a=this.getHTMLElement(); if(a==null||!this.showingActive){return }a.style.backgroundColor=this.saveBackgroundColor; this.showingActive=false; this.saveBackgroundColor=null },showHover:function(){var a=this.getHTMLElement(); if(a==null||this.showingHover){return }this.saveBorderWidth=a.style.borderWidth; this.saveBorderStyle=a.style.borderStyle; this.saveBorderColor=a.style.borderColor; this.showingHover=true; a.style.borderWidth="1px"; a.style.borderStyle="solid"; a.style.borderColor="#ffff00" },hideHover:function(){var a=this.getHTMLElement(); if(a==null||!this.showingHover){return }a.style.borderWidth=this.saveBorderWidth; a.style.borderStyle=this.saveBorderStyle; a.style.borderColor=this.saveBorderColor; this.showingHover=false },canAccept:function(a){return true },accept:function(b){var d=this.getHTMLElement(); if(d==null){return }var e=b.length; for(var a=0; a0){var f=Rico.getContentAsString(h[0],this.grid.buffer.isEncoded); Rico.log("Data provider returned an error:\n"+f); alert(Rico.getPhraseById("requestError",f)); return null }this.selectList.options.length=0; a=a.getElementsByTagName("response")[0]; var g=a.getElementsByTagName("rows")[0]; var j=this.grid.buffer.dom2jstable(g); Rico.log("selectValuesUpdate: id="+this.selectList.id+" rows="+j.length); for(var d=0; d0){var e=j[d][0]; var c=(j[d].length>1)?j[d][1]:e; Rico.addSelectOption(this.selectList,e,c) }}},filterKeypress:function(c){var a=Rico.eventElement(c); if(typeof this.lastKeyFilter!="string"){this.lastKeyFilter="" }if(this.lastKeyFilter==a.value){return }var b=a.value; Rico.log("filterKeypress: "+this.index+" "+b); this.lastKeyFilter=b; this.selectValuesRequest(b) },listClick:function(c){var b=Rico.eventElement(c); if(b.tagName.toLowerCase()!="select"){return }if(this.returnValue){var a=b.options[b.selectedIndex]; this.returnValue(a.value,a.innerHTML) }this.close() }}; Rico.TreeControl=function(c,b,a){this.initialize(c,b,a) }; Rico.TreeControl.prototype={initialize:function(c,b,a){Rico.extend(this,new Rico.Popup()); Rico.extend(this.options,{ignoreClicks:true,nodeIdDisplay:"none",showCheckBox:false,showFolders:false,showPlusMinus:true,showLines:true,defaultAction:Rico.eventHandle(this,"nodeClick"),height:"300px",width:"300px",leafIcon:"rico-icon rico-doc"}); Rico.extend(this.options,a||{}); this.id=c; this.dataSource=b; this.close=this.closePopup; this.hoverSet=new Rico.HoverSet([]) },atLoad:function(){this.treeDiv=document.createElement("div"); this.treeDiv.id=this.id; this.treeDiv.className="ricoTree"; if(Rico.theme.treeContent){Rico.addClass(this.treeDiv,Rico.theme.treeContent) }this.treeDiv.style.height=this.options.height; this.treeDiv.style.width=this.options.width; this.createContainer(); this.content.className=Rico.theme.tree||"ricoTreeContainer"; this.content.appendChild(this.treeDiv); if(this.options.showCheckBox){this.buttonDiv=document.createElement("div"); this.buttonDiv.style.width=this.options.width; this.buttonDiv.className="ricoTreeButtons"; if(Rico.getStyle(this.container,"position")=="absolute"){var a=document.createElement("span"); a.innerHTML=RicoTranslate.getPhraseById("treeSave"); Rico.setStyle(a,{"float":"left",cursor:"pointer"}); this.buttonDiv.appendChild(a); Rico.eventBind(a,"click",Rico.eventHandle(this,"saveSelection")) }var a=document.createElement("span"); a.innerHTML=RicoTranslate.getPhraseById("treeClear"); Rico.setStyle(a,{"float":"right",cursor:"pointer"}); this.buttonDiv.appendChild(a); this.content.appendChild(this.buttonDiv); Rico.eventBind(a,"click",Rico.eventHandle(this,"clrCheckBoxEvent")) }this.close() },setTreeDiv:function(a){this.treeDiv=Rico.$(a); this.openPopup=function(){} },open:function(){this.openPopup(); if(this.treeDiv.childNodes.length==0&&this.dataSource){this.loadXMLDoc() }},loadXMLDoc:function(c){var b={id:this.id}; if(c){b.Parent=c }Rico.log("Tree loadXMLDoc: "+this.id); var a=this; new Rico.ajaxRequest(this.dataSource,{parameters:b,method:"get",onComplete:function(d){a.processResponse(d) }}) },domID:function(b,a){return"RicoTree_"+a+"_"+this.id+"_"+b },processResponse:function(d){var b=d.responseXML.getElementsByTagName("ajax-response"); if(b==null||b.length!=1){return }var f=b[0].getElementsByTagName("rows")[0]; var g=f.getElementsByTagName("tr"); var k=[]; for(var e=0; e1){var e=h.getElementsByTagName("td"); for(var r=0; r0){var c=k&&this.options.showLines?"last":""; var o=this.options.showLines?"node":""; if(this.options.showPlusMinus&&f){var w=document.createElement("div"); w.name=l; w.style.cursor="pointer"; Rico.eventBind(w,"click",Rico.eventHandle(this,"clickBranch")); w.className="rico-icon rico-tree-"+o+"p"+c; d.insertCell(-1).appendChild(w) }else{if(this.options.showLines){var w=document.createElement("div"); w.className="rico-icon rico-tree-node"+c; d.insertCell(-1).appendChild(w) }}if(this.options.showFolders&&(f||(s&&s!="none"))){var w=document.createElement("div"); if(!f){w.className=s }else{w.name=l; w.style.cursor="pointer"; Rico.eventBind(w,"click",Rico.eventHandle(this,"clickBranch")); w.className="rico-icon rico-folderclosed" }d.insertCell(-1).appendChild(w) }}if(u&&this.options.showCheckBox){var n=document.createElement("input"); n.type="checkbox"; n.value=l; d.insertCell(-1).appendChild(n) }if(u&&!this.options.showCheckBox){var p=document.createElement("a"); if(typeof u=="string"){p.href=u }else{p.href="javascript:void(0)"; Rico.eventBind(p,"click",this.options.defaultAction) }this.hoverSet.add(p) }else{var p=document.createElement("p") }p.id=this.domID(l,"Desc"); p.className="ricoTreeLevel"+a; switch(this.options.nodeIdDisplay){case"last":t+=" ("+l+")"; break; case"first":t=l+" - "+t; break; case"tooltip":p.title=l; break }p.appendChild(document.createTextNode(t)); d.insertCell(-1).appendChild(p); var j=v||this.treeDiv; j.appendChild(b); j.appendChild(m) },nodeClick:function(c){var b=Rico.eventElement(c); if(this.returnValue){var a=this.domID("","Desc"); this.returnValue(b.id.substr(a.length),b.innerHTML) }this.close() },saveSelection:function(a){if(this.returnValue){this.returnValue(this.getCheckedItems()) }this.close() },getCheckedItems:function(){var b=this.treeDiv.getElementsByTagName("input"); var c=[]; for(var a=0; a0){d=Math.min(this.outerDiv.parentNode.clientWidth,d) }var a=this.frzWi+this.scrWi-d; Rico.log("baseSizeDivs "+this.tableId+": scrWi="+this.scrWi+" wiLimit="+d+" overage="+a+" clientWidth="+this.outerDiv.parentNode.clientWidth); if(a>0&&this.options.frozenColumns' },cell:function(a,b){return(0<=b&&b=0)?this.columns[b].cell(a):null },availHt:function(){var a=Rico.cumulativeOffset(this.outerDiv); return Rico.windowHeight()-a.top-2*this.options.scrollBarWidth-15 },setHorizontalScroll:function(){var a=(-this.scrollDiv.scrollLeft)+"px"; this.hdrTabs[1].style.marginLeft=a },pluginScroll:function(){if(this.scrollPluggedIn){return }Rico.eventBind(this.scrollDiv,"scroll",this.scrollEventFunc,false); this.scrollPluggedIn=true },unplugScroll:function(){Rico.eventUnbind(this.scrollDiv,"scroll",this.scrollEventFunc,false); this.scrollPluggedIn=false },hideMsg:function(){this.messagePopup.closePopup() },showMsg:function(a){this.messagePopup.setContent(a); this.messagePopup.centerPopup(); Rico.log("showMsg: "+a) },listInvisible:function(b){var c=[]; for(var a=0; a" }}this.exportText+=""; if(this.exportHeader){this.exportText+=this.exportHeader }for(a=0; a0){k=Rico.select(".ricoLG_cell",b.cell); l=k&&k.length>0?k[0]:b.cell; this.exportText+="1){this.exportText+=" colspan='"+e+"'" }this.exportText+=">"+Rico.getInnerText(l,!this.options.exportImgTags,!this.options.exportFormFields,"NoExport")+"" }}this.exportText+="" }this.exportText+="" },exportFinish:function(){if(this.hideMsg){this.hideMsg() }window.status=Rico.getPhraseById("exportComplete"); if(this.exportRows.length>0){this.exportText+=""+this.exportRows.join("")+"" }if(this.exportFooter){this.exportText+=this.exportFooter }this.exportText+=""; if(this.cancelMenu){this.cancelMenu() }var a=window.open("","_blank",this.options.exportWindow); if(a==null){alert(Rico.getPhraseById("disableBlocker")) }else{a.document.open(); a.document.write(this.exportText); a.document.close() }this.exportText=undefined; this.exportRows=undefined },exportStyle:function(d,g){for(var b=0,c=""; b=this.columns.length){continue }var e=this.columns[h]; switch(a[0].charAt(0)){case"w":e.setColWidth(a[1]); e.customWidth=true; break; case"h":if(a[1].toLowerCase()=="true"){e.hideshow(true,true) }else{e.hideshow(false,true) }break; case"s":if(!this.options.saveColumnInfo.sort||!e.sortable){break }e.setSorted(a[1]); break; case"f":if(!this.options.saveColumnInfo.filter||!e.filterable){break }var d=a[1].split("~"); e.filterOp=d.shift(); e.filterValues=[]; e.filterType=Rico.ColumnConst.USERFILTER; for(var b=0; b0){return b[0].innerHTML }else{return Rico.stripTags(a.innerHTML) }},_clear:function(a){a.innerHTML=" " },clearCell:function(b){var a=this.cell(b); this._clear(a,b); if(this.liveGrid.buffer&&this.liveGrid.buffer.options.acceptStyle){a.style.cssText="" }},dataTable:function(){return this.liveGrid.tabs[this.tabIdx] },numRows:function(){return this.dataColDiv.childNodes.length },clearColumn:function(){var b=this.numRows(); for(var a=0; a0){this.edge+=Rico.nan2zero(this.liveGrid.tabs[0].offsetWidth) }}this.liveGrid.resizeDiv.style.left=this.edge+"px"; this.liveGrid.resizeDiv.style.display=""; this.liveGrid.outerDiv.style.cursor="e-resize"; this.tmpHighlight=this.liveGrid.highlightEnabled; this.liveGrid.highlightEnabled=false; this.pluginMouseEvents(); Rico.eventStop(b) },handleMouseMove:function(b){var c=Rico.eventClient(b).x-this.resizeStart; var a=(this.liveGrid.direction=="rtl")?this.origWidth-c:this.origWidth+c; if(a"+a+"" }}this.exportRows.push(d) }this.exportFinish() },hideRow:function(a){if(this.columns[0].cell(a).style.display=="none"){return }for(var b=0; bthis.width){c-=this.width }}else{if(c+this.width+this.options.margin>this.scrollDiv.clientWidth){c-=this.width }}e.divPopup.style.visibility="hidden"; e.divPopup.style.display="block"; var b=e.divPopup.offsetHeight; var a=Math.floor(d.offsetTop-this.scrollDiv.scrollTop+d.offsetHeight/2); if(a+b+e.options.margin>this.scrollDiv.clientHeight){a=Math.max(a-b,0) }e.openPopup(this.frzWi+c,this.hdrHt+a); e.divPopup.style.visibility="visible"; return d }}; if(Rico.Menu){Rico.extend(Rico.Menu.prototype,{showSimpleMenu:function(b,c){Rico.eventStop(b); this.hideFunc=c; if(this.div.childNodes.length==0){this.cancelmenu(); return false }var a=Rico.eventElement(b); this.grid.openPopup(a,this); return a },showSimpleSubMenu:function(b,c){if(this.openSubMenu){this.hideSubMenu() }this.openSubMenu=c; this.openMenuAnchor=b; if(b.className=="ricoSubMenu"){b.className="ricoSubMenuOpen" }var e=parseInt(this.div.style.top,10); var d=parseInt(this.div.style.left,10); c.openPopup(d+b.offsetWidth,e+b.offsetTop); c.div.style.visibility="visible" }}) }Rico.SimpleGridColumn=function(a,d,c,b){this.initialize(a,d,c,b) }; Rico.SimpleGridColumn.prototype={initialize:function(a,d,c,b){Rico.extend(this,new Rico.TableColumnBase()); this.baseInit(a,d,c,b) },setUnfiltered:function(){this.filterRows=null },filterChange:function(a){var b=Rico.eventElement(a); if(b.value==this.liveGrid.options.FilterAllToken){this.setUnfiltered() }else{this.filterRows=this.filterHash[b.value] }this.liveGrid.applyFilters() },filterKeypress:function(f){var a=Rico.eventElement(f); if(typeof this.lastKeyFilter!="string"){this.lastKeyFilter="" }if(this.lastKeyFilter==a.value){return }var b=a.value; Rico.log("filterKeypress: "+this.index+" "+b); this.lastKeyFilter=b; if(b){b=b.replace("\\","\\\\"); b=b.replace("(","\\(").replace(")","\\)"); b=b.replace(".","\\."); if(this.format.filterUI.indexOf("^")>0){b="^"+b }var d=new RegExp(b,"i"); this.filterRows=[]; var h=this.numRows(); for(var c=0; c=this.startPos)&&(b<=this.endPos()) },endPos:function(){return this.startPos+this.rows.length },fetch:function(a){Rico.log("fetch "+this.liveGrid.tableId+": offset="+a); this.applyFilters(); this.setTotalRows(); this.rcvdRowCount=true; this.foundRowCount=true; if(a<0){a=0 }this.liveGrid.refreshContents(a); return },visibleRows:function(){return this.rows.slice(this.windowStart,this.windowEnd) },setWindow:function(b,a){this.windowStart=b-this.startPos; Rico.log("setWindow "+this.liveGrid.tableId+": "+b+", "+a+", newstart="+this.windowStart); this.windowEnd=Math.min(a,this.size); this.windowPos=b },isVisible:function(a){return a=this.windowStart&&a=this.windowEnd){return false }return this.setValue(a,b,c) },getCell:function(b,a){return b=this.size){return false }if(!this.rows[d][b]){this.rows[d][b]={} }this.rows[d][b]=c; if(typeof a=="string"){this.rows[d][b]._style=a }this.rows[d][b].modified=true; return true },getRows:function(f,d){var e=f-this.startPos; var a=Math.min(e+d,this.size); var c=[]; for(var b=e; b=this.nan2zero(h.filterValues[0]) }else{f=this.baseRows[a][d]>=h.filterValues[0] }break; case"NULL":f=this.baseRows[a][d]==""; break; case"NOTNULL":f=this.baseRows[a][d]!=""; break }}if(f){g.push(this.baseRows[a]) }}this.rows=g }this.rowcntContent=this.size=this.rows.length },printAll:function(){this.liveGrid.showMsg(Rico.getPhraseById("exportInProgress")); Rico.runLater(10,this,"_printAll") },_printAll:function(){this.liveGrid.exportStart(); this.exportBuffer(this.getRows(0,this.totalRows)); this.liveGrid.exportFinish() },printVisible:function(){this.liveGrid.showMsg(Rico.getPhraseById("exportInProgress")); Rico.runLater(10,this,"_printVisible") },_printVisible:function(){this.liveGrid.exportStart(); this.exportBuffer(this.visibleRows()); this.liveGrid.exportFinish() },exportBuffer:function(l,f){var a,g,k,b,j; Rico.log("exportBuffer: "+l.length+" rows"); var e=this.liveGrid.getExportStyles(this.liveGrid.tbody[0]); var i=[]; var d=f||0; var h=this.liveGrid.columns; for(g=0; g"+k+"" }this.liveGrid.exportRows.push(j); d++; if(d%10==0){window.status=Rico.getPhraseById("exportStatus",d) }}}}; Rico.LiveGrid=function(c,a,b){this.initialize(c,a,b) }; Rico.LiveGrid.prototype={initialize:function(e,b,d){Rico.extend(this,Rico.GridCommon); Rico.extend(this,Rico.LiveGridMethods); this.baseInit(); this.tableId=e; this.buffer=b; this.actionId="_action_"+e; Rico.setDebugArea(e+"_debugmsgs"); Rico.extend(this.options,{visibleRows:-3,frozenColumns:0,offset:0,prefetchBuffer:true,minPageRows:2,maxPageRows:50,canSortDefault:true,canFilterDefault:b.options.canFilter,canHideDefault:true,highlightElem:"none",highlightSection:3,highlightMethod:"class",highlightClass:Rico.theme.gridHighlightClass||"ricoLG_selection",maxPrint:5000,headingSort:"link",hdrIconsFirst:true}); var c=this; this.options.sortHandler=function(){c.sortHandler() }; this.options.filterHandler=function(){c.filterHandler() }; this.options.onRefreshComplete=function(f,g){c.bookmarkHandler(f,g) }; this.options.rowOverHandler=Rico.eventHandle(this,"rowMouseOver"); this.options.mouseDownHandler=Rico.eventHandle(this,"selectMouseDown"); this.options.mouseOverHandler=Rico.eventHandle(this,"selectMouseOver"); this.options.mouseUpHandler=Rico.eventHandle(this,"selectMouseUp"); Rico.extend(this.options,d||{}); switch(typeof this.options.visibleRows){case"string":this.sizeTo=this.options.visibleRows; switch(this.options.visibleRows){case"data":this.options.visibleRows=-2; break; case"body":this.options.visibleRows=-3; break; case"parent":this.options.visibleRows=-4; break; case"datamax":this.options.visibleRows=-5; break; default:this.options.visibleRows=-1; break }break; case"number":switch(this.options.visibleRows){case -1:this.sizeTo="window"; break; case -2:this.sizeTo="data"; break; case -3:this.sizeTo="body"; break; case -4:this.sizeTo="parent"; break; case -5:this.sizeTo="datamax"; break; default:this.sizeTo="fixed"; break }break; default:this.sizeTo="body"; this.options.visibleRows=-3; break }this.highlightEnabled=this.options.highlightSection>0; this.pageSize=0; this.createTables(); if(this.headerColCnt==0){alert('ERROR: no columns found in "'+this.tableId+'"'); return }this.createColumnArray("LiveGridColumn"); if(this.options.headingSort=="hover"){this.createHoverSet() }this.bookmark=document.getElementById(this.tableId+"_bookmark"); this.sizeDivs(); var a=this.buffer.options.canFilter?this.options.FilterLocation:false; if(typeof(a)=="number"&&a<0){a=this.addHeadingRow("ricoLG_FilterRow") }this.createDataCells(this.options.visibleRows); if(this.pageSize==0){return }this.buffer.registerGrid(this); if(this.buffer.setBufferSize){this.buffer.setBufferSize(this.pageSize) }this.scrollTimeout=null; this.lastScrollPos=0; this.attachMenuEvents(); this.setSortUI(this.options.sortCol,this.options.sortDir); this.setImages(); if(this.listInvisible().length==this.columns.length){this.columns[0].showColumn() }this.sizeDivs(); this.scrollDiv.style.display=""; if(this.buffer.totalRows>0){this.updateHeightDiv() }if(this.options.prefetchBuffer){if(this.bookmark){this.bookmark.innerHTML=Rico.getPhraseById("bookmarkLoading") }if(this.options.canFilterDefault&&this.options.getQueryParms){this.checkForFilterParms() }this.scrollToRow(this.options.offset); this.buffer.fetch(this.options.offset) }if(typeof(a)=="number"){this.createFilters(a) }this.scrollEventFunc=Rico.eventHandle(this,"handleScroll"); this.wheelEventFunc=Rico.eventHandle(this,"handleWheel"); this.wheelEvent=(Rico.isIE||Rico.isOpera||Rico.isWebKit)?"mousewheel":"DOMMouseScroll"; if(this.options.offset&&this.options.offset=this.buffer.totalRows){return -1 }this.unhighlight(); this.menuIdx=a; this.highlight(a); var c=this.buffer.getWindowCell(a.row,f); for(var d=3; d0){Rico.log("Data provider returned an error:\n"+Rico.getContentAsString(n[0],this.buffer.isEncoded)); alert(Rico.getPhraseById("requestError",Rico.getContentAsString(n[0],this.buffer.isEncoded))); return false }f=f.getElementsByTagName("response")[0]; var l=f.getElementsByTagName("rows")[0]; var d=this.columns[parseInt(a,10)]; var r=this.buffer.dom2jstable(l); var m,b,q; if(d.filterType==Rico.ColumnConst.USERFILTER&&d.filterOp=="EQ"){q=d.filterValues[0] }Rico.log("filterValuesUpdate: col="+a+" rows="+r.length); switch(d.format.filterUI.charAt(0)){case"m":d.mFilter=document.body.appendChild(document.createElement("div")); d.mFilter.className="ricoLG_mFilter"; Rico.hide(d.mFilter); var e=d.mFilter.appendChild(document.createElement("div")); e.className="ricoLG_mFilter_content"; var o=d.mFilter.appendChild(document.createElement("div")); o.className="ricoLG_mFilter_button"; d.mFilterButton=o.appendChild(document.createElement("button")); d.mFilterButton.innerHTML=Rico.getPhraseById("ok"); var j=Rico.isWebKit?"mousedown":"click"; Rico.eventBind(d.filterField,j,Rico.eventHandle(d,"mFilterSelectClick")); Rico.eventBind(d.mFilterButton,"click",Rico.eventHandle(d,"mFilterFinish")); tab=e.appendChild(document.createElement("table")); tab.border=0; tab.cellPadding=2; tab.cellSpacing=0; var p=this.filterId(a)+"_"; this.createMFilterItem(tab,this.options.FilterAllToken,Rico.getPhraseById("filterAll"),p+"all",Rico.eventHandle(d,"mFilterAllClick")); var k=Rico.eventHandle(d,"mFilterOtherClick"); for(var h=0; h0){m=r[h][0]; this.createMFilterItem(tab,m,m||Rico.getPhraseById("filterBlank"),p+h,k) }}d.mFilterInputs=e.getElementsByTagName("input"); d.mFilterLabels=e.getElementsByTagName("label"); d.mFilterFocus=d.mFilterInputs.length?d.mFilterInputs[0]:d.mFilterButton; break; case"s":for(var h=0; h0){m=r[h][0]; b=Rico.addSelectOption(d.filterField,m,m||Rico.getPhraseById("filterBlank")); if(d.filterType==Rico.ColumnConst.USERFILTER&&m==q){b.selected=true }}}Rico.eventBind(d.filterField,"change",Rico.eventHandle(d,"filterChange")); break }return true },createMFilterItem:function(j,b,i,a,e){var f=j.insertRow(-1); f.vAlign="top"; if(f.rowIndex%2==1){f.className="ricoLG_mFilter_oddrow" }var d=f.insertCell(-1); var c=f.insertCell(-1); var h=Rico.createFormField(d,"input","checkbox",a); h.value=b; h.checked=true; var g=c.appendChild(document.createElement("label")); g.htmlFor=a; g.innerHTML=i; Rico.eventBind(h,"click",e) },unplugHighlightEvents:function(){var a=this.options.highlightSection; if(a&1){this.detachHighlightEvents(this.tbody[0]) }if(a&2){this.detachHighlightEvents(this.tbody[1]) }},insertPanelNames:function(a,b,d,f){Rico.log("insertPanelNames: start="+b+" limit="+d); a.className="ricoLG_hdg"; var i=-1,j,e=null,g=0; for(var h=b; h0; j++){this.thead[j0; j++){if(Rico.hasClass(a[0],"ricoFrozen")){if(e==this.headerRowIdx){this.options.frozenColumns=j+1 }}else{d=1 }this.thead[d].rows[e].appendChild(a[0]) }}}Rico.log("loadHdrSrc end") },sizeDivs:function(){Rico.log("sizeDivs: "+this.tableId); this.unhighlight(); this.baseSizeDivs(); var d=this.firstVisible(); if(this.pageSize==0||d<0){return }var c=this.columns[d].dataColDiv.offsetHeight; this.rowHeight=Math.round(c/this.pageSize); var b=this.dataHt; if(this.scrTabWi0==this.scrTabWi){this.innerDiv.style.height=(this.hdrHt+1)+"px"; this.scrollDiv.style.overflowX="hidden" }else{this.scrollDiv.style.overflowX="scroll"; b+=this.options.scrollBarWidth }this.scrollDiv.style.height=b+"px"; this.innerDiv.style.width=(this.scrWi)+"px"; this.scrollTab.style.width=(this.scrWi-this.options.scrollBarWidth)+"px"; this.resizeDiv.style.height=(this.hdrHt+this.dataHt+1)+"px"; Rico.log("sizeDivs scrHt="+b+" innerHt="+this.innerDiv.style.height+" rowHt="+this.rowHeight+" pageSize="+this.pageSize); var a=(this.scrWi-this.scrTabWib){this.removeRow() }while(this.pageSizeb&&this.buffer.totalRows>0){this.isPartialBlank=true; var a=this.adjustRow(this.lastRowPos); this.buffer.fetch(a) }else{if(this.pageSize=this.buffer.totalRows){break }this.appendBlankRow() }},appendBlankRow:function(){if(this.pageSize>=this.options.maxPageRows){return }Rico.log("appendBlankRow #"+this.pageSize); var a=this.defaultRowClass(this.pageSize); for(var d=0; d=this.buffer.endPos()); return a },attachHighlightEvents:function(a){switch(this.options.highlightElem){case"selection":Rico.eventBind(a,"mousedown",this.options.mouseDownHandler,false); a.ondrag=function(){return false }; a.onselectstart=function(){return false }; break; case"cursorRow":case"cursorCell":Rico.eventBind(a,"mouseover",this.options.rowOverHandler,false); break }},detachHighlightEvents:function(a){switch(this.options.highlightElem){case"selection":Rico.eventUnbind(a,"mousedown",this.options.mouseDownHandler,false); a.ondrag=null; a.onselectstart=null; break; case"cursorRow":case"cursorCell":Rico.eventUnbind(a,"mouseover",this.options.rowOverHandler,false); break }},getVisibleSelection:function(){var d=[]; if(this.SelectIdxStart&&this.SelectIdxEnd){var b=Math.max(Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row)-this.buffer.startPos,this.buffer.windowStart); var a=Math.min(Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row)-this.buffer.startPos,this.buffer.windowEnd-1); var g=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column); var f=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column); for(var h=b; h<=a; h++){for(var j=g; j<=f; j++){d.push({row:h-this.buffer.windowStart,column:j}) }}}if(this.SelectCtrl){for(var e=0; e=this.buffer.windowStart&&this.SelectCtrl[e].rowc){this.HideSelection(); return }var g=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column); var e=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column); var h=this.columns[g].cell(d-this.buffer.windowStart).offsetTop; var j=this.columns[g].cell(c-this.buffer.windowStart); var b=j.offsetTop+j.offsetHeight; var l=this.columns[g].dataCell.offsetLeft; var k=this.columns[e].dataCell.offsetLeft; var a=k+this.columns[e].dataCell.offsetWidth; this.highlightDiv[0].style.top=this.highlightDiv[3].style.top=this.highlightDiv[1].style.top=(this.hdrHt+h-1)+"px"; this.highlightDiv[2].style.top=(this.hdrHt+b-1)+"px"; this.highlightDiv[3].style.left=(l-2)+"px"; this.highlightDiv[0].style.left=this.highlightDiv[2].style.left=(l-1)+"px"; this.highlightDiv[1].style.left=(a-1)+"px"; this.highlightDiv[0].style.width=this.highlightDiv[2].style.width=(a-l-1)+"px"; this.highlightDiv[1].style.height=this.highlightDiv[3].style.height=(b-h)+"px"; for(var f=0; f<4; f++){this.highlightDiv[f].style.display="" }},HideSelection:function(){var b; if(this.options.highlightMethod!="class"){for(b=0; bb){return false }var e=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column); var d=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column); var f=this.datasetIndex(a); return(c<=f.row&&f.row<=b&&e<=f.column&&f.column<=d) },highlightCell:function(a){Rico.addClass(a,this.options.highlightClass) },unhighlightCell:function(a){if(a){Rico.removeClass(a,this.options.highlightClass) }},selectRow:function(a){for(var b=0; b=0){c=this.columns[a].getSortDirection() }else{if(typeof c!="string"){c=Rico.ColumnConst.SORT_ASC }else{c=c.toUpperCase(); if(c!=Rico.ColumnConst.SORT_DESC){c=Rico.ColumnConst.SORT_ASC }}switch(typeof b){case"string":a=this.findColumnName(b); break; case"number":a=b; break }}if(typeof(a)!="number"||a<0){return }this.clearSort(); this.columns[a].setSorted(c); this.buffer.sortBuffer(a) },clearSort:function(){for(var a=0; aj; var d=h?this.buffer.startPos:j; this.contentStartPos=d+1; var b=Math.min(this.buffer.startPos+this.buffer.size,j+this.pageSize); this.buffer.setWindow(d,b); Rico.log("refreshContents2 "+this.tableId+": cStartPos="+d+" cEndPos="+b+" vPrecedesBuf="+h+" b.startPos="+this.buffer.startPos); if(j==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){return }this.isBlank=false; var m=this.options.onRefreshComplete; if((j+this.pageSize0; this.lastRowPos=j; Rico.log("refreshContents complete, startPos="+j); if(m){m(this.contentStartPos,b) }},scrollToRow:function(a){var b=this.rowToPixel(a); Rico.log("scrollToRow, rowOffset="+a+" pixel="+b); this.scrollDiv.scrollTop=b; if(this.options.onscroll){this.options.onscroll(this,a) }},scrollUp:function(){this.moveRelative(-1) },scrollDown:function(){this.moveRelative(1) },pageUp:function(){this.moveRelative(-this.pageSize) },pageDown:function(){this.moveRelative(this.pageSize) },adjustRow:function(a){var b=this.topOfLastPage(); if(b==0||!a){return 0 }return Math.min(b,a) },rowToPixel:function(a){return this.adjustRow(a)*this.rowHeight },pixeltorow:function(c){var b=this.topOfLastPage(); if(b==0){return 0 }var a=parseInt(c/this.rowHeight,10); return Math.min(b,a) },moveRelative:function(b){var a=Math.max(this.scrollDiv.scrollTop+b*this.rowHeight,0); a=Math.min(a,this.scrollDiv.scrollHeight); this.scrollDiv.scrollTop=a },pluginScroll:function(){if(this.scrollPluggedIn){return }Rico.log("pluginScroll: wheelEvent="+this.wheelEvent); Rico.eventBind(this.scrollDiv,"scroll",this.scrollEventFunc,false); for(var a=0; a<2; a++){Rico.eventBind(this.tabs[a],this.wheelEvent,this.wheelEventFunc,false) }this.scrollPluggedIn=true },unplugScroll:function(){if(!this.scrollPluggedIn){return }Rico.log("unplugScroll"); Rico.eventUnbind(this.scrollDiv,"scroll",this.scrollEventFunc,false); for(var a=0; a<2; a++){Rico.eventUnbind(this.tabs[a],this.wheelEvent,this.wheelEventFunc,false) }this.scrollPluggedIn=false },handleWheel:function(a){var b=0; if(a.wheelDelta){if(Rico.isOpera){b=a.wheelDelta/120 }else{if(Rico.isWebKit){b=-a.wheelDelta/12 }else{b=-a.wheelDelta/120 }}}else{if(a.detail){b=a.detail/3 }}if(b){this.moveRelative(b) }Rico.eventStop(a); return false },handleScroll:function(g){if(this.scrollTimeout){clearTimeout(this.scrollTimeout) }this.setHorizontalScroll(); var a=this.scrollDiv.scrollTop; var b=this.lastScrollPos-a; if(b==0){return }var d=this.pixeltorow(a); if(d==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){return }var f=new Date(); Rico.log("handleScroll, newrow="+d+" scrtop="+a); if(this.options.highlightElem=="selection"){this.HideSelection() }this.buffer.fetch(d); if(this.options.onscroll){this.options.onscroll(this,d) }this.scrollTimeout=Rico.runLater(1200,this,"scrollIdle"); this.lastScrollPos=this.scrollDiv.scrollTop; var c=new Date() },scrollIdle:function(){if(this.options.onscrollidle){this.options.onscrollidle() }}}; Rico.LiveGridColumn=function(a,d,c,b){this.initialize(a,d,c,b) }; Rico.LiveGridColumn.prototype={initialize:function(liveGrid,colIdx,hdrInfo,tabIdx){Rico.extend(this,new Rico.TableColumnBase()); this.baseInit(liveGrid,colIdx,hdrInfo,tabIdx); this.buffer=liveGrid.buffer; if(typeof(this.format.type)!="string"||this.format.EntryType=="tinyMCE"){this.format.type="html" }if(typeof this.isNullable!="boolean"){this.isNullable=/number|date/.test(this.format.type) }this.isText=/html|text/.test(this.format.type); Rico.log(" sortable="+this.sortable+" filterable="+this.filterable+" hideable="+this.hideable+" isNullable="+this.isNullable+" isText="+this.isText); this.fixHeaders(this.liveGrid.tableId,this.options.hdrIconsFirst); if(this["format_"+this.format.type]){this._format=this["format_"+this.format.type] }if(this.format.control){if(typeof this.format.control=="string"){this.format.control=eval(this.format.control) }for(var property in this.format.control){if(property.charAt(0)=="_"){Rico.log("Copying control property "+property+" to "+this); this[property]=this.format.control[property] }}}},sortAsc:function(){this.setColumnSort(Rico.ColumnConst.SORT_ASC) },sortDesc:function(){this.setColumnSort(Rico.ColumnConst.SORT_DESC) },setColumnSort:function(a){this.liveGrid.clearSort(); this.setSorted(a); if(this.liveGrid.options.saveColumnInfo.sort){this.liveGrid.setCookie() }if(this.options.sortHandler){this.options.sortHandler() }},isSortable:function(){return this.sortable },isSorted:function(){return this.currentSort!=Rico.ColumnConst.UNSORTED },getSortDirection:function(){return this.currentSort },toggleSort:function(){if(this.buffer&&this.buffer.totalRows==0){return }if(this.currentSort==Rico.ColumnConst.SORT_ASC){this.sortDesc() }else{this.sortAsc() }},setUnsorted:function(){this.setSorted(Rico.ColumnConst.UNSORTED) },setSorted:function(a){this.currentSort=a },canFilter:function(){return this.filterable },getFilterText:function(){var c=[]; for(var b=0; b= "+c[0]; case"LIKE":return Rico.getPhraseById("filterLike",c[0]); case"NULL":return Rico.getPhraseById("filterEmpty"); case"NOTNULL":return Rico.getPhraseById("filterNotEmpty") }return"?" },getFilterQueryParm:function(){if(this.filterType==Rico.ColumnConst.UNFILTERED){return"" }var a="&f["+this.index+"][op]="+this.filterOp; a+="&f["+this.index+"][len]="+this.filterValues.length; for(var b=0; b0){var f=a.join(", "); this.filterField.options[0].text=f; this.filterField.title=f; Rico.hide(this.mFilter); this.mFilterChange=false; var b=this; this.setFilter("EQ",c,Rico.ColumnConst.USERFILTER,function(){b.mFilterReset() }) }else{alert("Please select at least one value") }},mFilterReset:function(){var a=this.mFilterLabels[0].innerHTML; this.filterField.options[0].text=a; this.filterField.title=a },mFilterAllClick:function(c){var a=this.mFilterInputs[0].checked; for(var b=1; b/g,">") }},format_number:function(a){if(typeof a=="undefined"||a==""||a==null){return" " }else{return Rico.formatNumber(a,this.format) }},format_datetime:function(a){if(typeof a=="undefined"||a==""||a==null){return" " }else{var b=Rico.setISO8601(a); if(!b){return a }return(this.format.prefix||"")+Rico.formatDate(b,this.format.dateFmt||"translateDateTime")+(this.format.suffix||"") }},format_utcaslocaltime:function(a){if(typeof a=="undefined"||a==""||a==null){return" " }else{var c=new Date(); var b=Rico.setISO8601(a,-c.getTimezoneOffset()); if(!b){return a }return(this.format.prefix||"")+Rico.formatDate(b,this.format.dateFmt||"translateDateTime")+(this.format.suffix||"") }},format_date:function(a){if(typeof a=="undefined"||a==null||a==""){return" " }else{var b=Rico.setISO8601(a); if(!b){return a }return(this.format.prefix||"")+Rico.formatDate(b,this.format.dateFmt||"translateDate")+(this.format.suffix||"") }},fixHeaders:function(d,e){if(this.sortable){var c=Rico.eventHandle(this,"toggleSort"); switch(this.options.headingSort){case"link":var b=Rico.wrapChildren(this.hdrCellDiv,"ricoSort",undefined,"a"); b.href="javascript:void(0)"; Rico.eventBind(b,"click",c); break; case"hover":Rico.eventBind(this.hdrCellDiv,"click",c); break }}this.imgFilter=document.createElement("span"); this.imgFilter.style.display="none"; this.imgFilter.className="rico-icon ricoLG_filterCol"; this.imgSort=document.createElement("span"); this.imgSort.style.display="none"; this.imgSort.style.verticalAlign="top"; if(e){this.hdrCellDiv.insertBefore(this.imgSort,this.hdrCellDiv.firstChild); this.hdrCellDiv.insertBefore(this.imgFilter,this.hdrCellDiv.firstChild) }else{this.hdrCellDiv.appendChild(this.imgFilter); this.hdrCellDiv.appendChild(this.imgSort) }if(!this.format.filterUI){Rico.eventBind(this.imgFilter,"click",Rico.eventHandle(this,"filterClick"),false) }},filterClick:function(a){if(this.filterType==Rico.ColumnConst.USERFILTER&&this.filterOp=="LIKE"){this.liveGrid.openKeyword(this.index) }},getValue:function(a){return this.buffer.getWindowCell(a,this.index) },getBufferStyle:function(a){return this.buffer.getWindowStyle(a,this.index) },setValue:function(b,a){this.buffer.setWindowValue(b,this.index,a) },_format:function(a){return a },_display:function(a,b){b.innerHTML=this._format(a) },_export:function(a){return this._format(a) },exportBuffer:function(a){return this._export(this.buffer.getValue(a,this.index)) },displayValue:function(c){var a=this.getValue(c); if(a==null){this.clearCell(c); return }var b=this.cell(c); this._display(a,b,c); if(this.buffer.options.acceptStyle){b.style.cssText=this.getBufferStyle(c) }}}; Rico.TableColumn={}; Rico.TableColumn.checkboxKey=function(a){this.initialize(a) }; Rico.TableColumn.checkboxKey.prototype={initialize:function(a){this._checkboxes=[]; this._spans=[]; this._KeyHash={}; this._showKey=a },_create:function(a,b){this._checkboxes[b]=Rico.createFormField(a,"input","checkbox",this.liveGrid.tableId+"_chkbox_"+this.index+"_"+b); this._spans[b]=Rico.createFormField(a,"span",null,this.liveGrid.tableId+"_desc_"+this.index+"_"+b); this._clear(a,b); Rico.eventBind(this._checkboxes[b],"click",Rico.eventHandle(this,"_onclick")) },_onclick:function(c){var b=Event.element(c); var d=parseInt(b.id.substr((b.id.lastIndexOf("_",b.id.length)+1))); var a=this.getValue(d); if(b.checked){this._addChecked(a) }else{this._remChecked(a) }},_clear:function(b,c){var a=this._checkboxes[c]; a.checked=false; a.style.display="none"; this._spans[c].innerHTML="" },_display:function(a,c,d){var b=this._checkboxes[d]; b.style.display=""; b.checked=this._KeyHash[a]; if(this._showKey){this._spans[d].innerHTML=a }},_SelectedKeys:function(){return Rico.keys(this._KeyHash) },_addChecked:function(a){this._KeyHash[a]=1 },_remChecked:function(a){delete this._KeyHash[a] }}; Rico.TableColumn.checkbox=function(b,c,a,d){this.initialize(b,c,a,d) }; Rico.TableColumn.checkbox.prototype={initialize:function(b,c,a,d){this._checkedValue=b; this._uncheckedValue=c; this._defaultValue=a||false; this._readOnly=d||false; this._checkboxes=[] },_create:function(a,b){this._checkboxes[b]=Rico.createFormField(a,"input","checkbox",this.liveGrid.tableId+"_chkbox_"+this.index+"_"+b); this._clear(a,b); if(this._readOnly){this._checkboxes[b].disabled=true }else{Rico.eventBind(this._checkboxes[b],"click",Rico.eventHandle(this,"_onclick")) }},_onclick:function(c){var a=Event.element(c); var d=parseInt(a.id.substr((a.id.lastIndexOf("_",a.id.length)+1))); var b=a.checked?this._checkedValue:this._uncheckedValue; this.setValue(d,b) },_clear:function(b,c){var a=this._checkboxes[c]; a.checked=this._defaultValue; a.style.display="none" },_display:function(a,c,d){var b=this._checkboxes[d]; b.style.display=""; b.checked=(a==this._checkedValue) }}; Rico.TableColumn.textbox=function(c,b,a){this.initialize(c,b,a) }; Rico.TableColumn.textbox.prototype={initialize:function(c,b,a){this._boxSize=c; this._boxMaxLen=b; this._readOnly=a||false; this._textboxes=[] },_create:function(b,c){var a=Rico.createFormField(b,"input","text",this.liveGrid.tableId+"_txtbox_"+this.index+"_"+c); a.size=this._boxSize; a.maxLength=this._boxMaxLen; this._textboxes[c]=a; this._clear(b,c); if(this._readOnly){a.disabled=true }else{Rico.eventBind(a,"change",Rico.eventHandle(this,"_onchange")) }},_onchange:function(b){var a=Event.element(b); var c=parseInt(a.id.substr((a.id.lastIndexOf("_",a.id.length)+1))); this.setValue(c,a.value) },_clear:function(b,c){var a=this._textboxes[c]; a.value=""; a.style.display="none" },_display:function(a,c,d){var b=this._textboxes[d]; b.style.display=""; b.value=a }}; Rico.TableColumn.HighlightCell=function(a,c,e,b,d){this.initialize(a,c,e,b,d) }; Rico.TableColumn.HighlightCell.prototype={initialize:function(a,c,e,b,d){this._chkcol=a; this._chkval=c; this._chkop=d; this._highlightColor=e; this._highlightBackground=b },_clear:function(a,b){a.style.color=""; a.style.backgroundColor=""; a.innerHTML=" " },_display:function(b,d,e){var a=this.liveGrid.buffer.getWindowValue(e,this._chkcol); var c; switch(this._chkop){case"!=":c=(a!=this._chkval); break; case">":c=(a>this._chkval); break; case"<":c=(a=":c=(a>=this._chkval); break; case"<=":c=(a<=this._chkval); break; case"abs>":c=(Math.abs(a)>this._chkval); break; case"abs<":c=(Math.abs(a)=":c=(Math.abs(a)>=this._chkval); break; case"abs<=":c=(Math.abs(a)<=this._chkval); break; default:c=(a==this._chkval); break }d.style.color=c?this._highlightColor:""; d.style.backgroundColor=c?this._highlightBackground:""; d.innerHTML=this._format(b) }}; Rico.TableColumn.bgColor=function(){}; Rico.TableColumn.bgColor.prototype={_clear:function(a,b){a.style.backgroundColor="" },_display:function(a,b,c){b.style.backgroundColor=a }}; Rico.TableColumn.link=function(a,c,b){this.initialize(a,c,b) }; Rico.TableColumn.link.prototype={initialize:function(a,c,b){this._href=a; this._target=c; this._linktext=b; this._anchors=[] },_create:function(a,b){this._anchors[b]=Rico.createFormField(a,"a",null,this.liveGrid.tableId+"_a_"+this.index+"_"+b); if(this._target){this._anchors[b].target=this._target }this._clear(a,b) },_clear:function(a,b){this._anchors[b].href=""; this._anchors[b].innerHTML="" },_display:function(b,d,f){var c=this.liveGrid.buffer; var a=this._href=="self"?b:this._href.replace(/\{\d+\}/g,function(g){var h=parseInt(g.substr(1),10); return encodeURIComponent(c.getWindowValue(f,h)) }); var e=this._linktext||b; if(a&&e){this._anchors[f].href=a; this._anchors[f].innerHTML=e }else{this._clear(d,f) }}}; Rico.TableColumn.image=function(a,b){this.initialize(a,b) }; Rico.TableColumn.image.prototype={initialize:function(a,b){this._img=[]; this._prefix=a||""; this._suffix=b||"" },_create:function(a,b){this._img[b]=Rico.createFormField(a,"img",null,this.liveGrid.tableId+"_img_"+this.index+"_"+b); this._clear(a,b) },_clear:function(b,c){var a=this._img[c]; a.style.display="none"; a.src="" },_display:function(b,c,d){var a=this._img[d]; this._img[d].src=this._prefix+b+this._suffix; a.style.display="" }}; Rico.TableColumn.lookup=function(c,a,b){this.initialize(c,a,b) }; Rico.TableColumn.lookup.prototype={initialize:function(d,a,c){this._map=d; this._defaultCode=a||""; this._defaultDesc=c||" "; var b=this; this._sortfunc=function(e){return b._sortvalue(e) }; this._codes=[]; this._descriptions=[] },_create:function(a,b){this._descriptions[b]=Rico.createFormField(a,"span",null,this.liveGrid.tableId+"_desc_"+this.index+"_"+b); this._codes[b]=Rico.createFormField(a,"input","hidden",this.liveGrid.tableId+"_code_"+this.index+"_"+b); this._clear(a,b) },_clear:function(a,b){this._codes[b].value=this._defaultCode; this._descriptions[b].innerHTML=this._defaultDesc },_sortvalue:function(a){return this._getdesc(a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/ /g," ") },_getdesc:function(a){var b=this._map[a]; return(typeof b=="string")?b:this._defaultDesc },_export:function(a){return this._getdesc(a) },_display:function(a,b,c){this._codes[c].value=a; this._descriptions[c].innerHTML=this._getdesc(a) }}; Rico.TableColumn.MultiLine=function(){}; Rico.TableColumn.MultiLine.prototype={_display:function(a,c,d){var b=document.createElement("div"); b.innerHTML=this._format(a); b.style.height="100%"; if(c.firstChild){c.replaceChild(b,c.firstChild) }else{c.appendChild(b) }}}; if(typeof Rico=="undefined"){throw ("GridMenu requires the Rico JavaScript framework") }Rico.GridMenu=function(a){this.initialize(a) }; Rico.GridMenu.prototype={initialize:function(a){this.options={width:"18em",dataMenuHandler:null}; Rico.extend(this.options,a||{}); Rico.extend(this,new Rico.Menu(this.options)); this.sortmenu=new Rico.Menu({width:"15em"}); this.filtermenu=new Rico.Menu({width:"22em"}); this.exportmenu=new Rico.Menu({width:"24em"}); this.hideshowmenu=new Rico.Menu({width:"22em"}); this.createDiv(); this.sortmenu.createDiv(); this.filtermenu.createDiv(); this.exportmenu.createDiv(); this.hideshowmenu.createDiv() },buildGridMenu:function(a,i){this.clearMenu(); var o=this.liveGrid; var f=o.buffer; var m=f.totalRows; var n=o.options.maxPrint; var b=(a>=m); var d=o.columns[i]; if(this.options.dataMenuHandler){var l=this.options.dataMenuHandler(o,a,i,b); if(!l){return(this.itemCount>0) }}if(d.sortable&&m>0){this.sortmenu.clearMenu(); this.addSubMenuItem(Rico.getPhraseById("gridmenuSortBy",d.displayName),this.sortmenu,false); this.sortmenu.addMenuItemId("gridmenuSortAsc",function(){d.sortAsc() },true); this.sortmenu.addMenuItemId("gridmenuSortDesc",function(){d.sortDesc() },true) }this.filtermenu.clearMenu(); if(d.canFilter()){this.addSubMenuItem(Rico.getPhraseById("gridmenuFilterBy",d.displayName),this.filtermenu,false); if(!d.format.filterUI&&(!b||d.filterType==Rico.ColumnConst.USERFILTER)){d.userFilter=d.getValue(a); if(d.filterType==Rico.ColumnConst.USERFILTER){this.filtermenu.addMenuItemId("gridmenuRemoveFilter",function(){d.setUnfiltered(false) },true); if(d.filterOp=="LIKE"){this.filtermenu.addMenuItemId("gridmenuChgKeyword",function(){o.openKeyword(i) },true) }if(d.filterOp=="NE"&&!b){this.filtermenu.addMenuItemId("gridmenuExcludeAlso",function(){d.addFilterNE() },true) }}else{if(!b){this.filtermenu.addMenuItemId("gridmenuInclude",function(){d.setFilterEQ() },true); this.filtermenu.addMenuItemId("gridmenuGreaterThan",function(){d.setFilterGE() },d.userFilter!=""); this.filtermenu.addMenuItemId("gridmenuLessThan",function(){d.setFilterLE() },d.userFilter!=""); if(d.isText){this.filtermenu.addMenuItemId("gridmenuContains",function(){o.openKeyword(i) },true) }this.filtermenu.addMenuItemId("gridmenuExclude",function(){d.setFilterNE() },true) }}}if(o.filterCount()>0){this.filtermenu.addMenuItemId("gridmenuRemoveAll",function(){o.clearFilters() },true) }this.filtermenu.addMenuItemId("gridmenuRefresh",function(){o.filterHandler() },true) }this.exportmenu.clearMenu(); if(n>0){this.addSubMenuItem(Rico.getPhraseById("gridmenuExport"),this.exportmenu,false); if(f.printVisibleSQL&&typeof(f.dataSource)=="string"){this.exportmenu.addMenuItemId("gridmenuExportVis2Web",function(){f.printVisibleSQL("html") }); this.exportmenu.addMenuItemId("gridmenuExportAll2Web",function(){f.printAllSQL("html") },f.totalRows<=n); this.exportmenu.addMenuBreak(); this.exportmenu.addMenuItemId("gridmenuExportVis2SS",function(){f.printVisibleSQL("xl") }); this.exportmenu.addMenuItemId("gridmenuExportAll2SS",function(){f.printAllSQL("xl") },f.totalRows<=n) }else{this.addSubMenuItem(Rico.getPhraseById("gridmenuExport"),this.exportmenu,false); this.exportmenu.addMenuItemId("gridmenuExportVis2Web",function(){f.printVisible() }); this.exportmenu.addMenuItemId("gridmenuExportAll2Web",function(){f.printAll() },f.totalRows<=n) }}var k=o.listInvisible(); for(var e=0,j=0; j0||d.canHideShow()){this.hideshowmenu.clearMenu(); this.addSubMenuItem(Rico.getPhraseById("gridmenuHideShow"),this.hideshowmenu,false); this.hideshowmenu.addMenuItemId("gridmenuChooseCols",function(){o.chooseColumns() },true,false); var h=o.columns.length-k.length; var g=(h>1&&d.visible&&d.canHideShow()); this.hideshowmenu.addMenuItem(Rico.getPhraseById("gridmenuHide",d.displayName),function(){d.hideColumn() },g); if(k.length>1){this.hideshowmenu.addMenuItemId("gridmenuShowAll",function(){o.showAll() }) }}return true }}; if(typeof Rico=="undefined"){throw ("LiveGridAjax requires the Rico JavaScript framework") }if(!Rico.Buffer){Rico.Buffer={} }Rico.Buffer.AjaxXML=function(c,b,a){this.initialize(c,b,a) }; Rico.Buffer.AjaxXML.prototype={initialize:function(c,b,a){Rico.extend(this,new Rico.Buffer.Base()); Rico.extend(this,Rico.Buffer.AjaxXMLMethods); this.dataSource=c; this.options.bufferTimeout=20000; this.options.requestParameters=[]; this.options.waitMsg=Rico.getPhraseById("waitForData"); this.options.canFilter=true; this.options.fmt="xml"; Rico.extend(this.options,b||{}); this.ajaxOptions={parameters:null,method:"get"}; Rico.extend(this.ajaxOptions,a||{}); this.requestCount=0; this.processingRequest=false; this.pendingRequest=-2; this.fetchData=true; this.sortParm={} }}; Rico.Buffer.AjaxXMLMethods={fetch:function(b){if(this.fetchData){this.foundRowCount=true; this.fetchData=false; this.processingRequest=true; this.liveGrid.showMsg(this.options.waitMsg); this.timeoutHandler=Rico.runLater(this.options.bufferTimeout,this,"handleTimedOut"); this.ajaxOptions.parameters=this.formQueryHashXML(0,-1); Rico.log("sending request"); var a=this; if(typeof this.dataSource=="string"){this.ajaxOptions.onComplete=function(c){a.ajaxUpdate(b,c) }; new Rico.ajaxRequest(this.dataSource,this.ajaxOptions) }else{this.ajaxOptions.onComplete=function(d,f,c,e){a.jsUpdate(b,d,f,c,e) }; this.dataSource(this.ajaxOptions) }}else{if(b<0){this.applyFilters(); this.setTotalRows(this.size); b=0 }this.liveGrid.refreshContents(b) }},handleTimedOut:function(){Rico.log("Request Timed Out"); this.liveGrid.showMsg(Rico.getPhraseById("requestTimedOut")) },formQueryHashXML:function(e,c){var d={id:this.liveGrid.tableId,page_size:(typeof c=="number")?c:this.totalRows,offset:e.toString()}; if(!this.foundRowCount){d.get_total="true" }if(this.options.requestParameters){for(var f=0; f=-1){var b=this.pendingRequest; Rico.log("ajaxUpdate: found pending request for offset="+b); this.pendingRequest=-2; this.fetch(b) }},processResponseXML:function(k,f){var o=f.responseXML; if(f.responseText.substring(0,4)==""); if(m==-1){this.liveGrid.showMsg("Web server error - client side debugging may be enabled"); return false }o=Rico.createXmlDocument(); o.loadXML(f.responseText.substring(m+3)) }if(!o){alert("Data provider returned an invalid XML response"); Rico.log("Data provider returned an invalid XML response"); return false }var d=o.getElementsByTagName("ajax-response"); if(d==null||d.length!=1){alert("Received invalid response from server"); return false }Rico.log("Processing ajax-response"); this.rcvdRows=0; this.rcvdRowCount=false; var b=d[0]; var a=b.getElementsByTagName("debug"); for(var g=0; g0){var c=Rico.getContentAsString(l[0],this.options.isEncoded); alert("Data provider returned an error:\n"+c); Rico.log("Data provider returned an error:\n"+c); return false }var j=b.getElementsByTagName("rows")[0]; if(!j){Rico.log("ajaxUpdate: invalid response"); this.liveGrid.showMsg(Rico.getPhraseById("invalidResponse")); return false }var n=b.getElementsByTagName("rowcount"); if(n&&n.length==1){this.rowcntContent=Rico.getContentAsString(n[0],this.options.isEncoded); this.rcvdRowCount=true; this.foundRowCount=true; Rico.log("ajaxUpdate: found RowCount="+this.rowcntContent) }this.updateUI=j.getAttribute("update_ui")=="true"; this.rcvdOffset=j.getAttribute("offset"); Rico.log("ajaxUpdate: rcvdOffset="+this.rcvdOffset); var h=this.dom2jstable(j); var e=(this.options.acceptStyle)?this.dom2jstableStyle(j):false; this.rcvdRows=h.length; this.updateBuffer(k,h,e); return true },dom2jstableStyle:function(e,b){var a=this.options.acceptStyle; Rico.log("dom2jstableStyle start"); var f=[]; var g=e.getElementsByTagName("tr"); for(var d=b||0; dthis.totalRows){var c=a; Rico.log("extending totrows to "+c); this.setTotalRows(c) }}e=this.liveGrid.pixeltorow(this.liveGrid.scrollDiv.scrollTop); Rico.log("updateGrid: newpos="+e); this.liveGrid.refreshContents(e) }}; Rico.Buffer.AjaxSQL=function(c,b,a){this.initialize(c,b,a) }; Rico.Buffer.AjaxSQL.prototype={initialize:function(c,b,a){Rico.extend(this,new Rico.Buffer.AjaxXML()); Rico.extend(this,Rico.Buffer.AjaxSQLMethods); this.dataSource=c; this.options.canFilter=true; this.options.largeBufferSize=7; this.options.nearLimitFactor=1; Rico.extend(this.options,b||{}); Rico.extend(this.ajaxOptions,a||{}) }}; Rico.Buffer.AjaxSQLMethods={registerGrid:function(a){this.liveGrid=a; this.sessionExpired=false; this.timerMsg=document.getElementById(a.tableId+"_timer"); if(this.options.TimeOut&&this.timerMsg){if(!this.timerMsg.title){this.timerMsg.title=Rico.getPhraseById("sessionExpireMinutes") }this.restartSessionTimer() }},setBufferSize:function(a){this.maxFetchSize=Math.max(50,parseInt(this.options.largeBufferSize*a,10)); this.nearLimit=parseInt(this.options.nearLimitFactor*a,10); this.maxBufferSize=this.maxFetchSize*3 },restartSessionTimer:function(){if(this.sessionExpired==true){return }this.sessionEndTime=(new Date()).getTime()+this.options.TimeOut*60000; if(this.sessionTimer){clearTimeout(this.sessionTimer) }this.updateSessionTimer() },updateSessionTimer:function(){var b=(new Date()).getTime(); if(b>this.sessionEndTime){this.displaySessionTimer(Rico.getPhraseById("sessionExpired")); this.timerMsg.style.backgroundColor="red"; this.sessionExpired=true }else{var a=Math.ceil((this.sessionEndTime-b)/60000); this.displaySessionTimer(a); this.sessionTimer=Rico.runLater(10000,this,"updateSessionTimer") }},displaySessionTimer:function(a){this.timerMsg.innerHTML=" "+a+" " },refresh:function(b){var a=this.liveGrid.lastRowPos; this.clear(); if(b){this.setTotalRows(0); this.foundRowCount=false }this.liveGrid.clearBookmark(); this.liveGrid.clearRows(); this.fetch(a) },fetch:function(e){Rico.log("AjaxSQL fetch: offset="+e+", lastOffset="+this.lastOffset); if(this.processingRequest){Rico.log("AjaxSQL fetch: queue request"); this.pendingRequest=e; return }if(e<0){this.clear(); this.setTotalRows(0); this.foundRowCount=false; e=0 }var d=this.lastOffset; this.lastOffset=e; if(this.isInRange(e)){Rico.log("AjaxSQL fetch: in buffer"); this.liveGrid.refreshContents(e); if(e>d){if(e+this.liveGrid.pageSizethis.startPos+this.nearLimit){return }if(this.startPos==0){return }}else{return }}}if(e>=this.totalRows&&this.foundRowCount){return }this.processingRequest=true; Rico.log("AjaxSQL fetch: processing offset="+e); var c=this.getFetchOffset(e); var a=this.getFetchSize(c); var f=false; this.liveGrid.showMsg(this.options.waitMsg); this.timeoutHandler=Rico.runLater(this.options.bufferTimeout,this,"handleTimedOut"); this.ajaxOptions.parameters=this.formQueryHashSQL(c,a,this.options.fmt); this.requestCount++; Rico.log("sending req #"+this.requestCount); var b=this; if(typeof this.dataSource=="string"){this.ajaxOptions.onComplete=function(g){b.ajaxUpdate(c,g) }; new Rico.ajaxRequest(this.dataSource,this.ajaxOptions) }else{this.ajaxOptions.onComplete=function(h,j,g,i){b.jsUpdate(c,h,j,g,i) }; this.dataSource(this.ajaxOptions) }},formQueryHashSQL:function(g,h,d){var k=this.formQueryHashXML(g,h); k[this.liveGrid.actionId]="query"; if(d){k._fmt=d }Rico.extend(k,this.sortParm); for(var b=0; b=this.startPos){var c=this.maxFetchSize+a; b=c-a; if(a==0&&b0){return }var a=parseInt(this.options.panelWidth,10); if(this.form){if(Rico.isWebKit){this.formPopup.container.style.display="block" }this.options.bgColor=Rico.Color.createColorFromBackground(this.form).toString() }this.formPopup.container.style.display="none"; this.formPanels=new Rico.TabbedPanel(this.panelGroup,this.options) },notEmpty:function(a){return typeof(a)!="undefined" },startForm:function(){this.form=document.createElement("form"); this.form.onsubmit=function(){return false }; this.form.autocomplete="off"; this.formPopup.contentDiv.appendChild(this.form); var e=document.createElement("div"); e.className="ButtonBar"; var d=e.appendChild(this.createButton(Rico.getPhraseById("saveRecord",this.options.RecordName))); Rico.eventBind(d,"click",Rico.eventHandle(this,"TESubmit"),false); d=e.appendChild(this.createButton(Rico.getPhraseById("cancel"))); Rico.eventBind(d,"click",Rico.eventHandle(this,"cancelEdit"),false); this.form.appendChild(e); this.hiddenFields=document.createElement("div"); this.hiddenFields.style.display="none"; this.action=this.appendHiddenField(this.grid.actionId,""); var c,a; for(c=0; c=0; c--){b[c]=this.createPanel(c) }}else{for(c=0; c0?i.rows[i.rows.length-1]:i.insertRow(-1); var h=j.insertCell(-1); c.formLabel=h; if(h.noWrap){h.noWrap=true }var f=j.insertCell(-1); if(f.noWrap){f.noWrap=true }h.id="lbl_"+b.FieldName; var e,a=b.FieldName; switch(b.EntryType){case"TA":case"tinyMCE":e=Rico.createFormField(f,"textarea",null,a); e.cols=b.TxtAreaCols; e.rows=b.TxtAreaRows; e.innerHTML=b.ColData; h.style.verticalAlign="top"; break; case"R":case"RL":e=Rico.createFormField(f,"div",null,a); if(b.DescriptionField){e.RicoUpdate=b.DescriptionField }if(b.MultiSelect){Rico.addClass(e,"MultiSelect") }if(b.isNullable&&!b.MultiSelect){this.addSelectNone(e) }this.selectValuesRequest(e,c); break; case"N":e=Rico.createFormField(f,"select",null,a); if(b.isNullable){this.addSelectNone(e) }Rico.eventBind(e,"change",Rico.eventHandle(this,"checkSelectNew")); this.selectValuesRequest(e,c); e=document.createElement("span"); e.className="ricoEditLabel"; e.id="labelnew__"+b.FieldName; e.innerHTML="   "+Rico.getPhraseById("formNewValue").replace(" "," "); f.appendChild(e); a="textnew__"+b.FieldName; e=Rico.createFormField(f,"input","text",a,a); break; case"S":case"SL":if(b.ReadOnly){e=Rico.createFormField(f,"input","text",a,a); this.initField(e,b) }else{e=Rico.createFormField(f,"select",null,a); if(b.MultiSelect){e.multiple=true }if(b.SelectRows){e.size=parseInt(b.SelectRows,10) }if(b.isNullable&&!b.MultiSelect){this.addSelectNone(e) }if(b.DescriptionField){e.RicoUpdate=b.DescriptionField; Rico.eventBind(e,"change",Rico.eventHandle(this,"selectClick"),false) }this.selectValuesRequest(e,c) }break; case"D":if(!b.isNullable){b.required=true }if(!b.dateFmt){b.dateFmt=Rico.dateFmt }if(!b.Help){b.Help=b.dateFmt }if(typeof b.min=="string"){b.min=Rico.setISO8601(b.min)||new Date(b.min) }if(typeof b.max=="string"){b.max=Rico.setISO8601(b.max)||new Date(b.max) }if(Rico.inputtypes.date){e=Rico.createFormField(f,"input","date",a,a); e.required=b.required; if(b.min){e.min=Rico.toISO8601String(b.min,3) }if(b.max){e.max=Rico.toISO8601String(b.max,3) }e.required=b.required; b.SelectCtl=null }else{e=Rico.createFormField(f,"input","text",a,a) }this.initField(e,b); break; case"I":if(!b.isNullable){b.required=true }if(!b.pattern){b.pattern="int-signed" }if(Rico.inputtypes.number){e=Rico.createFormField(f,"input","number",a,a); e.required=b.required; e.min=b.min; e.max=b.max; e.step=1 }else{e=Rico.createFormField(f,"input","text",a,a) }if(typeof b.min=="string"){b.min=parseInt(b.min,10) }if(typeof b.max=="string"){b.max=parseInt(b.max,10) }this.initField(e,b); break; case"F":if(!b.isNullable){b.required=true }if(!b.pattern){b.pattern="float-signed" }e=Rico.createFormField(f,"input","text",a,a); this.initField(e,b); if(typeof b.min=="string"){b.min=parseFloat(b.min) }if(typeof b.max=="string"){b.max=parseFloat(b.max) }break; default:e=Rico.createFormField(f,"input","text",a,a); if(!b.isNullable&&b.EntryType!="T"){b.required=true }this.initField(e,b); break }if(e&&b.SelectCtl){Rico.EditControls.applyTo(c,e) }var g=""; h.className="ricoEditLabel"; if(b.Help){h.title=b.Help; g=" " }var d=b.EntryType.length>1&&b.EntryType.charAt(1)=="L"?c.next.displayName:c.displayName; h.innerHTML=d+g },addSelectNone:function(a){this.addSelectOption(a,this.options.TableSelectNone,Rico.getPhraseById("selectNone")) },initField:function(b,a){if(a.Length){b.maxLength=a.Length; b.size=Math.min(a.Length,this.options.maxDisplayLen) }b.value=a.ColData },selectClick:function(c){var b=Rico.eventElement(c); if(b.readOnly){Rico.eventStop(c); return false }if(b.RicoUpdate){var a=b.options[b.selectedIndex]; Rico.$(b.RicoUpdate).value=a.innerHTML }},radioClick:function(c){var b=Rico.eventElement(c); if(b.readOnly){Rico.eventStop(c); return false }var a=Rico.getParentByTagName(b,"div"); if(a.RicoUpdate){Rico.$(a.RicoUpdate).value=b.nextSibling.innerHTML }},checkSelectNew:function(a){this.updateSelectNew(Rico.eventElement(a)) },updateSelectNew:function(b){var a=(b.value==this.options.TableSelectNew)?"":"hidden"; Rico.$("labelnew__"+b.id).style.visibility=a; Rico.$("textnew__"+b.id).style.visibility=a },selectValuesRequest:function(g,f){var a=f.format; if(a.SelectValues){var b=a.SelectValues.split(","); for(var e=0; e0){var g=Rico.getContentAsString(j[0],this.grid.buffer.isEncoded); Rico.log("Data provider returned an error:\n"+g); alert(Rico.getPhraseById("requestError",g)); return }b=b.getElementsByTagName("response")[0]; var h=b.getElementsByTagName("rows")[0]; var k=this.grid.buffer.dom2jstable(h); Rico.log("selectValuesUpdate: id="+a.id+" rows="+k.length); for(var e=0; e0){var f=k[e][0]; var d=(k[e].length>1)?k[e][1]:f; this.addSelectOption(a,f,d,e) }}if(Rico.$("textnew__"+a.id)){this.addSelectOption(a,this.options.TableSelectNew,Rico.getPhraseById("selectNewVal")) }if(this.panelGroup){Rico.runLater(50,this,"initPanelGroup") }},addSelectOption:function(c,e,f,a){switch(c.tagName.toLowerCase()){case"div":var b=Rico.createFormField(c,"input",Rico.hasClass(c,"MultiSelect")?"checkbox":"radio",c.id+"_"+a,c.id); b.value=e; var d=document.createElement("label"); d.innerHTML=f; d.htmlFor=b.id; c.appendChild(d); Rico.eventBind(b,"click",Rico.eventHandle(this,"radioClick"),false); break; case"select":Rico.addSelectOption(c,e,f); break }},clearSaveMsg:function(){if(this.saveMsg){this.saveMsg.innerHTML="" }},addMenuItem:function(c,b,a){this.extraMenuItems.push({menuText:c,menuAction:b,enabled:a}) },editMenu:function(d,h,j,e){this.clearSaveMsg(); if(this.grid.buffer.sessionExpired==true||this.grid.buffer.startPos<0){return false }this.rowIdx=h; var g=Rico.$("pageTitle"); var f=g?g.innerHTML:document.title; this.menu.addMenuHeading(f); var a=this; if(e==false){for(var b=0; b=0; a--){if(b[a].nodeType==1&&b[a].nodeName!="P"&&b[a].nodeName!="DIV"&&b[a].nodeName!="BR"){this.responseDiv.removeChild(b[a]) }}d=Rico.stripTags(this.responseDiv.innerHTML); f=(d.toLowerCase().indexOf("error")==-1) }if(f&&this.options.showSaveMsg!="full"){this.hideResponse(""); this.grid.resetContents(); this.grid.buffer.foundRowCount=false; this.grid.buffer.fetch(this.grid.lastRowPos||0); if(this.saveMsg){this.saveMsg.innerHTML=" "+d+" " }}this.processCallback(this.options.onSubmitResponse); Rico.log("Processing response completed") },processCallback:function(callback){switch(typeof callback){case"string":return eval(callback); case"function":return callback() }},ackResponse:function(a){this.hideResponse(""); this.grid.highlightEnabled=true },cloneRecord:function(){this.formPopup.setTitle(this.cloneText); this.displayEditForm("ins") },editRecord:function(){this.formPopup.setTitle(this.editText); this.displayEditForm("upd") },displayEditForm:function(e){this.grid.highlightEnabled=false; this.menu.cancelmenu(); this.hideResponse(Rico.getPhraseById("saving")); this.grid.outerDiv.style.cursor="auto"; this.action.value=e; for(var d=0; d1&&f.format.EntryType.charAt(1)=="L"){b=this.grid.columns[d+1].getValue(this.rowIdx) }b=f._format(b); if(b===""){b=" " }f.format.selectDesc.innerHTML=b }if(f.format.SelectCtl){Rico.EditControls.displayClrImg(f,!f.format.InsertOnly) }}}this.setReadOnly(e); for(var a=0; ad?(d-c)+"px":(h.left+1)+"px"; var g=Rico.docScrollTop(); var a=this.formPopup.container.offsetHeight; var f=h.top+this.grid.hdrHt+g; var b=Rico.windowHeight()+g; if(k>=0){f+=(k+1)*this.grid.rowHeight; if(f+a>b){f-=(a+this.grid.rowHeight) }}else{if(f+a>b){f=b-a-2 }}if(this.processCallback(this.options.formOpen)===false){return }this.formPopup.openPopup(null,Math.max(f,g)); this.formPopup.container.style.visibility="visible"; Rico.EditControls.setZ(Rico.getStyle(this.formPopup.container,"zIndex")); if(this.initialized){return }var e,j; for(e=0; e1&&a.EntryType.charAt(1)=="L"){c++ }var e=Rico.stripTags(this.grid.cell(rowIdx,c).innerHTML).replace(/ /g," "); if(f){f+=", " }f+=this.grid.columns[c].displayName+" "+e }break; default:f='"'+Rico.truncate(this.getConfirmDesc(this.rowIdx),50)+'"'; break }if(!this.options.ConfirmDelete.valueOf||confirm(Rico.getPhraseById("confirmDelete",f))){this.hideResponse(Rico.getPhraseById("deleting")); this.showResponse(); var d={}; d[this.grid.actionId]="del"; for(var b=0; b31){return NaN }var f=parseInt(i[dateParts.mm],10)-1; if(f>11){return NaN }var h=parseInt(i[dateParts.yyyy],10); if(h<100){h+=b-(b%100) }g.setFullYear(h,f,a); return g },TESubmit:function(j){var g,h,k,l,f,d,c=[]; Rico.eventStop(j); Rico.log("Event: TESubmit called to validate input"); for(g=0; g0&&l.regexp&&!l.regexp.test(f.value)){return this.validationMsg(f,g,"formInvalidFmt") }switch(l.EntryType.charAt(0)){case"I":d=parseInt(f.value,10); break; case"F":d=parseFloat(f.value); break; case"D":d=this.parseDate(f.value,l.dateFmt); if(isNaN(d)){return this.validationMsg(f,g,"formInvalidFmt") }c.push({e:f,v:d}); break; default:d=NaN; break }if(typeof l.min!="undefined"&&!isNaN(d)&&dl.max){return this.validationMsg(f,g,"formOutOfRange") }}if(this.processCallback(this.options.formSubmit)===false){return false }for(g=0; g