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