esp_app.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875
  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="espNavObj" class=" ygtv-highlight" style="font-size:0.90em; padding: 2px; height: 100%; width: 60">&nbsp;</div>
  164. </div>
  165. <div id="center1" style="height:100%; width:100%">
  166. <iframe id="center1frame" name="main" style="height:100%; width:100%; border:0;" ></iframe>
  167. </div>
  168. <script>
  169. var tree, currentIconMode;
  170. var treeSelections;
  171. var lastTreeNode;
  172. var layout;
  173. var navMenu;
  174. var viewType;
  175. var leftcfg;
  176. var start_page;
  177. function getURLParameter(name)
  178. {
  179. name = name.replace(/[[]/,"\[").replace(/[]]/,"\]");
  180. var regexS = "[\?&]"+name+"=([^&#]*)";
  181. var regex = new RegExp( regexS );
  182. var results = regex.exec( window.location.href );
  183. if( results == null )
  184. return "";
  185. else
  186. return results[1];
  187. }
  188. function getFrameUrls(flist, parentwin)
  189. {
  190. for (var fnbr=0; fnbr<parentwin.frames.length; fnbr++)
  191. {
  192. tf = parentwin.frames[fnbr];
  193. if (tf.name && tf.name!="" && tf.location && tf.location.href != "about:blank" && tf.location.pathname.substr(0,14)!="/esp/files/yui")
  194. {
  195. flist.push({name: tf.name, url: tf.location});
  196. getFrameUrls(flist, tf.window);
  197. }
  198. }
  199. }
  200. function writeESPText()
  201. {
  202. var titlediv = document.getElementById("ESPtitle")
  203. if (titlediv.clientWidth < 225)
  204. {
  205. if (titlediv.innerHTML != "<font size=\"4\"><b class=\"ESPchar\">ESP&nbsp;&nbsp;&nbsp;</b></font>")
  206. titlediv.innerHTML = "<font size=\"4\"><b class=\"ESPchar\">ESP&nbsp;&nbsp;&nbsp;</b></font>";
  207. }
  208. else
  209. {
  210. 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>")
  211. 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>";
  212. }
  213. }
  214. function writeESPappname(appname)
  215. {
  216. var namediv = document.getElementById("ESPappname")
  217. namediv.innerHTML = appname + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  218. }
  219. (function() {
  220. var Dom = YAHOO.util.Dom,
  221. Event = YAHOO.util.Event;
  222. Event.onDOMReady(function() {
  223. writeESPText();
  224. layout = new YAHOO.widget.Layout({
  225. units: [
  226. { position: 'top', height: 28, body: 'top1', scroll: null, zIndex: 3, useShim: true },
  227. { position: 'center', body: 'center1', useShim: true, zIndex: 1 }
  228. ]
  229. });
  230. layout.render();
  231. var inner = getURLParameter("inner");
  232. if (inner!="")
  233. gomain(inner);
  234. Event.on('tLeft', 'click', function(ev) {
  235. Event.stopEvent(ev);
  236. layout.getUnitByPosition('left').toggle();
  237. });
  238. var close_nav = function() {
  239. layout.getUnitByPosition('left').close();
  240. };
  241. var no_frames = function() {
  242. top.location.href=top.frames['main'].location.href
  243. };
  244. var refresh_main = function() {
  245. parent.frames['main'].location.reload();
  246. };
  247. var open_nav = function() {
  248. var navunit = layout.getUnitByPosition('left');
  249. var strunit = navunit.toString();
  250. if (navunit)
  251. navunit.expand();
  252. else
  253. layout.addUnit(leftcfg);
  254. };
  255. var show_about=function()
  256. {
  257. //prepare URL for XHR request:
  258. var sUrl = "/esp/titlebar?rawxml_";
  259. //prepare our callback object
  260. var callback = {
  261. //if our XHR call is successful, we want to make use
  262. //of the returned data and create child nodes.
  263. success: function(oResponse) {
  264. var xmldoc = oResponse.responseXML;
  265. var abouttxt = "Enterprise Services Platform <br/><br/>";
  266. var builditer = xmldoc.getElementsByTagName("BuildVersion");
  267. if (builditer.length)
  268. abouttxt += "Build: " + builditer[0].text + "<br/><br/>";
  269. builditer = xmldoc.getElementsByTagName("LoginId");
  270. if (builditer.length)
  271. abouttxt += "Logged in as: " + builditer[0].text + "<br/><br/>";
  272. abouttxt += "Copyright (c) 2011 HPCC Systems";
  273. var aPanel = new YAHOO.widget.Panel("about_panel", {
  274. constraintoviewport: true,
  275. visible: true,
  276. fixedcenter: true,
  277. width: "400px",
  278. zIndex: 4,
  279. iframe: true
  280. });
  281. aPanel.setHeader("ABOUT");
  282. aPanel.setBody(abouttxt);
  283. aPanel.render("center1");
  284. },
  285. //if our XHR call is not successful, we want to
  286. //fire the TreeView callback and let the Tree
  287. //proceed with its business.
  288. failure: function(oResponse) {
  289. },
  290. //our handlers for the XHR response will need the same
  291. //argument information we got to loadNodeData, so
  292. //we'll pass those along:
  293. argument: {
  294. }
  295. //timeout -- if more than 7 seconds go by, we'll abort
  296. //the transaction and assume there are no children:
  297. //timeout: 21000
  298. };
  299. //With our callback object ready, it's now time to
  300. //make our XHR call using Connection Manager's
  301. //asyncRequest method:
  302. YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
  303. }
  304. var copy_url = function()
  305. {
  306. var inner = parent.frames['main'].location;
  307. var ploc = top.location;
  308. var url = ploc.protocol + "//" + ploc.host + ploc.pathname;
  309. if ((inner.pathname != "" && inner.pathname != '/') || inner.search!="")
  310. {
  311. var b = false;
  312. var s1 = inner.search;
  313. if (s1.split("?").length > 1)
  314. {
  315. s2 = s1.split("?")[1];
  316. if (s2.split("&").length > 1)
  317. {
  318. s3 = s2.split("&")[0];
  319. s4 = s2.split("&")[1];
  320. if ((s3.indexOf('inner=') == 0) && (s4.indexOf('esp_iframe_title=') == 0))
  321. {
  322. b = true;
  323. url += '?inner=' + escape('..' + inner.pathname + '?' + s4 + '&' + s3);
  324. }
  325. }
  326. }
  327. if (!b)
  328. url += '?inner=' + escape('..' + inner.pathname + inner.search);
  329. }
  330. var oPanel = new YAHOO.widget.Panel("panel1", { constraintoviewport: false, visible: true, fixedcenter: true, zIndex: 4, iframe: true });
  331. oPanel.setHeader("COPY URLs");
  332. var bodystr = "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">";
  333. var usequote = "\"";
  334. bodystr += "<tr><td><a href=" + usequote + url + usequote + "><b>full:</b></a>&nbsp;</td><td>" + url + "</td></tr>";
  335. bodystr += "<tr><td><a href=" + usequote + ploc + usequote + "><b>top:</b></a>&nbsp;</td><td>" + ploc + "</td></tr>";
  336. var allframes = new Array();
  337. getFrameUrls(allframes, parent);
  338. for (var fnbr=0; fnbr<allframes.length; fnbr++)
  339. {
  340. var tf = allframes[fnbr];
  341. bodystr += "<tr><td><a href=" + usequote + tf.url + usequote + "><b>" + tf.name +":</b></a>&nbsp;</td><td>" + tf.url + "</td></tr>";
  342. }
  343. bodystr += "</table>";
  344. oPanel.setBody(bodystr);
  345. oPanel.render("center1");
  346. };
  347. var aItemData = [
  348. {
  349. text: "<em id=\"hpcclabel\">HPCC Systems</em>",
  350. submenu: {
  351. id: "LNButton",
  352. itemdata: [
  353. { text: "About", onclick: { fn: show_about }},
  354. ]
  355. }
  356. },
  357. {
  358. text: "<b>View</b>",
  359. submenu: {
  360. id: "viewmenu",
  361. itemdata: [
  362. [
  363. { text: "Config", url: '/?config_&esp_iframe_title=ESP Configuration File', target: "main"}
  364. ],
  365. [
  366. { text: "Show NAV", onclick: { fn: open_nav }},
  367. { text: "Hide NAV", onclick: { fn: close_nav }}
  368. ]
  369. ] }
  370. },
  371. {
  372. text: "<b>Frame</b>",
  373. submenu: {
  374. id: "framemenu",
  375. itemdata: [
  376. [
  377. { text: "No Frames", onclick: { fn: no_frames }},
  378. { text: "Links", onclick: { fn: copy_url }},
  379. { text: "Refresh", onclick: { fn: refresh_main }}
  380. ]
  381. ] }
  382. }
  383. ];
  384. /*
  385. Instantiate a Menu: The first argument passed to the constructor
  386. is the id for the Menu element to be created, the second is an
  387. object literal of configuration properties.
  388. */
  389. var oMenuBar = new YAHOO.widget.MenuBar("mymenubar", {
  390. iframe: true,
  391. lazyload: true,
  392. itemdata: aItemData,
  393. hidedelay: 750
  394. });
  395. /*
  396. Since this MenuBar instance is built completely from
  397. script, call the "render" method passing in a node
  398. reference for the DOM element that its should be
  399. appended to.
  400. */
  401. oMenuBar.render(document.getElementById("menu1"));
  402. // Add a "show" event listener for each submenu.
  403. function onSubmenuShow() {
  404. var oIFrame,
  405. oElement,
  406. nOffsetWidth;
  407. // Keep the left-most submenu against the left edge of the browser viewport
  408. if (this.id == "yahoo") {
  409. YAHOO.util.Dom.setX(this.element, 0);
  410. oIFrame = this.iframe;
  411. if (oIFrame) {
  412. YAHOO.util.Dom.setX(oIFrame, 0);
  413. }
  414. this.cfg.setProperty("x", 0, true);
  415. }
  416. /*
  417. Need to set the width for submenus of submenus in IE to prevent the mouseout
  418. event from firing prematurely when the user mouses off of a MenuItem's
  419. text node.
  420. */
  421. if ((this.id == "filemenu" || this.id == "editmenu") && YAHOO.env.ua.ie) {
  422. oElement = this.element;
  423. nOffsetWidth = oElement.offsetWidth;
  424. /*
  425. Measuring the difference of the offsetWidth before and after
  426. setting the "width" style attribute allows us to compute the
  427. about of padding and borders applied to the element, which in
  428. turn allows us to set the "width" property correctly.
  429. */
  430. oElement.style.width = nOffsetWidth + "px";
  431. oElement.style.width = (nOffsetWidth - (oElement.offsetWidth - nOffsetWidth)) + "px";
  432. }
  433. }
  434. // Subscribe to the "show" event for each submenu
  435. oMenuBar.subscribe("show", onSubmenuShow);
  436. });
  437. })();
  438. function gomain(url)
  439. {
  440. var f=top.frames['main'];
  441. f.focus();
  442. if (f)
  443. f.location=url;
  444. return false;
  445. }
  446. function loadDynamicFolderData(node, fnLoadComplete)
  447. {
  448. var nodeLabel = encodeURI(node.label);
  449. tree.locked = false;
  450. //prepare URL for XHR request:
  451. var sUrl = "/esp/navdata?" + node.data.params;
  452. //prepare our callback object
  453. var callback = {
  454. //if our XHR call is successful, we want to make use
  455. //of the returned data and create child nodes.
  456. success: function(oResponse) {
  457. var xmldoc = oResponse.responseXML.documentElement;
  458. treeLoadFolderDataFromXml(node, xmldoc)
  459. //ttreeLoadFolderData(node, xmldoc);
  460. oResponse.argument.fnLoadComplete();
  461. },
  462. //if our XHR call is not successful, we want to
  463. //fire the TreeView callback and let the Tree
  464. //proceed with its business.
  465. failure: function(oResponse) {
  466. oResponse.argument.fnLoadComplete();
  467. },
  468. //our handlers for the XHR response will need the same
  469. //argument information we got to loadNodeData, so
  470. //we'll pass those along:
  471. argument: {
  472. "node": node,
  473. "fnLoadComplete": fnLoadComplete
  474. }
  475. //timeout -- if more than 7 seconds go by, we'll abort
  476. //the transaction and assume there are no children:
  477. //timeout: 21000
  478. };
  479. //With our callback object ready, it's now time to
  480. //make our XHR call using Connection Manager's
  481. //asyncRequest method:
  482. YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
  483. }
  484. function loadNodeData(node, fnLoadComplete)
  485. {
  486. loadDynamicFolderData(node, fnLoadComplete);
  487. }
  488. function showOldForm(ev)
  489. {
  490. var Node = tree._currentlyHighlighted;
  491. gomain("/" + Node.parent.data.myNodeId +"/" + Node.data.myNodeId + "?form");
  492. }
  493. function createXmlArg()
  494. {
  495. var rootNode = tree.getRoot();
  496. var xmlArgs = '';
  497. if (rootNode.children.length > 0)
  498. {
  499. if (rootNode.highlightState > 0)
  500. {
  501. xmlArgs = '<EspNavigationData>' + selectChildNodes(rootNode) + '</EspNavigationData>';
  502. }
  503. }
  504. xmlArgs = escape(xmlArgs);
  505. xmlArgs = xmlArgs.replace(/'+'/g, '%20')
  506. return xmlArgs;
  507. }
  508. function selectChildNodes(Node)
  509. {
  510. var xmlChildArgs = '';
  511. for(var i=0;i<Node.children.length;i++)
  512. {
  513. if (Node.children[i].highlightState > 0)
  514. {
  515. xmlChildArgs = xmlChildArgs + selectChildNodes(Node.children[i]);
  516. }
  517. }
  518. if (Node.parent == null)
  519. {
  520. return xmlChildArgs;
  521. }
  522. 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 + '>';
  523. }
  524. var onTreeClick = function(oArgs)
  525. {
  526. oCurrentTextNode = oArgs.node;
  527. return true;
  528. };
  529. var onNodeClick = function(tNode)
  530. {
  531. if (tNode.data.elementType=='Link')
  532. {
  533. if (tNode.data.navpath && tNode.data.navpath!="")
  534. gomain(tNode.data.navpath);
  535. else
  536. {
  537. var pathval = tNode.parent.data.myNodeId;
  538. var queryval = tNode.data.myNodeId;
  539. var fullurl = "/WsEcl2/tabview/query/" + pathval + "/" + queryval;
  540. gomain(fullurl);
  541. }
  542. }
  543. };
  544. function treeLoadFolderDataFromXml(ntparent, xfolder, expandlist)
  545. {
  546. var xchildren = xfolder.childNodes;
  547. for(var i = 0; i < xchildren.length; i++)
  548. {
  549. var xchild = xchildren[i];
  550. if (xchild.nodeName=="Link")
  551. {
  552. var ntnode = new YAHOO.widget.TextNode({label: xchild.getAttribute("name")}, ntparent);
  553. ntnode.isLeaf = true;
  554. var pathval = xchild.getAttribute("navpath");
  555. if (!pathval || pathval=="")
  556. pathval = xchild.getAttribute("path");
  557. ntnode.data = {
  558. myNodeId: xchild.getAttribute("name"),
  559. title: xchild.getAttribute("name"),
  560. elementType:'Link',
  561. params: xchild.getAttribute("params"),
  562. navpath: pathval
  563. };
  564. }
  565. else if (xchild.nodeName=="DynamicFolder")
  566. {
  567. var ntnode = new YAHOO.widget.TextNode({label: xchild.getAttribute("name")}, ntparent);
  568. ntnode.data = { elementType:'DynamicFolder', params: xchild.getAttribute("params") };
  569. if (expandlist)
  570. expandlist.push(ntnode);
  571. }
  572. else if (xchild.nodeName=="Folder")
  573. {
  574. var ntnode = new YAHOO.widget.TextNode({label: xchild.getAttribute("name"), expanded: true}, ntparent);
  575. ntnode.data = { elementType: 'Folder', params: '', myNodeId: xchild.getAttribute("name") };
  576. ntnode.setNodesProperty("propagateHighlightUp",false);
  577. ntnode.setNodesProperty("propagateHighlightDown",false);
  578. treeLoadFolderDataFrom(ntnode, xchild)
  579. }
  580. }
  581. }
  582. function buildTree(xmlNav)
  583. {
  584. tree = new YAHOO.widget.TreeView("espNavObj");
  585. tree.subscribe('dblClickEvent',function(oArgs) { ImportFromTree(oArgs.Node);});
  586. // By default, trees with TextNodes will fire an event for when the label is clicked:
  587. tree.subscribe("labelClick", onNodeClick);
  588. tree.locked = false;
  589. tree.singleNodeHighlight=true;
  590. var ntroot = tree.getRoot();
  591. tree.setDynamicLoad(loadNodeData, currentIconMode);
  592. tree.subscribe("clickEvent", onTreeClick);
  593. var expandlist = new Array();
  594. treeLoadFolderDataFromXml(ntroot, xmlNav, expandlist);
  595. tree.render();
  596. for (var exp=0; exp<expandlist.length; exp++)
  597. {
  598. expandlist[exp].expand();
  599. }
  600. }
  601. function addNavMenuItemdata(menuitemdata, xmltag)
  602. {
  603. var children = xmltag.childNodes;
  604. for(var i = 0; i < children.length; i++)
  605. {
  606. if (children[i].nodeName=="Link")
  607. {
  608. menuitemdata[i]={text: children[i].getAttribute("name"), url: children[i].getAttribute("path"), target: "main"};
  609. }
  610. else if (children[i].nodeName=="Folder")
  611. {
  612. var childdata = new Array();
  613. addNavMenuItems(childdata, children[i]);
  614. menuitemdata[i]={
  615. text: children[i].getAttribute('name'),
  616. submenu: {
  617. id: children[i].getAttribute('name'),
  618. iframe: true,
  619. itemdata: childdata
  620. }
  621. };
  622. }
  623. }
  624. }
  625. function addNavMenuSubmenuItems(xmltag)
  626. {
  627. var children = xmltag.childNodes;
  628. var ai=0;
  629. for(var i = 0; i < children.length; i++)
  630. {
  631. if (children[i].nodeName=="Folder")
  632. {
  633. var childdata = new Array();
  634. addNavMenuItemdata(childdata, children[i]);
  635. navMenu.addItem({
  636. text: children[i].getAttribute('name'),
  637. iframe: true,
  638. submenu: {
  639. id: children[i].getAttribute('name'),
  640. iframe: true,
  641. itemdata: childdata
  642. }
  643. });
  644. }
  645. else if (children[i].nodeName=="Link")
  646. {
  647. navMenu.addItem({
  648. text: children[i].getAttribute("name"),
  649. url: children[i].getAttribute("path"),
  650. target: "main"
  651. });
  652. }
  653. }
  654. }
  655. function buildNavMenu(xmlNav)
  656. {
  657. navMenu = new YAHOO.widget.Menu("espNavObj", { iframe: true, position: "static", hidedelay: 750, lazyload: true});
  658. addNavMenuSubmenuItems(xmlNav);
  659. navMenu.render();
  660. navMenu.show();
  661. }
  662. function loadNavRootData()
  663. {
  664. //prepare URL for XHR request:
  665. var sUrl = "/esp/nav?rawxml_";
  666. //prepare our callback object
  667. var navroot_callback = {
  668. success: function(oResponse) {
  669. var xmlDoc = oResponse.responseXML;
  670. var xroot = xmlDoc.documentElement;
  671. viewtype = xroot.getAttribute("viewType");
  672. if (viewtype && (viewtype=="wsecl_tree"||viewtype=="yuitree"))
  673. buildTree(xroot);
  674. else
  675. buildNavMenu(xroot);
  676. },
  677. failure: function(oResponse) {
  678. oResponse.argument.fnLoadComplete();
  679. },
  680. argument: {
  681. }
  682. };
  683. YAHOO.util.Connect.asyncRequest('GET', sUrl, navroot_callback);
  684. }
  685. function loadNavUnit()
  686. {
  687. //prepare URL for XHR request:
  688. var sUrl = "/esp/nav?rawxml_";
  689. //prepare our callback object
  690. var navunit_callback = {
  691. success: function(oResponse) {
  692. var xmlDoc = oResponse.responseXML;
  693. var xroot = xmlDoc.documentElement;
  694. var appname = xroot.getAttribute("appName");
  695. viewtype = xroot.getAttribute("viewType");
  696. var inner = getURLParameter("inner");
  697. if (inner!="")
  698. start_page = inner;
  699. else
  700. start_page = xroot.getAttribute("start_page");
  701. if (start_page && start_page!="" && start_page!="/")
  702. {
  703. var cloc = parent.frames['main'].location;
  704. if (cloc.href=="about:blank" || cloc.pathname=="" || cloc.pathname=='/')
  705. {
  706. gomain(start_page);
  707. }
  708. }
  709. if (appname && appname!="")
  710. writeESPappname(appname);
  711. if (viewtype && (viewtype=="wsecl_tree"||viewtype=="yuitree"))
  712. {
  713. leftcfg={ position: 'left', width: 240, resize: true, body: 'left1',
  714. gutter: '0px', collapse: true, close: true, useShim: true,
  715. scroll: true, zIndex: 2
  716. };
  717. }
  718. else
  719. {
  720. leftcfg ={ position: 'left', width: 150, resize: false, body: 'left1',
  721. gutter: '0px', useShim: true, collapse: false, close: true,
  722. collapseSize: 25, scroll: null, animate: true, zIndex: 2
  723. };
  724. }
  725. layout.addUnit(leftcfg);
  726. loadNavRootData();
  727. },
  728. failure: function(oResponse) {
  729. oResponse.argument.fnLoadComplete();
  730. },
  731. argument: {
  732. }
  733. };
  734. YAHOO.util.Connect.asyncRequest('GET', sUrl, navunit_callback);
  735. }
  736. </script>
  737. </body>
  738. </html>