Pman.Tab.AdminNotify.bjs
[Pman.Admin] / Pman.Tab.AdminNotify.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.Tab.AdminNotify = new Roo.XComponent({
6     part     :  ["Admin","Notify"],
7     order    : '001-Pman.Tab.AdminNotify',
8     region   : 'center',
9     parent   : 'Pman.Tab.AdminWatchNotify',
10     name     : "Pman.Tab.AdminNotify",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         var _this = this;
16         var MODULE = this;
17         return {
18             xtype: 'GridPanel',
19             xns: Roo,
20             listeners : {
21                 activate : function() {
22                     _this.panel = this;
23                     if (_this.grid) {
24                         _this.grid.footer.onClick('first');
25                     }
26                     
27                 }
28             },
29             background : true,
30             fitContainer : true,
31             fitToframe : true,
32             region : 'center',
33             tableName : 'core_notify',
34             title : "Current Notifications",
35             grid : {
36                 xtype: 'Grid',
37                 xns: Roo.grid,
38                 listeners : {
39                     render : function() 
40                     {
41                         _this.grid = this; 
42                         //_this.dialog = Pman.Dialog.FILL_IN
43                         if (_this.panel.active) {
44                            this.footer.onClick('first');
45                         }
46                     },
47                     rowdblclick : function (_self, rowIndex, e)
48                     {
49                         if (!_this.dialog) return;
50                         _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
51                             _this.grid.footer.onClick('first');
52                         }); 
53                     }
54                 },
55                 autoExpandColumn : 'person_id_name',
56                 loadMask : true,
57                 dataSource : {
58                     xtype: 'Store',
59                     xns: Roo.data,
60                     listeners : {
61                         beforeload : function (_self, options)
62                         {
63                             if (!_this.toggleBtn.pressed) {
64                                 options.params['event_id'] = 0;
65                             }
66                         }
67                     },
68                     remoteSort : true,
69                     sortInfo : { field : 'act_when', direction: 'DESC' },
70                     proxy : {
71                         xtype: 'HttpProxy',
72                         xns: Roo.data,
73                         method : 'GET',
74                         url : baseURL + '/Roo/core_notify.php'
75                     },
76                     reader : {
77                         xtype: 'JsonReader',
78                         xns: Roo.data,
79                         totalProperty : 'total',
80                         root : 'data',
81                         id : 'id',
82                         fields : [
83                             {
84                                 'name': 'id',
85                                 'type': 'int'
86                             },
87                             {
88                                 'name': 'act_when',
89                                 'type': 'date',
90                                 'dateFormat': 'Y-m-d'
91                             },
92                             {
93                                 'name': 'onid',
94                                 'type': 'int'
95                             },
96                             {
97                                 'name': 'ontable',
98                                 'type': 'string'
99                             },
100                             {
101                                 'name': 'person_id',
102                                 'type': 'int'
103                             },
104                             {
105                                 'name': 'msgid',
106                                 'type': 'string'
107                             },
108                             {
109                                 'name': 'sent',
110                                 'type': 'date',
111                                 'dateFormat': 'Y-m-d'
112                             },
113                             {
114                                 'name': 'event_id',
115                                 'type': 'int'
116                             },
117                             {
118                                 'name': 'person_id_id',
119                                 'type': 'int'
120                             },
121                             {
122                                 'name': 'person_id_office_id',
123                                 'type': 'int'
124                             },
125                             {
126                                 'name': 'person_id_name',
127                                 'type': 'string'
128                             },
129                             {
130                                 'name': 'person_id_phone',
131                                 'type': 'string'
132                             },
133                             {
134                                 'name': 'person_id_fax',
135                                 'type': 'string'
136                             },
137                             {
138                                 'name': 'person_id_email',
139                                 'type': 'string'
140                             },
141                             {
142                                 'name': 'person_id_company_id',
143                                 'type': 'int'
144                             },
145                             {
146                                 'name': 'person_id_role',
147                                 'type': 'string'
148                             },
149                             {
150                                 'name': 'person_id_active',
151                                 'type': 'int'
152                             },
153                             {
154                                 'name': 'person_id_remarks',
155                                 'type': 'string'
156                             },
157                             {
158                                 'name': 'person_id_passwd',
159                                 'type': 'string'
160                             },
161                             {
162                                 'name': 'person_id_owner_id',
163                                 'type': 'int'
164                             },
165                             {
166                                 'name': 'person_id_lang',
167                                 'type': 'string'
168                             },
169                             {
170                                 'name': 'person_id_no_reset_sent',
171                                 'type': 'int'
172                             },
173                             {
174                                 'name': 'person_id_action_type',
175                                 'type': 'string'
176                             },
177                             {
178                                 'name': 'person_id_project_id',
179                                 'type': 'int'
180                             },
181                             {
182                                 'name': 'person_id_deleted_by',
183                                 'type': 'int'
184                             },
185                             {
186                                 'name': 'person_id_deleted_dt',
187                                 'type': 'date'
188                             },
189                             {
190                                 'name': 'event_id_id',
191                                 'type': 'int'
192                             },
193                             {
194                                 'name': 'event_id_person_name',
195                                 'type': 'string'
196                             },
197                             {
198                                 'name': 'event_id_event_when',
199                                 'type': 'date'
200                             },
201                             {
202                                 'name': 'event_id_action',
203                                 'type': 'string'
204                             },
205                             {
206                                 'name': 'event_id_ipaddr',
207                                 'type': 'string'
208                             },
209                             {
210                                 'name': 'event_id_on_id',
211                                 'type': 'int'
212                             },
213                             {
214                                 'name': 'event_id_on_table',
215                                 'type': 'string'
216                             },
217                             {
218                                 'name': 'event_id_person_id',
219                                 'type': 'int'
220                             },
221                             {
222                                 'name': 'event_id_remarks',
223                                 'type': 'string'
224                             }
225                         ]
226                     }
227                 },
228                 footer : {
229                     xtype: 'PagingToolbar',
230                     xns: Roo,
231                     pageSize : 25,
232                     displayInfo : true,
233                     displayMsg : "Displaying core_notify{0} - {1} of {2}",
234                     emptyMsg : "No core_notify found"
235                 },
236                 toolbar : {
237                     xtype: 'Toolbar',
238                     xns: Roo,
239                     items : [
240                         {
241                             xtype: 'ComboBox',
242                             xns: Roo.form,
243                             listeners : {
244                                 select : function (combo, record, index)
245                                 {
246                                    (function() { _this.grid.footer.onClick('first'); }).defer(100);
247                                 },
248                                 render : function (_self)
249                                 {
250                                 
251                                 }
252                             },
253                             allowBlank : true,
254                             displayField : 'person_id_name',
255                             editable : true,
256                             emptyText : "Select person",
257                             forceSelection : true,
258                             hiddenName : 'id',
259                             listWidth : 400,
260                             loadingText : "Searching...",
261                             minChars : 2,
262                             name : 'name',
263                             pageSize : 20,
264                             qtip : "Select core_notify",
265                             queryParam : 'query[person_id_name]',
266                             selectOnFocus : true,
267                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{person_id_name}</b> {person_id_email}</div>',
268                             triggerAction : 'all',
269                             valueField : 'person_id',
270                             width : 300,
271                             store : {
272                                 xtype: 'Store',
273                                 xns: Roo.data,
274                                 listeners : {
275                                     beforeload : function (_self, o){
276                                         o.params = o.params || {};
277                                         o.params._distinct='person_id';
278                                         o.params._columns='person_id,person_id_name,person_id_email';
279                                         o.params['!person_id_name'] = '';
280                                         
281                                         // set more here
282                                     }
283                                 },
284                                 remoteSort : true,
285                                 sortInfo : { direction : 'ASC', field: 'person_id_name' },
286                                 proxy : {
287                                     xtype: 'HttpProxy',
288                                     xns: Roo.data,
289                                     method : 'GET',
290                                     url : baseURL + '/Roo/core_notify.php'
291                                 },
292                                 reader : {
293                                     xtype: 'JsonReader',
294                                     xns: Roo.data,
295                                     id : 'id',
296                                     root : 'data',
297                                     totalProperty : 'total',
298                                     fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}]
299                                 }
300                             }
301                         },
302                         {
303                             xtype: 'Fill',
304                             xns: Roo.Toolbar
305                         },
306                         {
307                             xtype: 'Button',
308                             xns: Roo.Toolbar,
309                             listeners : {
310                                 click : function()
311                                         {
312                                         Pman.genericDelete(_this, 'core_notify'); 
313                                         }
314                             },
315                             cls : 'x-btn-text-icon',
316                             text : "Delete",
317                             icon : rootURL + '/Pman/templates/images/trash.gif'
318                         },
319                         {
320                             xtype: 'Button',
321                             xns: Roo.Toolbar,
322                             listeners : {
323                                 render : function (_self)
324                                 {
325                                     _this.toggleBtn = _self;
326                                 },
327                                 toggle : function (_self, pressed)
328                                 {
329                                     this.setText(pressed ? "Hide Completed" : "Show Completed");
330                                     _this.grid.footer.onClick('first');
331                                 }
332                             },
333                             enableToggle : true,
334                             text : "Show Completed"
335                         }
336                     ]
337                 },
338                 colModel : [
339                     {
340                         xtype: 'ColumnModel',
341                         xns: Roo.grid,
342                         dataIndex : 'id',
343                         header : 'id#',
344                         sortable : true,
345                         width : 50,
346                         renderer : function(v) { return String.format('{0}', v ); }
347                     },
348                     {
349                         xtype: 'ColumnModel',
350                         xns: Roo.grid,
351                         dataIndex : 'evtype',
352                         header : 'Method',
353                         sortable : true,
354                         width : 100,
355                         renderer : function(v) { return String.format('{0}', v ); }
356                     },
357                     {
358                         xtype: 'ColumnModel',
359                         xns: Roo.grid,
360                         dataIndex : 'act_when',
361                         header : 'Act when',
362                         sortable : true,
363                         width : 100,
364                         renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }
365                     },
366                     {
367                         xtype: 'ColumnModel',
368                         xns: Roo.grid,
369                         dataIndex : 'sent',
370                         header : 'Sent',
371                         sortable : true,
372                         width : 100,
373                         renderer : function(v,x,r) {
374                             if (r.data.event_id *1 == 0) {
375                                 return '';
376                             }
377                              return String.format('{0}', v ? v.format('d/M/Y H:i:s') : '');
378                           }
379                     },
380                     {
381                         xtype: 'ColumnModel',
382                         xns: Roo.grid,
383                         dataIndex : 'ontable',
384                         header : 'Ontable',
385                         width : 100,
386                         renderer : function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); }
387                     },
388                     {
389                         xtype: 'ColumnModel',
390                         xns: Roo.grid,
391                         dataIndex : 'person_id_name',
392                         header : 'Who to notify',
393                         width : 100,
394                         renderer : function(v,x,r) {
395                              return String.format('{0} <u>&lt;{1}&gt;</u>', v, r.data.person_id_email); 
396                          }
397                     },
398                     {
399                         xtype: 'ColumnModel',
400                         xns: Roo.grid,
401                         dataIndex : 'trigger_event_id',
402                         header : 'Triggered by',
403                         width : 100,
404                         renderer : function(v,x,r) {
405                              return String.format(
406                                     '{0} : {1} {2}', 
407                                     r.data.trigger_event_id_on_table, 
408                                     r.data.trigger_event_id_on_id, 
409                                     r.data.trigger_event_id_remarks
410                                 ); 
411                          }
412                     },
413                     {
414                         xtype: 'ColumnModel',
415                         xns: Roo.grid,
416                         header : 'Msgid',
417                         width : 200,
418                         dataIndex : 'msgid',
419                         renderer : function(v) { return String.format('{0}', v); }
420                     },
421                     {
422                         xtype: 'ColumnModel',
423                         xns: Roo.grid,
424                         dataIndex : 'event_id_remarks',
425                         header : 'Event',
426                         width : 300,
427                         renderer : function(v) { return String.format('<span qtip="{0}">{0}</span>', v); }
428                     }
429                 ]
430             }
431         };
432     }
433 });