Pman.Tab.MTrackTimeline.bjs
[Pman.MTrack] / Pman.Tab.MTrackTimeline.bjs
1 {
2     "id": "roo-file-77",
3     "name": "Pman.Tab.MTrackTimeline",
4     "parent": "Pman.Tab.DocumentsTab",
5     "title": "",
6     "path": "/home/alan/gitlive/Pman.MTrack/Pman.Tab.MTrackTimeline.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "activate": "function (_self)\n{\n    // navigation..\n    // a) record the fact we go here.. (for history)\n    \n    // when page loads, we have to go to this page..\n    \n    // at other times, we just check \n    //  a) project was the same as before... - do not change.\n    //  b) \n    _this.project = _this.project || 0;\n    \n    \n    if (typeof(MTrackWeb) != 'undefined' && !MTrackWeb.Layout) {\n        return;\n    }\n    /*\n    if (!_this.iscroll) {  \n    \n        (function() {\n \n            try {\n                _this.iscroll = new Roo.ux.Iscroll(_this.tpanel.el.dom);\n            } catch(e) { \n                Roo.log(e);\n            }\n        }).defer(100);    \n\n    }\n    _this.iscroll = true;    \n    \n    */\n    var  chg_project =  (_this.project != Pman.Tab.DocumentsTab.panel.getProjectId());\n    \n   _this.project = Pman.Tab.DocumentsTab.panel.getProjectId();\n    \n   if (typeof(MTrackWeb) == 'undefined') {\n        return;\n    }\n    try { \n         window.history.pushState( { url: '/Timeline' }, 'Timeline' , baseURL +  '/Timeline' );\n    } catch (e) {}\n    \n    MTrack.currentURL = '/Timeline';\n    if (chg_project) {\n        (function() {\n            _this.grid.ds.load({});\n           //_this.tpanel.view.store.load({});\n        }).defer(100);\n    }\n   \n \n}"
11             },
12             "background": true,
13             "fitContainer": true,
14             "fitToFrame": true,
15             "region": "center",
16             "title": "Project Timeline",
17             "xtype": "NestedLayoutPanel",
18             "|xns": "Roo",
19             "items": [
20                 {
21                     "|xns": "Roo",
22                     "xtype": "BorderLayout",
23                     "*prop": "layout",
24                     "items": [
25                         {
26                             "*prop": "center",
27                             "tabPosition": "top",
28                             "xtype": "LayoutRegion",
29                             "|xns": "Roo"
30                         },
31                         {
32                             "*prop": "west",
33                             "width": 250,
34                             "xtype": "LayoutRegion",
35                             "|xns": "Roo"
36                         },
37                         {
38                             "listeners": {
39                                 "activate": "function (_self)\n{\n    _this.tpanel = _self;\n}"
40                             },
41                             "autoScroll": true,
42                             "background": true,
43                             "fitContainer": true,
44                             "fitToFrame": true,
45                             "region": "center",
46                             "title": "Timeline",
47                             "xtype": "ContentPanel",
48                             "|mload": "function(url) {\n\n  // can you actually link to this page..\n  // perhaps a specific day..\n\n    this._url = url;\n   // this._project = MTrack.projectCombo.getValue();\n   // MTrack.ajaxLoad(url, this);\n   _this.grid.ds.load({});\n    \n}\n",
49                             "|xns": "Roo",
50                             "items": [
51                                 {
52                                     "|xns": "Roo",
53                                     "xtype": "Toolbar",
54                                     "*prop": "toolbar",
55                                     "items": [
56                                         {
57                                             "text": "Select a date to refresh..",
58                                             "xtype": "Button",
59                                             "|xns": "Roo.Toolbar"
60                                         }
61                                     ]
62                                 },
63                                 {
64                                     "|xns": "Roo",
65                                     "xtype": "View"
66                                 }
67                             ]
68                         },
69                         {
70                             "region": "west",
71                             "xtype": "NestedLayoutPanel",
72                             "|xns": "Roo",
73                             "items": [
74                                 {
75                                     "|xns": "Roo",
76                                     "xtype": "BorderLayout",
77                                     "*prop": "layout",
78                                     "items": [
79                                         {
80                                             "*prop": "center",
81                                             "xtype": "LayoutRegion",
82                                             "|xns": "Roo"
83                                         },
84                                         {
85                                             "*prop": "north",
86                                             "height": 220,
87                                             "xtype": "LayoutRegion",
88                                             "|xns": "Roo"
89                                         },
90                                         {
91                                             "listeners": {
92                                                 "|activate": "function() {\n    _this.gridpanel = this;\n\n}"
93                                             },
94                                             "autoScroll": true,
95                                             "background": true,
96                                             "fitContainer": true,
97                                             "fitToframe": true,
98                                             "region": "center",
99                                             "tableName": "Events",
100                                             "title": "Events",
101                                             "xtype": "GridPanel",
102                                             "|xns": "Roo",
103                                             "items": [
104                                                 {
105                                                     "listeners": {
106                                                         "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n       this.dataSource.load({});\n\n}"
107                                                     },
108                                                     "*prop": "grid",
109                                                     "autoExpandColumn": "person_id_name",
110                                                     "loadMask": true,
111                                                     "xtype": "Grid",
112                                                     "|xns": "Roo.grid",
113                                                     "items": [
114                                                         {
115                                                             "listeners": {
116                                                                 "afterselectionchange": "function (_self)\n{\n  // select the data..\n  \n  var r= _this.grid.sm.getSelected();\n  \n  \n  _this.datePicker.setValue(r.data.changeday);\n   //   _this.tpanel.view.store.load({});\n}"
117                                                             },
118                                                             "*prop": "sm",
119                                                             "singleSelect": true,
120                                                             "xtype": "RowSelectionModel",
121                                                             "|xns": "Roo.grid"
122                                                         },
123                                                         {
124                                                             "listeners": {
125                                                                 "beforeload": "function (_self, o)\n{\n    o = o || {};\n    o.params = o.params || {};\n    \n    if (!_this.datePicker || !_this.datePicker.getValue) {\n        return false;\n    }\n    o.params.from_date = _this.datePicker.activeDate.format(\"Y-m-01\");\n    o.params.viewtype = 'summary';    \n    o.params.timeline = 1;\n    // project?\n    o.params.project =  Pman.Tab.DocumentsTab.panel.getProjectId();\n}"
126                                                             },
127                                                             "*prop": "dataSource",
128                                                             "remoteSort": true,
129                                                             "xtype": "Store",
130                                                             "|sortInfo": "{ field : 'person_name', direction: 'ASC' }",
131                                                             "|xns": "Roo.data",
132                                                             "items": [
133                                                                 {
134                                                                     "*prop": "proxy",
135                                                                     "method": "GET",
136                                                                     "xtype": "HttpProxy",
137                                                                     "|url": "baseURL + '/Roo/mtrack_change.php'",
138                                                                     "|xns": "Roo.data"
139                                                                 },
140                                                                 {
141                                                                     "*prop": "reader",
142                                                                     "id": "id",
143                                                                     "root": "data",
144                                                                     "totalProperty": "total",
145                                                                     "xtype": "JsonReader",
146                                                                     "|fields": "[\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'changeday',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'nchanges',\n        'type': 'int'\n    },\n    'project_code',\n    'project_id',\n    \n\n]",
147                                                                     "|xns": "Roo.data"
148                                                                 }
149                                                             ]
150                                                         },
151                                                         {
152                                                             "*prop": "colModel[]",
153                                                             "dataIndex": "changeday",
154                                                             "header": "Date",
155                                                             "width": 30,
156                                                             "xtype": "ColumnModel",
157                                                             "|renderer": "function(v,x,r) { \n\n    return String.format('{0}',  v ? v.format('d') : '' );\n }",
158                                                             "|xns": "Roo.grid"
159                                                         },
160                                                         {
161                                                             "*prop": "colModel[]",
162                                                             "dataIndex": "project_code",
163                                                             "header": "Project",
164                                                             "width": 50,
165                                                             "xtype": "ColumnModel",
166                                                             "|renderer": "function(v,x,r) { \n    \n    Roo.log(r);\n    return String.format( '{0}' ,v );\n }\n ",
167                                                             "|xns": "Roo.grid"
168                                                         },
169                                                         {
170                                                             "*prop": "colModel[]",
171                                                             "dataIndex": "person_name",
172                                                             "header": "Who",
173                                                             "width": 100,
174                                                             "xtype": "ColumnModel",
175                                                             "|renderer": "function(v,x,r) { \n    \n    return String.format( '{0}' , v);\n }\n ",
176                                                             "|xns": "Roo.grid"
177                                                         },
178                                                         {
179                                                             "*prop": "colModel[]",
180                                                             "align": "right",
181                                                             "dataIndex": "nchanges",
182                                                             "header": "Changes",
183                                                             "width": 30,
184                                                             "xtype": "ColumnModel",
185                                                             "|renderer": "function(v,x,r) { \n    return v * 1;\n }\n ",
186                                                             "|xns": "Roo.grid"
187                                                         }
188                                                     ]
189                                                 }
190                                             ]
191                                         },
192                                         {
193                                             "region": "north",
194                                             "xtype": "ContentPanel",
195                                             "|xns": "Roo",
196                                             "items": [
197                                                 {
198                                                     "listeners": {
199                                                         "render": "function (_self)\n{\n  _this.datePicker = _self;\n}",
200                                                         "select": "function (_self, date)\n{\n    if (_this.tpanel.view.store) {\n        return;\n    }\n    _this.tpanel.view.store.load({});\n}",
201                                                         "monthchange": "function (_self, date)\n{\n  if (_this.grid) {\n     _this.grid.ds.load({   });\n     }\n}"
202                                                     },
203                                                     "xtype": "DatePicker",
204                                                     "|xns": "Roo"
205                                                 }
206                                             ]
207                                         }
208                                     ]
209                                 }
210                             ]
211                         }
212                     ]
213                 }
214             ]
215         }
216     ],
217     "permname": "",
218     "modOrder": "300"
219 }