]> source.dussan.org Git - archiva.git/commitdiff
finish footer with version copyrightRange
authorOlivier Lamy <olamy@apache.org>
Fri, 27 Jan 2012 11:20:11 +0000 (11:20 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 27 Jan 2012 11:20:11 +0000 (11:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1236636 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/pom.xml
archiva-modules/archiva-web/archiva-webapp-js/src/main/filtered-resources/application.properties [deleted file]
archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultRuntimeInfoService.java
archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoService.java
archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/ApplicationRuntimeInfo.java
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js

index a4a5840c816a7eed0079aa983bda8efebf0026b2..377b188cd0675b98dd877ce77e173260bd631973 100644 (file)
       <resource>
         <directory>src/main/resources</directory>
       </resource>
-      <resource>
-        <directory>src/main/filtered-resources</directory>
-        <filtering>true</filtering>
-      </resource>
     </resources>
 
     <plugins>
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/filtered-resources/application.properties b/archiva-modules/archiva-web/archiva-webapp-js/src/main/filtered-resources/application.properties
deleted file mode 100644 (file)
index 12806aa..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-user.agent=Apache Archiva/${project.version}
-archiva.version=${project.version}
-archiva.buildNumber=${buildNumber}
-archiva.timestamp=${timestamp}
index c4562fb74a1ccd565f6e46b9c1961f73add08936..cd58ddacd80dc57ea801c64d58152d70979e2d98 100644 (file)
@@ -18,9 +18,12 @@ package org.apache.archiva.webapp.ui.services.api;
  * under the License.
  */
 
+import org.apache.archiva.web.runtime.ArchivaRuntimeInfo;
 import org.apache.archiva.webapp.ui.services.model.ApplicationRuntimeInfo;
 import org.springframework.stereotype.Service;
 
+import javax.inject.Inject;
+
 /**
  * @author Olivier Lamy
  */
@@ -28,9 +31,22 @@ import org.springframework.stereotype.Service;
 public class DefaultRuntimeInfoService
     implements RuntimeInfoService
 {
-    public ApplicationRuntimeInfo archivaRuntimeInfo()
+
+    private ArchivaRuntimeInfo archivaRuntimeInfo;
+
+    @Inject
+    public DefaultRuntimeInfoService( ArchivaRuntimeInfo archivaRuntimeInfo )
+    {
+        this.archivaRuntimeInfo = archivaRuntimeInfo;
+    }
+
+    @Inject
+    public ApplicationRuntimeInfo getApplicationRuntimeInfo()
     {
-        ApplicationRuntimeInfo archivaRuntimeInfo = new ApplicationRuntimeInfo();
-        return archivaRuntimeInfo;
+        ApplicationRuntimeInfo applicationRuntimeInfo = new ApplicationRuntimeInfo();
+        applicationRuntimeInfo.setBuildNumber( this.archivaRuntimeInfo.getBuildNumber() );
+        applicationRuntimeInfo.setTimestamp( this.archivaRuntimeInfo.getTimestamp() );
+        applicationRuntimeInfo.setVersion( this.archivaRuntimeInfo.getVersion() );
+        return applicationRuntimeInfo;
     }
 }
index 43e82dd594b6353d6afc82a7f6384e545e371955..43f609e7ad0237aa9aa3b2eeb7627b82e1be409f 100644 (file)
@@ -37,5 +37,5 @@ public interface RuntimeInfoService
     @GET
     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
     @RedbackAuthorization( noRestriction = true )
-    ApplicationRuntimeInfo archivaRuntimeInfo();
+    ApplicationRuntimeInfo getApplicationRuntimeInfo();
 }
index 3759d9a3e33f1f605c9669a1da92d6110510c5e2..fb438a8c27b0fa02641a049ae7801a83341952e5 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.archiva.webapp.ui.services.model;
  */
 
 import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Calendar;
 
 /**
  * @author Olivier Lamy
@@ -31,11 +32,22 @@ public class ApplicationRuntimeInfo
 
     private boolean javascriptLog = false;
 
+    private String version;
+
+    private String buildNumber;
+
+    private long timestamp;
+
+    private String copyrightRange;
+
+
     public ApplicationRuntimeInfo()
     {
         this.devMode = Boolean.getBoolean( "archiva.devMode" );
 
         this.javascriptLog = Boolean.getBoolean( "archiva.javascriptLog" );
+
+        this.copyrightRange = "2005 - " + Calendar.getInstance().get( Calendar.YEAR );
     }
 
     public boolean isDevMode()
@@ -58,6 +70,46 @@ public class ApplicationRuntimeInfo
         this.javascriptLog = javascriptLog;
     }
 
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getBuildNumber()
+    {
+        return buildNumber;
+    }
+
+    public void setBuildNumber( String buildNumber )
+    {
+        this.buildNumber = buildNumber;
+    }
+
+    public long getTimestamp()
+    {
+        return timestamp;
+    }
+
+    public void setTimestamp( long timestamp )
+    {
+        this.timestamp = timestamp;
+    }
+
+    public String getCopyrightRange()
+    {
+        return copyrightRange;
+    }
+
+    public void setCopyrightRange( String copyrightRange )
+    {
+        this.copyrightRange = copyrightRange;
+    }
+
     @Override
     public String toString()
     {
@@ -65,6 +117,10 @@ public class ApplicationRuntimeInfo
         sb.append( "ApplicationRuntimeInfo" );
         sb.append( "{devMode=" ).append( devMode );
         sb.append( ", javascriptLog=" ).append( javascriptLog );
+        sb.append( ", version='" ).append( version ).append( '\'' );
+        sb.append( ", buildNumber='" ).append( buildNumber ).append( '\'' );
+        sb.append( ", timestamp=" ).append( timestamp );
+        sb.append( ", copyrightRange='" ).append( copyrightRange ).append( '\'' );
         sb.append( '}' );
         return sb.toString();
     }
index 1d06f8be335d832634714df731a921e0192eac7c..7581bfdd931ab255068a9d1dbc7984c9fb051b09 100644 (file)
@@ -53,6 +53,7 @@ $.ajax(
     success:function(data){
         window.archivaDevMode=data.applicationRuntimeInfo.devMode;
         window.archivaJavascriptLog=data.applicationRuntimeInfo.javascriptLog;
+        window.archivaRuntimeInfo=data.applicationRuntimeInfo;
         require.config({
             baseUrl: "js/"
           });
index 8f92bb64b2538312700a03c3d0d49ce158df251c..9df607d1cc3ad1144d10e5b7bd9fc87a76a5af93 100644 (file)
@@ -172,7 +172,7 @@ $(function() {
     hideElementWithKarma();
     checkSecurityLinks();
     checkCreateAdminLink();
-    $('#footer-content').html($('#footer-tmpl').tmpl());
+    $('#footer-content').html($('#footer-tmpl').tmpl(window.archivaRuntimeInfo));
   }
   startArchivaApplication();
 })