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 : true,
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                         autoExpandColumn : 'filename',
63                         loadMask : true,
64                         listeners : {
65                             render : function() 
66                             {
67                                 _this.grid = this; 
68                                 //_this.dialog = Pman.Dialog.FILL_IN
69                                 if (_this.panel.active) {
70                                    this.footer.onClick('first');
71                                 }
72                             },
73                             rowdblclick : function (_self, rowIndex, e)
74                             {
75                                 if (!_this.dialog) return;
76                                 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
77                                     _this.grid.footer.onClick('first');
78                                 }); 
79                             }
80                         },
81                         dataSource : {
82                             xtype: 'Store',
83                             xns: Roo.data,
84                             remoteSort : true,
85                             sortInfo : { field : 'filename', direction: 'ASC' },
86                             proxy : {
87                                 xtype: 'HttpProxy',
88                                 xns: Roo.data,
89                                 method : 'GET',
90                                 url : baseURL + '/Roo/Images.php'
91                             },
92                             reader : {
93                                 xtype: 'JsonReader',
94                                 xns: Roo.data,
95                                 id : 'id',
96                                 root : 'data',
97                                 totalProperty : 'total',
98                                 fields : [
99                                     {
100                                         'name': 'id',
101                                         'type': 'int'
102                                     },
103                                     {
104                                         'name': 'event_when',
105                                         'type': 'string'
106                                     }
107                                 ]
108                             }
109                         },
110                         footer : {
111                             xtype: 'PagingToolbar',
112                             xns: Roo,
113                             pageSize : 25,
114                             displayInfo : true,
115                             displayMsg : "Displaying Images{0} - {1} of {2}",
116                             emptyMsg : "No Images found"
117                         },
118                         colModel : [
119                             {
120                                 xtype: 'ColumnModel',
121                                 xns: Roo.grid,
122                                 header : 'Onid',
123                                 width : 75,
124                                 dataIndex : 'onid',
125                                 renderer : function(v) { return String.format('{0}', v); }
126                             },
127                             {
128                                 xtype: 'ColumnModel',
129                                 xns: Roo.grid,
130                                 header : 'Mimetype',
131                                 width : 200,
132                                 dataIndex : 'mimetype',
133                                 renderer : function(v) { return String.format('{0}', v); }
134                             },
135                             {
136                                 xtype: 'ColumnModel',
137                                 xns: Roo.grid,
138                                 header : 'Width',
139                                 width : 75,
140                                 dataIndex : 'width',
141                                 renderer : function(v) { return String.format('{0}', v); }
142                             },
143                             {
144                                 xtype: 'ColumnModel',
145                                 xns: Roo.grid,
146                                 header : 'Height',
147                                 width : 75,
148                                 dataIndex : 'height',
149                                 renderer : function(v) { return String.format('{0}', v); }
150                             },
151                             {
152                                 xtype: 'ColumnModel',
153                                 xns: Roo.grid,
154                                 header : 'Filesize',
155                                 width : 75,
156                                 dataIndex : 'filesize',
157                                 renderer : function(v) { return String.format('{0}', v); }
158                             },
159                             {
160                                 xtype: 'ColumnModel',
161                                 xns: Roo.grid,
162                                 header : 'Displayorder',
163                                 width : 75,
164                                 dataIndex : 'displayorder',
165                                 renderer : function(v) { return String.format('{0}', v); }
166                             },
167                             {
168                                 xtype: 'ColumnModel',
169                                 xns: Roo.grid,
170                                 header : 'Language',
171                                 width : 200,
172                                 dataIndex : 'language',
173                                 renderer : function(v) { return String.format('{0}', v); }
174                             },
175                             {
176                                 xtype: 'ColumnModel',
177                                 xns: Roo.grid,
178                                 header : 'Parent image',
179                                 width : 75,
180                                 dataIndex : 'parent_image_id',
181                                 renderer : function(v) { return String.format('{0}', v); }
182                             },
183                             {
184                                 xtype: 'ColumnModel',
185                                 xns: Roo.grid,
186                                 header : 'Created',
187                                 width : 75,
188                                 dataIndex : 'created',
189                                 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
190                             },
191                             {
192                                 xtype: 'ColumnModel',
193                                 xns: Roo.grid,
194                                 header : 'Imgtype',
195                                 width : 200,
196                                 dataIndex : 'imgtype',
197                                 renderer : function(v) { return String.format('{0}', v); }
198                             },
199                             {
200                                 xtype: 'ColumnModel',
201                                 xns: Roo.grid,
202                                 header : 'Linkurl',
203                                 width : 200,
204                                 dataIndex : 'linkurl',
205                                 renderer : function(v) { return String.format('{0}', v); }
206                             },
207                             {
208                                 xtype: 'ColumnModel',
209                                 xns: Roo.grid,
210                                 header : 'Descript',
211                                 width : 200,
212                                 dataIndex : 'descript',
213                                 renderer : function(v) { return String.format('{0}', v); }
214                             },
215                             {
216                                 xtype: 'ColumnModel',
217                                 xns: Roo.grid,
218                                 header : 'Title',
219                                 width : 200,
220                                 dataIndex : 'title',
221                                 renderer : function(v) { return String.format('{0}', v); }
222                             }
223                         ]
224                     }
225                 },
226                 {
227                     xtype: 'ContentPanel',
228                     xns: Roo,
229                     listeners : {
230                         render : function (_self)
231                         {
232                             _this.viewPanel = _self;
233                         }
234                     },
235                     background : false,
236                     fitContainer : true,
237                     fitToFrame : true,
238                     region : 'center'
239                 }
240             ],
241             center : {
242                 xtype: 'LayoutRegion',
243                 xns: Roo
244             },
245             west : {
246                 xtype: 'LayoutRegion',
247                 xns: Roo,
248                 split : true,
249                 width : 200
250             },
251             buttons : [
252                 {
253                     xtype: 'Button',
254                     xns: Roo,
255                     listeners : {
256                         click : function() {
257                             _this.dialog.hide();
258                         }
259                     },
260                     text : "Cancel"
261                 },
262                 {
263                     xtype: 'Button',
264                     xns: Roo,
265                     listeners : {
266                         click : function() {
267                             _this.dialog.hide();
268                         }
269                     },
270                     text : "OK"
271                 }
272             ]
273         });
274     }
275 };