-
-
- +
-
diff --git a/apps/common/mobile/resources/less/ios/_color-palette.less b/apps/common/mobile/resources/less/ios/_color-palette.less index f243b1ef6..9e868c0c1 100644 --- a/apps/common/mobile/resources/less/ios/_color-palette.less +++ b/apps/common/mobile/resources/less/ios/_color-palette.less @@ -164,3 +164,8 @@ } } } + +#font-color-auto.active .color-auto { + box-shadow: 0 0 0 1px white, 0 0 0 4px @themeColor; + border-radius: 1px; +} diff --git a/apps/common/mobile/resources/less/material/_color-palette.less b/apps/common/mobile/resources/less/material/_color-palette.less index 511765221..c6284cf79 100644 --- a/apps/common/mobile/resources/less/material/_color-palette.less +++ b/apps/common/mobile/resources/less/material/_color-palette.less @@ -168,4 +168,8 @@ } } } -} \ No newline at end of file +} +#font-color-auto.active .color-auto { + box-shadow: 0 0 0 1px white, 0 0 0 4px @themeColor; + border-radius: 1px; +} diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 1798f3976..3bf2092be 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -91,12 +91,16 @@ DE.ApplicationController = new(function(){ permissions = $.extend(permissions, docConfig.permissions); var _permissions = $.extend({}, docConfig.permissions), - docInfo = new Asc.asc_CDocInfo(); + docInfo = new Asc.asc_CDocInfo(), + _user = new Asc.asc_CUserInfo(); + _user.put_Id(config.user && config.user.id ? config.user.id : ('uid-' + Date.now())); + docInfo.put_Id(docConfig.key); docInfo.put_Url(docConfig.url); docInfo.put_Title(docConfig.title); docInfo.put_Format(docConfig.fileType); docInfo.put_VKey(docConfig.vkey); + docInfo.put_UserInfo(_user); docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(config.encryptionKeys); diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index c0930f086..f47f50bd1 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -631,9 +631,11 @@ define([ }, autoCorrect: function() { - (new Common.Views.AutoCorrectDialog({ + if (this.dlgAutoCorrect && this.dlgAutoCorrect.isVisible()) return; + this.dlgAutoCorrect = new Common.Views.AutoCorrectDialog({ api: this.api - })).show(); + }); + this.dlgAutoCorrect.show(); }, strLiveComment: 'Turn on option', @@ -1127,7 +1129,7 @@ define([ var appname = (this.api) ? this.api.asc_getAppProps() : null; if (appname) { - appname = (appname.asc_getApplication() || '') + ' ' + (appname.asc_getAppVersion() || ''); + appname = (appname.asc_getApplication() || '') + (appname.asc_getAppVersion() ? ' ' : '') + (appname.asc_getAppVersion() || ''); this.lblApplication.text(appname); } this._ShowHideInfoItem(this.lblApplication, !!appname); diff --git a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js index a9e5638af..6eb3ee1e9 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js @@ -207,7 +207,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); this.Spacing = properties.get_Spacing(); } - this.Spacing.put_Before(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + var value = field.getNumberValue(); + this.Spacing.put_Before(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value)); }, this)); this.spinners.push(this.numSpacingBefore); @@ -227,7 +228,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); this.Spacing = properties.get_Spacing(); } - this.Spacing.put_After(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + var value = field.getNumberValue(); + this.Spacing.put_After(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value)); }, this)); this.spinners.push(this.numSpacingAfter); @@ -795,8 +797,10 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem this.numIndentsLeft.setValue(this.LeftIndent!==null ? Common.Utils.Metric.fnRecalcFromMM(this.LeftIndent) : '', true); this.numIndentsRight.setValue((props.get_Ind() !== null && props.get_Ind().get_Right() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_Right()) : '', true); - this.numSpacingBefore.setValue((props.get_Spacing() !== null && props.get_Spacing().get_Before() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Before()) : '', true); - this.numSpacingAfter.setValue((props.get_Spacing() !== null && props.get_Spacing().get_After() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_After()) : '', true); + var value = props.get_Spacing() ? props.get_Spacing().get_Before() : null; + this.numSpacingBefore.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true); + value = props.get_Spacing() ? props.get_Spacing().get_After() : null; + this.numSpacingAfter.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true); var linerule = props.get_Spacing().get_LineRule(); this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true); diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 5b8ae11ae..4cc806463 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -639,9 +639,9 @@ define([ $(document).on('contextmenu', _.bind(me.onContextMenu, me)); if (!me.appOptions.canReview) { - var canViewReview = me.appOptions.isEdit || me.api.asc_HaveRevisionsChanges(true); - DE.getController('Common.Controllers.Collaboration').setCanViewReview(canViewReview); - if (canViewReview) { + me.appOptions.canViewReview = me.appOptions.isEdit || me.api.asc_HaveRevisionsChanges(true); + DE.getController('Common.Controllers.Collaboration').setCanViewReview(me.appOptions.canViewReview); + if (me.appOptions.canViewReview) { var viewReviewMode = Common.localStorage.getItem("de-view-review-mode"); if (viewReviewMode===null) viewReviewMode = me.appOptions.customization && /^(original|final|markup)$/i.test(me.appOptions.customization.reviewDisplay) ? me.appOptions.customization.reviewDisplay.toLocaleLowerCase() : 'original'; @@ -649,6 +649,7 @@ define([ DE.getController('Common.Controllers.Collaboration').turnDisplayMode(viewReviewMode); } } + DE.getController('Toolbar').displayCollaboration(); Common.Gateway.documentReady(); diff --git a/apps/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index 2787d8455..d476fae33 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -442,7 +442,7 @@ define([ var appProps = (this.api) ? this.api.asc_getAppProps() : null; if (appProps) { - var appName = (appProps.asc_getApplication() || '') + ' ' + (appProps.asc_getAppVersion() || ''); + var appName = (appProps.asc_getApplication() || '') + (appProps.asc_getAppVersion() ? ' ' : '') + (appProps.asc_getAppVersion() || ''); appName ? $('#settings-doc-application').html(appName) : $('.display-application').remove(); } var props = (this.api) ? this.api.asc_getCoreProps() : null; diff --git a/apps/documenteditor/mobile/app/controller/Toolbar.js b/apps/documenteditor/mobile/app/controller/Toolbar.js index 9821de2ce..da1b50097 100644 --- a/apps/documenteditor/mobile/app/controller/Toolbar.js +++ b/apps/documenteditor/mobile/app/controller/Toolbar.js @@ -52,6 +52,7 @@ define([ DE.Controllers.Toolbar = Backbone.Controller.extend(_.extend((function() { // private var stateDisplayMode = false; + var _users = []; return { models: [], @@ -78,12 +79,14 @@ define([ this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); - this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.displayCollaboration, this)); - this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.displayCollaboration, this)); + this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onUsersChanged, this)); + this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onUsersChanged, this)); + this.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(this.onUserConnection, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); }, setMode: function (mode) { + this.mode = mode; this.getView('Toolbar').setMode(mode); }, @@ -191,19 +194,38 @@ define([ DE.getController('Settings').hideModal(); }, - displayCollaboration: function(users) { - if(users !== undefined) { + displayCollaboration: function() { + if(_users !== undefined) { var length = 0; - _.each(users, function (item) { - if (!item.asc_getView()) + _.each(_users, function (item) { + if ((item.asc_getState()!==false) && !item.asc_getView()) length++; }); - if (length > 0) { - $('#toolbar-collaboration').show(); - } else { + if (length < 1 && this.mode && !this.mode.canViewComments && !this.mode.canReview && !this.mode.canViewReview) $('#toolbar-collaboration').hide(); + else + $('#toolbar-collaboration').show(); + } + }, + + onUsersChanged: function(users) { + _users = users; + this.displayCollaboration(); + }, + + onUserConnection: function(change){ + var changed = false; + for (var uid in _users) { + if (undefined !== uid) { + var user = _users[uid]; + if (user && user.asc_getId() == change.asc_getId()) { + _users[uid] = change; + changed = true; + } } } + !changed && change && (_users[change.asc_getId()] = change); + this.displayCollaboration(); }, dlgLeaveTitleText : 'You leave the application', diff --git a/apps/documenteditor/mobile/app/controller/edit/EditParagraph.js b/apps/documenteditor/mobile/app/controller/edit/EditParagraph.js index 6175d77c8..b0ac19f25 100644 --- a/apps/documenteditor/mobile/app/controller/edit/EditParagraph.js +++ b/apps/documenteditor/mobile/app/controller/edit/EditParagraph.js @@ -244,7 +244,7 @@ define([ if ($button.hasClass('decrement')) { distance = Math.max(-1, distance - step); } else { - distance = Math.min(maxValue, distance + step); + distance = (distance<0) ? 0 : Math.min(maxValue, distance + step); } var distanceFix = parseFloat(distance.toFixed(2)); @@ -273,7 +273,7 @@ define([ if ($button.hasClass('decrement')) { distance = Math.max(-1, distance - step); } else { - distance = Math.min(maxValue, distance + step); + distance = (distance<0) ? 0 : Math.min(maxValue, distance + step); } var distanceFix = parseFloat(distance.toFixed(2)); diff --git a/apps/documenteditor/mobile/app/controller/edit/EditText.js b/apps/documenteditor/mobile/app/controller/edit/EditText.js index 77cb799f6..08f0ba0af 100644 --- a/apps/documenteditor/mobile/app/controller/edit/EditText.js +++ b/apps/documenteditor/mobile/app/controller/edit/EditText.js @@ -132,8 +132,8 @@ define([ _paragraphObject.get_SmallCaps() && $inputTextCaps.val(['small']).prop('prevValue', 'small'); _paragraphObject.get_AllCaps() && $inputTextCaps.val(['all']).prop('prevValue', 'all'); - _fontInfo.letterSpacing = Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_TextSpacing()); - $('#letter-spacing .item-after label').text(_fontInfo.letterSpacing + ' ' + Common.Utils.Metric.getCurrentMetricName()); + _fontInfo.letterSpacing = (_paragraphObject.get_TextSpacing()===null || _paragraphObject.get_TextSpacing()===undefined) ? _paragraphObject.get_TextSpacing() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_TextSpacing()); + $('#letter-spacing .item-after label').text((_fontInfo.letterSpacing===null || _fontInfo.letterSpacing===undefined) ? '' : _fontInfo.letterSpacing + ' ' + Common.Utils.Metric.getCurrentMetricName()); } }, @@ -327,9 +327,9 @@ define([ spacing = _fontInfo.letterSpacing; if ($button.hasClass('decrement')) { - spacing = Math.max(-100, --spacing); + spacing = (spacing===null || spacing===undefined) ? 0 : Math.max(-100, --spacing); } else { - spacing = Math.min(100, ++spacing); + spacing = (spacing===null || spacing===undefined) ? 0 : Math.min(100, ++spacing); } _fontInfo.letterSpacing = spacing; @@ -370,7 +370,9 @@ define([ } if (this.api) { - this.api.put_TextColor(Common.Utils.ThemeColor.getRgbColor("000000")); + var color = new Asc.asc_CColor(); + color.put_auto(true); + this.api.put_TextColor(color); } }, @@ -449,7 +451,8 @@ define([ onApiBullets: function(data) { var type = data.get_ListType(), subtype = data.get_ListSubType(); - + $('.dataview.bullets li').removeClass('active'); + $('.dataview.numbers li').removeClass('active'); switch (type) { case 0: $('.dataview.bullets li[data-type=' + subtype + ']').addClass('active'); @@ -457,6 +460,9 @@ define([ case 1: $('.dataview.numbers li[data-type=' + subtype + ']').addClass('active'); break; + default: + $('.dataview.bullets li[data-type="-1"]').addClass('active'); + $('.dataview.numbers li[data-type="-1"]').addClass('active'); } }, @@ -480,12 +486,17 @@ define([ onApiTextColor: function (color) { var me = this; + var palette = this.getView('EditText').paletteTextColor; if (color.get_auto()) { + if (palette) { + palette.clearSelection(); + } + $('#font-color .color-preview').css('background-color', '#000'); + $('#font-color-auto').addClass('active'); } else { - var palette = me.getView('EditText').paletteTextColor, - clr; + var clr; if (color) { if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { @@ -499,7 +510,7 @@ define([ $('#font-color .color-preview').css('background-color', '#' + (_.isObject(clr) ? clr.color : clr)); } - + $('#font-color-auto').removeClass('active'); if (palette) { palette.select(clr); } diff --git a/apps/documenteditor/mobile/app/template/EditTable.template b/apps/documenteditor/mobile/app/template/EditTable.template index 45d5b1fe0..6dc95f580 100644 --- a/apps/documenteditor/mobile/app/template/EditTable.template +++ b/apps/documenteditor/mobile/app/template/EditTable.template @@ -211,7 +211,7 @@0 ptdiff --git a/apps/documenteditor/mobile/app/template/EditText.template b/apps/documenteditor/mobile/app/template/EditText.template index 76080e08e..6701dc869 100644 --- a/apps/documenteditor/mobile/app/template/EditText.template +++ b/apps/documenteditor/mobile/app/template/EditText.template @@ -158,7 +158,7 @@- +<%= scope.textAutomatic %>diff --git a/apps/documenteditor/mobile/resources/css/app-ios.css b/apps/documenteditor/mobile/resources/css/app-ios.css index 45c50e170..33440b872 100644 --- a/apps/documenteditor/mobile/resources/css/app-ios.css +++ b/apps/documenteditor/mobile/resources/css/app-ios.css @@ -6354,6 +6354,10 @@ html.pixel-ratio-3 .document-menu .list-block li:last-child li .item-inner:after .custom-colors .color-picker-wheel .color-picker-sb-spectrum-handle.color-picker-sb-spectrum-handle-pressed:after { transform: scale(1.5) translate(-33.333%, -33.333%); } +#font-color-auto.active .color-auto { + box-shadow: 0 0 0 1px white, 0 0 0 4px #446995; + border-radius: 1px; +} .about .page-content { text-align: center; } diff --git a/apps/documenteditor/mobile/resources/css/app-material.css b/apps/documenteditor/mobile/resources/css/app-material.css index ff00967da..3051ef762 100644 --- a/apps/documenteditor/mobile/resources/css/app-material.css +++ b/apps/documenteditor/mobile/resources/css/app-material.css @@ -5929,6 +5929,10 @@ html.phone .document-menu .list-block .item-link { .custom-colors .color-picker-wheel .color-picker-sb-spectrum-handle.color-picker-sb-spectrum-handle-pressed:after { transform: scale(1.5) translate(-33.333%, -33.333%); } +#font-color-auto.active .color-auto { + box-shadow: 0 0 0 1px white, 0 0 0 4px #446995; + border-radius: 1px; +} .about .page-content { text-align: center; } diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index b33c53850..c251151be 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -92,12 +92,16 @@ PE.ApplicationController = new(function(){ permissions = $.extend(permissions, docConfig.permissions); var _permissions = $.extend({}, docConfig.permissions), - docInfo = new Asc.asc_CDocInfo(); + docInfo = new Asc.asc_CDocInfo(), + _user = new Asc.asc_CUserInfo(); + _user.put_Id(config.user && config.user.id ? config.user.id : ('uid-' + Date.now())); + docInfo.put_Id(docConfig.key); docInfo.put_Url(docConfig.url); docInfo.put_Title(docConfig.title); docInfo.put_Format(docConfig.fileType); docInfo.put_VKey(docConfig.vkey); + docInfo.put_UserInfo(_user); docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(config.encryptionKeys); diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 6baae7269..20b5c73a5 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -543,9 +543,11 @@ define([ }, autoCorrect: function() { - (new Common.Views.AutoCorrectDialog({ + if (this.dlgAutoCorrect && this.dlgAutoCorrect.isVisible()) return; + this.dlgAutoCorrect = new Common.Views.AutoCorrectDialog({ api: this.api - })).show(); + }); + this.dlgAutoCorrect.show(); }, strInputMode: 'Turn on hieroglyphs', @@ -998,7 +1000,7 @@ define([ var appname = (this.api) ? this.api.asc_getAppProps() : null; if (appname) { - appname = (appname.asc_getApplication() || '') + ' ' + (appname.asc_getAppVersion() || ''); + appname = (appname.asc_getApplication() || '') + (appname.asc_getAppVersion() ? ' ' : '') + (appname.asc_getAppVersion() || ''); this.lblApplication.text(appname); } this._ShowHideInfoItem(this.lblApplication, !!appname); diff --git a/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js index 7d772dc4e..bbd577d93 100644 --- a/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js @@ -212,7 +212,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); this.Spacing = properties.get_Spacing(); } - this.Spacing.put_Before(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + var value = field.getNumberValue(); + this.Spacing.put_Before(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value)); }, this)); this.spinners.push(this.numSpacingBefore); @@ -232,7 +233,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); this.Spacing = properties.get_Spacing(); } - this.Spacing.put_After(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + var value = field.getNumberValue(); + this.Spacing.put_After(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value)); }, this)); this.spinners.push(this.numSpacingAfter); @@ -467,8 +469,10 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced this.cmbSpecial.setValue(this.CurSpecial); this.numSpecialBy.setValue(this.FirstLine!== null ? Math.abs(Common.Utils.Metric.fnRecalcFromMM(this.FirstLine)) : '', true); - this.numSpacingBefore.setValue((props.get_Spacing() !== null && props.get_Spacing().get_Before() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Before()) : '', true); - this.numSpacingAfter.setValue((props.get_Spacing() !== null && props.get_Spacing().get_After() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_After()) : '', true); + var value = props.get_Spacing() ? props.get_Spacing().get_Before() : null; + this.numSpacingBefore.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true); + value = props.get_Spacing() ? props.get_Spacing().get_After() : null; + this.numSpacingAfter.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true); var linerule = props.get_Spacing().get_LineRule(); this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true); diff --git a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js index 2d43e631c..6b58dad79 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js @@ -202,7 +202,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem width: 100, defaultUnit : "cm", value: '0.19 cm', - maxValue: 9.34, + maxValue: 55.87, minValue: 0 }); this.spnMarginLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){ @@ -220,7 +220,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem width: 100, defaultUnit : "cm", value: '0.19 cm', - maxValue: 9.34, + maxValue: 55.87, minValue: 0 }); this.spnMarginRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ diff --git a/apps/presentationeditor/main/app/view/TableSettingsAdvanced.js b/apps/presentationeditor/main/app/view/TableSettingsAdvanced.js index 258e5a602..5418b1aa3 100644 --- a/apps/presentationeditor/main/app/view/TableSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/TableSettingsAdvanced.js @@ -147,7 +147,7 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem width: 85, defaultUnit : "cm", value: '0.19 cm', - maxValue: 9.34, + maxValue: 55.87, minValue: 0 }); this.spnTableMarginLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){ @@ -167,7 +167,7 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem width: 85, defaultUnit : "cm", value: '0.19 cm', - maxValue: 9.34, + maxValue: 55.87, minValue: 0 }); this.spnTableMarginRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ @@ -259,7 +259,7 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem width: 85, defaultUnit : "cm", value: '0.19 cm', - maxValue: 9.34, + maxValue: 55.87, minValue: 0 }); this.spnMarginLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){ @@ -279,7 +279,7 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem width: 85, defaultUnit : "cm", value: '0.19 cm', - maxValue: 9.34, + maxValue: 55.87, minValue: 0 }); this.spnMarginRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ diff --git a/apps/presentationeditor/mobile/app/controller/Settings.js b/apps/presentationeditor/mobile/app/controller/Settings.js index 4d3f3d1b3..ee921a5bb 100644 --- a/apps/presentationeditor/mobile/app/controller/Settings.js +++ b/apps/presentationeditor/mobile/app/controller/Settings.js @@ -226,7 +226,7 @@ define([ var appProps = (this.api) ? this.api.asc_getAppProps() : null; if (appProps) { - var appName = (appProps.asc_getApplication() || '') + ' ' + (appProps.asc_getAppVersion() || ''); + var appName = (appProps.asc_getApplication() || '') + (appProps.asc_getAppVersion() ? ' ' : '') + (appProps.asc_getAppVersion() || ''); appName ? $('#settings-pe-application').html(appName) : $('.display-application').remove(); } diff --git a/apps/presentationeditor/mobile/app/controller/Toolbar.js b/apps/presentationeditor/mobile/app/controller/Toolbar.js index cb9b42416..2d1c9f527 100644 --- a/apps/presentationeditor/mobile/app/controller/Toolbar.js +++ b/apps/presentationeditor/mobile/app/controller/Toolbar.js @@ -51,6 +51,7 @@ define([ PE.Controllers.Toolbar = Backbone.Controller.extend(_.extend((function() { // private + var _users = []; return { models: [], @@ -77,13 +78,15 @@ define([ this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); - this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.displayCollaboration, this)); - this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.displayCollaboration, this)); + this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onUsersChanged, this)); + this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onUsersChanged, this)); + this.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(this.onUserConnection, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPages, this)); }, setMode: function (mode) { + this.mode = mode; this.getView('Toolbar').setMode(mode); }, @@ -200,19 +203,38 @@ define([ PE.getController('Settings').hideModal(); }, - displayCollaboration: function(users) { - if(users !== undefined) { + displayCollaboration: function() { + if(_users !== undefined) { var length = 0; - _.each(users, function (item) { - if (!item.asc_getView()) + _.each(_users, function (item) { + if ((item.asc_getState()!==false) && !item.asc_getView()) length++; }); - if (length > 0) { - $('#toolbar-collaboration').show(); - } else { + if (length < 1 && this.mode && !this.mode.canViewComments) $('#toolbar-collaboration').hide(); + else + $('#toolbar-collaboration').show(); + } + }, + + onUsersChanged: function(users) { + _users = users; + this.displayCollaboration(); + }, + + onUserConnection: function(change){ + var changed = false; + for (var uid in _users) { + if (undefined !== uid) { + var user = _users[uid]; + if (user && user.asc_getId() == change.asc_getId()) { + _users[uid] = change; + changed = true; + } } } + !changed && change && (_users[change.asc_getId()] = change); + this.displayCollaboration(); }, dlgLeaveTitleText : 'You leave the application', diff --git a/apps/presentationeditor/mobile/app/controller/edit/EditText.js b/apps/presentationeditor/mobile/app/controller/edit/EditText.js index 9ad65b8a0..116758067 100644 --- a/apps/presentationeditor/mobile/app/controller/edit/EditText.js +++ b/apps/presentationeditor/mobile/app/controller/edit/EditText.js @@ -146,8 +146,8 @@ define([ _paragraphObject.get_SmallCaps() && $inputTextCaps.val(['small']).prop('prevValue', 'small'); _paragraphObject.get_AllCaps() && $inputTextCaps.val(['all']).prop('prevValue', 'all'); - _fontInfo.letterSpacing = Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_TextSpacing()); - $('#letter-spacing .item-after label').text(_fontInfo.letterSpacing + ' ' + Common.Utils.Metric.getCurrentMetricName()); + _fontInfo.letterSpacing = (_paragraphObject.get_TextSpacing()===null || _paragraphObject.get_TextSpacing()===undefined) ? _paragraphObject.get_TextSpacing() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_TextSpacing()); + $('#letter-spacing .item-after label').text((_fontInfo.letterSpacing===null || _fontInfo.letterSpacing===undefined) ? '' : _fontInfo.letterSpacing + ' ' + Common.Utils.Metric.getCurrentMetricName()); } _paragraphInfo.spaceBefore = _paragraphObject.get_Spacing().get_Before() < 0 ? _paragraphObject.get_Spacing().get_Before() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_Spacing().get_Before()); @@ -304,9 +304,9 @@ define([ spacing = _fontInfo.letterSpacing; if ($button.hasClass('decrement')) { - spacing = Math.max(-100, --spacing); + spacing = (spacing===null || spacing===undefined) ? 0 : Math.max(-100, --spacing); } else { - spacing = Math.min(100, ++spacing); + spacing = (spacing===null || spacing===undefined) ? 0 : Math.min(100, ++spacing); } _fontInfo.letterSpacing = spacing; @@ -415,35 +415,58 @@ define([ onDistanceBefore: function (e) { var $button = $(e.currentTarget), - distance = _paragraphInfo.spaceBefore; + distance = _paragraphInfo.spaceBefore, + step, + maxValue; + + if (Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.pt) { + step = 1; + } else { + step = 0.01; + } + + maxValue = Common.Utils.Metric.fnRecalcFromMM(558.8); if ($button.hasClass('decrement')) { - distance = Math.max(-1, --distance); + distance = Math.max(-1, distance - step); } else { - distance = Math.min(100, ++distance); + distance = (distance<0) ? 0 : Math.min(maxValue, distance + step); } + var distanceFix = parseFloat(distance.toFixed(2)); + _paragraphInfo.spaceBefore = distance; - $('#paragraph-distance-before .item-after label').text(_paragraphInfo.spaceBefore < 0 ? 'Auto' : (_paragraphInfo.spaceBefore) + ' ' + metricText); + $('#paragraph-distance-before .item-after label').text(_paragraphInfo.spaceBefore < 0 ? 'Auto' : distanceFix + ' ' + metricText); this.api.put_LineSpacingBeforeAfter(0, (_paragraphInfo.spaceBefore < 0) ? -1 : Common.Utils.Metric.fnRecalcToMM(_paragraphInfo.spaceBefore)); }, onDistanceAfter: function (e) { var $button = $(e.currentTarget), - distance = _paragraphInfo.spaceAfter; + distance = _paragraphInfo.spaceAfter, + step, + maxValue; + + if (Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.pt) { + step = 1; + } else { + step = 0.01; + } + + maxValue = Common.Utils.Metric.fnRecalcFromMM(558.8); if ($button.hasClass('decrement')) { - distance = Math.max(-1, --distance); + distance = Math.max(-1, distance - step); } else { - distance = Math.min(100, ++distance); + distance = (distance<0) ? 0 : Math.min(maxValue, distance + step); } + var distanceFix = parseFloat(distance.toFixed(2)); + _paragraphInfo.spaceAfter = distance; - $('#paragraph-distance-after .item-after label').text(_paragraphInfo.spaceAfter < 0 ? 'Auto' : (_paragraphInfo.spaceAfter) + ' ' + metricText); - + $('#paragraph-distance-after .item-after label').text(_paragraphInfo.spaceAfter < 0 ? 'Auto' : distanceFix + ' ' + metricText); this.api.put_LineSpacingBeforeAfter(1, (_paragraphInfo.spaceAfter < 0) ? -1 : Common.Utils.Metric.fnRecalcToMM(_paragraphInfo.spaceAfter)); }, @@ -544,7 +567,8 @@ define([ onApiBullets: function(data) { var type = data.get_ListType(), subtype = data.get_ListSubType(); - + $('.dataview.bullets li').removeClass('active'); + $('.dataview.numbers li').removeClass('active'); switch (type) { case 0: $('.dataview.bullets li[data-type=' + subtype + ']').addClass('active'); @@ -552,6 +576,9 @@ define([ case 1: $('.dataview.numbers li[data-type=' + subtype + ']').addClass('active'); break; + default: + $('.dataview.bullets li[data-type="-1"]').addClass('active'); + $('.dataview.numbers li[data-type="-1"]').addClass('active'); } }, diff --git a/apps/presentationeditor/mobile/app/template/EditTable.template b/apps/presentationeditor/mobile/app/template/EditTable.template index 2846e673f..fc6ac933c 100644 --- a/apps/presentationeditor/mobile/app/template/EditTable.template +++ b/apps/presentationeditor/mobile/app/template/EditTable.template @@ -73,7 +73,7 @@0 ptdiff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index a782216a7..ca30a2365 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -90,12 +90,16 @@ SSE.ApplicationController = new(function(){ permissions = $.extend(permissions, docConfig.permissions); var _permissions = $.extend({}, docConfig.permissions), - docInfo = new Asc.asc_CDocInfo(); + docInfo = new Asc.asc_CDocInfo(), + _user = new Asc.asc_CUserInfo(); + _user.put_Id(config.user && config.user.id ? config.user.id : ('uid-' + Date.now())); + docInfo.put_Id(docConfig.key); docInfo.put_Url(docConfig.url); docInfo.put_Title(docConfig.title); docInfo.put_Format(docConfig.fileType); docInfo.put_VKey(docConfig.vkey); + docInfo.put_UserInfo(_user); docInfo.put_Token(docConfig.token); docInfo.put_Permissions(_permissions); docInfo.put_EncryptedInfo(config.encryptionKeys); diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index b5f954932..7a953d193 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -1443,9 +1443,11 @@ define([ }, autoCorrect: function() { - (new Common.Views.AutoCorrectDialog({ + if (this.dlgAutoCorrect && this.dlgAutoCorrect.isVisible()) return; + this.dlgAutoCorrect = new Common.Views.AutoCorrectDialog({ api: this.api - })).show(); + }); + this.dlgAutoCorrect.show(); }, strIgnoreWordsInUPPERCASE: 'Ignore words in UPPERCASE', @@ -1853,7 +1855,7 @@ define([ var appname = (this.api) ? this.api.asc_getAppProps() : null; if (appname) { - appname = (appname.asc_getApplication() || '') + ' ' + (appname.asc_getAppVersion() || ''); + appname = (appname.asc_getApplication() || '') + (appname.asc_getAppVersion() ? ' ' : '') + (appname.asc_getAppVersion() || ''); this.lblApplication.text(appname); } this._ShowHideInfoItem(this.lblApplication, !!appname); diff --git a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js index b112cdb5e..85d811549 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js @@ -86,16 +86,6 @@ define([ this.api.asc_registerCallback('asc_onHidePopMenu', _.bind(this.onApiHidePopMenu, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect,this)); - this.api.asc_registerCallback('asc_onShowComment', _.bind(this.onApiShowComment, this)); - this.api.asc_registerCallback('asc_onHideComment', _.bind(this.onApiHideComment, this)); - }, - - onApiShowComment: function(comments) { - _isComments = comments && comments.length>0; - }, - - onApiHideComment: function() { - _isComments = false; }, setMode: function (mode) { @@ -313,6 +303,7 @@ define([ var iscelllocked = cellinfo.asc_getLocked(), seltype = cellinfo.asc_getSelectionType(), xfs = cellinfo.asc_getXfs(); + _isComments = cellinfo.asc_getComments().length>0; //prohibit adding multiple comments in one cell; switch (seltype) { case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break; diff --git a/apps/spreadsheeteditor/mobile/app/controller/Settings.js b/apps/spreadsheeteditor/mobile/app/controller/Settings.js index 4a0005217..ab7d32a02 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Settings.js @@ -295,7 +295,7 @@ define([ var appProps = (this.api) ? this.api.asc_getAppProps() : null; if (appProps) { - var appName = (appProps.asc_getApplication() || '') + ' ' + (appProps.asc_getAppVersion() || ''); + var appName = (appProps.asc_getApplication() || '') + (appProps.asc_getAppVersion() ? ' ' : '') + (appProps.asc_getAppVersion() || ''); appName ? $('#settings-sse-application').html(appName) : $('.display-application').remove(); } diff --git a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js index 46328b544..74a778ffb 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js @@ -55,6 +55,7 @@ define([ book: false, sheet: false }; + var _users = []; return { models: [], @@ -84,14 +85,16 @@ define([ this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onApiWorksheetLocked, this)); this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onApiActiveSheetChanged, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); - this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.displayCollaboration, this)); - this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.displayCollaboration, this)); + this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onUsersChanged, this)); + this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onUsersChanged, this)); + this.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(this.onUserConnection, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('sheet:active', this.onApiActiveSheetChanged.bind(this)); }, setMode: function (mode) { + this.mode = mode; this.getView('Toolbar').setMode(mode); }, @@ -219,19 +222,38 @@ define([ SSE.getController('Settings').hideModal(); }, - displayCollaboration: function(users) { - if(users !== undefined) { + displayCollaboration: function() { + if(_users !== undefined) { var length = 0; - _.each(users, function (item) { - if (!item.asc_getView()) + _.each(_users, function (item) { + if ((item.asc_getState()!==false) && !item.asc_getView()) length++; }); - if (length > 0) { - $('#toolbar-collaboration').show(); - } else { + if (length < 1 && this.mode && !this.mode.canViewComments) $('#toolbar-collaboration').hide(); + else + $('#toolbar-collaboration').show(); + } + }, + + onUsersChanged: function(users) { + _users = users; + this.displayCollaboration(); + }, + + onUserConnection: function(change){ + var changed = false; + for (var uid in _users) { + if (undefined !== uid) { + var user = _users[uid]; + if (user && user.asc_getId() == change.asc_getId()) { + _users[uid] = change; + changed = true; + } } } + !changed && change && (_users[change.asc_getId()] = change); + this.displayCollaboration(); }, dlgLeaveTitleText : 'You leave the application', diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js index 983455c93..dd1096405 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js @@ -70,6 +70,7 @@ define([ var me = this; me.api = api; me.api.asc_registerCallback('asc_onError', _.bind(me.onError, me)); + me.api.asc_registerCallback('asc_onSelectionChanged', _.bind(me.onApiSelectionChanged, me)); // me.api.asc_registerCallback('asc_onInitEditorFonts', _.bind(onApiLoadFonts, me)); @@ -80,8 +81,8 @@ define([ this.view.canViewComments = mode.canViewComments; }, - setHideAddComment: function(hide) { - this.view.isComments = hide; //prohibit adding multiple comments in one cell + onApiSelectionChanged: function(info) { + this.view.isComments = info.asc_getComments().length>0; //prohibit adding multiple comments in one cell }, onLaunch: function () { diff --git a/apps/spreadsheeteditor/mobile/app/template/EditCell.template b/apps/spreadsheeteditor/mobile/app/template/EditCell.template index 3c4a872a2..edc50c93b 100644 --- a/apps/spreadsheeteditor/mobile/app/template/EditCell.template +++ b/apps/spreadsheeteditor/mobile/app/template/EditCell.template @@ -916,7 +916,7 @@
-
-
+
10:56@@ -926,7 +926,7 @@
- - +
21:56:00@@ -936,7 +936,7 @@- - +
05:56 AM@@ -946,7 +946,7 @@- - +
05:56:00 AM@@ -956,7 +956,7 @@- - +
38:56:00diff --git a/translation/convert_translation.py b/translation/convert_translation.py new file mode 100644 index 000000000..fdd8111eb --- /dev/null +++ b/translation/convert_translation.py @@ -0,0 +1,106 @@ +import os +import io +import shutil + +def strSplit(str): + result = [] + ind1 = str.find('"') + ind2 = str.find('"', ind1+1) + result.append(str[ind1+1:ind2]) + ind3 = str.find('"', ind2+1) + indLast = str.rfind('"') + result.append(str[ind3+1:indLast]) + return result +app_names = ['documenteditor', 'presentationeditor', 'spreadsheeteditor'] +app_types = ['embed', 'main', 'mobile'] +prefix_apps = '../apps/' +prefix_src = 'src/' +prefix_dest = 'dest/' +str_apps = [] +langs = [] +for i in range(len(app_names)): + for j in range (len(app_types)): + locale_path = prefix_apps + app_names[i] + '/' + app_types[j] + '/locale/' + src_path = prefix_src + app_names[i] + '/' + app_types[j] + '/locale/' + dest_path = prefix_dest + app_names[i] + '/' + app_types[j] + '/locale/' + print(locale_path) + if os.path.isdir(locale_path): + langs = os.listdir(locale_path) + if not os.path.isdir(dest_path): + os.makedirs(dest_path) + if len(langs)>0: + try: + f = io.open(locale_path + 'en.json', mode='r', encoding='utf-8') + except Exception: + continue + lines = f.readlines() + f.close() + str_apps = [] + for k in range(1, len(lines)-1): + arr = strSplit(lines[k]) + if len(arr) > 0: + str_apps.append(arr[0]) + for l in range(len(langs)): + lang = langs[l].split('.')[0] + f = io.open(locale_path + lang+ '.json', mode='r', encoding='utf-8') + lines = f.readlines() + f.close() + try: + f = io.open(src_path + lang+ '.json', mode='r', encoding='utf-8') + except Exception: + f.close() + f = io.open(dest_path + lang + '.json', mode='w', encoding='utf-8') + f.writelines(lines) + f.close() + print(' ' + lang+ '.json - copied') + continue + d_locale = dict() + d_src = dict() + # locale + for k in range(1, len(lines)-1): + arr = strSplit(lines[k]) + if len(arr) > 1: + d_locale[arr[0]] = arr[1] + # src + lines = f.readlines() + for k in range(1, len(lines)-1): + arr = strSplit(lines[k]) + if len(arr) > 1: + d_src[arr[0]] = arr[1] + f.close() + f = io.open(dest_path + lang + '.json', mode='w', encoding='utf-8') + f.write(u'{') + f.write(u'\n') + changed = 'not changed' + isFirst = True + arr_len = len(str_apps) + for k in range(arr_len): + str = str_apps[k] + if str.find('del_')==0: + continue + if str in d_src: + changed = 'changed' + str = ' "' + str + '": "' + d_src[str] + '"' + if isFirst: + isFirst = False + else: + f.write(u',\n') + f.write(str) + elif str in d_locale: + str = ' "' + str + '": "' + d_locale[str] + '"' + if isFirst: + isFirst = False + else: + f.write(u',\n') + f.write(str) + f.write(u'\n') + f.write(u'}') + f.close() + print(' ' + lang + '.json - ' + changed) + add_langs = os.listdir(src_path) + for l in range(len(langs)): + add_langs.remove(langs[l]) + for l in range(len(add_langs)): + lang = add_langs[l] + shutil.copyfile(src_path + lang, dest_path + lang) + print(' ' + lang + ' - ' + 'added') \ No newline at end of file - - +
-
-
+