1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Tab');
7 Pman.Tab.AdminEnum = new Roo.XComponent({
8 part : ["Admin", "Enum" ],
9 order : '500-Pman.Tab.AdminEnum',
11 parent : 'Pman.Tab.Admin',
12 name : "Pman.Tab.AdminEnum",
24 xtype : 'LayoutRegion',
30 xtype : 'LayoutRegion',
34 xtype : 'BorderLayout',
42 url : baseURL + '/Roo/core_enum.php',
75 totalProperty : 'total'
80 sortInfo : { field : 'etype', direction: 'ASC' },
83 update : function (_self, record, operation)
85 if (operation != Roo.data.Record.COMMIT) {
90 url : baseURL + '/Roo/Core_enum.php',
94 etype : _this.etypeCombo.getValue(),
95 name : record.data.name,
96 active : record.data.active,
97 seqid : record.data.seqid,
98 display_name : record.data.display_name
100 success : function(res) {
102 // update the ID if it's not set..
103 if (record.data.id * 1 < 1) {
104 record.set('id', res.data.id);
110 beforeload : function (_self, o)
112 o.params['query[empty_etype]'] = 1;
123 xtype : 'CellSelectionModel',
126 selectionchange : function (_self, selection)
128 _this.grid.footer.onClick('first');
135 xtype : 'PagingToolbar',
136 emptyMsg : "No core_enum found",
147 '|xns' : 'Roo.Toolbar',
148 text : "Add new pulldown list",
150 cls : 'x-btn-text-icon',
151 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
157 Roo.MessageBox.prompt ("Create a new Enum type",
158 "Enter the name for a new enum type, " +
159 "this is only relivant if you know how it is going to be used",
165 url : baseURL + '/Roo/Core_enum.php',
172 success : function() {
173 Roo.MessageBox.alert("Created", "You can now select it from the type list on the left");
192 autoExpandColumn : 'display_name',
193 xtype : 'EditorGrid',
200 xtype : 'ColumnModel',
203 renderer : function(v,x,r) {
206 return String.format('<span qtip="{1}">{0}</span>', (''+v).length ? v : r.data.name, r.data.name);
209 dataIndex : 'display_name'
213 xtype : 'ColumnModel',
216 renderer : function(v) {
217 var state = v> 0 ? '-checked' : '';
219 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
227 beforeedit : function (e)
229 if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){
233 cellclick : function (_self, rowIndex, columnIndex, e)
236 var di = this.colModel.getDataIndex(columnIndex);
237 if (di != 'active') {
241 var rec = _this.grid.ds.getAt(rowIndex);
243 rec.set('active', rec.data.active ? 0 : 1);
251 //_this.dialog = Pman.Dialog.FILL_IN
252 if (_this.epanel.active) {
253 this.footer.onClick('first');
256 afteredit : function (e)
269 title : "Pulldown Options",
272 tableName : 'core_enum',
274 activate : function() {
277 _this.egrid.footer.onClick('first');
291 url : baseURL + '/Roo/core_enum.php',
300 xtype : 'JsonReader',
324 totalProperty : 'total'
329 sortInfo : { field : 'etype', direction: 'ASC' },
332 update : function (_self, record, operation)
334 if (operation != Roo.data.Record.COMMIT) {
339 url : baseURL + '/Roo/Core_enum.php',
343 etype : _this.etypeCombo.getValue(),
344 name : record.data.name,
345 active : record.data.active,
346 seqid : record.data.seqid,
347 display_name : record.data.display_name
349 success : function(res) {
351 // update the ID if it's not set..
352 if (record.data.id * 1 < 1) {
353 record.set('id', res.data.id);
359 beforeload : function (_self, options)
362 var s = _this.egrid.getSelectionModel().getSelectedCell();
368 var d = _this.egrid.dataSource.getAt(s[0]);
370 options.params.etype = d.data.name;
371 if (!options.params.etype.length) {
384 xtype : 'PagingToolbar',
385 emptyMsg : "No core_enum found",
388 displayMsg : "Displaying core_enum{0} - {1} of {2}",
391 '|xns' : 'Roo.Toolbar',
396 click : function (_self, e)
401 Roo.MessageBox.alert("Downloading", "File is downloading");
406 '|xns' : 'Roo.Toolbar',
407 text : "Upload Values",
411 click : function (_self, e)
414 var s = _this.egrid.getSelectionModel().getSelectedCell();
418 Roo.MessageBox.alert("Error", "Select a pulldown");
421 var d = _this.egrid.dataSource.getAt(s[0]);
424 var etype = d.data.name;
427 Roo.MessageBox.alert('Error', 'Please select a pulldown');
431 Pman.Dialog.Image.show(
433 _url : baseURL+'/Admin/Import/Enum?' + Roo.urlEncode({'etype' : etype})
437 _this.grid.footer.onClick('first');
452 '|xns' : 'Roo.Toolbar',
455 cls : 'x-btn-text-icon',
456 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
462 // if we do not have a selected type... - what should we show..?
465 var s = _this.egrid.getSelectionModel().getSelectedCell();
469 Roo.MessageBox.alert("Error", "Select a pulldown");
472 var d = _this.egrid.dataSource.getAt(s[0]);
475 var ds = _this.grid.getDataSource();
477 var add = ds.reader.newRow({
485 var r = ds.data.length;
487 _this.grid.startEditing(r, 1); // name...
492 '|xns' : 'Roo.Toolbar',
495 cls : 'x-btn-text-icon',
496 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
502 // if we do not have a selected type... - what should we show..?
503 var et = _this.etypeCombo.getValue();
506 Roo.MessageBox.alert("Error", "Select a pulldown");
509 var sc = _this.grid.getSelectionModel().getSelectedCell();
511 var ds = _this.grid.ds.getAt(sc[0]);
513 Roo.MessageBox.alert("Error", "Select enum");
518 Pman.Dialog.AdminEnumImages.show({onid:ds.data.id}, function(){
519 _this.grid.footer.onClick('first');
529 autoExpandColumn : 'display_name',
530 xtype : 'EditorGrid',
537 xtype : 'ColumnModel',
539 header : 'Internal #',
540 renderer : function(v) { return String.format('{0}', v); },
546 xtype : 'ColumnModel',
549 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); },
551 dataIndex : 'images_id_id'
561 xtype : 'GridEditor',
569 xtype : 'ColumnModel',
572 renderer : function(v) { return String.format('{0}', v); },
588 xtype : 'GridEditor',
596 xtype : 'ColumnModel',
598 header : 'Display Name',
599 renderer : function(v) { return String.format('{0}', v); },
601 dataIndex : 'display_name',
609 xtype : 'ColumnModel',
612 renderer : function(v) {
613 var state = v> 0 ? '-checked' : '';
615 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
625 allowNegative : true,
626 xtype : 'NumberField',
627 allowDecimals : false,
628 decimalPrecision : 0,
632 xtype : 'GridEditor',
640 xtype : 'ColumnModel',
644 renderer : function(v) { return String.format('{0}', v); },
654 beforeedit : function (e)
656 if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){
663 //_this.dialog = Pman.Dialog.FILL_IN
664 if (_this.panel.active) {
665 this.footer.onClick('first');
668 cellclick : function (_self, rowIndex, columnIndex, e)
671 var di = this.colModel.getDataIndex(columnIndex);
672 if (di != 'active') {
676 var rec = _this.grid.ds.getAt(rowIndex);
678 rec.set('active', rec.data.active ? 0 : 1);
683 afteredit : function (e)
697 title : "Pulldown Options",
700 tableName : 'core_enum',
702 activate : function() {
705 _this.grid.footer.onClick('first');
718 xtype : 'NestedLayoutPanel',
721 title : "Pulldown Options",