diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java index 510cb2532..b74979164 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java @@ -105,12 +105,13 @@ public class PagedSearchController extends FreemarkerHttpServlet { boolean wasCSVRequested = isRequestedFormatCSV(vreq); if( !wasXmlRequested && !wasCSVRequested){ super.doGet(vreq,response); - }else if (wasXMLRequested){ + }else if (wasXmlRequested){ try { ResponseValues rvalues = processRequest(vreq); response.setCharacterEncoding("UTF-8"); response.setContentType("text/xml;charset=UTF-8"); + response.setHeader("Content-Disposition", "attachment; filename=search.xml"); writeTemplate(rvalues.getTemplateName(), rvalues.getMap(), request, response); } catch (Exception e) { log.error(e, e); @@ -121,6 +122,7 @@ public class PagedSearchController extends FreemarkerHttpServlet { response.setCharacterEncoding("UTF-8"); response.setContentType("text/csv;charset=UTF-8"); + response.setHeader("Content-Disposition", "attachment; filename=search.csv"); writeTemplate(rvalues.getTemplateName(), rvalues.getMap(), request, response); } catch (Exception e) { log.error(e, e); @@ -134,8 +136,9 @@ public class PagedSearchController extends FreemarkerHttpServlet { //There may be other non-html formats in the future Format format = getFormat(vreq); boolean wasXmlRequested = Format.XML == format; + boolean wasCSVRequested = Format.CSV == format; log.debug("Requested format was " + (wasXmlRequested ? "xml" : "html")); - boolean wasHtmlRequested = ! wasXmlRequested; + boolean wasHtmlRequested = ! (wasXmlRequested || wasCSVRequested); try { diff --git a/webapp/web/css/search.css b/webapp/web/css/search.css index 35b6857eb..b3717888a 100644 --- a/webapp/web/css/search.css +++ b/webapp/web/css/search.css @@ -79,7 +79,22 @@ ul.searchTips li { } span#searchHelp { float:right; - margin-top:-45px; + margin-top:10px; font-size:.825em; padding-right:32px +} + +span#downloadResults { + float:left; + margin-top:10px; + font-size:.825em; + padding-left:10px +} + +img#downloadIcon { + cursor: pointer; +} + +.download-url { + padding: 5px 25px 5px; } \ No newline at end of file diff --git a/webapp/web/images/download-icon.png b/webapp/web/images/download-icon.png new file mode 100644 index 000000000..dd3213204 Binary files /dev/null and b/webapp/web/images/download-icon.png differ diff --git a/webapp/web/js/searchDownload.js b/webapp/web/js/searchDownload.js new file mode 100644 index 000000000..7d9da55a8 --- /dev/null +++ b/webapp/web/js/searchDownload.js @@ -0,0 +1,44 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +$(document).ready(function(){ + // This function creates and styles the "qTip" tooltip that displays the resource uri and the rdf link when the user clicks the uri/rdf icon. + $('span#downloadResults').children('img#downloadIcon').each(function() + { + $(this).qtip( + { + content: { + prerender: true, // We need this for the .click() event listener on 'a.close' + text: '