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