Skip to content

Commit c4b7ad6

Browse files
author
Julia Radzhabova
committed
Merge pull request 'feature/fill-forms' (#317) from feature/fill-forms into develop
2 parents 81f4080 + 382811a commit c4b7ad6

File tree

11 files changed

+56
-19
lines changed

11 files changed

+56
-19
lines changed

apps/common/main/lib/view/Header.js

+19-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ define([
8989
'<div class="hedset">' +
9090
'<div class="btn-slot margin-right-2" id="slot-btn-header-form-submit"></div>' +
9191
'<div class="btn-slot margin-right-2" id="slot-btn-start-fill"></div>' +
92+
'<div class="btn-slot margin-right-2 margin-left-5" id="slot-btn-fill-status"></div>' +
9293
'</div>' +
9394
'<div class="hedset">' +
9495
'<div class="btn-slot" id="slot-hbtn-edit"></div>' +
@@ -404,6 +405,14 @@ define([
404405
Common.NotificationCenter.trigger('forms:request-fill');
405406
});
406407

408+
if (me.btnFillStatus) {
409+
me.btnFillStatus.updateHint(me.tipFillStatus);
410+
me.btnFillStatus && me.btnFillStatus.on('click', function (e) {
411+
Common.UI.TooltipManager.closeTip('showFillStatus');
412+
Common.Gateway.requestFillingStatus(appConfig.user.roles && appConfig.user.roles.length>0 ? appConfig.user.roles[0] : undefined);
413+
});
414+
}
415+
407416
if ( me.logo )
408417
me.logo.children(0).on('click', function (e) {
409418
var _url = !!me.branding && !!me.branding.logo && (me.branding.logo.url!==undefined) ?
@@ -1006,6 +1015,14 @@ define([
10061015
$html.find('#slot-btn-start-fill').hide();
10071016
}
10081017

1018+
if (config.isPDFForm && config.canFillForms && config.isRestrictedEdit && config.canRequestFillingStatus) {
1019+
me.btnFillStatus = new Common.UI.Button({
1020+
cls: 'btn-header',
1021+
iconCls: 'toolbar__icon icon--inverse btn-filling-status',
1022+
});
1023+
me.btnFillStatus.render($html.find('#slot-btn-fill-status'));
1024+
}
1025+
10091026
$userList = $html.find('.cousers-list');
10101027
$panelUsers = $html.find('.box-cousers');
10111028
$btnUsers = $panelUsers.find('> .btn-users');
@@ -1420,7 +1437,8 @@ define([
14201437
helpQuickAccessHeader: 'Customize Quick Access',
14211438
ariaQuickAccessToolbar: 'Quick access toolbar',
14221439
textAnnotateDesc: 'Fill forms or annotate',
1423-
textDownload: 'Download'
1440+
textDownload: 'Download',
1441+
tipFillStatus: 'Filling status'
14241442
}
14251443
}(), Common.Views.Header || {}))
14261444
});

apps/documenteditor/forms/app/controller/ApplicationController.js

+17-12
Original file line numberDiff line numberDiff line change
@@ -1528,15 +1528,18 @@ define([
15281528
if (me.appOptions.canFillForms) {
15291529
var oform = me.api.asc_GetOForm(),
15301530
role = new AscCommon.CRestrictionSettings();
1531-
if (oform && me.appOptions.user.roles && me.appOptions.user.roles.length>0 && oform.asc_canFillRole(me.appOptions.user.roles[0])) {
1532-
role.put_OFormRole(this.appOptions.user.roles[0]);
1531+
if (oform && me.appOptions.user.roles) {
1532+
if (me.appOptions.user.roles.length>0 && oform.asc_canFillRole(me.appOptions.user.roles[0])) {
1533+
role.put_OFormRole(this.appOptions.user.roles[0]);
1534+
me.showFillingForms(true);
1535+
} else {
1536+
role.put_OFormNoRole(true);
1537+
me.view.btnFillStatus && me.view.btnFillStatus.isVisible() && Common.UI.TooltipManager.addTips({
1538+
'showFillStatus': { name: 'de-help-tip-fill-status', text: me.helpTextFillStatus, target: '#id-btn-status', placement: 'bottom-left', showButton: false, automove: true, maxwidth: 300 }
1539+
});
1540+
}
1541+
} else // can fill all fields
15331542
me.showFillingForms(true);
1534-
} else {
1535-
role.put_OFormNoRole(true);
1536-
me.view.btnFillStatus && me.view.btnFillStatus.isVisible() && Common.UI.TooltipManager.addTips({
1537-
'showFillStatus': { name: 'de-help-tip-fill-status', text: me.helpTextFillStatus, target: '#id-btn-status', placement: 'bottom-left', showButton: false, automove: true, maxwidth: 300 }
1538-
});
1539-
}
15401543
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms, role);
15411544
}
15421545

@@ -2085,10 +2088,12 @@ define([
20852088
}
20862089
var oform = this.api.asc_GetOForm(),
20872090
role = new AscCommon.CRestrictionSettings();
2088-
if (oform && this.appOptions.user.roles && this.appOptions.user.roles.length>0 && oform.asc_canFillRole(this.appOptions.user.roles[0])) {
2089-
role.put_OFormRole(this.appOptions.user.roles[0]);
2090-
} else {
2091-
role.put_OFormNoRole(true);
2091+
if (oform && this.appOptions.user.roles) {
2092+
if (this.appOptions.user.roles.length>0 && oform.asc_canFillRole(this.appOptions.user.roles[0])) {
2093+
role.put_OFormRole(this.appOptions.user.roles[0]);
2094+
} else {
2095+
role.put_OFormNoRole(true);
2096+
}
20922097
}
20932098
this.api.asc_setRestriction(state || !this.appOptions.canFillForms ? Asc.c_oAscRestrictionType.View : Asc.c_oAscRestrictionType.OnlyForms, role);
20942099
},

apps/documenteditor/main/app/controller/FormsTab.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,18 @@ define([
513513
if (config.isRestrictedEdit && config.canFillForms && config.isPDFForm && me.api) {
514514
var oform = me.api.asc_GetOForm(),
515515
role = new AscCommon.CRestrictionSettings();
516-
if (oform && config.user.roles && config.user.roles.length>0 && oform.asc_canFillRole(config.user.roles[0])) {
517-
role.put_OFormRole(config.user.roles[0]);
516+
if (oform && config.user.roles) {
517+
if (config.user.roles.length>0 && oform.asc_canFillRole(config.user.roles[0])) {
518+
role.put_OFormRole(config.user.roles[0]);
519+
me.view && me.view.showFillingForms(true);
520+
} else {
521+
role.put_OFormNoRole(true);
522+
me.view && config.canRequestFillingStatus && Common.UI.TooltipManager.showTip({
523+
step: 'showFillStatus', name: 'de-help-tip-fill-status', text: me.view.helpTextFillStatus, target: '#slot-btn-fill-status', placement: 'bottom-left', showButton: false, automove: true, maxwidth: 300
524+
});
525+
}
526+
} else // can fill all fields
518527
me.view && me.view.showFillingForms(true);
519-
} else {
520-
role.put_OFormNoRole(true);
521-
}
522528
me.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms, role);
523529
}
524530
if (config.isRestrictedEdit && me.view && me.view.btnSubmit && me.api) {

apps/documenteditor/main/app/controller/Main.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ define([
473473
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
474474
this.appOptions.canSaveDocumentToBinary = this.editorConfig.canSaveDocumentToBinary;
475475
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this));
476+
this.appOptions.canRequestFillingStatus = this.editorConfig.canRequestFillingStatus;
476477

477478
this.appOptions.canRequestClose = this.editorConfig.canRequestClose;
478479
this.appOptions.canCloseEditor = false;
@@ -1948,7 +1949,8 @@ define([
19481949

19491950
onStartFilling: function(disconnect) {
19501951
this._isFillInitiator = true;
1951-
disconnect ? this.api.asc_DisconnectEveryone() : this.onDisconnectEveryone();
1952+
this.api.asc_CompletePreparingOForm(!!disconnect);
1953+
!disconnect && this.onDisconnectEveryone(); // disable editing only for current user
19521954
},
19531955

19541956
onDisconnectEveryone: function() {

apps/documenteditor/main/locale/en.json

+2
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@
594594
"Common.Views.Header.tipViewUsers": "View users and manage document access rights",
595595
"Common.Views.Header.txtAccessRights": "Change access rights",
596596
"Common.Views.Header.txtRename": "Rename",
597+
"Common.Views.Header.tipFillStatus": "Filling status",
597598
"Common.Views.History.textCloseHistory": "Close history",
598599
"Common.Views.History.textHideAll": "Hide detailed changes",
599600
"Common.Views.History.textHighlightDeleted": "Highlight deleted",
@@ -2461,6 +2462,7 @@
24612462
"DE.Views.FormsTab.txtInlineDesc": "Insert inline text field",
24622463
"DE.Views.FormsTab.txtInlineText": "Inline",
24632464
"DE.Views.FormsTab.txtUntitled": "Untitled",
2465+
"DE.Views.FormsTab.helpTextFillStatus": "This form is ready for filling. You can view the filling status by clicking the corresponding button.",
24642466
"DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom center",
24652467
"DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left",
24662468
"DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of page",
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)