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