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                                       _this.grid.footer.onClick('first');
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,x,r) 
358                                 { 
359                                     var vv = (typeof(r.data.evtype_align) != 'undefined' && r.data.evtype_align) ? r.data.evtype_align : v;
360                                     return String.format('{0}', vv ); 
361                                 },
362                                 xns : Roo.grid,
363                                 dataIndex : 'evtype'
364                             },
365 {
366                                 '|xns' : 'Roo.grid',
367                                 xtype : 'ColumnModel',
368                                 sortable : true,
369                                 header : 'Act when',
370                                 width : 100,
371                                 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
372                                 xns : Roo.grid,
373                                 dataIndex : 'act_when'
374                             },
375 {
376                                 '|xns' : 'Roo.grid',
377                                 xtype : 'ColumnModel',
378                                 sortable : true,
379                                 header : 'Sent',
380                                 width : 100,
381                                 renderer : function(v,x,r) {
382                                     if (r.data.event_id *1 == 0) {
383                                         return '';
384                                     }
385                                      return String.format('{0}', v ? v.format('d/M/Y H:i:s') : '');
386                                   },
387                                 xns : Roo.grid,
388                                 dataIndex : 'sent'
389                             },
390 {
391                                 '|xns' : 'Roo.grid',
392                                 xtype : 'ColumnModel',
393                                 header : 'Ontable',
394                                 width : 100,
395                                 renderer : function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); },
396                                 xns : Roo.grid,
397                                 dataIndex : 'ontable'
398                             },
399 {
400                                 '|xns' : 'Roo.grid',
401                                 xtype : 'ColumnModel',
402                                 header : 'Who to notify',
403                                 width : 100,
404                                 renderer : function(v,x,r) {
405                                      return String.format('{0} <u>&lt;{1}&gt;</u>', v, r.data.person_id_email); 
406                                  },
407                                 xns : Roo.grid,
408                                 dataIndex : 'person_id_name'
409                             },
410 {
411                                 '|xns' : 'Roo.grid',
412                                 xtype : 'ColumnModel',
413                                 header : 'Triggered by',
414                                 width : 100,
415                                 renderer : function(v,x,r) {
416                                      return String.format(
417                                             '{0} : {1} {2}', 
418                                             r.data.trigger_event_id_on_table, 
419                                             r.data.trigger_event_id_on_id, 
420                                             r.data.trigger_event_id_remarks
421                                         ); 
422                                  },
423                                 xns : Roo.grid,
424                                 dataIndex : 'trigger_event_id'
425                             },
426 {
427                                 '|xns' : 'Roo.grid',
428                                 xtype : 'ColumnModel',
429                                 width : 200,
430                                 header : 'Msgid',
431                                 renderer : function(v) { return String.format('{0}', v); },
432                                 xns : Roo.grid,
433                                 dataIndex : 'msgid'
434                             },
435 {
436                                 '|xns' : 'Roo.grid',
437                                 xtype : 'ColumnModel',
438                                 header : 'Event',
439                                 width : 300,
440                                 renderer : function(v) { return String.format('<span qtip="{0}">{0}</span>', v); },
441                                 xns : Roo.grid,
442                                 dataIndex : 'event_id_remarks'
443                             }
444                 ],
445                 listeners : {
446                         render : function() 
447                            {
448                                _this.grid = this; 
449                                //_this.dialog = Pman.Dialog.FILL_IN
450                                if (_this.panel.active) {
451                                   this.footer.onClick('first');
452                                }
453                            }
454                 },
455                 items : [
456
457                 ]
458
459             },
460             '|xns' : 'Roo',
461             fitToframe : true,
462             background : true,
463             region : 'center',
464             title : "Current Notifications",
465             xtype : 'GridPanel',
466             fitContainer : true,
467             xns : Roo,
468             tableName : 'core_notify',
469             listeners : {
470                 activate : function() {
471                        _this.panel = this;
472                        if (_this.grid) {
473                            _this.grid.footer.onClick('first');
474                        }
475                        
476                    }
477             },
478             items : [
479
480             ]
481
482         };    }
483 });