@@ 664-734 (lines=71) @@ | ||
661 | if (onLoadFunction) this._doOnLoad = function() { onLoadFunction(); }; |
|
662 | this._xmlLoader.loadXMLString(xmlString); |
|
663 | } |
|
664 | this._buildMenu = function(t, parentId) { |
|
665 | // if (parentId==null) { parentId = this.topId;} |
|
666 | var u = 0; |
|
667 | for (var q=0; q<t.childNodes.length; q++) { |
|
668 | if (t.childNodes[q].tagName == this.itemTagName) { |
|
669 | var r = t.childNodes[q]; |
|
670 | var item = {}; |
|
671 | // basic |
|
672 | item["id"] = this.idPrefix+(r.getAttribute("id")||this._genStr(24)); |
|
673 | item["title"] = r.getAttribute("text")||""; |
|
674 | // images |
|
675 | item["imgen"] = r.getAttribute("img")||""; |
|
676 | item["imgdis"] = r.getAttribute("imgdis")||""; |
|
677 | item["tip"] = ""; |
|
678 | item["hotkey"] = ""; |
|
679 | // custom css |
|
680 | if (r.getAttribute("cssNormal") != null) { item["cssNormal"] = r.getAttribute("cssNormal"); } |
|
681 | // type |
|
682 | item["type"] = r.getAttribute("type")||"item"; |
|
683 | //#menu_checks:06062008{ |
|
684 | if (item["type"] == "checkbox") { |
|
685 | item["checked"] = (r.getAttribute("checked")!=null); |
|
686 | // set classname |
|
687 | item["imgen"] = "chbx_"+(item["checked"]?"1":"0"); |
|
688 | item["imgdis"] = item["imgen"]; |
|
689 | } |
|
690 | //#} |
|
691 | //#menu_radio:06062008{ |
|
692 | if (item["type"] == "radio") { |
|
693 | item["checked"] = (r.getAttribute("checked")!=null); |
|
694 | item["imgen"] = "rdbt_"+(item["checked"]?"1":"0"); |
|
695 | item["imgdis"] = item["imgen"]; |
|
696 | item["group"] = r.getAttribute("group")||this._genStr(24); |
|
697 | if (this.radio[item["group"]]==null) { this.radio[item["group"]] = new Array(); } |
|
698 | this.radio[item["group"]][this.radio[item["group"]].length] = item["id"]; |
|
699 | } |
|
700 | //#} |
|
701 | // enable/disable |
|
702 | item["state"] = (r.getAttribute("enabled")!=null||r.getAttribute("disabled")!=null?(r.getAttribute("enabled")=="false"||r.getAttribute("disabled")=="true"?"disabled":"enabled"):"enabled"); |
|
703 | item["parent"] = (parentId!=null?parentId:this.idPrefix+this.topId); |
|
704 | // item["complex"] = (((this.dLoad)&&(parentId!=null))?(r.getAttribute("complex")!=null?true:false):(this._buildMenu(r,item["id"])>0)); |
|
705 | item["complex"] = (this.dLoad?(r.getAttribute("complex")!=null?true:false):(this._buildMenu(r,item["id"])>0)); |
|
706 | if (this.dLoad && item["complex"]) { item["loaded"] = "no"; } |
|
707 | this.itemPull[item["id"]] = item; |
|
708 | // check for user data |
|
709 | for (var w=0; w<r.childNodes.length; w++) { |
|
710 | // added in 0.4 |
|
711 | var tagNm = r.childNodes[w].tagName; |
|
712 | if (tagNm != null) { tagNm = tagNm.toLowerCase(); } |
|
713 | // |
|
714 | if (tagNm == this.userDataTagName) { |
|
715 | var d = r.childNodes[w]; |
|
716 | if (d.getAttribute("name")!=null) { this.userData[item["id"]+"_"+d.getAttribute("name")] = (d.firstChild!=null&&d.firstChild.nodeValue!=null?d.firstChild.nodeValue:""); } |
|
717 | } |
|
718 | // extended text, added in 0.4 |
|
719 | if (tagNm == this.itemTextTagName) { item["title"] = r.childNodes[w].firstChild.nodeValue; } |
|
720 | // tooltips, added in 0.4 |
|
721 | if (tagNm == this.itemTipTagName) { item["tip"] = r.childNodes[w].firstChild.nodeValue; } |
|
722 | // hotkeys, added in 0.4 |
|
723 | if (tagNm == this.itemHotKeyTagName) { item["hotkey"] = r.childNodes[w].firstChild.nodeValue; } |
|
724 | // hrefs |
|
725 | if (tagNm == this.itemHrefTagName && item["type"] == "item") { |
|
726 | item["href_link"] = r.childNodes[w].firstChild.nodeValue; |
|
727 | if (r.childNodes[w].getAttribute("target") != null) { item["href_target"] = r.childNodes[w].getAttribute("target"); } |
|
728 | } |
|
729 | } |
|
730 | u++; |
|
731 | } |
|
732 | } |
|
733 | return u; |
|
734 | } |
|
735 | /* parse incoming xml */ |
|
736 | this._xmlParser = function() { |
|
737 | if (main_self.dLoad) { |
@@ 638-708 (lines=71) @@ | ||
635 | if (onLoadFunction) this._doOnLoad = function() { onLoadFunction(); }; |
|
636 | this._xmlLoader.loadXMLString(xmlString); |
|
637 | } |
|
638 | this._buildMenu = function(t, parentId) { |
|
639 | // if (parentId==null) { parentId = this.topId;} |
|
640 | var u = 0; |
|
641 | for (var q=0; q<t.childNodes.length; q++) { |
|
642 | if (t.childNodes[q].tagName == this.itemTagName) { |
|
643 | var r = t.childNodes[q]; |
|
644 | var item = {}; |
|
645 | // basic |
|
646 | item["id"] = this.idPrefix+(r.getAttribute("id")||this._genStr(24)); |
|
647 | item["title"] = r.getAttribute("text")||""; |
|
648 | // images |
|
649 | item["imgen"] = r.getAttribute("img")||""; |
|
650 | item["imgdis"] = r.getAttribute("imgdis")||""; |
|
651 | item["tip"] = ""; |
|
652 | item["hotkey"] = ""; |
|
653 | // custom css |
|
654 | if (r.getAttribute("cssNormal") != null) { item["cssNormal"] = r.getAttribute("cssNormal"); } |
|
655 | // type |
|
656 | item["type"] = r.getAttribute("type")||"item"; |
|
657 | //#menu_checks:06062008{ |
|
658 | if (item["type"] == "checkbox") { |
|
659 | item["checked"] = (r.getAttribute("checked")!=null); |
|
660 | // set classname |
|
661 | item["imgen"] = "chbx_"+(item["checked"]?"1":"0"); |
|
662 | item["imgdis"] = item["imgen"]; |
|
663 | } |
|
664 | //#} |
|
665 | //#menu_radio:06062008{ |
|
666 | if (item["type"] == "radio") { |
|
667 | item["checked"] = (r.getAttribute("checked")!=null); |
|
668 | item["imgen"] = "rdbt_"+(item["checked"]?"1":"0"); |
|
669 | item["imgdis"] = item["imgen"]; |
|
670 | item["group"] = r.getAttribute("group")||this._genStr(24); |
|
671 | if (this.radio[item["group"]]==null) { this.radio[item["group"]] = new Array(); } |
|
672 | this.radio[item["group"]][this.radio[item["group"]].length] = item["id"]; |
|
673 | } |
|
674 | //#} |
|
675 | // enable/disable |
|
676 | item["state"] = (r.getAttribute("enabled")!=null||r.getAttribute("disabled")!=null?(r.getAttribute("enabled")=="false"||r.getAttribute("disabled")=="true"?"disabled":"enabled"):"enabled"); |
|
677 | item["parent"] = (parentId!=null?parentId:this.idPrefix+this.topId); |
|
678 | // item["complex"] = (((this.dLoad)&&(parentId!=null))?(r.getAttribute("complex")!=null?true:false):(this._buildMenu(r,item["id"])>0)); |
|
679 | item["complex"] = (this.dLoad?(r.getAttribute("complex")!=null?true:false):(this._buildMenu(r,item["id"])>0)); |
|
680 | if (this.dLoad && item["complex"]) { item["loaded"] = "no"; } |
|
681 | this.itemPull[item["id"]] = item; |
|
682 | // check for user data |
|
683 | for (var w=0; w<r.childNodes.length; w++) { |
|
684 | // added in 0.4 |
|
685 | var tagNm = r.childNodes[w].tagName; |
|
686 | if (tagNm != null) { tagNm = tagNm.toLowerCase(); } |
|
687 | // |
|
688 | if (tagNm == this.userDataTagName) { |
|
689 | var d = r.childNodes[w]; |
|
690 | if (d.getAttribute("name")!=null) { this.userData[item["id"]+"_"+d.getAttribute("name")] = (d.firstChild.nodeValue!=null?d.firstChild.nodeValue:""); } |
|
691 | } |
|
692 | // extended text, added in 0.4 |
|
693 | if (tagNm == this.itemTextTagName) { item["title"] = r.childNodes[w].firstChild.nodeValue; } |
|
694 | // tooltips, added in 0.4 |
|
695 | if (tagNm == this.itemTipTagName) { item["tip"] = r.childNodes[w].firstChild.nodeValue; } |
|
696 | // hotkeys, added in 0.4 |
|
697 | if (tagNm == this.itemHotKeyTagName) { item["hotkey"] = r.childNodes[w].firstChild.nodeValue; } |
|
698 | // hrefs |
|
699 | if (tagNm == this.itemHrefTagName && item["type"] == "item") { |
|
700 | item["href_link"] = r.childNodes[w].firstChild.nodeValue; |
|
701 | if (r.childNodes[w].getAttribute("target") != null) { item["href_target"] = r.childNodes[w].getAttribute("target"); } |
|
702 | } |
|
703 | } |
|
704 | u++; |
|
705 | } |
|
706 | } |
|
707 | return u; |
|
708 | } |
|
709 | /* parse incoming xml */ |
|
710 | this._xmlParser = function() { |
|
711 | if (main_self.dLoad) { |