diff --git a/apps/common/main/lib/component/SynchronizeTip.js b/apps/common/main/lib/component/SynchronizeTip.js
index d012a2d97..e317f4044 100644
--- a/apps/common/main/lib/component/SynchronizeTip.js
+++ b/apps/common/main/lib/component/SynchronizeTip.js
@@ -111,6 +111,8 @@ define([
} else
if (this.placement == 'top')
this.cmpEl.css({bottom : innerHeight - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'});
+ else if (this.placement == 'bottom')
+ this.cmpEl.css({top : (showxy.top+5) + this.target.height() + 'px', left: showxy.left + (this.target.width() - this.cmpEl.width())/2 + 'px'});
else if (this.placement == 'target') {
this.cmpEl.css({top : (showxy.top+5) + 'px', left: (showxy.left+5) + 'px'});
} else {// left or right
diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js
index facf19713..f8eaad23f 100644
--- a/apps/documenteditor/main/app/controller/FormsTab.js
+++ b/apps/documenteditor/main/app/controller/FormsTab.js
@@ -70,6 +70,9 @@ define([
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onChangeSpecialFormsGlobalSettings', _.bind(this.onChangeSpecialFormsGlobalSettings, this));
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
+ this.api.asc_registerCallback('asc_onStartAction', _.bind(this.onLongActionBegin, this));
+ this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this));
+ this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
// this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this));
// this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this));
@@ -79,8 +82,10 @@ define([
setConfig: function(config) {
this.toolbar = config.toolbar;
+ this.appConfig = config.config;
this.view = this.createView('FormsTab', {
- toolbar: this.toolbar.toolbar
+ toolbar: this.toolbar.toolbar,
+ config: config.config
});
this.addListeners({
'FormsTab': {
@@ -89,7 +94,9 @@ define([
'forms:clear': this.onClearClick,
'forms:no-color': this.onNoControlsColor,
'forms:select-color': this.onSelectControlsColor,
- 'forms:mode': this.onModeClick
+ 'forms:mode': this.onModeClick,
+ 'forms:goto': this.onGoTo,
+ 'forms:submit': this.onSubmitClick
}
});
},
@@ -98,6 +105,10 @@ define([
this.view && this.view.SetDisabled(state);
},
+ createToolbarPanel: function() {
+ return this.view.getPanel();
+ },
+
getView: function(name) {
return !name && this.view ?
this.view : Backbone.Controller.prototype.getView.call(this, name);
@@ -108,7 +119,7 @@ define([
},
onApiFocusObject: function(selectedObjects) {
- if (!this.toolbar.editMode) return;
+ if (!this.toolbar.editMode || this.appConfig.isRestrictedEdit) return;
var pr, i = -1, type,
paragraph_locked = false,
@@ -215,6 +226,17 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
+ onGoTo: function(type) {
+ if (this.api)
+ this.api.asc_MoveToFillingForm(type=='next');
+ Common.NotificationCenter.trigger('edit:complete', this.toolbar);
+ },
+
+ onSubmitClick: function() {
+ this.api.asc_SendForm();
+ Common.NotificationCenter.trigger('edit:complete', this.toolbar);
+ },
+
disableEditing: function(disable) {
if (this._state.DisabledEditing != disable) {
this._state.DisabledEditing = disable;
@@ -237,12 +259,46 @@ define([
}
},
+ onLongActionBegin: function(type, id) {
+ if (id==Asc.c_oAscAsyncAction['Submit'] && this.view.btnSubmit) {
+ this._submitFail = false;
+ this.submitedTooltip && this.submitedTooltip.hide();
+ this.view.btnSubmit.setDisabled(true);
+ }
+ },
+
+ onLongActionEnd: function(type, id) {
+ if (id==Asc.c_oAscAsyncAction['Submit'] && this.view.btnSubmit) {
+ this.view.btnSubmit.setDisabled(false);
+ if (!this.submitedTooltip) {
+ this.submitedTooltip = new Common.UI.SynchronizeTip({
+ text: this.view.textSubmited,
+ extCls: 'no-arrow',
+ showLink: false,
+ target: $('.toolbar'),
+ placement: 'bottom'
+ });
+ this.submitedTooltip.on('closeclick', function () {
+ this.submitedTooltip.hide();
+ }, this);
+ }
+ !this._submitFail && this.submitedTooltip.show();
+ }
+ },
+
+ onError: function(id, level, errData) {
+ if (id==Asc.c_oAscError.ID.Submit) {
+ this._submitFail = true;
+ this.submitedTooltip && this.submitedTooltip.hide();
+ }
+ },
+
onAppReady: function (config) {
var me = this;
(new Promise(function (accept, reject) {
accept();
})).then(function(){
- if (config.canEditContentControl) {
+ if (config.canEditContentControl && me.view.btnHighlight) {
var clr = me.api.asc_GetSpecialFormsHighlightColor();
clr && (clr = Common.Utils.ThemeColor.getHexColor(clr.get_r(), clr.get_g(), clr.get_b()));
me.view.btnHighlight.currentColor = clr;
diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js
index 23fac4a6c..7fdabb933 100644
--- a/apps/documenteditor/main/app/controller/Main.js
+++ b/apps/documenteditor/main/app/controller/Main.js
@@ -1301,6 +1301,7 @@ define([
this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport);
this.appOptions.canEditContentControl = (this.permissions.modifyContentControl!==false);
this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false);
+ this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm;
this.appOptions.canFillForms = this.appOptions.canLicense && ((this.permissions.fillForms===undefined) ? this.appOptions.isEdit : this.permissions.fillForms) && (this.editorConfig.mode !== 'view');
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
@@ -1663,6 +1664,10 @@ define([
config.msg = this.errorSetPassword;
break;
+ case Asc.c_oAscError.ID.Submit:
+ config.msg = this.errorSubmit;
+ break;
+
default:
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
break;
@@ -2834,7 +2839,8 @@ define([
textRenameLabel: 'Enter a name to be used for collaboration',
textRenameError: 'User name must not be empty.',
textLongName: 'Enter a name that is less than 128 characters.',
- textGuest: 'Guest'
+ textGuest: 'Guest',
+ errorSubmit: 'Submit failed.'
}
})(), DE.Controllers.Main || {}))
});
\ No newline at end of file
diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js
index cd18c3555..6aeb23e35 100644
--- a/apps/documenteditor/main/app/controller/Toolbar.js
+++ b/apps/documenteditor/main/app/controller/Toolbar.js
@@ -3055,8 +3055,8 @@ define([
onAppShowed: function (config) {
var me = this;
- var compactview = !config.isEdit;
- if ( config.isEdit ) {
+ var compactview = !(config.isEdit || config.isRestrictedEdit && config.canFillForms);
+ if ( config.isEdit || config.isRestrictedEdit && config.canFillForms) {
if ( Common.localStorage.itemExists("de-compact-toolbar") ) {
compactview = Common.localStorage.getBool("de-compact-toolbar");
} else
@@ -3102,15 +3102,21 @@ define([
var links = me.getApplication().getController('Links');
links.setApi(me.api).setConfig({toolbar: me});
Array.prototype.push.apply(me.toolbar.toolbarControls, links.getView('Links').getButtons());
-
- if (config.canFeatureContentControl) {
- tab = {caption: me.textTabForms, action: 'forms'};
- var forms = me.getApplication().getController('FormsTab');
- forms.setApi(me.api).setConfig({toolbar: me});
+ }
+ if ( config.isEdit && config.canFeatureContentControl || config.isRestrictedEdit && config.canFillForms ) {
+ tab = {caption: me.textTabForms, action: 'forms'};
+ var forms = me.getApplication().getController('FormsTab');
+ forms.setApi(me.api).setConfig({toolbar: me, config: config});
+ $panel = forms.createToolbarPanel();
+ if ($panel) {
me.toolbar.addTab(tab, $panel, 4);
me.toolbar.setVisible('forms', true);
- Array.prototype.push.apply(me.toolbar.toolbarControls, forms.getView('FormsTab').getButtons());
- me.onChangeSdtGlobalSettings();
+ if (config.isEdit && config.canFeatureContentControl) {
+ Array.prototype.push.apply(me.toolbar.toolbarControls, forms.getView('FormsTab').getButtons());
+ me.onChangeSdtGlobalSettings();
+ } else if (!compactview) {
+ me.toolbar.setTab('forms');
+ }
}
}
},
diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js
index 5780631da..5f44a908a 100644
--- a/apps/documenteditor/main/app/controller/Viewport.js
+++ b/apps/documenteditor/main/app/controller/Viewport.js
@@ -165,7 +165,7 @@ define([
me.viewport.$el.attr('applang', me.appConfig.lang.split(/[\-_]/)[0]);
- if ( !config.isEdit ||
+ if ( !(config.isEdit || config.isRestrictedEdit && config.canFillForms) ||
( !Common.localStorage.itemExists("de-compact-toolbar") &&
config.customization && config.customization.compactToolbar )) {
@@ -205,8 +205,8 @@ define([
onAppReady: function (config) {
var me = this;
if ( me.header.btnOptions ) {
- var compactview = !config.isEdit;
- if ( config.isEdit ) {
+ var compactview = !(config.isEdit || config.isRestrictedEdit && config.canFillForms);
+ if ( config.isEdit || config.isRestrictedEdit && config.canFillForms) {
if ( Common.localStorage.itemExists("de-compact-toolbar") ) {
compactview = Common.localStorage.getBool("de-compact-toolbar");
} else
@@ -223,7 +223,7 @@ define([
if (!config.isEdit) {
me.header.mnuitemCompactToolbar.hide();
Common.NotificationCenter.on('tab:visible', _.bind(function(action, visible){
- if ((action=='plugins' || action=='review') && visible) {
+ if ((action=='plugins' || action=='review' || action=='forms') && visible) {
me.header.mnuitemCompactToolbar.show();
}
}, this));
diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template
index 69a8c91ca..1c6b32745 100644
--- a/apps/documenteditor/main/app/template/Toolbar.template
+++ b/apps/documenteditor/main/app/template/Toolbar.template
@@ -174,29 +174,6 @@
-