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                         sm : {
79                             xtype: 'RowSelectionModel',
80                             xns: Roo.grid,
81                             singleSelect : true
82                         },
83                         dataSource : {
84                             xtype: 'Store',
85                             xns: Roo.data,
86                             remoteSort : true,
87                             sortInfo : { field : 'filename', direction: 'ASC' },
88                             proxy : {
89                                 xtype: 'HttpProxy',
90                                 xns: Roo.data,
91                                 method : 'GET',
92                                 url : baseURL + '/Roo/Images.php'
93                             },
94                             reader : {
95                                 xtype: 'JsonReader',
96                                 xns: Roo.data,
97                                 id : 'id',
98                                 root : 'data',
99                                 totalProperty : 'total',
100                                 fields : [
101                                     {
102                                         'name': 'id',
103                                         'type': 'int'
104                                     },
105                                     {
106                                         'name': 'event_when',
107                                         'type': 'string'
108                                     }
109                                 ]
110                             }
111                         },
112                         footer : {
113                             xtype: 'PagingToolbar',
114                             xns: Roo,
115                             displayInfo : false,
116                             pageSize : 25
117                         },
118                         colModel : [
119                             {
120                                 xtype: 'ColumnModel',
121                                 xns: Roo.grid,
122                                 dataIndex : 'event_when',
123                                 header : 'Date',
124                                 width : 100,
125                                 renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }
126                             }
127                         ]
128                     }
129                 },
130                 {
131                     xtype: 'ContentPanel',
132                     xns: Roo,
133                     listeners : {
134                         render : function (_self)
135                         {
136                             _this.viewPanel = _self;
137                         }
138                     },
139                     background : false,
140                     fitContainer : true,
141                     fitToFrame : true,
142                     region : 'center'
143                 }
144             ],
145             center : {
146                 xtype: 'LayoutRegion',
147                 xns: Roo
148             },
149             west : {
150                 xtype: 'LayoutRegion',
151                 xns: Roo,
152                 split : true,
153                 width : 200
154             },
155             buttons : [
156                 {
157                     xtype: 'Button',
158                     xns: Roo,
159                     listeners : {
160                         click : function() {
161                             _this.dialog.hide();
162                         }
163                     },
164                     text : "Cancel"
165                 },
166                 {
167                     xtype: 'Button',
168                     xns: Roo,
169                     listeners : {
170                         click : function() {
171                             _this.dialog.hide();
172                         }
173                     },
174                     text : "OK"
175                 }
176             ]
177         });
178     }
179 };