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.action = 'AUTOSAVE'
99                                 }
100                             },
101                             remoteSort : true,
102                             sortInfo : { field: 'event_when', direction: 'DESC'},
103                             reader : {
104                                 xtype: 'JsonReader',
105                                 xns: Roo.data,
106                                 totalProperty : 'total',
107                                 root : 'data',
108                                 id : 'id',
109                                 fields : [
110                                     {
111                                         'name': 'id',
112                                         'type': 'int'
113                                     },
114                                     {
115                                         'name': 'person_name',
116                                         'type': 'string'
117                                     },
118                                     {
119                                         'name': 'event_when',
120                                         'type': 'date',
121                                         'dateFormat': 'Y-m-d'
122                                     },
123                                     {
124                                         'name': 'action',
125                                         'type': 'string'
126                                     },
127                                     {
128                                         'name': 'ipaddr',
129                                         'type': 'string'
130                                     },
131                                     {
132                                         'name': 'on_id',
133                                         'type': 'int'
134                                     },
135                                     {
136                                         'name': 'on_table',
137                                         'type': 'string'
138                                     },
139                                     {
140                                         'name': 'person_id',
141                                         'type': 'int'
142                                     },
143                                     {
144                                         'name': 'remarks',
145                                         'type': 'string'
146                                     },
147                                     {
148                                         'name': 'person_id_id',
149                                         'type': 'int'
150                                     },
151                                     {
152                                         'name': 'person_id_office_id',
153                                         'type': 'int'
154                                     },
155                                     {
156                                         'name': 'person_id_name',
157                                         'type': 'string'
158                                     },
159                                     {
160                                         'name': 'person_id_phone',
161                                         'type': 'string'
162                                     },
163                                     {
164                                         'name': 'person_id_fax',
165                                         'type': 'string'
166                                     },
167                                     {
168                                         'name': 'person_id_email',
169                                         'type': 'string'
170                                     },
171                                     {
172                                         'name': 'person_id_company_id',
173                                         'type': 'int'
174                                     },
175                                     {
176                                         'name': 'person_id_role',
177                                         'type': 'string'
178                                     },
179                                     {
180                                         'name': 'person_id_active',
181                                         'type': 'int'
182                                     },
183                                     {
184                                         'name': 'person_id_remarks',
185                                         'type': 'string'
186                                     },
187                                     {
188                                         'name': 'person_id_passwd',
189                                         'type': 'string'
190                                     },
191                                     {
192                                         'name': 'person_id_owner_id',
193                                         'type': 'int'
194                                     },
195                                     {
196                                         'name': 'person_id_lang',
197                                         'type': 'string'
198                                     },
199                                     {
200                                         'name': 'person_id_no_reset_sent',
201                                         'type': 'int'
202                                     },
203                                     {
204                                         'name': 'person_id_action_type',
205                                         'type': 'string'
206                                     },
207                                     {
208                                         'name': 'person_id_project_id',
209                                         'type': 'int'
210                                     },
211                                     {
212                                         'name': 'person_id_deleted_by',
213                                         'type': 'int'
214                                     },
215                                     {
216                                         'name': 'person_id_deleted_dt',
217                                         'type': 'date'
218                                     }
219                                 ]
220                             },
221                             proxy : {
222                                 xtype: 'HttpProxy',
223                                 xns: Roo.data,
224                                 method : 'GET',
225                                 url : baseURL + '/Roo/Events.php'
226                             }
227                         },
228                         footer : {
229                             xtype: 'PagingToolbar',
230                             xns: Roo,
231                             displayInfo : true,
232                             displayMsg : "{0} - {1} of {2}",
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                 }
260             ],
261             center : {
262                 xtype: 'LayoutRegion',
263                 xns: Roo
264             },
265             west : {
266                 xtype: 'LayoutRegion',
267                 xns: Roo,
268                 split : true,
269                 width : 200
270             },
271             buttons : [
272                 {
273                     xtype: 'Button',
274                     xns: Roo,
275                     listeners : {
276                         click : function() {
277                             _this.dialog.hide();
278                         }
279                     },
280                     text : "Cancel"
281                 },
282                 {
283                     xtype: 'Button',
284                     xns: Roo,
285                     listeners : {
286                         click : function() {
287                             _this.dialog.hide();
288                         }
289                     },
290                     text : "OK"
291                 }
292             ]
293         });
294     }
295 };