diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 664a25181..82fad3fa6 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -783,10 +783,10 @@ define([ toolbar.btnContentControls.setDisabled(paragraph_locked || header_locked); if (!(paragraph_locked || header_locked)) { var control_disable = control_plain || content_locked; - for (var i=0; i<7; i++) + for (var i=0; i<14; i++) toolbar.btnContentControls.menu.items[i].setDisabled(control_disable); - toolbar.btnContentControls.menu.items[8].setDisabled(!in_control || lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked); - toolbar.btnContentControls.menu.items[10].setDisabled(!in_control); + toolbar.btnContentControls.menu.items[15].setDisabled(!in_control || lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked); + toolbar.btnContentControls.menu.items[17].setDisabled(!in_control); } var need_text_disable = paragraph_locked || header_locked || in_chart || rich_edit_lock || plain_edit_lock; @@ -1826,16 +1826,26 @@ define([ } } } else { + var isnew = (item.value.indexOf('new-')==0), + oPr, oFormPr; + if (isnew) { + oFormPr = new AscCommon.CSdtFormPr(); + oPr = new AscCommon.CSdtTextFormPr(); + } if (item.value == 'plain' || item.value == 'rich') this.api.asc_AddContentControl((item.value=='plain') ? Asc.c_oAscSdtLevelType.Inline : Asc.c_oAscSdtLevelType.Block); - else if (item.value == 'picture') - this.api.asc_AddContentControlPicture(); - else if (item.value == 'checkbox') - this.api.asc_AddContentControlCheckBox(); - else if (item.value == 'date') + else if (item.value.indexOf('picture')>=0) + this.api.asc_AddContentControlPicture(oFormPr); + else if (item.value.indexOf('checkbox')>=0) + this.api.asc_AddContentControlCheckBox(oPr, oFormPr); + else if (item.value.indexOf('radiobox')>=0) { + this.api.asc_AddContentControlCheckBox(oPr, oFormPr); + } else if (item.value == 'date') this.api.asc_AddContentControlDatePicker(); - else if (item.value == 'combobox' || item.value == 'dropdown') - this.api.asc_AddContentControlList(item.value == 'combobox'); + else if (item.value.indexOf('combobox')>=0 || item.value.indexOf('dropdown')>=0) + this.api.asc_AddContentControlList(item.value.indexOf('combobox')>=0, oPr, oFormPr); + else if (item.value == 'new-field') + this.api.asc_AddContentControlTextForm(oPr, oFormPr); Common.component.Analytics.trackEvent('ToolBar', 'Add Content Control'); } diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 029e27b84..b740bd2d8 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -643,6 +643,31 @@ define([ value: 'checkbox' }, {caption: '--'}, + { + caption: this.textNewFieldControl, + value: 'new-field' + }, + { + caption: this.textNewPictureControl, + value: 'new-picture' + }, + { + caption: this.textNewComboboxControl, + value: 'new-combobox' + }, + { + caption: this.textNewDropdownControl, + value: 'new-dropdown' + }, + { + caption: this.textNewCheckboxControl, + value: 'new-checkbox' + }, + { + caption: this.textNewRadioboxControl, + value: 'new-radiobox' + }, + {caption: '--'}, { caption: this.textRemoveControl, // iconCls: 'menu__icon cc-remove', @@ -1957,7 +1982,7 @@ define([ this.btnMailRecepients.setVisible(mode.canCoAuthoring == true && mode.canUseMailMerge); this.listStylesAdditionalMenuItem.setVisible(mode.canEditStyles); - this.btnContentControls.menu.items[10].setVisible(mode.canEditContentControl); + this.btnContentControls.menu.items[17].setVisible(mode.canEditContentControl); this.mnuInsertImage.items[2].setVisible(this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1); }, @@ -2321,7 +2346,13 @@ define([ mniEraseTable: 'Erase Table', textListSettings: 'List Settings', capBtnDateTime: 'Date & Time', - tipDateTime: 'Insert current date and time' + tipDateTime: 'Insert current date and time', + textNewFieldControl: 'New text field', + textNewPictureControl: 'New picture', + textNewComboboxControl: 'New combo box', + textNewCheckboxControl: 'New check box', + textNewRadioboxControl: 'New radio box', + textNewDropdownControl: 'New drop-down list' } })(), DE.Views.Toolbar || {})); });