--- /dev/null
+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;
+ }
+}
--- /dev/null
+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;
+ }
+}
*/
import com.opensymphony.xwork.Preparable;
+import com.opensymphony.xwork.Validateable;
import org.apache.commons.collections.Closure;
import org.apache.commons.collections.CollectionUtils;
*/
public class ConfigureProxyConnectorAction
extends PlexusActionSupport
- implements SecureAction, Preparable, Initializable
+ implements SecureAction, Preparable, Validateable, Initializable
{
private static final String DIRECT_CONNECTION = "(direct connection)";
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();
public String removeProperty()
{
- getLogger().info( ".removeProperty()" );
String key = getPropertyKey();
if ( StringUtils.isBlank( key ) )
public String addWhiteListPattern()
{
- getLogger().info( ".addWhiteListPattern()" );
String pattern = getWhiteListPattern();
if ( StringUtils.isBlank( pattern ) )
if ( !hasActionErrors() )
{
- getLogger().info(
- "whitelist patterns: (" + getConnector().getWhiteListPatterns().size() + "): "
- + getConnector().getWhiteListPatterns() );
-
getConnector().getWhiteListPatterns().add( pattern );
setWhiteListPattern( null );
}
public String removeWhiteListPattern()
{
String pattern = getPattern();
- getLogger().info( ".removeWhiteListPattern(" + pattern + ")" );
if ( StringUtils.isBlank( pattern ) )
{
public String addBlackListPattern()
{
- getLogger().info( ".addBlackListPattern()" );
String pattern = getBlackListPattern();
if ( StringUtils.isBlank( pattern ) )
public String removeBlackListPattern()
{
- getLogger().info( ".removeBlackListPattern()" );
String pattern = getBlackListPattern();
if ( StringUtils.isBlank( pattern ) )
public String edit()
{
- getLogger().info( ".edit()" );
this.mode = "edit";
return INPUT;
}
public String input()
{
- getLogger().info( "input()" );
return INPUT;
}
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();
}
}
{
this.connector = findProxyConnector( sourceId, targetId );
}
- getLogger().info( "Connector: " + connector );
Configuration config = archivaConfiguration.getConfiguration();
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 );
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();
continue;
}
}
-
- if ( hasActionErrors() || hasActionMessages() )
- {
- return false;
- }
-
- return true;
}
private void removeConnector( String sourceId, String targetId )
--- /dev/null
+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;
+ }
+}
* 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
* @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;
+ }
}
<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">
--- /dev/null
+<%--
+ ~ 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>
--- /dev/null
+<%--
+ ~ 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
<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>
--- /dev/null
+<%--
+ ~ 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
--- /dev/null
+<%--
+ ~ 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" />
--- /dev/null
+<%--
+ ~ 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>
<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)}">
<%-- 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">
<%-- 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">
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