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