templates/view.html
[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 : 'center',
14         parent : Pman.Tab.MTrack,
15         name : "Pman.Tab.MTrackRepos",
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             listeners : {
37                 activate : function() {
38                     _this.panel = this;
39                     if (_this.grid) {
40                         _this.grid.footer.onClick('first');
41                     }
42                 }
43             },
44             background : true,
45             fitContainer : true,
46             fitToframe : true,
47             region : 'center',
48             tableName : 'mtrack_repos',
49             title : "Repositories",
50             grid : {
51                 xtype: 'Grid',
52                 xns: Roo.grid,
53                 listeners : {
54                     render : function() 
55                     {
56                         _this.grid = this; 
57                         _this.dialog = Pman.Dialog.MTrackRepos;
58                         if (_this.panel.active) {
59                            this.footer.onClick('first');
60                         }
61                     },
62                     rowdblclick : function (_self, rowIndex, e)
63                     {
64                         if (!_this.dialog) return;
65                         _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
66                             _this.grid.footer.onClick('first');
67                         }); 
68                     }
69                 },
70                 autoExpandColumn : 'shortname',
71                 loadMask : true,
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                             listeners : {
153                                 click : function()
154                                 {
155                                     if (!_this.dialog) return;
156                                     _this.dialog.show( { id : 0 } , function() {
157                                         _this.grid.footer.onClick('first');
158                                    }); 
159                                 }
160                             },
161                             cls : 'x-btn-text-icon',
162                             text : "Add",
163                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
164                         },
165                         {
166                             xtype: 'Button',
167                             xns: Roo.Toolbar,
168                             listeners : {
169                                 click : function()
170                                 {
171                                     var s = _this.grid.getSelectionModel().getSelections();
172                                     if (!s.length || (s.length > 1))  {
173                                         Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
174                                         return;
175                                     }
176                                     if (!_this.dialog) return;
177                                     _this.dialog.show(s[0].data, function() {
178                                         _this.grid.footer.onClick('reload');
179                                     }); 
180                                     
181                                 }
182                             },
183                             cls : 'x-btn-text-icon',
184                             text : "Edit",
185                             icon : Roo.rootURL + 'images/default/tree/leaf.gif'
186                         }
187                     ]
188                 },
189                 colModel : [
190                     {
191                         xtype: 'ColumnModel',
192                         xns: Roo.grid,
193                         dataIndex : 'project_id_name',
194                         header : 'Project',
195                         width : 150,
196                         renderer : function(v) { return String.format('{0}', v); }
197                     },
198                     {
199                         xtype: 'ColumnModel',
200                         xns: Roo.grid,
201                         header : 'Shortname',
202                         width : 200,
203                         dataIndex : 'shortname',
204                         renderer : function(v) { return String.format('{0}', v); }
205                     },
206                     {
207                         xtype: 'ColumnModel',
208                         xns: Roo.grid,
209                         dataIndex : 'scmtype',
210                         header : 'Scmtype',
211                         width : 70,
212                         renderer : function(v) { return String.format('{0}', v); }
213                     },
214                     {
215                         xtype: 'ColumnModel',
216                         xns: Roo.grid,
217                         dataIndex : 'repopath',
218                         header : 'Repopath',
219                         width : 100,
220                         renderer : function(v) { return String.format('{0}', v); }
221                     },
222                     {
223                         xtype: 'ColumnModel',
224                         xns: Roo.grid,
225                         header : 'Description',
226                         width : 200,
227                         dataIndex : 'description',
228                         renderer : function(v) { return String.format('{0}', v); }
229                     },
230                     {
231                         xtype: 'ColumnModel',
232                         xns: Roo.grid,
233                         dataIndex : 'parent',
234                         header : 'Parent',
235                         width : 100,
236                         renderer : function(v) { return String.format('{0}', v); }
237                     }
238                 ]
239             }
240         });
241         this.layout = this.panel.layout;
242
243     }
244 });