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