php warnings
[Pman.MTrack] / Pman.MTrack.js
1 /**
2  * Helper methods..
3  *
4  */
5
6 Pman.MTrack = {
7     loaded : false,
8     
9     loadAudit : function (id, el)
10     {
11         new Pman.Request({
12             url : baseURL + '/Roo/mtrack_change',
13             method : 'GET',
14             params : { 
15                 onid : id,
16                 ontable : 'mtrack_ticket',
17                 sort : 'changedate',
18                 dir: 'ASC',
19                 limit : 9999
20             } ,
21             success : function(res) {
22                // Roo.log(res.data);
23                 // render it into a template..
24                 var out = '';
25                 Roo.each(res.data, function(cg) {
26                     
27                     if (cg.rev.length) {
28                         out+= Pman.MTrack.template.change_commit(cg);
29                         return;
30                     }
31                     if (!cg.reason.length && !cg.audit.length) {
32                         return;
33                     }
34                     
35                     if ( !cg.reason.length || cg.reason == 'Changed' || cg.reason == 'Created' || cg.reason.match(/Hours worked:/)) {
36                         out+= Pman.MTrack.template.change_simple(cg);
37                         return;
38                     }
39                     out+= Pman.MTrack.template.change_comment(cg);
40                 });
41                 
42                 el.dom.innerHTML = '<ul>' + out + '</ul>';
43                  
44                 el.select('.change-log-item').on('click', Pman.MTrack.auditToggle);
45             }
46         });
47         
48     },
49     auditToggle : function(e,y)
50     {
51        // Roo.log(this);
52         var id = this.id.split('-').pop();
53         if (Roo.get('change-expand-' + id)) {
54             Roo.get('change-expand-' + id).setVisibilityMode(Roo.Element.DISPLAY);
55             Roo.get('change-expand-' + id).toggle(true);
56         }
57         if (Roo.get('change-expander-' + id)) {
58             Roo.get('change-expander-' + id).toggleClass('change-log-item-expanded');
59         }
60         
61         
62     },
63     
64     pushState: function(cfg)
65     {
66         if (!this.loaded) {
67             return;
68         }
69         try { 
70             window.history.pushState( { url: cfg.url }, cfg.title, cfg.href);
71             Roo.log("MtrackWeb.pushState: history push state");
72         } catch (e) {
73             Roo.log(e);
74             
75         }
76             
77         
78     }
79     
80     
81     
82 }