diff --git a/test/documenteditor/main/index.html b/test/documenteditor/main/index.html index a203ed37c..9e591c035 100644 --- a/test/documenteditor/main/index.html +++ b/test/documenteditor/main/index.html @@ -129,8 +129,6 @@ - - diff --git a/test/documenteditor/main/js/ApplicationController.js b/test/documenteditor/main/js/ApplicationController.js index 9ad6f906f..4ff7a740f 100644 --- a/test/documenteditor/main/js/ApplicationController.js +++ b/test/documenteditor/main/js/ApplicationController.js @@ -42,7 +42,7 @@ DE.ApplicationController = new(function(){ ttOffset = [0, -10], appOptions = {}, btnSubmit, - _submitFail, $submitedTooltip, $requiredTooltip, + _submitFail, $submitedTooltip, $listControlMenu, listControlItems = [], listObj, bodyWidth = 0; @@ -67,19 +67,11 @@ DE.ApplicationController = new(function(){ function loadConfig(data) { config = $.extend(config, data.config); - embedConfig = $.extend(embedConfig, data.config.embedded); - common.controller.modals.init(embedConfig); - - // Docked toolbar - if (embedConfig.toolbarDocked === 'bottom') { - $('#editor_sdk').addClass('bottom'); - } else { $('#editor_sdk').addClass('top'); - } - config.canBackToFolder = (config.canBackToFolder!==false) && config.customization && config.customization.goback && - (config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose); + /*config.canBackToFolder = (config.canBackToFolder!==false) && config.customization && config.customization.goback && + (config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose);*/ } function loadDocument(data) { @@ -115,10 +107,11 @@ DE.ApplicationController = new(function(){ docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(config.encryptionKeys); - var enable = !config.customization || (config.customization.macros!==false); + /*var enable = !config.customization || (config.customization.macros!==false); docInfo.asc_putIsEnabledMacroses(!!enable); enable = !config.customization || (config.customization.plugins!==false); - docInfo.asc_putIsEnabledPlugins(!!enable); + docInfo.asc_putIsEnabledPlugins(!!enable);*/ + var type = /^(?:(pdf|djvu|xps))$/.exec(docConfig.fileType); if (type && typeof type[1] === 'string') { @@ -137,11 +130,6 @@ DE.ApplicationController = new(function(){ function onCountPages(count) { maxPages = count; - $('#pages').text(me.textOf + " " + count); - } - - function onCurrentPage(number) { - //$('#page-number').val(number + 1); } function onLongActionBegin(type, id) { @@ -388,11 +376,11 @@ DE.ApplicationController = new(function(){ api.asc_registerCallback('asc_onPrint', onPrint); api.asc_registerCallback('asc_onPrintUrl', onPrintUrl); api.asc_registerCallback('sync_onAllRequiredFormsFilled', onFillRequiredFields); - if (appOptions.canFillForms) { + /*if (appOptions.canFillForms) { api.asc_registerCallback('asc_onShowContentControlsActions', onShowContentControlsActions); api.asc_registerCallback('asc_onHideContentControlsActions', onHideContentControlsActions); api.asc_SetHighlightRequiredFields(true); - } + }*/ Common.Gateway.on('processmouse', onProcessMouse); Common.Gateway.on('downloadas', onDownloadAs); @@ -439,17 +427,17 @@ DE.ApplicationController = new(function(){ var licType = params.asc_getLicenseType(); appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); - appOptions.canFillForms = appOptions.canLicense && (permissions.fillForms===true) && (config.mode !== 'view'); + //appOptions.canFillForms = appOptions.canLicense && (permissions.fillForms===true) && (config.mode !== 'view'); appOptions.canSubmitForms = appOptions.canLicense && (typeof (config.customization) == 'object') && !!config.customization.submitForm; - api.asc_setViewMode(!appOptions.canFillForms); + //api.asc_setViewMode(!appOptions.canFillForms); + //api.asc_setViewMode(false); + /*if (appOptions.canFillForms) {*/ - if (appOptions.canFillForms) { - - api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); - api.asc_SetFastCollaborative(true); + //api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); + //api.asc_SetFastCollaborative(true); api.asc_setAutoSaveGap(1); - } + /*}*/ onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); api.asc_LoadDocument(); @@ -468,7 +456,7 @@ DE.ApplicationController = new(function(){ $('#id-critical-error-close').text(me.txtClose).off().on('click', function(){ window.location.reload(); }); - $('#id-critical-error-dialog').css('z-index', 20002).modal('show'); + //$('#id-critical-error-dialog').css('z-index', 20002).modal('show'); return; } @@ -660,7 +648,7 @@ DE.ApplicationController = new(function(){ window["flat_desine"] = true; api = new Asc.asc_docs_api({ 'id-view' : 'editor_sdk', - 'embedded' : true + 'embedded' : true/**/ }); if (api){ @@ -669,8 +657,7 @@ DE.ApplicationController = new(function(){ api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_registerCallback('asc_onCountPages', onCountPages); -// api.asc_registerCallback('OnCurrentVisiblePage', onCurrentPage); - api.asc_registerCallback('asc_onCurrentPage', onCurrentPage); + // Initialize api gateway Common.Gateway.on('init', loadConfig); diff --git a/test/unit-tests/common/main/lib/controller/modals.js b/test/unit-tests/common/main/lib/controller/modals.js deleted file mode 100644 index d8802955a..000000000 --- a/test/unit-tests/common/main/lib/controller/modals.js +++ /dev/null @@ -1,143 +0,0 @@ -/* - * - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -+function () { - !window.common && (window.common = {}); - !common.controller && (common.controller = {}); - - common.controller.modals = new(function() { - var $dlgShare, $dlgEmbed; - var appConfig; - var embedCode = '', - minEmbedWidth = 400, - minEmbedHeight = 600; - - function copytext(el, event) { - el.select(); - if ( !document.execCommand('copy') ) { - window.alert('Browser\'s error! Use keyboard shortcut [Ctrl] + [C]'); - } - } - - var createDlgShare = function () { - $dlgShare = common.view.modals.create('share'); - - var _encoded = encodeURIComponent(appConfig.shareUrl); - var _mailto = 'mailto:?subject=I have shared a document with you: ' + appConfig.docTitle + '&body=I have shared a document with you: ' + _encoded; - - $dlgShare.find('#btn-copyshort').on('click', copytext.bind(this, $dlgShare.find('#id-short-url'))); - $dlgShare.find('.share-buttons > span').on('click', function(e){ - var _url; - switch ($(e.target).attr('data-name')) { - case 'facebook': - _url = 'https://www.facebook.com/sharer/sharer.php?u=' + appConfig.shareUrl + '&t=' + encodeURI(appConfig.docTitle); - window.open(_url, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600'); - break; - case 'twitter': - _url = 'https://twitter.com/share?url='+ _encoded; - !!appConfig.docTitle && (_url += encodeURIComponent('&text=' + appConfig.docTitle)); - window.open(_url, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600'); - break; - case 'email': - window.open(_mailto, '_self'); - break; - } - }); - - $dlgShare.find('#id-short-url').val(appConfig.shareUrl); - $dlgShare.find('.share-buttons > #email.autotest').attr('data-test', _mailto); - }; - - var createDlgEmbed =function () { - $dlgEmbed = common.view.modals.create('embed'); - - var txtembed = $dlgEmbed.find('#txt-embed-url'); - txtembed.text(embedCode.replace('{embed-url}', appConfig.embedUrl).replace('{width}', minEmbedWidth).replace('{height}', minEmbedHeight)); - $dlgEmbed.find('#btn-copyembed').on('click', copytext.bind(this, txtembed)); - $dlgEmbed.find('#txt-embed-width, #txt-embed-height').on({ - 'keypress': function(e){ - if (e.keyCode == 13) - updateEmbedCode(); - } - , 'focusout': function(e){ - updateEmbedCode(); - } - }); - }; - - function updateEmbedCode(){ - var $txtwidth = $dlgEmbed.find('#txt-embed-width'); - var $txtheight = $dlgEmbed.find('#txt-embed-height'); - var newWidth = parseInt($txtwidth.val()), - newHeight = parseInt($txtheight.val()); - - if (newWidth < minEmbedWidth) - newWidth = minEmbedWidth; - - if (newHeight < minEmbedHeight) - newHeight = minEmbedHeight; - - $dlgEmbed.find('#txt-embed-url').text(embedCode.replace('{embed-url}', appConfig.embedUrl).replace('{width}', newWidth).replace('{height}', newHeight)); - - $txtwidth.val(newWidth + 'px'); - $txtheight.val(newHeight + 'px'); - } - - var attachToView = function(config) { - if ( config.share && !!appConfig.shareUrl ) { - if ( !$dlgShare ) { - createDlgShare(); - } - - $(config.share).on('click', function(e){ - $dlgShare.modal('show'); - }); - } - - if ( config.embed && !!appConfig.embedUrl ) { - if ( !$dlgEmbed ) { - createDlgEmbed(); - } - - $(config.embed).on('click', function(e) { - $dlgEmbed.modal('show'); - }) - } - }; - - return { - init: function(config) { appConfig = config; } - , attach: attachToView - }; - }); -}(); \ No newline at end of file diff --git a/test/unit-tests/common/main/lib/view/modals.js b/test/unit-tests/common/main/lib/view/modals.js deleted file mode 100644 index 8f9c9760d..000000000 --- a/test/unit-tests/common/main/lib/view/modals.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * (c) Copyright Ascensio System SIA 2010-2019 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * -*/ - -!window.common && (window.common = {}); -!common.view && (common.view = {}); -common.view.modals = new(function() { - var tplDialog = '
'; - - var _tplbody_share = ' ' + - ' '; - - var _tplbody_embed = '