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 : 'Events',
58                     title : "Events",
59                     grid : {
60                         xtype: 'Grid',
61                         xns: Roo.grid,
62                         listeners : {
63                             render : function() { 
64                                 _this.grid = this; 
65                                 //_this.dialog = Pman.Dialog.FILL_IN
66                                 if (_this.panel.active) {
67                                    this.footer.onClick('first');
68                                 }
69                             }
70                         },
71                         autoExpandColumn : 'event_when',
72                         loadMask : true,
73                         sm : {
74                             xtype: 'RowSelectionModel',
75                             xns: Roo.grid,
76                             listeners : {
77                                 afterselectionchange : function (_self)
78                                 {
79                                     
80                                     if (!this.getSelected()) {
81                                         _this.viewPanel.setContent("Nothing Selected");
82                                         return;
83                                     }
84                                     
85                                     _this.viewPanel.setContent("data");
86                                 }
87                             },
88                             singleSelect : true
89                         },
90                         dataSource : {
91                             xtype: 'Store',
92                             xns: Roo.data,
93                             listeners : {
94                                 beforeload : function (_self, o)
95                                 {
96                                     Roo.log(_this.data);
97                                     o.params = o.parmas || {};
98                                     o.params.action = 'AUTOSAVE';
99                                     
100                                 }
101                             },
102                             remoteSort : true,
103                             sortInfo : { field: 'event_when', direction: 'DESC'},
104                             reader : {
105                                 xtype: 'JsonReader',
106                                 xns: Roo.data,
107                                 totalProperty : 'total',
108                                 root : 'data',
109                                 id : 'id',
110                                 fields : [
111                                     {
112                                         'name': 'id',
113                                         'type': 'int'
114                                     },
115                                     {
116                                         'name': 'person_name',
117                                         'type': 'string'
118                                     },
119                                     {
120                                         'name': 'event_when',
121                                         'type': 'date',
122                                         'dateFormat': 'Y-m-d'
123                                     },
124                                     {
125                                         'name': 'action',
126                                         'type': 'string'
127                                     },
128                                     {
129                                         'name': 'ipaddr',
130                                         'type': 'string'
131                                     },
132                                     {
133                                         'name': 'on_id',
134                                         'type': 'int'
135                                     },
136                                     {
137                                         'name': 'on_table',
138                                         'type': 'string'
139                                     },
140                                     {
141                                         'name': 'person_id',
142                                         'type': 'int'
143                                     },
144                                     {
145                                         'name': 'remarks',
146                                         'type': 'string'
147                                     },
148                                     {
149                                         'name': 'person_id_id',
150                                         'type': 'int'
151                                     },
152                                     {
153                                         'name': 'person_id_office_id',
154                                         'type': 'int'
155                                     },
156                                     {
157                                         'name': 'person_id_name',
158                                         'type': 'string'
159                                     },
160                                     {
161                                         'name': 'person_id_phone',
162                                         'type': 'string'
163                                     },
164                                     {
165                                         'name': 'person_id_fax',
166                                         'type': 'string'
167                                     },
168                                     {
169                                         'name': 'person_id_email',
170                                         'type': 'string'
171                                     },
172                                     {
173                                         'name': 'person_id_company_id',
174                                         'type': 'int'
175                                     },
176                                     {
177                                         'name': 'person_id_role',
178                                         'type': 'string'
179                                     },
180                                     {
181                                         'name': 'person_id_active',
182                                         'type': 'int'
183                                     },
184                                     {
185                                         'name': 'person_id_remarks',
186                                         'type': 'string'
187                                     },
188                                     {
189                                         'name': 'person_id_passwd',
190                                         'type': 'string'
191                                     },
192                                     {
193                                         'name': 'person_id_owner_id',
194                                         'type': 'int'
195                                     },
196                                     {
197                                         'name': 'person_id_lang',
198                                         'type': 'string'
199                                     },
200                                     {
201                                         'name': 'person_id_no_reset_sent',
202                                         'type': 'int'
203                                     },
204                                     {
205                                         'name': 'person_id_action_type',
206                                         'type': 'string'
207                                     },
208                                     {
209                                         'name': 'person_id_project_id',
210                                         'type': 'int'
211                                     },
212                                     {
213                                         'name': 'person_id_deleted_by',
214                                         'type': 'int'
215                                     },
216                                     {
217                                         'name': 'person_id_deleted_dt',
218                                         'type': 'date'
219                                     }
220                                 ]
221                             },
222                             proxy : {
223                                 xtype: 'HttpProxy',
224                                 xns: Roo.data,
225                                 method : 'GET',
226                                 url : baseURL + '/Roo/Events.php'
227                             }
228                         },
229                         footer : {
230                             xtype: 'PagingToolbar',
231                             xns: Roo,
232                             displayInfo : false,
233                             emptyMsg : "Nothing found",
234                             pageSize : 25
235                         },
236                         colModel : [
237                             {
238                                 xtype: 'ColumnModel',
239                                 xns: Roo.grid,
240                                 dataIndex : 'event_when',
241                                 header : 'Date',
242                                 width : 100,
243                                 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }
244                             }
245                         ]
246                     }
247                 },
248                 {
249                     xtype: 'ContentPanel',
250                     xns: Roo,
251                     listeners : {
252                         render : function (_self)
253                         {
254                             _this.viewPanel = _self;
255                         }
256                     },
257                     background : false,
258                     fitContainer : true,
259                     fitToFrame : true,
260                     region : 'center'
261                 }
262             ],
263             center : {
264                 xtype: 'LayoutRegion',
265                 xns: Roo
266             },
267             west : {
268                 xtype: 'LayoutRegion',
269                 xns: Roo,
270                 split : true,
271                 width : 200
272             },
273             buttons : [
274                 {
275                     xtype: 'Button',
276                     xns: Roo,
277                     listeners : {
278                         click : function() {
279                             _this.dialog.hide();
280                         }
281                     },
282                     text : "Cancel"
283                 },
284                 {
285                     xtype: 'Button',
286                     xns: Roo,
287                     listeners : {
288                         click : function() {
289                             _this.dialog.hide();
290                         }
291                     },
292                     text : "OK"
293                 }
294             ]
295         });
296     }
297 };