//v.3.0 build 110707 /* 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 */ /****************************************************************************************************************************************************/ /* EXTENDED MODULE INFO */ dhtmlXMenuObject.prototype.extendedModule = "DHXMENUEXT"; /****************************************************************************************************************************************************/ /* ENABLING/DISBLING */ /** * @desc: enables an item * @param: id - item's id to enable * @param: state - true|false * @type: public */ dhtmlXMenuObject.prototype.setItemEnabled = function(id) { // modified in 0.4 this._changeItemState(id, "enabled", this._getItemLevelType(id)); } /** * @desc: disables an item * @param: id - item's id to disablei * @type: public */ dhtmlXMenuObject.prototype.setItemDisabled = function(id) { this._changeItemState(id, "disabled", this._getItemLevelType(id)); } /** * @desc: returns true if the item is enabled * @param: id - the item to check * @type: public */ dhtmlXMenuObject.prototype.isItemEnabled = function(id) { return (this.itemPull[this.idPrefix+id]!=null?(this.itemPull[this.idPrefix+id]["state"]=="enabled"):false); } /* enable/disable sublevel item */ dhtmlXMenuObject.prototype._changeItemState = function(id, newState, levelType) { var t = false; var j = this.idPrefix + id; if ((this.itemPull[j] != null) && (this.idPull[j] != null)) { if (this.itemPull[j]["state"] != newState) { this.itemPull[j]["state"] = newState; if (this.itemPull[j]["parent"] == this.idPrefix+this.topId && !this.context) { this.idPull[j].className = "dhtmlxMenu_"+this.skin+"_TopLevel_Item_"+(this.itemPull[j]["state"]=="enabled"?"Normal":"Disabled"); } else { this.idPull[j].className = "sub_item"+(this.itemPull[j]["state"]=="enabled"?"":"_dis"); } this._updateItemComplexState(this.idPrefix+id, this.itemPull[this.idPrefix+id]["complex"], false); this._updateItemImage(id, levelType); // if changeItemState attached to onClick event and changing applies to selected item all selection should be reparsed if ((this.idPrefix + this.menuLastClicked == j) && (levelType != "TopLevel")) { this._redistribSubLevelSelection(j, this.itemPull[j]["parent"]); } if (levelType == "TopLevel" && !this.context) { // rebuild style.left and show nested polygons // this._redistribTopLevelSelection(id, "parent"); } } } return t; } /****************************************************************************************************************************************************/ /* SET/GET TEXT */ /** * @desc: returns item's text * @param: id - the item * @type: public */ dhtmlXMenuObject.prototype.getItemText = function(id) { return (this.itemPull[this.idPrefix+id]!=null?this.itemPull[this.idPrefix+id]["title"]:""); } /** * @desc: sets text for the item * @param: id - the item * @param: text - a new text * @type: public */ dhtmlXMenuObject.prototype.setItemText = function(id, text) { id = this.idPrefix + id; if ((this.itemPull[id] != null) && (this.idPull[id] != null)) { this._clearAndHide(); this.itemPull[id]["title"] = text; if (this.itemPull[id]["parent"] == this.idPrefix+this.topId && !this.context) { // top level var tObj = null; for (var q=0; q 0) this.idPull[id].insertBefore(tObj,this.idPull[id].childNodes[0]); else this.idPull[id].appendChild(tObj); } tObj.innerHTML = this.itemPull[id]["title"]; } } else { // sub level var tObj = null; for (var q=0; q