Pman.Tab.MTrackTimeline.bjs
[Pman.MTrack] / Pman.Tab.MTrackTimeline.bjs
1 {
2     "id": "roo-file-225",
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 (typeof(Pman.Tab.DocumentsTab) == 'undefined') {\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                                     "selectedClass": "change-log-item-expanded",
65                                     "singleSelect": false,
66                                     "xtype": "View",
67                                     "|xns": "Roo",
68                                     "items": [
69                                         {
70                                             "*prop": "tpl",
71                                             "xtype": "XTemplate",
72                                             "|url": "rootURL + '/Pman/MTrack/templates/timeline.html'",
73                                             "|xns": "Roo"
74                                         },
75                                         {
76                                             "listeners": {
77                                                 "beforeload": "function (_self, o)\n{\n    o = o || {};\n    o.params = o.params || {};\n    \n    var sel = _this.grid.selModel.getSelected();\n    o.params.from_date = sel.data.changeday.format(\"Y-m-d\");\n    o.params.person_id = sel.data.person_id;\n   // o.params.viewtype = 'summary';    \n    o.params.timeline = 1;\n    // project?\n    o.params.project_id =  sel.data.project_id;\n}"
78                                             },
79                                             "*prop": "store",
80                                             "remoteSort": true,
81                                             "xtype": "Store",
82                                             "|sortInfo": "{ field : 'person_name', direction: 'ASC' }",
83                                             "|xns": "Roo.data",
84                                             "items": [
85                                                 {
86                                                     "*prop": "proxy",
87                                                     "method": "GET",
88                                                     "xtype": "HttpProxy",
89                                                     "|url": "baseURL + '/Roo/mtrack_change.php'",
90                                                     "|xns": "Roo.data"
91                                                 },
92                                                 {
93                                                     "*prop": "reader",
94                                                     "id": "id",
95                                                     "root": "data",
96                                                     "totalProperty": "total",
97                                                     "xtype": "JsonReader",
98                                                     "|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]",
99                                                     "|xns": "Roo.data"
100                                                 }
101                                             ]
102                                         }
103                                     ]
104                                 }
105                             ]
106                         },
107                         {
108                             "region": "west",
109                             "xtype": "NestedLayoutPanel",
110                             "|xns": "Roo",
111                             "items": [
112                                 {
113                                     "|xns": "Roo",
114                                     "xtype": "BorderLayout",
115                                     "*prop": "layout",
116                                     "items": [
117                                         {
118                                             "*prop": "center",
119                                             "xtype": "LayoutRegion",
120                                             "|xns": "Roo"
121                                         },
122                                         {
123                                             "*prop": "north",
124                                             "height": 220,
125                                             "xtype": "LayoutRegion",
126                                             "|xns": "Roo"
127                                         },
128                                         {
129                                             "listeners": {
130                                                 "|activate": "function() {\n    _this.gridpanel = this;\n\n}"
131                                             },
132                                             "autoScroll": true,
133                                             "background": false,
134                                             "fitContainer": true,
135                                             "fitToframe": true,
136                                             "region": "center",
137                                             "tableName": "Events",
138                                             "title": "Events",
139                                             "xtype": "GridPanel",
140                                             "|xns": "Roo",
141                                             "items": [
142                                                 {
143                                                     "listeners": {
144                                                         "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n       this.dataSource.load({});\n\n}"
145                                                     },
146                                                     "*prop": "grid",
147                                                     "autoExpandColumn": "person_id_name",
148                                                     "loadMask": true,
149                                                     "xtype": "Grid",
150                                                     "|xns": "Roo.grid",
151                                                     "items": [
152                                                         {
153                                                             "listeners": {
154                                                                 "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   \n}                                                                   "
155                                                             },
156                                                             "*prop": "sm",
157                                                             "singleSelect": true,
158                                                             "xtype": "RowSelectionModel",
159                                                             "|xns": "Roo.grid"
160                                                         },
161                                                         {
162                                                             "listeners": {
163                                                                 "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_id =  Pman.Tab.DocumentsTab ? Pman.Tab.DocumentsTab.panel.getProjectId() : 0;\n}"
164                                                             },
165                                                             "*prop": "dataSource",
166                                                             "remoteSort": true,
167                                                             "xtype": "Store",
168                                                             "|sortInfo": "{ field : 'person_name', direction: 'ASC' }",
169                                                             "|xns": "Roo.data",
170                                                             "items": [
171                                                                 {
172                                                                     "*prop": "proxy",
173                                                                     "method": "GET",
174                                                                     "xtype": "HttpProxy",
175                                                                     "|url": "baseURL + '/Roo/mtrack_change.php'",
176                                                                     "|xns": "Roo.data"
177                                                                 },
178                                                                 {
179                                                                     "*prop": "reader",
180                                                                     "id": "id",
181                                                                     "root": "data",
182                                                                     "totalProperty": "total",
183                                                                     "xtype": "JsonReader",
184                                                                     "|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]",
185                                                                     "|xns": "Roo.data"
186                                                                 }
187                                                             ]
188                                                         },
189                                                         {
190                                                             "*prop": "colModel[]",
191                                                             "dataIndex": "changeday",
192                                                             "header": "Date",
193                                                             "width": 30,
194                                                             "xtype": "ColumnModel",
195                                                             "|renderer": "function(v,x,r) { \n\n    return String.format('{0}',  v ? v.format('d') : '' );\n }",
196                                                             "|xns": "Roo.grid"
197                                                         },
198                                                         {
199                                                             "*prop": "colModel[]",
200                                                             "dataIndex": "project_code",
201                                                             "header": "Project",
202                                                             "width": 50,
203                                                             "xtype": "ColumnModel",
204                                                             "|renderer": "function(v,x,r) { \n    \n    Roo.log(r);\n    return String.format( '{0}' ,v );\n }\n ",
205                                                             "|xns": "Roo.grid"
206                                                         },
207                                                         {
208                                                             "*prop": "colModel[]",
209                                                             "dataIndex": "person_name",
210                                                             "header": "Who",
211                                                             "width": 100,
212                                                             "xtype": "ColumnModel",
213                                                             "|renderer": "function(v,x,r) { \n    \n    return String.format( '{0}' , v);\n }\n ",
214                                                             "|xns": "Roo.grid"
215                                                         },
216                                                         {
217                                                             "*prop": "colModel[]",
218                                                             "align": "right",
219                                                             "dataIndex": "nchanges",
220                                                             "header": "Changes",
221                                                             "width": 30,
222                                                             "xtype": "ColumnModel",
223                                                             "|renderer": "function(v,x,r) { \n    return v * 1;\n }\n ",
224                                                             "|xns": "Roo.grid"
225                                                         }
226                                                     ]
227                                                 }
228                                             ]
229                                         },
230                                         {
231                                             "region": "north",
232                                             "xtype": "ContentPanel",
233                                             "|xns": "Roo",
234                                             "items": [
235                                                 {
236                                                     "listeners": {
237                                                         "render": "function (_self)\n{\n  _this.datePicker = _self;\n}",
238                                                         "select": "function (_self, date)\n{\n    if (!_this.tpanel) {\n        return;\n    }\n    _this.tpanel.view.store.load({});\n}",
239                                                         "monthchange": "function (_self, date)\n{\n  if (_this.grid) {\n     _this.grid.ds.load({   });\n     }\n}"
240                                                     },
241                                                     "xtype": "DatePicker",
242                                                     "|xns": "Roo"
243                                                 }
244                                             ]
245                                         }
246                                     ]
247                                 }
248                             ]
249                         }
250                     ]
251                 }
252             ]
253         }
254     ],
255     "permname": "",
256     "modOrder": "300"
257 }