| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 | 
							- "use strict";
 
- /*
 
-  * Licensed Materials - Property of IBM
 
-  * 
 
-  * IBM Cognos Products: ADMIN
 
-  * 
 
-  * (C) Copyright IBM Corp. 2015, 2016
 
-  * 
 
-  * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 
-  */
 
- define(['bi/glass/core/Class', 'bi/admin/nls/StringResource', 'bi/schedule/service/service'], function (Class, StringResource, shareService) {
 
-   'use strict';
 
-   var ContextMenuButtonView = Class.extend({
 
-     shareService: shareService,
 
-     onSelectItem: function onSelectItem(context) {
 
-       var options = {
 
-         context: context,
 
-         launchPoint: context.target.plugin.activeObject.currentTarget
 
-       };
 
-       var idTokens = context.target.itemId.split('.');
 
-       var key = idTokens[idTokens.length - 1];
 
-       if (key === "update") {
 
-         this._updateSubscriptionMenuItem(options);
 
-       } else if (key === "versions") {
 
-         this._viewVersionsOfSubscriptionMenuItem(options);
 
-       } else if (key === "delete") {
 
-         this._deleteSubscriptionMenuItem(options);
 
-       }
 
-     },
 
-     isItemVisible: function isItemVisible(context) {
 
-       /* var idTokens = context.target.itemId.split('.');
 
-        var key = idTokens[idTokens.length - 1];
 
-        if(key === "update" || key === "versions" || key === "delete") {
 
-            return true;
 
-        } else {
 
-            return false;
 
-        }*/
 
-       return true;
 
-     },
 
-     _showSubscriptionPane: function _showSubscriptionPane(glassContext, descriptor, launchPoint, callback) {
 
-       var content = {
 
-         'module': 'bi/schedule/views/SubscriptionView',
 
-         'glassContext': glassContext,
 
-         'descriptor': descriptor
 
-       };
 
-       if (callback !== undefined) {
 
-         content.callback = callback;
 
-       }
 
-       glassContext.appController.showSlideOut({
 
-         'position': 'right',
 
-         'content': content,
 
-         'width': "400px",
 
-         'enableTabLooping': true,
 
-         'label': StringResource.get('subscription_header_region'),
 
-         'launchPoint': launchPoint
 
-       });
 
-     },
 
-     _updateSubscriptionMenuItem: function _updateSubscriptionMenuItem(options) {
 
-       var subscriptionId = options.context.target.activeObject.subscriptionId;
 
-       var updateCallback = options.context.target.activeObject.updateCallback;
 
-       this.shareService.getSubscriptionDetails(subscriptionId, options.context.glassContext).then(function (data) {
 
-         this._showSubscriptionPane(options.context.glassContext, data, options.launchPoint, {
 
-           onUpdate: updateCallback
 
-         });
 
-       }.bind(this));
 
-     },
 
-     _showVersionsPane: function _showVersionsPane(glassContext, properties, launchPoint) {
 
-       var content = {
 
-         'module': 'bi/content_apps/VersionsView',
 
-         'glassContext': glassContext,
 
-         'objectInformation': properties.data[0]
 
-       };
 
-       glassContext.appController.showSlideOut({
 
-         'position': 'right',
 
-         'content': content,
 
-         'width': '350px',
 
-         'enableTabLooping': true,
 
-         'label': StringResource.get('schedule_subscription_version_aria_label'),
 
-         'launchPoint': launchPoint
 
-       });
 
-     },
 
-     _viewVersionsOfSubscriptionMenuItem: function _viewVersionsOfSubscriptionMenuItem(options) {
 
-       var subscriptionId = options.context.target.activeObject.subscriptionId;
 
-       this.shareService.getObjectProperties(subscriptionId, options.context.glassContext).then(function (properties) {
 
-         this._showVersionsPane(options.context.glassContext, properties, options.launchPoint);
 
-       }.bind(this));
 
-     },
 
-     _deleteSubscriptionMenuItem: function _deleteSubscriptionMenuItem(options) {
 
-       var subscriptionId = options.context.target.activeObject.subscriptionId;
 
-       var deleteCallbacks = options.context.target.activeObject.deleteCallbacks;
 
-       var $subscriptionRow = $(options.context.target.activeObject.currentTarget).closest('tr');
 
-       var deleteOptions = {
 
-         subscriptionId: subscriptionId,
 
-         pending: true
 
-       };
 
-       if (options.context.glassContext.services.userProfile.preferences.accessibilityFeatures) {
 
-         options.context.glassContext.appController.showMessage(StringResource.get('delete_subscription_confirm_message'), StringResource.get('delete_confirm'), 'info', ['ok', 'cancel'], undefined, function (evt) {
 
-           if (evt.btn === 'ok') {
 
-             deleteCallbacks.hideRow($subscriptionRow).done(function () {
 
-               deleteCallbacks.complete(deleteOptions);
 
-             }); //set focus to "Enabled" table header
 
-             $("table.subscriptions_list_table thead tr th").eq(0).focus();
 
-           } else {
 
-             //set the focus back to the chevron that was clicked
 
-             $(options.launchPoint).focus();
 
-           }
 
-         }.bind(this));
 
-       } else {
 
-         deleteCallbacks.hideRow($subscriptionRow); //set focus to "Enabled" table header
 
-         $("table.subscriptions_list_table thead tr th").eq(0).focus();
 
-         options.context.glassContext.appController.showToast(StringResource.get('delete_sub_message'), {
 
-           'type': 'info',
 
-           'btnLabel': StringResource.get('delete_undo'),
 
-           'callback': function callback() {
 
-             deleteOptions.pending = false;
 
-             deleteCallbacks.undoDelete($subscriptionRow);
 
-           },
 
-           'newestOnTop': true,
 
-           'preventDuplicates': false,
 
-           'timeOut': 6000,
 
-           'extendedTimeOut': 1000,
 
-           'onHidden': function onHidden() {
 
-             deleteCallbacks.complete(deleteOptions);
 
-           }
 
-         });
 
-       }
 
-     }
 
-   });
 
-   return ContextMenuButtonView;
 
- });
 
 
  |