From 72d2cafc2aa2370ac34080729755778f33935a02 Mon Sep 17 00:00:00 2001 From: tworrall Date: Fri, 5 Oct 2012 17:39:36 +0000 Subject: [PATCH] merging 10098 to the trunk --- .../controller/SearchHelpController.java | 52 ++++++++++++++++++ webapp/web/WEB-INF/web.xml | 11 +++- webapp/web/css/search.css | 14 +++++ .../freemarker/body/search/search-error.ftl | 3 +- .../freemarker/body/search/search-help.ftl | 55 ++++++++++++++----- .../body/search/search-pagedResults.ftl | 2 +- 6 files changed, 119 insertions(+), 18 deletions(-) create mode 100644 webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SearchHelpController.java diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SearchHelpController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SearchHelpController.java new file mode 100644 index 000000000..451676e81 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SearchHelpController.java @@ -0,0 +1,52 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ +package edu.cornell.mannlib.vitro.webapp.search.controller; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.HashMap; +import java.util.Map; +import java.util.Enumeration; + +import javax.servlet.RequestDispatcher; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.hp.hpl.jena.query.QuerySolution; +import com.hp.hpl.jena.query.ResultSet; +import com.hp.hpl.jena.rdf.model.Literal; +import com.hp.hpl.jena.rdf.model.RDFNode; +import com.hp.hpl.jena.datatypes.RDFDatatype ; + +import edu.cornell.mannlib.vitro.webapp.beans.Individual; +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; +import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils; +import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; + + +public class SearchHelpController extends FreemarkerHttpServlet { + + private static final Log log = LogFactory.getLog(SearchHelpController.class.getName()); + private static final String TEMPLATE_NAME = "search-help.ftl"; + + @Override + protected ResponseValues processRequest(VitroRequest vreq) { + + Map body = new HashMap(); + + String pointOfOrigin = "helpLink"; + + body.put("origination", pointOfOrigin); + + return new TemplateResponseValues(TEMPLATE_NAME, body); + } + +} + + diff --git a/webapp/web/WEB-INF/web.xml b/webapp/web/WEB-INF/web.xml index ab2683642..961b1e170 100644 --- a/webapp/web/WEB-INF/web.xml +++ b/webapp/web/WEB-INF/web.xml @@ -863,11 +863,20 @@ SearchController edu.cornell.mannlib.vitro.webapp.search.controller.PagedSearchController - SearchController /search + + + SearchHelpController + edu.cornell.mannlib.vitro.webapp.search.controller.SearchHelpController + + + SearchHelpController + /searchHelp + + SearchController diff --git a/webapp/web/css/search.css b/webapp/web/css/search.css index 6a7a6d287..35b6857eb 100644 --- a/webapp/web/css/search.css +++ b/webapp/web/css/search.css @@ -57,6 +57,14 @@ a:visited span.SearchTerm { div.searchTips li { line-height: 2em; } +ul.searchTips { + list-style: url("../images/arrowIcon.gif"); +} +ul.searchTips li { + line-height:1.375em; + padding:0 0 8px 0; + margin-left:20px; +} /* Search results */ .display-title { font-size: .825em; @@ -68,4 +76,10 @@ div.searchTips li { } .display-title:first-child { margin-left: .5em; +} +span#searchHelp { + float:right; + margin-top:-45px; + font-size:.825em; + padding-right:32px } \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/search/search-error.ftl b/webapp/web/templates/freemarker/body/search/search-error.ftl index 3ede65822..d71bcff1e 100644 --- a/webapp/web/templates/freemarker/body/search/search-error.ftl +++ b/webapp/web/templates/freemarker/body/search/search-error.ftl @@ -8,4 +8,5 @@

${message?html} -

\ No newline at end of file +

+<#include "search-help.ftl" > \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/search/search-help.ftl b/webapp/web/templates/freemarker/body/search/search-help.ftl index 32a190884..98fc9c222 100644 --- a/webapp/web/templates/freemarker/body/search/search-help.ftl +++ b/webapp/web/templates/freemarker/body/search/search-help.ftl @@ -1,18 +1,43 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> -

Search Tips

-
    -
  • Use short, single terms unless your searches are returning too many results
  • -
  • When you enter more than one term, the search will look for records containing all of them unless you add the word "OR" between your terms.
  • -
  • "NOT" can help limit searches -- e.g., climate NOT change
  • +<#if origination?has_content && origination == "helpLink"> +

    Search Tips

    + + Back to results + +<#else> +

    Search Tips

    + +
      +
    • Keep it simple! Use short, single terms unless your searches are returning too many results.
    • +
    • Use quotes to search for an entire phrase -- e.g., "protein folding".
    • +
    • Except for Boolean operators, searches are not case-sensitive, so Geneva and geneva are equivalent.
    • Except for boolean operators, searches are not case-sensitive, so "Geneva" and "geneva" are equivalent
    • -
    • Enclose a phrase in quotes (") to search for the whole phrase, not individual words (e.g., "protein folding") -- both leading and ending quotes are required
    • -
    • Phrase searches may be combined with boolean operators: "climate change" OR "global warming"
    • -
    • The search uses stemming by default so that close word variations will also be found (e.g., "sequence" also matches "sequences" and "sequencing"). - Use the wildcard * character to match wider variation (e.g., nano* to match both - nanotechnology and nanofabrication), but note that searching uses stemmed, or shortened, versions of words, - so "cogniti*" finds nothing while "cognit*" finds both cognitive and cognition
    • -
    • If you're not sure of the spelling, put a ~ at the end -- e.g., cabage~ finds cabbage, - steven~ finds Stephen and Stefan (as well as a few unwanted extra words)
    • -
    • To match a person or unit's primary entry, enter name: Smith or name: Biology
    • -
    \ No newline at end of file +
  • If you are unsure of the correct spelling, put ~ at the end of your search term -- e.g., cabage~ finds cabbage, steven~ finds Stephen and Stefan (as well as other similar names).
  • +
+ +

Advanced Tips

+ + +${stylesheets.add('')} + \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/search/search-pagedResults.ftl b/webapp/web/templates/freemarker/body/search/search-pagedResults.ftl index 7db886a0e..5203b4fb3 100644 --- a/webapp/web/templates/freemarker/body/search/search-pagedResults.ftl +++ b/webapp/web/templates/freemarker/body/search/search-pagedResults.ftl @@ -9,7 +9,7 @@ <#if typeName?has_content>limited to type '${typeName}' - +Not the results you expected?
<#-- Refinement links -->