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             listeners : {
34                 show : function (_self)
35                 {
36                     _this.grid.onClick('first');
37                 }
38             },
39             height : 500,
40             title : "Event history",
41             width : 800,
42             items : [
43                 {
44                     xtype: 'GridPanel',
45                     xns: Roo,
46                     listeners : {
47                         activate : function() {
48                             _this.panel = this;
49                             if (_this.grid) {
50                                 _this.grid.footer.onClick('first');
51                             }
52                         }
53                     },
54                     background : false,
55                     fitContainer : true,
56                     fitToframe : true,
57                     region : 'center',
58                     tableName : 'Events',
59                     title : "Events",
60                     grid : {
61                         xtype: 'Grid',
62                         xns: Roo.grid,
63                         listeners : {
64                             render : function() 
65                             {
66                                 _this.grid = this; 
67                                 //_this.dialog = Pman.Dialog.FILL_IN
68                                 if (_this.panel.active) {
69                                    this.footer.onClick('first');
70                                 }
71                             },
72                             rowdblclick : function (_self, rowIndex, e)
73                             {
74                                 if (!_this.dialog) return;
75                                 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
76                                     _this.grid.footer.onClick('first');
77                                 }); 
78                             }
79                         },
80                         autoExpandColumn : 'remarks',
81                         loadMask : true,
82                         dataSource : {
83                             xtype: 'Store',
84                             xns: Roo.data,
85                             listeners : {
86                                 beforeload : function (_self,o )
87                                 {
88                                     if (!_this.data || !_this.data.on_id) {
89                                         return false;
90                                     }
91                                     o.params.on_table = _this.data.on_table;
92                                     o.params.on_id = _this.data.on_id;
93                                     
94                                     if (typeof(_this.data.person_table) != 'undefined') {
95                                          o.params.person_table =_this.data.person_table;
96                                      }
97                                 }
98                             },
99                             remoteSort : true,
100                             sortInfo : { field : 'event_when', direction: 'DESC' },
101                             proxy : {
102                                 xtype: 'HttpProxy',
103                                 xns: Roo.data,
104                                 method : 'GET',
105                                 url : baseURL + '/Roo/Events.php'
106                             },
107                             reader : {
108                                 xtype: 'JsonReader',
109                                 xns: Roo.data,
110                                 totalProperty : 'total',
111                                 root : 'data',
112                                 id : 'id',
113                                 fields : [
114                                     {
115                                         'name': 'id',
116                                         'type': 'int'
117                                     },
118                                     {
119                                         'name': 'person_name',
120                                         'type': 'string'
121                                     },
122                                     {
123                                         'name': 'event_when',
124                                         'type': 'date',
125                                         'dateFormat': 'Y-m-d'
126                                     },
127                                     {
128                                         'name': 'action',
129                                         'type': 'string'
130                                     },
131                                     {
132                                         'name': 'ipaddr',
133                                         'type': 'string'
134                                     },
135                                     {
136                                         'name': 'on_id',
137                                         'type': 'int'
138                                     },
139                                     {
140                                         'name': 'on_table',
141                                         'type': 'string'
142                                     },
143                                     {
144                                         'name': 'person_id',
145                                         'type': 'int'
146                                     },
147                                     {
148                                         'name': 'remarks',
149                                         'type': 'string'
150                                     },
151                                     {
152                                         'name': 'person_table',
153                                         'type': 'string'
154                                     },
155                                     {
156                                         'name': 'person_id_id',
157                                         'type': 'int'
158                                     },
159                                     {
160                                         'name': 'person_id_office_id',
161                                         'type': 'int'
162                                     },
163                                     {
164                                         'name': 'person_id_name',
165                                         'type': 'string'
166                                     },
167                                     {
168                                         'name': 'person_id_phone',
169                                         'type': 'string'
170                                     },
171                                     {
172                                         'name': 'person_id_fax',
173                                         'type': 'string'
174                                     },
175                                     {
176                                         'name': 'person_id_email',
177                                         'type': 'string'
178                                     },
179                                     {
180                                         'name': 'person_id_company_id',
181                                         'type': 'int'
182                                     },
183                                     {
184                                         'name': 'person_id_role',
185                                         'type': 'string'
186                                     },
187                                     {
188                                         'name': 'person_id_active',
189                                         'type': 'int'
190                                     },
191                                     {
192                                         'name': 'person_id_remarks',
193                                         'type': 'string'
194                                     },
195                                     {
196                                         'name': 'person_id_passwd',
197                                         'type': 'string'
198                                     },
199                                     {
200                                         'name': 'person_id_owner_id',
201                                         'type': 'int'
202                                     },
203                                     {
204                                         'name': 'person_id_lang',
205                                         'type': 'string'
206                                     },
207                                     {
208                                         'name': 'person_id_no_reset_sent',
209                                         'type': 'int'
210                                     },
211                                     {
212                                         'name': 'person_id_action_type',
213                                         'type': 'string'
214                                     },
215                                     {
216                                         'name': 'person_id_project_id',
217                                         'type': 'int'
218                                     },
219                                     {
220                                         'name': 'person_id_deleted_by',
221                                         'type': 'int'
222                                     },
223                                     {
224                                         'name': 'person_id_deleted_dt',
225                                         'type': 'date'
226                                     },
227                                     {
228                                         'name': 'person_id_firstname',
229                                         'type': 'string'
230                                     },
231                                     {
232                                         'name': 'person_id_lastname',
233                                         'type': 'string'
234                                     }
235                                 ]
236                             }
237                         },
238                         footer : {
239                             xtype: 'PagingToolbar',
240                             xns: Roo,
241                             pageSize : 25,
242                             displayInfo : true,
243                             displayMsg : "Displaying Events{0} - {1} of {2}",
244                             emptyMsg : "No Events found"
245                         },
246                         colModel : [
247                             {
248                                 xtype: 'ColumnModel',
249                                 xns: Roo.grid,
250                                 header : 'Event when',
251                                 width : 75,
252                                 dataIndex : 'event_when',
253                                 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
254                             },
255                             {
256                                 xtype: 'ColumnModel',
257                                 xns: Roo.grid,
258                                 dataIndex : 'person_id_name',
259                                 header : 'Person name',
260                                 width : 100,
261                                 renderer : function(v) { return String.format('{0}', v); }
262                             },
263                             {
264                                 xtype: 'ColumnModel',
265                                 xns: Roo.grid,
266                                 dataIndex : 'action',
267                                 header : 'Action',
268                                 width : 80,
269                                 renderer : function(v) { return String.format('{0}', v); }
270                             },
271                             {
272                                 xtype: 'ColumnModel',
273                                 xns: Roo.grid,
274                                 dataIndex : 'ipaddr',
275                                 header : 'Ipaddr',
276                                 width : 80,
277                                 renderer : function(v) { return String.format('{0}', v); }
278                             },
279                             {
280                                 xtype: 'ColumnModel',
281                                 xns: Roo.grid,
282                                 header : 'Remarks',
283                                 width : 200,
284                                 dataIndex : 'remarks',
285                                 renderer : function(v) { return String.format('{0}', v); }
286                             }
287                         ]
288                     }
289                 }
290             ],
291             center : {
292                 xtype: 'LayoutRegion',
293                 xns: Roo
294             },
295             buttons : [
296                 {
297                     xtype: 'Button',
298                     xns: Roo,
299                     listeners : {
300                         click : function (_self, e)
301                         {
302                             _this.dialog.hide();
303                         }
304                     },
305                     text : "Close"
306                 }
307             ]
308         });
309     }
310 };