3 Rico.onLoadCallbacks=[];
4 Rico.windowIsLoaded=false;
5 Rico.inputtypes={search:0,number:0,range:0,color:0,tel:0,url:0,email:0,date:0,month:0,week:0,time:0,datetime:0,"datetime-local":0};
6 Rico.windowLoaded=function(){this.windowIsLoaded=true;
7 if(typeof Rico_CONFIG=="object"){if(Rico_CONFIG.enableLogging){this.enableLogging()
8 }if(Rico_CONFIG.enableHTML5){this._CheckInputTypes()
9 }}Rico.writeDebugMsg=Rico.log;
10 Rico.log("Processing callbacks");
11 while(this.onLoadCallbacks.length>0){var a=this.onLoadCallbacks.shift();
14 Rico._CheckInputTypes=function(){var a=document.createElement("input");
15 for(var b in this.inputtypes){a.setAttribute("type","text");
16 a.setAttribute("type",b);
17 this.inputtypes[b]=(a.type!=="text")
19 Rico.onLoad=function(b,a){if(this.windowIsLoaded){b()
20 }else{if(a){this.onLoadCallbacks.unshift(b)
21 }else{this.onLoadCallbacks.push(b)
23 Rico.isKonqueror=navigator.userAgent.toLowerCase().indexOf("konqueror")>-1;
24 Rico.isIE=!!(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1);
25 Rico.isOpera=navigator.userAgent.indexOf("Opera")>-1;
26 Rico.isWebKit=navigator.userAgent.indexOf("AppleWebKit/")>-1;
27 Rico.isGecko=navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")===-1;
28 Rico.ieVersion=/MSIE (\d+\.\d+);/.test(navigator.userAgent)?new Number(RegExp.$1):null;
29 Rico.startTime=new Date();
30 Rico.timeStamp=function(){var a=new Date();
31 return(a.getTime()-this.startTime.getTime())+": "
33 Rico.setDebugArea=function(c,a){if(!this.debugArea||a){var b=document.getElementById(c);
38 Rico.log=function(){};
39 Rico.enableLogging=function(){if(this.debugArea){this.log=function(b,a){if(a){this.debugArea.value=""
40 }this.debugArea.value+=this.timeStamp()+b+"\n"
42 }else{if(window.console){if(window.console.firebug){this.log=function(a){window.console.log(this.timeStamp(),a)
44 }else{this.log=function(a){window.console.log(this.timeStamp()+a)
46 }}else{if(window.opera){this.log=function(a){window.opera.postError(this.timeStamp()+a)
49 Rico.$=function(a){return typeof a=="string"?document.getElementById(a):a
51 Rico.runLater=function(){var b=Array.prototype.slice.call(arguments);
55 return setTimeout(function(){a[d].apply(a,b)
58 Rico.visible=function(a){return Rico.getStyle(a,"display")!="none"
60 Rico.show=function(a){a.style.display=""
62 Rico.hide=function(a){a.style.display="none"
64 Rico.toggle=function(a){a.style.display=a.style.display=="none"?"":"none"
66 Rico.direction=function(a){return(Rico.getStyle(a,"direction")||"ltr").toLowerCase()
68 Rico.viewportOffset=function(a){var b=Rico.cumulativeOffset(a);
69 b.left-=this.docScrollLeft();
70 b.top-=this.docScrollTop();
73 Rico.getInnerText=function(f,b,g,e){switch(typeof f){case"string":return f;
74 case"undefined":return f;
75 case"number":return f.toString()
81 c++){switch(d[c].nodeType){case 1:if(this.getStyle(d[c],"display")=="none"){continue
82 }if(e&&this.hasClass(d[c],e)){continue
83 }switch(d[c].tagName.toLowerCase()){case"img":if(!b){h+=d[c].alt||d[c].title||d[c].src
85 case"input":if(!g&&!d[c].disabled&&d[c].type.toLowerCase()=="text"){h+=d[c].value
87 case"select":if(!g&&d[c].selectedIndex>=0){h+=d[c].options[d[c].selectedIndex].text
89 case"textarea":if(!g&&!d[c].disabled){h+=d[c].value
91 default:h+=this.getInnerText(d[c],b,g,e);
94 case 3:h+=d[c].nodeValue;
98 Rico.getContentAsString=function(a,b){if(b){return this._getEncodedContent(a)
99 }if(typeof a.xml!="undefined"){return this._getContentAsStringIE(a)
100 }return this._getContentAsStringMozilla(a)
102 Rico._getEncodedContent=function(a){if(a.innerHTML){return a.innerHTML
103 }switch(a.childNodes.length){case 0:return"";
104 case 1:return a.firstChild.nodeValue;
105 default:return a.childNodes[1].nodeValue
107 Rico._getContentAsStringIE=function(a){var c="";
109 b<a.childNodes.length;
110 b++){var d=a.childNodes[b];
111 c+=(d.nodeType==4)?d.nodeValue:d.xml
114 Rico._getContentAsStringMozilla=function(b){var a=new XMLSerializer();
117 c<b.childNodes.length;
118 c++){var e=b.childNodes[c];
119 if(e.nodeType==4){d+=e.nodeValue
120 }else{d+=a.serializeToString(e)
123 Rico.nan2zero=function(a){if(typeof(a)=="string"){a=parseInt(a,10)
124 }return isNaN(a)||typeof(a)=="undefined"?0:a
126 Rico.stripTags=function(a){return a.replace(/<\/?[^>]+>/gi,"")
128 Rico.truncate=function(a,b){return a.length>b?a.substr(0,b-3)+"...":a
130 Rico.zFill=function(d,c,b){var a=d.toString(b||10);
131 while(a.length<c){a="0"+a
134 Rico.keys=function(c){var b=[];
135 for(var a in c){b.push[a]
138 Rico.eventKey=function(a){if(typeof(a.keyCode)=="number"){return a.keyCode
139 }else{if(typeof(a.which)=="number"){return a.which
140 }else{if(typeof(a.charCode)=="number"){return a.charCode
143 Rico.eventLeftClick=function(a){return(((a.which)&&(a.which==1))||((a.button)&&(a.button==1)))
145 Rico.eventRelatedTarget=function(a){return a.relatedTarget
147 Rico.getPreviosSiblingByTagName=function(c,b){var a=c.previousSibling;
148 while(a){if((a.tagName==b)&&(a.style.display!="none")){return a
152 Rico.getParentByTagName=function(d,a,c){var b=d;
154 while(b){if(b.tagName&&b.tagName.toLowerCase()==a){if(!c||b.className.indexOf(c)>=0){return b
158 Rico.wrapChildren=function(b,a,e,c){var d=document.createElement(c||"div");
161 }while(b.firstChild){d.appendChild(b.firstChild)
165 Rico.positionCtlOverIcon=function(f,j){j=this.$(j);
166 var b=this.cumulativeOffset(j);
167 var i=this.docScrollTop();
168 var a=this.windowHeight();
169 if(f.style.display=="none"){f.style.display="block"
171 if(Rico.direction(j)=="rtl"){f.style.left=(b.left+j.offsetWidth-f.offsetWidth)+"px"
172 }else{var d=this.nan2zero(this.getStyle(j,"marginLeft"));
173 f.style.left=(b.left+d+g)+"px"
175 var e=f.offsetHeight;
176 var c=j.offsetHeight;
179 }else{h=Math.max(h-e,i)
182 Rico.createFormField=function(d,b,f,g,a){var e;
183 if(typeof a!="string"){a=g
184 }if(this.isIE&&this.ieVersion<8){var c=b+' id="'+g+'"';
185 if(f){c+=' type="'+f+'"'
186 }if(b.match(/^(form|input|select|textarea|object|button|img)$/)){c+=' name="'+a+'"'
187 }e=document.createElement("<"+c+" />")
188 }else{e=document.createElement(b);
191 if(typeof e.name=="string"){e.name=a
195 Rico.addSelectOption=function(b,c,d){var a=document.createElement("option");
196 if(typeof c=="string"){a.value=c
198 if(this.isIE){b.add(a)
202 Rico.getCookie=function(g){var b=g+"=";
204 var a=document.cookie.length;
206 while(d<a){var c=d+f;
207 if(document.cookie.substring(d,c)==b){var e=document.cookie.indexOf(";",c);
208 if(e==-1){e=document.cookie.length
209 }return unescape(document.cookie.substring(c,e))
210 }d=document.cookie.indexOf(" ",d)+1;
214 Rico.getTBody=function(a){return a.tBodies.length==0?a.appendChild(document.createElement("tbody")):a.tBodies[0]
216 Rico.setCookie=function(e,g,f,d,a){var h=e+"="+escape(g);
217 if(typeof(f)=="number"){var b=new Date();
218 b.setTime(b.getTime()+(f*24*60*60*1000));
219 h+="; expires="+b.toGMTString()
220 }if(typeof(d)=="string"){h+="; path="+d
221 }if(typeof(a)=="string"){h+="; domain="+a
228 Rico.dateFmt="mm/dd/yyyy";
229 Rico.timeFmt="hh:nn:ss a/pm";
230 Rico.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];
231 Rico.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
232 Rico.monthAbbr=function(a){return this.monthNamesShort?this.monthNamesShort[a]:this.monthNames[a].substr(0,3)
234 Rico.dayAbbr=function(a){return this.dayNamesShort?this.dayNamesShort[a]:this.dayNames[a].substr(0,3)
236 Rico.addPhraseId=function(b,a){this.phrasesById[b]=a
238 Rico.getPhraseById=function(d){var b=this.phrasesById[d];
239 if(!b){alert("Error: missing phrase for "+d);
241 }if(arguments.length<=1){return b
243 return b.replace(/(\$\d)/g,function(e){var a=parseInt(e.charAt(1),10);
244 return(a<c.length)?c[a]:""
247 Rico.formatPosNumber=function(e,f,c){var b=e.toFixed(f).split(/\./);
248 if(c){var d=/(\d+)(\d{3})/;
249 while(d.test(b[0])){b[0]=b[0].replace(d,"$1"+Rico.thouSep+"$2")
250 }}return b.join(Rico.decPoint)
252 Rico.formatNumber=function(b,c){if(typeof b=="string"){b=parseFloat(b.replace(/,/,"."),10)
253 }if(isNaN(b)){return"NaN"
254 }if(typeof c.multiplier=="number"){b*=c.multiplier
255 }var h=typeof c.decPlaces=="number"?c.decPlaces:0;
256 var e=typeof c.thouSep=="undefined"?true:this.thouSep;
259 var a=typeof c.negSign=="string"?c.negSign:"L";
262 if(b<0){i=this.formatPosNumber(-b,h,e);
263 if(a=="P"){i="("+i+")"
268 }else{g=b==0?"zeroNumber":"posNumber";
269 i=d+this.formatPosNumber(b,h,e)
270 }return"<span class='"+g+"'>"+i+f+"</span>"
272 Rico.formatDate=function(c,a){var b=(typeof a=="string")?a:"translateDate";
273 switch(b){case"locale":case"localeDateTime":return c.toLocaleString();
274 case"localeDate":return c.toLocaleDateString();
275 case"translate":case"translateDateTime":b=this.dateFmt+" "+this.timeFmt;
277 case"translateDate":b=this.dateFmt;
279 }return b.replace(/(yyyy|yy|mmmm|mmm|mm|dddd|ddd|dd|d|hh|nn|ss|a\/p)/gi,function(d){var e;
280 switch(d){case"yyyy":return c.getFullYear();
281 case"yy":return c.getFullYear().toString().substr(2);
282 case"mmmm":return Rico.monthNames[c.getMonth()];
283 case"mmm":return Rico.monthAbbr(c.getMonth());
284 case"mm":return Rico.zFill(c.getMonth()+1,2);
285 case"m":return(c.getMonth()+1);
286 case"dddd":return Rico.dayNames[c.getDay()];
287 case"ddd":return Rico.dayAbbr(c.getDay());
288 case"dd":return Rico.zFill(c.getDate(),2);
289 case"d":return c.getDate();
290 case"hh":return Rico.zFill((e=c.getHours()%12)?e:12,2);
291 case"h":return((e=c.getHours()%12)?e:12);
292 case"HH":return Rico.zFill(c.getHours(),2);
293 case"H":return c.getHours();
294 case"nn":return Rico.zFill(c.getMinutes(),2);
295 case"ss":return Rico.zFill(c.getSeconds(),2);
296 case"a/p":return c.getHours()<12?"a":"p"
299 Rico.setISO8601=function(b,f){if(!b){return false
300 }var e=b.match(/(\d\d\d\d)(?:-?(\d\d)(?:-?(\d\d)(?:[T ](\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|(?:([-+])(\d\d)(?::?(\d\d))?)?)?)?)?)?/);
303 }var a=new Date(e[1],0,1);
304 if(e[2]){a.setMonth(e[2]-1)
305 }if(e[3]){a.setDate(e[3])
306 }if(e[4]){a.setHours(e[4])
307 }if(e[5]){a.setMinutes(e[5])
308 }if(e[6]){a.setSeconds(e[6])
309 }if(e[7]){a.setMilliseconds(Number("0."+e[7])*1000)
310 }if(e[8]){if(e[10]&&e[11]){f=(Number(e[10])*60)+Number(e[11])
311 }f*=((e[9]=="-")?1:-1);
312 f-=a.getTimezoneOffset()
313 }var c=(Number(a)+(f*60*1000));
314 a.setTime(Number(c));
317 Rico.toISO8601String=function(a,e,h){if(!e){e=6
319 }else{var g=h.match(/([-+])([0-9]{2}):([0-9]{2})/);
320 var c=(Number(g[2])*60)+Number(g[3]);
321 c*=((g[1]=="-")?-1:1);
322 a=new Date(Number(Number(a)+(c*60000)))
323 }var i=function(d){return((d<10)?"0":"")+d
325 var f=a.getUTCFullYear();
326 if(e>1){f+="-"+i(a.getUTCMonth()+1)
327 }if(e>2){f+="-"+i(a.getUTCDate())
328 }if(e>3){f+="T"+i(a.getUTCHours())+":"+i(a.getUTCMinutes())
329 }if(e>5){var b=Number(a.getUTCSeconds()+"."+((a.getUTCMilliseconds()<100)?"0":"")+i(a.getUTCMilliseconds()));
331 }else{if(e>4){f+=":"+i(a.getUTCSeconds())
335 Rico.createXmlDocument=function(){if(document.implementation&&document.implementation.createDocument){var a=document.implementation.createDocument("","",null);
336 if(a.readyState==null){a.readyState=1;
337 a.addEventListener("load",function(){a.readyState=4;
338 if(typeof a.onreadystatechange=="function"){a.onreadystatechange()
341 }if(window.ActiveXObject){return Rico.tryFunctions(function(){return new ActiveXObject("MSXML2.DomDocument")
342 },function(){return new ActiveXObject("Microsoft.DomDocument")
343 },function(){return new ActiveXObject("MSXML.DomDocument")
344 },function(){return new ActiveXObject("MSXML3.DomDocument")
348 Rico.ajaxUpdater=function(c,b,a){this.updateSend(c,b,a)
350 Rico.ajaxUpdater.prototype={updateSend:function(d,c,b){this.element=d;
351 this.onComplete=b.onComplete;
353 b.onComplete=function(e){a.updateComplete(e)
355 new Rico.ajaxRequest(c,b)
356 },updateComplete:function(a){this.element.innerHTML=a.responseText;
357 if(this.onComplete){this.onComplete(a)
359 try{document.execCommand("BackgroundImageCache",false,true)
360 }catch(err){}Rico.eventBind(window,"load",Rico.eventHandle(Rico,"windowLoaded"));
361 Rico.applyShadow=function(b,a){if(typeof a=="undefined"){a=true
362 }if(a){Rico.addClass(b,"ricoShadow")
365 Rico._OpenPopupList=[];
366 Rico._RemoveOpenPopup=function(a){if(a.openIndex>=0&&a.openIndex<Rico._OpenPopupList.length){Rico._OpenPopupList.splice(a.openIndex,1)
369 Rico._AddOpenPopup=function(a){a.openIndex=Rico._OpenPopupList.push(a)-1
371 Rico._checkEscKey=function(b){if(Rico.eventKey(b)!=27){return true
372 }while(Rico._OpenPopupList.length>0){var a=Rico._OpenPopupList.pop();
373 if(a&&a.visible()){a.openIndex=-1;
379 Rico.eventBind(document,"keyup",Rico.eventHandle(Rico,"_checkEscKey"));
380 Rico.Popup=function(b,a){this.initialize(b,a)
382 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};
384 if(b){this.setDiv(b,a)
385 }},createContainer:function(a){this.setDiv(document.createElement("div"),a);
386 if(a&&a.parent){a.parent.appendChild(this.container)
387 }else{document.getElementsByTagName("body")[0].appendChild(this.container)
388 }},setDiv:function(c,b){Rico.extend(this.options,b||{});
389 this.container=Rico.$(c);
390 if(this.options.position=="auto"){this.position=Rico.getStyle(this.container,"position").toLowerCase()
391 }else{this.position=this.container.style.position=this.options.position
392 }this.content=document.createElement("div");
393 while(this.container.firstChild){this.content.appendChild(this.container.firstChild)
394 }this.container.appendChild(this.content);
395 this.content.className="RicoPopupContent";
396 if(this.position!="absolute"){return
397 }if(this.options.closeFunc){this.closeFunc=this.options.closeFunc
399 this.closeFunc=function(){a.closePopup()
401 }this.container.style.top="0px";
402 this.container.style.left="0px";
403 this.container.style.display="none";
404 if(this.options.zIndex>=0){this.container.style.zIndex=this.options.zIndex
405 }if(Rico.isIE&&Rico.ieVersion<7&&this.options.shim!==false){this.content.style.position="relative";
406 this.content.style.zIndex=2;
407 this.ifr=document.createElement("iframe");
408 this.ifr.className="RicoShim";
409 this.ifr.frameBorder=0;
410 this.ifr.src="javascript:'';";
411 this.container.appendChild(this.ifr)
412 }Rico.applyShadow(this.container,this.options.shadow);
413 if(this.options.hideOnClick){Rico.eventBind(document,"click",Rico.eventHandle(this,"_docClick"))
414 }this.dragEnabled=false;
415 this.mousedownHandler=Rico.eventHandle(this,"_startDrag");
416 this.dragHandler=Rico.eventHandle(this,"_drag");
417 this.dropHandler=Rico.eventHandle(this,"_endDrag");
418 if(this.options.canDrag){this.enableDragging()
419 }if(this.options.ignoreClicks||this.options.canDrag){this.ignoreClicks()
420 }},clearContent:function(){this.content.innerHTML=""
421 },setContent:function(a){this.content.innerHTML=a
422 },enableDragging:function(){if(!this.dragEnabled&&this.options.dragElement){Rico.eventBind(this.options.dragElement,"mousedown",this.mousedownHandler);
423 this.dragEnabled=true
424 }return this.dragEnabled
425 },disableDragging:function(){if(!this.dragEnabled){return
426 }Rico.eventUnbind(this.options.dragElement,"mousedown",this.mousedownHandler);
427 this.dragEnabled=false
428 },setZ:function(a){this.container.style.zIndex=a
429 },ignoreClicks:function(){Rico.eventBind(this.container,"click",Rico.eventHandle(this,"_ignoreClick"))
430 },_ignoreClick:function(a){if(a.stopPropagation){a.stopPropagation()
431 }else{a.cancelBubble=true
433 },_docClick:function(a){this.closeFunc();
435 },move:function(b,a){if(typeof b=="number"){this.container.style.left=b+"px"
436 }if(typeof a=="number"){this.container.style.top=a+"px"
437 }},_startDrag:function(b){var a=Rico.eventElement(b);
438 this.container.style.cursor="move";
439 this.lastMouse=Rico.eventClient(b);
440 Rico.eventBind(document,"mousemove",this.dragHandler);
441 Rico.eventBind(document,"mouseup",this.dropHandler);
443 },_drag:function(d){var b=Rico.eventClient(d);
444 var c=parseInt(this.container.style.left,10)+b.x-this.lastMouse.x;
445 var a=parseInt(this.container.style.top,10)+b.y-this.lastMouse.y;
449 },_endDrag:function(){this.container.style.cursor="";
450 Rico.eventUnbind(document,"mousemove",this.dragHandler);
451 Rico.eventUnbind(document,"mouseup",this.dropHandler)
452 },openPopup:function(b,a){this.move(b,a);
453 this.container.style.display="";
454 if(this.container.id){Rico.log("openPopup "+this.container.id+" at "+b+","+a)
455 }Rico._AddOpenPopup(this)
456 },centerPopup:function(){this.openPopup();
457 var d=this.container.offsetWidth;
458 var c=this.container.offsetHeight;
459 var a=this.container.parentNode.offsetWidth;
460 var b=this.container.parentNode.offsetHeight;
461 this.move(parseInt(Math.max((a-d)/2,0),10),parseInt(Math.max((b-c)/2,0),10))
462 },visible:function(){return Rico.visible(this.container)
463 },closePopup:function(){Rico._RemoveOpenPopup(this);
464 if(!Rico.visible(this.container)){return
465 }if(this.container.id){Rico.log("closePopup "+this.container.id)
466 }if(this.dragEnabled){this._endDrag()
467 }this.container.style.display="none";
468 if(this.options.onClose){this.options.onClose()
470 Rico.closeButton=function(d){var b=document.createElement("a");
471 b.className="RicoCloseAnchor";
472 if(Rico.theme.closeAnchor){Rico.addClass(b,Rico.theme.closeAnchor)
473 }var c=b.appendChild(document.createElement("span"));
474 c.title=Rico.getPhraseById("close");
475 new Rico.HoverSet([b],{hoverClass:Rico.theme.hover||"ricoCloseHover"});
476 Rico.addClass(c,Rico.theme.close||"rico-icon RicoClose");
477 Rico.eventBind(b,"click",d);
480 Rico.floatButton=function(b,e,f){var c=document.createElement("a");
481 c.className="RicoButtonAnchor";
482 Rico.addClass(c,Rico.theme.buttonAnchor||"RicoButtonAnchorNative");
483 var d=c.appendChild(document.createElement("span"));
485 }d.className=Rico.theme[b.toLowerCase()]||"rico-icon Rico"+b;
486 Rico.eventBind(c,"click",e,false);
487 new Rico.HoverSet([c]);
490 Rico.clearButton=function(b){var a=document.createElement("span");
491 a.title=Rico.getPhraseById("clear");
492 a.className="ricoClear";
493 Rico.addClass(a,Rico.theme.clear||"rico-icon ricoClearNative");
494 Rico.eventBind(a,"click",b);
497 Rico.Window=function(c,a,b){this.initialize(c,a,b)
499 Rico.Window.prototype={initialize:function(c,a,b){a=a||{overflow:"auto"};
500 Rico.extend(this,new Rico.Popup());
501 this.titleDiv=document.createElement("div");
502 this.options.canDrag=true;
503 this.options.dragElement=this.titleDiv;
504 this.createContainer(a);
505 this.content.appendChild(this.titleDiv);
507 if(b){this.contentDiv=b;
508 b.parentNode.insertBefore(this.container,b)
509 }else{this.contentDiv=document.createElement("div")
510 }this.content.appendChild(this.contentDiv);
511 this.titleDiv.className="ricoTitle";
512 if(Rico.theme.dialogTitle){Rico.addClass(this.titleDiv,Rico.theme.dialogTitle)
513 }this.titleDiv.style.position="relative";
514 this.titleContent=document.createElement("span");
515 this.titleContent.className="ricoTitleSpan";
516 this.titleDiv.appendChild(this.titleContent);
517 this.titleDiv.appendChild(Rico.closeButton(Rico.eventHandle(this,"closeFunc")));
520 }this.setTitle(c||" ");
521 this.contentDiv.className="ricoContent";
522 if(Rico.theme.dialogContent){Rico.addClass(this.contentDiv,Rico.theme.dialogContent)
523 }this.contentDiv.style.position="relative";
524 if(a.height){this.contentDiv.style.height=a.height
525 }if(a.width){this.contentDiv.style.width=a.width
526 }if(a.overflow){this.contentDiv.style.overflow=a.overflow
527 }Rico.addClass(this.container,"ricoWindow");
528 if(Rico.theme.dialog){Rico.addClass(this.container,Rico.theme.dialog)
529 }this.content=this.contentDiv
530 },setTitle:function(a){this.titleContent.innerHTML=a
532 Rico.Menu=function(a){this.initialize(a)
534 Rico.Menu.prototype={initialize:function(a){Rico.extend(this,new Rico.Popup());
535 Rico.extend(this.options,{width:"15em",arrowColor:"b",showDisabled:false,hideOnClick:true});
536 if(typeof a=="string"){this.options.width=a
537 }else{Rico.extend(this.options,a||{})
539 this.highlightElem=null
540 },createDiv:function(a){if(this.container){return
542 var c={closeFunc:function(){b.cancelmenu()
545 }this.createContainer(c);
546 this.content.className=Rico.isWebKit?"ricoMenuSafari":"ricoMenu";
547 this.content.style.width=this.options.width;
548 this.direction=Rico.direction(this.container);
551 },showmenu:function(b,c){Rico.eventStop(b);
553 if(this.content.childNodes.length==0){this.cancelmenu();
555 }var a=Rico.eventClient(b);
556 this.openmenu(a.x,a.y,0,0)
557 },openmenu:function(g,f,j,e,a){var h=g+(a?0:Rico.docScrollLeft());
558 this.container.style.visibility="hidden";
559 this.container.style.display="block";
560 var i=this.container.offsetWidth;
561 var b=this.content.offsetWidth;
562 if(this.direction=="rtl"){if(h>i+j){h-=b+j
563 }}else{if(g+i>Rico.windowWidth()){h-=b+j-2
564 }}var d=Rico.docScrollTop();
566 if(f+this.container.offsetHeight-d>Rico.windowHeight()){c=Math.max(c-this.content.offsetHeight+e,0)
567 }this.openPopup(h,c);
568 this.container.style.visibility="visible";
570 },clearMenu:function(){this.clearContent();
571 this.defaultAction=null;
573 },addMenuHeading:function(b){var a=document.createElement("div");
575 a.className="ricoMenuHeading";
576 this.content.appendChild(a)
577 },addMenuBreak:function(){var a=document.createElement("div");
578 a.className="ricoMenuBreak";
579 this.content.appendChild(a)
580 },addSubMenuItem:function(b,e,g){var d=this.direction=="rtl"?"left":"right";
581 var c=this.addMenuItem(b,null,true,null,g);
582 c.className="ricoSubMenu";
583 var f=c.appendChild(document.createElement("div"));
584 f.className="rico-icon rico-"+d+"-"+this.options.arrowColor;
585 Rico.setStyle(f,{position:"absolute",top:"2px"});
588 Rico.eventBind(c,"mouseover",Rico.eventHandle(this,"showSubMenu"))
589 },showSubMenu:function(c){if(this.openSubMenu){this.hideSubMenu()
590 }var b=Rico.eventElement(c);
591 if(!b.RicoSubmenu){b=b.parentNode
592 }if(!b.RicoSubmenu){return
593 }this.openSubMenu=b.RicoSubmenu;
594 this.openMenuAnchor=b;
595 if(Rico.hasClass(b,"ricoSubMenu")){Rico.removeClass(b,"ricoSubMenu");
596 Rico.addClass(b,"ricoSubMenuOpen")
597 }b.RicoSubmenu.openmenu(parseInt(this.container.style.left)+b.offsetWidth,parseInt(this.container.style.top)+b.offsetTop,b.offsetWidth-2,b.offsetHeight+2,true)
598 },hideSubMenu:function(){if(this.openMenuAnchor){Rico.removeClass(this.openMenuAnchor,"ricoSubMenuOpen");
599 Rico.addClass(this.openMenuAnchor,"ricoSubMenu");
600 this.openMenuAnchor=null
601 }if(this.openSubMenu){this.openSubMenu.hidemenu();
602 this.openSubMenu=null
603 }},addMenuItemId:function(c,b,a,e,d){if(arguments.length<3){a=true
604 }this.addMenuItem(Rico.getPhraseById(c),b,a,e,d)
605 },addMenuItem:function(b,e,d,g,f){if(arguments.length>=3&&!d&&!this.options.showDisabled){return null
607 var c=document.createElement(typeof e=="string"?"a":"div");
608 if(arguments.length<3||d){if(typeof e=="string"){c.href=e;
610 }}else{if(f=="event"){Rico.eventBind(c,"click",e)
612 }}c.className="enabled";
613 if(this.defaultAction==null){this.defaultAction=e
614 }}else{c.disabled=true;
615 c.className="disabled"
617 if(typeof g=="string"){c.title=g
618 }c=this.content.appendChild(c);
619 Rico.eventBind(c,"mouseover",Rico.eventHandle(this,"mouseOver"));
620 Rico.eventBind(c,"mouseout",Rico.eventHandle(this,"mouseOut"));
622 },mouseOver:function(b){if(this.highlightElem&&this.highlightElem.className=="enabled-hover"){this.highlightElem.className="enabled";
623 this.highlightElem=null
624 }var a=Rico.eventElement(b);
625 if(a.parentNode==this.openMenuAnchor){a=a.parentNode
626 }if(this.openMenuAnchor&&this.openMenuAnchor!=a){this.hideSubMenu()
627 }if(a.className=="enabled"){a.className="enabled-hover";
629 }},mouseOut:function(b){var a=Rico.eventElement(b);
630 if(a.className=="enabled-hover"){a.className="enabled"
631 }if(this.highlightElem==a){this.highlightElem=null
632 }},cancelmenu:function(){if(!this.visible()){return
633 }if(this.hideFunc){this.hideFunc()
636 },hidemenu:function(){if(this.openSubMenu){this.openSubMenu.hidemenu()
639 Rico.SelectionSet=function(b,a){this.initialize(b,a)
641 Rico.SelectionSet.prototype={initialize:function(e,b){Rico.log("SelectionSet#initialize");
643 if(typeof e=="string"){e=Rico.select(e)
644 }this.previouslySelected=[];
645 this.selectionSet=[];
646 this.selectedClassName=this.options.selectedClass||Rico.theme.selected||"selected";
647 this.selectNode=this.options.selectNode||function(f){return f
649 this.onSelect=this.options.onSelect;
650 this.onFirstSelect=this.options.onFirstSelect;
652 this.clickHandler=function(f){a.selectIndex(f)
654 this.selectedIndex=-1;
658 }if(!this.options.noDefault){var d=this.options.cookieName?this.getCookie():0;
659 this.selectIndex(d||this.options.selectedIndex||0)
660 }},getCookie:function(){var b=Rico.getCookie(this.options.cookieName);
663 return a<this.selectionSet.length?a:0
664 },reset:function(){this.previouslySelected=[];
665 this._notifySelected(this.selectedIndex)
666 },clearSelected:function(){if(this.selected){Rico.removeClass(this.selectNode(this.selected),this.selectedClassName)
667 }},getIndex:function(b){for(var a=0;
668 a<this.selectionSet.length;
669 a++){if(b==this.selectionSet[a]){return a
671 },select:function(b){if(this.selected==b){return
672 }var a=this.getIndex(b);
673 if(a>=0){this.selectIndex(a)
674 }},_notifySelected:function(a){if(a<0){return
675 }var b=this.selectionSet[a];
676 if(this.options.cookieName){Rico.setCookie(this.options.cookieName,a,this.options.cookieDays,this.options.cookiePath,this.options.cookieDomain)
677 }if(this.onFirstSelect&&!this.previouslySelected[a]){this.onFirstSelect(b,a);
678 this.previouslySelected[a]=true
679 }if(this.onSelect){try{this.onSelect(a)
680 }catch(c){}}},selectIndex:function(a){if(this.selectedIndex==a||a>=this.selectionSet.length){return
681 }this.clearSelected();
682 this._notifySelected(a);
683 this.selectedIndex=a;
684 this.selected=this.selectionSet[a].element;
685 Rico.addClass(this.selectNode(this.selected),this.selectedClassName)
686 },nextSelectIndex:function(){return(this.selectedIndex+1)%this.selectionSet.length
687 },nextSelectItem:function(){return this.selectionSet[this.nextSelectIndex()]
688 },selectNext:function(){this.selectIndex(this.nextSelectIndex())
689 },add:function(b){var a=this.selectionSet.length;
690 this.selectionSet[a]=new Rico._SelectionItem(b,a,this.clickHandler)
691 },remove:function(b){if(b==this.selected){this.clearSelected()
692 }var a=this.getIndex(b);
694 }this.selectionSet[a].remove();
695 this.selectionSet.splice(a,1)
696 },removeAll:function(){this.clearSelected();
697 while(this.selectionSet.length>0){this.selectionSet.pop().remove()
699 Rico._SelectionItem=function(b,a,c){this.add(b,a,c)
701 Rico._SelectionItem.prototype={add:function(b,a,c){this.element=b;
704 this.handle=Rico.eventHandle(this,"click");
705 Rico.eventBind(b,"click",this.handle)
706 },click:function(a){this.callback(this.index)
707 },remove:function(){Rico.eventUnbind(this.element,"click",this.handle)
709 Rico.HoverSet=function(b,a){this.initialize(b,a)
711 Rico.HoverSet.prototype={initialize:function(c,a){Rico.log("HoverSet#initialize");
713 this.hoverClass=a.hoverClass||Rico.theme.hover||"hover";
714 this.hoverFunc=a.hoverNodes||function(d){return[d]
721 }},add:function(a){this.hoverSet.push(new Rico._HoverItem(a,this.hoverFunc,this.hoverClass))
722 },removeAll:function(){while(this.hoverSet.length>0){this.hoverSet.pop().remove()
724 Rico._HoverItem=function(b,a,c){this.add(b,a,c)
726 Rico._HoverItem.prototype={add:function(b,a,c){this.element=b;
729 this.movehandle=Rico.eventHandle(this,"move");
730 this.outhandle=Rico.eventHandle(this,"mouseout");
731 Rico.eventBind(b,"mousemove",this.movehandle);
732 Rico.eventBind(b,"mouseout",this.outhandle)
733 },move:function(c){var a=this.selectFunc(this.element);
736 b++){Rico.addClass(a[b],this.hoverClass)
737 }},mouseout:function(c){var a=this.selectFunc(this.element);
740 b++){Rico.removeClass(a[b],this.hoverClass)
741 }},remove:function(){Rico.eventUnbind(element,"mousemove",this.movehandle);
742 Rico.eventUnbind(element,"mouseout",this.outhandle)
744 Rico.ContentTransitionBase=function(){};
745 Rico.ContentTransitionBase.prototype={initBase:function(e,d,b){this.options=b||{};
748 this.hoverSet=new Rico.HoverSet(e,b);
751 c++){if(d[c]){Rico.hide(d[c])
753 this.selectionSet=new Rico.SelectionSet(e,Rico.extend(b,{onSelect:function(f){a._finishSelect(f)
755 },reset:function(){this.selectionSet.reset()
756 },select:function(a){this.selectionSet.selectIndex(a)
757 },_finishSelect:function(b){Rico.log("ContentTransitionBase#_finishSelect");
758 var a=this.contents[b];
759 if(!a){alert("Internal error: no panel @index="+b);
761 }if(this.selected==a){return
762 }if(this.transition){if(this.selected){this.transition(a)
763 }else{a.style.display="block"
764 }}else{if(this.selected){Rico.hide(this.selected)
765 }a.style.display="block"
767 },addBase:function(b,a){this.titles.push(b);
768 this.contents.push(a);
769 this.hoverSet.add(b);
770 this.selectionSet.add(b);
772 },removeAll:function(){this.hoverSet.removeAll();
773 this.selectionSet.removeAll()
775 Rico.Accordion=function(b,a){this.initialize(b,a)
777 Rico.Accordion.prototype=Rico.extend(new Rico.ContentTransitionBase(),{initialize:function(g,e){g=Rico.$(g);
778 g.style.overflow="hidden";
779 g.className=e.accClass||Rico.theme.accordion||"Rico_accordion";
780 if(typeof e.panelWidth=="number"){e.panelWidth+="px"
781 }if(e.panelWidth){g.style.width=e.panelWidth
782 }var d=Rico.getDirectChildrenByTag(g,"div");
786 f++){c=Rico.getDirectChildrenByTag(d[f],"div");
787 if(c.length>=2){c[0].className=e.titleClass||Rico.theme.accTitle||"Rico_accTitle";
788 c[1].className=e.contentClass||Rico.theme.accContent||"Rico_accContent";
791 var b=Rico.wrapChildren(c[0],"","","a");
792 b.href="javascript:void(0)"
793 }}Rico.log("creating Rico.Accordion for "+g.id+" with "+j.length+" panels");
794 this.initBase(j,h,e);
795 this.selected.style.height=this.options.panelHeight+"px";
796 this.totSteps=(typeof e.duration=="number"?e.duration:200)/25
797 },transition:function(b){if(!this.options.noAnimate){this.closing=this.selected;
801 this.timer=setInterval(function(){a.step()
803 }else{b.style.height=this.options.panelHeight+"px";
804 if(this.selected){Rico.hide(this.selected)
805 }b.style.display="block"
806 }},step:function(){this.curStep++;
807 var a=Math.round(this.curStep/this.totSteps*this.options.panelHeight);
808 this.opening.style.height=a+"px";
809 this.closing.style.height=(this.options.panelHeight-a)+"px";
810 if(this.curStep==1){this.opening.style.paddingTop=this.opening.style.paddingBottom="0px";
811 this.opening.style.display="block"
812 }if(this.curStep==this.totSteps){clearInterval(this.timer);
813 this.opening.style.paddingTop=this.opening.style.paddingBottom="";
814 Rico.hide(this.closing)
815 }},setPanelHeight:function(a){this.options.panelHeight=a;
816 this.selected.style.height=this.options.panelHeight+"px"
818 Rico.TabbedPanel=function(b,a){this.initialize(b,a)
820 Rico.TabbedPanel.prototype=Rico.extend(new Rico.ContentTransitionBase(),{initialize:function(d,l){d=Rico.$(d);
822 if(typeof l.panelWidth=="number"){l.panelWidth+="px"
823 }if(typeof l.panelHeight=="number"){l.panelHeight+="px"
824 }d.className=l.tabClass||Rico.theme.tabPanel||"Rico_tabPanel";
825 if(l.panelWidth){d.style.width=l.panelWidth
830 e++){if(k[e]&&k[e].tagName&&k[e].tagName.match(/^div|ul$/i)){g.push(k[e])
831 }}if(g.length<2){return
832 }var c=g[0].tagName.toLowerCase()=="ul"?"li":"div";
833 g[0].className=l.navContainerClass||Rico.theme.tabNavContainer||"Rico_tabNavContainer";
834 g[0].style.listStyle="none";
835 g[1].className=l.contentContainerClass||Rico.theme.tabContentContainer||"Rico_tabContentContainer";
836 var f=Rico.getDirectChildrenByTag(g[0],c);
837 var b=Rico.getDirectChildrenByTag(g[1],"div");
838 var j=Rico.direction(d);
839 if(!l.corners){l.corners="top"
842 e++){if(j=="rtl"){Rico.setStyle(f[e],{"float":"right"})
843 }f[e].className=l.titleClass||Rico.theme.tabTitle||"Rico_tabTitle";
844 var h=Rico.wrapChildren(f[e],"","","a");
845 h.href="javascript:void(0)";
846 b[e].className=l.contentClass||Rico.theme.tabContent||"Rico_tabContent";
847 if(l.panelHeight){b[e].style.overflow="auto"
848 }if(l.corners!="none"){if(l.panelHdrWidth){f[e].style.width=l.panelHdrWidth
849 }Rico.Corner.round(f[e],Rico.theme.tabCornerOptions||l)
850 }}l.selectedClass=Rico.theme.tabSelected||"selected";
851 this.initBase(f,b,l);
852 if(this.selected){this.transition(this.selected)
853 }},transition:function(a){Rico.log("TabbedPanel#transition "+typeof(a));
854 if(this.selected){Rico.hide(this.selected)
856 if(this.options.panelHeight){a.style.height=this.options.panelHeight
858 Rico.Corner={round:function(b,a){b=Rico.$(b);
859 this.options={corners:"all",bgColor:"fromParent",compact:false,nativeCorners:false};
860 Rico.extend(this.options,a||{});
861 if(typeof(Rico.getStyle(b,"border-radius"))=="string"){this._roundCornersStdCss(b)
862 }else{if(typeof(Rico.getStyle(b,"-webkit-border-radius"))=="string"){this._roundCornersWebKit(b)
863 }else{if(typeof(Rico.getStyle(b,"-moz-border-radius"))=="string"){this._roundCornersMoz(b)
864 }else{if(!this.options.nativeCorners){this._roundCornersImpl(b)
865 }}}}},_roundCornersStdCss:function(b){var a=this.options.compact?"4px":"8px";
866 if(this._hasString(this.options.corners,"all")){Rico.setStyle(b,{borderRadius:a})
867 }else{if(this._hasString(this.options.corners,"top","tl")){Rico.setStyle(b,{borderTopLeftRadius:a})
868 }if(this._hasString(this.options.corners,"top","tr")){Rico.setStyle(b,{borderTopRightRadius:a})
869 }if(this._hasString(this.options.corners,"bottom","bl")){Rico.setStyle(b,{borderBottomLeftRadius:a})
870 }if(this._hasString(this.options.corners,"bottom","br")){Rico.setStyle(b,{borderBottomRightRadius:a})
871 }}},_roundCornersWebKit:function(b){var a=this.options.compact?"4px":"8px";
872 if(this._hasString(this.options.corners,"all")){Rico.setStyle(b,{WebkitBorderRadius:a})
873 }else{if(this._hasString(this.options.corners,"top","tl")){Rico.setStyle(b,{WebkitBorderTopLeftRadius:a})
874 }if(this._hasString(this.options.corners,"top","tr")){Rico.setStyle(b,{WebkitBorderTopRightRadius:a})
875 }if(this._hasString(this.options.corners,"bottom","bl")){Rico.setStyle(b,{WebkitBorderBottomLeftRadius:a})
876 }if(this._hasString(this.options.corners,"bottom","br")){Rico.setStyle(b,{WebkitBorderBottomRightRadius:a})
877 }}},_roundCornersMoz:function(b){var a=this.options.compact?"4px":"8px";
878 if(this._hasString(this.options.corners,"all")){Rico.setStyle(b,{MozBorderRadius:a})
879 }else{if(this._hasString(this.options.corners,"top","tl")){Rico.setStyle(b,{MozBorderRadiusTopleft:a})
880 }if(this._hasString(this.options.corners,"top","tr")){Rico.setStyle(b,{MozBorderRadiusTopright:a})
881 }if(this._hasString(this.options.corners,"bottom","bl")){Rico.setStyle(b,{MozBorderRadiusBottomleft:a})
882 }if(this._hasString(this.options.corners,"bottom","br")){Rico.setStyle(b,{MozBorderRadiusBottomright:a})
883 }}},_roundCornersImpl:function(b){var a=this.options.bgColor=="fromParent"?this._background(b.parentNode):this.options.bgColor;
884 b.style.position="relative";
885 if(this._hasString(this.options.corners,"all","top","tl")){this._createCorner(b,"top","left",a)
886 }if(this._hasString(this.options.corners,"all","top","tr")){this._createCorner(b,"top","right",a)
887 }if(this._hasString(this.options.corners,"all","bottom","bl")){this._createCorner(b,"bottom","left",a)
888 }if(this._hasString(this.options.corners,"all","bottom","br")){this._createCorner(b,"bottom","right",a)
889 }},_createCorner:function(b,c,f,k){var n=document.createElement("div");
890 n.className="ricoCorner";
891 Rico.setStyle(n,{width:"6px",height:"5px"});
892 var o=Rico.getStyle(b,"border-"+c+"-style");
893 var a=o=="none"?k:Rico.getStyle(b,"border-"+c+"-color");
894 var j=o=="none"?"0px":"-1px";
896 n.style[f]=Rico.isIE&&Rico.ieVersion<7&&f=="right"&&o!="none"?"-2px":"-1px";
899 if(c=="bottom"){h.reverse()
900 }var m=o=="none"?"0px none":"1px solid "+a;
901 var g=f=="left"?"Right":"Left";
904 e++){var l=document.createElement("div");
905 Rico.setStyle(l,{backgroundColor:k,height:"1px"});
906 l.style["margin"+g]=h[e]+"px";
907 l.style["border"+g]=m;
909 }},_background:function(c){try{var a=Rico.getStyle(c,"backgroundColor");
910 if(a.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i)&&c.parentNode){return this._background(c.parentNode)
911 }return a==null?"#ffffff":a
912 }catch(b){return"#ffffff"
913 }},_hasString:function(b){for(var a=1;
915 a++){if(b.indexOf(arguments[a])>=0){return true
918 Rico.toColorPart=function(a){return Rico.zFill(a,2,16)
920 Rico.Color=function(c,b,a){this.initialize(c,b,a)
922 Rico.Color.prototype={initialize:function(c,b,a){this.rgb={r:c,g:b,b:a}
923 },setRed:function(a){this.rgb.r=a
924 },setGreen:function(a){this.rgb.g=a
925 },setBlue:function(a){this.rgb.b=a
926 },setHue:function(b){var a=this.asHSB();
928 this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,a.b)
929 },setSaturation:function(b){var a=this.asHSB();
931 this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,a.b)
932 },setBrightness:function(a){var c=this.asHSB();
934 this.rgb=Rico.Color.HSBtoRGB(c.h,c.s,c.b)
935 },darken:function(b){var a=this.asHSB();
936 this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,Math.max(a.b-b,0))
937 },brighten:function(b){var a=this.asHSB();
938 this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,Math.min(a.b+b,1))
939 },blend:function(a){this.rgb.r=Math.floor((this.rgb.r+a.rgb.r)/2);
940 this.rgb.g=Math.floor((this.rgb.g+a.rgb.g)/2);
941 this.rgb.b=Math.floor((this.rgb.b+a.rgb.b)/2)
942 },isBright:function(){var a=this.asHSB();
943 return this.asHSB().b>0.5
944 },isDark:function(){return !this.isBright()
945 },asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"
946 },asHex:function(){return"#"+Rico.toColorPart(this.rgb.r)+Rico.toColorPart(this.rgb.g)+Rico.toColorPart(this.rgb.b)
947 },asHSB:function(){return Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b)
948 },toString:function(){return this.asHex()
950 Rico.Color.createFromHex=function(d){if(d.length==4){var b=d;
954 c++){d+=(b.charAt(c)+b.charAt(c))
955 }}if(d.indexOf("#")==0){d=d.substring(1)
956 }if(!d.match(/^[0-9A-Fa-f]{6}$/)){return null
957 }var f=d.substring(0,2);
958 var e=d.substring(2,4);
959 var a=d.substring(4,6);
960 return new Rico.Color(parseInt(f,16),parseInt(e,16),parseInt(a,16))
962 Rico.Color.createColorFromBackground=function(d){if(!d.style){return new Rico.Color(255,255,255)
963 }var b=Rico.getStyle(d,"background-color");
964 if(b.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i)&&d.parentNode){return Rico.Color.createColorFromBackground(d.parentNode)
965 }if(b==null){return new Rico.Color(255,255,255)
966 }if(b.indexOf("rgb(")==0){var a=b.substring(4,b.length-1);
968 return new Rico.Color(parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10))
969 }else{if(b.indexOf("#")==0){return Rico.Color.createFromHex(b)
970 }else{return new Rico.Color(255,255,255)
972 Rico.Color.HSBtoRGB=function(i,e,k){var c=0;
975 if(e==0){c=parseInt(k*255+0.5,10);
978 }else{var g=(i-Math.floor(i))*6;
979 var j=g-Math.floor(g);
982 var m=k*(1-(e*(1-j)));
983 switch(parseInt(g,10)){case 0:c=(k*255+0.5);
987 case 1:c=(a*255+0.5);
991 case 2:c=(b*255+0.5);
995 case 3:c=(b*255+0.5);
999 case 4:c=(m*255+0.5);
1003 case 5:c=(k*255+0.5);
1007 }}return{r:parseInt(c,10),g:parseInt(d,10),b:parseInt(l,10)}
1009 Rico.Color.RGBtoHSB=function(a,f,l){var h;
1020 }else{var c=(m-a)/(m-i);
1024 }else{if(f==m){h=2+c-d
1028 }}return{h:h,s:e,b:k}
1030 Rico.createXmlDocument=function(){if(document.implementation&&document.implementation.createDocument){var a=document.implementation.createDocument("","",null);
1031 if(a.readyState==null){a.readyState=1;
1032 a.addEventListener("load",function(){a.readyState=4;
1033 if(typeof a.onreadystatechange=="function"){a.onreadystatechange()
1036 }if(window.ActiveXObject){return Rico.tryFunctions(function(){return new ActiveXObject("MSXML2.DomDocument")
1037 },function(){return new ActiveXObject("Microsoft.DomDocument")
1038 },function(){return new ActiveXObject("MSXML.DomDocument")
1039 },function(){return new ActiveXObject("MSXML3.DomDocument")
1043 Rico.CalendarControl=function(b,a){this.initialize(b,a)
1045 Rico.CalendarControl.prototype={initialize:function(d,c){this.id=d;
1047 this.defaultMin=new Date(b.getFullYear()-50,0,1);
1048 this.defaultMax=new Date(b.getFullYear()+50,11,31);
1049 Rico.extend(this,new Rico.Popup());
1050 Rico.extend(this.options,{ignoreClicks:true,startAt:0,showWeekNumber:0,showToday:1,dateFmt:"ISO8601",minDate:this.defaultMin,maxDate:this.defaultMax});
1051 Rico.extend(this.options,c||{});
1052 this.close=this.closePopup;
1053 this.bPageLoaded=false;
1055 this.re=/^\s*(\w+)(\W)(\w+)(\W)(\w+)/i;
1056 this.setDateFmt(this.options.dateFmt);
1058 Rico.onLoad(function(){a.atLoad()
1060 },setDateFmt:function(a){this.dateFmt=(a=="rico")?Rico.dateFmt:a;
1061 Rico.log(this.id+" date format set to "+this.dateFmt);
1063 if(this.re.exec(this.dateFmt)){this.dateParts[RegExp.$1]=0;
1064 this.dateParts[RegExp.$3]=1;
1065 this.dateParts[RegExp.$5]=2
1066 }},addHoliday:function(f,a,g,e,c,b){this.Holidays[this.holidayKey(g,a-1,f)]={desc:e,txtColor:b,bgColor:c||"#DDF"}
1067 },holidayKey:function(c,a,b){return"h"+Rico.zFill(c,4)+Rico.zFill(a,2)+Rico.zFill(b,2)
1068 },atLoad:function(){Rico.log("Calendar#atLoad: "+this.id);
1069 var d=Rico.$(this.id);
1070 if(d){this.setDiv(d)
1071 }else{this.createContainer();
1072 this.container.id=this.id
1073 }Rico.addClass(this.content,Rico.theme.calendar||"ricoCalContainer");
1074 this.direction=Rico.direction(this.container);
1075 var b,h,g,f,n,l,o,e;
1076 this.colStart=this.options.showWeekNumber?1:0;
1077 var k=7+this.colStart;
1078 this.maintab=document.createElement("table");
1079 this.maintab.cellSpacing=2;
1080 this.maintab.cellPadding=0;
1081 this.maintab.border=0;
1082 this.maintab.style.borderCollapse="separate";
1083 this.maintab.className=Rico.theme.calendarTable||"ricoCalTab";
1084 this.thead=this.maintab.createTHead();
1085 b=this.thead.insertRow(-1);
1086 this.heading=b.insertCell(-1);
1087 this.heading.colSpan=k;
1088 this.heading.className="RicoCalHeading";
1089 if(Rico.theme.calendarHeading){Rico.addClass(this.heading,Rico.theme.calendarHeading)
1090 }if(this.options.showToday){this.tfoot=this.maintab.createTFoot();
1091 this.tfoot.className="ricoCalFoot";
1092 b=this.tfoot.insertRow(-1);
1093 this.todayCell=b.insertCell(-1);
1094 this.todayCell.colSpan=k;
1095 this.todayCell.className=Rico.theme.calendarFooter||"ricoCalFoot";
1096 Rico.eventBind(this.todayCell,"click",Rico.eventHandle(this,"selectNow"),false)
1097 }this.tbody=Rico.getTBody(this.maintab);
1098 this.tbody.className="ricoCalBody";
1099 this.content.style.display="block";
1100 if(this.position=="absolute"){this.content.style.width="auto";
1101 this.maintab.style.width="auto"
1102 }else{this.container.style.position="relative";
1103 this.heading.style.position="static";
1104 this.content.style.padding="0px";
1105 this.content.style.width="15em";
1106 this.maintab.style.width="100%"
1110 g++){b=this.tbody.insertRow(-1);
1111 b.className=g==0?"ricoCalDayNames":"row"+g;
1112 if(this.options.showWeekNumber){h=b.insertCell(-1);
1113 h.className="ricoCalWeekNum";
1114 if(g==0){h.innerHTML=Rico.getPhraseById("calWeekHdg")
1117 f++){h=b.insertCell(-1);
1118 if(g==0){n=(f+this.options.startAt)%7;
1119 h.innerHTML=Rico.dayAbbr(n);
1120 this.styles[f]="ricoCal"+n
1121 }else{h.className=this.styles[f];
1122 if(Rico.theme.calendarDay){Rico.addClass(h,Rico.theme.calendarDay)
1123 }}}}this.content.appendChild(this.maintab);
1124 new Rico.HoverSet(this.tbody.getElementsByTagName("td"),{hoverNodes:function(a){return a.innerHTML.match(/^\d+$/)?[a]:[]
1126 this.navtab=this.heading.appendChild(document.createElement("table"));
1127 this.navrow=this.navtab.insertRow(-1);
1128 this._createTitleSection("Month");
1129 this.navrow.insertCell(-1).innerHTML=" ";
1130 this._createTitleSection("Year");
1131 new Rico.HoverSet(this.heading.getElementsByTagName("a"));
1132 if(this.position=="absolute"){this.heading.appendChild(Rico.closeButton(Rico.eventHandle(this,"close")))
1133 }this.monthPopup=new Rico.Popup(document.createElement("div"),{shim:false,zIndex:10});
1134 this.monthPopup.content.className="ricoCalMonthPrompt";
1135 e=document.createElement("table");
1136 e.className="ricoCalMenu";
1137 if(Rico.theme.calendarPopdown){Rico.addClass(e,Rico.theme.calendarPopdown)
1141 e.style.borderCollapse="separate";
1142 e.style.margin="0px";
1145 g++){b=e.insertRow(-1);
1148 f++){h=b.insertCell(-1);
1149 l=document.createElement("a");
1150 l.innerHTML=Rico.monthAbbr(g*3+f);
1152 if(Rico.theme.calendarDay){Rico.addClass(l,Rico.theme.calendarDay)
1154 Rico.eventBind(l,"click",Rico.eventHandle(this,"selectMonth"),false)
1155 }}new Rico.HoverSet(e.getElementsByTagName("a"));
1156 this.monthPopup.content.appendChild(e);
1157 this.container.appendChild(this.monthPopup.container);
1158 this.monthPopup.closePopup();
1159 this.yearPopup=new Rico.Popup(document.createElement("div"),{shim:false,zIndex:10});
1160 this.yearPopup.content.className="ricoCalYearPrompt";
1161 if(Rico.theme.calendarPopdown){Rico.addClass(this.yearPopup.content,Rico.theme.calendarPopdown)
1162 }this.yearPrompt=document.createElement("p");
1163 this.yearPrompt.innerHTML=" ";
1164 var m=document.createElement("p");
1165 this.yearInput=m.appendChild(document.createElement("input"));
1166 this.yearInput.maxlength=4;
1167 this.yearInput.size=4;
1168 Rico.eventBind(this.yearInput,"keyup",Rico.eventHandle(this,"yearKey"),false);
1169 l=Rico.floatButton("Checkmark",Rico.eventHandle(this,"processPopUpYear"));
1171 l=Rico.floatButton("Cancel",Rico.eventHandle(this,"popDownYear"));
1173 this.yearPopup.content.appendChild(this.yearPrompt);
1174 this.yearPopup.content.appendChild(m);
1175 this.container.appendChild(this.yearPopup.container);
1176 this.yearPopup.closePopup();
1177 l=this.content.getElementsByTagName("a");
1180 g++){l[g].href="javascript:void(0)"
1181 }Rico.eventBind(this.tbody,"click",Rico.eventHandle(this,"saveAndClose"));
1182 this.bPageLoaded=true
1183 },_createTitleSection:function(e){var d=["left","right"];
1184 if(this.direction=="rtl"){d.reverse()
1185 }var f=this.navrow.insertCell(-1);
1186 var b=f.appendChild(document.createElement("a"));
1187 b.className="Rico_"+d[0]+"Arrow";
1188 b.appendChild(this._createNavArrow(d[0]));
1189 Rico.eventBind(b,"click",Rico.eventHandle(this,"dec"+e),false);
1190 f=this.navrow.insertCell(-1);
1191 b=f.appendChild(document.createElement("a"));
1192 Rico.eventBind(b,"click",Rico.eventHandle(this,"popUp"+e),false);
1194 f=this.navrow.insertCell(-1);
1195 b=f.appendChild(document.createElement("a"));
1196 b.className="Rico_"+d[1]+"Arrow";
1197 b.appendChild(this._createNavArrow(d[1]));
1198 Rico.eventBind(b,"click",Rico.eventHandle(this,"inc"+e),false)
1199 },_createNavArrow:function(b){var a=document.createElement("span");
1200 a.className=Rico.theme[b+"Arrow"]||"rico-icon Rico_"+b+"Arrow";
1201 a.style.display="inline-block";
1203 },selectNow:function(){var a=new Date();
1204 this.dateNow=a.getDate();
1205 this.monthNow=a.getMonth();
1206 this.yearNow=a.getFullYear();
1207 this.monthSelected=this.monthNow;
1208 this.yearSelected=this.yearNow;
1209 this.constructCalendar()
1210 },isValidMonth:function(a,b){if(a<this.options.minDate.getFullYear()){return false
1211 }if(a==this.options.minDate.getFullYear()&&b<this.options.minDate.getMonth()){return false
1212 }if(a>this.options.maxDate.getFullYear()){return false
1213 }if(a==this.options.maxDate.getFullYear()&&b>this.options.maxDate.getMonth()){return false
1215 },incMonth:function(){var b=this.monthSelected+1;
1216 var a=this.yearSelected;
1219 }if(!this.isValidMonth(a,b)){return
1220 }this.monthSelected=b;
1221 this.yearSelected=a;
1222 this.constructCalendar()
1223 },decMonth:function(){var b=this.monthSelected-1;
1224 var a=this.yearSelected;
1227 }if(!this.isValidMonth(a,b)){return
1228 }this.monthSelected=b;
1229 this.yearSelected=a;
1230 this.constructCalendar()
1231 },selectMonth:function(b){var a=Rico.eventElement(b);
1232 this.monthSelected=parseInt(a.name,10);
1233 this.constructCalendar();
1235 },openYrMo:function(b,a){if(this.direction=="rtl"){a=1-a
1237 var c=a?this.content.offsetWidth-b.container.offsetWidth-5:3;
1238 b.move(c,this.heading.offsetHeight+2)
1239 },popUpMonth:function(a){Rico.eventStop(a);
1240 if(this.monthPopup.visible()){this.popDownMonth();
1242 }this.popDownYear();
1243 this.openYrMo(this.monthPopup,0);
1245 },popDownMonth:function(){this.monthPopup.closePopup()
1246 },popDownYear:function(){this.yearPopup.closePopup();
1247 this.yearInput.disabled=true
1248 },popUpYear:function(b){Rico.eventStop(b);
1249 if(this.yearPopup.visible()){this.popDownYear();
1251 }this.popDownMonth();
1252 this.yearPrompt.innerHTML=Rico.getPhraseById("calYearRange",this.options.minDate.getFullYear(),this.options.maxDate.getFullYear());
1253 this.yearInput.disabled=false;
1254 this.yearInput.value="";
1255 this.openYrMo(this.yearPopup,1);
1257 setTimeout(function(){a.yearInput.focus()
1260 },yearKey:function(a){switch(Rico.eventKey(a)){case 27:this.popDownYear();
1263 case 13:this.processPopUpYear();
1267 },processPopUpYear:function(){var a=this.yearInput.value;
1269 if(isNaN(a)||a<this.options.minDate.getFullYear()||a>this.options.maxDate.getFullYear()){alert(Rico.getPhraseById("calInvalidYear"))
1270 }else{this.yearSelected=a;
1272 this.constructCalendar()
1273 }},incYear:function(){if(this.yearSelected>=this.options.maxDate.getFullYear()){return
1274 }this.yearSelected++;
1275 this.constructCalendar()
1276 },decYear:function(){if(this.yearSelected<=this.options.minDate.getFullYear()){return
1277 }this.yearSelected--;
1278 this.constructCalendar()
1279 },WeekNbr:function(h,f,j){var g=new Date(h,f,j);
1280 var c=new Date(h,0,1);
1281 var e=7+1-c.getDay();
1283 }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;
1284 var d=Math.floor((b-e+7)/7);
1286 var a=new Date(h,0,1);
1287 var i=7+1-a.getDay();
1288 d=(i==2||i==8)?53:52
1290 },constructCalendar:function(){var l=[31,0,31,30,31,30,31,31,30,31,30,31];
1291 var d=new Date(this.yearSelected,this.monthSelected,1);
1293 if(typeof this.monthSelected!="number"||this.monthSelected>=12||this.monthSelected<0){alert("ERROR in calendar: monthSelected="+this.monthSelected);
1295 }if(this.monthSelected==1){j=new Date(this.yearSelected,this.monthSelected+1,1);
1296 j=new Date(j-(24*60*60*1000));
1298 }else{e=l[this.monthSelected]
1299 }var n=d.getDay()-this.options.startAt;
1301 }this.popDownMonth();
1303 if(this.options.showWeekNumber){for(f=1;
1305 f++){this.tbody.rows[f].cells[0].innerHTML=" "
1308 f++){this.resetCell(this.tbody.rows[1].cells[f+this.colStart])
1312 if(this.options.showWeekNumber&&b==0){this.tbody.rows[a].cells[0].innerHTML=this.WeekNbr(this.yearSelected,this.monthSelected,k)
1313 }var m=this.tbody.rows[a].cells[b+this.colStart];
1315 m.className=this.styles[b];
1316 if((k==this.dateNow)&&(this.monthSelected==this.monthNow)&&(this.yearSelected==this.yearNow)){Rico.addClass(m,Rico.theme.calendarToday||"ricoCalToday")
1317 }if(Rico.theme.calendarDay){Rico.addClass(m,Rico.theme.calendarDay)
1318 }if((k==this.odateSelected)&&(this.monthSelected==this.omonthSelected)&&(this.yearSelected==this.oyearSelected)){Rico.addClass(m,Rico.theme.calendarSelectedDay||"ricoSelectedDay")
1319 }var g=this.Holidays[this.holidayKey(this.yearSelected,this.monthSelected,k)];
1320 if(!g){g=this.Holidays[this.holidayKey(0,this.monthSelected,k)]
1321 }m.style.color=g?g.txtColor:"";
1322 m.style.backgroundColor=g?g.bgColor:"";
1323 m.title=g?g.desc:"";
1324 m.style.visibility="visible";
1326 }}while(n<42){b=n%7;
1327 this.resetCell(this.tbody.rows[a].cells[b+this.colStart]);
1330 }}this.titleMonth.innerHTML=Rico.monthAbbr(this.monthSelected);
1331 this.titleYear.innerHTML=this.yearSelected;
1332 if(this.todayCell){this.todayCell.innerHTML=Rico.getPhraseById("calToday",this.dateNow,Rico.monthAbbr(this.monthNow),this.yearNow,this.monthNow+1)
1333 }},resetCell:function(a){a.innerHTML=" ";
1335 a.style.visibility="hidden"
1336 },saveAndClose:function(g){Rico.eventStop(g);
1337 var f=Rico.eventElement(g);
1338 var c=f.innerHTML.replace(/ /g,"");
1339 if(c==""||f.className=="ricoCalWeekNum"){return
1340 }var b=parseInt(c,10);
1342 }var h=new Date(this.yearSelected,this.monthSelected,b);
1343 var a=Rico.formatDate(h,this.dateFmt=="ISO8601"?"yyyy-mm-dd":this.dateFmt);
1344 if(this.returnValue){this.returnValue(a);
1346 }},open:function(c,b){if(!this.bPageLoaded){return
1347 }if(b){this.setDateFmt(b.format.dateFmt);
1348 this.options.minDate=b.format.min||this.defaultMin;
1349 this.options.maxDate=b.format.max||this.defaultMax
1351 this.dateNow=a.getDate();
1352 this.monthNow=a.getMonth();
1353 this.yearNow=a.getFullYear();
1354 this.oyearSelected=-1;
1355 if(typeof c=="object"){this.odateSelected=c.getDate();
1356 this.omonthSelected=c.getMonth();
1357 this.oyearSelected=c.getFullYear()
1358 }else{if(this.dateFmt=="ISO8601"){var e=Rico.setISO8601(c);
1359 if(e){this.odateSelected=e.getDate();
1360 this.omonthSelected=e.getMonth();
1361 this.oyearSelected=e.getFullYear()
1362 }}else{if(this.re.exec(c)){var g=[RegExp.$1,RegExp.$3,RegExp.$5];
1363 this.odateSelected=parseInt(g[this.dateParts.dd],10);
1364 this.omonthSelected=parseInt(g[this.dateParts.mm],10)-1;
1365 this.oyearSelected=parseInt(g[this.dateParts.yyyy],10);
1366 if(this.oyearSelected<100){this.oyearSelected+=this.yearNow-(this.yearNow%100);
1367 var f=this.options.maxDate.getFullYear();
1368 while(this.oyearSelected>f){this.oyearSelected-=100
1369 }}}else{if(c){alert("ERROR: invalid date passed to calendar ("+c+")")
1370 }}}}if(this.oyearSelected>0){this.dateSelected=this.odateSelected;
1371 this.monthSelected=this.omonthSelected;
1372 this.yearSelected=this.oyearSelected
1373 }else{this.dateSelected=this.dateNow;
1374 this.monthSelected=this.monthNow;
1375 this.yearSelected=this.yearNow
1376 }this.constructCalendar();
1379 Rico.ColorPicker=function(b,a){this.initialize(b,a)
1381 Rico.ColorPicker.prototype={initialize:function(i,d){this.id=i;
1382 this.currentValue="#FFFFFF";
1383 Rico.extend(this,new Rico.Popup());
1384 Rico.extend(this.options,{showColorCode:false,cellsPerRow:18,palette:[]});
1385 var h=["00","33","66","99","CC","FF"];
1392 a++){this.options.palette.push(h[e]+h[f]+h[a])
1393 }}}Rico.extend(this.options,d||{});
1395 Rico.onLoad(function(){c.atLoad()
1397 },atLoad:function(){this.createContainer();
1398 this.content.className="ricoColorPicker";
1399 var c=this.options.cellsPerRow;
1400 var d="<TABLE BORDER='1' CELLSPACING='1' CELLPADDING='0'>";
1402 b<this.options.palette.length;
1403 b++){if((b%c)==0){d+="<TR>"
1404 }d+='<TD BGCOLOR="#'+this.options.palette[b]+'"> </TD>';
1405 if(((b+1)>=this.options.palette.length)||(((b+1)%c)==0)){d+="</TR>"
1406 }}var a=Math.floor(c/2);
1407 if(this.options.showColorCode){d+="<TR><TD COLSPAN='"+a+"' ID='colorPickerSelectedColor'> </TD><TD COLSPAN='"+(c-a)+"' ALIGN='CENTER' ID='colorPickerSelectedColorValue'>#FFFFFF</TD></TR>"
1408 }else{d+="<TR><TD COLSPAN='"+c+"' ID='colorPickerSelectedColor'> </TD></TR>"
1410 this.content.innerHTML=d;
1411 this.open=this.openPopup;
1412 this.close=this.closePopup;
1413 Rico.eventBind(this.container,"mouseover",Rico.eventHandle(this,"highlightColor"),false);
1414 Rico.eventBind(this.container,"click",Rico.eventHandle(this,"selectColor"),false);
1416 },selectColor:function(a){Rico.eventStop(a);
1417 if(this.returnValue){this.returnValue(this.currentValue)
1419 },highlightColor:function(b){var a=Rico.eventElement(b);
1420 if(!a.tagName||a.tagName.toLowerCase()!="td"){return
1421 }var g=Rico.Color.createColorFromBackground(a).toString();
1422 this.currentValue=g;
1423 Rico.setStyle("colorPickerSelectedColor",{backgroundColor:g});
1424 var f=Rico.$("colorPickerSelectedColorValue");
1428 Rico.registerDraggable=function(b,a){if(typeof a!="number"){a=0
1429 }if(typeof Rico.dndMgrList[a]!="object"){Rico.dndMgrList[a]=new Rico.dndMgr()
1430 }Rico.dndMgrList[a].registerDraggable(b)
1432 Rico.registerDropZone=function(b,a){if(typeof a!="number"){a=0
1433 }if(typeof Rico.dndMgrList[a]!="object"){Rico.dndMgrList[a]=new Rico.dndMgr()
1434 }Rico.dndMgrList[a].registerDropZone(b)
1436 Rico.dndMgr=function(){this.initialize()
1438 Rico.dndMgr.prototype={initialize:function(){this.dropZones=[];
1440 this.currentDragObjects=[];
1441 this.dragElement=null;
1442 this.lastSelectedDraggable=null;
1443 this.currentDragObjectVisible=false;
1444 this.interestedInMotionEvents=false;
1445 this._mouseDown=Rico.eventHandle(this,"_mouseDownHandler");
1446 this._mouseMove=Rico.eventHandle(this,"_mouseMoveHandler");
1447 this._mouseUp=Rico.eventHandle(this,"_mouseUpHandler")
1448 },registerDropZone:function(a){this.dropZones[this.dropZones.length]=a
1449 },deregisterDropZone:function(a){var d=new Array();
1452 c<this.dropZones.length;
1453 c++){if(this.dropZones[c]!=a){d[b++]=this.dropZones[c]
1455 },clearDropZones:function(){this.dropZones=new Array()
1456 },registerDraggable:function(a){this.draggables[this.draggables.length]=a;
1457 var b=a.getMouseDownHTMLElement();
1458 if(b!=null){b.ricoDraggable=a;
1459 Rico.eventBind(b,"mousedown",Rico.eventHandle(this,"_attachEvents"));
1460 Rico.eventBind(b,"mousedown",this._mouseDown)
1461 }},clearSelection:function(){for(var a=0;
1462 a<this.currentDragObjects.length;
1463 a++){this.currentDragObjects[a].deselect()
1464 }this.currentDragObjects=new Array();
1465 this.lastSelectedDraggable=null
1466 },hasSelection:function(){return this.currentDragObjects.length>0
1467 },setStartDragFromElement:function(a,c){this.origPos=Rico.cumulativeOffset(c);
1468 var b=Rico.eventClient(a);
1469 this.startx=b.x-this.origPos.left;
1470 this.starty=b.y-this.origPos.top;
1471 this.interestedInMotionEvents=this.hasSelection();
1473 },updateSelection:function(a,b){if(!b){this.clearSelection()
1474 }if(a.isSelected()){this.currentDragObjects=this.currentDragObjects.without(a);
1476 if(a==this.lastSelectedDraggable){this.lastSelectedDraggable=null
1478 if(a.isSelected()){this.currentDragObjects.push(a);
1479 this.lastSelectedDraggable=a
1480 }}},_mouseDownHandler:function(f){if(!Rico.eventLeftClick(f)){return
1481 }var d=Rico.eventElement(f);
1482 var a=d.ricoDraggable;
1484 while(a==null&&c.parentNode){c=c.parentNode;
1487 }this.updateSelection(a,f.ctrlKey);
1488 if(this.hasSelection()){for(var b=0;
1489 b<this.dropZones.length;
1490 b++){this.dropZones[b].clearPositionCache()
1491 }}this.setStartDragFromElement(f,a.getMouseDownHTMLElement())
1492 },_mouseMoveHandler:function(a){if(!this.interestedInMotionEvents){return
1493 }if(!this.hasSelection()){return
1494 }if(!this.currentDragObjectVisible){this._startDrag(a)
1495 }if(!this.activatedDropZones){this._activateRegisteredDropZones()
1496 }this._updateDraggableLocation(a);
1497 this._updateDropZonesHover(a);
1499 },_makeDraggableObjectVisible:function(b){if(!this.hasSelection()){return
1501 if(this.currentDragObjects.length>1){a=this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects)
1502 }else{a=this.currentDragObjects[0].getSingleObjectDragGUI()
1503 }this.dragElemPosition=Rico.getStyle(a,"position");
1504 if(this.dragElemPosition!="absolute"){a.style.position="absolute"
1505 }if(a.parentNode==null||a.parentNode.nodeType==11){document.body.appendChild(a)
1506 }this.dragElement=a;
1507 this._updateDraggableLocation(b);
1508 this.currentDragObjectVisible=true
1509 },_leftOffset:function(a){return a.offsetX?document.body.scrollLeft:0
1510 },_topOffset:function(a){return a.offsetY?document.body.scrollTop:0
1511 },_updateDraggableLocation:function(b){var a=this.dragElement.style;
1512 var c=Rico.eventClient(b);
1513 a.left=(c.x+this._leftOffset(b)-this.startx)+"px";
1514 a.top=(c.y+this._topOffset(b)-this.starty)+"px"
1515 },_updateDropZonesHover:function(b){var a,c=this.dropZones.length;
1518 a++){if(!this._mousePointInDropZone(b,this.dropZones[a])){this.dropZones[a].hideHover()
1521 a++){if(this._mousePointInDropZone(b,this.dropZones[a])){if(this.dropZones[a].canAccept(this.currentDragObjects)){this.dropZones[a].showHover()
1522 }}}},_startDrag:function(b){for(var a=0;
1523 a<this.currentDragObjects.length;
1524 a++){this.currentDragObjects[a].startDrag()
1525 }this._makeDraggableObjectVisible(b)
1526 },_mouseUpHandler:function(b){if(!this.hasSelection()){return
1527 }if(!Rico.eventLeftClick(b)){return
1528 }this.interestedInMotionEvents=false;
1529 if(this._placeDraggableInDropZone(b)){this._completeDropOperation(b)
1530 }else{if(this.dragElement!=null){Rico.eventStop(b);
1532 Rico.animate(this.dragElement,{duration:300,onEnd:function(){a._doCancelDragProcessing()
1533 }},{left:this.origPos.left,top:this.origPos.top})
1534 }}Rico.eventUnbind(document.body,"mousemove",this._mouseMove);
1535 Rico.eventUnbind(document.body,"mouseup",this._mouseUp)
1536 },_retTrue:function(){return true
1537 },_completeDropOperation:function(a){if(this.dragElement!=this.currentDragObjects[0].getMouseDownHTMLElement()){if(this.dragElement.parentNode!=null){this.dragElement.parentNode.removeChild(this.dragElement)
1538 }}this._deactivateRegisteredDropZones();
1540 this.clearSelection();
1541 this.dragElement=null;
1542 this.currentDragObjectVisible=false;
1544 },_doCancelDragProcessing:function(){this._cancelDrag();
1545 if(this.dragElement==this.currentDragObjects[0].getMouseDownHTMLElement()){this.dragElement.style.position=this.dragElemPosition
1546 }else{if(this.dragElement&&this.dragElement.parentNode!=null){this.dragElement.parentNode.removeChild(this.dragElement)
1547 }}this._deactivateRegisteredDropZones();
1548 this.dragElement=null;
1549 this.currentDragObjectVisible=false
1550 },_placeDraggableInDropZone:function(c){var a=false;
1551 var d=this.dropZones.length;
1554 b++){if(this._mousePointInDropZone(c,this.dropZones[b])){if(this.dropZones[b].canAccept(this.currentDragObjects)){this.dropZones[b].hideHover();
1555 this.dropZones[b].accept(this.currentDragObjects);
1559 },_cancelDrag:function(){for(var a=0;
1560 a<this.currentDragObjects.length;
1561 a++){this.currentDragObjects[a].cancelDrag()
1562 }},_endDrag:function(){for(var a=0;
1563 a<this.currentDragObjects.length;
1564 a++){this.currentDragObjects[a].endDrag()
1565 }},_mousePointInDropZone:function(b,c){var a=c.getAbsoluteRect();
1566 var d=Rico.eventClient(b);
1567 return d.x>a.left+this._leftOffset(b)&&d.x<a.right+this._leftOffset(b)&&d.y>a.top+this._topOffset(b)&&d.y<a.bottom+this._topOffset(b)
1568 },_activateRegisteredDropZones:function(){var c=this.dropZones.length;
1571 a++){var b=this.dropZones[a];
1572 if(b.canAccept(this.currentDragObjects)){b.activate()
1573 }}this.activatedDropZones=true
1574 },_deactivateRegisteredDropZones:function(){var b=this.dropZones.length;
1577 a++){this.dropZones[a].deactivate()
1578 }this.activatedDropZones=false
1579 },_attachEvents:function(){Rico.eventBind(document.body,"mousemove",this._mouseMove);
1580 Rico.eventBind(document.body,"mouseup",this._mouseUp)
1582 Rico.Draggable=function(a,b){this.initialize(a,b)
1584 Rico.Draggable.prototype={initialize:function(a,b){this.type=a;
1585 this.htmlElement=Rico.$(b);
1587 },getMouseDownHTMLElement:function(){return this.htmlElement
1588 },select:function(){this._select()
1589 },_select:function(){this.selected=true;
1590 if(this.showingSelected){return
1591 }this.showingSelected=true;
1592 var b=this.getMouseDownHTMLElement();
1593 var a=Rico.Color.createColorFromBackground(b);
1594 a.isBright()?a.darken(0.033):a.brighten(0.033);
1595 this.saveBackground=Rico.getStyle(b,"backgroundColor","background-color");
1596 b.style.backgroundColor=a.asHex()
1597 },deselect:function(){this.selected=false;
1598 if(!this.showingSelected){return
1599 }var a=this.getMouseDownHTMLElement();
1600 a.style.backgroundColor=this.saveBackground;
1601 this.showingSelected=false
1602 },isSelected:function(){return this.selected
1603 },startDrag:function(){},cancelDrag:function(){},endDrag:function(){},getSingleObjectDragGUI:function(){return this.htmlElement
1604 },getMultiObjectDragGUI:function(a){return this.htmlElement
1605 },getDroppedGUI:function(){return this.htmlElement
1606 },toString:function(){return this.type+":"+this.htmlElement+":"
1608 Rico.LiveGridDraggable=function(b,a,c){this.initialize(b,a,c)
1610 Rico.LiveGridDraggable.prototype=Rico.extend(new Rico.Draggable(),{initialize:function(b,a,c){this.type="RicoCell";
1611 this.htmlElement=b.cell(a,c);
1615 },select:function(){if(this.dragRow>=this.liveGrid.buffer.totalRows){return
1616 }this.selected=true;
1617 this.showingSelected=true
1618 },deselect:function(){this.selected=false;
1619 this.showingSelected=false
1620 },getSingleObjectDragGUI:function(){var a=document.createElement("div");
1621 a.className="LiveGridDraggable";
1622 a.style.width=(this.htmlElement.offsetWidth-10)+"px";
1623 a.innerHTML=this.htmlElement.innerHTML;
1626 Rico.Dropzone=function(a){this.initialize(a)
1628 Rico.Dropzone.prototype={initialize:function(a){this.htmlElement=Rico.$(a);
1629 this.absoluteRect=null
1630 },getHTMLElement:function(){return this.htmlElement
1631 },clearPositionCache:function(){this.absoluteRect=null
1632 },getAbsoluteRect:function(){if(this.absoluteRect==null){var a=this.getHTMLElement();
1633 var b=Rico.viewportOffset(a);
1634 this.absoluteRect={top:b.top,left:b.left,bottom:b.top+a.offsetHeight,right:b.left+a.offsetWidth}
1635 }return this.absoluteRect
1636 },activate:function(){var c=this.getHTMLElement();
1637 if(c==null||this.showingActive){return
1638 }this.showingActive=true;
1639 this.saveBackgroundColor=c.style.backgroundColor;
1641 var a=Rico.Color.createColorFromBackground(c);
1642 if(a==null){c.style.backgroundColor=b
1643 }else{a.isBright()?a.darken(0.2):a.brighten(0.2);
1644 c.style.backgroundColor=a.asHex()
1645 }},deactivate:function(){var a=this.getHTMLElement();
1646 if(a==null||!this.showingActive){return
1647 }a.style.backgroundColor=this.saveBackgroundColor;
1648 this.showingActive=false;
1649 this.saveBackgroundColor=null
1650 },showHover:function(){var a=this.getHTMLElement();
1651 if(a==null||this.showingHover){return
1652 }this.saveBorderWidth=a.style.borderWidth;
1653 this.saveBorderStyle=a.style.borderStyle;
1654 this.saveBorderColor=a.style.borderColor;
1655 this.showingHover=true;
1656 a.style.borderWidth="1px";
1657 a.style.borderStyle="solid";
1658 a.style.borderColor="#ffff00"
1659 },hideHover:function(){var a=this.getHTMLElement();
1660 if(a==null||!this.showingHover){return
1661 }a.style.borderWidth=this.saveBorderWidth;
1662 a.style.borderStyle=this.saveBorderStyle;
1663 a.style.borderColor=this.saveBorderColor;
1664 this.showingHover=false
1665 },canAccept:function(a){return true
1666 },accept:function(b){var d=this.getHTMLElement();
1671 a++){var c=b[a].getDroppedGUI();
1672 if(Rico.getStyle(c,"position")=="absolute"){c.style.position="static";
1677 Rico.KeywordSearch=function(b,a){this.initialize(b,a)
1679 Rico.KeywordSearch.prototype={initialize:function(c,b){this.id=c;
1680 Rico.extend(this,new Rico.Window(Rico.getPhraseById("keywordTitle"),b));
1681 Rico.addClass(this.content,"ricoKeywordSearch");
1682 Rico.extend(this.options,{listLength:10,maxSuggest:20,width:"12em"});
1684 Rico.onLoad(function(){a.atLoad()
1686 },atLoad:function(){this.searchField=Rico.createFormField(this.contentDiv,"input","text",this.id+"_search");
1687 this.searchField.style.display="block";
1688 this.searchField.style.width=this.options.width;
1689 Rico.eventBind(this.searchField,"keyup",Rico.eventHandle(this,"filterKeypress"),false);
1690 this.selectList=Rico.createFormField(this.contentDiv,"select",null,this.id+"_list");
1691 this.selectList.size=this.options.listLength;
1692 this.selectList.style.display="block";
1693 this.selectList.style.width=this.options.width;
1694 Rico.eventBind(this.selectList,"change",Rico.eventHandle(this,"listClick"),false);
1695 this.close=this.closePopup;
1697 },open:function(a,b){this.column=b;
1698 this.grid=this.column.liveGrid;
1699 this.searchField.value="";
1700 this.selectList.options.length=0;
1702 this.searchField.focus();
1703 this.selectValuesRequest("")
1704 },selectValuesRequest:function(c){var d=this.column.index;
1706 Rico.extend(b,this.grid.buffer.ajaxOptions);
1707 b.parameters={id:this.grid.tableId,offset:"0",page_size:this.options.maxSuggest,edit:d};
1708 b.parameters[this.grid.actionId]="query";
1709 if(c!=""&&c!="*"){if(c.indexOf("*")==-1){c="*"+c+"*"
1710 }b.parameters["f[1][op]"]="LIKE";
1711 b.parameters["f[1][len]"]=1;
1712 b.parameters["f[1][0]"]=c
1714 b.onComplete=function(e){a.selectValuesUpdate(e)
1716 new Rico.ajaxRequest(this.grid.buffer.dataSource,b)
1717 },selectValuesUpdate:function(b){var a=b.responseXML.getElementsByTagName("ajax-response");
1718 Rico.log("selectValuesUpdate: "+b.status);
1719 if(a==null||a.length!=1){return
1721 var h=a.getElementsByTagName("error");
1722 if(h.length>0){var f=Rico.getContentAsString(h[0],this.grid.buffer.isEncoded);
1723 Rico.log("Data provider returned an error:\n"+f);
1724 alert(Rico.getPhraseById("requestError",f));
1726 }this.selectList.options.length=0;
1727 a=a.getElementsByTagName("response")[0];
1728 var g=a.getElementsByTagName("rows")[0];
1729 var j=this.grid.buffer.dom2jstable(g);
1730 Rico.log("selectValuesUpdate: id="+this.selectList.id+" rows="+j.length);
1733 d++){if(j[d].length>0){var e=j[d][0];
1734 var c=(j[d].length>1)?j[d][1]:e;
1735 Rico.addSelectOption(this.selectList,e,c)
1736 }}},filterKeypress:function(c){var a=Rico.eventElement(c);
1737 if(typeof this.lastKeyFilter!="string"){this.lastKeyFilter=""
1738 }if(this.lastKeyFilter==a.value){return
1740 Rico.log("filterKeypress: "+this.index+" "+b);
1741 this.lastKeyFilter=b;
1742 this.selectValuesRequest(b)
1743 },listClick:function(c){var b=Rico.eventElement(c);
1744 if(b.tagName.toLowerCase()!="select"){return
1745 }if(this.returnValue){var a=b.options[b.selectedIndex];
1746 this.returnValue(a.value,a.innerHTML)
1749 Rico.TreeControl=function(c,b,a){this.initialize(c,b,a)
1751 Rico.TreeControl.prototype={initialize:function(d,c,b){Rico.extend(this,new Rico.Popup());
1752 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"});
1753 Rico.extend(this.options,b||{});
1756 this.close=this.closePopup;
1757 this.hoverSet=new Rico.HoverSet([]);
1759 Rico.onLoad(function(){a.atLoad()
1761 },atLoad:function(){this.treeDiv=document.createElement("div");
1762 this.treeDiv.id=this.id;
1763 this.treeDiv.className="ricoTree";
1764 if(Rico.theme.treeContent){Rico.addClass(this.treeDiv,Rico.theme.treeContent)
1765 }this.treeDiv.style.height=this.options.height;
1766 this.treeDiv.style.width=this.options.width;
1767 this.createContainer();
1768 this.content.className=Rico.theme.tree||"ricoTreeContainer";
1769 this.content.appendChild(this.treeDiv);
1770 if(this.options.showCheckBox){this.buttonDiv=document.createElement("div");
1771 this.buttonDiv.style.width=this.options.width;
1772 this.buttonDiv.className="ricoTreeButtons";
1773 if(Rico.getStyle(this.container,"position")=="absolute"){var a=document.createElement("span");
1774 a.innerHTML=RicoTranslate.getPhraseById("treeSave");
1775 Rico.setStyle(a,{"float":"left",cursor:"pointer"});
1776 this.buttonDiv.appendChild(a);
1777 Rico.eventBind(a,"click",Rico.eventHandle(this,"saveSelection"))
1778 }var a=document.createElement("span");
1779 a.innerHTML=RicoTranslate.getPhraseById("treeClear");
1780 Rico.setStyle(a,{"float":"right",cursor:"pointer"});
1781 this.buttonDiv.appendChild(a);
1782 this.content.appendChild(this.buttonDiv);
1783 Rico.eventBind(a,"click",Rico.eventHandle(this,"clrCheckBoxEvent"))
1785 },setTreeDiv:function(a){this.treeDiv=Rico.$(a);
1786 this.openPopup=function(){}
1787 },open:function(){this.openPopup();
1788 if(this.treeDiv.childNodes.length==0&&this.dataSource){this.loadXMLDoc()
1789 }},loadXMLDoc:function(c){var b={id:this.id};
1791 }Rico.log("Tree loadXMLDoc: "+this.id);
1793 new Rico.ajaxRequest(this.dataSource,{parameters:b,method:"get",onComplete:function(d){a.processResponse(d)
1795 },domID:function(b,a){return"RicoTree_"+a+"_"+this.id+"_"+b
1796 },processResponse:function(d){var b=d.responseXML.getElementsByTagName("ajax-response");
1797 if(b==null||b.length!=1){return
1798 }var f=b[0].getElementsByTagName("rows")[0];
1799 var g=f.getElementsByTagName("tr");
1803 e++){var l=g[e].getElementsByTagName("td");
1804 if(l.length<5){continue
1806 h[5]=this.options.leafIcon;
1809 c++){h[c]=Rico.getContentAsString(l[c],true)
1810 }h[3]=h[3].match(/^0|L$/i)?0:1;
1811 h[4]=parseInt(h[4]);
1815 e++){var a=(e<k.length-1)&&(k[e][0]==k[e+1][0]);
1816 this.addNode(k[e][0],k[e][1],k[e][2],k[e][3],k[e][4],k[e][5],!a)
1817 }},addNode:function(q,l,t,f,u,s,k){var h=Rico.$(this.domID(q,"Parent"));
1818 var v=Rico.$(this.domID(q,"Children"));
1819 var a=h?h.TreeLevel+1:0;
1820 var b=document.createElement("table");
1821 var m=document.createElement("div");
1822 m.id=this.domID(l,"Children");
1823 m.className="ricoTreeBranch";
1824 m.style.display=h?"none":"";
1828 b.id=this.domID(l,"Parent");
1831 b.TreeFetchedChildren=this.dataSource?false:true;
1832 var d=b.insertRow(0);
1836 r++){g[r]=d.insertCell(-1)
1837 }if(a>1){var e=h.getElementsByTagName("td");
1840 r++){g[r].innerHTML=e[r].innerHTML
1841 }var w=document.createElement("div");
1842 w.className="rico-icon rico-tree-"+(v.nextSibling&&this.options.showLines?"nodeline":"nodeblank");
1843 g[a-2].appendChild(w)
1844 }if(a>0){var c=k&&this.options.showLines?"last":"";
1845 var o=this.options.showLines?"node":"";
1846 if(this.options.showPlusMinus&&f){var w=document.createElement("div");
1848 w.style.cursor="pointer";
1849 Rico.eventBind(w,"click",Rico.eventHandle(this,"clickBranch"));
1850 w.className="rico-icon rico-tree-"+o+"p"+c;
1851 d.insertCell(-1).appendChild(w)
1852 }else{if(this.options.showLines){var w=document.createElement("div");
1853 w.className="rico-icon rico-tree-node"+c;
1854 d.insertCell(-1).appendChild(w)
1855 }}if(this.options.showFolders&&(f||(s&&s!="none"))){var w=document.createElement("div");
1856 if(!f){w.className=s
1858 w.style.cursor="pointer";
1859 Rico.eventBind(w,"click",Rico.eventHandle(this,"clickBranch"));
1860 w.className="rico-icon rico-folderclosed"
1861 }d.insertCell(-1).appendChild(w)
1862 }}if(u&&this.options.showCheckBox){var n=document.createElement("input");
1865 d.insertCell(-1).appendChild(n)
1866 }if(u&&!this.options.showCheckBox){var p=document.createElement("a");
1867 if(typeof u=="string"){p.href=u
1868 }else{p.href="javascript:void(0)";
1869 Rico.eventBind(p,"click",this.options.defaultAction)
1870 }this.hoverSet.add(p)
1871 }else{var p=document.createElement("p")
1872 }p.id=this.domID(l,"Desc");
1873 p.className="ricoTreeLevel"+a;
1874 switch(this.options.nodeIdDisplay){case"last":t+=" ("+l+")";
1876 case"first":t=l+" - "+t;
1878 case"tooltip":p.title=l;
1880 }p.appendChild(document.createTextNode(t));
1881 d.insertCell(-1).appendChild(p);
1882 var j=v||this.treeDiv;
1885 },nodeClick:function(c){var b=Rico.eventElement(c);
1886 if(this.returnValue){var a=this.domID("","Desc");
1887 this.returnValue(b.id.substr(a.length),b.innerHTML)
1889 },saveSelection:function(a){if(this.returnValue){this.returnValue(this.getCheckedItems())
1891 },getCheckedItems:function(){var b=this.treeDiv.getElementsByTagName("input");
1895 a++){if(b[a].type=="checkbox"&&b[a].checked){c.push(b[a].value)
1897 },setCheckBoxes:function(c){var b=this.treeDiv.getElementsByTagName("input");
1900 a++){if(b[a].type=="checkbox"){b[a].checked=c
1901 }}},clrCheckBoxEvent:function(a){Rico.eventStop(a);
1902 this.setCheckBoxes(false)
1903 },clickBranch:function(h){var g=Rico.eventElement(h);
1904 var f=Rico.getParentByTagName(g,"table");
1905 if(!f||!f.TreeContainer){return
1906 }var c=f.id.split("_");
1908 var b=Rico.$(c.join("_"));
1910 if(g.tagName=="DIV"){var d=Rico.visible(b);
1911 if(g.className.match(/node(p|m)(last)?$/)){g.className=g.className.replace(/nodep|nodem/,"node"+(d?"m":"p"))
1912 }else{if(g.className.match(/folder(open|closed)$/)){g.className=g.className.replace(/folder(open|closed)/,"folder"+(d?"open":"closed"))
1913 }else{if(g.className.match(/\b(m|p)$/)){g.className=g.className.replace(/(p|m)$/,d?"m":"p")
1914 }}}}if(!f.TreeFetchedChildren){f.TreeFetchedChildren=1;
1915 this.loadXMLDoc(g.name)
1917 if(typeof Rico=="undefined"){throw ("GridCommon requires the Rico JavaScript framework")
1918 }Rico.GridCommon={baseInit:function(){this.options={saveColumnInfo:{width:true,filter:false,sort:false},cookiePrefix:"RicoGrid.",allowColResize:true,windowResize:true,click:null,dblclick:null,contextmenu:null,menuEvent:null,defaultWidth:-1,scrollBarWidth:19,minScrollWidth:100,frozenColumns:0,exportWindow:"height=400,width=500,scrollbars=1,menubar=1,resizable=1,location=0,toolbar=0,status=0",exportStyleList:["background-color","color","text-align","font-weight","font-size","font-family"],exportImgTags:false,exportFormFields:true,FilterLocation:null,FilterAllToken:"___ALL___",columnSpecs:[]};
1920 this.headerColCnt=0;
1921 this.headerRowIdx=0;
1922 this.tabs=new Array(2);
1923 this.thead=new Array(2);
1924 this.tbody=new Array(2)
1925 },attachMenuEvents:function(){var a;
1926 if(!this.options.menuEvent||this.options.menuEvent=="none"){return
1927 }this.hideScroll=navigator.userAgent.match(/Macintosh\b.*\b(Firefox|Camino)\b/i)||(Rico.isOpera&&parseFloat(window.opera.version())<9.5);
1928 this.options[this.options.menuEvent]=Rico.eventHandle(this,"handleMenuClick");
1929 if(this.highlightDiv){switch(this.options.highlightElem){case"cursorRow":this.attachMenu(this.highlightDiv[0]);
1931 case"cursorCell":for(a=0;
1933 a++){this.attachMenu(this.highlightDiv[a])
1937 a++){this.attachMenu(this.tbody[a])
1938 }},attachMenu:function(a){if(this.options.click){Rico.eventBind(a,"click",this.options.click,false)
1939 }if(this.options.dblclick){if(Rico.isWebKit||Rico.isOpera){Rico.eventBind(a,"click",Rico.eventHandle(this,"handleDblClick"),false)
1940 }else{Rico.eventBind(a,"dblclick",this.options.dblclick,false)
1941 }}if(this.options.contextmenu){if(Rico.isOpera||Rico.isKonqueror){Rico.eventBind(a,"click",Rico.eventHandle(this,"handleContextMenu"),false)
1942 }else{Rico.eventBind(a,"contextmenu",this.options.contextmenu,false)
1943 }}},handleDblClick:function(b){var a=Rico.eventElement(b);
1944 if(this.dblClickElem==a){this.options.dblclick(b)
1945 }else{this.dblClickElem=a;
1946 this.safariTimer=Rico.runLater(300,this,"clearDblClick")
1947 }},clearDblClick:function(){this.dblClickElem=null
1948 },handleContextMenu:function(c){var a;
1949 if(typeof(c.which)=="number"){a=c.which
1950 }else{if(typeof(c.button)=="number"){a=c.button
1952 }}if(a==1&&c.ctrlKey){this.options.contextmenu(c)
1953 }},cancelMenu:function(){if(this.menu){this.menu.cancelmenu()
1954 }},getColumnInfo:function(f){Rico.log("getColumnInfo: len="+f.length);
1955 if(f.length==0){return 0
1956 }this.headerRowCnt=f.length;
1959 d<this.headerRowCnt;
1962 if(d>=this.hdrCells.length){this.hdrCells[d]=[]
1967 g.colSpan=a[h].colSpan||1;
1968 if(this.options.defaultWidth<0){g.initWidth=a[h].offsetWidth
1969 }this.hdrCells[d].push(g)
1970 }if(b.id.slice(-5)=="_main"){e=this.hdrCells[d].length;
1972 }}if(!e){this.headerRowIdx=this.headerRowCnt-1;
1973 e=this.hdrCells[this.headerRowIdx].length
1974 }Rico.log("getColumnInfo: colcnt="+e);
1976 },addHeadingRow:function(g){var a=this.headerRowCnt++;
1977 this.hdrCells[a]=[];
1980 e++){var k=this.thead[e].insertRow(-1);
1981 var f="ricoLG_hdg "+this.tableId+"_hdg"+a;
1984 var b=e==0?this.options.frozenColumns:this.headerColCnt-this.options.frozenColumns;
1987 j++){var d=k.insertCell(-1);
1988 var i=Rico.wrapChildren(d,"ricoLG_col");
1989 Rico.wrapChildren(i,"ricoLG_cell");
1990 this.hdrCells[a].push({cell:d,colSpan:1})
1992 },createColumnArray:function(b){this.direction=Rico.getStyle(this.outerDiv,"direction").toLowerCase();
1993 this.align=this.direction=="rtl"?["right","left"]:["left","right"];
1994 Rico.log("createColumnArray: dir="+this.direction);
1997 e<this.headerColCnt;
1998 e++){Rico.log("createColumnArray: c="+e);
1999 var d=e<this.options.frozenColumns?0:1;
2000 var a=new Rico[b](this,e,this.hdrCells[this.headerRowIdx][e],d);
2001 this.columns.push(a);
2002 if(e>0){this.columns[e-1].next=a
2004 Rico.runLater(100,this,"insertResizers")
2005 },insertResizers:function(){if(!this.options.allowColResize){return
2007 a<this.columns.length;
2008 a++){this.columns[a].insertResizer()
2009 }},createDivs:function(){Rico.log("createDivs start");
2010 this.outerDiv=this.createDiv("outer");
2011 if(Rico.theme.gridContainer){Rico.addClass(this.outerDiv,Rico.theme.gridContainer)
2012 }if(this.outerDiv.firstChild&&this.outerDiv.firstChild.tagName&&this.outerDiv.firstChild.tagName.toUpperCase()=="TABLE"){this.structTab=this.outerDiv.firstChild;
2013 this.structTabLeft=this.structTab.rows[0].cells[0];
2014 this.structTabUR=this.structTab.rows[0].cells[1];
2015 this.structTabLR=this.structTab.rows[1].cells[0]
2016 }else{this.structTab=document.createElement("table");
2017 this.structTab.border=0;
2018 this.structTab.cellPadding=0;
2019 this.structTab.cellSpacing=0;
2020 var b=this.structTab.insertRow(-1);
2022 this.structTabLeft=b.insertCell(-1);
2023 this.structTabLeft.rowSpan=2;
2024 this.structTabLeft.style.padding="0px";
2025 this.structTabLeft.style.border="none";
2026 var d=this.structTab.insertRow(-1);
2028 this.structTabUR=b.insertCell(-1);
2029 this.structTabUR.style.padding="0px";
2030 this.structTabUR.style.border="none";
2031 this.structTabLR=d.insertCell(-1);
2032 this.structTabLR.style.padding="0px";
2033 this.structTabLR.style.border="none";
2034 this.outerDiv.appendChild(this.structTab)
2035 }Rico.addClass(this.structTab,"ricoLG_StructTab");
2036 this.frozenTabs=this.createDiv("frozenTabs",this.structTabLeft);
2037 this.innerDiv=this.createDiv("inner",this.structTabUR);
2038 this.scrollDiv=this.createDiv("scroll",this.structTabLR);
2039 this.resizeDiv=this.createDiv("resize",this.outerDiv,true);
2040 this.messagePopup=new Rico.Popup();
2041 this.messagePopup.createContainer({hideOnEscape:false,hideOnClick:false,parent:this.outerDiv});
2042 this.messagePopup.content.className="ricoLG_messageDiv";
2043 if(Rico.theme.gridMessage){Rico.addClass(this.messagePopup.content,Rico.theme.gridMessage)
2044 }this.keywordPopup=new Rico.Window("",{zIndex:-1,parent:this.outerDiv});
2045 Rico.addClass(this.keywordPopup.container,"ricoLG_keywordDiv");
2046 var a=this.keywordPopup.contentDiv.appendChild(document.createElement("p"));
2047 a.innerHTML=Rico.getPhraseById("keywordPrompt");
2048 this.keywordBox=this.keywordPopup.contentDiv.appendChild(document.createElement("input"));
2049 this.keywordBox.size=20;
2050 Rico.eventBind(this.keywordBox,"keypress",Rico.eventHandle(this,"keywordKey"),false);
2051 this.keywordPopup.contentDiv.appendChild(Rico.floatButton("Checkmark",Rico.eventHandle(this,"processKeyword")));
2052 var c=this.keywordPopup.contentDiv.appendChild(document.createElement("p"));
2053 Rico.setStyle(c,{clear:"both"});
2054 Rico.log("createDivs end")
2055 },keywordKey:function(a){switch(Rico.eventKey(a)){case 27:this.closeKeyword();
2058 case 13:this.processKeyword();
2062 },openKeyword:function(a){this.keywordCol=a;
2063 this.keywordBox.value="";
2064 this.keywordPopup.setTitle(this.columns[a].displayName);
2065 this.keywordPopup.centerPopup();
2066 this.keywordBox.focus()
2067 },closeKeyword:function(){this.keywordPopup.closePopup();
2069 },processKeyword:function(){var a=this.keywordBox.value;
2070 this.closeKeyword();
2071 this.columns[this.keywordCol].setFilterKW(a)
2072 },createDiv:function(c,a,b){var e=this.tableId+"_"+c+"Div";
2073 var d=document.getElementById(e);
2074 if(!d){d=document.createElement("div");
2076 if(a){a.appendChild(d)
2077 }}d.className="ricoLG_"+c+"Div";
2080 },baseSizeDivs:function(){this.setOtherHdrCellWidths();
2081 if(this.options.frozenColumns){Rico.show(this.tabs[0]);
2082 Rico.show(this.frozenTabs);
2083 this.hdrHt=Math.max(Rico.nan2zero(this.thead[0].offsetHeight),this.thead[1].offsetHeight);
2084 this.dataHt=Math.max(Rico.nan2zero(this.tbody[0].offsetHeight),this.tbody[1].offsetHeight);
2085 this.frzWi=this.borderWidth(this.tabs[0])
2086 }else{Rico.hide(this.tabs[0]);
2087 Rico.hide(this.frozenTabs);
2089 this.hdrHt=this.thead[1].offsetHeight;
2090 this.dataHt=this.tbody[1].offsetHeight
2092 var c=this.borderWidth(this.columns[0].dataCell);
2093 Rico.log("baseSizeDivs "+this.tableId+": hdrHt="+this.hdrHt+" dataHt="+this.dataHt);
2094 Rico.log(this.tableId+" frzWi="+this.frzWi+" borderWi="+c);
2096 b<this.options.frozenColumns;
2097 b++){if(this.columns[b].visible){this.frzWi+=parseInt(this.columns[b].colWidth,10)+c
2098 }}this.scrTabWi=this.borderWidth(this.tabs[1]);
2099 this.scrTabWi0=this.scrTabWi;
2100 Rico.log("scrTabWi: "+this.scrTabWi);
2101 for(b=this.options.frozenColumns;
2102 b<this.columns.length;
2103 b++){if(this.columns[b].visible){this.scrTabWi+=parseInt(this.columns[b].colWidth,10)+c
2104 }}this.scrWi=this.scrTabWi+this.options.scrollBarWidth;
2105 if(this.sizeTo=="parent"){if(Rico.isIE){Rico.hide(this.outerDiv)
2106 }d=this.outerDiv.parentNode.offsetWidth;
2107 if(Rico.isIE){Rico.show(this.outerDiv)
2108 }}else{d=Rico.windowWidth()-this.options.scrollBarWidth-8
2109 }if(this.outerDiv.parentNode.clientWidth>0){d=Math.min(this.outerDiv.parentNode.clientWidth,d)
2110 }var a=this.frzWi+this.scrWi-d;
2111 Rico.log("baseSizeDivs "+this.tableId+": scrWi="+this.scrWi+" wiLimit="+d+" overage="+a+" clientWidth="+this.outerDiv.parentNode.clientWidth);
2112 if(a>0&&this.options.frozenColumns<this.columns.length){this.scrWi=Math.max(this.scrWi-a,this.options.minScrollWidth)
2113 }this.scrollDiv.style.width=this.scrWi+"px";
2114 this.frozenTabs.style.width=this.frzWi+"px";
2115 this.outerDiv.style.width=(this.frzWi+this.scrWi)+"px"
2116 },borderWidth:function(c){var a=Rico.nan2zero(Rico.getStyle(c,"borderLeftWidth"));
2117 var b=Rico.nan2zero(Rico.getStyle(c,"borderRightWidth"));
2118 Rico.log((c.id||c.tagName)+" borderWidth: L="+a+", R="+b);
2120 },setOtherHdrCellWidths:function(){var k,g,f,a,l,b,m,d,e,h;
2122 a<this.hdrCells.length;
2123 a++){if(a==this.headerRowIdx){continue
2124 }Rico.log("setOtherHdrCellWidths: r="+a);
2126 while(g<this.headerColCnt&&k<this.hdrCells[a].length){b=this.hdrCells[a][k];
2131 f++,g++){if(this.columns[g].hdrCell.style.display=="none"){e--
2132 }else{if(this.columns[g].hdrColDiv.style.display!="none"){l+=parseInt(this.columns[g].colWidth,10)
2133 }}}if(!b.hdrColDiv||!b.hdrCellDiv){h=m.getElementsByTagName("div");
2134 b.hdrColDiv=(h.length<1)?Rico.wrapChildren(m,"ricoLG_col"):h[0];
2135 b.hdrCellDiv=(h.length<2)?Rico.wrapChildren(b.hdrColDiv,"ricoLG_cell"):h[1]
2136 }if(e==0){m.style.display="none"
2137 }else{if(l==0){b.hdrColDiv.style.display="none";
2139 }else{m.style.display="";
2140 b.hdrColDiv.style.display="";
2142 b.hdrColDiv.style.width=l+"px"
2144 }}},initFilterImage:function(a){this.filterAnchor=document.getElementById(this.tableId+"_filterLink");
2145 if(!this.filterAnchor){return
2146 }this.filterRows=Rico.select("tr."+this.tableId+"_hdg"+a);
2147 if(this.filterRows.length!=2){return
2150 c++){d[c]=Rico.select(".ricoLG_cell",this.filterRows[c])
2151 }this.filterElements=d[0].concat(d[1]);
2152 this.saveHeight=this.filterElements[0].offsetHeight;
2153 var e=Rico.getStyle(this.filterElements[0],"paddingTop");
2154 var b=Rico.getStyle(this.filterElements[0],"paddingBottom");
2155 if(e){this.saveHeight-=parseInt(e,10)
2156 }if(b){this.saveHeight-=parseInt(b,10)
2158 this.setFilterImage(false)
2159 },toggleFilterRow:function(){if(Rico.visible(this.filterRows[0])){this.slideFilterUp()
2160 }else{this.slideFilterDown()
2161 }},setFilterImage:function(b){var a=Rico.getPhraseById((b?"show":"hide")+"FilterRow");
2162 this.filterAnchor.innerHTML='<img src="'+Rico.imgDir+"tableFilter"+(b?"Expand":"Collapse")+'.gif" alt="'+a+'" border="0">'
2163 },cell:function(a,b){return(0<=b&&b<this.columns.length&&a>=0)?this.columns[b].cell(a):null
2164 },availHt:function(){var a=Rico.cumulativeOffset(this.outerDiv);
2165 return Rico.windowHeight()-a.top-2*this.options.scrollBarWidth-15
2166 },setHorizontalScroll:function(){var a=(-this.scrollDiv.scrollLeft)+"px";
2167 this.hdrTabs[1].style.marginLeft=a
2168 },pluginScroll:function(){if(this.scrollPluggedIn){return
2169 }Rico.eventBind(this.scrollDiv,"scroll",this.scrollEventFunc,false);
2170 this.scrollPluggedIn=true
2171 },unplugScroll:function(){Rico.eventUnbind(this.scrollDiv,"scroll",this.scrollEventFunc,false);
2172 this.scrollPluggedIn=false
2173 },hideMsg:function(){this.messagePopup.closePopup()
2174 },showMsg:function(a){this.messagePopup.setContent(a);
2175 this.messagePopup.centerPopup();
2176 Rico.log("showMsg: "+a)
2177 },listInvisible:function(b){var c=[];
2179 a<this.columns.length;
2180 a++){if(!this.columns[a].visible){c.push(b?this.columns[a][b]:this.columns[a])
2182 },firstVisible:function(){for(var a=0;
2183 a<this.columns.length;
2184 a++){if(this.columns[a].visible){return a
2186 },showAll:function(){var b=this.listInvisible();
2189 a++){b[a].showColumn()
2190 }},chooseColumns:function(){this.menu.cancelmenu();
2192 if(!this.columnChooser){Rico.log("creating columnChooser");
2193 f=Rico.getStyle(this.outerDiv.offsetParent,"zIndex");
2194 if(typeof f!="number"){f=0
2195 }this.columnChooser=new Rico.Window(Rico.getPhraseById("gridChooseCols"),{zIndex:f+2,parent:this.outerDiv});
2196 Rico.addClass(this.columnChooser.container,"ricoLG_chooserDiv");
2197 c=this.columnChooser.contentDiv;
2199 a<this.columns.length;
2200 a++){b=this.columns[a];
2201 e=c.appendChild(document.createElement("div"));
2202 b.ChooserBox=Rico.createFormField(e,"input","checkbox");
2203 d=e.appendChild(document.createElement("span"));
2204 d.innerHTML=b.displayName;
2205 Rico.eventBind(b.ChooserBox,"click",Rico.eventHandle(b,"chooseColumn"),false)
2206 }}Rico.log("opening columnChooser");
2207 this.columnChooser.openPopup(3,this.hdrHt+3);
2209 a<this.columns.length;
2210 a++){this.columns[a].ChooserBox.checked=this.columns[a].visible;
2211 this.columns[a].ChooserBox.disabled=!this.columns[a].canHideShow()
2212 }},blankRow:function(a){for(var b=0;
2213 b<this.columns.length;
2214 b++){this.columns[b].clearCell(a)
2215 }},getExportStyles:function(a){var e=this.options.exportStyleList;
2216 var b=Rico.getStyle(a,"backgroundImage");
2217 if(!b||b=="none"){return e
2220 c++){if(e[c]!="background-color"&&e[c]!="color"){d.push(e[c])
2222 },exportStart:function(){var a,h,f,d,b,e,k,l;
2223 var g=this.getExportStyles(this.thead[0]);
2225 this.exportText="<html><head></head><body><table border='1' cellspacing='0'>";
2227 h<this.columns.length;
2228 h++){if(this.columns[h].visible){this.exportText+="<col width='"+parseInt(this.columns[h].colWidth,10)+"'>"
2229 }}this.exportText+="<thead style='display: table-header-group;'>";
2230 if(this.exportHeader){this.exportText+=this.exportHeader
2232 a<this.hdrCells.length;
2233 a++){if(this.hdrCells[a].length==0||!Rico.visible(this.hdrCells[a][0].cell.parentNode)){continue
2234 }this.exportText+="<tr>";
2236 h<this.hdrCells[a].length;
2237 h++){b=this.hdrCells[a][h];
2241 d++,f++){if(!this.columns[f].visible){e--
2242 }}if(e>0){k=Rico.select(".ricoLG_cell",b.cell);
2243 l=k&&k.length>0?k[0]:b.cell;
2244 this.exportText+="<td style='"+this.exportStyle(l,g)+"'";
2245 if(b.colSpan>1){this.exportText+=" colspan='"+e+"'"
2246 }this.exportText+=">"+Rico.getInnerText(l,!this.options.exportImgTags,!this.options.exportFormFields,"NoExport")+"</td>"
2247 }}this.exportText+="</tr>"
2248 }this.exportText+="</thead><tbody>"
2249 },exportFinish:function(){if(this.hideMsg){this.hideMsg()
2250 }window.status=Rico.getPhraseById("exportComplete");
2251 if(this.exportRows.length>0){this.exportText+="<tr>"+this.exportRows.join("</tr><tr>")+"</tr>"
2252 }if(this.exportFooter){this.exportText+=this.exportFooter
2253 }this.exportText+="</tbody></table></body></html>";
2254 if(this.cancelMenu){this.cancelMenu()
2255 }var a=window.open("","_blank",this.options.exportWindow);
2256 if(a==null){alert(Rico.getPhraseById("disableBlocker"))
2257 }else{a.document.open();
2258 a.document.write(this.exportText);
2260 }this.exportText=undefined;
2261 this.exportRows=undefined
2262 },exportStyle:function(d,g){for(var b=0,c="";
2264 b++){try{var a=Rico.getStyle(d,g[b]);
2265 if(a){c+=g[b]+":"+a+";"
2266 }}catch(f){}}return c
2267 },getCookie:function(){var k=Rico.getCookie(this.options.cookiePrefix+this.tableId);
2269 }var f=k.split(",");
2272 g++){var a=f[g].split(":");
2273 if(a.length!=2){continue
2274 }var h=parseInt(a[0].slice(1),10);
2275 if(h<0||h>=this.columns.length){continue
2276 }var e=this.columns[h];
2277 switch(a[0].charAt(0)){case"w":e.setColWidth(a[1]);
2280 case"h":if(a[1].toLowerCase()=="true"){e.hideshow(true,true)
2281 }else{e.hideshow(false,true)
2283 case"s":if(!this.options.saveColumnInfo.sort||!e.sortable){break
2286 case"f":if(!this.options.saveColumnInfo.filter||!e.filterable){break
2287 }var d=a[1].split("~");
2288 e.filterOp=d.shift();
2290 e.filterType=Rico.ColumnConst.USERFILTER;
2293 b++){e.filterValues.push(unescape(d[b]))
2295 }}},setCookie:function(){var d=[];
2297 e<this.columns.length;
2298 e++){var c=this.columns[e];
2299 if(this.options.saveColumnInfo.width){if(c.customWidth){d.push("w"+e+":"+c.colWidth)
2300 }if(c.customVisible){d.push("h"+e+":"+c.visible)
2301 }}if(this.options.saveColumnInfo.sort){if(c.currentSort!=Rico.ColumnConst.UNSORTED){d.push("s"+e+":"+c.currentSort)
2302 }}if(this.options.saveColumnInfo.filter&&c.filterType==Rico.ColumnConst.USERFILTER){var b=[c.filterOp];
2304 a<c.filterValues.length;
2305 a++){b.push(escape(c.filterValues[a]))
2306 }d.push("f"+e+":"+b.join("~"))
2307 }}Rico.setCookie(this.options.cookiePrefix+this.tableId,d.join(","),this.options.cookieDays,this.options.cookiePath,this.options.cookieDomain)
2309 Rico.ColumnConst={UNFILTERED:0,SYSTEMFILTER:1,USERFILTER:2,UNSORTED:0,SORT_ASC:"ASC",SORT_DESC:"DESC",MINWIDTH:10};
2310 Rico.TableColumnBase=function(){};
2311 Rico.TableColumnBase.prototype={baseInit:function(h,g,e,d){Rico.log("TableColumnBase.baseInit index="+g+" tabIdx="+d);
2314 this.hideWidth=Rico.isKonqueror||Rico.isWebKit||h.headerRowCnt>1?5:2;
2315 this.options=h.options;
2317 this.hdrCell=e.cell;
2318 this.body=document.getElementsByTagName("body")[0];
2319 this.displayName=this.getDisplayName(this.hdrCell);
2320 var c=this.hdrCell.getElementsByTagName("div");
2321 this.hdrColDiv=(c.length<1)?Rico.wrapChildren(this.hdrCell,"ricoLG_col"):c[0];
2322 this.hdrCellDiv=(c.length<2)?Rico.wrapChildren(this.hdrColDiv,"ricoLG_cell"):c[1];
2323 var f=d==0?g:g-h.options.frozenColumns;
2324 this.dataCell=h.tbody[d].rows[0].cells[f];
2325 c=this.dataCell.getElementsByTagName("div");
2326 this.dataColDiv=(c.length<1)?Rico.wrapChildren(this.dataCell,"ricoLG_col"):c[0];
2327 this.mouseDownHandler=Rico.eventHandle(this,"handleMouseDown");
2328 this.mouseMoveHandler=Rico.eventHandle(this,"handleMouseMove");
2329 this.mouseUpHandler=Rico.eventHandle(this,"handleMouseUp");
2330 this.mouseOutHandler=Rico.eventHandle(this,"handleMouseOut");
2331 this.format={type:"text"};
2332 var b=h.options.columnSpecs[g];
2333 if(typeof b=="object"){Rico.extend(this.format,b)
2334 }Rico.addClass(this.dataColDiv,this.colClassName());
2336 if(typeof this.format.visible=="boolean"){this.visible=this.format.visible
2337 }this.sortable=typeof this.format.canSort=="boolean"?this.format.canSort:h.options.canSortDefault;
2338 this.currentSort=Rico.ColumnConst.UNSORTED;
2339 this.filterable=typeof this.format.canFilter=="boolean"?this.format.canFilter:h.options.canFilterDefault;
2340 this.filterType=Rico.ColumnConst.UNFILTERED;
2341 this.hideable=typeof this.format.canHide=="boolean"?this.format.canHide:h.options.canHideDefault;
2343 switch(typeof this.format.width){case"number":a=this.format.width;
2345 case"string":a=parseInt(this.format.width,10);
2347 default:a=e.initWidth;
2349 }a=(typeof(a)=="number")?Math.max(a,Rico.ColumnConst.MINWIDTH):h.options.defaultWidth;
2350 this.setColWidth(a);
2351 if(!this.visible){this.setDisplay("none")
2352 }},colClassName:function(){return this.format.ClassName?this.format.ClassName:this.liveGrid.tableId+"_col"+this.index
2353 },insertResizer:function(){if(this.format.noResize){return
2354 }var a=document.createElement("div");
2355 a.className="ricoLG_Resize";
2356 a.style[this.liveGrid.align[1]]="0px";
2357 this.hdrCellDiv.appendChild(a);
2358 Rico.eventBind(a,"mousedown",this.mouseDownHandler,false)
2359 },getDisplayName:function(b){var c=b.getElementsByTagName("A");
2360 var a=c.length>0?c[0].innerHTML:Rico.stripTags(b.innerHTML);
2362 },_clear:function(a){a.innerHTML=" "
2363 },clearCell:function(b){var a=this.cell(b);
2365 if(this.liveGrid.buffer&&this.liveGrid.buffer.options.acceptStyle){a.style.cssText=""
2366 }},dataTable:function(){return this.liveGrid.tabs[this.tabIdx]
2367 },numRows:function(){return this.dataColDiv.childNodes.length
2368 },clearColumn:function(){var b=this.numRows();
2371 a++){this.clearCell(a)
2372 }},cell:function(a){return this.dataColDiv.childNodes[a]
2373 },getFormattedValue:function(c,a,d,b){return Rico.getInnerText(this.cell(c),a,d,b)
2374 },setColWidth:function(a){if(typeof a=="number"){a=parseInt(a,10);
2375 if(a<Rico.ColumnConst.MINWIDTH){return
2377 }Rico.log("setColWidth "+this.index+": "+a);
2379 this.hdrColDiv.style.width=a;
2380 this.dataColDiv.style.width=a
2381 },pluginMouseEvents:function(){if(this.mousePluggedIn==true){return
2382 }Rico.eventBind(this.body,"mousemove",this.mouseMoveHandler,false);
2383 Rico.eventBind(this.body,"mouseup",this.mouseUpHandler,false);
2384 Rico.eventBind(this.body,"mouseout",this.mouseOutHandler,false);
2385 this.mousePluggedIn=true
2386 },unplugMouseEvents:function(){Rico.eventUnbind(this.body,"mousemove",this.mouseMoveHandler,false);
2387 Rico.eventUnbind(this.body,"mouseup",this.mouseUpHandler,false);
2388 Rico.eventUnbind(this.body,"mouseout",this.mouseOutHandler,false);
2389 this.mousePluggedIn=false
2390 },handleMouseDown:function(b){this.resizeStart=Rico.eventClient(b).x;
2391 this.origWidth=parseInt(this.colWidth,10);
2392 var a=Rico.positionedOffset(this.hdrCell);
2393 if(this.liveGrid.direction=="rtl"){this.edge=a.left;
2394 switch(this.tabIdx){case 0:this.edge+=this.liveGrid.innerDiv.offsetWidth;
2396 case 1:this.edge-=this.liveGrid.scrollDiv.scrollLeft;
2398 }}else{this.edge=a.left+this.hdrCell.offsetWidth;
2399 if(this.tabIdx>0){this.edge+=Rico.nan2zero(this.liveGrid.tabs[0].offsetWidth)
2400 }}this.liveGrid.resizeDiv.style.left=this.edge+"px";
2401 this.liveGrid.resizeDiv.style.display="";
2402 this.liveGrid.outerDiv.style.cursor="e-resize";
2403 this.tmpHighlight=this.liveGrid.highlightEnabled;
2404 this.liveGrid.highlightEnabled=false;
2405 this.pluginMouseEvents();
2407 },handleMouseMove:function(b){var c=Rico.eventClient(b).x-this.resizeStart;
2408 var a=(this.liveGrid.direction=="rtl")?this.origWidth-c:this.origWidth+c;
2409 if(a<Rico.ColumnConst.MINWIDTH){return
2410 }this.liveGrid.resizeDiv.style.left=(this.edge+c)+"px";
2413 },handleMouseUp:function(a){this.unplugMouseEvents();
2414 Rico.log("handleMouseUp "+this.liveGrid.tableId);
2415 this.liveGrid.outerDiv.style.cursor="";
2416 this.liveGrid.resizeDiv.style.display="none";
2417 this.setColWidth(this.colWidth);
2418 this.customWidth=true;
2419 this.liveGrid.setCookie();
2420 this.liveGrid.highlightEnabled=this.tmpHighlight;
2421 this.liveGrid.sizeDivs();
2423 },handleMouseOut:function(b){var a=Rico.eventRelatedTarget(b)||b.toElement;
2424 while(a!=null&&a.nodeName.toLowerCase()!="body"){a=a.parentNode
2425 }if(a!=null&&a.nodeName.toLowerCase()=="body"){return true
2426 }this.handleMouseUp(b);
2428 },setDisplay:function(a){this.hdrCell.style.display=a;
2429 this.hdrColDiv.style.display=a;
2430 this.dataCell.style.display=a;
2431 this.dataColDiv.style.display=a
2432 },hideshow:function(b,a){this.setDisplay(b?"":"none");
2433 this.liveGrid.cancelMenu();
2435 this.customVisible=true;
2437 }this.liveGrid.setCookie();
2438 this.liveGrid.sizeDivs()
2439 },hideColumn:function(){Rico.log("hideColumn "+this.liveGrid.tableId);
2440 this.hideshow(false,false)
2441 },showColumn:function(){Rico.log("showColumn "+this.liveGrid.tableId);
2442 this.hideshow(true,false)
2443 },chooseColumn:function(b){var a=Rico.eventElement(b);
2444 this.hideshow(a.checked,false)
2445 },setImage:function(){if(this.currentSort==Rico.ColumnConst.SORT_ASC){this.imgSort.style.display="inline-block";
2446 this.imgSort.className=Rico.theme.sortAsc||"rico-icon ricoLG_sortAsc"
2447 }else{if(this.currentSort==Rico.ColumnConst.SORT_DESC){this.imgSort.style.display="inline-block";
2448 this.imgSort.className=Rico.theme.sortDesc||"rico-icon ricoLG_sortDesc"
2449 }else{this.imgSort.style.display="none"
2450 }}if(this.filterType==Rico.ColumnConst.USERFILTER){this.imgFilter.style.display="inline-block";
2451 this.imgFilter.title=this.getFilterText()
2452 }else{this.imgFilter.style.display="none"
2453 }},canHideShow:function(){return this.hideable
2455 if(typeof Rico=="undefined"){throw ("SimpleGrid requires the Rico JavaScript framework")
2456 }Rico.SimpleGrid=function(b,a){this.initialize(b,a)
2458 Rico.SimpleGrid.prototype={initialize:function(b,a){Rico.extend(this,Rico.GridCommon);
2460 Rico.setDebugArea(b+"_debugmsgs");
2461 Rico.extend(this.options,a||{});
2463 Rico.log("SimpleGrid initialize start: "+b);
2465 this.hdrTabs=new Array(2);
2466 this.simpleGridInit();
2467 Rico.log("SimpleGrid initialize end: "+b)
2468 },simpleGridInit:function(){var a;
2471 a++){Rico.log("simpleGridInit "+a);
2472 this.tabs[a]=Rico.$(this.tableId+"_tab"+a);
2473 if(!this.tabs[a]){return
2474 }this.hdrTabs[a]=Rico.$(this.tableId+"_tab"+a+"h");
2475 if(!this.hdrTabs[a]){return
2476 }this.thead[a]=this.hdrTabs[a];
2477 this.tbody[a]=this.tabs[a];
2478 this.headerColCnt=this.getColumnInfo(this.hdrTabs[a].rows);
2479 if(a==0){this.options.frozenColumns=this.headerColCnt
2480 }if(Rico.theme.gridheader){Rico.addClass(this.thead[a],Rico.theme.gridheader)
2481 }if(Rico.theme.gridcontent){Rico.addClass(this.tbody[a],Rico.theme.gridcontent)
2482 }}if(this.headerColCnt==0){alert('ERROR: no columns found in "'+this.tableId+'"');
2484 }this.createColumnArray("SimpleGridColumn");
2485 this.pageSize=this.columns[0].dataColDiv.childNodes.length;
2487 if(typeof(this.options.FilterLocation)=="number"){this.createFilters(this.options.FilterLocation)
2488 }this.attachMenuEvents();
2489 this.scrollEventFunc=Rico.eventHandle(this,"handleScroll");
2490 this.pluginScroll();
2491 if(this.options.windowResize){Rico.eventBind(window,"resize",Rico.eventHandle(this,"sizeDivs"),false)
2492 }},filterId:function(a){return"RicoFilter_"+this.tableId+"_"+a
2493 },createFilters:function(a){if(a<0){a=this.addHeadingRow();
2496 g<this.headerColCnt;
2497 g++){var d=this.columns[g];
2499 if(typeof e.filterUI!="string"){continue
2500 }var k=this.hdrCells[a][g].cell;
2501 var j,b=this.filterId(g);
2502 var h=k.getElementsByTagName("div");
2503 switch(e.filterUI.charAt(0)){case"t":j=Rico.createFormField(h[1],"input","text",b,b);
2504 var m=e.filterUI.match(/\d+/);
2505 j.maxLength=e.Length||50;
2506 j.size=m?parseInt(m,10):10;
2507 Rico.eventBind(j,"keyup",Rico.eventHandle(d,"filterKeypress"),false);
2509 case"s":j=Rico.createFormField(h[1],"select",null,b);
2510 Rico.addSelectOption(j,this.options.FilterAllToken,Rico.getPhraseById("filterAll"));
2511 this.getFilterValues(d);
2512 var l=Rico.keys(d.filterHash);
2516 f++){Rico.addSelectOption(j,l[f],l[f]||Rico.getPhraseById("filterBlank"))
2517 }Rico.eventBind(j,"change",Rico.eventHandle(d,"filterChange"),false);
2519 }}this.initFilterImage(a)
2520 },getFilterValues:function(b){var e={};
2524 c++){var a=Rico.getInnerText(b.cell(c));
2529 },applyFilters:function(){var b=[];
2531 f<this.columns.length;
2532 f++){if(this.columns[f].filterRows){b.push(this.columns[f].filterRows)
2533 }}if(b.length==0){this.showAllRows();
2540 a++){if(b[a].indexOf(d)==-1){e=false;
2542 }}if(e){this.showRow(d)
2543 }else{this.hideRow(d)
2545 },handleScroll:function(b){var a=(-this.scrollDiv.scrollTop)+"px";
2546 this.tabs[0].style.marginTop=a;
2547 this.setHorizontalScroll()
2548 },registerScrollMenu:function(a){if(!this.menu){this.menu=a
2550 a.showmenu=a.showSimpleMenu;
2551 a.showSubMenu=a.showSimpleSubMenu;
2552 a.createDiv(this.outerDiv)
2553 },handleMenuClick:function(a){if(!this.menu){return
2555 this.menuCell=Rico.getParentByTagName(Rico.eventElement(a),"div");
2556 this.highlightEnabled=false;
2557 if(this.hideScroll){this.scrollDiv.style.overflow="hidden"
2558 }if(this.menu.buildGridMenu){this.menu.buildGridMenu(this.menuCell)
2559 }this.menu.showmenu(a,this.closeMenu.bind(this))
2560 },closeMenu:function(){if(this.hideScroll){this.scrollDiv.style.overflow=""
2561 }this.highlightEnabled=true
2562 },sizeDivs:function(){if(this.outerDiv.offsetParent.style.display=="none"){return
2563 }this.baseSizeDivs();
2564 var c=Math.max(this.options.maxHt||this.availHt(),50);
2565 var b=Math.min(this.hdrHt+this.dataHt,c);
2566 Rico.log("sizeDivs "+this.tableId+": hdrHt="+this.hdrHt+" dataHt="+this.dataHt);
2567 this.dataHt=b-this.hdrHt;
2568 if(this.scrWi>0){this.dataHt+=this.options.scrollBarWidth
2569 }this.scrollDiv.style.height=this.dataHt+"px";
2570 this.frozenTabs.style.height=this.scrollDiv.clientHeight+"px";
2572 this.innerDiv.style.width=(this.scrWi-this.options.scrollBarWidth+a)+"px";
2574 this.resizeDiv.style.height=b+"px";
2576 },printVisible:function(){this.showMsg(Rico.getPhraseById("exportInProgress"));
2577 Rico.runLater(10,this,"_printVisible")
2578 },_printVisible:function(){this.exportStart();
2579 var f=this.getExportStyles(this.tbody[0]);
2582 e++){if(this.columns[0].cell(e).style.display=="none"){continue
2585 g<this.columns.length;
2586 g++){var b=this.columns[g];
2587 if(b.visible){var a=b.getFormattedValue(e,!this.options.exportImgTags,!this.options.exportFormFields,"NoExport");
2588 if(b.format.exportPrefix){a=b.format.exportPrefix+a
2589 }if(a==""){a=" "
2590 }d+="<td style='"+this.exportStyle(b.cell(e),f)+"'>"+a+"</td>"
2591 }}this.exportRows.push(d)
2592 }this.exportFinish()
2593 },hideRow:function(a){if(this.columns[0].cell(a).style.display=="none"){return
2595 b<this.columns.length;
2596 b++){this.columns[b].cell(a).style.display="none"
2597 }},showRow:function(a){if(this.columns[0].cell(a).style.display==""){return
2599 b<this.columns.length;
2600 b++){this.columns[b].cell(a).style.display=""
2601 }},searchRows:function(h,e,c){if(!e){return
2602 }var f=new RegExp(e);
2603 var d=this.columns[h].numRows();
2606 g++){var b=this.cell(g,h).innerHTML;
2607 var a=(b.match(f)!=null);
2608 if(a!=c){this.hideRow(g)
2611 },showAllRows:function(){for(var a=0;
2613 a++){this.showRow(a)
2615 },openPopup:function(d,e){while(d&&!Rico.hasClass(d,"ricoLG_cell")){d=d.parentNode
2616 }if(!d){return false
2617 }var f=Rico.getParentByTagName(d,"td");
2618 var c=Math.floor(f.offsetLeft-this.scrollDiv.scrollLeft+f.offsetWidth/2);
2619 if(this.direction=="rtl"){if(c>this.width){c-=this.width
2620 }}else{if(c+this.width+this.options.margin>this.scrollDiv.clientWidth){c-=this.width
2621 }}e.divPopup.style.visibility="hidden";
2622 e.divPopup.style.display="block";
2623 var b=e.divPopup.offsetHeight;
2624 var a=Math.floor(d.offsetTop-this.scrollDiv.scrollTop+d.offsetHeight/2);
2625 if(a+b+e.options.margin>this.scrollDiv.clientHeight){a=Math.max(a-b,0)
2626 }e.openPopup(this.frzWi+c,this.hdrHt+a);
2627 e.divPopup.style.visibility="visible";
2630 if(Rico.Menu){Rico.extend(Rico.Menu.prototype,{showSimpleMenu:function(b,c){Rico.eventStop(b);
2632 if(this.div.childNodes.length==0){this.cancelmenu();
2634 }var a=Rico.eventElement(b);
2635 this.grid.openPopup(a,this);
2637 },showSimpleSubMenu:function(b,c){if(this.openSubMenu){this.hideSubMenu()
2638 }this.openSubMenu=c;
2639 this.openMenuAnchor=b;
2640 if(b.className=="ricoSubMenu"){b.className="ricoSubMenuOpen"
2641 }var e=parseInt(this.div.style.top,10);
2642 var d=parseInt(this.div.style.left,10);
2643 c.openPopup(d+b.offsetWidth,e+b.offsetTop);
2644 c.div.style.visibility="visible"
2646 }Rico.SimpleGridColumn=function(a,d,c,b){this.initialize(a,d,c,b)
2648 Rico.SimpleGridColumn.prototype={initialize:function(a,d,c,b){Rico.extend(this,new Rico.TableColumnBase());
2649 this.baseInit(a,d,c,b)
2650 },setUnfiltered:function(){this.filterRows=null
2651 },filterChange:function(a){var b=Rico.eventElement(a);
2652 if(b.value==this.liveGrid.options.FilterAllToken){this.setUnfiltered()
2653 }else{this.filterRows=this.filterHash[b.value]
2654 }this.liveGrid.applyFilters()
2655 },filterKeypress:function(f){var a=Rico.eventElement(f);
2656 if(typeof this.lastKeyFilter!="string"){this.lastKeyFilter=""
2657 }if(this.lastKeyFilter==a.value){return
2659 Rico.log("filterKeypress: "+this.index+" "+b);
2660 this.lastKeyFilter=b;
2661 if(b){b=b.replace("\\","\\\\");
2662 b=b.replace("(","\\(").replace(")","\\)");
2663 b=b.replace(".","\\.");
2664 if(this.format.filterUI.indexOf("^")>0){b="^"+b
2665 }var d=new RegExp(b,"i");
2667 var h=this.numRows();
2670 c++){var g=Rico.getInnerText(this.cell(c));
2671 if(g.match(d)){this.filterRows.push(c)
2672 }}}else{this.setUnfiltered()
2673 }this.liveGrid.applyFilters()
2675 if(!Rico.Buffer){Rico.Buffer={}
2676 }Rico.Buffer.Base=function(b,a){this.initialize(b,a)
2678 Rico.Buffer.Base.prototype={initialize:function(b,a){this.clear();
2679 this.updateInProgress=false;
2681 this.rcvdRowCount=false;
2682 this.foundRowCount=false;
2684 this.rowcntContent="";
2686 this.options={fixedHdrRows:0,canFilter:true,isEncoded:true,acceptStyle:false,canRefresh:false};
2687 Rico.extend(this.options,a||{});
2688 if(b){this.loadRowsFromTable(b,this.options.fixedHdrRows);
2689 b.parentNode.removeChild(b)
2691 }},registerGrid:function(a){this.liveGrid=a
2692 },setTotalRows:function(a){if(typeof(a)!="number"){a=this.size
2693 }if(this.totalRows==a){return
2695 if(!this.liveGrid){return
2696 }Rico.log("setTotalRows, newTotalRows="+a);
2697 switch(this.liveGrid.sizeTo){case"data":this.liveGrid.resizeWindow();
2699 case"datamax":this.liveGrid.setPageSize(a);
2701 default:this.liveGrid.updateHeightDiv();
2703 }},loadRowsFromTable:function(h,g){var e=[];
2704 var a=h.getElementsByTagName("tr");
2708 var c=a[d].getElementsByTagName("td");
2711 b++){f[b]=c[b].innerHTML
2714 },loadRowsFromArray:function(b){for(var c=0;
2718 a++){b[c][a]=b[c][a].toString()
2720 },loadRows:function(a){this.baseRows=a;
2722 this.size=this.baseRows.length
2723 },dom2jstable:function(f){Rico.log("dom2jstable: encoded="+this.options.isEncoded);
2725 var a=f.getElementsByTagName("tr");
2729 var c=a[d].getElementsByTagName("td");
2732 b++){g[b]=Rico.getContentAsString(c[b],this.options.isEncoded)
2735 },_blankRow:function(){var a=[];
2737 b<this.liveGrid.columns.length;
2740 },deleteRows:function(b,a){this.baseRows.splice(b,typeof(a)=="number"?a:1);
2741 this.liveGrid.isPartialBlank=true;
2742 this.size=this.baseRows.length
2743 },insertRow:function(a){var b=this._blankRow();
2744 this.baseRows.splice(a,0,b);
2745 this.size=this.baseRows.length;
2746 this.liveGrid.isPartialBlank=true;
2747 if(this.startPos<0){this.startPos=0
2749 },appendRows:function(b){var c=[];
2752 a++){var d=this._blankRow();
2753 this.baseRows.push(d);
2755 }this.size=this.baseRows.length;
2756 this.liveGrid.isPartialBlank=true;
2757 if(this.startPos<0){this.startPos=0
2759 },sortFunc:function(b){var a=this;
2760 switch(b){case"number":return function(d,c){return a._sortNumeric(d,c)
2762 case"control":return function(d,c){return a._sortControl(d,c)
2764 default:return function(d,c){return a._sortAlpha(d,c)
2766 }},sortBuffer:function(b){if(!this.baseRows){this.delayedSortCol=b;
2768 }this.liveGrid.showMsg(Rico.getPhraseById("sorting"));
2770 var a=this.liveGrid.columns[b];
2771 this.getValFunc=a._sortfunc;
2772 this.baseRows.sort(this.sortFunc(a.format.type));
2773 if(a.getSortDirection()=="DESC"){this.baseRows.reverse()
2774 }},_sortAlpha:function(d,c){var e=this.sortColumn<d.length?Rico.getInnerText(d[this.sortColumn]):"";
2775 var f=this.sortColumn<c.length?Rico.getInnerText(c[this.sortColumn]):"";
2779 },_sortNumeric:function(d,c){var e=this.sortColumn<d.length?this.nan2zero(Rico.getInnerText(d[this.sortColumn])):0;
2780 var f=this.sortColumn<c.length?this.nan2zero(Rico.getInnerText(c[this.sortColumn])):0;
2782 },nan2zero:function(a){if(typeof(a)=="string"){a=parseFloat(a)
2783 }return isNaN(a)||typeof(a)=="undefined"?0:a
2784 },_sortControl:function(d,c){var e=this.sortColumn<d.length?Rico.getInnerText(d[this.sortColumn]):"";
2785 var f=this.sortColumn<c.length?Rico.getInnerText(c[this.sortColumn]):"";
2786 if(this.getValFunc){e=this.getValFunc(e);
2787 f=this.getValFunc(f)
2791 },clear:function(){this.baseRows=[];
2796 },isInRange:function(a){var b=Math.min(this.totalRows,a+this.liveGrid.pageSize);
2797 return(a>=this.startPos)&&(b<=this.endPos())
2798 },endPos:function(){return this.startPos+this.rows.length
2799 },fetch:function(a){Rico.log("fetch "+this.liveGrid.tableId+": offset="+a);
2800 this.applyFilters();
2801 this.setTotalRows();
2802 this.rcvdRowCount=true;
2803 this.foundRowCount=true;
2805 }this.liveGrid.refreshContents(a);
2807 },visibleRows:function(){return this.rows.slice(this.windowStart,this.windowEnd)
2808 },setWindow:function(b,a){this.windowStart=b-this.startPos;
2809 Rico.log("setWindow "+this.liveGrid.tableId+": "+b+", "+a+", newstart="+this.windowStart);
2810 this.windowEnd=Math.min(a,this.size);
2812 },isVisible:function(a){return a<this.rows.length&&a>=this.windowStart&&a<this.windowEnd
2813 },bufferRow:function(a){return this.windowStart+a
2814 },getWindowCell:function(c,b){var a=this.bufferRow(c);
2815 return this.isVisible(a)&&b<this.rows[a].length?this.rows[a][b]:null
2816 },getWindowStyle:function(c,b){var a=this.bufferRow(c);
2817 return this.attr&&this.isVisible(a)&&this.attr[a]&&b<this.attr[a].length?this.attr[a][b]:""
2818 },getWindowValue:function(b,a){return this.getWindowCell(b,a)
2819 },setWindowValue:function(d,b,c){var a=this.bufferRow(d);
2820 if(a>=this.windowEnd){return false
2821 }return this.setValue(a,b,c)
2822 },getCell:function(b,a){return b<this.size?this.rows[b][a]:null
2823 },getValue:function(b,a){return this.getCell(b,a)
2824 },setValue:function(d,b,c,a){if(d>=this.size){return false
2825 }if(!this.rows[d][b]){this.rows[d][b]={}
2827 if(typeof a=="string"){this.rows[d][b]._style=a
2828 }this.rows[d][b].modified=true;
2830 },getRows:function(f,d){var e=f-this.startPos;
2831 var a=Math.min(e+d,this.size);
2835 b++){c.push(this.rows[b])
2837 },applyFilters:function(){var g=[],k=[];
2839 var j=this.liveGrid.columns;
2843 if(h.filterType==Rico.ColumnConst.UNFILTERED){continue
2845 if(h.filterOp=="LIKE"){k[d]=new RegExp(h.filterValues[0],"i")
2846 }}Rico.log("applyFilters: # of filters="+b);
2847 if(b==0){this.rows=this.baseRows
2849 a<this.baseRows.length;
2854 if(h.filterType==Rico.ColumnConst.UNFILTERED){continue
2855 }switch(h.filterOp){case"LIKE":f=k[d].test(this.baseRows[a][d]);
2857 case"EQ":f=this.baseRows[a][d]==h.filterValues[0];
2860 e<h.filterValues.length&&f;
2861 e++){f=this.baseRows[a][d]!=h.filterValues[e]
2863 case"LE":if(h.format.type=="number"){f=this.nan2zero(this.baseRows[a][d])<=this.nan2zero(h.filterValues[0])
2864 }else{f=this.baseRows[a][d]<=h.filterValues[0]
2866 case"GE":if(h.format.type=="number"){f=this.nan2zero(this.baseRows[a][d])>=this.nan2zero(h.filterValues[0])
2867 }else{f=this.baseRows[a][d]>=h.filterValues[0]
2869 case"NULL":f=this.baseRows[a][d]=="";
2871 case"NOTNULL":f=this.baseRows[a][d]!="";
2873 }}if(f){g.push(this.baseRows[a])
2875 }this.rowcntContent=this.size=this.rows.length
2876 },printAll:function(){this.liveGrid.showMsg(Rico.getPhraseById("exportInProgress"));
2877 Rico.runLater(10,this,"_printAll")
2878 },_printAll:function(){this.liveGrid.exportStart();
2879 this.exportBuffer(this.getRows(0,this.totalRows));
2880 this.liveGrid.exportFinish()
2881 },printVisible:function(){this.liveGrid.showMsg(Rico.getPhraseById("exportInProgress"));
2882 Rico.runLater(10,this,"_printVisible")
2883 },_printVisible:function(){this.liveGrid.exportStart();
2884 this.exportBuffer(this.visibleRows());
2885 this.liveGrid.exportFinish()
2886 },exportBuffer:function(l,f){var a,g,k,b,j;
2887 Rico.log("exportBuffer: "+l.length+" rows");
2888 var e=this.liveGrid.getExportStyles(this.liveGrid.tbody[0]);
2891 var h=this.liveGrid.columns;
2894 g++){if(h[g].visible){i[g]=this.liveGrid.exportStyle(h[g].cell(0),e)
2900 g++){if(!h[g].visible){continue
2903 k=b._export(l[a][g],l[a]);
2904 if(k==""){k=" "
2905 }j+="<td style='"+b.expStyle+"'>"+k+"</td>"
2906 }this.liveGrid.exportRows.push(j);
2908 if(d%10==0){window.status=Rico.getPhraseById("exportStatus",d)
2910 Rico.LiveGrid=function(c,a,b){this.initialize(c,a,b)
2912 Rico.LiveGrid.prototype={initialize:function(e,b,d){Rico.extend(this,Rico.GridCommon);
2913 Rico.extend(this,Rico.LiveGridMethods);
2917 this.actionId="_action_"+e;
2918 Rico.setDebugArea(e+"_debugmsgs");
2919 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});
2921 this.options.sortHandler=function(){c.sortHandler()
2923 this.options.filterHandler=function(){c.filterHandler()
2925 this.options.onRefreshComplete=function(f,g){c.bookmarkHandler(f,g)
2927 this.options.rowOverHandler=Rico.eventHandle(this,"rowMouseOver");
2928 this.options.mouseDownHandler=Rico.eventHandle(this,"selectMouseDown");
2929 this.options.mouseOverHandler=Rico.eventHandle(this,"selectMouseOver");
2930 this.options.mouseUpHandler=Rico.eventHandle(this,"selectMouseUp");
2931 Rico.extend(this.options,d||{});
2932 switch(typeof this.options.visibleRows){case"string":this.sizeTo=this.options.visibleRows;
2933 switch(this.options.visibleRows){case"data":this.options.visibleRows=-2;
2935 case"body":this.options.visibleRows=-3;
2937 case"parent":this.options.visibleRows=-4;
2939 case"datamax":this.options.visibleRows=-5;
2941 default:this.options.visibleRows=-1;
2944 case"number":switch(this.options.visibleRows){case -1:this.sizeTo="window";
2946 case -2:this.sizeTo="data";
2948 case -3:this.sizeTo="body";
2950 case -4:this.sizeTo="parent";
2952 case -5:this.sizeTo="datamax";
2954 default:this.sizeTo="fixed";
2957 default:this.sizeTo="body";
2958 this.options.visibleRows=-3;
2960 }this.highlightEnabled=this.options.highlightSection>0;
2962 this.createTables();
2963 if(this.headerColCnt==0){alert('ERROR: no columns found in "'+this.tableId+'"');
2965 }this.createColumnArray("LiveGridColumn");
2966 if(this.options.headingSort=="hover"){this.createHoverSet()
2967 }this.bookmark=document.getElementById(this.tableId+"_bookmark");
2970 if(this.buffer.options.canFilter&&this.options.AutoFilter){a=this.addHeadingRow("ricoLG_FilterRow")
2971 }this.createDataCells(this.options.visibleRows);
2972 if(this.pageSize==0){return
2973 }this.buffer.registerGrid(this);
2974 if(this.buffer.setBufferSize){this.buffer.setBufferSize(this.pageSize)
2975 }this.scrollTimeout=null;
2976 this.lastScrollPos=0;
2977 this.attachMenuEvents();
2978 this.setSortUI(this.options.sortCol,this.options.sortDir);
2980 if(this.listInvisible().length==this.columns.length){this.columns[0].showColumn()
2982 this.scrollDiv.style.display="";
2983 if(this.buffer.totalRows>0){this.updateHeightDiv()
2984 }if(this.options.prefetchBuffer){if(this.bookmark){this.bookmark.innerHTML=Rico.getPhraseById("bookmarkLoading")
2985 }if(this.options.canFilterDefault&&this.options.getQueryParms){this.checkForFilterParms()
2986 }this.scrollToRow(this.options.offset);
2987 this.buffer.fetch(this.options.offset)
2988 }if(a>=0){this.createFilters(a)
2989 }this.scrollEventFunc=Rico.eventHandle(this,"handleScroll");
2990 this.wheelEventFunc=Rico.eventHandle(this,"handleWheel");
2991 this.wheelEvent=(Rico.isIE||Rico.isOpera||Rico.isWebKit)?"mousewheel":"DOMMouseScroll";
2992 if(this.options.offset&&this.options.offset<this.buffer.totalRows){Rico.runLater(50,this,"scrollToRow",this.options.offset)
2993 }this.pluginScroll();
2994 this.setHorizontalScroll();
2995 Rico.log("setHorizontalScroll done");
2996 if(this.options.windowResize){Rico.runLater(100,this,"pluginWindowResize")
2997 }Rico.log("initialize complete for "+this.tableId);
2998 if(this.direction=="rtl"&&(!Rico.isWebKit||this.scrollDiv.clientLeft>0)){this.scrollTab.style.right="0px"
2999 }else{this.scrollTab.style.left="0px";
3000 Rico.setStyle(this.tabs[1],{"float":"left"})
3002 Rico.LiveGridMethods={createHoverSet:function(){var a=[];
3004 b<this.headerColCnt;
3005 b++){if(this.columns[b].sortable){a.push(this.columns[b].hdrCellDiv)
3006 }}this.hoverSet=new Rico.HoverSet(a)
3007 },checkForFilterParms:function(){var b=window.location.search;
3008 if(b.charAt(0)=="?"){b=b.substring(1)
3009 }var c=b.split("&");
3012 a++){if(c[a].match(/^f\[\d+\]/)){this.buffer.options.requestParameters.push(c[a])
3013 }}},drillDown:function(g,f,h){var b=Rico.eventElement(g||window.event);
3014 b=Rico.getParentByTagName(b,"div","ricoLG_cell");
3016 }var a=this.winCellIndex(b);
3017 if(a.row>=this.buffer.totalRows){return -1
3018 }this.unhighlight();
3021 var c=this.buffer.getWindowCell(a.row,f);
3024 d++){arguments[d].setDetailFilter(h,c)
3026 },setDetailFilter:function(a,d){var b=this.columns[a];
3028 b.setSystemFilter("EQ",d)
3029 },createTables:function(){var f,g,b;
3030 var e=document.getElementById(this.tableId)||document.getElementById(this.tableId+"_outerDiv");
3032 }if(e.tagName.toLowerCase()=="table"){var a=e.getElementsByTagName("thead");
3033 if(a.length==1){Rico.log("createTables: using thead section, id="+this.tableId);
3034 if(this.options.ColGroupsOnTabHdr&&this.options.ColGroups){var d=a[0].insertRow(0);
3035 this.insertPanelNames(d,0,this.options.frozenColumns,"ricoFrozen");
3036 this.insertPanelNames(d,this.options.frozenColumns,this.options.columnSpecs.length)
3038 }else{Rico.log("createTables: using tbody section, id="+this.tableId);
3039 g=new Array(e.rows[0])
3041 }else{if(this.options.columnSpecs.length>0){if(!e.id.match(/_outerDiv$/)){f=e
3042 }Rico.log("createTables: inserting at "+e.tagName+", id="+this.tableId)
3043 }else{alert("ERROR!\n\nUnable to initialize '"+this.tableId+"'\n\nLiveGrid terminated");
3045 }}this.createDivs();
3046 this.scrollContainer=this.createDiv("scrollContainer",this.structTabLR);
3047 this.scrollContainer.appendChild(this.scrollDiv);
3048 this.scrollTab=this.createDiv("scrollTab",this.scrollContainer);
3049 this.shadowDiv=this.createDiv("shadow",this.scrollDiv);
3050 this.shadowDiv.style.direction="ltr";
3051 this.scrollDiv.style.display="none";
3052 this.scrollDiv.scrollTop=0;
3053 if(this.options.highlightMethod!="class"){this.highlightDiv=[];
3054 switch(this.options.highlightElem){case"menuRow":case"cursorRow":this.highlightDiv[0]=this.createDiv("highlight",this.outerDiv);
3055 this.highlightDiv[0].style.display="none";
3057 case"menuCell":case"cursorCell":for(b=0;
3059 b++){this.highlightDiv[b]=this.createDiv("highlight",b==0?this.frozenTabs:this.scrollTab);
3060 this.highlightDiv[b].style.display="none";
3061 this.highlightDiv[b].id+=b
3063 case"selection":var h=this.options.highlightSection==1?this.frozenTabs:this.scrollTab;
3066 b++){this.highlightDiv[b]=this.createDiv("highlight",h);
3067 this.highlightDiv[b].style.display="none";
3068 this.highlightDiv[b].style.overflow="hidden";
3069 this.highlightDiv[b].id+=b;
3070 this.highlightDiv[b].style[b%2==0?"height":"width"]="0px"
3074 b++){this.tabs[b]=document.createElement("table");
3075 this.tabs[b].className=(b<2)?"ricoLG_table":"ricoLG_scrollTab";
3076 this.tabs[b].border=0;
3077 this.tabs[b].cellPadding=0;
3078 this.tabs[b].cellSpacing=0;
3079 this.tabs[b].id=this.tableId+"_tab"+b
3082 b++){this.thead[b]=this.tabs[b].createTHead();
3083 this.thead[b].className="ricoLG_top";
3084 if(Rico.theme.gridheader){Rico.addClass(this.thead[b],Rico.theme.gridheader)
3087 b++){this.tbody[b]=Rico.getTBody(this.tabs[b==0?0:2]);
3088 this.tbody[b].className="ricoLG_bottom";
3089 if(Rico.theme.gridcontent){Rico.addClass(this.tbody[b],Rico.theme.gridcontent)
3090 }this.tbody[b].insertRow(-1)
3091 }this.frozenTabs.appendChild(this.tabs[0]);
3092 this.innerDiv.appendChild(this.tabs[1]);
3093 this.scrollTab.appendChild(this.tabs[2]);
3094 if(f){f.parentNode.insertBefore(this.outerDiv,f)
3095 }if(g){this.headerColCnt=this.getColumnInfo(g);
3097 }else{this.createHdr(0,0,this.options.frozenColumns);
3098 this.createHdr(1,this.options.frozenColumns,this.options.columnSpecs.length);
3099 if(this.options.ColGroupsOnTabHdr&&this.options.ColGroups){this.insertPanelNames(this.thead[0].insertRow(0),0,this.options.frozenColumns);
3100 this.insertPanelNames(this.thead[1].insertRow(0),this.options.frozenColumns,this.options.columnSpecs.length)
3103 b++){this.headerColCnt=this.getColumnInfo(this.thead[b].rows)
3105 j<this.headerColCnt;
3106 j++){this.tbody[j<this.options.frozenColumns?0:1].rows[0].insertCell(-1)
3107 }if(f){e.parentNode.removeChild(e)
3108 }Rico.log("createTables end");
3110 },createDataCells:function(d){if(d<0){for(var a=0;
3111 a<this.options.minPageRows;
3112 a++){this.appendBlankRow()
3114 this.autoAppendRows(this.remainingHt())
3117 c++){this.appendBlankRow()
3118 }}var b=this.options.highlightSection;
3119 if(b&1){this.attachHighlightEvents(this.tbody[0])
3120 }if(b&2){this.attachHighlightEvents(this.tbody[1])
3121 }},filterId:function(a){return"RicoFilter_"+this.tableId+"_"+a
3122 },createFilters:function(b){for(var h=0;
3123 h<this.headerColCnt;
3124 h++){var e=this.columns[h];
3126 if(typeof f.filterUI!="string"){continue
3127 }var l=this.hdrCells[b][h].cell;
3128 var j,d=this.filterId(h);
3129 var i=l.getElementsByTagName("div");
3130 var g=Rico.getStyle(this.cell(0,h),"textAlign");
3131 i[1].style.textAlign=g;
3132 switch(f.filterUI.charAt(0)){case"t":j=Rico.createFormField(i[1],"input",Rico.inputtypes.search?"search":"text",d,d);
3133 var n=f.filterUI.match(/\d+/);
3134 j.maxLength=f.Length||50;
3135 j.size=n?parseInt(n,10):10;
3136 if(j.type!="search"){i[1].appendChild(Rico.clearButton(Rico.eventHandle(e,"filterClear")))
3137 }if(e.filterType==Rico.ColumnConst.USERFILTER&&e.filterOp=="LIKE"){var k=e.filterValues[0];
3138 if(k.charAt(0)=="*"){k=k.substr(1)
3139 }if(k.slice(-1)=="*"){k=k.slice(0,-1)
3142 }Rico.eventBind(j,"keyup",Rico.eventHandle(e,"filterKeypress"),false);
3145 case"m":case"s":j=Rico.createFormField(i[1],"select",null,d);
3146 Rico.addSelectOption(j,this.options.FilterAllToken,Rico.getPhraseById("filterAll"));
3149 Rico.extend(m,this.buffer.ajaxOptions);
3150 var a=typeof(f.filterCol)=="number"?f.filterCol:h;
3151 m.parameters={id:this.tableId,distinct:a};
3152 m.parameters[this.actionId]="query";
3153 m.onComplete=this.filterValuesUpdateFunc(h);
3154 new Rico.ajaxRequest(this.buffer.dataSource,m);
3156 case"c":if(typeof e._createFilters=="function"){e._createFilters(i[1],d)
3158 }}this.initFilterImage(b)
3159 },filterValuesUpdateFunc:function(b){var a=this;
3160 return function(c){a.filterValuesUpdate(b,c)
3162 },filterValuesUpdate:function(a,g){var f=g.responseXML.getElementsByTagName("ajax-response");
3163 Rico.log("filterValuesUpdate: "+g.status);
3164 if(f==null||f.length!=1){return false
3166 var n=f.getElementsByTagName("error");
3167 if(n.length>0){Rico.log("Data provider returned an error:\n"+Rico.getContentAsString(n[0],this.buffer.isEncoded));
3168 alert(Rico.getPhraseById("requestError",Rico.getContentAsString(n[0],this.buffer.isEncoded)));
3170 }f=f.getElementsByTagName("response")[0];
3171 var l=f.getElementsByTagName("rows")[0];
3172 var d=this.columns[parseInt(a,10)];
3173 var r=this.buffer.dom2jstable(l);
3175 if(d.filterType==Rico.ColumnConst.USERFILTER&&d.filterOp=="EQ"){q=d.filterValues[0]
3176 }Rico.log("filterValuesUpdate: col="+a+" rows="+r.length);
3177 switch(d.format.filterUI.charAt(0)){case"m":d.mFilter=document.body.appendChild(document.createElement("div"));
3178 d.mFilter.className="ricoLG_mFilter";
3179 Rico.hide(d.mFilter);
3180 var e=d.mFilter.appendChild(document.createElement("div"));
3181 e.className="ricoLG_mFilter_content";
3182 var o=d.mFilter.appendChild(document.createElement("div"));
3183 o.className="ricoLG_mFilter_button";
3184 d.mFilterButton=o.appendChild(document.createElement("button"));
3185 d.mFilterButton.innerHTML=Rico.getPhraseById("apply");
3186 var j=Rico.isWebKit?"mousedown":"click";
3187 Rico.eventBind(d.filterField,j,Rico.eventHandle(d,"mFilterSelectClick"));
3188 Rico.eventBind(d.mFilterButton,"click",Rico.eventHandle(d,"mFilterFinish"));
3189 tab=e.appendChild(document.createElement("table"));
3193 var p=this.filterId(a)+"_";
3194 this.createMFilterItem(tab,this.options.FilterAllToken,Rico.getPhraseById("filterAll"),p+"all",Rico.eventHandle(d,"mFilterAllClick"));
3195 var k=Rico.eventHandle(d,"mFilterOtherClick");
3198 h++){if(r[h].length>0){m=r[h][0];
3199 this.createMFilterItem(tab,m,m||Rico.getPhraseById("filterBlank"),p+h,k)
3200 }}d.mFilterInputs=e.getElementsByTagName("input");
3201 d.mFilterLabels=e.getElementsByTagName("label");
3202 d.mFilterFocus=d.mFilterInputs.length?d.mFilterInputs[0]:d.mFilterButton;
3204 case"s":for(var h=0;
3206 h++){if(r[h].length>0){m=r[h][0];
3207 b=Rico.addSelectOption(d.filterField,m,m||Rico.getPhraseById("filterBlank"));
3208 if(d.filterType==Rico.ColumnConst.USERFILTER&&m==q){b.selected=true
3209 }}}Rico.eventBind(d.filterField,"change",Rico.eventHandle(d,"filterChange"));
3212 },createMFilterItem:function(j,b,i,a,e){var f=j.insertRow(-1);
3214 if(f.rowIndex%2==1){f.className="ricoLG_mFilter_oddrow"
3215 }var d=f.insertCell(-1);
3216 var c=f.insertCell(-1);
3217 var h=Rico.createFormField(d,"input","checkbox",a);
3220 var g=c.appendChild(document.createElement("label"));
3223 Rico.eventBind(h,"click",e)
3224 },unplugHighlightEvents:function(){var a=this.options.highlightSection;
3225 if(a&1){this.detachHighlightEvents(this.tbody[0])
3226 }if(a&2){this.detachHighlightEvents(this.tbody[1])
3227 }},insertPanelNames:function(a,b,d,f){Rico.log("insertPanelNames: start="+b+" limit="+d);
3228 a.className="ricoLG_hdg";
3229 var i=-1,j,e=null,g=0;
3232 h++){if(i==this.options.columnSpecs[h].ColGroupIdx){j++
3233 }else{if(e){e.colSpan=j
3234 }e=a.insertCell(-1);
3237 i=this.options.columnSpecs[h].ColGroupIdx;
3238 e.innerHTML=this.options.ColGroups[i]
3240 }},createHdr:function(d,g,b){Rico.log("createHdr: i="+d+" start="+g+" limit="+b);
3241 var a=this.thead[d].insertRow(-1);
3242 a.id=this.tableId+"_tab"+d+"h_main";
3243 a.className="ricoLG_hdg";
3246 f++){var e=a.insertCell(-1);
3247 e.innerHTML=this.options.columnSpecs[f].Hdg
3248 }},loadHdrSrc:function(g){var b,d,j,e,f,a;
3249 Rico.log("loadHdrSrc start");
3254 e++){f=this.thead[b].insertRow(-1);
3255 f.className="ricoLG_hdg "+this.tableId+"_hdg"+e
3256 }}if(g.length==1){a=g[0].cells;
3259 j++){this.thead[j<this.options.frozenColumns?0:1].rows[0].appendChild(a[0])
3265 j++){if(Rico.hasClass(a[0],"ricoFrozen")){if(e==this.headerRowIdx){this.options.frozenColumns=j+1
3267 }this.thead[d].rows[e].appendChild(a[0])
3268 }}}Rico.log("loadHdrSrc end")
3269 },sizeDivs:function(){Rico.log("sizeDivs: "+this.tableId);
3271 this.baseSizeDivs();
3272 var d=this.firstVisible();
3273 if(this.pageSize==0||d<0){return
3274 }var c=this.columns[d].dataColDiv.offsetHeight;
3275 this.rowHeight=Math.round(c/this.pageSize);
3277 if(this.scrTabWi0==this.scrTabWi){this.innerDiv.style.height=(this.hdrHt+1)+"px";
3278 this.scrollDiv.style.overflowX="hidden"
3279 }else{this.scrollDiv.style.overflowX="scroll";
3280 b+=this.options.scrollBarWidth
3281 }this.scrollDiv.style.height=b+"px";
3282 this.innerDiv.style.width=(this.scrWi)+"px";
3283 this.scrollTab.style.width=(this.scrWi-this.options.scrollBarWidth)+"px";
3284 this.resizeDiv.style.height=(this.hdrHt+this.dataHt+1)+"px";
3285 Rico.log("sizeDivs scrHt="+b+" innerHt="+this.innerDiv.style.height+" rowHt="+this.rowHeight+" pageSize="+this.pageSize);
3286 var a=(this.scrWi-this.scrTabWi<this.options.scrollBarWidth)?2:0;
3287 this.shadowDiv.style.width=(this.scrTabWi+a)+"px";
3288 this.outerDiv.style.height=(this.hdrHt+b)+"px";
3289 this.setHorizontalScroll()
3290 },setHorizontalScroll:function(){var a=(-this.scrollDiv.scrollLeft)+"px";
3291 this.tabs[1].style.marginLeft=a;
3292 this.tabs[2].style.marginLeft=a
3293 },remainingHt:function(){var f=this.outerDiv.offsetHeight;
3294 var g=Rico.windowHeight();
3295 var e=Rico.isIE?15:10;
3296 if(!Rico.isIE&&window.frameElement&&window.frameElement.scrolling=="yes"&&this.sizeTo!="parent"){e+=this.options.scrollBarWidth
3297 }switch(this.sizeTo){case"window":var d=Rico.cumulativeOffset(this.outerDiv).top;
3298 Rico.log("remainingHt/window, winHt="+g+" tabHt="+f+" gridY="+d);
3300 case"parent":var h=this.offsetFromParent(this.outerDiv);
3301 if(Rico.isIE){Rico.hide(this.outerDiv)
3302 }var b=this.outerDiv.parentNode.clientHeight;
3303 if(Rico.isIE){Rico.show(this.outerDiv)
3304 }Rico.log("remainingHt/parent, parentHt="+b+" offset="+h+" tabHt="+f);
3306 case"data":case"body":var a=Rico.isIE?document.body.scrollHeight:document.body.offsetHeight;
3308 if(!Rico.isWebKit){c-=this.options.scrollBarWidth
3309 }Rico.log("remainingHt, winHt="+g+" pageHt="+a+" remHt="+c);
3311 default:Rico.log("remainingHt, winHt="+g+" tabHt="+f);
3312 if(this.sizeTo.slice(-1)=="%"){g*=parseFloat(this.sizeTo)/100
3313 }else{if(this.sizeTo.slice(-2)=="px"){g=parseInt(this.sizeTo,10)
3315 }},offsetFromParent:function(b){var a=0;
3317 do{a+=b.offsetTop||0;
3319 if(!b||b==null){break
3320 }var d=Rico.getStyle(b,"position");
3321 if(b.tagName=="BODY"||b.tagName=="HTML"||d=="absolute"){return a-c.offsetTop
3324 },adjustPageSize:function(){var a=this.remainingHt();
3325 Rico.log("adjustPageSize remHt="+a+" lastRow="+this.lastRowPos);
3326 if(a>this.rowHeight){this.autoAppendRows(a)
3327 }else{if(a<0||this.sizeTo=="data"){this.autoRemoveRows(-a)
3328 }}},setPageSize:function(b){b=Math.min(b,this.options.maxPageRows);
3329 b=Math.max(b,this.options.minPageRows);
3330 this.sizeTo="fixed";
3331 var a=this.pageSize;
3332 while(this.pageSize>b){this.removeRow()
3333 }while(this.pageSize<b){this.appendBlankRow()
3334 }this.finishResize(a)
3335 },pluginWindowResize:function(){Rico.log("pluginWindowResize");
3336 this.resizeWindowHandler=Rico.eventHandle(this,"resizeWindow");
3337 Rico.eventBind(window,"resize",this.resizeWindowHandler,false)
3338 },unplugWindowResize:function(){if(!this.resizeWindowHandler){return
3339 }Rico.eventUnbind(window,"resize",this.resizeWindowHandler,false);
3340 this.resizeWindowHandler=null
3341 },resizeWindow:function(){Rico.log("resizeWindow "+this.tableId+" lastRow="+this.lastRowPos);
3342 if(this.resizeState=="finish"){Rico.log("resizeWindow postponed");
3343 this.resizeState="resize";
3345 }if(!this.sizeTo||this.sizeTo=="fixed"){this.sizeDivs();
3347 }if(this.sizeTo=="parent"&&Rico.getStyle(this.outerDiv.parentNode,"display")=="none"){return
3348 }var a=this.pageSize;
3349 this.adjustPageSize();
3350 this.finishResize(a)
3351 },finishResize:function(b){if(this.pageSize>b&&this.buffer.totalRows>0){this.isPartialBlank=true;
3352 var a=this.adjustRow(this.lastRowPos);
3353 this.buffer.fetch(a)
3354 }else{if(this.pageSize<b){if(this.options.onRefreshComplete){this.options.onRefreshComplete(this.contentStartPos,this.contentStartPos+this.pageSize-1)
3355 }}}this.resizeState="finish";
3356 Rico.runLater(20,this,"finishResize2");
3357 Rico.log("Resize "+this.tableId+" complete. old size="+b+" new size="+this.pageSize)
3358 },finishResize2:function(){this.sizeDivs();
3359 this.updateHeightDiv();
3360 if(this.resizeState=="resize"){this.resizeWindow()
3361 }else{this.resizeState=""
3362 }},topOfLastPage:function(){return Math.max(this.buffer.totalRows-this.pageSize,0)
3363 },updateHeightDiv:function(){var b=this.topOfLastPage();
3364 var a=b?this.scrollDiv.clientHeight+Math.floor(this.rowHeight*(b+0.4)):1;
3365 Rico.log("updateHeightDiv, ht="+a+" scrollDiv.clientHeight="+this.scrollDiv.clientHeight+" rowsNotDisplayed="+b);
3366 this.shadowDiv.style.height=a+"px"
3367 },autoRemoveRows:function(a){if(!this.rowHeight){return
3368 }var c=Math.ceil(a/this.rowHeight);
3369 if(this.sizeTo=="data"){c=Math.max(c,this.pageSize-this.buffer.totalRows)
3370 }Rico.log("autoRemoveRows overage="+a+" removeCnt="+c);
3373 b++){this.removeRow()
3374 }},removeRow:function(){if(this.pageSize<=this.options.minPageRows){return
3377 b<this.headerColCnt;
3378 b++){var a=this.columns[b].cell(this.pageSize);
3379 this.columns[b].dataColDiv.removeChild(a)
3380 }},autoAppendRows:function(a){if(!this.rowHeight){return
3381 }var c=Math.floor(a/this.rowHeight);
3382 Rico.log("autoAppendRows overage="+a+" cnt="+c+" rowHt="+this.rowHeight);
3385 b++){if(this.sizeTo=="data"&&this.pageSize>=this.buffer.totalRows){break
3386 }this.appendBlankRow()
3387 }},appendBlankRow:function(){if(this.pageSize>=this.options.maxPageRows){return
3388 }Rico.log("appendBlankRow #"+this.pageSize);
3389 var a=this.defaultRowClass(this.pageSize);
3391 d<this.headerColCnt;
3392 d++){var b=document.createElement("div");
3393 b.className="ricoLG_cell "+a;
3394 b.id=this.tableId+"_"+this.pageSize+"_"+d;
3395 this.columns[d].dataColDiv.appendChild(b);
3396 if(this.columns[d]._create){this.columns[d]._create(b,this.pageSize)
3397 }else{b.innerHTML=" "
3398 }if(this.columns[d].format.canDrag&&Rico.registerDraggable){Rico.registerDraggable(new Rico.LiveGridDraggable(this,this.pageSize,d),this.options.dndMgrIdx)
3400 },defaultRowClass:function(b){var a;
3401 if(b%2==0){a="ricoLG_evenRow"
3402 }else{a="ricoLG_oddRow"
3404 },handleMenuClick:function(f){if(!this.menu){return
3408 var a=Rico.eventElement(f);
3409 if(a.className=="ricoLG_highlightDiv"){b=this.highlightIdx
3410 }else{a=Rico.getParentByTagName(a,"div","ricoLG_cell");
3412 }b=this.winCellIndex(a);
3413 if((this.options.highlightSection&(b.tabIdx+1))==0){return
3414 }}this.highlight(b);
3415 this.highlightEnabled=false;
3416 if(this.hideScroll){this.scrollDiv.style.overflow="hidden"
3418 if(!this.menu.div){this.menu.createDiv()
3419 }this.menu.liveGrid=this;
3420 if(this.menu.buildGridMenu){var d=this.menu.buildGridMenu(b.row,b.column,b.tabIdx);
3422 }}if(this.options.highlightElem=="selection"&&!this.isSelected(b.cell)){this.selectCell(b.cell)
3424 this.menu.showmenu(f,function(){c.closeMenu()
3427 },closeMenu:function(){if(!this.menuIdx){return
3428 }if(this.hideScroll){this.scrollDiv.style.overflow=""
3429 }this.highlightEnabled=true;
3431 },winCellIndex:function(b){var d=b.id.lastIndexOf("_",b.id.length);
3432 var a=b.id.lastIndexOf("_",d-1)+1;
3433 var f=parseInt(b.id.substr(d+1));
3434 var e=parseInt(b.id.substr(a,d));
3435 return{row:e,column:f,tabIdx:this.columns[f].tabIdx,cell:b}
3436 },datasetIndex:function(b){var a=this.winCellIndex(b);
3437 a.row+=this.buffer.windowPos;
3438 a.onBlankRow=(a.row>=this.buffer.endPos());
3440 },attachHighlightEvents:function(a){switch(this.options.highlightElem){case"selection":Rico.eventBind(a,"mousedown",this.options.mouseDownHandler,false);
3441 a.ondrag=function(){return false
3443 a.onselectstart=function(){return false
3446 case"cursorRow":case"cursorCell":Rico.eventBind(a,"mouseover",this.options.rowOverHandler,false);
3448 }},detachHighlightEvents:function(a){switch(this.options.highlightElem){case"selection":Rico.eventUnbind(a,"mousedown",this.options.mouseDownHandler,false);
3450 a.onselectstart=null;
3452 case"cursorRow":case"cursorCell":Rico.eventUnbind(a,"mouseover",this.options.rowOverHandler,false);
3454 }},getVisibleSelection:function(){var d=[];
3455 if(this.SelectIdxStart&&this.SelectIdxEnd){var b=Math.max(Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row)-this.buffer.startPos,this.buffer.windowStart);
3456 var a=Math.min(Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row)-this.buffer.startPos,this.buffer.windowEnd-1);
3457 var g=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3458 var f=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3463 j++){d.push({row:h-this.buffer.windowStart,column:j})
3464 }}}if(this.SelectCtrl){for(var e=0;
3465 e<this.SelectCtrl.length;
3466 e++){if(this.SelectCtrl[e].row>=this.buffer.windowStart&&this.SelectCtrl[e].row<this.buffer.windowEnd){d.push({row:this.SelectCtrl[e].row-this.buffer.windowStart,column:this.SelectCtrl[e].column})
3468 },updateSelectOutline:function(){if(!this.SelectIdxStart||!this.SelectIdxEnd){return
3469 }var d=Math.max(Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row),this.buffer.windowStart);
3470 var c=Math.min(Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row),this.buffer.windowEnd-1);
3471 if(d>c){this.HideSelection();
3473 }var g=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3474 var e=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3475 var h=this.columns[g].cell(d-this.buffer.windowStart).offsetTop;
3476 var j=this.columns[g].cell(c-this.buffer.windowStart);
3477 var b=j.offsetTop+j.offsetHeight;
3478 var l=this.columns[g].dataCell.offsetLeft;
3479 var k=this.columns[e].dataCell.offsetLeft;
3480 var a=k+this.columns[e].dataCell.offsetWidth;
3481 this.highlightDiv[0].style.top=this.highlightDiv[3].style.top=this.highlightDiv[1].style.top=(this.hdrHt+h-1)+"px";
3482 this.highlightDiv[2].style.top=(this.hdrHt+b-1)+"px";
3483 this.highlightDiv[3].style.left=(l-2)+"px";
3484 this.highlightDiv[0].style.left=this.highlightDiv[2].style.left=(l-1)+"px";
3485 this.highlightDiv[1].style.left=(a-1)+"px";
3486 this.highlightDiv[0].style.width=this.highlightDiv[2].style.width=(a-l-1)+"px";
3487 this.highlightDiv[1].style.height=this.highlightDiv[3].style.height=(b-h)+"px";
3490 f++){this.highlightDiv[f].style.display=""
3491 }},HideSelection:function(){var b;
3492 if(this.options.highlightMethod!="class"){for(b=0;
3493 b<this.highlightDiv.length;
3494 b++){this.highlightDiv[b].style.display="none"
3495 }}if(this.options.highlightMethod!="outline"){var a=this.getVisibleSelection();
3496 Rico.log("HideSelection "+a.length);
3499 b++){this.unhighlightCell(this.columns[a[b].column].cell(a[b].row))
3500 }}},ShowSelection:function(){if(this.options.highlightMethod!="class"){this.updateSelectOutline()
3501 }if(this.options.highlightMethod!="outline"){var a=this.getVisibleSelection();
3504 b++){this.highlightCell(this.columns[a[b].column].cell(a[b].row))
3505 }}},ClearSelection:function(){Rico.log("ClearSelection");
3506 this.HideSelection();
3507 this.SelectIdxStart=null;
3508 this.SelectIdxEnd=null;
3510 },selectCell:function(a){this.ClearSelection();
3511 this.SelectIdxStart=this.SelectIdxEnd=this.datasetIndex(a);
3512 this.ShowSelection()
3513 },AdjustSelection:function(a){var b=this.datasetIndex(a);
3514 if(this.SelectIdxStart.tabIdx!=b.tabIdx){return
3515 }this.HideSelection();
3516 this.SelectIdxEnd=b;
3517 this.ShowSelection()
3518 },RefreshSelection:function(){var a=this.getVisibleSelection();
3521 b++){this.columns[a[b].column].displayValue(a[b].row)
3522 }},FillSelection:function(b,f){if(this.SelectIdxStart&&this.SelectIdxEnd){var e=Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row);
3523 var d=Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row);
3524 var j=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3525 var g=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3530 k++){this.buffer.setValue(a,k,b,f)
3531 }}}if(this.SelectCtrl){for(var h=0;
3532 h<this.SelectCtrl.length;
3533 h++){this.buffer.setValue(this.SelectCtrl[h].row,this.SelectCtrl[h].column,b,f)
3534 }}this.RefreshSelection()
3535 },selectMouseDown:function(d){if(this.highlightEnabled==false){return true
3537 var a=Rico.eventElement(d);
3538 if(!Rico.eventLeftClick(d)){return true
3539 }a=Rico.getParentByTagName(a,"div","ricoLG_cell");
3542 var c=this.datasetIndex(a);
3543 if(c.onBlankRow){return true
3544 }Rico.log("selectMouseDown @"+c.row+","+c.column);
3545 if(d.ctrlKey){if(!this.SelectIdxStart||this.options.highlightMethod!="class"){return true
3546 }if(!this.isSelected(a)){this.highlightCell(a);
3547 this.SelectCtrl.push(this.datasetIndex(a))
3549 b<this.SelectCtrl.length;
3550 b++){if(this.SelectCtrl[b].row==c.row&&this.SelectCtrl[b].column==c.column){this.unhighlightCell(a);
3551 this.SelectCtrl.splice(b,1);
3553 }}}}else{if(d.shiftKey){if(!this.SelectIdxStart){return true
3554 }this.AdjustSelection(a)
3555 }else{this.selectCell(a);
3558 },pluginSelect:function(){if(this.selectPluggedIn){return
3559 }var a=this.tbody[this.SelectIdxStart.tabIdx];
3560 Rico.eventBind(a,"mouseover",this.options.mouseOverHandler,false);
3561 Rico.eventBind(this.outerDiv,"mouseup",this.options.mouseUpHandler,false);
3562 this.selectPluggedIn=true
3563 },unplugSelect:function(){if(!this.selectPluggedIn){return
3564 }var a=this.tbody[this.SelectIdxStart.tabIdx];
3565 Rico.eventUnbind(a,"mouseover",this.options.mouseOverHandler,false);
3566 Rico.eventUnbind(this.outerDiv,"mouseup",this.options.mouseUpHandler,false);
3567 this.selectPluggedIn=false
3568 },selectMouseUp:function(b){this.unplugSelect();
3569 var a=Rico.eventElement(b);
3570 a=Rico.getParentByTagName(a,"div","ricoLG_cell");
3572 }if(this.SelectIdxStart&&this.SelectIdxEnd){this.AdjustSelection(a)
3573 }else{this.ClearSelection()
3574 }},selectMouseOver:function(b){var a=Rico.eventElement(b);
3575 a=Rico.getParentByTagName(a,"div","ricoLG_cell");
3577 }this.AdjustSelection(a);
3579 },isSelected:function(a){if(this.options.highlightMethod!="outline"){return Rico.hasClass(a,this.options.highlightClass)
3580 }if(!this.SelectIdxStart||!this.SelectIdxEnd){return false
3581 }var c=Math.max(Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row),this.buffer.windowStart);
3582 var b=Math.min(Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row),this.buffer.windowEnd-1);
3583 if(c>b){return false
3584 }var e=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3585 var d=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3586 var f=this.datasetIndex(a);
3587 return(c<=f.row&&f.row<=b&&e<=f.column&&f.column<=d)
3588 },highlightCell:function(a){Rico.addClass(a,this.options.highlightClass)
3589 },unhighlightCell:function(a){if(a){Rico.removeClass(a,this.options.highlightClass)
3590 }},selectRow:function(a){for(var b=0;
3591 b<this.columns.length;
3592 b++){this.highlightCell(this.columns[b].cell(a))
3593 }},unselectRow:function(a){for(var b=0;
3594 b<this.columns.length;
3595 b++){this.unhighlightCell(this.columns[b].cell(a))
3596 }},rowMouseOver:function(c){if(!this.highlightEnabled){return
3597 }var a=Rico.eventElement(c);
3598 a=Rico.getParentByTagName(a,"div","ricoLG_cell");
3600 }var b=this.winCellIndex(a);
3601 if((this.options.highlightSection&(b.tabIdx+1))==0){return
3603 },highlight:function(a){if(this.options.highlightMethod!="outline"){this.cursorSetClass(a)
3604 }if(this.options.highlightMethod!="class"){this.cursorOutline(a)
3605 }this.highlightIdx=a
3606 },cursorSetClass:function(e){switch(this.options.highlightElem){case"menuCell":case"cursorCell":if(this.highlightIdx){this.unhighlightCell(this.highlightIdx.cell)
3607 }this.highlightCell(e.cell);
3609 case"menuRow":case"cursorRow":if(this.highlightIdx){this.unselectRow(this.highlightIdx.row)
3610 }var b=this.options.highlightSection&1;
3611 var a=this.options.highlightSection&2;
3612 var f=b?0:this.options.frozenColumns;
3613 var d=a?this.columns.length:this.options.frozenColumns;
3616 g++){this.highlightCell(this.columns[g].cell(e.row))
3619 }},cursorOutline:function(c){var d;
3620 switch(this.options.highlightElem){case"menuCell":case"cursorCell":d=this.highlightDiv[c.tabIdx];
3621 d.style.left=(this.columns[c.column].dataCell.offsetLeft-1)+"px";
3622 d.style.width=this.columns[c.column].colWidth;
3623 this.highlightDiv[1-c.tabIdx].style.display="none";
3625 case"menuRow":case"cursorRow":d=this.highlightDiv[0];
3626 var b=this.options.highlightSection&1;
3627 var a=this.options.highlightSection&2;
3628 d.style.left=b?"0px":this.frozenTabs.style.width;
3629 d.style.width=((b?this.frozenTabs.offsetWidth:0)+(a?this.innerDiv.offsetWidth:0)-4)+"px";
3632 }d.style.top=(this.hdrHt+c.row*this.rowHeight-1)+"px";
3633 d.style.height=(this.rowHeight-1)+"px";
3635 },unhighlight:function(){switch(this.options.highlightElem){case"menuCell":case"cursorCell":if(this.highlightIdx){this.unhighlightCell(this.highlightIdx.cell)
3636 }if(!this.highlightDiv){return
3639 a++){this.highlightDiv[a].style.display="none"
3641 case"menuRow":case"cursorRow":if(this.highlightIdx){this.unselectRow(this.highlightIdx.row)
3642 }if(this.highlightDiv){this.highlightDiv[0].style.display="none"
3644 }},resetContents:function(){Rico.log("resetContents");
3645 this.ClearSelection();
3646 this.buffer.clear();
3648 this.clearBookmark()
3649 },setImages:function(){for(var a=0;
3650 a<this.columns.length;
3651 a++){this.columns[a].setImage()
3652 }},findSortedColumn:function(){for(var a=0;
3653 a<this.columns.length;
3654 a++){if(this.columns[a].isSorted()){return a
3656 },findColumnsBySpec:function(b,c){var a=[];
3658 d<this.options.columnSpecs.length;
3659 d++){if(this.options.columnSpecs[d][b]==c){a.push(d)
3661 },setSortUI:function(c,b){Rico.log("setSortUI: "+c+" "+b);
3662 var a=this.findSortedColumn();
3663 if(a>=0){b=this.columns[a].getSortDirection()
3664 }else{if(typeof b!="string"){b=Rico.ColumnConst.SORT_ASC
3665 }else{b=b.toUpperCase();
3666 if(b!=Rico.ColumnConst.SORT_DESC){b=Rico.ColumnConst.SORT_ASC
3667 }}switch(typeof c){case"string":a=this.findColumnsBySpec("id",c);
3671 }}if(typeof(a)!="number"||a<0){return
3673 this.columns[a].setSorted(b);
3674 this.buffer.sortBuffer(a)
3675 },clearSort:function(){for(var a=0;
3676 a<this.columns.length;
3677 a++){this.columns[a].setUnsorted()
3678 }},clearFilters:function(){for(var a=0;
3679 a<this.columns.length;
3680 a++){this.columns[a].setUnfiltered(true)
3681 }if(this.options.filterHandler){this.options.filterHandler()
3682 }},filterCount:function(){for(var a=0,b=0;
3683 a<this.columns.length;
3684 a++){if(this.columns[a].isFiltered()){b++
3686 },sortHandler:function(){this.cancelMenu();
3687 this.ClearSelection();
3689 var a=this.findSortedColumn();
3691 }Rico.log("sortHandler: sorting column "+a);
3692 this.buffer.sortBuffer(a);
3694 this.scrollDiv.scrollTop=0;
3695 this.buffer.fetch(0)
3696 },filterHandler:function(){Rico.log("filterHandler");
3698 if(this.buffer.processingRequest){this.queueFilter=true;
3700 }this.unplugScroll();
3701 this.ClearSelection();
3703 this.clearBookmark();
3705 this.buffer.fetch(-1);
3706 Rico.runLater(10,this,"pluginScroll")
3707 },clearBookmark:function(){if(this.bookmark){this.bookmark.innerHTML=" "
3708 }},bookmarkHandler:function(a,d){var b;
3709 if(isNaN(a)||!this.bookmark){return
3710 }var c=this.buffer.totalRows;
3712 }if(c<=0){b=Rico.getPhraseById("bookmarkNoMatch")
3713 }else{if(d<0){b=Rico.getPhraseById("bookmarkNoRec")
3714 }else{if(this.buffer.foundRowCount){b=Rico.getPhraseById("bookmarkExact",a,d,c)
3715 }else{b=Rico.getPhraseById("bookmarkAbout",a,d,c)
3716 }}}this.bookmark.innerHTML=b
3717 },clearRows:function(){if(this.isBlank==true){return
3719 a<this.columns.length;
3720 a++){this.columns[a].clearColumn()
3722 },refreshContents:function(j){Rico.log("refreshContents1 "+this.tableId+": startPos="+j+" lastRow="+this.lastRowPos+" PartBlank="+this.isPartialBlank+" pageSize="+this.pageSize);
3726 if(this.queueFilter){Rico.log("refreshContents: cancelling refresh because filter has changed");
3727 this.queueFilter=false;
3728 this.filterHandler();
3730 }this.highlightEnabled=this.options.highlightSection!="none";
3731 var h=this.buffer.startPos>j;
3732 var d=h?this.buffer.startPos:j;
3733 this.contentStartPos=d+1;
3734 var b=Math.min(this.buffer.startPos+this.buffer.size,j+this.pageSize);
3735 this.buffer.setWindow(d,b);
3736 Rico.log("refreshContents2 "+this.tableId+": cStartPos="+d+" cEndPos="+b+" vPrecedesBuf="+h+" b.startPos="+this.buffer.startPos);
3737 if(j==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){return
3738 }this.isBlank=false;
3739 var m=this.options.onRefreshComplete;
3740 if((j+this.pageSize<this.buffer.startPos)||(this.buffer.startPos+this.buffer.size<j)||(this.buffer.size==0)){this.clearRows();
3741 if(m){m(this.contentStartPos,b)
3743 }Rico.log("refreshContents: contentStartPos="+d+" contentEndPos="+b+" viewPrecedesBuffer="+h);
3745 var f=this.pageSize-n;
3751 l<this.columns.length;
3752 l++){this.columns[l].displayValue(a+e)
3755 g++){this.blankRow(g+k)
3756 }if(this.options.highlightElem=="selection"){this.ShowSelection()
3757 }this.isPartialBlank=f>0;
3759 Rico.log("refreshContents complete, startPos="+j);
3760 if(m){m(this.contentStartPos,b)
3761 }},scrollToRow:function(a){var b=this.rowToPixel(a);
3762 Rico.log("scrollToRow, rowOffset="+a+" pixel="+b);
3763 this.scrollDiv.scrollTop=b;
3764 if(this.options.onscroll){this.options.onscroll(this,a)
3765 }},scrollUp:function(){this.moveRelative(-1)
3766 },scrollDown:function(){this.moveRelative(1)
3767 },pageUp:function(){this.moveRelative(-this.pageSize)
3768 },pageDown:function(){this.moveRelative(this.pageSize)
3769 },adjustRow:function(a){var b=this.topOfLastPage();
3770 if(b==0||!a){return 0
3771 }return Math.min(b,a)
3772 },rowToPixel:function(a){return this.adjustRow(a)*this.rowHeight
3773 },pixeltorow:function(c){var b=this.topOfLastPage();
3775 }var a=parseInt(c/this.rowHeight,10);
3776 return Math.min(b,a)
3777 },moveRelative:function(b){var a=Math.max(this.scrollDiv.scrollTop+b*this.rowHeight,0);
3778 a=Math.min(a,this.scrollDiv.scrollHeight);
3779 this.scrollDiv.scrollTop=a
3780 },pluginScroll:function(){if(this.scrollPluggedIn){return
3781 }Rico.log("pluginScroll: wheelEvent="+this.wheelEvent);
3782 Rico.eventBind(this.scrollDiv,"scroll",this.scrollEventFunc,false);
3785 a++){Rico.eventBind(this.tabs[a],this.wheelEvent,this.wheelEventFunc,false)
3786 }this.scrollPluggedIn=true
3787 },unplugScroll:function(){if(!this.scrollPluggedIn){return
3788 }Rico.log("unplugScroll");
3789 Rico.eventUnbind(this.scrollDiv,"scroll",this.scrollEventFunc,false);
3792 a++){Rico.eventUnbind(this.tabs[a],this.wheelEvent,this.wheelEventFunc,false)
3793 }this.scrollPluggedIn=false
3794 },handleWheel:function(a){var b=0;
3795 if(a.wheelDelta){if(Rico.isOpera){b=a.wheelDelta/120
3796 }else{if(Rico.isWebKit){b=-a.wheelDelta/12
3797 }else{b=-a.wheelDelta/120
3798 }}}else{if(a.detail){b=a.detail/3
3799 }}if(b){this.moveRelative(b)
3802 },handleScroll:function(g){if(this.scrollTimeout){clearTimeout(this.scrollTimeout)
3803 }this.setHorizontalScroll();
3804 var a=this.scrollDiv.scrollTop;
3805 var b=this.lastScrollPos-a;
3807 }var d=this.pixeltorow(a);
3808 if(d==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){return
3810 Rico.log("handleScroll, newrow="+d+" scrtop="+a);
3811 if(this.options.highlightElem=="selection"){this.HideSelection()
3812 }this.buffer.fetch(d);
3813 if(this.options.onscroll){this.options.onscroll(this,d)
3814 }this.scrollTimeout=Rico.runLater(1200,this,"scrollIdle");
3815 this.lastScrollPos=this.scrollDiv.scrollTop;
3817 },scrollIdle:function(){if(this.options.onscrollidle){this.options.onscrollidle()
3819 Rico.LiveGridColumn=function(a,d,c,b){this.initialize(a,d,c,b)
3821 Rico.LiveGridColumn.prototype={initialize:function(liveGrid,colIdx,hdrInfo,tabIdx){Rico.extend(this,new Rico.TableColumnBase());
3822 this.baseInit(liveGrid,colIdx,hdrInfo,tabIdx);
3823 this.buffer=liveGrid.buffer;
3824 if(typeof(this.format.type)!="string"||this.format.EntryType=="tinyMCE"){this.format.type="html"
3825 }if(typeof this.isNullable!="boolean"){this.isNullable=/number|date/.test(this.format.type)
3826 }this.isText=/html|text/.test(this.format.type);
3827 Rico.log(" sortable="+this.sortable+" filterable="+this.filterable+" hideable="+this.hideable+" isNullable="+this.isNullable+" isText="+this.isText);
3828 this.fixHeaders(this.liveGrid.tableId,this.options.hdrIconsFirst);
3829 if(this["format_"+this.format.type]){this._format=this["format_"+this.format.type]
3830 }if(this.format.control){if(typeof this.format.control=="string"){this.format.control=eval(this.format.control)
3831 }for(var property in this.format.control){if(property.charAt(0)=="_"){Rico.log("Copying control property "+property+" to "+this);
3832 this[property]=this.format.control[property]
3833 }}}},sortAsc:function(){this.setColumnSort(Rico.ColumnConst.SORT_ASC)
3834 },sortDesc:function(){this.setColumnSort(Rico.ColumnConst.SORT_DESC)
3835 },setColumnSort:function(a){this.liveGrid.clearSort();
3837 if(this.liveGrid.options.saveColumnInfo.sort){this.liveGrid.setCookie()
3838 }if(this.options.sortHandler){this.options.sortHandler()
3839 }},isSortable:function(){return this.sortable
3840 },isSorted:function(){return this.currentSort!=Rico.ColumnConst.UNSORTED
3841 },getSortDirection:function(){return this.currentSort
3842 },toggleSort:function(){if(this.buffer&&this.buffer.totalRows==0){return
3843 }if(this.currentSort==Rico.ColumnConst.SORT_ASC){this.sortDesc()
3844 }else{this.sortAsc()
3845 }},setUnsorted:function(){this.setSorted(Rico.ColumnConst.UNSORTED)
3846 },setSorted:function(a){this.currentSort=a
3847 },canFilter:function(){return this.filterable
3848 },getFilterText:function(){var c=[];
3850 b<this.filterValues.length;
3851 b++){var a=this.filterValues[b];
3852 c.push(a==""?Rico.getPhraseById("filterBlank"):a)
3853 }switch(this.filterOp){case"EQ":return"= "+c.join(", ");
3854 case"NE":return Rico.getPhraseById("filterNot",c.join(", "));
3855 case"LE":return"<= "+c[0];
3856 case"GE":return">= "+c[0];
3857 case"LIKE":return Rico.getPhraseById("filterLike",c[0]);
3858 case"NULL":return Rico.getPhraseById("filterEmpty");
3859 case"NOTNULL":return Rico.getPhraseById("filterNotEmpty")
3861 },getFilterQueryParm:function(){if(this.filterType==Rico.ColumnConst.UNFILTERED){return""
3862 }var a="&f["+this.index+"][op]="+this.filterOp;
3863 a+="&f["+this.index+"][len]="+this.filterValues.length;
3865 b<this.filterValues.length;
3866 b++){a+="&f["+this.index+"]["+b+"]="+escape(this.filterValues[b])
3868 },setUnfiltered:function(a){this.filterType=Rico.ColumnConst.UNFILTERED;
3869 if(this.liveGrid.options.saveColumnInfo.filter){this.liveGrid.setCookie()
3870 }if(this.removeFilterFunc){this.removeFilterFunc()
3871 }if(this.options.filterHandler&&!a){this.options.filterHandler()
3872 }},setFilterEQ:function(){this.setUserFilter("EQ")
3873 },setFilterNE:function(){this.setUserFilter("NE")
3874 },addFilterNE:function(){this.filterValues.push(this.userFilter);
3875 if(this.liveGrid.options.saveColumnInfo.filter){this.liveGrid.setCookie()
3876 }if(this.options.filterHandler){this.options.filterHandler()
3877 }},setFilterGE:function(){this.setUserFilter("GE")
3878 },setFilterLE:function(){this.setUserFilter("LE")
3879 },setFilterKW:function(a){if(a!=""&&a!=null){this.setFilter("LIKE",a,Rico.ColumnConst.USERFILTER)
3880 }else{this.setUnfiltered(false)
3881 }},setUserFilter:function(a){this.setFilter(a,this.userFilter,Rico.ColumnConst.USERFILTER)
3882 },setSystemFilter:function(a,b){this.setFilter(a,b,Rico.ColumnConst.SYSTEMFILTER)
3883 },setFilter:function(a,c,b,d){this.filterValues=typeof(c)=="object"?c:[c];
3886 if(b==Rico.ColumnConst.USERFILTER&&this.liveGrid.options.saveColumnInfo.filter){this.liveGrid.setCookie()
3887 }this.removeFilterFunc=d;
3888 if(this.options.filterHandler){this.options.filterHandler()
3889 }},isFiltered:function(){return this.filterType==Rico.ColumnConst.USERFILTER
3890 },filterChange:function(a){var b=Rico.eventElement(a);
3891 if(b.value==this.liveGrid.options.FilterAllToken){this.setUnfiltered()
3892 }else{this.setFilter("EQ",b.value,Rico.ColumnConst.USERFILTER,function(){b.selectedIndex=0
3894 }},filterClear:function(a){this.filterField.value="";
3895 this.setUnfiltered()
3896 },filterKeypress:function(c){var a=Rico.eventElement(c);
3897 if(typeof this.lastKeyFilter!="string"){this.lastKeyFilter=""
3898 }if(this.lastKeyFilter==a.value){return
3900 Rico.log("filterKeypress: "+this.index+" "+b);
3901 this.lastKeyFilter=b;
3902 if(b==""||b=="*"){this.setUnfiltered()
3903 }else{this.setFilter("LIKE",b,Rico.ColumnConst.USERFILTER,function(){a.value=""
3905 }},mFilterSelectClick:function(a){Rico.eventStop(a);
3906 if(this.mFilter.style.display!="none"){this.mFilterFinish(a);
3907 if(Rico.isIE&&Rico.ieVersion<=6){this.filterField.focus()
3908 }else{this.filterField.blur()
3909 }}else{var b=Rico.cumulativeOffset(this.filterField);
3910 this.mFilter.style.top=(b.top+this.filterField.offsetHeight)+"px";
3911 this.mFilter.style.left=b.left+"px";
3912 this.mFilter.style.width=Math.min(this.filterField.offsetWidth,parseInt(this.colWidth,10))+"px";
3913 Rico.show(this.mFilter);
3914 this.mFilterFocus.focus()
3915 }},mFilterFinish:function(g){if(!this.mFilterChange){Rico.hide(this.mFilter);
3917 }if(this.mFilterInputs[0].checked){this.mFilterReset();
3918 Rico.hide(this.mFilter);
3919 this.setUnfiltered();
3924 d<this.mFilterInputs.length;
3925 d++){if(this.mFilterInputs[d].checked){c.push(this.mFilterInputs[d].value);
3926 a.push(this.mFilterLabels[d].innerHTML)
3927 }}if(c.length>0){var f=a.join(", ");
3928 this.filterField.options[0].text=f;
3929 this.filterField.title=f;
3930 Rico.hide(this.mFilter);
3931 this.mFilterChange=false;
3933 this.setFilter("EQ",c,Rico.ColumnConst.USERFILTER,function(){b.mFilterReset()
3935 }else{alert("Please select at least one value")
3936 }},mFilterReset:function(){var a=this.mFilterLabels[0].innerHTML;
3937 this.filterField.options[0].text=a;
3938 this.filterField.title=a
3939 },mFilterAllClick:function(c){var a=this.mFilterInputs[0].checked;
3941 b<this.mFilterInputs.length;
3942 b++){this.mFilterInputs[b].checked=a
3943 }this.mFilterChange=true
3944 },mFilterOtherClick:function(a){this.mFilterInputs[0].checked=false;
3945 this.mFilterChange=true
3946 },format_text:function(a){if(typeof a!="string"){return" "
3947 }else{return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")
3948 }},format_number:function(a){if(typeof a=="undefined"||a==""||a==null){return" "
3949 }else{return Rico.formatNumber(a,this.format)
3950 }},format_datetime:function(a){if(typeof a=="undefined"||a==""||a==null){return" "
3951 }else{var b=Rico.setISO8601(a);
3953 }return(this.format.prefix||"")+Rico.formatDate(b,this.format.dateFmt||"translateDateTime")+(this.format.suffix||"")
3954 }},format_utcaslocaltime:function(a){if(typeof a=="undefined"||a==""||a==null){return" "
3955 }else{var c=new Date();
3956 var b=Rico.setISO8601(a,-c.getTimezoneOffset());
3958 }return(this.format.prefix||"")+Rico.formatDate(b,this.format.dateFmt||"translateDateTime")+(this.format.suffix||"")
3959 }},format_date:function(a){if(typeof a=="undefined"||a==null||a==""){return" "
3960 }else{var b=Rico.setISO8601(a);
3962 }return(this.format.prefix||"")+Rico.formatDate(b,this.format.dateFmt||"translateDate")+(this.format.suffix||"")
3963 }},fixHeaders:function(d,e){if(this.sortable){var c=Rico.eventHandle(this,"toggleSort");
3964 switch(this.options.headingSort){case"link":var b=Rico.wrapChildren(this.hdrCellDiv,"ricoSort",undefined,"a");
3965 b.href="javascript:void(0)";
3966 Rico.eventBind(b,"click",c);
3968 case"hover":Rico.eventBind(this.hdrCellDiv,"click",c);
3970 }}this.imgFilter=document.createElement("span");
3971 this.imgFilter.style.display="none";
3972 this.imgFilter.className="rico-icon ricoLG_filterCol";
3973 this.imgSort=document.createElement("span");
3974 this.imgSort.style.display="none";
3975 this.imgSort.style.verticalAlign="top";
3976 if(e){this.hdrCellDiv.insertBefore(this.imgSort,this.hdrCellDiv.firstChild);
3977 this.hdrCellDiv.insertBefore(this.imgFilter,this.hdrCellDiv.firstChild)
3978 }else{this.hdrCellDiv.appendChild(this.imgFilter);
3979 this.hdrCellDiv.appendChild(this.imgSort)
3980 }if(!this.format.filterUI){Rico.eventBind(this.imgFilter,"click",Rico.eventHandle(this,"filterClick"),false)
3981 }},filterClick:function(a){if(this.filterType==Rico.ColumnConst.USERFILTER&&this.filterOp=="LIKE"){this.liveGrid.openKeyword(this.index)
3982 }},getValue:function(a){return this.buffer.getWindowCell(a,this.index)
3983 },getBufferStyle:function(a){return this.buffer.getWindowStyle(a,this.index)
3984 },setValue:function(b,a){this.buffer.setWindowValue(b,this.index,a)
3985 },_format:function(a){return a
3986 },_display:function(a,b){b.innerHTML=this._format(a)
3987 },_export:function(a){return this._format(a)
3988 },exportBuffer:function(a){return this._export(this.buffer.getValue(a,this.index))
3989 },displayValue:function(c){var a=this.getValue(c);
3990 if(a==null){this.clearCell(c);
3992 }var b=this.cell(c);
3993 this._display(a,b,c);
3994 if(this.buffer.options.acceptStyle){b.style.cssText=this.getBufferStyle(c)
3996 Rico.TableColumn={};
3997 Rico.TableColumn.checkboxKey=function(a){this.initialize(a)
3999 Rico.TableColumn.checkboxKey.prototype={initialize:function(a){this._checkboxes=[];
4003 },_create:function(a,b){this._checkboxes[b]=Rico.createFormField(a,"input","checkbox",this.liveGrid.tableId+"_chkbox_"+this.index+"_"+b);
4004 this._spans[b]=Rico.createFormField(a,"span",null,this.liveGrid.tableId+"_desc_"+this.index+"_"+b);
4006 Rico.eventBind(this._checkboxes[b],"click",Rico.eventHandle(this,"_onclick"))
4007 },_onclick:function(c){var b=Event.element(c);
4008 var d=parseInt(b.id.substr((b.id.lastIndexOf("_",b.id.length)+1)));
4009 var a=this.getValue(d);
4010 if(b.checked){this._addChecked(a)
4011 }else{this._remChecked(a)
4012 }},_clear:function(b,c){var a=this._checkboxes[c];
4014 a.style.display="none";
4015 this._spans[c].innerHTML=""
4016 },_display:function(a,c,d){var b=this._checkboxes[d];
4018 b.checked=this._KeyHash[a];
4019 if(this._showKey){this._spans[d].innerHTML=a
4020 }},_SelectedKeys:function(){return Rico.keys(this._KeyHash)
4021 },_addChecked:function(a){this._KeyHash[a]=1
4022 },_remChecked:function(a){delete this._KeyHash[a]
4024 Rico.TableColumn.checkbox=function(b,c,a,d){this.initialize(b,c,a,d)
4026 Rico.TableColumn.checkbox.prototype={initialize:function(b,c,a,d){this._checkedValue=b;
4027 this._uncheckedValue=c;
4028 this._defaultValue=a||false;
4029 this._readOnly=d||false;
4031 },_create:function(a,b){this._checkboxes[b]=Rico.createFormField(a,"input","checkbox",this.liveGrid.tableId+"_chkbox_"+this.index+"_"+b);
4033 if(this._readOnly){this._checkboxes[b].disabled=true
4034 }else{Rico.eventBind(this._checkboxes[b],"click",Rico.eventHandle(this,"_onclick"))
4035 }},_onclick:function(c){var a=Event.element(c);
4036 var d=parseInt(a.id.substr((a.id.lastIndexOf("_",a.id.length)+1)));
4037 var b=a.checked?this._checkedValue:this._uncheckedValue;
4039 },_clear:function(b,c){var a=this._checkboxes[c];
4040 a.checked=this._defaultValue;
4041 a.style.display="none"
4042 },_display:function(a,c,d){var b=this._checkboxes[d];
4044 b.checked=(a==this._checkedValue)
4046 Rico.TableColumn.textbox=function(c,b,a){this.initialize(c,b,a)
4048 Rico.TableColumn.textbox.prototype={initialize:function(c,b,a){this._boxSize=c;
4050 this._readOnly=a||false;
4052 },_create:function(b,c){var a=Rico.createFormField(b,"input","text",this.liveGrid.tableId+"_txtbox_"+this.index+"_"+c);
4053 a.size=this._boxSize;
4054 a.maxLength=this._boxMaxLen;
4055 this._textboxes[c]=a;
4057 if(this._readOnly){a.disabled=true
4058 }else{Rico.eventBind(a,"change",Rico.eventHandle(this,"_onchange"))
4059 }},_onchange:function(b){var a=Event.element(b);
4060 var c=parseInt(a.id.substr((a.id.lastIndexOf("_",a.id.length)+1)));
4061 this.setValue(c,a.value)
4062 },_clear:function(b,c){var a=this._textboxes[c];
4064 a.style.display="none"
4065 },_display:function(a,c,d){var b=this._textboxes[d];
4069 Rico.TableColumn.bgColor=function(){};
4070 Rico.TableColumn.bgColor.prototype={_clear:function(a,b){a.style.backgroundColor=""
4071 },_display:function(a,b,c){b.style.backgroundColor=a
4073 Rico.TableColumn.link=function(a,c,b){this.initialize(a,c,b)
4075 Rico.TableColumn.link.prototype={initialize:function(a,c,b){this._href=a;
4079 },_create:function(c,d){var b=c.appendChild(document.createElement("a"));
4080 if(this._target){b.target=this._target
4082 b.innerHTML=Rico.isIE?" ":"";
4084 },_clear:function(a,b){this._anchors[b].style.display="none"
4085 },_display:function(b,d,f){var c=this.liveGrid.buffer;
4086 var a=this._href=="self"?b:this._href.replace(/\{\d+\}/g,function(g){var h=parseInt(g.substr(1),10);
4087 return encodeURIComponent(c.getWindowValue(f,h))
4089 var e=this._linktext||b;
4090 if(a&&e){this._anchors[f].href=a;
4091 this._anchors[f].innerHTML=e;
4092 this._anchors[f].style.display=""
4093 }else{this._clear(d,f)
4095 Rico.TableColumn.image=function(a,b){this.initialize(a,b)
4097 Rico.TableColumn.image.prototype={initialize:function(a,b){this._img=[];
4100 },_create:function(a,b){this._img[b]=Rico.createFormField(a,"img",null,this.liveGrid.tableId+"_img_"+this.index+"_"+b);
4102 },_clear:function(b,c){var a=this._img[c];
4103 a.style.display="none";
4105 },_display:function(b,c,d){var a=this._img[d];
4106 this._img[d].src=this._prefix+b+this._suffix;
4109 Rico.TableColumn.lookup=function(c,a,b){this.initialize(c,a,b)
4111 Rico.TableColumn.lookup.prototype={initialize:function(d,a,c){this._map=d;
4112 this._defaultCode=a||"";
4113 this._defaultDesc=c||" ";
4115 this._sortfunc=function(e){return b._sortvalue(e)
4118 this._descriptions=[]
4119 },_create:function(a,b){this._descriptions[b]=Rico.createFormField(a,"span",null,this.liveGrid.tableId+"_desc_"+this.index+"_"+b);
4120 this._codes[b]=Rico.createFormField(a,"input","hidden",this.liveGrid.tableId+"_code_"+this.index+"_"+b);
4122 },_clear:function(a,b){this._codes[b].value=this._defaultCode;
4123 this._descriptions[b].innerHTML=this._defaultDesc
4124 },_sortvalue:function(a){return this._getdesc(a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/ /g," ")
4125 },_getdesc:function(a){var b=this._map[a];
4126 return(typeof b=="string")?b:this._defaultDesc
4127 },_export:function(a){return this._getdesc(a)
4128 },_display:function(a,b,c){this._codes[c].value=a;
4129 this._descriptions[c].innerHTML=this._getdesc(a)
4131 Rico.TableColumn.MultiLine=function(){};
4132 Rico.TableColumn.MultiLine.prototype={_display:function(a,c,d){var b=document.createElement("div");
4133 b.innerHTML=this._format(a);
4134 b.style.height="100%";
4135 if(c.firstChild){c.replaceChild(b,c.firstChild)
4136 }else{c.appendChild(b)
4138 Rico.GridMenu=function(a){this.initialize(a)
4140 Rico.GridMenu.prototype={initialize:function(a){this.options={width:"18em",dataMenuHandler:null};
4141 Rico.extend(this.options,a||{});
4142 Rico.extend(this,new Rico.Menu(this.options));
4143 this.sortmenu=new Rico.Menu({width:"15em"});
4144 this.filtermenu=new Rico.Menu({width:"22em"});
4145 this.exportmenu=new Rico.Menu({width:"24em"});
4146 this.hideshowmenu=new Rico.Menu({width:"22em"});
4148 this.sortmenu.createDiv();
4149 this.filtermenu.createDiv();
4150 this.exportmenu.createDiv();
4151 this.hideshowmenu.createDiv()
4152 },buildGridMenu:function(a,i){this.clearMenu();
4153 var o=this.liveGrid;
4156 var n=o.options.maxPrint;
4159 if(this.options.dataMenuHandler){var l=this.options.dataMenuHandler(o,a,i,b);
4160 if(!l){return(this.itemCount>0)
4161 }}if(d.sortable&&m>0){this.sortmenu.clearMenu();
4162 this.addSubMenuItem(Rico.getPhraseById("gridmenuSortBy",d.displayName),this.sortmenu,false);
4163 this.sortmenu.addMenuItemId("gridmenuSortAsc",function(){d.sortAsc()
4165 this.sortmenu.addMenuItemId("gridmenuSortDesc",function(){d.sortDesc()
4167 }this.filtermenu.clearMenu();
4168 if(d.canFilter()){this.addSubMenuItem(Rico.getPhraseById("gridmenuFilterBy",d.displayName),this.filtermenu,false);
4169 if(!d.format.filterUI&&(!b||d.filterType==Rico.ColumnConst.USERFILTER)){d.userFilter=d.getValue(a);
4170 if(d.filterType==Rico.ColumnConst.USERFILTER){this.filtermenu.addMenuItemId("gridmenuRemoveFilter",function(){d.setUnfiltered(false)
4172 if(d.filterOp=="LIKE"){this.filtermenu.addMenuItemId("gridmenuChgKeyword",function(){o.openKeyword(i)
4174 }if(d.filterOp=="NE"&&!b){this.filtermenu.addMenuItemId("gridmenuExcludeAlso",function(){d.addFilterNE()
4176 }}else{if(!b){this.filtermenu.addMenuItemId("gridmenuInclude",function(){d.setFilterEQ()
4178 this.filtermenu.addMenuItemId("gridmenuGreaterThan",function(){d.setFilterGE()
4179 },d.userFilter!="");
4180 this.filtermenu.addMenuItemId("gridmenuLessThan",function(){d.setFilterLE()
4181 },d.userFilter!="");
4182 if(d.isText){this.filtermenu.addMenuItemId("gridmenuContains",function(){o.openKeyword(i)
4184 }this.filtermenu.addMenuItemId("gridmenuExclude",function(){d.setFilterNE()
4186 }}}if(o.filterCount()>0){this.filtermenu.addMenuItemId("gridmenuRemoveAll",function(){o.clearFilters()
4188 }if(f.options.canRefresh){this.filtermenu.addMenuItemId("gridmenuRefresh",function(){o.filterHandler()
4190 }}this.exportmenu.clearMenu();
4191 if(n>0){this.addSubMenuItem(Rico.getPhraseById("gridmenuExport"),this.exportmenu,false);
4192 if(f.printVisibleSQL&&typeof(f.dataSource)=="string"){this.exportmenu.addMenuItemId("gridmenuExportVis2Web",function(){f.printVisibleSQL("html")
4194 this.exportmenu.addMenuItemId("gridmenuExportAll2Web",function(){f.printAllSQL("html")
4196 this.exportmenu.addMenuBreak();
4197 this.exportmenu.addMenuItemId("gridmenuExportVis2SS",function(){f.printVisibleSQL("xl")
4199 this.exportmenu.addMenuItemId("gridmenuExportAll2SS",function(){f.printAllSQL("xl")
4201 }else{this.exportmenu.addMenuItemId("gridmenuExportVis2Web",function(){f.printVisible()
4203 this.exportmenu.addMenuItemId("gridmenuExportAll2Web",function(){f.printAll()
4205 }}var k=o.listInvisible();
4208 j++){if(k[j].canHideShow()){e++
4209 }}if(e>0||d.canHideShow()){this.hideshowmenu.clearMenu();
4210 this.addSubMenuItem(Rico.getPhraseById("gridmenuHideShow"),this.hideshowmenu,false);
4211 this.hideshowmenu.addMenuItemId("gridmenuChooseCols",function(){o.chooseColumns()
4213 var h=o.columns.length-k.length;
4214 var g=(h>1&&d.visible&&d.canHideShow());
4215 this.hideshowmenu.addMenuItem(Rico.getPhraseById("gridmenuHide",d.displayName),function(){d.hideColumn()
4217 if(k.length>1){this.hideshowmenu.addMenuItemId("gridmenuShowAll",function(){o.showAll()
4221 if(typeof Rico=="undefined"){throw ("LiveGridAjax requires the Rico JavaScript framework")
4222 }if(!Rico.Buffer){Rico.Buffer={}
4223 }Rico.Buffer.AjaxLoadOnce=function(c,b,a){this.initialize(c,b,a)
4225 Rico.Buffer.AjaxLoadOnce.prototype={initialize:function(c,b,a){Rico.extend(this,new Rico.Buffer.Base());
4226 Rico.extend(this,Rico.Buffer.AjaxXMLMethods);
4228 this.options.bufferTimeout=20000;
4229 this.options.requestParameters=[];
4230 this.options.waitMsg=Rico.getPhraseById("waitForData");
4231 this.options.canFilter=true;
4232 this.options.fmt="xml";
4233 Rico.extend(this.options,b||{});
4234 this.ajaxOptions={parameters:null,method:"get"};
4235 Rico.extend(this.ajaxOptions,a||{});
4236 this.requestCount=0;
4237 this.processingRequest=false;
4238 this.pendingRequest=-2;
4239 this.fetchData=true;
4242 Rico.Buffer.AjaxXMLMethods={fetch:function(b){if(this.fetchData){this.foundRowCount=true;
4243 this.fetchData=false;
4244 this.processingRequest=true;
4245 this.liveGrid.showMsg(this.options.waitMsg);
4246 this.timeoutHandler=Rico.runLater(this.options.bufferTimeout,this,"handleTimedOut");
4247 this.ajaxOptions.parameters=this.formQueryHashXML(0,-1);
4248 Rico.log("sending request");
4250 if(typeof this.dataSource=="string"){this.ajaxOptions.onComplete=function(c){a.ajaxUpdate(b,c)
4252 new Rico.ajaxRequest(this.dataSource,this.ajaxOptions)
4253 }else{this.ajaxOptions.onComplete=function(d,f,c,e){a.jsUpdate(b,d,f,c,e)
4255 this.dataSource(this.ajaxOptions)
4256 }}else{if(b<0){this.applyFilters();
4257 this.setTotalRows(this.size);
4259 }this.liveGrid.refreshContents(b)
4260 }},handleTimedOut:function(){Rico.log("Request Timed Out");
4261 this.liveGrid.showMsg(Rico.getPhraseById("requestTimedOut"))
4262 },formQueryHashXML:function(e,c){var d={id:this.liveGrid.tableId,page_size:(typeof c=="number")?c:this.totalRows,offset:e.toString()};
4263 if(!this.foundRowCount){d.get_total="true"
4264 }if(this.options.requestParameters){for(var f=0;
4265 f<this.options.requestParameters.length;
4266 f++){var g=this.options.requestParameters[f];
4267 if(g.name!=undefined&&g.value!=undefined){d[g.name]=g.value
4268 }else{var b=g.indexOf("=");
4269 var h=g.substring(0,b);
4270 var a=g.substring(b+1);
4273 },clearTimer:function(){if(typeof this.timeoutHandler!="number"){return
4274 }window.clearTimeout(this.timeoutHandler);
4275 delete this.timeoutHandler
4276 },jsUpdate:function(a,c,e,b,d){this.clearTimer();
4277 this.processingRequest=false;
4278 Rico.log("jsUpdate: "+arguments.length);
4279 if(d){Rico.log("jsUpdate: received error="+d);
4280 this.liveGrid.showMsg(Rico.getPhraseById("requestError",d));
4282 }this.rcvdRows=c.length;
4283 if(typeof b=="number"){this.rowcntContent=b.toString();
4284 this.rcvdRowCount=true;
4285 this.foundRowCount=true;
4286 Rico.log("jsUpdate: found RowCount="+this.rowcntContent)
4287 }this.updateBuffer(a,c,e);
4288 if(this.options.onAjaxUpdate){this.options.onAjaxUpdate()
4289 }this.updateGrid(a);
4290 if(this.options.TimeOut&&this.timerMsg){this.restartSessionTimer()
4291 }if(this.pendingRequest>=-1){var f=this.pendingRequest;
4292 Rico.log("jsUpdate: found pending request for offset="+f);
4293 this.pendingRequest=-2;
4295 }},ajaxUpdate:function(a,c){this.clearTimer();
4296 this.processingRequest=false;
4297 if(c.status!=200){Rico.log("ajaxUpdate: received http error="+c.status);
4298 this.liveGrid.showMsg(Rico.getPhraseById("httpError",c.status));
4300 }this._responseHandler=this["processResponse"+this.options.fmt.toUpperCase()];
4301 if(!this._responseHandler(a,c)){return
4302 }if(this.options.onAjaxUpdate){this.options.onAjaxUpdate()
4303 }this.updateGrid(a);
4304 if(this.options.TimeOut&&this.timerMsg){this.restartSessionTimer()
4305 }if(this.pendingRequest>=-1){var b=this.pendingRequest;
4306 Rico.log("ajaxUpdate: found pending request for offset="+b);
4307 this.pendingRequest=-2;
4309 }},processResponseXML:function(k,f){var o=f.responseXML;
4310 if(f.responseText.substring(0,4)=="<!--"){var m=f.responseText.indexOf("-->");
4311 if(m==-1){this.liveGrid.showMsg("Web server error - client side debugging may be enabled");
4313 }o=Rico.createXmlDocument();
4314 o.loadXML(f.responseText.substring(m+3))
4315 }if(!o){alert("Data provider returned an invalid XML response");
4316 Rico.log("Data provider returned an invalid XML response");
4318 }var d=o.getElementsByTagName("ajax-response");
4319 if(d==null||d.length!=1){alert("Received invalid response from server");
4321 }Rico.log("Processing ajax-response");
4323 this.rcvdRowCount=false;
4325 var a=b.getElementsByTagName("debug");
4328 g++){Rico.log("ajaxUpdate: debug msg "+g+": "+Rico.getContentAsString(a[g],this.options.isEncoded))
4329 }var l=b.getElementsByTagName("error");
4330 if(l.length>0){var c=Rico.getContentAsString(l[0],this.options.isEncoded);
4331 alert("Data provider returned an error:\n"+c);
4332 Rico.log("Data provider returned an error:\n"+c);
4334 }var j=b.getElementsByTagName("rows")[0];
4335 if(!j){Rico.log("ajaxUpdate: invalid response");
4336 this.liveGrid.showMsg(Rico.getPhraseById("invalidResponse"));
4338 }var n=b.getElementsByTagName("rowcount");
4339 if(n&&n.length==1){this.rowcntContent=Rico.getContentAsString(n[0],this.options.isEncoded);
4340 this.rcvdRowCount=true;
4341 this.foundRowCount=true;
4342 Rico.log("ajaxUpdate: found RowCount="+this.rowcntContent)
4343 }this.updateUI=j.getAttribute("update_ui")=="true";
4344 this.rcvdOffset=j.getAttribute("offset");
4345 Rico.log("ajaxUpdate: rcvdOffset="+this.rcvdOffset);
4346 var h=this.dom2jstable(j);
4347 var e=(this.options.acceptStyle)?this.dom2jstableStyle(j):false;
4348 this.rcvdRows=h.length;
4349 this.updateBuffer(k,h,e);
4351 },dom2jstableStyle:function(e,b){var a=this.options.acceptStyle;
4352 Rico.log("dom2jstableStyle start");
4354 var g=e.getElementsByTagName("tr");
4358 var h=g[d].getElementsByTagName("td");
4361 c++){k[c]=h[c].getAttribute("style")||""
4363 }Rico.log("dom2jstableStyle end");
4365 },processResponseJSON:function(a,d){var c=Rico.getJSON(d);
4366 if(!c||c==null){alert("Data provider returned an invalid JSON response");
4367 Rico.log("Data provider returned an invalid JSON response");
4369 }if(c.debug){for(var b=0;
4371 b++){Rico.writeDebugMsg("debug msg "+b+": "+c.debug[b])
4372 }}if(c.error){alert("Data provider returned an error:\n"+c.error);
4373 Rico.writeDebugMsg("Data provider returned an error:\n"+c.error);
4375 }if(c.rowcount){this.rowcntContent=c.rowcount;
4376 this.rcvdRowCount=true;
4377 this.foundRowCount=true;
4378 Rico.writeDebugMsg("loadRows, found RowCount="+c.rowcount)
4379 }this.rcvdRows=c.rows.length;
4380 this.updateBuffer(a,c.rows,c.styles);
4382 },updateBuffer:function(c,a,b){this.baseRows=a;
4384 Rico.log("updateBuffer: # of rows="+this.rcvdRows);
4385 this.rcvdRowCount=true;
4386 this.rowcntContent=this.rcvdRows;
4387 if(typeof this.delayedSortCol=="number"){this.sortBuffer(this.delayedSortCol)
4388 }this.applyFilters();
4390 },updateGrid:function(f){Rico.log("updateGrid, size="+this.size+" rcv cnt type="+typeof(this.rowcntContent));
4392 if(this.rcvdRowCount==true){Rico.log("found row cnt: "+this.rowcntContent);
4393 var d=parseInt(this.rowcntContent,10);
4394 var b=this.totalRows;
4395 if(!isNaN(d)&&d!=b){this.setTotalRows(d);
4396 e=Math.min(this.liveGrid.topOfLastPage(),f);
4397 Rico.log("updateGrid: new rowcnt="+d+" newpos="+e);
4398 if(b==0&&this.liveGrid.sizeTo=="data"){Rico.runLater(100,this.liveGrid,"adjustPageSize")
4399 }this.liveGrid.scrollToRow(e);
4400 if(this.isInRange(e)){this.liveGrid.refreshContents(e)
4403 }}else{var a=f+this.rcvdRows;
4404 if(a>this.totalRows){var c=a;
4405 Rico.log("extending totrows to "+c);
4406 this.setTotalRows(c)
4407 }}e=this.liveGrid.pixeltorow(this.liveGrid.scrollDiv.scrollTop);
4408 Rico.log("updateGrid: newpos="+e);
4409 this.liveGrid.refreshContents(e)
4411 Rico.Buffer.AjaxSQL=function(c,b,a){this.initialize(c,b,a)
4413 Rico.Buffer.AjaxSQL.prototype={initialize:function(c,b,a){Rico.extend(this,new Rico.Buffer.AjaxLoadOnce());
4414 Rico.extend(this,Rico.Buffer.AjaxSQLMethods);
4416 this.options.canFilter=true;
4417 this.options.largeBufferSize=7;
4418 this.options.nearLimitFactor=1;
4419 this.options.canRefresh=true;
4420 Rico.extend(this.options,b||{});
4421 Rico.extend(this.ajaxOptions,a||{})
4423 Rico.Buffer.AjaxSQLMethods={registerGrid:function(a){this.liveGrid=a;
4424 this.sessionExpired=false;
4425 this.timerMsg=document.getElementById(a.tableId+"_timer");
4426 if(this.options.TimeOut&&this.timerMsg){if(!this.timerMsg.title){this.timerMsg.title=Rico.getPhraseById("sessionExpireMinutes")
4427 }this.restartSessionTimer()
4428 }},setBufferSize:function(a){this.maxFetchSize=Math.max(50,parseInt(this.options.largeBufferSize*a,10));
4429 this.nearLimit=parseInt(this.options.nearLimitFactor*a,10);
4430 this.maxBufferSize=this.maxFetchSize*3
4431 },restartSessionTimer:function(){if(this.sessionExpired==true){return
4432 }this.sessionEndTime=(new Date()).getTime()+this.options.TimeOut*60000;
4433 if(this.sessionTimer){clearTimeout(this.sessionTimer)
4434 }this.updateSessionTimer()
4435 },updateSessionTimer:function(){var b=(new Date()).getTime();
4436 if(b>this.sessionEndTime){this.displaySessionTimer(Rico.getPhraseById("sessionExpired"));
4437 this.timerMsg.style.backgroundColor="red";
4438 this.sessionExpired=true
4439 }else{var a=Math.ceil((this.sessionEndTime-b)/60000);
4440 this.displaySessionTimer(a);
4441 this.sessionTimer=Rico.runLater(10000,this,"updateSessionTimer")
4442 }},displaySessionTimer:function(a){this.timerMsg.innerHTML=" "+a+" "
4443 },refresh:function(b){var a=this.liveGrid.lastRowPos;
4445 if(b){this.setTotalRows(0);
4446 this.foundRowCount=false
4447 }this.liveGrid.clearBookmark();
4448 this.liveGrid.clearRows();
4450 },fetch:function(e){Rico.log("AjaxSQL fetch: offset="+e+", lastOffset="+this.lastOffset);
4451 if(this.processingRequest){Rico.log("AjaxSQL fetch: queue request");
4452 this.pendingRequest=e;
4454 }if((typeof e=="undefined")||(e<0)){this.clear();
4455 this.setTotalRows(0);
4456 this.foundRowCount=false;
4458 }var d=this.lastOffset;
4460 if(this.isInRange(e)){Rico.log("AjaxSQL fetch: in buffer");
4461 this.liveGrid.refreshContents(e);
4462 if(e>d){if(e+this.liveGrid.pageSize<this.endPos()-this.nearLimit){return
4463 }if(this.endPos()==this.totalRows&&this.foundRowCount){return
4464 }}else{if(e<d){if(e>this.startPos+this.nearLimit){return
4465 }if(this.startPos==0){return
4467 }}}if(e>=this.totalRows&&this.foundRowCount){return
4468 }this.processingRequest=true;
4469 Rico.log("AjaxSQL fetch: processing offset="+e);
4470 var c=this.getFetchOffset(e);
4471 var a=this.getFetchSize(c);
4473 this.liveGrid.showMsg(this.options.waitMsg);
4474 this.timeoutHandler=Rico.runLater(this.options.bufferTimeout,this,"handleTimedOut");
4475 this.ajaxOptions.parameters=this.formQueryHashSQL(c,a,this.options.fmt);
4476 this.requestCount++;
4477 Rico.log("sending req #"+this.requestCount);
4479 if(typeof this.dataSource=="string"){this.ajaxOptions.onComplete=function(g){b.ajaxUpdate(c,g)
4481 new Rico.ajaxRequest(this.dataSource,this.ajaxOptions)
4482 }else{this.ajaxOptions.onComplete=function(h,j,g,i){b.jsUpdate(c,h,j,g,i)
4484 this.dataSource(this.ajaxOptions)
4485 }},formQueryHashSQL:function(g,h,d){var k=this.formQueryHashXML(g,h);
4486 k[this.liveGrid.actionId]="query";
4488 }Rico.extend(k,this.sortParm);
4490 b<this.liveGrid.columns.length;
4491 b++){var j=this.liveGrid.columns[b];
4492 if(j.filterType==Rico.ColumnConst.UNFILTERED){continue
4493 }var a=typeof(j.format.filterCol)=="number"?j.format.filterCol:j.index;
4494 k["f["+a+"][op]"]=j.filterOp;
4495 k["f["+a+"][len]"]=j.filterValues.length;
4497 e<j.filterValues.length;
4498 e++){var f=j.filterValues[e];
4499 if(j.filterOp=="LIKE"&&f.indexOf("*")==-1){f="*"+f+"*"
4500 }k["f["+a+"]["+e+"]"]=f
4502 },getFetchSize:function(a){var b=0;
4503 if(a>=this.startPos){var c=this.maxFetchSize+a;
4505 if(a==0&&b<this.maxFetchSize){b=this.maxFetchSize
4506 }Rico.log("getFetchSize/append, adjustedSize="+b+" adjustedOffset="+a+" endFetchOffset="+c)
4507 }else{b=Math.min(this.startPos-a,this.maxFetchSize)
4509 },getFetchOffset:function(b){var a=b;
4510 if(b>this.startPos){a=Math.max(b,this.endPos())
4511 }else{if(b+this.maxFetchSize>=this.startPos){a=Math.max(this.startPos-this.maxFetchSize,0)
4513 },updateBuffer:function(d,a,b){Rico.log("updateBuffer: start="+d+", # of rows="+this.rcvdRows);
4514 if(this.rows.length==0){this.rows=a;
4517 }else{if(d>this.startPos){if(this.startPos+this.rows.length<d){this.rows=a;
4520 }else{this.rows=this.rows.concat(a.slice(0,a.length));
4521 if(this.attr){this.attr=this.attr.concat(b.slice(0,b.length))
4522 }if(this.rows.length>this.maxBufferSize){var c=this.rows.length;
4523 this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length);
4524 if(this.attr){this.attr=this.attr.slice(this.attr.length-this.maxBufferSize,this.attr.length)
4525 }this.startPos=this.startPos+(c-this.rows.length)
4526 }}}else{if(d+a.length<this.startPos){this.rows=a;
4528 }else{this.rows=a.slice(0,this.startPos).concat(this.rows);
4529 if(b){this.attr=b.slice(0,this.startPos).concat(this.attr)
4530 }if(this.maxBufferSize&&this.rows.length>this.maxBufferSize){this.rows=this.rows.slice(0,this.maxBufferSize);
4531 if(this.attr){this.attr=this.attr.slice(0,this.maxBufferSize)
4533 }}this.size=this.rows.length
4534 },sortBuffer:function(b){this.sortParm={};
4535 var a=this.liveGrid.columns[b];
4536 if(this.options.sortParmFmt){this.sortParm.sort_col=a[this.options.sortParmFmt];
4537 this.sortParm.sort_dir=a.getSortDirection()
4538 }else{this.sortParm["s"+b]=a.getSortDirection()
4540 },printAllSQL:function(a){var c=this.formQueryHashSQL(0,this.liveGrid.options.maxPrint,a);
4541 c.hidden=this.liveGrid.listInvisible("index").join(",");
4542 var b=this.dataSource+"?"+Rico.toQueryString(c);
4543 window.open(b,"",this.liveGrid.options.exportWindow)
4544 },printVisibleSQL:function(a){var c=this.formQueryHashSQL(this.liveGrid.contentStartPos-1,this.liveGrid.pageSize,a);
4545 c.hidden=this.liveGrid.listInvisible("index").join(",");
4546 var b=this.dataSource+"?"+Rico.toQueryString(c);
4547 window.open(b,"",this.liveGrid.options.exportWindow)
4548 },_printAll:function(){this.liveGrid.exportStart();
4549 this.ajaxOptions.parameters=this.formQueryHashSQL(0,this.liveGrid.options.maxPrint);
4551 this.ajaxOptions.onComplete=function(){a._jsExport()
4553 this.dataSource(this.ajaxOptions)
4554 },_jsExport:function(b,d,a,c){Rico.log("_jsExport: "+arguments.length);
4555 if(c){Rico.log("_jsExport: received error="+c);
4556 this.liveGrid.showMsg(Rico.getPhraseById("requestError",c));
4558 }this.exportBuffer(b,0);
4559 this.liveGrid.exportFinish()
4561 if(typeof Rico=="undefined"){throw ("LiveGridForms requires the Rico JavaScript framework")
4562 }Rico.TableEdit=function(a){this.initialize(a)
4564 Rico.TableEdit.prototype={initialize:function(b){Rico.log("Rico.TableEdit initialize: "+b.tableId);
4566 this.options={maxDisplayLen:20,panelHeight:200,panelWidth:500,compact:false,RecordName:Rico.getPhraseById("record"),updateURL:window.location.href,showSaveMsg:"errors"};
4567 Rico.extend(this.options,b.options);
4570 this.menu.options.dataMenuHandler=function(d,f,g,e){return a.editMenu(d,f,g,e)
4572 this.menu.ignoreClicks();
4573 this.editText=Rico.getPhraseById("editRecord",this.options.RecordName);
4574 this.cloneText=Rico.getPhraseById("cloneRecord",this.options.RecordName);
4575 this.delText=Rico.getPhraseById("deleteRecord",this.options.RecordName);
4576 this.addText=Rico.getPhraseById("addRecord",this.options.RecordName);
4577 this.buttonHover=new Rico.HoverSet();
4578 this.dateRegExp=/^\s*(\w+)(\W)(\w+)(\W)(\w+)/i;
4579 this.createKeyArray();
4580 if(typeof(this.options.ConfirmDeleteCol)!="number"){this.options.ConfirmDeleteCol=this.keys.length>0?-2:-1
4581 }this.createEditDiv();
4582 this.saveMsg=Rico.$(b.tableId+"_savemsg");
4583 Rico.eventBind(document,"click",Rico.eventHandle(this,"clearSaveMsg"));
4584 this.extraMenuItems=[];
4585 this.responseHandler=function(c){a.processResponse(c)
4587 Rico.log("Rico.TableEdit.initialize complete")
4588 },createKeyArray:function(){this.keys=[];
4590 a<this.grid.columns.length;
4591 a++){if(this.grid.columns[a].format&&this.grid.columns[a].format.isKey){this.keys.push({colidx:a})
4592 }}},createEditDiv:function(){this.requestCount=1;
4593 this.formPopup=this.createWindow();
4594 Rico.addClass(this.formPopup.content.parentNode,"ricoLG_editDiv");
4595 if(this.options.canEdit||this.options.canAdd){this.startForm();
4596 this.createForm(this.form)
4597 }else{var a=this.createButton(Rico.getPhraseById("close"));
4598 Rico.eventBind(a,"click",Rico.eventHandle(this,"cancelEdit"),false);
4599 this.createForm(this.formPopup.contentDiv)
4600 }this.editDivCreated=true;
4601 this.responseDialog=this.grid.createDiv("editResponse",document.body);
4602 this.responseDialog.style.display="none";
4603 var b=document.createElement("button");
4604 b.appendChild(document.createTextNode(Rico.getPhraseById("ok")));
4605 Rico.eventBind(b,"click",Rico.eventHandle(this,"ackResponse"));
4606 this.responseDialog.appendChild(b);
4607 this.responseDiv=this.grid.createDiv("editResponseText",this.responseDialog);
4608 if(this.panelGroup){Rico.log("createEditDiv complete, requestCount="+this.requestCount);
4609 Rico.runLater(50,this,"initPanelGroup")
4610 }},createWindow:function(){var a=this;
4611 return new Rico.Window("",{closeFunc:function(){a.makeFormInvisible()
4612 },overflow:this.options.ColGroups?"hidden":"auto"})
4613 },initPanelGroup:function(){this.requestCount--;
4614 Rico.log("initPanelGroup: "+this.requestCount);
4615 if(this.requestCount>0){return
4616 }var a=parseInt(this.options.panelWidth,10);
4617 if(this.form){if(Rico.isWebKit){this.formPopup.container.style.display="block"
4618 }this.options.bgColor=Rico.Color.createColorFromBackground(this.form).toString()
4619 }this.formPopup.container.style.display="none";
4620 this.formPanels=new Rico.TabbedPanel(this.panelGroup,this.options)
4621 },notEmpty:function(a){return typeof(a)!="undefined"
4622 },startForm:function(){this.form=document.createElement("form");
4623 this.form.onsubmit=function(){return false
4625 this.form.autocomplete="off";
4626 this.formPopup.contentDiv.appendChild(this.form);
4627 var e=document.createElement("div");
4628 e.className="ButtonBar";
4629 var d=e.appendChild(this.createButton(Rico.getPhraseById("saveRecord",this.options.RecordName)));
4630 Rico.eventBind(d,"click",Rico.eventHandle(this,"TESubmit"),false);
4631 d=e.appendChild(this.createButton(Rico.getPhraseById("cancel")));
4632 Rico.eventBind(d,"click",Rico.eventHandle(this,"cancelEdit"),false);
4633 this.form.appendChild(e);
4634 this.hiddenFields=document.createElement("div");
4635 this.hiddenFields.style.display="none";
4636 this.action=this.appendHiddenField(this.grid.actionId,"");
4639 c<this.grid.columns.length;
4640 c++){a=this.grid.columns[c].format;
4641 if(a&&a.FormView&&a.FormView=="hidden"){this.appendHiddenField(a.FieldName,a.ColData)
4644 b++){this.keys[b].keyField=this.appendHiddenField("_k"+this.keys[b].colidx,"")
4645 }this.form.appendChild(this.hiddenFields)
4646 },createButton:function(b){var a=document.createElement("a");
4647 a.href="javascript:void(0)";
4649 a.className="RicoButton";
4650 if(Rico.theme.button){Rico.addClass(a,Rico.theme.button)
4651 }this.buttonHover.add(a);
4653 },createPanel:function(c){var e=false;
4655 b<this.grid.columns.length;
4656 b++){var a=this.grid.columns[b].format;
4658 }if(!a.EntryType){continue
4659 }if(a.EntryType=="H"){continue
4660 }if(a.FormView&&a.FormView=="hidden"){continue
4661 }var d=a.ColGroupIdx||0;
4664 }}if(!e){return null
4665 }this.panelHdr[c]=document.createElement("li");
4666 this.panelHdr[c].innerHTML=this.options.ColGroups[c];
4667 this.panelHdrs.appendChild(this.panelHdr[c]);
4668 this.panelContent[c]=document.createElement("div");
4669 this.panelContents.appendChild(this.panelContent[c]);
4670 this.panelActualIdx[c]=this.panelCnt++;
4671 return this.createFormTable(this.panelContent[c],"tabContent")
4672 },createForm:function(e){var c,f,a,d,b=[];
4675 this.panelContent=[];
4676 if(this.options.ColGroups){this.panelGroup=document.createElement("div");
4677 this.panelGroup.className="tabPanelGroup";
4678 this.panelHdrs=document.createElement("ul");
4679 this.panelGroup.appendChild(this.panelHdrs);
4680 this.panelContents=document.createElement("div");
4681 this.panelContents.className="tabContentContainer";
4682 this.panelGroup.appendChild(this.panelContents);
4683 this.panelActualIdx=[];
4684 e.appendChild(this.panelGroup);
4685 if(this.grid.direction=="rtl"){for(c=this.options.ColGroups.length-1;
4687 c--){b[c]=this.createPanel(c)
4689 c<this.options.ColGroups.length;
4690 c++){b[c]=this.createPanel(c)
4691 }}e.appendChild(this.panelGroup)
4692 }else{f=document.createElement("div");
4693 f.className="noTabContent";
4694 b[0]=this.createFormTable(f);
4697 c<this.grid.columns.length;
4698 c++){a=this.grid.columns[c].format;
4700 }d=a.ColGroupIdx||0;
4701 if(b[d]){this.appendFormField(this.grid.columns[c],b[d])
4702 }if(typeof a.pattern=="string"){switch(a.pattern){case"email":a.regexp=/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/;
4704 case"float-unsigned":a.regexp=/^\d+(\.\d+)?$/;
4706 case"float-signed":a.regexp=/^[-+]?\d+(\.\d+)?$/;
4708 case"int-unsigned":a.regexp=/^\d+$/;
4710 case"int-signed":a.regexp=/^[-+]?\d+$/;
4712 default:a.regexp=new RegExp(a.pattern);
4714 }}}},createFormTable:function(b){var a=document.createElement("table");
4718 },appendHiddenField:function(a,b){var c=Rico.createFormField(this.hiddenFields,"input","hidden",a,a);
4721 },appendFormField:function(c,i){var b=c.format;
4722 if(!b.EntryType){return
4723 }if(b.EntryType=="H"){return
4724 }if(b.FormView){return
4725 }Rico.log("appendFormField: "+c.displayName+" - "+b.EntryType);
4726 var j=b.noFormBreak&&i.rows.length>0?i.rows[i.rows.length-1]:i.insertRow(-1);
4727 var h=j.insertCell(-1);
4729 if(h.noWrap){h.noWrap=true
4730 }var f=j.insertCell(-1);
4731 if(f.noWrap){f.noWrap=true
4732 }h.id="lbl_"+b.FieldName;
4733 var e,a=b.FieldName;
4734 switch(b.EntryType){case"TA":case"tinyMCE":e=Rico.createFormField(f,"textarea",null,a);
4735 e.cols=b.TxtAreaCols;
4736 e.rows=b.TxtAreaRows;
4737 e.innerHTML=b.ColData;
4738 h.style.verticalAlign="top";
4740 case"R":case"RL":e=Rico.createFormField(f,"div",null,a);
4741 if(b.DescriptionField){e.RicoUpdate=b.DescriptionField
4742 }if(b.MultiSelect){Rico.addClass(e,"MultiSelect")
4743 }if(b.isNullable&&!b.MultiSelect){this.addSelectNone(e)
4744 }this.selectValuesRequest(e,c);
4746 case"N":e=Rico.createFormField(f,"select",null,a);
4747 if(b.isNullable){this.addSelectNone(e)
4748 }Rico.eventBind(e,"change",Rico.eventHandle(this,"checkSelectNew"));
4749 this.selectValuesRequest(e,c);
4750 e=document.createElement("span");
4751 e.className="ricoEditLabel";
4752 e.id="labelnew__"+b.FieldName;
4753 e.innerHTML=" "+Rico.getPhraseById("formNewValue").replace(" "," ");
4755 a="textnew__"+b.FieldName;
4756 e=Rico.createFormField(f,"input","text",a,a);
4758 case"S":case"SL":if(b.ReadOnly){e=Rico.createFormField(f,"input","text",a,a);
4760 }else{e=Rico.createFormField(f,"select",null,a);
4761 if(b.MultiSelect){e.multiple=true
4762 }if(b.SelectRows){e.size=parseInt(b.SelectRows,10)
4763 }if(b.isNullable&&!b.MultiSelect){this.addSelectNone(e)
4764 }if(b.DescriptionField){e.RicoUpdate=b.DescriptionField;
4765 Rico.eventBind(e,"change",Rico.eventHandle(this,"selectClick"),false)
4766 }this.selectValuesRequest(e,c)
4768 case"D":if(!b.isNullable){b.required=true
4769 }if(!b.dateFmt){b.dateFmt=Rico.dateFmt
4770 }if(!b.Help){b.Help=b.dateFmt
4771 }if(typeof b.min=="string"){b.min=Rico.setISO8601(b.min)||new Date(b.min)
4772 }if(typeof b.max=="string"){b.max=Rico.setISO8601(b.max)||new Date(b.max)
4773 }b.Length=Math.max(b.dateFmt.length,10);
4774 if(Rico.inputtypes.date){e=Rico.createFormField(f,"input","date",a,a);
4775 e.required=b.required;
4776 if(b.min){e.min=Rico.toISO8601String(b.min,3)
4777 }if(b.max){e.max=Rico.toISO8601String(b.max,3)
4778 }e.required=b.required;
4780 }else{e=Rico.createFormField(f,"input","text",a,a)
4781 }this.initField(e,b);
4783 case"I":if(!b.isNullable){b.required=true
4784 }if(!b.pattern){b.pattern="int-signed"
4785 }if(Rico.inputtypes.number){e=Rico.createFormField(f,"input","number",a,a);
4786 e.required=b.required;
4790 }else{e=Rico.createFormField(f,"input","text",a,a)
4791 }if(typeof b.min=="string"){b.min=parseInt(b.min,10)
4792 }if(typeof b.max=="string"){b.max=parseInt(b.max,10)
4793 }this.initField(e,b);
4795 case"F":if(!b.isNullable){b.required=true
4796 }if(!b.pattern){b.pattern="float-signed"
4797 }e=Rico.createFormField(f,"input","text",a,a);
4798 this.initField(e,b);
4799 if(typeof b.min=="string"){b.min=parseFloat(b.min)
4800 }if(typeof b.max=="string"){b.max=parseFloat(b.max)
4802 default:e=Rico.createFormField(f,"input","text",a,a);
4803 if(!b.isNullable&&b.EntryType!="T"){b.required=true
4804 }this.initField(e,b);
4806 }if(e&&b.SelectCtl){Rico.EditControls.applyTo(c,e,b.EntryType=="D")
4808 h.className="ricoEditLabel";
4809 if(b.Help){h.title=b.Help;
4810 g=" <span class='rico-icon rico-info'></span>"
4811 }var d=b.EntryType.length>1&&b.EntryType.charAt(1)=="L"?c.next.displayName:c.displayName;
4813 },addSelectNone:function(a){this.addSelectOption(a,this.options.TableSelectNone,Rico.getPhraseById("selectNone"))
4814 },initField:function(b,a){if(a.Length){b.maxLength=a.Length;
4815 b.size=Math.min(a.Length,this.options.maxDisplayLen)
4817 },selectClick:function(c){var b=Rico.eventElement(c);
4818 if(b.readOnly){Rico.eventStop(c);
4820 }if(b.RicoUpdate){var a=b.options[b.selectedIndex];
4821 Rico.$(b.RicoUpdate).value=a.innerHTML
4822 }},radioClick:function(c){var b=Rico.eventElement(c);
4823 if(b.readOnly){Rico.eventStop(c);
4825 }var a=Rico.getParentByTagName(b,"div");
4826 if(a.RicoUpdate){Rico.$(a.RicoUpdate).value=b.nextSibling.innerHTML
4827 }},checkSelectNew:function(a){this.updateSelectNew(Rico.eventElement(a))
4828 },updateSelectNew:function(b){var a=(b.value==this.options.TableSelectNew)?"":"hidden";
4829 Rico.$("labelnew__"+b.id).style.visibility=a;
4830 Rico.$("textnew__"+b.id).style.visibility=a
4831 },selectValuesRequest:function(g,f){var a=f.format;
4832 if(a.SelectValues){var b=a.SelectValues.split(",");
4835 e++){this.addSelectOption(g,b[e],b[e],e)
4836 }}else{this.requestCount++;
4838 Rico.extend(d,this.grid.buffer.ajaxOptions);
4839 d.parameters={id:this.grid.tableId,offset:"0",page_size:"-1",edit:f.index};
4840 d.parameters[this.grid.actionId]="query";
4841 d.onComplete=function(h){c.selectValuesUpdate(g,h)
4843 new Rico.ajaxRequest(this.grid.buffer.dataSource,d);
4844 Rico.log("selectValuesRequest: "+a.FieldName)
4845 }},selectValuesUpdate:function(a,c){var b=c.responseXML.getElementsByTagName("ajax-response");
4846 Rico.log("selectValuesUpdate: "+c.status);
4847 if(b==null||b.length!=1){return
4849 var j=b.getElementsByTagName("error");
4850 if(j.length>0){var g=Rico.getContentAsString(j[0],this.grid.buffer.isEncoded);
4851 Rico.log("Data provider returned an error:\n"+g);
4852 alert(Rico.getPhraseById("requestError",g));
4854 }b=b.getElementsByTagName("response")[0];
4855 var h=b.getElementsByTagName("rows")[0];
4856 var k=this.grid.buffer.dom2jstable(h);
4857 Rico.log("selectValuesUpdate: id="+a.id+" rows="+k.length);
4860 e++){if(k[e].length>0){var f=k[e][0];
4861 var d=(k[e].length>1)?k[e][1]:f;
4862 this.addSelectOption(a,f,d,e)
4863 }}if(Rico.$("textnew__"+a.id)){this.addSelectOption(a,this.options.TableSelectNew,Rico.getPhraseById("selectNewVal"))
4864 }if(this.panelGroup){Rico.runLater(50,this,"initPanelGroup")
4865 }},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);
4867 var d=document.createElement("label");
4871 Rico.eventBind(b,"click",Rico.eventHandle(this,"radioClick"),false);
4873 case"select":Rico.addSelectOption(c,e,f);
4875 }},clearSaveMsg:function(){if(this.saveMsg){this.saveMsg.innerHTML=""
4876 }},addMenuItem:function(c,b,a){this.extraMenuItems.push({menuText:c,menuAction:b,enabled:a})
4877 },editMenu:function(d,h,j,e){this.clearSaveMsg();
4878 if(this.grid.buffer.sessionExpired==true||this.grid.buffer.startPos<0){return false
4880 var g=Rico.$("pageTitle");
4881 var f=g?g.innerHTML:document.title;
4882 this.menu.addMenuHeading(f);
4884 if(e==false){for(var b=0;
4885 b<this.extraMenuItems.length;
4886 b++){this.menu.addMenuItem(this.extraMenuItems[b].menuText,this.extraMenuItems[b].menuAction,this.extraMenuItems[b].enabled)
4887 }this.menu.addMenuItem(this.editText,function(){a.editRecord()
4889 this.menu.addMenuItem(this.delText,function(){a.deleteRecord()
4890 },this.canDelete(h));
4891 if(this.options.canClone){this.menu.addMenuItem(this.cloneText,function(){a.cloneRecord()
4892 },this.canAdd(h)&&this.canEdit(h))
4893 }}this.menu.addMenuItem(this.addText,function(){a.addRecord()
4896 },canAdd:function(a){return(typeof this.options.canAdd=="function")?this.options.canAdd(a):this.options.canAdd
4897 },canEdit:function(a){return(typeof this.options.canEdit=="function")?this.options.canEdit(a):this.options.canEdit
4898 },canDelete:function(a){return(typeof this.options.canDelete=="function")?this.options.canDelete(a):this.options.canDelete
4899 },cancelEdit:function(a){Rico.eventStop(a);
4900 this.makeFormInvisible();
4901 this.grid.highlightEnabled=true;
4902 this.menu.cancelmenu();
4904 },setField:function(g,m){var p=this.grid.columns[g].format;
4905 var k=Rico.$(p.FieldName);
4908 }Rico.log("setField: "+p.FieldName+"="+m);
4909 switch(k.tagName.toUpperCase()){case"DIV":c=k.getElementsByTagName("INPUT");
4911 if(p.MultiSelect&&m){n=m.split(",");
4918 j++){c[j].checked=f[c[j].value]==1
4920 case"INPUT":if(p.EntryType=="D"){n=m.split(/\s|T/);
4922 if(this.isTextInput(k)){var l=m.toLowerCase()=="today"?new Date():Rico.setISO8601(m);
4923 if(l){m=Rico.formatDate(l,p.dateFmt)
4926 case"SELECT":b=k.options;
4928 if(p.MultiSelect&&m){n=m.split(",");
4934 j++){b[j].selected=f[b[j].value]==1
4937 j++){if(b[j].value==m){k.selectedIndex=j;
4939 }}}if(p.EntryType=="N"){h=Rico.$("textnew__"+k.id);
4940 if(!h){alert('Warning: unable to find id "textnew__'+k.id+'"')
4942 if(k.selectedIndex!=j){k.selectedIndex=b.length-1
4943 }this.updateSelectNew(k)
4945 case"TEXTAREA":k.value=m;
4946 if(p.EntryType=="tinyMCE"&&typeof(tinyMCE)!="undefined"&&this.initialized){if(tinyMCE.updateContent){tinyMCE.updateContent(k.id)
4947 }else{tinyMCE.execInstanceCommand(k.id,"mceSetContent",false,m)
4949 }},setReadOnly:function(h){for(var g,f=0;
4950 f<this.grid.columns.length;
4951 f++){var b=this.grid.columns[f].format;
4953 }var k=Rico.$(b.FieldName);
4955 }switch(h){case"ins":g=!b.Writeable||b.ReadOnly||b.UpdateOnly;
4957 case"upd":g=!b.Writeable||b.ReadOnly||b.InsertOnly;
4961 }switch(k.tagName.toUpperCase()){case"DIV":var c=k.getElementsByTagName("INPUT");
4964 d++){c[d].disabled=g
4966 case"SELECT":if(b.EntryType=="N"){var a=Rico.$("textnew__"+k.id);
4970 case"TEXTAREA":case"INPUT":k.disabled=g;
4971 if(b.selectIcon){b.selectIcon.style.display=g?"none":""
4973 }}},hideResponse:function(a){this.responseDiv.innerHTML=a;
4974 this.responseDialog.style.display="none"
4975 },showResponse:function(){var a=Rico.cumulativeOffset(this.grid.outerDiv);
4976 a.top+=Rico.docScrollTop();
4977 this.responseDialog.style.top=a.top+"px";
4978 this.responseDialog.style.left=a.left+"px";
4979 this.responseDialog.style.display=""
4980 },processResponse:function(g){var d,f=true;
4981 Rico.log("Processing response from form submittal: "+typeof(g));
4982 this.responseDiv.innerHTML=g.responseText;
4983 var e=Rico.select(".ricoFormResponse",this.responseDiv);
4984 if(e){Rico.log("Found ricoFormResponse");
4985 var c=Rico.trim(e[0].className).split(/\s+/)[1];
4986 d=Rico.getPhraseById(c,this.options.RecordName)
4987 }else{Rico.log("Processing response text");
4988 var b=this.responseDiv.childNodes;
4989 for(var a=b.length-1;
4991 a--){if(b[a].nodeType==1&&b[a].nodeName!="P"&&b[a].nodeName!="DIV"&&b[a].nodeName!="BR"){this.responseDiv.removeChild(b[a])
4992 }}d=Rico.stripTags(this.responseDiv.innerHTML);
4993 f=(d.toLowerCase().indexOf("error")==-1)
4994 }if(f&&this.options.showSaveMsg!="full"){this.hideResponse("");
4995 this.grid.resetContents();
4996 this.grid.buffer.foundRowCount=false;
4997 this.grid.buffer.fetch(this.grid.lastRowPos||0);
4998 if(this.saveMsg){this.saveMsg.innerHTML=" "+d+" "
4999 }}this.processCallback(this.options.onSubmitResponse);
5000 Rico.log("Processing response completed")
5001 },processCallback:function(callback){switch(typeof callback){case"string":return eval(callback);
5002 case"function":return callback()
5003 }},ackResponse:function(a){this.hideResponse("");
5004 this.grid.highlightEnabled=true
5005 },cloneRecord:function(){this.formPopup.setTitle(this.cloneText);
5006 this.displayEditForm("ins")
5007 },editRecord:function(){this.formPopup.setTitle(this.editText);
5008 this.displayEditForm("upd")
5009 },displayEditForm:function(e){this.grid.highlightEnabled=false;
5010 this.menu.cancelmenu();
5011 this.hideResponse(Rico.getPhraseById("saving"));
5012 this.grid.outerDiv.style.cursor="auto";
5013 this.action.value=e;
5015 d<this.grid.columns.length;
5016 d++){var f=this.grid.columns[d];
5017 if(f.format){var b=f.getValue(this.rowIdx);
5019 if(f.format.selectDesc){if(f.format.EntryType.length>1&&f.format.EntryType.charAt(1)=="L"){b=this.grid.columns[d+1].getValue(this.rowIdx)
5021 if(b===""){b=" "
5022 }f.format.selectDesc.innerHTML=b
5023 }if(f.format.SelectCtl){Rico.EditControls.displayClrImg(f,!f.format.InsertOnly)
5024 }}}this.setReadOnly(e);
5027 a++){this.keys[a].keyField.value=this.grid.buffer.getWindowValue(this.rowIdx,this.keys[a].colidx)
5028 }this.makeFormVisible(this.rowIdx)
5029 },addPrepare:function(){this.hideResponse(Rico.getPhraseById("saving"));
5031 this.setReadOnly("ins");
5032 this.action.value="ins";
5034 a<this.grid.columns.length;
5035 a++){var b=this.grid.columns[a];
5036 if(b.format){this.setField(a,b.format.ColData);
5037 if(b.format.SelectCtl){if(b.format.EntryType!="D"){Rico.EditControls.resetValue(b)
5038 }Rico.EditControls.displayClrImg(b,!b.format.UpdateOnly)
5039 }}}},addRecord:function(){this.menu.cancelmenu();
5040 this.formPopup.setTitle(this.addText);
5042 this.makeFormVisible(-1);
5043 if(this.formPanels){this.formPanels.select(0)
5044 }},drillDown:function(b,a,c){return this.grid.drillDown.apply(this.grid,arguments)
5045 },setDetailFilter:function(a,b){this.grid.setDetailFilter(a,b)
5046 },makeFormVisible:function(k){this.formPopup.container.style.display="block";
5047 var c=this.formPopup.container.offsetWidth;
5048 var h=Rico.cumulativeOffset(this.grid.outerDiv);
5049 var d=Rico.windowWidth();
5050 this.formPopup.container.style.left=c+h.left>d?(d-c)+"px":(h.left+1)+"px";
5051 var g=Rico.docScrollTop();
5052 var a=this.formPopup.container.offsetHeight;
5053 var f=h.top+this.grid.hdrHt+g;
5054 var b=Rico.windowHeight()+g;
5055 if(k>=0){f+=(k+1)*this.grid.rowHeight;
5056 if(f+a>b){f-=(a+this.grid.rowHeight)
5057 }}else{if(f+a>b){f=b-a-2
5058 }}if(this.processCallback(this.options.formOpen)===false){return
5059 }this.formPopup.openPopup(null,Math.max(f,g));
5060 this.formPopup.container.style.visibility="visible";
5061 Rico.EditControls.setZ(Rico.getStyle(this.formPopup.container,"zIndex"));
5062 if(this.initialized){return
5065 e<this.grid.columns.length;
5066 e++){j=this.grid.columns[e].format;
5067 if(!j||!j.EntryType||!j.FieldName){continue
5068 }switch(j.EntryType){case"tinyMCE":if(typeof tinyMCE!="undefined"){tinyMCE.execCommand("mceAddControl",true,j.FieldName)
5070 }}this.initialized=true
5071 },makeFormInvisible:function(){for(var a=0;
5072 a<this.grid.columns.length;
5073 a++){if(this.grid.columns[a].format&&this.grid.columns[a].format.SelectCtl){Rico.EditControls.close(this.grid.columns[a].format.SelectCtl)
5074 }}this.formPopup.container.style.visibility="hidden";
5075 this.formPopup.closePopup();
5076 this.processCallback(this.options.formClose)
5077 },getConfirmDesc:function(a){return Rico.stripTags(this.grid.cell(a,this.options.ConfirmDeleteCol).innerHTML).replace(" "," ")
5078 },deleteRecord:function(){this.menu.cancelmenu();
5080 switch(this.options.ConfirmDeleteCol){case -1:f=Rico.getPhraseById("thisRecord",this.options.RecordName);
5085 b++){var c=this.keys[b].colidx;
5086 var a=this.grid.columns[c].format;
5087 if(a.EntryType.length>1&&a.EntryType.charAt(1)=="L"){c++
5088 }var e=Rico.trim(Rico.stripTags(this.grid.cell(this.rowIdx,c).innerHTML).replace(/ /g," "));
5090 }f+=this.grid.columns[c].displayName+' "'+e+'"'
5092 default:f='"'+Rico.truncate(this.getConfirmDesc(this.rowIdx),50)+'"';
5094 }if(!this.options.ConfirmDelete.valueOf||confirm(Rico.getPhraseById("confirmDelete",f))){this.hideResponse(Rico.getPhraseById("deleting"));
5095 this.showResponse();
5097 d[this.grid.actionId]="del";
5100 b++){var c=this.keys[b].colidx;
5101 var e=this.grid.columns[c].getValue(this.rowIdx);
5103 }new Rico.ajaxRequest(this.options.updateURL,{parameters:d,method:"post",onComplete:this.responseHandler})
5104 }this.menu.cancelmenu()
5105 },validationMsg:function(d,c,e){var b=this.grid.columns[c];
5106 if(this.formPanels){this.formPanels.select(this.panelActualIdx[b.format.ColGroupIdx])
5107 }var a=Rico.stripTags(b.formLabel.innerHTML).replace(/ /g," ");
5108 var f=Rico.getPhraseById(e,' "'+a+'"');
5109 Rico.log(" Validation error: "+f);
5110 if(b.format.Help){f+="\n\n"+b.format.Help
5112 setTimeout(function(){try{d.focus();
5116 },isTextInput:function(a){if(!a){return false
5117 }if(a.tagName.toLowerCase()!="input"){return false
5118 }if(a.type.toLowerCase()!="text"){return false
5119 }if(a.readOnly){return false
5120 }if(!Rico.visible(a)){return false
5122 },parseDate:function(c,e){dateParts={};
5123 if(!this.dateRegExp.exec(e)){return NaN
5124 }dateParts[RegExp.$1]=0;
5125 dateParts[RegExp.$3]=1;
5126 dateParts[RegExp.$5]=2;
5127 var i=c.split(/\D/);
5129 var b=g.getFullYear();
5130 if(i.length==2&&dateParts.yyyy==2){i.push(b)
5131 }if(i.length!=3){return NaN
5132 }var a=parseInt(i[dateParts.dd],10);
5133 if(a==0||a>31){return NaN
5134 }var f=parseInt(i[dateParts.mm],10)-1;
5136 }var h=parseInt(i[dateParts.yyyy],10);
5137 if(h<100){h+=b-(b%100)
5138 }return new Date(h,f,a,0,0,0)
5139 },TESubmit:function(j){var g,h,k,l,f,d,c=[];
5141 Rico.log("Event: TESubmit called to validate input");
5143 g<this.grid.columns.length;
5144 g++){l=this.grid.columns[g].format;
5145 if(!l||!l.EntryType||!l.FieldName){continue
5146 }f=Rico.$(l.FieldName);
5147 if(!this.isTextInput(f)){continue
5148 }switch(this.action.value){case"ins":h=!l.Writeable||l.ReadOnly||l.UpdateOnly;
5150 case"upd":h=!l.Writeable||l.ReadOnly||l.InsertOnly;
5155 }Rico.log(" Validating field #"+g+" EntryType="+l.EntryType+" ("+l.FieldName+")");
5156 if(f.value.length==0){if(l.required){return this.validationMsg(f,g,"formPleaseEnter")
5158 }}if(f.value.length>0&&l.regexp&&!l.regexp.test(f.value)){return this.validationMsg(f,g,"formInvalidFmt")
5159 }switch(l.EntryType.charAt(0)){case"I":d=parseInt(f.value,10);
5161 case"F":d=parseFloat(f.value);
5163 case"D":d=this.parseDate(f.value,l.dateFmt);
5164 if(isNaN(d)){return this.validationMsg(f,g,"formInvalidFmt")
5169 }if(typeof l.min!="undefined"&&!isNaN(d)&&d<l.min){return this.validationMsg(f,g,"formOutOfRange")
5170 }if(typeof l.max!="undefined"&&!isNaN(d)&&d>l.max){return this.validationMsg(f,g,"formOutOfRange")
5171 }}if(this.processCallback(this.options.formSubmit)===false){return false
5173 g<this.grid.columns.length;
5174 g++){l=this.grid.columns[g].format;
5175 if(!l||!l.EntryType||!l.FieldName){continue
5176 }if(l.EntryType.charAt(0)!="N"){continue
5177 }var a=Rico.$(l.FieldName);
5178 if(!a||a.value!=this.options.TableSelectNew){continue
5179 }var b=Rico.$("textnew__"+a.id).value;
5180 this.addSelectOption(a,b,b)
5183 g++){c[g].e.value=Rico.formatDate(c[g].v,"yyyy-mm-dd")
5184 }if(typeof tinyMCE!="undefined"){tinyMCE.triggerSave()
5185 }this.makeFormInvisible();
5187 this.menu.cancelmenu();
5189 },sendForm:function(){this.setReadOnly("reset");
5190 this.showResponse();
5191 Rico.log("sendForm: "+this.grid.tableId);
5192 Rico.ajaxSubmit(this.form,this.options.updateURL,{method:"post",onComplete:this.responseHandler})
5194 Rico.EditControls={widgetList:{},elemList:{},zIndex:0,register:function(b,c){this.widgetList[b.id]={imgsrc:c,widget:b,currentEl:""};
5196 b.returnValue=function(d,e){a.setValue(b,d,e)
5198 Rico.log("Rico.EditControls.register:"+b.id)
5199 },setZ:function(a){this.zIndex=Math.max(this.zIndex,a+10)
5200 },applyTo:function(f,g,b){var d=this.widgetList[f.format.SelectCtl];
5202 }Rico.log("Rico.EditControls.applyTo: "+f.displayName+" : "+f.format.SelectCtl);
5203 var a,e=document.createElement("span");
5204 if(d.imgsrc.indexOf(".")==-1&&d.imgsrc.indexOf("/")==-1){a=document.createElement("span");
5205 a.className=d.imgsrc
5206 }else{a=document.createElement("img");
5208 }a.style.verticalAlign="top";
5209 a.style.marginLeft="4px";
5210 a.style.cursor="pointer";
5211 a.id=this.imgId(f.format.FieldName);
5212 Rico.eventBind(a,"click",Rico.eventHandle(this,"processClick"));
5213 g.parentNode.appendChild(e);
5214 g.parentNode.appendChild(a);
5215 if(b){e.style.display="none"
5216 }else{g.style.display="none"
5218 if(f.format.isNullable){c=Rico.clearButton(Rico.eventHandle(this,"processClear"));
5220 g.parentNode.appendChild(c)
5221 }this.elemList[a.id]={descSpan:e,inputCtl:g,widget:d.widget,listObj:d,column:f,clrimg:c};
5222 f.format.selectIcon=a;
5223 f.format.selectDesc=e
5224 },displayClrImg:function(c,a){var b=this.elemList[this.imgId(c.format.FieldName)];
5225 if(b&&b.clrimg){b.clrimg.style.display=a?"inline-block":"none"
5226 }},processClear:function(c){var b=Rico.eventElement(c);
5227 var a=this.elemList[b.id.slice(0,-6)];
5229 }a.inputCtl.value="";
5230 a.descSpan.innerHTML=a.column._format("")
5231 },processClick:function(c){var b=Rico.eventElement(c);
5232 var a=this.elemList[b.id];
5234 }if(a.listObj.currentEl==b.id&&a.widget.container.style.display!="none"){a.widget.close();
5235 a.listObj.currentEl=""
5236 }else{a.listObj.currentEl=b.id;
5237 Rico.log("Rico.EditControls.processClick: "+a.widget.id+" : "+a.inputCtl.value);
5238 a.widget.container.style.zIndex=this.zIndex;
5239 a.widget.open(a.inputCtl.value,a.column);
5240 Rico.positionCtlOverIcon(a.widget.container,b)
5241 }},imgId:function(a){return"icon_"+a
5242 },resetValue:function(c){var b=this.elemList[this.imgId(c.format.FieldName)];
5244 }b.inputCtl.value=c.format.ColData;
5245 var a=c._format(c.format.ColData);
5246 if(a===""){a=" "
5247 }b.descSpan.innerHTML=a
5248 },setValue:function(e,a,d){var b=this.widgetList[e.id];
5252 }var c=this.elemList[f];
5254 }c.inputCtl.value=a;
5255 if(!d){d=c.column._format(a)
5256 }c.descSpan.innerHTML=d;
5257 if(c.column.format.DescriptionField){Rico.$(c.column.format.DescriptionField).value=d
5258 }},close:function(b){var a=this.widgetList[b];
5260 }if(a.widget.container.style.display!="none"){a.widget.close()
5263 Rico.addPhraseId("bookmarkExact","Listing records $1 - $2 of $3");
5264 Rico.addPhraseId("bookmarkAbout","Listing records $1 - $2 of more than $3");
5265 Rico.addPhraseId("bookmarkNoRec","No records");
5266 Rico.addPhraseId("bookmarkNoMatch","No matching records");
5267 Rico.addPhraseId("bookmarkLoading","Loading...");
5268 Rico.addPhraseId("sorting","Sorting...");
5269 Rico.addPhraseId("exportStatus","Exporting row $1");
5270 Rico.addPhraseId("filterAll","(all)");
5271 Rico.addPhraseId("filterBlank","(blank)");
5272 Rico.addPhraseId("filterEmpty","(empty)");
5273 Rico.addPhraseId("filterNotEmpty","(not empty)");
5274 Rico.addPhraseId("filterLike","contains: $1");
5275 Rico.addPhraseId("filterNot","not: $1");
5276 Rico.addPhraseId("requestError","The request for data returned an error:\n$1");
5277 Rico.addPhraseId("keywordPrompt","Enter keyword to search for (use * as a wildcard):");
5278 Rico.addPhraseId("keywordTitle","Keyword Search");
5279 Rico.addPhraseId("apply","Apply");
5280 Rico.addPhraseId("gridmenuSortBy","Sort by: $1");
5281 Rico.addPhraseId("gridmenuSortAsc","Ascending");
5282 Rico.addPhraseId("gridmenuSortDesc","Descending");
5283 Rico.addPhraseId("gridmenuFilterBy","Filter by: $1");
5284 Rico.addPhraseId("gridmenuRefresh","Refresh");
5285 Rico.addPhraseId("gridmenuChgKeyword","Change keyword...");
5286 Rico.addPhraseId("gridmenuExcludeAlso","Exclude this value also");
5287 Rico.addPhraseId("gridmenuInclude","Include only this value");
5288 Rico.addPhraseId("gridmenuGreaterThan","Greater than or equal to this value");
5289 Rico.addPhraseId("gridmenuLessThan","Less than or equal to this value");
5290 Rico.addPhraseId("gridmenuContains","Contains keyword...");
5291 Rico.addPhraseId("gridmenuExclude","Exclude this value");
5292 Rico.addPhraseId("gridmenuRemoveFilter","Remove filter");
5293 Rico.addPhraseId("gridmenuRemoveAll","Remove all filters");
5294 Rico.addPhraseId("gridmenuExport","Print/Export");
5295 Rico.addPhraseId("gridmenuExportVis2Web","Visible rows to web page");
5296 Rico.addPhraseId("gridmenuExportAll2Web","All rows to web page");
5297 Rico.addPhraseId("gridmenuExportVis2SS","Visible rows to spreadsheet");
5298 Rico.addPhraseId("gridmenuExportAll2SS","All rows to spreadsheet");
5299 Rico.addPhraseId("gridmenuHideShow","Hide/Show");
5300 Rico.addPhraseId("gridmenuChooseCols","Choose columns...");
5301 Rico.addPhraseId("gridmenuHide","Hide: $1");
5302 Rico.addPhraseId("gridmenuShow","Show: $1");
5303 Rico.addPhraseId("gridmenuShowAll","Show All");
5304 Rico.addPhraseId("sessionExpireMinutes","minutes before your session expires");
5305 Rico.addPhraseId("sessionExpired","EXPIRED");
5306 Rico.addPhraseId("requestTimedOut","Request for data timed out!");
5307 Rico.addPhraseId("waitForData","Waiting for data...");
5308 Rico.addPhraseId("httpError","Received HTTP error: $1");
5309 Rico.addPhraseId("invalidResponse","Server returned an invalid response");
5310 Rico.addPhraseId("gridChooseCols","Choose columns");
5311 Rico.addPhraseId("exportComplete","Exporting complete");
5312 Rico.addPhraseId("exportInProgress","Export in progress...");
5313 Rico.addPhraseId("disableBlocker","You need to disable your browser's pop-up blocker before exporting.");
5314 Rico.addPhraseId("showFilterRow","Show filter row");
5315 Rico.addPhraseId("hideFilterRow","Hide filter row");
5316 Rico.addPhraseId("ok","OK");
5317 Rico.addPhraseId("selectNone","(none)");
5318 Rico.addPhraseId("selectNewVal","(new value)");
5319 Rico.addPhraseId("record","record");
5320 Rico.addPhraseId("thisRecord","this $1");
5321 Rico.addPhraseId("confirmDelete","Are you sure you want to delete $1?");
5322 Rico.addPhraseId("deleting","Deleting...");
5323 Rico.addPhraseId("formPleaseEnter","Please enter a value for $1");
5324 Rico.addPhraseId("formInvalidFmt","Invalid format for $1");
5325 Rico.addPhraseId("formOutOfRange","Value is out of range for $1");
5326 Rico.addPhraseId("formNewValue","new value:");
5327 Rico.addPhraseId("saving","Saving...");
5328 Rico.addPhraseId("clear","clear");
5329 Rico.addPhraseId("close","Close");
5330 Rico.addPhraseId("saveRecord","Save $1");
5331 Rico.addPhraseId("cancel","Cancel");
5332 Rico.addPhraseId("editRecord","Edit $1");
5333 Rico.addPhraseId("deleteRecord","Delete this $1");
5334 Rico.addPhraseId("cloneRecord","Clone $1");
5335 Rico.addPhraseId("addRecord","Add new $1");
5336 Rico.addPhraseId("addedSuccessfully","$1 added successfully");
5337 Rico.addPhraseId("deletedSuccessfully","$1 deleted successfully");
5338 Rico.addPhraseId("updatedSuccessfully","$1 updated successfully");
5339 Rico.addPhraseId("treeSave","Save Selection");
5340 Rico.addPhraseId("treeClear","Clear All");
5341 Rico.addPhraseId("calToday","Today is $1 $2 $3");
5342 Rico.addPhraseId("calWeekHdg","Wk");
5343 Rico.addPhraseId("calYearRange","Year ($1-$2)");
5344 Rico.addPhraseId("calInvalidYear","Invalid year");
5347 Rico.dateFmt="mm/dd/yyyy";
5348 Rico.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];
5349 Rico.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];