1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.AdminEnums = new Roo.XComponent({
6 part : ["Admin","Enums"],
7 order : '500-Pman.Tab.AdminEnums',
9 parent : 'Pman.Tab.Admin',
10 name : "Pman.Tab.AdminEnums",
12 permname : 'Admin.Enums',
21 activate : function() {
24 _this.grid.footer.onClick('first');
32 tableName : 'core_enum',
33 title : "Pulldown Options",
41 //_this.dialog = Pman.Dialog.FILL_IN
42 if (_this.panel.active) {
43 this.footer.onClick('first');
46 afteredit : function (e)
50 cellclick : function (_self, rowIndex, columnIndex, e)
53 var di = this.colModel.getDataIndex(columnIndex);
58 var rec = _this.grid.ds.getAt(rowIndex);
60 rec.set('active', rec.data.active ? 0 : 1);
65 beforeedit : function (e)
67 if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){
72 autoExpandColumn : 'display_name',
79 beforeload : function (_self, options)
81 if (!_this.etypeCombo) {
84 options.params.etype = _this.etypeCombo.getValue();
85 if (!options.params.etype.length) {
89 update : function (_self, record, operation)
91 if (operation != Roo.data.Record.COMMIT) {
96 url : baseURL + '/Roo/Core_enum.php',
100 etype : _this.etypeCombo.getValue(),
101 name : record.data.name,
102 active : record.data.active,
103 seqid : record.data.seqid,
104 display_name : record.data.display_name
106 success : function(res) {
108 // update the ID if it's not set..
109 if (record.data.id * 1 < 1) {
110 record.set('id', res.data.id);
118 sortInfo : { field : 'etype', direction: 'ASC' },
123 url : baseURL + '/Roo/core_enum.php'
128 totalProperty : 'total',
156 xtype: 'PagingToolbar',
160 displayMsg : "Displaying core_enum{0} - {1} of {2}",
161 emptyMsg : "No core_enum found",
167 click : function (_self, e)
172 Roo.MessageBox.alert("Downloading", "File is downloading");
186 text : "Pulldown Name:"
192 render : function (_self)
194 _this.etypeCombo = _self;
196 select : function (combo, record, index)
198 _this.grid.footer.onClick('first');
202 displayField : 'name',
204 emptyText : "Select pulldown",
205 fieldLabel : 'core_enum',
206 forceSelection : true,
208 loadingText : "Searching...",
211 qtip : "Select type",
212 queryParam : 'query[name]',
213 selectOnFocus : true,
214 tpl : '<div class="x-grid-cell-text x-btn button"><b>{display_name}</b> - {name} </div>',
215 triggerAction : 'all',
223 beforeload : function (_self, o){
224 o.params = o.params || {};
226 o.params['query[empty_etype]'] = 1;
230 sortInfo : { direction : 'ASC', field: 'display_name' },
235 url : baseURL + '/Roo/core_enum.php'
242 totalProperty : 'total',
243 fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
254 // if we do not have a selected type... - what should we show..?
255 var et = _this.etypeCombo.getValue();
256 var ds = _this.grid.getDataSource();
258 Roo.MessageBox.alert("Error", "Select a pulldown");
262 var add = ds.reader.newRow({
270 var r = ds.data.length;
272 _this.grid.startEditing(r, 1); // name...
275 cls : 'x-btn-text-icon',
277 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
286 // if we do not have a selected type... - what should we show..?
287 var et = _this.etypeCombo.getValue();
290 Roo.MessageBox.alert("Error", "Select a pulldown");
293 var sc = _this.grid.getSelectionModel().getSelectedCell();
295 var ds = _this.grid.ds.getAt(sc[0]);
297 Roo.MessageBox.alert("Error", "Select enum");
302 Pman.Dialog.AdminEnumImages.show({onid:ds.data.id}, function(){
303 _this.grid.footer.onClick('first');
308 cls : 'x-btn-text-icon',
310 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
323 Roo.MessageBox.prompt ("Create a new Enum type",
324 "Enter the name for a new enum type, " +
325 "this is only relivant if you know how it is going to be used",
331 url : baseURL + '/Roo/Core_enum.php',
338 success : function() {
339 Roo.MessageBox.alert("Created", "You can now select it from the type list on the left");
353 cls : 'x-btn-text-icon',
354 text : "Add new pulldown list",
355 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
361 xtype: 'ColumnModel',
364 header : 'Internal #',
366 renderer : function(v) { return String.format('{0}', v); }
369 xtype: 'ColumnModel',
371 dataIndex : 'images_id_id',
374 renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/25/{1}/{2}" width="25" height="25">', baseURL, v, r.data.images_id_filename); }
377 xtype: 'ColumnModel',
382 renderer : function(v) { return String.format('{0}', v); },
393 xtype: 'ColumnModel',
395 dataIndex : 'display_name',
396 header : 'Display Name',
398 renderer : function(v) { return String.format('{0}', v); },
409 xtype: 'ColumnModel',
411 dataIndex : 'active',
414 renderer : function(v) {
415 var state = v> 0 ? '-checked' : '';
417 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
422 xtype: 'ColumnModel',
428 renderer : function(v) { return String.format('{0}', v); },
433 xtype: 'NumberField',
435 allowDecimals : false,
436 allowNegative : true,