| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- ClientConfig.window.Setting = function(config) {
- config = config || {};
- config.id = config.id || Ext.id(),
- Ext.applyIf(config,{
- title: (config.isUpdate) ?
- _('clientconfig.update_setting') :
- (config.isDuplicate) ? _('clientconfig.duplicate_setting') : _('clientconfig.add_setting'),
- autoHeight: true,
- url: ClientConfig.config.connectorUrl,
- baseParams: {
- action: (config.isUpdate) ?
- 'mgr/settings/update' :
- 'mgr/settings/create'
- },
- width: 750,
- fields: [{
- xtype: 'hidden',
- name: 'id'
- },{
- layout: 'column',
- items: [{
- columnWidth: 0.5,
- layout: 'form',
- items: [{
- xtype: 'textfield',
- name: 'key',
- fieldLabel: _('clientconfig.key') + '*',
- allowBlank: false,
- anchor: '100%'
- },{
- xtype: 'textfield',
- name: 'label',
- fieldLabel: _('clientconfig.label') + '*',
- allowBlank: false,
- anchor: '100%'
- },{
- xtype: 'textarea',
- name: 'description',
- fieldLabel: _('clientconfig.description'),
- anchor: '100%'
- },{
- xtype: 'clientconfig-combo-groups',
- name: 'group',
- fieldLabel: _('clientconfig.group'),
- anchor: '100%',
- autoLoad: true,
- storeLoadListener: function(store, data, request) {
- if (this.getValue() < 1) {
- this.setValue(store.getAt(0).get(this.valueField));
- }
- return true;
- }
- },{
- xtype: 'numberfield',
- name: 'sortorder',
- fieldLabel: _('clientconfig.sortorder'),
- allowBlank: false,
- minValue: 0,
- maxValue: 9999999999,
- anchor: '100%',
- value: 0
- }]
- },{
- columnWidth: 0.5,
- layout: 'form',
- items: [{
- xtype: 'clientconfig-combo-fieldtypes',
- name: 'xtype',
- fieldLabel: _('clientconfig.xtype') + '*',
- allowBlank: false,
- anchor: '100%',
- listeners: {
- select: {fn: function(field, record) {
- if (record.data.xtype == 'modx-combo') {
- Ext.getCmp(config.id + '-options').show();
- Ext.getCmp(config.id + '-process_options').show();
- } else {
- Ext.getCmp(config.id + '-options').hide();
- Ext.getCmp(config.id + '-process_options').hide();
- }
- if (['modx-panel-tv-image', 'modx-panel-tv-file'].indexOf(record.data.xtype) !== -1) {
- Ext.getCmp(config.id + '-source').show();
- } else {
- Ext.getCmp(config.id + '-source').hide();
- }
- }, scope: this}
- }
- },{
- xtype: (config.record && config.record.xtype && ['textarea', 'richtext'].indexOf(config.record.xtype) !== -1) ? 'textarea' : 'textfield',
- name: 'value',
- fieldLabel: _('clientconfig.value'),
- anchor: '100%'
- },{
- xtype: 'textarea',
- id: config.id + '-options',
- name: 'options',
- fieldLabel: _('clientconfig.options'),
- description: _('clientconfig.options.desc'),
- anchor: '100%',
- hidden: (config.record && (config.record.xtype === 'modx-combo')) ? false : true
- },{
- xtype: 'checkbox',
- id: config.id + '-process_options',
- name: 'process_options',
- boxLabel: _('clientconfig.process_options'),
- anchor: '100%'
- },{
- xtype: 'modx-combo-source',
- id: config.id + '-source',
- name: 'source',
- fieldLabel: _('clientconfig.source'),
- description: _('clientconfig.source.desc'),
- anchor: '100%',
- hidden: (config.record && (['modx-panel-tv-image', 'modx-panel-tv-file'].indexOf(config.record.xtype) !== -1)) ? false : true,
- hideMode: 'offsets',
- value: 0
- },{
- xtype: 'checkbox',
- name: 'is_required',
- boxLabel: _('clientconfig.is_required.long'),
- anchor: '100%'
- }]
- }]
- }],
- keys: [] //prevent enter in textarea from firing submit
- });
- ClientConfig.window.Setting.superclass.constructor.call(this,config);
- };
- Ext.extend(ClientConfig.window.Setting,MODx.Window);
- Ext.reg('clientconfig-window-setting',ClientConfig.window.Setting);
|