[desktop] changed "read only" file opening
This commit is contained in:
parent
4c4da4113f
commit
b825310d30
|
@ -234,21 +234,42 @@ define([
|
||||||
|
|
||||||
Common.NotificationCenter.on('document:ready', function () {
|
Common.NotificationCenter.on('document:ready', function () {
|
||||||
if ( config.isEdit ) {
|
if ( config.isEdit ) {
|
||||||
var maincontroller = webapp.getController('Main');
|
// var maincontroller = webapp.getController('Main');
|
||||||
if (maincontroller.api.asc_getLocalRestrictions && Asc.c_oAscLocalRestrictionType.None !== maincontroller.api.asc_getLocalRestrictions()) {
|
// if (maincontroller.api.asc_getLocalRestrictions && Asc.c_oAscLocalRestrictionType.None !== maincontroller.api.asc_getLocalRestrictions()) {
|
||||||
maincontroller.warningDocumentIsLocked();
|
// maincontroller.warningDocumentIsLocked();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Common.NotificationCenter.on('app:face', function (mode) {
|
Common.NotificationCenter.on('app:face', function (mode) {
|
||||||
features.viewmode = !mode.isEdit;
|
features.viewmode = !mode.isEdit;
|
||||||
features.crypted = mode.isCrypted;
|
features.crypted = mode.isCrypted;
|
||||||
|
|
||||||
|
const header = webapp.getController('Viewport').getView('Common.Views.Header');
|
||||||
|
if ( mode.isEdit ) {
|
||||||
|
const api = webapp.getController('Main').api;
|
||||||
|
if ( api.asc_getLocalRestrictions && Asc.c_oAscLocalRestrictionType.None !== api.asc_getLocalRestrictions()) {
|
||||||
|
features.readonly = true;
|
||||||
|
|
||||||
|
header.setDocumentReadOnly(true);
|
||||||
|
api.asc_setLocalRestrictions(Asc.c_oAscLocalRestrictionType.None);
|
||||||
|
|
||||||
|
(new Common.UI.SynchronizeTip({
|
||||||
|
extCls: 'no-arrow',
|
||||||
|
placement: 'bottom',
|
||||||
|
target: $('.toolbar'),
|
||||||
|
text: Common.Locale.get("tipFileLocked",{name:"Common.Translation", default: "Document is locked for editing. You can make changes and save it as local copy later."}),
|
||||||
|
showLink: false,
|
||||||
|
})).on('closeclick', function () {
|
||||||
|
this.close();
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
native.execCommand('webapps:features', JSON.stringify(features));
|
native.execCommand('webapps:features', JSON.stringify(features));
|
||||||
|
|
||||||
titlebuttons = {};
|
titlebuttons = {};
|
||||||
if ( mode.isEdit ) {
|
if ( mode.isEdit ) {
|
||||||
var header = webapp.getController('Viewport').getView('Common.Views.Header');
|
|
||||||
if (!!header.btnSave) {
|
if (!!header.btnSave) {
|
||||||
titlebuttons['save'] = {btn: header.btnSave};
|
titlebuttons['save'] = {btn: header.btnSave};
|
||||||
|
|
||||||
|
|
|
@ -709,6 +709,7 @@ define([
|
||||||
if (idx>0)
|
if (idx>0)
|
||||||
this.fileExtention = this.documentCaption.substring(idx);
|
this.fileExtention = this.documentCaption.substring(idx);
|
||||||
this.isModified && (value += '*');
|
this.isModified && (value += '*');
|
||||||
|
this.readOnly && (value += ' (' + this.textReadOnly + ')');
|
||||||
if ( $labelDocName ) {
|
if ( $labelDocName ) {
|
||||||
this.setDocTitle( value );
|
this.setDocTitle( value );
|
||||||
}
|
}
|
||||||
|
@ -901,6 +902,11 @@ define([
|
||||||
return initials;
|
return initials;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setDocumentReadOnly: function (readonly) {
|
||||||
|
this.readOnly = readonly;
|
||||||
|
this.setDocumentCaption(this.documentCaption);
|
||||||
|
},
|
||||||
|
|
||||||
textBack: 'Go to Documents',
|
textBack: 'Go to Documents',
|
||||||
txtRename: 'Rename',
|
txtRename: 'Rename',
|
||||||
txtAccessRights: 'Change access rights',
|
txtAccessRights: 'Change access rights',
|
||||||
|
@ -925,7 +931,8 @@ define([
|
||||||
textHideNotes: 'Hide Notes',
|
textHideNotes: 'Hide Notes',
|
||||||
tipSearch: 'Search',
|
tipSearch: 'Search',
|
||||||
textShare: 'Share',
|
textShare: 'Share',
|
||||||
tipPrintQuick: 'Quick print'
|
tipPrintQuick: 'Quick print',
|
||||||
|
textReadOnly: 'Read only'
|
||||||
}
|
}
|
||||||
}(), Common.Views.Header || {}))
|
}(), Common.Views.Header || {}))
|
||||||
});
|
});
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
"Common.define.chartData.textSurface": "Surface",
|
"Common.define.chartData.textSurface": "Surface",
|
||||||
"Common.Translation.textMoreButton": "More",
|
"Common.Translation.textMoreButton": "More",
|
||||||
"Common.Translation.warnFileLocked": "You can't edit this file because it's being edited in another app.",
|
"Common.Translation.warnFileLocked": "You can't edit this file because it's being edited in another app.",
|
||||||
|
"Common.Translation.tipFileLocked": "Document is locked for editing. You can make changes and save it as local copy later.",
|
||||||
"Common.Translation.warnFileLockedBtnEdit": "Create a copy",
|
"Common.Translation.warnFileLockedBtnEdit": "Create a copy",
|
||||||
"Common.Translation.warnFileLockedBtnView": "Open for viewing",
|
"Common.Translation.warnFileLockedBtnView": "Open for viewing",
|
||||||
"Common.UI.ButtonColored.textAutoColor": "Automatic",
|
"Common.UI.ButtonColored.textAutoColor": "Automatic",
|
||||||
|
@ -320,6 +321,7 @@
|
||||||
"Common.Views.Header.txtAccessRights": "Change access rights",
|
"Common.Views.Header.txtAccessRights": "Change access rights",
|
||||||
"Common.Views.Header.txtRename": "Rename",
|
"Common.Views.Header.txtRename": "Rename",
|
||||||
"Common.Views.Header.tipPrintQuick": "Quick print",
|
"Common.Views.Header.tipPrintQuick": "Quick print",
|
||||||
|
"Common.Views.Header.textReadOnly": "Read only",
|
||||||
"Common.Views.History.textCloseHistory": "Close History",
|
"Common.Views.History.textCloseHistory": "Close History",
|
||||||
"Common.Views.History.textHide": "Collapse",
|
"Common.Views.History.textHide": "Collapse",
|
||||||
"Common.Views.History.textHideAll": "Hide detailed changes",
|
"Common.Views.History.textHideAll": "Hide detailed changes",
|
||||||
|
|
Loading…
Reference in a new issue