continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r171180 - in /maven/continuum/trunk/continuum-web/src/main: java/org/apache/maven/continuum/web/tool/ resources/META-INF/plexus/ resources/forms/ resources/localization/ resources/templates/ resources/templates/screens/
Date Sat, 21 May 2005 01:28:20 GMT
Author: jvanzyl
Date: Fri May 20 18:28:19 2005
New Revision: 171180

URL: http://svn.apache.org/viewcvs?rev=171180&view=rev
Log:
o updating the form tool 
o making the add/edit templates close to being the same, moving toward
  merging them and trying to make all the templates reusable across apps but
  the aren't right now.
o displaying the number of failure projects
o displaying the number of error projects


Modified:
    maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/tool/FormicaTool.java
    maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml
    maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
    maven/continuum/trunk/continuum-web/src/main/resources/templates/CommonMacros.vm
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Add.vm
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Edit.vm
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm

Modified: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/tool/FormicaTool.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/tool/FormicaTool.java?rev=171180&r1=171179&r2=171180&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/tool/FormicaTool.java
(original)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/tool/FormicaTool.java
Fri May 20 18:28:19 2005
@@ -41,7 +41,7 @@
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
- * @version $Id: CssTool.java,v 1.2 2005/04/06 14:10:38 trygvis Exp $
+ * @version $Id$
  */
 public class FormicaTool
     extends AbstractLogEnabled
@@ -166,6 +166,14 @@
         return getItem( form, element, getItem( form, id ) );
     }
 
+    // ----------------------------------------------------------------------
+    // Need to use the decomposer here
+    //
+    // Ignore if the expression is passive ... shit how to get the data
+    // from the single piece of data that holds what is needed here ...
+    // I need to have some information at the form level about what
+    // elements are affected by the transformations.
+    // ----------------------------------------------------------------------
 
     public String getItem( Form form, Element element, Object item )
         throws FormToolException
@@ -200,21 +208,43 @@
         }
     }
 
-    public String getAUElement( Form form, Element element, Object data, RunData rundata
)
+    /**
+     * For a given element in a form, get the data for that form whether it be from a request
+     * parameter or by applying an expression to the item in question.
+     *
+     * @param form Formica form object.
+     * @param element Form element.
+     * @param item The object from which the data will be extracted using an expression.
+     * @param runData The summit runData.
+     * @return
+     * @throws FormToolException
+     */
+    public String getElementData( Form form, Element element, Object item, RunData runData
)
         throws FormToolException
     {
-        if ( data == null )
+        // ----------------------------------------------------------------------
+        // First try to get the form data from the request parameters
+        // ----------------------------------------------------------------------
+
+        Object data = runData.getParameters().getString( element.getId() );
+
+        if ( data != null )
         {
-            return null;
+            return data.toString();
         }
 
-        Object o = rundata.getParameters().getString( element.getId() );
-
-        if ( o == null )
+        if ( item != null )
         {
             try
             {
-                o = Ognl.getValue( element.getExpression(), data );
+                // ----------------------------------------------------------------------
+                // Here we need to decompose data into constituent form element
+                // data if necessary.
+                // ----------------------------------------------------------------------
+
+                data = Ognl.getValue( element.getExpression(), item );
+
+                return data.toString();
             }
             catch ( OgnlException e )
             {
@@ -222,7 +252,7 @@
             }
         }
 
-        return o.toString();
+        return "";
     }
 
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml?rev=171180&r1=171179&r2=171180&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
Fri May 20 18:28:19 2005
@@ -127,6 +127,19 @@
       <configuration>
         <views>
           <view>
+            <id>Summary</id>
+            <scalars>
+              <scalar>
+                <id>projectsWithFailures</id>
+                <expression>getProjectsWithFailures().size()</expression>
+              </scalar>
+              <scalar>
+                <id>projectsWithErrors</id>
+                <expression>getProjectsWithErrors().size()</expression>
+              </scalar>
+            </scalars>
+          </view>
+          <view>
             <id>ProjectBuilds</id>
             <scalars>
               <scalar>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml?rev=171180&r1=171179&r2=171180&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml Fri
May 20 18:28:19 2005
@@ -4,6 +4,24 @@
   <summary-collection-expression>getProjects()</summary-collection-expression>
   <source-role>org.apache.maven.continuum.Continuum</source-role>
   <type-expression>executorId</type-expression>
+
+  <!--
+  <transformations>
+    <transformation>
+      <id>scmUrl</id>
+      <composition>
+        <expression>"scm" + ":" + #projectScm + ":" + #projectScmUrl</expression>
+      </composition>
+      <decomposition>
+        #projectScm = split( #data, ":" )[1]
+        #projectScm = #data.substring( 0, #data.indexOf( ":", 4 ) )
+        #projectScmUrl = split( #data, ":" )[2+]
+        #projectScmUrl = #data.substring( #data.indexOf( ":", 4 ) )
+      </decomposition>
+    </transformation>
+  </transformations>
+  -->
+
   <elements>
     <element>
       <id>project.name</id>
@@ -17,7 +35,7 @@
       <expression>name</expression>
     </element>
     <element>
-      <id>project.scmUrl</id>
+      <id>projectScmUrl</id>
       <validators>
         <validator>
           <id>scm-url</id>
@@ -25,7 +43,7 @@
         </validator>
       </validators>
       <type>text</type>
-      <expression>scmUrl</expression>
+      <transformer>scmUrl</transformer>
     </element>
     <element>
       <id>project.nagEmailAddress</id>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties?rev=171180&r1=171179&r2=171180&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
Fri May 20 18:28:19 2005
@@ -35,9 +35,13 @@
 project.name.error = You must provide a project name
 project.name.message = Enter the project name
 
