Pman.Dialog.CoreAutoSavePreview.bjs
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.bjs
1 {
2     "id": "roo-file-208",
3     "name": "Pman.Dialog.CoreAutoSavePreview",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreAutoSavePreview.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n    if(typeof(_this.data) != 'undefined'){\n        _this.grid.footer.onClick('first');\n    }\n    \n}"
11             },
12             "background": false,
13             "closable": false,
14             "collapsible": false,
15             "height": 500,
16             "modal": true,
17             "resizable": false,
18             "title": "Saved Version",
19             "width": 800,
20             "xtype": "LayoutDialog",
21             "|xns": "Roo",
22             "items": [
23                 {
24                     "*prop": "center",
25                     "xtype": "LayoutRegion",
26                     "|xns": "Roo"
27                 },
28                 {
29                     "*prop": "west",
30                     "split": true,
31                     "width": 200,
32                     "xtype": "LayoutRegion",
33                     "|xns": "Roo"
34                 },
35                 {
36                     "listeners": {
37                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
38                     },
39                     "background": false,
40                     "fitContainer": true,
41                     "fitToframe": true,
42                     "region": "west",
43                     "tableName": "Events",
44                     "title": "Events",
45                     "xtype": "GridPanel",
46                     "|xns": "Roo",
47                     "items": [
48                         {
49                             "listeners": {
50                                 "|render": "function() \n{\n    _this.grid = this; \n    \n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
51                             },
52                             "*prop": "grid",
53                             "autoExpandColumn": "event_when",
54                             "loadMask": true,
55                             "xtype": "Grid",
56                             "|xns": "Roo.grid",
57                             "items": [
58                                 {
59                                     "listeners": {
60                                         "afterselectionchange": "function (_self)\n{\n    var selected = this.getSelected();\n    \n    _this.source = '';\n    \n    if(!selected){\n       _this.viewPanel.setContent(\"Please select an saved version on the left\"); \n       return;\n    }\n    \n    _this.viewPanel.load( { url : baseURL + \"/Roo/Events\", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){\n        \n        var res = Roo.decode(oResponse.responseText);\n        \n        if(!bSuccess || !res.success){\n            _this.viewPanel.setContent(\"Load data failed?!\");\n        }\n        \n        if(typeof(res.data) === 'string'){\n            _this.viewPanel.setContent(res.data);\n            return;\n        }\n        \n        if(!_this.data.successFn){\n            Roo.MessageBox.alert('Error', 'Please setup the successFn');\n            return;\n        }\n        \n        _this.source = _this.data.successFn(res);\n\n        _this.viewPanel.setContent(_this.source);\n        \n    });\n}"
61                                     },
62                                     "*prop": "sm",
63                                     "singleSelect": true,
64                                     "xtype": "RowSelectionModel",
65                                     "|xns": "Roo.grid"
66                                 },
67                                 {
68                                     "listeners": {
69                                         "beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    if(typeof(_this.data) == 'undefined'){\n        this.removeAll();\n        return false;\n    }\n\n    var d = Roo.apply({}, _this.data);\n    delete d.successFn;\n\n    Roo.apply(o.params, d);\n    \n}",
70                                         "load": "function (_self, records, options)\n{\n    var sm = _this.grid.getSelectionModel();\n    if (!sm.getSelections().length) {\n        sm.selectFirstRow();\n        \n        sm.fireEvent('afterselectionchange', sm);\n    }\n}"
71                                     },
72                                     "*prop": "dataSource",
73                                     "remoteSort": true,
74                                     "xtype": "Store",
75                                     "|sortInfo": "{ field : 'event_when', direction: 'DESC' }",
76                                     "|xns": "Roo.data",
77                                     "items": [
78                                         {
79                                             "*prop": "proxy",
80                                             "method": "GET",
81                                             "xtype": "HttpProxy",
82                                             "|url": "baseURL + '/Roo/Events.php'",
83                                             "|xns": "Roo.data"
84                                         },
85                                         {
86                                             "*prop": "reader",
87                                             "id": "id",
88                                             "root": "data",
89                                             "totalProperty": "total",
90                                             "xtype": "JsonReader",
91                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'event_when',\n        'type': 'string'\n    }\n]",
92                                             "|xns": "Roo.data"
93                                         }
94                                     ]
95                                 },
96                                 {
97                                     "*prop": "footer",
98                                     "displayInfo": false,
99                                     "pageSize": 25,
100                                     "xtype": "PagingToolbar",
101                                     "|xns": "Roo"
102                                 },
103                                 {
104                                     "*prop": "colModel[]",
105                                     "dataIndex": "event_when",
106                                     "header": "Date",
107                                     "width": 100,
108                                     "xtype": "ColumnModel",
109                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }",
110                                     "|xns": "Roo.grid"
111                                 }
112                             ]
113                         }
114                     ]
115                 },
116                 {
117                     "listeners": {
118                         "render": "function (_self)\n{\n    _this.viewPanel = _self;\n}"
119                     },
120                     "autoScroll": true,
121                     "background": false,
122                     "fitContainer": true,
123                     "fitToFrame": true,
124                     "region": "center",
125                     "xtype": "ContentPanel",
126                     "|xns": "Roo"
127                 },
128                 {
129                     "listeners": {
130                         "|click": "function() {\n    _this.dialog.hide();\n}"
131                     },
132                     "*prop": "buttons[]",
133                     "text": "Cancel",
134                     "xtype": "Button",
135                     "|xns": "Roo"
136                 },
137                 {
138                     "listeners": {
139                         "|click": "function() {\n\n    _this.dialog.hide();\n    \n    if (_this.callback && _this.source != '') {\n        _this.callback.call(this, _this.source);\n    }\n}"
140                     },
141                     "*prop": "buttons[]",
142                     "text": "OK",
143                     "xtype": "Button",
144                     "|xns": "Roo"
145                 }
146             ]
147         }
148     ],
149     "permname": "",
150     "modOrder": "001"
151 }