diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index abd6120ae..18386db6c 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -144,11 +144,12 @@ define([ (lock_type===undefined) && (lock_type = Asc.c_oAscSdtLockType.Unlocked); var content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked; var arr = [ this.view.btnTextField, this.view.btnComboBox, this.view.btnDropDown, this.view.btnCheckBox, - this.view.btnRadioBox, this.view.btnImageField ]; + this.view.btnRadioBox, this.view.btnImageField, this.view.btnEmailField, this.view.btnPhoneField, this.view.btnComplexField ]; Common.Utils.lockControls(Common.enumLock.paragraphLock, paragraph_locked, {array: arr}); Common.Utils.lockControls(Common.enumLock.headerLock, header_locked, {array: arr}); Common.Utils.lockControls(Common.enumLock.controlPlain, control_plain, {array: arr}); Common.Utils.lockControls(Common.enumLock.contentLock, content_locked, {array: arr}); + Common.Utils.lockControls(Common.enumLock.complexForm, in_control && !!control_props && !!control_props.get_ComplexFormPr(), {array: [this.view.btnComplexField, this.view.btnImageField]}); }, onChangeSpecialFormsGlobalSettings: function() { @@ -166,7 +167,7 @@ define([ } }, - onControlsSelect: function(type) { + onControlsSelect: function(type, options) { if (!(this.toolbar.mode && this.toolbar.mode.canFeatureContentControl && this.toolbar.mode.canFeatureForms)) return; var oPr, @@ -182,7 +183,15 @@ define([ this.api.asc_AddContentControlList(type == 'combobox', oPr, oFormPr); else if (type == 'text') { oPr = new AscCommon.CSdtTextFormPr(); + if (options) { + if (options.reg) + oPr.put_RegExpFormat(options.reg); + else if (options.mask) + oPr.put_MaskFormat(options.mask); + } this.api.asc_AddContentControlTextForm(oPr, oFormPr); + } else if (type == 'complex') { + this.api.asc_AddComplexForm(); } var me = this; diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index ee8d7e32b..e4f8f39be 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1971,6 +1971,10 @@ define([ config.msg = this.errorNoTOC; break; + case Asc.c_oAscError.ID.TextFormWrongFormat: + config.msg = this.errorTextFormWrongFormat; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); break; @@ -3252,7 +3256,8 @@ define([ errorEmptyTOC: 'Start creating a table of contents by applying a heading style from the Styles gallery to the selected text.', errorNoTOC: 'There\'s no table of contents to update. You can insert one from the References tab.', textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?', - textRememberMacros: 'Remember my choice for all macros' + textRememberMacros: 'Remember my choice for all macros', + errorTextFormWrongFormat: 'The value entered does not match the format of the field.' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/template/FormSettings.template b/apps/documenteditor/main/app/template/FormSettings.template index 575cca8b3..736bec199 100644 --- a/apps/documenteditor/main/app/template/FormSettings.template +++ b/apps/documenteditor/main/app/template/FormSettings.template @@ -28,18 +28,37 @@ <div id="form-txt-pholder"></div> </td> </tr> - <tr> + <tr class="form-not-in-complex"> <td class="padding-small"> <label class="input-label"><%= scope.textTag %></label> <div id="form-txt-tag"></div> </td> </tr> <tr> - <td class="padding-large"> + <td class="padding-small"> <label class="input-label"><%= scope.textTip %></label> <div id="form-txt-help"></div> </td> </tr> + <tr class="form-textfield"> + <td class="padding-small"> + <label class="input-label"><%= scope.textFormat %></label> + <div id="form-combo-format" style="width: 100%;"></div> + </td> + </tr> + <tr class="form-textfield-mask"> + <td class="padding-small"> + <div id="form-txt-mask"></div> + </td> + </tr> + <tr class="form-textfield"> + <td class="padding-small"> + <label class="input-label"><%= scope.textFormatSymbols %></label> + <div id="form-txt-format-symbols"></div> + </td> + </tr> +</table> +<table cols="2"> <tr class="form-list"> <td colspan="2" class="padding-small"> <label class="input-label"><%= scope.textValue %></label> @@ -47,7 +66,7 @@ </tr> <tr class="form-list" style="vertical-align: top;"> <td class="padding-small"> - <div id="form-txt-new-value" style="margin-right: 5px;"></div> + <div id="form-txt-new-value" style="width:164px; margin-right: 5px;"></div> </td> <td class="padding-small"> <div id="form-list-add" style="margin-left: 5px;"></div> @@ -55,7 +74,7 @@ </tr> <tr class="form-list" style="vertical-align: top;"> <td class="padding-large"> - <div id="form-list-list" style="width:162px; height: 95px;margin-right: 5px;"></div> + <div id="form-list-list" style="width:164px; height: 95px;margin-right: 5px;"></div> </td> <td class="padding-large"> <div id="form-list-delete" style="margin-bottom: 5px;margin-left: 5px;"></div> @@ -63,22 +82,24 @@ <div id="form-list-down" style="margin-left: 5px;"></div> </td> </tr> - <tr class="form-not-image"> +</table> +<table cols="1"> + <tr class="form-fixed"> <td class="padding-small"> <div id="form-chb-fixed"></div> </td> </tr> - <tr class="form-textfield"> + <tr class="form-textfield-simple"> <td class="padding-small"> <div id="form-chb-autofit"></div> </td> </tr> - <tr class="form-textfield"> + <tr class="form-textfield-simple"> <td class="padding-small"> <div id="form-chb-multiline"></div> </td> </tr> - <tr class="form-textfield"> + <tr class="form-textfield-simple"> <td class="padding-small"> <div class="separator horizontal"></div> </td> @@ -97,16 +118,16 @@ </table> <table cols="2"> <tr class="form-textfield"> - <td colspan=2> + <td colspan=2 style="padding-left: 22px;"> <label class="input-label"><%= scope.textWidth %></label> </td> </tr> <tr class="form-textfield"> - <td class="padding-small" width="50%"> - <div id="form-combo-width-rule" style="width: 85px;"></div> + <td class="padding-small" style="padding-left: 22px;"> + <div id="form-combo-width-rule" style="width: 82px;"></div> </td> - <td class="padding-small" width="50%"> - <div id="form-spin-width"></div> + <td class="padding-small"> + <div id="form-spin-width" style="float:right;"></div> </td> </tr> <tr class="form-textfield"> @@ -157,7 +178,7 @@ </td> </tr> <tr> - <td class="padding-large"> + <td class="padding-small"> <label class="input-label" style="margin-top: 4px;"><%= scope.textBackgroundColor %></label> <div id="form-background-color-btn" style="display: inline-block; float: right;"></div> </td> @@ -169,12 +190,12 @@ <div class="separator horizontal"></div> </td> </tr> - <tr> + <tr class="form-not-in-complex"> <td class="padding-small"> <div id="form-chb-required"></div> </td> </tr> - <tr> + <tr class="form-not-in-complex"> <td class="padding-small"> <div class="separator horizontal"></div> </td> @@ -184,7 +205,7 @@ <div id="form-btn-delete"></div> </td> </tr> - <tr> + <tr class="form-not-in-complex"> <td class="padding-small"> <div id="form-btn-lock"></div> </td> diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index 22dd24c61..9e89325ea 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -96,6 +96,8 @@ define([ })); this.TextOnlySettings = el.find('.form-textfield'); + this.TextOnlySimpleSettings = el.find('.form-textfield-simple'); // text field not in complex form + this.TextOnlySettingsMask = el.find('.form-textfield-mask'); this.PlaceholderSettings = el.find('.form-placeholder'); this.KeySettings = el.find('.form-keyfield'); this.KeySettingsTd = this.KeySettings.find('td'); @@ -104,7 +106,8 @@ define([ this.ListOnlySettings = el.find('.form-list'); this.ImageOnlySettings = el.find('.form-image'); this.ConnectedSettings = el.find('.form-connected'); - this.NotImageSettings = el.find('.form-not-image'); + this.FixedSettings = el.find('.form-fixed'); + this.NotInComplexSettings = el.find('.form-not-in-complex'); }, createDelayedElements: function() { @@ -173,7 +176,7 @@ define([ this.textareaHelp = new Common.UI.TextareaField({ el : $markup.findById('#form-txt-help'), - style : 'width: 100%; height: 60px;', + style : 'width: 100%; height: 36px;', value : '', dataHint : '1', dataHintDirection: 'left', @@ -223,7 +226,7 @@ define([ this.cmbWidthRule = new Common.UI.ComboBox({ el: $markup.findById('#form-combo-width-rule'), cls: 'input-group-nr', - menuStyle: 'min-width: 85px;', + menuStyle: 'min-width: 82px;', editable: false, data: this._arrWidthRule, dataHint: '1', @@ -236,7 +239,7 @@ define([ this.spnWidth = new Common.UI.MetricSpinner({ el: $markup.findById('#form-spin-width'), step: .1, - width: 85, + width: 82, defaultUnit : "cm", value: '', allowAuto: false, @@ -500,6 +503,60 @@ define([ yValue = this.sldrPreviewPositionY.getValue(); this.imagePositionLabel.text(xValue + ',' + yValue); + this.cmbFormat = new Common.UI.ComboBox({ + el: $markup.findById('#form-combo-format'), + cls: 'input-group-nr', + menuStyle: 'min-width: 100%;', + editable: false, + data: [{ displayValue: this.textNone, value: Asc.TextFormFormatType.None }, + { displayValue: this.textDigits, value: Asc.TextFormFormatType.Digit }, + { displayValue: this.textLetters, value: Asc.TextFormFormatType.Letter }, + { displayValue: this.textMask, value: Asc.TextFormFormatType.Mask }, + { displayValue: this.textReg, value: Asc.TextFormFormatType.RegExp }], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.cmbFormat); + this.cmbFormat.setValue(Asc.TextFormFormatType.None); + this.cmbFormat.on('selected', this.onFormatSelect.bind(this)); + + this.txtMask = new Common.UI.InputField({ + el : $markup.findById('#form-txt-mask'), + allowBlank : true, + validateOnChange: false, + validateOnBlur: false, + style : 'width: 100%;', + value : '', + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.txtMask); + this.txtMask.on('changed:after', this.onMaskChanged.bind(this)); + this.txtMask.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.txtMask.cmpEl.on('focus', 'input.form-control', function() { + setTimeout(function(){me.txtMask._input && me.txtMask._input.select();}, 1); + }); + + this.txtFormatSymbols = new Common.UI.InputField({ + el : $markup.findById('#form-txt-format-symbols'), + allowBlank : true, + validateOnChange: false, + validateOnBlur: false, + style : 'width: 100%;', + value : '', + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.txtFormatSymbols); + this.txtFormatSymbols.on('changed:after', this.onFormatSymbolsChanged.bind(this)); + this.txtFormatSymbols.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.txtFormatSymbols.cmpEl.on('focus', 'input.form-control', function() { + setTimeout(function(){me.txtFormatSymbols._input && me.txtFormatSymbols._input.select();}, 1); + }); + this.updateMetricUnit(); this.UpdateThemeColors(); }, @@ -562,7 +619,7 @@ define([ onChMaxCharsChanged: function(field, newValue, oldValue, eOpts){ var checked = (field.getValue()=='checked'); - this.spnMaxChars.setDisabled(!checked || this._state.DisabledControls); + this.spnMaxChars.setDisabled(!checked || this._state.FormatType===Asc.TextFormFormatType.Mask || this._state.DisabledControls); if (!checked) { this.chComb.setValue(false, true); this.spnWidth.setDisabled(true); @@ -594,7 +651,7 @@ define([ var checked = (field.getValue()=='checked'); if (checked) { this.chMaxChars.setValue(true, true); - this.spnMaxChars.setDisabled(false || this._state.DisabledControls); + this.spnMaxChars.setDisabled(false || this._state.FormatType===Asc.TextFormFormatType.Mask || this._state.DisabledControls); } this.cmbWidthRule.setDisabled(!checked || this._state.Fixed || this._state.DisabledControls); this.spnWidth.setDisabled(!checked || this._state.WidthRule===Asc.CombFormWidthRule.Auto || this._state.DisabledControls); @@ -878,6 +935,63 @@ define([ } }, + onFormatSelect: function(combo, record) { + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); + switch (record.value) { + case Asc.TextFormFormatType.None: + formTextPr.put_NoneFormat(); + break; + case Asc.TextFormFormatType.Digit: + formTextPr.put_DigitFormat(); + break; + case Asc.TextFormFormatType.Letter: + formTextPr.put_LetterFormat(); + break; + case Asc.TextFormFormatType.Mask: + this.txtMask.setValue('*'); + formTextPr.put_MaskFormat(this.txtMask.getValue()); + break; + case Asc.TextFormFormatType.RegExp: + this.txtMask.setValue('.'); + formTextPr.put_RegExpFormat(this.txtMask.getValue()); + break; + } + props.put_TextFormPr(formTextPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + onMaskChanged: function(input, newValue, oldValue, e) { + if (this.api && !this._noApply && (newValue!==oldValue)) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); + if (this.cmbFormat.getValue()===Asc.TextFormFormatType.Mask) { + formTextPr.put_MaskFormat(newValue); + } else if (this.cmbFormat.getValue()===Asc.TextFormFormatType.RegExp) { + formTextPr.put_RegExpFormat(newValue); + } + props.put_TextFormPr(formTextPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + if (!e.relatedTarget || (e.relatedTarget.localName != 'input' && e.relatedTarget.localName != 'textarea') || !/form-control/.test(e.relatedTarget.className)) + this.fireEvent('editcomplete', this); + } + }, + + onFormatSymbolsChanged: function(input, newValue, oldValue, e) { + if (this.api && !this._noApply && (newValue!==oldValue)) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); + formTextPr.put_FormatSymbols(newValue); + props.put_TextFormPr(formTextPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + if (!e.relatedTarget || (e.relatedTarget.localName != 'input' && e.relatedTarget.localName != 'textarea') || !/form-control/.test(e.relatedTarget.className)) + this.fireEvent('editcomplete', this); + } + }, + ChangeSettings: function(props) { if (this._initSettings) this.createDelayedElements(); @@ -1131,6 +1245,7 @@ define([ } var formTextPr = props.get_TextFormPr(); + var needUpdateTextControls = !!formTextPr && !this._originalTextFormProps || !formTextPr && !!this._originalTextFormProps; if (formTextPr) { this._originalTextFormProps = formTextPr; @@ -1176,22 +1291,50 @@ define([ this._state.Width=val; } + val = formTextPr.get_FormatType(); + if ( this._state.FormatType!==val ) { + this.cmbFormat.setValue((val !== null && val !== undefined) ? val : Asc.TextFormFormatType.None); + this._state.FormatType=val; + } + + if ( this._state.FormatType===Asc.TextFormFormatType.Mask || this._state.FormatType===Asc.TextFormFormatType.RegExp ) { + val = (this._state.FormatType===Asc.TextFormFormatType.Mask) ? formTextPr.get_MaskFormat() : formTextPr.get_RegExpFormat(); + this.txtMask.setValue((val !== null && val !== undefined) ? val : ''); + this._state.Mask=val; + } + + val = formTextPr.get_FormatSymbols(); + if ( this._state.FormatSymbols!==val ) { + this.txtFormatSymbols.setValue((val !== null && val !== undefined) ? val : ''); + this._state.FormatSymbols=val; + } + val = formTextPr.get_MaxCharacters(); this.chMaxChars.setValue(val && val>=0); - this.spnMaxChars.setDisabled(!val || val<0 || this._state.DisabledControls); + this.chMaxChars.setDisabled(this._state.FormatType===Asc.TextFormFormatType.Mask || this._state.DisabledControls); + this.spnMaxChars.setDisabled(!val || val<0 || this._state.FormatType===Asc.TextFormFormatType.Mask || this._state.DisabledControls); if ( (val===undefined || this._state.MaxChars===undefined)&&(this._state.MaxChars!==val) || Math.abs(this._state.MaxChars-val)>0.1) { this.spnMaxChars.setValue(val && val>=0 ? val : 10, true); this._state.MaxChars=val; } - } + } else + this._originalTextFormProps = null; + var isComplex = !!props.get_ComplexFormPr(), // is complex form + isSimpleInsideComplex = !!this.api.asc_GetCurrentComplexForm() && !isComplex; + + if (isComplex) { + this.labelFormName.text(this.textComplex); + } this._noApply = false; this.KeySettingsTd.toggleClass('padding-small', !connected); this.ConnectedSettings.toggleClass('hidden', !connected); - if (this.type !== type || type == Asc.c_oAscContentControlSpecificType.CheckBox) - this.showHideControls(type, formTextPr, specProps); + this.TextOnlySettingsMask.toggleClass('hidden', !(type === Asc.c_oAscContentControlSpecificType.None && !!formTextPr) || !(this._state.FormatType===Asc.TextFormFormatType.Mask || 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); this.type = type; + this._state.isSimpleInsideComplex = isSimpleInsideComplex; this._state.internalId = this.internalId; } @@ -1274,7 +1417,8 @@ define([ item.setDisabled(me._state.DisabledControls); }); } - this.spnMaxChars.setDisabled(this.chMaxChars.getValue()!=='checked' || this._state.DisabledControls); + this.chMaxChars.setDisabled(this._state.FormatType===Asc.TextFormFormatType.Mask || this._state.DisabledControls); + this.spnMaxChars.setDisabled(this.chMaxChars.getValue()!=='checked' || this._state.FormatType===Asc.TextFormFormatType.Mask || this._state.DisabledControls); this.cmbWidthRule.setDisabled(!this._state.Comb || this._state.Fixed || this._state.DisabledControls); this.spnWidth.setDisabled(!this._state.Comb || this._state.WidthRule===Asc.CombFormWidthRule.Auto || this._state.DisabledControls); this.chMulti.setDisabled(!this._state.Fixed || this._state.Comb || this._state.DisabledControls); @@ -1287,7 +1431,7 @@ define([ this.btnLockForm.setDisabled(disable); }, - showHideControls: function(type, textProps, specProps) { + showHideControls: function(type, textProps, specProps, isSimpleInsideComplex) { var textOnly = false, checkboxOnly = false, radioboxOnly = false, @@ -1306,14 +1450,16 @@ define([ textOnly = !!textProps; } this.TextOnlySettings.toggleClass('hidden', !textOnly); + this.TextOnlySimpleSettings.toggleClass('hidden', !textOnly || isSimpleInsideComplex); this.ListOnlySettings.toggleClass('hidden', !listOnly); this.ImageOnlySettings.toggleClass('hidden', !imageOnly); this.RadioOnlySettings.toggleClass('hidden', !radioboxOnly); - this.KeySettings.toggleClass('hidden', radioboxOnly); + this.KeySettings.toggleClass('hidden', radioboxOnly || isSimpleInsideComplex); var value = (checkboxOnly || radioboxOnly); this.PlaceholderSettings.toggleClass('hidden', value); this.CheckOnlySettings.toggleClass('hidden', !value); - this.NotImageSettings.toggleClass('hidden', imageOnly); + this.FixedSettings.toggleClass('hidden', imageOnly || isSimpleInsideComplex); + this.NotInComplexSettings.toggleClass('hidden', isSimpleInsideComplex); }, onSelectItem: function(listView, itemView, record) { @@ -1425,7 +1571,15 @@ define([ textTag: 'Tag', textAuto: 'Auto', textAtLeast: 'At least', - textExact: 'Exactly' + textExact: 'Exactly', + textFormat: 'Format', + textMask: 'Arbitrary Mask', + textReg: 'Regular Expression', + textFormatSymbols: 'Allowed Symbols', + textLetters: 'Letters', + textDigits: 'Digits', + textNone: 'None', + textComplex: 'Complex Field' }, DE.Views.FormSettings || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/FormsTab.js b/apps/documenteditor/main/app/view/FormsTab.js index d3a0a2199..06a5df008 100644 --- a/apps/documenteditor/main/app/view/FormsTab.js +++ b/apps/documenteditor/main/app/view/FormsTab.js @@ -56,6 +56,9 @@ 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-email"></span>' + + '<span class="btn-slot text x-huge" id="slot-btn-form-phone"></span>' + + '<span class="btn-slot text x-huge" id="slot-btn-form-complex"></span>' + '</div>' + '<div class="separator long forms" style="display: none;"></div>' + '<div class="group no-group-mask inner-elset small" style="display: none;">' + @@ -99,6 +102,15 @@ define([ this.btnImageField && this.btnImageField.on('click', function (b, e) { me.fireEvent('forms:insert', ['picture']); }); + this.btnComplexField && this.btnComplexField.on('click', function (b, e) { + me.fireEvent('forms:insert', ['complex']); + }); + this.btnEmailField && this.btnEmailField.on('click', function (b, e) { + me.fireEvent('forms:insert', ['text', {reg: "\\S+@\\S+\\.\\S+"}]); + }); + this.btnPhoneField && this.btnPhoneField.on('click', function (b, e) { + me.fireEvent('forms:insert', ['text', {mask: "(999)999-9999"}]); + }); this.btnViewForm && this.btnViewForm.on('click', function (b, e) { me.fireEvent('forms:mode', [b.pressed]); }); @@ -209,7 +221,7 @@ define([ this.btnImageField = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-insertimage', - lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart], + lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.complexForm, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart], caption: this.capBtnImage, dataHint: '1', dataHintDirection: 'bottom', @@ -217,6 +229,39 @@ define([ }); this.paragraphControls.push(this.btnImageField); + this.btnEmailField = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-email', + lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart], + caption: this.capBtnEmail, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.paragraphControls.push(this.btnEmailField); + + this.btnPhoneField = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-phone', + lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart], + caption: this.capBtnPhone, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.paragraphControls.push(this.btnPhoneField); + + this.btnComplexField = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon сomplex-field', + lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.complexForm, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart], + caption: this.capBtnComplex, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.paragraphControls.push(this.btnComplexField); + this.btnViewForm = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-sheet-view', @@ -349,6 +394,9 @@ define([ me.btnRadioBox.updateHint(me.tipRadioBox); me.btnImageField.updateHint(me.tipImageField); me.btnViewForm.updateHint(me.tipViewForm); + me.btnEmailField.updateHint(me.tipEmailField); + me.btnPhoneField.updateHint(me.tipPhoneField); + me.btnComplexField.updateHint(me.tipComplexField); } else { me.btnClear.updateHint(me.textClearFields); } @@ -381,6 +429,9 @@ define([ this.btnViewForm.render($host.find('#slot-btn-form-view')); this.btnClearFields.render($host.find('#slot-form-clear-fields')); this.btnHighlight.render($host.find('#slot-form-highlight')); + this.btnEmailField.render($host.find('#slot-btn-form-email')); + this.btnPhoneField.render($host.find('#slot-btn-form-phone')); + this.btnComplexField.render($host.find('#slot-btn-form-complex')); var separator_forms = $host.find('.separator.forms'); separator_forms.prev('.group').show(); @@ -443,7 +494,13 @@ define([ textCreateForm: 'Add fields and create a fillable OFORM document', textGotIt: 'Got it', capBtnDownloadForm: 'Download as oform', - tipDownloadForm: 'Download a file as a fillable OFORM document' + tipDownloadForm: 'Download a file as a fillable OFORM document', + capBtnEmail: 'Email Address', + capBtnPhone: 'Phone Number', + capBtnComplex: 'Complex Field', + tipEmailField: 'Insert email address', + tipPhoneField: 'Insert phone number', + tipComplexField: 'Insert complex field' } }()), DE.Views.FormsTab || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 93f63587e..ed2a41376 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -115,7 +115,8 @@ define([ cantArrange: 'cant-arrange', noObjectSelected: 'no-object', lostConnect: 'disconnect', - disableOnStart: 'on-start' + disableOnStart: 'on-start', + complexForm: 'complex-form' }; for (var key in enumLock) { if (enumLock.hasOwnProperty(key)) { diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 87d502782..6ece81050 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -606,6 +606,7 @@ "DE.Controllers.Main.errorUserDrop": "The file cannot be accessed right now.", "DE.Controllers.Main.errorUsersExceed": "The number of users allowed by the pricing plan was exceeded", "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,<br>but will not be able to download or print it until the connection is restored and page is reloaded.", + "DE.Controllers.Main.errorTextFormWrongFormat": "The value entered does not match the format of the field.", "DE.Controllers.Main.leavePageText": "You have unsaved changes in this document. Click \"Stay on This Page\", then \"Save\" to save them. Click \"Leave This Page\" to discard all the unsaved changes.", "DE.Controllers.Main.leavePageTextOnClose": "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.", "DE.Controllers.Main.loadFontsTextText": "Loading data...", @@ -1880,6 +1881,14 @@ "DE.Views.FormSettings.textUnlock": "Unlock", "DE.Views.FormSettings.textValue": "Value Options", "DE.Views.FormSettings.textWidth": "Cell width", + "DE.Views.FormSettings.textFormat": "Format", + "DE.Views.FormSettings.textMask": "Arbitrary Mask", + "DE.Views.FormSettings.textReg": "Regular Expression", + "DE.Views.FormSettings.textFormatSymbols": "Allowed Symbols", + "DE.Views.FormSettings.textLetters": "Letters", + "DE.Views.FormSettings.textDigits": "Digits", + "DE.Views.FormSettings.textNone": "None", + "DE.Views.FormSettings.textComplex": "Complex Field", "DE.Views.FormsTab.capBtnCheckBox": "Checkbox", "DE.Views.FormsTab.capBtnComboBox": "Combo Box", "DE.Views.FormsTab.capBtnDownloadForm": "Download as oform", @@ -1913,6 +1922,12 @@ "DE.Views.FormsTab.tipTextField": "Insert text field", "DE.Views.FormsTab.tipViewForm": "View form", "DE.Views.FormsTab.txtUntitled": "Untitled", + "DE.Views.FormsTab.capBtnEmail": "Email Address", + "DE.Views.FormsTab.capBtnPhone": "Phone Number", + "DE.Views.FormsTab.capBtnComplex": "Complex Field", + "DE.Views.FormsTab.tipEmailField": "Insert email address", + "DE.Views.FormsTab.tipPhoneField": "Insert phone number", + "DE.Views.FormsTab.tipComplexField": "Insert complex field", "DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom center", "DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left", "DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of Page", diff --git a/apps/documenteditor/main/resources/img/toolbar/1.25x/big/btn-email.png b/apps/documenteditor/main/resources/img/toolbar/1.25x/big/btn-email.png new file mode 100644 index 000000000..92a5d7d8a Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.25x/big/btn-email.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1.25x/big/btn-phone.png b/apps/documenteditor/main/resources/img/toolbar/1.25x/big/btn-phone.png new file mode 100644 index 000000000..a43d536f6 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.25x/big/btn-phone.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1.25x/big/сomplex-field.png b/apps/documenteditor/main/resources/img/toolbar/1.25x/big/сomplex-field.png new file mode 100644 index 000000000..8419ec10f Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.25x/big/сomplex-field.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1.5x/big/btn-email.png b/apps/documenteditor/main/resources/img/toolbar/1.5x/big/btn-email.png new file mode 100644 index 000000000..b804285c5 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.5x/big/btn-email.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1.5x/big/btn-phone.png b/apps/documenteditor/main/resources/img/toolbar/1.5x/big/btn-phone.png new file mode 100644 index 000000000..a2480fb64 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.5x/big/btn-phone.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1.5x/big/сomplex-field.png b/apps/documenteditor/main/resources/img/toolbar/1.5x/big/сomplex-field.png new file mode 100644 index 000000000..23c3f3963 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.5x/big/сomplex-field.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1.75x/big/btn-email.png b/apps/documenteditor/main/resources/img/toolbar/1.75x/big/btn-email.png new file mode 100644 index 000000000..73386b41b Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.75x/big/btn-email.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1.75x/big/btn-phone.png b/apps/documenteditor/main/resources/img/toolbar/1.75x/big/btn-phone.png new file mode 100644 index 000000000..a81126ff4 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.75x/big/btn-phone.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1.75x/big/сomplex-field.png b/apps/documenteditor/main/resources/img/toolbar/1.75x/big/сomplex-field.png new file mode 100644 index 000000000..15015c661 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.75x/big/сomplex-field.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-email.png b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-email.png new file mode 100644 index 000000000..e75820d87 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-email.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-phone.png b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-phone.png new file mode 100644 index 000000000..86485be8b Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-phone.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/big/сomplex-field.png b/apps/documenteditor/main/resources/img/toolbar/1x/big/сomplex-field.png new file mode 100644 index 000000000..571a4d376 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/big/сomplex-field.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-email.png b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-email.png new file mode 100644 index 000000000..e1107eae0 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-email.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-phone.png b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-phone.png new file mode 100644 index 000000000..cab7535bf Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-phone.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/big/сomplex-field.png b/apps/documenteditor/main/resources/img/toolbar/2x/big/сomplex-field.png new file mode 100644 index 000000000..4cca0665a Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/big/сomplex-field.png differ