finish footer with version copyrightRange

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1236636 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-01-27 11:20:11 +00:00
parent 7b50ea96e2
commit 538e2f2417
7 changed files with 78 additions and 31 deletions

View File

@ -523,10 +523,6 @@
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/filtered-resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>

View File

@ -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}

View 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 )
{
ApplicationRuntimeInfo archivaRuntimeInfo = new ApplicationRuntimeInfo();
return archivaRuntimeInfo;
this.archivaRuntimeInfo = archivaRuntimeInfo;
}
@Inject
public ApplicationRuntimeInfo getApplicationRuntimeInfo()
{
ApplicationRuntimeInfo applicationRuntimeInfo = new ApplicationRuntimeInfo();
applicationRuntimeInfo.setBuildNumber( this.archivaRuntimeInfo.getBuildNumber() );
applicationRuntimeInfo.setTimestamp( this.archivaRuntimeInfo.getTimestamp() );
applicationRuntimeInfo.setVersion( this.archivaRuntimeInfo.getVersion() );
return applicationRuntimeInfo;
}
}

View File

@ -37,5 +37,5 @@ public interface RuntimeInfoService
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noRestriction = true )
ApplicationRuntimeInfo archivaRuntimeInfo();
ApplicationRuntimeInfo getApplicationRuntimeInfo();
}

View 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();
}

View 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/"
});

View File

@ -172,7 +172,7 @@ $(function() {
hideElementWithKarma();
checkSecurityLinks();
checkCreateAdminLink();
$('#footer-content').html($('#footer-tmpl').tmpl());
$('#footer-content').html($('#footer-tmpl').tmpl(window.archivaRuntimeInfo));
}
startArchivaApplication();
})