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