Merge pull request #2159 from ONLYOFFICE/feature/de-forms

Feature/de forms
This commit is contained in:
Julia Radzhabova 2022-12-22 18:05:32 +03:00 committed by GitHub
commit a7d90a47da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 1871 additions and 203 deletions

View file

@ -202,6 +202,13 @@
text-overflow: ellipsis;
}
}
.separator {
height: 22px;
margin: 0 9px;
border-left: 1px solid @border-divider-ie;
border-left: 1px solid @border-divider;
}
}
.margin-right-small {

View file

@ -311,7 +311,10 @@ define([
var $list = this.cmpEl.find('ul');
if ($list.hasClass('menu-absolute')) {
var offset = this.cmpEl.offset();
$list.css({left: offset.left, top: offset.top + this.cmpEl.outerHeight() + 2});
var left = offset.left;
if (left + $list.outerWidth()>Common.Utils.innerWidth())
left += (this.cmpEl.outerWidth() - $list.outerWidth());
$list.css({left: left, top: offset.top + this.cmpEl.outerHeight() + 2});
} else if ($list.hasClass('menu-aligned')) {
var offset = this.cmpEl.offset();
$list.toggleClass('show-top', offset.top + this.cmpEl.outerHeight() + $list.outerHeight() > Common.Utils.innerHeight());

View file

@ -716,6 +716,14 @@ define([
}
},
getChecked: function() {
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
if (item.isChecked && item.isChecked())
return item;
}
},
clearAll: function() {
_.each(this.items, function(item){
if (item.setChecked)

View file

@ -603,6 +603,9 @@ define([
me.view.btnPrev.setVisible(false);
me.view.btnNext.setVisible(false);
me.view.btnClear.setVisible(false);
me.view.btnUndo.setVisible(false);
me.view.btnRedo.setVisible(false);
me.view.btnRedo.$el.next().hide();
} else {
me.view.btnPrev.on('click', function(){
me.api.asc_MoveToFillingForm(false);
@ -626,6 +629,12 @@ define([
}
}
});
me.view.btnUndo.on('click', function(){
me.api.Undo(false);
});
me.view.btnRedo.on('click', function(){
me.api.Redo(false);
});
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms);
this.api.asc_SetFastCollaborative(true);
@ -1363,6 +1372,8 @@ define([
if (this.appOptions.canFillForms) {
this.api.asc_registerCallback('asc_onShowContentControlsActions', _.bind(this.onShowContentControlsActions, this));
this.api.asc_registerCallback('asc_onHideContentControlsActions', _.bind(this.onHideContentControlsActions, this));
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_SetHighlightRequiredFields(true);
Common.Gateway.on('insertimage', _.bind(this.insertImage, this));
Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); // try to load image from storage
@ -1800,9 +1811,10 @@ define([
this.textMenu.items[0].setDisabled(disabled || !this.api.asc_getCanUndo()); // undo
this.textMenu.items[1].setDisabled(disabled || !this.api.asc_getCanRedo()); // redo
this.textMenu.items[3].setDisabled(disabled || !cancopy); // cut
this.textMenu.items[4].setDisabled(!cancopy); // copy
this.textMenu.items[5].setDisabled(disabled) // paste;
this.textMenu.items[3].setDisabled(disabled); // clear
this.textMenu.items[5].setDisabled(disabled || !cancopy); // cut
this.textMenu.items[6].setDisabled(!cancopy); // copy
this.textMenu.items[7].setDisabled(disabled) // paste;
this.showPopupMenu(this.textMenu, {}, event);
}
@ -1832,6 +1844,14 @@ define([
}
}
break;
case 'clear':
if (this.api) {
var props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null;
if (props) {
this.api.asc_ClearContentControl(props.get_InternalId());
}
}
break;
}
},
@ -1839,6 +1859,8 @@ define([
this._state.isDisconnected = true;
this._isDisabled = true;
this.view && this.view.btnClear && this.view.btnClear.setDisabled(true);
this.view && this.view.btnUndo && this.view.btnUndo.setDisabled(true);
this.view && this.view.btnRedo && this.view.btnRedo.setDisabled(true);
if (!enableDownload) {
this.appOptions.canPrint = this.appOptions.canDownload = false;
this.view && this.view.btnDownload.setDisabled(true);
@ -1852,6 +1874,12 @@ define([
}
},
onApiCanRevert: function(which, can) {
if (!this.view) return;
(which=='undo') ? this.view.btnUndo.setDisabled(!can) : this.view.btnRedo.setDisabled(!can);
},
errorDefaultMessage : 'Error code: %1',
unknownErrorText : 'Unknown error.',
convertationTimeoutText : 'Conversion timeout exceeded.',

View file

@ -89,6 +89,20 @@ define([
});
this.btnPrev.render($('#id-btn-prev-field'));
this.btnUndo = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'svg-icon undo',
hint: this.tipUndo + Common.Utils.String.platformKey('Ctrl+Z')
});
this.btnUndo.render($('#id-btn-undo'));
this.btnRedo = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'svg-icon redo',
hint: this.tipRedo + Common.Utils.String.platformKey('Ctrl+Y')
});
this.btnRedo.render($('#id-btn-redo'));
this.btnSubmit = new Common.UI.Button({
cls: 'btn-text-default colored margin-left-small margin-right-small',
caption: this.textSubmit
@ -121,6 +135,8 @@ define([
{ caption: this.textUndo, value: 'undo', iconCls: 'mi-icon svg-icon undo' },
{ caption: this.textRedo, value: 'redo', iconCls: 'mi-icon svg-icon redo' },
{ caption: '--' },
{ caption: this.textClearField, value: 'clear', iconCls: 'mi-icon svg-icon clear-style' },
{ caption: '--' },
{ caption: this.textCut, value: 'cut', iconCls: 'mi-icon svg-icon cut' },
{ caption: this.textCopy, value: 'copy', iconCls: 'mi-icon svg-icon copy' },
{ caption: this.textPaste, value: 'paste', iconCls: 'mi-icon svg-icon paste' }
@ -150,7 +166,10 @@ define([
textZoom: 'Zoom',
textFitToPage: 'Fit to Page',
textFitToWidth: 'Fit to Width',
txtSearch: 'Search'
txtSearch: 'Search',
tipUndo: 'Undo',
tipRedo: 'Redo',
textClearField: 'Clear field'
}, DE.Views.ApplicationView || {}));
});

View file

@ -259,7 +259,10 @@
<div class="toolbar" id="toolbar">
<div class="group left">
<div class="margin-right-large"><a id="header-logo" class="brand-logo" href="http://www.onlyoffice.com/" target="_blank"></a></div>
<span id="id-btn-prev-field" class="margin-right-small"></span>
<span id="id-btn-undo" class="margin-right-small"></span>
<span id="id-btn-redo" class="margin-right-small"></span>
<div class="separator"></div>
<span id="id-btn-prev-field" class="margin-left-small margin-right-small"></span>
<span id="id-btn-next-field" class="margin-right-large"></span>
<span id="id-btn-clear-fields"></span>
</div>

View file

@ -241,7 +241,10 @@
<div class="toolbar" id="toolbar">
<div class="group left">
<div class="margin-right-large"><a id="header-logo" class="brand-logo" href="http://www.onlyoffice.com/" target="_blank"></a></div>
<span id="id-btn-prev-field" class="margin-right-small"></span>
<span id="id-btn-undo" class="margin-right-small"></span>
<span id="id-btn-redo" class="margin-right-small"></span>
<div class="separator"></div>
<span id="id-btn-prev-field" class="margin-left-small margin-right-small"></span>
<span id="id-btn-next-field" class="margin-right-large"></span>
<span id="id-btn-clear-fields"></span>
</div>

View file

@ -180,5 +180,8 @@
"DE.Views.ApplicationView.txtPrint": "Print",
"DE.Views.ApplicationView.txtSearch": "Search",
"DE.Views.ApplicationView.txtShare": "Share",
"DE.Views.ApplicationView.txtTheme": "Interface theme"
"DE.Views.ApplicationView.txtTheme": "Interface theme",
"DE.Views.ApplicationView.tipUndo": "Undo",
"DE.Views.ApplicationView.tipRedo": "Redo",
"DE.Views.ApplicationView.textClearField": "Clear field"
}

View file

@ -41,7 +41,9 @@
define([
'core',
'documenteditor/main/app/view/FormsTab'
'documenteditor/main/app/view/FormsTab',
'documenteditor/main/app/view/RolesManagerDlg',
'documenteditor/main/app/view/SaveFormDlg'
], function () {
'use strict';
@ -57,7 +59,10 @@ define([
initialize: function () {
},
onLaunch: function () {
this._state = {};
this._state = {
lastViewRole: undefined, // last selected role in the preview mode
lastRoleInList: undefined // last role in the roles list
};
},
setApi: function (api) {
@ -66,12 +71,13 @@ define([
this.api.asc_registerCallback('asc_onFocusObject', this.onApiFocusObject.bind(this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onChangeSpecialFormsGlobalSettings', _.bind(this.onChangeSpecialFormsGlobalSettings, 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_onDownloadUrl', _.bind(this.onDownloadUrl, this));
this.api.asc_registerCallback('asc_onUpdateOFormRoles', _.bind(this.onRefreshRolesList, this));
// this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this));
// this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this));
@ -91,12 +97,13 @@ define([
'FormsTab': {
'forms:insert': this.onControlsSelect,
'forms:clear': this.onClearClick,
'forms:no-color': this.onNoControlsColor,
'forms:select-color': this.onSelectControlsColor,
// 'forms:no-color': this.onNoControlsColor,
// 'forms:select-color': this.onSelectControlsColor,
'forms:mode': this.onModeClick,
'forms:goto': this.onGoTo,
'forms:submit': this.onSubmitClick,
'forms:save': this.onSaveFormClick
'forms:save': this.onSaveFormClick,
'forms:manager': this.onManagerClick
},
'Toolbar': {
'tab:active': this.onActiveTab
@ -149,7 +156,8 @@ 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.btnEmailField, this.view.btnPhoneField, this.view.btnComplexField ];
this.view.btnRadioBox, this.view.btnImageField, this.view.btnEmailField, this.view.btnPhoneField, this.view.btnComplexField,
this.view.btnCreditCard, this.view.btnZipCode, this.view.btnDateTime];
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});
@ -162,26 +170,27 @@ define([
Common.Utils.lockControls(Common.enumLock.inSmartartInternal, in_smart_art_internal, {array: arr});
},
onChangeSpecialFormsGlobalSettings: function() {
if (this.view && this.view.mnuFormsColorPicker) {
var clr = this.api.asc_GetSpecialFormsHighlightColor(),
show = !!clr;
this.view.mnuNoFormsColor.setChecked(!show, true);
this.view.mnuFormsColorPicker.clearSelection();
if (clr) {
clr = Common.Utils.ThemeColor.getHexColor(clr.get_r(), clr.get_g(), clr.get_b());
this.view.mnuFormsColorPicker.selectByRGB(clr, true);
}
this.view.btnHighlight.currentColor = clr;
this.view.btnHighlight.setColor(this.view.btnHighlight.currentColor || 'transparent');
}
},
// onChangeSpecialFormsGlobalSettings: function() {
// if (this.view && this.view.mnuFormsColorPicker) {
// var clr = this.api.asc_GetSpecialFormsHighlightColor(),
// show = !!clr;
// this.view.mnuNoFormsColor.setChecked(!show, true);
// this.view.mnuFormsColorPicker.clearSelection();
// if (clr) {
// clr = Common.Utils.ThemeColor.getHexColor(clr.get_r(), clr.get_g(), clr.get_b());
// this.view.mnuFormsColorPicker.selectByRGB(clr, true);
// }
// this.view.btnHighlight.currentColor = clr;
// this.view.btnHighlight.setColor(this.view.btnHighlight.currentColor || 'transparent');
// }
// },
onControlsSelect: function(type, options) {
if (!(this.toolbar.mode && this.toolbar.mode.canFeatureContentControl && this.toolbar.mode.canFeatureForms)) return;
var oPr,
oFormPr = new AscCommon.CSdtFormPr();
oFormPr.put_Role(Common.Utils.InternalSettings.get('de-last-form-role') || this._state.lastRoleInList);
this.toolbar.toolbar.fireEvent('insertcontrol', this.toolbar.toolbar);
if (type == 'picture')
this.api.asc_AddContentControlPicture(oFormPr);
@ -191,6 +200,8 @@ define([
this.api.asc_AddContentControlCheckBox(oPr, oFormPr);
} else if (type == 'combobox' || type == 'dropdown')
this.api.asc_AddContentControlList(type == 'combobox', oPr, oFormPr);
else if (type == 'datetime')
this.api.asc_AddContentControlDatePicker(); // !!!! change for datetime form
else if (type == 'text') {
var props = new AscCommon.CContentControlPr();
oPr = new AscCommon.CSdtTextFormPr();
@ -201,6 +212,8 @@ define([
oPr.put_MaskFormat(options.mask);
if (options.placeholder)
props.put_PlaceholderText(options.placeholder);
if (options.fixed!==undefined)
oFormPr.put_Fixed && oFormPr.put_Fixed(options.fixed);
}
props.put_TextFormPr(oPr);
props.put_FormPr(oFormPr);
@ -216,19 +229,23 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onModeClick: function(state) {
onModeClick: function(state, lastViewRole) {
if (this.api) {
this.disableEditing(state);
this.api.asc_setRestriction(state ? Asc.c_oAscRestrictionType.OnlyForms : Asc.c_oAscRestrictionType.None);
this.view && this.view.setPreviewMode(state); // send role name - lastViewRole
var role = new AscCommon.CRestrictionSettings();
role.put_OFormRole(lastViewRole);
this.api.asc_setRestriction(state ? Asc.c_oAscRestrictionType.OnlyForms : Asc.c_oAscRestrictionType.None, role);
this.api.asc_SetPerformContentControlActionByClick(state);
this.api.asc_SetHighlightRequiredFields(state);
state && (this._state.lastViewRole = lastViewRole);
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
changeViewFormMode: function(state) {
if (this.view && (state !== this.view.btnViewForm.isActive())) {
this.view.btnViewForm.toggle(state, true);
if (this.view && (state !== this.view.btnViewFormRoles.isActive())) {
this.view.btnViewFormRoles.toggle(state, true);
this.onModeClick(state);
}
},
@ -240,21 +257,21 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onNoControlsColor: function(item) {
if (!item.isChecked())
this.api.asc_SetSpecialFormsHighlightColor(201, 200, 255);
else
this.api.asc_SetSpecialFormsHighlightColor();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
// onNoControlsColor: function(item) {
// if (!item.isChecked())
// this.api.asc_SetSpecialFormsHighlightColor(201, 200, 255);
// else
// this.api.asc_SetSpecialFormsHighlightColor();
// Common.NotificationCenter.trigger('edit:complete', this.toolbar);
// },
onSelectControlsColor: function(color) {
var clr = Common.Utils.ThemeColor.getRgbColor(color);
if (this.api) {
this.api.asc_SetSpecialFormsHighlightColor(clr.get_r(), clr.get_g(), clr.get_b());
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
// onSelectControlsColor: function(color) {
// var clr = Common.Utils.ThemeColor.getRgbColor(color);
// if (this.api) {
// this.api.asc_SetSpecialFormsHighlightColor(clr.get_r(), clr.get_g(), clr.get_b());
// }
// Common.NotificationCenter.trigger('edit:complete', this.toolbar);
// },
onGoTo: function(type) {
if (this.api)
@ -280,8 +297,10 @@ define([
},
onSaveFormClick: function() {
this.showRolesList(function() {
this.isFromFormSaveAs = this.appConfig.canRequestSaveAs || !!this.appConfig.saveAsUrl;
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.OFORM, this.isFromFormSaveAs));
});
},
onDownloadUrl: function(url, fileType) {
@ -388,12 +407,13 @@ define([
(new Promise(function (accept, reject) {
accept();
})).then(function(){
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;
}
// 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;
// }
config.isEdit && config.canFeatureContentControl && config.isFormCreator && me.showCreateFormTip(); // show tip only when create form in docxf
me.onRefreshRolesList();
me.onChangeProtectDocument();
});
},
@ -444,6 +464,42 @@ define([
}
},
onRefreshRolesList: function(roles) {
if (!roles) {
var oform = this.api.asc_GetOForm();
oform && (roles = oform.asc_getAllRoles());
}
this._state.lastRoleInList = (roles && roles.length>0) ? roles[roles.length-1].asc_getSettings().asc_getName() : undefined;
this.view && this.view.fillRolesMenu(roles, this._state.lastViewRole);
},
onManagerClick: function() {
var me = this;
this.api.asc_GetOForm() && (new DE.Views.RolesManagerDlg({
api: me.api,
handler: function(result, settings) {
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
},
props : undefined
})).on('close', function(win){
}).show();
},
showRolesList: function(callback) {
var me = this,
oform = this.api.asc_GetOForm();
oform && (new DE.Views.SaveFormDlg({
handler: function(result, settings) {
if (result=='ok')
callback.call(me);
else
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
},
roles: oform.asc_getAllRoles()
})).show();
},
onActiveTab: function(tab) {
if (tab !== 'forms') {
this.tipSaveForm && this.tipSaveForm.close();

View file

@ -220,7 +220,8 @@ define([
if (control_props && control_props.get_FormPr() && this.rightmenu.formSettings) {
var spectype = control_props.get_SpecificType();
if (spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture || spectype==Asc.c_oAscContentControlSpecificType.Complex ||
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.None) {
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.None ||
spectype==Asc.c_oAscContentControlSpecificType.DateTime) {
settingsType = Common.Utils.documentSettingsType.Form;
this._settings[settingsType].props = control_props;
this._settings[settingsType].locked = control_lock || isProtected;

View file

@ -4,6 +4,17 @@
<label class="header padding-small" id="form-settings-name"><%= scope.textField %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textFillRoles %></label>
<div id="form-combo-roles" style="width: 100%;"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr class="form-keyfield">
<td class="padding-small">
<label class="input-label"><%= scope.textKey %></label>
@ -48,7 +59,12 @@
</tr>
<tr class="form-textfield-mask">
<td class="padding-small">
<div id="form-txt-mask"></div>
<div id="form-txt-mask" style="width: 100%;"></div>
</td>
</tr>
<tr class="form-textfield-regexp">
<td class="padding-small">
<div id="form-txt-regexp"></div>
</td>
</tr>
<tr class="form-textfield">
@ -83,6 +99,20 @@
</td>
</tr>
</table>
<table cols="1">
<tr class="form-datetime">
<td class="padding-small">
<label class="input-label"><%= scope.textDateFormat %></label>
<div id="form-cmb-date-format" style="width: 100%;"></div>
</td>
</tr>
<tr class="form-datetime">
<td class="padding-small">
<label class="input-label"><%= scope.textLang %></label>
<div id="form-cmb-date-lang" style="width: 100%;"></div>
</td>
</tr>
</table>
<table cols="1">
<tr class="form-fixed">
<td class="padding-small">

View file

@ -0,0 +1,27 @@
<div class="settings-panel active">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small">
<label><%= scope.textDescription %></label>
</td>
<td class="padding-small" style="width: 60px;">
<div id="roles-manager-btn-down" style="display: inline-block;float: right;margin-left: 5px;"></div>
<div id="roles-manager-btn-up" style="display: inline-block;float: right;"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<div id="roles-manager-roles-list" class="roles-tableview no-borders" style="width:100%; height: 170px;"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-large">
<button type="button" class="btn btn-text-default" id="roles-manager-btn-new" style="min-width: 100px;margin-right:5px;"><%= scope.textNew %></button>
<button type="button" class="btn btn-text-default" id="roles-manager-btn-edit" style="min-width: 100px;"><%= scope.textEdit %></button>
<button type="button" class="btn btn-text-default" id="roles-manager-btn-delete" style="min-width: 100px; float: right;"><%= scope.textDelete %></button>
</td>
</tr>
</table>
</div>
</div>

View file

@ -98,6 +98,7 @@ 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.TextOnlySettingsRegExp = el.find('.form-textfield-regexp');
this.PlaceholderSettings = el.find('.form-placeholder');
this.KeySettings = el.find('.form-keyfield');
this.KeySettingsTd = this.KeySettings.find('td');
@ -108,6 +109,7 @@ define([
this.ConnectedSettings = el.find('.form-connected');
this.FixedSettings = el.find('.form-fixed');
this.NotInComplexSettings = el.find('.form-not-in-complex');
this.DateOnlySettings = el.find('.form-datetime');
},
createDelayedElements: function() {
@ -125,7 +127,8 @@ define([
this.cmbKey = new Common.UI.ComboBox({
el: $markup.findById('#form-combo-key'),
cls: 'input-group-nr',
menuStyle: 'min-width: 100%;',
menuCls: 'menu-absolute',
menuStyle: 'min-width: 195px; max-height: 190px;',
editable: true,
data: [],
dataHint: '1',
@ -295,7 +298,8 @@ define([
this.cmbGroupKey = new Common.UI.ComboBox({
el: $markup.findById('#form-combo-group-key'),
cls: 'input-group-nr',
menuStyle: 'min-width: 100%;',
menuCls: 'menu-absolute',
menuStyle: 'min-width: 195px; max-height: 190px;',
editable: true,
data: [],
dataHint: '1',
@ -503,6 +507,53 @@ define([
yValue = this.sldrPreviewPositionY.getValue();
this.imagePositionLabel.text(xValue + ',' + yValue);
// Roles
var itemsTemplate =
[
'<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem" style="padding-left: 10px;">',
'<span class="color" style="background: <%= item.color %>;"></span>',
'<%= item.displayValue %>',
'</a></li>',
'<% }); %>'
];
var template = [
'<div class="input-group combobox input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<div class="form-control" style="display: block; padding-top:3px; line-height: 14px; cursor: pointer; <%= style %>"></div>',
'<div style="display: table-cell;"></div>',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">'].concat(itemsTemplate).concat([
'</ul>',
'</div>'
]);
this.cmbRoles = new Common.UI.ComboBoxCustom({
el: $markup.findById('#form-combo-roles'),
cls: 'menu-roles',
menuCls: 'menu-absolute',
menuStyle: 'min-width: 195px; max-height: 190px;',
style: 'width: 100%;',
editable: false,
template : _.template(template.join('')),
itemsTemplate: _.template(itemsTemplate.join('')),
data: [],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
updateFormControl: function(record) {
var formcontrol = $(this.el).find('.form-control');
if (record) {
formcontrol[0].innerHTML = '<span class="color" style="background:' + record.get('color') + ';"></span>' + record.get('displayValue');
} else
formcontrol[0].innerHTML = '';
}
});
this.onRefreshRolesList(this.roles);
this.lockedControls.push(this.cmbRoles);
this.cmbRoles.on('selected', this.onRolesChanged.bind(this));
this.cmbFormat = new Common.UI.ComboBox({
el: $markup.findById('#form-combo-format'),
cls: 'input-group-nr',
@ -521,8 +572,8 @@ define([
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'),
this.txtRegExp = new Common.UI.InputField({
el : $markup.findById('#form-txt-regexp'),
allowBlank : true,
validateOnChange: false,
validateOnBlur: false,
@ -532,11 +583,41 @@ define([
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.lockedControls.push(this.txtRegExp);
this.txtRegExp.on('changed:after', this.onRegExpChanged.bind(this));
this.txtRegExp.on('inputleave', function(){ me.fireEvent('editcomplete', me);});
this.txtRegExp.cmpEl.on('focus', 'input.form-control', function() {
setTimeout(function(){me.txtRegExp._input && me.txtRegExp._input.select();}, 1);
});
this.cmbMask = new Common.UI.ComboBoxCustom({
el: $markup.findById('#form-txt-mask'),
cls: 'input-group-nr',
menuCls: 'menu-absolute',
menuStyle: 'min-width: 195px;',
editable: true,
data: [
{ displayValue: this.textPhone1, value: '(999)999-9999' },
{ displayValue: this.textPhone2, value: '+999999999999' },
{ displayValue: this.textZipCodeUS, value: '99999-9999' },
{ displayValue: this.textUSSSN, value: '999-99-9999' },
{ displayValue: this.textUKPassport, value: '999999999' },
{ displayValue: this.textCreditCard, value: '9999-9999-9999-9999' }],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big',
updateFormControl: function(record) {
record && this.setRawValue(record.get('value'));
// $('.selected', $(this.el)).removeClass('selected');
}
});
this.cmbMask.setValue('');
this.lockedControls.push(this.cmbMask);
this.cmbMask.on('selected', this.onMaskChanged.bind(this));
this.cmbMask.on('changed:after', this.onMaskChanged.bind(this));
this.cmbMask.on('hide:after', this.onHideMenus.bind(this));
this.cmbMask.cmpEl.on('focus', 'input.form-control', function() {
setTimeout(function(){me.cmbMask._input && me.cmbMask._input.select();}, 1);
});
this.txtFormatSymbols = new Common.UI.InputField({
@ -557,6 +638,53 @@ define([
setTimeout(function(){me.txtFormatSymbols._input && me.txtFormatSymbols._input.select();}, 1);
});
// Date & Time
this.cmbDateFormat = new Common.UI.ComboBox({
el: $markup.findById('#form-cmb-date-format'),
cls: 'input-group-nr',
menuCls: 'menu-absolute',
menuStyle: 'min-width: 195px; max-height: 190px;',
editable: true,
data: [],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.cmbDateFormat.setValue('');
this.lockedControls.push(this.cmbDateFormat);
this.cmbDateFormat.on('selected', this.onDateFormatChanged.bind(this));
this.cmbDateFormat.on('changed:after', this.onDateFormatChanged.bind(this));
this.cmbDateFormat.on('hide:after', this.onHideMenus.bind(this));
this.cmbDateFormat.cmpEl.on('focus', 'input.form-control', function() {
setTimeout(function(){me.cmbDateFormat._input && me.cmbDateFormat._input.select();}, 1);
});
var data = [{ value: 0x042C }, { value: 0x0402 }, { value: 0x0405 }, { value: 0x0C07 }, { value: 0x0407 }, {value: 0x0807}, { value: 0x0408 }, { value: 0x0C09 }, { value: 0x0809 }, { value: 0x0409 }, { value: 0x0C0A }, { value: 0x080A },
{ value: 0x040B }, { value: 0x040C }, { value: 0x100C }, { value: 0x0410 }, { value: 0x0810 }, { value: 0x0411 }, { value: 0x0412 }, { value: 0x0426 }, { value: 0x040E }, { value: 0x0413 }, { value: 0x0415 }, { value: 0x0416 },
{ value: 0x0816 }, { value: 0x0419 }, { value: 0x041B }, { value: 0x0424 }, { value: 0x081D }, { value: 0x041D }, { value: 0x041F }, { value: 0x0422 }, { value: 0x042A }, { value: 0x0804 }];
data.forEach(function(item) {
var langinfo = Common.util.LanguageInfo.getLocalLanguageName(item.value);
item.displayValue = langinfo[1];
item.langName = langinfo[0];
});
this.cmbLang = new Common.UI.ComboBox({
el: $markup.findById('#form-cmb-date-lang'),
cls: 'input-group-nr',
menuCls: 'menu-absolute',
menuStyle: 'min-width: 195px; max-height: 190px;',
editable: false,
data: data,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.lockedControls.push(this.cmbLang);
this.cmbLang.setValue(0x0409);
this.cmbLang.on('selected',function(combo, record) {
me.updateDateFormats(record.value);
});
this.updateMetricUnit();
this.UpdateThemeColors();
},
@ -565,6 +693,7 @@ define([
this.api = api;
if (this.api) {
// this.api.asc_registerCallback('asc_onParaSpacingLine', _.bind(this._onLineSpacing, this));
this.api.asc_registerCallback('asc_onUpdateOFormRoles', _.bind(this.onRefreshRolesList, this));
}
Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this));
return this;
@ -951,12 +1080,12 @@ define([
formTextPr.put_LetterFormat();
break;
case Asc.TextFormFormatType.Mask:
this.txtMask.setValue('*');
formTextPr.put_MaskFormat(this.txtMask.getValue());
this.cmbMask.setValue('*');
formTextPr.put_MaskFormat(this.cmbMask.getValue());
break;
case Asc.TextFormFormatType.RegExp:
this.txtMask.setValue('.');
formTextPr.put_RegExpFormat(this.txtMask.getValue());
this.txtRegExp.setValue('.');
formTextPr.put_RegExpFormat(this.txtRegExp.getValue());
break;
}
props.put_TextFormPr(formTextPr);
@ -965,15 +1094,27 @@ define([
}
},
onMaskChanged: function(input, newValue, oldValue, e) {
onMaskChanged: function(combo, record) {
if (this.api && !this._noApply) {
var props = this._originalProps || new AscCommon.CContentControlPr();
var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr();
formTextPr.put_MaskFormat(record.value);
if (this._state.placeholder===this._state.Mask)
props.put_PlaceholderText(record.value);
props.put_TextFormPr(formTextPr);
this.api.asc_SetContentControlProperties(props, this.internalId);
this.fireEvent('editcomplete', this);
} else {
this.cmbMask.setValue(this._state.Mask ? this._state.Mask : '');
this.fireEvent('editcomplete', this);
}
},
onRegExpChanged: 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))
@ -1082,6 +1223,12 @@ define([
this._state.arrKey=data;
}
val = formPr.get_Role();
if (this._state.Role!==val) {
this.cmbRoles.setValue(val ? val : '');
this._state.Role=val;
}
val = formPr.get_Key();
if (this._state.Key!==val) {
this.cmbKey.setValue(val ? val : '');
@ -1294,12 +1441,18 @@ define([
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 : '');
if ( this._state.FormatType===Asc.TextFormFormatType.Mask ) {
val = formTextPr.get_MaskFormat();
this.cmbMask.setValue((val !== null && val !== undefined) ? val : '');
this._state.Mask=val;
}
if ( this._state.FormatType===Asc.TextFormFormatType.RegExp ) {
val = formTextPr.get_RegExpFormat();
this.txtRegExp.setValue((val !== null && val !== undefined) ? val : '');
this._state.RegExp=val;
}
val = formTextPr.get_FormatSymbols();
if ( this._state.FormatSymbols!==val ) {
this.txtFormatSymbols.setValue((val !== null && val !== undefined) ? val : '');
@ -1317,6 +1470,22 @@ define([
} else
this._originalTextFormProps = null;
var datePr = props.get_DateTimePr();
if (datePr && type == Asc.c_oAscContentControlSpecificType.DateTime) {
this.labelFormName.text(this.textDateField);
this._originalDateProps = datePr;
var lang = datePr.get_LangId() || this.options.controlLang;
if (lang) {
var item = this.cmbLang.store.findWhere({value: lang});
item = item ? item.get('value') : 0x0409;
this.cmbLang.setValue(item);
}
this.updateDateFormats(this.cmbLang.getValue());
var format = datePr.get_DateFormat();
this.cmbDateFormat.setValue(format);
this._state.DateFormat=format;
}
var isComplex = !!props.get_ComplexFormPr(), // is complex form
isSimpleInsideComplex = !!this.api.asc_GetCurrentComplexForm() && !isComplex;
@ -1327,7 +1496,8 @@ define([
this.KeySettingsTd.toggleClass('padding-small', !connected);
this.ConnectedSettings.toggleClass('hidden', !connected);
this.TextOnlySettingsMask.toggleClass('hidden', !(type === Asc.c_oAscContentControlSpecificType.None && !!formTextPr) || !(this._state.FormatType===Asc.TextFormFormatType.Mask || this._state.FormatType===Asc.TextFormFormatType.RegExp));
this.TextOnlySettingsMask.toggleClass('hidden', !(type === Asc.c_oAscContentControlSpecificType.None && !!formTextPr) || this._state.FormatType!==Asc.TextFormFormatType.Mask);
this.TextOnlySettingsRegExp.toggleClass('hidden', !(type === Asc.c_oAscContentControlSpecificType.None && !!formTextPr) || 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;
@ -1364,11 +1534,8 @@ define([
checkable: true
}), {caption: '--'}],
menu : true,
colors: ['000000', '993300', '333300', '003300', '003366', '000080', '333399', '333333', '800000', 'FF6600',
'808000', '00FF00', '008080', '0000FF', '666699', '808080', 'FF0000', 'FF9900', '99CC00', '339966',
'33CCCC', '3366FF', '800080', '999999', 'FF00FF', 'FFCC00', 'FFFF00', '00FF00', '00FFFF', '00CCFF',
'993366', 'C0C0C0', 'FF99CC', 'FFCC99', 'FFFF99', 'CCFFCC', 'CCFFFF', 'C9C8FF', 'CC99FF', 'FFFFFF'
],
colors: ['FEF8E5', 'FFEFBF', 'E2EFD8', 'C6E0B3', 'EDEDED', 'DBDBDB', 'CDD6E4', 'A2B2CA', '800000', 'FF6600', 'F2F2F2', 'D9D9D9', 'DDEBF6', 'C2DDF2', 'FBECE2',
'F7D9C6', 'D6E3EE', 'B9CAE7', 'F2DADA', 'F2C2C2', 'F0DDF6', 'E5C2F2', 'E6FBD6', 'CDF7AC', 'EED6D6', 'E7B9B9', 'CCE1FF', '9AC4FF', 'E4CDDB', 'D9ADC7'],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
@ -1433,7 +1600,8 @@ define([
checkboxOnly = false,
radioboxOnly = false,
listOnly = false,
imageOnly = false;
imageOnly = false,
dateOnly = false;
if (type == Asc.c_oAscContentControlSpecificType.ComboBox || type == Asc.c_oAscContentControlSpecificType.DropDownList) {
listOnly = !!specProps;
} else if (type == Asc.c_oAscContentControlSpecificType.CheckBox) {
@ -1443,6 +1611,8 @@ define([
}
} else if (type == Asc.c_oAscContentControlSpecificType.Picture) {
imageOnly = true;
} else if (type == Asc.c_oAscContentControlSpecificType.DateTime) {
dateOnly = true;
} else if (type == Asc.c_oAscContentControlSpecificType.None || type == Asc.c_oAscContentControlSpecificType.Complex) {
textOnly = !!textProps;
}
@ -1457,6 +1627,7 @@ define([
this.CheckOnlySettings.toggleClass('hidden', !value);
this.FixedSettings.toggleClass('hidden', imageOnly || isSimpleInsideComplex);
this.NotInComplexSettings.toggleClass('hidden', isSimpleInsideComplex);
this.DateOnlySettings.toggleClass('hidden', !dateOnly);
},
onSelectItem: function(listView, itemView, record) {
@ -1525,6 +1696,88 @@ define([
}
},
onRefreshRolesList: function(roles) {
if (this._initSettings) {
this.roles = roles;
return;
}
if (!roles) {
roles = this.api.asc_GetOForm().asc_getAllRoles();
// change to event asc_onRefreshRolesList
// roles = [
// {name: 'employee 1', color: Common.Utils.ThemeColor.getRgbColor('ff0000'), fields: 5},
// {name: 'employee 2', color: Common.Utils.ThemeColor.getRgbColor('00ff00'), fields: 1},
// {name: 'manager', color: null, fields: 10}
// ];
}
var lastrole = this.cmbRoles.getSelectedRecord();
lastrole = lastrole ? lastrole.value : '';
var arr = [];
var me = this;
roles && roles.forEach(function(item) {
var role = item.asc_getSettings(),
color = role.asc_getColor();
arr.push({
displayValue: role.asc_getName() || me.textAnyone,
value: role.asc_getName(),
color: color ? '#' + Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()) : 'transparent'
});
});
this.cmbRoles.setData(arr);
this.cmbRoles.setValue(lastrole);
},
onRolesChanged: function(combo, record) {
if (this.api && !this._noApply) {
this._state.Role = undefined;
var props = this._originalProps || new AscCommon.CContentControlPr();
var formPr = this._originalFormProps || new AscCommon.CSdtFormPr();
formPr.put_Role(record.value);
props.put_FormPr(formPr);
this.api.asc_SetContentControlProperties(props, this.internalId);
Common.Utils.InternalSettings.set('de-last-form-role', record.value)
this.fireEvent('editcomplete', this);
}
},
updateDateFormats: function(lang) {
if (this._originalDateProps) {
var props = this._originalDateProps,
formats = props.get_FormatsExamples(),
arr = [];
for (var i = 0, len = formats.length; i < len; i++)
{
arr.push({
value: formats[i],
displayValue: props.get_String(formats[i], undefined, lang)
});
}
this.cmbDateFormat.setData(arr);
this.cmbDateFormat.setValue(arr[0].value);
if (this.api && !this._noApply)
this.onDateFormatChanged();
}
},
onDateFormatChanged: function(combo, record) {
if (this.api && !this._noApply) {
var props = this._originalProps || new AscCommon.CContentControlPr();
var formDatePr = this._originalDateProps || new AscCommon.CSdtDatePickerPr();
formDatePr.put_DateFormat(this.cmbDateFormat.getValue());
formDatePr.put_LangId(this.cmbLang.getValue());
props.put_DateTimePr(formDatePr);
this.api.asc_SetContentControlProperties(props, this.internalId);
this.fireEvent('editcomplete', this);
} else {
this.cmbDateFormat.setValue(this._state.DateFormat ? this._state.DateFormat : '');
this.fireEvent('editcomplete', this);
}
},
textField: 'Text Field',
textKey: 'Key',
textPlaceholder: 'Placeholder',
@ -1565,6 +1818,7 @@ define([
textTooSmall: 'Image is Too Small',
textScale: 'When to scale',
textBackgroundColor: 'Background Color',
textFillRoles: 'Who needs to fill this out?',
textTag: 'Tag',
textAuto: 'Auto',
textAtLeast: 'At least',
@ -1576,7 +1830,17 @@ define([
textLetters: 'Letters',
textDigits: 'Digits',
textNone: 'None',
textComplex: 'Complex Field'
textComplex: 'Complex Field',
textAnyone: 'Anyone',
textPhone1: 'Phone Number (e.g. (123) 456-7890)',
textPhone2: 'Phone Number (e.g. +447911123456)',
textZipCodeUS: 'US Zip Code (e.g. 92663 or 92663-1234)',
textUSSSN: 'US SSN (e.g. 123-45-6789)',
textUKPassport: 'UK Passport Number (e.g. 925665416)',
textCreditCard: 'Credit Card Number (e.g 4111-1111-1111-1111)',
textDateField: 'Date & Time Field',
textDateFormat: 'Display the date like this',
textLang: 'Language'
}, DE.Views.FormSettings || {}));
});

View file

@ -61,25 +61,21 @@ define([
'<div class="group forms-buttons" style="display: none;">' +
'<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-datetime"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-zipcode"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-credit"></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;">' +
'<div class="elset no-group-mask form-view">' +
'<span class="btn-slot text" id="slot-form-clear-fields"></span>' +
'<div class="separator long forms-buttons" style="display: none;"></div>' +
'<div class="group forms-buttons" style="display: none;">' +
'<span class="btn-slot text x-huge" id="slot-btn-manager"></span>' +
'</div>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-form-highlight"></span>' +
'</div>' +
'</div>' +
'<div class="group no-group-mask form-view">' +
'<span class="btn-slot text x-huge" id="slot-btn-form-clear"></span>' +
'<div class="separator long forms-buttons" style="display: none;"></div>' +
'<div class="group no-group-mask" style="">' +
'<span class="btn-slot text x-huge" id="slot-btn-form-view-roles"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-prev"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-next"></span>' +
'</div>' +
'<div class="separator long submit" style="display: none;"></div>' +
'<div class="group no-group-mask form-view" style="display: none;">' +
'<span class="btn-slot text x-huge" id="slot-btn-form-view"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-clear"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-submit"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-save"></span>' +
'</div>' +
@ -88,7 +84,22 @@ define([
function setEvents() {
var me = this;
this.btnTextField && this.btnTextField.on('click', function (b, e) {
me.fireEvent('forms:insert', ['text']);
me.fireEvent('forms:insert', ['text', {fixed: b.options.fieldType==='fixed'}]);
});
this.btnTextField && this.btnTextField.menu.on('item:click', function (menu, item) {
var oldType = me.btnTextField.options.fieldType;
var newType = item.value;
if(newType !== oldType){
me.btnTextField.changeIcon({
next: item.options.iconClsForMainBtn,
curr: me.btnTextField.menu.items.filter(function(mnu){return mnu.value === oldType})[0].options.iconClsForMainBtn
});
me.btnTextField.updateHint(item.options.hintForMainBtn);
me.btnTextField.options.fieldType = newType;
Common.localStorage.setBool("de-text-form-fixed", newType==='fixed')
}
me.fireEvent('forms:insert', ['text', {fixed: newType==='fixed'}]);
});
this.btnComboBox && this.btnComboBox.on('click', function (b, e) {
me.fireEvent('forms:insert', ['combobox']);
@ -114,23 +125,43 @@ define([
this.btnPhoneField && this.btnPhoneField.on('click', function (b, e) {
me.fireEvent('forms:insert', ['text', {mask: "(999)999-9999", placeholder: '(999)999-9999'}]);
});
this.btnViewForm && this.btnViewForm.on('click', function (b, e) {
me.fireEvent('forms:mode', [b.pressed]);
this.btnCreditCard && this.btnCreditCard.on('click', function (b, e) {
me.fireEvent('forms:insert', ['text', {mask: "9999-9999-9999-9999", placeholder: '9999-9999-9999-9999'}]);
});
this.btnClearFields && this.btnClearFields.on('click', function (b, e) {
me.fireEvent('forms:clear');
this.btnZipCode && this.btnZipCode.on('click', function (b, e) {
me.fireEvent('forms:insert', ['text', {mask: "99999-9999", placeholder: '99999-9999'}]);
});
this.btnDateTime && this.btnDateTime.on('click', function (b, e) {
me.fireEvent('forms:insert', ['datetime']);
});
this.btnViewFormRoles && this.btnViewFormRoles.on('click', function (b, e) {
var item = b.menu.getChecked();
me.fireEvent('forms:mode', [b.pressed, item ? item.caption : undefined]);
});
this.btnViewFormRoles.menu.on('item:toggle', _.bind(function (menu, item, state) {
if (!!state) {
me.btnViewFormRoles.toggle(true, true);
me.fireEvent('forms:mode', [true, item.caption]);
}
}, me));
this.btnViewFormRoles.menu.on('show:after', function (menu) {
me.fillRolesMenu();
});
this.btnManager && this.btnManager.on('click', function (b, e) {
me.fireEvent('forms:manager');
});
this.btnClear && this.btnClear.on('click', function (b, e) {
me.fireEvent('forms:clear');
});
if (this.mnuFormsColorPicker) {
this.btnHighlight.on('color:select', function(btn, color) {
me.fireEvent('forms:select-color', [color]);
});
this.mnuNoFormsColor.on('click', function (item) {
me.fireEvent('forms:no-color', [item]);
});
}
// if (this.mnuFormsColorPicker) {
// this.btnHighlight.on('color:select', function(btn, color) {
// me.fireEvent('forms:select-color', [color]);
// });
// this.mnuNoFormsColor.on('click', function (item) {
// me.fireEvent('forms:no-color', [item]);
// });
// }
this.btnPrevForm && this.btnPrevForm.on('click', function (b, e) {
me.fireEvent('forms:goto', ['prev']);
});
@ -155,22 +186,23 @@ define([
this.appConfig = options.config;
this.paragraphControls = [];
this._state = {};
var me = this;
var _set = Common.enumLock;
if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms) {
this.btnClear = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon clear-style',
caption: this.textClear
});
} else {
var isfixed = Common.localStorage.getBool("de-text-form-fixed", true);
this.btnTextField = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-text-field',
iconCls: 'toolbar__icon ' + (isfixed ? 'btn-fixed-field' : 'btn-text-field'),
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.inSmartart, _set.inSmartartInternal],
caption: this.capBtnText,
fieldType: isfixed ? 'fixed' : 'inline',
split: true,
menu: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -232,6 +264,17 @@ define([
});
this.paragraphControls.push(this.btnImageField);
this.btnManager = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-ic-sharing',
lock: [ _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments],
caption: this.capBtnManager,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnManager);
this.btnEmailField = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-email',
@ -254,6 +297,39 @@ define([
});
this.paragraphControls.push(this.btnPhoneField);
this.btnZipCode = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-zip-code',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.inSmartart, _set.inSmartartInternal],
caption: this.capZipCode,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnZipCode);
this.btnCreditCard = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-credit-card',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.inSmartart, _set.inSmartartInternal],
caption: this.capCreditCard,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnCreditCard);
this.btnDateTime = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-datetime',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.inSmartart, _set.inSmartartInternal],
caption: this.capDateTime,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnDateTime);
this.btnComplexField = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon complex-field',
@ -265,59 +341,64 @@ define([
});
this.paragraphControls.push(this.btnComplexField);
this.btnViewForm = new Common.UI.Button({
this.btnViewFormRoles = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-sheet-view',
lock: [ _set.previewReviewMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments],
lock: [ _set.previewReviewMode, _set.formsNoRoles, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments],
caption: this.capBtnView,
split: true,
menu: new Common.UI.Menu({
cls: 'menu-roles',
maxHeight: 270,
items: []
}),
enableToggle: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnViewForm);
this.paragraphControls.push(this.btnViewFormRoles);
this.btnClearFields = new Common.UI.Button({
cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-clearstyle',
lock: [ _set.previewReviewMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments],
caption : this.textClearFields,
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnClearFields);
this.btnHighlight = new Common.UI.ButtonColored({
cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-highlight',
lock: [ _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments],
caption : this.textHighlight,
menu : true,
additionalItems: [ this.mnuNoFormsColor = new Common.UI.MenuItem({
id: 'id-toolbar-menu-no-highlight-form',
caption: this.textNoHighlight,
checkable: true,
style: 'padding-left: 20px;'
}),
{caption: '--'}],
colors: ['000000', '993300', '333300', '003300', '003366', '000080', '333399', '333333', '800000', 'FF6600',
'808000', '00FF00', '008080', '0000FF', '666699', '808080', 'FF0000', 'FF9900', '99CC00', '339966',
'33CCCC', '3366FF', '800080', '999999', 'FF00FF', 'FFCC00', 'FFFF00', '00FF00', '00FFFF', '00CCFF',
'993366', 'C0C0C0', 'FF99CC', 'FFCC99', 'FFFF99', 'CCFFCC', 'CCFFFF', 'C9C8FF', 'CC99FF', 'FFFFFF'
],
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnHighlight);
// this.btnHighlight = new Common.UI.ButtonColored({
// cls : 'btn-toolbar',
// iconCls : 'toolbar__icon btn-highlight',
// lock: [ _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
// caption : this.textHighlight,
// menu : true,
// additionalItems: [ this.mnuNoFormsColor = new Common.UI.MenuItem({
// id: 'id-toolbar-menu-no-highlight-form',
// caption: this.textNoHighlight,
// checkable: true,
// style: 'padding-left: 20px;'
// }),
// {caption: '--'}],
// colors: ['000000', '993300', '333300', '003300', '003366', '000080', '333399', '333333', '800000', 'FF6600',
// '808000', '00FF00', '008080', '0000FF', '666699', '808080', 'FF0000', 'FF9900', '99CC00', '339966',
// '33CCCC', '3366FF', '800080', '999999', 'FF00FF', 'FFCC00', 'FFFF00', '00FF00', '00FFFF', '00CCFF',
// '993366', 'C0C0C0', 'FF99CC', 'FFCC99', 'FFFF99', 'CCFFCC', 'CCFFFF', 'C9C8FF', 'CC99FF', 'FFFFFF'
// ],
// dataHint: '1',
// dataHintDirection: 'left',
// dataHintOffset: 'small'
// });
}
this.btnClear = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon clear-style',
caption: this.textClear,
visible: false,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.btnPrevForm = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon previous-field',
lock: [ _set.previewReviewMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments],
caption: this.capBtnPrev,
visible: false,
// disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode
dataHint: '1',
dataHintDirection: 'bottom',
@ -330,6 +411,7 @@ define([
iconCls: 'toolbar__icon next-field',
lock: [ _set.previewReviewMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments],
caption: this.capBtnNext,
visible: false,
// disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
dataHint: '1',
dataHintDirection: 'bottom',
@ -380,29 +462,62 @@ define([
accept();
})).then(function(){
if (config.isEdit && config.canFeatureContentControl && config.canFeatureForms) {
if (config.canEditContentControl) {
me.btnHighlight.setMenu();
me.mnuFormsColorPicker = me.btnHighlight.getPicker();
me.btnHighlight.currentColor && me.mnuFormsColorPicker.selectByRGB(me.btnHighlight.currentColor, true);
me.mnuNoFormsColor.setChecked(me.btnHighlight.currentColor === null);
me.btnHighlight.setColor(me.btnHighlight.currentColor || 'transparent');
} else {
me.btnHighlight.cmpEl.parents('.group').hide().prev('.separator').hide();
}
// if (config.canEditContentControl) {
// me.btnHighlight.setMenu();
// me.mnuFormsColorPicker = me.btnHighlight.getPicker();
// me.btnHighlight.currentColor && me.mnuFormsColorPicker.selectByRGB(me.btnHighlight.currentColor, true);
// me.mnuNoFormsColor.setChecked(me.btnHighlight.currentColor === null);
// me.btnHighlight.setColor(me.btnHighlight.currentColor || 'transparent');
// } else {
// me.btnHighlight.cmpEl.parents('.group').hide().prev('.separator').hide();
// }
var menuTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem">'+
'<% if (!_.isEmpty(iconCls)) { %>'+
'<span class="menu-item-icon <%= iconCls %>"></span>'+
'<% } %>'+
'<div><%= caption %></div>' +
'<% if (options.description !== null) { %><label style="display: block;cursor: pointer;white-space: normal;"><%= options.description %></label>' +
'<% } %></a>');
me.btnTextField.setMenu(new Common.UI.Menu({
items: [
{
caption: me.txtInlineText,
template: menuTemplate,
description: me.txtInlineDesc,
iconCls : 'menu__icon btn-field',
value: 'inline',
iconClsForMainBtn: 'btn-text-field',
hintForMainBtn: [me.tipInlineText, me.tipTextField]
},
{
caption: me.txtFixedText,
template: menuTemplate,
description: me.txtFixedDesc,
iconCls : 'menu__icon btn-fixed-field',
value: 'fixed',
iconClsForMainBtn: 'btn-fixed-field',
hintForMainBtn: [me.tipFixedText, me.tipTextField]
}
]
}));
me.btnTextField.updateHint([Common.localStorage.getBool("de-text-form-fixed", true) ? me.tipFixedText : me.tipInlineText, me.tipTextField]);
me.btnTextField.updateHint(me.tipTextField);
me.btnComboBox.updateHint(me.tipComboBox);
me.btnDropDown.updateHint(me.tipDropDown);
me.btnCheckBox.updateHint(me.tipCheckBox);
me.btnRadioBox.updateHint(me.tipRadioBox);
me.btnImageField.updateHint(me.tipImageField);
me.btnViewForm.updateHint(me.tipViewForm);
me.btnViewFormRoles.updateHint(me.tipViewForm);
me.btnManager.updateHint(me.tipManager);
me.btnEmailField.updateHint(me.tipEmailField);
me.btnPhoneField.updateHint(me.tipPhoneField);
me.btnComplexField.updateHint(me.tipComplexField);
} else {
me.btnClear.updateHint(me.textClearFields);
me.btnZipCode.updateHint(me.tipZipCode);
me.btnCreditCard.updateHint(me.tipCreditCard);
me.btnDateTime.updateHint(me.tipDateTime);
}
me.btnClear.updateHint(me.textClearFields);
me.btnPrevForm.updateHint(me.tipPrevForm);
me.btnNextForm.updateHint(me.tipNextForm);
me.btnSubmit && me.btnSubmit.updateHint(me.tipSubmit);
@ -420,8 +535,6 @@ define([
this.appConfig.canDownloadForms && this.btnSaveForm.render($host.find('#slot-btn-form-save'));
if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms) {
this.btnClear.render($host.find('#slot-btn-form-clear'));
(this.btnSubmit || this.btnSaveForm) && $host.find('.separator.submit').show().next('.group').show();
} else {
this.btnTextField.render($host.find('#slot-btn-form-field'));
this.btnComboBox.render($host.find('#slot-btn-form-combobox'));
@ -429,23 +542,66 @@ define([
this.btnCheckBox.render($host.find('#slot-btn-form-checkbox'));
this.btnRadioBox.render($host.find('#slot-btn-form-radiobox'));
this.btnImageField.render($host.find('#slot-btn-form-image'));
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.btnViewFormRoles.render($host.find('#slot-btn-form-view-roles'));
this.btnManager.render($host.find('#slot-btn-manager'));
// 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'));
this.btnZipCode.render($host.find('#slot-btn-form-zipcode'));
this.btnCreditCard.render($host.find('#slot-btn-form-credit'));
this.btnDateTime.render($host.find('#slot-btn-form-datetime'));
$host.find('.forms-buttons').show();
$host.find('.separator.forms').show().next('.group').show();
$host.find('.separator.submit').show().next('.group').show();
}
this.btnClear.render($host.find('#slot-btn-form-clear'));
this.btnPrevForm.render($host.find('#slot-btn-form-prev'));
this.btnNextForm.render($host.find('#slot-btn-form-next'));
return this.$el;
},
fillRolesMenu: function(roles, lastViewRole) {
if (!(this.btnViewFormRoles && this.btnViewFormRoles.menu && this.btnViewFormRoles.menu.isVisible())) {
this._state.roles = roles;
this._state.lastViewRole = lastViewRole;
return;
}
roles = roles || this._state.roles;
lastViewRole = lastViewRole || this._state.lastViewRole;
this._state.roles = this._state.lastViewRole = undefined;
if (!roles) return;
var checkedIndex = 0,
me = this;
this.btnViewFormRoles.menu.removeAll();
roles && roles.forEach(function(item, index) {
var role = item.asc_getSettings(),
color = role.asc_getColor();
if (role.asc_getName()===lastViewRole)
checkedIndex = index;
me.btnViewFormRoles.menu.addItem(new Common.UI.MenuItem({
caption: role.asc_getName() || me.textAnyone,
color: color ? '#' + Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()) : 'transparent',
checkable: true,
toggleGroup: 'formtab-view-role',
template: _.template([
'<a id="<%= id %>" tabindex="-1" type="menuitem" class="<%= options.cls %>">',
'<span class="color" style="background: <%= options.color %>;"></span>',
'<%= caption %>',
'</a>'
].join(''))
}));
});
var len = this.btnViewFormRoles.menu.items.length>0;
len && this.btnViewFormRoles.menu.items[checkedIndex].setChecked(true, true);
Common.Utils.lockControls(Common.enumLock.formsNoRoles, !len,{array: [this.btnViewFormRoles]});
},
show: function () {
Common.UI.BaseView.prototype.show.call(this);
this.fireEvent('show', this);
@ -455,6 +611,14 @@ define([
return this.paragraphControls;
},
setPreviewMode: function(state) {
this.btnClear.setVisible(state);
this.btnPrevForm.setVisible(state);
this.btnNextForm.setVisible(state);
this.btnSubmit && this.btnSubmit.setVisible(!state);
this.btnSaveForm && this.btnSaveForm.setVisible(!state);
},
SetDisabled: function (state) {
this._state.disabled = state;
this.paragraphControls.forEach(function(button) {
@ -495,6 +659,8 @@ define([
txtUntitled: 'Untitled',
textCreateForm: 'Add fields and create a fillable OFORM document',
textGotIt: 'Got it',
capBtnManager: 'Manage Roles',
tipManager: 'Manage Roles',
capBtnDownloadForm: 'Download as oform',
tipDownloadForm: 'Download a file as a fillable OFORM document',
capBtnEmail: 'Email Address',
@ -502,7 +668,20 @@ define([
capBtnComplex: 'Complex Field',
tipEmailField: 'Insert email address',
tipPhoneField: 'Insert phone number',
tipComplexField: 'Insert complex field'
tipComplexField: 'Insert complex field',
textAnyone: 'Anyone',
txtInlineText: 'Inline',
txtInlineDesc: 'Insert inline text field',
txtFixedText: 'Fixed',
txtFixedDesc: 'Insert fixed text field',
tipInlineText: 'Insert inline text field',
tipFixedText: 'Insert fixed text field',
capZipCode: 'Zip Code',
capCreditCard: 'Credit Card',
tipZipCode: 'Insert zip code',
tipCreditCard: 'Insert credit card number',
capDateTime: 'Date & Time',
tipDateTime: 'Insert date and time'
}
}()), DE.Views.FormsTab || {}));
});

View file

@ -1400,7 +1400,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
var spectype = control_props.get_SpecificType();
fixed_size = (spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.ComboBox ||
spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.None ||
spectype==Asc.c_oAscContentControlSpecificType.Picture || spectype==Asc.c_oAscContentControlSpecificType.Complex) &&
spectype==Asc.c_oAscContentControlSpecificType.Picture || spectype==Asc.c_oAscContentControlSpecificType.Complex ||
spectype==Asc.c_oAscContentControlSpecificType.DateTime) &&
control_props.get_FormPr() && control_props.get_FormPr().get_Fixed();
}

View file

@ -0,0 +1,144 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2022
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* RoleDeleteDlg.js
*
* Created by Julia Radzhabova on 15/04/22
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/component/Window',
'common/main/lib/component/ComboBox'
], function () { 'use strict';
DE.Views.RoleDeleteDlg = Common.UI.Window.extend(_.extend({
options: {
width: 300,
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
}, options || {});
this.template = [
'<div class="box">',
'<div class="" style="margin-bottom: 10px;">',
'<label>' + this.textLabel + '</label>',
'</div>',
'<div class="input-row" style="">',
'<label>' + this.textSelect + '</label>',
'</div>',
'<div style="margin-bottom: 12px;">',
'<div id="id-role-del-remove" class="input-group-nr"></div>',
'</div>',
'</div>'
].join('');
this.options.tpl = _.template(this.template)(this.options);
this.props = options.props;
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
var $window = this.getChild();
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.cmbRole = new Common.UI.ComboBox({
el: $('#id-role-del-remove', $window),
style: 'width: 100%;',
menuStyle: 'min-width: 100%;max-height: 190px;',
cls: 'input-group-nr',
data: [],
editable: false,
takeFocusOnClose: true
});
this.afterRender();
},
getFocusedComponents: function() {
return [this.cmbRole];
},
getDefaultFocusableComponent: function () {
return this.cmbRole;
},
afterRender: function() {
this._setDefaults(this.props);
},
_setDefaults: function (props) {
if (props) {
var arr = [];
props.roles.each(function(item, index){
var name = item.get('name');
if (name!==props.excludeName)
arr.push({value: name, displayValue: name});
});
this.cmbRole.setData(arr);
(arr.length>0) && this.cmbRole.setValue(arr[0].value);
}
},
onPrimary: function(event) {
this._handleInput('ok');
return false;
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
_handleInput: function(state) {
if (this.options.handler) {
this.options.handler.call(this, state, this.cmbRole.getValue());
}
this.close();
},
textTitle: 'Delete Role',
textLabel: 'To delete this role, you need to move the fields associated with it to another role.',
textSelect: 'Select for field merger role'
}, DE.Views.RoleDeleteDlg || {}));
});

View file

@ -0,0 +1,209 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2022
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* RoleEditDlg.js
*
* Created by Julia Radzhabova on 13/04/22
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/component/Window',
'common/main/lib/component/InputField'
], function () { 'use strict';
DE.Views.RoleEditDlg = Common.UI.Window.extend(_.extend({
options: {
width: 330,
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
},
initialize : function(options) {
_.extend(this.options, options || {});
this.template = [
'<div class="box">',
'<table cols="2" style="width: 100%;">',
'<tr>',
'<td style="width: 50px; padding-right: 10px;">',
'<label></label>',
'<div id="id-dlg-role-color" style="margin-bottom: 10px;"></div>',
'</td>',
'<td>',
'<label>' + this.textName + '</label>',
'<div id="id-dlg-role-name" class="input-row" style="margin-bottom: 10px; "></div>',
'</td>',
'</tr>',
'</table>',
'</div>'
].join('');
this.options.tpl = _.template(this.template)(this.options);
this.props = this.options.props;
this.lastColor = 'C9C8FF';
this.oformManager = this.options.oformManager;
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
var me = this;
var $window = this.getChild();
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
me.inputName = new Common.UI.InputField({
el : $window.find('#id-dlg-role-name'),
allowBlank : false,
blankError : me.textEmptyError,
style : 'width: 100%;',
validateOnBlur: false,
validation : function(value) {
value = value.trim();
if (_.isEmpty(value))
return '';
if (!(me.props && value === me.props.name) && me.oformManager.asc_haveRole(value))
return me.errNameExists;
return true;
}
});
this.btnColor = new Common.UI.ColorButton({
parentEl: $window.find('#id-dlg-role-color'),
additionalItems: [ this.mnuNoFormsColor = new Common.UI.MenuItem({
id: 'id-dlg-role-menu-no-highlight',
caption: this.textNoHighlight,
checkable: true,
style: 'padding-left: 20px;'
}),
{caption: '--'}],
additionalAlign: this.menuAddAlign,
colors: ['FEF8E5', 'FFEFBF', 'E2EFD8', 'C6E0B3', 'EDEDED', 'DBDBDB', 'CDD6E4', 'A2B2CA', '800000', 'FF6600', 'F2F2F2', 'D9D9D9', 'DDEBF6', 'C2DDF2', 'FBECE2',
'F7D9C6', 'D6E3EE', 'B9CAE7', 'F2DADA', 'F2C2C2', 'F0DDF6', 'E5C2F2', 'E6FBD6', 'CDF7AC', 'EED6D6', 'E7B9B9', 'CCE1FF', '9AC4FF', 'E4CDDB', 'D9ADC7'],
color: this.lastColor,
cls: 'move-focus',
takeFocusOnClose: true
});
this.btnColor.on('color:select', _.bind(this.onColorsSelect, this));
this.mnuNoFormsColor.on('click', _.bind(this.onNoColorClick, this));
this.mnuColorPicker = this.btnColor.getPicker();
this.afterRender();
},
afterRender: function() {
this.setSettings(this.props);
this.setTitle((this.options.isEdit) ? this.txtTitleEdit : this.txtTitleNew);
},
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
},
setSettings: function (props) {
if (props) {
var clr = props.color,
show = !!clr;
this.mnuNoFormsColor.setChecked(!show, true);
this.mnuColorPicker.clearSelection();
if (clr) {
clr = Common.Utils.ThemeColor.getHexColor(clr.get_r(), clr.get_g(), clr.get_b());
this.mnuColorPicker.selectByRGB(clr, true);
this.lastColor = clr;
}
this.btnColor.setColor(clr || 'transparent');
this.inputName.setValue(props.name || '');
}
},
getSettings: function() {
return {name: this.inputName.getValue(), color: this.mnuNoFormsColor.isChecked() ? null : Common.Utils.ThemeColor.getRgbColor(this.lastColor)};
},
onColorsSelect: function(btn, color) {
this.lastColor = color;
this.mnuNoFormsColor.setChecked(false, true);
},
onNoColorClick: function(item) {
if (!item.isChecked()) {
this.btnColor.setColor(this.lastColor);
this.mnuColorPicker.selectByRGB(this.lastColor, true);
} else {
this.mnuColorPicker.clearSelection();
}
},
onPrimary: function(event) {
this._handleInput('ok');
return false;
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
getFocusedComponents: function() {
return [this.btnColor, this.inputName];
},
getDefaultFocusableComponent: function () {
return this.inputName;
},
_handleInput: function(state) {
if (this.options.handler) {
if (state == 'ok') {
if (this.inputName.checkValidate() !== true) {
this.inputName.cmpEl.find('input').focus();
return;
}
}
this.options.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined);
}
this.close();
},
txtTitleEdit: 'Edit Role',
txtTitleNew: 'Create New Role',
textName: 'Role name',
textEmptyError: 'Role name must not be empty.',
textNoHighlight: 'No highlighting',
errNameExists: 'Role with such a name already exists.'
}, DE.Views.RoleEditDlg || {}));
});

View file

@ -0,0 +1,372 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2022
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
*
* RolesManagerDlg.js
*
* Created by Julia.Radzhabova on 12.04.22
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
*
*/
define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
'common/main/lib/view/AdvancedSettingsWindow',
'common/main/lib/component/ListView',
'documenteditor/main/app/view/RoleEditDlg',
'documenteditor/main/app/view/RoleDeleteDlg'
], function (contentTemplate) {
'use strict';
DE.Views = DE.Views || {};
DE.Views.RolesManagerDlg = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: {
alias: 'RolesManagerDlg',
contentWidth: 500,
height: 353,
buttons: null
},
initialize: function (options) {
var me = this;
_.extend(this.options, {
title: this.txtTitle,
template: [
'<div class="box" style="height:' + (this.options.height-85) + 'px;">',
'<div class="content-panel" style="padding: 0;">' + _.template(contentTemplate)({scope: this}) + '</div>',
'</div>',
'<div class="separator horizontal"></div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">' + this.closeButtonText + '</button>',
'</div>'
].join('')
}, options);
this.api = options.api;
this.handler = options.handler;
this.props = options.props;
this.oformManager = this.api.asc_GetOForm();
this.wrapEvents = {
onRefreshRolesList: _.bind(this.onRefreshRolesList, this)
};
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
},
render: function () {
Common.Views.AdvancedSettingsWindow.prototype.render.call(this);
var me = this;
this.rolesList = new Common.UI.ListView({
el: $('#roles-manager-roles-list', this.$window),
store: new Common.UI.DataViewStore(),
emptyText: this.textEmpty,
itemTemplate: _.template([
'<div id="<%= id %>" class="list-item" style="">',
'<div class="listitem-icon"><svg class=""><use xlink:href="#svg-icon-<%= scope.getIconCls(index) %>"></use></svg></div>',
'<div style="min-width: 25px;text-align:center; padding-right: 5px;"><%= index+1 %></div>',
'<div style="min-width: 25px;">',
'<span class="color" style="background: <% if (color) { %>#<%= Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()) %><% } else { %> transparent <% } %>;"></span>',
'</div>',
'<div style="flex-grow: 1;padding-right: 5px;"><%= Common.Utils.String.htmlEncode(name) %></div>',
'<div style="min-width: 25px;text-align: right;opacity: 0.8;"><%= fields %></div>',
'</div>'
].join('')),
tabindex: 1
});
this.rolesList.on('item:select', _.bind(this.onSelectRoleItem, this))
.on('item:keydown', _.bind(this.onKeyDown, this))
.on('item:dblclick', _.bind(this.onDblClickItem, this))
.on('entervalue', _.bind(this.onDblClickItem, this));
this.btnNewRole = new Common.UI.Button({
el: $('#roles-manager-btn-new', this.$window)
});
this.btnNewRole.on('click', _.bind(this.onEditRole, this, false));
this.btnEditRole = new Common.UI.Button({
el: $('#roles-manager-btn-edit', this.$window)
});
this.btnEditRole.on('click', _.bind(this.onEditRole, this, true));
this.btnDeleteRole = new Common.UI.Button({
el: $('#roles-manager-btn-delete', this.$window)
});
this.btnDeleteRole.on('click', _.bind(this.onDeleteRole, this));
this.btnUp = new Common.UI.Button({
parentEl: $('#roles-manager-btn-up', this.$window),
cls: 'btn-toolbar bg-white',
iconCls: 'caret-up',
hint: this.textUp
});
this.btnUp.on('click', _.bind(this.onMoveClick, this, true));
this.btnDown = new Common.UI.Button({
parentEl: $('#roles-manager-btn-down', this.$window),
cls: 'btn-toolbar bg-white',
iconCls: 'caret-down',
hint: this.textDown
});
this.btnDown.on('click', _.bind(this.onMoveClick, this, false));
this.afterRender();
},
getFocusedComponents: function() {
return [ this.btnUp, this.btnDown, this.rolesList, this.btnNewRole, this.btnEditRole, this.btnDeleteRole ];
},
getDefaultFocusableComponent: function () {
return this.rolesList;
},
afterRender: function() {
this._setDefaults(this.props);
},
_setDefaults: function (props) {
this.refreshRolesList(this.oformManager.asc_getAllRoles(), 0);
this.api.asc_registerCallback('asc_onUpdateOFormRoles', this.wrapEvents.onRefreshRolesList);
},
onRefreshRolesList: function(roles) {
this.refreshRolesList(roles);
},
refreshRolesList: function(roles, selectedRole) {
(selectedRole===undefined) && (selectedRole = this.lastSelectedRole); // when add or delete roles
this.lastSelectedRole = undefined;
if (selectedRole===undefined && this.rolesList.store.length>0) {
var rec = this.rolesList.getSelectedRec();
rec && (selectedRole = rec.get('name'));
}
if (roles) {
var arr = [];
for (var i=0; i<roles.length; i++) {
var role = roles[i].asc_getSettings();
arr.push({
name: role.asc_getName() || this.textAnyone,
color: role.asc_getColor(),
fields: role.asc_getFieldCount() || 0,
index: i,
scope: this
});
}
this.rolesList.store.reset(arr);
}
if (this.rolesList.store.length>0) {
var me = this,
rec;
(selectedRole===undefined) && (selectedRole = 0);
if (typeof selectedRole === 'string') { // name
rec = this.rolesList.store.findWhere({name: selectedRole});
this.rolesList.selectRecord(rec);
} else {
selectedRole = Math.min(selectedRole, this.rolesList.store.length-1);
rec = this.rolesList.selectByIndex(selectedRole);
}
setTimeout(function() {
me.rolesList.scrollToRecord(rec || me.rolesList.store.at(0));
}, 50);
}
this.updateButtons();
},
getIconCls: function(index) {
if (this.rolesList.store.length===1)
return 'Point';
return (index===0) ? 'StartPoint' : (index===this.rolesList.store.length-1 ? 'EndPoint' : 'MiddlePoint');
},
onEditRole: function (isEdit) {
if (this._isWarningVisible) return;
var me = this,
xy = me.$window.offset(),
rec = this.rolesList.getSelectedRec();
var win = new DE.Views.RoleEditDlg({
oformManager: me.oformManager,
props : (isEdit && rec) ? {name: rec.get('name'), color: rec.get('color')} : null,
isEdit : (isEdit && rec),
handler : function(result, settings) {
if (result == 'ok' && settings) {
me.lastSelectedRole = settings.name;
var role = new AscCommon.CRoleSettings();
role.asc_putName(settings.name);
role.asc_putColor(settings.color);
if (isEdit && rec) {
me.oformManager.asc_editRole(rec.get('name'), role);
} else {
me.oformManager.asc_addRole(role);
}
}
}
}).on('close', function() {
me.show();
setTimeout(function(){ me.getDefaultFocusableComponent().focus(); }, 100);
});
me.hide();
win.show(xy.left + 65, xy.top + 77);
},
onDeleteRole: function () {
var me = this,
store = this.rolesList.store,
rec = this.rolesList.getSelectedRec();
if (!rec) return;
if (store.length===1 && rec.get('fields')>0) {
Common.UI.warning({
msg: me.warnCantDelete,
buttons: ['ok']
});
return;
}
var callback = function(toRole) {
me.lastSelectedRole = store.indexOf(rec);
me.oformManager.asc_removeRole(rec.get('name'), toRole); // remove role and move it's fields
};
if (rec.get('fields')<1) {
me._isWarningVisible = true;
Common.UI.warning({
msg: Common.Utils.String.format(me.warnDelete, rec.get('name')),
buttons: ['ok', 'cancel'],
callback: function(btn) {
if (btn == 'ok') {
callback();
}
setTimeout(function(){ me.getDefaultFocusableComponent().focus(); }, 100);
me._isWarningVisible = false;
}
});
} else {
var xy = me.$window.offset();
var win = new DE.Views.RoleDeleteDlg({
props : {roles: this.rolesList.store, excludeName: rec.get('name')},
handler : function(result, settings) {
if (result == 'ok' && settings) {
callback(settings);
}
}
}).on('close', function() {
me.show();
setTimeout(function(){ me.getDefaultFocusableComponent().focus(); }, 100);
});
me.hide();
win.show(xy.left + 65, xy.top + 77);
}
},
getSettings: function() {
},
onPrimary: function() {
return true;
},
onDlgBtnClick: function(event) {
this.handler && this.handler.call(this, event.currentTarget.attributes['result'].value, this.getSettings());
this.close();
},
onSelectRoleItem: function(lisvView, itemView, record) {
if (!record) return;
this.lastSelectedRole = undefined;
this.updateMoveButtons();
},
onMoveClick: function(up) {
var rec = this.rolesList.getSelectedRec();
if (rec) {
this.lastSelectedRole = rec.get('name');
up ? this.oformManager.asc_moveUpRole(rec.get('name')) : this.oformManager.asc_moveDownRole(rec.get('name'));
}
},
updateButtons: function() {
this.btnEditRole.setDisabled(this.rolesList.store.length<1);
this.btnDeleteRole.setDisabled(this.rolesList.store.length<1);
this.updateMoveButtons();
this.rolesList.scroller && this.rolesList.scroller.update();
},
updateMoveButtons: function() {
var rec = this.rolesList.getSelectedRec(),
index = rec ? this.rolesList.store.indexOf(rec) : -1;
this.btnUp.setDisabled(index<1);
this.btnDown.setDisabled(index<0 || index==this.rolesList.store.length-1);
},
hide: function () {
Common.UI.Window.prototype.hide.call(this);
},
close: function () {
this.api.asc_unregisterCallback('asc_onUpdateOFormRoles', this.wrapEvents.onRefreshRolesList);
Common.UI.Window.prototype.close.call(this);
},
onKeyDown: function (lisvView, record, e) {
if (e.keyCode==Common.UI.Keys.DELETE && !this.btnDeleteRole.isDisabled())
this.onDeleteRole();
},
onDblClickItem: function (lisvView, record, e) {
if (!this.btnEditRole.isDisabled())
this.onEditRole(true);
},
txtTitle: 'Manage Roles',
closeButtonText : 'Close',
textNew: 'New',
textEdit: 'Edit',
textDelete: 'Delete',
textEmpty: 'No roles have been created yet.<br>Create at least one role and it will appear in this field.',
warnDelete: 'Are you sure you want to delete the role {0}?',
warnCantDelete: 'You cannot delete this role because it has associated fields.',
textUp: 'Move role up',
textDown: 'Move role down',
textDescription: 'Add roles and set the order in which the fillers receive and sign the document',
textAnyone: 'Anyone'
}, DE.Views.RolesManagerDlg || {}));
});

View file

@ -0,0 +1,162 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2022
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
*
* SaveFormDlg.js
*
* Created by Julia.Radzhabova on 12.04.22
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
*
*/
define([ 'common/main/lib/view/AdvancedSettingsWindow',
'common/main/lib/component/ListView',
'documenteditor/main/app/view/RoleEditDlg',
'documenteditor/main/app/view/RoleDeleteDlg'
], function (contentTemplate) {
'use strict';
DE.Views = DE.Views || {};
DE.Views.SaveFormDlg = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: {
alias: 'SaveFormDlg',
contentWidth: 320,
height: 280,
buttons: null
},
initialize: function (options) {
var me = this;
_.extend(this.options, {
title: this.txtTitle,
template: [
'<div class="box" style="height:' + (this.options.height-85) + 'px;">',
'<div class="content-panel" style="padding: 0;">',
'<div class="settings-panel active">',
'<div class="inner-content">',
'<table style="width: 100%;">',
'<tr>',
'<td class="padding-small">',
'<label>' + this.textDescription + '</label>',
'</td>',
'</tr>',
'<tr>',
'<td>',
'<label>' + this.textFill + '</label>',
'</td>',
'</tr>',
'<tr>',
'<td>',
'<div id="save-form-roles-list" class="roles-tableview no-borders" style="width:100%; height: 116px;"></div>',
'</td>',
'</tr>',
'</table>',
'</div>',
'</div>',
'</div>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="width: 86px;">' + this.saveButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">' + this.cancelButtonText + '</button>',
'</div>'
].join('')
}, options);
this.handler = options.handler;
this.roles = options.roles;
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
},
render: function () {
Common.Views.AdvancedSettingsWindow.prototype.render.call(this);
var me = this;
this.rolesList = new Common.UI.ListView({
el: $('#save-form-roles-list', this.$window),
store: new Common.UI.DataViewStore(),
simpleAddMode: true,
handleSelect: false,
enableKeyEvents: false,
showLast: false,
emptyText: this.textEmpty,
itemTemplate: _.template([
'<div id="<%= id %>" class="list-item" style="border-color: transparent;">',
'<div class="listitem-icon"><svg class=""><use xlink:href="#svg-icon-<%= scope.getIconCls(index) %>"></use></svg></div>',
'<div style="flex-grow: 1;padding-right: 5px;"><%= Common.Utils.String.htmlEncode(name) %></div>',
'</div>'
].join(''))
});
this.afterRender();
},
afterRender: function() {
this.refreshRolesList(this.roles);
},
refreshRolesList: function(roles, selectedItem) {
if (roles) {
this.roles = roles;
var arr = [];
var me = this;
for (var i=0; i<this.roles.length; i++) {
var role = roles[i].asc_getSettings(),
fields = role.asc_getFieldCount();
(fields>0) && arr.push({
name: role.asc_getName() || me.textAnyone,
color: role.asc_getColor(),
fields: fields,
index: i,
scope: this
});
}
this.rolesList.store.reset(arr);
}
},
getIconCls: function(index) {
if (this.rolesList.store.length===1)
return 'Point';
return (index===0) ? 'StartPoint' : (index===this.rolesList.store.length-1 ? 'EndPoint' : 'MiddlePoint');
},
txtTitle: 'Save as Form',
saveButtonText : 'Save',
textEmpty: 'There are no roles associated with fields.',
textDescription: 'When saving to the oform, only roles with fields are added to the filling list',
textFill: 'Filling list',
textAnyone: 'Anyone'
}, DE.Views.SaveFormDlg || {}));
});

View file

@ -810,7 +810,8 @@ define([
var spectype = control_props.get_SpecificType();
control_props = (spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.ComboBox ||
spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.None ||
spectype==Asc.c_oAscContentControlSpecificType.Picture || spectype==Asc.c_oAscContentControlSpecificType.Complex) &&
spectype==Asc.c_oAscContentControlSpecificType.Picture || spectype==Asc.c_oAscContentControlSpecificType.Complex ||
spectype==Asc.c_oAscContentControlSpecificType.DateTime) &&
control_props.get_FormPr() && control_props.get_FormPr().get_Fixed();
} else
control_props = false;

View file

@ -116,6 +116,7 @@ define([
noObjectSelected: 'no-object',
lostConnect: 'disconnect',
disableOnStart: 'on-start',
formsNoRoles: 'no-roles',
complexForm: 'complex-form'
};
for (var key in enumLock) {

View file

@ -332,6 +332,7 @@
<img class="inline-svg" src="../../common/main/resources/img/toolbar/shapetypes.svg">
<img class="inline-svg" src="../../common/main/resources/img/toolbar/charttypes.svg">
<img class="inline-svg" src="../../common/main/resources/img/toolbar/equationicons.svg">
<img class="inline-svg" src="resources/img/form-points.svg">
<script>
var svgpoints = document.querySelectorAll('img.inline-svg');
SVGInjector(svgpoints);

View file

@ -322,6 +322,7 @@
<inline src="../../common/main/resources/img/toolbar/shapetypes.svg" />
<inline src="../../common/main/resources/img/toolbar/charttypes.svg" />
<inline src="../../common/main/resources/img/toolbar/equationicons.svg" />
<inline src="resources/img/form-points.svg" />
<script src="../../../../../../sdkjs/common/device_scale.js?__inline=true"></script>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>

View file

@ -272,6 +272,7 @@
<img class="inline-svg" src="../../common/main/resources/img/toolbar/shapetypes.svg">
<img class="inline-svg" src="../../common/main/resources/img/toolbar/charttypes.svg">
<img class="inline-svg" src="../../common/main/resources/img/toolbar/equationicons.svg">
<img class="inline-svg" src="resources/img/form-points.svg">
<script>
var svgpoints = document.querySelectorAll('img.inline-svg');
SVGInjector(svgpoints);

View file

@ -321,7 +321,7 @@
<inline src="../../common/main/resources/img/toolbar/shapetypes.svg" />
<inline src="../../common/main/resources/img/toolbar/charttypes.svg" />
<inline src="../../common/main/resources/img/toolbar/equationicons.svg" />
<inline src="resources/img/form-points.svg" />
<div id="viewport"></div>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>

View file

@ -2108,6 +2108,17 @@
"DE.Views.FormSettings.textUnlock": "Unlock",
"DE.Views.FormSettings.textValue": "Value Options",
"DE.Views.FormSettings.textWidth": "Cell width",
"DE.Views.FormSettings.textAnyone": "Anyone",
"DE.Views.FormSettings.textPhone1": "Phone Number (e.g. (123) 456-7890)",
"DE.Views.FormSettings.textPhone2": "Phone Number (e.g. +447911123456)",
"DE.Views.FormSettings.textZipCodeUS": "US Zip Code (e.g. 92663 or 92663-1234)",
"DE.Views.FormSettings.textUSSSN": "US SSN (e.g. 123-45-6789)",
"DE.Views.FormSettings.textUKPassport": "UK Passport Number (e.g. 925665416)",
"DE.Views.FormSettings.textCreditCard": "Credit Card Number (e.g 4111-1111-1111-1111)",
"DE.Views.FormSettings.textDateField": "Date & Time Field",
"DE.Views.FormSettings.textDateFormat": "Display the date like this",
"DE.Views.FormSettings.textLang": "Language",
"DE.Views.FormSettings.textFillRoles": "Who needs to fill this out?",
"DE.Views.FormsTab.capBtnCheckBox": "Checkbox",
"DE.Views.FormsTab.capBtnComboBox": "Combo Box",
"DE.Views.FormsTab.capBtnComplex": "Complex Field",
@ -2147,6 +2158,19 @@
"DE.Views.FormsTab.tipTextField": "Insert text field",
"DE.Views.FormsTab.tipViewForm": "View form",
"DE.Views.FormsTab.txtUntitled": "Untitled",
"DE.Views.FormsTab.textAnyone": "Anyone",
"DE.Views.FormsTab.txtInlineText": "Inline",
"DE.Views.FormsTab.txtInlineDesc": "Insert inline text field",
"DE.Views.FormsTab.txtFixedText": "Fixed",
"DE.Views.FormsTab.txtFixedDesc": "Insert fixed text field",
"DE.Views.FormsTab.tipInlineText": "Insert inline text field",
"DE.Views.FormsTab.tipFixedText": "Insert fixed text field",
"DE.Views.FormsTab.capZipCode": "Zip Code",
"DE.Views.FormsTab.capCreditCard": "Credit Card",
"DE.Views.FormsTab.tipZipCode": "Insert zip code",
"DE.Views.FormsTab.tipCreditCard": "Insert credit card number",
"DE.Views.FormsTab.capDateTime": "Date & Time",
"DE.Views.FormsTab.tipDateTime": "Insert date and time",
"DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom center",
"DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left",
"DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of Page",
@ -2650,6 +2674,35 @@
"DE.Views.RightMenu.txtSignatureSettings": "Signature settings",
"DE.Views.RightMenu.txtTableSettings": "Table settings",
"DE.Views.RightMenu.txtTextArtSettings": "Text Art settings",
"DE.Views.RoleDeleteDlg.textTitle": "Delete Role",
"DE.Views.RoleDeleteDlg.textLabel": "To delete this role, you need to move the fields associated with it to another role.",
"DE.Views.RoleDeleteDlg.textSelect": "Select for field merger role",
"DE.Views.RoleEditDlg.txtTitleEdit": "Edit Role",
"DE.Views.RoleEditDlg.txtTitleNew": "Create New Role",
"DE.Views.RoleEditDlg.textName": "Role name",
"DE.Views.RoleEditDlg.textEmptyError": "Role name must not be empty.",
"DE.Views.RoleEditDlg.textNoHighlight": "No highlighting",
"DE.Views.RoleEditDlg.errNameExists": "Role with such a name already exists.",
"DE.Views.RoleEditDlg.capBtnManager": "Manage Roles",
"DE.Views.RoleEditDlg.tipManager": "Manage Roles",
"DE.Views.RolesManagerDlg.txtTitle": "Manage Roles",
"DE.Views.RolesManagerDlg.closeButtonText ": "Close",
"DE.Views.RolesManagerDlg.textNew": "New",
"DE.Views.RolesManagerDlg.textEdit": "Edit",
"DE.Views.RolesManagerDlg.textDelete": "Delete",
"DE.Views.RolesManagerDlg.textEmpty": "No roles have been created yet.<br>Create at least one role and it will appear in this field.",
"DE.Views.RolesManagerDlg.warnDelete": "Are you sure you want to delete the role {0}?",
"DE.Views.RolesManagerDlg.warnCantDelete": "You cannot delete this role because it has associated fields.",
"DE.Views.RolesManagerDlg.textUp": "Move role up",
"DE.Views.RolesManagerDlg.textDown": "Move role down",
"DE.Views.RolesManagerDlg.textDescription": "Add roles and set the order in which the fillers receive and sign the document",
"DE.Views.RolesManagerDlg.textAnyone": "Anyone",
"DE.Views.SaveFormDlg.txtTitle": "Save as Form",
"DE.Views.SaveFormDlg.saveButtonText": "Save",
"DE.Views.SaveFormDlg.textEmpty": "There are no roles associated with fields.",
"DE.Views.SaveFormDlg.textDescription": "When saving to the oform, only roles with fields are added to the filling list",
"DE.Views.SaveFormDlg.textFill": "Filling list",
"DE.Views.SaveFormDlg.textAnyone": "Anyone",
"DE.Views.ShapeSettings.strBackground": "Background color",
"DE.Views.ShapeSettings.strChange": "Change Autoshape",
"DE.Views.ShapeSettings.strColor": "Color",

View file

@ -0,0 +1,22 @@
<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<symbol id="svg-icon-Point" viewBox="0 0 20 28">
<g id="Point">
<path id="Ellipse 121 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M9.5 17C10.8807 17 12 15.8807 12 14.5C12 13.1193 10.8807 12 9.5 12C8.11929 12 7 13.1193 7 14.5C7 15.8807 8.11929 17 9.5 17ZM9.5 18C11.433 18 13 16.433 13 14.5C13 12.567 11.433 11 9.5 11C7.567 11 6 12.567 6 14.5C6 16.433 7.567 18 9.5 18Z"/>
</g>
</symbol>
<symbol id="svg-icon-StartPoint" viewBox="20 0 20 28">
<g id="StartPoint">
<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M32 14.5C32 15.8807 30.8807 17 29.5 17C28.1193 17 27 15.8807 27 14.5C27 13.1193 28.1193 12 29.5 12C30.8807 12 32 13.1193 32 14.5ZM33 14.5C33 16.433 31.433 18 29.5 18C27.567 18 26 16.433 26 14.5C26 12.567 27.567 11 29.5 11C31.433 11 33 12.567 33 14.5ZM29.5 18H30V20H29V18H29.5ZM30 22V24H29V22H30ZM30 28V26H29V28H30Z"/>
</g>
</symbol>
<symbol id="svg-icon-MiddlePoint" viewBox="40 0 20 28">
<g id="MiddlePoint">
<path id="Union_2" fill-rule="evenodd" clip-rule="evenodd" d="M49 2H50V4H49V2ZM49.5 17C50.8807 17 52 15.8807 52 14.5C52 13.1193 50.8807 12 49.5 12C48.1193 12 47 13.1193 47 14.5C47 15.8807 48.1193 17 49.5 17ZM49.5 18C51.433 18 53 16.433 53 14.5C53 12.567 51.433 11 49.5 11H50V10H49V11H49.5C47.567 11 46 12.567 46 14.5C46 16.433 47.567 18 49.5 18ZM49.5 18H49V20H50V18H49.5ZM50 6H49V8H50V6ZM50 22V24H49V22H50ZM50 28V26H49V28H50Z"/>
</g>
</symbol>
<symbol id="svg-icon-EndPoint" viewBox="60 0 20 28">
<g id="EndPoint">
<path id="Union_3" fill-rule="evenodd" clip-rule="evenodd" d="M70 2H69V4H70V2ZM72 14.5C72 15.8807 70.8807 17 69.5 17C68.1193 17 67 15.8807 67 14.5C67 13.1193 68.1193 12 69.5 12C70.8807 12 72 13.1193 72 14.5ZM73 14.5C73 16.433 71.433 18 69.5 18C67.567 18 66 16.433 66 14.5C66 12.567 67.567 11 69.5 11C71.433 11 73 12.567 73 14.5ZM69.5 11H69V10H70V11H69.5ZM69 6H70V8H69V6Z"/>
</g>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

View file

@ -73,3 +73,59 @@
display: inline-block;
vertical-align: middle;
}
.advanced-settings-dlg {
.roles-tableview {
&.no-borders > .listview .item {
border-width: 0 !important;
}
.item {
padding: 0 6px;
}
@item-width: 20px;
@item-height: 28px;
.list-item {
display: flex;
align-items: center;
height: @item-height;
span.color {
display: block;
width: 12px;
height: 12px;
border: @scaled-one-px-value-ie solid @border-color-shading-ie;
border: @scaled-one-px-value solid @border-color-shading;
}
}
.list-item > div{
vertical-align: middle;
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
white-space: pre;
}
.listitem-icon {
width: @item-width;
height: @item-height;
margin-right: 5px;
svg {
width: @item-width;
height: @item-height;
fill: @text-normal-ie;
fill: @text-normal;
}
}
.selected {
.listitem-icon {
svg {
fill: @text-normal-pressed-ie;
fill: @text-normal-pressed;
}
}
}
}
}

View file

@ -205,3 +205,16 @@
}
}
}
.dropdown-menu.menu-roles,
.input-group-nr.menu-roles {
span.color {
display: inline-block;
vertical-align: text-top;
width: 12px;
height: 12px;
margin: 0 8px 0 2px;
border: @scaled-one-px-value-ie solid @border-color-shading-ie;
border: @scaled-one-px-value solid @border-color-shading;
}
}

View file

@ -7,6 +7,29 @@
white-space: nowrap;
}
.header-sorted {
label, div, span {
display: inline-block;
cursor: pointer;
}
.caret {
width: 4px;
height: 4px;
border: solid 1px @icon-normal-ie;
border: solid 1px @icon-normal;
border-bottom: none;
border-right: none;
background-image: none;
transition: transform 0.2s ease;
transform: rotate(-135deg) translate(1px,1px);
&.sort-desc {
transform: rotate(45deg);
}
}
}
.range-tableview {
.list-item > div{
vertical-align: middle;
@ -42,29 +65,6 @@
text-align: center;
}
}
.header-sorted {
label, div, span {
display: inline-block;
cursor: pointer;
}
.caret {
width: 4px;
height: 4px;
border: solid 1px @icon-normal-ie;
border: solid 1px @icon-normal;
border-bottom: none;
border-right: none;
background-image: none;
transition: transform 0.2s ease;
transform: rotate(-135deg) translate(1px,1px);
&.sort-desc {
transform: rotate(45deg);
}
}
}
}
#sort-dialog-btn-down {