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