1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Dialog.CmsCategory = {
10 show : function(data, cb)
18 this.dialog.show(this.data._el);
21 this.form.setValues(data);
22 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
30 this.dialog = Roo.factory({
31 xtype: 'LayoutDialog',
36 title : "Edit Category",
43 xtype: 'ContentPanel',
53 actionfailed : function (_self, action)
55 _this.dialog.el.unmask();
56 Pman.standardActionFailed(_self, action);
58 actioncomplete : function (_self, action)
61 if (action.type =='submit') {
63 _this.dialog.el.unmask();
67 _this.callback.call(_this, _this.form.getValues());
72 if (action.type == 'setdata') {
74 _this.dialog.el.mask("Loading");
75 this.load({ method: 'GET', params: { '_id' : _this.data.id }});
78 _this.grid.getDataSource().load();
81 if (action.type == 'load') {
82 _this.grid.getDataSource().load();
83 _this.dialog.el.unmask();
90 rendered : function (_self)
96 style : 'margin: 5px',
97 url : baseURL + '/Roo/Category.php',
102 fieldLabel : 'Parent',
103 name : 'parent_id_title',
108 xtype: 'NumberField',
110 decimalPrecision : 0,
111 fieldLabel : 'Order (1 first)',
112 name : 'display_order',
119 fieldLabel : 'Title',
126 displayField : 'name',
128 emptyText : "Select Type",
130 forceSelection : true,
131 hiddenName : 'category_type_id',
133 loadingText : "Searching...",
135 name : 'category_type_id_name',
137 qtip : "Select cms_category_type",
138 selectOnFocus : true,
139 tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
140 triggerAction : 'all',
148 sortInfo : { direction : 'ASC', field: 'id' },
150 beforeload : function (_self, o){
151 o.params = o.params || {};
159 url : baseURL + '/Roo/cms_category_type.php'
166 totalProperty : 'total',
167 fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
174 fieldLabel : 'Visible',
197 tableName : 'Images',
200 activate : function() {
203 //_this.grid.footer.onClick('first');
211 autoExpandColumn : 'filename',
214 render : function() {
216 //_this.dialog = Pman.Dialog.FILL_IN
217 if (_this.panel.active) {
218 //this.footer.onClick('first');
225 reader : Pman.Readers.Images,
227 beforeload : function (_self, o)
229 if (!_this.data.id) {
232 o.params = o.params || {};
233 o.params.onid = _this.data.id;
234 o.params.ontable = 'Category';
241 url : baseURL + '/Roo/Images.php'
252 cls : 'x-btn-text-icon',
253 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
257 Pman.Dialog.Image.show( { id : 0, onid: _this.data.id, ontable: 'Category' }, function(data) {
258 _this.grid.getDataSource().load();
259 Pman.Dialog.CmsImage.show(data, function() {
260 _this.grid.getDataSource().load();
273 cls : 'x-btn-text-icon',
274 icon : Roo.rootURL + 'images/default/tree/leaf.gif',
278 var s = _this.grid.getSelectionModel().getSelections();
279 if (!s.length || (s.length > 1)) {
280 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
283 var data = _this.grid.getDataSource().getById(s[0].data.id).data;
284 Pman.Dialog.CmsImage.show(data, function() {
285 _this.grid.getDataSource().load();
295 cls : 'x-btn-text-icon',
296 icon : rootURL + '/Pman/templates/images/trash.gif',
300 Pman.genericDelete(_this, _this.panel.tableName);
308 xtype: 'ColumnModel',
313 renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}">', baseURL, v, r.data.filename); }
316 xtype: 'ColumnModel',
320 dataIndex : 'filename',
321 renderer : function(v,x,r) { return String.format('{0}<br/><i qtip="{1}">{1}</i>', v, r.data.linkurl); }
328 xtype: 'LayoutRegion',
333 xtype: 'LayoutRegion',
362 _this.dialog.el.mask("Saving");
364 _this.form.doAction("submit");