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