diff --git a/apps/documenteditor/mobile/app/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js similarity index 93% rename from apps/documenteditor/mobile/app/controller/Collaboration.js rename to apps/common/mobile/lib/controller/Collaboration.js index cbc18da07..c5d3afc1d 100644 --- a/apps/documenteditor/mobile/app/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -33,44 +33,49 @@ /** * Collaboration.js - * Document Editor * - * Created by Julia Svinareva on 14/5/19 + * Created by Julia Svinareva on 12/7/19 * Copyright (c) 2019 Ascensio System SIA. All rights reserved. * */ + +if (Common === undefined) + var Common = {}; + +Common.Controllers = Common.Controllers || {}; + define([ 'core', 'jquery', 'underscore', 'backbone', - 'documenteditor/mobile/app/view/Collaboration' + 'common/mobile/lib/view/Collaboration' ], function (core, $, _, Backbone) { 'use strict'; - DE.Controllers.Collaboration = Backbone.Controller.extend(_.extend((function() { + Common.Controllers.Collaboration = Backbone.Controller.extend(_.extend((function() { // Private - var _settings = [], - _headerType = 1, - rootView, + var rootView, + _userId, + editUsers = [], + editor = !!window.DE ? 'DE' : !!window.PE ? 'PE' : 'SSE', displayMode = "Markup", arrChangeReview = [], dateChange = [], - _fileKey, - _userId, - editUsers = []; + _fileKey; + return { models: [], collections: [], views: [ - 'Collaboration' + 'Common.Views.Collaboration' ], initialize: function() { var me = this; me.addListeners({ - 'Collaboration': { + 'Common.Views.Collaboration': { 'page:show' : me.onPageShow } }); @@ -78,19 +83,23 @@ define([ setApi: function(api) { this.api = api; - this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.changeReview, this)); this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onChangeEditUsers, this)); this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onChangeEditUsers, this)); + if (editor === 'DE') { + this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.changeReview, this)); + } }, onLaunch: function () { - this.createView('Collaboration').render(); + this.createView('Common.Views.Collaboration').render(); }, setMode: function(mode) { this.appConfig = mode; - _fileKey = mode.fileKey; _userId = mode.user.id; + if (editor === 'DE') { + _fileKey = mode.fileKey; + } return this; }, @@ -99,7 +108,8 @@ define([ var me = this, isAndroid = Framework7.prototype.device.android === true, modalView, - mainView = DE.getController('Editor').getView('Editor').f7View; + appPrefix = !!window.DE ? DE : !!window.PE ? PE : SSE, + mainView = appPrefix.getController('Editor').getView('Editor').f7View; uiApp.closeModal(); @@ -107,7 +117,7 @@ define([ modalView = $$(uiApp.pickerModal( '
' + '' + '
' )).on('opened', function () { @@ -129,7 +139,7 @@ define([ '
' + '
' + '' + '
' + '
' + @@ -149,9 +159,9 @@ define([ }); Common.NotificationCenter.trigger('collaborationcontainer:show'); - this.onPageShow(this.getView('Collaboration')); + this.onPageShow(this.getView('Common.Views.Collaboration')); - DE.getController('Toolbar').getView('Toolbar').hideSearch(); + appPrefix.getController('Toolbar').getView('Toolbar').hideSearch(); }, rootView : function() { @@ -173,13 +183,69 @@ define([ } else if('#edit-users-view' == pageId) { me.initEditUsers(); Common.Utils.addScrollIfNeed('.page[data-page=edit-users-view]', '.page[data-page=edit-users-view] .page-content'); + } else if ('#comments-view' == pageId) { + me.initComments(); + Common.Utils.addScrollIfNeed('.page[data-page=comments-view]', '.page[data-page=comments-view] .page-content'); } else { - if(!this.appConfig.canReview) { + if(editor === 'DE' && !this.appConfig.canReview) { $('#reviewing-settings').hide(); } } }, + //Edit users + + onChangeEditUsers: function(users) { + editUsers = users; + }, + + initEditUsers: function() { + var usersArray = []; + _.each(editUsers, function(item){ + var fio = item.asc_getUserName().split(' '); + var initials = fio[0].substring(0, 1).toUpperCase(); + if (fio.length > 1) { + initials += fio[fio.length - 1].substring(0, 1).toUpperCase(); + } + if(!item.asc_getView()) { + var userAttr = { + color: item.asc_getColor(), + id: item.asc_getId(), + idOriginal: item.asc_getIdOriginal(), + name: item.asc_getUserName(), + view: item.asc_getView(), + initial: initials + }; + if(item.asc_getIdOriginal() == _userId) { + usersArray.unshift(userAttr); + } else { + usersArray.push(userAttr); + } + } + }); + var userSort = _.chain(usersArray).groupBy('idOriginal').value(); + var templateUserItem = _.template([ + '<% _.each(users, function (user) { %>', + '
  • ' + + '
    ' + + '
    <%= user[0].initial %>
    '+ + '' + + '<% if (user.length>1) { %><% } %>' + + '
    '+ + '
  • ', + '<% }); %>'].join('')); + var templateUserList = _.template( + '
    ' + + this.textEditUser + + '
    ' + + ''); + $('#user-list').html(templateUserList()); + }, + + //Review + initReviewingSettingsView: function () { var me = this; $('#settings-review input:checkbox').attr('checked', this.appConfig.isReviewOnly || Common.localStorage.getBool("de-mobile-track-changes-" + (_fileKey || ''))); @@ -204,13 +270,14 @@ define([ $checkbox.attr('checked', true); } else { this.api.asc_SetTrackRevisions(state); - Common.localStorage.setItem("de-mobile-track-changes-" + (_fileKey || ''), state ? 1 : 0); + var prefix = !!window.DE ? 'de' : !!window.PE ? 'pe' : 'sse'; + Common.localStorage.setItem(prefix + "-mobile-track-changes-" + (_fileKey || ''), state ? 1 : 0); } }, onAcceptAllClick: function() { if (this.api) { - this.api.asc_AcceptAllChanges(); + this.api.asc_AcceptAllChanges(); } }, @@ -517,15 +584,15 @@ define([ changetext += ''; changetext += proptext; break; - case Asc.c_oAscRevisionsChangeType.TablePr: - changetext = me.textTableChanged; - break; - case Asc.c_oAscRevisionsChangeType.RowsAdd: - changetext = me.textTableRowsAdd; - break; - case Asc.c_oAscRevisionsChangeType.RowsRem: - changetext = me.textTableRowsDel; - break; + case Asc.c_oAscRevisionsChangeType.TablePr: + changetext = me.textTableChanged; + break; + case Asc.c_oAscRevisionsChangeType.RowsAdd: + changetext = me.textTableRowsAdd; + break; + case Asc.c_oAscRevisionsChangeType.RowsRem: + changetext = me.textTableRowsDel; + break; } var date = (item.get_DateTime() == '') ? new Date() : new Date(item.get_DateTime()), @@ -577,57 +644,6 @@ define([ } }, - onChangeEditUsers: function(users) { - editUsers = users; - }, - - initEditUsers: function() { - var usersArray = []; - _.each(editUsers, function(item){ - var fio = item.asc_getUserName().split(' '); - var initials = fio[0].substring(0, 1).toUpperCase(); - if (fio.length > 1) { - initials += fio[fio.length - 1].substring(0, 1).toUpperCase(); - } - if(!item.asc_getView()) { - var userAttr = { - color: item.asc_getColor(), - id: item.asc_getId(), - idOriginal: item.asc_getIdOriginal(), - name: item.asc_getUserName(), - view: item.asc_getView(), - initial: initials - }; - if(item.asc_getIdOriginal() == _userId) { - usersArray.unshift(userAttr); - } else { - usersArray.push(userAttr); - } - } - }); - var userSort = _.chain(usersArray).groupBy('idOriginal').value(); - var templateUserItem = _.template([ - '<% _.each(users, function (user) { %>', - '
  • ' + - '
    ' + - '
    <%= user[0].initial %>
    '+ - '' + - '<% if (user.length>1) { %><% } %>' + - '
    '+ - '
  • ', - '<% }); %>'].join('')); - var templateUserList = _.template( - '
    ' + - this.textEditUser + - '
    ' + - ''); - $('#user-list').html(templateUserList()); - }, - - - textInserted: 'Inserted:', textDeleted: 'Deleted:', @@ -690,5 +706,5 @@ define([ textEditUser: 'Document is currently being edited by several users.' } - })(), DE.Controllers.Collaboration || {})) + })(), Common.Controllers.Collaboration || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/mobile/app/template/Collaboration.template b/apps/common/mobile/lib/template/Collaboration.template similarity index 93% rename from apps/documenteditor/mobile/app/template/Collaboration.template rename to apps/common/mobile/lib/template/Collaboration.template index 8555c942b..6256a860a 100644 --- a/apps/documenteditor/mobile/app/template/Collaboration.template +++ b/apps/common/mobile/lib/template/Collaboration.template @@ -20,6 +20,7 @@ + <% if (editor === 'DE') { %>
  • @@ -29,6 +30,7 @@
  • + <% } %> @@ -36,6 +38,25 @@ + +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    @@ -170,7 +191,7 @@ - + @@ -186,23 +207,4 @@
    - - - -
    - -
    -
    -
    -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/apps/documenteditor/mobile/app/view/Collaboration.js b/apps/common/mobile/lib/view/Collaboration.js similarity index 89% rename from apps/documenteditor/mobile/app/view/Collaboration.js rename to apps/common/mobile/lib/view/Collaboration.js index 22b8db64a..c886a0f5b 100644 --- a/apps/documenteditor/mobile/app/view/Collaboration.js +++ b/apps/common/mobile/lib/view/Collaboration.js @@ -33,22 +33,26 @@ /** * Collaboration.js - * Document Editor * - * Created by Julia Svinareva on 14/5/19 + * Created by Julia Svinareva on 12/7/19 * Copyright (c) 2019 Ascensio System SIA. All rights reserved. * */ +if (Common === undefined) + var Common = {}; + +Common.Views = Common.Views || {}; + define([ - 'text!documenteditor/mobile/app/template/Collaboration.template', + 'text!common/mobile/lib/template/Collaboration.template', 'jquery', 'underscore', 'backbone' ], function (settingsTemplate, $, _, Backbone) { 'use strict'; - DE.Views.Collaboration = Backbone.View.extend(_.extend((function() { + Common.Views.Collaboration = Backbone.View.extend(_.extend((function() { // private return { @@ -81,7 +85,8 @@ define([ android : Common.SharedSettings.get('android'), phone : Common.SharedSettings.get('phone'), orthography: Common.SharedSettings.get('sailfish'), - scope : this + scope : this, + editor : !!window.DE ? 'DE' : !!window.PE ? 'PE' : 'SSE' })); return this; @@ -119,7 +124,10 @@ define([ }, showPage: function(templateId, animate) { - var rootView = DE.getController('Collaboration').rootView(); + var me = this; + var prefix = !!window.DE ? DE : !!window.PE ? PE : SSE; + var rootView = prefix.getController('Common.Controllers.Collaboration').rootView(); + if (rootView && this.layout) { var $content = this.layout.find(templateId); @@ -155,5 +163,5 @@ define([ textEditUsers: 'Users' } - })(), DE.Views.Collaboration || {})) + })(), Common.Views.Collaboration || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/mobile/app-dev.js b/apps/documenteditor/mobile/app-dev.js index 768ce7629..db28adc5d 100644 --- a/apps/documenteditor/mobile/app-dev.js +++ b/apps/documenteditor/mobile/app-dev.js @@ -151,7 +151,7 @@ require([ 'AddShape', 'AddImage', 'AddOther', - 'Collaboration' + 'Common.Controllers.Collaboration' ] }); @@ -222,7 +222,7 @@ require([ 'documenteditor/mobile/app/controller/add/AddShape', 'documenteditor/mobile/app/controller/add/AddImage', 'documenteditor/mobile/app/controller/add/AddOther', - 'documenteditor/mobile/app/controller/Collaboration' + 'common/mobile/lib/controller/Collaboration' ], function() { window.compareVersions = true; app.start(); diff --git a/apps/documenteditor/mobile/app.js b/apps/documenteditor/mobile/app.js index 0b3aeb561..465d67e69 100644 --- a/apps/documenteditor/mobile/app.js +++ b/apps/documenteditor/mobile/app.js @@ -162,7 +162,7 @@ require([ 'AddShape', 'AddImage', 'AddOther', - 'Collaboration' + 'Common.Controllers.Collaboration' ] }); @@ -233,7 +233,7 @@ require([ 'documenteditor/mobile/app/controller/add/AddShape', 'documenteditor/mobile/app/controller/add/AddImage', 'documenteditor/mobile/app/controller/add/AddOther', - 'documenteditor/mobile/app/controller/Collaboration' + 'common/mobile/lib/controller/Collaboration' ], function() { app.start(); }); diff --git a/apps/documenteditor/mobile/app/controller/DocumentHolder.js b/apps/documenteditor/mobile/app/controller/DocumentHolder.js index bff7031dc..7ceeca7d4 100644 --- a/apps/documenteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/documenteditor/mobile/app/controller/DocumentHolder.js @@ -149,14 +149,14 @@ define([ } }); } else if ('review' == eventName) { - var getCollaboration = DE.getController('Collaboration'); + var getCollaboration = DE.getController('Common.Controllers.Collaboration'); getCollaboration.showModal(); - getCollaboration.getView('Collaboration').showPage('#reviewing-settings-view', false); + getCollaboration.getView('Common.Views.Collaboration').showPage('#reviewing-settings-view', false); } else if('reviewchange' == eventName) { - var getCollaboration = DE.getController('Collaboration'); + var getCollaboration = DE.getController('Common.Controllers.Collaboration'); getCollaboration.showModal(); - getCollaboration.getView('Collaboration').showPage('#reviewing-settings-view', false); - getCollaboration.getView('Collaboration').showPage('#change-view', false); + getCollaboration.getView('Common.Views.Collaboration').showPage('#reviewing-settings-view', false); + getCollaboration.getView('Common.Views.Collaboration').showPage('#change-view', false); } else if ('showActionSheet' == eventName && _actionSheets.length > 0) { _.delay(function () { _.each(_actionSheets, function (action) { diff --git a/apps/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index be2f7dcc9..9ed879014 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -47,7 +47,7 @@ define([ 'underscore', 'backbone', 'documenteditor/mobile/app/view/Settings', - 'documenteditor/mobile/app/controller/Collaboration' + 'common/mobile/lib/controller/Collaboration' ], function (core, $, _, Backbone) { 'use strict'; @@ -249,7 +249,7 @@ define([ $('#settings-download').single('click', _.bind(me.onDownloadOrigin, me)); $('#settings-print').single('click', _.bind(me.onPrint, me)); $('#settings-collaboration').single('click', _.bind(me.clickCollaboration, me)); - var _stateDisplayMode = DE.getController('Collaboration').getDisplayMode(); + var _stateDisplayMode = DE.getController('Common.Controllers.Collaboration').getDisplayMode(); if(_stateDisplayMode == "Final" || _stateDisplayMode == "Original") { $('#settings-document').addClass('disabled'); } @@ -261,7 +261,7 @@ define([ }, clickCollaboration: function() { - DE.getController('Collaboration').showModal(); + DE.getController('Common.Controllers.Collaboration').showModal(); }, onNoCharacters: function(e) { @@ -339,7 +339,7 @@ define([ var value = Common.localStorage.getItem('de-mobile-settings-unit'); value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric(); $unitMeasurement.val([value]); - var _stateDisplayMode = DE.getController('Collaboration').getDisplayMode(); + var _stateDisplayMode = DE.getController('Common.Controllers.Collaboration').getDisplayMode(); if(_stateDisplayMode == "Final" || _stateDisplayMode == "Original") { $('#settings-no-characters').addClass('disabled'); $('#settings-hidden-borders').addClass('disabled'); diff --git a/apps/documenteditor/mobile/app/view/Toolbar.js b/apps/documenteditor/mobile/app/view/Toolbar.js index 4738c92c5..c941d416c 100644 --- a/apps/documenteditor/mobile/app/view/Toolbar.js +++ b/apps/documenteditor/mobile/app/view/Toolbar.js @@ -153,7 +153,7 @@ define([ //Collaboration showCollaboration: function () { - DE.getController('Collaboration').showModal(); + DE.getController('Common.Controllers.Collaboration').showModal(); }, editDocument: function () { diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index 0823b2b2a..ba5c164b2 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -3,6 +3,65 @@ "Common.UI.ThemeColorPalette.textThemeColors": "Theme Colors", "Common.Utils.Metric.txtCm": "cm", "Common.Utils.Metric.txtPt": "pt", + "Common.Controllers.Collaboration.textInserted": "Inserted:", + "Common.Controllers.Collaboration.textDeleted": "Deleted:", + "Common.Controllers.Collaboration.textParaInserted": "Paragraph Inserted", + "Common.Controllers.Collaboration.textParaDeleted": "Paragraph Deleted", + "Common.Controllers.Collaboration.textFormatted": "Formatted", + "Common.Controllers.Collaboration.textParaFormatted": "Paragraph Formatted", + "Common.Controllers.Collaboration.textNot": "Not", + "Common.Controllers.Collaboration.textBold": "Bold", + "Common.Controllers.Collaboration.textItalic": "Italic", + "Common.Controllers.Collaboration.textStrikeout": "Strikeout", + "Common.Controllers.Collaboration.textUnderline": "Underline", + "Common.Controllers.Collaboration.textColor": "Font color", + "Common.Controllers.Collaboration.textBaseline": "Baseline", + "Common.Controllers.Collaboration.textSuperScript": "Superscript", + "Common.Controllers.Collaboration.textSubScript": "Subscript", + "Common.Controllers.Collaboration.textHighlight": "Highlight color", + "Common.Controllers.Collaboration.textSpacing": "Spacing", + "Common.Controllers.Collaboration.textDStrikeout": "Double strikeout", + "Common.Controllers.Collaboration.textCaps": "All caps", + "Common.Controllers.Collaboration.textSmallCaps": "Small caps", + "Common.Controllers.Collaboration.textPosition": "Position", + "Common.Controllers.Collaboration.textShd": "Background color", + "Common.Controllers.Collaboration.textContextual": "Don't add interval between paragraphs of the same style", + "Common.Controllers.Collaboration.textNoContextual": "Add interval between paragraphs of the same style", + "Common.Controllers.Collaboration.textIndentLeft": "Indent left", + "Common.Controllers.Collaboration.textIndentRight": "Indent right", + "Common.Controllers.Collaboration.textFirstLine": "First line", + "Common.Controllers.Collaboration.textRight": "Align right", + "Common.Controllers.Collaboration.textLeft": "Align left", + "Common.Controllers.Collaboration.textCenter": "Align center", + "Common.Controllers.Collaboration.textJustify": "Align justify", + "Common.Controllers.Collaboration.textBreakBefore": "Page break before", + "Common.Controllers.Collaboration.textKeepNext": "Keep with next", + "Common.Controllers.Collaboration.textKeepLines": "Keep lines together", + "Common.Controllers.Collaboration.textNoBreakBefore": "No page break before", + "Common.Controllers.Collaboration.textNoKeepNext": "Don't keep with next", + "Common.Controllers.Collaboration.textNoKeepLines": "Don't keep lines together", + "Common.Controllers.Collaboration.textLineSpacing": "Line Spacing: ", + "Common.Controllers.Collaboration.textMultiple": "multiple", + "Common.Controllers.Collaboration.textAtLeast": "at least", + "Common.Controllers.Collaboration.textExact": "exactly", + "Common.Controllers.Collaboration.textSpacingBefore": "Spacing before", + "Common.Controllers.Collaboration.textSpacingAfter": "Spacing after", + "Common.Controllers.Collaboration.textAuto": "auto", + "Common.Controllers.Collaboration.textWidow": "Widow control", + "Common.Controllers.Collaboration.textNoWidow": "No widow control", + "Common.Controllers.Collaboration.textTabs": "Change tabs", + "Common.Controllers.Collaboration.textNum": "Change numbering", + "Common.Controllers.Collaboration.textEquation": "Equation", + "Common.Controllers.Collaboration.textImage": "Image", + "Common.Controllers.Collaboration.textChart": "Chart", + "Common.Controllers.Collaboration.textShape": "Shape", + "Common.Controllers.Collaboration.textTableChanged": "Table Settings Changed", + "Common.Controllers.Collaboration.textTableRowsAdd": "Table Rows Added", + "Common.Controllers.Collaboration.textTableRowsDel": "Table Rows Deleted", + "Common.Controllers.Collaboration.textParaMoveTo": "Moved:", + "Common.Controllers.Collaboration.textParaMoveFromUp": "Moved Up:", + "Common.Controllers.Collaboration.textParaMoveFromDown": "Moved Down:", + "Common.Controllers.Collaboration.textEditUser": "Document is currently being edited by several users.", "DE.Controllers.AddContainer.textImage": "Image", "DE.Controllers.AddContainer.textOther": "Other", "DE.Controllers.AddContainer.textShape": "Shape", @@ -185,65 +244,6 @@ "DE.Controllers.Toolbar.dlgLeaveTitleText": "You leave the application", "DE.Controllers.Toolbar.leaveButtonText": "Leave this Page", "DE.Controllers.Toolbar.stayButtonText": "Stay on this Page", - "DE.Controllers.Collaboration.textInserted": "Inserted:", - "DE.Controllers.Collaboration.textDeleted": "Deleted:", - "DE.Controllers.Collaboration.textParaInserted": "Paragraph Inserted", - "DE.Controllers.Collaboration.textParaDeleted": "Paragraph Deleted", - "DE.Controllers.Collaboration.textFormatted": "Formatted", - "DE.Controllers.Collaboration.textParaFormatted": "Paragraph Formatted", - "DE.Controllers.Collaboration.textNot": "Not", - "DE.Controllers.Collaboration.textBold": "Bold", - "DE.Controllers.Collaboration.textItalic": "Italic", - "DE.Controllers.Collaboration.textStrikeout": "Strikeout", - "DE.Controllers.Collaboration.textUnderline": "Underline", - "DE.Controllers.Collaboration.textColor": "Font color", - "DE.Controllers.Collaboration.textBaseline": "Baseline", - "DE.Controllers.Collaboration.textSuperScript": "Superscript", - "DE.Controllers.Collaboration.textSubScript": "Subscript", - "DE.Controllers.Collaboration.textHighlight": "Highlight color", - "DE.Controllers.Collaboration.textSpacing": "Spacing", - "DE.Controllers.Collaboration.textDStrikeout": "Double strikeout", - "DE.Controllers.Collaboration.textCaps": "All caps", - "DE.Controllers.Collaboration.textSmallCaps": "Small caps", - "DE.Controllers.Collaboration.textPosition": "Position", - "DE.Controllers.Collaboration.textShd": "Background color", - "DE.Controllers.Collaboration.textContextual": "Don't add interval between paragraphs of the same style", - "DE.Controllers.Collaboration.textNoContextual": "Add interval between paragraphs of the same style", - "DE.Controllers.Collaboration.textIndentLeft": "Indent left", - "DE.Controllers.Collaboration.textIndentRight": "Indent right", - "DE.Controllers.Collaboration.textFirstLine": "First line", - "DE.Controllers.Collaboration.textRight": "Align right", - "DE.Controllers.Collaboration.textLeft": "Align left", - "DE.Controllers.Collaboration.textCenter": "Align center", - "DE.Controllers.Collaboration.textJustify": "Align justify", - "DE.Controllers.Collaboration.textBreakBefore": "Page break before", - "DE.Controllers.Collaboration.textKeepNext": "Keep with next", - "DE.Controllers.Collaboration.textKeepLines": "Keep lines together", - "DE.Controllers.Collaboration.textNoBreakBefore": "No page break before", - "DE.Controllers.Collaboration.textNoKeepNext": "Don't keep with next", - "DE.Controllers.Collaboration.textNoKeepLines": "Don't keep lines together", - "DE.Controllers.Collaboration.textLineSpacing": "Line Spacing: ", - "DE.Controllers.Collaboration.textMultiple": "multiple", - "DE.Controllers.Collaboration.textAtLeast": "at least", - "DE.Controllers.Collaboration.textExact": "exactly", - "DE.Controllers.Collaboration.textSpacingBefore": "Spacing before", - "DE.Controllers.Collaboration.textSpacingAfter": "Spacing after", - "DE.Controllers.Collaboration.textAuto": "auto", - "DE.Controllers.Collaboration.textWidow": "Widow control", - "DE.Controllers.Collaboration.textNoWidow": "No widow control", - "DE.Controllers.Collaboration.textTabs": "Change tabs", - "DE.Controllers.Collaboration.textNum": "Change numbering", - "DE.Controllers.Collaboration.textEquation": "Equation", - "DE.Controllers.Collaboration.textImage": "Image", - "DE.Controllers.Collaboration.textChart": "Chart", - "DE.Controllers.Collaboration.textShape": "Shape", - "DE.Controllers.Collaboration.textTableChanged": "Table Settings Changed", - "DE.Controllers.Collaboration.textTableRowsAdd": "Table Rows Added", - "DE.Controllers.Collaboration.textTableRowsDel": "Table Rows Deleted", - "DE.Controllers.Collaboration.textParaMoveTo": "Moved:", - "DE.Controllers.Collaboration.textParaMoveFromUp": "Moved Up:", - "DE.Controllers.Collaboration.textParaMoveFromDown": "Moved Down:", - "DE.Controllers.Collaboration.textEditUser": "Document is currently being edited by several users.", "DE.Views.AddImage.textAddress": "Address", "DE.Views.AddImage.textBack": "Back", "DE.Views.AddImage.textFromLibrary": "Picture from Library", @@ -493,17 +493,17 @@ "DE.Views.Settings.textNoCharacters": "Nonprinting Characters", "DE.Views.Settings.textHiddenTableBorders": "Hidden Table Borders", "DE.Views.Toolbar.textBack": "Back", - "DE.Views.Collaboration.textCollaboration": "Collaboration", - "DE.Views.Collaboration.textReviewing": "Review", - "DE.Views.Collaboration.textСomments": "Сomments", - "DE.Views.Collaboration.textBack": "Back", - "DE.Views.Collaboration.textReview": "Track Changes", - "DE.Views.Collaboration.textAcceptAllChanges": "Accept All Changes", - "DE.Views.Collaboration.textRejectAllChanges": "Reject All Changes", - "DE.Views.Collaboration.textDisplayMode": "Display Mode", - "DE.Views.Collaboration.textMarkup": "Markup", - "DE.Views.Collaboration.textFinal": "Final", - "DE.Views.Collaboration.textOriginal": "Original", - "DE.Views.Collaboration.textChange": "Review Change", - "DE.Views.Collaboration.textEditUsers": "Users" + "Common.Views.Collaboration.textCollaboration": "Collaboration", + "Common.Views.Collaboration.textReviewing": "Review", + "Common.Views.Collaboration.textСomments": "Сomments", + "Common.Views.Collaboration.textBack": "Back", + "Common.Views.Collaboration.textReview": "Track Changes", + "Common.Views.Collaboration.textAcceptAllChanges": "Accept All Changes", + "Common.Views.Collaboration.textRejectAllChanges": "Reject All Changes", + "Common.Views.Collaboration.textDisplayMode": "Display Mode", + "Common.Views.Collaboration.textMarkup": "Markup", + "Common.Views.Collaboration.textFinal": "Final", + "Common.Views.Collaboration.textOriginal": "Original", + "Common.Views.Collaboration.textChange": "Review Change", + "Common.Views.Collaboration.textEditUsers": "Users" } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/app-dev.js b/apps/presentationeditor/mobile/app-dev.js index eb062d384..575778b44 100644 --- a/apps/presentationeditor/mobile/app-dev.js +++ b/apps/presentationeditor/mobile/app-dev.js @@ -149,7 +149,7 @@ require([ 'AddImage', 'AddLink', 'AddSlide', - 'Collaboration' + 'Common.Controllers.Collaboration' ] }); @@ -218,7 +218,7 @@ require([ 'presentationeditor/mobile/app/controller/add/AddImage', 'presentationeditor/mobile/app/controller/add/AddLink', 'presentationeditor/mobile/app/controller/add/AddSlide', - 'presentationeditor/mobile/app/controller/Collaboration' + 'common/mobile/lib/controller/Collaboration' ], function() { window.compareVersions = true; diff --git a/apps/presentationeditor/mobile/app.js b/apps/presentationeditor/mobile/app.js index 5103851de..c2f9901d1 100644 --- a/apps/presentationeditor/mobile/app.js +++ b/apps/presentationeditor/mobile/app.js @@ -160,7 +160,7 @@ require([ 'AddImage', 'AddLink', 'AddSlide', - 'Collaboration' + 'Common.Controllers.Collaboration' ] }); @@ -229,7 +229,7 @@ require([ 'presentationeditor/mobile/app/controller/add/AddImage', 'presentationeditor/mobile/app/controller/add/AddLink', 'presentationeditor/mobile/app/controller/add/AddSlide', - 'presentationeditor/mobile/app/controller/Collaboration' + 'common/mobile/lib/controller/Collaboration' ], function() { app.start(); }); diff --git a/apps/presentationeditor/mobile/app/controller/Collaboration.js b/apps/presentationeditor/mobile/app/controller/Collaboration.js deleted file mode 100644 index ac31c2bf5..000000000 --- a/apps/presentationeditor/mobile/app/controller/Collaboration.js +++ /dev/null @@ -1,217 +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 - * - */ - -/** - * Collaboration.js - * Presentation Editor - * - * Created by Julia Svinareva on 31/5/19 - * Copyright (c) 2019 Ascensio System SIA. All rights reserved. - * - */ -define([ - 'core', - 'jquery', - 'underscore', - 'backbone', - 'presentationeditor/mobile/app/view/Collaboration' -], function (core, $, _, Backbone) { - 'use strict'; - - PE.Controllers.Collaboration = Backbone.Controller.extend(_.extend((function() { - // Private - var rootView, - _userId, - editUsers = []; - - return { - models: [], - collections: [], - views: [ - 'Collaboration' - ], - - initialize: function() { - var me = this; - me.addListeners({ - 'Collaboration': { - 'page:show' : me.onPageShow - } - }); - }, - - setApi: function(api) { - this.api = api; - this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onChangeEditUsers, this)); - this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onChangeEditUsers, this)); - }, - - onLaunch: function () { - this.createView('Collaboration').render(); - }, - - setMode: function(mode) { - this.appConfig = mode; - _userId = mode.user.id; - return this; - }, - - - showModal: function() { - var me = this, - isAndroid = Framework7.prototype.device.android === true, - modalView, - mainView = PE.getController('Editor').getView('Editor').f7View; - - uiApp.closeModal(); - - if (Common.SharedSettings.get('phone')) { - modalView = $$(uiApp.pickerModal( - '
    ' + - '' + - '
    ' - )).on('opened', function () { - if (_.isFunction(me.api.asc_OnShowContextMenu)) { - me.api.asc_OnShowContextMenu() - } - }).on('close', function (e) { - mainView.showNavbar(); - }).on('closed', function () { - if (_.isFunction(me.api.asc_OnHideContextMenu)) { - me.api.asc_OnHideContextMenu() - } - }); - mainView.hideNavbar(); - } else { - modalView = uiApp.popover( - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '' + - '
    ' + - '
    ' + - '
    ', - $$('#toolbar-collaboration') - ); - } - - if (Framework7.prototype.device.android === true) { - $$('.view.collaboration-root-view.navbar-through').removeClass('navbar-through').addClass('navbar-fixed'); - $$('.view.collaboration-root-view .navbar').prependTo('.view.collaboration-root-view > .pages > .page'); - } - - rootView = uiApp.addView('.collaboration-root-view', { - dynamicNavbar: true, - domCache: true - }); - - Common.NotificationCenter.trigger('collaborationcontainer:show'); - this.onPageShow(this.getView('Collaboration')); - - PE.getController('Toolbar').getView('Toolbar').hideSearch(); - }, - - rootView : function() { - return rootView; - }, - - onPageShow: function(view, pageId) { - var me = this; - - if('#edit-users-view' == pageId) { - me.initEditUsers(); - Common.Utils.addScrollIfNeed('.page[data-page=edit-users-view]', '.page[data-page=edit-users-view] .page-content'); - } else { - } - }, - - onChangeEditUsers: function(users) { - editUsers = users; - }, - - initEditUsers: function() { - var usersArray = []; - _.each(editUsers, function(item){ - var fio = item.asc_getUserName().split(' '); - var initials = fio[0].substring(0, 1).toUpperCase(); - if (fio.length > 1) { - initials += fio[fio.length - 1].substring(0, 1).toUpperCase(); - } - if(!item.asc_getView()) { - var userAttr = { - color: item.asc_getColor(), - id: item.asc_getId(), - idOriginal: item.asc_getIdOriginal(), - name: item.asc_getUserName(), - view: item.asc_getView(), - initial: initials - }; - if(item.asc_getIdOriginal() == _userId) { - usersArray.unshift(userAttr); - } else { - usersArray.push(userAttr); - } - } - }); - var userSort = _.chain(usersArray).groupBy('idOriginal').value(); - var templateUserItem = _.template([ - '<% _.each(users, function (user) { %>', - '
  • ' + - '
    ' + - '
    <%= user[0].initial %>
    '+ - '' + - '<% if (user.length>1) { %><% } %>' + - '
    '+ - '
  • ', - '<% }); %>'].join('')); - var templateUserList = _.template( - '
    ' + - this.textEditUser + - '
    ' + - '
      ' + - templateUserItem({users: userSort}) + - '
    '); - $('#user-list').html(templateUserList()); - }, - - - textEditUser: 'Document is currently being edited by several users.' - - } - })(), PE.Controllers.Collaboration || {})) -}); \ No newline at end of file diff --git a/apps/presentationeditor/mobile/app/controller/Settings.js b/apps/presentationeditor/mobile/app/controller/Settings.js index 14050c3e0..43472adc2 100644 --- a/apps/presentationeditor/mobile/app/controller/Settings.js +++ b/apps/presentationeditor/mobile/app/controller/Settings.js @@ -194,7 +194,7 @@ define([ }, onCollaboration: function() { - PE.getController('Collaboration').showModal(); + PE.getController('Common.Controllers.Collaboration').showModal(); }, initPageColorSchemes: function () { diff --git a/apps/presentationeditor/mobile/app/template/Collaboration.template b/apps/presentationeditor/mobile/app/template/Collaboration.template deleted file mode 100644 index 599f0a369..000000000 --- a/apps/presentationeditor/mobile/app/template/Collaboration.template +++ /dev/null @@ -1,47 +0,0 @@ - -
    - - -
    - - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/apps/presentationeditor/mobile/app/view/Collaboration.js b/apps/presentationeditor/mobile/app/view/Collaboration.js deleted file mode 100644 index 6b8299f82..000000000 --- a/apps/presentationeditor/mobile/app/view/Collaboration.js +++ /dev/null @@ -1,149 +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 - * - */ - -/** - * Collaboration.js - * Presentation Editor - * - * Created by Julia Svinareva on 31/5/19 - * Copyright (c) 2019 Ascensio System SIA. All rights reserved. - * - */ - -define([ - 'text!presentationeditor/mobile/app/template/Collaboration.template', - 'jquery', - 'underscore', - 'backbone' -], function (settingsTemplate, $, _, Backbone) { - 'use strict'; - - PE.Views.Collaboration = Backbone.View.extend(_.extend((function() { - // private - - return { - - template: _.template(settingsTemplate), - - events: { - // - }, - - initialize: function() { - Common.NotificationCenter.on('collaborationcontainer:show', _.bind(this.initEvents, this)); - this.on('page:show', _.bind(this.updateItemHandlers, this)); - }, - - initEvents: function () { - var me = this; - - Common.Utils.addScrollIfNeed('.view[data-page=collaboration-root-view] .pages', '.view[data-page=collaboration-root-view] .page'); - me.updateItemHandlers(); - }, - - initControls: function() { - // - }, - - // Render layout - render: function() { - this.layout = $('
    ').append(this.template({ - android : Common.SharedSettings.get('android'), - phone : Common.SharedSettings.get('phone'), - orthography: Common.SharedSettings.get('sailfish'), - scope : this - })); - - return this; - }, - - updateItemHandlers: function () { - var selectorsDynamicPage = [ - '.page[data-page=collaboration-root-view]' - ].map(function (selector) { - return selector + ' a.item-link[data-page]'; - }).join(', '); - - $(selectorsDynamicPage).single('click', _.bind(this.onItemClick, this)); - }, - - onItemClick: function (e) { - var $target = $(e.currentTarget), - page = $target.data('page'); - - if (page && page.length > 0 ) { - this.showPage(page); - } - }, - - rootLayout: function () { - if (this.layout) { - var $layour = this.layout.find('#collaboration-root-view'), - isPhone = Common.SharedSettings.get('phone'); - - return $layour.html(); - } - - return ''; - }, - - showPage: function(templateId, animate) { - var rootView = PE.getController('Collaboration').rootView(); - - if (rootView && this.layout) { - var $content = this.layout.find(templateId); - - // Android fix for navigation - if (Framework7.prototype.device.android) { - $content.find('.page').append($content.find('.navbar')); - } - - rootView.router.load({ - content: $content.html(), - animatePages: animate !== false - }); - - this.fireEvent('page:show', [this, templateId]); - } - }, - - - - textCollaboration: 'Collaboration', - textСomments: 'Сomments', - textBack: 'Back', - textEditUsers: 'Users' - - } - })(), PE.Views.Collaboration || {})) -}); \ No newline at end of file diff --git a/apps/presentationeditor/mobile/app/view/Toolbar.js b/apps/presentationeditor/mobile/app/view/Toolbar.js index e71a47607..6e7c74ded 100644 --- a/apps/presentationeditor/mobile/app/view/Toolbar.js +++ b/apps/presentationeditor/mobile/app/view/Toolbar.js @@ -162,7 +162,7 @@ define([ //Collaboration showCollaboration: function () { - PE.getController('Collaboration').showModal(); + PE.getController('Common.Controllers.Collaboration').showModal(); }, textBack: 'Back' diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 43260e8f6..389a52701 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -226,7 +226,7 @@ "PE.Controllers.Toolbar.dlgLeaveTitleText": "You leave the application", "PE.Controllers.Toolbar.leaveButtonText": "Leave this Page", "PE.Controllers.Toolbar.stayButtonText": "Stay on this Page", - "PE.Controllers.Collaboration.textEditUser": "Document is currently being edited by several users.", + "Common.Controllers.Collaboration.textEditUser": "Document is currently being edited by several users.", "PE.Views.AddImage.textAddress": "Address", "PE.Views.AddImage.textBack": "Back", "PE.Views.AddImage.textFromLibrary": "Picture from Library", @@ -477,8 +477,8 @@ "PE.Views.Settings.unknownText": "Unknown", "PE.Views.Settings.textCollaboration": "Collaboration", "PE.Views.Toolbar.textBack": "Back", - "PE.Views.Collaboration.textCollaboration": "Collaboration", - "PE.Views.Collaboration.textСomments": "Сomments", - "PE.Views.Collaboration.textBack": "Back", - "PE.Views.Collaboration.textEditUsers": "Users" + "Common.Views.Collaboration.textCollaboration": "Collaboration", + "Common.Views.Collaboration.textСomments": "Сomments", + "Common.Views.Collaboration.textBack": "Back", + "Common.Views.Collaboration.textEditUsers": "Users" } \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app-dev.js b/apps/spreadsheeteditor/mobile/app-dev.js index 0a41b8910..1a92b9ba2 100644 --- a/apps/spreadsheeteditor/mobile/app-dev.js +++ b/apps/spreadsheeteditor/mobile/app-dev.js @@ -134,8 +134,8 @@ require([ ,'AddShape' ,'AddOther' ,'AddLink' - ,'Collaboration' ,'FilterOptions' + ,'Common.Controllers.Collaboration' ] }); @@ -207,8 +207,8 @@ require([ ,'spreadsheeteditor/mobile/app/controller/add/AddShape' ,'spreadsheeteditor/mobile/app/controller/add/AddOther' ,'spreadsheeteditor/mobile/app/controller/add/AddLink' - ,'spreadsheeteditor/mobile/app/controller/Collaboration' ,'spreadsheeteditor/mobile/app/controller/FilterOptions' + ,'common/mobile/lib/controller/Collaboration' ], function() { window.compareVersions = true; app.start(); diff --git a/apps/spreadsheeteditor/mobile/app.js b/apps/spreadsheeteditor/mobile/app.js index 1f518f056..82d26b8e4 100644 --- a/apps/spreadsheeteditor/mobile/app.js +++ b/apps/spreadsheeteditor/mobile/app.js @@ -145,8 +145,8 @@ require([ ,'AddShape' ,'AddOther' ,'AddLink' - ,'Collaboration' ,'FilterOptions' + ,'Common.Controllers.Collaboration' ] }); @@ -218,8 +218,8 @@ require([ ,'spreadsheeteditor/mobile/app/controller/add/AddShape' ,'spreadsheeteditor/mobile/app/controller/add/AddOther' ,'spreadsheeteditor/mobile/app/controller/add/AddLink' - ,'spreadsheeteditor/mobile/app/controller/Collaboration' ,'spreadsheeteditor/mobile/app/controller/FilterOptions' + ,'common/mobile/lib/controller/Collaboration' ], function() { app.start(); }); diff --git a/apps/spreadsheeteditor/mobile/app/controller/Collaboration.js b/apps/spreadsheeteditor/mobile/app/controller/Collaboration.js deleted file mode 100644 index 2e98a912e..000000000 --- a/apps/spreadsheeteditor/mobile/app/controller/Collaboration.js +++ /dev/null @@ -1,217 +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 - * - */ - -/** - * Collaboration.js - * Spreadsheet Editor - * - * Created by Julia Svinareva on 4/6/19 - * Copyright (c) 2019 Ascensio System SIA. All rights reserved. - * - */ -define([ - 'core', - 'jquery', - 'underscore', - 'backbone', - 'spreadsheeteditor/mobile/app/view/Collaboration' -], function (core, $, _, Backbone) { - 'use strict'; - - SSE.Controllers.Collaboration = Backbone.Controller.extend(_.extend((function() { - // Private - var rootView, - _userId, - editUsers = []; - - return { - models: [], - collections: [], - views: [ - 'Collaboration' - ], - - initialize: function() { - var me = this; - me.addListeners({ - 'Collaboration': { - 'page:show' : me.onPageShow - } - }); - }, - - setApi: function(api) { - this.api = api; - this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onChangeEditUsers, this)); - this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onChangeEditUsers, this)); - }, - - onLaunch: function () { - this.createView('Collaboration').render(); - }, - - setMode: function(mode) { - this.appConfig = mode; - _userId = mode.user.id; - return this; - }, - - - showModal: function() { - var me = this, - isAndroid = Framework7.prototype.device.android === true, - modalView, - mainView = SSE.getController('Editor').getView('Editor').f7View; - - uiApp.closeModal(); - - if (Common.SharedSettings.get('phone')) { - modalView = $$(uiApp.pickerModal( - '
    ' + - '' + - '
    ' - )).on('opened', function () { - if (_.isFunction(me.api.asc_OnShowContextMenu)) { - me.api.asc_OnShowContextMenu() - } - }).on('close', function (e) { - mainView.showNavbar(); - }).on('closed', function () { - if (_.isFunction(me.api.asc_OnHideContextMenu)) { - me.api.asc_OnHideContextMenu() - } - }); - mainView.hideNavbar(); - } else { - modalView = uiApp.popover( - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '' + - '
    ' + - '
    ' + - '
    ', - $$('#toolbar-collaboration') - ); - } - - if (Framework7.prototype.device.android === true) { - $$('.view.collaboration-root-view.navbar-through').removeClass('navbar-through').addClass('navbar-fixed'); - $$('.view.collaboration-root-view .navbar').prependTo('.view.collaboration-root-view > .pages > .page'); - } - - rootView = uiApp.addView('.collaboration-root-view', { - dynamicNavbar: true, - domCache: true - }); - - Common.NotificationCenter.trigger('collaborationcontainer:show'); - this.onPageShow(this.getView('Collaboration')); - - SSE.getController('Toolbar').getView('Toolbar').hideSearch(); - }, - - rootView : function() { - return rootView; - }, - - onPageShow: function(view, pageId) { - var me = this; - - if('#edit-users-view' == pageId) { - me.initEditUsers(); - Common.Utils.addScrollIfNeed('.page[data-page=edit-users-view]', '.page[data-page=edit-users-view] .page-content'); - } else { - } - }, - - onChangeEditUsers: function(users) { - editUsers = users; - }, - - initEditUsers: function() { - var usersArray = []; - _.each(editUsers, function(item){ - var fio = item.asc_getUserName().split(' '); - var initials = fio[0].substring(0, 1).toUpperCase(); - if (fio.length > 1) { - initials += fio[fio.length - 1].substring(0, 1).toUpperCase(); - } - if(!item.asc_getView()) { - var userAttr = { - color: item.asc_getColor(), - id: item.asc_getId(), - idOriginal: item.asc_getIdOriginal(), - name: item.asc_getUserName(), - view: item.asc_getView(), - initial: initials - }; - if(item.asc_getIdOriginal() == _userId) { - usersArray.unshift(userAttr); - } else { - usersArray.push(userAttr); - } - } - }); - var userSort = _.chain(usersArray).groupBy('idOriginal').value(); - var templateUserItem = _.template([ - '<% _.each(users, function (user) { %>', - '
  • ' + - '
    ' + - '
    <%= user[0].initial %>
    '+ - '' + - '<% if (user.length>1) { %><% } %>' + - '
    '+ - '
  • ', - '<% }); %>'].join('')); - var templateUserList = _.template( - '
    ' + - this.textEditUser + - '
    ' + - '
      ' + - templateUserItem({users: userSort}) + - '
    '); - $('#user-list').html(templateUserList()); - }, - - - textEditUser: 'Document is currently being edited by several users.' - - } - })(), SSE.Controllers.Collaboration || {})) -}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app/controller/Settings.js b/apps/spreadsheeteditor/mobile/app/controller/Settings.js index 26966e450..7babd4a74 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Settings.js @@ -282,7 +282,7 @@ define([ }, onCollaboration: function() { - SSE.getController('Collaboration').showModal(); + SSE.getController('Common.Controllers.Collaboration').showModal(); }, initSpreadsheetSettings: function() { diff --git a/apps/spreadsheeteditor/mobile/app/template/Collaboration.template b/apps/spreadsheeteditor/mobile/app/template/Collaboration.template deleted file mode 100644 index 599f0a369..000000000 --- a/apps/spreadsheeteditor/mobile/app/template/Collaboration.template +++ /dev/null @@ -1,47 +0,0 @@ - -
    - - -
    - - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app/view/Collaboration.js b/apps/spreadsheeteditor/mobile/app/view/Collaboration.js deleted file mode 100644 index be4328c70..000000000 --- a/apps/spreadsheeteditor/mobile/app/view/Collaboration.js +++ /dev/null @@ -1,149 +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 - * - */ - -/** - * Collaboration.js - * Presentation Editor - * - * Created by Julia Svinareva on 31/5/19 - * Copyright (c) 2019 Ascensio System SIA. All rights reserved. - * - */ - -define([ - 'text!spreadsheeteditor/mobile/app/template/Collaboration.template', - 'jquery', - 'underscore', - 'backbone' -], function (settingsTemplate, $, _, Backbone) { - 'use strict'; - - SSE.Views.Collaboration = Backbone.View.extend(_.extend((function() { - // private - - return { - - template: _.template(settingsTemplate), - - events: { - // - }, - - initialize: function() { - Common.NotificationCenter.on('collaborationcontainer:show', _.bind(this.initEvents, this)); - this.on('page:show', _.bind(this.updateItemHandlers, this)); - }, - - initEvents: function () { - var me = this; - - Common.Utils.addScrollIfNeed('.view[data-page=collaboration-root-view] .pages', '.view[data-page=collaboration-root-view] .page'); - me.updateItemHandlers(); - }, - - initControls: function() { - // - }, - - // Render layout - render: function() { - this.layout = $('
    ').append(this.template({ - android : Common.SharedSettings.get('android'), - phone : Common.SharedSettings.get('phone'), - orthography: Common.SharedSettings.get('sailfish'), - scope : this - })); - - return this; - }, - - updateItemHandlers: function () { - var selectorsDynamicPage = [ - '.page[data-page=collaboration-root-view]' - ].map(function (selector) { - return selector + ' a.item-link[data-page]'; - }).join(', '); - - $(selectorsDynamicPage).single('click', _.bind(this.onItemClick, this)); - }, - - onItemClick: function (e) { - var $target = $(e.currentTarget), - page = $target.data('page'); - - if (page && page.length > 0 ) { - this.showPage(page); - } - }, - - rootLayout: function () { - if (this.layout) { - var $layour = this.layout.find('#collaboration-root-view'), - isPhone = Common.SharedSettings.get('phone'); - - return $layour.html(); - } - - return ''; - }, - - showPage: function(templateId, animate) { - var rootView = SSE.getController('Collaboration').rootView(); - - if (rootView && this.layout) { - var $content = this.layout.find(templateId); - - // Android fix for navigation - if (Framework7.prototype.device.android) { - $content.find('.page').append($content.find('.navbar')); - } - - rootView.router.load({ - content: $content.html(), - animatePages: animate !== false - }); - - this.fireEvent('page:show', [this, templateId]); - } - }, - - - - textCollaboration: 'Collaboration', - textСomments: 'Сomments', - textBack: 'Back', - textEditUsers: 'Users' - - } - })(), SSE.Views.Collaboration || {})) -}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app/view/Toolbar.js b/apps/spreadsheeteditor/mobile/app/view/Toolbar.js index d5bc17b8e..00bfacc15 100644 --- a/apps/spreadsheeteditor/mobile/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/mobile/app/view/Toolbar.js @@ -158,7 +158,7 @@ define([ //Collaboration showCollaboration: function () { - SSE.getController('Collaboration').showModal(); + SSE.getController('Common.Controllers.Collaboration').showModal(); }, textBack: 'Back' diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 801de3914..e897f9296 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -300,7 +300,7 @@ "SSE.Controllers.Toolbar.dlgLeaveTitleText": "You leave the application", "SSE.Controllers.Toolbar.leaveButtonText": "Leave this Page", "SSE.Controllers.Toolbar.stayButtonText": "Stay on this Page", - "SSE.Controllers.Collaboration.textEditUser": "Document is currently being edited by several users.", + "Common.Controllers.Collaboration.textEditUser": "Document is currently being edited by several users.", "SSE.Controllers.FilterOptions.textEmptyItem": "{Blanks}", "SSE.Controllers.FilterOptions.textSelectAll": "Select All", "SSE.Controllers.FilterOptions.textErrorTitle": "Warning", @@ -556,10 +556,10 @@ "SSE.Views.Settings.textR1C1Style": "R1C1 Reference Style", "SSE.Views.Settings.textRegionalSettings": "Regional Settings", "SSE.Views.Toolbar.textBack": "Back", - "SSE.Views.Collaboration.textCollaboration": "Collaboration", - "SSE.Views.Collaboration.textСomments": "Сomments", - "SSE.Views.Collaboration.textBack": "Back", - "SSE.Views.Collaboration.textEditUsers": "Users", + "Common.Views.Collaboration.textCollaboration": "Collaboration", + "Common.Views.Collaboration.textСomments": "Сomments", + "Common.Views.Collaboration.textBack": "Back", + "Common.Views.Collaboration.textEditUsers": "Users", "SSE.Views.FilterOptions.textFilter": "Filter Options", "SSE.Views.FilterOptions.textClearFilter": "Clear Filter", "SSE.Views.FilterOptions.textDeleteFilter": "Delete Filter"