Pman.Dialog.CoreAutoSavePreview.bjs
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.bjs
1 {
2  "name" : "Pman.Dialog.CoreAutoSavePreview",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreAutoSavePreview.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "87f9f735a1d36793ceaecd4e47124b63" : "Events",
10   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
11   "bd88a20b53a47f7b5704a83a15ff5506" : "Saved Version",
12   "44749712dbec183e983dcd78a7736c41" : "Date",
13   "e0aa021e21dddbd6d8cecec71e9cf564" : "OK"
14  },
15  "items" : [
16   {
17    "listeners" : {
18     "show" : "function (_self)\n{\n    if(typeof(_this.data) != 'undefined'){\n        _this.grid.footer.onClick('first');\n    }\n    \n}"
19    },
20    "modal" : true,
21    "collapsible" : false,
22    "background" : false,
23    "title" : "Saved Version",
24    "xtype" : "LayoutDialog",
25    "width" : 800,
26    "$ xns" : "Roo",
27    "closable" : false,
28    "resizable" : false,
29    "height" : 500,
30    "items" : [
31     {
32      "xtype" : "LayoutRegion",
33      "$ xns" : "Roo",
34      "* prop" : "center"
35     },
36     {
37      "xtype" : "LayoutRegion",
38      "width" : 200,
39      "$ xns" : "Roo",
40      "split" : true,
41      "* prop" : "west"
42     },
43     {
44      "listeners" : {
45       "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
46      },
47      "fitToframe" : true,
48      "background" : false,
49      "region" : "west",
50      "title" : "Events",
51      "xtype" : "GridPanel",
52      "fitContainer" : true,
53      "$ xns" : "Roo",
54      "tableName" : "Events",
55      "items" : [
56       {
57        "listeners" : {
58         "|render" : "function() \n{\n    _this.grid = this; \n    \n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
59        },
60        "autoExpandColumn" : "event_when",
61        "xtype" : "Grid",
62        "loadMask" : true,
63        "$ xns" : "Roo.grid",
64        "* prop" : "grid",
65        "items" : [
66         {
67          "listeners" : {
68           "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}"
69          },
70          "xtype" : "RowSelectionModel",
71          "singleSelect" : true,
72          "$ xns" : "Roo.grid",
73          "* prop" : "sm"
74         },
75         {
76          "listeners" : {
77           "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}",
78           "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}"
79          },
80          "xtype" : "Store",
81          "remoteSort" : true,
82          "$ sortInfo" : "{ field : 'event_when', direction: 'DESC' }",
83          "$ xns" : "Roo.data",
84          "* prop" : "dataSource",
85          "items" : [
86           {
87            "$ url" : "baseURL + '/Roo/Events.php'",
88            "xtype" : "HttpProxy",
89            "method" : "GET",
90            "$ xns" : "Roo.data",
91            "* prop" : "proxy"
92           },
93           {
94            "id" : "id",
95            "root" : "data",
96            "xtype" : "JsonReader",
97            "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'event_when',\n        'type': 'string'\n    }\n]",
98            "$ xns" : "Roo.data",
99            "* prop" : "reader",
100            "totalProperty" : "total"
101           }
102          ]
103         },
104         {
105          "pageSize" : 25,
106          "xtype" : "PagingToolbar",
107          "$ xns" : "Roo",
108          "displayInfo" : false,
109          "* prop" : "footer"
110         },
111         {
112          "xtype" : "ColumnModel",
113          "width" : 100,
114          "header" : "Date",
115          "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }",
116          "$ xns" : "Roo.grid",
117          "* prop" : "colModel[]",
118          "dataIndex" : "event_when"
119         },
120         {
121          "xtype" : "ColumnModel",
122          "header" : "Date",
123          "width" : 100,
124          "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }",
125          "$ xns" : "Roo.grid",
126          "* prop" : "colModel[]",
127          "dataIndex" : "event_when"
128         }
129        ]
130       }
131      ]
132     },
133     {
134      "listeners" : {
135       "render" : "function (_self)\n{\n    _this.viewPanel = _self;\n}"
136      },
137      "autoScroll" : true,
138      "background" : false,
139      "fitToFrame" : true,
140      "region" : "center",
141      "xtype" : "ContentPanel",
142      "fitContainer" : true,
143      "$ xns" : "Roo"
144     },
145     {
146      "listeners" : {
147       "|click" : "function() {\n    _this.dialog.hide();\n}"
148      },
149      "text" : "Cancel",
150      "xtype" : "Button",
151      "$ xns" : "Roo",
152      "* prop" : "buttons[]"
153     },
154     {
155      "listeners" : {
156       "|click" : "function() {\n\n    _this.dialog.hide();\n    \n    if (_this.callback && _this.source != '') {\n        _this.callback.call(this, _this.source);\n    }\n}"
157      },
158      "text" : "OK",
159      "xtype" : "Button",
160      "$ xns" : "Roo",
161      "* prop" : "buttons[]"
162     }
163    ]
164   }
165  ]
166 }