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                             pageSize : 25
234                         },
235                         colModel : [
236                             {
237                                 xtype: 'ColumnModel',
238                                 xns: Roo.grid,
239                                 dataIndex : 'event_when',
240                                 header : 'Date',
241                                 width : 100,
242                                 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }
243                             }
244                         ]
245                     }
246                 },
247                 {
248                     xtype: 'ContentPanel',
249                     xns: Roo,
250                     listeners : {
251                         render : function (_self)
252                         {
253                             _this.viewPanel = _self;
254                         }
255                     },
256                     background : false,
257                     fitContainer : true,
258                     fitToFrame : true,
259                     region : 'center'
260                 }
261             ],
262             center : {
263                 xtype: 'LayoutRegion',
264                 xns: Roo
265             },
266             west : {
267                 xtype: 'LayoutRegion',
268                 xns: Roo,
269                 split : true,
270                 width : 200
271             },
272             buttons : [
273                 {
274                     xtype: 'Button',
275                     xns: Roo,
276                     listeners : {
277                         click : function() {
278                             _this.dialog.hide();
279                         }
280                     },
281                     text : "Cancel"
282                 },
283                 {
284                     xtype: 'Button',
285                     xns: Roo,
286                     listeners : {
287                         click : function() {
288                             _this.dialog.hide();
289                         }
290                     },
291                     text : "OK"
292                 }
293             ]
294         });
295     }
296 };