Reimplement search controller and search results display template in Freemarker. Error cases not handled yet.

This commit is contained in:
rjy7 2010-08-27 15:52:30 +00:00
parent 3dbbf13cd7
commit 73024a4d03
13 changed files with 1042 additions and 26 deletions

View file

@ -2,6 +2,8 @@
<#-- List individual members of a class. -->
<#import "listMacros.ftl" as l>
<div class="contents">
<div class="individualList">
<h2>${title}</h2>
@ -15,8 +17,20 @@
<ul>
<#list individuals as individual>
<li>
<#-- Currently we just use the search view here; there's no custom list view defined. -->
<#include "${individual.searchView}">
<#-- The old JSP version uses a custom search view if one is defined, but it doesn't make sense
to do that in the current system, because we don't use the default search view. We could define
a custom list or use the custom short view, but for now just hard-code the view here; it will not be
customizable.
<#include "${individual.searchView}"> -->
<a href="${individual.profileUrl}">${individual.name}</a>
<ul class="individualData">
<@l.firstLastList>
<#if individual.moniker??><li>${individual.moniker}</li>,</#if>
<#list individual.links as link>
<li><a class="externalLink" href="${link.url}">${link.anchor}</a></li>,
</#list>
</@l.firstLastList>
</ul>
</li>
</#list>
</ul>

View file

@ -0,0 +1,55 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for displaying paged search results -->
<h2>
Search Results for '${querytext}'
<#if classgroupName?has_content>limited to type '${classgroupName}'</#if>
<#if typeName?has_content>limited to type '${typeName}'</#if>
</h2>
<div class="contentsBrowseGroup">
<#-- Refinement links -->
<#if classGroupLinks?has_content>
<div class="searchTOC">
<span class="jumpText">Show only results of this <b>type</b>:</span>
<#list classGroupLinks as link>
<a href="${link.url}">${link.text}</a>
</#list>
</div>
</#if>
<#if classLinks?has_content>
<div class="searchTOC">
<span class="jumpText">Show only results of this <b>subtype</b>:</span>
<#list classLinks as link>
<a href="${link.url}">${link.text}</a>
</#list>
</div>
</#if>
<#-- Search results -->
<ul class="searchhits">
<#list individuals as individual>
<li>
<#include "${individual.searchView}">
</li>
</#list>
</ul>
<#-- Paging controls -->
<#if (pagingLinks?size > 0)>
<div class="searchpages">
Pages:
<#list pagingLinks as link>
<#if link.url??>
<a href="${link.url}">${link.text}</a>
<#else>
${link.text} <#-- no link if current page -->
</#if>
</#list>
</div>
</#if>
</div> <!-- end contentsBrowseGroup -->

View file

@ -2,14 +2,9 @@
<#-- Default individual search view -->
<#import "listMacros.ftl" as l>
<a href="${individual.profileUrl}">${individual.name}</a>
<ul class="individualData">
<@l.firstLastList>
<#if individual.moniker??><li>${individual.moniker}</li>,</#if>
<#list individual.links as link>
<li><a class="externalLink" href="${link.url}">${link.anchor}</a></li>,
</#list>
</@l.firstLastList>
</ul>
<#if individual.moniker?has_content> | ${individual.moniker}</#if>
<#if individual.description?has_content>
<div class="searchFragment">${individual.description}</div>
</#if>

View file

@ -7,6 +7,7 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ page errorPage="/error.jsp"%>
<%
/***********************************************
Display Paged Search Results
@ -153,7 +154,7 @@ if( request.getAttribute("types") != null ){
String basePageUrl =
request.getContextPath() + "/search?querytext="
+URLEncoder.encode(request.getParameter("querytext"),"UTF-8") +
request.getAttribute("refinment");
request.getAttribute("refinement");
out.println("<div class='searchpages'>");
out.println("Pages:");