]> source.dussan.org Git - archiva.git/commitdiff
[MRM-131] implement mailing lists tab
authorBrett Porter <brett@apache.org>
Sat, 23 Dec 2006 07:16:52 +0000 (07:16 +0000)
committerBrett Porter <brett@apache.org>
Sat, 23 Dec 2006 07:16:52 +0000 (07:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@489863 13f79535-47bb-0310-9956-ffa450edef68

archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java
archiva-webapp/src/main/resources/xwork.xml
archiva-webapp/src/main/webapp/WEB-INF/jsp/include/mailingLists.jspf [new file with mode: 0644]
archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp

index 966087b679dc3dec731b79ccbf5ab443219e3eb4..3cab3eda615991636c4cbdeafc87f9ac8331df1e 100644 (file)
@@ -135,6 +135,8 @@ public class ShowArtifactAction
 
     private String artifactPath;
 
+    private List mailingLists;
+
     public String artifact()
         throws ConfigurationStoreException, IOException, XmlPullParserException, ProjectBuildingException,
         ResourceDoesNotExistException, ProxyException, ArtifactResolutionException
@@ -189,6 +191,23 @@ public class ShowArtifactAction
         return SUCCESS;
     }
 
+    public String mailingLists()
+        throws ConfigurationStoreException, IOException, XmlPullParserException, ProjectBuildingException
+    {
+        if ( !checkParameters() )
+        {
+            return ERROR;
+        }
+
+        MavenProject project = readProject();
+
+        model = project.getModel();
+
+        this.mailingLists = project.getMailingLists();
+
+        return SUCCESS;
+    }
+
     public String dependees()
         throws ConfigurationStoreException, IOException, XmlPullParserException, ProjectBuildingException,
         RepositoryIndexException, RepositoryIndexSearchException
@@ -517,4 +536,9 @@ public class ShowArtifactAction
     {
         return repositoryId;
     }
+
+    public List getMailingLists()
+    {
+        return mailingLists;
+    }
 }
index 71a2833bcd6878adaa5b8ffac238fbae72ecb29e..c18f0f1d594c76bcac10559dc328bc7c36a85b39 100644 (file)
@@ -59,6 +59,11 @@ public class RepositoryActionMapper
             return BROWSE_PREFIX + params.remove( "groupId" ) + "/" + params.remove( "artifactId" ) + "/" +
                 params.remove( "version" ) + "/dependencies";
         }
+        else if ( "showArtifactMailingLists".equals( actionMapping.getName() ) )
+        {
+            return BROWSE_PREFIX + params.remove( "groupId" ) + "/" + params.remove( "artifactId" ) + "/" +
+                params.remove( "version" ) + "/mailingLists";
+        }
         else if ( "showArtifactDependees".equals( actionMapping.getName() ) )
         {
             return BROWSE_PREFIX + params.remove( "groupId" ) + "/" + params.remove( "artifactId" ) + "/" +
@@ -122,6 +127,10 @@ public class RepositoryActionMapper
                     {
                         return new ActionMapping( "showArtifactDependencies", "/", "", params );
                     }
+                    else if ( "mailingLists".equals( parts[3] ) )
+                    {
+                        return new ActionMapping( "showArtifactMailingLists", "/", "", params );
+                    }
                     else if ( "usedby".equals( parts[3] ) )
                     {
                         return new ActionMapping( "showArtifactDependees", "/", "", params );
index 6c0ff55640347ac7fd70215873207fce66921b2b..8484a94b1023bce41c7efed5768d639b5a83ffcc 100644 (file)
       <result>/WEB-INF/jsp/showArtifact.jsp</result>
     </action>
 
+    <action name="showArtifactMailingLists" class="showArtifactAction" method="mailingLists">
+      <result>/WEB-INF/jsp/showArtifact.jsp</result>
+    </action>
+
     <action name="showArtifactDependencies" class="showArtifactAction" method="dependencies">
       <result>/WEB-INF/jsp/showArtifact.jsp</result>
     </action>
diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/mailingLists.jspf b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/mailingLists.jspf
new file mode 100644 (file)
index 0000000..2385129
--- /dev/null
@@ -0,0 +1,84 @@
+<%--
+  ~ 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="my" tagdir="/WEB-INF/tags" %>
+
+<c:forEach items="${mailingLists}" var="mailingList">
+  <h3>
+      ${mailingList.name}
+  </h3>
+  <%-- TODO: description
+    <p>
+      Description blah blah blah
+    </p>
+  --%>
+  <ul>
+    <c:if test="${!empty(mailingList.subscribe)}">
+      <li>
+        <b>Subscribe:</b>
+        <a href="mailto:${mailingList.subscribe}">${mailingList.subscribe}</a>
+      </li>
+    </c:if>
+    <c:if test="${!empty(mailingList.post)}">
+      <li>
+        <b>Post:</b>
+        <a href="mailto:${mailingList.post}">${mailingList.post}</a>
+      </li>
+    </c:if>
+    <c:if test="${!empty(mailingList.unsubscribe)}">
+      <li>
+        <b>Unsubscribe:</b>
+        <a href="mailto:${mailingList.unsubscribe}">${mailingList.unsubscribe}</a>
+      </li>
+    </c:if>
+      <%-- TODO: not in the POM yet
+          <li>
+            <b>List owner:</b>
+            <a href="mailto:${mailingList.owner}">${mailingList.owner}</a>
+          </li>
+      --%>
+    <c:if test="${!empty(mailingList.archive)}">
+      <li>
+        <b>Archive:</b>
+        <ul>
+          <li>
+            <a href="${mailingList.archive}">${mailingList.archive}</a>
+          </li>
+        </ul>
+      </li>
+    </c:if>
+    <c:if test="${!empty(mailingList.otherArchives)}">
+      <li>
+        <b>Other Archives:</b>
+        <ul>
+          <c:forEach items="${mailingList.otherArchives}" var="archive">
+            <li>
+              <a href="${archive}">${archive}</a>
+            </li>
+          </c:forEach>
+        </ul>
+      </li>
+    </c:if>
+  </ul>
+</c:forEach>
+<c:if test="${empty(mailingLists)}">
+  <strong>No mailing lists</strong>
+</c:if>
index 9ff9dce51b4e405f210fc04ea5486fb1ab842a22..efab1c047b73a4e8f5b7b8d7ef161e9706e45a7e 100644 (file)
         </ww:url>
       </c:set>
       <my:currentWWUrl url="${url}">Used By</my:currentWWUrl>
-      <%-- TODO:
-          <a href="TODO">Mailing Lists</a>
-      --%>
+      <c:set var="url">
+        <ww:url action="showArtifactMailingLists">
+          <ww:param name="groupId" value="%{groupId}"/>
+          <ww:param name="artifactId" value="%{artifactId}"/>
+          <ww:param name="version" value="%{version}"/>
+        </ww:url>
+      </c:set>
+      <my:currentWWUrl url="${url}">Mailing Lists</my:currentWWUrl>
     </span>
   </div>
 
       <c:when test="${dependencyTree != null}">
         <%@ include file="/WEB-INF/jsp/include/dependencyTree.jspf" %>
       </c:when>
+      <c:when test="${mailingLists != null}">
+        <%@ include file="/WEB-INF/jsp/include/mailingLists.jspf" %>
+      </c:when>
       <c:otherwise>
         <%@ include file="/WEB-INF/jsp/include/artifactInfo.jspf" %>
       </c:otherwise>