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