Pman.Tab.AdminEmailTemplates.bjs
[Pman.Admin] / Pman.Tab.AdminOAuthClient.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.AdminOAuthClient = new Roo.XComponent({
8
9  _strings : {
10   '16f63df432feae9fab6840eabc9d3704' :"No Clients found",
11   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
12   '76525f0f34b48475e5ca33f71d296f3b' :"Client ID",
13   '27499763cc523271e74f32ff4f740a7f' :"Redirect URI",
14   '1063e38cb53d94d386f21227fcd84717' :"Remove",
15   '0c95cb44ad29b66991e47d3e27fecadc' :"Oauth2 Clients",
16   '734082edf44417dd19cc65943aa65c36' :"Client Secret"
17  },
18
19   part     :  ["Admin", "OAuthClient" ],
20   order    : '900-Pman.Tab.AdminOAuthClient',
21   region   : 'center',
22   parent   : 'Pman.Tab.Admin',
23   name     : "unnamed module",
24   disabled : false, 
25   permname : '', 
26   _tree : function()
27   {
28    var _this = this;
29    var MODULE = this;
30    return {
31    region : 'center',
32    title : _this._strings['0c95cb44ad29b66991e47d3e27fecadc'] /* Oauth2 Clients */,
33    xns : Roo,
34    '|xns' : 'Roo',
35    xtype : 'NestedLayoutPanel',
36    layout : {
37     xns : Roo,
38     '|xns' : 'Roo',
39     xtype : 'BorderLayout',
40     center : {
41      autoScroll : false,
42      split : true,
43      xns : Roo,
44      '|xns' : 'Roo',
45      xtype : 'LayoutRegion'
46     },
47     items  : [
48      {
49       background : true,
50       fitContainer : true,
51       fitToframe : true,
52       region : 'center',
53       tableName : 'core_oauth_clients',
54       title : _this._strings['0c95cb44ad29b66991e47d3e27fecadc'] /* Oauth2 Clients */,
55       xns : Roo,
56       '|xns' : 'Roo',
57       xtype : 'GridPanel',
58       listeners : {
59        activate : function() {
60             _this.panel = this;
61             
62             if (_this.grid) {
63                 _this.grid.footer.onClick('first');
64             }
65         }
66       },
67       grid : {
68        autoExpandColumn : 'redirect_uri',
69        clicksToEdit : 1,
70        loadMask : true,
71        xns : Roo.grid,
72        '|xns' : 'Roo.grid',
73        xtype : 'EditorGrid',
74        listeners : {
75         afteredit : function (e)
76          {
77              if(e.originalValue == e.value || !e.value.length){
78                  return false;
79              }
80              
81              Roo.log('commit it');
82              e.record.commit();
83          },
84         render : function() 
85          {
86              _this.grid = this; 
87              if (_this.panel.active) {
88                 this.footer.onClick('first');
89              }
90          }
91        },
92        footer : {
93         displayInfo : true,
94         emptyMsg : _this._strings['16f63df432feae9fab6840eabc9d3704'] /* No Clients found */,
95         pageSize : 25,
96         xns : Roo,
97         '|xns' : 'Roo',
98         xtype : 'PagingToolbar'
99        },
100        toolbar : {
101         xns : Roo,
102         '|xns' : 'Roo',
103         xtype : 'Toolbar',
104         items  : [
105          {
106           cls : 'x-btn-text-icon',
107           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
108           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
109           xns : Roo.Toolbar,
110           '|xns' : 'Roo.Toolbar',
111           xtype : 'Button',
112           listeners : {
113            click : function()
114             {
115                 
116                 var nr = _this.grid.ds.reader.newRow({
117                     id : 0,
118                     client_id : '',
119                     client_secret : '',
120                     redirect_uri : ''
121                 });
122                 
123                 _this.grid.stopEditing();
124                 _this.grid.ds.insert(_this.grid.ds.getCount(), nr); 
125                 _this.grid.startEditing(_this.grid.ds.getCount()-1, 0);
126             }
127           }
128          },
129          {
130           cls : 'x-btn-text-icon',
131           icon : rootURL + '/Pman/templates/images/trash.gif',
132           text : _this._strings['1063e38cb53d94d386f21227fcd84717'] /* Remove */,
133           xns : Roo.Toolbar,
134           '|xns' : 'Roo.Toolbar',
135           xtype : 'Button',
136           listeners : {
137            click : function ()
138             {   
139                 var cs = _this.grid.getSelectionModel().getSelectedCell();
140                 if (!cs) {
141                     Roo.MessageBox.alert("Error", "Select a cell");
142                     return;
143                 }
144                 _this.grid.stopEditing();
145              
146                 var r = _this.grid.ds.getAt(cs[0]);
147                 
148                 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete this client?", function (v){
149                     if (v != 'yes') {
150                         return;
151                     }
152                     
153                     new Pman.Request({
154                         url : baseURL + '/Roo/Core_oauth_clients',
155                         method : 'POST',
156                         params : {
157                             _delete : r.data.id
158                         },
159                         success : function(res) {
160                             _this.grid.footer.onClick('refresh');
161                         }
162                     });
163                 });
164             }
165           }
166          }
167         ]
168        },
169        dataSource : {
170         remoteSort : true,
171         sortInfo : { field : 'client_id', direction: 'ASC' },
172         xns : Roo.data,
173         '|xns' : 'Roo.data',
174         xtype : 'Store',
175         listeners : {
176          beforeload : function (_self, o){
177               o.params = o.params || {};
178           
179           },
180          update : function (_self, record, operation)
181           {
182               if (operation != Roo.data.Record.COMMIT) {
183                   return;
184               }
185           
186               if (!record.data.client_id.length || !record.data.client_secret.length) {
187                   return;
188               }
189               
190               new Pman.Request({
191                   url : baseURL + '/Roo/Core_oauth_clients',
192                   method : 'POST',
193                   params : {
194                       id : record.data.id,
195                       client_id : record.data.client_id,
196                       client_secret : record.data.client_secret,
197                       redirect_uri : record.data.redirect_uri
198                   },
199                   success : function(res) {
200                       _this.grid.footer.onClick('refresh');
201                   }
202               });
203               
204           }
205         },
206         proxy : {
207          method : 'GET',
208          url : baseURL + '/Roo/Core_oauth_clients',
209          xns : Roo.data,
210          '|xns' : 'Roo.data',
211          xtype : 'HttpProxy'
212         },
213         reader : {
214          fields : [
215              {
216                  'name': 'id',
217                  'type': 'int'
218              },
219              {
220                  'name': 'client_id',
221                  'type': 'string'
222              },
223              {
224                  'name': 'client_secret',
225                  'type': 'string'
226              },
227              {
228                  'name': 'redirect_uri',
229                  'type': 'string'
230              }
231          ],
232          id : 'id',
233          root : 'data',
234          totalProperty : 'total',
235          xns : Roo.data,
236          '|xns' : 'Roo.data',
237          xtype : 'JsonReader'
238         }
239        },
240        colModel : [
241         {
242          dataIndex : 'client_id',
243          header : _this._strings['76525f0f34b48475e5ca33f71d296f3b'] /* Client ID */,
244          renderer : function(v) { 
245              return String.format('{0}', v ? v : '');
246          },
247          width : 150,
248          xns : Roo.grid,
249          '|xns' : 'Roo.grid',
250          xtype : 'ColumnModel',
251          editor : {
252           xns : Roo.grid,
253           '|xns' : 'Roo.grid',
254           xtype : 'GridEditor',
255           field : {
256            allowBlank : false,
257            xns : Roo.form,
258            '|xns' : 'Roo.form',
259            xtype : 'TextField'
260           }
261          }
262         },
263         {
264          dataIndex : 'client_secret',
265          header : _this._strings['734082edf44417dd19cc65943aa65c36'] /* Client Secret */,
266          renderer : function(v) { 
267              return String.format('{0}', v ? v : '');
268          },
269          width : 150,
270          xns : Roo.grid,
271          '|xns' : 'Roo.grid',
272          xtype : 'ColumnModel',
273          editor : {
274           xns : Roo.grid,
275           '|xns' : 'Roo.grid',
276           xtype : 'GridEditor',
277           field : {
278            allowBlank : false,
279            xns : Roo.form,
280            '|xns' : 'Roo.form',
281            xtype : 'TextField'
282           }
283          }
284         },
285         {
286          dataIndex : 'redirect_uri',
287          header : _this._strings['27499763cc523271e74f32ff4f740a7f'] /* Redirect URI */,
288          renderer : function(v) { 
289              return String.format('{0}', v ? v : '');
290          },
291          width : 150,
292          xns : Roo.grid,
293          '|xns' : 'Roo.grid',
294          xtype : 'ColumnModel',
295          editor : {
296           xns : Roo.grid,
297           '|xns' : 'Roo.grid',
298           xtype : 'GridEditor',
299           field : {
300            xns : Roo.form,
301            '|xns' : 'Roo.form',
302            xtype : 'TextField'
303           }
304          }
305         }
306        ]
307       }
308      }
309     ]
310    }
311   };  }
312 });