continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r357094 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ resources/ resources/META-INF/plexus/ resources/localization/ resources/org/ resources/org/apache/ resources/org/apache/maven/ resour...
Date Fri, 16 Dec 2005 00:14:00 GMT
Author: evenisse
Date: Thu Dec 15 16:13:46 2005
New Revision: 357094

URL: http://svn.apache.org/viewcvs?rev=357094&view=rev
Log:
Start configuration screens

Added:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
  (with props)
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction.properties
  (with props)
    maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/LoginAction.properties
  (with props)
    maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp   (with props)
    maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp   (with props)
Modified:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/LoginAction.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/trunk/continuum-webapp/src/main/webapp/css/tigris.css
    maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp

Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java?rev=357094&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
(added)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ConfigurationAction.java
Thu Dec 15 16:13:46 2005
@@ -0,0 +1,192 @@
+package org.apache.maven.continuum.web.action;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.continuum.Continuum;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import com.opensymphony.xwork.ActionSupport;
+
+public class ConfigurationAction
+    extends ActionSupport
+{
+    private Continuum continuum;
+
+    private boolean guestAccountEnabled;
+
+    private String workingDirectory;
+
+    private String buildOutputDirectory;
+
+    private String baseUrl;
+
+    private String companyLogo;
+
+    private String companyName;
+
+    private String companyUrl;
+
+    public String execute()
+        throws Exception
+    {
+        boolean hasErrors = false;
+
+        // TODO : Using WebWork Validators
+        if ( StringUtils.isEmpty( workingDirectory ) )
+        {
+            addFieldError( "workingDirectory", getText( "configuration.missing.workingDirectory"
) );
+
+            hasErrors = true;
+        }
+
+        if ( StringUtils.isEmpty( buildOutputDirectory ) )
+        {
+            addFieldError( "buildOutputDirectory", getText( "configuration.missing.buildOutputDirectory"
) );
+
+            hasErrors = true;
+        }
+
+        if ( StringUtils.isEmpty( baseUrl ) )
+        {
+            addFieldError( "baseUrl", getText( "configuration.missing.baseUrl" ) );
+
+            hasErrors = true;
+        }
+        else
+        {
+            try
+            {
+                URL url = new URL( baseUrl );
+            }
+            catch ( MalformedURLException e )
+            {
+                addFieldError( "baseUrl", getText( "configuration.invalid.baseUrl" ) );
+
+                hasErrors = true;
+            }
+        }
+
+        if ( hasErrors )
+        {
+            return INPUT;
+        }
+        else
+        {
+            continuum.getConfiguration().setGuestAccountEnabled( guestAccountEnabled );
+
+            continuum.getConfiguration().setWorkingDirectory( new File( workingDirectory
) );
+
+            continuum.getConfiguration().setBuildOutputDirectory( new File( buildOutputDirectory
) );
+
+            continuum.getConfiguration().setUrl( baseUrl );
+
+            continuum.getConfiguration().setCompanyLogo( companyLogo );
+
+            continuum.getConfiguration().setCompanyName( companyName );
+
+            continuum.getConfiguration().setCompanyUrl( companyUrl );
+
+            return SUCCESS;
+        }
+    }
+
+    public String doDefault()
+        throws Exception
+    {
+        return SUCCESS;
+    }
+
+    public String doEdit()
+        throws Exception
+    {
+        return INPUT;
+    }
+
+    public boolean isGuestAccountEnabled()
+    {
+        return continuum.getConfiguration().isGuestAccountEnabled();
+    }
+
+    public void setGuestAccountEnabled( boolean guestAccountEnabled )
+    {
+        this.guestAccountEnabled = guestAccountEnabled;
+    }
+
+    public String getWorkingDirectory()
+    {
+        return continuum.getConfiguration().getWorkingDirectory().getAbsolutePath();
+    }
+
+    public void setWorkingDirectory( String workingDirectory )
+    {
+        this.workingDirectory = workingDirectory;
+    }
+
+    public String getBuildOutputDirectory()
+    {
+        return continuum.getConfiguration().getBuildOutputDirectory().getAbsolutePath();
+    }
+
+    public void setBuildOutputDirectory( String buildOutputDirectory )
+    {
+        this.buildOutputDirectory = buildOutputDirectory;
+    }
+
+    public String getBaseUrl()
+    {
+        return continuum.getConfiguration().getUrl();
+    }
+
+    public void setBaseUrl( String baseUrl )
+    {
+        this.baseUrl = baseUrl;
+    }
+
+    public String getCompanyLogo()
+    {
+        return continuum.getConfiguration().getCompanyLogo();
+    }
+
+    public void setCompanyLogo( String companyLogo )
+    {
+        this.companyLogo = companyLogo;
+    }
+
+    public String getCompanyName()
+    {
+        return continuum.getConfiguration().getCompanyName();
+    }
+
+    public void setCompanyName( String companyName )
+    {
+        this.companyName = companyName;
+    }
+
+    public String getCompanyUrl()
+    {
+        return continuum.getConfiguration().getCompanyUrl();
+    }
+
+    public void setCompanyUrl( String companyUrl )
+    {
+        this.companyUrl = companyUrl;
+    }
+}

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

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

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/LoginAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/LoginAction.java?rev=357094&r1=357093&r2=357094&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/LoginAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/LoginAction.java
Thu Dec 15 16:13:46 2005
@@ -16,11 +16,8 @@
  * limitations under the License.
  */
 
-import org.apache.maven.continuum.Continuum;
-
 import com.opensymphony.xwork.ActionSupport;
-
-import java.util.Collection;
+import org.codehaus.plexus.util.StringUtils;
 
 public class LoginAction
     extends ActionSupport
@@ -33,16 +30,14 @@
         throws Exception
     {
         //TODO
-        if ( username == null || password == null || !"testuser".equals( username ) )
+        if ( StringUtils.isEmpty( username ) || StringUtils.isEmpty( password ) || !"testuser".equals(
username ) )
         {
             //TODO : i18n
-            addFieldError( "username", "Username/password incorrect");
-
-            System.out.println( "Username=" + username + " - password = " + password);
+            addFieldError( "username", getText( "login.bad_login_password" ) );
 
             return INPUT;
         }
-        System.out.println( "SUCESS" + "Username=" + username + " - password = " + password);
+
         return SUCCESS;
     }
 

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml?rev=357094&r1=357093&r2=357094&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/components.xml
Thu Dec 15 16:13:46 2005
@@ -8,8 +8,8 @@
 
     <component>
       <role>com.opensymphony.xwork.Action</role>
-      <role-hint>summaryAction</role-hint>
-      <implementation>org.apache.maven.continuum.web.action.SummaryAction</implementation>
+      <role-hint>configurationAction</role-hint>
+      <implementation>org.apache.maven.continuum.web.action.ConfigurationAction</implementation>
       <instantiation-strategy>per-lookup</instantiation-strategy>
       <requirements>
         <requirement>
@@ -22,6 +22,17 @@
       <role-hint>loginAction</role-hint>
       <implementation>org.apache.maven.continuum.web.action.LoginAction</implementation>
       <instantiation-strategy>per-lookup</instantiation-strategy>
+    </component>
+    <component>
+      <role>com.opensymphony.xwork.Action</role>
+      <role-hint>summaryAction</role-hint>
+      <implementation>org.apache.maven.continuum.web.action.SummaryAction</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.Continuum</role>
+        </requirement>
+      </requirements>
     </component>
 
     <!--

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=357094&r1=357093&r2=357094&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Thu Dec 15 16:13:46 2005
@@ -4,6 +4,8 @@
 message.success = Success
 message.failed = Failed
 message.error = Error
+enabled = Enabled
+disabled = Disabled
 
 // ----------------------------------------------------------------------
 // Page: Top
@@ -35,3 +37,19 @@
 summary.projectTable.version = Version
 summary.projectTable.build = Build
 summary.projectTable.group = Group
