[DE] Lock buttons on forms, references. view tabs

This commit is contained in:
Julia Radzhabova 2021-12-29 13:14:42 +03:00
parent bb40bc8994
commit 8a45637f32
8 changed files with 124 additions and 108 deletions

View file

@ -57,9 +57,7 @@ define([
initialize: function () { initialize: function () {
}, },
onLaunch: function () { onLaunch: function () {
this._state = { this._state = {};
prcontrolsdisable:undefined
};
}, },
setApi: function (api) { setApi: function (api) {
@ -145,17 +143,12 @@ define([
control_plain = (in_control&&control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false; control_plain = (in_control&&control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false;
(lock_type===undefined) && (lock_type = Asc.c_oAscSdtLockType.Unlocked); (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 content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked;
var need_disable = (paragraph_locked || header_locked || control_plain || content_locked); var arr = [ this.view.btnTextField, this.view.btnComboBox, this.view.btnDropDown, this.view.btnCheckBox,
if (this._state.prcontrolsdisable !== need_disable) { this.view.btnRadioBox, this.view.btnImageField ];
this.view.btnTextField.setDisabled(need_disable); Common.Utils.lockControls(DE.enumLock.paragraphLock, paragraph_locked, {array: arr});
this.view.btnComboBox.setDisabled(need_disable); Common.Utils.lockControls(DE.enumLock.headerLock, header_locked, {array: arr});
this.view.btnDropDown.setDisabled(need_disable); Common.Utils.lockControls(DE.enumLock.controlPlain, control_plain, {array: arr});
this.view.btnCheckBox.setDisabled(need_disable); Common.Utils.lockControls(DE.enumLock.contentLock, content_locked, {array: arr});
this.view.btnRadioBox.setDisabled(need_disable);
this.view.btnImageField.setDisabled(need_disable);
this.view.btnTextField.setDisabled(need_disable);
this._state.prcontrolsdisable = need_disable;
}
}, },
onChangeSpecialFormsGlobalSettings: function() { onChangeSpecialFormsGlobalSettings: function() {

View file

@ -87,7 +87,6 @@ define([
}, },
onLaunch: function () { onLaunch: function () {
this._state = { this._state = {
prcontrolsdisable:undefined,
in_object: undefined in_object: undefined
}; };
Common.Gateway.on('setactionlink', function (url) { Common.Gateway.on('setactionlink', function (url) {
@ -164,7 +163,6 @@ define([
object_type = type; object_type = type;
} }
} }
this._state.prcontrolsdisable = paragraph_locked || header_locked;
this._state.in_object = object_type; this._state.in_object = object_type;
var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null, var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
@ -176,28 +174,31 @@ define([
plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : false, plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : false,
plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false; plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false;
this.lockToolbar(DE.enumLock.paragraphLock, paragraph_locked, {array: this.view.btnsNotes.concat(this.view.btnsHyperlink).concat([this.view.btnBookmarks, this.view.btnTableFiguresUpdate, this.view.btnCrossRef])});
this.lockToolbar(DE.enumLock.inHeader, in_header, {array: this.view.btnsNotes.concat(this.view.btnsContents).concat([this.view.btnBookmarks, this.view.btnTableFigures,
this.view.btnTableFiguresUpdate, this.view.btnCaption])});
this.lockToolbar(DE.enumLock.controlPlain, control_plain, {array: this.view.btnsNotes.concat([this.view.btnBookmarks, this.view.btnCrossRef])});
this.lockToolbar(DE.enumLock.richEditLock, rich_edit_lock, {array: this.view.btnsNotes.concat(this.view.btnsContents).concat([this.view.btnTableFigures, this.view.btnTableFiguresUpdate,
this.view.btnCrossRef])});
this.lockToolbar(DE.enumLock.plainEditLock, plain_edit_lock, {array: this.view.btnsNotes.concat(this.view.btnsContents).concat([this.view.btnTableFigures, this.view.btnTableFiguresUpdate,
this.view.btnCrossRef])});
this.lockToolbar(DE.enumLock.headerLock, header_locked, {array: this.view.btnsHyperlink.concat([this.view.btnBookmarks, this.view.btnCrossRef])});
this.lockToolbar(DE.enumLock.inEquation, in_equation, {array: this.view.btnsNotes});
this.lockToolbar(DE.enumLock.inImage, in_image, {array: this.view.btnsNotes});
this.lockToolbar(DE.enumLock.richDelLock, rich_del_lock, {array: this.view.btnsContents.concat([this.view.btnTableFigures, this.view.btnTableFiguresUpdate])});
this.lockToolbar(DE.enumLock.plainDelLock, plain_del_lock, {array: this.view.btnsContents.concat([this.view.btnTableFigures, this.view.btnTableFiguresUpdate])});
this.lockToolbar(DE.enumLock.contentLock, content_locked, {array: [this.view.btnCrossRef]});
this.lockToolbar(DE.enumLock.cantUpdateTOF, !this.api.asc_CanUpdateTablesOfFigures(), {array: [this.view.btnTableFiguresUpdate]});
var need_disable = paragraph_locked || in_equation || in_image || in_header || control_plain || rich_edit_lock || plain_edit_lock; this.dlgCrossRefDialog && this.dlgCrossRefDialog.isVisible() && this.dlgCrossRefDialog.setLocked(this.view.btnCrossRef.isDisabled());
this.view.btnsNotes.setDisabled(need_disable); },
need_disable = paragraph_locked || header_locked || in_header || control_plain; lockToolbar: function (causes, lock, opts) {
this.view.btnBookmarks.setDisabled(need_disable); Common.Utils.lockControls(causes, lock, opts, this.view.getButtons());
need_disable = in_header || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock;
this.view.btnsContents.setDisabled(need_disable);
this.view.btnTableFigures.setDisabled(need_disable);
this.view.btnTableFiguresUpdate.setDisabled(need_disable || paragraph_locked || !this.api.asc_CanUpdateTablesOfFigures());
need_disable = in_header;
this.view.btnCaption.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || control_plain || rich_edit_lock || plain_edit_lock || content_locked;
this.view.btnCrossRef.setDisabled(need_disable);
this.dlgCrossRefDialog && this.dlgCrossRefDialog.isVisible() && this.dlgCrossRefDialog.setLocked(need_disable);
}, },
onApiCanAddHyperlink: function(value) { onApiCanAddHyperlink: function(value) {
this.toolbar.editMode && this.view.btnsHyperlink.setDisabled(!value || this._state.prcontrolsdisable); this.toolbar.editMode && this.lockToolbar(DE.enumLock.hyperlinkLock, !value, {array: this.view.btnsHyperlink});
}, },
onHyperlinkClick: function(btn) { onHyperlinkClick: function(btn) {

View file

@ -124,17 +124,23 @@ define([
if (!this.editMode) return; if (!this.editMode) return;
var me = this; var me = this;
var disable = [], type; var disable = {}, type,
islocked = false,
shapeProps,
canGroupUngroup = false,
wrapping,
content_locked = false,
no_object = true;
for (var i in objects) { for (var i in objects) {
type = objects[i].get_ObjectType(); type = objects[i].get_ObjectType();
if ( type === Asc.c_oAscTypeSelectElement.Image ) { if ( type === Asc.c_oAscTypeSelectElement.Image ) {
var props = objects[i].get_ObjectValue(), var props = objects[i].get_ObjectValue(),
shapeProps = props.get_ShapeProperties(); notflow = !props.get_CanBeFlow();
var islocked = props.get_Locked(); shapeProps = props.get_ShapeProperties();
var notflow = !props.get_CanBeFlow(); islocked = props.get_Locked();
wrapping = props.get_WrappingStyle();
var wrapping = props.get_WrappingStyle(); no_object = false;
me.onApiWrappingStyleChanged(notflow ? -1 : wrapping); me.onApiWrappingStyleChanged(notflow ? -1 : wrapping);
_.each(me.toolbar.btnImgWrapping.menu.items, function(item) { _.each(me.toolbar.btnImgWrapping.menu.items, function(item) {
@ -143,47 +149,42 @@ define([
me.toolbar.btnImgWrapping.menu.items[8].setDisabled(!me.api.CanChangeWrapPolygon()); me.toolbar.btnImgWrapping.menu.items[8].setDisabled(!me.api.CanChangeWrapPolygon());
var control_props = me.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null, var control_props = me.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
lock_type = (control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked, lock_type = (control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked;
content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked;
disable.align = islocked || wrapping == Asc.c_oAscWrapStyle2.Inline || content_locked; content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked;
disable.group = islocked || wrapping == Asc.c_oAscWrapStyle2.Inline || content_locked; disable.arrange = (wrapping == Asc.c_oAscWrapStyle2.Inline) && !props.get_FromGroup();
disable.arrange = (wrapping == Asc.c_oAscWrapStyle2.Inline) && !props.get_FromGroup() || shapeProps && shapeProps.asc_getFromSmartArtInternal() || content_locked; disable.wrapping = props.get_FromGroup() || (notflow && !me.api.CanChangeWrapPolygon()) ||
disable.wrapping = islocked || props.get_FromGroup() || (notflow && !me.api.CanChangeWrapPolygon()) || content_locked ||
(!!control_props && control_props.get_SpecificType()==Asc.c_oAscContentControlSpecificType.Picture && !control_props.get_FormPr()); (!!control_props && control_props.get_SpecificType()==Asc.c_oAscContentControlSpecificType.Picture && !control_props.get_FormPr());
disable.group = islocked || wrapping == Asc.c_oAscWrapStyle2.Inline || content_locked;
if ( !disable.group ) { canGroupUngroup = me.api.CanGroup() || me.api.CanUnGroup();
if (me.api.CanGroup() || me.api.CanUnGroup()) { if (!disable.group && canGroupUngroup) {
var mnuGroup = me.toolbar.btnImgGroup.menu.items[0], me.toolbar.btnImgGroup.menu.items[0].setDisabled(!me.api.CanGroup());
mnuUnGroup = me.toolbar.btnImgGroup.menu.items[1]; me.toolbar.btnImgGroup.menu.items[1].setDisabled(!me.api.CanUnGroup());
mnuGroup.setDisabled(!me.api.CanGroup());
mnuUnGroup.setDisabled(!me.api.CanUnGroup());
} else
disable.group = true;
} }
_imgOriginalProps = props; _imgOriginalProps = props;
break; break;
} }
} }
me.toolbar.lockToolbar(DE.enumLock.noObjectSelected, no_object, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping, me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
me.toolbar.btnImgAlign.setDisabled(disable.align !== false); me.toolbar.lockToolbar(DE.enumLock.imageLock, islocked, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping]});
me.toolbar.btnImgGroup.setDisabled(disable.group !== false); me.toolbar.lockToolbar(DE.enumLock.contentLock, content_locked, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping, me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
me.toolbar.btnImgForward.setDisabled(disable.arrange !== false); me.toolbar.lockToolbar(DE.enumLock.inImageInline, wrapping == Asc.c_oAscWrapStyle2.Inline, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup]});
me.toolbar.btnImgBackward.setDisabled(disable.arrange !== false); me.toolbar.lockToolbar(DE.enumLock.inSmartartInternal, shapeProps && shapeProps.asc_getFromSmartArtInternal(), {array: [me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
me.toolbar.btnImgWrapping.setDisabled(disable.wrapping !== false); me.toolbar.lockToolbar(DE.enumLock.cantGroup, !canGroupUngroup, {array: [me.toolbar.btnImgGroup]});
me.toolbar.lockToolbar(DE.enumLock.cantWrap, disable.wrapping, {array: [me.toolbar.btnImgWrapping]});
me.toolbar.lockToolbar(DE.enumLock.cantArrange, disable.arrange, {array: [me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
}, },
onApiCoAuthoringDisconnect: function() { onApiCoAuthoringDisconnect: function() {
var me = this; var me = this;
me.editMode = false; me.editMode = false;
me.toolbar.btnImgAlign.setDisabled(true); // me.toolbar.btnImgAlign.setDisabled(true);
me.toolbar.btnImgGroup.setDisabled(true); // me.toolbar.btnImgGroup.setDisabled(true);
me.toolbar.btnImgForward.setDisabled(true); // me.toolbar.btnImgForward.setDisabled(true);
me.toolbar.btnImgBackward.setDisabled(true); // me.toolbar.btnImgBackward.setDisabled(true);
me.toolbar.btnImgWrapping.setDisabled(true); // me.toolbar.btnImgWrapping.setDisabled(true);
}, },
onBeforeShapeAlign: function() { onBeforeShapeAlign: function() {

View file

@ -151,12 +151,12 @@ define([
me.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { me.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) {
var value = item.value; var value = item.value;
Common.UI.Themes.setTheme(value); Common.UI.Themes.setTheme(value);
me.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme()); Common.Utils.lockControls(DE.enumLock.inLightTheme, !Common.UI.Themes.isDarkTheme(), {array: [me.view.btnDarkDocument]});
}, me)); }, me));
setTimeout(function () { setTimeout(function () {
me.onContentThemeChangedToDark(Common.UI.Themes.isContentThemeDark()); me.onContentThemeChangedToDark(Common.UI.Themes.isContentThemeDark());
me.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme()); Common.Utils.lockControls(DE.enumLock.inLightTheme, !Common.UI.Themes.isDarkTheme(), {array: [me.view.btnDarkDocument]});
}, 0); }, 0);
} }
}); });
@ -238,7 +238,7 @@ define([
menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme}); menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme});
this.view.btnInterfaceTheme.menu.clearAll(); this.view.btnInterfaceTheme.menu.clearAll();
menu_item.setChecked(true, true); menu_item.setChecked(true, true);
this.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme()); Common.Utils.lockControls(DE.enumLock.inLightTheme, !Common.UI.Themes.isDarkTheme(), {array: [this.view.btnDarkDocument]});
} }
}, },

View file

@ -142,6 +142,7 @@ define([
this.paragraphControls = []; this.paragraphControls = [];
var me = this; var me = this;
var _set = DE.enumLock;
if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms) { if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms) {
this.btnClear = new Common.UI.Button({ this.btnClear = new Common.UI.Button({
@ -153,8 +154,8 @@ define([
this.btnTextField = new Common.UI.Button({ this.btnTextField = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-text-field', iconCls: 'toolbar__icon btn-text-field',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnText, caption: this.capBtnText,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -164,8 +165,8 @@ define([
this.btnComboBox = new Common.UI.Button({ this.btnComboBox = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-combo-box', iconCls: 'toolbar__icon btn-combo-box',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnComboBox, caption: this.capBtnComboBox,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -175,8 +176,8 @@ define([
this.btnDropDown = new Common.UI.Button({ this.btnDropDown = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-dropdown', iconCls: 'toolbar__icon btn-dropdown',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnDropDown, caption: this.capBtnDropDown,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -186,8 +187,8 @@ define([
this.btnCheckBox = new Common.UI.Button({ this.btnCheckBox = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-checkbox', iconCls: 'toolbar__icon btn-checkbox',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnCheckBox, caption: this.capBtnCheckBox,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -197,8 +198,8 @@ define([
this.btnRadioBox = new Common.UI.Button({ this.btnRadioBox = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-radio-button', iconCls: 'toolbar__icon btn-radio-button',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnRadioBox, caption: this.capBtnRadioBox,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -208,8 +209,8 @@ define([
this.btnImageField = new Common.UI.Button({ this.btnImageField = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-insertimage', iconCls: 'toolbar__icon btn-insertimage',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnImage, caption: this.capBtnImage,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -219,9 +220,9 @@ define([
this.btnViewForm = new Common.UI.Button({ this.btnViewForm = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-sheet-view', iconCls: 'toolbar__icon btn-sheet-view',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.capBtnView, caption: this.capBtnView,
enableToggle: true, enableToggle: true,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -231,8 +232,8 @@ define([
this.btnClearFields = new Common.UI.Button({ this.btnClearFields = new Common.UI.Button({
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-clearstyle', iconCls : 'toolbar__icon btn-clearstyle',
lock: [_set.lostConnect, _set.disableOnStart],
caption : this.textClearFields, caption : this.textClearFields,
disabled: true,
dataHint : '1', dataHint : '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -242,9 +243,9 @@ define([
this.btnHighlight = new Common.UI.ButtonColored({ this.btnHighlight = new Common.UI.ButtonColored({
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-highlight', iconCls : 'toolbar__icon btn-highlight',
lock: [_set.lostConnect, _set.disableOnStart],
caption : this.textHighlight, caption : this.textHighlight,
menu : true, menu : true,
disabled: true,
additionalItems: [ this.mnuNoFormsColor = new Common.UI.MenuItem({ additionalItems: [ this.mnuNoFormsColor = new Common.UI.MenuItem({
id: 'id-toolbar-menu-no-highlight-form', id: 'id-toolbar-menu-no-highlight-form',
caption: this.textNoHighlight, caption: this.textNoHighlight,
@ -268,8 +269,9 @@ define([
this.btnPrevForm = new Common.UI.Button({ this.btnPrevForm = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon previous-field', iconCls: 'toolbar__icon previous-field',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.capBtnPrev, caption: this.capBtnPrev,
disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode // disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -279,8 +281,9 @@ define([
this.btnNextForm = new Common.UI.Button({ this.btnNextForm = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon next-field', iconCls: 'toolbar__icon next-field',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.capBtnNext, caption: this.capBtnNext,
disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode, // disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -291,8 +294,9 @@ define([
this.btnSubmit = new Common.UI.Button({ this.btnSubmit = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon submit-form', iconCls: 'toolbar__icon submit-form',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.capBtnSubmit, caption: this.capBtnSubmit,
disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode, // disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -302,16 +306,17 @@ define([
if (this.appConfig.canDownloadForms) { if (this.appConfig.canDownloadForms) {
this.btnSaveForm = new Common.UI.Button({ this.btnSaveForm = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
lock: [_set.lostConnect, _set.disableOnStart],
iconCls: 'toolbar__icon save-form', iconCls: 'toolbar__icon save-form',
caption: this.capBtnSaveForm, caption: this.capBtnSaveForm,
disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode, // disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
}); });
this.paragraphControls.push(this.btnSaveForm); this.paragraphControls.push(this.btnSaveForm);
} }
Common.Utils.lockControls(DE.enumLock.disableOnStart, true, {array: this.paragraphControls});
this._state = {disabled: false}; this._state = {disabled: false};
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
}, },

View file

@ -157,23 +157,29 @@ define([
this.btnsPrevEndNote = []; this.btnsPrevEndNote = [];
this.btnsNextEndNote = []; this.btnsNextEndNote = [];
this.paragraphControls = []; this.paragraphControls = [];
var _set = DE.enumLock;
var me = this, var me = this,
$host = me.toolbar.$el; $host = me.toolbar.$el;
this.btnsContents = Common.Utils.injectButtons($host.find('.btn-slot.btn-contents'), '', 'toolbar__icon btn-contents', me.capBtnInsContents, undefined, true, true, undefined, '1', 'bottom', 'small'); this.btnsContents = Common.Utils.injectButtons($host.find('.btn-slot.btn-contents'), '', 'toolbar__icon btn-contents', me.capBtnInsContents,
this.btnsNotes = Common.Utils.injectButtons($host.find('.btn-slot.slot-notes'), '', 'toolbar__icon btn-notes', me.capBtnInsFootnote, undefined, true, true, undefined, '1', 'bottom', 'small'); [_set.inHeader, _set.richEditLock, _set.plainEditLock, _set.richDelLock, _set.plainDelLock, _set.lostConnect, _set.disableOnStart],
this.btnsHyperlink = Common.Utils.injectButtons($host.find('.btn-slot.slot-inshyperlink'), '', 'toolbar__icon btn-inserthyperlink', me.capBtnInsLink, undefined, undefined, undefined, undefined, '1', 'bottom', 'small'); true, true, undefined, '1', 'bottom', 'small');
this.btnsNotes = Common.Utils.injectButtons($host.find('.btn-slot.slot-notes'), '', 'toolbar__icon btn-notes', me.capBtnInsFootnote,
[_set.paragraphLock, _set.inEquation, _set.inImage, _set.inHeader, _set.controlPlain, _set.richEditLock, _set.plainEditLock, _set.lostConnect, _set.disableOnStart],
true, true, undefined, '1', 'bottom', 'small');
this.btnsHyperlink = Common.Utils.injectButtons($host.find('.btn-slot.slot-inshyperlink'), '', 'toolbar__icon btn-inserthyperlink', me.capBtnInsLink,
[_set.paragraphLock, _set.headerLock, _set.hyperlinkLock, _set.lostConnect, _set.disableOnStart],
undefined, undefined, undefined, '1', 'bottom', 'small');
Array.prototype.push.apply(this.paragraphControls, this.btnsContents.concat(this.btnsNotes, this.btnsHyperlink)); Array.prototype.push.apply(this.paragraphControls, this.btnsContents.concat(this.btnsNotes, this.btnsHyperlink));
this.btnContentsUpdate = new Common.UI.Button({ this.btnContentsUpdate = new Common.UI.Button({
parentEl: $host.find('#slot-btn-contents-update'), parentEl: $host.find('#slot-btn-contents-update'),
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-update', iconCls: 'toolbar__icon btn-update',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.capBtnContentsUpdate, caption: this.capBtnContentsUpdate,
split: true, split: true,
menu: true, menu: true,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -184,8 +190,8 @@ define([
parentEl: $host.find('#slot-btn-bookmarks'), parentEl: $host.find('#slot-btn-bookmarks'),
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-bookmarks', iconCls: 'toolbar__icon btn-bookmarks',
lock: [_set.paragraphLock, _set.inHeader, _set.headerLock, _set.controlPlain, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnBookmarks, caption: this.capBtnBookmarks,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -196,8 +202,8 @@ define([
parentEl: $host.find('#slot-btn-caption'), parentEl: $host.find('#slot-btn-caption'),
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-caption', iconCls: 'toolbar__icon btn-caption',
lock: [_set.inHeader, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnCaption, caption: this.capBtnCaption,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -208,8 +214,8 @@ define([
parentEl: $host.find('#slot-btn-crossref'), parentEl: $host.find('#slot-btn-crossref'),
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-cross-reference', iconCls: 'toolbar__icon btn-cross-reference',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.richEditLock, _set.plainEditLock, _set.contentLock, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnCrossRef, caption: this.capBtnCrossRef,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -220,8 +226,8 @@ define([
parentEl: $host.find('#slot-btn-tof'), parentEl: $host.find('#slot-btn-tof'),
cls: 'btn-toolbar', cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-contents', iconCls: 'toolbar__icon btn-contents',
lock: [_set.inHeader, _set.richEditLock, _set.plainEditLock, _set.richDelLock, _set.plainDelLock, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnTOF, caption: this.capBtnTOF,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'medium' dataHintOffset: 'medium'
@ -232,14 +238,14 @@ define([
parentEl: $host.find('#slot-btn-tof-update'), parentEl: $host.find('#slot-btn-tof-update'),
cls: 'btn-toolbar', cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-update', iconCls: 'toolbar__icon btn-update',
lock: [_set.paragraphLock, _set.inHeader, _set.richEditLock, _set.plainEditLock, _set.richDelLock, _set.plainDelLock, _set.cantUpdateTOF, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnContentsUpdate, caption: this.capBtnContentsUpdate,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'medium' dataHintOffset: 'medium'
}); });
this.paragraphControls.push(this.btnTableFiguresUpdate); this.paragraphControls.push(this.btnTableFiguresUpdate);
Common.Utils.lockControls(DE.enumLock.disableOnStart, true, {array: this.paragraphControls});
this._state = {disabled: false}; this._state = {disabled: false};
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
}, },

View file

@ -80,6 +80,7 @@ define([
dropcapLock: 'dropcap-lock', dropcapLock: 'dropcap-lock',
docPropsLock: 'doc-props-lock', docPropsLock: 'doc-props-lock',
docSchemaLock: 'doc-schema-lock', docSchemaLock: 'doc-schema-lock',
hyperlinkLock: 'can-hyperlink',
inSmartart: 'in-smartart', inSmartart: 'in-smartart',
inSmartartInternal: 'in-smartart-internal', inSmartartInternal: 'in-smartart-internal',
inSpecificForm: 'in-specific-form', inSpecificForm: 'in-specific-form',
@ -88,8 +89,10 @@ define([
inHeader: 'in-header', inHeader: 'in-header',
inImage: 'in-image', inImage: 'in-image',
inImagePara: 'in-image-para', inImagePara: 'in-image-para',
inImageInline: 'in-image-inline',
inFootnote: 'in-footnote', inFootnote: 'in-footnote',
inControl: 'in-control', inControl: 'in-control',
inLightTheme: 'light-theme',
controlPlain: 'control-plain', controlPlain: 'control-plain',
noParagraphSelected: 'no-paragraph', noParagraphSelected: 'no-paragraph',
cantAddTable: 'cant-add-table', cantAddTable: 'cant-add-table',
@ -100,6 +103,11 @@ define([
cantAddChart: 'cant-add-chart', cantAddChart: 'cant-add-chart',
cantAddPageNum: 'cant-add-page-num', cantAddPageNum: 'cant-add-page-num',
cantPageBreak: 'cant-page-break', cantPageBreak: 'cant-page-break',
cantUpdateTOF: 'cant-update-tof',
cantGroup: 'cant-group',
cantWrap: 'cant-wrap',
cantArrange: 'cant-arrange',
noObjectSelected: 'no-object',
lostConnect: 'disconnect', lostConnect: 'disconnect',
disableOnStart: 'on-start' disableOnStart: 'on-start'
}; };
@ -1281,7 +1289,7 @@ define([
me.btnImgAlign = new Common.UI.Button({ me.btnImgAlign = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-align', iconCls: 'toolbar__icon btn-img-align',
lock: [_set.lostConnect, _set.disableOnStart], lock: [_set.imageLock, _set.contentLock, _set.inImageInline, _set.noObjectSelected, _set.lostConnect, _set.disableOnStart],
caption: me.capImgAlign, caption: me.capImgAlign,
menu: true, menu: true,
dataHint: '1', dataHint: '1',
@ -1292,7 +1300,7 @@ define([
me.btnImgGroup = new Common.UI.Button({ me.btnImgGroup = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-group', iconCls: 'toolbar__icon btn-img-group',
lock: [_set.lostConnect, _set.disableOnStart], lock: [_set.imageLock, _set.contentLock, _set.inImageInline, _set.noObjectSelected, _set.cantGroup, _set.lostConnect, _set.disableOnStart],
caption: me.capImgGroup, caption: me.capImgGroup,
menu: true, menu: true,
dataHint: '1', dataHint: '1',
@ -1302,7 +1310,7 @@ define([
me.btnImgForward = new Common.UI.Button({ me.btnImgForward = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-frwd', iconCls: 'toolbar__icon btn-img-frwd',
lock: [_set.lostConnect, _set.disableOnStart], lock: [_set.cantArrange, _set.lostConnect, _set.contentLock, _set.noObjectSelected, _set.inSmartartInternal, _set.disableOnStart],
caption: me.capImgForward, caption: me.capImgForward,
split: true, split: true,
menu: true, menu: true,
@ -1313,7 +1321,7 @@ define([
me.btnImgBackward = new Common.UI.Button({ me.btnImgBackward = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-bkwd', iconCls: 'toolbar__icon btn-img-bkwd',
lock: [_set.lostConnect, _set.disableOnStart], lock: [_set.cantArrange, _set.lostConnect, _set.contentLock, _set.noObjectSelected, _set.inSmartartInternal, _set.disableOnStart],
caption: me.capImgBackward, caption: me.capImgBackward,
split: true, split: true,
menu: true, menu: true,
@ -1324,7 +1332,7 @@ define([
me.btnImgWrapping = new Common.UI.Button({ me.btnImgWrapping = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-wrap', iconCls: 'toolbar__icon btn-img-wrap',
lock: [_set.lostConnect, _set.disableOnStart], lock: [_set.cantWrap, _set.imageLock, _set.contentLock, _set.noObjectSelected, _set.lostConnect, _set.disableOnStart],
caption: me.capImgWrapping, caption: me.capImgWrapping,
menu: true, menu: true,
dataHint: '1', dataHint: '1',

View file

@ -85,14 +85,15 @@ define([
var me = this, var me = this,
$host = me.toolbar.$el; $host = me.toolbar.$el;
var _set = DE.enumLock;
this.btnNavigation = new Common.UI.Button({ this.btnNavigation = new Common.UI.Button({
parentEl: $host.find('#slot-btn-navigation'), parentEl: $host.find('#slot-btn-navigation'),
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-menu-navigation', iconCls: 'toolbar__icon btn-menu-navigation',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.textNavigation, caption: this.textNavigation,
enableToggle: true, enableToggle: true,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -102,9 +103,9 @@ define([
this.cmbZoom = new Common.UI.ComboBox({ this.cmbZoom = new Common.UI.ComboBox({
el: $host.find('#slot-field-zoom'), el: $host.find('#slot-field-zoom'),
cls: 'input-group-nr', cls: 'input-group-nr',
lock: [_set.lostConnect, _set.disableOnStart],
menuStyle: 'min-width: 55px;', menuStyle: 'min-width: 55px;',
editable: true, editable: true,
disabled: true,
data: [ data: [
{ displayValue: "50%", value: 50 }, { displayValue: "50%", value: 50 },
{ displayValue: "75%", value: 75 }, { displayValue: "75%", value: 75 },
@ -130,10 +131,10 @@ define([
parentEl: $host.find('#slot-btn-ftp'), parentEl: $host.find('#slot-btn-ftp'),
cls: 'btn-toolbar', cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-ic-zoomtopage', iconCls: 'toolbar__icon btn-ic-zoomtopage',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.textFitToPage, caption: this.textFitToPage,
toggleGroup: 'view-zoom', toggleGroup: 'view-zoom',
enableToggle: true, enableToggle: true,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'medium' dataHintOffset: 'medium'
@ -144,10 +145,10 @@ define([
parentEl: $host.find('#slot-btn-ftw'), parentEl: $host.find('#slot-btn-ftw'),
cls: 'btn-toolbar', cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-ic-zoomtowidth', iconCls: 'toolbar__icon btn-ic-zoomtowidth',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.textFitToWidth, caption: this.textFitToWidth,
toggleGroup: 'view-zoom', toggleGroup: 'view-zoom',
enableToggle: true, enableToggle: true,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'medium' dataHintOffset: 'medium'
@ -158,9 +159,9 @@ define([
parentEl: $host.find('#slot-btn-interface-theme'), parentEl: $host.find('#slot-btn-interface-theme'),
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon day', iconCls: 'toolbar__icon day',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.textInterfaceTheme, caption: this.textInterfaceTheme,
menu: true, menu: true,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -171,9 +172,9 @@ define([
parentEl: $host.find('#slot-btn-dark-document'), parentEl: $host.find('#slot-btn-dark-document'),
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon dark-mode', iconCls: 'toolbar__icon dark-mode',
lock: [_set.inLightTheme, _set.lostConnect, _set.disableOnStart],
caption: this.textDarkDocument, caption: this.textDarkDocument,
enableToggle: true, enableToggle: true,
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -182,9 +183,9 @@ define([
this.chStatusbar = new Common.UI.CheckBox({ this.chStatusbar = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-statusbar'), el: $host.findById('#slot-chk-statusbar'),
lock: [_set.lostConnect, _set.disableOnStart],
labelText: this.textStatusBar, labelText: this.textStatusBar,
value: !Common.localStorage.getBool("de-hidden-status"), value: !Common.localStorage.getBool("de-hidden-status"),
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -193,9 +194,9 @@ define([
this.chToolbar = new Common.UI.CheckBox({ this.chToolbar = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-toolbar'), el: $host.findById('#slot-chk-toolbar'),
lock: [_set.lostConnect, _set.disableOnStart],
labelText: this.textAlwaysShowToolbar, labelText: this.textAlwaysShowToolbar,
value: !options.compactToolbar, value: !options.compactToolbar,
disabled: true,
dataHint : '1', dataHint : '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -204,14 +205,15 @@ define([
this.chRulers = new Common.UI.CheckBox({ this.chRulers = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-rulers'), el: $host.findById('#slot-chk-rulers'),
lock: [_set.lostConnect, _set.disableOnStart],
labelText: this.textRulers, labelText: this.textRulers,
value: !Common.Utils.InternalSettings.get("de-hidden-rulers"), value: !Common.Utils.InternalSettings.get("de-hidden-rulers"),
disabled: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'small' dataHintOffset: 'small'
}); });
this.lockedControls.push(this.chRulers); this.lockedControls.push(this.chRulers);
Common.Utils.lockControls(_set.disableOnStart, true, {array: this.lockedControls});
}, },
render: function (el) { render: function (el) {