GlossaryAction.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 2013
  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. /**
  13. * GlossaryAction - implements IBM business glossary in cognos viewer
  14. */
  15. function GlossaryAction(){}
  16. GlossaryAction.prototype = new CognosViewerAction();
  17. /**
  18. * Execute the IBM business glossary request
  19. */
  20. GlossaryAction.prototype.execute = function()
  21. {
  22. var cognosViewer = this.getCognosViewer();
  23. cognosViewer.loadExtra();
  24. var selectionController = cognosViewer.getSelectionController();
  25. var selectionList = selectionController.getAllSelectedObjects();
  26. if(selectionList.length > 0)
  27. {
  28. var config = null;
  29. if(typeof MDSRV_CognosConfiguration != "undefined")
  30. {
  31. config = new MDSRV_CognosConfiguration();
  32. var glossaryURI = "";
  33. if(cognosViewer.envParams["glossaryURI"])
  34. {
  35. glossaryURI = cognosViewer.envParams["glossaryURI"];
  36. }
  37. config.addProperty("glossaryURI", glossaryURI);
  38. config.addProperty("gatewayURI", cognosViewer.getGateway());
  39. }
  40. var searchPath = cognosViewer.envParams["ui.object"];
  41. var sSelectionContext = getViewerSelectionContext(selectionController, new CSelectionContext(searchPath));
  42. var glossaryHelper = new MDSRV_BusinessGlossary(config, sSelectionContext);
  43. glossaryHelper.open();
  44. }
  45. };
  46. GlossaryAction.prototype.updateMenu = function(jsonSpec)
  47. {
  48. if (!this.getCognosViewer().bCanUseGlossary) {
  49. return "";
  50. }
  51. var bContext = this.selectionHasContext();
  52. if (!bContext || this.getCognosViewer().envParams["glossaryURI"] == null || this.getCognosViewer().envParams["glossaryURI"] == "")
  53. {
  54. jsonSpec.disabled = true;
  55. }
  56. else
  57. {
  58. jsonSpec.disabled = false;
  59. }
  60. return jsonSpec;
  61. };