Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIVO-4000 Fixes for search result export to CSV #472

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package edu.cornell.mannlib.vitro.webapp.search.controller;

import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
Expand Down Expand Up @@ -124,7 +126,10 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro

response.setCharacterEncoding("UTF-8");
response.setContentType("text/csv;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment; filename=search.csv");
String date = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HHmmss"));
String applicationName = vreq.getAppBean().getApplicationName();
String fileName = date + "_" + applicationName + "_searchterm.csv";
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
writeTemplate(rvalues.getTemplateName(), rvalues.getMap(), request, response);
} catch (Exception e) {
log.error(e, e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<#-- $This file is distributed under the terms of the license in LICENSE$ -->
<#assign today = .now >
<#assign todayDate = today?date>
Results from ${siteName} for ${querytext} on ${todayDate}

Name, URI, URL
<#list individuals as individual>
"${individual.name}","${individual.uri}","${individual.profileUrl}"
Expand Down
Loading