-project.scmUrl.label = Scm Url
-project.scmUrl.error = You must provide an scm url
-project.scmUrl.message = Enter the Maven SCM url
+project.scm.label = Scm
+project.scm.error = You must select an SCM
+project.scm.message = Select an SCM
+
+projectScmUrl.label = Scm Url
+projectScmUrl.error = You must provide an scm url
+projectScmUrl.message = Enter the Maven SCM url
 
 // ----------------------------------------------------------------------
 // Delete

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/CommonMacros.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/CommonMacros.vm?rev=171180&r1=171179&r2=171180&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/CommonMacros.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/CommonMacros.vm Fri May
20 18:28:19 2005
@@ -1,28 +1,18 @@
-#macro ( addField $i18n $data $element )
-<th>$i18n.getString( $element.labelKey )</th>
-<td>
-  #set ( $value = $data.getParameters().getString( $element.id ) )
-  #if ( !$value )
-    #set( $value = "" )
-  #end
-  <input type="text" name="$element.id" value="$value" size="40"/>
-  <p>$i18n.getString( $element.messageKey )</p>
-</td>
-#end
+## ----------------------------------------------------------------------------
+##
+## ----------------------------------------------------------------------------
 
-#macro ( editField $i18n $data $element $formtool )
+#macro ( field $i18n $data $element $item $formtool )
 <th>$i18n.getString( $element.labelKey )</th>
 <td>
-  #set ( $value = $formtool.getAUElement( $form, $element, $item, $data ) )
-  #if ( !$value )
-    #set( $value = "" )
+  #set ( $elementData = $formtool.getElementData( $form, $element, $item, $data ) )
+  #if ( $element.type == "text" )
+    #text( $element $elementData )
   #end
-  <input type="text" name="$element.id" value="$value" size="40"/>
   <p>$i18n.getString( $element.messageKey )</p>
 </td>
 #end
 
-
 #macro ( validateField $fvr $element )
 #if ( $fvr && !$fvr.getElementResult( $element.getId()).valid() )
 <td class="inputerror">
@@ -31,16 +21,57 @@
 #end
 #end
 
+#macro ( bar )
+<div class="functnbar3"/>
+#end
+
+## ----------------------------------------------------------------------------
+##
+## ----------------------------------------------------------------------------
+
+#macro ( text $element $elementData )
+<input type="text" name="$element.id" value="$elementData" size="40"/>
+#end
+
+#macro ( textarea $element $elementData )
+<input type="text" name="$element.id" value="$elementData" size="40"/>
+#end
+
+#macro ( password $element $elementData )
+<input type="text" name="$element.id" value="$elementData" size="40"/>
+#end
+
+#macro ( radio $element $elementData )
+<input type="radio" name="$element.id" value=""/>
+#end
+
+#macro ( checkbox $element $elementData )
+<input type="checkbox" name="$element.id" value=""/>
+#end
+
+#macro ( pulldown $element $elementData )
+<select name="$element.id">
+  #foreach ( $datum in $elementData )
+    <option>
+  #end
+</select>
+#end
+
+#macro ( imageButton $label )
+stuff
+#end
+
 #macro ( hidden $name $value )
 <input type="hidden" name="$name" value="$value"/>
 #end
 
 #macro ( submitBar $labelKey )
 <div class="functnbar3">
-  <input type="submit" value="$labelKey"/>
+<input type="submit" value="$labelKey"/>
 </div>
 #end
 
-#macro ( bar )
-<div class="functnbar3"/>
-#end
+
+##The Selection Box.
+
+##Active Images.

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Add.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Add.vm?rev=171180&r1=171179&r2=171180&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Add.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Add.vm Fri May
20 18:28:19 2005
@@ -14,7 +14,7 @@
           #foreach ( $element in $form.elements )
           #if ( !$element.immutable )
           <tr>
-            #addField( $i18n $data $element )
+            #field( $i18n $data $element $item $formtool )
             #validateField( $fvr $element )
           </tr>
           #end

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Edit.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Edit.vm?rev=171180&r1=171179&r2=171180&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Edit.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Edit.vm Fri May
20 18:28:19 2005
@@ -21,7 +21,7 @@
           #foreach ( $element in $form.elements )
           #if ( !$element.immutable )
           <tr>
-            #editField( $i18n $data $element $formtool )
+            #field( $i18n $data $element $item $formtool )
             #validateField( $fvr $element )
           </tr>
           #end

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm?rev=171180&r1=171179&r2=171180&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm Fri
May 20 18:28:19 2005
@@ -30,16 +30,26 @@
       #end
     </table>
     ##
-    ## TODO: This should be made a general feature in formica using the CAM and an option
for an 
+    ## TODO: This should be made a general feature in formica using the CAM and an option
for an
     ## enable expression to model what we have below.
     <div class="functnbar3">
-      <form method="post" action="$link">
-        #if ( $items && $items.size() > 0 )
-        #hidden ( "action" "cam" )
-        #hidden ( "cid" "buildAllProjects" )
-        <input type="submit" name="build-all" value="Build All"/>
-        #end
-      </form>
+      <table>
+        <tr>
+          <td>
+            <form method="post" action="$link">
+            #if ( $items && $items.size() > 0 )
+            #hidden ( "action" "cam" )
+            #hidden ( "cid" "buildAllProjects" )
+            <input type="submit" name="build-all" value="Build All"/>
+            #end
+            </form>
+          </td>
+          <td>
+          <img src="/continuum/images/icon_error_sml.gif" alt="Failed"/> $projectsWithErrors
+          <img src="/continuum/images/icon_warning_sml.gif" alt="Error"/> $projectsWithFailures
+          </td>
+        </tr>
+      </table>
     </div>
   </div>
 </div>



Mime
View raw message