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