Pman.Tab.CoreOAuthClient = new Roo.XComponent({
part : ["Core","OAuthClient"],
- order : '001-Pman.Tab.CoreOAuthClient',
+ order : '900-Pman.Tab.CoreOAuthClient',
region : 'center',
- parent : false,
+ parent : 'Pman.Tab.Admin',
name : "unnamed module",
disabled : false,
permname : '',
xtype: 'NestedLayoutPanel',
xns: Roo,
region : 'center',
- title : "Email Template",
+ title : "Oauth2 Clients",
layout : {
xtype: 'BorderLayout',
xns: Roo,
this.footer.onClick('first');
}
},
- beforeedit : function (e)
+ afteredit : function (e)
{
- var r = e.record.data.poitem_qty_received * 1;
-
- if(r > 0){
- Roo.MessageBox.alert("Error", "This item has been receipted");
- return false;
- }
-
- var status = _this.form.findField('pohead_status').getValue();
-
- if(status == 'C'){
- Roo.MessageBox.alert("Error", "This PO has been closed");
+ if(e.originalValue == e.value || !e.value.length){
return false;
}
-
+ Roo.log('commit it');
+ e.record.commit();
}
},
autoExpandColumn : 'redirect_uri',
beforeload : function (_self, o){
o.params = o.params || {};
+ },
+ update : function (_self, record, operation)
+ {
+ if (operation != Roo.data.Record.COMMIT) {
+ return;
+ }
+
+ if (!record.data.client_id.length || !record.data.client_secret.length) {
+ return;
+ }
+
+ new Pman.Request({
+ url : baseURL + '/Roo/Core_oauth_clients',
+ method : 'POST',
+ params : {
+ id : record.data.id,
+ client_id : record.data.client_id,
+ client_secret : record.data.client_secret,
+ redirect_uri : record.data.redirect_uri
+ },
+ success : function(res) {
+ _this.grid.footer.onClick('refresh');
+ }
+ });
+
}
},
remoteSort : true,
root : 'data',
totalProperty : 'total',
fields : [
+ {
+ 'name': 'id',
+ 'type': 'int'
+ },
{
'name': 'client_id',
'type': 'string'
listeners : {
click : function()
{
- var status = _this.form.findField('pohead_status').getValue();
-
- if(status == 'C'){
- Roo.MessageBox.alert("Error", "This PO has been closed");
- return;
- }
-
- var ct = _this.grid.ds.getCount();
-
- var last = ct ? _this.grid.ds.getAt(ct-1).data.poitem_linenumber * 1 + 1 : 1;
-
- var dt = _this.form.findField('pohead_orderdate').getValue();
var nr = _this.grid.ds.reader.newRow({
- poitem_id : 0,
- poitem_linenumber : last,
- item_number : '',
- item_descrip1 : '',
- poitem_duedate : dt,
- poitem_qty_ordered : 1,
- poitem_unitprice : 0
+ id : 0,
+ client_id : '',
+ client_secret : '',
+ redirect_uri : ''
});
_this.grid.stopEditing();
_this.grid.ds.insert(_this.grid.ds.getCount(), nr);
- _this.grid.startEditing(_this.grid.ds.getCount()-1, 1);
+ _this.grid.startEditing(_this.grid.ds.getCount()-1, 0);
}
},
cls : 'x-btn-text-icon',
xns: Roo.Toolbar,
listeners : {
click : function ()
- {
- var status = _this.form.findField('pohead_status').getValue();
-
- if(status == 'C'){
- Roo.MessageBox.alert("Error", "This PO has been closed");
- return;
- }
-
+ {
var cs = _this.grid.getSelectionModel().getSelectedCell();
if (!cs) {
Roo.MessageBox.alert("Error", "Select a cell");
return;
}
_this.grid.stopEditing();
+
var r = _this.grid.ds.getAt(cs[0]);
- if(r.data.poitem_qty_received * 1 > 0){
- Roo.MessageBox.alert("Error", "This item has been receipted");
- return;
- }
-
-
- _this.grid.ds.remove(r);
-
+ Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete this client?", function (v){
+ if (v != 'yes') {
+ return;
+ }
+
+ new Pman.Request({
+ url : baseURL + '/Roo/Core_oauth_clients',
+ method : 'POST',
+ params : {
+ _delete : r.data.id
+ },
+ success : function(res) {
+ _this.grid.footer.onClick('refresh');
+ }
+ });
+ });
}
},
cls : 'x-btn-text-icon',
xns: Roo.grid,
field : {
xtype: 'TextField',
- xns: Roo.form
+ xns: Roo.form,
+ allowBlank : false
}
}
},
{
xtype: 'ColumnModel',
xns: Roo.grid,
- dataIndex : 'client_id',
- header : 'Client ID',
+ dataIndex : 'client_secret',
+ header : 'Client Secret',
+ width : 150,
+ renderer : function(v) {
+ return String.format('{0}', v ? v : '');
+ },
+ editor : {
+ xtype: 'GridEditor',
+ xns: Roo.grid,
+ field : {
+ xtype: 'TextField',
+ xns: Roo.form,
+ allowBlank : false
+ }
+ }
+ },
+ {
+ xtype: 'ColumnModel',
+ xns: Roo.grid,
+ dataIndex : 'redirect_uri',
+ header : 'Redirect URI',
width : 150,
renderer : function(v) {
return String.format('{0}', v ? v : '');