[DE] Change Forms tab and Roles manager according to layout

This commit is contained in:
Julia Radzhabova 2022-04-13 22:35:41 +03:00
parent 83e856d259
commit 726c0fe6ef
6 changed files with 255 additions and 183 deletions

View file

@ -52,4 +52,41 @@
padding-right: 30px;
}
}
.range-tableview {
.list-item > div{
vertical-align: middle;
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
white-space: pre;
}
.listitem-icon {
width: 20px;
height: 20px;
vertical-align: middle;
margin-right: 5px;
}
.selected {
.listitem-icon {
background-position-x: -20px;
background-position-x: @button-small-active-icon-offset-x;
}
}
.lock-user {
position: absolute;
right: 2px;
min-width: 100px;
max-width: 150px;
height: 20px;
padding: 2px 10px;
background-color: #EE3525;
color: #fff;
text-align: center;
}
}
}

View file

@ -41,7 +41,8 @@
define([
'core',
'documenteditor/main/app/view/FormsTab'
'documenteditor/main/app/view/FormsTab',
'documenteditor/main/app/view/RolesManagerDlg'
], function () {
'use strict';
@ -66,7 +67,7 @@ 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));
@ -90,12 +91,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
@ -195,6 +197,7 @@ define([
onModeClick: function(state) {
if (this.api) {
this.disableEditing(state);
this.view && this.view.setPreviewMode(state);
this.api.asc_setRestriction(state ? Asc.c_oAscRestrictionType.OnlyForms : Asc.c_oAscRestrictionType.None);
this.api.asc_SetPerformContentControlActionByClick(state);
this.api.asc_SetHighlightRequiredFields(state);
@ -412,6 +415,20 @@ define([
}
},
onManagerClick: function() {
var me = this;
(new DE.Views.RolesManagerDlg({
api: me.api,
handler: function(result) {
Common.component.Analytics.trackEvent('ToolBar', 'Roles Manager');
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
},
roles: [],
props : undefined
})).on('close', function(win){
}).show();
},
onActiveTab: function(tab) {
if (tab !== 'forms') {
this.tipSaveForm && this.tipSaveForm.close();

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="range-tableview" 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

@ -49,7 +49,7 @@ define([
DE.Views.FormsTab = Common.UI.BaseView.extend(_.extend((function(){
var template =
'<section class="panel" data-tab="forms">' +
'<div class="group" style="display: none;">' +
'<div class="group forms" style="display: none;">' +
'<span class="btn-slot text x-huge" id="slot-btn-form-field"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-combobox"></span>' +
'<span class="btn-slot text x-huge" id="slot-btn-form-dropdown"></span>' +
@ -58,22 +58,15 @@ define([
'<span class="btn-slot text x-huge" id="slot-btn-form-image"></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>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-form-highlight"></span>' +
'</div>' +
'<div class="group forms" style="display: none;">' +
'<span class="btn-slot text x-huge" id="slot-btn-manager"></span>' +
'</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" style="display: none;"></div>' +
'<div class="group no-group-mask" style="">' +
'<span class="btn-slot text x-huge" id="slot-btn-form-view"></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>' +
@ -102,8 +95,8 @@ define([
this.btnViewForm && this.btnViewForm.on('click', function (b, e) {
me.fireEvent('forms:mode', [b.pressed]);
});
this.btnClearFields && this.btnClearFields.on('click', function (b, e) {
me.fireEvent('forms:clear');
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');
@ -145,11 +138,7 @@ define([
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 {
this.btnTextField = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
@ -217,6 +206,18 @@ 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],
caption: this.capBtnManager,
enableToggle: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnManager);
this.btnViewForm = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-sheet-view',
@ -229,48 +230,48 @@ define([
});
this.paragraphControls.push(this.btnViewForm);
this.btnClearFields = new Common.UI.Button({
cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-clearstyle',
lock: [ _set.previewReviewMode, _set.lostConnect, _set.disableOnStart],
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],
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'
],
paletteHeight: 94,
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'
// ],
// paletteHeight: 94,
// dataHint: '1',
// dataHintDirection: 'left',
// dataHintOffset: 'small'
// });
// this.paragraphControls.push(this.btnHighlight);
}
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],
caption: this.capBtnPrev,
visible: false,
// disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode
dataHint: '1',
dataHintDirection: 'bottom',
@ -283,6 +284,7 @@ define([
iconCls: 'toolbar__icon next-field',
lock: [ _set.previewReviewMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnNext,
visible: false,
// disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
dataHint: '1',
dataHintDirection: 'bottom',
@ -333,15 +335,15 @@ 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();
// }
me.btnTextField.updateHint(me.tipTextField);
me.btnComboBox.updateHint(me.tipComboBox);
@ -350,9 +352,9 @@ define([
me.btnRadioBox.updateHint(me.tipRadioBox);
me.btnImageField.updateHint(me.tipImageField);
me.btnViewForm.updateHint(me.tipViewForm);
} else {
me.btnClear.updateHint(me.textClearFields);
me.btnManager.updateHint(me.tipManager);
}
me.btnClear.updateHint(me.textClearFields);
me.btnPrevForm.updateHint(me.tipPrevForm);
me.btnNextForm.updateHint(me.tipNextForm);
me.btnSubmit && me.btnSubmit.updateHint(me.tipSubmit);
@ -370,8 +372,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'));
@ -380,14 +380,12 @@ define([
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.btnManager.render($host.find('#slot-btn-manager'));
// this.btnHighlight.render($host.find('#slot-form-highlight'));
var separator_forms = $host.find('.separator.forms');
separator_forms.prev('.group').show();
separator_forms.show().next('.group').show();
$host.find('.separator.submit').show().next('.group').show();
$host.find('.forms').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'));
@ -403,6 +401,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) {
@ -442,7 +448,9 @@ define([
tipSaveForm: 'Save a file as a fillable OFORM document',
txtUntitled: 'Untitled',
textCreateForm: 'Add fields and create a fillable OFORM document',
textGotIt: 'Got it'
textGotIt: 'Got it',
capBtnManager: 'Manage Roles',
tipManager: 'Manage Roles'
}
}()), DE.Views.FormsTab || {}));
});

View file

@ -41,7 +41,8 @@
define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
'common/main/lib/view/AdvancedSettingsWindow',
'common/main/lib/component/ListView'
'common/main/lib/component/ListView',
// 'documenteditor/main/app/view/RoleEditDlg'
], function (contentTemplate) {
'use strict';
@ -73,6 +74,7 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
this.api = options.api;
this.handler = options.handler;
this.props = options.props;
this.roles = options.roles;
this.rolesStore = new Common.UI.DataViewStore();
@ -87,9 +89,8 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
var me = this;
this.rolesList = new Common.UI.ListView({
el: $('#name-manager-range-list', this.$window),
el: $('#roles-manager-roles-list', this.$window),
store: new Common.UI.DataViewStore(),
simpleAddMode: true,
emptyText: this.textEmpty,
itemTemplate: _.template([
'<div id="<%= id %>" class="list-item" style="width: 100%;display:inline-block;<% if (!lock) { %>pointer-events:none;<% } %>">',
@ -116,25 +117,41 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
.on('entervalue', _.bind(this.onDblClickItem, this));
this.btnNewRole = new Common.UI.Button({
el: $('#name-manager-btn-new')
el: $('#roles-manager-btn-new', this.$window)
});
this.btnNewRole.on('click', _.bind(this.onEditRole, this, false));
this.btnEditRole = new Common.UI.Button({
el: $('#name-manager-btn-edit')
el: $('#roles-manager-btn-edit', this.$window)
});
this.btnEditRole.on('click', _.bind(this.onEditRole, this, true));
this.btnDeleteRole = new Common.UI.Button({
el: $('#name-manager-btn-delete')
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.rolesList, this.btnNewRole, this.btnEditRole, this.btnDeleteRole ];
return [ this.btnUp, this.btnDown, this.rolesList, this.btnNewRole, this.btnEditRole, this.btnDeleteRole ];
},
getDefaultFocusableComponent: function () {
@ -151,7 +168,7 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
},
onRefreshRolesList: function(roles) {
this.refreshRangeList(roles);
this.refreshRolesList(roles);
},
refreshRolesList: function(roles, selectedItem) {
@ -164,65 +181,46 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
type = this.roles[i].asc_getType();
arr.push({
name: this.roles[i].asc_getName(true),
lock: (id!==null && id!==undefined),
lockuser: (id) ? (this.isUserVisible(id) ? this.getUserName(id) : this.lockText) : this.guestText,
type: type,
isTable: type===Asc.c_oAscDefNameType.table,
isSlicer: type===Asc.c_oAscDefNameType.slicer
});
}
this.rolesStore.reset(arr);
this.rolesList.setEmptyText((this.rolesStore.length>0) ? this.textnoNames : this.textEmpty);
}
var me = this,
store = this.rolesList.store,
models = this.rolesStore.models,
val = this.cmbFilter.getValue(),
isTableFilter = (val<3) ? (val==2) : -1,
isWorkbook = (val>2) ? (val==4) : -1;
if (val>0)
models = this.rolesStore.filter(function(item) {
if (isTableFilter!==-1)
return (isTableFilter===item.get('isTable'));
if (isWorkbook!==-1)
return (isWorkbook===(item.get('scope')===null));
return false;
});
store.reset(models, {silent: false});
val = store.length;
val = store.length;
this.btnEditRole.setDisabled(!val);
this.btnDeleteRole.setDisabled(!val);
if (val>0) {
if (selectedItem===undefined || selectedItem===null) selectedItem = 0;
if (_.isNumber(selectedItem)) {
if (selectedItem>val-1) selectedItem = val-1;
this.rangeList.selectByIndex(selectedItem);
this.rolesList.selectByIndex(selectedItem);
setTimeout(function() {
me.rangeList.scrollToRecord(store.at(selectedItem));
me.rolesList.scrollToRecord(store.at(selectedItem));
}, 50);
} else if (selectedItem){ // object
var rec = store.findWhere({name: selectedItem.asc_getName(true), scope: selectedItem.asc_getScope()});
if (rec) {
this.rangeList.selectRecord(rec);
this.rolesList.selectRecord(rec);
setTimeout(function() {
me.rangeList.scrollToRecord(rec);
me.rolesList.scrollToRecord(rec);
}, 50);
}
}
if (this.userTooltip===true && this.rangeList.cmpEl.find('.lock-user').length>0)
this.rangeList.cmpEl.on('mouseover', _.bind(me.onMouseOverLock, me)).on('mouseout', _.bind(me.onMouseOutLock, me));
}
_.delay(function () {
me.rangeList.scroller.update({alwaysVisibleY: true});
me.rolesList.scroller.update({alwaysVisibleY: true});
}, 100, this);
this.updateButtons();
},
onEditRange: function (isEdit) {
onEditRole: function (isEdit) {
if (this._isWarningVisible) return;
if (this.locked) {
@ -231,24 +229,19 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
}
var me = this,
xy = me.$window.offset(),
rec = this.rangeList.getSelectedRec(),
idx = _.indexOf(this.rangeList.store.models, rec),
oldname = (isEdit && rec) ? new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('type'), undefined, undefined, undefined, true) : null;
rec = this.rolesList.getSelectedRec(),
props = (isEdit && rec) ? {name: rec.get('name'), color: rec.get('color')} : null;
var win = new SSE.Views.NamedRangeEditDlg({
var win = new DE.Views.RoleEditDlg({
api: me.api,
sheets : this.sheets,
props : (isEdit) ? oldname : this.props,
props : props,
isEdit : isEdit,
handler : function(result, settings) {
if (result == 'ok' && settings) {
if (isEdit) {
me.currentNamedRange = settings;
me.api.asc_editDefinedNames(oldname, settings);
me.api.asc_editRole(settings);
} else {
me.cmbFilter.setValue(0);
me.currentNamedRange = settings;
me.api.asc_setDefinedNames(settings);
me.api.asc_addRole(settings);
}
}
}
@ -259,10 +252,11 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
me.hide();
win.show(xy.left + 65, xy.top + 77);
this.updateButtons();
},
onDeleteRange: function () {
var rec = this.rangeList.getSelectedRec();
onDeleteRole: function () {
var rec = this.rolesList.getSelectedRec();
if (rec) {
var me = this;
me._isWarningVisible = true;
@ -271,14 +265,14 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
buttons: ['ok', 'cancel'],
callback: function(btn) {
if (btn == 'ok') {
me.currentNamedRange = _.indexOf(me.rangeList.store.models, rec);
me.api.asc_delDefinedNames(new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('type'), undefined, undefined, undefined, true));
me.api.asc_delRole(rec.get('name'));
}
setTimeout(function(){ me.getDefaultFocusableComponent().focus(); }, 100);
me._isWarningVisible = false;
}
});
}
this.updateButtons();
},
getSettings: function() {
@ -297,29 +291,51 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
onSelectRoleItem: function(lisvView, itemView, record) {
if (!record) return;
this.userTipHide();
var rawData = {},
isViewSelect = _.isFunction(record.toJSON);
// var rawData = {},
// isViewSelect = _.isFunction(record.toJSON);
//
// if (isViewSelect){
// if (record.get('selected')) {
// rawData = record.toJSON();
// } else {// record deselected
// return;
// }
// }
this.updateMoveButtons();
},
if (isViewSelect){
if (record.get('selected')) {
rawData = record.toJSON();
} else {// record deselected
return;
}
this.currentNamedRange = _.indexOf(this.rangeList.store.models, record);
this.btnEditRange.setDisabled(rawData.lock);
this.btnDeleteRange.setDisabled(rawData.lock || rawData.isTable || rawData.isSlicer);
onMoveClick: function(up) {
var store = this.rolesList.store,
length = store.length,
rec = this.rolesList.getSelectedRec();
if (rec) {
var index = store.indexOf(rec);
store.add(store.remove(rec), {at: up ? Math.max(0, index-1) : Math.min(length-1, index+1)});
this.rolesList.selectRecord(rec);
this.rolesList.scrollToRecord(rec);
}
this.updateMoveButtons();
},
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 () {
this.userTipHide();
Common.UI.Window.prototype.hide.call(this);
},
close: function () {
this.userTipHide();
this.api.asc_unregisterCallback('asc_onRefreshRolesList', this.wrapEvents.onRefreshRolesList);
Common.UI.Window.prototype.close.call(this);
@ -340,8 +356,11 @@ define([ 'text!documenteditor/main/app/template/RolesManagerDlg.template',
textNew: 'New',
textEdit: 'Edit',
textDelete: 'Delete',
textEmpty: 'No named ranges have been created yet.<br>Create at least one named range and it will appear in this field.',
warnDelete: 'Are you sure you want to delete the role {0}?'
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}?',
textUp: 'Move role up',
textDown: 'Move role down',
textDescription: 'Add roles and set the order in which the fillers receive and sign the document'
}, DE.Views.RolesManagerDlg || {}));
});

View file

@ -37,42 +37,6 @@
white-space: nowrap;
}
.range-tableview {
.list-item > div{
vertical-align: middle;
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
white-space: pre;
}
.listitem-icon {
width: 20px;
height: 20px;
vertical-align: middle;
margin-right: 5px;
}
.selected {
.listitem-icon {
background-position-x: -20px;
background-position-x: @button-small-active-icon-offset-x;
}
}
.lock-user {
position: absolute;
right: 2px;
min-width: 100px;
max-width: 150px;
height: 20px;
padding: 2px 10px;
background-color: #EE3525;
color: #fff;
text-align: center;
}
}
.header-sorted {
label, div, span {
display: inline-block;