From 08442924f4e695fb21d800f4d881e82703cbdcc4 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 17 Sep 2010 15:13:53 +0200 Subject: [PATCH] added plugin config api --- .../src/main/resources/sonia/scm/hg.config.js | 46 ++++++++++++++++++- scm-webapp/src/main/webapp/index.html | 1 + .../src/main/webapp/resources/js/global.js | 7 ++- .../src/main/webapp/resources/js/layout.js | 29 ++++++------ .../main/webapp/resources/js/sonia.config.js | 30 ++++++++++++ 5 files changed, 97 insertions(+), 16 deletions(-) create mode 100644 scm-webapp/src/main/webapp/resources/js/sonia.config.js diff --git a/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js b/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js index 3089378655..18f8c46a99 100644 --- a/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js +++ b/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js @@ -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' + }] + }] - +}); diff --git a/scm-webapp/src/main/webapp/index.html b/scm-webapp/src/main/webapp/index.html index f9b7282209..70e32e38f2 100644 --- a/scm-webapp/src/main/webapp/index.html +++ b/scm-webapp/src/main/webapp/index.html @@ -18,6 +18,7 @@ + diff --git a/scm-webapp/src/main/webapp/resources/js/global.js b/scm-webapp/src/main/webapp/resources/js/global.js index eef0107439..b9231ddfa1 100644 --- a/scm-webapp/src/main/webapp/resources/js/global.js +++ b/scm-webapp/src/main/webapp/resources/js/global.js @@ -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); } }); -} \ No newline at end of file +} diff --git a/scm-webapp/src/main/webapp/resources/js/layout.js b/scm-webapp/src/main/webapp/resources/js/layout.js index fefb7baa30..ac2e3cd439 100644 --- a/scm-webapp/src/main/webapp/resources/js/layout.js +++ b/scm-webapp/src/main/webapp/resources/js/layout.js @@ -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' ); } diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.config.js b/scm-webapp/src/main/webapp/resources/js/sonia.config.js new file mode 100644 index 0000000000..64271e13ce --- /dev/null +++ b/scm-webapp/src/main/webapp/resources/js/sonia.config.js @@ -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); \ No newline at end of file