Move Terms of Use controller & template into FreeMarker.
This commit is contained in:
parent
8a83103367
commit
fc8c9876f0
13 changed files with 109 additions and 32 deletions
|
@ -2,28 +2,19 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.FreeMarkerHttpServlet;
|
||||
|
||||
import freemarker.template.SimpleDate;
|
||||
import freemarker.template.TemplateDateModel;
|
||||
import freemarker.template.TemplateModelException;
|
||||
|
||||
public class AboutControllerFM extends FreeMarkerHttpServlet {
|
||||
|
||||
private static final Log log = LogFactory.getLog(AboutControllerFM.class.getName());
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Log log = LogFactory.getLog(AboutControllerFM.class.getName());
|
||||
|
||||
protected String getTitle() {
|
||||
return "About " + portal.getAppName();
|
||||
return "About " + appName;
|
||||
}
|
||||
|
||||
protected String getBody() {
|
||||
|
|
|
@ -100,7 +100,7 @@ public class BrowseControllerFM extends FreeMarkerHttpServlet {
|
|||
body.put("classGroups", vcgroups);
|
||||
}
|
||||
|
||||
String templateName = "body/browseGroups.ftl";
|
||||
String templateName = "body/classGroups.ftl";
|
||||
return mergeBodyToTemplate(templateName, body);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,28 +18,28 @@ import java.util.List;
|
|||
public class Controllers {
|
||||
|
||||
// Servlet urls
|
||||
|
||||
public static final String ENTITY = "/entity";
|
||||
public static final String ENTITY_PROP_LIST = "/entityPropList";
|
||||
public static final String ENTITY_LIST = "/EntityList";
|
||||
|
||||
public static final String BROWSE_CONTROLLER = "browsecontroller";
|
||||
public static final String RETRY_URL = "editForm";
|
||||
public static final String TAB_ENTITIES = "/TabEntitiesController";
|
||||
|
||||
public static final String ABOUT = "/about";
|
||||
|
||||
|
||||
public static final String SITE_ADMIN = "/siteAdmin";
|
||||
public static final String LOGIN = "/siteAdmin";
|
||||
public static final String LOGOUT = "/siteAdmin";
|
||||
|
||||
public static final String EXPORT_RDF = "/export";
|
||||
|
||||
|
||||
public static final String ABOUT = "/about";
|
||||
public static final String CONTACT_URL = "/comments";
|
||||
public static final String TERMS_OF_USE_URL = "/termsOfUse";
|
||||
|
||||
public static final String BROWSE = "/browse";
|
||||
public static final String INDIVIDUAL_LIST_URL = "/entitylist"; // will change to individuallist
|
||||
|
||||
public static final String INDIVIDUAL_LIST_URL = "/individuallist";
|
||||
|
||||
public static final String ENTITY = "/entity";
|
||||
public static final String ENTITY_PROP_LIST = "/entityPropList";
|
||||
public static final String ENTITY_LIST = "/EntityList";
|
||||
|
||||
public static final String BROWSE_CONTROLLER = "browse";
|
||||
public static final String RETRY_URL = "editForm";
|
||||
public static final String TAB_ENTITIES = "/TabEntitiesController";
|
||||
|
||||
public static final String EXPORT_RDF = "/export";
|
||||
|
||||
// jsps go here:
|
||||
|
||||
public static final String EMPTY = "/empty.jsp";
|
||||
|
|
|
@ -56,6 +56,7 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
|
|||
protected VitroRequest vreq;
|
||||
protected HttpServletResponse response;
|
||||
protected Portal portal;
|
||||
protected String appName;
|
||||
protected Map<String, Object> root = new HashMap<String, Object>();
|
||||
|
||||
// Some servlets have their own doGet() method, in which case they need to call
|
||||
|
@ -201,6 +202,13 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
|
|||
} catch (TemplateModelException e) {
|
||||
log.error("Can't set shared variable 'portalId'.");
|
||||
}
|
||||
|
||||
appName = portal.getAppName();
|
||||
try {
|
||||
config.setSharedVariable("appName", appName);
|
||||
} catch (TemplateModelException e) {
|
||||
log.error("Can't set shared variable 'appName'.");
|
||||
}
|
||||
|
||||
setTemplateLoader();
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ public class IndividualListControllerFM extends FreeMarkerHttpServlet {
|
|||
|
||||
long startTime = -1;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Log log = LogFactory.getLog(IndividualListControllerFM.class.getName());
|
||||
private VClass vclass = null;
|
||||
|
||||
|
@ -117,7 +118,7 @@ public class IndividualListControllerFM extends FreeMarkerHttpServlet {
|
|||
}
|
||||
setSharedVariable("title", title);
|
||||
|
||||
String templateName = "entityList.ftl";
|
||||
String templateName = "individualList.ftl";
|
||||
return mergeBodyToTemplate(templateName, body);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
|||
* Controller for Terms of Use page
|
||||
* @author bjl23
|
||||
*/
|
||||
public class TermsOfUseController extends VitroHttpServlet{
|
||||
public class TermsOfUseController extends VitroHttpServlet{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
|
|
|
@ -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;
|
||||
|
||||
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.utils.StringUtils;
|
||||
|
||||
public class TermsOfUseControllerFM extends FreeMarkerHttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Log log = LogFactory.getLog(TermsOfUseControllerFM.class.getName());
|
||||
|
||||
protected String getTitle() {
|
||||
return appName + " Terms of Use";
|
||||
}
|
||||
|
||||
protected String getBody() {
|
||||
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
|
||||
String websiteName = portal.getRootBreadCrumbAnchor();
|
||||
if (StringUtils.isEmpty(websiteName)) {
|
||||
websiteName = appName;
|
||||
}
|
||||
|
||||
body.put("websiteName", websiteName);
|
||||
body.put("copyrightAnchor", portal.getCopyrightAnchor());
|
||||
|
||||
String templateName = "body/termsOfUse.ftl";
|
||||
return mergeBodyToTemplate(templateName, body);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue