NIHVIVO-2997 Merged r3354 from maint-rel-1.3 branch.

This commit is contained in:
cappadona 2011-07-21 12:49:15 +00:00
parent 5485ff82b7
commit 73e299ec79
4 changed files with 252 additions and 238 deletions

View file

@ -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;
}

View file

@ -7,17 +7,16 @@
<#else> <#else>
<#if jobKnown == "false"> <#if jobKnown == "false">
<p>Error: No file harvest job was specified, or an unknown job was specified.</p> <p>Error: No file harvest job was specified, or an unknown job was specified.</p>
<p>The end user should not see this error under normal circumstances, so this is probably a bug and should be reported.</p> <p>The end user should not see this error under normal circumstances, so this is probably a bug and should be reported.</p>
<#else> <#else>
<script type="text/javascript"> <script type="text/javascript">
var harvestProgressResponse; var harvestProgressResponse;
function doFunStuff()
{
doHarvest();
}
function doHarvest() function doHarvest()
{ {
@ -67,8 +66,9 @@
request.send("${paramMode}=${modeCheckStatus}"); request.send("${paramMode}=${modeCheckStatus}");
} else { } else {
var linkHeader = document.getElementById("linkHeader"); // var linkHeader = document.getElementById("linkHeader");
linkHeader.style.display = "inline"; // linkHeader.style.display = "inline";
$('#linkHeader').removeClass('hidden');
var importedItems = document.getElementById("importedItems") var importedItems = document.getElementById("importedItems")
@ -102,21 +102,6 @@
return request; return request;
} }
function toggleCollapsibleDiv(divName)
{
var display = document.getElementById(divName).style.display;
if(display == "none")
document.getElementById(divName).style.display = "inline";
else
document.getElementById(divName).style.display = "none";
}
function toggleCsvHelp()
{
toggleCollapsibleDiv("csvHelp-collapsible");
}
function fileResponse() function fileResponse()
{ {
var response = frames["uploadTarget"].document.getElementsByTagName("body")[0].innerHTML; var response = frames["uploadTarget"].document.getElementsByTagName("body")[0].innerHTML;
@ -151,50 +136,43 @@
document.getElementById("downloadTemplateForm").target = "uploadTarget"; document.getElementById("downloadTemplateForm").target = "uploadTarget";
} }
} }
window.onload = init; window.onload = init;
$(document).ready(function() {
$('a.help').click(function() {
$('#csvHelp-collapsible').toggleClass('hidden');
return false;
});
$('#harvestButton').click(function() {
doHarvest();
return false;
});
});
</script> </script>
<h2><a class="ingestMenu" href="${urls.base}/ingest">Ingest Menu</a> > ${jobSpecificHeader}</h2>
<style>
h3.testfile-step-header
{
float:left;
padding-right:30px
}
h4.testfile-step-subheader
{
}
div.testfile-step-body
{
overflow:hidden
}
div.clearBothDiv
{
clear:both;
padding-bottom:20px
}
</style>
<h2>${jobSpecificHeader}</h2>
<div id="step1" class="testfile-step"> <div id="step1" class="testfile-step">
<h3 class="testfile-step-header">Step 1</h3> <h3 class="testfile-step-header">Step 1</h3>
<div id="step1-inner" class="testfile-step-body"> <div id="step1-inner" class="testfile-step-body">
<h4 class="testfile-step-subheader">Download template</h4> <h4 class="testfile-step-subheader">Download template</h4>
<form id="downloadTemplateForm" method="post" action=${postTo}> <form id="downloadTemplateForm" method="post" action=${postTo}>
<input type="hidden" id="${paramMode}" name="${paramMode}" value="${modeDownloadTemplate}" /> <input type="hidden" id="${paramMode}" name="${paramMode}" value="${modeDownloadTemplate}" />
<p><input type="submit" name="submit" value="Download" style="margin-right:10px" />${jobSpecificDownloadHelp}</p> <p><input id="submit" type="submit" name="submit" value="Download" /> ${jobSpecificDownloadHelp}</p>
</form> </form>
</div> </div>
<div class="clearBothDiv" /> <div class="clearBothDiv" />
</div> </div>
<div id="step2" class="testfile-step"> <div id="step2" class="testfile-step">
<h3 class="testfile-step-header">Step 2</h3> <h3 class="testfile-step-header">Step 2</h3>
<div id="step2-inner" class="testfile-step-body"> <div id="step2-inner" class="testfile-step-body">
<h4 class="testfile-step-subheader">Fill in data <a style="font-size:smaller;margin-left:10px" onclick="toggleCsvHelp();return false;" href="#">Help</a></h4> <h4 class="testfile-step-subheader">Fill in data <a class="help" href="#">Help</a></h4>
<div id="csvHelp-collapsible" style="display:none"> <div id="csvHelp-collapsible" class="hidden">
<div id="csvHelp-indented" style="margin-left:20px;font-size:smaller"> <div id="csvHelp-indented">
${jobSpecificFillInHelp} ${jobSpecificFillInHelp}
</div> </div>
</div> </div>
@ -204,6 +182,7 @@
</div> </div>
<div class="clearBothDiv" /> <div class="clearBothDiv" />
</div> </div>
<div id="step3" class="testfile-step"> <div id="step3" class="testfile-step">
<h3 class="testfile-step-header">Step 3</h3> <h3 class="testfile-step-header">Step 3</h3>
<div id="step3-inner" class="testfile-step-body"> <div id="step3-inner" class="testfile-step-body">
@ -214,7 +193,7 @@
<!--<input type="hidden" id="${paramJob}" name="${paramJob}" value="${job}" /> --> <!--<input type="hidden" id="${paramJob}" name="${paramJob}" value="${job}" /> -->
<input type="file" name="${paramUploadedFile}" /> <input type="file" name="${paramUploadedFile}" />
<input type="submit" name="submit" value="Upload" /> <input type="submit" name="submit" value="Upload" />
<iframe id="uploadTarget" name="uploadTarget" src="" style="width:0;height:0;border:0px solid #fff;"></iframe> <iframe id="uploadTarget" name="uploadTarget" src=""></iframe>
</form> </form>
<h5>Uploaded files</h5> <h5>Uploaded files</h5>
<ul id="fileListing"> <ul id="fileListing">
@ -222,16 +201,16 @@
</div> </div>
<div class="clearBothDiv" /> <div class="clearBothDiv" />
</div> </div>
<div id="step4" class="testfile-step"> <div id="step4" class="testfile-step">
<h3 class="testfile-step-header">Step 4</h3> <h3 class="testfile-step-header">Step 4</h3>
<div id="step4-inner" class="testfile-step-body"> <div id="step4-inner" class="testfile-step-body">
<h4 class="testfile-step-subheader">Harvest</h4> <h4 class="testfile-step-subheader">Harvest</h4>
<p><input type="button" name="harvestButton" id="harvestButton" value="Harvest" style="margin-right:10px" onclick="doFunStuff();" /><span id="harvestButtonHelpText">Click the button to harvest your file(s).</span></p> <p><input type="button" name="harvestButton" id="harvestButton" class="green button" value="Harvest" /><span id="harvestButtonHelpText">Click the button to harvest your file(s).</span></p>
</div> </div>
<div class="clearBothDiv" /> <div class="clearBothDiv" />
</div> </div>
<div id="step5" class="testfile-step"> <div id="step5" class="testfile-step">
<h3 class="testfile-step-header">Step 5</h3> <h3 class="testfile-step-header">Step 5</h3>
<div id="step5-inner" class="testfile-step-body"> <div id="step5-inner" class="testfile-step-body">
@ -245,7 +224,7 @@
<textarea cols="100" rows="20" readonly="readonly" id="progressTextArea"></textarea> <textarea cols="100" rows="20" readonly="readonly" id="progressTextArea"></textarea>
</div> </div>
<div id="summary"> <div id="summary">
<h5 id="linkHeader" style="display:none">${jobSpecificLinkHeader}</h5> <h5 id="linkHeader" class="hidden">${jobSpecificLinkHeader}</h5>
<ul id="importedItems"> <ul id="importedItems">
</ul> </ul>
</div> </div>
@ -253,10 +232,10 @@
<div class="clearBothDiv" /> <div class="clearBothDiv" />
</div> </div>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/harvester/fileharvest.css" />')}
<#-- if job known --> <#-- if job known -->
</#if> </#if>
<#-- if user is logged-in with site admin access --> <#-- if user is logged-in with site admin access -->
</#if> </#if>

View file

@ -423,7 +423,7 @@ class CsvFileHarvestJob implements FileHarvestJob {
public String getTemplateFillInHelp() { public String getTemplateFillInHelp() {
String newline = "\n"; String newline = "\n";
String help = ""; String help = "";
help += "<p>A CSV, or <b>C</b>omma-<b>S</b>eparated <b>V</b>alues 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.</p>" + newline; help += "<p>A CSV, or <strong>C</strong>omma-<strong>S</strong>eparated </strong>V</strong>alues 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.</p>" + newline;
help += "<p>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\".</p>" + newline; help += "<p>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\".</p>" + newline;
return help; return help;
} }

View file

@ -57,7 +57,7 @@ public class FileHarvestController extends FreemarkerHttpServlet {
private static final String PARAMETER_MODE = "mode"; private static final String PARAMETER_MODE = "mode";
private static final String PARAMETER_JOB = "job"; 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_HARVEST = "harvest";
private static final String MODE_CHECK_STATUS = "checkStatus"; private static final String MODE_CHECK_STATUS = "checkStatus";