esp_app_tree.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  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 copy_url = function()
  322. {
  323. var inner = parent.frames['main'].location;
  324. var ploc = top.location;
  325. var url = ploc.protocol + "//" + ploc.host + ploc.pathname;
  326. if ((inner.pathname != "" && inner.pathname != '/') || inner.search!="")
  327. {
  328. var b = false;
  329. var s1 = inner.search;
  330. if (s1.split("?").length > 1)
  331. {
  332. s2 = s1.split("?")[1];
  333. if (s2.split("&").length > 1)
  334. {
  335. s3 = s2.split("&")[0];
  336. s4 = s2.split("&")[1];
  337. if ((s3.indexOf('inner=') == 0) && (s4.indexOf('esp_iframe_title=') == 0))
  338. {
  339. b = true;
  340. url += '?inner=' + escape('..' + inner.pathname + '?' + s4 + '&' + s3);
  341. }
  342. }
  343. }
  344. if (!b)
  345. url += '?inner=' + escape('..' + inner.pathname + inner.search);
  346. }
  347. var oPanel = new YAHOO.widget.Panel("panel1", { constraintoviewport: false, visible: true, fixedcenter: true, zIndex: 4, iframe: true });
  348. oPanel.setHeader("COPY URLs");
  349. var bodystr = "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">";
  350. var usequote = "\"";
  351. bodystr += "<tr><td><a href=" + usequote + url + usequote + "><b>full:</b></a>&nbsp;</td><td>" + url + "</td></tr>";
  352. bodystr += "<tr><td><a href=" + usequote + ploc + usequote + "><b>top:</b></a>&nbsp;</td><td>" + ploc + "</td></tr>";
  353. var allframes = new Array();
  354. getFrameUrls(allframes, parent);
  355. for (var fnbr=0; fnbr<allframes.length; fnbr++)
  356. {
  357. var tf = allframes[fnbr];
  358. bodystr += "<tr><td><a href=" + usequote + tf.url + usequote + "><b>" + tf.name +":</b></a>&nbsp;</td><td>" + tf.url + "</td></tr>";
  359. }
  360. bodystr += "</table>";
  361. oPanel.setBody(bodystr);
  362. oPanel.render("center1");
  363. };
  364. var aItemData = [
  365. {
  366. text: "<em id=\"hpcclabel\">HPCC Systems</em>",
  367. submenu: {
  368. id: "LNButton",
  369. itemdata: [
  370. { text: "About", onclick: { fn: show_about }},
  371. ]
  372. }
  373. },
  374. {
  375. text: "<b>View</b>",
  376. submenu: {
  377. id: "viewmenu",
  378. itemdata: [
  379. [
  380. { text: "Config", url: '/?config_&esp_iframe_title=ESP Configuration File', target: "main"}
  381. ],
  382. [
  383. { text: "Show NAV", onclick: { fn: open_nav }},
  384. { text: "Hide NAV", onclick: { fn: close_nav }}
  385. ]
  386. ] }
  387. },
  388. {
  389. text: "<b>Frame</b>",
  390. submenu: {
  391. id: "framemenu",
  392. itemdata: [
  393. [
  394. { text: "No Frames", onclick: { fn: no_frames }},
  395. { text: "Links", onclick: { fn: copy_url }},
  396. { text: "Refresh", onclick: { fn: refresh_main }}
  397. ]
  398. ] }
  399. }
  400. ];
  401. /*
  402. Instantiate a Menu: The first argument passed to the constructor
  403. is the id for the Menu element to be created, the second is an
  404. object literal of configuration properties.
  405. */
  406. var oMenuBar = new YAHOO.widget.MenuBar("mymenubar", {
  407. iframe: true,
  408. lazyload: true,
  409. itemdata: aItemData,
  410. hidedelay: 750
  411. });
  412. /*
  413. Since this MenuBar instance is built completely from
  414. script, call the "render" method passing in a node
  415. reference for the DOM element that its should be
  416. appended to.
  417. */
  418. oMenuBar.render(document.getElementById("menu1"));
  419. // Add a "show" event listener for each submenu.
  420. function onSubmenuShow() {
  421. var oIFrame,
  422. oElement,
  423. nOffsetWidth;
  424. // Keep the left-most submenu against the left edge of the browser viewport
  425. if (this.id == "yahoo") {
  426. YAHOO.util.Dom.setX(this.element, 0);
  427. oIFrame = this.iframe;
  428. if (oIFrame) {
  429. YAHOO.util.Dom.setX(oIFrame, 0);
  430. }
  431. this.cfg.setProperty("x", 0, true);
  432. }
  433. /*
  434. Need to set the width for submenus of submenus in IE to prevent the mouseout
  435. event from firing prematurely when the user mouses off of a MenuItem's
  436. text node.
  437. */
  438. if ((this.id == "filemenu" || this.id == "editmenu") && YAHOO.env.ua.ie) {
  439. oElement = this.element;
  440. nOffsetWidth = oElement.offsetWidth;
  441. /*
  442. Measuring the difference of the offsetWidth before and after
  443. setting the "width" style attribute allows us to compute the
  444. about of padding and borders applied to the element, which in
  445. turn allows us to set the "width" property correctly.
  446. */
  447. oElement.style.width = nOffsetWidth + "px";
  448. oElement.style.width = (nOffsetWidth - (oElement.offsetWidth - nOffsetWidth)) + "px";
  449. }
  450. }
  451. // Subscribe to the "show" event for each submenu
  452. oMenuBar.subscribe("show", onSubmenuShow);
  453. });
  454. })();
  455. function gomain(url)
  456. {
  457. var f=top.frames['main'];
  458. f.focus();
  459. if (f)
  460. f.location=url;
  461. return false;
  462. }
  463. function loadDynamicFolderData(node, fnLoadComplete)
  464. {
  465. var nodeLabel = encodeURI(node.label);
  466. tree.locked = false;
  467. var e = document.getElementById('wsecl_tree_select');
  468. var viewtype = e.options[e.selectedIndex].value;
  469. //prepare URL for XHR request:
  470. var sUrl = "/esp/navdata?" + node.data.params + "&" + viewtype;
  471. //prepare our callback object
  472. var callback = {
  473. //if our XHR call is successful, we want to make use
  474. //of the returned data and create child nodes.
  475. success: function(oResponse) {
  476. var xmldoc = oResponse.responseXML.documentElement;
  477. treeLoadFolderDataFromXml(node, xmldoc)
  478. //ttreeLoadFolderData(node, xmldoc);
  479. oResponse.argument.fnLoadComplete();
  480. },
  481. //if our XHR call is not successful, we want to
  482. //fire the TreeView callback and let the Tree
  483. //proceed with its business.
  484. failure: function(oResponse) {
  485. oResponse.argument.fnLoadComplete();
  486. },
  487. //our handlers for the XHR response will need the same
  488. //argument information we got to loadNodeData, so
  489. //we'll pass those along:
  490. argument: {
  491. "node": node,
  492. "fnLoadComplete": fnLoadComplete
  493. }
  494. //timeout -- if more than 7 seconds go by, we'll abort
  495. //the transaction and assume there are no children:
  496. //timeout: 21000
  497. };
  498. //With our callback object ready, it's now time to
  499. //make our XHR call using Connection Manager's
  500. //asyncRequest method:
  501. YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
  502. }
  503. function loadNodeData(node, fnLoadComplete)
  504. {
  505. loadDynamicFolderData(node, fnLoadComplete);
  506. }
  507. function showOldForm(ev)
  508. {
  509. var Node = tree._currentlyHighlighted;
  510. gomain("/" + Node.parent.data.myNodeId +"/" + Node.data.myNodeId + "?form");
  511. }
  512. function createXmlArg()
  513. {
  514. var rootNode = tree.getRoot();
  515. var xmlArgs = '';
  516. if (rootNode.children.length > 0)
  517. {
  518. if (rootNode.highlightState > 0)
  519. {
  520. xmlArgs = '<EspNavigationData>' + selectChildNodes(rootNode) + '</EspNavigationData>';
  521. }
  522. }
  523. xmlArgs = escape(xmlArgs);
  524. xmlArgs = xmlArgs.replace(/'+'/g, '%20')
  525. return xmlArgs;
  526. }
  527. function selectChildNodes(Node)
  528. {
  529. var xmlChildArgs = '';
  530. for(var i=0;i<Node.children.length;i++)
  531. {
  532. if (Node.children[i].highlightState > 0)
  533. {
  534. xmlChildArgs = xmlChildArgs + selectChildNodes(Node.children[i]);
  535. }
  536. }
  537. if (Node.parent == null)
  538. {
  539. return xmlChildArgs;
  540. }
  541. 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 + '>';
  542. }
  543. var onTreeClick = function(oArgs)
  544. {
  545. oCurrentTextNode = oArgs.node;
  546. return true;
  547. };
  548. var onNodeClick = function(tNode)
  549. {
  550. if (tNode.data.elementType=='Link')
  551. {
  552. if (tNode.data.navpath && tNode.data.navpath!="")
  553. gomain(tNode.data.navpath);
  554. else
  555. {
  556. var pathval = tNode.parent.data.myNodeId;
  557. var queryval = tNode.data.myNodeId;
  558. var fullurl = "/WsEcl2/tabview/query/" + pathval + "/" + queryval;
  559. gomain(fullurl);
  560. }
  561. }
  562. };
  563. function treeLoadFolderDataFromXml(ntparent, xfolder, expandlist)
  564. {
  565. var xchildren = xfolder.childNodes;
  566. for(var i = 0; i < xchildren.length; i++)
  567. {
  568. var xchild = xchildren[i];
  569. if (xchild.nodeName=="Link")
  570. {
  571. var ntnode = new YAHOO.widget.TextNode({label: xchild.getAttribute("name")}, ntparent);
  572. ntnode.isLeaf = true;
  573. var pathval = xchild.getAttribute("navpath");
  574. if (!pathval || pathval=="")
  575. pathval = xchild.getAttribute("path");
  576. ntnode.data = {
  577. myNodeId: xchild.getAttribute("name"),
  578. title: xchild.getAttribute("name"),
  579. elementType:'Link',
  580. params: xchild.getAttribute("params"),
  581. navpath: pathval
  582. };
  583. }
  584. else if (xchild.nodeName=="DynamicFolder")
  585. {
  586. var ntnode = new YAHOO.widget.TextNode({label: xchild.getAttribute("name")}, ntparent);
  587. ntnode.data = { elementType:'DynamicFolder', params: xchild.getAttribute("params") };
  588. if (expandlist)
  589. expandlist.push(ntnode);
  590. }
  591. else if (xchild.nodeName=="Folder")
  592. {
  593. var ntnode = new YAHOO.widget.TextNode({label: xchild.getAttribute("name"), expanded: true}, ntparent);
  594. ntnode.data = { elementType: 'Folder', params: '', myNodeId: xchild.getAttribute("name") };
  595. ntnode.setNodesProperty("propagateHighlightUp",false);
  596. ntnode.setNodesProperty("propagateHighlightDown",false);
  597. treeLoadFolderDataFrom(ntnode, xchild)
  598. }
  599. }
  600. }
  601. function buildTree(xmlNav)
  602. {
  603. tree = new YAHOO.widget.TreeView("espNavObj");
  604. tree.subscribe('dblClickEvent',function(oArgs) { ImportFromTree(oArgs.Node);});
  605. // By default, trees with TextNodes will fire an event for when the label is clicked:
  606. tree.subscribe("labelClick", onNodeClick);
  607. tree.locked = false;
  608. tree.singleNodeHighlight=true;
  609. var ntroot = tree.getRoot();
  610. tree.setDynamicLoad(loadNodeData, currentIconMode);
  611. tree.subscribe("clickEvent", onTreeClick);
  612. var expandlist = new Array();
  613. treeLoadFolderDataFromXml(ntroot, xmlNav, expandlist);
  614. tree.render();
  615. for (var exp=0; exp<expandlist.length; exp++)
  616. {
  617. expandlist[exp].expand();
  618. }
  619. }
  620. function addNavMenuItemdata(menuitemdata, xmltag)
  621. {
  622. var children = xmltag.childNodes;
  623. for(var i = 0; i < children.length; i++)
  624. {
  625. if (children[i].nodeName=="Link")
  626. {
  627. menuitemdata[i]={text: children[i].getAttribute("name"), url: children[i].getAttribute("path"), target: "main"};
  628. }
  629. else if (children[i].nodeName=="Folder")
  630. {
  631. var childdata = new Array();
  632. addNavMenuItems(childdata, children[i]);
  633. menuitemdata[i]={
  634. text: children[i].getAttribute('name'),
  635. submenu: {
  636. id: children[i].getAttribute('name'),
  637. iframe: true,
  638. itemdata: childdata
  639. }
  640. };
  641. }
  642. }
  643. }
  644. function addNavMenuSubmenuItems(xmltag)
  645. {
  646. var children = xmltag.childNodes;
  647. var ai=0;
  648. for(var i = 0; i < children.length; i++)
  649. {
  650. if (children[i].nodeName=="Folder")
  651. {
  652. var childdata = new Array();
  653. addNavMenuItemdata(childdata, children[i]);
  654. navMenu.addItem({
  655. text: children[i].getAttribute('name'),
  656. iframe: true,
  657. submenu: {
  658. id: children[i].getAttribute('name'),
  659. iframe: true,
  660. itemdata: childdata
  661. }
  662. });
  663. }
  664. else if (children[i].nodeName=="Link")
  665. {
  666. navMenu.addItem({
  667. text: children[i].getAttribute("name"),
  668. url: children[i].getAttribute("path"),
  669. target: "main"
  670. });
  671. }
  672. }
  673. }
  674. function buildNavMenu(xmlNav)
  675. {
  676. navMenu = new YAHOO.widget.Menu("espNavObj", { iframe: true, position: "static", hidedelay: 750, lazyload: true});
  677. addNavMenuSubmenuItems(xmlNav);
  678. navMenu.render();
  679. navMenu.show();
  680. }
  681. function loadNavRootData()
  682. {
  683. //prepare URL for XHR request:
  684. var sUrl = "/esp/nav?rawxml_";
  685. //prepare our callback object
  686. var navroot_callback = {
  687. success: function(oResponse) {
  688. var xmlDoc = oResponse.responseXML;
  689. var xroot = xmlDoc.documentElement;
  690. viewtype = xroot.getAttribute("viewType");
  691. if (viewtype && (viewtype=="wsecl_tree"||viewtype=="yuitree"))
  692. buildTree(xroot);
  693. else
  694. buildNavMenu(xroot);
  695. },
  696. failure: function(oResponse) {
  697. oResponse.argument.fnLoadComplete();
  698. },
  699. argument: {
  700. }
  701. };
  702. YAHOO.util.Connect.asyncRequest('GET', sUrl, navroot_callback);
  703. }
  704. function loadNavUnit()
  705. {
  706. //prepare URL for XHR request:
  707. var sUrl = "/esp/nav?rawxml_";
  708. //prepare our callback object
  709. var navunit_callback = {
  710. success: function(oResponse) {
  711. var xmlDoc = oResponse.responseXML;
  712. var xroot = xmlDoc.documentElement;
  713. var appname = xroot.getAttribute("appName");
  714. viewtype = xroot.getAttribute("viewType");
  715. var inner = getURLParameter("inner");
  716. if (inner!="")
  717. start_page = inner;
  718. else
  719. start_page = xroot.getAttribute("start_page");
  720. if (start_page && start_page!="" && start_page!="/")
  721. {
  722. var cloc = parent.frames['main'].location;
  723. if (cloc.href=="about:blank" || cloc.pathname=="" || cloc.pathname=='/')
  724. {
  725. gomain(start_page);
  726. }
  727. }
  728. if (appname && appname!="")
  729. writeESPappname(appname);
  730. loadNavRootData();
  731. },
  732. failure: function(oResponse) {
  733. oResponse.argument.fnLoadComplete();
  734. },
  735. argument: {
  736. }
  737. };
  738. YAHOO.util.Connect.asyncRequest('GET', sUrl, navunit_callback);
  739. }
  740. </script>
  741. </body>
  742. </html>