NIHVIVO-1592 Fix TermOfUse controller and template so the page displays when no copyright anchor has been specified.

This commit is contained in:
ryounes 2011-03-24 18:36:10 +00:00
parent c0aa6cdbf0
commit c5dc320cc0
2 changed files with 20 additions and 14 deletions

View file

@ -25,15 +25,21 @@ public class TermsOfUseController extends FreemarkerHttpServlet {
protected ResponseValues processRequest(VitroRequest vreq) { protected ResponseValues processRequest(VitroRequest vreq) {
Portal portal = vreq.getPortal(); Portal portal = vreq.getPortal();
Map<String, Object> body = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
Map<String, String> termsOfUse = new HashMap<String, String>();
String rootBreadCrumbAnchor = portal.getRootBreadCrumbAnchor(); String rootBreadCrumbAnchor = portal.getRootBreadCrumbAnchor();
String websiteName = StringUtils.isEmpty(rootBreadCrumbAnchor) ? portal.getAppName() : rootBreadCrumbAnchor; String siteName = StringUtils.isEmpty(rootBreadCrumbAnchor) ? portal.getAppName() : rootBreadCrumbAnchor;
body.put("websiteName", websiteName); termsOfUse.put("siteName", siteName);
body.put("copyrightAnchor", portal.getCopyrightAnchor()); String siteHost = portal.getCopyrightAnchor();
if (siteHost == null) {
siteHost = "the hosting institution";
}
termsOfUse.put("siteHost", siteHost);
return new TemplateResponseValues(TEMPLATE_DEFAULT, body); map.put("termsOfUse", termsOfUse);
return new TemplateResponseValues(TEMPLATE_DEFAULT, map);
} }
@Override @Override

View file

@ -4,8 +4,8 @@
<h2>Terms of Use</h2> <h2>Terms of Use</h2>
<h3>Disclaimers</h3> <h3>Disclaimers</h3>
<p>This ${websiteName} website contains material&mdash;text information, publication <p>This ${termsOfUse.siteName} website contains material&mdash;text information, publication
citations, links, and images&mdash;provided by ${copyrightAnchor} and by various citations, links, and images&mdash;provided by ${termsOfUse.siteHost} and by various
third parties, both individuals and organizations, commercial and otherwise. The use of this material 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, 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 users must seek permission from the copyright owner for all uses that are not allowed by fair use and
@ -13,17 +13,17 @@
without express written permission.</p> without express written permission.</p>
<h3>Disclaimer of Liability</h3> <h3>Disclaimer of Liability</h3>
<p>${copyrightAnchor} makes no warranty, expressed or implied, including the warranties of merchantability <p>${termsOfUse.siteHost?cap_first} 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, 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 completeness, currency or usefulness of any material displayed or distributed through the
${siteName} website or represents that its use would not infringe privately owned rights. ${termsOfUse.siteName} 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 ${termsOfUse.siteHost?cap_first} 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 is at your own risk. In no event will ${termsOfUse.siteHost} be liable to you for any damages or losses whatsoever resulting
from or caused by the ${siteName} website or its contents.</p> from or caused by the ${termsOfUse.siteName} website or its contents.</p>
<h3>Disclaimer of Endorsement</h3> <h3>Disclaimer of Endorsement</h3>
<p>Reference herein to any specific commercial product, process, or service by trade name, <p>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 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 by ${termsOfUse.siteHost}. 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> ${termsOfUse.siteHost} and shall not be used for advertising or product endorsement purposes.</p>
</section> </section>