Pman.Dialog.CoreAutoSavePreview.bjs
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.CoreAutoSavePreview = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             background : false,
34             closable : false,
35             collapsible : false,
36             height : 500,
37             modal : true,
38             resizable : false,
39             title : "Saved Version",
40             width : 800,
41             items : [
42                 {
43                     xtype: 'GridPanel',
44                     xns: Roo,
45                     listeners : {
46                         activate : function() {
47                             _this.panel = this;
48                             if (_this.grid) {
49                                 _this.grid.footer.onClick('first');
50                             }
51                         }
52                     },
53                     background : false,
54                     fitContainer : true,
55                     fitToframe : true,
56                     region : 'west',
57                     tableName : 'Images',
58                     title : "Images",
59                     grid : {
60                         xtype: 'Grid',
61                         xns: Roo.grid,
62                         listeners : {
63                             render : function() 
64                             {
65                                 _this.grid = this; 
66                                 
67                                 if (_this.panel.active) {
68                                    this.footer.onClick('first');
69                                 }
70                             },
71                             rowdblclick : function (_self, rowIndex, e)
72                             {
73                             
74                             }
75                         },
76                         autoExpandColumn : 'filename',
77                         loadMask : true,
78                         dataSource : {
79                             xtype: 'Store',
80                             xns: Roo.data,
81                             remoteSort : true,
82                             sortInfo : { field : 'filename', direction: 'ASC' },
83                             proxy : {
84                                 xtype: 'HttpProxy',
85                                 xns: Roo.data,
86                                 method : 'GET',
87                                 url : baseURL + '/Roo/Images.php'
88                             },
89                             reader : {
90                                 xtype: 'JsonReader',
91                                 xns: Roo.data,
92                                 id : 'id',
93                                 root : 'data',
94                                 totalProperty : 'total',
95                                 fields : [
96                                     {
97                                         'name': 'id',
98                                         'type': 'int'
99                                     },
100                                     {
101                                         'name': 'event_when',
102                                         'type': 'string'
103                                     }
104                                 ]
105                             }
106                         },
107                         footer : {
108                             xtype: 'PagingToolbar',
109                             xns: Roo,
110                             displayInfo : false,
111                             pageSize : 25
112                         },
113                         colModel : [
114                             {
115                                 xtype: 'ColumnModel',
116                                 xns: Roo.grid,
117                                 dataIndex : 'event_when',
118                                 header : 'Date',
119                                 width : 100,
120                                 renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }
121                             }
122                         ]
123                     }
124                 },
125                 {
126                     xtype: 'ContentPanel',
127                     xns: Roo,
128                     listeners : {
129                         render : function (_self)
130                         {
131                             _this.viewPanel = _self;
132                         }
133                     },
134                     background : false,
135                     fitContainer : true,
136                     fitToFrame : true,
137                     region : 'center'
138                 }
139             ],
140             center : {
141                 xtype: 'LayoutRegion',
142                 xns: Roo
143             },
144             west : {
145                 xtype: 'LayoutRegion',
146                 xns: Roo,
147                 split : true,
148                 width : 200
149             },
150             buttons : [
151                 {
152                     xtype: 'Button',
153                     xns: Roo,
154                     listeners : {
155                         click : function() {
156                             _this.dialog.hide();
157                         }
158                     },
159                     text : "Cancel"
160                 },
161                 {
162                     xtype: 'Button',
163                     xns: Roo,
164                     listeners : {
165                         click : function() {
166                             _this.dialog.hide();
167                         }
168                     },
169                     text : "OK"
170                 }
171             ]
172         });
173     }
174 };