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                                 Roo.log('1');
68                                    this.footer.onClick('first');
69                                 }
70                             }
71                         },
72                         autoExpandColumn : 'event_when',
73                         loadMask : true,
74                         sm : {
75                             xtype: 'RowSelectionModel',
76                             xns: Roo.grid,
77                             listeners : {
78                                 afterselectionchange : function (_self)
79                                 {
80                                     
81                                     if (!this.getSelected()) {
82                                         _this.viewPanel.setContent("Nothing Selected");
83                                         return;
84                                     }
85                                     
86                                     _this.viewPanel.setContent("data");
87                                 }
88                             },
89                             singleSelect : true
90                         },
91                         dataSource : {
92                             xtype: 'Store',
93                             xns: Roo.data,
94                             listeners : {
95                                 beforeload : function (_self, o)
96                                 {
97                                     Roo.log(_this.data);
98                                     o.params = o.parmas || {};
99                                     o.params.action = 'AUTOSAVE';
100                                     
101                                 }
102                             },
103                             remoteSort : true,
104                             sortInfo : { field: 'event_when', direction: 'DESC'},
105                             reader : {
106                                 xtype: 'JsonReader',
107                                 xns: Roo.data,
108                                 totalProperty : 'total',
109                                 root : 'data',
110                                 id : 'id',
111                                 fields : [
112                                     {
113                                         'name': 'id',
114                                         'type': 'int'
115                                     },
116                                     {
117                                         'name': 'person_name',
118                                         'type': 'string'
119                                     },
120                                     {
121                                         'name': 'event_when',
122                                         'type': 'date',
123                                         'dateFormat': 'Y-m-d'
124                                     },
125                                     {
126                                         'name': 'action',
127                                         'type': 'string'
128                                     },
129                                     {
130                                         'name': 'ipaddr',
131                                         'type': 'string'
132                                     },
133                                     {
134                                         'name': 'on_id',
135                                         'type': 'int'
136                                     },
137                                     {
138                                         'name': 'on_table',
139                                         'type': 'string'
140                                     },
141                                     {
142                                         'name': 'person_id',
143                                         'type': 'int'
144                                     },
145                                     {
146                                         'name': 'remarks',
147                                         'type': 'string'
148                                     },
149                                     {
150                                         'name': 'person_id_id',
151                                         'type': 'int'
152                                     },
153                                     {
154                                         'name': 'person_id_office_id',
155                                         'type': 'int'
156                                     },
157                                     {
158                                         'name': 'person_id_name',
159                                         'type': 'string'
160                                     },
161                                     {
162                                         'name': 'person_id_phone',
163                                         'type': 'string'
164                                     },
165                                     {
166                                         'name': 'person_id_fax',
167                                         'type': 'string'
168                                     },
169                                     {
170                                         'name': 'person_id_email',
171                                         'type': 'string'
172                                     },
173                                     {
174                                         'name': 'person_id_company_id',
175                                         'type': 'int'
176                                     },
177                                     {
178                                         'name': 'person_id_role',
179                                         'type': 'string'
180                                     },
181                                     {
182                                         'name': 'person_id_active',
183                                         'type': 'int'
184                                     },
185                                     {
186                                         'name': 'person_id_remarks',
187                                         'type': 'string'
188                                     },
189                                     {
190                                         'name': 'person_id_passwd',
191                                         'type': 'string'
192                                     },
193                                     {
194                                         'name': 'person_id_owner_id',
195                                         'type': 'int'
196                                     },
197                                     {
198                                         'name': 'person_id_lang',
199                                         'type': 'string'
200                                     },
201                                     {
202                                         'name': 'person_id_no_reset_sent',
203                                         'type': 'int'
204                                     },
205                                     {
206                                         'name': 'person_id_action_type',
207                                         'type': 'string'
208                                     },
209                                     {
210                                         'name': 'person_id_project_id',
211                                         'type': 'int'
212                                     },
213                                     {
214                                         'name': 'person_id_deleted_by',
215                                         'type': 'int'
216                                     },
217                                     {
218                                         'name': 'person_id_deleted_dt',
219                                         'type': 'date'
220                                     }
221                                 ]
222                             },
223                             proxy : {
224                                 xtype: 'HttpProxy',
225                                 xns: Roo.data,
226                                 method : 'GET',
227                                 url : baseURL + '/Roo/Events.php'
228                             }
229                         },
230                         footer : {
231                             xtype: 'PagingToolbar',
232                             xns: Roo,
233                             displayInfo : false,
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 };