Skip to content

Commit

Permalink
Merge pull request 'feature/pdf-sign-field' (#67) from feature/pdf-si…
Browse files Browse the repository at this point in the history
…gn-field into release/v8.2.0
  • Loading branch information
Julia Radzhabova committed Oct 7, 2024
2 parents 9f0c6d5 + cf58312 commit 5436091
Show file tree
Hide file tree
Showing 64 changed files with 676 additions and 56 deletions.
376 changes: 376 additions & 0 deletions apps/common/main/lib/view/PdfSignDialog.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions apps/common/main/resources/less/advanced-settings-window.less
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,10 @@
}
}
}

#window-pdf-sign {
#id-dlg-pdf-btn-draw,
#id-dlg-pdf-btn-type {
.margin-left(-1px)
}
}
32 changes: 29 additions & 3 deletions apps/documenteditor/main/app/controller/DocumentHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,8 @@ define([
},

onShowContentControlsActions: function(obj, x, y) {
var type = obj.type;
var type = obj.type,
me = this;
switch (type) {
case Asc.c_oAscContentControlSpecificType.DateTime:
this.onShowDateActions(obj, x, y);
Expand All @@ -1731,8 +1732,33 @@ define([
if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock==Asc.c_oAscSdtLockType.ContentLocked)
return;
}
this.api.asc_addImage(obj);
var me = this;
if (obj.pr && obj.pr.is_Signature() && false) {
if (_.isUndefined(me.fontStore)) {
me.fontStore = new Common.Collections.Fonts();
var fonts = me.getApplication().getController('Toolbar').getView('Toolbar').cmbFontName.store.toJSON();
var arr = [];
_.each(fonts, function(font, index){
if (!font.cloneid) {
arr.push(_.clone(font));
}
});
me.fontStore.add(arr);
}
(new Common.Views.PdfSignDialog({
props: obj,
api: me.api,
disableNetworkFunctionality: me.mode.disableNetworkFunctionality,
storage: me.mode.canRequestInsertImage || me.mode.fileChoiceUrl && me.mode.fileChoiceUrl.indexOf("{documentType}")>-1,
fontStore: me.fontStore,
handler: function(result, value) {
if (result == 'ok') {
me.api.asc_SetSignatureProps(value);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
} else
this.api.asc_addImage(obj);
setTimeout(function(){
me.api.asc_UncheckContentControlButtons();
}, 500);
Expand Down
3 changes: 2 additions & 1 deletion apps/documenteditor/main/app/controller/FormsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ define([
this.api.asc_AddContentControlTextForm(props);
} else if (type == 'complex') {
this.api.asc_AddComplexForm();
}
} else if (type === 'signature')
this.api.asc_AddContentControlSignature(oFormPr);

var me = this;
if (!this._state.formCount) { // add first form
Expand Down
3 changes: 2 additions & 1 deletion apps/documenteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ define([
"table of figures": this.txtTableOfFigures,
"TOC Heading": this.txtTOCHeading,
"Anyone": this.textAnyone,
"Text": this.textText
"Text": this.textText,
"Signature": this.textSignature
};
styleNames.forEach(function(item){
translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item;
Expand Down
24 changes: 16 additions & 8 deletions apps/documenteditor/main/app/view/FormSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ define([
this.DateOnlySettings = el.find('.form-datetime');
this.DefValueText = el.find('#form-txt-def-value').closest('tr');
this.DefValueDropDown = el.find('#form-combo-def-value').closest('tr');
this.TagSettings = el.find('#form-txt-tag').closest('tr');

!Common.UI.FeaturesManager.isFeatureEnabled('roles', true) && el.find('#form-combo-roles').closest('tr').hide();
},
Expand Down Expand Up @@ -1407,8 +1408,8 @@ define([
if (formPr) {
this._originalFormProps = formPr;

if (type == Asc.c_oAscContentControlSpecificType.Picture)
this.labelFormName.text(this.textImage);
if (type == Asc.c_oAscContentControlSpecificType.Picture)
this.labelFormName.text(props.is_Signature() ? this.textSignature : this.textImage);

var data = this.api.asc_GetFormKeysByType(type);
if (!this._state.arrKey || this._state.arrKey.length!==data.length || _.difference(this._state.arrKey, data).length>0) {
Expand Down Expand Up @@ -1559,9 +1560,11 @@ define([

}

var pictPr = props.get_PictureFormPr();
var pictPr = props.get_PictureFormPr(),
isSignature = false;
if (pictPr) {
this._originalPictProps = pictPr;
isSignature = props.is_Signature();
val = pictPr.get_ConstantProportions();
if ( this._state.Aspect!==val ) {
this.chAspect.setValue(!!val, true);
Expand Down Expand Up @@ -1594,6 +1597,7 @@ define([
var disableSliders = this._state.scaleFlag === Asc.c_oAscPictureFormScaleFlag.Always && !this._state.Aspect || this._state.DisabledControls;
this.sldrPreviewPositionX.setDisabled(disableSliders);
this.sldrPreviewPositionY.setDisabled(disableSliders);
this.chRequired.setDisabled(isSignature || this._state.DisabledControls);
}

var formTextPr = props.get_TextFormPr();
Expand Down Expand Up @@ -1720,12 +1724,14 @@ define([
this.ConnectedSettings.toggleClass('hidden', !connected);
this.TextOnlySettingsMask.toggleClass('hidden', !(type === Asc.c_oAscContentControlSpecificType.None && !!formTextPr) || this._state.FormatType!==Asc.TextFormFormatType.Mask);
this.TextOnlySettingsRegExp.toggleClass('hidden', !(type === Asc.c_oAscContentControlSpecificType.None && !!formTextPr) || this._state.FormatType!==Asc.TextFormFormatType.RegExp);
if (this.type !== type || this.isSimpleInsideComplex !== isSimpleInsideComplex || needUpdateTextControls || type == Asc.c_oAscContentControlSpecificType.CheckBox)
this.showHideControls(type, formTextPr, specProps, isSimpleInsideComplex);
if (this.type !== type || this.isSimpleInsideComplex !== isSimpleInsideComplex || needUpdateTextControls ||
type == Asc.c_oAscContentControlSpecificType.CheckBox || this.isSignature !== isSignature)
this.showHideControls(type, formTextPr, specProps, isSimpleInsideComplex, isSignature);
if (this.type !== type || this.isSimpleInsideComplex !== isSimpleInsideComplex)
this.fireEvent('updatescroller', this);
this.type = type;
this.isSimpleInsideComplex = isSimpleInsideComplex;
this.isSignature = isSignature;

this._state.internalId = this.internalId;
}
Expand Down Expand Up @@ -1820,9 +1826,10 @@ define([
this.sldrPreviewPositionY.setDisabled(disableSliders || this._state.DisabledControls);
this.btnListAdd.setDisabled(this.txtNewValue.length<1 || this._state.DisabledControls);
this.btnLockForm.setDisabled(disable);
this.chRequired.setDisabled(this.isSignature || this._state.DisabledControls);
},

showHideControls: function(type, textProps, specProps, isSimpleInsideComplex) {
showHideControls: function(type, textProps, specProps, isSimpleInsideComplex, isSignature) {
var textOnly = false,
checkboxOnly = false,
radioboxOnly = false,
Expand All @@ -1846,17 +1853,18 @@ define([
this.TextOnlySettings.toggleClass('hidden', !textOnly);
this.TextOnlySimpleSettings.toggleClass('hidden', !textOnly || isSimpleInsideComplex);
this.ListOnlySettings.toggleClass('hidden', !listOnly);
this.ImageOnlySettings.toggleClass('hidden', !imageOnly);
this.ImageOnlySettings.toggleClass('hidden', !imageOnly || isSignature);
this.RadioOnlySettings.toggleClass('hidden', !radioboxOnly);
this.KeySettings.toggleClass('hidden', radioboxOnly || isSimpleInsideComplex);
var value = (checkboxOnly || radioboxOnly);
this.PlaceholderSettings.toggleClass('hidden', value);
this.CheckOnlySettings.toggleClass('hidden', !value);
this.FixedSettings.toggleClass('hidden', imageOnly || isSimpleInsideComplex);
this.FixedSettings.toggleClass('hidden', imageOnly || isSimpleInsideComplex || isSignature);
this.NotInComplexSettings.toggleClass('hidden', isSimpleInsideComplex);
this.DateOnlySettings.toggleClass('hidden', !dateOnly);
this.DefValueText.toggleClass('hidden', !(type === Asc.c_oAscContentControlSpecificType.ComboBox || textOnly));
this.DefValueDropDown.toggleClass('hidden', type !== Asc.c_oAscContentControlSpecificType.DropDownList);
this.TagSettings.toggleClass('hidden', isSignature || isSimpleInsideComplex);
},

onSelectItem: function(listView, itemView, record) {
Expand Down
21 changes: 20 additions & 1 deletion apps/documenteditor/main/app/view/FormsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ define([
'<span class="btn-slot text x-huge" id="slot-btn-form-checkbox"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-radiobox"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-image"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-signature"></span>' +
'</div>' +
'<div class="separator long forms-buttons" style="display: none;"></div>' +
'<div class="group forms-buttons" style="display: none;">' +
Expand Down Expand Up @@ -161,6 +162,9 @@ define([
this.btnImageField && this.btnImageField.on('click', function (b, e) {
me.fireEvent('forms:insert', ['picture']);
});
this.btnSignField && this.btnSignField.on('click', function (b, e) {
me.fireEvent('forms:insert', ['signature']);
});
this.btnComplexField && this.btnComplexField.on('click', function (b, e) {
me.fireEvent('forms:insert', ['complex']);
});
Expand Down Expand Up @@ -407,6 +411,17 @@ define([
});
this.paragraphControls.push(this.btnImageField);

this.btnSignField = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-signature-field',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.complexForm, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.inSmartart, _set.inSmartartInternal, _set.viewMode],
caption: this.capBtnSignature,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnSignField);

this.btnManager = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-ic-sharing',
Expand Down Expand Up @@ -666,6 +681,7 @@ define([
me.btnCheckBox.updateHint(me.tipCheckBox);
me.btnRadioBox.updateHint(me.tipRadioBox);
me.btnImageField.updateHint(me.tipImageField);
me.btnSignField.updateHint(me.tipSignField);
me.btnViewFormRoles.updateHint(me.tipViewForm);
me.btnManager.updateHint(me.tipManager);
me.btnEmailField.updateHint(me.tipEmailField);
Expand Down Expand Up @@ -711,6 +727,7 @@ define([
this.btnCheckBox.render($host.find('#slot-btn-form-checkbox'));
this.btnRadioBox.render($host.find('#slot-btn-form-radiobox'));
this.btnImageField.render($host.find('#slot-btn-form-image'));
this.btnSignField.render($host.find('#slot-btn-form-signature'));
this.btnViewFormRoles.render($host.find('#slot-btn-form-view-roles'));
this.btnManager.render($host.find('#slot-btn-manager'));
// this.btnHighlight.render($host.find('#slot-form-highlight'));
Expand Down Expand Up @@ -870,7 +887,9 @@ define([
tipFirstPage: 'Go to the first page',
tipLastPage: 'Go to the last page',
tipPrevPage: 'Go to the previous page',
tipNextPage: 'Go to the next page'
tipNextPage: 'Go to the next page',
capBtnSignature: 'Signature Field',
tipSignField: 'Insert signature field'
}
}()), DE.Views.FormsTab || {}));
});
1 change: 1 addition & 0 deletions apps/documenteditor/main/app_dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ require([
'common/main/lib/view/TextInputDialog',
'common/main/lib/view/DocumentHolderExt',
'common/main/lib/util/define',
'common/main/lib/view/PdfSignDialog',
'common/main/lib/view/DocumentPropertyDialog',

'documenteditor/main/app/view/FileMenuPanels',
Expand Down
1 change: 1 addition & 0 deletions apps/documenteditor/main/app_pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require([
'common/main/lib/view/LanguageDialog',
'common/main/lib/view/TextInputDialog',
'common/main/lib/view/DocumentHolderExt',
'common/main/lib/view/PdfSignDialog',
'common/main/lib/view/DocumentPropertyDialog',

'documenteditor/main/app/view/FileMenuPanels',
Expand Down
6 changes: 5 additions & 1 deletion apps/documenteditor/main/locale/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3649,5 +3649,9 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "شبه شفاف",
"DE.Views.WatermarkSettingsDialog.textUnderline": "تحته خط",
"DE.Views.WatermarkSettingsDialog.tipFontName": "اسم الخط",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "حجم الخط"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "حجم الخط",
"DE.Controllers.Main.textSignature": "Signature",
"DE.Views.FormSettings.textSignature": "Signature",
"DE.Views.FormsTab.capBtnSignature": "Signature Field",
"DE.Views.FormsTab.tipSignField": "Insert signature field"
}
6 changes: 5 additions & 1 deletion apps/documenteditor/main/locale/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -3649,5 +3649,9 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Yarım şəffaf",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Altından xətt çəkilmiş",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Şrift Adı",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Şrift Ölçüsü"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Şrift Ölçüsü",
"DE.Controllers.Main.textSignature": "Signature",
"DE.Views.FormSettings.textSignature": "Signature",
"DE.Views.FormsTab.capBtnSignature": "Signature Field",
"DE.Views.FormsTab.tipSignField": "Insert signature field"
}
6 changes: 5 additions & 1 deletion apps/documenteditor/main/locale/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -3649,5 +3649,9 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Паўпразрысты",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Падкрэслены",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Назва шрыфту",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Памер шрыфту"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Памер шрыфту",
"DE.Controllers.Main.textSignature": "Signature",
"DE.Views.FormSettings.textSignature": "Signature",
"DE.Views.FormsTab.capBtnSignature": "Signature Field",
"DE.Views.FormsTab.tipSignField": "Insert signature field"
}
6 changes: 5 additions & 1 deletion apps/documenteditor/main/locale/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -3649,5 +3649,9 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Semitransparent",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Underline",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Font name",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Font size"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Font size",
"DE.Controllers.Main.textSignature": "Signature",
"DE.Views.FormSettings.textSignature": "Signature",
"DE.Views.FormsTab.capBtnSignature": "Signature Field",
"DE.Views.FormsTab.tipSignField": "Insert signature field"
}
6 changes: 5 additions & 1 deletion apps/documenteditor/main/locale/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -3649,5 +3649,9 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Semitransparent",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Subratllar",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Nom de la lletra",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Mida de la lletra"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Mida de la lletra",
"DE.Controllers.Main.textSignature": "Signature",
"DE.Views.FormSettings.textSignature": "Signature",
"DE.Views.FormsTab.capBtnSignature": "Signature Field",
"DE.Views.FormsTab.tipSignField": "Insert signature field"
}
6 changes: 5 additions & 1 deletion apps/documenteditor/main/locale/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3649,5 +3649,9 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Poloprůhledné",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Podtržené",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Název písma",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Velikost písma"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Velikost písma",
"DE.Controllers.Main.textSignature": "Signature",
"DE.Views.FormSettings.textSignature": "Signature",
"DE.Views.FormsTab.capBtnSignature": "Signature Field",
"DE.Views.FormsTab.tipSignField": "Insert signature field"
}
6 changes: 5 additions & 1 deletion apps/documenteditor/main/locale/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -3649,5 +3649,9 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Halvgennemsigtig",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Understreg",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Skrifttypenavn",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Skriftstørrelse"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Skriftstørrelse",
"DE.Controllers.Main.textSignature": "Signature",
"DE.Views.FormSettings.textSignature": "Signature",
"DE.Views.FormsTab.capBtnSignature": "Signature Field",
"DE.Views.FormsTab.tipSignField": "Insert signature field"
}
6 changes: 5 additions & 1 deletion apps/documenteditor/main/locale/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3649,5 +3649,9 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Halbtransparent",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Unterstrichen",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Schriftartname",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Schriftgrad"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Schriftgrad",
"DE.Controllers.Main.textSignature": "Signature",
"DE.Views.FormSettings.textSignature": "Signature",
"DE.Views.FormsTab.capBtnSignature": "Signature Field",
"DE.Views.FormsTab.tipSignField": "Insert signature field"
}
6 changes: 5 additions & 1 deletion apps/documenteditor/main/locale/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -3649,5 +3649,9 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Ημιδιαφανές",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Υπογράμμιση",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Όνομα γραμματοσειράς",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Μέγεθος γραμματοσειράς"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Μέγεθος γραμματοσειράς",
"DE.Controllers.Main.textSignature": "Signature",
"DE.Views.FormSettings.textSignature": "Signature",
"DE.Views.FormsTab.capBtnSignature": "Signature Field",
"DE.Views.FormsTab.tipSignField": "Insert signature field"
}
Loading

0 comments on commit 5436091

Please sign in to comment.