From 6dd1f74b30a3254c7458ff280a7e7ac5fd8deb70 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 9 Aug 2010 23:20:51 +0000 Subject: [PATCH] web: add dhtmlxcombo 2.6 (unminified version) to repo --- data/web/static/dhtmlxcombo.js | 1359 +++++++++++++++++++++++ data/web/static/dhtmlxcommon.js | 940 ++++++++++++++++ data/web/static/images/combo_select.gif | Bin 0 -> 309 bytes 3 files changed, 2299 insertions(+) create mode 100644 data/web/static/dhtmlxcombo.js create mode 100644 data/web/static/dhtmlxcommon.js create mode 100644 data/web/static/images/combo_select.gif diff --git a/data/web/static/dhtmlxcombo.js b/data/web/static/dhtmlxcombo.js new file mode 100644 index 000000000..20424e16b --- /dev/null +++ b/data/web/static/dhtmlxcombo.js @@ -0,0 +1,1359 @@ +//v.2.6 build 100722 + +/* +Copyright DHTMLX LTD. http://www.dhtmlx.com +You allowed to use this component or parts of it under GPL terms +To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com +*/ + +/*_TOPICS_ +@0:Initialization +@1:Selection control +@2:Add/delete +@3:Reserved +@4:Methods of Option object +*/ + +/** +* Build combobox from existing select control. +* +* +* @param parent {string} id of existing select control +* @param size {int } size of control, optional +* @return {object} combobox object +* @type public +* @topic 0 +* +*/ + +function dhtmlXComboFromSelect(parent,size){ + if (typeof(parent)=="string") + parent=document.getElementById(parent); + + + size=size||parent.getAttribute("width")||(window.getComputedStyle?window.getComputedStyle(parent,null)["width"]:(parent.currentStyle?parent.currentStyle["width"]:0)); + if ((!size)||(size=="auto")) + size=parent.offsetWidth||100; + + var z=document.createElement("SPAN"); + + + + parent.parentNode.insertBefore(z,parent); + parent.style.display='none'; + + var s_type = parent.getAttribute('opt_type'); + + var w= new dhtmlXCombo(z,parent.name,size,s_type,parent.tabIndex); + + var x=new Array(); + var sel=0; + for (var i=0; i= 48 && ev.keyCode <= 57)||(ev.keyCode >= 65 && ev.keyCode <= 90)){ + for(var i=0; i15 && ev<19) return true; //shift,alt,ctrl + if (ev==27) return; + if ((that.DOMlist.style.display!="block")&&(ev!="13")&&(ev!="9")&&((!that._filter)||(that._filterAny))) + that.DOMelem.onclick(e||event); + + if ((ev!="13")&&(ev!="9")){ + window.setTimeout(function(){ that._onKeyB(ev); },1); + if (ev=="40" || ev=="38") + return false; + } + else if (ev==9){ + that.closeAll(); + (e||event).cancelBubble=false; + } + } + dhtmlXCombo.prototype._onKeyB = function(ev) + { + if (ev=="40"){ //down + var z=this.selectNext(1); + } else if (ev=="38"){ //up + this.selectNext(-1); + } else{ + this.callEvent("onKeyPressed",[ev]) + if (this._filter) return this.filterSelf((ev==8)||(ev==46)); + for(var i=0; i=0; i--) + this.DOMlist.removeChild(this.DOMlist.childNodes[i]); + for(var i=0; i0) this.DOMlist.scrollTop+=corr; + corr=this.DOMlist.scrollTop-this._selOption.content.offsetTop; + if (corr>0) this.DOMlist.scrollTop-=corr; + var data=this._selOption.data(); + + if (conf){ + this.setComboText(data[1]); + this._confirmSelection(data[0],false); + + if ((this._autoxml)&&((ind+1)==this._lastLength)) + this._fetchOptions(ind+1,this._lasttext||""); + } + + if (filter){ + var text=this.getComboText(); + if (text!=data[1]){ + this.setComboText(data[1]); + dhtmlXRange(this.DOMelem_input,text.length+1,data[1].length); + } + } + else + this.setComboText(data[1]); + this._selOption.RedrawHeader(this); + + /*Event*/ + this.callEvent("onSelectionChange",[]); + } +/** +* @desc: option on select handler +* @type: private +* @topic: 2 +*/ + dhtmlXCombo.prototype._selectOption = function(e) + { + (e||event).cancelBubble = true; + var node=(_isIE?event.srcElement:e.target); + var that=this.combo; + while (!node._self) { + node = node.parentNode; + if (!node) + return; + } + + var i=0; + for (i; i0) this.DOMlist.scrollTop+=corr; + corr=this.DOMlist.scrollTop-this._selOption.content.offsetTop; + if (corr>0) this.DOMlist.scrollTop-=corr; + } + /* if (this.autoOptionSize){ + var x=this.DOMlist.offsetWidth; + + for ( var i=0; i x= "+ x); + if (this.DOMlist.childNodes[i].scrollWidth > x) + x=this.DOMlist.childNodes[i].scrollWidth; + } + + this.DOMlist.style.width=x+"px"; + }*/ + + + if (_isIE) this._IEFix(true); + this.DOMelem_input.focus(); + + if (this._filter) this.filterSelf(); + } +/** +* @desc: open(close) list +* @type: private +* @topic: 2 +*/ + dhtmlXCombo.prototype._toggleSelect = function(e) + { + var that=this.combo; + if ( that.DOMlist.style.display == "block" ) { + that.closeAll(); + } else { + that.openSelect(); + } + (e||event).cancelBubble = true; + } + + dhtmlXCombo.prototype._fetchOptions=function(ind,text){ + if (text=="") { this.closeAll(); return this.clearAll(); } + var url=this._xml+((this._xml.indexOf("?")!=-1)?"&":"?")+"pos="+ind+"&mask="+encodeURIComponent(text); + this._lasttext=text; + if (this._load) this._load=url; + else { + if (!this.callEvent("onDynXLS",[text,ind])) return; + this.loadXML(url); + } + } +/** +* @desc: filter list of options +* @type: private +* @topic: 2 +*/ + dhtmlXCombo.prototype.filterSelf = function(mode) + { + var text=this.getComboText(); + if (this._xml){ + this._lkmode=mode; + this._fetchOptions(0,text); + } + try{ var filter=new RegExp("^"+text,"i"); } catch (e){ var filter=new RegExp("^"+text.replace(/([\[\]\{\}\(\)\+\*\\])/g,"\\$1")); } + this.filterAny=false; + for(var i=0; i