1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2018
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['jquery', '../../../lib/@waca/core-client/js/core-client/ui/dialogs/BaseDialog'], function ($, BaseDialog) {
- var Dialog = null;
- Dialog = BaseDialog.extend({
- init: function init(url, successCheck, okHandler, cancelHandler) {
- Dialog.inherited('init', this);
- this.url = url;
- this.successCheck = successCheck;
- this.okHandler = okHandler;
- this.cancelHandler = cancelHandler;
- },
- show: function show() {
- var nContainer = this._container();
- if (nContainer.length) {
- nContainer.empty();
- var styles = { width: window.innerWidth - 50, height: window.innerHeight - 50 };
- var content = this.renderContent($('<div>', { 'class': 'dialogContent dialogCenter' }).css(styles));
- nContainer.append($('<div>', {
- 'class': 'modalDialog',
- 'tabIndex': '0',
- 'role': 'dialog'
- }).append(content));
- }
- },
- renderContent: function renderContent(n) {
- this.$dialog = $('<iframe>', { 'class': 'iFrameContent' });
- this.$dialog.on('load', this._onDialogLoad.bind(this));
- $('body').append(this.$dialog);
- this.$dialog.attr('src', this.url);
- n.append(this.$dialog);
- return n;
- },
- _onDialogLoad: function _onDialogLoad() {
- var loc = this.$dialog[0].contentWindow.location.href;
- if (loc && loc.indexOf(this.successCheck) !== -1) {
- this.hide();
- this.okHandler();
- $('document').remove(this.$dialog);
- this.$dialog = null;
- }
- }
- });
- return Dialog;
- });
- //# sourceMappingURL=IframeDialog.js.map
|