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 : 'remarks',
72                         loadMask : true,
73                         sm : {
74                             xtype: 'RowSelectionModel',
75                             xns: Roo.grid,
76                             listeners : {
77                                 afterselectionchange : function (_self)
78                                 {
79                                     // load detail log in _this.viewPanel;
80                                     if (!this.getSelected()) {
81                                         this.viewPanel.setContent("Nothing Selected");
82                                         return;
83                                     }
84                                     var id = this.getSelected().data.id;
85                                     _this.viewPanel.load( { url : baseURL + "/Admin/EventView/" + id + ".html" });
86                                     
87                                 }
88                             },
89                             singleSelect : true
90                         },
91                         dataSource : {
92                             xtype: 'Store',
93                             xns: Roo.data,
94                             listeners : {
95                                 beforeload : function (_self, o)
96                                 {
97                                     if (!Pman.buildCompleted) {
98                                         return false;
99                                     }
100                                    
101                                    
102                                    if (! _this.personSel) {
103                                     return false;
104                                     }
105                                     o.params = o.params || {};
106                                     o.params.person_id = _this.personSel.getValue();
107                                     var act = _this.actionSel.getValue();
108                                     if (act.length) {
109                                         o.params.action = act;
110                                     }
111                                     var tbl = _this.affectSel.getValue();
112                                     if (tbl.length) {
113                                         o.params.on_table = tbl;
114                                     }
115                                     act = _this.dateFrom.getValue();
116                                     if (act.format) {
117                                         o.params['query[from]'] = act.format('Y-m-d');
118                                     }
119                                     act = _this.dateTo.getValue();
120                                     if (act.format) {
121                                         o.params['query[to]'] = act.format('Y-m-d');
122                                     }
123                                  
124                                     
125                                     /*
126                                     act = _this.groupedCombo.getValue();
127                                     o.params['query[grouped]'] = act;
128                                     if (o.params['query[grouped]'] == 'gr') {
129                                     
130                                         if (!tbl.length) {
131                                             Roo.MessageBox.alert("Error", "Select a table to group results on");
132                                             return false;
133                                         }
134                                 //        o.params['_columns']  = 
135                                         o.params['_distinct'] = 'on_id';
136                                         
137                                         
138                                     }
139                                     
140                                     */
141                                 
142                                     
143                                 }
144                             },
145                             remoteSort : true,
146                             sortInfo : { field: 'event_when', direction: 'DESC'},
147                             reader : {
148                                 xtype: 'JsonReader',
149                                 xns: Roo.data,
150                                 totalProperty : 'total',
151                                 root : 'data',
152                                 id : 'id',
153                                 fields : [
154                                     {
155                                         'name': 'id',
156                                         'type': 'int'
157                                     },
158                                     {
159                                         'name': 'person_name',
160                                         'type': 'string'
161                                     },
162                                     {
163                                         'name': 'event_when',
164                                         'type': 'date',
165                                         'dateFormat': 'Y-m-d'
166                                     },
167                                     {
168                                         'name': 'action',
169                                         'type': 'string'
170                                     },
171                                     {
172                                         'name': 'ipaddr',
173                                         'type': 'string'
174                                     },
175                                     {
176                                         'name': 'on_id',
177                                         'type': 'int'
178                                     },
179                                     {
180                                         'name': 'on_table',
181                                         'type': 'string'
182                                     },
183                                     {
184                                         'name': 'person_id',
185                                         'type': 'int'
186                                     },
187                                     {
188                                         'name': 'remarks',
189                                         'type': 'string'
190                                     },
191                                     {
192                                         'name': 'person_id_id',
193                                         'type': 'int'
194                                     },
195                                     {
196                                         'name': 'person_id_office_id',
197                                         'type': 'int'
198                                     },
199                                     {
200                                         'name': 'person_id_name',
201                                         'type': 'string'
202                                     },
203                                     {
204                                         'name': 'person_id_phone',
205                                         'type': 'string'
206                                     },
207                                     {
208                                         'name': 'person_id_fax',
209                                         'type': 'string'
210                                     },
211                                     {
212                                         'name': 'person_id_email',
213                                         'type': 'string'
214                                     },
215                                     {
216                                         'name': 'person_id_company_id',
217                                         'type': 'int'
218                                     },
219                                     {
220                                         'name': 'person_id_role',
221                                         'type': 'string'
222                                     },
223                                     {
224                                         'name': 'person_id_active',
225                                         'type': 'int'
226                                     },
227                                     {
228                                         'name': 'person_id_remarks',
229                                         'type': 'string'
230                                     },
231                                     {
232                                         'name': 'person_id_passwd',
233                                         'type': 'string'
234                                     },
235                                     {
236                                         'name': 'person_id_owner_id',
237                                         'type': 'int'
238                                     },
239                                     {
240                                         'name': 'person_id_lang',
241                                         'type': 'string'
242                                     },
243                                     {
244                                         'name': 'person_id_no_reset_sent',
245                                         'type': 'int'
246                                     },
247                                     {
248                                         'name': 'person_id_action_type',
249                                         'type': 'string'
250                                     },
251                                     {
252                                         'name': 'person_id_project_id',
253                                         'type': 'int'
254                                     },
255                                     {
256                                         'name': 'person_id_deleted_by',
257                                         'type': 'int'
258                                     },
259                                     {
260                                         'name': 'person_id_deleted_dt',
261                                         'type': 'date'
262                                     }
263                                 ]
264                             },
265                             proxy : {
266                                 xtype: 'HttpProxy',
267                                 xns: Roo.data,
268                                 method : 'GET',
269                                 url : baseURL + '/Roo/Events.php'
270                             }
271                         },
272                         footer : {
273                             xtype: 'PagingToolbar',
274                             xns: Roo,
275                             pageSize : 25,
276                             displayInfo : true,
277                             displayMsg : "Displaying Events  {0} - {1} of {2}",
278                             emptyMsg : "No Events found"
279                         },
280                         colModel : [
281                             {
282                                 xtype: 'ColumnModel',
283                                 xns: Roo.grid,
284                                 dataIndex : 'event_when',
285                                 header : 'Date',
286                                 width : 100,
287                                 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }
288                             },
289                             {
290                                 xtype: 'ColumnModel',
291                                 xns: Roo.grid,
292                                 dataIndex : 'on_table',
293                                 header : 'Affected',
294                                 width : 100,
295                                 renderer : function(v) {                     
296                                     return String.format('{0})', v ? v : '');  
297                                 }
298                             }
299                         ]
300                     }
301                 }
302             ],
303             center : {
304                 xtype: 'LayoutRegion',
305                 xns: Roo,
306                 titlebar : false
307             },
308             west : {
309                 xtype: 'LayoutRegion',
310                 xns: Roo,
311                 split : true,
312                 width : 300
313             },
314             buttons : [
315                 {
316                     xtype: 'Button',
317                     xns: Roo,
318                     listeners : {
319                         click : function() {
320                             _this.dialog.hide();
321                         }
322                     },
323                     text : "Cancel"
324                 },
325                 {
326                     xtype: 'Button',
327                     xns: Roo,
328                     listeners : {
329                         click : function() {
330                             _this.dialog.hide();
331                         }
332                     },
333                     text : "OK"
334                 }
335             ]
336         });
337     }
338 };