improve web interface navigation

This commit is contained in:
Sebastian Sdorra
2010-11-25 19:08:32 +01:00
parent afc56635ea
commit 6e9bbc96c9
2 changed files with 63 additions and 51 deletions

View File

@@ -33,6 +33,7 @@
var debug = typeof console != 'undefined'; var debug = typeof console != 'undefined';
var state = null; var state = null;
var admin = false;
// sonia.scm.api.rest.resources.UserResource.DUMMY_PASSWORT // sonia.scm.api.rest.resources.UserResource.DUMMY_PASSWORT
var dummyPassword = '__dummypassword__'; var dummyPassword = '__dummypassword__';
@@ -50,6 +51,7 @@ function loadState(s){
console.debug( s ); console.debug( s );
} }
state = s; state = s;
admin = s.user.admin;
// call login callback functions // call login callback functions
Ext.each(loginCallbacks, function(callback){ Ext.each(loginCallbacks, function(callback){
if ( Ext.isFunction(callback) ){ if ( Ext.isFunction(callback) ){

View File

@@ -42,31 +42,31 @@ Ext.onReady(function(){
new Ext.Viewport({ new Ext.Viewport({
layout: 'border', layout: 'border',
items: [ items: [
new Ext.BoxComponent({ new Ext.BoxComponent({
region: 'north', region: 'north',
id: 'north-panel', id: 'north-panel',
contentEl: 'north', contentEl: 'north',
height: 75 height: 75
}), { }), {
region: 'west', region: 'west',
id: 'navigationPanel', id: 'navigationPanel',
title: 'Navigation', title: 'Navigation',
xtype: 'navPanel', xtype: 'navPanel',
split: true, split: true,
width: 200, width: 200,
minSize: 175, minSize: 175,
maxSize: 400, maxSize: 400,
collapsible: true, collapsible: true,
margins: '0 0 0 5' margins: '0 0 0 5'
}, },
new Ext.BoxComponent({ new Ext.BoxComponent({
region: 'south', region: 'south',
id: 'south-panel', id: 'south-panel',
contentEl: 'south', contentEl: 'south',
height: 16, height: 16,
margins: '2 2 2 5' margins: '2 2 2 5'
}), }),
mainTabPanel mainTabPanel
] ]
}); });
@@ -109,7 +109,7 @@ Ext.onReady(function(){
console.debug('create main menu'); console.debug('create main menu');
} }
var panel = Ext.getCmp('navigationPanel'); var panel = Ext.getCmp('navigationPanel');
panel.addSections([{ panel.addSection({
title: 'Main', title: 'Main',
items: [{ items: [{
label: 'Repositories', label: 'Repositories',
@@ -117,37 +117,47 @@ Ext.onReady(function(){
addTabPanel('repositories', 'repositoryPanel', 'Repositories'); addTabPanel('repositories', 'repositoryPanel', 'Repositories');
} }
}] }]
},{ });
title: 'Config',
items: [{ if ( admin ){
label: 'General', panel.addSections([{
fn: function(){ title: 'Config',
addTabPanel("scmConfig", "scmConfig", "Scm 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', title: 'Security',
fn: function(){ items: [{
addTabPanel('repositoryConfig', 'repositoryConfig', 'Repository Config'); label: 'Users',
} fn: function(){
},{ addTabPanel('users', 'userPanel', 'Users');
label: 'Server', }
fn: function(){console.debug( 'Server Config' );} }]
}] }]);
},{ }
title: 'Security',
items: [{ panel.addSection({
label: 'Users',
fn: function(){
addTabPanel('users', 'userPanel', 'Users');
}
}]
},{
title: 'Abmelden', title: 'Abmelden',
items: [{ items: [{
label: 'Abmelden', label: 'Abmelden',
fn: logout fn: logout
}] }]
}]); });
//fix hidden logout button
panel.doLayout();
} }
function createWelcomePanel(){ function createWelcomePanel(){