editTitle.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. function setupDialog()
  14. {
  15. var oAppFrame = goDialogManager.getApplicationFrame();
  16. var oMQMgr = goDialogManager.getMiniQueryManager();
  17. var oTitleArea = oMQMgr.getElementsByTagName("TitleArea");
  18. var bTitleAreaSet = false;
  19. var oTitle = null;
  20. var oSubtitle = null;
  21. var oFilters = null;
  22. var oSorts = null;
  23. var oSuppress = null;
  24. var sReportTitle = "";
  25. var sReportSubTitle = "";
  26. if (typeof oTitleArea == "object")
  27. {
  28. oTitleArea = oTitleArea[0];
  29. oTitle = oMQMgr.getElementsByTagName("Title", oTitleArea);
  30. oSubtitle = oMQMgr.getElementsByTagName("Subtitle", oTitleArea);
  31. if(typeof oTitle == "object")
  32. bTitleAreaSet = true;
  33. oFilters = oMQMgr.getElementsByTagName("Filters", oTitleArea);
  34. if (typeof oFilters == "object")
  35. {
  36. oFilters = oFilters[0];
  37. }
  38. oSorts = oMQMgr.getElementsByTagName("Sorts", oTitleArea);
  39. if (typeof oSorts == "object")
  40. {
  41. oSorts = oSorts[0];
  42. }
  43. oSuppress = oMQMgr.getElementsByTagName("Suppress", oTitleArea);
  44. if (typeof oSuppress === "object")
  45. {
  46. oSuppress = oSuppress[0];
  47. }
  48. }
  49. if(typeof oTitle != "object" || typeof oTitleArea != "object")
  50. {
  51. var report=goDialogManager.getWindowManager().getReportFrame();
  52. var spanObjects=report.document.getElementsByTagName("span");
  53. for(var i=0;i<spanObjects.length;i++)
  54. {
  55. var item=spanObjects.item(i);
  56. var value= item.getAttribute("lid");
  57. if(value!==null && value=="reportTitleQS")
  58. {
  59. if(item.innerText)
  60. sReportTitle=item.innerText;
  61. else
  62. sReportTitle=item.textContent;
  63. }
  64. if(value!==null && value=="reportSubtitleQS")
  65. {
  66. if(item.innerText)
  67. sReportSubTitle=item.innerText;
  68. else
  69. sReportSubTitle=item.textContent;
  70. }
  71. }
  72. }
  73. if (oTitle === null)
  74. {
  75. if(sReportTitle=="")
  76. sReportTitle = goDialogManager.getApplicationManager().get("reportTitleDefault");
  77. }
  78. else
  79. {
  80. var idxTitles;
  81. for (idxTitles = 0; idxTitles < oTitle.length; idxTitles++)
  82. {
  83. if (oTitle[idxTitles].getAttribute("locale") == goDialogManager.getApplicationManager().get("contentLocale"))
  84. {
  85. if (oTitle[idxTitles].getAttribute("value") !== null)
  86. {
  87. sReportTitle = oTitle[idxTitles].getAttribute("value");
  88. }
  89. break;
  90. }
  91. }
  92. if (sReportTitle === "")
  93. {
  94. for (idxTitles = 0; idxTitles < oTitle.length; idxTitles++)
  95. {
  96. if (oTitle[idxTitles].getAttribute("default") == "true")
  97. {
  98. if (oTitle[idxTitles].getAttribute("value") !== null)
  99. {
  100. sReportTitle = oTitle[idxTitles].getAttribute("value");
  101. }
  102. break;
  103. }
  104. }
  105. }
  106. }
  107. document.f.title_text.value = sReportTitle;
  108. if (bTitleAreaSet && typeof oSubtitle == "object")
  109. {
  110. var idxSubtitle;
  111. for (idxSubtitle = 0; idxSubtitle < oSubtitle.length; idxSubtitle++)
  112. {
  113. if (oSubtitle[idxSubtitle].getAttribute("locale") == goDialogManager.getApplicationManager().get("contentLocale"))
  114. {
  115. sReportSubTitle = oSubtitle[idxSubtitle].getAttribute("value");
  116. break;
  117. }
  118. }
  119. if (sReportSubTitle === "" || sReportSubTitle === null)
  120. {
  121. for (idxSubtitle = 0; idxSubtitle < oSubtitle.length; idxSubtitle++)
  122. {
  123. if (oSubtitle[idxSubtitle].getAttribute("default") == "true")
  124. {
  125. sReportSubTitle = oSubtitle[idxSubtitle].getAttribute("value");
  126. break;
  127. }
  128. }
  129. }
  130. if (sReportSubTitle === "" || sReportSubTitle === null)
  131. {
  132. sReportSubTitle = "";
  133. }
  134. }
  135. document.f.subtitle_text.value = sReportSubTitle;
  136. if (!bTitleAreaSet || (bTitleAreaSet && typeof oFilters == "object" && oFilters.getAttribute("showFilters") == "true"))
  137. {
  138. document.f.show_filters.checked = true;
  139. }
  140. if (!bTitleAreaSet || (bTitleAreaSet && typeof oSorts == "object" && oSorts.getAttribute("showSorts") == "true"))
  141. {
  142. document.f.show_sorts.checked = true;
  143. }
  144. if (!bTitleAreaSet || (typeof oSuppress == "object" && oSuppress.getAttribute("show") == "true"))
  145. {
  146. document.f.show_suppress.checked = true;
  147. }
  148. document.f.title_text.focus();
  149. };