archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joak...@apache.org
Subject svn commit: r537036 - in /maven/archiva/trunk/archiva-web/archiva-webapp/src/main: java/org/apache/maven/archiva/web/action/admin/networkproxies/ resources/ resources/org/apache/maven/archiva/web/action/admin/networkproxies/ webapp/WEB-INF/jsp/admin/
Date Thu, 10 May 2007 23:13:27 GMT
Author: joakime
Date: Thu May 10 16:13:26 2007
New Revision: 537036

URL: http://svn.apache.org/viewvc?view=rev&rev=537036
Log:
[MRM-327]: Adding/Editing network proxies doesn't have validation 

Added:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/networkproxies/
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction-saveNetworkProxy-validation.xml
  (with props)
Removed:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addNetworkProxy.jsp
Modified:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java?view=diff&rev=537036&r1=537035&r2=537036
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
(original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
Thu May 10 16:13:26 2007
@@ -89,7 +89,7 @@
             addActionError( "Unable to remove network proxy, proxy with id [" + id + "] not
found." );
             return SUCCESS;
         }
-        
+
         archivaConfiguration.getConfiguration().removeNetworkProxy( proxyConfig );
         addActionMessage( "Successfully removed network proxy [" + id + "]" );
         return saveConfiguration();
@@ -157,6 +157,14 @@
         if ( StringUtils.equalsIgnoreCase( "edit", mode ) )
         {
             removeNetworkProxy( id );
+        }
+        else
+        {
+            if ( findNetworkProxy( id ) != null )
+            {
+                addActionError( "Unable to add new repository with id [" + id + "], that
id already exists." );
+                return INPUT;
+            }
         }
 
         addNetworkProxy( getProxy() );

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction-saveNetworkProxy-validation.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction-saveNetworkProxy-validation.xml?view=auto&rev=537036
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction-saveNetworkProxy-validation.xml
(added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction-saveNetworkProxy-validation.xml
Thu May 10 16:13:26 2007
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+
+
+<validators>
+  <field name="proxy.id">
+    <field-validator type="stringlength">
+      <param name="minLength">4</param>
+      <param name="maxLength">45</param>
+      <param name="trim">true</param>
+      <message>You must enter an identifier of 4 or more than 4 characters.</message>
+    </field-validator>
+  </field>
+  <field name="proxy.protocol">
+    <field-validator type="requiredstring">
+      <param name="trim">true</param>
+      <message>You must enter a protocol.</message>
+    </field-validator>
+  </field>
+  <field name="proxy.host">
+    <field-validator type="requiredstring">
+      <param name="trim">true</param>
+      <message>You must enter a host.</message>
+    </field-validator>
+  </field>
+  <field name="proxy.port">
+    <field-validator type="required">
+      <message>You must enter an port.</message>
+    </field-validator>
+    <field-validator type="int">
+      <param name="min">1</param>
+      <param name="max">65535</param>
+      <message>Port needs to be between ${min} and ${max}</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction-saveNetworkProxy-validation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction-saveNetworkProxy-validation.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction-saveNetworkProxy-validation.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml?view=diff&rev=537036&r1=537035&r2=537036
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml Thu May 10
16:13:26 2007
@@ -307,7 +307,7 @@
     </action>
     
     <action name="addNetworkProxy" class="configureNetworkProxyAction" method="add">
-      <result name="input">/WEB-INF/jsp/admin/addNetworkProxy.jsp</result>
+      <result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result>
       <result name="success" type="redirect-action">networkProxies</result>
       <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp?view=diff&rev=537036&r1=537035&r2=537036
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp
(original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editNetworkProxy.jsp
Thu May 10 16:13:26 2007
@@ -18,25 +18,42 @@
   --%>
 
 <%@ taglib prefix="ww" uri="/webwork" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<c:choose>
+  <c:when test="${mode == 'edit'}">
+    <c:set var="addedit" value="Edit" />
+    <c:set var="disableId" value="true" />
+  </c:when>
+  <c:otherwise>
+    <c:set var="addedit" value="Add" />
+    <c:set var="disableId" value="false" />
+  </c:otherwise>
+</c:choose>
 
 <html>
 <head>
-  <title>Admin: Edit Network Proxy</title>
+  <title>Admin: ${addedit} Network Proxy</title>
   <ww:head/>
 </head>
 
 <body>
 
-<h1>Admin: Network Proxy</h1>
+<h1>Admin: ${addedit} Network Proxy</h1>
 
 <div id="contentArea">
 
-  <h2>Edit Network Proxy</h2>
+  <h2>${addedit} Network Proxy</h2>
 
+  <ww:actionerror/> 
   <ww:actionmessage/>
-  <ww:form method="post" action="saveNetworkProxy" namespace="/admin" validate="false">
-    <ww:hidden name="mode" value="edit"/>  
-    <ww:hidden name="proxy.id"/>
+  
+  <ww:form method="post" action="saveNetworkProxy" namespace="/admin">
+    <ww:hidden name="mode"/>  
+    
+    <ww:textfield name="proxy.id" label="Identifier" size="10" required="true"
+      disabled="${disableId}"/>
+    
     <%@ include file="/WEB-INF/jsp/admin/include/networkProxyForm.jspf" %>
     <ww:submit value="Save Network Proxy"/>
   </ww:form>



Mime
View raw message