From 6e9bbc96c9134030ea25e8b4b98797c70642847c Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 25 Nov 2010 19:08:32 +0100 Subject: [PATCH] improve web interface navigation --- .../main/webapp/resources/js/sonia.global.js | 2 + .../src/main/webapp/resources/js/sonia.scm.js | 112 ++++++++++-------- 2 files changed, 63 insertions(+), 51 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.global.js b/scm-webapp/src/main/webapp/resources/js/sonia.global.js index af7add876a..8157dab7af 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.global.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.global.js @@ -33,6 +33,7 @@ var debug = typeof console != 'undefined'; var state = null; +var admin = false; // sonia.scm.api.rest.resources.UserResource.DUMMY_PASSWORT var dummyPassword = '__dummypassword__'; @@ -50,6 +51,7 @@ function loadState(s){ console.debug( s ); } state = s; + admin = s.user.admin; // call login callback functions Ext.each(loginCallbacks, function(callback){ if ( Ext.isFunction(callback) ){ diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.scm.js b/scm-webapp/src/main/webapp/resources/js/sonia.scm.js index 5a2f23f01e..5e9c797346 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.scm.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.scm.js @@ -42,31 +42,31 @@ Ext.onReady(function(){ new Ext.Viewport({ layout: 'border', items: [ - new Ext.BoxComponent({ - region: 'north', - id: 'north-panel', - contentEl: 'north', - height: 75 - }), { - region: 'west', - id: 'navigationPanel', - title: 'Navigation', - xtype: 'navPanel', - split: true, - width: 200, - minSize: 175, - maxSize: 400, - collapsible: true, - margins: '0 0 0 5' - }, - new Ext.BoxComponent({ - region: 'south', - id: 'south-panel', - contentEl: 'south', - height: 16, - margins: '2 2 2 5' - }), - mainTabPanel + new Ext.BoxComponent({ + region: 'north', + id: 'north-panel', + contentEl: 'north', + height: 75 + }), { + region: 'west', + id: 'navigationPanel', + title: 'Navigation', + xtype: 'navPanel', + split: true, + width: 200, + minSize: 175, + maxSize: 400, + collapsible: true, + margins: '0 0 0 5' + }, + new Ext.BoxComponent({ + region: 'south', + id: 'south-panel', + contentEl: 'south', + height: 16, + margins: '2 2 2 5' + }), + mainTabPanel ] }); @@ -109,7 +109,7 @@ Ext.onReady(function(){ console.debug('create main menu'); } var panel = Ext.getCmp('navigationPanel'); - panel.addSections([{ + panel.addSection({ title: 'Main', items: [{ label: 'Repositories', @@ -117,37 +117,47 @@ Ext.onReady(function(){ addTabPanel('repositories', 'repositoryPanel', 'Repositories'); } }] - },{ - title: 'Config', - items: [{ - label: 'General', - fn: function(){ - addTabPanel("scmConfig", "scmConfig", "Scm Config"); - } + }); + + if ( admin ){ + panel.addSections([{ + title: 'Config', + items: [{ + label: 'General', + fn: function(){ + addTabPanel("scmConfig", "scmConfig", "Scm Config"); + } + },{ + label: 'Repository Types', + fn: function(){ + addTabPanel('repositoryConfig', 'repositoryConfig', 'Repository Config'); + } + },{ + label: 'Server', + fn: function(){ + console.debug( 'Server Config' ); + } + }] },{ - label: 'Repository Types', - fn: function(){ - addTabPanel('repositoryConfig', 'repositoryConfig', 'Repository Config'); - } - },{ - label: 'Server', - fn: function(){console.debug( 'Server Config' );} - }] - },{ - title: 'Security', - items: [{ - label: 'Users', - fn: function(){ - addTabPanel('users', 'userPanel', 'Users'); - } - }] - },{ + title: 'Security', + items: [{ + label: 'Users', + fn: function(){ + addTabPanel('users', 'userPanel', 'Users'); + } + }] + }]); + } + + panel.addSection({ title: 'Abmelden', items: [{ label: 'Abmelden', fn: logout }] - }]); + }); + //fix hidden logout button + panel.doLayout(); } function createWelcomePanel(){