diff --git a/productMods/css/harvester/fileharvest.css b/productMods/css/harvester/fileharvest.css new file mode 100644 index 00000000..80a517ac --- /dev/null +++ b/productMods/css/harvester/fileharvest.css @@ -0,0 +1,35 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +h3.testfile-step-header { + float: left; + padding-right: 30px; +} +div.testfile-step-body { + overflow: hidden; +} +div.clearBothDiv { + clear: both; + padding-bottom: 20px; +} +a.help { + margin-left: 10px; + font-size: 0.8em; +} +#csvHelp-indented { + margin: 0 1.5em 1em; + padding: .5em; + font-size: 0.8em; + line-height: 1.2em; + background: #efefef; +} +#csvHelp-indented p:last-child { + margin-bottom: 0; +} +#uploadTarget { + width: 0; + height: 0; + border: 0px solid #fff; +} +#harvestButton { + margin-right: 10px; +} \ No newline at end of file diff --git a/productMods/templates/freemarker/body/harvester/fileharvest.ftl b/productMods/templates/freemarker/body/harvester/fileharvest.ftl index 3cf27f0e..0a5f7c0f 100644 --- a/productMods/templates/freemarker/body/harvester/fileharvest.ftl +++ b/productMods/templates/freemarker/body/harvester/fileharvest.ftl @@ -2,261 +2,240 @@ <#if !(user.loggedIn && user.hasSiteAdminAccess)> -

You must be an administrator to use this tool.

+

You must be an administrator to use this tool.

<#else> -<#if jobKnown == "false"> -

Error: No file harvest job was specified, or an unknown job was specified.

-

The end user should not see this error under normal circumstances, so this is probably a bug and should be reported.

-<#else> + <#if jobKnown == "false"> + +

Error: No file harvest job was specified, or an unknown job was specified.

+ +

The end user should not see this error under normal circumstances, so this is probably a bug and should be reported.

+ + <#else> + + + if(json.success) + newLi.innerHTML = json.fileName + " " + json.errorMessage + ""; + else + newLi.innerHTML = json.fileName + " upload failed: " + json.errorMessage + ""; + fileListing.appendChild(newLi); + document.getElementById("${paramFirstUpload}").value = "false"; - + //document.getElementById("responseArea").innerHTML = response; + } -

${jobSpecificHeader}

-
-

Step 1

-
-

Download template

-
- -

${jobSpecificDownloadHelp}

-
-
-
-
-
-

Step 2

-
-

Fill in data Help

- -

Fill in the template with your data. You may fill in multiple templates if you wish to harvest multiple files at once.

-
-
-
-
-
-
-

Step 3

-
-

Upload file(s)

-

Upload your filled-in template(s).

-
- - - - - -
-
Uploaded files
-
    -
-
-
-
-
-

Step 4

-
-

Harvest

-

Click the button to harvest your file(s).

-
-
-
+ function init() + { + document.getElementById("harvestButton").disabled = false; + document.getElementById("${paramFirstUpload}").value = "true"; + document.getElementById("fileUploadForm").onsubmit = function() + { + document.getElementById("fileUploadForm").target = "uploadTarget"; + document.getElementById("uploadTarget").onload = fileResponse; + } + document.getElementById("downloadTemplateForm").onsubmit = function() + { + document.getElementById("downloadTemplateForm").target = "uploadTarget"; + } + } + + window.onload = init; + + $(document).ready(function() { + $('a.help').click(function() { + $('#csvHelp-collapsible').toggleClass('hidden'); + return false; + }); + + $('#harvestButton').click(function() { + doHarvest(); + return false; + }); + }); -
-

Step 5

-
-

View results

-
-
Script being executed
- -
-
-
Progress
- -
-
- -
    -
-
-
-
-
- -<#-- if job known --> - + + +

Ingest Menu > ${jobSpecificHeader}

+ +
+

Step 1

+
+

Download template

+
+ +

${jobSpecificDownloadHelp}

+
+
+
+
+ +
+

Step 2

+
+

Fill in data Help

+ +

Fill in the template with your data. You may fill in multiple templates if you wish to harvest multiple files at once.

+
+
+
+
+
+ +
+

Step 3

+
+

Upload file(s)

+

Upload your filled-in template(s).

+
+ + + + + +
+
Uploaded files
+
    +
+
+
+
+ +
+

Step 4

+
+

Harvest

+

Click the button to harvest your file(s).

+
+
+
+ +
+

Step 5

+
+

View results

+
+
Script being executed
+ +
+
+
Progress
+ +
+
+ +
    +
+
+
+
+
+ + ${stylesheets.add('')} + + <#-- if job known --> + <#-- if user is logged-in with site admin access --> - - - + \ No newline at end of file diff --git a/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/CsvFileHarvestJob.java b/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/CsvFileHarvestJob.java index 18d2faca..f877808a 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/CsvFileHarvestJob.java +++ b/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/CsvFileHarvestJob.java @@ -423,7 +423,7 @@ class CsvFileHarvestJob implements FileHarvestJob { public String getTemplateFillInHelp() { String newline = "\n"; String help = ""; - help += "

A CSV, or Comma-Separated Values file, is a method of storing tabular data in plain text. The first line of a CSV file contains header information, while each subsequent line contains a data record.

" + newline; + help += "

A CSV, or Comma-Separated Values file, is a method of storing tabular data in plain text. The first line of a CSV file contains header information, while each subsequent line contains a data record.

" + newline; help += "

The template we provide contains only the header, which you will then fill in accordingly. For example, if the template contains the text \"firstName,lastName\", then you might add two more lines, \"John,Doe\" and \"Jane,Public\".

" + newline; return help; } diff --git a/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/FileHarvestController.java b/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/FileHarvestController.java index 7e179b6c..9d2b67cc 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/FileHarvestController.java +++ b/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/FileHarvestController.java @@ -57,7 +57,7 @@ public class FileHarvestController extends FreemarkerHttpServlet { private static final String PARAMETER_MODE = "mode"; private static final String PARAMETER_JOB = "job"; - private static final String POST_TO = "/vivo/harvester/harvest"; + private static final String POST_TO = UrlBuilder.getUrl("/harvester/harvest"); private static final String MODE_HARVEST = "harvest"; private static final String MODE_CHECK_STATUS = "checkStatus";