simplify code

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1298147 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-07 22:00:39 +00:00
parent 1238f94c44
commit 18f3888b23
1 changed files with 11 additions and 3 deletions

View File

@ -80,22 +80,30 @@ $(function() {
} }
var screen = $.urlParam('screen'); var screen = $.urlParam('screen');
$.log("screen:"+screen+',operations:'+window.redbackModel.operatioNames);
if(screen){ if(screen){
if(screen=='proxy-connectors'&& $.inArray('archiva-manage-configuration',window.redbackModel.operatioNames)>=0){ if(screen=='proxy-connectors'&& hasKarma('archiva-manage-configuration')){
displayProxyConnectors(); displayProxyConnectors();
return; return;
} }
if(screen=="legacy-artifact-path-support"&& $.inArray('archiva-manage-configuration',window.redbackModel.operatioNames)>=0){ if(screen=="legacy-artifact-path-support"&& hasKarma('archiva-manage-configuration')){
displayLegacyArtifactPathSupport(); displayLegacyArtifactPathSupport();
return; return;
} }
if (screen=='repository-scanning'&& hasKarma('archiva-manage-configuration')){
displayRepositoryScanning();
return;
}
} }
// by default display search screen // by default display search screen
displaySearch(); displaySearch();
} }
hasKarma=function(karmaName){
return $.inArray(karmaName,window.redbackModel.operatioNames)>=0;
}
decorateMenuWithKarma=function(user) { decorateMenuWithKarma=function(user) {
var username = user.username; var username = user.username;
$.log("decorateMenuWithKarma"); $.log("decorateMenuWithKarma");