View.php
[Pman.MTrack] / Pman.Tab.MTrackMerger.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.Tab');
6
7 Pman.Tab.MTrackMerger = new Roo.XComponent({
8
9  _strings : {
10   'cd23e6cc0233eef073cbed0cfebcd6a1' :"Create Commit Using Patch",
11   'f29ddbfb905eb2593fdcdfb243f9af85' :"Added",
12   '66717bf2b8235cc94a52d5b815d57a54' :"Review Changes",
13   '06f5aa315f44a2147bab17980d1f6570' :"Merge Commits",
14   'c671c787b49f50a3ace9fdc5bd597825' :"core_enum",
15   '93f07b720ebf7d1246512569761a5804' :"Removed",
16   '4d1c8263ba1036754f8db14a98f9f006' :"Reload",
17   '21bcad367951f7c2e761f744423161b6' :"Create Commit Using Merge",
18   'e63695c4dea40eefb2ef481c7b242192' :"All Changes",
19   '0b27918290ff5323bea1e3b78a9cf04e' :"File"
20  },
21
22   part     :  ["MTrack", "Merger" ],
23   order    : '400-Pman.Tab.MTrackMerger',
24   region   : 'center',
25   parent   : 'Pman.Tab.MTrack',
26   name     : "Pman.Tab.MTrackMerger",
27   disabled : false, 
28   permname : '', 
29   _tree : function()
30   {
31    var _this = this;
32    var MODULE = this;
33    return {
34    background : true,
35    region : 'center',
36    title : _this._strings['06f5aa315f44a2147bab17980d1f6570'] /* Merge Commits */,
37    xns : Roo,
38    '|xns' : 'Roo',
39    xtype : 'NestedLayoutPanel',
40    listeners : {
41     activate : function (_self)
42      {
43         try {
44              var t = _this.tree.tree;
45              t.loader.load(t.root);
46          } catch(e) {}
47      }
48    },
49    layout : {
50     xns : Roo,
51     '|xns' : 'Roo',
52     xtype : 'BorderLayout',
53     center : {
54      xns : Roo,
55      '|xns' : 'Roo',
56      xtype : 'LayoutRegion'
57     },
58     west : {
59      split : true,
60      width : 200,
61      xns : Roo,
62      '|xns' : 'Roo',
63      xtype : 'LayoutRegion'
64     },
65     south : {
66      height : 200,
67      split : true,
68      titlebar : true,
69      xns : Roo,
70      '|xns' : 'Roo',
71      xtype : 'LayoutRegion'
72     },
73     items  : [
74      {
75       autoScroll : true,
76       fitToFrame : true,
77       region : 'west',
78       xns : Roo,
79       '|xns' : 'Roo',
80       xtype : 'TreePanel',
81       listeners : {
82        render : function (_self)
83         {
84           _this.tree = _self;
85         }
86       },
87       toolbar : {
88        xns : Roo,
89        '|xns' : 'Roo',
90        xtype : 'Toolbar',
91        items  : [
92         {
93          text : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
94          xns : Roo.Toolbar,
95          '|xns' : 'Roo.Toolbar',
96          xtype : 'Button',
97          listeners : {
98           click : function (_self, e)
99            {
100              var t = _this.tree.tree;
101              t.loader.load(t.root);
102            }
103          }
104         }
105        ]
106       },
107       tree : {
108        xns : Roo.tree,
109        '|xns' : 'Roo.tree',
110        xtype : 'TreePanel',
111        listeners : {
112         click : function (node, e)
113          {
114          
115             _this.grid.ds.load.defer(100, _this.grid.ds, [ {} ]);
116          }
117        },
118        root : {
119         text : _this._strings['e63695c4dea40eefb2ef481c7b242192'] /* All Changes */,
120         xns : Roo.tree,
121         '|xns' : 'Roo.tree',
122         xtype : 'TreeNode'
123        },
124        loader : {
125         baseParams : { _tree : 1 },
126         dataUrl : baseURL + '/MTrack/Merger',
127         requestMethod : 'GET',
128         root : 'data',
129         xns : Roo.tree,
130         '|xns' : 'Roo.tree',
131         xtype : 'TreeLoader',
132         listeners : {
133          beforeload : function (This, node, callback)
134           {
135              _this.tree.el.mask("Loading");
136           },
137          load : function (This, node, response)
138           {
139                _this.tree.el.unmask();
140                _this.tree.tree.root.expand(false,true);
141           },
142          loadexception : function (This, node, response)
143           {
144            _this.tree.el.unmask();
145           }
146         }
147        }
148       }
149      },
150      {
151       background : true,
152       fitContainer : true,
153       fitToframe : true,
154       region : 'center',
155       tableName : 'core_enum',
156       title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'] /* core_enum */,
157       xns : Roo,
158       '|xns' : 'Roo',
159       xtype : 'GridPanel',
160       listeners : {
161        activate : function() {
162             _this.panel = this;
163             if (_this.grid) {
164                 //_this.grid.footer.onClick('first');
165             }
166         }
167       },
168       grid : {
169        autoExpandColumn : 'etype',
170        loadMask : true,
171        xns : Roo.grid,
172        '|xns' : 'Roo.grid',
173        xtype : 'Grid',
174        listeners : {
175         render : function() 
176          {
177              _this.grid = this; 
178              //_this.dialog = Pman.Dialog.FILL_IN
179              if (_this.panel.active) {
180                 //this.footer.onClick('first');
181              }
182          },
183         rowdblclick : function (_self, rowIndex, e)
184          {
185              if (!_this.dialog) return;
186              _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
187                  _this.grid.footer.onClick('first');
188              }); 
189          }
190        },
191        toolbar : {
192         xns : Roo,
193         '|xns' : 'Roo',
194         xtype : 'Toolbar',
195         items  : [
196          {
197           cls : 'x-btn-text-icon',
198           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
199           text : _this._strings['cd23e6cc0233eef073cbed0cfebcd6a1'] /* Create Commit Using Patch */,
200           xns : Roo.Toolbar,
201           '|xns' : 'Roo.Toolbar',
202           xtype : 'Button',
203           listeners : {
204            click : function()
205             {
206                 // if we are just copying a simple commit accross with a valid message
207                 // then this could contain the original commit message..
208                if (! _this.tree.tree.selModel.getSelectedNode()) {
209                   Roo.MessageBox.alert("Error", "select a revision");
210                   return ;
211                }
212                var ar = _this.grid.sm.getSelections();
213                var files = [];
214                Roo.each(ar, function(s) {
215                     files.push(s.data.filename);
216                
217                });
218                
219                if (!files.length) {
220                   Roo.MessageBox.alert("Error", "select some files");
221                   return ;
222                }
223                 
224             
225                 Roo.MessageBox.show({
226                    title: "Create a Commit",
227                    msg: "Enter commit message",
228                    width:300,
229                    buttons: Roo.MessageBox.OKCANCEL,
230                    multiline: true,
231                    fn: function(btn, msg) {
232             
233                      if (btn != 'ok') {
234                          return;
235                       }
236                       new Pman.Request({
237                             method : 'POST',
238                             url : baseURL + '/MTrack/Merger',
239                             params : { 
240                                 message : msg,
241                                 _merge : _this.tree.tree.selModel.getSelectedNode().attributes.rev,
242                                 files :  Roo.encode(files)
243                             },
244                             success : function () {
245                                // reload the grid..
246                                _this.grid.ds.load({});
247                             }
248                        });
249                    },
250                    animEl: this.el
251                });
252             }
253           }
254          },
255          {
256           cls : 'x-btn-text-icon',
257           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
258           text : _this._strings['21bcad367951f7c2e761f744423161b6'] /* Create Commit Using Merge */,
259           xns : Roo.Toolbar,
260           '|xns' : 'Roo.Toolbar',
261           xtype : 'Button',
262           listeners : {
263            click : function()
264             {
265                 // if we are just copying a simple commit accross with a valid message
266                 // then this could contain the original commit message..
267                if (! _this.tree.tree.selModel.getSelectedNode()) {
268                   Roo.MessageBox.alert("Error", "select a revision");
269                   return ;
270                }
271                 
272                 
273             
274                 Roo.MessageBox.show({
275                    title: "Create a Commit",
276                    msg: "Enter commit message",
277                    width:300,
278                    buttons: Roo.MessageBox.OKCANCEL,
279                    multiline: true,
280                    fn: function(btn, msg) {
281             
282                      if (btn != 'ok') {
283                          return;
284                       }
285                       new Pman.Request({
286                             method : 'POST',
287                             url : baseURL + '/MTrack/Merger',
288                             params : { 
289                                 message : msg,
290                                 _merge : _this.tree.tree.selModel.getSelectedNode().attributes.rev,
291                                 files :   '_all_'   
292                             },
293                             success : function () {
294                                // reload the grid..
295                                 var t = _this.tree.tree;
296                                 t.loader.load(t.root);
297                             }
298                        });
299                    },
300                    animEl: this.el
301                });
302             }
303           }
304          }
305         ]
306        },
307        dataSource : {
308         remoteSort : false,
309         sortInfo : { field: 'filename', dir : 'ASC' },
310         xns : Roo.data,
311         '|xns' : 'Roo.data',
312         xtype : 'Store',
313         listeners : {
314          beforeload : function (_self, options)
315           {
316              if (!_this.tree.tree.selModel.getSelectedNode()) {
317                  return false;
318              }
319              
320              options.params = {   
321                 _changedFiles : _this.tree.tree.selModel.getSelectedNode().attributes.rev
322                 };
323           },
324          load : function (_self, records, options)
325           {
326              // clear selections??
327              _this.preview.load({
328                 method : 'POST',
329                 url : baseURL + '/MTrack/Merger',
330                 params : {
331                     _preview :  _this.tree.tree.selModel.getSelectedNode().attributes.rev
332                 }
333             });
334                 
335           
336           }
337         },
338         proxy : {
339          method : 'GET',
340          url : baseURL + '/MTrack/Merger.php',
341          xns : Roo.data,
342          '|xns' : 'Roo.data',
343          xtype : 'HttpProxy'
344         },
345         reader : {
346          fields : [
347              {
348                  'name': 'id',
349                  'type': 'int'
350              },
351              {
352                  'name': 'filename',
353                  'type': 'string'
354              },
355              {
356                  'name': 'added',
357                  'type': 'int'
358              },
359              {
360                  'name': 'removed',
361                  'type': 'int'
362              }
363          
364          ],
365          id : 'id',
366          root : 'data',
367          totalProperty : 'total',
368          xns : Roo.data,
369          '|xns' : 'Roo.data',
370          xtype : 'JsonReader'
371         }
372        },
373        sm : {
374         singleSelect : false,
375         xns : Roo.grid,
376         '|xns' : 'Roo.grid',
377         xtype : 'RowSelectionModel',
378         listeners : {
379          afterselectionchange : function (_self)
380           {
381              var ar = this.getSelections();
382              if (!ar.length) {
383                // show whole change.
384                _this.preview.load({
385                     method : 'POST',
386                     url : baseURL + '/MTrack/Merger',
387                     params : {
388                         _preview :  _this.tree.tree.selModel.getSelectedNode().attributes.rev
389                     }
390                 });
391                 return;
392              }
393              var files = [];
394              Roo.each(ar, function(s) {
395                   files.push(s.data.filename);
396              
397              });
398                _this.preview.load({
399                     method : 'POST',
400                     url : baseURL + '/MTrack/Merger',
401                     params : {
402                         _preview :  _this.tree.tree.selModel.getSelectedNode().attributes.rev,
403                         files:  Roo.encode(files)
404                     }
405                 });   
406              
407              
408           }
409         }
410        },
411        colModel : [
412         {
413          dataIndex : 'filename',
414          header : _this._strings['0b27918290ff5323bea1e3b78a9cf04e'] /* File */,
415          renderer : function(v) { return String.format('{0}', v); },
416          width : 200,
417          xns : Roo.grid,
418          '|xns' : 'Roo.grid',
419          xtype : 'ColumnModel'
420         },
421         {
422          dataIndex : 'added',
423          header : _this._strings['f29ddbfb905eb2593fdcdfb243f9af85'] /* Added */,
424          renderer : function(v) { return String.format('{0}', v); },
425          width : 50,
426          xns : Roo.grid,
427          '|xns' : 'Roo.grid',
428          xtype : 'ColumnModel'
429         },
430         {
431          dataIndex : 'removed',
432          header : _this._strings['93f07b720ebf7d1246512569761a5804'] /* Removed */,
433          renderer : function(v) { return String.format('{0}', v); },
434          width : 50,
435          xns : Roo.grid,
436          '|xns' : 'Roo.grid',
437          xtype : 'ColumnModel'
438         }
439        ]
440       }
441      },
442      {
443       autoScroll : true,
444       fitToFrame : true,
445       region : 'south',
446       title : _this._strings['66717bf2b8235cc94a52d5b815d57a54'] /* Review Changes */,
447       xns : Roo,
448       '|xns' : 'Roo',
449       xtype : 'ContentPanel',
450       listeners : {
451        render : function (_self)
452         {
453           _this.preview = _self;
454         }
455       }
456      }
457     ]
458    }
459   };  }
460 });