GotoAction.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 2012
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or
  8. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *|
  10. *+------------------------------------------------------------------------+
  11. */
  12. function GotoAction(){}
  13. GotoAction.prototype = new CognosViewerAction();
  14. GotoAction.prototype.execute = function()
  15. {
  16. var drillManager = this.m_oCV.getDrillMgr();
  17. drillManager.launchGoToPage();
  18. };
  19. GotoAction.prototype.updateMenu = function(jsonSpec)
  20. {
  21. var items = [];
  22. var drillTargetSpecifications = this.m_oCV.getDrillTargets();
  23. var drillManager = this.m_oCV.getDrillMgr();
  24. var aAuthoredDrillThroughTargets = drillManager.getAuthoredDrillThroughTargets();
  25. if(aAuthoredDrillThroughTargets.length > 0)
  26. {
  27. var sAuthoredDrillThroughTargets = "<AuthoredDrillTargets>";
  28. for(var iIndex = 0; iIndex < aAuthoredDrillThroughTargets.length; ++iIndex)
  29. {
  30. sAuthoredDrillThroughTargets += eval('"' + aAuthoredDrillThroughTargets[iIndex] + '"');
  31. }
  32. sAuthoredDrillThroughTargets += "</AuthoredDrillTargets>";
  33. var authoredDrillAction = this.m_oCV.getAction("AuthoredDrill");
  34. var rvDrillTargetsNode = authoredDrillAction.getAuthoredDrillThroughContext(sAuthoredDrillThroughTargets, drillTargetSpecifications);
  35. var drillTargets = rvDrillTargetsNode.childNodes;
  36. if(drillTargets.length > 0)
  37. {
  38. for(var index = 0; index < drillTargets.length; ++index)
  39. {
  40. var drillTarget = drillTargets[index];
  41. var sIconClass = this.getTargetReportIconClass(drillTarget);
  42. var sLabel = drillTarget.getAttribute("label");
  43. items.push({ name: "AuthoredDrill", label: sLabel, iconClass: sIconClass, action: { name: "AuthoredDrill", payload: XMLBuilderSerializeNode(drillTarget) }, items: null });
  44. }
  45. }
  46. }
  47. if(items.length > 0)
  48. {
  49. items.push({separator: true});
  50. }
  51. // related links
  52. var relatedDisabled = false;
  53. if(this.m_oCV.getSelectionController() == null || this.m_oCV.getSelectionController().getModelDrillThroughEnabled() == false)
  54. {
  55. relatedDisabled = true;
  56. }
  57. items.push({ name: "Goto", disabled: relatedDisabled, label: RV_RES.RV_MORE, iconClass: "", action: { name: "Goto", payload: "" }, items: null });
  58. if (this.m_oCV.isIWidgetMobile()) {
  59. jsonSpec.flatten = "true";
  60. }
  61. jsonSpec.items = items;
  62. return jsonSpec;
  63. };
  64. GotoAction.prototype.getTargetReportIconClass = function(drillTarget)
  65. {
  66. var sIconClass = "";
  67. var sMethod = drillTarget.getAttribute("method");
  68. switch(sMethod)
  69. {
  70. case "edit":
  71. sIconClass = "editContent";
  72. break;
  73. case "execute":
  74. sIconClass = "runReport"; //"/ps/portal/images/action_run.gif";
  75. break;
  76. case "view":
  77. var sOutputFormat = drillTarget.getAttribute("outputFormat");
  78. switch(sOutputFormat)
  79. {
  80. case "HTML":
  81. case "XHTML":
  82. case "HTMLFragment":
  83. sIconClass = "html";
  84. break;
  85. case "PDF":
  86. sIconClass = "pdf";
  87. break;
  88. case "XML":
  89. sIconClass = "xml";
  90. break;
  91. case "CSV":
  92. sIconClass = "csv";
  93. break;
  94. case "XLS":
  95. sIconClass = "excel2000";
  96. break;
  97. case "SingleXLS":
  98. sIconClass = "excelSingleSheet";
  99. break;
  100. case "XLWA":
  101. sIconClass = "excel2002";
  102. break;
  103. case "spreadsheetML":
  104. sIconClass = "excel2007";
  105. break;
  106. case "xlsxData":
  107. sIconClass = "excel2007";
  108. break;
  109. }
  110. break;
  111. }
  112. return sIconClass;
  113. };