improve hg config

This commit is contained in:
Sebastian Sdorra
2010-09-19 15:07:59 +02:00
parent 797b6b281a
commit d9064a91a9
2 changed files with 66 additions and 3 deletions

View File

@@ -20,5 +20,39 @@ registerConfigPanel({
name: 'baseUrl',
fieldLabel: 'Base URL',
allowBlank : false
}]
}],
onSubmit: function(values){
Ext.Ajax.request({
url: restUrl + 'config/repositories/hg.json',
method: 'POST',
jsonData: values,
scope: this,
success: function(response){
alert( 'success' );
},
failure: function(){
alert( 'failure' );
}
});
},
onLoad: function(){
//this.getEl().mask();
Ext.Ajax.request({
url: restUrl + 'config/repositories/hg.json',
method: 'GET',
scope: this,
success: function(response){
var obj = Ext.decode(response.responseText);
this.load(obj);
//this.getEl().unmask();
},
failure: function(){
alert( 'failure' );
//this.getEl().unmask();
}
});
}
});

View File

@@ -33,6 +33,9 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
title: 'Config Form',
items: null,
onSubmit: null,
getValues: null,
onCancel: null,
initComponent: function(){
@@ -61,15 +64,41 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
},
items: this.items,
buttons: [{
text: 'Save'
text: 'Save',
scope: this,
handler: this.submitForm
},{
text: 'Cancel'
text: 'Cancel',
scope: this,
handler: this.cancel
}]
}]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.config.ConfigForm.superclass.initComponent.apply(this, arguments);
if ( this.onLoad != null && Ext.isFunction( this.onLoad ) ){
this.onLoad();
}
},
load: function(values){
this.getForm().loadRecord({success: true, data: values});
},
submitForm: function(){
var form = this.getForm();
if ( this.onSubmit != null && Ext.isFunction( this.onSubmit ) ){
this.onSubmit( form.getValues() );
}
},
cancel: function(){
var form = this.getForm();
if ( this.onCancel != null && Ext.isFunction( this.onCancel ) ){
this.onCancel(form);
}
}
});