Pman.Tab.MTrackRepos.js
[Pman.MTrack] / Pman.Tab.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
6
7 // register the module first
8 Pman.on('beforeload', function()
9 {
10     Pman.register({
11         modKey : '001-Pman.Tab.MTrackRepos',
12         module : Pman.Tab.MTrackRepos,
13         region : '',
14         parent : false,
15         name : "unnamed module",
16         disabled : false, 
17         permname: '' 
18     });
19 });
20
21 Pman.Tab.MTrackRepos = new Roo.util.Observable({
22
23     panel : false,
24     disabled : false,
25     parentLayout:  false,
26
27     add : function(parentLayout, region)
28     {
29
30         var _this = this;
31         this.parentLayout = parentLayout;
32
33         this.panel = parentLayout.addxtype({
34             xtype: 'GridPanel',
35             xns: Roo,
36             title : "mtrack_repos",
37             fitToframe : true,
38             fitContainer : true,
39             tableName : 'mtrack_repos',
40             background : true,
41             region : 'center',
42             listeners : {
43                 activate : function() {
44                     _this.panel = this;
45                     if (_this.grid) {
46                         _this.grid.footer.onClick('first');
47                     }
48                 }
49             },
50             grid : {
51                 xtype: 'Grid',
52                 xns: Roo.grid,
53                 autoExpandColumn : 'shortname',
54                 loadMask : true,
55                 listeners : {
56                     render : function() 
57                     {
58                         _this.grid = this; 
59                         //_this.dialog = Pman.Dialog.FILL_IN
60                         if (_this.panel.active) {
61                            this.footer.onClick('first');
62                         }
63                     },
64                     rowdblclick : function (_self, rowIndex, e)
65                     {
66                         if (!_this.dialog) return;
67                         _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
68                             _this.grid.footer.onClick('first');
69                         }); 
70                     }
71                 },
72                 dataSource : {
73                     xtype: 'Store',
74                     xns: Roo.data,
75                     remoteSort : true,
76                     sortInfo : { field : 'shortname', direction: 'ASC' },
77                     proxy : {
78                         xtype: 'HttpProxy',
79                         xns: Roo.data,
80                         method : 'GET',
81                         url : baseURL + '/Roo/mtrack_repos.php'
82                     },
83                     reader : {
84                         xtype: 'JsonReader',
85                         xns: Roo.data,
86                         totalProperty : 'total',
87                         root : 'data',
88                         id : 'id',
89                         fields : [
90                             {
91                                 'name': 'id',
92                                 'type': 'int'
93                             },
94                             {
95                                 'name': 'shortname',
96                                 'type': 'string'
97                             },
98                             {
99                                 'name': 'scmtype',
100                                 'type': 'string'
101                             },
102                             {
103                                 'name': 'repopath',
104                                 'type': 'string'
105                             },
106                             {
107                                 'name': 'browserurl',
108                                 'type': 'string'
109                             },
110                             {
111                                 'name': 'browsertype',
112                                 'type': 'string'
113                             },
114                             {
115                                 'name': 'description',
116                                 'type': 'string'
117                             },
118                             {
119                                 'name': 'serverurl',
120                                 'type': 'string'
121                             },
122                             {
123                                 'name': 'parent',
124                                 'type': 'string'
125                             },
126                             {
127                                 'name': 'clonedfrom',
128                                 'type': 'int'
129                             },
130                             {
131                                 'name': 'project_id',
132                                 'type': 'int'
133                             }
134                         ]
135                     }
136                 },
137                 footer : {
138                     xtype: 'PagingToolbar',
139                     xns: Roo,
140                     pageSize : 25,
141                     displayInfo : true,
142                     displayMsg : 'Displaying mtrack_repos{0} - {1} of {2}',
143                     emptyMsg : 'No mtrack_repos found'
144                 },
145                 toolbar : {
146                     xtype: 'Toolbar',
147                     xns: Roo,
148                     items : [
149                         {
150                             xtype: 'Button',
151                             xns: Roo.Toolbar,
152                             text : "Add",
153                             cls : 'x-btn-text-icon',
154                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
155                             listeners : {
156                                 click : function()
157                                 {
158                                     if (!_this.dialog) return;
159                                     _this.dialog.show( { id : 0 } , function() {
160                                         _this.grid.footer.onClick('first');
161                                    }); 
162                                 }
163                             }
164                         },
165                         {
166                             xtype: 'Button',
167                             xns: Roo.Toolbar,
168                             text : "Edit",
169                             cls : 'x-btn-text-icon',
170                             icon : Roo.rootURL + 'images/default/tree/leaf.gif',
171                             listeners : {
172                                 click : function()
173                                 {
174                                     var s = _this.grid.getSelectionModel().getSelections();
175                                     if (!s.length || (s.length > 1))  {
176                                         Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
177                                         return;
178                                     }
179                                     if (!_this.dialog) return;
180                                     _this.dialog.show(s[0].data, function() {
181                                         _this.grid.footer.onClick('first');
182                                     }); 
183                                     
184                                 }
185                             }
186                         },
187                         {
188                             xtype: 'Button',
189                             xns: Roo.Toolbar,
190                             text : "Delete",
191                             cls : 'x-btn-text-icon',
192                             icon : rootURL + '/Pman/templates/images/trash.gif',
193                             listeners : {
194                                 click : function()
195                                 {
196                                      Pman.genericDelete(_this, 'mtrack_repos'); 
197                                 }
198                             }
199                         }
200                     ]
201                 },
202                 colModel : [
203                     {
204                         xtype: 'ColumnModel',
205                         xns: Roo.grid,
206                         dataIndex : 'project_id_name',
207                         header : 'Project',
208                         width : 150,
209                         renderer : function(v) { return String.format('{0}', v); }
210                     },
211                     {
212                         xtype: 'ColumnModel',
213                         xns: Roo.grid,
214                         header : 'Shortname',
215                         width : 200,
216                         dataIndex : 'shortname',
217                         renderer : function(v) { return String.format('{0}', v); }
218                     },
219                     {
220                         xtype: 'ColumnModel',
221                         xns: Roo.grid,
222                         header : 'Scmtype',
223                         width : 200,
224                         dataIndex : 'scmtype',
225                         renderer : function(v) { return String.format('{0}', v); }
226                     },
227                     {
228                         xtype: 'ColumnModel',
229                         xns: Roo.grid,
230                         dataIndex : 'repopath',
231                         header : 'Repopath',
232                         width : 100,
233                         renderer : function(v) { return String.format('{0}', v); }
234                     },
235                     {
236                         xtype: 'ColumnModel',
237                         xns: Roo.grid,
238                         header : 'Description',
239                         width : 200,
240                         dataIndex : 'description',
241                         renderer : function(v) { return String.format('{0}', v); }
242                     },
243                     {
244                         xtype: 'ColumnModel',
245                         xns: Roo.grid,
246                         header : 'Parent',
247                         width : 200,
248                         dataIndex : 'parent',
249                         renderer : function(v) { return String.format('{0}', v); }
250                     }
251                 ]
252             }
253         });
254         this.layout = this.panel.layout;
255
256     }
257 });