read only param
This commit is contained in:
@@ -146,7 +146,8 @@
|
||||
"dynamicLogicReadOnly": "Conditions making field read-only",
|
||||
"dynamicLogicRequired": "Conditions making field required",
|
||||
"dynamicLogicOptions": "Conditional options",
|
||||
"probabilityMap": "Stage Probabilities (%)"
|
||||
"probabilityMap": "Stage Probabilities (%)",
|
||||
"readOnly": "Read-only"
|
||||
},
|
||||
"messages": {
|
||||
"upgradeVersion": "Your EspoCRM will be upgraded to version <strong>{version}</strong>. This can take some time.",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"lengthOfCut": "How long text can be before it will be cut.",
|
||||
"maxLength": "Max acceptable length of text.",
|
||||
"before": "The date value should be before the date value of the specified field.",
|
||||
"after": "The date value should be after the date value of the specified field."
|
||||
"after": "The date value should be after the date value of the specified field.",
|
||||
"readOnly": "Field value can't be specified by user. But can be calculated by formula."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"actualFields":[
|
||||
|
||||
@@ -51,6 +51,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -48,6 +48,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -48,6 +48,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"actualFields":[
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"actualFields":[
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
"type": "bool",
|
||||
"default": false,
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"actualFields":[
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"actualFields":[
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
"default": 400,
|
||||
"min": 1,
|
||||
"tooltip": true
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
{
|
||||
"name":"audited",
|
||||
"type":"bool"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
{
|
||||
"name": "minHeight",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"name":"readOnly",
|
||||
"type":"bool"
|
||||
}
|
||||
],
|
||||
"filter": true,
|
||||
|
||||
@@ -34,7 +34,7 @@ Espo.define('views/admin/field-manager/edit', ['view', 'model'], function (Dep,
|
||||
|
||||
entityTypeWithTranslatedOptionsList: ['enum', 'multiEnum', 'array', 'phone'],
|
||||
|
||||
paramWithTooltipList: ['audited', 'required', 'default', 'min', 'max', 'maxLength', 'after', 'before'],
|
||||
paramWithTooltipList: ['audited', 'required', 'default', 'min', 'max', 'maxLength', 'after', 'before', 'readOnly'],
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
@@ -91,6 +91,10 @@ Espo.define('views/admin/field-manager/edit', ['view', 'model'], function (Dep,
|
||||
this.model.set('type', this.type);
|
||||
}
|
||||
|
||||
this.listenTo(this.model, 'change:readOnly', function () {
|
||||
this.readOnlyControl();
|
||||
}, this);
|
||||
|
||||
this.getModelFactory().create(this.scope, function (model) {
|
||||
if (!this.isNew) {
|
||||
this.type = model.getFieldType(this.field);
|
||||
@@ -181,7 +185,6 @@ Espo.define('views/admin/field-manager/edit', ['view', 'model'], function (Dep,
|
||||
if (
|
||||
!this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'dynamicLogicRequiredDisabled'])
|
||||
&&
|
||||
!this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'readOnly'])&&
|
||||
!this.getMetadata().get(['fields', this.type, 'readOnly'])
|
||||
) {
|
||||
this.model.set('dynamicLogicRequired', this.getMetadata().get(['clientDefs', this.scope, 'dynamicLogic', 'fields', this.field, 'required']));
|
||||
@@ -194,8 +197,6 @@ Espo.define('views/admin/field-manager/edit', ['view', 'model'], function (Dep,
|
||||
if (
|
||||
!this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'dynamicLogicReadOnlyDisabled'])
|
||||
&&
|
||||
!this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'readOnly'])
|
||||
&&
|
||||
!this.getMetadata().get(['fields', this.type, 'readOnly'])
|
||||
) {
|
||||
this.model.set('dynamicLogicReadOnly', this.getMetadata().get(['clientDefs', this.scope, 'dynamicLogic', 'fields', this.field, 'readOnly']));
|
||||
@@ -210,8 +211,6 @@ Espo.define('views/admin/field-manager/edit', ['view', 'model'], function (Dep,
|
||||
~['enum', 'array', 'multiEnum'].indexOf(this.type)
|
||||
&&
|
||||
!this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'dynamicLogicOptionsDisabled'])
|
||||
&&
|
||||
!this.getMetadata().get(['entityDefs', this.scope, 'fields', this.field, 'readOnly'])
|
||||
) {
|
||||
this.model.set('dynamicLogicOptions', this.getMetadata().get(['clientDefs', this.scope, 'dynamicLogic', 'options', this.field]));
|
||||
this.createFieldView(null, 'dynamicLogicOptions', null, {
|
||||
@@ -260,6 +259,49 @@ Espo.define('views/admin/field-manager/edit', ['view', 'model'], function (Dep,
|
||||
}, this);
|
||||
},
|
||||
|
||||
readOnlyControl: function () {
|
||||
if (this.model.get('readOnly')) {
|
||||
this.hideField('dynamicLogicReadOnly');
|
||||
this.hideField('dynamicLogicRequired');
|
||||
this.hideField('dynamicLogicOptions');
|
||||
} else {
|
||||
this.showField('dynamicLogicReadOnly');
|
||||
this.showField('dynamicLogicRequired');
|
||||
this.showField('dynamicLogicOptions');
|
||||
}
|
||||
},
|
||||
|
||||
hideField: function (name) {
|
||||
var f = function () {
|
||||
var view = this.getView(name)
|
||||
console.log();
|
||||
if (view) {
|
||||
this.$el.find('.cell[data-name="'+name+'"]').addClass('hidden');
|
||||
view.setDisabled();
|
||||
}
|
||||
}.bind(this);
|
||||
if (this.isRendered()) {
|
||||
f();
|
||||
} else {
|
||||
this.once('after:render', f);
|
||||
}
|
||||
},
|
||||
|
||||
showField: function (name) {
|
||||
var f = function () {
|
||||
var view = this.getView(name)
|
||||
if (view) {
|
||||
this.$el.find('.cell[data-name="'+name+'"]').removeClass('hidden');
|
||||
view.setNotDisabled();
|
||||
}
|
||||
}.bind(this);
|
||||
if (this.isRendered()) {
|
||||
f();
|
||||
} else {
|
||||
this.once('after:render', f);
|
||||
}
|
||||
},
|
||||
|
||||
createFieldView: function (type, name, readOnly, params, options, callback) {
|
||||
var viewName = (params || {}).view || this.getFieldManager().getViewName(type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user