Commit 266e3b69 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '7-separator-char-options' into 'master'

- added separator char options

Closes #7

See merge request !9
parents 9ba1c685 08c1e836
......@@ -74,8 +74,10 @@ public class ValidatorController {
*/
@RequestMapping(value = "process", method = RequestMethod.POST, params = "csvText")
public String processString(@RequestParam(name = "separator", required = false, defaultValue = ",") final Character separator,
@RequestParam(name = "separatorOther", required = false, defaultValue = "") final Character separatorOther,
@RequestParam(name = "quoteChar", required = false, defaultValue = "\"") final Character quoteChar,
@RequestParam(name = "escapeChar", required = false, defaultValue = "\0") final Character escapeChar, @RequestParam(name = "csvText", required = true) final String csvText,
@RequestParam(name = "escapeChar", required = false, defaultValue = "\0") final Character escapeChar,
@RequestParam(name = "csvText", required = true) final String csvText,
@RequestParam(name = "toCurrentTaxa", required = false) final Boolean toCurrentTaxa,
@RequestParam(name = "validateType", defaultValue = "") final String validateType,
@RequestParam(name = "decimalMark", defaultValue = ".") final Character decimalMark,
......@@ -83,7 +85,7 @@ public class ValidatorController {
LOG.trace("Processing uploaded CSV string:\n{}", csvText);
List<String[]> rows = processService.process(new StringReader(StringUtils.defaultString(csvText, "")), separator, quoteChar, escapeChar, validateType,
List<String[]> rows = processService.process(new StringReader(StringUtils.defaultString(csvText, "")), (separator == 'O' ? separatorOther : separator), quoteChar, escapeChar, validateType,
toCurrentTaxa, decimalMark);
model.addAttribute("result", rows);
model.addAttribute("tableHeaders", rows.get(0));
......
......@@ -7,22 +7,29 @@ label.run-check-land=Classify Land or Water
label.copy-paste-csv=Copy-paste data from Excel
hint.copy-paste-csv=Select the range of cells (including headers) in Excel and paste the data in to the textbox.
label.csv-separator=Separator character
hint.csv-separator=The separator character in CSV separates "columns".
label.separator=Separator character
hint.separator=The separator character in CSV separates "columns".
label.separator.tab=Tab
label.separator.comma=Comma
label.separator.semi=Semicolon
label.separator.space=Space
label.separator.other=Other
label.quote-char=Quote character
hint.quote-char=Quote character is used to mark the start and end of a column. Commonly the double quote: "
label.other=Other
label.escape-char=Escape character
hint.escape-char=If the quote character is used in column text, it must be escaped: "This is: a \"column\""
hint.escape-char=If the quote character is used in column text, it must be escaped: "This is: a \\\"column\\\""
label.non.current.taxa=Flag non-current taxa
label.yes=Yes
label.no=No
label.decimal.mark=Decimal mark
label.decimal.mark.dot=Dot (\u03C0 is approximately 3.14159)
label.decimal.mark.comma=Comma (\u03C0 is approximately 3,14159)
label.decimal-mark=Decimal mark
label.decimal-mark.dot=Dot (\u03C0 is approximately 3.14159)
label.decimal-mark.comma=Comma (\u03C0 is approximately 3,14159)
hint.decimal-mark=A decimal mark is a symbol used to separate the integer part from the fractional part of a number. PI is 3 [decimal-mark] 14159.
http-error.401=Unauthorized
http-error.200= It's ok
......
<%@ include file="/WEB-INF/jsp/init.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><spring:message code="label.title"/></title>
<style>
html {
......@@ -33,6 +34,11 @@
margin: 2em 0;
}
code {
display: inline-block;
white-space: pre;
background-color: Pink;
}
</style>
</head>
<body>
......@@ -80,28 +86,33 @@
<h2>2. Configure CSV settings</h2>
<div>
<label for="separator"><spring:message code="label.csv-separator"/>:</label>
<input id="separator" name="separator" placeholder=","/>
<p class="hint"><spring:message code="hint.csv-separator"/></p>
</div>
<div>
<label for="quoteChar"><spring:message code="label.quote-char"/>:</label>
<input id="quoteChar" name="quoteChar" placeholder="&#34"/>
<p class="hint"><spring:message code="hint.quote-char"/></p>
<h3><spring:message code="label.separator"/>:</h3>
<input id="separatorTab" name="separator" value="&#9;" type="radio" checked>
<label for="separatorTab"><spring:message code="label.separator.tab"/> <code>&#09;</code></label>
<input id="separatorComma" name="separator" value="," type="radio">
<label for="separatorComma"><spring:message code="label.separator.comma"/> <code>,</code></label>
<input id="separatorSemi" name="separator" value=";" type="radio">
<label for="separatorSemi"><spring:message code="label.separator.semi"/> <code>;</code></label>
<input id="separatorSpace" name="separator" value=" " type="radio">
<label for="separatorSpace"><spring:message code="label.separator.space"/> <code> </code></label>
<input id="separatorOther" name="separator" value="O" type="radio">
<label for="separatorOther"><spring:message code="label.separator.other"/></label>
<input name="separatorOther" type="text" maxlength="1">
<p class="hint"><spring:message code="hint.separator"/></p>
</div>
<div>
<label for="escapeChar"><spring:message code="label.escape-char"/>:</label>
<h3><spring:message code="label.escape-char"/>:</h3>
<input id="escapeChar" name="escapeChar" placeholder=""/>
<p class="hint"><spring:message code="hint.escape-char"/></p>
</div>
<div>
<h3><spring:message code="label.decimal.mark"/>:</h3>
<h3><spring:message code="label.decimal-mark"/>:</h3>
<input type="radio" id="decimalMarkDot" name="decimalMark" value="." checked/>
<label for="decimalMarkDot"><spring:message code="label.decimal.mark.dot"/></label>
<label for="decimalMarkDot"><spring:message code="label.decimal-mark.dot"/></label>
<input type="radio" id="decimalMarkComma" name="decimalMark" value=","/>
<label for="decimalMarkComma"><spring:message code="label.decimal.mark.comma"/></label>
<label for="decimalMarkComma"><spring:message code="label.decimal-mark.comma"/></label>
<p class="hint"><spring:message code="hint.decimal-mark"/></p>
</div>
<h2>3. Other options</h2>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment