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
|
@ -829,7 +829,7 @@
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>TermsOfUseController</servlet-name>
|
<servlet-name>TermsOfUseController</servlet-name>
|
||||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.TermsOfUseController</servlet-class>
|
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.TermsOfUseControllerFM</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>TermsOfUseController</servlet-name>
|
<servlet-name>TermsOfUseController</servlet-name>
|
||||||
|
|
|
@ -2,28 +2,19 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.controller;
|
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.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
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 {
|
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() {
|
protected String getTitle() {
|
||||||
return "About " + portal.getAppName();
|
return "About " + appName;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getBody() {
|
protected String getBody() {
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class BrowseControllerFM extends FreeMarkerHttpServlet {
|
||||||
body.put("classGroups", vcgroups);
|
body.put("classGroups", vcgroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
String templateName = "body/browseGroups.ftl";
|
String templateName = "body/classGroups.ftl";
|
||||||
return mergeBodyToTemplate(templateName, body);
|
return mergeBodyToTemplate(templateName, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,26 +19,26 @@ public class Controllers {
|
||||||
|
|
||||||
// Servlet urls
|
// 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 SITE_ADMIN = "/siteAdmin";
|
||||||
public static final String LOGIN = "/siteAdmin";
|
public static final String LOGIN = "/siteAdmin";
|
||||||
public static final String LOGOUT = "/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 CONTACT_URL = "/comments";
|
||||||
public static final String TERMS_OF_USE_URL = "/termsOfUse";
|
public static final String TERMS_OF_USE_URL = "/termsOfUse";
|
||||||
|
|
||||||
public static final String BROWSE = "/browse";
|
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:
|
// jsps go here:
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
|
||||||
protected VitroRequest vreq;
|
protected VitroRequest vreq;
|
||||||
protected HttpServletResponse response;
|
protected HttpServletResponse response;
|
||||||
protected Portal portal;
|
protected Portal portal;
|
||||||
|
protected String appName;
|
||||||
protected Map<String, Object> root = new HashMap<String, Object>();
|
protected Map<String, Object> root = new HashMap<String, Object>();
|
||||||
|
|
||||||
// Some servlets have their own doGet() method, in which case they need to call
|
// Some servlets have their own doGet() method, in which case they need to call
|
||||||
|
@ -202,6 +203,13 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
|
||||||
log.error("Can't set shared variable 'portalId'.");
|
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();
|
setTemplateLoader();
|
||||||
|
|
||||||
TabMenu menu = getTabMenu(portalId);
|
TabMenu menu = getTabMenu(portalId);
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class IndividualListControllerFM extends FreeMarkerHttpServlet {
|
||||||
|
|
||||||
long startTime = -1;
|
long startTime = -1;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private static final Log log = LogFactory.getLog(IndividualListControllerFM.class.getName());
|
private static final Log log = LogFactory.getLog(IndividualListControllerFM.class.getName());
|
||||||
private VClass vclass = null;
|
private VClass vclass = null;
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ public class IndividualListControllerFM extends FreeMarkerHttpServlet {
|
||||||
}
|
}
|
||||||
setSharedVariable("title", title);
|
setSharedVariable("title", title);
|
||||||
|
|
||||||
String templateName = "entityList.ftl";
|
String templateName = "individualList.ftl";
|
||||||
return mergeBodyToTemplate(templateName, body);
|
return mergeBodyToTemplate(templateName, body);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||||
* Controller for Terms of Use page
|
* Controller for Terms of Use page
|
||||||
* @author bjl23
|
* @author bjl23
|
||||||
*/
|
*/
|
||||||
public class TermsOfUseController extends VitroHttpServlet{
|
public class TermsOfUseController extends VitroHttpServlet{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
<#-- $This file is distributed under the terms of the license in /doc/license.txt -->
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt -->
|
||||||
|
|
||||||
|
<#-- Template for the body of the About page -->
|
||||||
|
|
||||||
<h2>${title}</h2>
|
<h2>${title}</h2>
|
||||||
|
|
||||||
<#if aboutText??>
|
<#if aboutText??>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#-- List class groups, and classes within each group. -->
|
||||||
|
|
||||||
<#if message??>
|
<#if message??>
|
||||||
<p>${message}</p>
|
<p>${message}</p>
|
||||||
<#else>
|
<#else>
|
|
@ -1,5 +1,7 @@
|
||||||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#-- List individual members of a class. -->
|
||||||
|
|
||||||
<div class="contents">
|
<div class="contents">
|
||||||
|
|
||||||
<div class="entityList">
|
<div class="entityList">
|
||||||
|
|
32
webapp/web/templates/freemarker/body/termsOfUse.ftl
Normal file
32
webapp/web/templates/freemarker/body/termsOfUse.ftl
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<div class="staticPageBackground">
|
||||||
|
|
||||||
|
<h2>Terms of Use</h2>
|
||||||
|
|
||||||
|
<h3 class="celltopcentered">Disclaimers</h3>
|
||||||
|
<p class="normal">This ${websiteName} website contains material—text information, publication
|
||||||
|
citations, links, and images—provided by ${copyrightAnchor} and by various
|
||||||
|
third parties, both individuals and organizations, commercial and otherwise. The use of this material
|
||||||
|
is protected by copyright and unless the terms of use are clearly stated with respect to individual items,
|
||||||
|
users must seek permission from the copyright owner for all uses that are not allowed by fair use and
|
||||||
|
other provisions of the United States Copyright Act. Redistribution or commercial use is prohibited
|
||||||
|
without express written permission.</p>
|
||||||
|
|
||||||
|
<h3>Disclaimer of Liability</h3>
|
||||||
|
<p class="normal">${copyrightAnchor} makes no warranty, expressed or implied, including the warranties of merchantability
|
||||||
|
and fitness for a particular purpose, or assumes any legal liability or responsibility for the accuracy,
|
||||||
|
completeness, currency or usefulness of any material displayed or distributed through the
|
||||||
|
${appName} website or represents that its use would not infringe privately owned rights.
|
||||||
|
${copyrightAnchor} disclaims all warranties with regard to the information provided. Any reliance upon such information
|
||||||
|
is at your own risk. In no event will ${copyrightAnchor} be liable to you for any damages or losses whatsoever resulting
|
||||||
|
from or caused by the ${appName} website or its contents.</p>
|
||||||
|
|
||||||
|
<h3>Disclaimer of Endorsement</h3>
|
||||||
|
<p class="normal">Reference herein to any specific commercial product, process, or service by trade name,
|
||||||
|
trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement or recommendation
|
||||||
|
by ${copyrightAnchor}. The views and opinions of authors expressed herein do not necessarily state or reflect those of
|
||||||
|
${copyrightAnchor} and shall not be used for advertising or product endorsement purposes.</p>
|
||||||
|
|
||||||
|
</div> <!-- staticPageBackground -->
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
<div id="contentwrap">
|
<div id="contentwrap">
|
||||||
<div id="content" <#if contentClass??> class="${contentClass}" </#if>>
|
<div id="content" <#if contentClass??> class="${contentClass}" </#if>>
|
||||||
|
<#-- We don't do title here because some pages don't get a title, or it may not be the same as the <title> text.
|
||||||
|
<h2>${title}</h2> -->
|
||||||
${body}
|
${body}
|
||||||
</div> <!-- content -->
|
</div> <!-- content -->
|
||||||
</div> <!-- contentwrap -->
|
</div> <!-- contentwrap -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue