NIHVIVO-1230 NIHVIVO-1231 Example implementation of the Freemarker templates to show revision info.
This commit is contained in:
parent
b8fefaee00
commit
a7a083c7b3
5 changed files with 84 additions and 8 deletions
|
@ -25,6 +25,7 @@ import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
|||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.config.RevisionInfoBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.ContactMailServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -435,7 +436,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
map.put("bannerImage", UrlBuilder.getUrl(themeDir + "site_icons/" + bannerImage));
|
||||
}
|
||||
|
||||
map.put("version", getVersionInfo());
|
||||
map.put("version", getVersionInfo(urlBuilder));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
@ -479,12 +480,13 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
return copyright;
|
||||
}
|
||||
|
||||
private final Map<String, Object> getVersionInfo() {
|
||||
Map<String, Object> version = new HashMap<String, Object>();
|
||||
// Add revision info here
|
||||
version.put("number", "1.2"); // test code - to be removed
|
||||
return version;
|
||||
}
|
||||
private final Map<String, Object> getVersionInfo(UrlBuilder urlBuilder) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("label", RevisionInfoBean.getBean(getServletContext())
|
||||
.getReleaseLabel());
|
||||
map.put("moreInfoUrl", urlBuilder.getPortalUrl("/revisionInfo"));
|
||||
return map;
|
||||
}
|
||||
|
||||
// Subclasses may override. This serves as a default.
|
||||
protected String getTitle(String siteName) {
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.config.RevisionInfoBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
||||
/**
|
||||
* Display the detailed revision information.
|
||||
*/
|
||||
public class RevisionInfoController extends FreemarkerHttpServlet {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Log log = LogFactory.getLog(RevisionInfoController.class);
|
||||
private static final String TEMPLATE_DEFAULT = "revisionInfo.ftl";
|
||||
|
||||
@Override
|
||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
|
||||
body.put("revisionInfoBean", RevisionInfoBean.getBean(getServletContext()));
|
||||
|
||||
return new TemplateResponseValues(TEMPLATE_DEFAULT, body);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTitle(String siteName) {
|
||||
return "Revision Information for " + siteName;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue