OpenAboutCognosAction.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Glass
  5. *| (C) Copyright IBM Corp. 2020, 2021
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or disclosure
  8. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *+------------------------------------------------------------------------+
  10. */
  11. define([
  12. 'baglass/core-client/js/core-client/ui/core/Class',
  13. 'underscore',
  14. 'jquery',
  15. '../../nls/StringResources',
  16. 'text!../views/templates/AboutDialog.html',
  17. 'doT',
  18. 'bi/commons/utils/Utils',
  19. 'require-css!css/ca_portal/aboutDialog'
  20. ], function(Class, _, $, StringResources, template, dot, Utils) {
  21. var OpenAboutCognosAction = Class.extend({
  22. init: function(options) {
  23. OpenAboutCognosAction.inherited('init', this, arguments);
  24. _.extend(this, options);
  25. },
  26. canExecute: function() {
  27. return true;
  28. },
  29. doAction: function(context) {
  30. return this._showTheAboutDialog(context);
  31. },
  32. _options: function(productVersion, kitVersion) {
  33. return {
  34. aboutCognosAnalytics: StringResources.get('legalText', { 'year': new Date().getFullYear() }),
  35. cognosLabel: StringResources.get('productName', {
  36. version: productVersion
  37. }),
  38. kitVersion: kitVersion
  39. };
  40. },
  41. _showTheAboutDialog: function(context) {
  42. return context.glassContext.getCoreSvc('.Config').getProductVersion().then(function(productVersion) {
  43. var html = dot.template(template || '')(this._options(productVersion, context.glassContext.versionInfo));
  44. return context.glassContext.appController.showMessage(html, '', 'info', ['close'], '399px', undefined, true, 'aboutDialog').then(function(dialog) {
  45. var $dlg = $(dialog._queryId);
  46. $dlg.find('.dialogCloseX').remove();
  47. var $dialogHeader = $dlg.find('.dialogHeader');
  48. var $dialogHeaderContents = $dlg.find('.aboutDialogAnalyticsLogo').children();
  49. var $dialogTitle = $dlg.find('.dialogTitle');
  50. $dlg.find('.logoText').attr('id', $dialogTitle.attr('id'));
  51. $dialogTitle.removeAttr('id');
  52. $dialogHeader.addClass('aboutDialogHeader');
  53. $dialogHeaderContents.detach();
  54. $dialogHeader.find('header').addClass('aboutDialogAnalyticsLogo').append($dialogHeaderContents);
  55. Utils.setIcon($dlg.find('.aboutDialogAnalyticsLogo').find('.logoImage'), 'common-CA_Avatar_Colour_24');
  56. });
  57. }.bind(this));
  58. }
  59. });
  60. return OpenAboutCognosAction;
  61. });