]> source.dussan.org Git - archiva.git/commitdiff
[MRM-765]
authorMaria Odea B. Ching <oching@apache.org>
Wed, 10 Sep 2008 08:46:26 +0000 (08:46 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Wed, 10 Sep 2008 08:46:26 +0000 (08:46 +0000)
submitted by Mark Jeffery
-disabled the Add link if there are no remote repositories defined and inform the user that it is disabled

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.1.x@693737 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxyConnectors.jsp

index fccbd380ed20973a960bc790ede2941a384bea2e..3cfb0ece9bcb164d4e75a5364ca3a914d7d1332c 100644 (file)
@@ -43,6 +43,11 @@ public class ProxyConnectorsAction
 {
     private Map<String, AbstractRepositoryConfiguration> repoMap;
 
+    /**
+     * boolean to indicate that remote repo is present. Used for Add Link
+     */
+    private boolean remoteRepoExists=false;
+    
     /**
      * Map of Proxy Connectors.
      */
@@ -57,6 +62,8 @@ public class ProxyConnectorsAction
         repoMap.putAll( config.getManagedRepositoriesAsMap() );
 
         proxyConnectorMap = createProxyConnectorMap();
+        
+        remoteRepoExists=config.getRemoteRepositories().size()>0;
     }
 
     public Map<String, AbstractRepositoryConfiguration> getRepoMap()
@@ -68,4 +75,9 @@ public class ProxyConnectorsAction
     {
         return proxyConnectorMap;
     }
+
+       public boolean getRemoteRepoExists()
+    {
+        return remoteRepoExists;
+    }
 }
index 78963a1fa49db3995f730788f5789556844b567b..db597c5da1329081e5f278337f312b47bbbf685d 100644 (file)
 <ww:actionerror/>
 <ww:actionmessage/>
 
-<div style="float:right">
-  <redback:ifAnyAuthorized permissions="archiva-manage-configuration">
-    <ww:url id="addProxyConnectorUrl" action="addProxyConnector"/>
-    <ww:a href="%{addProxyConnectorUrl}" cssClass="create">
-      <img src="<c:url value="/images/icons/create.png" />"/>
-      Add
-    </ww:a>
-  </redback:ifAnyAuthorized>
+<div style="float:right">  
+  <c:choose>
+       <c:when test="${remoteRepoExists}">
+         <redback:ifAnyAuthorized permissions="archiva-manage-configuration">
+           <ww:url id="addProxyConnectorUrl" action="addProxyConnector"/>
+           <ww:a href="%{addProxyConnectorUrl}" cssClass="create">
+             <img src="<c:url value="/images/icons/create.png" />"/>
+             Add
+           </ww:a>
+         </redback:ifAnyAuthorized>
+       </c:when>
+       <c:otherwise>
+               <img src="<c:url value="/images/icons/create.png" />"/>
+             Add (Disabled. No remote repositories)
+       </c:otherwise>
+  </c:choose>    
 </div>
 
 <h2>Repository Proxy Connectors</h2>