/* Product Name: dhtmlxSuite Version: 4.0.3 Edition: Professional License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com Copyright UAB Dinamenta http://www.dhtmlx.com */ function dhtmlXToolbarObject(base, skin) { var main_self = this; this.conf = { skin: (skin||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxtoolbar")||"dhx_skyblue"), align: "left", align_autostart: "left", icons_path: "", iconSize: 18, sel_ofs_x: 0, sel_ofs_y: 0, xml_autoload: null, items_autoload: null } if (typeof(base) == "object" && base != null && typeof(base.tagName) == "undefined") { // object-api init if (base.icons_path != null || base.icon_path != null) this.conf.icons_path = (base.icons_path||base.icon_path); if (base.icons_size != null) this.conf.icons_size_autoload = base.icons_size; if (base.json != null) this.conf.json_autoload = base.json; if (base.xml != null) this.conf.xml_autoload = base.xml; if (base.onload != null) this.conf.onload_autoload = base.onload; if (base.items != null) this.conf.items_autoload = base.items; if (base.skin != null) this.conf.skin = base.skin; if (base.align != null) this.conf.align_autostart = base.align; base = base.parent; } this.cont = (typeof(base)!="object")?document.getElementById(base):base; while (this.cont.childNodes.length > 0) this.cont.removeChild(this.cont.childNodes[0]); base = null; this.cont.dir = "ltr"; this.base = document.createElement("DIV"); this.base.className = "dhxtoolbar_float_left"; this.cont.appendChild(this.base); if (window.dhx4.isIPad) { this.cont.ontouchstart = function(e){ e = e||event; if((String(e.target.tagName||"").toLowerCase()=="input")) return true; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; e.cancelBubble = true; return false; } } this.setSkin(this.conf.skin); this.objPull = {}; this.anyUsed = "none"; /* random prefix */ this._genStr = function(w) { var s = ""; var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for (var q=0; q 0) obj.insertBefore(imgObj, obj.childNodes[0]); else obj.appendChild(imgObj); return imgObj; } // set/clear item image/imagedis this._setItemImage = function(item, url, dis) { if (dis == true) item.imgEn = url; else item.imgDis = url; if ((!item.state && dis == true) || (item.state && dis == false)) return; var imgObj = this._getObj(item.obj, "img"); if (imgObj == null) imgObj = this._addImgObj(item.obj); imgObj.src = this.conf.icons_path+url; } this._clearItemImage = function(item, dis) { if (dis == true) item.imgEn = ""; else item.imgDis = ""; if ((!item.state && dis == true) || (item.state && dis == false)) return; var imgObj = this._getObj(item.obj, "img"); if (imgObj != null) imgObj.parentNode.removeChild(imgObj); } // set/get item text this._setItemText = function(item, text) { var txtObj = this._getObj(item.obj, "div"); if (text == null || text.length == 0) { if (txtObj != null) txtObj.parentNode.removeChild(txtObj); return; } if (txtObj == null) { txtObj = document.createElement("DIV"); txtObj.className = "dhxtoolbar_text"; item.obj.appendChild(txtObj); } txtObj.innerHTML = text; } this._getItemText = function(item) { var txtObj = this._getObj(item.obj, "div"); if (txtObj != null) return txtObj.innerHTML; return ""; } // enable/disable btn this._enableItem = function(item) { if (item.state) return; item.state = true; if (this.objPull[item.id]["type"] == "buttonTwoState" && this.objPull[item.id]["obj"]["pressed"] == true) { item.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres"; item.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"; } else { item.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; item.obj.renderAs = item.obj.className; } if (item.arw) item.arw.className = String(item.obj.className).replace("btn","arw"); var imgObj = this._getObj(item.obj, "img"); if (item.imgEn != "") { if (imgObj == null) imgObj = this._addImgObj(item.obj); imgObj.src = this.conf.icons_path+item.imgEn; } else { if (imgObj != null) imgObj.parentNode.removeChild(imgObj); } } this._disableItem = function(item) { if (!item.state) return; item.state = false; item.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_"+(this.objPull[item.id]["type"]=="buttonTwoState"&&item.obj.pressed?"pres_":"")+"dis"; item.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; if (item.arw) item.arw.className = String(item.obj.className).replace("btn","arw"); var imgObj = this._getObj(item.obj, "img"); if (item.imgDis != "") { if (imgObj == null) imgObj = this._addImgObj(item.obj); imgObj.src = this.conf.icons_path+item.imgDis; } else { if (imgObj != null) imgObj.parentNode.removeChild(imgObj); } // if (this.objPull[item.id]["type"] == "buttonTwoState") this.objPull[item.id]["obj"]["pressed"] = false; // hide opened polygon if any if (item.polygon != null) { if (item.polygon.style.display != "none") { window.dhx4.zim.clear(item.polygon._idd); item.polygon.style.display = "none"; if (item.polygon._ie6cover) item.polygon._ie6cover.style.display = "none"; // fix border if (this.conf.skin == "dhx_terrace") this._improveTerraceButtonSelect(item.id, true); } } this.anyUsed = "none"; } this.clearAll = function() { for (var a in this.objPull) this._removeItem(String(a).replace(this.idPrefix,"")); } // this._doOnClick = function(e) { if (main_self && main_self.forEachItem) { main_self.forEachItem(function(itemId){ if (main_self.objPull[main_self.idPrefix+itemId]["type"] == "buttonSelect") { // hide any opened buttonSelect's polygons, clear selection if any var item = main_self.objPull[main_self.idPrefix+itemId]; if (item.arw._skip === true) { item.arw._skip = false; } else if (item.polygon.style.display != "none") { item.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; item.obj.className = item.obj.renderAs; item.arw.className = String(item.obj.renderAs).replace("btn","arw"); main_self.anyUsed = "none"; window.dhx4.zim.clear(item.polygon._idd); item.polygon.style.display = "none"; if (item.polygon._ie6cover) item.polygon._ie6cover.style.display = "none"; // fix border if (main_self.conf.skin == "dhx_terrace") main_self._improveTerraceButtonSelect(item.id, true); } } }); } } if (window.dhx4.isIPad) { document.addEventListener("touchstart", this._doOnClick, false); } else { if (typeof(window.addEventListener) != "undefined") { window.addEventListener("mousedown", this._doOnClick, false); } else { document.body.attachEvent("onmousedown", this._doOnClick); } } if (this.conf.icons_size_autoload != null) { this.setIconSize(this.conf.icons_size_autoload); this.conf.icons_size_autoload = null; } if (this.conf.items_autoload != null) { this.loadStruct(this.conf.items_autoload, this.conf.onload_autoload); this.conf.items_autoload = null; } else if (this.conf.json_autoload != null) { this.loadStruct(this.conf.json_autoload, this.conf.onload_autoload); this.conf.json_autoload = null; } else if (this.conf.xml_autoload != null) { this.loadStruct(this.conf.xml_autoload, this.conf.onload_autoload); this.conf.xml_autoload = null; } if (this.conf.align_autostart != this.conf.align) { this.setAlign(this.conf.align_autostart); this.conf.align_autostart = null; } // return this; } dhtmlXToolbarObject.prototype.addSpacer = function(nextToId) { var nti = this.idPrefix+nextToId; if (this._spacer != null) { // spacer already at specified position if (this._spacer.idd == nextToId) return; // if current spacer contain nextToId item // move all items from first to nextToId to this.base if (this._spacer == this.objPull[nti].obj.parentNode) { var doMove = true; while (doMove) { var idd = this._spacer.childNodes[0].idd; this.base.appendChild(this._spacer.childNodes[0]); if (idd == nextToId || this._spacer.childNodes.length == 0) { if (this.objPull[nti].arw != null) this.base.appendChild(this.objPull[nti].arw); doMove = false; } } this._spacer.idd = nextToId; this._fixSpacer(); return; } // if this.base contain nextToId item, move (insertBefore[0]) if (this.base == this.objPull[nti].obj.parentNode) { var doMove = true; var chArw = (this.objPull[nti].arw!=null); while (doMove) { var q = this.base.childNodes.length-1; if (chArw == true) if (this.base.childNodes[q] == this.objPull[nti].arw) doMove = false; if (this.base.childNodes[q].idd == nextToId) doMove = false; if (doMove) { if (this._spacer.childNodes.length > 0) this._spacer.insertBefore(this.base.childNodes[q], this._spacer.childNodes[0]); else this._spacer.appendChild(this.base.childNodes[q]); } } this._spacer.idd = nextToId; this._fixSpacer(); return; } } else { var np = null; for (var q=0; q np+1) this._spacer.appendChild(this.base.childNodes[np+1]); this.cont.appendChild(this._spacer); this._fixSpacer(); } } if (this.conf.skin == "dhx_terrace") this._improveTerraceSkin(); } dhtmlXToolbarObject.prototype.removeSpacer = function() { if (!this._spacer) return; while (this._spacer.childNodes.length > 0) this.base.appendChild(this._spacer.childNodes[0]); this._spacer.parentNode.removeChild(this._spacer); this._spacer = null; if (this.conf.skin == "dhx_terrace") this._improveTerraceSkin(); } dhtmlXToolbarObject.prototype._fixSpacer = function() { // IE icons mixing fix if (typeof(window.addEventListener) == "undefined" && this._spacer != null) { this._spacer.style.borderLeft = "1px solid #a4bed4"; var k = this._spacer; window.setTimeout(function(){k.style.borderLeft="0px solid #a4bed4";k=null;},1); } } dhtmlXToolbarObject.prototype.getType = function(itemId) { var parentId = this.getParentId(itemId); if (parentId != null) { var typeExt = null; var itemData = this.objPull[this.idPrefix+parentId]._listOptions[itemId]; if (itemData != null) if (itemData.sep != null) typeExt = "buttonSelectSeparator"; else typeExt = "buttonSelectButton"; return typeExt; } else { if (this.objPull[this.idPrefix+itemId] == null) return null; return this.objPull[this.idPrefix+itemId]["type"]; } } dhtmlXToolbarObject.prototype.getTypeExt = function(itemId) { var type = this.getType(itemId); if (type == "buttonSelectButton" || type == "buttonSelectSeparator") { if (type == "buttonSelectButton") type = "button"; else type = "separator"; return type; } return null; } dhtmlXToolbarObject.prototype.inArray = function(array, value) { for (var q=0; q 0) p.obj.removeChild(p.obj.childNodes[0]); p.obj.parentNode.removeChild(p.obj); p.obj = null; p.id = null; p.type = null; p.state = null; p.enableItem = null; p.disableItem = null; p.isEnabled = null; p.setItemToolTipTemplate = null; p.getItemToolTipTemplate = null; p.setMaxValue = null; p.setMinValue = null; p.getMaxValue = null; p.getMinValue = null; p.setValue = null; p.getValue = null; p.showItem = null; p.hideItem = null; p.isVisible = null; } if (t == "separator") { p.obj.onselectstart = null; p.obj.idd = null; p.obj.parentNode.removeChild(p.obj); p.obj = null; p.id = null; p.type = null; p.showItem = null; p.hideItem = null; p.isVisible = null; } if (t == "text") { p.obj.onselectstart = null; p.obj.idd = null; p.obj.parentNode.removeChild(p.obj); p.obj = null; p.id = null; p.type = null; p.showItem = null; p.hideItem = null; p.isVisible = null; p.setWidth = null; p.setItemText = null; p.getItemText = null; } t = null; p = null; this.objPull[this.idPrefix+itemId] = null; delete this.objPull[this.idPrefix+itemId]; }; //#tool_list:06062008{ (function(){ var list="addListOption,removeListOption,showListOption,hideListOption,isListOptionVisible,enableListOption,disableListOption,isListOptionEnabled,setListOptionPosition,getListOptionPosition,setListOptionText,getListOptionText,setListOptionToolTip,getListOptionToolTip,setListOptionImage,getListOptionImage,clearListOptionImage,forEachListOption,getAllListOptions,setListOptionSelected,getListOptionSelected".split(",") var functor = function(name){ return function(parentId,a,b,c,d,e){ parentId = this.idPrefix+parentId; if (this.objPull[parentId] == null) return; if (this.objPull[parentId]["type"] != "buttonSelect") return; return this.objPull[parentId][name].call(this.objPull[parentId],a,b,c,d,e); } } for (var i=0; i":""), (data.text!=null?"
"+data.text+"
":"")); var obj = this; this.obj.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } this.obj.onmouseover = function() { this._doOnMouseOver(); } this.obj.onmouseout = function() { this._doOnMouseOut(); } this.obj._doOnMouseOver = function() { this.allowClick = true; if (obj.state == false) return; if (that.anyUsed != "none") return; this.className = "dhx_toolbar_btn dhxtoolbar_btn_over"; this.renderAs = this.className; } this.obj._doOnMouseOut = function() { this.allowClick = false; if (obj.state == false) return; if (that.anyUsed != "none") return; this.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; this.renderAs = this.renderAs; } this.obj.onclick = function(e) { if (obj.state == false) return; if (this.allowClick == false) return; e = e||event; // event var id = this.idd.replace(that.idPrefix,""); if (this.extAction) try {window[this.extAction](id);} catch(e){}; if(that&&that.callEvent) that.callEvent("onClick", [id]); } this.obj[window.dhx4.isIPad?"ontouchstart":"onmousedown"] = function(e) { if (obj.state == false) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; e.cancelBubble = true; return false; } if (that.anyUsed != "none") return; that.anyUsed = this.idd; this.className = "dhx_toolbar_btn dhxtoolbar_btn_pres"; this.pressed = true; this.onmouseover = function() { this._doOnMouseOver(); } this.onmouseout = function() { that.anyUsed = "none"; this._doOnMouseOut(); } return false; } this.obj[window.dhx4.isIPad?"ontouchend":"onmouseup"] = function(e) { if (obj.state == false) return; if (that.anyUsed != "none") { if (that.anyUsed != this.idd) return; } var t = that.anyUsed; this._doOnMouseUp(); if (window.dhx4.isIPad && t != "none") that.callEvent("onClick", [this.idd.replace(that.idPrefix,"")]); } if (window.dhx4.isIPad) { this.obj.ontouchmove = function(e) { this._doOnMouseUp(); } } this.obj._doOnMouseUp = function() { that.anyUsed = "none"; this.className = this.renderAs; this.pressed = false; } this.obj._doOnMouseUpOnceAnywhere = function() { this._doOnMouseUp(); this.onmouseover = function() { this._doOnMouseOver(); } this.onmouseout = function() { this._doOnMouseOut(); } } // add object that.base.appendChild(this.obj); // // functions this.enableItem = function() { that._enableItem(this); } this.disableItem = function() { that._disableItem(this); } this.isEnabled = function() { return this.state; } this.showItem = function() { this.obj.style.display = ""; } this.hideItem = function() { this.obj.style.display = "none"; } this.isVisible = function() { return (this.obj.style.display == ""); } this.setItemText = function(text) { that._setItemText(this, text); } this.getItemText = function() { return that._getItemText(this); } this.setItemImage = function(url) { that._setItemImage(this, url, true); } this.clearItemImage = function() { that._clearItemImage(this, true); } this.setItemImageDis = function(url) { that._setItemImage(this, url, false); } this.clearItemImageDis = function() { that._clearItemImage(this, false); } this.setItemToolTip = function(tip) { this.obj.title = tip; } this.getItemToolTip = function() { return this.obj.title; } return this; } /****************************************************************************************************************************************************************** object: buttonSelect *******************************************************************************************************************************************************************/ dhtmlXToolbarObject.prototype._buttonSelectObject = function(that, id, data) { this.id = that.idPrefix+id; this.state = (data.enabled!=null?(data.enabled=="true"?true:false):true); this.imgEn = (data.img||""); this.imgDis = (data.imgdis||""); this.img = (this.state?(this.imgEn!=""?this.imgEn:""):(this.imgDis!=""?this.imgDis:"")); this.mode = (data.mode||"button"); // button, select if (this.mode == "select") { this.openAll = true; this.renderSelect = false; if (!data.text||data.text.length==0) data.text = " " } else { this.openAll = (window.dhx4.s2b(data.openAll)==true); this.renderSelect = (data.renderSelect == null ? true : window.dhx4.s2b(data.renderSelect)); } this.maxOpen = (!isNaN(data.maxOpen?data.maxOpen:"")?data.maxOpen:null); this._maxOpenTest = function() { if (!isNaN(this.maxOpen)) { if (!that._sbw) { var t = document.createElement("DIV"); t.className = "dhxtoolbar_maxopen_test"; document.body.appendChild(t); var k = document.createElement("DIV"); k.className = "dhxtoolbar_maxopen_test2"; t.appendChild(k); that._sbw = t.offsetWidth-k.offsetWidth; t.removeChild(k); k = null; document.body.removeChild(t); t = null; } } } this._maxOpenTest(); // this.obj = document.createElement("DIV"); this.obj.allowClick = false; this.obj.extAction = (data.action||null); this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_"+(this.state?"def":"dis"); this.obj.style.display = (data.hidden!=null?"none":""); this.obj.renderAs = this.obj.className; this.obj.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } this.obj.idd = String(id); this.obj.title = (data.title||""); this.obj.pressed = false; this.callEvent = false; this.obj.innerHTML = that._rtlParseBtn((this.img!=""?"":""),(data.text!=null?"
"+data.text+"
":"")); // add object that.base.appendChild(this.obj); this.arw = document.createElement("DIV"); this.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_"+(this.state?"def":"dis"); this.arw.style.display = this.obj.style.display; this.arw.innerHTML = "
 
"; this.arw.title = this.obj.title; this.arw.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } that.base.appendChild(this.arw); var self = this; this.obj.onmouseover = function(e) { e = e||event; if (that.anyUsed != "none") return; if (!self.state) return; self.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"; self.obj.className = self.obj.renderAs; self.arw.className = String(self.obj.renderAs).replace("btn","arw"); } this.obj.onmouseout = function() { self.obj.allowClick = false; if (that.anyUsed != "none") return; if (!self.state) return; self.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; self.obj.className = self.obj.renderAs; self.arw.className = String(self.obj.renderAs).replace("btn","arw"); self.callEvent = false; } this.arw.onmouseover = this.obj.onmouseover; this.arw.onmouseout = this.obj.onmouseout; if (this.openAll == true) { } else { this.obj.onclick = function(e) { e = e||event; if (!self.obj.allowClick) return; if (!self.state) return; if (that.anyUsed != "none") return; // event var id = self.obj.idd.replace(that.idPrefix,""); if (self.obj.extAction) try {window[self.obj.extAction](id);} catch(e){}; that.callEvent("onClick", [id]); } this.obj[window.dhx4.isIPad?"ontouchstart":"onmousedown"] = function(e) { e = e||event; if (that.anyUsed != "none") return; if (!self.state) return; self.obj.allowClick = true; self.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres"; self.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_pres"; self.callEvent = true; } this.obj[window.dhx4.isIPad?"ontouchend":"onmouseup"] = function(e) { e = e||event; e.cancelBubble = true; if (that.anyUsed != "none") return; if (!self.state) return; self.obj.className = self.obj.renderAs; self.arw.className = String(self.obj.renderAs).replace("btn","arw"); if (window.dhx4.isIPad && self.callEvent) { var id = self.obj.idd.replace(that.idPrefix,""); that.callEvent("onClick", [id]); } } } if (window.dhx4.isIPad) { this.obj.ontouchmove = this.obj.onmouseout; } this.arw[window.dhx4.isIPad?"ontouchstart":"onmousedown"] = function(e) { e = e||event; //clickfix var st = (this.className.indexOf("dhx_toolbar_arw") === 0 ? this:this.nextSibling); if (st._skip) { e = e||event; e.cancelBubble = true; } else { st._skip = true; } st = null; if (!self.state) return; if (that.anyUsed == self.obj.idd) { // hide self.obj.className = self.obj.renderAs; self.arw.className = String(self.obj.renderAs).replace("btn","arw"); that.anyUsed = "none"; window.dhx4.zim.clear(self.polygon._idd); self.polygon.style.display = "none"; if (self.polygon._ie6cover) self.polygon._ie6cover.style.display = "none"; // fix border if (that.conf.skin == "dhx_terrace") that._improveTerraceButtonSelect(self.id, true); } else { if (that.anyUsed != "none") { if (that.objPull[that.idPrefix+that.anyUsed]["type"] == "buttonSelect") { var item = that.objPull[that.idPrefix+that.anyUsed]; if (item.polygon.style.display != "none") { item.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; item.obj.className = item.obj.renderAs; item.arw.className = String(self.obj.renderAs).replace("btn","arw"); window.dhx4.zim.clear(item.polygon._idd); item.polygon.style.display = "none"; if (item.polygon._ie6cover) item.polygon._ie6cover.style.display = "none"; // fix border if (that.conf.skin == "dhx_terrace") that._improveTerraceButtonSelect(item.id, true); } } } self.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_over"; self.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_pres"; that.anyUsed = self.obj.idd; // show self.polygon.style.top = "0px"; self.polygon.style.visibility = "hidden"; self.polygon.style.zIndex = window.dhx4.zim.reserve(self.polygon._idd); self.polygon.style.display = ""; // fix border if (that.conf.skin == "dhx_terrace") that._improveTerraceButtonSelect(self.id, false); // check maxOpen self._fixMaxOpenHeight(self.maxOpen||null); // detect overlay by Y axis that._autoDetectVisibleArea(); // calculate top position var newTop = window.dhx4.absTop(self.obj)+self.obj.offsetHeight+that.conf.sel_ofs_y; var newH = self.polygon.offsetHeight; if (newTop + newH > that.tY2) { // if maxOpen mode enabled, check if at bottom at least one item can be shown // and show it, if no space - show on top. in maxOpen mode not enabled, show at top var k0 = (self.maxOpen!=null?Math.floor((that.tY2-newTop)/22):0); // k0 = count of items that can be visible if (k0 >= 1) { self._fixMaxOpenHeight(k0); } else { newTop = window.dhx4.absTop(self.obj)-newH-that.conf.sel_ofs_y; if (newTop < 0) newTop = 0; } } self.polygon.style.top = newTop+"px"; // calculate left position if (that.rtl) { self.polygon.style.left = window.dhx4.absLeft(self.obj)+self.obj.offsetWidth-self.polygon.offsetWidth+that.conf.sel_ofs_x+"px"; } else { var x1 = document.body.scrollLeft; var x2 = x1+(window.innerWidth||document.body.clientWidth); var newLeft = window.dhx4.absLeft(self.obj)+that.conf.sel_ofs_x; if (newLeft+self.polygon.offsetWidth > x2) newLeft = window.dhx4.absLeft(self.arw)+self.arw.offsetWidth-self.polygon.offsetWidth; self.polygon.style.left = Math.max(newLeft,5)+"px"; } self.polygon.style.visibility = "visible"; // show IE6 cover if needed if (self.polygon._ie6cover) { self.polygon._ie6cover.style.left = self.polygon.style.left; self.polygon._ie6cover.style.top = self.polygon.style.top; self.polygon._ie6cover.style.width = self.polygon.offsetWidth+"px"; self.polygon._ie6cover.style.height = self.polygon.offsetHeight+"px"; self.polygon._ie6cover.style.display = ""; } } return false; } this.arw.onclick = function(e) { e = e||event; e.cancelBubble = true; } this.arw[window.dhx4.isIPad?"ontouchend":"onmouseup"] = function(e) { e = e||event; e.cancelBubble = true; } if (this.openAll === true) { this.obj.onclick = this.arw.onclick; this.obj.onmousedown = this.arw.onmousedown; this.obj.onmouseup = this.arw.onmouseup; if (window.dhx4.isIPad) { this.obj.ontouchstart = this.arw.ontouchstart; this.obj.ontouchend = this.arw.ontouchend; } } this.obj.iddPrefix = that.idPrefix; this._listOptions = {}; this._fixMaxOpenHeight = function(maxOpen) { var h = "auto"; var h0 = false; if (maxOpen !== null) { var t = 0; for (var a in this._listOptions) t++; if (t > maxOpen) { this._ph = 22*maxOpen; h = this._ph+"px"; } else { h0 = true; } } this.polygon.style.width = "auto"; this.polygon.style.height = "auto"; if (!h0 && self.maxOpen != null) { this.polygon.style.width = this.p_tbl.offsetWidth+that._sbw+"px"; this.polygon.style.height = h; } } // inner objects: separator this._separatorButtonSelectObject = function(id, data, pos) { this.obj = {}; this.obj.tr = document.createElement("TR"); this.obj.tr.className = "tr_sep"; this.obj.tr.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; return false; } this.obj.td = document.createElement("TD"); this.obj.td.colSpan = "2"; this.obj.td.className = "td_btn_sep"; this.obj.td.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; return false; } if (isNaN(pos)) pos = self.p_tbody.childNodes.length+1; else if (pos < 1) pos = 1; if (pos > self.p_tbody.childNodes.length) self.p_tbody.appendChild(this.obj.tr); else self.p_tbody.insertBefore(this.obj.tr, self.p_tbody.childNodes[pos-1]); this.obj.tr.appendChild(this.obj.td); this.obj.sep = document.createElement("DIV"); this.obj.sep.className = "btn_sep"; this.obj.sep.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; return false; } this.obj.td.appendChild(this.obj.sep); self._listOptions[id] = this.obj; return this; } // inner objects: button this._buttonButtonSelectObject = function(id, data, pos) { var en = true; if (typeof(data.enabled) != "undefined") { en = window.dhx4.s2b(data.enabled); } else if (typeof(data.disabled) != "undefined") { en = window.dhx4.s2b(data.disabled); } this.obj = {}; this.obj.tr = document.createElement("TR"); this.obj.tr.en = en; this.obj.tr.extAction = (data.action||null); this.obj.tr._selected = (data.selected!=null); this.obj.tr.className = "tr_btn"+(this.obj.tr.en?(this.obj.tr._selected&&self.renderSelect?" tr_btn_selected":""):" tr_btn_disabled"); this.obj.tr.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; return false; } this.obj.tr.idd = String(id); if (isNaN(pos)) pos = self.p_tbody.childNodes.length+1; else if (pos < 1) pos = 1; if (pos > self.p_tbody.childNodes.length) self.p_tbody.appendChild(this.obj.tr); else self.p_tbody.insertBefore(this.obj.tr, self.p_tbody.childNodes[pos-1]); this.obj.td_a = document.createElement("TD"); this.obj.td_a.className = "td_btn_img"; this.obj.td_a.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; return false; } this.obj.td_b = document.createElement("TD"); this.obj.td_b.className = "td_btn_txt"; this.obj.td_b.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; return false; } if (that.rtl) { this.obj.tr.appendChild(this.obj.td_b); this.obj.tr.appendChild(this.obj.td_a); } else { this.obj.tr.appendChild(this.obj.td_a); this.obj.tr.appendChild(this.obj.td_b); } // image if (data.img != null) { this.obj.td_a.innerHTML = ""; this.obj.tr._img = data.img; } else { this.obj.td_a.innerHTML = " "; } // text var itemText = (data.text!=null?data.text:(data.itemText||"")); /* if (itemText == null) { var itm = data.getElementsByTagName("itemText"); itemText = (itm[0]!=null?itm[0].firstChild.nodeValue:""); } */ this.obj.td_b.innerHTML = "
"+itemText+"
"; this.obj.tr[window.dhx4.isIPad?"ontouchstart":"onmouseover"] = function() { if (!this.en || (this._selected && self.renderSelect)) return; this.className = "tr_btn tr_btn_over"; } this.obj.tr.onmouseout = function() { if (!this.en) return; if (this._selected && self.renderSelect) { if (String(this.className).search("tr_btn_selected") == -1) this.className = "tr_btn tr_btn_selected"; } else { this.className = "tr_btn"; } } this.obj.tr[window.dhx4.isIPad?"ontouchend":"onclick"] = function(e) { e = e||event; e.cancelBubble = true; if (!this.en) return; self.setListOptionSelected(this.idd.replace(that.idPrefix,"")); // self.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; self.obj.className = self.obj.renderAs; self.arw.className = String(self.obj.renderAs).replace("btn","arw"); window.dhx4.zim.clear(self.polygon._idd); self.polygon.style.display = "none"; if (self.polygon._ie6cover) self.polygon._ie6cover.style.display = "none"; // fix border if (that.conf.skin == "dhx_terrace") that._improveTerraceButtonSelect(self.id, true); that.anyUsed = "none"; // event var id = this.idd.replace(that.idPrefix,""); if (this.extAction) try {window[this.extAction](id);} catch(e){}; that.callEvent("onClick", [id]); } self._listOptions[id] = this.obj; return this; } // add polygon this.polygon = document.createElement("DIV"); this.polygon.dir = "ltr"; this.polygon.style.display = "none"; this.polygon.className = "dhx_toolbar_poly_"+that.conf.skin+" dhxtoolbar_icons_"+that.conf.iconSize; this.polygon.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } this.polygon.onmousedown = function(e) { e = e||event; e.cancelBubble = true; } this.polygon.style.overflowY = "auto"; this.polygon._idd = window.dhx4.newId(); if (window.dhx4.isIPad) { this.polygon.ontouchstart = function(e){ e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; e.cancelBubble = true; return false; } } this.p_tbl = document.createElement("TABLE"); this.p_tbl.className = "buttons_cont"; this.p_tbl.cellSpacing = "0"; this.p_tbl.cellPadding = "0"; this.p_tbl.border = "0"; this.polygon.appendChild(this.p_tbl); this.p_tbody = document.createElement("TBODY"); this.p_tbl.appendChild(this.p_tbody); // if (data.options != null) { for (var q=0; q 0) item.td_a.removeChild(item.td_a.childNodes[0]); while (item.td_b.childNodes.length > 0) item.td_b.removeChild(item.td_b.childNodes[0]); item.tr.onselectstart = null; item.tr.onmouseover = null; item.tr.onmouseout = null; item.tr.onclick = null; while (item.tr.childNodes.length > 0) item.tr.removeChild(item.tr.childNodes[0]); item.tr.parentNode.removeChild(item.tr); item.td_a = null; item.td_b = null; item.tr = null; } else { // separator item.sep.onselectstart = null; item.td.onselectstart = null; item.tr.onselectstart = null; while (item.td.childNodes.length > 0) item.td.removeChild(item.td.childNodes[0]); while (item.tr.childNodes.length > 0) item.tr.removeChild(item.tr.childNodes[0]); item.tr.parentNode.removeChild(item.tr); item.sep = null; item.td = null; item.tr = null; } item = null; this._listOptions[id] = null; try { delete this._listOptions[id]; } catch(e) {} } // new engine this.showListOption = function(id) { if (!this._isListButton(id, true)) return; this._listOptions[id].tr.style.display = ""; } // new engine this.hideListOption = function(id) { if (!this._isListButton(id, true)) return; this._listOptions[id].tr.style.display = "none"; } // new engine this.isListOptionVisible = function(id) { if (!this._isListButton(id, true)) return; return (this._listOptions[id].tr.style.display != "none"); } // new engine this.enableListOption = function(id) { if (!this._isListButton(id)) return; this._listOptions[id].tr.en = true; this._listOptions[id].tr.className = "tr_btn"+(this._listOptions[id].tr._selected&&that.renderSelect?" tr_btn_selected":""); } // new engine this.disableListOption = function(id) { if (!this._isListButton(id)) return; this._listOptions[id].tr.en = false; this._listOptions[id].tr.className = "tr_btn tr_btn_disabled"; } // new engine this.isListOptionEnabled = function(id) { if (!this._isListButton(id)) return; return this._listOptions[id].tr.en; } // new engine this.setListOptionPosition = function(id, pos) { if (!this._listOptions[id] || this.getListOptionPosition(id) == pos || isNaN(pos)) return; if (pos < 1) pos = 1; var tr = this._listOptions[id].tr; this.p_tbody.removeChild(tr); if (pos > this.p_tbody.childNodes.length) this.p_tbody.appendChild(tr); else this.p_tbody.insertBefore(tr, this.p_tbody.childNodes[pos-1]); tr = null; } // new engine this.getListOptionPosition = function(id) { var pos = -1; if (!this._listOptions[id]) return pos; for (var q=0; q 0) { td.childNodes[0].src = that.conf.icons_path+img; } else { var imgObj = document.createElement("IMG"); imgObj.className = "btn_sel_img"; imgObj.src = that.conf.icons_path+img; td.appendChild(imgObj); } td = null; } // new engine this.getListOptionImage = function(id) { if (!this._isListButton(id)) return; var td = this._listOptions[id].tr.childNodes[(that.rtl?1:0)]; var src = null; if (td.childNodes.length > 0) src = td.childNodes[0].src; td = null; return src; } // new engine this.clearListOptionImage = function(id) { if (!this._isListButton(id)) return; var td = this._listOptions[id].tr.childNodes[(that.rtl?1:0)]; while (td.childNodes.length > 0) td.removeChild(td.childNodes[0]); td.innerHTML = " "; td = null; } // new engine this.setListOptionText = function(id, text) { if (!this._isListButton(id)) return; this._listOptions[id].tr.childNodes[(that.rtl?0:1)].childNodes[0].innerHTML = text; } // new engine this.getListOptionText = function(id) { if (!this._isListButton(id)) return; return this._listOptions[id].tr.childNodes[(that.rtl?0:1)].childNodes[0].innerHTML; } // new engine this.setListOptionToolTip = function(id, tip) { if (!this._isListButton(id)) return; this._listOptions[id].tr.title = tip; } // new engine this.getListOptionToolTip = function(id) { if (!this._isListButton(id)) return; return this._listOptions[id].tr.title; } // works this.forEachListOption = function(handler) { for (var a in this._listOptions) handler(a); } // works, return array with ids this.getAllListOptions = function() { var listData = new Array(); for (var a in this._listOptions) listData[listData.length] = a; return listData; } // new engine this.setListOptionSelected = function(id) { for (var a in this._listOptions) { var item = this._listOptions[a]; if (item.td_a != null && item.td_b != null && item.tr.en) { if (a == id) { item.tr._selected = true; item.tr.className = "tr_btn"+(this.renderSelect?" tr_btn_selected":""); // if (this.mode == "select") { if (item.tr._img) this.setItemImage(item.tr._img); else this.clearItemImage(); this.setItemText(this.getListOptionText(id)); } } else { item.tr._selected = false; item.tr.className = "tr_btn"; } } item = null; } } // new engine this.getListOptionSelected = function() { var id = null; for (var a in this._listOptions) if (this._listOptions[a].tr._selected == true) id = a; return id; } // inner, return tru if list option is button and is exists this._isListButton = function(id, allowSeparator) { if (this._listOptions[id] == null) return false; if (!allowSeparator && this._listOptions[id].tr.className == "tr_sep") return false; return true; } this.setMaxOpen = function(r) { this._ph = null; if (typeof(r) == "number") { this.maxOpen = r; this._maxOpenTest(); return; } this.maxOpen = null; } if (data.width) this.setWidth(data.width); if (this.mode == "select" && typeof(data.selected) != "undefined") this.setListOptionSelected(data.selected); // return this; } /***************************************************************************************************************************************************************** object: buttonInput ***************************************************************************************************************************************************************** */ dhtmlXToolbarObject.prototype._buttonInputObject = function(that, id, data) { // this.id = that.idPrefix+id; this.obj = document.createElement("DIV"); this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; this.obj.style.display = (data.hidden!=null?"none":""); this.obj.idd = String(id); this.obj.w = (data.width!=null?data.width:100); this.obj.title = (data.title!=null?data.title:""); // this.obj.innerHTML = ""; var th = that; var self = this; this.obj.childNodes[0].onkeydown = function(e) { e = e||event; if (e.keyCode == 13) { th.callEvent("onEnter", [self.obj.idd, this.value]); } } // add that.base.appendChild(this.obj); // this.enableItem = function() { this.obj.childNodes[0].disabled = false; } this.disableItem = function() { this.obj.childNodes[0].disabled = true; } this.isEnabled = function() { return (!this.obj.childNodes[0].disabled); } this.showItem = function() { this.obj.style.display = ""; } this.hideItem = function() { this.obj.style.display = "none"; } this.isVisible = function() { return (this.obj.style.display != "none"); } this.setValue = function(value) { this.obj.childNodes[0].value = value; } this.getValue = function() { return this.obj.childNodes[0].value; } this.setWidth = function(width) { this.obj.w = width; this.obj.childNodes[0].style.width = this.obj.w+"px"; } this.getWidth = function() { return this.obj.w; } this.setItemToolTip = function(tip) { this.obj.title = tip; } this.getItemToolTip = function() { return this.obj.title; } this.getInput = function() { return this.obj.firstChild; } if (typeof(data.enabled) != "undefined" && window.dhx4.s2b(data.enabled) == false) { this.disableItem(); } // return this; } /***************************************************************************************************************************************************************** object: buttonTwoState ***************************************************************************************************************************************************************** */ dhtmlXToolbarObject.prototype._buttonTwoStateObject = function(that, id, data) { this.id = that.idPrefix+id; this.state = (data.enabled!=null?false:true); this.imgEn = (data.img!=null?data.img:""); this.imgDis = (data.imgdis!=null?data.imgdis:""); this.img = (this.state?(this.imgEn!=""?this.imgEn:""):(this.imgDis!=""?this.imgDis:"")); // this.obj = document.createElement("DIV"); this.obj.pressed = (data.selected!=null); this.obj.extAction = (data.action||null); this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_"+(this.obj.pressed?"pres"+(this.state?"":"_dis"):(this.state?"def":"dis")); this.obj.style.display = (data.hidden!=null?"none":""); this.obj.renderAs = this.obj.className; this.obj.idd = String(id); this.obj.title = (data.title||""); if (this.obj.pressed) { this.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"; } this.obj.innerHTML = that._rtlParseBtn((this.img!=""?"":""),(data.text!=null?"
"+data.text+"
":"")); // add object that.base.appendChild(this.obj); var obj = this; this.obj.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } this.obj.onmouseover = function() { this._doOnMouseOver(); } this.obj.onmouseout = function() { this._doOnMouseOut(); } this.obj._doOnMouseOver = function() { if (obj.state == false) return; if (that.anyUsed != "none") return; if (this.pressed) { this.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"; return; } this.className = "dhx_toolbar_btn dhxtoolbar_btn_over"; this.renderAs = this.className; } this.obj._doOnMouseOut = function() { if (obj.state == false) return; if (that.anyUsed != "none") return; if (this.pressed) { this.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; return; } this.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; this.renderAs = this.className; } this.obj[window.dhx4.isIPad?"ontouchstart":"onmousedown"] = function(e) { if (that.checkEvent("onBeforeStateChange")) if (!that.callEvent("onBeforeStateChange", [this.idd.replace(that.idPrefix, ""), this.pressed])) return; // if (obj.state == false) return; if (that.anyUsed != "none") return; this.pressed = !this.pressed; this.className = (this.pressed?"dhx_toolbar_btn dhxtoolbar_btn_pres":this.renderAs); // event var id = this.idd.replace(that.idPrefix, ""); if (this.extAction) try {window[this.extAction](id, this.pressed);} catch(e){}; that.callEvent("onStateChange", [id, this.pressed]); //this._doOnMouseOut(); return false; } // functions this.setItemState = function(state, callEvent) { if (this.obj.pressed != state) { if (state == true) { this.obj.pressed = true; this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres"+(this.state?"":"_dis"); this.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"; } else { this.obj.pressed = false; this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_"+(this.state?"def":"dis"); this.obj.renderAs = this.obj.className; } if (callEvent == true) { var id = this.obj.idd.replace(that.idPrefix, ""); if (this.obj.extAction) try {window[this.obj.extAction](id, this.obj.pressed);} catch(e){}; that.callEvent("onStateChange", [id, this.obj.pressed]); } } } this.getItemState = function() { return this.obj.pressed; } this.enableItem = function() { that._enableItem(this); } this.disableItem = function() { that._disableItem(this); } this.isEnabled = function() { return this.state; } this.showItem = function() { this.obj.style.display = ""; } this.hideItem = function() { this.obj.style.display = "none"; } this.isVisible = function() { return (this.obj.style.display == ""); } this.setItemText = function(text) { that._setItemText(this, text); } this.getItemText = function() { return that._getItemText(this); } this.setItemImage = function(url) { that._setItemImage(this, url, true); } this.clearItemImage = function() { that._clearItemImage(this, true); } this.setItemImageDis = function(url) { that._setItemImage(this, url, false); } this.clearItemImageDis = function() { that._clearItemImage(this, false); } this.setItemToolTip = function(tip) { this.obj.title = tip; } this.getItemToolTip = function() { return this.obj.title; } // return this; } /***************************************************************************************************************************************************************** object: slider ***************************************************************************************************************************************************************** */ dhtmlXToolbarObject.prototype._sliderObject = function(that, id, data) { this.id = that.idPrefix+id; this.state = (data.enabled!=null?(data.enabled=="true"?true:false):true); this.obj = document.createElement("DIV"); this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_"+(this.state?"def":"dis"); this.obj.style.display = (data.hidden!=null?"none":""); this.obj.onselectstart = function(e) { e = e||event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } this.obj.idd = String(id); this.obj.len = (data.length!=null?Number(data.length):50); // this.obj.innerHTML = "
"+(data.textMin||"")+"
"+ "
"+ "
"+ "
"+ "
"+(data.textMax||"")+"
"; // add object that.base.appendChild(this.obj); var self = this; this.pen = document.createElement("DIV"); this.pen.className = "dhxtoolbar_sl_pen"; this.obj.appendChild(this.pen); var pen = this.pen; this.label = document.createElement("DIV"); this.label.dir = "ltr"; this.label.className = "dhx_toolbar_slider_label_"+that.conf.skin+(that.rtl?"_rtl":""); this.label.style.display = "none"; this.label.tip = (data.toolTip||"%v"); this.label._zi = window.dhx4.newId(); document.body.appendChild(this.label); var label = this.label; // mix-max value this.pen.valueMin = (data.valueMin!=null?Number(data.valueMin):0); this.pen.valueMax = (data.valueMax!=null?Number(data.valueMax):100); if (this.pen.valueMin > this.pen.valueMax) this.pen.valueMin = this.pen.valueMax; // init value this.pen.valueNow = (data.valueNow!=null?Number(data.valueNow):this.pen.valueMax); if (this.pen.valueNow > this.pen.valueMax) this.pen.valueNow = this.pen.valueMax; if (this.pen.valueNow < this.pen.valueMin) this.pen.valueNow = this.pen.valueMin; // min/max x coordinate this.pen._detectLimits = function() { this.minX = self.obj.childNodes[1].offsetLeft+2; this.maxX = self.obj.childNodes[3].offsetLeft-this.offsetWidth+1; } this.pen._detectLimits(); // position this.pen._definePos = function() { this.nowX = Math.round((this.valueNow-this.valueMin)*(this.maxX-this.minX)/(this.valueMax-this.valueMin)+this.minX); this.style.left = this.nowX+"px"; this.newNowX = this.nowX; } this.pen._definePos(); this.pen.initXY = 0; this.pen.allowMove = false; this.pen[window.dhx4.isIPad?"ontouchstart":"onmousedown"] = function(e) { if (self.state == false) return; e = e||event; this.initXY = (window.dhx4.isIPad?e.touches[0].clientX:e.clientX); //e.clientX; this.newValueNow = this.valueNow; this.allowMove = true; this.className = "dhxtoolbar_sl_pen dhxtoolbar_over"; if (label.tip != "") { label.style.visibility = "hidden"; label.style.display = ""; label.innerHTML = label.tip.replace("%v", this.valueNow); label.style.left = Math.round(window.dhx4.absLeft(this)+this.offsetWidth/2-label.offsetWidth/2)+"px"; label.style.top = window.dhx4.absTop(this)-label.offsetHeight-3+"px"; label.style.visibility = ""; label.style.zIndex = window.dhx4.zim.reserve(label._zi); } } this.pen._doOnMouseMoveStart = function(e) { // optimized for destructor e=e||event; if (!pen.allowMove) return; var ecx = (window.dhx4.isIPad?e.touches[0].clientX:e.clientX); var ofst = ecx - pen.initXY; // mouse goes out to left/right from pen if (ecx < window.dhx4.absLeft(pen)+Math.round(pen.offsetWidth/2) && pen.nowX == pen.minX) return; if (ecx > window.dhx4.absLeft(pen)+Math.round(pen.offsetWidth/2) && pen.nowX == pen.maxX) return; pen.newNowX = pen.nowX + ofst; if (pen.newNowX < pen.minX) pen.newNowX = pen.minX; if (pen.newNowX > pen.maxX) pen.newNowX = pen.maxX; pen.nowX = pen.newNowX; pen.style.left = pen.nowX+"px"; pen.initXY = ecx; pen.newValueNow = Math.round((pen.valueMax-pen.valueMin)*(pen.newNowX-pen.minX)/(pen.maxX-pen.minX)+pen.valueMin); if (label.tip != "") { label.innerHTML = label.tip.replace(/%v/gi, pen.newValueNow); label.style.left = Math.round(window.dhx4.absLeft(pen)+pen.offsetWidth/2-label.offsetWidth/2)+"px"; label.style.top = window.dhx4.absTop(pen)-label.offsetHeight-3+"px"; } e.cancelBubble = true; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; return false; } this.pen._doOnMouseMoveEnd = function() { if (!pen.allowMove) return; pen.className = "dhxtoolbar_sl_pen"; pen.allowMove = false; pen.nowX = pen.newNowX; pen.valueNow = pen.newValueNow; if (label.tip != "") { label.style.display = "none"; window.dhx4.zim.clear(label._zi); } that.callEvent("onValueChange", [self.obj.idd.replace(that.idPrefix, ""), pen.valueNow]); } if (window.dhx4.isIPad) { document.addEventListener("touchmove", pen._doOnMouseMoveStart, false); document.addEventListener("touchend", pen._doOnMouseMoveEnd, false); } else { if (typeof(window.addEventListener) != "undefined") { window.addEventListener("mousemove", pen._doOnMouseMoveStart, false); window.addEventListener("mouseup", pen._doOnMouseMoveEnd, false); } else { document.body.attachEvent("onmousemove", pen._doOnMouseMoveStart); document.body.attachEvent("onmouseup", pen._doOnMouseMoveEnd); } } // functions this.enableItem = function() { if (this.state) return; this.state = true; this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; } this.disableItem = function() { if (!this.state) return; this.state = false; this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_dis"; } this.isEnabled = function() { return this.state; } this.showItem = function() { this.obj.style.display = ""; } this.hideItem = function() { this.obj.style.display = "none"; } this.isVisible = function() { return (this.obj.style.display == ""); } this.setValue = function(value, callEvent) { value = Number(value); if (value < this.pen.valueMin) value = this.pen.valueMin; if (value > this.pen.valueMax) value = this.pen.valueMax; this.pen.valueNow = value; this.pen._definePos(); if (callEvent == true) that.callEvent("onValueChange", [this.obj.idd.replace(that.idPrefix, ""), this.pen.valueNow]); } this.getValue = function() { return this.pen.valueNow; } this.setMinValue = function(value, label) { value = Number(value); if (value > this.pen.valueMax) return; this.obj.childNodes[0].innerHTML = label; this.obj.childNodes[0].style.display = (label.length>0?"":"none"); this.pen.valueMin = value; if (this.pen.valueNow < this.pen.valueMin) this.pen.valueNow = this.pen.valueMin; this.pen._detectLimits(); this.pen._definePos(); } this.setMaxValue = function(value, label) { value = Number(value); if (value < this.pen.valueMin) return; this.obj.childNodes[4].innerHTML = label; this.obj.childNodes[4].style.display = (label.length>0?"":"none"); this.pen.valueMax = value; if (this.pen.valueNow > this.pen.valueMax) this.pen.valueNow = this.pen.valueMax; this.pen._detectLimits(); this.pen._definePos(); } this.getMinValue = function() { var label = this.obj.childNodes[0].innerHTML; var value = this.pen.valueMin; return new Array(value, label); } this.getMaxValue = function() { var label = this.obj.childNodes[4].innerHTML; var value = this.pen.valueMax; return new Array(value, label); } this.setItemToolTipTemplate = function(template) { this.label.tip = template; } this.getItemToolTipTemplate = function() { return this.label.tip; } // return this; } dhtmlXToolbarObject.prototype.unload = function() { if (this.conf.isIPad) { document.removeEventListener("touchstart", this._doOnClick, false); } else { if (typeof(window.addEventListener) == "function") { window.removeEventListener("mousedown", this._doOnClick, false); } else { document.body.detachEvent("onmousedown", this._doOnClick); } } this._doOnClick = null; this.clearAll(); this.objPull = null; if (this._xmlLoader) { this._xmlLoader.destructor(); this._xmlLoader = null; } while (this.base.childNodes.length > 0) this.base.removeChild(this.base.childNodes[0]); this.cont.removeChild(this.base); this.base = null; while (this.cont.childNodes.length > 0) this.cont.removeChild(this.cont.childNodes[0]); this.cont.className = ""; this.cont = null; window.dhx4._enableDataLoading(this, null, null, null, "clear"); window.dhx4._eventable(this, "clear"); this.tX1 = null; this.tX2 = null; this.tY1 = null; this.tY2 = null; this.anyUsed = null; this.idPrefix = null; this.rootTypes = null; this._rtl = null; this._rtlParseBtn = null; this.setRTL = null; this._sbw = null; this._getObj = null; this._addImgObj = null; this._setItemImage = null; this._clearItemImage = null; this._setItemText = null; this._getItemText = null; this._enableItem = null; this._disableItem = null; this._xmlParser = null; this._addItemToStorage = null; this._genStr = null; this._addItem = null; this._getPosition = null; this._setPosition = null; this._getIdByPosition = null; this._separatorObject = null; this._textObject = null; this._buttonObject = null; this._buttonSelectObject = null; this._buttonInputObject = null; this._buttonTwoStateObject = null; this._sliderObject = null; this._autoDetectVisibleArea = null; this._removeItem = null; this.setAlign = null; this.setSkin = null; this.setIconsPath = null; this.setIconPath = null; this.loadXML = null; this.loadXMLString = null; this.clearAll = null; this.addSpacer = null; this.removeSpacer = null; this.getType = null; this.getTypeExt = null; this.inArray = null; this.getParentId = null; this.addButton = null; this.addText = null; this.addButtonSelect = null; this.addButtonTwoState = null; this.addSeparator = null; this.addSlider = null; this.addInput = null; this.forEachItem = null; this.showItem = null; this.hideItem = null; this.isVisible = null; this.enableItem = null; this.disableItem = null; this.isEnabled = null; this.setItemText = null; this.getItemText = null; this.setItemToolTip = null; this.getItemToolTip = null; this.setItemImage = null; this.setItemImageDis = null; this.clearItemImage = null; this.clearItemImageDis = null; this.setItemState = null; this.getItemState = null; this.setItemToolTipTemplate = null; this.getItemToolTipTemplate = null; this.setValue = null; this.getValue = null; this.setMinValue = null; this.getMinValue = null; this.setMaxValue = null; this.getMaxValue = null; this.setWidth = null; this.getWidth = null; this.getPosition = null; this.setPosition = null; this.removeItem = null; this.addListOption = null; this.removeListOption = null; this.showListOption = null; this.hideListOption = null; this.isListOptionVisible = null; this.enableListOption = null; this.disableListOption = null; this.isListOptionEnabled = null; this.setListOptionPosition = null; this.getListOptionPosition = null; this.setListOptionText = null; this.getListOptionText = null; this.setListOptionToolTip = null; this.getListOptionToolTip = null; this.setListOptionImage = null; this.getListOptionImage = null; this.clearListOptionImage = null; this.forEachListOption = null; this.getAllListOptions = null; this.setListOptionSelected = null; this.getListOptionSelected = null; this.unload = null; this.setUserData = null; this.getUserData = null; this.setMaxOpen = null; this.items = null; this.conf = null; }; dhtmlXToolbarObject.prototype._autoDetectVisibleArea = function() { var d = window.dhx4.screenDim(); this.tX1 = d.left; this.tX2 = d.right; this.tY1 = d.top; this.tY2 = d.bottom; }; dhtmlXToolbarObject.prototype._initObj = function(data) { for (var q=0; q= 0 && p[w][q-1] != null && bn[p[w][q-1].type])) bl = true; } t.node.style.borderRightWidth = (br?"1px":"0px"); t.node.style.borderTopRightRadius = t.node.style.borderBottomRightRadius = (br?this.conf.terrace_radius:"0px"); if (t.type == "buttonSelect") { t.node.previousSibling.style.borderTopLeftRadius = t.node.previousSibling.style.borderBottomLeftRadius = (bl?this.conf.terrace_radius:"0px"); t.node.previousSibling._br = br; t.node.previousSibling._bl = bl; } else { t.node.style.borderTopLeftRadius = t.node.style.borderBottomLeftRadius = (bl?this.conf.terrace_radius:"0px"); } t.node._br = br; t.node._bl = bl; } } for (var w=0; w