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