php warnings
[Pman.MTrack] / Pman.Tab.MTrackTimeline.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.MTrackTimeline = new Roo.XComponent({
8
9  _strings : {
10   '9a9984a2dd014cc958919b73e2a1f33a' :"Project Timeline",
11   '87f9f735a1d36793ceaecd4e47124b63' :"Events",
12   '9e727fdd3aec8274f46685441900280d' :"Project",
13   '4ee972120bcda675f75222c87cb9d356' :"Who",
14   '3d1f92a565d3b1a61880236e33c49bf3' :"Timeline",
15   'c112bb3542e98308d12d5ecb10a67abc' :"Changes",
16   'e77ec81408c215410441b24d83ef5bec' :"Repos",
17   'ff5572e3fac2fd20b897cebfdf14e9d5' :"Code Changes",
18   '6c099dca310fcc4e75f7cc0d01e5afe1' :"Select a date to refresh.."
19  },
20
21   part     :  ["MTrack", "Timeline" ],
22   order    : '300-Pman.Tab.MTrackTimeline',
23   region   : 'center',
24   parent   : 'Pman.Tab.DocumentsTab',
25   name     : "unnamed module",
26   disabled : false, 
27   permname : '', 
28   _tree : function()
29   {
30    var _this = this;
31    var MODULE = this;
32    return {
33    background : true,
34    fitContainer : true,
35    fitToFrame : true,
36    region : 'center',
37    title : _this._strings['9a9984a2dd014cc958919b73e2a1f33a'] /* Project Timeline */,
38    xns : Roo,
39    '|xns' : 'Roo',
40    xtype : 'NestedLayoutPanel',
41    listeners : {
42     activate : function (_self)
43      {
44          // navigation..
45          // a) record the fact we go here.. (for history)
46          
47          // when page loads, we have to go to this page..
48          
49          // at other times, we just check 
50          //  a) project was the same as before... - do not change.
51          //  b) 
52          _this.project = _this.project || 0;
53          
54          
55          if (typeof(MTrackWeb) != 'undefined' && !MTrackWeb.Layout) {
56              return;
57          }
58          
59          if (typeof(Pman.Tab.DocumentsTab) == 'undefined') {
60              return;
61          }
62          /*
63          if (!_this.iscroll) {  
64          
65              (function() {
66       
67                  try {
68                      _this.iscroll = new Roo.ux.Iscroll(_this.tpanel.el.dom);
69                  } catch(e) { 
70                      Roo.log(e);
71                  }
72              }).defer(100);    
73      
74          }
75          _this.iscroll = true;    
76          
77          */
78          var  chg_project =  (_this.project != Pman.Tab.DocumentsTab.panel.getProjectId());
79          
80         _this.project = Pman.Tab.DocumentsTab.panel.getProjectId();
81          
82         if (typeof(MTrackWeb) == 'undefined') {
83              return;
84          }
85          try { 
86               window.history.pushState( { url: '/Timeline' }, 'Timeline' , baseURL +  '/Timeline' );
87          } catch (e) {}
88          
89          MTrack.currentURL = '/Timeline';
90          if (chg_project) {
91              (function() {
92                  _this.grid.ds.load({});
93                 //_this.tpanel.view.store.load({});
94              }).defer(100);
95          }
96         
97       
98      }
99    },
100    layout : {
101     xns : Roo,
102     '|xns' : 'Roo',
103     xtype : 'BorderLayout',
104     center : {
105      tabPosition : 'top',
106      xns : Roo,
107      '|xns' : 'Roo',
108      xtype : 'LayoutRegion'
109     },
110     west : {
111      width : 250,
112      xns : Roo,
113      '|xns' : 'Roo',
114      xtype : 'LayoutRegion'
115     },
116     items  : [
117      {
118       autoScroll : true,
119       fitToFrame : true,
120       region : 'center',
121       title : _this._strings['ff5572e3fac2fd20b897cebfdf14e9d5'] /* Code Changes */,
122       xns : Roo,
123       '|xns' : 'Roo',
124       xtype : 'ContentPanel',
125       listeners : {
126        activate : function (_self)
127         {
128             
129         },
130        render : function (_self)
131         {
132             _this.commitpanel = _self;
133         }
134       },
135       view : {
136        tpl : new Roo.DomTemplate({url : rootURL +'/Pman/MTrack/domtemplates/dailychanges.html'}),
137        xns : Roo,
138        '|xns' : 'Roo',
139        xtype : 'View',
140        listeners : {
141         preparedata : function (_self, data, i, rec)
142          {
143              Roo.apply(data, rec.json);
144          }
145        },
146        store : {
147         xns : Roo.data,
148         '|xns' : 'Roo.data',
149         xtype : 'Store',
150         listeners : {
151          beforeload : function (_self, o)
152           {
153               o.params = o.params || {};
154               o.params._daychanges = _this.datePicker.activeDate.format("Y-m-d");
155               var re = _this.grid.selModel.getSelected();
156               if (!re) {
157                   return false;
158               }
159               o.params.id = re.data.repo_id;
160           }
161         },
162         proxy : {
163          method : 'GET',
164          timeout : 60000,
165          url : baseURL + '/Roo/mtrack_repos',
166          xns : Roo.data,
167          '|xns' : 'Roo.data',
168          xtype : 'HttpProxy'
169         },
170         reader : {
171          fields : [
172              {
173                  'name': 'id',
174                  'type': 'int'
175              },
176              'name'
177          ],
178          id : 'id',
179          root : 'data',
180          xns : Roo.data,
181          '|xns' : 'Roo.data',
182          xtype : 'JsonReader'
183         }
184        }
185       }
186      },
187      {
188       autoScroll : true,
189       background : true,
190       fitContainer : true,
191       fitToFrame : true,
192       mload : function(url) {
193       
194         // can you actually link to this page..
195         // perhaps a specific day..
196       
197           this._url = url;
198          // this._project = MTrack.projectCombo.getValue();
199          // MTrack.ajaxLoad(url, this);
200          _this.grid.ds.load({});
201           
202       },
203       region : 'center',
204       title : _this._strings['3d1f92a565d3b1a61880236e33c49bf3'] /* Timeline */,
205       xns : Roo,
206       '|xns' : 'Roo',
207       xtype : 'ContentPanel',
208       listeners : {
209        activate : function (_self)
210         {
211             _this.tpanel = _self;
212         }
213       },
214       toolbar : {
215        xns : Roo,
216        '|xns' : 'Roo',
217        xtype : 'Toolbar',
218        items  : [
219         {
220          text : _this._strings['6c099dca310fcc4e75f7cc0d01e5afe1'] /* Select a date to refresh.. */,
221          xns : Roo.Toolbar,
222          '|xns' : 'Roo.Toolbar',
223          xtype : 'Button'
224         }
225        ]
226       },
227       items  : [
228        {
229         multiSelect : true,
230         selectedClass : 'change-log-item-expanded',
231         singleSelect : false,
232         toggleSelect : true,
233         xns : Roo,
234         '|xns' : 'Roo',
235         xtype : 'View',
236         listeners : {
237          beforeclick : function (_self, index, node, e)
238           {
239               Roo.log(node);
240               Roo.log(e);
241           },
242          beforeselect : function (_self, node, selections)
243           {
244              //Roo.log(node)
245              //Roo.log(this.indexOf(node));
246              var rec =  this.store.getAt(this.indexOf(node));
247              //Roo.log(data);
248              
249              new Pman.Request({
250                    url : baseURL + '/Roo/mtrack_change',
251                    method :'GET',
252                    params : {
253                       _id : rec.data.id,
254                       _withdiff : 1
255                   },
256                   success : function (res) {
257                   
258                      //.. this.tpl.
259                      //Roo.log( _this.tpanel.view.chgtmp.apply(res));
260                       
261                   
262                   }
263               });
264              
265              
266              
267              
268           }
269         },
270         store : {
271          remoteSort : true,
272          sortInfo : { field : 'person_name', direction: 'ASC' },
273          xns : Roo.data,
274          '|xns' : 'Roo.data',
275          xtype : 'Store',
276          listeners : {
277           beforeload : function (_self, o)
278            {
279                o = o || {};
280                o.params = o.params || {};
281                
282                var sel = _this.grid.selModel.getSelected();
283                if (!sel) {
284                    return false;
285                }
286                
287                
288                o.params.from_date =_this.datePicker.activeDate.format("Y-m-d");
289                o.params.person_id = sel.data.person_id;
290               // o.params.viewtype = 'summary';    
291                o.params.timeline = 1;
292                // project?
293                o.params.project_id =  sel.data.project_id;
294                o.params.limit = 9999;
295            }
296          },
297          proxy : {
298           method : 'GET',
299           url : baseURL + '/Roo/mtrack_change.php',
300           xns : Roo.data,
301           '|xns' : 'Roo.data',
302           xtype : 'HttpProxy'
303          },
304          reader : {
305           fields : [
306               {
307                   'name': 'person_id',
308                   'type': 'int'
309               },
310               {
311                   'name': 'person_name',
312                   'type': 'string'
313               },
314               {
315                   'name': 'changeday',
316                   'type': 'date',
317                   'dateFormat': 'Y-m-d'
318               },
319               {
320                   'name': 'nchanges',
321                   'type': 'int'
322               },
323               'project_code',
324               'project_id'
325               
326           
327           ],
328           id : 'id',
329           root : 'data',
330           totalProperty : 'total',
331           xns : Roo.data,
332           '|xns' : 'Roo.data',
333           xtype : 'JsonReader'
334          }
335         },
336         chgtpl : {
337          url : rootURL + '/Pman/MTrack/templates/timeline-changelog.html',
338          xns : Roo,
339          '|xns' : 'Roo',
340          xtype : 'XTemplate'
341         },
342         tpl : {
343          url : rootURL + '/Pman/MTrack/templates/timeline.html',
344          xns : Roo,
345          '|xns' : 'Roo',
346          xtype : 'XTemplate'
347         }
348        }
349       ]
350      },
351      {
352       region : 'west',
353       xns : Roo,
354       '|xns' : 'Roo',
355       xtype : 'NestedLayoutPanel',
356       layout : {
357        xns : Roo,
358        '|xns' : 'Roo',
359        xtype : 'BorderLayout',
360        center : {
361         xns : Roo,
362         '|xns' : 'Roo',
363         xtype : 'LayoutRegion'
364        },
365        north : {
366         height : 220,
367         xns : Roo,
368         '|xns' : 'Roo',
369         xtype : 'LayoutRegion'
370        },
371        items  : [
372         {
373          autoScroll : true,
374          background : false,
375          fitContainer : true,
376          fitToframe : true,
377          region : 'center',
378          tableName : 'Events',
379          title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'] /* Events */,
380          xns : Roo,
381          '|xns' : 'Roo',
382          xtype : 'GridPanel',
383          listeners : {
384           activate : function() {
385                _this.gridpanel = this;
386            
387            }
388          },
389          grid : {
390           autoExpandColumn : 'person_id_name',
391           loadMask : true,
392           xns : Roo.grid,
393           '|xns' : 'Roo.grid',
394           xtype : 'Grid',
395           listeners : {
396            render : function() 
397             {
398                 _this.grid = this; 
399                 //_this.dialog = Pman.Dialog.FILL_IN
400                    this.dataSource.load({});
401             
402             }
403           },
404           dataSource : {
405            remoteSort : true,
406            sortInfo : { field : 'person_name', direction: 'ASC' },
407            xns : Roo.data,
408            '|xns' : 'Roo.data',
409            xtype : 'Store',
410            listeners : {
411             beforeload : function (_self, o)
412              {
413                  o = o || {};
414                  o.params = o.params || {};
415                  
416                  if (!_this.datePicker || !_this.datePicker.getValue) {
417                      return false;
418                  }
419                  o.params.on_date = _this.datePicker.activeDate.format("Y-m-d");
420                  o.params.viewtype = 'summary';    
421                  o.params.timeline = 1;
422                  // project?
423                  o.params.project_id =  Pman.Tab.DocumentsTab ? 
424                              Pman.Tab.DocumentsTab.panel.getProjectId() : 0;
425              }
426            },
427            proxy : {
428             method : 'GET',
429             url : baseURL + '/Roo/mtrack_change.php',
430             xns : Roo.data,
431             '|xns' : 'Roo.data',
432             xtype : 'HttpProxy'
433            },
434            reader : {
435             fields : [
436                 {
437                     'name': 'person_id',
438                     'type': 'int'
439                 },
440                 {
441                     'name': 'person_name',
442                     'type': 'string'
443                 },
444                 {
445                     'name': 'changeday',
446                     'type': 'date',
447                     'dateFormat': 'Y-m-d'
448                 },
449                 {
450                     'name': 'nchanges',
451                     'type': 'int'
452                 },
453                 'project_code',
454                 'project_id',
455                 'repo_id',
456                 'repo_name'
457                 
458             
459             ],
460             id : 'id',
461             root : 'data',
462             totalProperty : 'total',
463             xns : Roo.data,
464             '|xns' : 'Roo.data',
465             xtype : 'JsonReader'
466            }
467           },
468           sm : {
469            singleSelect : true,
470            xns : Roo.grid,
471            '|xns' : 'Roo.grid',
472            xtype : 'RowSelectionModel',
473            listeners : {
474             afterselectionchange : function (_self)
475              {
476                // select the data..
477                
478                var r= _this.grid.sm.getSelected();
479                
480                
481                //_this.datePicker.setValue(r.data.changeday);
482                //
483                 _this.commitpanel.view.store.load({});
484                // _this.tpanel.view.store.load({});
485                 
486              }
487            }
488           },
489           colModel : [
490            {
491             dataIndex : 'repo_name',
492             header : _this._strings['e77ec81408c215410441b24d83ef5bec'] /* Repos */,
493             renderer : function(v,x,r) { 
494             
495                 return String.format('{0}',  v  ? v : '' );
496              },
497             width : 30,
498             xns : Roo.grid,
499             '|xns' : 'Roo.grid',
500             xtype : 'ColumnModel'
501            },
502            {
503             dataIndex : 'project_code',
504             header : _this._strings['9e727fdd3aec8274f46685441900280d'] /* Project */,
505             renderer : function(v,x,r) { 
506                 
507                 Roo.log(r);
508                 return String.format( '{0}' ,v );
509              },
510             width : 50,
511             xns : Roo.grid,
512             '|xns' : 'Roo.grid',
513             xtype : 'ColumnModel'
514            },
515            {
516             dataIndex : 'person_name',
517             header : _this._strings['4ee972120bcda675f75222c87cb9d356'] /* Who */,
518             renderer : function(v,x,r) { 
519                 
520                 return String.format( '{0}' , v);
521              },
522             width : 100,
523             xns : Roo.grid,
524             '|xns' : 'Roo.grid',
525             xtype : 'ColumnModel'
526            },
527            {
528             align : 'right',
529             dataIndex : 'nchanges',
530             header : _this._strings['c112bb3542e98308d12d5ecb10a67abc'] /* Changes */,
531             renderer : function(v,x,r) { 
532                 return v * 1;
533              },
534             width : 30,
535             xns : Roo.grid,
536             '|xns' : 'Roo.grid',
537             xtype : 'ColumnModel'
538            }
539           ]
540          }
541         },
542         {
543          region : 'north',
544          xns : Roo,
545          '|xns' : 'Roo',
546          xtype : 'ContentPanel',
547          items  : [
548           {
549            xns : Roo,
550            '|xns' : 'Roo',
551            xtype : 'DatePicker',
552            listeners : {
553             monthchange : function (_self, date)
554              {
555                 
556              },
557             render : function (_self)
558              {
559                _this.datePicker = _self;
560              },
561             select : function (_self, date)
562              {
563                  if (! _this.grid) {
564                      return;
565                  }
566                  _this.grid.ds.load({});
567              }
568            }
569           }
570          ]
571         }
572        ]
573       }
574      }
575     ]
576    }
577   };  }
578 });