123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- /*
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: SHARE
- *
- * (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([
- 'jquery',
- 'bi/sharecommon/utils/simpledoT',
- 'q',
- 'bi/schedule/views/DeliveryPickerView',
- 'bi/sharecommon/utils/translator',
- 'bi/commons/utils/Utils',
- 'bootstrap'
- ], function($, dot, Q, DeliveryPickerView, t, Utils) {
- 'use strict';
- /* deliveryOptions look like:
- * {
- * "save": {
- * "notify": false
- * },
- * "email": {
- * "emailAsAttachment": false,
- * "emailAsURL": false,
- * "subject": "blah",
- * "memoPart": "this is the body",
- * "to": [],
- * "cc": [],
- * "bcc": []
- * }
- * mobile: {
- * to: []
- * }
- * print: {
- * printer: ""
- * }
- * }
- */
- var __SLIDEOUT_PRESET_WIDTH = '350px';
-
- var scheduleDeliveryPickerView = DeliveryPickerView.extend({
-
- init: function(options) {
- $.extend(this, options);
- scheduleDeliveryPickerView.inherited('init', this, arguments);
-
- if(options.slideoutparent == undefined) {
- throw "Error: slideoutparent parameter must be provided.";
- }
-
- this.isVisible = false;
- this.slideout = null;
- },
- render: function() {
- // in update mode the permissions are passed
- if ( this.hasPermission && !this.hasPermission.write && this.hasPermission.read ) {
- this.$toggler.prop('disabled', true);
- }
- this._setEvents();
-
- // Initially update the "delivery" area in the main pane
- if(this.$activeOptionsContainer) {
- this.updateActiveDeliveryList(this.$activeOptionsContainer);
- }
- },
-
- _setEvents: function() {
- this.$toggler.on('primaryaction', function(event) {
- this._showDeliveryOptions();
- }.bind(this));
- },
-
- _setpanelContent: function() {
- var allowRecipients = typeof this.allowRecipients === "function" ? this.allowRecipients() : true;
-
- var deliveryContent = this.getDeliveryContent(allowRecipients);
- this.$panelContent = $(deliveryContent);
- },
-
- _showDeliveryOptions: function(){
- this.isVisible = true;
- this._setpanelContent();
- this.slideout = this.glassContext.appController.showSlideOut({
- 'parent': this.slideoutparent,
- 'overlay': this.overlay,
- 'width': __SLIDEOUT_PRESET_WIDTH,
- 'enableTabLooping': true,
- 'label': t.translate('schedule_delivery_picker_name'),
- 'content': {
- 'module': 'bi/schedule/views/OptionsSlideoutView',
- 'content': this.$panelContent,
- 'title': t.translate("schedule_delivery_label"),
- 'closeCallback': function() {
- this._close();
- }.bind(this),
- 'setUpCallback': function(content) {
- this.setDeliveryOptions(content, this.$activeOptionsContainer);
- }.bind(this)
- }
- });
-
- },
-
- _close: function() {
- this.isVisible = false;
-
- // clear event handler for editor dialogs and remove editor dialogs
- if($('body').hasClass('editorHideHandlerSet')) {
- $('body').removeClass('editorHideHandlerSet');
-
- $('body').off( ".ckeditorDialog" );
-
- var editorDialogs = $('body').find('.cke_reset_all');
- var editorDialogBg = $('body').find('.cke_dialog_background_cover');
-
- editorDialogs.remove();
- editorDialogBg.remove();
- }
-
- this.close();
- }
- });
- return scheduleDeliveryPickerView;
- });
|