Merge pull request #102 from ONLYOFFICE/hotfix/v5.1.3

v5.1.3
This commit is contained in:
Alexey Golubev 2018-04-26 18:57:25 +03:00 committed by GitHub
commit cda6734a0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 71 additions and 92 deletions

View file

@ -164,11 +164,14 @@ define([
var result = Array.prototype.slice.call(this);
args.forEach(function(sub){
if (sub instanceof Array )
Array.prototype.push.apply(result, sub);
else if (sub)
result.push(sub);
});
return result;
}
};
var _out_array = Object.create(ButtonsArray.prototype);
for ( var i in arguments ) {

View file

@ -119,7 +119,7 @@ define([
},
_onMessage: function(msg) {
if (msg && msg.Referer == "onlyoffice") {
if (msg /*&& msg.Referer == "onlyoffice"*/) {
if (msg.needUpdate)
this.trigger('accessrights', this, msg.sharingSettings);
Common.NotificationCenter.trigger('window:close', this);

View file

@ -150,7 +150,7 @@ define([
function onResetUsers(collection, opts) {
var usercount = collection.getEditingCount();
if ( $userList ) {
if ( usercount > 1 || usercount > 0 && appConfig && !appConfig.isEdit) {
if ( usercount > 1 || usercount > 0 && appConfig && !appConfig.isEdit && !appConfig.canComments) {
$userList.html(templateUserList({
users: collection.models,
usertpl: _.template(templateUserItem),
@ -172,7 +172,8 @@ define([
};
function applyUsers(count) {
if ( count > 1 || count > 0 && appConfig && !appConfig.isEdit) {
var has_edit_users = count > 1 || count > 0 && appConfig && !appConfig.isEdit && !appConfig.canComments; // has other user(s) who edit document
if ( has_edit_users ) {
$btnUsers
.attr('data-toggle', 'dropdown')
.addClass('dropdown-toggle')
@ -189,13 +190,13 @@ define([
}
$btnUsers.find('.caption')
.css({'font-size': ((count > 1 || count > 0 && appConfig && !appConfig.isEdit) ? '12px' : '14px'),
'margin-top': ((count > 1 || count > 0 && appConfig && !appConfig.isEdit) ? '0' : '-1px')})
.html((count > 1 || count > 0 && appConfig && !appConfig.isEdit) ? count : '+');
.css({'font-size': ((has_edit_users) ? '12px' : '14px'),
'margin-top': ((has_edit_users) ? '0' : '-1px')})
.html((has_edit_users) ? count : '+');
var usertip = $btnUsers.data('bs.tooltip');
if ( usertip ) {
usertip.options.title = (count > 1 || count > 0 && appConfig && !appConfig.isEdit) ? usertip.options.titleExt : usertip.options.titleNorm;
usertip.options.title = (has_edit_users) ? usertip.options.titleExt : usertip.options.titleNorm;
usertip.setContent();
}
}
@ -247,7 +248,7 @@ define([
var editingUsers = storeUsers.getEditingCount();
$btnUsers.tooltip({
title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit) ? me.tipViewUsers : me.tipAccessRights,
title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit && !appConfig.canComments) ? me.tipViewUsers : me.tipAccessRights,
titleNorm: me.tipAccessRights,
titleExt: me.tipViewUsers,
placement: 'bottom',
@ -263,7 +264,7 @@ define([
});
$labelChangeRights[(!mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length)?'show':'hide']();
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit || !mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit && !appConfig.canComments || !mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
if ( $saveStatus ) {
$saveStatus.attr('data-width', me.textSaveExpander);
@ -674,7 +675,7 @@ define([
};
btn.setDisabled( true );
} else {
btn.setDisabled( btn.keepState.disabled );
btn.setDisabled( btn.keepState && btn.keepState.disabled || lock);
delete btn.keepState;
}
}

View file

@ -154,12 +154,12 @@ define([
} else {
this.initCodePages();
this.updatePreview();
}
this.onPrimary = function() {
me._handleInput('ok');
return false;
};
}
}
},
show: function() {

View file

@ -242,13 +242,13 @@
position: absolute;
bottom: 0;
width: 100%;
z-index: 1041;
z-index: 102;
}
.toolbar {
&.cover {
ul {
z-index: 1042;
z-index: 102;
}
}
}

View file

@ -286,11 +286,11 @@ define([
clickSaveAsFormat: function(menu, format) {
if (menu) {
if (format == Asc.c_oAscFileType.TXT) {
if (format == Asc.c_oAscFileType.TXT || format == Asc.c_oAscFileType.RTF) {
Common.UI.warning({
closable: false,
title: this.notcriticalErrorTitle,
msg: this.warnDownloadAs,
msg: (format == Asc.c_oAscFileType.TXT) ? this.warnDownloadAs : this.warnDownloadAsRTF,
buttons: ['ok', 'cancel'],
callback: _.bind(function(btn){
if (btn == 'ok') {
@ -731,6 +731,7 @@ define([
textLoadHistory : 'Loading versions history...',
notcriticalErrorTitle: 'Warning',
leavePageText: 'All unsaved changes in this document will be lost.<br> Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.',
warnDownloadAs : 'If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?'
warnDownloadAs : 'If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?',
warnDownloadAsRTF : 'If you continue saving in this format some of the formatting might be lost.<br>Are you sure you want to continue?'
}, DE.Controllers.LeftMenu || {}));
});

View file

@ -169,7 +169,7 @@ define([ 'text!documenteditor/main/app/template/MailMergeEmailDlg.template',
},
_onMessage: function(msg) {
if (msg && msg.Referer == "onlyoffice") {
if (msg /*&& msg.Referer == "onlyoffice"*/) {
// if ( !_.isEmpty(msg.folder) ) {
// this.trigger('mailmergefolder', this, msg.folder); // save last folder url
// }

View file

@ -116,7 +116,7 @@ define([
},
_onMessage: function(msg) {
if (msg && msg.Referer == "onlyoffice" && msg.file !== undefined) {
if (msg /*&& msg.Referer == "onlyoffice"*/ && msg.file !== undefined) {
Common.NotificationCenter.trigger('window:close', this);
var me = this;
setTimeout(function() {

View file

@ -120,7 +120,7 @@ define([
},
_onMessage: function(msg) {
if (msg && msg.Referer == "onlyoffice") {
if (msg /*&& msg.Referer == "onlyoffice"*/) {
if ( !_.isEmpty(msg.error) ) {
this.trigger('mailmergeerror', this, msg.error);
}

View file

@ -302,6 +302,7 @@
"DE.Controllers.LeftMenu.textReplaceSkipped": "Der Ersatzvorgang wurde durchgeführt. {0} Vorkommen wurden ausgelassen.",
"DE.Controllers.LeftMenu.textReplaceSuccess": "Der Suchvorgang wurde durchgeführt. Vorkommen wurden ersetzt:{0}",
"DE.Controllers.LeftMenu.warnDownloadAs": "Wenn Sie mit dem Speichern in diesem Format fortsetzen, werden alle Objekte außer Text verloren gehen.<br>Möchten Sie wirklich fortsetzen?",
"DE.Controllers.LeftMenu.warnDownloadAsRTF": "Wenn Sie mit dem Speichern in diesem Format fortsetzen, kann die Formatierung teilweise verloren gehen.<br>Möchten Sie wirklich fortsetzen?",
"DE.Controllers.Main.applyChangesTextText": "Die Änderungen werden geladen...",
"DE.Controllers.Main.applyChangesTitleText": "Laden von Änderungen",
"DE.Controllers.Main.convertationTimeoutText": "Timeout für die Konvertierung wurde überschritten.",

View file

@ -302,6 +302,7 @@
"DE.Controllers.LeftMenu.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.",
"DE.Controllers.LeftMenu.textReplaceSuccess": "The search has been done. Occurrences replaced: {0}",
"DE.Controllers.LeftMenu.warnDownloadAs": "If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?",
"DE.Controllers.LeftMenu.warnDownloadAsRTF": "If you continue saving in this format some of the formatting might be lost.<br>Are you sure you want to continue?",
"DE.Controllers.Main.applyChangesTextText": "Loading the changes...",
"DE.Controllers.Main.applyChangesTitleText": "Loading the Changes",
"DE.Controllers.Main.convertationTimeoutText": "Conversion timeout exceeded.",

View file

@ -302,6 +302,7 @@
"DE.Controllers.LeftMenu.textReplaceSkipped": "Замена выполнена. Пропущено вхождений - {0}.",
"DE.Controllers.LeftMenu.textReplaceSuccess": "Поиск выполнен. Заменено вхождений: {0}",
"DE.Controllers.LeftMenu.warnDownloadAs": "Если Вы продолжите сохранение в этот формат, весь функционал, кроме текста, будет потерян.<br>Вы действительно хотите продолжить?",
"DE.Controllers.LeftMenu.warnDownloadAsRTF": "Если вы продолжите сохранение в этот формат, часть форматирования может быть потеряна.<br>Вы действительно хотите продолжить?",
"DE.Controllers.Main.applyChangesTextText": "Загрузка изменений...",
"DE.Controllers.Main.applyChangesTitleText": "Загрузка изменений",
"DE.Controllers.Main.convertationTimeoutText": "Превышено время ожидания конвертации.",

View file

@ -193,7 +193,6 @@ define([
$('#settings-readermode input:checkbox').attr('checked', Common.SharedSettings.get('readerMode'));
$('#settings-search').single('click', _.bind(me.onSearch, me));
$('#settings-readermode input:checkbox').single('change', _.bind(me.onReaderMode, me));
$('#settings-edit-document').single('click', _.bind(me.onEditDocumet, me));
$('#settings-help').single('click', _.bind(me.onShowHelp, me));
$('#settings-download').single('click', _.bind(me.onDownloadOrigin, me));
}
@ -267,10 +266,6 @@ define([
// Handlers
onEditDocumet: function() {
Common.Gateway.requestEditRights();
},
onSearch: function (e) {
var toolbarView = DE.getController('Toolbar').getView('Toolbar');

View file

@ -25,18 +25,6 @@
</a>
</li>
<% } %>
<li>
<a id="settings-edit-document" class="item-link no-indicator">
<div class="item-content">
<div class="item-media">
<i class="icon icon-edit"></i>
</div>
<div class="item-inner">
<div class="item-title"><%= scope.textEditDoc %></div>
</div>
</div>
</a>
</li>
<li>
<div id="settings-readermode" class="item-content">
<div class="item-media">

View file

@ -34,6 +34,9 @@
<a href="#" id="toolbar-add" class="link icon-only" style="display: none;">
<i class="icon icon-plus"></i>
</a>
<a href="#" id="toolbar-edit-document" class="link icon-only" style="display: none;">
<i class="icon icon-edit"></i>
</a>
<% if (!phone) { %>
<a href="#" id="toolbar-search" class="link icon-only">
<i class="icon icon-search"></i>

View file

@ -113,10 +113,8 @@ define([
isPhone = Common.SharedSettings.get('phone');
if (_isEdit) {
$layour.find('#settings-edit-document').hide();
$layour.find('#settings-search .item-title').text(this.textFindAndReplace)
} else {
if (!_canEdit) $layour.find('#settings-edit-document').hide();
$layour.find('#settings-document').hide();
}
if (!_canReader)
@ -219,7 +217,6 @@ define([
permissions = _.extend(permissions, data.doc.permissions);
if (permissions.edit === false) {
$('#settings-edit-document').hide();
}
}
},

View file

@ -62,7 +62,8 @@ define([
"click #toolbar-search" : "searchToggle",
"click #toolbar-edit" : "showEdition",
"click #toolbar-add" : "showInserts",
"click #toolbar-settings" : "showSettings"
"click #toolbar-settings" : "showSettings",
"click #toolbar-edit-document": "editDocument"
},
// Set innerHTML and get the references to the DOM elements
@ -100,6 +101,8 @@ define([
setMode: function (mode) {
if (mode.isEdit) {
$('#toolbar-edit, #toolbar-add, #toolbar-undo, #toolbar-redo').show();
} else if (mode.canEdit && mode.canRequestEditRights){
$('#toolbar-edit-document').show();
}
},
@ -147,6 +150,10 @@ define([
DE.getController('Settings').showModal();
},
editDocument: function () {
Common.Gateway.requestEditRights();
},
textBack: 'Back'
}
})(), DE.Views.Toolbar || {}))

View file

@ -890,7 +890,7 @@ define([
this.api.asc_Save();
}
toolbar.btnsSave.setDisabled(!toolbar.mode.forcesave);
toolbar.btnSave.setDisabled(!toolbar.mode.forcesave);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('Save');
@ -1963,7 +1963,7 @@ define([
var toolbar = this.toolbar;
toolbar.$el.find('.toolbar').toggleClass('masked', disable);
this.toolbar.lockToolbar(PE.enumLock.menuFileOpen, disable, {array: [toolbar.btnsAddSlide, toolbar.btnChangeSlide, toolbar.btnPreview, toolbar.btnHide]});
this.toolbar.lockToolbar(PE.enumLock.menuFileOpen, disable, {array: toolbar.btnsAddSlide.concat(toolbar.btnChangeSlide, toolbar.btnPreview)});
if(disable) {
mask = $("<div class='toolbar-mask'>").appendTo(toolbar.$el.find('.toolbar'));
Common.util.Shortcuts.suspendEvents('command+k, ctrl+k, alt+h, command+f5, ctrl+f5');

View file

@ -80,6 +80,7 @@ define([
toolbar.setExtra('left', me.header.getPanel('left', config));
},
'view:compact' : function (toolbar, state) {
me.header.mnuitemCompactToolbar.setChecked(state, true);
me.viewport.vlayout.getItem('toolbar').height = state ?
Common.Utils.InternalSettings.get('toolbar-height-compact') : Common.Utils.InternalSettings.get('toolbar-height-normal');
},
@ -208,7 +209,7 @@ define([
var mnuitemHideRulers = new Common.UI.MenuItem({
caption: me.header.textHideLines,
checked: Common.localStorage.getBool("pe-hidden-rulers"),
checked: Common.localStorage.getBool("pe-hidden-rulers", true),
checkable: true,
value: 'rulers'
});

View file

@ -155,7 +155,6 @@ define([
var me = this;
$('#settings-search').single('click', _.bind(me._onSearch, me));
$('#settings-readermode input:checkbox').single('change', _.bind(me._onReaderMode, me));
$('#settings-edit-presentation').single('click', _.bind(me._onEditPresentation, me));
$(modalView).find('.formats a').single('click', _.bind(me._onSaveFormat, me));
$('#page-settings-setup-view li').single('click', _.bind(me._onSlideSize, me));
@ -224,10 +223,6 @@ define([
$('#settings-presentation-title').html(name ? name : '-');
},
_onEditPresentation: function() {
Common.Gateway.requestEditRights();
},
_onSearch: function (e) {
var toolbarView = PE.getController('Toolbar').getView('Toolbar');

View file

@ -25,18 +25,6 @@
</a>
</li>
<% } %>
<li>
<a id="settings-edit-presentation" class="item-link no-indicator">
<div class="item-content">
<div class="item-media">
<i class="icon icon-edit"></i>
</div>
<div class="item-inner">
<div class="item-title"><%= scope.textEditPresent %></div>
</div>
</div>
</a>
</li>
<li>
<a id="settings-presentation-setup" class="item-link">
<div class="item-content">

View file

@ -37,6 +37,9 @@
<a href="#" id="toolbar-add" class="link icon-only" style="display: none;">
<i class="icon icon-plus"></i>
</a>
<a href="#" id="toolbar-edit-document" class="link icon-only" style="display: none;">
<i class="icon icon-edit"></i>
</a>
<% if (!phone) { %>
<a href="#" id="toolbar-search" class="link icon-only">
<i class="icon icon-search"></i>

View file

@ -114,11 +114,9 @@ define([
isPhone = Common.SharedSettings.get('phone');
if (isEdit) {
$layour.find('#settings-edit-presentation').hide();
$layour.find('#settings-readermode').hide();
$layour.find('#settings-search .item-title').text(this.textFindAndReplace)
} else {
if (!canEdit) $layour.find('#settings-edit-presentation').hide();
$layour.find('#settings-presentation-setup').hide();
$layour.find('#settings-readermode input:checkbox')
.attr('checked', Common.SharedSettings.get('readerMode'))
@ -196,7 +194,6 @@ define([
permissions = _.extend(permissions, data.doc.permissions);
if (permissions.edit === false) {
$('#settings-edit-presentation').hide();
}
}
},

View file

@ -63,7 +63,8 @@ define([
"click #toolbar-edit" : "showEdition",
"click #toolbar-add" : "showInserts",
"click #toolbar-settings" : "showSettings",
"click #toolbar-preview" : "showPreview"
"click #toolbar-preview" : "showPreview",
"click #toolbar-edit-document": "editDocument"
},
// Set innerHTML and get the references to the DOM elements
@ -101,6 +102,8 @@ define([
setMode: function (mode) {
if (mode.isEdit) {
$('#toolbar-edit, #toolbar-add, #toolbar-undo, #toolbar-redo').show();
} else if (mode.canEdit && mode.canRequestEditRights){
$('#toolbar-edit-document').show();
}
},
@ -152,6 +155,10 @@ define([
PE.getController('DocumentPreview').show();
},
editDocument: function () {
Common.Gateway.requestEditRights();
},
textBack: 'Back'
}
})(), PE.Views.Toolbar || {}))

View file

@ -872,7 +872,6 @@ define([
this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false);
this.appOptions.canRename = this.editorConfig.canRename && !!this.permissions.rename;
this.appOptions.trialMode = params.asc_getLicenseMode();
this.appOptions.canProtect = this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport();
this.appOptions.canModifyFilter = (this.permissions.modifyFilter!==false);
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding)
@ -897,6 +896,7 @@ define([
(typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave);
this.appOptions.forcesave = this.appOptions.canForcesave;
this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly);
this.appOptions.canProtect = this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport() && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge);
this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false);
this.applyModeCommonElements();

View file

@ -1213,7 +1213,7 @@ define([
me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink,
me.btnInsertChart, me.btnColorSchemas,
me.btnAutofilter, me.btnCopy, me.btnPaste, me.listStyles, me.btnPrint,
me.btnSave, me.btnClearStyle, me.btnCopyStyle
/*me.btnSave,*/ me.btnClearStyle, me.btnCopyStyle
];
var _temp_array = [me.cmbFontName, me.cmbFontSize, me.btnAlignLeft,me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust,me.btnAlignTop,

View file

@ -148,7 +148,6 @@ define([
onPageShow: function(view, pageId) {
var me = this;
$('#settings-search').single('click', _.bind(me._onSearch, me));
$('#settings-edit-document').single('click', _.bind(me._onEditDocument, me));
$(modalView).find('.formats a').single('click', _.bind(me._onSaveFormat, me));
me.initSettings(pageId);
},
@ -200,10 +199,6 @@ define([
// API handlers
_onEditDocument: function() {
Common.Gateway.requestEditRights();
},
_onSearch: function (e) {
var toolbarView = SSE.getController('Toolbar').getView('Toolbar');

View file

@ -25,18 +25,6 @@
</a>
</li>
<% } %>
<li>
<a id="settings-edit-document" class="item-link no-indicator">
<div class="item-content">
<div class="item-media">
<i class="icon icon-edit"></i>
</div>
<div class="item-inner">
<div class="item-title"><%= scope.textEditDoc %></div>
</div>
</div>
</a>
</li>
<li>
<a id="settings-download" class="item-link">
<div class="item-content">

View file

@ -34,6 +34,9 @@
<a href="#" id="toolbar-add" class="link icon-only" style="display: none;">
<i class="icon icon-plus"></i>
</a>
<a href="#" id="toolbar-edit-document" class="link icon-only" style="display: none;">
<i class="icon icon-edit"></i>
</a>
<% if (!phone) { %>
<a href="#" id="toolbar-search" class="link icon-only">
<i class="icon icon-search"></i>

View file

@ -119,10 +119,8 @@ define([
isPhone = Common.SharedSettings.get('phone');
if (isEdit) {
$layout.find('#settings-edit-document').hide();
$layout.find('#settings-search .item-title').text(this.textFindAndReplace)
} else {
if (!canEdit) $layout.find('#settings-edit-document').hide();
}
if (!canDownload) $layout.find('#settings-download').hide();
if (!canAbout) $layout.find('#settings-about').hide();
@ -191,7 +189,6 @@ define([
permissions = _.extend(permissions, data.doc.permissions);
if (permissions.edit === false) {
$('#settings-edit-document').hide();
}
}
},

View file

@ -62,7 +62,8 @@ define([
"click #toolbar-search" : "searchToggle",
"click #toolbar-edit" : "showEdition",
"click #toolbar-add" : "showInserts",
"click #toolbar-settings" : "showSettings"
"click #toolbar-settings" : "showSettings",
"click #toolbar-edit-document": "editDocument"
},
// Set innerHTML and get the references to the DOM elements
@ -93,6 +94,8 @@ define([
setMode: function (mode) {
if (mode.isEdit) {
$('#toolbar-edit, #toolbar-add, #toolbar-undo, #toolbar-redo').show();
} else if (mode.canEdit && mode.canRequestEditRights){
$('#toolbar-edit-document').show();
}
},
@ -148,6 +151,10 @@ define([
this.$btnEdit.toggleClass('disabled', val);
},
editDocument: function () {
Common.Gateway.requestEditRights();
},
textBack: 'Back'
}
})(), SSE.Views.Toolbar || {}))