esp_app_tree.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  5. <title>ESP</title>
  6. <style type="text/css">
  7. /*margin and padding on body element
  8. can introduce errors in determining
  9. element position and are not recommended;
  10. we turn them off as a foundation for YUI
  11. CSS treatments. */
  12. body {
  13. margin:0;
  14. padding:0;
  15. }
  16. div
  17. {
  18. border:0;
  19. }
  20. #toggle {
  21. text-align: center;
  22. padding: 1em;
  23. }
  24. #toggle a {
  25. padding: 0 5px;
  26. border-left: 1px solid black;
  27. }
  28. #tRight {
  29. border-left: none !important;
  30. }
  31. .yui-navset {
  32. height:100%;
  33. }
  34. .yui-content {
  35. height:100%;
  36. }
  37. .yui-nav
  38. {
  39. background-image:url('esp/files/img/wsecltext.GIF');
  40. background-repeat:no-repeat;
  41. background-position:center;
  42. }
  43. .yui-skin-sam .yui-layout .yui-layout-hd {
  44. background:url(sprite.png) repeat-x 0 -1400px;
  45. border: 1px solid #808080;
  46. }
  47. /* Style the text in the header */
  48. .yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-hd h2 {
  49. font-weight: bold;
  50. color: #fff;
  51. padding: 3px;
  52. text-align: center;
  53. }
  54. #yui-history-iframe {
  55. position:absolute;
  56. top:0; left:0;
  57. width:1px; height:1px; /* avoid scrollbars */
  58. visibility:hidden;
  59. }
  60. .ESPchar {
  61. //color: #3A3E5E;
  62. color: #7D0E1B;
  63. }
  64. /*
  65. Setting the "zoom" property to "1" triggers the "hasLayout"
  66. property in IE. This is necessary to fix a bug IE where
  67. mousing mousing off a the text node of MenuItem instance's
  68. text label, or help text without the mouse actually exiting the
  69. boundaries of the MenuItem instance will result in the losing
  70. the background color applied when it is selected.
  71. */
  72. #filemenu.visible .yuimenuitemlabel,
  73. #editmenu.visible .yuimenuitemlabel {
  74. *zoom: 1;
  75. }
  76. /*
  77. Remove "hasLayout" from the submenu of the file menu.
  78. */
  79. #filemenu.visible .yuimenu .yuimenuitemlabel {
  80. *zoom: normal;
  81. }
  82. em#hpcclabel {
  83. text-indent: -12em;
  84. display: block;
  85. background: url(/esp/files/img/hpccsystemsWsECL.png) center center no-repeat;
  86. width: 10em;
  87. overflow: hidden;
  88. }
  89. #espleftnavmenu {
  90. position: static;
  91. }
  92. #espleftnavmenu .yuimenu .yuimenuitemlabel {
  93. _zoom: normal;
  94. }
  95. #espleftnavmenu .bd {
  96. border: none;
  97. }
  98. #espleftnavmenu .bd .first-of-type .bd {
  99. border: 1px solid #808080;
  100. }
  101. </style>
  102. <link rel="shortcut icon" href="/esp/files/img/favicon.ico" />
  103. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/reset-fonts-grids/reset-fonts-grids.css" />
  104. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/layout/assets/skins/sam/layout.css" />
  105. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/button/assets/skins/sam/button.css" />
  106. <link rel="stylesheet" type="text/css" href="/esp/files/css/espdefault.css">
  107. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/reset/reset.css">
  108. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/fonts/fonts-min.css">
  109. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/reset-fonts-grids/reset-fonts-grids.css">
  110. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/resize/assets/skins/sam/resize.css">
  111. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/layout/assets/skins/sam/layout.css">
  112. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/button/assets/skins/sam/button.css">
  113. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/menu/assets/skins/sam/menu.css">
  114. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/tabview/assets/skins/sam/tabview.css">
  115. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/treeview/assets/skins/sam/treeview.css">
  116. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/paginator/assets/skins/sam/paginator.css">
  117. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/datatable/assets/skins/sam/datatable.css">
  118. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/container/assets/skins/sam/container.css">
  119. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/autocomplete/assets/skins/sam/autocomplete.css">
  120. <link rel="stylesheet" type="text/css" href="/esp/files/yui/build/menu/assets/skins/sam/menu.css">
  121. <script type="text/javascript" src="/esp/files/scripts/espdefault.js"> </script>
  122. <script type="text/javascript" src="/esp/files/yui/build/yahoo/yahoo-min.js"></script>
  123. <script type="text/javascript" src="/esp/files/yui/build/yuiloader/yuiloader-min.js"></script>
  124. <script type="text/javascript" src="/esp/files/yui/build/event/event-min.js"></script>
  125. <script type="text/javascript" src="/esp/files/yui/build/dom/dom-min.js"></script>
  126. <script type="text/javascript" src="/esp/files/yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
  127. <script type="text/javascript" src="/esp/files/yui/build/element/element-min.js"></script>
  128. <script type="text/javascript" src="/esp/files/yui/build/connection/connection-min.js"></script>
  129. <script type="text/javascript" src="/esp/files/yui/build/dragdrop/dragdrop-min.js"></script>
  130. <script type="text/javascript" src="/esp/files/yui/build/container/container_core-min.js"></script>
  131. <script type="text/javascript" src="/esp/files/yui/build/container/container-min.js"></script>
  132. <script type="text/javascript" src="/esp/files/yui/build/resize/resize-min.js"></script>
  133. <script type="text/javascript" src="/esp/files/yui/build/animation/animation-min.js"></script>
  134. <script type="text/javascript" src="/esp/files/yui/build/button/button-min.js"></script>
  135. <script type="text/javascript" src="/esp/files/yui/build/menu/menu.js"></script>
  136. <script type="text/javascript" src="/esp/files/yui/build/menu/menu-min.js"></script>
  137. <script type="text/javascript" src="/esp/files/yui/build/animation/animation-min.js"></script>
  138. <script type="text/javascript" src="/esp/files/yui/build/layout/layout-min.js"></script>
  139. <script type="text/javascript" src="/esp/files/yui/build/datasource/datasource-min.js"></script>
  140. <script type="text/javascript" src="/esp/files/yui/build/paginator/paginator-min.js"></script>
  141. <script type="text/javascript" src="/esp/files/yui/build/datatable/datatable-min.js"></script>
  142. <script type="text/javascript" src="/esp/files/yui/build/json/json-min.js"></script>
  143. <script type="text/javascript" src="/esp/files/yui/build/tabview/tabview-min.js"></script>
  144. <script type="text/javascript" src="/esp/files/yui/build/treeview/treeview.js"></script>
  145. <script type="text/javascript" src="/esp/files/yui/build/autocomplete/autocomplete-min.js"></script>
  146. <script type="text/javascript" src="/esp/files/yui/build/hpcc-ext/DataView.js"></script>
  147. <script type="text/javascript" src="/esp/files/yui/build/hpcc-ext/RowFilter.js"></script>
  148. <script type="text/javascript" src="/esp/files/yui/build/datatable/datatable-min.js"></script>
  149. <script type="text/javascript" src="/esp/files/yui/build/history/history-min.js"></script>
  150. <script type="text/javascript" src="/esp/files/yui/build/utilities/utilities.js"></script>
  151. <script type="text/javascript" src="/esp/files/yui/build/container/container.js"></script>
  152. </head>
  153. <body class=" yui-skin-sam" onload="loadNavUnit();" onresize="writeESPText();">
  154. <iframe id="yui-history-iframe" src="/esp/files/yui/build/history/assets/blank.html"></iframe>
  155. <input id="yui-history-field" type="hidden">
  156. <div id="top1">
  157. <div class="bd"><div id="menu1" style="float: left; width: 100%"><div id="ESPtitle" style="float: right; text-align: right; color: #525461; width: 30%;"><font size=\"4\"><b class=\"ESPchar\">E</b>nterprise&nbsp;<b class=\"ESPchar\">S</b>ervices&nbsp;<b class=\"ESPchar\">P</b>latform&nbsp;&nbsp;&nbsp;</font></div>
  158. <div style="float: right; text-align: center; "><b><font size="4"><div id="ESPappname" style="color: #525461;" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></font></b><font size="1"></font></div>
  159. </div>
  160. </div>
  161. </div>
  162. <div id="left1">
  163. <div id="espNavHeader" style="font-size:0.90em; xpadding: 2px;">
  164. <img src="/esp/files/img/refresh.png" style="cursor:pointer" onclick="removeTreeNodes();" title="Refresh Tree" width="17" height="17" align="right" vspace="1">
  165. <select id="wsecl_tree_select" name="wsecl_tree_select" style="width: 92%;" onchange="removeTreeNodes();">
  166. <option value="AliasList" selected="selected">Active Queries</option>
  167. <option value="QueryList">All Queries</option>
  168. </select>
  169. </div>
  170. <div id="espNavObj" class=" ygtv-highlight" style="font-size:0.90em; padding: 2px; height: 100%; width: 60">&nbsp;</div>
  171. </div>
  172. <div id="center1" style="height:100%; width:100%">
  173. <iframe id="center1frame" name="main" style="height:100%; width:100%; border:0;" ></iframe>
  174. </div>
  175. <script>
  176. var tree, currentIconMode;
  177. var treeSelections;
  178. var lastTreeNode;
  179. var layout;
  180. var navMenu;
  181. var viewType;
  182. var leftcfg;
  183. var start_page;
  184. function removeTreeNodes()
  185. {
  186. var childnodes = tree.getRoot().children[0].children;
  187. for(var i = childnodes.length-1; i>=0; i--)
  188. {
  189. tree.removeChildren(childnodes[i]);
  190. }
  191. tree.getRoot().expand();
  192. }
  193. function getURLParameter(name)
  194. {
  195. name = name.replace(/[[]/,"\[").replace(/[]]/,"\]");
  196. var regexS = "[\?&]"+name+"=([^&#]*)";
  197. var regex = new RegExp( regexS );
  198. var results = regex.exec( window.location.href );
  199. if( results == null )
  200. return "";
  201. else
  202. return results[1];
  203. }
  204. function getFrameUrls(flist, parentwin)
  205. {
  206. for (var fnbr=0; fnbr<parentwin.frames.length; fnbr++)
  207. {
  208. tf = parentwin.frames[fnbr];
  209. if (tf.name && tf.name!="" && tf.location && tf.location.href != "about:blank" && tf.location.pathname.substr(0,14)!="/esp/files/yui")
  210. {
  211. flist.push({name: tf.name, url: tf.location});
  212. getFrameUrls(flist, tf.window);
  213. }
  214. }
  215. }
  216. function writeESPText()
  217. {
  218. var titlediv = document.getElementById("ESPtitle")
  219. if (titlediv.clientWidth < 225)
  220. {
  221. if (titlediv.innerHTML != "<font size=\"4\"><b class=\"ESPchar\">ESP&nbsp;&nbsp;&nbsp;</b></font>")
  222. titlediv.innerHTML = "<font size=\"4\"><b class=\"ESPchar\">ESP&nbsp;&nbsp;&nbsp;</b></font>";
  223. }
  224. else
  225. {
  226. if (titlediv.innerHTML != "<font size=\"4\"><b class=\"ESPchar\">E</b>nterprise&nbsp;<b class=\"ESPchar\">S</b>ervices&nbsp;<b class=\"ESPchar\">P</b>latform&nbsp;&nbsp;&nbsp;</font>")
  227. titlediv.innerHTML = "<font size=\"4\"><b class=\"ESPchar\">E</b>nterprise&nbsp;<b class=\"ESPchar\">S</b>ervices&nbsp;<b class=\"ESPchar\">P</b>latform&nbsp;&nbsp;&nbsp;</font>";
  228. }
  229. }
  230. function writeESPappname(appname)
  231. {
  232. var namediv = document.getElementById("ESPappname")
  233. namediv.innerHTML = appname + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  234. }
  235. (function() {
  236. var Dom = YAHOO.util.Dom,
  237. Event = YAHOO.util.Event;
  238. Event.onDOMReady(function() {
  239. writeESPText();
  240. layout = new YAHOO.widget.Layout({
  241. units: [
  242. { position: 'top', height: 28, body: 'top1', scroll: null, zIndex: 3, useShim: true },
  243. { position: 'left', width: 240, resize: true, body: 'left1', gutter: '0px',
  244. collapse: true, close: true, useShim: true, scroll: true, zIndex: 2 },
  245. { position: 'center', body: 'center1', useShim: true, zIndex: 1 }
  246. ]
  247. });
  248. layout.render();
  249. var inner = getURLParameter("inner");
  250. if (inner!="")
  251. gomain(inner);
  252. Event.on('tLeft', 'click', function(ev) {
  253. Event.stopEvent(ev);
  254. layout.getUnitByPosition('left').toggle();
  255. });
  256. var close_nav = function() {
  257. layout.getUnitByPosition('left').close();
  258. };
  259. var no_frames = function() {
  260. top.location.href=top.frames['main'].location.href
  261. };
  262. var refresh_main = function() {
  263. parent.frames['main'].location.reload();
  264. };
  265. var open_nav = function() {
  266. var navunit = layout.getUnitByPosition('left');
  267. if (navunit)
  268. navunit.expand();
  269. else
  270. layout.addUnit({position: 'left', width: 240, resize: true, body: 'left1', gutter: '0px', collapse: true, close: true, useShim: true, scroll: true, zIndex: 2});
  271. };
  272. var show_about=function()
  273. {
  274. //prepare URL for XHR request:
  275. var sUrl = "/esp/titlebar?rawxml_";
  276. //prepare our callback object
  277. var callback = {
  278. //if our XHR call is successful, we want to make use
  279. //of the returned data and create child nodes.
  280. success: function(oResponse) {
  281. var xmldoc = oResponse.responseXML;
  282. var abouttxt = "Enterprise Services Platform <br/><br/>";
  283. var builditer = xmldoc.getElementsByTagName("BuildVersion");
  284. if (builditer.length)
  285. abouttxt += "Build: " + builditer[0].text + "<br/><br/>";
  286. builditer = xmldoc.getElementsByTagName("LoginId");
  287. if (builditer.length)
  288. abouttxt += "Logged in as: " + builditer[0].text + "<br/><br/>";
  289. abouttxt += "Copyright (c) 2011 HPCC Systems";
  290. var aPanel = new YAHOO.widget.Panel("about_panel", {
  291. constraintoviewport: true,
  292. visible: true,
  293. fixedcenter: true,
  294. width: "400px",
  295. zIndex: 4,
  296. iframe: true
  297. });
  298. aPanel.setHeader("ABOUT");
  299. aPanel.setBody(abouttxt);
  300. aPanel.render("center1");
  301. },
  302. //if our XHR call is not successful, we want to
  303. //fire the TreeView callback and let the Tree
  304. //proceed with its business.
  305. failure: function(oResponse) {
  306. },
  307. //our handlers for the XHR response will need the same
  308. //argument information we got to loadNodeData, so
  309. //we'll pass those along:
  310. argument: {
  311. }
  312. //timeout -- if more than 7 seconds go by, we'll abort
  313. //the transaction and assume there are no children:
  314. //timeout: 21000
  315. };
  316. //With our callback object ready, it's now time to
  317. //make our XHR call using Connection Manager's
  318. //asyncRequest method:
  319. YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
  320. }
  321. var logout = function()
  322. {
  323. var logoutRequest = new XMLHttpRequest();
  324. logoutRequest.onreadystatechange = function()
  325. {
  326. if (logoutRequest.readyState == 4 && logoutRequest.status == 200)
  327. parent.location = '/esp/files/Login.html';
  328. else
  329. console.log("Logout failed: " + logoutRequest.status);
  330. }
  331. logoutRequest.open( "GET", 'esp/logout', true );
  332. logoutRequest.send( null );
  333. }
  334. var copy_url = function()
  335. {
  336. var inner = parent.frames['main'].location;
  337. var ploc = top.location;
  338. var url = ploc.protocol + "//" + ploc.host + ploc.pathname;
  339. if ((inner.pathname != "" && inner.pathname != '/') || inner.search!="")
  340. {
  341. var b = false;
  342. var s1 = inner.search;
  343. if (s1.split("?").length > 1)
  344. {
  345. s2 = s1.split("?")[1];
  346. if (s2.split("&").length > 1)
  347. {
  348. s3 = s2.split("&")[0];
  349. s4 = s2.split("&")[1];
  350. if ((s3.indexOf('inner=') == 0) && (s4.indexOf('esp_iframe_title=') == 0))
  351. {
  352. b = true;
  353. url += '?inner=' + escape('..' + inner.pathname + '?' + s4 + '&' + s3);
  354. }
  355. }
  356. }
  357. if (!b)
  358. url += '?inner=' + escape('..' + inner.pathname + inner.search);
  359. }
  360. var oPanel = new YAHOO.widget.Panel("panel1", { constraintoviewport: false, visible: true, fixedcenter: true, zIndex: 4, iframe: true });
  361. oPanel.setHeader("COPY URLs");
  362. var bodystr = "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">";
  363. var usequote = "\"";
  364. bodystr += "<tr><td><a href=" + usequote + url + usequote + "><b>full:</b></a>&nbsp;</td><td>" + url + "</td></tr>";
  365. bodystr += "<tr><td><a href=" + usequote + ploc + usequote + "><b>top:</b></a>&nbsp;</td><td>" + ploc + "</td></tr>";
  366. var allframes = new Array();
  367. getFrameUrls(allframes, parent);
  368. for (var fnbr=0; fnbr<allframes.length; fnbr++)
  369. {
  370. var tf = allframes[fnbr];
  371. bodystr += "<tr><td><a href=" + usequote + tf.url + usequote + "><b>" + tf.name +":</b></a>&nbsp;</td><td>" + tf.url + "</td></tr>";
  372. }
  373. bodystr += "</table>";
  374. oPanel.setBody(bodystr);
  375. oPanel.render("center1");
  376. };
  377. var aItemData = [
  378. {
  379. text: "<em id=\"hpcclabel\">HPCC Systems</em>",
  380. submenu: {
  381. id: "LNButton",
  382. itemdata: [
  383. { text: "About", onclick: { fn: show_about }},
  384. ]
  385. }
  386. },
  387. {
  388. text: "<b>View</b>",
  389. submenu: {
  390. id: "viewmenu",
  391. itemdata: [
  392. [
  393. { text: "Config", url: '/?config_&esp_iframe_title=ESP Configuration File', target: "main"}
  394. ],
  395. [
  396. { text: "Show NAV", onclick: { fn: open_nav }},
  397. { text: "Hide NAV", onclick: { fn: close_nav }}
  398. ]
  399. ] }
  400. },
  401. {
  402. text: "<b>Frame</b>",
  403. submenu: {
  404. id: "framemenu",
  405. itemdata: [
  406. [
  407. { text: "No Frames", onclick: { fn: no_frames }},
  408. { text: "Links", onclick: { fn: copy_url }},
  409. { text: "Refresh", onclick: { fn: refresh_main }}
  410. ]
  411. ] }
  412. },
  413. {
  414. text: "<b>Log Out</b>",
  415. onclick: { fn: logout }
  416. }
  417. ];
  418. /*
  419. Instantiate a Menu: The first argument passed to the constructor
  420. is the id for the Menu element to be created, the second is an
  421. object literal of configuration properties.
  422. */
  423. var oMenuBar = new YAHOO.widget.MenuBar("mymenubar", {
  424. iframe: true,
  425. lazyload: true,
  426. itemdata: aItemData,
  427. hidedelay: 750
  428. });
  429. /*
  430. Since this MenuBar instance is built completely from
  431. script, call the "render" method passing in a node
  432. reference for the DOM element that its should be
  433. appended to.
  434. */
  435. oMenuBar.render(document.getElementById("menu1"));
  436. // Add a "show" event listener for each submenu.
  437. function onSubmenuShow() {
  438. var oIFrame,
  439. oElement,
  440. nOffsetWidth;
  441. // Keep the left-most submenu against the left edge of the browser viewport
  442. if (this.id == "yahoo") {
  443. YAHOO.util.Dom.setX(this.element, 0);
  444. oIFrame = this.iframe;
  445. if (oIFrame) {
  446. YAHOO.util.Dom.setX(oIFrame, 0);
  447. }
  448. this.cfg.setProperty("x", 0, true);
  449. }
  450. /*
  451. Need to set the width for submenus of submenus in IE to prevent the mouseout
  452. event from firing prematurely when the user mouses off of a MenuItem's
  453. text node.
  454. */
  455. if ((this.id == "filemenu" || this.id == "editmenu") && YAHOO.env.ua.ie) {
  456. oElement = this.element;
  457. nOffsetWidth = oElement.offsetWidth;
  458. /*
  459. Measuring the difference of the offsetWidth before and after
  460. setting the "width" style attribute allows us to compute the
  461. about of padding and borders applied to the element, which in
  462. turn allows us to set the "width" property correctly.
  463. */
  464. oElement.style.width = nOffsetWidth + "px";
  465. oElement.style.width = (nOffsetWidth - (oElement.offsetWidth - nOffsetWidth)) + "px";
  466. }
  467. }
  468. // Subscribe to the "show" event for each submenu
  469. oMenuBar.subscribe("show", onSubmenuShow);
  470. });
  471. })();
  472. function gomain(url)
  473. {
  474. var f=top.frames['main'];
  475. f.focus();
  476. if (f)
  477. f.location=url;
  478. return false;
  479. }
  480. function loadDynamicFolderData(node, fnLoadComplete)
  481. {
  482. var nodeLabel = encodeURI(node.label);
  483. tree.locked = false;
  484. var e = document.getElementById('wsecl_tree_select');
  485. var viewtype = e.options[e.selectedIndex].value;
  486. //prepare URL for XHR request:
  487. var sUrl = "/esp/navdata?" + node.data.params + "&" + viewtype;
  488. //prepare our callback object
  489. var callback = {
  490. //if our XHR call is successful, we want to make use
  491. //of the returned data and create child nodes.
  492. success: function(oResponse) {
  493. var xmldoc = oResponse.responseXML.documentElement;
  494. treeLoadFolderDataFromXml(node, xmldoc)
  495. //ttreeLoadFolderData(node, xmldoc);
  496. oResponse.argument.fnLoadComplete();
  497. },
  498. //if our XHR call is not successful, we want to
  499. //fire the TreeView callback and let the Tree
  500. //proceed with its business.
  501. failure: function(oResponse) {
  502. oResponse.argument.fnLoadComplete();
  503. },
  504. //our handlers for the XHR response will need the same
  505. //argument information we got to loadNodeData, so
  506. //we'll pass those along:
  507. argument: {
  508. "node": node,
  509. "fnLoadComplete": fnLoadComplete
  510. }
  511. //timeout -- if more than 7 seconds go by, we'll abort
  512. //the transaction and assume there are no children:
  513. //timeout: 21000
  514. };
  515. //With our callback object ready, it's now time to
  516. //make our XHR call using Connection Manager's
  517. //asyncRequest method:
  518. YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
  519. }
  520. function loadNodeData(node, fnLoadComplete)
  521. {
  522. loadDynamicFolderData(node, fnLoadComplete);
  523. }
  524. function showOldForm(ev)
  525. {
  526. var Node = tree._currentlyHighlighted;
  527. gomain("/" + Node.parent.data.myNodeId +"/" + Node.data.myNodeId + "?form");
  528. }
  529. function createXmlArg()
  530. {
  531. var rootNode = tree.getRoot();
  532. var xmlArgs = '';
  533. if (rootNode.children.length > 0)
  534. {
  535. if (rootNode.highlightState > 0)
  536. {
  537. xmlArgs = '<EspNavigationData>' + selectChildNodes(rootNode) + '</EspNavigationData>';
  538. }
  539. }
  540. xmlArgs = escape(xmlArgs);
  541. xmlArgs = xmlArgs.replace(/'+'/g, '%20')
  542. return xmlArgs;
  543. }
  544. function selectChildNodes(Node)
  545. {
  546. var xmlChildArgs = '';
  547. for(var i=0;i<Node.children.length;i++)
  548. {
  549. if (Node.children[i].highlightState > 0)
  550. {
  551. xmlChildArgs = xmlChildArgs + selectChildNodes(Node.children[i]);
  552. }
  553. }
  554. if (Node.parent == null)
  555. {
  556. return xmlChildArgs;
  557. }
  558. return '<' + Node.data.elementType + ' name="' + Node.label + '" ' + (Node.data.params != null && Node.data.params != '' ? 'params="' + Node.data.params.replace(/&/g, '&amp;') + '" ': '') + (Node.highlightState == 1 ? 'selected="true" ': '') + '>' + xmlChildArgs + '</' + Node.data.elementType + '>';
  559. }
  560. var onTreeClick = function(oArgs)
  561. {
  562. oCurrentTextNode = oArgs.node;
  563. return true;
  564. };
  565. var onNodeClick = function(tNode)
  566. {
  567. if (tNode.data.elementType=='Link')
  568. {
  569. if (tNode.data.navpath && tNode.data.navpath!="")
  570. gomain(tNode.data.navpath);
  571. else
  572. {
  573. var pathval = tNode.parent.data.myNodeId;
  574. var queryval = tNode.data.myNodeId;
  575. var fullurl = "/WsEcl2/tabview/query/" + pathval + "/" + queryval;
  576. gomain(fullurl);
  577. }
  578. }
  579. };
  580. function treeLoadFolderDataFromXml(ntparent, xfolder, expandlist)
  581. {
  582. var xchildren = xfolder.childNodes;
  583. for(var i = 0; i < xchildren.length; i++)
  584. {
  585. var xchild = xchildren[i];
  586. if (xchild.nodeName=="Link")
  587. {
  588. var ntnode = new YAHOO.widget.TextNode({label: xchild.getAttribute("name")}, ntparent);
  589. ntnode.isLeaf = true;
  590. var pathval = xchild.getAttribute("navpath");
  591. if (!pathval || pathval=="")
  592. pathval = xchild.getAttribute("path");
  593. ntnode.data = {
  594. myNodeId: xchild.getAttribute("name"),
  595. title: xchild.getAttribute("name"),
  596. elementType:'Link',
  597. params: xchild.getAttribute("params"),
  598. navpath: pathval
  599. };
  600. }
  601. else if (xchild.nodeName=="DynamicFolder")
  602. {
  603. var ntnode = new YAHOO.widget.TextNode({label: xchild.getAttribute("name")}, ntparent);
  604. ntnode.data = { elementType:'DynamicFolder', params: xchild.getAttribute("params") };
  605. if (expandlist)
  606. expandlist.push(ntnode);
  607. }
  608. else if (xchild.nodeName=="Folder")
  609. {
  610. var ntnode = new YAHOO.widget.TextNode({label: xchild.getAttribute("name"), expanded: true}, ntparent);
  611. ntnode.data = { elementType: 'Folder', params: '', myNodeId: xchild.getAttribute("name") };
  612. ntnode.setNodesProperty("propagateHighlightUp",false);
  613. ntnode.setNodesProperty("propagateHighlightDown",false);
  614. treeLoadFolderDataFrom(ntnode, xchild)
  615. }
  616. }
  617. }
  618. function buildTree(xmlNav)
  619. {
  620. tree = new YAHOO.widget.TreeView("espNavObj");
  621. tree.subscribe('dblClickEvent',function(oArgs) { ImportFromTree(oArgs.Node);});
  622. // By default, trees with TextNodes will fire an event for when the label is clicked:
  623. tree.subscribe("labelClick", onNodeClick);
  624. tree.locked = false;
  625. tree.singleNodeHighlight=true;
  626. var ntroot = tree.getRoot();
  627. tree.setDynamicLoad(loadNodeData, currentIconMode);
  628. tree.subscribe("clickEvent", onTreeClick);
  629. var expandlist = new Array();
  630. treeLoadFolderDataFromXml(ntroot, xmlNav, expandlist);
  631. tree.render();
  632. for (var exp=0; exp<expandlist.length; exp++)
  633. {
  634. expandlist[exp].expand();
  635. }
  636. }
  637. function addNavMenuItemdata(menuitemdata, xmltag)
  638. {
  639. var children = xmltag.childNodes;
  640. for(var i = 0; i < children.length; i++)
  641. {
  642. if (children[i].nodeName=="Link")
  643. {
  644. menuitemdata[i]={text: children[i].getAttribute("name"), url: children[i].getAttribute("path"), target: "main"};
  645. }
  646. else if (children[i].nodeName=="Folder")
  647. {
  648. var childdata = new Array();
  649. addNavMenuItems(childdata, children[i]);
  650. menuitemdata[i]={
  651. text: children[i].getAttribute('name'),
  652. submenu: {
  653. id: children[i].getAttribute('name'),
  654. iframe: true,
  655. itemdata: childdata
  656. }
  657. };
  658. }
  659. }
  660. }
  661. function addNavMenuSubmenuItems(xmltag)
  662. {
  663. var children = xmltag.childNodes;
  664. var ai=0;
  665. for(var i = 0; i < children.length; i++)
  666. {
  667. if (children[i].nodeName=="Folder")
  668. {
  669. var childdata = new Array();
  670. addNavMenuItemdata(childdata, children[i]);
  671. navMenu.addItem({
  672. text: children[i].getAttribute('name'),
  673. iframe: true,
  674. submenu: {
  675. id: children[i].getAttribute('name'),
  676. iframe: true,
  677. itemdata: childdata
  678. }
  679. });
  680. }
  681. else if (children[i].nodeName=="Link")
  682. {
  683. navMenu.addItem({
  684. text: children[i].getAttribute("name"),
  685. url: children[i].getAttribute("path"),
  686. target: "main"
  687. });
  688. }
  689. }
  690. }
  691. function buildNavMenu(xmlNav)
  692. {
  693. navMenu = new YAHOO.widget.Menu("espNavObj", { iframe: true, position: "static", hidedelay: 750, lazyload: true});
  694. addNavMenuSubmenuItems(xmlNav);
  695. navMenu.render();
  696. navMenu.show();
  697. }
  698. function loadNavRootData()
  699. {
  700. //prepare URL for XHR request:
  701. var sUrl = "/esp/nav?rawxml_";
  702. //prepare our callback object
  703. var navroot_callback = {
  704. success: function(oResponse) {
  705. var xmlDoc = oResponse.responseXML;
  706. var xroot = xmlDoc.documentElement;
  707. viewtype = xroot.getAttribute("viewType");
  708. if (viewtype && (viewtype=="wsecl_tree"||viewtype=="yuitree"))
  709. buildTree(xroot);
  710. else
  711. buildNavMenu(xroot);
  712. },
  713. failure: function(oResponse) {
  714. oResponse.argument.fnLoadComplete();
  715. },
  716. argument: {
  717. }
  718. };
  719. YAHOO.util.Connect.asyncRequest('GET', sUrl, navroot_callback);
  720. }
  721. function loadNavUnit()
  722. {
  723. //prepare URL for XHR request:
  724. var sUrl = "/esp/nav?rawxml_";
  725. //prepare our callback object
  726. var navunit_callback = {
  727. success: function(oResponse) {
  728. var xmlDoc = oResponse.responseXML;
  729. var xroot = xmlDoc.documentElement;
  730. var appname = xroot.getAttribute("appName");
  731. viewtype = xroot.getAttribute("viewType");
  732. var inner = getURLParameter("inner");
  733. if (inner!="")
  734. start_page = inner;
  735. else
  736. start_page = xroot.getAttribute("start_page");
  737. if (start_page && start_page!="" && start_page!="/")
  738. {
  739. var cloc = parent.frames['main'].location;
  740. if (cloc.href=="about:blank" || cloc.pathname=="" || cloc.pathname=='/')
  741. {
  742. gomain(start_page);
  743. }
  744. }
  745. if (appname && appname!="")
  746. writeESPappname(appname);
  747. loadNavRootData();
  748. },
  749. failure: function(oResponse) {
  750. oResponse.argument.fnLoadComplete();
  751. },
  752. argument: {
  753. }
  754. };
  755. YAHOO.util.Connect.asyncRequest('GET', sUrl, navunit_callback);
  756. }
  757. </script>
  758. </body>
  759. </html>