diff options
author | Joakim Erdfelt <joakime@apache.org> | 2007-05-07 21:30:38 +0000 |
---|---|---|
committer | Joakim Erdfelt <joakime@apache.org> | 2007-05-07 21:30:38 +0000 |
commit | 6ff6fab1e4754021b01dafaca98aeb41fe6b70a0 (patch) | |
tree | f9954f12bce68f52b506eb16ca37a92cc7aa138a | |
parent | cfc586926328557e341768259ca9d84a220a75c3 (diff) | |
download | archiva-6ff6fab1e4754021b01dafaca98aeb41fe6b70a0.tar.gz archiva-6ff6fab1e4754021b01dafaca98aeb41fe6b70a0.zip |
Adding Network Proxy admin screens.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@535999 13f79535-47bb-0310-9956-ffa450edef68
14 files changed, 744 insertions, 73 deletions
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxyComparator.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxyComparator.java new file mode 100644 index 000000000..6acd20ff5 --- /dev/null +++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxyComparator.java @@ -0,0 +1,62 @@ +package org.apache.maven.archiva.configuration.util; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; + +import java.util.Comparator; + +/** + * NetworkProxyComparator + * + * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @version $Id$ + */ +public class NetworkProxyComparator + implements Comparator +{ + + public int compare( Object o1, Object o2 ) + { + if ( o1 == null && o2 == null ) + { + return 0; + } + + if ( o1 == null && o2 != null ) + { + return 1; + } + + if ( o1 != null && o2 == null ) + { + return -1; + } + + if ( ( o1 instanceof NetworkProxyConfiguration ) && ( o2 instanceof NetworkProxyConfiguration ) ) + { + String id1 = ( (NetworkProxyConfiguration) o1 ).getId(); + String id2 = ( (NetworkProxyConfiguration) o2 ).getId(); + return id1.compareToIgnoreCase( id2 ); + } + + return 0; + } +} diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxySelectionPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxySelectionPredicate.java new file mode 100644 index 000000000..c21630866 --- /dev/null +++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxySelectionPredicate.java @@ -0,0 +1,54 @@ +package org.apache.maven.archiva.configuration.util; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.collections.Predicate; +import org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; + +/** + * NetworkProxySelectionPredicate + * + * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @version $Id$ + */ +public class NetworkProxySelectionPredicate + implements Predicate +{ + private String proxyId; + + public NetworkProxySelectionPredicate( String id ) + { + this.proxyId = id; + } + + public boolean evaluate( Object object ) + { + boolean satisfies = false; + + if ( object instanceof NetworkProxyConfiguration ) + { + NetworkProxyConfiguration proxy = (NetworkProxyConfiguration) object; + return ( StringUtils.equals( proxyId, proxy.getId() ) ); + } + + return satisfies; + } +} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java index cca665ae5..8b416bc9c 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java @@ -20,6 +20,7 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy; */ import com.opensymphony.xwork.Preparable; +import com.opensymphony.xwork.Validateable; import org.apache.commons.collections.Closure; import org.apache.commons.collections.CollectionUtils; @@ -63,7 +64,7 @@ import java.util.Map.Entry; */ public class ConfigureProxyConnectorAction extends PlexusActionSupport - implements SecureAction, Preparable, Initializable + implements SecureAction, Preparable, Validateable, Initializable { private static final String DIRECT_CONNECTION = "(direct connection)"; @@ -128,26 +129,22 @@ public class ConfigureProxyConnectorAction public String add() { - getLogger().info( ".add()" ); this.mode = "add"; return INPUT; } public String confirm() { - getLogger().info( ".confirm()" ); return INPUT; } public String delete() { - getLogger().info( ".delete()" ); return INPUT; } public String addProperty() { - getLogger().info( ".addProperty()" ); String key = getPropertyKey(); String value = getPropertyValue(); @@ -173,7 +170,6 @@ public class ConfigureProxyConnectorAction public String removeProperty() { - getLogger().info( ".removeProperty()" ); String key = getPropertyKey(); if ( StringUtils.isBlank( key ) ) @@ -193,7 +189,6 @@ public class ConfigureProxyConnectorAction public String addWhiteListPattern() { - getLogger().info( ".addWhiteListPattern()" ); String pattern = getWhiteListPattern(); if ( StringUtils.isBlank( pattern ) ) @@ -203,10 +198,6 @@ public class ConfigureProxyConnectorAction if ( !hasActionErrors() ) { - getLogger().info( - "whitelist patterns: (" + getConnector().getWhiteListPatterns().size() + "): " - + getConnector().getWhiteListPatterns() ); - getConnector().getWhiteListPatterns().add( pattern ); setWhiteListPattern( null ); } @@ -217,7 +208,6 @@ public class ConfigureProxyConnectorAction public String removeWhiteListPattern() { String pattern = getPattern(); - getLogger().info( ".removeWhiteListPattern(" + pattern + ")" ); if ( StringUtils.isBlank( pattern ) ) { @@ -235,7 +225,6 @@ public class ConfigureProxyConnectorAction public String addBlackListPattern() { - getLogger().info( ".addBlackListPattern()" ); String pattern = getBlackListPattern(); if ( StringUtils.isBlank( pattern ) ) @@ -254,7 +243,6 @@ public class ConfigureProxyConnectorAction public String removeBlackListPattern() { - getLogger().info( ".removeBlackListPattern()" ); String pattern = getBlackListPattern(); if ( StringUtils.isBlank( pattern ) ) @@ -273,7 +261,6 @@ public class ConfigureProxyConnectorAction public String edit() { - getLogger().info( ".edit()" ); this.mode = "edit"; return INPUT; } @@ -359,7 +346,6 @@ public class ConfigureProxyConnectorAction public String input() { - getLogger().info( "input()" ); return INPUT; } @@ -369,13 +355,10 @@ public class ConfigureProxyConnectorAction String sourceId = getSource(); String targetId = getTarget(); - getLogger().info( ".prepare() - sourceId [" + sourceId + "], targetId [" + targetId + "]" ); - if ( StringUtils.isBlank( sourceId ) || StringUtils.isBlank( targetId ) ) { if ( this.connector == null ) { - getLogger().info( "Creating new connector." ); this.connector = new ProxyConnectorConfiguration(); } } @@ -383,7 +366,6 @@ public class ConfigureProxyConnectorAction { this.connector = findProxyConnector( sourceId, targetId ); } - getLogger().info( "Connector: " + connector ); Configuration config = archivaConfiguration.getConfiguration(); @@ -426,13 +408,6 @@ public class ConfigureProxyConnectorAction String sourceId = getConnector().getSourceRepoId(); String targetId = getConnector().getTargetRepoId(); - getLogger().info( ".save(" + mode + ":" + sourceId + "->" + targetId + ")" ); - - if ( !isValid( getConnector() ) ) - { - return INPUT; - } - if ( StringUtils.equalsIgnoreCase( "edit", mode ) ) { removeConnector( sourceId, targetId ); @@ -527,13 +502,14 @@ public class ConfigureProxyConnectorAction ProxyConnectorSelectionPredicate selectedProxy = new ProxyConnectorSelectionPredicate( sourceId, targetId ); return (ProxyConnectorConfiguration) CollectionUtils.find( config.getProxyConnectors(), selectedProxy ); } - - private boolean isValid( ProxyConnectorConfiguration proxyConnector ) + + public void validate() { + ProxyConnectorConfiguration proxyConnector = getConnector(); + if ( proxyConnector.getPolicies() == null ) { addActionError( "Policies must be set." ); - return false; } Iterator it = policyMap.entrySet().iterator(); @@ -568,13 +544,6 @@ public class ConfigureProxyConnectorAction continue; } } - - if ( hasActionErrors() || hasActionMessages() ) - { - return false; - } - - return true; } private void removeConnector( String sourceId, String targetId ) diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java new file mode 100644 index 000000000..5da2144b5 --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java @@ -0,0 +1,211 @@ +package org.apache.maven.archiva.web.action.admin.networkproxies; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import com.opensymphony.xwork.Preparable; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.functors.NotPredicate; +import org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.InvalidConfigurationException; +import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; +import org.apache.maven.archiva.configuration.util.NetworkProxySelectionPredicate; +import org.apache.maven.archiva.security.ArchivaRoleConstants; +import org.codehaus.plexus.registry.RegistryException; +import org.codehaus.plexus.security.rbac.Resource; +import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; +import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle; +import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException; +import org.codehaus.plexus.xwork.action.PlexusActionSupport; + +import java.io.IOException; + +/** + * ConfigureNetworkProxyAction + * + * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @version $Id$ + * + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureNetworkProxyAction" + */ +public class ConfigureNetworkProxyAction + extends PlexusActionSupport + implements SecureAction, Preparable +{ + /** + * @plexus.requirement + */ + private ArchivaConfiguration archivaConfiguration; + + private String mode; + + private String proxyid; + + private NetworkProxyConfiguration proxy; + + public String add() + { + this.mode = "add"; + return INPUT; + } + + public String confirm() + { + return INPUT; + } + + public String delete() + { + return INPUT; + } + + public String edit() + { + this.mode = "edit"; + return INPUT; + } + + public String getMode() + { + return mode; + } + + public NetworkProxyConfiguration getProxy() + { + return proxy; + } + + public String getProxyid() + { + return proxyid; + } + + public SecureActionBundle getSecureActionBundle() + throws SecureActionException + { + SecureActionBundle bundle = new SecureActionBundle(); + + bundle.setRequiresAuthentication( true ); + bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL ); + + return bundle; + } + + public String input() + { + return INPUT; + } + + public void prepare() + throws Exception + { + String id = getProxyid(); + + if ( StringUtils.isNotBlank( id ) ) + { + proxy = findNetworkProxy( id ); + } + + if ( proxy == null ) + { + proxy = new NetworkProxyConfiguration(); + } + } + + public String save() + { + String mode = getMode(); + + String id = getProxy().getId(); + + if ( StringUtils.equalsIgnoreCase( "edit", mode ) ) + { + removeNetworkProxy( id ); + } + + try + { + addNetworkProxy( getProxy() ); + saveConfiguration(); + } + catch ( IOException e ) + { + addActionError( "I/O Exception: " + e.getMessage() ); + } + catch ( InvalidConfigurationException e ) + { + addActionError( "Invalid Configuration Exception: " + e.getMessage() ); + } + catch ( RegistryException e ) + { + addActionError( "Configuration Registry Exception: " + e.getMessage() ); + } + + return SUCCESS; + } + + public void setMode( String mode ) + { + this.mode = mode; + } + + public void setProxy( NetworkProxyConfiguration proxy ) + { + this.proxy = proxy; + } + + public void setProxyid( String proxyid ) + { + this.proxyid = proxyid; + } + + private void addNetworkProxy( NetworkProxyConfiguration proxy ) + { + archivaConfiguration.getConfiguration().addNetworkProxy( proxy ); + } + + private NetworkProxyConfiguration findNetworkProxy( String id ) + { + Configuration config = archivaConfiguration.getConfiguration(); + + NetworkProxySelectionPredicate selectedProxy = new NetworkProxySelectionPredicate( id ); + + return (NetworkProxyConfiguration) CollectionUtils.find( config.getNetworkProxies(), selectedProxy ); + } + + private void removeNetworkProxy( String id ) + { + NetworkProxySelectionPredicate selectedProxy = new NetworkProxySelectionPredicate( id ); + NotPredicate notSelectedProxy = new NotPredicate( selectedProxy ); + CollectionUtils.filter( archivaConfiguration.getConfiguration().getNetworkProxies(), notSelectedProxy ); + } + + private String saveConfiguration() + throws IOException, InvalidConfigurationException, RegistryException + { + archivaConfiguration.save( archivaConfiguration.getConfiguration() ); + + addActionMessage( "Successfully saved configuration" ); + + return SUCCESS; + } +} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java index 160a93cca..84d8974a0 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java @@ -19,17 +19,17 @@ package org.apache.maven.archiva.web.action.admin.networkproxies; * under the License. */ -import com.opensymphony.webwork.interceptor.ServletRequestAware; -import com.opensymphony.xwork.ModelDriven; import com.opensymphony.xwork.Preparable; -import com.opensymphony.xwork.Validateable; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.security.ArchivaRoleConstants; +import org.codehaus.plexus.security.rbac.Resource; import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException; import org.codehaus.plexus.xwork.action.PlexusActionSupport; -import javax.servlet.http.HttpServletRequest; +import java.util.List; /** * NetworkProxiesAction @@ -40,34 +40,40 @@ import javax.servlet.http.HttpServletRequest; * @plexus.component role="com.opensymphony.xwork.Action" role-hint="networkProxiesAction" */ public class NetworkProxiesAction -extends PlexusActionSupport -implements ModelDriven, Preparable, Validateable, SecureAction, ServletRequestAware + extends PlexusActionSupport + implements Preparable, SecureAction { + /** + * @plexus.requirement + */ + private ArchivaConfiguration configuration; - public Object getModel() - { - // TODO Auto-generated method stub - return null; - } + private List networkProxies; public void prepare() throws Exception { - // TODO Auto-generated method stub - + networkProxies = configuration.getConfiguration().getNetworkProxies(); } public SecureActionBundle getSecureActionBundle() throws SecureActionException { - // TODO Auto-generated method stub - return null; + SecureActionBundle bundle = new SecureActionBundle(); + + bundle.setRequiresAuthentication( true ); + bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL ); + + return bundle; } - public void setServletRequest( HttpServletRequest request ) + public List getNetworkProxies() { - // TODO Auto-generated method stub - + return networkProxies; } + public void setNetworkProxies( List networkProxies ) + { + this.networkProxies = networkProxies; + } } diff --git a/archiva-web/archiva-webapp/src/main/resources/xwork.xml b/archiva-web/archiva-webapp/src/main/resources/xwork.xml index 7bd0cd23b..a60c3c423 100644 --- a/archiva-web/archiva-webapp/src/main/resources/xwork.xml +++ b/archiva-web/archiva-webapp/src/main/resources/xwork.xml @@ -306,6 +306,30 @@ <result name="input">/WEB-INF/jsp/admin/networkProxies.jsp</result> </action> + <action name="addNetworkProxy" class="configureNetworkProxyAction" method="add"> + <result name="input">/WEB-INF/jsp/admin/addNetworkProxy.jsp</result> + <result name="success" type="redirect-action">networkProxies</result> + <interceptor-ref name="configuredPrepareParamsStack"/> + </action> + + <action name="editNetworkProxy" class="configureNetworkProxyAction" method="edit"> + <result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result> + <result name="success" type="redirect-action">networkProxies</result> + <interceptor-ref name="configuredPrepareParamsStack"/> + </action> + + <action name="saveNetworkProxy" class="configureNetworkProxyAction" method="save"> + <result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result> + <result name="success" type="redirect-action">networkProxies</result> + <interceptor-ref name="configuredPrepareParamsStack"/> + </action> + + <action name="deleteNetworkProxy" class="configureNetworkProxyAction" method="confirm"> + <result name="input">/WEB-INF/jsp/admin/deleteNetworkProxy.jsp</result> + <result name="success" type="redirect-action">networkProxies</result> + <interceptor-ref name="configuredPrepareParamsStack"/> + </action> + <!-- .\ REPOSITORY SCANNING \._____________________________________ --> <action name="repositoryScanning" class="repositoryScanningAction" method="input"> diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addNetworkProxy.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addNetworkProxy.jsp new file mode 100644 index 000000000..7561af365 --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addNetworkProxy.jsp @@ -0,0 +1,51 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> + +<%@ taglib prefix="ww" uri="/webwork" %> + +<html> +<head> + <title>Admin: Add Network Proxy</title> + <ww:head/> +</head> + +<body> + +<h1>Admin: Add Network Proxy</h1> + +<div id="contentArea"> + + <h2>Add Network Proxy</h2> + + <ww:actionmessage/> + <ww:form method="post" action="saveNetworkProxy" namespace="/admin" validate="true"> + <ww:hidden name="mode" value="add"/> + <ww:textfield name="proxy.id" label="Identifier" size="10" required="true"/> + <%@ include file="/WEB-INF/jsp/admin/include/networkProxyForm.jspf" %> + <ww:submit value="Add Network Proxy"/> + </ww:form> + + <script type="text/javascript"> + document.getElementById("saveNetworkProxy_id").focus(); + </script> + +</div> + +</body> +</html> diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteNetworkProxy.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteNetworkProxy.jsp new file mode 100644 index 000000000..584a99c72 --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteNetworkProxy.jsp @@ -0,0 +1,51 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> + +<%@ taglib prefix="ww" uri="/webwork" %> + +<html> +<head> + <title>Admin: Delete Network Proxy</title> + <ww:head/> +</head> + +<body> + +<h1>Admin: Delete Network Proxy</h1> + +<div id="contentArea"> + + <h2>Delete Network Proxy</h2> + + <blockquote> + <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong> + </blockquote> + + <p> + Are you sure you want to delete network proxy ${proxyid} ? + </p> + + <ww:form method="post" action="deleteNetworkProxy!delete" namespace="/admin" validate="true"> + <ww:hidden name="proxyid"/> + <ww:submit value="Delete"/> + </ww:form> +</div> + +</body> +</html>
\ No newline at end of file diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp index 379b178b3..c028c1dd3 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteRepository.jsp @@ -21,17 +21,17 @@ <html> <head> - <title>Configuration</title> + <title>Admin: Delete Repository</title> <ww:head/> </head> <body> -<h1>Configuration</h1> +<h1>Admin: Delete Repository</h1> <div id="contentArea"> - <h2>Delete Managed Repository</h2> + <h2>Delete Repository</h2> <blockquote> <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong> diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp new file mode 100644 index 000000000..73da77a8f --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp @@ -0,0 +1,51 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> + +<%@ taglib prefix="ww" uri="/webwork" %> + +<html> +<head> + <title>Admin: Edit Network Proxy</title> + <ww:head/> +</head> + +<body> + +<h1>Admin: Network Proxy</h1> + +<div id="contentArea"> + + <h2>Edit Network Proxy</h2> + + <ww:actionmessage/> + <ww:form method="post" action="saveNetworkProxy" namespace="/admin" validate="false"> + <ww:hidden name="mode" value="edit"/> + <ww:hidden name="proxy.id"/> + <%@ include file="/WEB-INF/jsp/admin/include/networkProxyForm.jspf" %> + <ww:submit value="Save Network Proxy"/> + </ww:form> + + <script type="text/javascript"> + document.getElementById("saveNetworkProxy_host").focus(); + </script> + +</div> + +</body> +</html>
\ No newline at end of file diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/networkProxyForm.jspf b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/networkProxyForm.jspf new file mode 100644 index 000000000..935c4b176 --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/networkProxyForm.jspf @@ -0,0 +1,26 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<%@ taglib prefix="ww" uri="/webwork" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +<ww:textfield name="proxy.protocol" label="Protocol" size="5" required="true"/> +<ww:textfield name="proxy.host" label="Hostname" size="50" required="true"/> +<ww:textfield name="proxy.port" label="Port" size="5" required="true" /> +<ww:textfield name="proxy.username" label="Username" size="25" required="false" /> +<ww:password name="proxy.password" label="Password" size="25" required="false" /> diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/networkProxies.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/networkProxies.jsp new file mode 100644 index 000000000..96b59b373 --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/networkProxies.jsp @@ -0,0 +1,128 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> + +<%@ taglib prefix="ww" uri="/webwork"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="pss" uri="/plexusSecuritySystem"%> +<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva"%> + +<html> +<head> +<title>Administration - Network Proxies</title> +<ww:head /> +</head> + +<body> + +<h1>Administration - Network Proxies</h1> + +<div id="contentArea"> + +<ww:actionerror /> <ww:actionmessage /> + +<div class="admin"> +<div class="controls"> +<pss:ifAuthorized + permission="archiva-manage-configuration"> + <ww:url id="addNetworkProxyUrl" action="addNetworkProxy" /> + <ww:a href="%{addNetworkProxyUrl}"> + <img src="<c:url value="/images/icons/create.png" />" /> + Add Network Proxy</ww:a> +</pss:ifAuthorized></div> +<h2>Network Proxies</h2> + +<c:choose> + <c:when test="${empty(networkProxies)}"> + <%-- No Local Repositories. --%> + <strong>There are no network proxies configured yet.</strong> + </c:when> + <c:otherwise> + <%-- Display the repositories. --%> + + <c:forEach items="${networkProxies}" var="proxy" varStatus="i"> + <c:choose> + <c:when test='${(i.index)%2 eq 0}'> + <c:set var="rowColor" value="dark" scope="page" /> + </c:when> + <c:otherwise> + <c:set var="rowColor" value="lite" scope="page" /> + </c:otherwise> + </c:choose> + + <div class="netproxy ${rowColor}"> + + <div class="controls"> + <pss:ifAnyAuthorized + permissions="archiva-manage-configuration"> + <ww:url id="editNetworkProxyUrl" action="editNetworkProxy"> + <ww:param name="proxyid" value="%{'${proxy.id}'}" /> + </ww:url> + <ww:url id="deleteNetworkProxyUrl" action="deleteNetworkProxy" method="confirm"> + <ww:param name="proxyid" value="%{'${proxy.id}'}" /> + </ww:url> + <ww:a href="%{editNetworkProxyUrl}"> + <img src="<c:url value="/images/icons/edit.png" />" /> + Edit Network Proxy</ww:a> + <ww:a href="%{deleteNetworkProxyUrl}"> + <img src="<c:url value="/images/icons/delete.gif" />" /> + Delete Network Proxy</ww:a> + </pss:ifAnyAuthorized></div> + + <table class="infoTable"> + <tr> + <th>Identifier</th> + <td><code>${proxy.id}</code></td> + </tr> + <tr> + <th>Protocol</th> + <td>${proxy.protocol}</td> + </tr> + <tr> + <th>Host</th> + <td>${proxy.host}</td> + </tr> + <tr> + <th>Port</th> + <td>${proxy.port}</td> + </tr> + <c:if test="${not empty(proxy.username)}"> + <tr> + <th>Username</th> + <td>${proxy.username}</td> + </tr> + <c:if test="${not empty(proxy.password)}"> + <tr> + <th>Password</th> + <td>••••••••</td> + </tr> + </c:if> + </c:if> + </table> + + </div> + </c:forEach> + + </c:otherwise> +</c:choose> +</div> + +</div> + +</body> +</html> diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp index 9c00884d2..e977bc7d6 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp @@ -37,18 +37,16 @@ <ww:actionerror /> <ww:actionmessage /> - <div> - <div style="float: right"> - <%-- TODO replace with icons --%> - <pss:ifAuthorized permission="archiva-manage-configuration"> - <ww:url id="addRepositoryUrl" action="addRepository"/> - <ww:a href="%{addRepositoryUrl}"> - <img src="<c:url value="/images/icons/create.png" />" /> - Add Repository</ww:a> - </pss:ifAuthorized> - </div> - <h2>Local Repositories</h2> +<div class="admin"> + <div class="controls"> + <pss:ifAuthorized permission="archiva-manage-configuration"> + <ww:url id="addRepositoryUrl" action="addRepository"/> + <ww:a href="%{addRepositoryUrl}"> + <img src="<c:url value="/images/icons/create.png" />" /> + Add Repository</ww:a> + </pss:ifAuthorized> </div> + <h2>Local Repositories</h2> <c:choose> <c:when test="${empty(managedRepositories)}"> @@ -59,10 +57,18 @@ <%-- Display the repositories. --%> <c:forEach items="${managedRepositories}" var="repository" varStatus="i"> + <c:choose> + <c:when test='${(i.index)%2 eq 0}'> + <c:set var="rowColor" value="dark" scope="page" /> + </c:when> + <c:otherwise> + <c:set var="rowColor" value="lite" scope="page" /> + </c:otherwise> + </c:choose> - <div class="repository"> + <div class="repository ${rowColor}"> - <div style="float: right"> + <div class="controls"> <%-- TODO: make some icons --%> <pss:ifAnyAuthorized permissions="archiva-manage-configuration"> <ww:url id="editRepositoryUrl" action="editRepository"> @@ -200,9 +206,18 @@ <%-- Display the repositories. --%> <c:forEach items="${remoteRepositories}" var="repository" varStatus="i"> - <div class="repository"> + <c:choose> + <c:when test='${(i.index)%2 eq 0}'> + <c:set var="rowColor" value="dark" scope="page" /> + </c:when> + <c:otherwise> + <c:set var="rowColor" value="lite" scope="page" /> + </c:otherwise> + </c:choose> + + <div class="repository ${rowColor}"> - <div style="float: right"> + <div class="controls"> <%-- TODO: make some icons --%> <pss:ifAnyAuthorized permissions="archiva-manage-configuration"> <ww:url id="editRepositoryUrl" action="editRepository"> diff --git a/archiva-web/archiva-webapp/src/main/webapp/css/site.css b/archiva-web/archiva-webapp/src/main/webapp/css/site.css index fcdd9fc84..5091385f1 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/css/site.css +++ b/archiva-web/archiva-webapp/src/main/webapp/css/site.css @@ -284,4 +284,27 @@ tr.proxyConnector td.connector table p { tr.seperator td { border-top: 1px dashed #dddddd !important; +} + +div.admin div.dark, +div.admin div.lite { + border: 1px solid #aaaaaa; + font-size: 11pt; + margin-left: 15px; + margin-right: 15px; + margin-bottom: 5px; + padding: 5px; +} + +div.admin div.lite { + background-color: white; +} + +div.admin div.dark { + background-color: #eeeeee; +} + +div.admin div.controls { + float: right; + font-size: 8pt !important; }
\ No newline at end of file |