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