Pman.Dialog.AdminEventLog.bjs
[Pman.Admin] / Pman.Dialog.AdminEventLog.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.AdminEventLog = {
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             items : [
34                 {
35                     xtype: 'GridPanel',
36                     xns: Roo,
37                     title : "Events",
38                     fitToframe : true,
39                     fitContainer : true,
40                     tableName : 'Events',
41                     background : true,
42                     region : 'center',
43                     listeners : {
44                         activate : function() {
45                             _this.panel = this;
46                             if (_this.grid) {
47                                 _this.grid.footer.onClick('first');
48                             }
49                         }
50                     },
51                     grid : {
52                         xtype: 'Grid',
53                         xns: Roo.grid,
54                         autoExpandColumn : 'person_name',
55                         loadMask : true,
56                         listeners : {
57                             render : function() 
58                             {
59                                 _this.grid = this; 
60                                 //_this.dialog = Pman.Dialog.FILL_IN
61                                 if (_this.panel.active) {
62                                    this.footer.onClick('first');
63                                 }
64                             },
65                             rowdblclick : function (_self, rowIndex, e)
66                             {
67                                 if (!_this.dialog) return;
68                                 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
69                                     _this.grid.footer.onClick('first');
70                                 }); 
71                             }
72                         },
73                         dataSource : {
74                             xtype: 'Store',
75                             xns: Roo.data,
76                             remoteSort : true,
77                             sortInfo : { field : 'person_name', direction: 'ASC' },
78                             proxy : {
79                                 xtype: 'HttpProxy',
80                                 xns: Roo.data,
81                                 method : 'GET',
82                                 url : baseURL + '/Roo/Events.php'
83                             },
84                             reader : {
85                                 xtype: 'JsonReader',
86                                 xns: Roo.data,
87                                 totalProperty : 'total',
88                                 root : 'data',
89                                 id : 'id',
90                                 fields : [
91                                     {
92                                         'name': 'id',
93                                         'type': 'int'
94                                     },
95                                     {
96                                         'name': 'person_name',
97                                         'type': 'string'
98                                     },
99                                     {
100                                         'name': 'event_when',
101                                         'type': 'date',
102                                         'dateFormat': 'Y-m-d'
103                                     },
104                                     {
105                                         'name': 'action',
106                                         'type': 'string'
107                                     },
108                                     {
109                                         'name': 'ipaddr',
110                                         'type': 'string'
111                                     },
112                                     {
113                                         'name': 'on_id',
114                                         'type': 'int'
115                                     },
116                                     {
117                                         'name': 'on_table',
118                                         'type': 'string'
119                                     },
120                                     {
121                                         'name': 'person_id',
122                                         'type': 'int'
123                                     },
124                                     {
125                                         'name': 'remarks',
126                                         'type': 'string'
127                                     },
128                                     {
129                                         'name': 'person_table',
130                                         'type': 'string'
131                                     },
132                                     {
133                                         'name': 'person_id_id',
134                                         'type': 'int'
135                                     },
136                                     {
137                                         'name': 'person_id_office_id',
138                                         'type': 'int'
139                                     },
140                                     {
141                                         'name': 'person_id_name',
142                                         'type': 'string'
143                                     },
144                                     {
145                                         'name': 'person_id_phone',
146                                         'type': 'string'
147                                     },
148                                     {
149                                         'name': 'person_id_fax',
150                                         'type': 'string'
151                                     },
152                                     {
153                                         'name': 'person_id_email',
154                                         'type': 'string'
155                                     },
156                                     {
157                                         'name': 'person_id_company_id',
158                                         'type': 'int'
159                                     },
160                                     {
161                                         'name': 'person_id_role',
162                                         'type': 'string'
163                                     },
164                                     {
165                                         'name': 'person_id_active',
166                                         'type': 'int'
167                                     },
168                                     {
169                                         'name': 'person_id_remarks',
170                                         'type': 'string'
171                                     },
172                                     {
173                                         'name': 'person_id_passwd',
174                                         'type': 'string'
175                                     },
176                                     {
177                                         'name': 'person_id_owner_id',
178                                         'type': 'int'
179                                     },
180                                     {
181                                         'name': 'person_id_lang',
182                                         'type': 'string'
183                                     },
184                                     {
185                                         'name': 'person_id_no_reset_sent',
186                                         'type': 'int'
187                                     },
188                                     {
189                                         'name': 'person_id_action_type',
190                                         'type': 'string'
191                                     },
192                                     {
193                                         'name': 'person_id_project_id',
194                                         'type': 'int'
195                                     },
196                                     {
197                                         'name': 'person_id_deleted_by',
198                                         'type': 'int'
199                                     },
200                                     {
201                                         'name': 'person_id_deleted_dt',
202                                         'type': 'date'
203                                     },
204                                     {
205                                         'name': 'person_id_firstname',
206                                         'type': 'string'
207                                     },
208                                     {
209                                         'name': 'person_id_lastname',
210                                         'type': 'string'
211                                     }
212                                 ]
213                             }
214                         },
215                         footer : {
216                             xtype: 'PagingToolbar',
217                             xns: Roo,
218                             pageSize : 25,
219                             displayInfo : true,
220                             displayMsg : "Displaying Events{0} - {1} of {2}",
221                             emptyMsg : "No Events found"
222                         },
223                         toolbar : {
224                             xtype: 'Toolbar',
225                             xns: Roo,
226                             items : [
227                                 {
228                                     xtype: 'Button',
229                                     xns: Roo.Toolbar,
230                                     text : "Add",
231                                     cls : 'x-btn-text-icon',
232                                     icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
233                                     listeners : {
234                                         click : function()
235                                         {
236                                             if (!_this.dialog) return;
237                                             _this.dialog.show( { id : 0 } , function() {
238                                                 _this.grid.footer.onClick('first');
239                                            }); 
240                                         }
241                                     }
242                                 },
243                                 {
244                                     xtype: 'Button',
245                                     xns: Roo.Toolbar,
246                                     text : "Edit",
247                                     cls : 'x-btn-text-icon',
248                                     icon : Roo.rootURL + 'images/default/tree/leaf.gif',
249                                     listeners : {
250                                         click : function()
251                                         {
252                                             var s = _this.grid.getSelectionModel().getSelections();
253                                             if (!s.length || (s.length > 1))  {
254                                                 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
255                                                 return;
256                                             }
257                                             if (!_this.dialog) return;
258                                             _this.dialog.show(s[0].data, function() {
259                                                 _this.grid.footer.onClick('first');
260                                             }); 
261                                             
262                                         }
263                                     }
264                                 },
265                                 {
266                                     xtype: 'Button',
267                                     xns: Roo.Toolbar,
268                                     text : "Delete",
269                                     cls : 'x-btn-text-icon',
270                                     icon : rootURL + '/Pman/templates/images/trash.gif',
271                                     listeners : {
272                                         click : function()
273                                         {
274                                              Pman.genericDelete(_this, 'Events'); 
275                                         }
276                                     }
277                                 }
278                             ]
279                         },
280                         colModel : [
281                             {
282                                 xtype: 'ColumnModel',
283                                 xns: Roo.grid,
284                                 header : 'Id',
285                                 width : 75,
286                                 dataIndex : 'id',
287                                 renderer : function(v) { return String.format('{0}', v); }
288                             },
289                             {
290                                 xtype: 'ColumnModel',
291                                 xns: Roo.grid,
292                                 header : 'Person name',
293                                 width : 200,
294                                 dataIndex : 'person_name',
295                                 renderer : function(v) { return String.format('{0}', v); }
296                             },
297                             {
298                                 xtype: 'ColumnModel',
299                                 xns: Roo.grid,
300                                 header : 'Event when',
301                                 width : 75,
302                                 dataIndex : 'event_when',
303                                 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
304                             },
305                             {
306                                 xtype: 'ColumnModel',
307                                 xns: Roo.grid,
308                                 header : 'Action',
309                                 width : 200,
310                                 dataIndex : 'action',
311                                 renderer : function(v) { return String.format('{0}', v); }
312                             },
313                             {
314                                 xtype: 'ColumnModel',
315                                 xns: Roo.grid,
316                                 header : 'Ipaddr',
317                                 width : 200,
318                                 dataIndex : 'ipaddr',
319                                 renderer : function(v) { return String.format('{0}', v); }
320                             },
321                             {
322                                 xtype: 'ColumnModel',
323                                 xns: Roo.grid,
324                                 header : 'On',
325                                 width : 75,
326                                 dataIndex : 'on_id',
327                                 renderer : function(v) { return String.format('{0}', v); }
328                             },
329                             {
330                                 xtype: 'ColumnModel',
331                                 xns: Roo.grid,
332                                 header : 'On table',
333                                 width : 200,
334                                 dataIndex : 'on_table',
335                                 renderer : function(v) { return String.format('{0}', v); }
336                             },
337                             {
338                                 xtype: 'ColumnModel',
339                                 xns: Roo.grid,
340                                 header : 'Person',
341                                 width : 75,
342                                 dataIndex : 'person_id',
343                                 renderer : function(v) { return String.format('{0}', v); }
344                             },
345                             {
346                                 xtype: 'ColumnModel',
347                                 xns: Roo.grid,
348                                 header : 'Remarks',
349                                 width : 200,
350                                 dataIndex : 'remarks',
351                                 renderer : function(v) { return String.format('{0}', v); }
352                             },
353                             {
354                                 xtype: 'ColumnModel',
355                                 xns: Roo.grid,
356                                 header : 'Person table',
357                                 width : 200,
358                                 dataIndex : 'person_table',
359                                 renderer : function(v) { return String.format('{0}', v); }
360                             }
361                         ]
362                     }
363                 }
364             ]
365         });
366     }
367 };