+
+// ----------------------------------------------------------------------
+// Page: Configuration
+// ----------------------------------------------------------------------
+configuration.page.title = Continuum - Configuration
+configuration.section.title = General Configuration
+configuration.guest.label = Guests
+configuration.guest.value = Guest user is <strong style="color: green;">{0}</strong>
+configuration.workingDirectory.label = Working Directory
+configuration.buildOutputDirectory.label = Build Output Directory
+configuration.baseUrl.label = Base URL
+configuration.companyName.label = Company Name
+configuration.companyLogo.label = Company Logo
+configuration.companyUrl.label = Company URL
+configuration.submit.edit = Edit
+

Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction.properties?rev=357094&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction.properties
(added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/ConfigurationAction.properties
Thu Dec 15 16:13:46 2005
@@ -0,0 +1,4 @@
+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.

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

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

Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/LoginAction.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/LoginAction.properties?rev=357094&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/LoginAction.properties
(added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/LoginAction.properties
Thu Dec 15 16:13:46 2005
@@ -0,0 +1 @@
+login.bad_login_password = Username/password incorrect

Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/LoginAction.properties
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml?rev=357094&r1=357093&r2=357094&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml Thu Dec 15 16:13:46
2005
@@ -7,14 +7,19 @@
     <package name="default" extends="webwork-default">
         <default-interceptor-ref name="completeStack"/>
 
-        <action name="summary"
-                class="summaryAction">
-            <result name="success">summary.jsp</result>
+        <action name="configuration"
+                class="configurationAction">
+            <result name="input">configurationEdit.jsp</result>
+            <result name="success">configuration.jsp</result>
         </action>
         <action name="login"
                 class="loginAction">
             <result name="input">login.jsp</result>
             <result name="success" type="redirect">summary.action</result>
+        </action>
+        <action name="summary"
+                class="summaryAction">
+            <result name="success">summary.jsp</result>
         </action>
     </package>
 </xwork>

Added: maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp?rev=357094&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp Thu Dec 15 16:13:46
2005
@@ -0,0 +1,58 @@
+<%@ taglib uri="webwork" prefix="ww" %>
+<html>
+  <ww:i18n name="localization.Continuum">
+    <head>
+        <title><ww:text name="configuration.page.title"/></title>
+    </head>
+    <body>
+      <div id="axial" class="h3">
+        <h3><ww:text name="configuration.section.title"/></h3>
+
+        <div class="axial">
+          <table border="1" cellspacing="2" cellpadding="3" width="100%">
+            <tr class="b">
+              <th><ww:text name="configuration.guest.label"/></th>
+              <td>
+                <ww:text name="configuration.guest.value">
+                    <ww:param>
+                        <ww:if test="guestAccountEnabled"><ww:text name="enabled"/></ww:if>
+                        <ww:else><ww:text name="disabled"/></ww:else>
+                    </ww:param>
+                </ww:text>
+              </td>
+            </tr>
+            <tr class="a">
+              <th><ww:text name="configuration.workingDirectory.label"/></th>
+              <td><ww:property value="workingDirectory"/></td>
+            </tr>
+            <tr class="b">
+              <th><ww:text name="configuration.buildOutputDirectory.label"/></th>
+              <td><ww:property value="buildOutputDirectory"/></td>
+            </tr>
+            <tr class="a">
+              <th><ww:text name="configuration.baseUrl.label"/></th>
+              <td><ww:property value="baseUrl"/></td>
+            </tr>
+            <tr class="b">
+              <th><ww:text name="configuration.companyName.label"/></th>
+              <td><ww:property value="companyName"/></td>
+            </tr>
+            <tr class="a">
+              <th><ww:text name="configuration.companyLogo.label"/></th>
+              <td><ww:property value="companyLogo"/></td>
+            </tr>
+            <tr class="b">
+              <th><ww:text name="configuration.companyUrl.label"/></th>
+              <td><ww:property value="companyUrl"/></td>
+            </tr>
+          </table>
+          <div class="functnbar3">
+            <ww:form action="configuration!edit.action">
+                <ww:submit value="%{getText('configuration.submit.edit')}"/>
+            </ww:form>
+          </div>
+        </div>
+      </div>
+    </body>
+  </ww:i18n>
+</html>

Propchange: maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-webapp/src/main/webapp/configuration.jsp
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp?rev=357094&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp Thu Dec 15
16:13:46 2005
@@ -0,0 +1,26 @@
+<%@ taglib uri="webwork" prefix="ww" %>
+<html>
+  <ww:i18n name="localization.Continuum">
+    <head>
+        <title><ww:text name="configuration.page.title"/></title>
+    </head>
+    <body>
+      <div id="axial" class="h3">
+        <h3><ww:text name="configuration.section.title"/></h3>
+
+        <div class="axial">
+          <ww:form action="configuration.action" method="post">
+            <ww:checkbox label="%{getText('configuration.guest.label')}" name="guestAccountEnabled"
value="guestAccountEnabled" fieldValue="true"/>
+            <ww:textfield label="%{getText('configuration.workingDirectory.label')}" name="workingDirectory"/>
+            <ww:textfield label="%{getText('configuration.buildOutputDirectory.label')}"
name="buildOutputDirectory"/>
+            <ww:textfield label="%{getText('configuration.baseUrl.label')}" name="baseUrl"/>
+            <ww:textfield label="%{getText('configuration.companyName.label')}" name="companyName"/>
+            <ww:textfield label="%{getText('configuration.companyLogo.label')}" name="companyLogo"/>
+            <ww:textfield label="%{getText('configuration.companyUrl.label')}" name="companyUrl"/>
+            <ww:submit value="%{getText('configuration.submit.edit')}"/>
+          </ww:form>
+        </div>
+      </div>
+    </body>
+  </ww:i18n>
+</html>

Propchange: maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-webapp/src/main/webapp/configurationEdit.jsp
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/css/tigris.css
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/webapp/css/tigris.css?rev=357094&r1=357093&r2=357094&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/css/tigris.css (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/css/tigris.css Thu Dec 15 16:13:46
2005
@@ -2,6 +2,22 @@
 	
 	This file defines basic default formatting for HTML conforming to Tigris application style.
To extend or override these rules for your instance, edit inst.css instead of this file. */
 
+/* TODO REPLACE these styles used by webwork component */
+.maintable {cellpadding:10;cellspacing:10;}
+
+#nav_items {
+    font-weight: bold;
+}
+
+.wwFormTable {}
+.label {font-style:italic; }
+.errorLabel {font-style:italic; color:red; }
+.errorMessage {font-weight:bold; text-align: center; color:red; }
+.checkboxLabel {}
+.checkboxErrorLabel {color:red; }
+.required {color:red;}
+/* END TODO */
+
 /* colors, backgrounds, borders, link indication */
 body {
 	background: #fff;

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp?rev=357094&r1=357093&r2=357094&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/navigations/Menu.jsp Thu Dec 15
16:13:46 2005
@@ -9,7 +9,14 @@
       <div>
         <a href="<ww:url value="/summary.action"/>">Show Projects</a>
       </div>
-
+    </div>
+  </div>
+  <div id="projectmenu" class="toolgroup">
+    <div class="label">Administration</div>
+    <div class="body">
+      <div>
+        <a href="<ww:url value="configuration!default.action"/>">Configuration</a>
+      </div>
     </div>
   </div>
 </div>



Mime
View raw message