continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r451483 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ resources/ resources/org/apache/maven/continuum/web/action/ webapp/ webapp/navigations/
Date Fri, 29 Sep 2006 22:41:05 GMT
Author: evenisse
Date: Fri Sep 29 15:41:04 2006
New Revision: 451483

URL: http://svn.apache.org/viewvc?view=rev&rev=451483
Log:
[CONTINUUM-939] Validate admin configuration page
Submitted by: Maria Odea Ching

Added:
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-configuration-validation.xml
  (with props)
Modified:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-validation.xml
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction.properties
    maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp
    maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp
    maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java?view=diff&rev=451483&r1=451482&r2=451483
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
Fri Sep 29 15:41:04 2006
@@ -43,7 +43,6 @@
  */
 public class ConfigurationAction
     extends ContinuumActionSupport
-    implements Preparable
 {
 
     /**
@@ -77,32 +76,10 @@
 
     public void prepare()
     {
-        ConfigurationService configuration = getContinuum().getConfiguration();
-
-        guestAccountEnabled = configuration.isGuestAccountEnabled();
-
-        workingDirectory = configuration.getWorkingDirectory().getAbsolutePath();
-
-        buildOutputDirectory = configuration.getBuildOutputDirectory().getAbsolutePath();
 
-        baseUrl = configuration.getUrl();
-
-        if ( StringUtils.isEmpty( baseUrl ) )
-        {
-            HttpServletRequest request = ServletActionContext.getRequest();
-            baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
-                + request.getContextPath();
-            getLogger().info( "baseUrl='" + baseUrl + "'" );
-        }
-
-        companyLogo = configuration.getCompanyLogo();
-
-        companyName = configuration.getCompanyName();
-
-        companyUrl = configuration.getCompanyUrl();
     }
-
-    public String execute()
+    
+    public String save()
         throws ConfigurationStoringException, ContinuumStoreException
     {
         //todo switch this to validation
@@ -116,7 +93,7 @@
         adminUser.setGroup( store.getUserGroup( ContinuumSecurity.ADMIN_GROUP_NAME ) );
 
         store.addUser( adminUser );
-        
+
         ConfigurationService configuration = getContinuum().getConfiguration();
 
         if ( guestAccountEnabled )
@@ -152,16 +129,39 @@
         return SUCCESS;
     }
 
-    public String doDefault()
+    public String edit()
         throws Exception
     {
+        setConfiguration();
         return SUCCESS;
     }
 
-    public String doEdit()
-        throws Exception
+    private void setConfiguration()
     {
-        return INPUT;
+        ConfigurationService configuration = getContinuum().getConfiguration();
+
+        guestAccountEnabled = configuration.isGuestAccountEnabled();
+
+        workingDirectory = configuration.getWorkingDirectory().getAbsolutePath();
+
+        buildOutputDirectory = configuration.getBuildOutputDirectory().getAbsolutePath();
+
+        baseUrl = configuration.getUrl();
+
+        if ( StringUtils.isEmpty( baseUrl ) )
+        {
+            HttpServletRequest request = ServletActionContext.getRequest();
+            baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+                + request.getContextPath();
+            getLogger().info( "baseUrl='" + baseUrl + "'" );
+        }
+
+        companyLogo = configuration.getCompanyLogo();
+
+        companyName = configuration.getCompanyName();
+
+        companyUrl = configuration.getCompanyUrl();
+
     }
 
     public boolean isGuestAccountEnabled()

Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-configuration-validation.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-configuration-validation.xml?view=auto&rev=451483
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-configuration-validation.xml
(added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-configuration-validation.xml
Fri Sep 29 15:41:04 2006
@@ -0,0 +1,49 @@
+<!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="workingDirectory">
+    <field-validator type="requiredstring">
+      <message key="configuration.workingDirectory.required"/>
+    </field-validator>
+  </field>
+  <field name="buildOutputDirectory">
+    <field-validator type="requiredstring">
+      <message key="configuration.buildOutputDirectory.required"/>
+    </field-validator>
+  </field>
+  <field name="baseUrl">
+    <field-validator type="requiredstring" short-circuit="true">
+      <message key="configuration.baseUrl.required"/>
+    </field-validator>
+    <field-validator type="url">
+      <message key="configuration.baseUrl.invalid"/>
+    </field-validator>
+  </field>
+  <field name="username">
+    <field-validator type="requiredstring">
+      <message key="configuration.username.required"/>
+    </field-validator>
+  </field>
+  <field name="fullName">
+    <field-validator type="requiredstring">
+      <message key="configuration.fullName.required"/>
+    </field-validator>
+  </field>
+  <field name="password">
+    <field-validator type="requiredstring">
+      <message key="configuration.password.required"/>
+    </field-validator>
+  </field>
+  <field name="passwordTwo">
+    <field-validator type="requiredstring">
+      <message key="configuration.passwordTwo.required"/>
+    </field-validator>
+  </field>
+  <validator type="expression">
+    <param name="expression">
+      password.equals(passwordTwo)</param>
+    <message key="configuration.passwordTwo.nomatch"/>
+  </validator>
+</validators>

Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-configuration-validation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-configuration-validation.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-validation.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-validation.xml?view=diff&rev=451483&r1=451482&r2=451483
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-validation.xml
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction-validation.xml
Fri Sep 29 15:41:04 2006
@@ -1,24 +0,0 @@
-<!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="workingDirectory">
-    <field-validator type="requiredstring">
-      <message key="configuration.missing.workingDirectory"/>
-    </field-validator>
-  </field>
-  <field name="buildOutputDirectory">
-    <field-validator type="requiredstring">
-      <message key="configuration.missing.buildOutputDirectory"/>
-    </field-validator>
-  </field>
-  <field name="baseUrl">
-    <field-validator type="requiredstring" short-circuit="true">
-      <message key="configuration.missing.baseUrl"/>
-    </field-validator>
-    <field-validator type="url">
-      <message key="configuration.invalid.baseUrl"/>
-    </field-validator>
-  </field>
-</validators>

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction.properties?view=diff&rev=451483&r1=451482&r2=451483
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction.properties
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction.properties
Fri Sep 29 15:41:04 2006
@@ -1,4 +1,9 @@
-configuration.missing.workingDirectory = You must define a working directory.
-configuration.missing.buildOutputDirectory = You must define a build output directory.
-configuration.missing.baseUrl = You must define a URL.
-configuration.invalid.baseUrl = You must define a valid URL.
+configuration.workingDirectory.required = You must define a working directory.
+configuration.buildOutputDirectory.required = You must define a build output directory.
+configuration.baseUrl.required = You must define a URL.
+configuration.baseUrl.invalid = You must define a valid URL.
+configuration.username.required = Username is required
+configuration.fullName.required = Full name is required
+configuration.password.required = Password is required
+configuration.passwordTwo.required = Password must be verified again
+configuration.passwordTwo.nomatch = Password does not match

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml?view=diff&rev=451483&r1=451482&r2=451483
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml Fri Sep 29 15:41:04
2006
@@ -35,7 +35,7 @@
 
     <global-results>
       <result name="error-internal">/error/error.jsp?id=500</result>
-      <result name="continuumInitialization" type="redirect">/configuration!input.action?isNew=true</result>
+      <result name="continuumInitialization" type="redirect">/editConfiguration.action?isNew=true</result>
     </global-results>
 
     <global-exception-mappings>
@@ -47,7 +47,11 @@
       <result name="input">/redirectToContinuumInitialization.jsp</result>
     </action>
 
-    <action name="configuration" class="configuration">
+    <action name="editConfiguration" class="configuration" method="edit">
+      <result name="success">configurationEdit.jsp</result>
+    </action>
+
+    <action name="configuration" class="configuration" method="save">
       <result name="input">configurationEdit.jsp</result>
       <result name="success">configuration.jsp</result>
     </action>
@@ -55,7 +59,6 @@
     <action name="companyInfo" class="configuration">
       <result name="success">/components/companyLogo.jsp</result>
     </action>
-
 
     <action name="summary" class="summary">
       <result name="success">summary.jsp</result>

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp?view=diff&rev=451483&r1=451482&r2=451483
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp Fri Sep 29 15:41:04
2006
@@ -15,7 +15,7 @@
                 <ww:param name="after">
                     <ww:text name="configuration.guest.value">
                         <ww:param>
-                            <ww:if test="guestAccountEnabled"><ww:text name="enabled"/></ww:if>
+                            <ww:if test="%{guestAccountEnabled == true}"><ww:text
name="enabled"/></ww:if>
                             <ww:else><ww:text name="disabled"/></ww:else>
                         </ww:param>
                     </ww:text>
@@ -29,7 +29,7 @@
             <c1:data label="%{getText('configuration.companyUrl.label')}" name="companyUrl"/>
           </table>
           <div class="functnbar3">
-            <ww:form action="configuration!edit.action" method="post">
+            <ww:form action="editConfiguration.action" method="post">
               <ww:submit value="%{getText('edit')}"/>
             </ww:form>
           </div>

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp?view=diff&rev=451483&r1=451482&r2=451483
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp Fri Sep 29
15:41:04 2006
@@ -9,16 +9,23 @@
   <body>
   <div id="axial" class="h3">
     <h3><ww:text name="configuration.section.title"/></h3>
-    <ww:form action="configuration.action" method="post">
+    <ww:form action="configuration.action" method="post" validate="true">
+
+      <ww:if test="hasActionErrors()">
+        <h3>Action Error</h3>
+      </ww:if>
+      <p>
+        <ww:actionerror/>
+      </p>
 
       <div class="axial">
         <table border="1" cellspacing="2" cellpadding="3" width="100%">
 
-          <ww:textfield label="%{getText('user.username.label')}" name="username">
+          <ww:textfield label="%{getText('user.username.label')}" name="username" required="true">
             <ww:param name="desc"><p><ww:text name="user.username.message"/></p></ww:param>
           </ww:textfield>
 
-          <ww:textfield label="%{getText('user.fullName.label')}" name="fullName">
+          <ww:textfield label="%{getText('user.fullName.label')}" name="fullName" required="true">
             <ww:param name="desc"><p><ww:text name="user.fullName.message"/></p></ww:param>
           </ww:textfield>
 
@@ -26,9 +33,9 @@
             <ww:param name="desc"><p><ww:text name="user.email.message"/></p></ww:param>
           </ww:textfield>
 
-          <ww:password label="%{getText('user.password.label')}" name="password"/>
+          <ww:password label="%{getText('user.password.label')}" name="password" required="true"/>
 
-          <ww:password label="%{getText('user.passwordTwo.label')}" name="passwordTwo">
+          <ww:password label="%{getText('user.passwordTwo.label')}" name="passwordTwo"
required="true">
             <ww:param name="desc"><p><ww:text name="user.passwordTwo.message"/></p></ww:param>
           </ww:password>
 
@@ -41,7 +48,7 @@
           <tbody>
 
             <ww:checkbox label="%{getText('configuration.guest.label')}" name="guestAccountEnabled"
-                         value="guestAccountEnabled" fieldValue="true">
+                         value="guestAccountEnabled">
               <ww:param name="desc"><p><ww:text name="configuration.guest.message"/></p></ww:param>
             </ww:checkbox>
 

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp?view=diff&rev=451483&r1=451482&r2=451483
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp Fri Sep 29
15:41:04 2006
@@ -43,7 +43,7 @@
       </c1:ifAuthorized>
       <c1:ifAuthorized permission="manageConfiguration">
           <div class="body">
-            <a href="<ww:url value="/configuration!default.action" includeParams="none"/>"><ww:text
name="menu.administration.configuration"/></a>
+            <a href="<ww:url value="/editConfiguration.action" includeParams="none"/>"><ww:text
name="menu.administration.configuration"/></a>
           </div>
       </c1:ifAuthorized>
       <c1:ifAuthorized permission="manageUsers">



Mime
View raw message