[DE] Add mode for filling forms

This commit is contained in:
Julia Radzhabova 2018-07-19 17:47:03 +03:00
parent d2da2ac656
commit 6b4261629f
3 changed files with 12 additions and 6 deletions

View file

@ -46,6 +46,7 @@
comment: <can comment in view mode> // default = edit,
modifyFilter: <can add, remove and save filter in the spreadsheet> // default = true
modifyContentControl: <can modify content controls in documenteditor> // default = true
fillForms: <can edit forms in view mode> // default = edit || review
}
},
editorConfig: {

View file

@ -120,7 +120,7 @@ define([
function onResetUsers(collection, opts) {
var usercount = collection.getEditingCount();
if ( $userList ) {
if ( usercount > 1 || usercount > 0 && appConfig && !appConfig.isEdit && !appConfig.canComments) {
if ( usercount > 1 || usercount > 0 && appConfig && !appConfig.isEdit && !appConfig.isRestrictedEdit) {
$userList.html(templateUserList({
users: collection.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).value(),
usertpl: _.template(templateUserItem),
@ -148,7 +148,7 @@ define([
};
function applyUsers(count, originalCount) {
var has_edit_users = count > 1 || count > 0 && appConfig && !appConfig.isEdit && !appConfig.canComments; // has other user(s) who edit document
var has_edit_users = count > 1 || count > 0 && appConfig && !appConfig.isEdit && !appConfig.isRestrictedEdit; // has other user(s) who edit document
if ( has_edit_users ) {
$btnUsers
.attr('data-toggle', 'dropdown')
@ -224,7 +224,7 @@ define([
var editingUsers = storeUsers.getEditingCount();
$btnUsers.tooltip({
title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit && !appConfig.canComments) ? me.tipViewUsers : me.tipAccessRights,
title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit && !appConfig.isRestrictedEdit) ? me.tipViewUsers : me.tipAccessRights,
titleNorm: me.tipAccessRights,
titleExt: me.tipViewUsers,
placement: 'bottom',
@ -240,7 +240,7 @@ define([
});
$labelChangeRights[(!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']();
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit && !appConfig.isRestrictedEdit || !mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
if ( $saveStatus ) {
$saveStatus.attr('data-width', me.textSaveExpander);

View file

@ -879,7 +879,7 @@ define([
me.api.SetCollaborativeMarksShowType(value == 'all' ? Asc.c_oAscCollaborativeMarksShowType.All :
(value == 'none' ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges));
Common.Utils.InternalSettings.set((me._state.fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value);
} else if (!me.appOptions.isEdit && me.appOptions.canComments) {
} else if (!me.appOptions.isEdit && me.appOptions.isRestrictedEdit) {
me._state.fastCoauth = true;
me.api.asc_SetFastCollaborative(me._state.fastCoauth);
me.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None);
@ -1101,6 +1101,10 @@ define([
this.appOptions.canProtect = this.appOptions.isProtectSupport && this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport();
this.appOptions.canEditContentControl = (this.permissions.modifyContentControl!==false);
this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false);
this.appOptions.canFillForms = (this.permissions.fillForms===undefined) ? this.appOptions.isEdit : this.permissions.fillForms;
this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && (this.appOptions.canComments || this.appOptions.canFillForms);
if (this.appOptions.isRestrictedEdit && this.appOptions.canComments && this.appOptions.canFillForms) // must be one restricted mode, priority for filling forms
this.appOptions.canComments = false;
if ( this.appOptions.isLightVersion ) {
this.appOptions.canUseHistory =
@ -1136,8 +1140,9 @@ define([
this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
}
this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.canComments);
this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit);
(!this.appOptions.isEdit && this.appOptions.canComments) && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments);
(!this.appOptions.isEdit && this.appOptions.canFillForms) && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms);
this.api.asc_LoadDocument();
},