Pman.Dialog.MTrackRepos.js
[Pman.MTrack] / Pman.Dialog.MTrackRepos.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.MTrackRepos = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             closable : false,
34             collapsible : false,
35             height : 420,
36             resizable : false,
37             title : "Edit / Create mtrack_repos",
38             width : 400,
39             items : [
40                 {
41                     xtype: 'ContentPanel',
42                     xns: Roo,
43                     region : 'center',
44                     items : [
45                         {
46                             xtype: 'Form',
47                             xns: Roo.form,
48                             listeners : {
49                                 actioncomplete : function(_self,action)
50                                 {
51                                     if (action.type == 'setdata') {
52                                        //_this.dialog.el.mask("Loading");
53                                        //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
54                                        return;
55                                     }
56                                     if (action.type == 'load') {
57                                         _this.dialog.el.unmask();
58                                         return;
59                                     }
60                                     if (action.type =='submit') {
61                                     
62                                         _this.dialog.el.unmask();
63                                         _this.dialog.hide();
64                                     
65                                          if (_this.callback) {
66                                             _this.callback.call(_this, _this.form.getValues());
67                                          }
68                                          _this.form.reset();
69                                          return;
70                                     }
71                                 },
72                                 rendered : function (form)
73                                 {
74                                     _this.form= form;
75                                 }
76                             },
77                             method : 'POST',
78                             style : 'margin:10px;',
79                             url : baseURL + '/Roo/mtrack_repos.php',
80                             items : [
81                                 {
82                                     xtype: 'TextField',
83                                     xns: Roo.form,
84                                     fieldLabel : 'Shortname',
85                                     name : 'shortname',
86                                     width : 200
87                                 },
88                                 {
89                                     xtype: 'TextField',
90                                     xns: Roo.form,
91                                     fieldLabel : 'Scmtype',
92                                     name : 'scmtype',
93                                     width : 200
94                                 },
95                                 {
96                                     xtype: 'TextField',
97                                     xns: Roo.form,
98                                     fieldLabel : 'Repopath',
99                                     name : 'repopath',
100                                     width : 200
101                                 },
102                                 {
103                                     xtype: 'TextField',
104                                     xns: Roo.form,
105                                     fieldLabel : 'Browserurl',
106                                     name : 'browserurl',
107                                     width : 200
108                                 },
109                                 {
110                                     xtype: 'TextField',
111                                     xns: Roo.form,
112                                     fieldLabel : 'Browsertype',
113                                     name : 'browsertype',
114                                     width : 200
115                                 },
116                                 {
117                                     xtype: 'TextArea',
118                                     xns: Roo.form,
119                                     fieldLabel : 'Description',
120                                     name : 'description',
121                                     width : 200,
122                                     height : 100
123                                 },
124                                 {
125                                     xtype: 'TextField',
126                                     xns: Roo.form,
127                                     fieldLabel : 'Serverurl',
128                                     name : 'serverurl',
129                                     width : 200
130                                 },
131                                 {
132                                     xtype: 'TextField',
133                                     xns: Roo.form,
134                                     fieldLabel : 'Parent',
135                                     name : 'parent',
136                                     width : 200
137                                 },
138                                 {
139                                     xtype: 'TextField',
140                                     xns: Roo.form,
141                                     fieldLabel : 'Clonedfrom',
142                                     name : 'clonedfrom',
143                                     width : 75
144                                 },
145                                 {
146                                     xtype: 'ComboBox',
147                                     xns: Roo.form,
148                                     allowBlank : false,
149                                     displayField : 'name',
150                                     editable : false,
151                                     emptyText : "Select Projects",
152                                     fieldLabel : 'Projects',
153                                     forceSelection : false,
154                                     hiddenName : 'project_id',
155                                     listWidth : 400,
156                                     loadingText : "Searching...",
157                                     minChars : 2,
158                                     name : 'project_id_name',
159                                     pageSize : 20,
160                                     qtip : "Select Projects",
161                                     queryParam : 'query[name]',
162                                     selectOnFocus : true,
163                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{code}</b>{name} </div>',
164                                     triggerAction : 'all',
165                                     typeAhead : true,
166                                     valueField : 'id',
167                                     width : 200,
168                                     store : {
169                                         xtype: 'Store',
170                                         xns: Roo.data,
171                                         remoteSort : true,
172                                         sortInfo : { direction : 'ASC', field: 'id' },
173                                         listeners : {
174                                             beforeload : function (_self, o){
175                                                 o.params = o.params || {};
176                                                 // set more here
177                                             }
178                                         },
179                                         proxy : {
180                                             xtype: 'HttpProxy',
181                                             xns: Roo.data,
182                                             method : 'GET',
183                                             url : baseURL + '/Roo/Projects.php'
184                                         },
185                                         reader : {
186                                             xtype: 'JsonReader',
187                                             xns: Roo.data,
188                                             id : 'id',
189                                             root : 'data',
190                                             totalProperty : 'total',
191                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
192                                         }
193                                     }
194                                 },
195                                 {
196                                     xtype: 'Hidden',
197                                     xns: Roo.form,
198                                     name : 'id'
199                                 }
200                             ]
201                         }
202                     ]
203                 }
204             ],
205             center : {
206                 xtype: 'LayoutRegion',
207                 xns: Roo
208             },
209             buttons : [
210                 {
211                     xtype: 'Button',
212                     xns: Roo,
213                     listeners : {
214                         click : function (_self, e)
215                         {
216                             _this.dialog.hide();
217                         }
218                     },
219                     text : "Cancel"
220                 },
221                 {
222                     xtype: 'Button',
223                     xns: Roo,
224                     listeners : {
225                         click : function (_self, e)
226                         {
227                             // do some checks?
228                              
229                             
230                             _this.dialog.el.mask("Saving");
231                             _this.form.doAction("submit");
232                         
233                         }
234                     },
235                     text : "Save"
236                 }
237             ]
238         });
239     }
240 };