fix missing var issue
[Pman.Cms] / Pman.Dialog.AddChildElementToPage.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Dialog');
6
7 Pman.Dialog.AddChildElementToPage = {
8
9  _strings : {
10   '463ab1bc075f498d1aa03b9bc062efa3' :"Element Type",
11   '9656c9cdb7ecd471b88284047d6d885b' :"Select Element",
12   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
13   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
14   'c9cc8cce247e49bae79f15173ce97354' :"Save",
15   'f4b319f11758cc6fe44c71999f7690ac' :"Type of element to add"
16  },
17
18  dialog : false,
19  callback:  false,
20
21  show : function(data, cb)
22  {
23   if (!this.dialog) {
24    this.create();
25   }
26
27   this.callback = cb;
28   this.data = data;
29   this.dialog.show(this.data._el);
30   if (this.form) {
31    this.form.reset();
32    this.form.setValues(data);
33    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
34   }
35
36  },
37
38  create : function()
39  {
40    var _this = this;
41    this.dialog = Roo.factory({
42     xtype : 'LayoutDialog',
43     closable : false,
44     collapsible : false,
45     height : 120,
46     resizable : false,
47     title : _this._strings['f4b319f11758cc6fe44c71999f7690ac'] /* Type of element to add */,
48     width : 400,
49     listeners : {
50      show : function (_self)
51       {
52           
53           
54       }
55     },
56     xns : Roo,
57     '|xns' : 'Roo',
58     center : {
59      xtype : 'LayoutRegion',
60      xns : Roo,
61      '|xns' : 'Roo'
62     },
63     buttons : [
64      {
65       xtype : 'Button',
66       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
67       listeners : {
68        click : function (_self, e)
69         {
70             _this.dialog.hide();
71         }
72       },
73       xns : Roo,
74       '|xns' : 'Roo'
75      },
76      {
77       xtype : 'Button',
78       text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
79       listeners : {
80        click : function (_self, e)
81         {
82             _this.form.doAction("submit");
83         
84         }
85       },
86       xns : Roo,
87       '|xns' : 'Roo'
88      }
89     ],
90     items  : [
91      {
92       xtype : 'ContentPanel',
93       region : 'center',
94       xns : Roo,
95       '|xns' : 'Roo',
96       items  : [
97        {
98         xtype : 'Form',
99         method : 'POST',
100         style : 'margin:10px;',
101         url : baseURL + '/Roo/cms_category_type.php',
102         listeners : {
103          actioncomplete : function(_self,action)
104           {
105               if (action.type == 'setdata') {
106                  
107                  return;
108               }
109               if (action.type == 'load') {
110                   
111                   return;
112               }
113               if (action.type =='submit') {
114               
115                   _this.dialog.hide();
116               
117                    if (_this.callback) {
118                       _this.callback.call(_this, _this.form.getFieldValues());
119                    }
120                    
121                    _this.form.reset();
122                    
123                    return;
124               }
125           },
126          rendered : function (form)
127           {
128               _this.form = form;
129           }
130         },
131         xns : Roo.form,
132         '|xns' : 'Roo.form',
133         items  : [
134          {
135           xtype : 'ComboBox',
136           alwaysQuery : true,
137           displayField : 'name',
138           editable : false,
139           emptyText : _this._strings['9656c9cdb7ecd471b88284047d6d885b'] /* Select Element */,
140           fieldLabel : _this._strings['463ab1bc075f498d1aa03b9bc062efa3'] /* Element Type */,
141           forceSelection : true,
142           hiddenName : 'element_id',
143           listWidth : 400,
144           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
145           minChars : 2,
146           name : 'element_id_name',
147           pageSize : 20,
148           qtip : _this._strings['9656c9cdb7ecd471b88284047d6d885b'] /* Select Element */,
149           selectOnFocus : true,
150           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> </div>',
151           triggerAction : 'all',
152           typeAhead : false,
153           valueField : 'id',
154           xns : Roo.form,
155           '|xns' : 'Roo.form',
156           store : {
157            xtype : 'Store',
158            remoteSort : true,
159            sortInfo : { direction : 'ASC', field: 'seqid' },
160            listeners : {
161             beforeload : function (_self, o){
162                  
163                  o.params = o.params || {};
164                  
165                  Roo.log(_this.data);
166                  
167                  if(!_this.data.template_id || _this.data.template_id * 1 < 1){
168                      return false;
169                  }
170                  
171                  o.params.template_id = _this.data.template_id;
172                  
173              }
174            },
175            xns : Roo.data,
176            '|xns' : 'Roo.data',
177            proxy : {
178             xtype : 'HttpProxy',
179             method : 'GET',
180             url : baseURL + '/Roo/Cms_template_element.php',
181             xns : Roo.data,
182             '|xns' : 'Roo.data'
183            },
184            reader : {
185             xtype : 'JsonReader',
186             fields : [
187                 {
188                     "name":"id",
189                     "type":"int"
190                 },
191                 {
192                     "name":"name",
193                     "type":"string"
194                 }
195             ],
196             id : 'id',
197             root : 'data',
198             totalProperty : 'total',
199             xns : Roo.data,
200             '|xns' : 'Roo.data'
201            }
202           }
203          }
204         ]
205        }
206       ]
207      }
208     ]
209    });
210  }
211 };