ui.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. /****************************************************************
  2. ** Licensed Materials - Property of IBM
  3. **
  4. ** BI and PM: qs
  5. **
  6. ** (C) Copyright IBM Corp. 2001, 2015
  7. **
  8. ** US Government Users Restricted Rights - Use, duplication or
  9. ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *****************************************************************/
  11. // Copyright (C) 2008 Cognos ULC, an IBM Company. All Rights Reserved.
  12. // Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated) in the United States and/or other countries. IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, or other countries, or both. Other company, product, or service names may be trademarks or service marks of others.
  13. var menuPaneMinSize = 30;
  14. var menuPaneMinNSOpenSize = 106;
  15. function redrawLayers()
  16. {
  17. if (gsUiAction == 'new')
  18. {
  19. changeMenu('insert');
  20. }
  21. else
  22. {
  23. changeMenu('edit');
  24. }
  25. showPreview(false);
  26. showDialogFrame(0);
  27. changeNavigationLinks(false,false,false,false);
  28. };
  29. function showPreview(bShow)
  30. {
  31. if (bShow)
  32. {
  33. document.getElementById("previewTopTable").style.display = (document.all ? "inline" : "table");
  34. document.getElementById("previewBottomTable").style.display = (document.all ? "inline" : "table");
  35. document.getElementById("previewTopFrame").className = "previewBody";
  36. document.getElementById("previewBottomFrame").className = "previewBody";
  37. document.getElementById("previewTopFrame").style.height = "30px";
  38. document.getElementById("previewBottomFrame").style.height = "30px";
  39. }
  40. else
  41. {
  42. document.getElementById("previewTopTable").style.display = "none";
  43. document.getElementById("previewBottomTable").style.display = "none";
  44. document.getElementById("previewTopFrame").className = "previewBodyClosed";
  45. document.getElementById("previewBottomFrame").className = "previewBodyClosed";
  46. document.getElementById("previewTopFrame").style.height = "0px";
  47. document.getElementById("previewBottomFrame").style.height = "0px";
  48. }
  49. };
  50. function changeNavigationLinks(bPrevious, bNext, bLeft, bRight)
  51. {
  52. if (bPrevious === null || bNext === null || bLeft === null || bRight === null)
  53. {
  54. return;
  55. }
  56. document.getElementById("first_active").style.display = (bPrevious) ? ((document.all) ? "inline" : "table-cell") : "none";
  57. document.getElementById("first_inactive").style.display = (!bPrevious) ? ((document.all) ? "inline" : "table-cell") : "none";
  58. document.getElementById("prev_active").style.display = (bPrevious) ? ((document.all) ? "inline" : "table-cell") : "none";
  59. document.getElementById("prev_inactive").style.display = (!bPrevious) ? ((document.all) ? "inline" : "table-cell") : "none";
  60. document.getElementById("next_active").style.display = (bNext) ? ((document.all) ? "inline" : "table-cell") : "none";
  61. document.getElementById("next_inactive").style.display = (!bNext) ? ((document.all) ? "inline" : "table-cell") : "none";
  62. document.getElementById("last_active").style.display = (bNext) ? ((document.all) ? "inline" : "table-cell") : "none";
  63. document.getElementById("last_inactive").style.display = (!bNext) ? ((document.all) ? "inline" : "table-cell") : "none";
  64. if (!bPrevious)
  65. {
  66. cfgSet("StartRow", 1);
  67. }
  68. cfgSet("navigationLinksValues", bPrevious + "," + bNext + "," + bLeft + "," + bRight);
  69. if (bPrevious || bNext)
  70. {
  71. document.getElementById("navLinksFrame").style.display = (document.all) ? "inline" : "table-cell";
  72. document.getElementById("navLinksFrame").style.height = "19px";
  73. }
  74. else
  75. {
  76. document.getElementById("navLinksFrame").style.display = "none";
  77. }
  78. };
  79. function setMenuResizeDirection(direction)
  80. {
  81. cfgSet("MenuResizeDirection", direction);
  82. };
  83. function resizeMenuPane(evt, bEventInReportFrame)
  84. {
  85. if (typeof cfgGet == "function" && cfgGet("RESIZING_MENU_PANE"))
  86. {
  87. var m = null;
  88. if (cfgGet("MenuResizeDirection") == "ns")
  89. {
  90. m = document.getElementById("informationTDContainer");
  91. if (!m)
  92. {
  93. return;
  94. }
  95. if (getQSCookie('qs', 'in') === 0)
  96. {
  97. return;
  98. }
  99. getMenuPaneSize("ns");
  100. if (document.all)
  101. {
  102. size = document.body.offsetHeight - evt.y;
  103. }
  104. else
  105. {
  106. size = document.body.offsetHeight - evt.pageY;
  107. }
  108. if (size < menuPaneMinNSOpenSize)
  109. {
  110. size = menuPaneMinNSOpenSize;
  111. }
  112. if (size > menuPaneMinNSOpenSize + 100)
  113. {
  114. size = menuPaneMinNSOpenSize + 100;
  115. }
  116. resizeMenuPaneToSize("ns", size, true);
  117. }
  118. else
  119. {
  120. m = document.getElementById("menuFrame");
  121. if (!m)
  122. {
  123. return;
  124. }
  125. getMenuPaneSize("ew");
  126. if(!bEventInReportFrame)
  127. {
  128. size = 0;
  129. }
  130. if (document.all)
  131. {
  132. size += evt.x;
  133. }
  134. else
  135. {
  136. size += evt.pageX;
  137. }
  138. if (size < 100)
  139. {
  140. size = 100;
  141. }
  142. if (size > 500)
  143. {
  144. size = 500;
  145. }
  146. resizeMenuPaneToSize("ew", size, true);
  147. }
  148. renderInformation(false, true);
  149. autoSetMetadataContainerHeight();
  150. }
  151. };
  152. function getMenuPaneSize(menu)
  153. {
  154. var size = 0;
  155. var m = null;
  156. if (menu == "ns")
  157. {
  158. m = document.getElementById("informationTDContainer");
  159. size = parseInt(m.style.height);
  160. if (size === null || isNaN(size))
  161. {
  162. size = menuPaneMinSize;
  163. }
  164. }
  165. else
  166. {
  167. m = document.getElementById("menuFrame");
  168. size = parseInt(m.style.width);
  169. if (size === null || isNaN(size))
  170. {
  171. size = 200;
  172. }
  173. }
  174. return size;
  175. };
  176. function resizeMenuPaneToSize(menu, size, setCookie)
  177. {
  178. var m = null;
  179. if (menu == "ns")
  180. {
  181. m = document.getElementById("informationTDContainer");
  182. m.style.height = size + "px";
  183. if (setCookie)
  184. {
  185. setQSCookie('qs', 'msns', size);
  186. }
  187. }
  188. else
  189. {
  190. m = document.getElementById("menuFrame");
  191. cfgSet("MenuSize", size);
  192. m.style.width = size + "px";
  193. if (setCookie)
  194. {
  195. setQSCookie('qs', 'ms', size);
  196. }
  197. }
  198. };
  199. function enableResize(bEnable)
  200. {
  201. cfgSet('RESIZING_MENU_PANE', bEnable);
  202. if (cfgGet("lastMenu") == "insert")
  203. {
  204. var treePane = document.getElementById('metadataTreeOuterPane');
  205. if (treePane !== null)
  206. {
  207. if (bEnable)
  208. {
  209. if (treePane.scrollLeft > 0)
  210. {
  211. cfgSet('MENU_PANE_SCROLL_X',treePane.scrollLeft);
  212. }
  213. if (treePane.scrollTop > 0)
  214. {
  215. cfgSet('MENU_PANE_SCROLL_Y',treePane.scrollTop);
  216. }
  217. }
  218. else
  219. {
  220. if (cfgGet('MENU_PANE_SCROLL_X') != null)
  221. {
  222. treePane.scrollLeft = cfgGet('MENU_PANE_SCROLL_X');
  223. cfgRemove('MENU_PANE_SCROLL_X');
  224. }
  225. if (cfgGet('MENU_PANE_SCROLL_Y') != null)
  226. {
  227. treePane.scrollTop = cfgGet('MENU_PANE_SCROLL_Y');
  228. cfgRemove('MENU_PANE_SCROLL_Y');
  229. }
  230. }
  231. }
  232. }
  233. };
  234. function collapseMenu(url)
  235. {
  236. setQSCookie('qs', 'mn', 0);
  237. changeMenu('closed');
  238. document.getElementById("menuFrame").style.width = menuPaneMinSize + "px";
  239. };
  240. function expandMenu()
  241. {
  242. setQSCookie('qs', 'mn', 1);
  243. var size = cfgGet("MenuSize");
  244. if (size === null || isNaN(size))
  245. {
  246. size = 200;
  247. cfgSet("MenuSize");
  248. }
  249. changeMenu(cfgGet("lastMenu"));
  250. document.getElementById("menuFrame").style.width = size + "px";
  251. };
  252. function changeMenu(alias)
  253. {
  254. if (alias == null)
  255. {
  256. alias = 'edit';
  257. }
  258. if (alias != 'closed')
  259. {
  260. cfgSet("lastMenu", alias);
  261. }
  262. if (document.all)
  263. {
  264. var allTables = document.getElementsByTagName("TABLE");
  265. for (var i = 0; i < allTables.length; i++)
  266. {
  267. if (allTables[i].getAttribute("name") == "metadata_menu_panel")
  268. {
  269. allTables[i].style.display = "none";
  270. }
  271. }
  272. }
  273. else
  274. {
  275. var allMenuPanels = document.getElementsByName("metadata_menu_panel");
  276. for (var i = 0; i < allMenuPanels.length; i++)
  277. {
  278. allMenuPanels[i].style.display = "none";
  279. }
  280. }
  281. if (document.all)
  282. {
  283. document.getElementById('metadata_menu_' + alias).style.display = "block";
  284. }
  285. else
  286. {
  287. document.getElementById('metadata_menu_' + alias).style.display = "table";
  288. }
  289. if (alias == 'insert')
  290. {
  291. if (cfgSize("CalcFns") == 0)
  292. {
  293. fetchMetadataFunctionList("initial");
  294. }
  295. autoSetMetadataContainerHeight();
  296. }
  297. };
  298. function redrawSelf()
  299. {
  300. var previewType = getPreviewType();
  301. var previewTitleTop = document.getElementById("previewTitleTop");
  302. if (previewTitleTop)
  303. {
  304. while (previewTitleTop.hasChildNodes())
  305. {
  306. previewTitleTop.removeChild(previewTitleTop.firstChild);
  307. }
  308. previewTitleTop.appendChild(document.createTextNode(previewType=="none" ? runnodata_string : runlimited_string));
  309. }
  310. var previewTitleBottom = document.getElementById("previewTitleBottom");
  311. if (previewTitleBottom)
  312. {
  313. while (previewTitleBottom.hasChildNodes())
  314. {
  315. previewTitleBottom.removeChild(previewTitleBottom.firstChild);
  316. }
  317. previewTitleBottom.appendChild(document.createTextNode(previewType=="none" ? runnodata_string : runlimited_string));
  318. }
  319. };
  320. function setWindowTitle()
  321. {
  322. var fileName = cfgGet("ReportName");
  323. if ( fileName != null )
  324. {
  325. fileName = fileName.replace(/\.xml$/gi,"");
  326. }
  327. var captionText = "";
  328. try
  329. {
  330. if (fileName==null || fileName=="")
  331. {
  332. if (cfgGet("NewReport") == null)
  333. {
  334. document.title = windowTitle_string;
  335. }
  336. else
  337. {
  338. document.title = newFilename_string + " - " + windowTitle_string;
  339. captionText = windowTitle_string + " - " + newFilename_string;
  340. }
  341. }
  342. else
  343. {
  344. document.title = fileName + " - " + windowTitle_string;
  345. captionText = windowTitle_string + " - " + fileName;
  346. }
  347. }
  348. catch (e)
  349. {
  350. }
  351. var ac = document.getElementById("applicationCaption");
  352. if (ac)
  353. {
  354. while (ac.hasChildNodes())
  355. {
  356. ac.removeChild(ac.firstChild);
  357. }
  358. var newText = document.createTextNode(captionText);
  359. ac.appendChild(newText);
  360. }
  361. };
  362. function initQSUI()
  363. {
  364. setWindowTitle();
  365. var size = getQSCookie('qs', 'ms');
  366. if (size == null || isNaN(size))
  367. {
  368. size = 200;
  369. }
  370. document.getElementById("menuFrame").style.width = size + "px";
  371. cfgSet("MenuSize", size);
  372. cfgSet("InformationTableHeight", document.getElementById("informationTableContainer").style.height);
  373. if (getQSCookie('qs', 'in') == 1)
  374. {
  375. size = getQSCookie('qs', 'msns');
  376. if (size == null || isNaN(size) || size < menuPaneMinNSOpenSize)
  377. {
  378. size = menuPaneMinNSOpenSize;
  379. setQSCookie('qs', 'msns', menuPaneMinNSOpenSize);
  380. }
  381. else if (size >= menuPaneMinNSOpenSize)
  382. {
  383. document.getElementById("nsResizeBar").style.display = "block";
  384. if (document.all)
  385. {
  386. document.getElementById("informationContentContainer").style.display = "inline";
  387. }
  388. else
  389. {
  390. document.getElementById("informationContentContainer").style.display = "table-cell";
  391. }
  392. }
  393. }
  394. else
  395. {
  396. size = menuPaneMinSize;
  397. document.getElementById("informationTableContainer").style.height = "auto";
  398. }
  399. document.getElementById("informationTDContainer").style.height = size + "px";
  400. redrawLayers();
  401. gQsToolbar.draw();
  402. if (typeof gStyleToolbar != 'undefined')
  403. {
  404. gStyleToolbar.draw();
  405. }
  406. if (getQSCookie('qs', 'tb') == 0)
  407. {
  408. gQsToolbar.hideBar();
  409. }
  410. if (getQSCookie('qs', 'st') == 0)
  411. {
  412. gStyleToolbar.hideBar();
  413. }
  414. if (getQSCookie('qs', 'mn') == 0)
  415. {
  416. collapseMenu();
  417. }
  418. if (getQSCookie('qs', 'in') == 1)
  419. {
  420. toggleInformation();
  421. }
  422. goApplicationManager.getFeatureManager().registerFeatures();
  423. if (typeof unloadQS === "function")
  424. {
  425. if (window.attachEvent)
  426. {
  427. window.attachEvent("onunload", unloadQS);
  428. }
  429. else if (window.addEventListener)
  430. {
  431. window.addEventListener("unload", unloadQS, false);
  432. }
  433. }
  434. if (window.attachEvent)
  435. {
  436. window.attachEvent("onresize", autoSetMetadataContainerHeight);
  437. }
  438. else
  439. {
  440. window.addEventListener("resize", autoSetMetadataContainerHeight, false);
  441. }
  442. autoSetMetadataContainerHeight();
  443. };
  444. function closeLink(bForceCloseWindow, sUrl)
  445. {
  446. if (typeof sUrl === "string")
  447. {
  448. gsUiBackURL = sUrl;
  449. }
  450. if ( (typeof bForceCloseWindow == "undefined" || bForceCloseWindow == null || !bForceCloseWindow || bForceCloseWindow == "noCancel") && goApplicationManager.get("reportHasChanged") === true)
  451. {
  452. dlgReset();
  453. if (bForceCloseWindow == "noCancel")
  454. {
  455. dlgSetParm("xxNoCancel", "true");
  456. }
  457. dlgSetParm("m", "/" + qs_dir + "/leavingQS.xts");
  458. dlgSubmit(null, false, true);
  459. }
  460. else
  461. {
  462. releaseMetadataRequest();
  463. if (goApplicationManager)
  464. {
  465. var oCVQS = goApplicationManager.getReportManager().getCVObj();
  466. if (oCVQS)
  467. {
  468. oCVQS.exit(null);
  469. }
  470. }
  471. window.onbeforeunload = null;
  472. if (gsUiBackURL == null || gsUiBackURL == "")
  473. {
  474. setTimeout("window.close();", 100);
  475. }
  476. else
  477. {
  478. setTimeout("location.replace(gsUiBackURL);", 100);
  479. }
  480. window.onbeforeunload = null;
  481. if (gsUiBackURL == null || gsUiBackURL == "")
  482. {
  483. setTimeout("window.close();", 100);
  484. }
  485. else
  486. {
  487. setTimeout("location.replace(gsUiBackURL);", 100);
  488. }
  489. }
  490. };
  491. function unloadQS()
  492. {
  493. if (goApplicationManager && cfgGet("LAST_ACTION") != "logoff")
  494. {
  495. releaseMetadataRequest();
  496. var oCVQS = goApplicationManager.getReportManager().getCVObj();
  497. if (oCVQS)
  498. {
  499. oCVQS.exit(null);
  500. }
  501. }
  502. };
  503. function hideDialogs()
  504. {
  505. hideDialogFrame();
  506. };
  507. function bannerHelp(cmd)
  508. {
  509. switch(cmd)
  510. {
  511. case 'help':
  512. goApplicationManager.getFeatureManager().launchFeature('Help');
  513. break;
  514. case 'gettingstarted':
  515. gotoHelp(goApplicationManager.get("productLocale"), "wig_cr_a", "");
  516. break;
  517. case 'cogonweb':
  518. window.open("http://www-01.ibm.com/software/analytics/cognos");
  519. break;
  520. case 'welcome':
  521. bannerHome(goApplicationManager.get("scriptEngine") + "?b_action=xts.run&m=portal/welcome/welcome.xts");
  522. break;
  523. case 'about':
  524. goApplicationManager.getFeatureManager().launchFeature('About');
  525. break;
  526. default:
  527. break;
  528. }
  529. };
  530. function bannerHome(sUrl)
  531. {
  532. sUrl = sUrl.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'").replace(/&amp;/g, "&");
  533. closeLink(false, sUrl);
  534. };
  535. function initLogonMenu(iAvailableNamespaces,iTraversableNamespaces,bIsAnonymous)
  536. {
  537. var sLogoffString = cfgGet("gsLogoffString");
  538. var sLogonString = cfgGet("gsLogonString");
  539. var sGateway = cfgGet("gsGateway");
  540. var sApp = cfgGet("gsApp");
  541. var sSkinFolder = cfgGet("gsSkinFolder");
  542. var sWebRoot = cfgGet("gsWebRoot");
  543. var sBrandFolder = sSkinFolder + "/branding";
  544. var bIsLoggedOut = (bIsAnonymous || (iTraversableNamespaces == 0));
  545. var bCanLogin = (iAvailableNamespaces !== iTraversableNamespaces);
  546. var oAuthContainer = document.getElementById("authOptionContainerDiv");
  547. var oTopToolbarLogon = null;
  548. if (oAuthContainer)
  549. {
  550. var oTopToolbarLogonStyle = new CUIStyle('bannerOptionsButtonNormal', 'bannerOptionsButtonNormal', 'bannerOptionsButtonNormal', 'bannerOptionsButtonNormal', 'bannerOptionsButtonNormal', 'bannerOptionsButtonNormal');
  551. var oTopMenuItemLogonStyle = new CUIStyle('bannerOptions', 'bannerOptions', 'bannerOptions', 'bannerOptions', 'bannerOptions');
  552. var oTopToolbarLogonFlyoutMenu = new CUIStyle('bannerOptionsButtonNormal', 'bannerOptionsButtonOver', 'bannerOptionsButtonNormal', 'bannerOptionsButtonNormal','bannerOptionsButtonNormal', 'bannerOptionsButtonNormal');
  553. oTopToolbarLogon = new CBar('authOptionContainerDiv', oTopToolbarLogonStyle, null, sWebRoot + '/common/images/toolbar/', '', '', 'qs', 'tt');
  554. oTopToolbarLogon.setMenuType(cHorizonalBar);
  555. if (bCanLogin && ! bIsLoggedOut)
  556. {
  557. var logonMenuItem = new CMenuItem(oTopToolbarLogon, sLogonString, 'cfgSet("LAST_ACTION", "logon");pptFaultHandler();', sWebRoot + '/common/images/spacer.gif', oTopMenuItemLogonStyle, sWebRoot, sSkinFolder);
  558. var menuIcon = logonMenuItem.getIcon();
  559. menuIcon.setWidth(1);
  560. logonMenuItem = new CMenuItem(oTopToolbarLogon, '', '', '', oTopToolbarLogonFlyoutMenu, sWebRoot, sSkinFolder);
  561. menuIcon = logonMenuItem.getIcon();
  562. menuIcon.setWidth(7);
  563. var oTopToolbarLogonMenu = logonMenuItem.createDropDownMenu(gMenuStyle, '');
  564. logonMenuItem = new CMenuItem(oTopToolbarLogonMenu, sLogonString, 'cfgSet("LAST_ACTION", "logon");pptFaultHandler();', sBrandFolder + '/tools_logon.gif', gMenuItemStyle, sWebRoot, sSkinFolder);
  565. logonMenuItem = new CMenuItem(oTopToolbarLogonMenu, sLogoffString, 'cfgSet("LAST_ACTION", "logoff");bannerHome("' + sGateway + '?b_action=xts.run&m=' + sApp + '/logoff.xts&h_CAM_action=logoff");', sBrandFolder + '/tools_logoff.gif', gMenuItemStyle, sWebRoot, sSkinFolder);
  566. }
  567. else if (bIsLoggedOut)
  568. {
  569. logonMenuItem = new CMenuItem(oTopToolbarLogon, sLogonString, 'cfgSet("LAST_ACTION", "logon");pptFaultHandler();', "", oTopMenuItemLogonStyle, sWebRoot, sSkinFolder);
  570. }
  571. else
  572. {
  573. logonMenuItem = new CMenuItem(oTopToolbarLogon, sLogoffString, 'cfgSet("LAST_ACTION", "logoff");bannerHome("' + sGateway + '?b_action=xts.run&m=' + sApp + '/logoff.xts&h_CAM_action=logoff");', '', oTopMenuItemLogonStyle, sWebRoot, sSkinFolder);
  574. }
  575. oTopToolbarLogon.draw();
  576. }
  577. return oTopToolbarLogon;
  578. };
  579. function CToolbarNotification()
  580. {
  581. };
  582. CToolbarNotification.prototype.update = function (e)
  583. {
  584. if (typeof e != "undefined" && canUseQueryStudioAdvancedMode)
  585. {
  586. var selections = e.getSelections();
  587. var fontFamElt = document.getElementById("fontFamily");
  588. var fontSizeElt = document.getElementById("fontSize");
  589. var boldElt = document.getElementById("tbbuttonbold");
  590. var italicElt = document.getElementById("tbbuttonitalic");
  591. var underlineElt = document.getElementById("tbbuttonunderline");
  592. if (selections.length > 0)
  593. {
  594. var stylesArr = getStylesFromAllSelectedCols();
  595. stylesArr = stylesArr.concat(getStylesFromAllSelectedReportElements());
  596. var singleStylesArr = mergeStyles(stylesArr, true);
  597. var fontFamValue = "";
  598. if (singleStylesArr[2] != -1 && singleStylesArr[2] != "" && singleStylesArr[2] != null)
  599. {
  600. fontFamValue = singleStylesArr[2];
  601. }
  602. var i = 0;
  603. if (fontFamValue != "")
  604. {
  605. for (i = 0; i < fontFamElt.options.length; i++)
  606. {
  607. if (fontFamElt.options[i].value == fontFamValue)
  608. {
  609. fontFamElt.selectedIndex = i;
  610. break;
  611. }
  612. }
  613. }
  614. else
  615. {
  616. fontFamElt.selectedIndex = 0;
  617. }
  618. var fontSizeValue = "";
  619. if (singleStylesArr[3] != -1 && singleStylesArr[3] != "" && singleStylesArr[3] != null)
  620. {
  621. fontSizeValue = singleStylesArr[3];
  622. }
  623. if (fontSizeValue != "")
  624. {
  625. for (i = 0; i < fontSizeElt.options.length; i++)
  626. {
  627. if (fontSizeElt.options[i].value == fontSizeValue)
  628. {
  629. fontSizeElt.selectedIndex = i;
  630. break;
  631. }
  632. }
  633. }
  634. else
  635. {
  636. fontSizeElt.selectedIndex = 0;
  637. }
  638. if (singleStylesArr[0] != -1 && singleStylesArr[0] != "" && singleStylesArr[0] != "normal" && singleStylesArr[0] != null)
  639. {
  640. boldElt.tbItem.pressed();
  641. }
  642. else if (boldElt !== null)
  643. {
  644. boldElt.tbItem.reset();
  645. }
  646. if (singleStylesArr[1] != -1 && singleStylesArr[1] != "" && singleStylesArr[1] != "normal" && singleStylesArr[1] != null)
  647. {
  648. italicElt.tbItem.pressed();
  649. }
  650. else if (italicElt !== null)
  651. {
  652. italicElt.tbItem.reset();
  653. }
  654. if (singleStylesArr[6] != -1 && singleStylesArr[6] != "" && singleStylesArr[6] != null)
  655. {
  656. underlineElt.tbItem.pressed();
  657. }
  658. else if (underlineElt !== null)
  659. {
  660. underlineElt.tbItem.reset();
  661. }
  662. if (typeof colorColor !== "undefined")
  663. {
  664. if (singleStylesArr[4] != -1 && singleStylesArr[4] != "" && singleStylesArr[4] != null)
  665. {
  666. colorColor.setActiveColor(singleStylesArr[4]);
  667. }
  668. else
  669. {
  670. colorColor.setActiveColor('');
  671. }
  672. }
  673. if (typeof backgroundColorPicker !== "undefined")
  674. {
  675. if (singleStylesArr[5] != -1 && singleStylesArr[5] != "" && singleStylesArr[5] != null)
  676. {
  677. backgroundColorPicker.setActiveColor(singleStylesArr[5]);
  678. }
  679. else
  680. {
  681. backgroundColorPicker.setActiveColor('');
  682. }
  683. }
  684. var horizAlign = singleStylesArr[9];
  685. var vertAlign = singleStylesArr[10];
  686. var align = cssToAlignCode(horizAlign, vertAlign);
  687. if (typeof alignmentPicker !== "undefined")
  688. {
  689. alignmentPicker.setActiveAlignment(align);
  690. }
  691. }
  692. else
  693. {
  694. if (fontFamElt !== null)
  695. {
  696. fontFamElt.selectedIndex = 0;
  697. }
  698. if (fontSizeElt !== null)
  699. {
  700. fontSizeElt.selectedIndex = 0;
  701. }
  702. if (boldElt !== null)
  703. {
  704. boldElt.tbItem.reset();
  705. }
  706. if (italicElt !== null)
  707. {
  708. italicElt.tbItem.reset();
  709. }
  710. if (underlineElt !== null)
  711. {
  712. underlineElt.tbItem.reset();
  713. }
  714. if (typeof colorColor !== "undefined" && colorColor.m_oPicker!==null)
  715. {
  716. colorColor.setActiveColor('');
  717. }
  718. if (typeof backgroundColorPicker !== "undefined" && backgroundColorPicker.m_oPicker!==null)
  719. {
  720. backgroundColorPicker.setActiveColor('');
  721. }
  722. if (typeof alignmentPicker !== "undefined" && alignmentPicker.m_oPicker!=null)
  723. {
  724. alignmentPicker.setActiveAlignment('');
  725. }
  726. }
  727. }
  728. };
  729. var toolbarNotifier = new CToolbarNotification();
  730. function defaultCloseLinkButton(evt)
  731. {
  732. if(evt != null)
  733. {
  734. var goDialogManager = new CDialogManager();
  735. if(!goDialogManager.isSpaceOrEnterKeyEvent(evt))
  736. {
  737. return;
  738. }
  739. }
  740. this.closeLink(true);
  741. };
  742. function promptCloseLinkButton(evt)
  743. {
  744. if(evt != null)
  745. {
  746. var goDialogManager = new CDialogManager();
  747. if(!goDialogManager.isSpaceOrEnterKeyEvent(evt))
  748. {
  749. return;
  750. }
  751. }
  752. this.closeLink('noCancel');
  753. };
  754. function setMetadataContainerHeight(size)
  755. {
  756. if (isNaN(size))
  757. {
  758. return;
  759. }
  760. var oMetadataTreeOuterPane = document.getElementById("metadataTreeOuterPane");
  761. oMetadataTreeOuterPane.style.height = size;
  762. };
  763. function getMetadataContainerHeight()
  764. {
  765. return parseInt(document.getElementById("metadataTreeOuterPane").style.height);
  766. };
  767. function autoSetMetadataContainerHeight()
  768. {
  769. var iBottomPadding = 10;
  770. var oMetadataMenuContainer = document.getElementById("menuContent");
  771. var oInformationContainer = document.getElementById("informationTDContainer");
  772. var iInsertButtonHeight = 30;
  773. if (oInformationContainer && oMetadataMenuContainer)
  774. {
  775. var oMetadataTreeOuterPane = document.getElementById("metadataTreeOuterPane");
  776. oMetadataTreeOuterPane.style.height = "100px";
  777. var iMenuHeight = oMetadataMenuContainer.offsetHeight;
  778. var iBottomElementsHeight = iInsertButtonHeight + oInformationContainer.offsetHeight + iBottomPadding;
  779. var iNewMetadataTreeHeight = iMenuHeight - iBottomElementsHeight;
  780. if (iMenuHeight && iBottomElementsHeight && iNewMetadataTreeHeight > 0)
  781. {
  782. oMetadataTreeOuterPane.style.height = iNewMetadataTreeHeight + "px";
  783. }
  784. }
  785. };