From 37ee56347c5bc9e39a106e12ecfff651fa21d33f Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Fri, 13 Jan 2017 18:35:56 +0300 Subject: [PATCH] [SSE mobile] debug of deployment --- apps/spreadsheeteditor/mobile/app.js | 257 ++++++++++++++++++ .../mobile/index.html.deploy | 242 +++++++++++++++++ build/Gruntfile.js | 45 ++- build/spreadsheeteditor.json | 187 +++++++++---- 4 files changed, 658 insertions(+), 73 deletions(-) create mode 100644 apps/spreadsheeteditor/mobile/app.js create mode 100644 apps/spreadsheeteditor/mobile/index.html.deploy diff --git a/apps/spreadsheeteditor/mobile/app.js b/apps/spreadsheeteditor/mobile/app.js new file mode 100644 index 000000000..b221cc679 --- /dev/null +++ b/apps/spreadsheeteditor/mobile/app.js @@ -0,0 +1,257 @@ +/* + * + * (c) Copyright Ascensio System Limited 2010-2016 + * + * 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 Lubanas st. 125a-25, Riga, Latvia, + * EU, LV-1021. + * + * 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 + * + */ + +/** + * app.js + * + * Created by Maxim Kadushkin on 1/13/2017 + * Copyright (c) 2016 Ascensio System SIA. All rights reserved. + * + */ + +'use strict'; +var reqerr; +require.config({ + baseUrl: '../../', + paths: { + jquery : '../vendor/jquery/jquery', + underscore : '../vendor/underscore/underscore', + backbone : '../vendor/backbone/backbone', + framework7 : '../vendor/framework7/js/framework7', + text : '../vendor/requirejs-text/text', + xregexp : '../vendor/xregexp/xregexp-all-min', + sockjs : '../vendor/sockjs/sockjs.min', + jszip : '../vendor/jszip/jszip.min', + jsziputils : '../vendor/jszip-utils/jszip-utils.min', + jsrsasign : '../vendor/jsrsasign/jsrsasign-latest-all-min', + allfonts : '../../sdkjs/common/AllFonts', + sdk : '../../sdkjs/cell/sdk-all-min', + api : 'api/documents/api', + core : 'common/main/lib/core/application', + extendes : 'common/mobile/utils/extendes', + notification : 'common/main/lib/core/NotificationCenter', + analytics : 'common/Analytics', + gateway : 'common/Gateway', + locale : 'common/locale', + irregularstack : 'common/IrregularStack', + sharedsettings : 'common/mobile/utils/SharedSettings' + }, + + shim: { + framework7: { + exports: 'Framework7' + }, + underscore: { + exports: '_' + }, + sdk: { + deps: [ + 'jquery', + 'underscore', + 'allfonts', + 'xregexp', + 'sockjs', + 'jszip', + 'jsziputils', + 'jsrsasign' + ] + }, + backbone: { + deps: [ + 'underscore', + 'jquery' + ], + exports: 'Backbone' + }, + core: { + deps: [ + 'backbone', + 'notification', + 'irregularstack', + 'sharedsettings' + ] + } + } +}); + +require([ + 'backbone', + 'framework7', + 'core', + 'underscore', + 'extendes', + 'sdk', + 'api', + 'analytics', + 'gateway', + 'locale' +], function (Backbone, Framework7) { + Backbone.history.start(); + + /** + * Application instance with SSE namespace defined + */ + var app = new Backbone.Application({ + nameSpace: 'SSE', + autoCreate: false, + controllers : [ + 'Editor', + 'Toolbar', + 'Search', + 'CellEditor', + 'Main', + 'DocumentHolder' + ,'Statusbar' + ,'Settings' + ,'EditContainer' + ,'EditCell' + ,'EditText' + ,'EditImage' + ,'EditShape' + ,'EditChart' + ,'EditHyperlink' + ,'AddContainer' + ,'AddChart' + ,'AddFunction' + ,'AddShape' + ,'AddOther' + ,'AddLink' + ] + }); + + Common.Locale.apply(); + + var device = Framework7.prototype.device; + var loadPlatformCss = function (filename, opt){ + var fileref = document.createElement('link'); + fileref.setAttribute('rel', 'stylesheet'); + fileref.setAttribute('type', 'text/css'); + fileref.setAttribute('href', filename); + + if (typeof fileref != 'undefined') { + document.getElementsByTagName("head")[0].appendChild(fileref); + } + }; + + //Store Framework7 initialized instance for easy access + window.uiApp = new Framework7({ + // Default title for modals + modalTitle: 'ONLYOFFICE', + + // Enable tap hold events + tapHold: true, + + // If it is webapp, we can enable hash navigation: +// pushState: false, + + // If Android + material: device.android, + + // Hide and show indicator during ajax requests + onAjaxStart: function (xhr) { + uiApp.showIndicator(); + }, + onAjaxComplete: function (xhr) { + uiApp.hideIndicator(); + } + }); + + //Export DOM7 to local variable to make it easy accessable + window.$$ = Dom7; + + //Load platform styles + loadPlatformCss('resources/css/app-' + (device.android ? 'material' : 'ios') + '.css'); + + require([ + 'common/main/lib/util/LocalStorage', + 'common/main/lib/util/utils', + 'spreadsheeteditor/mobile/app/controller/Editor', + 'spreadsheeteditor/mobile/app/controller/Toolbar', + 'spreadsheeteditor/mobile/app/controller/Search', + 'spreadsheeteditor/mobile/app/controller/Main', + 'spreadsheeteditor/mobile/app/controller/DocumentHolder' + ,'spreadsheeteditor/mobile/app/controller/CellEditor' + ,'spreadsheeteditor/mobile/app/controller/Statusbar' + ,'spreadsheeteditor/mobile/app/controller/Settings' + ,'spreadsheeteditor/mobile/app/controller/edit/EditContainer' + ,'spreadsheeteditor/mobile/app/controller/edit/EditCell' + ,'spreadsheeteditor/mobile/app/controller/edit/EditText' + ,'spreadsheeteditor/mobile/app/controller/edit/EditImage' + ,'spreadsheeteditor/mobile/app/controller/edit/EditShape' + ,'spreadsheeteditor/mobile/app/controller/edit/EditChart' + ,'spreadsheeteditor/mobile/app/controller/edit/EditHyperlink' + ,'spreadsheeteditor/mobile/app/controller/add/AddContainer' + ,'spreadsheeteditor/mobile/app/controller/add/AddChart' + ,'spreadsheeteditor/mobile/app/controller/add/AddFunction' + ,'spreadsheeteditor/mobile/app/controller/add/AddShape' + ,'spreadsheeteditor/mobile/app/controller/add/AddOther' + ,'spreadsheeteditor/mobile/app/controller/add/AddLink' + ], function() { + app.start(); + }); +}, function(err) { + if (err.requireType == 'timeout' && !reqerr) { + var getUrlParams = function() { + var e, + a = /\+/g, // Regex for replacing addition symbol with a space + r = /([^&=]+)=?([^&]*)/g, + d = function (s) { return decodeURIComponent(s.replace(a, " ")); }, + q = window.location.search.substring(1), + urlParams = {}; + + while (e = r.exec(q)) + urlParams[d(e[1])] = d(e[2]); + + return urlParams; + }; + + var encodeUrlParam = function(str) { + return str.replace(/&/g, '&') + .replace(/"/g, '"') + .replace(/'/g, ''') + .replace(//g, '>'); + }; + + var lang = (getUrlParams()["lang"] || 'en').split("-")[0]; + + if ( lang == 'de') reqerr = 'Die Verbindung ist zu langsam, einige Komponenten konnten nicht geladen werden. Aktualisieren Sie bitte die Seite.'; + else if ( lang == 'es') reqerr = 'La conexión es muy lenta, algunos de los componentes no han podido cargar. Por favor recargue la página.'; + else if ( lang == 'fr') reqerr = 'La connexion est trop lente, certains des composants n\'ons pas pu être chargé. Veuillez recharger la page.'; + else if ( lang == 'ru') reqerr = 'Слишком медленное соединение, не удается загрузить некоторые компоненты. Пожалуйста, обновите страницу.'; + else reqerr = 'The connection is too slow, some of the components could not be loaded. Please reload the page.'; + + window.alert(reqerr); + window.location.reload(); + } +}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/index.html.deploy b/apps/spreadsheeteditor/mobile/index.html.deploy new file mode 100644 index 000000000..5e0639304 --- /dev/null +++ b/apps/spreadsheeteditor/mobile/index.html.deploy @@ -0,0 +1,242 @@ + + + + + + + + + + ONLYOFFICE Spreadsheet Editor + + + + + + + + + +
+ + + + diff --git a/build/Gruntfile.js b/build/Gruntfile.js index 214daf980..904c63292 100644 --- a/build/Gruntfile.js +++ b/build/Gruntfile.js @@ -3,6 +3,14 @@ module.exports = function(grunt) { defaultConfig, packageFile; + var copyright = '/*\n' + + ' * Copyright (c) Ascensio System SIA <%= grunt.template.today("yyyy") %>. All rights reserved\n' + + ' *\n' + + ' * <%= pkg.homepage %> \n' + + ' *\n' + + ' * Version: ' + process.env['PRODUCT_VERSION'] + ' (build:' + process.env['BUILD_NUMBER'] + ')\n' + + ' */\n'; + grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); @@ -176,13 +184,7 @@ module.exports = function(grunt) { concat: { options: { stripBanners: true, - banner: '/*\n' + - ' * Copyright (c) Ascensio System SIA <%= grunt.template.today("yyyy") %>. All rights reserved\n' + - ' *\n' + - ' * <%= pkg.homepage %> \n' + - ' *\n' + - ' * Version: ' + process.env['PRODUCT_VERSION'] + ' (build:' + process.env['BUILD_NUMBER'] + ')\n' + - ' */\n' + banner: copyright }, dist: { src: [packageFile['main']['js']['requirejs']['options']['out']], @@ -224,7 +226,7 @@ module.exports = function(grunt) { force: true }, 'deploy': packageFile['mobile']['clean']['deploy'], - 'template-backup': packageFile['mobile']['clean']['template-backup'], + 'template-backup': packageFile.mobile.copy['template-backup'][0].dest }, requirejs: { @@ -233,19 +235,14 @@ module.exports = function(grunt) { } }, - uglify: { + concat: { options: { - banner: '/*\n' + - ' * Copyright (c) Ascensio System SIA <%= grunt.template.today("yyyy") %>. All rights reserved\n' + - ' *\n' + - ' * <%= pkg.homepage %>\n' + - ' *\n' + - ' * Version: <%= pkg.version %> (build:<%= pkg.build %>)\n' + - ' */\n' + stripBanners: true, + banner: copyright }, - build: { - src: packageFile['mobile']['js']['src'], - dest: packageFile['mobile']['js']['dist'] + dist: { + src: packageFile.mobile.js.requirejs.options.out, + dest: packageFile.mobile.js.requirejs.options.out } }, @@ -302,13 +299,7 @@ module.exports = function(grunt) { uglify: { options: { - banner: '/*\n' + - ' * Copyright (c) Ascensio System SIA <%= grunt.template.today("yyyy") %>. All rights reserved\n' + - ' *\n' + - ' * <%= pkg.homepage %>\n' + - ' *\n' + - ' * Version: <%= pkg.version %> (build:<%= pkg.build %>)\n' + - ' */\n' + banner: copyright }, build: { src: packageFile['embed']['js']['src'], @@ -362,7 +353,7 @@ module.exports = function(grunt) { grunt.registerTask('deploy-requirejs', ['requirejs-init', 'clean', 'uglify']); grunt.registerTask('deploy-app-main', ['main-app-init', 'clean', 'imagemin', 'less', 'requirejs', 'concat', 'copy', 'replace:writeVersion']); - grunt.registerTask('deploy-app-mobile', ['mobile-app-init', 'clean:deploy', 'cssmin:styles', 'copy:template-backup', 'htmlmin', 'requirejs', 'copy:template-restore', 'clean:template-backup', 'copy:localization', 'copy:index-page', 'copy:images-app']); + grunt.registerTask('deploy-app-mobile', ['mobile-app-init', 'clean:deploy', 'cssmin:styles', 'copy:template-backup', 'htmlmin', 'requirejs', 'concat', 'copy:template-restore', 'clean:template-backup', 'copy:localization', 'copy:index-page', 'copy:images-app']); grunt.registerTask('deploy-app-embed', ['embed-app-init', 'clean:prebuild', 'uglify', 'less', 'copy', 'clean:postbuild']); diff --git a/build/spreadsheeteditor.json b/build/spreadsheeteditor.json index 4c3b797a5..ab3693590 100644 --- a/build/spreadsheeteditor.json +++ b/build/spreadsheeteditor.json @@ -1,7 +1,7 @@ { "name": "spreadsheeteditor", "version": "4.7.0", - "build": 878, + "build": 879, "homepage": "http://www.onlyoffice.com", "private": true, "sdk": { @@ -237,55 +237,150 @@ } }, "mobile": { - "clean": [ - "../deploy/web-apps/apps/spreadsheeteditor/mobile" - ], - "js": { - "src": [ - "../apps/common/Gateway.js", - "../apps/common/Analytics.js", - "../apps/common/mobile/loader.js", - "../apps/spreadsheeteditor/mobile/app/model/Worksheet.js", - "../apps/spreadsheeteditor/mobile/app/store/Worksheets.js", - "../apps/spreadsheeteditor/mobile/app/view/OpenCsvPanel.js", - "../apps/spreadsheeteditor/mobile/app/view/WorksheetList.js", - "../apps/spreadsheeteditor/mobile/app/view/Main.js", - "../apps/spreadsheeteditor/mobile/app/view/phone/toolbar/Search.js", - "../apps/spreadsheeteditor/mobile/app/view/phone/toolbar/View.js", - "../apps/spreadsheeteditor/mobile/app/view/phone/Main.js", - "../apps/spreadsheeteditor/mobile/app/view/tablet/toolbar/Search.js", - "../apps/spreadsheeteditor/mobile/app/view/tablet/toolbar/View.js", - "../apps/spreadsheeteditor/mobile/app/view/tablet/Main.js", - "../apps/spreadsheeteditor/mobile/app/controller/ApiEvents.js", - "../apps/spreadsheeteditor/mobile/app/controller/Document.js", - "../apps/spreadsheeteditor/mobile/app/controller/Search.js", - "../apps/spreadsheeteditor/mobile/app/controller/WorksheetList.js", - "../apps/spreadsheeteditor/mobile/app/controller/Main.js", - "../apps/spreadsheeteditor/mobile/app/controller/phone/Main.js", - "../apps/spreadsheeteditor/mobile/app/controller/tablet/Main.js", - "../apps/spreadsheeteditor/mobile/app/controller/toolbar/View.js", - "../apps/spreadsheeteditor/mobile/app/profile/Phone.js", - "../apps/spreadsheeteditor/mobile/app/profile/Tablet.js", - "../apps/common/locale.js", - "../apps/spreadsheeteditor/mobile/app.js" - ], - "dist": "../deploy/web-apps/apps/spreadsheeteditor/mobile/app-all.js" + "clean": { + "deploy": [ + "../deploy/web-apps/apps/spreadsheeteditor/mobile" + ] }, - "css": { - "normal": { - "src": [ - "../apps/spreadsheeteditor/mobile/resources/css/application-normal.css" - ], - "dist": "../deploy/web-apps/apps/spreadsheeteditor/mobile/resources/css/application-normal.css" - }, - "retina": { - "src": [ - "../apps/spreadsheeteditor/mobile/resources/css/application-retina.css" - ], - "dist": "../deploy/web-apps/apps/spreadsheeteditor/mobile/resources/css/application-retina.css" + "js": { + "requirejs": { + "options": { + "name": "../apps/spreadsheeteditor/mobile/app.js", + "out": "../deploy/web-apps/apps/spreadsheeteditor/mobile/app.js", + "baseUrl": "../apps/", + "inlineText": true, + "findNestedDependencies": true, + "preserveLicenseComments": false, + "optimizeAllPluginResources": true, + "paths": { + "jquery": "../vendor/jquery/jquery", + "underscore": "../vendor/underscore/underscore", + "backbone": "../vendor/backbone/backbone", + "framework7": "../vendor/framework7/js/framework7", + "text": "../vendor/requirejs-text/text", + "xregexp": "empty:", + "sockjs": "empty:", + "jszip": "empty:", + "jszip-utils": "empty:", + "jsrsasign": "empty:", + "coapisettings": "empty:", + "allfonts": "empty:", + "sdk": "empty:", + "api": "empty:", + "core": "common/main/lib/core/application", + "extendes": "common/mobile/utils/extendes", + "notification": "common/main/lib/core/NotificationCenter", + "localstorage": "common/main/lib/util/LocalStorage", + "analytics": "common/Analytics", + "gateway": "common/Gateway", + "locale": "common/locale", + "irregularstack": "common/IrregularStack", + "sharedsettings": "common/mobile/utils/SharedSettings" + }, + "shim": { + "framework7": { + "exports": "Framework7" + }, + "underscore": { + "exports": "_" + }, + "backbone": { + "deps": [ + "underscore", + "jquery" + ], + "exports": "Backbone" + }, + "notification": { + "deps": [ + "backbone" + ] + }, + "core": { + "deps": [ + "backbone", + "notification", + "irregularstack", + "sharedsettings" + ] + }, + "extendes": { + "deps": [ + "underscore", + "jquery", + "framework7" + ] + }, + "sdk": { + "deps": [ + "jquery", + "underscore", + "coapisettings", + "allfonts", + "xregexp", + "sockjs", + "jszip", + "jszip-utils", + "jsrsasign" + ] + }, + "gateway": { + "deps": [ + "jquery" + ] + }, + "analytics": { + "deps": [ + "jquery" + ] + } + } + } } }, + "css": { + "ios": { + "src": [ + "../apps/spreadsheeteditor/mobile/resources/css/app-ios.css" + ], + "dist": "../deploy/web-apps/apps/spreadsheeteditor/mobile/resources/css/app-ios.css" + }, + "material": { + "src": [ + "../apps/spreadsheeteditor/mobile/resources/css/app-material.css" + ], + "dist": "../deploy/web-apps/apps/spreadsheeteditor/mobile/resources/css/app-material.css" + } + }, + "htmlmin": { + "templates": [ + { + "expand": true, + "cwd": "../apps/spreadsheeteditor/mobile/app/template/", + "src": "*.template", + "dest": "../apps/spreadsheeteditor/mobile/app/template/" + } + ] + }, "copy": { + "template-backup": [ + { + "expand": true, + "cwd": "../apps/spreadsheeteditor/mobile/app/template/", + "src": "*.template", + "dest": "../apps/spreadsheeteditor/mobile/app/template/backup/", + "filter": "isFile" + } + ], + "template-restore": [ + { + "expand": true, + "cwd": "../apps/spreadsheeteditor/mobile/app/template/backup/", + "src": "*.template", + "dest": "../apps/spreadsheeteditor/mobile/app/template/", + "filter": "isFile" + } + ], "index-page": { "../deploy/web-apps/apps/spreadsheeteditor/mobile/index.html": "../apps/spreadsheeteditor/mobile/index.html.deploy" },