| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- /**
- * Loads a grid for managing languages.
- *
- * @class MODx.grid.Language
- * @extends MODx.grid.Grid
- * @param {Object} config An object of configuration properties
- * @xtype modx-grid-language
- */
- MODx.grid.Language = function(config) {
- config = config || {};
- Ext.applyIf(config,{
- title: _('languages')
- ,id: 'modx-grid-language'
- ,url: MODx.config.connector_url+'system/language.php'
- ,baseParams: {
- action: 'system/language/getlist'
- }
- ,fields: ['id','name','menu']
- ,width: '97%'
- ,paging: true
- ,autosave: true
- ,primaryKey: 'name'
- ,columns: [{
- header: _('name')
- ,dataIndex: 'name'
- ,width: 200
- ,sortable: true
- }]
- ,tbar: [{
- text: _('language_create')
- ,handler: {
- xtype: 'modx-window-language-create'
- ,listeners: {
- 'success':{fn:function(o) {
- var r = o.a.result.object;
- this.refresh();
-
- var g = Ext.getCmp('modx-grid-lexicon');
- if (g) {
- g.setFilterParams(null,null,r.name);
- }
- },scope:this}
- }
- }
- ,scope: this
- }]
- });
- MODx.grid.Language.superclass.constructor.call(this,config);
- };
- Ext.extend(MODx.grid.Language,MODx.grid.Grid,{
- duplicateLanguage: function(btn,e) {
- var df = Ext.Ajax.timeout;
- Ext.Ajax.timeout = 0;
- this.menu.record.new_name = _('duplicate_of')+this.menu.record.name;
- this.loadWindow(btn,e,{
- xtype: 'modx-window-language-duplicate'
- ,record: this.menu.record
- ,listeners: {
- 'success': {fn:function(r) {
- Ext.Ajax.timeout = df;
- this.refresh();
- var g = Ext.getCmp('modx-grid-lexicon');
- if (g) {
- g.setFilterParams(null,null,r.name);
- }
- },scope:this}
- }
- });
- }
- });
- Ext.reg('modx-grid-language',MODx.grid.Language);
- /**
- * Generates the create language window.
- *
- * @class MODx.window.CreateLanguage
- * @extends MODx.Window
- * @param {Object} config An object of options.
- * @xtype modx-window-language-create
- */
- MODx.window.CreateLanguage = function(config) {
- config = config || {};
- var r = config.record;
- Ext.applyIf(config,{
- title: _('language_create')
- ,url: MODx.config.connector_url
- ,action: 'system/language/create'
- ,fields: [{
- xtype: 'textfield'
- ,fieldLabel: _('name')
- ,name: 'name'
- ,itemId: 'name'
- ,anchor: '100%'
- ,maxLength: 100
- ,allowBlank: false
- }]
- });
- MODx.window.CreateLanguage.superclass.constructor.call(this,config);
- };
- Ext.extend(MODx.window.CreateLanguage,MODx.Window);
- Ext.reg('modx-window-language-create',MODx.window.CreateLanguage);
- MODx.window.DuplicateLanguage = function(config) {
- config = config || {};
- var r = config.record;
- Ext.applyIf(config,{
- title: _('language_duplicate')
- ,url: MODx.config.connector_url
- ,action: 'system/language/duplicate'
- ,fields: [{
- xtype: 'statictextfield'
- ,fieldLabel: _('duplicate')
- ,name: 'name'
- ,itemId: 'name'
- ,anchor: '100%'
- ,maxLength: 100
- ,allowBlank: false
- ,submitValue: true
- },{
- xtype: 'textfield'
- ,fieldLabel: _('language_new_name')
- ,description: _('language_new_name_desc')
- ,name: 'new_name'
- ,itemId: 'new_name'
- ,anchor: '100%'
- ,allowBlank: false
- },{
- xtype: 'xcheckbox'
- ,boxLabel: _('language_recursive')
- ,description: _('language_recursive_desc')
- ,name: 'recursive'
- ,itemId: 'recursive'
- ,inputValue: 1
- ,checked: true
- }]
- });
- MODx.window.DuplicateLanguage.superclass.constructor.call(this,config);
- };
- Ext.extend(MODx.window.DuplicateLanguage,MODx.Window);
- Ext.reg('modx-window-language-duplicate',MODx.window.DuplicateLanguage);
|