dhtmlxmenu.js 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233
  1. // v.2.6 build 100722
  2. /*
  3. Copyright DHTMLX LTD. http : // www.dhtmlx.com
  4. You allowed to use this component or parts of it under GPL terms
  5. To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
  6. */
  7. /*
  8. * 设置HTML元素属性
  9. * @param object o 要设置属性的HTML元素
  10. * @param string a 要设置的属性名
  11. * @param string v 要设置的属性值
  12. */
  13. function setAttribute(o, a, v) {
  14. if (typeof o != 'object' || typeof a != 'string')
  15. return;
  16. a == 'class' ? o.className = v : o.setAttribute(a, v);
  17. }
  18. /*
  19. * 获取HTML元素属性值
  20. * @param object o 要获取属性的HTML元素
  21. * @param string a 要获取的属性名
  22. * @return 返回要获取的属性值
  23. */
  24. function getAttribute(o, a) {
  25. if (typeof o != 'object' || typeof a != 'string')
  26. return;
  27. return a == 'class' ? o.className : o.getAttribute(a);
  28. }
  29. /*
  30. * 移除HTML元素属性
  31. * @param object o 要移除属性的HTML元素
  32. * @param string a 要移除的属性名
  33. */
  34. function removeAttribute(o, a) {
  35. if (typeof o != 'object' || typeof a != 'string')
  36. return;
  37. o.removeAttribute(a);
  38. if (a == 'class')
  39. o.removeAttribute('className');
  40. }
  41. function dhtmlXMenuObject(baseId, skin) {
  42. var main_self = this;
  43. this.addBaseIdAsContextZone = null;
  44. this.isDhtmlxMenuObject = true;
  45. this.skin = (skin != null ? skin : "dhx_skyblue");
  46. this.imagePath = "";
  47. this._isIE6 = false;
  48. this.parentTitleObject = null;
  49. if (_isIE)
  50. this._isIE6 = (window.XMLHttpRequest == null ? true : false);
  51. if (baseId == null) {
  52. this.base = document.body;
  53. } else {
  54. if (document.getElementById(baseId) != null) {
  55. this.base = document.getElementById(baseId);
  56. while (this.base.childNodes.length > 0) {
  57. this.base.removeChild(this.base.childNodes[0]);
  58. };
  59. this.base.className += " dhtmlxMenu_" + this.skin + "_Middle dir_left";
  60. this.base._autoSkinUpdate = true;
  61. if (this.base.oncontextmenu)
  62. this.base._oldContextMenuHandler = this.base.oncontextmenu;
  63. this.addBaseIdAsContextZone = baseId;
  64. this.base.onselectstart = function (e) {
  65. e = e || event;
  66. e.returnValue = false;
  67. return false;
  68. };
  69. this.base.oncontextmenu = function (e) {
  70. e = e || event;
  71. e.returnValue = false;
  72. return false;
  73. }
  74. } else {
  75. this.base = document.body;
  76. }
  77. };
  78. this.topId = "dhxWebMenuTopId";
  79. if (!this.extendedModule) {
  80. var t = function () {
  81. alert(this.i18n.dhxmenuextalert);
  82. };
  83. var extMethods = new Array("setItemEnabled", "setItemDisabled", "isItemEnabled", "_changeItemState", "getItemText", "setItemText",
  84. "loadFromHTML", "hideItem", "showItem", "isItemHidden", "_changeItemVisible", "setUserData", "getUserData",
  85. "setOpenMode", "setWebModeTimeout", "enableDynamicLoading", "_updateLoaderIcon", "getItemImage", "setItemImage",
  86. "clearItemImage", "setAutoShowMode", "setAutoHideMode", "setContextMenuHideAllMode", "getContextMenuHideAllMode",
  87. "setVisibleArea", "setTooltip", "getTooltip", "setHotKey", "getHotKey", "setItemSelected", "setTopText", "setRTL",
  88. "setAlign", "setHref", "clearHref", "getCircuit", "_clearAllSelectedSubItemsInPolygon", "_checkArrowsState",
  89. "_addUpArrow", "_addDownArrow", "_removeUpArrow", "_removeDownArrow", "_isArrowExists", "_doScrollUp", "_doScrollDown",
  90. "_countPolygonItems", "setOverflowHeight", "_getRadioImgObj", "_setRadioState", "_radioOnClickHandler",
  91. "getRadioChecked", "setRadioChecked", "addRadioButton", "_getCheckboxState", "_setCheckboxState", "_readLevel",
  92. "_updateCheckboxImage", "_checkboxOnClickHandler", "setCheckboxState", "getCheckboxState", "addCheckbox", "serialize");
  93. for (var q = 0; q < extMethods.length; q++)
  94. if (!this[extMethods[q]])
  95. this[extMethods[q]] = t;
  96. extMethods = null;
  97. };
  98. this.fixedPosition = false;
  99. this.menuSelected = - 1;
  100. this.menuLastClicked = - 1;
  101. this.idPrefix = "";
  102. this.dqlm = "个人首页"; // 增加当前栏目纪录 By Rd 2015-11-06
  103. this.itemTagName = "item";
  104. this.itemTextTagName = "itemtext";
  105. this.userDataTagName = "userdata";
  106. this.itemTipTagName = "tooltip";
  107. this.itemHotKeyTagName = "hotkey";
  108. this.itemHrefTagName = "href";
  109. this.dirTopLevel = "bottom";
  110. this.dirSubLevel = "right";
  111. this.menuX1 = null;
  112. this.menuX2 = null;
  113. this.menuY1 = null;
  114. this.menuY2 = null;
  115. this.menuMode = "web";
  116. this.menuTimeoutMsec = 400;
  117. this.menuTimeoutHandler = null;
  118. this.idPull = {};
  119. this.itemPull = {};
  120. this.userData = {};
  121. this.radio = {};
  122. this._rtl = false;
  123. this._align = "left";
  124. this.menuTouched = false;
  125. this.zIndInit = 1200;
  126. this.zInd = this.zIndInit;
  127. this.zIndStep = 50;
  128. this.menuModeTopLevelTimeout = true;
  129. this.menuModeTopLevelTimeoutTime = 200;
  130. this._topLevelBottomMargin = 1;
  131. this._topLevelRightMargin = 0;
  132. this._topLevelOffsetLeft = 1;
  133. this._arrowFFFix = (_isIE ? (document.compatMode == "BackCompat" ? 0 : - 4) : - 4);
  134. this.setSkin = function (skin) {
  135. var oldSkin = this.skin;
  136. this.skin = skin;
  137. switch (this.skin) {
  138. case "dhx_black":
  139. case "dhx_blue":
  140. case "dhx_skyblue":
  141. case "dhx_web":
  142. this._topLevelBottomMargin = 2;
  143. this._topLevelRightMargin = 1;
  144. this._topLevelOffsetLeft = 1;
  145. this._arrowFFFix = (_isIE ? (document.compatMode == "BackCompat" ? 0 : - 4) : - 4);
  146. break;
  147. case "dhx_web":
  148. this._arrowFFFix = 0;
  149. break;
  150. };
  151. if (this.base._autoSkinUpdate) {
  152. this.base.className = this.base.className.replace("dhtmlxMenu_" + oldSkin + "_Middle", "") + " dhtmlxMenu_" + this.skin + "_Middle";
  153. };
  154. for (var a in this.idPull) {
  155. this.idPull[a].className = String(this.idPull[a].className).replace(oldSkin, this.skin);
  156. }
  157. };
  158. this.setSkin(this.skin);
  159. this.dLoad = false;
  160. this.dLoadUrl = "";
  161. this.dLoadSign = "?";
  162. this.loaderIcon = false;
  163. this.limit = 0;
  164. this._scrollUpTM = null;
  165. this._scrollUpTMTime = 20;
  166. this._scrollUpTMStep = 3;
  167. this._scrollDownTM = null;
  168. this._scrollDownTMTime = 20;
  169. this._scrollDownTMStep = 3;
  170. this.context = false;
  171. this.contextZones = {};
  172. this.contextMenuZoneId = false;
  173. this.contextAutoShow = true;
  174. this.contextAutoHide = true;
  175. this.contextHideAllMode = true;
  176. this.sxDacProc = null;
  177. this.dacSpeed = 10;
  178. this.dacCycles = [];
  179. for (var q = 0; q < 10; q++) {
  180. this.dacCycles[q] = q;
  181. };
  182. this.dacSpeedIE = 10;
  183. this.dacCyclesIE = [];
  184. for (var q = 0; q < 10; q++) {
  185. this.dacCyclesIE[q] = q;
  186. };
  187. this._enableDacSupport = function (dac) {
  188. this.sxDacProc = dac;
  189. };
  190. this._selectedSubItems = new Array();
  191. this._openedPolygons = new Array();
  192. this._addSubItemToSelected = function (item, polygon) {
  193. var t = true;
  194. for (var q = 0; q < this._selectedSubItems.length;
  195. q++) {
  196. if ((this._selectedSubItems[q][0] == item) && (this._selectedSubItems[q][1] == polygon)) {
  197. t = false;
  198. }
  199. };
  200. if (t == true) {
  201. this._selectedSubItems.push(new Array(item, polygon));
  202. };
  203. return t;
  204. };
  205. this._removeSubItemFromSelected = function (item, polygon) {
  206. var m = new Array();
  207. var t = false;
  208. for (var q = 0; q < this._selectedSubItems.length;
  209. q++) {
  210. if ((this._selectedSubItems[q][0] == item) && (this._selectedSubItems[q][1] == polygon)) {
  211. t = true;
  212. } else {
  213. m[m.length] = this._selectedSubItems[q];
  214. }
  215. };
  216. if (t == true) {
  217. this._selectedSubItems = m;
  218. };
  219. return t;
  220. };
  221. this._getSubItemToDeselectByPolygon = function (polygon) {
  222. var m = new Array();
  223. for (var q = 0; q < this._selectedSubItems.length;
  224. q++) {
  225. if (this._selectedSubItems[q][1] == polygon) {
  226. m[m.length] = this._selectedSubItems[q][0];
  227. m = m.concat(this._getSubItemToDeselectByPolygon(this._selectedSubItems[q][0]));
  228. var t = true;
  229. for (var w = 0; w < this._openedPolygons.length;
  230. w++) {
  231. if (this._openedPolygons[w] == this._selectedSubItems[q][0]) {
  232. t = false;
  233. }
  234. };
  235. if (t == true) {
  236. this._openedPolygons[this._openedPolygons.length] = this._selectedSubItems[q][0];
  237. };
  238. this._selectedSubItems[q][0] = - 1;
  239. this._selectedSubItems[q][1] = - 1;
  240. }
  241. };
  242. return m;
  243. };
  244. this._hidePolygon = function (id) {
  245. if (this.idPull["polygon_" + id] != null) {
  246. if ((this.sxDacProc != null) && (this.idPull["sxDac_" + id] != null)) {
  247. this.idPull["sxDac_" + id]._hide();
  248. } else {
  249. if (this.idPull["polygon_" + id].style.display == "none")
  250. return;
  251. this.idPull["polygon_" + id].style.display = "none";
  252. if (this.idPull["arrowup_" + id] != null) {
  253. this.idPull["arrowup_" + id].style.display = "none";
  254. };
  255. if (this.idPull["arrowdown_" + id] != null) {
  256. this.idPull["arrowdown_" + id].style.display = "none";
  257. };
  258. this._updateItemComplexState(id, true, false);
  259. if (this._isIE6) {
  260. if (this.idPull["polygon_" + id + "_ie6cover"] != null) {
  261. this.idPull["polygon_" + id + "_ie6cover"].style.display = "none";
  262. }
  263. };
  264. id = String(id).replace(this.idPrefix, "");
  265. if (id == this.topId)
  266. id = null;
  267. this.callEvent("onHide", [id]);
  268. }
  269. }
  270. };
  271. this._showPolygon = function (id, openType) {
  272. var itemCount = this._countVisiblePolygonItems(id);
  273. if (itemCount == 0)
  274. return;
  275. var pId = "polygon_" + id;
  276. if ((this.idPull[pId] != null) && (this.idPull[id] != null)) {
  277. if (this.menuModeTopLevelTimeout && this.menuMode == "web" && !this.context) {
  278. if (!this.idPull[id]._mouseOver && openType == this.dirTopLevel)
  279. return;
  280. };
  281. if (!this.fixedPosition)
  282. this._autoDetectVisibleArea();
  283. var arrUpH = 0;
  284. var arrDownH = 0;
  285. var arrowUp = null;
  286. var arrowDown = null;
  287. if (this.limit > 0 && this.limit < itemCount) {
  288. var auId = "arrowup_" + id;
  289. var adId = "arrowdown_" + id;
  290. if (this.idPull["arrowup_" + id] == null)
  291. this._addUpArrow(String(id).replace(this.idPrefix, ""));
  292. if (this.idPull["arrowdown_" + id] == null)
  293. this._addDownArrow(String(id).replace(this.idPrefix, ""));
  294. arrowUp = this.idPull["arrowup_" + id];
  295. arrowUp.style.visibility = "hidden";
  296. arrowUp.style.display = "";
  297. arrowUp.style.zIndex = this.zInd;
  298. arrUpH = arrowUp.offsetHeight;
  299. arrowDown = this.idPull["arrowdown_" + id];
  300. arrowDown.style.visibility = "hidden";
  301. arrowDown.style.display = "";
  302. arrowDown.style.zIndex = this.zInd;
  303. arrDownH = arrowDown.offsetHeight;
  304. };
  305. this.idPull[pId].style.visibility = "hidden";
  306. this.idPull[pId].style.left = "0px";
  307. this.idPull[pId].style.top = "0px";
  308. this.idPull[pId].style.display = "";
  309. this.idPull[pId].style.zIndex = this.zInd;
  310. if (this.limit > 0) {
  311. if (this.limit < itemCount) {
  312. this.idPull[pId].style.height = 24 * this.limit + "px";
  313. this.idPull[pId].scrollTop = 0;
  314. } else {
  315. this.idPull[pId].style.height = "";
  316. }
  317. };
  318. this.zInd += this.zIndStep;
  319. if (this.itemPull[id] != null) {
  320. var parPoly = "polygon_" + this.itemPull[id]["parent"];
  321. } else if (this.context) {
  322. var parPoly = this.idPull[this.idPrefix + this.topId];
  323. };
  324. var srcX = (this.idPull[id].tagName != null ? getAbsoluteLeft(this.idPull[id]) : this.idPull[id][0]);
  325. var srcY = (this.idPull[id].tagName != null ? getAbsoluteTop(this.idPull[id]) : this.idPull[id][1]);
  326. var srcW = (this.idPull[id].tagName != null ? this.idPull[id].offsetWidth : 0);
  327. var srcH = (this.idPull[id].tagName != null ? this.idPull[id].offsetHeight + arrUpH + arrDownH : 0);
  328. var x = 0;
  329. var y = 0;
  330. var w = this.idPull[pId].offsetWidth;
  331. var h = this.idPull[pId].offsetHeight;
  332. if (openType == "bottom") {
  333. if (this._rtl) {
  334. x = srcX + (srcW != null ? srcW : 0) - w;
  335. } else {
  336. if (this._align == "right") {
  337. x = srcX + srcW - w;
  338. } else {
  339. x = srcX - 1 + (openType == this.dirTopLevel ? this._topLevelRightMargin : 0);
  340. }
  341. };
  342. y = srcY - 1 + srcH - arrUpH - arrDownH + this._topLevelBottomMargin;
  343. };
  344. if (openType == "right") {
  345. x = srcX + srcW - 1;
  346. y = srcY + 2;
  347. };
  348. if (openType == "left") {
  349. x = srcX - this.idPull[pId].offsetWidth + 2;
  350. y = srcY + 2;
  351. };
  352. if (openType == "top") {
  353. x = srcX - 1;
  354. y = srcY - h + 2;
  355. };
  356. if (this.fixedPosition) {
  357. var mx = 65536;
  358. var my = 65536;
  359. } else {
  360. var mx = (this.menuX2 != null ? this.menuX2 : 0);
  361. var my = (this.menuY2 != null ? this.menuY2 : 0);
  362. if (mx == 0) {
  363. if (window.innerWidth) {
  364. mx = window.innerWidth;
  365. my = window.innerHeight;
  366. } else {
  367. mx = document.body.offsetWidth;
  368. my = document.body.scrollHeight;
  369. }
  370. }
  371. };
  372. if (x + w > mx && !this._rtl) {
  373. x = srcX - w + 2;
  374. };
  375. if (x < this.menuX1 && this._rtl) {
  376. x = srcX + srcW - 2;
  377. };
  378. if (x < 0) {
  379. x = 0;
  380. };
  381. if (y + h > my && this.menuY2 != null) {
  382. y = srcY + srcH - h + 2;
  383. if (this.itemPull[id] != null && !this.context) {
  384. if (this.itemPull[id]["parent"] == this.idPrefix + this.topId)
  385. y = y - this.base.offsetHeight;
  386. }
  387. };
  388. this.idPull[pId].style.left = x + "px";
  389. this.idPull[pId].style.top = y + arrUpH + "px";
  390. if ((this.sxDacProc != null) && (this.idPull["sxDac_" + id] != null)) {
  391. this.idPull["sxDac_" + id]._show();
  392. } else {
  393. this.idPull[pId].style.visibility = "";
  394. if (this.limit > 0 && this.limit < itemCount) {
  395. arrowUp.style.left = x + "px";
  396. arrowUp.style.top = y + "px";
  397. arrowUp.style.width = w + this._arrowFFFix + "px";
  398. arrowUp.style.visibility = "";
  399. arrowDown.style.left = x + "px";
  400. arrowDown.style.top = y + arrUpH + h + "px";
  401. arrowDown.style.width = w + this._arrowFFFix + "px";
  402. arrowDown.style.visibility = "";
  403. this._checkArrowsState(id);
  404. };
  405. /*2016-09-02 添加*/
  406. if (this.idPull[pId].offsetHeight > this._offset(this.idPull[id]).y) { //判断上面的空位是否足够不足则向下展开
  407. var h_ = this.idPull[id].offsetHeight;
  408. this.idPull[pId].style.top = this._offset(this.idPull[id]).y + h_ + 'px';
  409. }
  410. /*2016-09-02 添加*/
  411. if (this._isIE6) {
  412. var pIdIE6 = pId + "_ie6cover";
  413. if (this.idPull[pIdIE6] == null) {
  414. var ifr = document.createElement("IFRAME");
  415. ifr.className = "dhtmlxMenu_IE6CoverFix_" + this.skin;
  416. ifr.frameBorder = 0;
  417. ifr.setAttribute("src", "javascript:false;");
  418. document.body.insertBefore(ifr, document.body.firstChild);
  419. this.idPull[pIdIE6] = ifr;
  420. };
  421. this.idPull[pIdIE6].style.left = this.idPull[pId].style.left;
  422. this.idPull[pIdIE6].style.top = this.idPull[pId].style.top;
  423. this.idPull[pIdIE6].style.width = this.idPull[pId].offsetWidth + "px";
  424. this.idPull[pIdIE6].style.height = this.idPull[pId].offsetHeight + "px";
  425. this.idPull[pIdIE6].style.zIndex = this.idPull[pId].style.zIndex - 1;
  426. this.idPull[pIdIE6].style.display = "";
  427. };
  428. id = String(id).replace(this.idPrefix, "");
  429. if (id == this.topId)
  430. id = null;
  431. this.callEvent("onShow", [id]);
  432. }
  433. }
  434. };
  435. /*2016-09-02新增一个获取元素距离父元素的距离*/
  436. this._offset = function (element, parent) {
  437. var parent = parent || document;
  438. var element = element;
  439. var par = element.offsetParent;
  440. var Top = element.offsetTop,
  441. Left = element.offsetLeft;
  442. while (par != null) {
  443. if (par === parent)
  444. break
  445. Top += par.offsetTop;
  446. Left += par.offsetLeft;
  447. par = par.offsetParent;
  448. }
  449. return {
  450. x: Left,
  451. y: Top
  452. };
  453. };
  454. this._redistribSubLevelSelection = function (id, parentId) {
  455. while (this._openedPolygons.length > 0)
  456. this._openedPolygons.pop();
  457. var i = this._getSubItemToDeselectByPolygon(parentId);
  458. this._removeSubItemFromSelected( - 1, - 1);
  459. for (var q = 0; q < i.length; q++) {
  460. if ((this.idPull[i[q]] != null) && (i[q] != id)) {
  461. if (this.itemPull[i[q]]["state"] == "enabled") {
  462. this.idPull[i[q]].className = "menu-item";
  463. }
  464. }
  465. };
  466. for (var q = 0; q < this._openedPolygons.length;
  467. q++) {
  468. if (this._openedPolygons[q] != parentId) {
  469. this._hidePolygon(this._openedPolygons[q]);
  470. }
  471. };
  472. if (this.itemPull[id]["state"] == "enabled") {
  473. this.idPull[id].className = "menu-item";
  474. if (this.itemPull[id]["complex"] && this.dLoad && (this.itemPull[id]["loaded"] == "no")) {
  475. if (this.loaderIcon == true) {
  476. this._updateLoaderIcon(id, true);
  477. };
  478. var xmlLoader = new dtmlXMLLoaderObject(this._xmlParser, window);
  479. this.itemPull[id]["loaded"] = "get";
  480. this.callEvent("onXLS", []);
  481. xmlLoader.loadXML(this.dLoadUrl + this.dLoadSign + "action=loadMenu&parentId=" + id.replace(this.idPrefix, "") + "&etc=" + new Date().getTime());
  482. };
  483. if (this.itemPull[id]["complex"] || (this.dLoad && (this.itemPull[id]["loaded"] == "yes"))) {
  484. if ((this.itemPull[id]["complex"]) && (this.idPull["polygon_" + id] != null)) {
  485. this._updateItemComplexState(id, true, true);
  486. this._showPolygon(id, this.dirSubLevel);
  487. }
  488. };
  489. this._addSubItemToSelected(id, parentId);
  490. this.menuSelected = id;
  491. }
  492. };
  493. this.setParentTitleObject = function (str) {
  494. this.parentTitleObject = eval("([" + str + "])");
  495. };
  496. this.getcascadeTitle = function (id) {
  497. var objarr = this.parentTitleObject;
  498. var obj;
  499. var wzmc = "";
  500. for (var i = 0; i < objarr.length; i++) {
  501. obj = objarr[i];
  502. if (obj.wzid == id) {
  503. wzmc = obj.mc;
  504. }
  505. }
  506. if (wzmc == "") {
  507. //网站名称数据由菜单部件发布时查询yy表并生成到页面,出现该情况可以1.查看更新数据表数据 2.进入菜单部件所属页面重新发布 By Rd 2015-12-10
  508. wzmc = "未知";
  509. }
  510. return wzmc;
  511. };
  512. // this.getTargetNode = function (rootElement) {
  513. // if (document.getElementById("mbwzbj") == null) {
  514. // var currentNode = rootElement.childNodes;
  515. // for (var i = 0; i < currentNode.length; i++) {
  516. // if (currentNode[i].innerHTML == "个人首页") {
  517. // currentNode[i].setAttribute("id", "mbwzbj");
  518. // //console.info("目标文字部件设置id为mbwzbj");
  519. // //currentNode[i].setAttribute("style","position: absolute; top: 0px;");
  520. // currentNode[i].style.cssText = "position: absolute; top: 0px;";
  521. // return;
  522. // }
  523. // this.getTargetNode(currentNode[i]);
  524. // }
  525. // }
  526. // }
  527. this._doOnClick = function (id, type, casState) {
  528. this.menuLastClicked = id;
  529. //自定义getElementsByName
  530. // var getElementsByName = function (tag, name) {
  531. // var returns = document.getElementsByName(name);
  532. // if (returns.length > 0)
  533. // return returns;
  534. // returns = new Array();
  535. // var e = document.getElementsByTagName(tag);
  536. // for (var i = 0; i < e.length; i++) {
  537. // if (e[i].getAttribute("name") == name) {
  538. // returns[returns.length] = e[i];
  539. // }
  540. // }
  541. // return returns;
  542. // }
  543. //console.info('目标文字部件名称 :'+this.wzbjname);
  544. // var mbwzbj = getElementsByName("div", this.wzbjname)[0];
  545. //var mbwzbj=document.querySelector('wzbjname');
  546. // if (typeof(mbwzbj) != "undefined") {
  547. // console.info("文字部件 : 拿到目标部件");
  548. // this.getTargetNode(mbwzbj); //将真正包含文字的元素增加一个标识id"mbwzbj"
  549. // }
  550. var href_link=this.itemPull[this.idPrefix + id]["href_link"];
  551. if (href_link != null&&href_link != 'null') //增加值不等于'null'的判断 By Rd 2015-12-15
  552. {
  553. var A = document.createElement("A");
  554. A.href = String(this.itemPull[this.idPrefix + id]["href_link"]);
  555. if (this.itemPull[this.idPrefix + id]["href_target"] != null) {
  556. A.target = this.itemPull[this.idPrefix + id]["href_target"];
  557. };
  558. A.style.display = "none";
  559. document.body.appendChild(A);
  560. A.click();
  561. if (A != null) {
  562. document.body.removeChild(A);
  563. A = null;
  564. };
  565. //<<<<<<<<<<<<<<<<< 关于菜单修改(文字部件显示当期栏目,个人首页开启控制) By Rd 2015-12-10
  566. //console.info('当前栏目 :'+this.dqlm);
  567. var userEdit_exit = (typeof(wd.topWindow.gxhymWindow.userEdit) != "undefined") ? 1 : 0;
  568. var parentItemId;
  569. var parentWzMC;
  570. var parentLmMc = "";
  571. //console.info('userEdit是否存在 :'+userEdit_exit);
  572. if ((id == 'gxhEdit' || id == 'gfEdit') && userEdit_exit == 0) { //进入个人首页编辑要对当前栏目进行判断 by Rd 2015-11-06
  573. alert('进入个人首页下才能开启编辑功能');
  574. return;
  575. }
  576. //因为部分菜单item是通过弹窗打开,所以还要加一步控制
  577. if (id != 'gxhEdit' && id != 'gfEdit' && this.itemPull[this.idPrefix + id]["href_link"].indexOf('popupWindow') == -1) {
  578. //var bjsy = document.getElementById('i440163264').contentWindow.document.querySelector('.bjsy');
  579. //if(bjsy != null && (bjsy.style.display == '' || bjsy.style.display == 'inline'))
  580. // bjsy.style.display = 'none';
  581. if (wd.topWindow.userEditButton_personal) {
  582. wd.topWindow.userEditButton_personal.style.display = "none"
  583. }
  584. }
  585. if (id != 'gxhEdit' && id != 'gfEdit' && this.itemPull[this.idPrefix + id]["href_link"].indexOf('popupWindow') == -1) {
  586. // var bjsymb = document.getElementById('i440163264').contentWindow.document.querySelector('.bjsymb');
  587. // if(bjsymb != null && (bjsymb.style.display == '' || bjsymb.style.display == 'inline'))
  588. // bjsymb.style.display = 'none';
  589. if (wd.topWindow.userEditButton_official) {
  590. wd.topWindow.userEditButton_official.style.display = "none"
  591. }
  592. }
  593. if(href_link.indexOf("wd.base.win2FitHeight")!=-1){
  594. wd.display.setHomeIconName(this.itemPull[this.idPrefix + id]["title"]);
  595. }
  596. // //若为编辑菜单,则title不改变
  597. // if (document.getElementById("mbwzbj") != null) { //该文字部件可能不存在
  598. // if (id != "editMenu" && id != "editGfMenu") {
  599. // this.dqlm = this.itemPull[this.idPrefix + id]["title"]; //改变当前栏目 By Rd 2015-11-06
  600. // parentItemId = this.itemPull[this.idPrefix + id]["parent"];
  601. // var url = this.itemPull[this.idPrefix + id]["href_link"].split('.do?')[1];
  602. // if (url != undefined) {
  603. // var wzid = url.split('_')[0];
  604. // parentWzMC = this.getcascadeTitle(wzid);
  605. //
  606. // if (this.itemPull[parentItemId] != undefined) {
  607. // parentLmMc = this.itemPull[parentItemId]["title"];
  608. // }
  609. // //路径不显示应用名称
  610. // // document.getElementById("mbwzbj").innerHTML="/"+parentWzMC+"/"+(parentLmMc==""||parentLmMc==parentWzMC?"":parentLmMc+"/")+this.itemPull[this.idPrefix + id]["title"];
  611. // document.getElementById("mbwzbj").innerHTML = (parentLmMc == "" || parentLmMc == parentWzMC ? "" : parentLmMc + "/") + this.itemPull[this.idPrefix + id]["title"];
  612. // } else {
  613. // document.getElementById("mbwzbj").innerHTML = this.itemPull[this.idPrefix + id]["title"];
  614. //
  615. // }
  616. // }
  617. // }
  618. //>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  619. return;
  620. } else {
  621. //点击的是个人首页
  622. if (id == 'shortcutMenu') {
  623. // var bjsy = document.getElementById('i440163264').contentWindow.document.querySelector('.bjsy');
  624. // var bjsymb = document.getElementById('i440163264').contentWindow.document.querySelector('.bjsymb');
  625. // if(bjsy != null && (bjsy.style.display == '' || bjsy.style.display == 'none'))
  626. // bjsy.style.display = 'inline';
  627. // if(bjsymb != null && (bjsymb.style.display == '' || bjsymb.style.display == 'none'))
  628. // bjsymb.style.display = 'inline';
  629. if (wd.topWindow.userEditButton_official) {
  630. wd.topWindow.userEditButton_official.style.display = "none"
  631. }
  632. if (wd.topWindow.userEditButton_personal) {
  633. wd.topWindow.userEditButton_personal.style.display = "none"
  634. }
  635. }
  636. };
  637. if (type.charAt(0) == "c")
  638. return;
  639. if (type.charAt(1) == "d")
  640. return;
  641. if (type.charAt(2) == "s")
  642. return;
  643. if (this.checkEvent("onClick")) {
  644. this._clearAndHide();
  645. // if (document.getElementById("mbwzbj") != null) { //该文字部件可能不存在
  646. // this.dqlm = this.itemPull[this.idPrefix + id]["title"]; //改变当前栏目 By Rd 2015-11-06
  647. // document.getElementById("mbwzbj").innerHTML = this.itemPull[this.idPrefix + id]["title"]; //系统菜单下项目
  648. // }
  649. if (this._isContextMenuVisible() && this.contextAutoHide)
  650. this._hideContextMenu();
  651. this.callEvent("onClick", [id, this.contextMenuZoneId, casState]);
  652. } else {
  653. if ((type.charAt(1) == "d") || (this.menuMode == "win" && type.charAt(2) == "t"))
  654. return;
  655. this._clearAndHide();
  656. if (this._isContextMenuVisible() && this.contextAutoHide)
  657. this._hideContextMenu();
  658. }
  659. };
  660. this._doOnTouchMenu = function (id) {
  661. if (this.menuTouched == false) {
  662. this.menuTouched = true;
  663. if (this.checkEvent("onTouch")) {
  664. this.callEvent("onTouch", [id]);
  665. }
  666. }
  667. };
  668. this._searchMenuNode = function (node, menu) {
  669. var m = new Array();
  670. for (var q = 0; q < menu.length; q++) {
  671. if (typeof(menu[q]) == "object") {
  672. if (menu[q].length == 5) {
  673. if (typeof(menu[q][0]) != "object") {
  674. if ((menu[q][0].replace(this.idPrefix, "") == node) && (q == 0)) {
  675. m = menu;
  676. }
  677. }
  678. };
  679. var j = this._searchMenuNode(node, menu[q]);
  680. if (j.length > 0) {
  681. m = j;
  682. }
  683. }
  684. };
  685. return m;
  686. };
  687. this._getMenuNodes = function (node) {
  688. var m = new Array;
  689. for (var a in this.itemPull) {
  690. if (this.itemPull[a]["parent"] == node) {
  691. m[m.length] = a;
  692. }
  693. };
  694. return m;
  695. };
  696. this._genStr = function (w) {
  697. var s = "";
  698. var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  699. for (var q = 0; q < w; q++)
  700. s += z.charAt(Math.round(Math.random() * (z.length - 1)));
  701. return s;
  702. };
  703. this.getItemType = function (id) {
  704. id = this.idPrefix + id;
  705. if (this.itemPull[id] == null) {
  706. return null;
  707. };
  708. return this.itemPull[id]["type"];
  709. };
  710. this.forEachItem = function (handler) {
  711. for (var a in this.itemPull) {
  712. handler(String(a).replace(this.idPrefix, ""));
  713. }
  714. };
  715. this._clearAndHide = function () {
  716. main_self.menuSelected = - 1;
  717. main_self.menuLastClicked = - 1;
  718. while (main_self._openedPolygons.length > 0) {
  719. main_self._openedPolygons.pop();
  720. };
  721. for (var q = 0; q < main_self._selectedSubItems.length;
  722. q++) {
  723. var id = main_self._selectedSubItems[q][0];
  724. if (main_self.idPull[id] != null) {
  725. if (main_self.itemPull[id]["state"] == "enabled") {
  726. if (main_self.idPull[id].className == "menu-item")
  727. main_self.idPull[id].className = "menu-item";
  728. if (main_self.idPull[id].className == "dhtmlxMenu_" + main_self.skin + "_TopLevel_Item_Selected") {
  729. if (main_self.itemPull[id]["cssNormal"] != null) {
  730. main_self.idPull[id].className = main_self.itemPull[id]["cssNormal"];
  731. } else {
  732. main_self.idPull[id].className = "dhtmlxMenu_" + main_self.skin + "_TopLevel_Item_Normal";
  733. }
  734. }
  735. }
  736. };
  737. main_self._hidePolygon(id);
  738. };
  739. main_self.menuTouched = false;
  740. if (main_self.context) {
  741. if (main_self.contextHideAllMode) {
  742. main_self._hidePolygon(main_self.idPrefix + main_self.topId);
  743. main_self.zInd = main_self.zIndInit;
  744. } else {
  745. main_self.zInd = main_self.zIndInit + main_self.zIndStep;
  746. }
  747. }
  748. };
  749. this._doOnLoad = function () {};
  750. this.loadXML = function (xmlFile, onLoadFunction) {
  751. if (onLoadFunction)
  752. this._doOnLoad = function () {
  753. onLoadFunction();
  754. };
  755. this.callEvent("onXLS", []);
  756. this._xmlLoader.loadXML(xmlFile);
  757. };
  758. this.loadXMLString = function (xmlString, onLoadFunction) {
  759. if (onLoadFunction)
  760. this._doOnLoad = function () {
  761. onLoadFunction();
  762. };
  763. this._xmlLoader.loadXMLString(xmlString);
  764. };
  765. this._buildMenu = function (t, parentId) {
  766. var u = 0;
  767. for (var q = 0; q < t.childNodes.length; q++) {
  768. if (t.childNodes[q].tagName == this.itemTagName) {
  769. var r = t.childNodes[q];
  770. var item = {};
  771. item["id"] = this.idPrefix + (r.getAttribute("id") || this._genStr(24));
  772. item["title"] = r.getAttribute("text") || "";
  773. item["imgen"] = r.getAttribute("img") || "";
  774. item["imgdis"] = r.getAttribute("imgdis") || "";
  775. item["tip"] = "";
  776. item["hotkey"] = "";
  777. if (r.getAttribute("cssNormal") != null) {
  778. item["cssNormal"] = r.getAttribute("cssNormal");
  779. };
  780. item["type"] = r.getAttribute("type") || "item";
  781. if (item["type"] == "checkbox") {
  782. item["checked"] = (r.getAttribute("checked") != null);
  783. item["imgen"] = "chbx_" + (item["checked"] ? "1" : "0");
  784. item["imgdis"] = item["imgen"];
  785. };
  786. if (item["type"] == "radio") {
  787. item["checked"] = (r.getAttribute("checked") != null);
  788. item["imgen"] = "rdbt_" + (item["checked"] ? "1" : "0");
  789. item["imgdis"] = item["imgen"];
  790. item["group"] = r.getAttribute("group") || this._genStr(24);
  791. if (this.radio[item["group"]] == null) {
  792. this.radio[item["group"]] = new Array();
  793. };
  794. this.radio[item["group"]][this.radio[item["group"]].length] = item["id"];
  795. };
  796. item["state"] = (r.getAttribute("enabled") != null || r.getAttribute("disabled") != null ? (r.getAttribute("enabled") == "false" || r.getAttribute("disabled") == "true" ? "disabled" : "enabled") : "enabled");
  797. item["parent"] = (parentId != null ? parentId : this.idPrefix + this.topId);
  798. item["complex"] = (this.dLoad ? (r.getAttribute("complex") != null ? true : false) : (this._buildMenu(r, item["id"]) > 0));
  799. if (this.dLoad && item["complex"]) {
  800. item["loaded"] = "no";
  801. };
  802. this.itemPull[item["id"]] = item;
  803. for (var w = 0; w < r.childNodes.length; w++) {
  804. var tagNm = r.childNodes[w].tagName;
  805. if (tagNm != null) {
  806. tagNm = tagNm.toLowerCase();
  807. };
  808. if (tagNm == this.userDataTagName) {
  809. var d = r.childNodes[w];
  810. if (d.getAttribute("name") != null) {
  811. this.userData[item["id"] + "_" + d.getAttribute("name")] = (d.firstChild.nodeValue != null ? d.firstChild.nodeValue : "");
  812. }
  813. };
  814. if (tagNm == this.itemTextTagName) {
  815. item["title"] = r.childNodes[w].firstChild.nodeValue;
  816. };
  817. if (tagNm == this.itemTipTagName) {
  818. item["tip"] = r.childNodes[w].firstChild.nodeValue;
  819. };
  820. if (tagNm == this.itemHotKeyTagName) {
  821. item["hotkey"] = r.childNodes[w].firstChild.nodeValue;
  822. };
  823. if (tagNm == this.itemHrefTagName && item["type"] == "item") {
  824. item["href_link"] = r.childNodes[w].firstChild.nodeValue;
  825. if (r.childNodes[w].getAttribute("target") != null) {
  826. item["href_target"] = r.childNodes[w].getAttribute("target");
  827. }
  828. }
  829. };
  830. u++;
  831. }
  832. };
  833. return u;
  834. };
  835. this._xmlParser = function () {
  836. if (main_self.dLoad) {
  837. var t = this.getXMLTopNode("menu");
  838. parentId = (t.getAttribute("parentId") != null ? t.getAttribute("parentId") : null);
  839. if (parentId == null) {
  840. main_self._buildMenu(t, null);
  841. main_self._initTopLevelMenu();
  842. } else {
  843. main_self._buildMenu(t, main_self.idPrefix + parentId);
  844. main_self._addSubMenuPolygon(main_self.idPrefix + parentId, main_self.idPrefix + parentId);
  845. if (main_self.menuSelected == main_self.idPrefix + parentId) {
  846. var pId = main_self.idPrefix + parentId;
  847. var isTop = main_self.itemPull[main_self.idPrefix + parentId]["parent"] == main_self.idPrefix + main_self.topId;
  848. var level = ((isTop && (!main_self.context)) ? main_self.dirTopLevel : main_self.dirSubLevel);
  849. var isShow = false;
  850. if (isTop && main_self.menuModeTopLevelTimeout && main_self.menuMode == "web" && !main_self.context) {
  851. var item = main_self.idPull[main_self.idPrefix + parentId];
  852. if (item._mouseOver == true) {
  853. var delay = main_self.menuModeTopLevelTimeoutTime - (new Date().getTime() - item._dynLoadTM);
  854. if (delay > 1) {
  855. item._menuOpenTM = window.setTimeout(function () {
  856. main_self._showPolygon(pId, level);
  857. }, delay);
  858. isShow = true;
  859. }
  860. }
  861. };
  862. if (!isShow) {
  863. main_self._showPolygon(pId, level);
  864. }
  865. };
  866. main_self.itemPull[main_self.idPrefix + parentId]["loaded"] = "yes";
  867. if (main_self.loaderIcon == true) {
  868. main_self._updateLoaderIcon(main_self.idPrefix + parentId, false);
  869. }
  870. };
  871. this.destructor();
  872. main_self.callEvent("onXLE", []);
  873. } else {
  874. var t = this.getXMLTopNode("menu");
  875. main_self._buildMenu(t, null);
  876. main_self.init();
  877. main_self.callEvent("onXLE", []);
  878. main_self._doOnLoad();
  879. }
  880. };
  881. this._xmlLoader = new dtmlXMLLoaderObject(this._xmlParser, window);
  882. this._showSubLevelItem = function (id, back) {
  883. if (document.getElementById("arrow_" + this.idPrefix + id) != null) {
  884. document.getElementById("arrow_" + this.idPrefix + id).style.display = (back ? "none" : "");
  885. };
  886. if (document.getElementById("image_" + this.idPrefix + id) != null) {
  887. document.getElementById("image_" + this.idPrefix + id).style.display = (back ? "none" : "");
  888. };
  889. if (document.getElementById(this.idPrefix + id) != null) {
  890. document.getElementById(this.idPrefix + id).style.display = (back ? "" : "none");
  891. }
  892. };
  893. this._hideSubLevelItem = function (id) {
  894. this._showSubLevelItem(id, true)
  895. };
  896. this.idPrefix = this._genStr(12);
  897. this._bodyClick = function (e) {
  898. e = e || event;
  899. if (e.button == 2 || (_isOpera && e.ctrlKey == true))
  900. return;
  901. if (main_self.context) {
  902. if (main_self.contextAutoHide && (!_isOpera || (main_self._isContextMenuVisible() && _isOpera)))
  903. main_self._hideContextMenu();
  904. } else {
  905. main_self._clearAndHide();
  906. }
  907. };
  908. this._bodyContext = function (e) {
  909. e = e || event;
  910. var t = (e.srcElement || e.target).className;
  911. // console.info("dhtmlxmenu捕获classname :"+t);
  912. if (t.search("dhtmlxMenu") != - 1 && t.search("SubLevelArea") != - 1)
  913. return;
  914. var toHide = true;
  915. var testZone = e.target || e.srcElement;
  916. if (testZone.id != null)
  917. if (main_self.isContextZone(testZone.id))
  918. toHide = false;
  919. if (testZone == document.body)
  920. toHide = false;
  921. if (toHide)
  922. main_self.hideContextMenu();
  923. };
  924. if (_isIE) {
  925. document.body.attachEvent("onclick", this._bodyClick);
  926. document.body.attachEvent("oncontextmenu", this._bodyContext);
  927. } else {
  928. window.addEventListener("click", this._bodyClick, false);
  929. window.addEventListener("contextmenu", this._bodyContext, false);
  930. };
  931. this._UID = this._genStr(32);
  932. dhtmlxMenuObjectLiveInstances[this._UID] = this;
  933. dhtmlxEventable(this);
  934. return this;
  935. };
  936. dhtmlXMenuObject.prototype.init = function () {
  937. console.log("TTTTTTTTTTTT init");
  938. if (this._isInited == true)
  939. return;
  940. if (this.dLoad) {
  941. this.callEvent("onXLS", []);
  942. this._xmlLoader.loadXML(this.dLoadUrl + this.dLoadSign + "action=loadMenu&etc=" + new Date().getTime());
  943. } else {
  944. this._initTopLevelMenu();
  945. this._isInited = true;
  946. }
  947. };
  948. dhtmlXMenuObject.prototype._countVisiblePolygonItems = function (id) {
  949. var count = 0;
  950. for (var a in this.itemPull) {
  951. var par = this.itemPull[a]["parent"];
  952. var tp = this.itemPull[a]["type"];
  953. if (this.idPull[a] != null) {
  954. if (par == id && (tp == "item" || tp == "radio" || tp == "checkbox") && this.idPull[a].style.display != "none") {
  955. count++;
  956. }
  957. }
  958. };
  959. return count;
  960. };
  961. dhtmlXMenuObject.prototype._redefineComplexState = function (id) {
  962. if (this.idPrefix + this.topId == id) {
  963. return;
  964. };
  965. if ((this.idPull["polygon_" + id] != null) && (this.idPull[id] != null)) {
  966. var u = this._countVisiblePolygonItems(id);
  967. if ((u > 0) && (!this.itemPull[id]["complex"])) {
  968. this._updateItemComplexState(id, true, false);
  969. };
  970. if ((u == 0) && (this.itemPull[id]["complex"])) {
  971. this._updateItemComplexState(id, false, false);
  972. }
  973. }
  974. };
  975. dhtmlXMenuObject.prototype._updateItemComplexState = function (id, state, over) {
  976. if ((!this.context) && (this._getItemLevelType(id.replace(this.idPrefix, "")) == "TopLevel")) {
  977. this.itemPull[id]["complex"] = state;
  978. return;
  979. };
  980. if ((this.idPull[id] == null) || (this.itemPull[id] == null)) {
  981. return;
  982. };
  983. this.itemPull[id]["complex"] = state;
  984. if (id == this.idPrefix + this.topId)
  985. return;
  986. var arrowObj = null;
  987. var item = this.idPull[id].childNodes[this._rtl ? 0 : 2];
  988. if (item.childNodes[0])
  989. if (String(item.childNodes[0].className).search("complex_arrow") === 0)
  990. arrowObj = item.childNodes[0];
  991. if (this.itemPull[id]["complex"]) {
  992. if (arrowObj == null) {
  993. arrowObj = document.createElement("DIV");
  994. arrowObj.className = "complex_arrow";
  995. arrowObj.id = "arrow_" + id;
  996. while (item.childNodes.length > 0)
  997. item.removeChild(item.childNodes[0]);
  998. item.appendChild(arrowObj);
  999. };
  1000. if (this.dLoad && (this.itemPull[id]["loaded"] == "get") && this.loaderIcon) {
  1001. if (arrowObj.className != "complex_arrow_loading")
  1002. arrowObj.className = "complex_arrow_loading";
  1003. } else {
  1004. arrowObj.className = "complex_arrow";
  1005. };
  1006. return;
  1007. };
  1008. if ((!this.itemPull[id]["complex"]) && (arrowObj != null)) {
  1009. item.removeChild(arrowObj);
  1010. if (this.itemPull[id]["hotkey_backup"] != null && this.setHotKey) {
  1011. this.setHotKey(id.replace(this.idPrefix, ""), this.itemPull[id]["hotkey_backup"]);
  1012. }
  1013. }
  1014. };
  1015. dhtmlXMenuObject.prototype._getItemLevelType = function (id) {
  1016. return (this.itemPull[this.idPrefix + id]["parent"] == this.idPrefix + this.topId ? "TopLevel" : "SubLevelArea");
  1017. };
  1018. dhtmlXMenuObject.prototype._redistribTopLevelSelection = function (id, parent) {
  1019. var i = this._getSubItemToDeselectByPolygon("parent");
  1020. this._removeSubItemFromSelected( - 1, - 1);
  1021. for (var q = 0; q < i.length; q++) {
  1022. if (i[q] != id) {
  1023. this._hidePolygon(i[q]);
  1024. };
  1025. if ((this.idPull[i[q]] != null) && (i[q] != id)) {
  1026. this.idPull[i[q]].className = this.idPull[i[q]].className.replace(/Selected/g, "Normal");
  1027. }
  1028. };
  1029. if (this.itemPull[this.idPrefix + id]["state"] == "enabled") {
  1030. this.idPull[this.idPrefix + id].className = "dhtmlxMenu_" + this.skin + "_TopLevel_Item_Selected";
  1031. this._addSubItemToSelected(this.idPrefix + id, "parent");
  1032. this.menuSelected = (this.menuMode == "win" ? (this.menuSelected != - 1 ? id : this.menuSelected) : id);
  1033. if ((this.itemPull[this.idPrefix + id]["complex"]) && (this.menuSelected != - 1)) {
  1034. this._showPolygon(this.idPrefix + id, this.dirTopLevel);
  1035. }
  1036. }
  1037. };
  1038. dhtmlXMenuObject.prototype._initTopLevelMenu = function () {
  1039. this.dirTopLevel = "bottom";
  1040. this.dirSubLevel = (this._rtl ? "left" : "right");
  1041. if (this.context) {
  1042. this.idPull[this.idPrefix + this.topId] = new Array(0, 0);
  1043. this._addSubMenuPolygon(this.idPrefix + this.topId, this.idPrefix + this.topId);
  1044. } else {
  1045. var m = this._getMenuNodes(this.idPrefix + this.topId);
  1046. console.log("TTTTTTTT _initTopLevelMenu"+ m +"("+ m.length +")");
  1047. for (var q = 0; q < m.length; q++) {
  1048. if (this.itemPull[m[q]]["type"] == "item")
  1049. this._renderToplevelItem(m[q], null);
  1050. if (this.itemPull[m[q]]["type"] == "separator")
  1051. this._renderSeparator(m[q], null);
  1052. }
  1053. }
  1054. };
  1055. dhtmlXMenuObject.prototype._renderToplevelItem = function (id, pos) {
  1056. var main_self = this;
  1057. var m = document.createElement("DIV");
  1058. m.id = id;
  1059. if (this.itemPull[id]["state"] == "enabled" && this.itemPull[id]["cssNormal"] != null) {
  1060. // m.className = this.itemPull[id]["cssNormal"];
  1061. m.className = "dhtmlxMenu_" + this.skin + "_TopLevel_Item_" + "Normal";
  1062. m.className += " menu-group";
  1063. } else {
  1064. // m.className = "dhtmlxMenu_" + this.skin + "_TopLevel_Item_" + (this.itemPull[id]["state"] == "enabled" ? "Normal" : "Disabled");
  1065. m.className = "dhtmlxMenu_" + this.skin + "_TopLevel_Item_" + "Normal";
  1066. m.className += " menu-group";
  1067. // m.className
  1068. };
  1069. if (this.itemPull[id]["title"] != "") {
  1070. var t1 = document.createElement("DIV");
  1071. t1.className = "top_level_text";
  1072. var title = this.itemPull[id]["title"];
  1073. if ("系统" == title && id == this.idPrefix + (window.menuRootName?window.menuRootName:"env")) {
  1074. t1.className += " system_menu cursor-click";
  1075. t1.style.backgroundImage = "url(" + (((MenuSetting) || {}).imagePath + 'logo/invertLogo.png') + ")";
  1076. t1.style.backgroundPosition = "center";
  1077. m.className += " menu-vLine cursor-click";
  1078. // m.className -= "menu-group";
  1079. m.className = m.className.replace( new RegExp( "(\\s|^)" + "menu-group" + "(\\s|$)" )," ");
  1080. m.style.float = "left";
  1081. m.style.width = "69px";
  1082. m.style.height = "70px";
  1083. m.style.padding = "0px";
  1084. m.style.verticalAlign = "middle";
  1085. m.style.marginLeft = "0px";
  1086. m.style.marginRight = "0px";
  1087. m.style.marginTop = "-35px";
  1088. m.style.background = "none";
  1089. m.style.fontSize = "0px";
  1090. }
  1091. t1.innerHTML = title;
  1092. m.appendChild(t1);
  1093. };
  1094. if (this.itemPull[id]["tip"].length > 0)
  1095. m.title = this.itemPull[id]["tip"];
  1096. if ((this.itemPull[id]["imgen"] != "") || (this.itemPull[id]["imgdis"] != "")) {
  1097. var imgTop = this.itemPull[id][(this.itemPull[id]["state"] == "enabled") ? "imgen" : "imgdis"];
  1098. if (imgTop) {
  1099. var img = document.createElement("IMG");
  1100. img.border = "0";
  1101. img.id = "image_" + id;
  1102. img.src = this.imagePath + imgTop;
  1103. img.className = "dhtmlxMenu_TopLevel_Item_Icon";
  1104. if (m.childNodes.length > 0 && !this._rtl)
  1105. m.insertBefore(img, m.childNodes[0]);
  1106. else
  1107. m.appendChild(img);
  1108. }
  1109. };
  1110. m.onselectstart = function (e) {
  1111. e = e || event;
  1112. e.returnValue = false;
  1113. return false;
  1114. };
  1115. m.oncontextmenu = function (e) {
  1116. e = e || event;
  1117. e.returnValue = false;
  1118. return false;
  1119. };
  1120. if (!this.cont) {
  1121. this.cont = document.createElement("DIV");
  1122. this.cont.dir = "ltr";
  1123. this.cont.className = (this._align == "right" ? "align_right" : "align_left");
  1124. this.base.appendChild(this.cont);
  1125. };
  1126. if (pos != null) {
  1127. pos++;
  1128. if (pos < 0)
  1129. pos = 0;
  1130. if (pos > this.cont.childNodes.length - 1)
  1131. pos = null;
  1132. };
  1133. if (pos != null)
  1134. this.cont.insertBefore(m, this.cont.childNodes[pos]);
  1135. else
  1136. this.cont.appendChild(m);
  1137. this.idPull[m.id] = m;
  1138. if (this.itemPull[id]["complex"] && (!this.dLoad))
  1139. this._addSubMenuPolygon(this.itemPull[id]["id"], this.itemPull[id]["id"]);
  1140. m.onmouseover = function () {
  1141. if (main_self.menuMode == "web") {
  1142. window.clearTimeout(main_self.menuTimeoutHandler);
  1143. };
  1144. var i = main_self._getSubItemToDeselectByPolygon("parent");
  1145. main_self._removeSubItemFromSelected( - 1, - 1);
  1146. for (var q = 0; q < i.length; q++) {
  1147. if (i[q] != this.id) {
  1148. main_self._hidePolygon(i[q]);
  1149. };
  1150. if ((main_self.idPull[i[q]] != null) && (i[q] != this.id)) {
  1151. if (main_self.itemPull[i[q]]["cssNormal"] != null) {
  1152. main_self.idPull[i[q]].className = main_self.itemPull[i[q]]["cssNormal"];
  1153. } else {
  1154. if (main_self.idPull[i[q]].className == "menu-item")
  1155. main_self.idPull[i[q]].className = "menu-item";
  1156. // main_self.idPull[i[q]].className = main_self.idPull[i[q]].className.replace(/Selected/g, "Normal");
  1157. }
  1158. }
  1159. };
  1160. if (main_self.itemPull[this.id]["state"] == "enabled") {
  1161. // this.className = "dhtmlxMenu_" + main_self.skin + "_TopLevel_Item_Selected";
  1162. main_self._addSubItemToSelected(this.id, "parent");
  1163. main_self.menuSelected = (main_self.menuMode == "win" ? (main_self.menuSelected != - 1 ? this.id : main_self.menuSelected) : this.id);
  1164. if (main_self.dLoad && (main_self.itemPull[this.id]["loaded"] == "no")) {
  1165. if (main_self.menuModeTopLevelTimeout && main_self.menuMode == "web" && !main_self.context) {
  1166. this._mouseOver = true;
  1167. this._dynLoadTM = new Date().getTime();
  1168. };
  1169. var xmlLoader = new dtmlXMLLoaderObject(main_self._xmlParser, window);
  1170. main_self.itemPull[this.id]["loaded"] = "get";
  1171. main_self.callEvent("onXLS", []);
  1172. xmlLoader.loadXML(main_self.dLoadUrl + main_self.dLoadSign + "action=loadMenu&parentId=" + this.id.replace(main_self.idPrefix, "") + "&etc=" + new Date().getTime());
  1173. };
  1174. if ((!main_self.dLoad) || (main_self.dLoad && (main_self.itemPull[this.id]["loaded"] == "yes"))) {
  1175. if ((main_self.itemPull[this.id]["complex"]) && (main_self.menuSelected != - 1)) {
  1176. if (main_self.menuModeTopLevelTimeout && main_self.menuMode == "web" && !main_self.context) {
  1177. this._mouseOver = true;
  1178. var showItemId = this.id;
  1179. this._menuOpenTM = window.setTimeout(function () {
  1180. main_self._showPolygon(showItemId, main_self.dirTopLevel);
  1181. }, main_self.menuModeTopLevelTimeoutTime);
  1182. } else {
  1183. main_self._showPolygon(this.id, main_self.dirTopLevel);
  1184. }
  1185. }
  1186. }
  1187. };
  1188. main_self._doOnTouchMenu(this.id.replace(main_self.idPrefix, ""));
  1189. };
  1190. m.onmouseout = function () {
  1191. if (!((main_self.itemPull[this.id]["complex"]) && (main_self.menuSelected != - 1)) && (main_self.itemPull[this.id]["state"] == "enabled")) {
  1192. if (main_self.itemPull[this.id]["cssNormal"] != null) {
  1193. // m.className = main_self.itemPull[this.id]["cssNormal"];
  1194. } else {
  1195. // m.className = "dhtmlxMenu_" + main_self.skin + "_TopLevel_Item_Normal";
  1196. }
  1197. };
  1198. if (main_self.menuMode == "web") {
  1199. window.clearTimeout(main_self.menuTimeoutHandler);
  1200. main_self.menuTimeoutHandler = window.setTimeout(function () {
  1201. main_self._clearAndHide();
  1202. }, main_self.menuTimeoutMsec, "JavaScript");
  1203. };
  1204. if (main_self.menuModeTopLevelTimeout && main_self.menuMode == "web" && !main_self.context) {
  1205. this._mouseOver = false;
  1206. window.clearTimeout(this._menuOpenTM);
  1207. }
  1208. };
  1209. m.onclick = function (e) {
  1210. if (main_self.menuMode == "web") {
  1211. window.clearTimeout(main_self.menuTimeoutHandler);
  1212. };
  1213. if (main_self.menuMode != "web" && main_self.itemPull[this.id]["state"] == "disabled") {
  1214. return;
  1215. };
  1216. e = e || event;
  1217. e.cancelBubble = true;
  1218. e.returnValue = false;
  1219. if (main_self.menuMode == "win") {
  1220. if (main_self.itemPull[this.id]["complex"]) {
  1221. if (main_self.menuSelected == this.id) {
  1222. main_self.menuSelected = - 1;
  1223. var s = false;
  1224. } else {
  1225. main_self.menuSelected = this.id;
  1226. var s = true;
  1227. };
  1228. if (s) {
  1229. main_self._showPolygon(this.id, main_self.dirTopLevel);
  1230. } else {
  1231. main_self._hidePolygon(this.id);
  1232. }
  1233. }
  1234. };
  1235. var tc = (main_self.itemPull[this.id]["complex"] ? "c" : "-");
  1236. var td = (main_self.itemPull[this.id]["state"] != "enabled" ? "d" : "-");
  1237. var cas = {
  1238. "ctrl": e.ctrlKey,
  1239. "alt": e.altKey,
  1240. "shift": e.shiftKey
  1241. };
  1242. main_self._doOnClick(this.id.replace(main_self.idPrefix, ""), tc + td + "t", cas);
  1243. return false;
  1244. }
  1245. };
  1246. dhtmlXMenuObject.prototype.setImagePath = function () {};
  1247. dhtmlXMenuObject.prototype.setIconsPath = function (path) {
  1248. this.imagePath = path;
  1249. };
  1250. dhtmlXMenuObject.prototype.setIconPath = dhtmlXMenuObject.prototype.setIconsPath;
  1251. dhtmlXMenuObject.prototype._updateItemImage = function (id, levelType) {
  1252. id = this.idPrefix + id;
  1253. var isTopLevel = (this.itemPull[id]["parent"] == this.idPrefix + this.topId && !this.context);
  1254. var imgObj = null;
  1255. if (isTopLevel) {
  1256. for (var q = 0; q < this.idPull[id].childNodes.length;
  1257. q++) {
  1258. try {
  1259. if (this.idPull[id].childNodes[q].className == "dhtmlxMenu_TopLevel_Item_Icon")
  1260. imgObj = this.idPull[id].childNodes[q];
  1261. } catch (e) {}
  1262. }
  1263. } else {
  1264. try {
  1265. var imgObj = this.idPull[id].childNodes[this._rtl ? 2 : 0].childNodes[0];
  1266. } catch (e) {}
  1267. };
  1268. if (this.itemPull[id]["type"] == "radio") {
  1269. var imgSrc = this.itemPull[id][(this.itemPull[id]["state"] == "enabled" ? "imgen" : "imgdis")];
  1270. } else {
  1271. var imgSrc = this.itemPull[id][(this.itemPull[id]["state"] == "enabled" ? "imgen" : "imgdis")];
  1272. };
  1273. if (imgSrc.length > 0) {
  1274. if (imgObj != null) {
  1275. imgObj.src = this.imagePath + imgSrc;
  1276. } else {
  1277. if (isTopLevel) {
  1278. var imgObj = document.createElement("IMG");
  1279. imgObj.className = "dhtmlxMenu_TopLevel_Item_Icon";
  1280. imgObj.src = this.imagePath + imgSrc;
  1281. imgObj.border = "0";
  1282. imgObj.id = "image_" + id;
  1283. if (!this._rtl && this.idPull[id].childNodes.length > 0)
  1284. this.idPull[id].insertBefore(imgObj, this.idPull[id].childNodes[0]);
  1285. else
  1286. this.idPull[id].appendChild(imgObj);
  1287. } else {
  1288. var imgObj = document.createElement("IMG");
  1289. imgObj.className = "sub_icon";
  1290. imgObj.src = this.imagePath + imgSrc;
  1291. imgObj.border = "0";
  1292. imgObj.id = "image_" + id;
  1293. var item = this.idPull[id].childNodes[this._rtl ? 2 : 0];
  1294. while (item.childNodes.length > 0)
  1295. item.removeChild(item.childNodes[0]);
  1296. item.appendChild(imgObj);
  1297. }
  1298. }
  1299. } else {
  1300. if (imgObj != null)
  1301. imgObj.parentNode.removeChild(imgObj);
  1302. }
  1303. };
  1304. dhtmlXMenuObject.prototype.removeItem = function (id, _isTId, _recCall) {
  1305. if (!_isTId)
  1306. id = this.idPrefix + id;
  1307. var pId = null;
  1308. if (id != this.idPrefix + this.topId) {
  1309. if (this.itemPull[id] == null)
  1310. return;
  1311. var t = this.itemPull[id]["type"];
  1312. if (t == "separator") {
  1313. var item = this.idPull["separator_" + id];
  1314. if (this.itemPull[id]["parent"] == this.idPrefix + this.topId) {
  1315. item.onclick = null;
  1316. item.onselectstart = null;
  1317. item.id = null;
  1318. item.parentNode.removeChild(item);
  1319. } else {
  1320. item.childNodes[0].childNodes[0].onclick = null;
  1321. item.childNodes[0].childNodes[0].onselectstart = null;
  1322. item.childNodes[0].childNodes[0].id = null;
  1323. item.childNodes[0].removeChild(item.childNodes[0].childNodes[0]);
  1324. item.removeChild(item.childNodes[0]);
  1325. item.parentNode.removeChild(item);
  1326. };
  1327. this.idPull["separator_" + id] = null;
  1328. this.itemPull[id] = null;
  1329. delete this.idPull["separator_" + id];
  1330. delete this.itemPull[id];
  1331. item = null;
  1332. } else {
  1333. pId = this.itemPull[id]["parent"];
  1334. var item = this.idPull[id];
  1335. item.onclick = null;
  1336. item.oncontextmenu = null;
  1337. item.onmouseover = null;
  1338. item.onmouseout = null;
  1339. item.onselectstart = null;
  1340. item.id = null;
  1341. while (item.childNodes.length > 0)
  1342. item.removeChild(item.childNodes[0]);
  1343. item.parentNode.removeChild(item);
  1344. this.idPull[id] = null;
  1345. this.itemPull[id] = null;
  1346. delete this.idPull[id];
  1347. delete this.itemPull[id];
  1348. item = null;
  1349. };
  1350. t = null;
  1351. };
  1352. for (var a in this.itemPull)
  1353. if (this.itemPull[a]["parent"] == id)
  1354. this.removeItem(a, true, true);
  1355. var p2 = new Array(id);
  1356. if (pId != null && !_recCall) {
  1357. if (this.idPull["polygon_" + pId] != null) {
  1358. if (this.idPull["polygon_" + pId].tbd.childNodes.length == 0) {
  1359. p2.push(pId);
  1360. this._updateItemComplexState(pId, false, false);
  1361. }
  1362. }
  1363. };
  1364. for (var q = 0; q < p2.length; q++) {
  1365. if (this.idPull["polygon_" + p2[q]]) {
  1366. var p = this.idPull["polygon_" + p2[q]];
  1367. p.onclick = null;
  1368. p.oncontextmenu = null;
  1369. p.tbl.removeChild(p.tbd);
  1370. p.tbd = null;
  1371. p.removeChild(p.tbl);
  1372. p.tbl = null;
  1373. p.id = null;
  1374. p.parentNode.removeChild(p);
  1375. p = null;
  1376. if (this._isIE6) {
  1377. var pc = "polygon_" + p2[q] + "_ie6cover";
  1378. if (this.idPull[pc] != null) {
  1379. document.body.removeChild(this.idPull[pc]);
  1380. delete this.idPull[pc];
  1381. }
  1382. };
  1383. if (this.idPull["arrowup_" + id] != null && this._removeArrow)
  1384. this._removeArrow("arrowup_" + id);
  1385. if (this.idPull["arrowdown_" + id] != null && this._removeArrow)
  1386. this._removeArrow("arrowdown_" + id);
  1387. this.idPull["polygon_" + p2[q]] = null;
  1388. delete this.idPull["polygon_" + p2[q]];
  1389. }
  1390. };
  1391. p2 = null;
  1392. };
  1393. dhtmlXMenuObject.prototype._getAllParents = function (id) {
  1394. var parents = new Array();
  1395. for (var a in this.itemPull) {
  1396. if (this.itemPull[a]["parent"] == id) {
  1397. parents[parents.length] = this.itemPull[a]["id"];
  1398. if (this.itemPull[a]["complex"]) {
  1399. var t = this._getAllParents(this.itemPull[a]["id"]);
  1400. for (var q = 0; q < t.length; q++) {
  1401. parents[parents.length] = t[q];
  1402. }
  1403. }
  1404. }
  1405. };
  1406. return parents;
  1407. };
  1408. dhtmlXMenuObject.prototype.renderAsContextMenu = function () {
  1409. this.context = true;
  1410. if (this.base._autoSkinUpdate == true) {
  1411. this.base.className = this.base.className.replace("dhtmlxMenu_" + this.skin + "_Middle", "");
  1412. this.base._autoSkinUpdate = false;
  1413. };
  1414. if (this.addBaseIdAsContextZone != null) {
  1415. this.addContextZone(this.addBaseIdAsContextZone);
  1416. }
  1417. };
  1418. dhtmlXMenuObject.prototype.addContextZone = function (zoneId) {
  1419. if (zoneId == document.body) {
  1420. zoneId = "document.body." + this.idPrefix;
  1421. var zone = document.body;
  1422. } else {
  1423. var zone = document.getElementById(zoneId);
  1424. };
  1425. var zoneExists = false;
  1426. for (var a in this.contextZones) {
  1427. zoneExists = zoneExists || (a == zoneId) || (this.contextZones[a] == zone);
  1428. };
  1429. if (zoneExists == true)
  1430. return false;
  1431. this.contextZones[zoneId] = zone;
  1432. var main_self = this;
  1433. if (_isOpera) {
  1434. this.operaContext = function (e) {
  1435. main_self._doOnContextMenuOpera(e, main_self);
  1436. };
  1437. zone.addEventListener("mouseup", this.operaContext, false);
  1438. } else {
  1439. if (zone.oncontextmenu != null && !zone._oldContextMenuHandler)
  1440. zone._oldContextMenuHandler = zone.oncontextmenu;
  1441. zone.oncontextmenu = function (e) {
  1442. for (var q in dhtmlxMenuObjectLiveInstances) {
  1443. if (q != main_self._UID) {
  1444. if (dhtmlxMenuObjectLiveInstances[q].context) {
  1445. dhtmlxMenuObjectLiveInstances[q]._hideContextMenu();
  1446. }
  1447. }
  1448. };
  1449. e = e || event;
  1450. e.cancelBubble = true;
  1451. e.returnValue = false;
  1452. main_self._doOnContextBeforeCall(e, this);
  1453. return false;
  1454. }
  1455. }
  1456. };
  1457. dhtmlXMenuObject.prototype._doOnContextMenuOpera = function (e, main_self) {
  1458. for (var q in dhtmlxMenuObjectLiveInstances) {
  1459. if (q != main_self._UID) {
  1460. if (dhtmlxMenuObjectLiveInstances[q].context) {
  1461. dhtmlxMenuObjectLiveInstances[q]._hideContextMenu();
  1462. }
  1463. }
  1464. };
  1465. e.cancelBubble = true;
  1466. e.returnValue = false;
  1467. if (e.button == 0 && e.ctrlKey == true) {
  1468. main_self._doOnContextBeforeCall(e, this);
  1469. };
  1470. return false;
  1471. };
  1472. dhtmlXMenuObject.prototype.removeContextZone = function (zoneId) {
  1473. if (!this.isContextZone(zoneId))
  1474. return false;
  1475. if (zoneId == document.body)
  1476. zoneId = "document.body." + this.idPrefix;
  1477. var zone = this.contextZones[zoneId];
  1478. if (_isOpera) {
  1479. zone.removeEventListener("mouseup", this.operaContext, false);
  1480. } else {
  1481. zone.oncontextmenu = (zone._oldContextMenuHandler != null ? zone._oldContextMenuHandler : null);
  1482. zone._oldContextMenuHandler = null;
  1483. };
  1484. try {
  1485. this.contextZones[zoneId] = null;
  1486. delete this.contextZones[zoneId];
  1487. } catch (e) {};
  1488. return true;
  1489. };
  1490. dhtmlXMenuObject.prototype.isContextZone = function (zoneId) {
  1491. if (zoneId == document.body && this.contextZones["document.body." + this.idPrefix] != null)
  1492. return true;
  1493. var isZone = false;
  1494. if (this.contextZones[zoneId] != null) {
  1495. if (this.contextZones[zoneId] == document.getElementById(zoneId))
  1496. isZone = true;
  1497. };
  1498. return isZone;
  1499. };
  1500. dhtmlXMenuObject.prototype._isContextMenuVisible = function () {
  1501. if (this.idPull["polygon_" + this.idPrefix + this.topId] == null)
  1502. return false;
  1503. return (this.idPull["polygon_" + this.idPrefix + this.topId].style.display == "");
  1504. };
  1505. dhtmlXMenuObject.prototype._showContextMenu = function (x, y, zoneId) {
  1506. this._clearAndHide();
  1507. if (this.idPull["polygon_" + this.idPrefix + this.topId] == null)
  1508. return false;
  1509. window.clearTimeout(this.menuTimeoutHandler);
  1510. this.idPull[this.idPrefix + this.topId] = new Array(x, y);
  1511. this._showPolygon(this.idPrefix + this.topId, "bottom");
  1512. this.callEvent("onContextMenu", [zoneId]);
  1513. };
  1514. dhtmlXMenuObject.prototype._hideContextMenu = function () {
  1515. if (this.idPull["polygon_" + this.idPrefix + this.topId] == null)
  1516. return false;
  1517. this._clearAndHide();
  1518. this._hidePolygon(this.idPrefix + this.topId);
  1519. this.zInd = this.zIndInit;
  1520. };
  1521. dhtmlXMenuObject.prototype._doOnContextBeforeCall = function (e, cZone) {
  1522. this.contextMenuZoneId = cZone.id;
  1523. this._clearAndHide();
  1524. this._hideContextMenu();
  1525. var p = (e.srcElement || e.target);
  1526. var px = (_isIE || _isOpera || _KHTMLrv ? e.offsetX : e.layerX);
  1527. var py = (_isIE || _isOpera || _KHTMLrv ? e.offsetY : e.layerY);
  1528. var mx = getAbsoluteLeft(p) + px;
  1529. var my = getAbsoluteTop(p) + py;
  1530. if (this.checkEvent("onBeforeContextMenu")) {
  1531. if (this.callEvent("onBeforeContextMenu", [cZone.id])) {
  1532. if (this.contextAutoShow) {
  1533. this._showContextMenu(mx, my);
  1534. this.callEvent("onAfterContextMenu", [cZone.id]);
  1535. }
  1536. }
  1537. } else {
  1538. if (this.contextAutoShow) {
  1539. this._showContextMenu(mx, my);
  1540. this.callEvent("onAfterContextMenu", [cZone.id]);
  1541. }
  1542. }
  1543. };
  1544. dhtmlXMenuObject.prototype.showContextMenu = function (x, y) {
  1545. this._showContextMenu(x, y, false);
  1546. };
  1547. dhtmlXMenuObject.prototype.hideContextMenu = function () {
  1548. this._hideContextMenu();
  1549. };
  1550. dhtmlXMenuObject.prototype._autoDetectVisibleArea = function () {
  1551. if (this._isVisibleArea)
  1552. return;
  1553. this.menuX1 = document.body.scrollLeft;
  1554. this.menuX2 = this.menuX1 + (window.innerWidth || document.body.clientWidth);
  1555. this.menuY1 = Math.max((_isIE ? document.documentElement : document.getElementsByTagName("html")[0]).scrollTop, document.body.scrollTop);
  1556. this.menuY2 = this.menuY1 + (_isIE ? Math.max(document.documentElement.clientHeight || 0, document.documentElement.offsetHeight || 0, document.body.clientHeight || 0) : window.innerHeight);
  1557. };
  1558. dhtmlXMenuObject.prototype.getItemPosition = function (id) {
  1559. id = this.idPrefix + id;
  1560. var pos = - 1;
  1561. if (this.itemPull[id] == null)
  1562. return pos;
  1563. var parent = this.itemPull[id]["parent"];
  1564. var obj = (this.idPull["polygon_" + parent] != null ? this.idPull["polygon_" + parent].tbd : this.cont);
  1565. for (var q = 0; q < obj.childNodes.length; q++) {
  1566. if (obj.childNodes[q] == this.idPull["separator_" + id] || obj.childNodes[q] == this.idPull[id]) {
  1567. pos = q;
  1568. }
  1569. };
  1570. return pos;
  1571. };
  1572. dhtmlXMenuObject.prototype.setItemPosition = function (id, pos) {
  1573. id = this.idPrefix + id;
  1574. if (this.idPull[id] == null) {
  1575. return;
  1576. };
  1577. var isOnTopLevel = (this.itemPull[id]["parent"] == this.idPrefix + this.topId);
  1578. var itemData = this.idPull[id];
  1579. var itemPos = this.getItemPosition(id.replace(this.idPrefix, ""));
  1580. var parent = this.itemPull[id]["parent"];
  1581. var obj = (this.idPull["polygon_" + parent] != null ? this.idPull["polygon_" + parent].tbd : this.cont);
  1582. obj.removeChild(obj.childNodes[itemPos]);
  1583. if (pos < 0)
  1584. pos = 0;
  1585. if (isOnTopLevel && pos < 1) {
  1586. pos = 1;
  1587. };
  1588. if (pos < obj.childNodes.length) {
  1589. obj.insertBefore(itemData, obj.childNodes[pos]);
  1590. } else {
  1591. obj.appendChild(itemData);
  1592. }
  1593. };
  1594. dhtmlXMenuObject.prototype.getParentId = function (id) {
  1595. id = this.idPrefix + id;
  1596. if (this.itemPull[id] == null) {
  1597. return null;
  1598. };
  1599. return ((this.itemPull[id]["parent"] != null ? this.itemPull[id]["parent"] : this.topId).replace(this.idPrefix, ""));
  1600. };
  1601. dhtmlXMenuObject.prototype.addNewSibling = function (nextToId, itemId, itemText, disabled, imgEnabled, imgDisabled) {
  1602. var id = this.idPrefix + (itemId != null ? itemId : this._genStr(24));
  1603. var parentId = this.idPrefix + (nextToId != null ? this.getParentId(nextToId) : this.topId);
  1604. this._addItemIntoGlobalStrorage(id, parentId, itemText, "item", disabled, imgEnabled, imgDisabled);
  1605. if ((parentId == this.idPrefix + this.topId) && (!this.context)) {
  1606. this._renderToplevelItem(id, this.getItemPosition(nextToId));
  1607. } else {
  1608. this._renderSublevelItem(id, this.getItemPosition(nextToId));
  1609. }
  1610. };
  1611. dhtmlXMenuObject.prototype.addNewChild = function (parentId, pos, itemId, itemText, disabled, imgEnabled, imgDisabled) {
  1612. if (parentId == null) {
  1613. if (this.context) {
  1614. parentId = this.topId;
  1615. } else {
  1616. this.addNewSibling(parentId, itemId, itemText, disabled, imgEnabled, imgDisabled);
  1617. if (pos != null)
  1618. this.setItemPosition(itemId, pos);
  1619. return;
  1620. }
  1621. };
  1622. itemId = this.idPrefix + (itemId != null ? itemId : this._genStr(24));
  1623. if (this.setHotKey)
  1624. this.setHotKey(parentId, "");
  1625. parentId = this.idPrefix + parentId;
  1626. this._addItemIntoGlobalStrorage(itemId, parentId, itemText, "item", disabled, imgEnabled, imgDisabled);
  1627. if (this.idPull["polygon_" + parentId] == null) {
  1628. this._renderSublevelPolygon(parentId, parentId);
  1629. };
  1630. this._renderSublevelItem(itemId, pos - 1);
  1631. this._redefineComplexState(parentId);
  1632. };
  1633. dhtmlXMenuObject.prototype.setWzBjName = function (wzbjname) { // 传入文字部件(已关联菜单部件)名称方法实现 by Rd 2015-11-06
  1634. this.wzbjname = wzbjname;
  1635. }
  1636. dhtmlXMenuObject.prototype._addItemIntoGlobalStrorage = function (itemId, itemParentId, itemText, itemType, disabled, img, imgDis) {
  1637. var item = {
  1638. id: itemId,
  1639. title: itemText,
  1640. imgen: (img != null ? img : ""),
  1641. imgdis: (imgDis != null ? imgDis : ""),
  1642. type: itemType,
  1643. state: (disabled == true ? "disabled" : "enabled"),
  1644. parent: itemParentId,
  1645. complex: false,
  1646. hotkey: "",
  1647. tip: ""
  1648. };
  1649. this.itemPull[item.id] = item;
  1650. };
  1651. dhtmlXMenuObject.prototype._addSubMenuPolygon = function (id, parentId) {
  1652. var s = this._renderSublevelPolygon(id, parentId);
  1653. var j = this._getMenuNodes(parentId);
  1654. for (q = 0; q < j.length; q++) {
  1655. if (this.itemPull[j[q]]["type"] == "separator") {
  1656. this._renderSeparator(j[q], null);
  1657. } else {
  1658. this._renderSublevelItem(j[q], null);
  1659. }
  1660. };
  1661. if (id == parentId) {
  1662. var level = "topLevel";
  1663. } else {
  1664. var level = "subLevel";
  1665. };
  1666. for (var q = 0; q < j.length; q++) {
  1667. if (this.itemPull[j[q]]["complex"]) {
  1668. this._addSubMenuPolygon(id, this.itemPull[j[q]]["id"]);
  1669. }
  1670. }
  1671. };
  1672. dhtmlXMenuObject.prototype._renderSublevelPolygon = function (id, parentId) {
  1673. var s = document.createElement("DIV");
  1674. // s.className = "dhtmlxMenu_" + this.skin + "_SubLevelArea_Polygon " + (this._rtl ? "dir_right" : "");
  1675. s.className = "menu-div";
  1676. s.dir = "ltr";
  1677. s.oncontextmenu = function (e) {
  1678. e = e || event;
  1679. e.returnValue = false;
  1680. e.cancelBubble = true;
  1681. return false;
  1682. };
  1683. s.id = "polygon_" + parentId;
  1684. s.onclick = function (e) {
  1685. e = e || event;
  1686. e.cancelBubble = true;
  1687. };
  1688. s.style.display = "none";
  1689. document.body.insertBefore(s, document.body.firstChild);
  1690. var tbl = document.createElement("TABLE");
  1691. // tbl.className = "dhtmlxMebu_SubLevelArea_Tbl";
  1692. tbl.cellSpacing = 0;
  1693. tbl.cellPadding = 0;
  1694. tbl.border = 0;
  1695. var tbd = document.createElement("TBODY");
  1696. tbl.appendChild(tbd);
  1697. s.appendChild(tbl);
  1698. s.tbl = tbl;
  1699. s.tbd = tbd;
  1700. this.idPull[s.id] = s;
  1701. if (this.sxDacProc != null) {
  1702. this.idPull["sxDac_" + parentId] = new this.sxDacProc(s, s.className);
  1703. if (_isIE) {
  1704. this.idPull["sxDac_" + parentId]._setSpeed(this.dacSpeedIE);
  1705. this.idPull["sxDac_" + parentId]._setCustomCycle(this.dacCyclesIE);
  1706. } else {
  1707. this.idPull["sxDac_" + parentId]._setSpeed(this.dacSpeed);
  1708. this.idPull["sxDac_" + parentId]._setCustomCycle(this.dacCycles);
  1709. }
  1710. };
  1711. return s;
  1712. };
  1713. dhtmlXMenuObject.prototype._renderSublevelItem = function (id, pos) {
  1714. var main_self = this;
  1715. var tr = document.createElement("TR");
  1716. tr.className = (this.itemPull[id]["state"] == "enabled" ? "menu-item" : "sub_item_dis");
  1717. var t1 = document.createElement("TD");
  1718. t1.className = "sub_item_icon";
  1719. t1.style.verticalAlign = "middle";
  1720. t1.style.width = "0px";
  1721. t1.style.paddingLeft = "5px";
  1722. var icon = this.itemPull[id][(this.itemPull[id]["state"] == "enabled" ? "imgen" : "imgdis")];
  1723. if (icon != "") {
  1724. var tp = this.itemPull[id]["type"];
  1725. if (tp == "checkbox" || tp == "radio") {
  1726. var img = document.createElement("DIV");
  1727. img.id = "image_" + this.itemPull[id]["id"];
  1728. img.className = "sub_icon " + icon;
  1729. t1.appendChild(img);
  1730. };
  1731. if (!(tp == "checkbox" || tp == "radio")) {
  1732. var img = document.createElement("IMG");
  1733. img.style.display = "inline-block";
  1734. img.style.width = "15px";
  1735. img.style.marginRight = "5px";
  1736. img.id = "image_" + this.itemPull[id]["id"];
  1737. img.className = "sub_icon";
  1738. img.src = this.imagePath + icon;
  1739. t1.appendChild(img);
  1740. }
  1741. };
  1742. var t2 = document.createElement("TD");
  1743. t2.style.verticalAlign = "middle";
  1744. t2.className = "sub_item_text";
  1745. if (this.itemPull[id]["title"] != "") {
  1746. var t2t = document.createElement("DIV");
  1747. t2t.className = "sub_item_text";
  1748. t2t.style.paddingRight = "15px";
  1749. t2t.innerHTML = this.itemPull[id]["title"];
  1750. t2.appendChild(t2t);
  1751. } else {
  1752. t2.innerHTML = "&nbsp;";
  1753. };
  1754. var t3 = document.createElement("TD");
  1755. t3.className = "sub_item_hk";
  1756. if (this.itemPull[id]["complex"]) {
  1757. var arw = document.createElement("DIV");
  1758. arw.className = "complex_arrow";
  1759. arw.id = "arrow_" + this.itemPull[id]["id"];
  1760. t3.appendChild(arw);
  1761. } else {
  1762. if (this.itemPull[id]["hotkey"].length > 0 && !this.itemPull[id]["complex"]) {
  1763. var t3t = document.createElement("DIV");
  1764. t3t.className = "sub_item_hk";
  1765. t3t.innerHTML = this.itemPull[id]["hotkey"];
  1766. t3.appendChild(t3t);
  1767. } else {
  1768. t3.innerHTML = "&nbsp;";
  1769. }
  1770. };
  1771. tr.appendChild(this._rtl ? t3 : t1);
  1772. tr.appendChild(t2);
  1773. // tr.appendChild(this._rtl ? t1 : t3);
  1774. tr.id = this.itemPull[id]["id"];
  1775. tr.parent = this.itemPull[id]["parent"];
  1776. if (this.itemPull[id]["tip"].length > 0)
  1777. tr.title = this.itemPull[id]["tip"];
  1778. tr.onselectstart = function (e) {
  1779. e = e || event;
  1780. e.returnValue = false;
  1781. return false;
  1782. };
  1783. tr.onmouseover = function () {
  1784. if (main_self.menuMode == "web")
  1785. window.clearTimeout(main_self.menuTimeoutHandler);
  1786. main_self._redistribSubLevelSelection(this.id, this.parent);
  1787. };
  1788. if (main_self.menuMode == "web") {
  1789. tr.onmouseout = function () {
  1790. window.clearTimeout(main_self.menuTimeoutHandler);
  1791. main_self.menuTimeoutHandler = window.setTimeout(function () {
  1792. main_self._clearAndHide();
  1793. }, main_self.menuTimeoutMsec, "JavaScript");
  1794. }
  1795. };
  1796. tr.onclick = function (e) {
  1797. if (!main_self.checkEvent("onClick") && main_self.itemPull[this.id]["complex"])
  1798. return;
  1799. e = e || event;
  1800. e.cancelBubble = true;
  1801. e.returnValue = false;
  1802. tc = (main_self.itemPull[this.id]["complex"] ? "c" : "-");
  1803. td = (main_self.itemPull[this.id]["state"] == "enabled" ? "-" : "d");
  1804. var cas = {
  1805. "ctrl": e.ctrlKey,
  1806. "alt": e.altKey,
  1807. "shift": e.shiftKey
  1808. };
  1809. switch (main_self.itemPull[this.id]["type"]) {
  1810. case "checkbox":
  1811. main_self._checkboxOnClickHandler(this.id.replace(main_self.idPrefix, ""), tc + td + "n", cas);
  1812. break;
  1813. case "radio":
  1814. main_self._radioOnClickHandler(this.id.replace(main_self.idPrefix, ""), tc + td + "n", cas);
  1815. break;
  1816. case "item":
  1817. main_self._doOnClick(this.id.replace(main_self.idPrefix, ""), tc + td + "n", cas);
  1818. break;
  1819. };
  1820. return false;
  1821. };
  1822. var polygon = this.idPull["polygon_" + this.itemPull[id]["parent"]];
  1823. if (pos != null) {
  1824. pos++;
  1825. if (pos < 0)
  1826. pos = 0;
  1827. if (pos > polygon.tbd.childNodes.length - 1)
  1828. pos = null;
  1829. };
  1830. if (pos != null && polygon.tbd.childNodes[pos] != null)
  1831. polygon.tbd.insertBefore(tr, polygon.tbd.childNodes[pos]);
  1832. else
  1833. polygon.tbd.appendChild(tr);
  1834. this.idPull[tr.id] = tr;
  1835. };
  1836. dhtmlXMenuObject.prototype._renderSeparator = function (id, pos) {
  1837. var level = (this.context ? "SubLevelArea" : (this.itemPull[id]["parent"] == this.idPrefix + this.topId ? "TopLevel" : "SubLevelArea"));
  1838. if (level == "TopLevel" && this.context)
  1839. return;
  1840. var main_self = this;
  1841. if (level != "TopLevel") {
  1842. var tr = document.createElement("TR");
  1843. tr.className = "sub_sep";
  1844. var td = document.createElement("TD");
  1845. td.colSpan = "3";
  1846. tr.appendChild(td);
  1847. };
  1848. var k = document.createElement("DIV");
  1849. k.id = "separator_" + id;
  1850. k.className = (level == "TopLevel" ? "top_sep" : "sub_sep");
  1851. k.onselectstart = function (e) {
  1852. e = e || event;
  1853. e.returnValue = false;
  1854. };
  1855. k.onclick = function (e) {
  1856. e = e || event;
  1857. e.cancelBubble = true;
  1858. var cas = {
  1859. "ctrl": e.ctrlKey,
  1860. "alt": e.altKey,
  1861. "shift": e.shiftKey
  1862. };
  1863. main_self._doOnClick(this.id.replace("separator_" + main_self.idPrefix, ""), "--s", cas);
  1864. };
  1865. if (level == "TopLevel") {
  1866. if (pos != null) {
  1867. pos++;
  1868. if (pos < 0) {
  1869. pos = 0;
  1870. };
  1871. if (this.cont.childNodes[pos] != null) {
  1872. this.cont.insertBefore(k, this.cont.childNodes[pos]);
  1873. } else {
  1874. this.cont.appendChild(k);
  1875. }
  1876. } else {
  1877. var last = this.cont.childNodes[this.cont.childNodes.length - 1];
  1878. if (String(last).search("TopLevel_Text") == - 1) {
  1879. this.cont.appendChild(k);
  1880. } else {
  1881. this.cont.insertBefore(k, last);
  1882. }
  1883. };
  1884. this.idPull[k.id] = k;
  1885. } else {
  1886. var polygon = this.idPull["polygon_" + this.itemPull[id]["parent"]];
  1887. if (pos != null) {
  1888. pos++;
  1889. if (pos < 0)
  1890. pos = 0;
  1891. if (pos > polygon.tbd.childNodes.length - 1)
  1892. pos = null;
  1893. };
  1894. if (pos != null && polygon.tbd.childNodes[pos] != null)
  1895. polygon.tbd.insertBefore(tr, polygon.tbd.childNodes[pos]);
  1896. else
  1897. polygon.tbd.appendChild(tr);
  1898. td.appendChild(k);
  1899. this.idPull[k.id] = tr;
  1900. }
  1901. };
  1902. dhtmlXMenuObject.prototype.addNewSeparator = function (nextToId, itemId) {
  1903. itemId = this.idPrefix + (itemId != null ? itemId : this._genStr(24));
  1904. var parentId = this.idPrefix + this.getParentId(nextToId);
  1905. this._addItemIntoGlobalStrorage(itemId, parentId, "", "separator", false, "", "");
  1906. this._renderSeparator(itemId, this.getItemPosition(nextToId));
  1907. };
  1908. dhtmlXMenuObject.prototype.hide = function () {
  1909. this._clearAndHide();
  1910. };
  1911. dhtmlXMenuObject.prototype.clearAll = function () {
  1912. this.removeItem(this.idPrefix + this.topId, true);
  1913. this._isInited = false;
  1914. this.idPrefix = this._genStr(12);
  1915. };
  1916. dhtmlXMenuObject.prototype.unload = function () {
  1917. if (_isIE) {
  1918. document.body.detachEvent("onclick", this._bodyClick);
  1919. document.body.detachEvent("oncontextmenu", this._bodyContext);
  1920. } else {
  1921. window.removeEventListener("click", this._bodyClick, false);
  1922. window.removeEventListener("contextmenu", this._bodyContext, false);
  1923. };
  1924. this._bodyClick = null;
  1925. this._bodyContext = null;
  1926. this.removeItem(this.idPrefix + this.topId, true);
  1927. this.itemPull = null;
  1928. this.idPull = null;
  1929. if (this.context)
  1930. for (var a in this.contextZones)
  1931. this.removeContextZone(a);
  1932. if (this.cont != null) {
  1933. this.cont.className = "";
  1934. this.cont.parentNode.removeChild(this.cont);
  1935. this.cont = null;
  1936. };
  1937. if (this.base != null) {
  1938. this.base.className = "";
  1939. if (!this.context)
  1940. this.base.oncontextmenu = (this.base._oldContextMenuHandler || null);
  1941. this.base.onselectstart = null;
  1942. this.base = null;
  1943. };
  1944. this.setSkin = null;
  1945. this.detachAllEvents();
  1946. if (this._xmlLoader) {
  1947. this._xmlLoader.destructor();
  1948. this._xmlLoader = null;
  1949. };
  1950. this._align = null;
  1951. this._arrowFFFix = null;
  1952. this._isIE6 = null;
  1953. this._isInited = null;
  1954. this._rtl = null;
  1955. this._scrollDownTMStep = null;
  1956. this._scrollDownTMTime = null;
  1957. this._scrollUpTMStep = null;
  1958. this._scrollUpTMTime = null;
  1959. this._topLevelBottomMargin = null;
  1960. this._topLevelOffsetLeft = null;
  1961. this._topLevelBottomMargin = null;
  1962. this._topLevelRightMargin = null;
  1963. this.addBaseIdAsContextZone = null;
  1964. this.context = null;
  1965. this.contextAutoHide = null;
  1966. this.contextAutoShow = null;
  1967. this.contextHideAllMode = null;
  1968. this.contextMenuZoneId = null;
  1969. this.dLoad = null;
  1970. this.dLoadSign = null;
  1971. this.dLoadUrl = null;
  1972. this.loaderIcon = null;
  1973. this.fixedPosition = null;
  1974. this.dirSubLevel = null;
  1975. this.dirTopLevel = null;
  1976. this.limit = null;
  1977. this.menuSelected = null;
  1978. this.menuLastClicked = null;
  1979. this.idPrefix = null;
  1980. this.imagePath = null;
  1981. this.menuMode = null;
  1982. this.menuModeTopLevelTimeout = null;
  1983. this.menuModeTopLevelTimeoutTime = null;
  1984. this.menuTimeoutHandler = null;
  1985. this.menuTimeoutMsec = null;
  1986. this.menuTouched = null;
  1987. this.isDhtmlxMenuObject = null;
  1988. this.itemHotKeyTagName = null;
  1989. this.itemHrefTagName = null;
  1990. this.itemTagName = null;
  1991. this.itemTextTagName = null;
  1992. this.itemTipTagName = null;
  1993. this.userDataTagName = null;
  1994. this.skin = null;
  1995. this.topId = null;
  1996. this.dacCycles = null;
  1997. this.dacCyclesIE = null;
  1998. this.dacSpeed = null;
  1999. this.dacSpeedIE = null;
  2000. this.zInd = null;
  2001. this.zIndInit = null;
  2002. this.zIndStep = null;
  2003. this._enableDacSupport = null;
  2004. this._selectedSubItems = null;
  2005. this._openedPolygons = null;
  2006. this._addSubItemToSelected = null;
  2007. this._removeSubItemFromSelected = null;
  2008. this._getSubItemToDeselectByPolygon = null;
  2009. this._hidePolygon = null;
  2010. this._showPolygon = null;
  2011. this._redistribSubLevelSelection = null;
  2012. this._doOnClick = null;
  2013. this._doOnTouchMenu = null;
  2014. this._searchMenuNode = null;
  2015. this._getMenuNodes = null;
  2016. this._genStr = null;
  2017. this._clearAndHide = null;
  2018. this._doOnLoad = null;
  2019. this.getItemType = null;
  2020. this.forEachItem = null;
  2021. this.init = null;
  2022. this.loadXML = null;
  2023. this.loadXMLString = null;
  2024. this._buildMenu = null;
  2025. this._xmlParser = null;
  2026. this._showSubLevelItem = null;
  2027. this._hideSubLevelItem = null;
  2028. this._countVisiblePolygonItems = null;
  2029. this._redefineComplexState = null;
  2030. this._updateItemComplexState = null;
  2031. this._getItemLevelType = null;
  2032. this._redistribTopLevelSelection = null;
  2033. this._initTopLevelMenu = null;
  2034. this._renderToplevelItem = null;
  2035. this.setImagePath = null;
  2036. this.setIconsPath = null;
  2037. this.setIconPath = null;
  2038. this._updateItemImage = null;
  2039. this.removeItem = null;
  2040. this._getAllParents = null;
  2041. this.renderAsContextMenu = null;
  2042. this.addContextZone = null;
  2043. this.removeContextZone = null;
  2044. this.isContextZone = null;
  2045. this._isContextMenuVisible = null;
  2046. this._showContextMenu = null;
  2047. this._doOnContextBeforeCall = null;
  2048. this._autoDetectVisibleArea = null;
  2049. this._addItemIntoGlobalStrorage = null;
  2050. this._addSubMenuPolygon = null;
  2051. this._renderSublevelPolygon = null;
  2052. this._renderSublevelItem = null;
  2053. this._renderSeparator = null;
  2054. this._hideContextMenu = null;
  2055. this.clearAll = null;
  2056. this.getItemPosition = null;
  2057. this.setItemPosition = null;
  2058. this.setWzBjName = null; // test传入参数方法 by Rd 2015-11-06
  2059. this.getParentId = null;
  2060. this.addNewSibling = null;
  2061. this.addNewChild = null;
  2062. this.addNewSeparator = null;
  2063. this.attachEvent = null;
  2064. this.callEvent = null;
  2065. this.checkEvent = null;
  2066. this.eventCatcher = null;
  2067. this.detachEvent = null;
  2068. this.dhx_Event = null;
  2069. this.unload = null;
  2070. this.items = null;
  2071. this.radio = null;
  2072. this.detachAllEvents = null;
  2073. this.hide = null;
  2074. this.showContextMenu = null;
  2075. this.hideContextMenu = null;
  2076. this._changeItemState = null;
  2077. this._changeItemVisible = null;
  2078. this._updateLoaderIcon = null;
  2079. this._clearAllSelectedSubItemsInPolygon = null;
  2080. this._checkArrowsState = null;
  2081. this._addUpArrow = null;
  2082. this._addDownArrow = null;
  2083. this._removeUpArrow = null;
  2084. this._removeDownArrow = null;
  2085. this._isArrowExists = null;
  2086. this._doScrollUp = null;
  2087. this._doScrollDown = null;
  2088. this._countPolygonItems = null;
  2089. this._getRadioImgObj = null;
  2090. this._setRadioState = null;
  2091. this._radioOnClickHandler = null;
  2092. this._getCheckboxState = null;
  2093. this._setCheckboxState = null;
  2094. this._readLevel = null;
  2095. this._updateCheckboxImage = null;
  2096. this._checkboxOnClickHandler = null;
  2097. this._removeArrow = null;
  2098. this.setItemEnabled = null;
  2099. this.setItemDisabled = null;
  2100. this.isItemEnabled = null;
  2101. this.getItemText = null;
  2102. this.setItemText = null;
  2103. this.loadFromHTML = null;
  2104. this.hideItem = null;
  2105. this.showItem = null;
  2106. this.isItemHidden = null;
  2107. this.setUserData = null;
  2108. this.getUserData = null;
  2109. this.setOpenMode = null;
  2110. this.setWebModeTimeout = null;
  2111. this.enableDynamicLoading = null;
  2112. this.getItemImage = null;
  2113. this.setItemImage = null;
  2114. this.clearItemImage = null;
  2115. this.setAutoShowMode = null;
  2116. this.setAutoHideMode = null;
  2117. this.setContextMenuHideAllMode = null;
  2118. this.getContextMenuHideAllMode = null;
  2119. this.setVisibleArea = null;
  2120. this.setTooltip = null;
  2121. this.getTooltip = null;
  2122. this.setHotKey = null;
  2123. this.getHotKey = null;
  2124. this.setItemSelected = null;
  2125. this.setTopText = null;
  2126. this.setRTL = null;
  2127. this.setAlign = null;
  2128. this.setHref = null;
  2129. this.setMbwz = null; //增加目标文字(mbwz) by Rd 2015-10-10
  2130. this.clearHref = null;
  2131. this.getCircuit = null;
  2132. this.contextZones = null;
  2133. this.setOverflowHeight = null;
  2134. this.userData = null;
  2135. this.getRadioChecked = null;
  2136. this.setRadioChecked = null;
  2137. this.addRadioButton = null;
  2138. this.setCheckboxState = null;
  2139. this.getCheckboxState = null;
  2140. this.addCheckbox = null;
  2141. this.serialize = null;
  2142. this.extendedModule = null;
  2143. dhtmlxMenuObjectLiveInstances[this._UID] = null;
  2144. try {
  2145. delete dhtmlxMenuObjectLiveInstances[this._UID];
  2146. } catch (e) {};
  2147. this._UID = null;
  2148. };
  2149. var dhtmlxMenuObjectLiveInstances = {};
  2150. dhtmlXMenuObject.prototype.i18n = {
  2151. dhxmenuextalert: "dhtmlxmenu_ext.js required"
  2152. };
  2153. (function () {
  2154. dhtmlx.extend_api("dhtmlXMenuObject", {
  2155. _init: function (obj) {
  2156. return [obj.parent, obj.skin];
  2157. },
  2158. align: "setAlign",
  2159. top_text: "setTopText",
  2160. context: "renderAsContextMenu",
  2161. icon_path: "setIconsPath",
  2162. open_mode: "setOpenMode",
  2163. rtl: "setRTL",
  2164. skin: "setSkin",
  2165. dynamic: "enableDynamicLoading",
  2166. xml: "loadXML",
  2167. items: "items",
  2168. overflow: "setOverflowHeight"
  2169. }, {
  2170. items: function (arr, parent) {
  2171. var pos = 100000;
  2172. var lastItemId = null;
  2173. for (var i = 0; i < arr.length; i++) {
  2174. var item = arr[i];
  2175. if (item.type == "separator") {
  2176. this.addNewSeparator(lastItemId, pos, item.id);
  2177. lastItemId = item.id;
  2178. } else {
  2179. this.addNewChild(parent, pos, item.id, item.text, item.disabled, item.img, item.img_disabled);
  2180. lastItemId = item.id;
  2181. if (item.items)
  2182. this.items(item.items, item.id);
  2183. }
  2184. }
  2185. }
  2186. });
  2187. })();
  2188. // v.2.6 build 100722
  2189. /*
  2190. Copyright DHTMLX LTD. http : // www.dhtmlx.com
  2191. You allowed to use this component or parts of it under GPL terms
  2192. To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
  2193. */