From e5ed8bb5e3c222d7fdc6248ccacb18104366bb8c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 30 May 2024 23:21:04 +0300 Subject: [PATCH] [DE] Change submit button --- apps/common/main/resources/less/buttons.less | 42 ++++++++++ .../app/controller/ApplicationController.js | 79 +++++++++---------- .../forms/app/view/ApplicationView.js | 8 +- apps/documenteditor/forms/index.html | 2 +- apps/documenteditor/forms/index.html.deploy | 2 +- apps/documenteditor/forms/locale/en.json | 3 +- .../main/app/controller/FormsTab.js | 45 +++++++---- apps/documenteditor/main/app/view/FormsTab.js | 2 +- 8 files changed, 119 insertions(+), 64 deletions(-) diff --git a/apps/common/main/resources/less/buttons.less b/apps/common/main/resources/less/buttons.less index 4ee1293804..e20ca393cd 100644 --- a/apps/common/main/resources/less/buttons.less +++ b/apps/common/main/resources/less/buttons.less @@ -1087,6 +1087,48 @@ background-color: @highlight-fill-button-pressed !important; } } + &.back-color { + .font-weight-bold(); + border: 1px solid @text-toolbar-header-ie; + border: 1px solid @text-toolbar-header; + color: @text-toolbar-header-ie; + color: @text-toolbar-header; + background-color: transparent; + + .style-off-tabs & { + border: 1px solid @text-normal-ie; + border: 1px solid @text-normal; + color: @text-normal-ie; + color: @text-normal; + } + + &:not(:disabled) { + opacity: @header-component-normal-icon-opacity; + } + + &:hover:not(.disabled), + .over:not(.disabled) { + background-color: @highlight-header-button-hover-ie !important; + background-color: @highlight-header-button-hover !important; + + .style-off-tabs & { + background-color: @highlight-button-hover-ie !important; + background-color: @highlight-button-hover !important; + } + } + + &:active:not(.disabled), + &.active:not(.disabled) { + background-color: @highlight-header-button-pressed-ie !important; + background-color: @highlight-header-button-pressed !important; + + .style-off-tabs & { + background-color: @highlight-button-pressed-ie !important; + background-color: @highlight-button-pressed !important; + } + } + + } } .btn-text-menu-default { diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index ff6d722b64..176ff4b2ab 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -666,6 +666,33 @@ define([ me.api.asc_ClearAllSpecialForms(); }); me.view.btnSubmit.on('click', function(){ + if (!me.api.asc_IsAllRequiredFormsFilled()) { + me.api.asc_MoveToFillingForm(true, true, true); + if (!me.requiredTooltip) { + me.requiredTooltip = new Common.UI.SynchronizeTip({ + extCls: 'colored', + placement: 'bottom-left', + target: me.view.btnSubmit.$el, + text: me.textRequired, + showLink: false, + closable: false, + showButton: true, + textButton: me.textGotIt + }); + me.requiredTooltip.on('buttonclick', function () { + me.requiredTooltip.hide(); + }); + } + !me.requiredTooltip.isVisible() && me.requiredTooltip.show(); + + // Common.UI.warning({ + // msg: me.textRequired, + // callback: function() { + // me.api.asc_MoveToFillingForm(true, true, true); + // } + // }); + return; + } me.api.asc_SendForm(); }); me.view.btnDownload.on('click', function(){ @@ -879,7 +906,7 @@ define([ this.view.btnSubmit.cmpEl.css("pointer-events", "auto"); if (!_submitFail) { this.view.btnSubmit.setCaption(this.textFilled); - this.view.btnSubmit.cmpEl.addClass('gray'); + this.view.btnSubmit.cmpEl.removeClass('yellow').removeClass('back-color').addClass('gray'); if (!this.submitedTooltip) { this.submitedTooltip = new Common.UI.SynchronizeTip({ text: this.textSubmitOk, @@ -1088,8 +1115,10 @@ define([ }, onFillRequiredFields: function(isFilled) { - this.view.btnSubmit.setDisabled(!isFilled); - this.view.btnSubmit.cmpEl.css("pointer-events", isFilled ? "auto" : "none"); + // this.view.btnSubmit.setDisabled(!isFilled); + // this.view.btnSubmit.cmpEl.css("pointer-events", isFilled ? "auto" : "none"); + this.view.btnSubmit.cmpEl.removeClass(isFilled ? 'back-color' : 'yellow').addClass(isFilled ? 'yellow' : 'back-color'); + isFilled && this.requiredTooltip && this.requiredTooltip.hide(); }, onProcessMouse: function(data) { @@ -1783,43 +1812,13 @@ define([ // TODO: add asc_hasRequiredFields to sdk - if (this.appOptions.canSubmitForms && !this.api.asc_IsAllRequiredFormsFilled()) { - this.view.btnSubmit.setDisabled(true); - this.view.btnSubmit.cmpEl.css("pointer-events", "none"); - var sgroup = $('#id-submit-group'); - if (!Common.localStorage.getItem("de-embed-hide-submittip")) { - var requiredTooltip = new Common.UI.SynchronizeTip({ - extCls: 'colored', - placement: 'bottom-left', - target: this.view.btnSubmit.$el, - text: this.textRequired, - showLink: false, - closable: false, - showButton: true, - textButton: this.textGotIt - }); - var onclose = function () { - requiredTooltip.hide(); - me.api.asc_MoveToFillingForm(true, true, true); - sgroup.attr('data-toggle', 'tooltip'); - sgroup.tooltip({ - title : me.textRequired, - placement : 'bottom' - }); - }; - requiredTooltip.on('buttonclick', function () { - onclose(); - Common.localStorage.setItem("de-embed-hide-submittip", 1); - }); - requiredTooltip.on('closeclick', onclose); - requiredTooltip.show(); - } else { - sgroup.attr('data-toggle', 'tooltip'); - sgroup.tooltip({ - title : me.textRequired, - placement : 'bottom' - }); - } + if (this.appOptions.canSubmitForms) { + if (this.api.asc_IsAllRequiredFormsFilled()) + this.view.btnSubmit.cmpEl.removeClass('back-color').addClass('yellow'); + // else { + // this.view.btnSubmit.setDisabled(true); + // this.view.btnSubmit.cmpEl.css("pointer-events", "none"); + // } } var documentMoveTimer; diff --git a/apps/documenteditor/forms/app/view/ApplicationView.js b/apps/documenteditor/forms/app/view/ApplicationView.js index ed22a5ebc0..45917aea14 100644 --- a/apps/documenteditor/forms/app/view/ApplicationView.js +++ b/apps/documenteditor/forms/app/view/ApplicationView.js @@ -148,8 +148,9 @@ define([ this.btnRedo.render($('#id-btn-redo')); this.btnSubmit = new Common.UI.Button({ - cls: 'btn-text-default auto colored yellow margin-left-small margin-right-small', - caption: this.textSubmit + cls: 'btn-text-default auto colored back-color margin-left-small margin-right-small', + caption: this.textSubmit, + hint: this.tipSubmit }); this.btnSubmit.render($('#id-submit-group')); @@ -223,7 +224,8 @@ define([ tipUndo: 'Undo', tipRedo: 'Redo', textClearField: 'Clear field', - textClose: 'Close file' + textClose: 'Close file', + tipSubmit: 'Submit form' }, DE.Views.ApplicationView || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/forms/index.html b/apps/documenteditor/forms/index.html index 8a30e8169b..903e247f2d 100644 --- a/apps/documenteditor/forms/index.html +++ b/apps/documenteditor/forms/index.html @@ -263,7 +263,7 @@ -
+
diff --git a/apps/documenteditor/forms/index.html.deploy b/apps/documenteditor/forms/index.html.deploy index b562826cb8..a29d301d85 100644 --- a/apps/documenteditor/forms/index.html.deploy +++ b/apps/documenteditor/forms/index.html.deploy @@ -244,7 +244,7 @@
-
+
diff --git a/apps/documenteditor/forms/locale/en.json b/apps/documenteditor/forms/locale/en.json index c1662873ce..45052c255b 100644 --- a/apps/documenteditor/forms/locale/en.json +++ b/apps/documenteditor/forms/locale/en.json @@ -189,5 +189,6 @@ "DE.Views.ApplicationView.txtPrint": "Print", "DE.Views.ApplicationView.txtSearch": "Find", "DE.Views.ApplicationView.txtShare": "Share", - "DE.Views.ApplicationView.txtTheme": "Interface theme" + "DE.Views.ApplicationView.txtTheme": "Interface theme", + "DE.Views.ApplicationView.tipSubmit": "Submit form" } \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index b43e9c0030..68461fd455 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -114,7 +114,8 @@ define([ callback: function() { me.api.asc_MoveToFillingForm(true, true, true); me.view.btnSubmit.updateHint(me.view.textRequired); - }} : undefined + }} : undefined, + 'submit-required': this.appConfig.isRestrictedEdit ? {placement: 'bottom-' + dirLeft, text: this.view.textRequired, link: false, target: '#slot-btn-header-form-submit'} : undefined }; !Common.localStorage.getItem(this._helpTips['key'].name) && this.addListeners({'RightMenu': {'rightmenuclick': this.onRightMenuClick}}); this.addListeners({ @@ -346,14 +347,17 @@ define([ onSubmitClick: function() { if (!this.api.asc_IsAllRequiredFormsFilled()) { - var me = this; - Common.UI.warning({ - msg: this.view.textRequired, - callback: function() { - me.api.asc_MoveToFillingForm(true, true, true); - Common.NotificationCenter.trigger('edit:complete', me.toolbar); - } - }); + this.showHelpTip('submit-required'); + this.api.asc_MoveToFillingForm(true, true, true); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + // var me = this; + // Common.UI.warning({ + // msg: this.view.textRequired, + // callback: function() { + // me.api.asc_MoveToFillingForm(true, true, true); + // Common.NotificationCenter.trigger('edit:complete', me.toolbar); + // } + // }); return; } @@ -459,7 +463,6 @@ define([ Common.Utils.lockControls(Common.enumLock.submit, !this._submitFail, {array: [this.view.btnSubmit]}) if (!this._submitFail) { this.view.btnSubmit.setCaption(this.view.textFilled); - this.view.btnSubmit.cmpEl.addClass('gray'); if (!this.submitedTooltip) { this.submitedTooltip = new Common.UI.SynchronizeTip({ text: this.view.textSubmitOk, @@ -497,9 +500,13 @@ define([ // } config.isEdit && config.canFeatureContentControl && config.isFormCreator && !config.isOForm && me.showHelpTip('create'); // show tip only when create form in docxf - if (config.isRestrictedEdit && me.view && me.view.btnSubmit && me.api && !me.api.asc_IsAllRequiredFormsFilled()) { - Common.Utils.lockControls(Common.enumLock.requiredNotFilled, true, {array: [me.view.btnSubmit]}); - me.showHelpTip('submit'); + if (config.isRestrictedEdit && me.view && me.view.btnSubmit && me.api) { + if (me.api.asc_IsAllRequiredFormsFilled()) + me.view.btnSubmit.cmpEl.removeClass('back-color').addClass('yellow'); + // else { + // Common.Utils.lockControls(Common.enumLock.requiredNotFilled, true, {array: [me.view.btnSubmit]}); + // me.showHelpTip('submit'); + // } } me.onRefreshRolesList(); me.onChangeProtectDocument(); @@ -511,13 +518,13 @@ define([ if (props) { props.tip && props.tip.close(); props.tip = undefined; - force && Common.localStorage.setItem(props.name, 1); + force && props.name && Common.localStorage.setItem(props.name, 1); } }, showHelpTip: function(step) { if (!this._helpTips[step]) return; - if (!Common.localStorage.getItem(this._helpTips[step].name)) { + if (!(this._helpTips[step].name && Common.localStorage.getItem(this._helpTips[step].name))) { var props = this._helpTips[step], target = props.target; @@ -549,7 +556,7 @@ define([ Common.NotificationCenter.trigger('file:help', props.link.src); }, 'close': function() { - Common.localStorage.setItem(props.name, 1); + props.name && Common.localStorage.setItem(props.name, 1); props.callback && props.callback(); } }); @@ -640,7 +647,11 @@ define([ }, onFillRequiredFields: function(isFilled) { - this.appConfig.isRestrictedEdit && this.appConfig.canFillForms && this.view.btnSubmit && Common.Utils.lockControls(Common.enumLock.requiredNotFilled, !isFilled, {array: [this.view.btnSubmit]}); + // this.appConfig.isRestrictedEdit && this.appConfig.canFillForms && this.view.btnSubmit && Common.Utils.lockControls(Common.enumLock.requiredNotFilled, !isFilled, {array: [this.view.btnSubmit]}); + if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms && this.view.btnSubmit) { + this.view.btnSubmit.cmpEl.removeClass(isFilled ? 'back-color' : 'yellow').addClass(isFilled ? 'yellow' : 'back-color'); + isFilled && this.closeHelpTip('submit-required'); + } }, onCountPages: function(count) { diff --git a/apps/documenteditor/main/app/view/FormsTab.js b/apps/documenteditor/main/app/view/FormsTab.js index 617fac929f..88401929d8 100644 --- a/apps/documenteditor/main/app/view/FormsTab.js +++ b/apps/documenteditor/main/app/view/FormsTab.js @@ -568,7 +568,7 @@ define([ if (this.appConfig.canSubmitForms) { if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms) { this.btnSubmit = new Common.UI.Button({ - cls: 'btn-text-default auto yellow', + cls: 'btn-text-default auto back-color', caption: this.capBtnSubmit, lock: [_set.lostConnect, _set.disableOnStart, _set.requiredNotFilled, _set.submit], dataHint: '0',