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");
181 click : function (_self, e)
183 var etype = _this.etypeCombo.getValue();
186 Roo.MessageBox.alert('Error', 'Please select a pulldown');
190 Pman.Dialog.Image.show(
192 _url : baseURL+'/Xtuple/Import/Enum?' + Roo.urlEncode({'etype' : etype})
196 _this.grid.footer.onClick('first');
201 text : "Upload Value"
212 text : "Pulldown Name:"
218 render : function (_self)
220 _this.etypeCombo = _self;
222 select : function (combo, record, index)
224 _this.grid.footer.onClick('first');
228 displayField : 'name',
230 emptyText : "Select pulldown",
231 fieldLabel : 'core_enum',
232 forceSelection : true,
234 loadingText : "Searching...",
237 qtip : "Select type",
238 queryParam : 'query[name]',
239 selectOnFocus : true,
240 tpl : '<div class="x-grid-cell-text x-btn button"><b>{display_name}</b> - {name} </div>',
241 triggerAction : 'all',
249 beforeload : function (_self, o){
250 o.params = o.params || {};
252 o.params['query[empty_etype]'] = 1;
256 sortInfo : { direction : 'ASC', field: 'display_name' },
261 url : baseURL + '/Roo/core_enum.php'
268 totalProperty : 'total',
269 fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
280 // if we do not have a selected type... - what should we show..?
281 var et = _this.etypeCombo.getValue();
282 var ds = _this.grid.getDataSource();
284 Roo.MessageBox.alert("Error", "Select a pulldown");
288 var add = ds.reader.newRow({
296 var r = ds.data.length;
298 _this.grid.startEditing(r, 1); // name...
301 cls : 'x-btn-text-icon',
303 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
312 // if we do not have a selected type... - what should we show..?
313 var et = _this.etypeCombo.getValue();
316 Roo.MessageBox.alert("Error", "Select a pulldown");
319 var sc = _this.grid.getSelectionModel().getSelectedCell();
321 var ds = _this.grid.ds.getAt(sc[0]);
323 Roo.MessageBox.alert("Error", "Select enum");
328 Pman.Dialog.AdminEnumImages.show({onid:ds.data.id}, function(){
329 _this.grid.footer.onClick('first');
334 cls : 'x-btn-text-icon',
336 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
349 Roo.MessageBox.prompt ("Create a new Enum type",
350 "Enter the name for a new enum type, " +
351 "this is only relivant if you know how it is going to be used",
357 url : baseURL + '/Roo/Core_enum.php',
364 success : function() {
365 Roo.MessageBox.alert("Created", "You can now select it from the type list on the left");
379 cls : 'x-btn-text-icon',
380 text : "Add new pulldown list",
381 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
387 xtype: 'ColumnModel',
390 header : 'Internal #',
392 renderer : function(v) { return String.format('{0}', v); }
395 xtype: 'ColumnModel',
397 dataIndex : 'images_id_id',
400 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); }
403 xtype: 'ColumnModel',
408 renderer : function(v) { return String.format('{0}', v); },
419 xtype: 'ColumnModel',
421 dataIndex : 'display_name',
422 header : 'Display Name',
424 renderer : function(v) { return String.format('{0}', v); },
435 xtype: 'ColumnModel',
437 dataIndex : 'active',
440 renderer : function(v) {
441 var state = v> 0 ? '-checked' : '';
443 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
448 xtype: 'ColumnModel',
454 renderer : function(v) { return String.format('{0}', v); },
459 xtype: 'NumberField',
461 allowDecimals : false,
462 allowNegative : true,