added plugin config api

This commit is contained in:
Sebastian Sdorra
2010-09-17 15:13:53 +02:00
parent ff5e3e4023
commit 08442924f4
5 changed files with 97 additions and 16 deletions

View File

@@ -2,5 +2,49 @@
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
repositoryConfigPanels.push({
style: 'margin: 10px',
trackResetOnLoad : true,
autoScroll : true,
border : false,
frame : false,
collapsible : false,
collapsed : false,
layoutConfig : {
labelSeparator : ''
},
items : [{
xtype : 'fieldset',
checkboxToggle : false,
title : 'Mercurial Settings',
collapsible : true,
autoHeight : true,
labelWidth : 140,
buttonAlign: 'left',
layoutConfig : {
labelSeparator : ''
},
items : [{
xtype : 'textfield',
fieldLabel : 'HG Binary',
name : 'hgBinary',
allowBlank : false
},{
xtype: 'textfield',
name: 'hgRepoDirectroy',
fieldLabel: 'Repository directory',
allowBlank : false
},{
xtype: 'textfield',
name: 'hgBaseUrl',
fieldLabel: 'Base URL',
allowBlank : false
}],
buttons: [{
text: 'Save'
},{
text: 'Cancel'
}]
}]
});

View File

@@ -18,6 +18,7 @@
<script type="text/javascript" src="resources/js/sonia.login.js"></script>
<script type="text/javascript" src="resources/js/sonia.group.js"></script>
<script type="text/javascript" src="resources/js/sonia.repository.js"></script>
<script type="text/javascript" src="resources/js/sonia.config.js"></script>
<script type="text/javascript" src="resources/js/layout.js"></script>
<script type="text/javascript" src="plugins/sonia.plugin.js"></script>

View File

@@ -5,8 +5,13 @@
var debug = true;
var state = null;
// functions called after login
var authCallbacks = [];
// config form panels
var repositoryConfigPanels = [];
var repositoryTypeStore = new Ext.data.JsonStore({
id: 1,
fields: [ 'displayName', 'name' ]
@@ -23,4 +28,4 @@ function loadState(s){
callback(state);
}
});
}
}

View File

@@ -59,26 +59,27 @@ Ext.onReady(function(){
tabPanel
]});
function addGroupPanel(){
function addTabPanel(id, xtype, title){
tabPanel.add({
id: 't_group',
xtype: 'groupGrid',
title: 'Groups',
id: id,
xtype: xtype,
title: title,
closable: true,
autoScroll: true
});
tabPanel.setActiveTab('t_group');
tabPanel.setActiveTab(id);
}
function addGroupPanel(){
addTabPanel('t_group', 'groupGrid', 'Groups');
}
function addRepositoryPanel(){
tabPanel.add({
id: 't_repository',
xtype: 'repositoryGrid',
title: 'Repositories',
closable: true,
autoScroll: true
});
tabPanel.setActiveTab('t_repository');
addTabPanel('t_repository', 'repositoryGrid', 'Repositories');
}
function addConfigPanel(){
addTabPanel('t_config', 'configPanel', 'Repository Config');
}
function createMainMenu(){
@@ -99,7 +100,7 @@ Ext.onReady(function(){
fn: function(){ console.debug( 'General Config' ); }
},{
label: 'Repository Types',
fn: function(){ console.debug( 'Repository Type Config' ); }
fn: addConfigPanel
},{
label: 'Server',
fn: function(){ console.debug( 'Server Config' ); }

View File

@@ -0,0 +1,30 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
Ext.ns("Sonia.config");
Sonia.config.ConfigPanel = Ext.extend(Ext.Panel, {
initComponent: function(){
var config = {
region: 'center',
bodyCssClass: 'x-panel-mc',
trackResetOnLoad: true,
autoScroll: true,
border: false,
frame: false,
collapsible: false,
collapsed: false,
items: repositoryConfigPanels
}
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.config.ConfigPanel.superclass.initComponent.apply(this, arguments);
}
});
Ext.reg("configPanel", Sonia.config.ConfigPanel);