add archive column (#2573)

Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
This commit is contained in:
james-cui 2020-06-15 10:56:00 -07:00 committed by GitHub
parent d57d76f7df
commit 04055153a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 331 additions and 81 deletions

View File

@ -285,6 +285,7 @@ public class DatabaseImportController implements ImportingController {
job, job,
new DBQueryResultPreviewReader(job, databaseService, querySource, columns, dbQueryInfo, 100), new DBQueryResultPreviewReader(job, databaseService, querySource, columns, dbQueryInfo, 100),
querySource, querySource,
"", // archivefilename
limit, limit,
options, options,
exceptions exceptions
@ -414,6 +415,7 @@ public class DatabaseImportController implements ImportingController {
job, job,
new DBQueryResultImportReader(job, databaseService, querySource, columns, dbQueryInfo, getCreateBatchSize()), new DBQueryResultImportReader(job, databaseService, querySource, columns, dbQueryInfo, getCreateBatchSize()),
querySource, querySource,
"", //archivefilename,
limit, limit,
options, options,
exceptions exceptions

View File

@ -142,6 +142,7 @@ public class GDataImporter {
job, job,
new WorksheetBatchRowReader(job, fileSource, service, spreadsheetId, worksheetEntry), new WorksheetBatchRowReader(job, fileSource, service, spreadsheetId, worksheetEntry),
fileSource, fileSource,
"", //archivefilename
limit, limit,
options, options,
exceptions exceptions

View File

@ -24,7 +24,9 @@
<td><input bind="limitInput" type="text" class="lightweight" size="2" value="0" /> <td><input bind="limitInput" type="text" class="lightweight" size="2" value="0" />
<label for="$limit">row(s) of data</label></td></tr> <label for="$limit">row(s) of data</label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td> <tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td>
<td><label for="$include-file-sources">Store file source<br/>(file names, URLs)<br/>in each row</label></td></tr> <td><label for="$include-file-sources">Store file source</label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeArchiveFileCheckbox" id="$include-archive-file" /></td>
<td><label for="$include-archive-file">Store archive file</label></td></tr>
</table></div></td> </table></div></td>
</tr> </tr>
</table></div> </table></div>

View File

@ -89,6 +89,7 @@ Refine.PCAxisParserUI.prototype.getOptions = function() {
options.skipDataLines = -1; options.skipDataLines = -1;
} }
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked; options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
return options; return options;
}; };
@ -120,6 +121,9 @@ Refine.PCAxisParserUI.prototype._initialize = function() {
if (this._config.includeFileSources) { if (this._config.includeFileSources) {
this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true); this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true);
} }
if (this._config.includeArchiveFileName) {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
var onChange = function() { var onChange = function() {
self._scheduleUpdatePreview(); self._scheduleUpdatePreview();

View File

@ -71,6 +71,7 @@ public class PCAxisImporter extends TabularImportingParserBase {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
Reader reader, Reader reader,
int limit, int limit,
ObjectNode options, ObjectNode options,
@ -88,8 +89,8 @@ public class PCAxisImporter extends TabularImportingParserBase {
TabularImportingParserBase.readTable( TabularImportingParserBase.readTable(
project, metadata, job, dataReader, project, metadata, job, dataReader,
fileSource, limit, options, exceptions); fileSource, archiveFileName, limit, options, exceptions);
super.parseOneFile(project, metadata, job, fileSource, reader, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, reader, limit, options, exceptions);
} }
} }

View File

@ -46,7 +46,7 @@ public class WikidataRefineTest extends PowerMockTestCase {
SeparatorBasedImporter importer = new SeparatorBasedImporter(); SeparatorBasedImporter importer = new SeparatorBasedImporter();
List<Exception> exceptions = new ArrayList<Exception>(); List<Exception> exceptions = new ArrayList<Exception>();
importer.parseOneFile(project, metadata, job, "filesource", new StringReader(input), -1, options, exceptions); importer.parseOneFile(project, metadata, job, "filesource", "archivefile", new StringReader(input), -1, options, exceptions);
project.update(); project.update();
ProjectManager.singleton.registerProject(project, metadata); ProjectManager.singleton.registerProject(project, metadata);

View File

@ -129,6 +129,7 @@ public class ExcelImporter extends TabularImportingParserBase {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
InputStream inputStream, InputStream inputStream,
int limit, int limit,
ObjectNode options, ObjectNode options,
@ -221,14 +222,14 @@ public class ExcelImporter extends TabularImportingParserBase {
metadata, metadata,
job, job,
dataReader, dataReader,
fileSource + "#" + sheet.getSheetName(), fileSource + "#" + sheet.getSheetName(), archiveFileName,
limit, limit,
options, options,
exceptions exceptions
); );
} }
super.parseOneFile(project, metadata, job, fileSource, inputStream, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, inputStream, limit, options, exceptions);
} }
static protected Cell extractCell(org.apache.poi.ss.usermodel.Cell cell) { static protected Cell extractCell(org.apache.poi.ss.usermodel.Cell cell) {

View File

@ -83,6 +83,7 @@ public class FixedWidthImporter extends TabularImportingParserBase {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
Reader reader, Reader reader,
int limit, int limit,
ObjectNode options, ObjectNode options,
@ -132,9 +133,9 @@ public class FixedWidthImporter extends TabularImportingParserBase {
} }
}; };
TabularImportingParserBase.readTable(project, metadata, job, dataReader, fileSource, limit, options, exceptions); TabularImportingParserBase.readTable(project, metadata, job, dataReader, fileSource, archiveFileName, limit, options, exceptions);
super.parseOneFile(project, metadata, job, fileSource, reader, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, reader, limit, options, exceptions);
} }
/** /**

View File

@ -71,7 +71,8 @@ abstract public class ImportingParserBase implements ImportingParser {
List<ObjectNode> fileRecords, String format) { List<ObjectNode> fileRecords, String format) {
ObjectNode options = ParsingUtilities.mapper.createObjectNode(); ObjectNode options = ParsingUtilities.mapper.createObjectNode();
JSONUtilities.safePut(options, "includeFileSources", fileRecords.size() > 1); JSONUtilities.safePut(options, "includeFileSources", fileRecords.size() > 1);
JSONUtilities.safePut(options, "includeArchiveFileName", ImportingUtilities.hasArchiveFileField(fileRecords));
return options; return options;
} }
@ -109,13 +110,14 @@ abstract public class ImportingParserBase implements ImportingParser {
) throws IOException { ) throws IOException {
final File file = ImportingUtilities.getFile(job, fileRecord); final File file = ImportingUtilities.getFile(job, fileRecord);
final String fileSource = ImportingUtilities.getFileSource(fileRecord); final String fileSource = ImportingUtilities.getFileSource(fileRecord);
final String archiveFileName = ImportingUtilities.getArchiveFileName(fileRecord);
progress.startFile(fileSource); progress.startFile(fileSource);
try { try {
InputStream inputStream = ImporterUtilities.openAndTrackFile(fileSource, file, progress); InputStream inputStream = ImporterUtilities.openAndTrackFile(fileSource, file, progress);
try { try {
if (useInputStream) { if (useInputStream) {
parseOneFile(project, metadata, job, fileSource, inputStream, limit, options, exceptions); parseOneFile(project, metadata, job, fileSource, archiveFileName, inputStream, limit, options, exceptions);
} else { } else {
String commonEncoding = JSONUtilities.getString(options, "encoding", null); String commonEncoding = JSONUtilities.getString(options, "encoding", null);
if (commonEncoding != null && commonEncoding.isEmpty()) { if (commonEncoding != null && commonEncoding.isEmpty()) {
@ -125,7 +127,7 @@ abstract public class ImportingParserBase implements ImportingParser {
Reader reader = ImportingUtilities.getReaderFromStream( Reader reader = ImportingUtilities.getReaderFromStream(
inputStream, fileRecord, commonEncoding); inputStream, fileRecord, commonEncoding);
parseOneFile(project, metadata, job, fileSource, reader, limit, options, exceptions); parseOneFile(project, metadata, job, fileSource, archiveFileName, reader, limit, options, exceptions);
} }
} finally { } finally {
inputStream.close(); inputStream.close();
@ -140,16 +142,18 @@ abstract public class ImportingParserBase implements ImportingParser {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
Reader reader, Reader reader,
int limit, int limit,
ObjectNode options, ObjectNode options,
List<Exception> exceptions List<Exception> exceptions
) { ) {
pushImportingOptions(metadata, fileSource, options); pushImportingOptions(metadata, "fileSource", fileSource, options);
pushImportingOptions(metadata, "archiveFileName", archiveFileName, options);
} }
private void pushImportingOptions(ProjectMetadata metadata, String fileSource, ObjectNode options) { private void pushImportingOptions(ProjectMetadata metadata, String key, String value, ObjectNode options) {
options.put("fileSource", fileSource); options.put(key, value);
// set the import options to metadata: // set the import options to metadata:
metadata.appendImportOptionMetadata(options); metadata.appendImportOptionMetadata(options);
} }
@ -159,21 +163,42 @@ abstract public class ImportingParserBase implements ImportingParser {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
InputStream inputStream, InputStream inputStream,
int limit, int limit,
ObjectNode options, ObjectNode options,
List<Exception> exceptions List<Exception> exceptions
) { ) {
pushImportingOptions(metadata, fileSource, options); pushImportingOptions(metadata, "fileSource", fileSource, options);
pushImportingOptions(metadata, "archiveFileName", archiveFileName, options);
} }
protected static int addFilenameColumn(Project project) { protected static int addFilenameColumn(Project project, boolean archiveColumnAdded) {
String fileNameColumnName = "File"; String fileNameColumnName = "File";
int columnId = archiveColumnAdded? 1 : 0;
if (project.columnModel.getColumnByName(fileNameColumnName) == null) { if (project.columnModel.getColumnByName(fileNameColumnName) == null) {
try { try {
project.columnModel.addColumn( project.columnModel.addColumn(
0, new Column(project.columnModel.allocateNewCellIndex(), fileNameColumnName), false); columnId, new Column(project.columnModel.allocateNewCellIndex(), fileNameColumnName), false);
return columnId;
} catch (ModelException e) {
// Shouldn't happen: We already checked for duplicate name.
logger.error("ModelException adding Filename column",e);
}
return -1;
} else {
return columnId;
}
}
protected static int addArchiveColumn(Project project) {
String ArchiveColumnName = "Archive";
if (project.columnModel.getColumnByName(ArchiveColumnName) == null) {
try {
project.columnModel.addColumn(
0, new Column(project.columnModel.allocateNewCellIndex(), ArchiveColumnName), false);
return 0; return 0;
} catch (ModelException e) { } catch (ModelException e) {

View File

@ -201,13 +201,13 @@ public class JsonImporter extends TreeImportingParserBase {
@Override @Override
public void parseOneFile(Project project, ProjectMetadata metadata, public void parseOneFile(Project project, ProjectMetadata metadata,
ImportingJob job, String fileSource, InputStream is, ImportingJob job, String fileSource, String archiveFileName, InputStream is,
ImportColumnGroup rootColumnGroup, int limit, ObjectNode options, List<Exception> exceptions) { ImportColumnGroup rootColumnGroup, int limit, ObjectNode options, List<Exception> exceptions) {
parseOneFile(project, metadata, job, fileSource, parseOneFile(project, metadata, job, fileSource, archiveFileName,
new JSONTreeReader(is), rootColumnGroup, limit, options, exceptions); new JSONTreeReader(is), rootColumnGroup, limit, options, exceptions);
super.parseOneFile(project, metadata, job, fileSource, is, rootColumnGroup, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, is, rootColumnGroup, limit, options, exceptions);
} }
static public class JSONTreeReader implements TreeReader { static public class JSONTreeReader implements TreeReader {

View File

@ -66,6 +66,7 @@ public class LineBasedImporter extends TabularImportingParserBase {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
Reader reader, Reader reader,
int limit, int limit,
ObjectNode options, ObjectNode options,
@ -129,8 +130,8 @@ public class LineBasedImporter extends TabularImportingParserBase {
} }
}; };
TabularImportingParserBase.readTable(project, metadata, job, dataReader, fileSource, limit, options, exceptions); TabularImportingParserBase.readTable(project, metadata, job, dataReader, fileSource, archiveFileName, limit, options, exceptions);
super.parseOneFile(project, metadata, job, fileSource, reader, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, reader, limit, options, exceptions);
} }
} }

View File

@ -126,6 +126,7 @@ public class OdsImporter extends TabularImportingParserBase {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
InputStream inputStream, InputStream inputStream,
int limit, int limit,
ObjectNode options, ObjectNode options,
@ -188,13 +189,14 @@ public class OdsImporter extends TabularImportingParserBase {
job, job,
dataReader, dataReader,
fileSource + "#" + table.getTableName(), fileSource + "#" + table.getTableName(),
archiveFileName,
limit, limit,
options, options,
exceptions exceptions
); );
} }
super.parseOneFile(project, metadata, job, fileSource, inputStream, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, inputStream, limit, options, exceptions);
} }
static protected Serializable extractCell(OdfTableCell cell) { static protected Serializable extractCell(OdfTableCell cell) {

View File

@ -76,7 +76,7 @@ public class RdfTripleImporter extends ImportingParserBase {
this.mode = mode; this.mode = mode;
} }
public void parseOneFile(Project project, ProjectMetadata metadata, ImportingJob job, String fileSource, public void parseOneFile(Project project, ProjectMetadata metadata, ImportingJob job, String fileSource, String archiveFileName,
InputStream input, int limit, ObjectNode options, List<Exception> exceptions) { InputStream input, int limit, ObjectNode options, List<Exception> exceptions) {
// create an empty model // create an empty model
Model model = ModelFactory.createDefaultModel(); Model model = ModelFactory.createDefaultModel();
@ -162,6 +162,6 @@ public class RdfTripleImporter extends ImportingParserBase {
exceptions.add(e); exceptions.add(e);
} }
super.parseOneFile(project, metadata, job, fileSource, input, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, input, limit, options, exceptions);
} }
} }

View File

@ -87,6 +87,7 @@ public class SeparatorBasedImporter extends TabularImportingParserBase {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
Reader reader, Reader reader,
int limit, int limit,
ObjectNode options, ObjectNode options,
@ -157,8 +158,8 @@ public class SeparatorBasedImporter extends TabularImportingParserBase {
} }
}; };
TabularImportingParserBase.readTable(project, metadata, job, dataReader, fileSource, limit, options, exceptions); TabularImportingParserBase.readTable(project, metadata, job, dataReader, fileSource, archiveFileName, limit, options, exceptions);
super.parseOneFile(project, metadata, job, fileSource, lnReader, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, lnReader, limit, options, exceptions);
} }
static protected ArrayList<Object> getCells(String line, CSVParser parser, LineNumberReader lnReader) static protected ArrayList<Object> getCells(String line, CSVParser parser, LineNumberReader lnReader)

View File

@ -83,6 +83,7 @@ abstract public class TabularImportingParserBase extends ImportingParserBase {
ImportingJob job, ImportingJob job,
TableDataReader reader, TableDataReader reader,
String fileSource, String fileSource,
String archiveFileName,
int limit, int limit,
ObjectNode options, ObjectNode options,
List<Exception> exceptions List<Exception> exceptions
@ -105,10 +106,14 @@ abstract public class TabularImportingParserBase extends ImportingParserBase {
boolean storeBlankCellsAsNulls = JSONUtilities.getBoolean(options, "storeBlankCellsAsNulls", true); boolean storeBlankCellsAsNulls = JSONUtilities.getBoolean(options, "storeBlankCellsAsNulls", true);
boolean includeFileSources = JSONUtilities.getBoolean(options, "includeFileSources", false); boolean includeFileSources = JSONUtilities.getBoolean(options, "includeFileSources", false);
boolean trimStrings = JSONUtilities.getBoolean(options, "trimStrings", false); boolean trimStrings = JSONUtilities.getBoolean(options, "trimStrings", false);
boolean includeArchiveFileName = JSONUtilities.getBoolean(options, "includeArchiveFileName", false);
int filenameColumnIndex = -1; int filenameColumnIndex = -1, archiveColumnIndex = -1;
if (includeArchiveFileName && archiveFileName != null) {
archiveColumnIndex = addArchiveColumn(project);
}
if (includeFileSources) { if (includeFileSources) {
filenameColumnIndex = addFilenameColumn(project); filenameColumnIndex = addFilenameColumn(project, archiveColumnIndex >=0);
} }
List<String> columnNames = new ArrayList<String>(); List<String> columnNames = new ArrayList<String>();
@ -187,10 +192,11 @@ abstract public class TabularImportingParserBase extends ImportingParserBase {
} }
if (rowHasData || storeBlankRows) { if (rowHasData || storeBlankRows) {
if (includeFileSources && filenameColumnIndex >= 0) { if (archiveColumnIndex >= 0) {
row.setCell( row.setCell(archiveColumnIndex, new Cell(archiveFileName, null));
filenameColumnIndex, }
new Cell(fileSource, null)); if (filenameColumnIndex >= 0) {
row.setCell(filenameColumnIndex, new Cell(fileSource, null));
} }
project.rows.add(row); project.rows.add(row);
} }
@ -206,8 +212,8 @@ abstract public class TabularImportingParserBase extends ImportingParserBase {
} }
} }
public void parseOneFile(Project project, ProjectMetadata metadata, ImportingJob job, String fileSource, public void parseOneFile(Project project, ProjectMetadata metadata, ImportingJob job, String fileSource, String archiveFileName,
Reader dataReader, int limit, ObjectNode options, List<Exception> exceptions) { Reader dataReader, int limit, ObjectNode options, List<Exception> exceptions) {
super.parseOneFile(project, metadata, job, fileSource, dataReader, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, dataReader, limit, options, exceptions);
} }
} }

View File

@ -691,6 +691,7 @@ public class WikitextImporter extends TabularImportingParserBase {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
Reader reader, Reader reader,
int limit, int limit,
ObjectNode options, ObjectNode options,
@ -749,7 +750,7 @@ public class WikitextImporter extends TabularImportingParserBase {
// TODO this does not seem to do anything - maybe we need to pass it to OpenRefine in some other way? // TODO this does not seem to do anything - maybe we need to pass it to OpenRefine in some other way?
} }
TabularImportingParserBase.readTable(project, metadata, job, dataReader, fileSource, limit, options, exceptions); TabularImportingParserBase.readTable(project, metadata, job, dataReader, fileSource, archiveFileName, limit, options, exceptions);
// Add reconciliation statistics // Add reconciliation statistics
if (dataReader.columnReconciled != null) { if (dataReader.columnReconciled != null) {
@ -768,7 +769,7 @@ public class WikitextImporter extends TabularImportingParserBase {
e1.printStackTrace(); e1.printStackTrace();
} }
super.parseOneFile(project, metadata, job, fileSource, reader, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, reader, limit, options, exceptions);
} }
private StandardReconConfig getReconConfig(String url) { private StandardReconConfig getReconConfig(String url) {

View File

@ -193,15 +193,15 @@ public class XmlImporter extends TreeImportingParserBase {
@Override @Override
public void parseOneFile(Project project, ProjectMetadata metadata, public void parseOneFile(Project project, ProjectMetadata metadata,
ImportingJob job, String fileSource, InputStream inputStream, ImportingJob job, String fileSource, String archiveFileName, InputStream inputStream,
ImportColumnGroup rootColumnGroup, int limit, ObjectNode options, ImportColumnGroup rootColumnGroup, int limit, ObjectNode options,
List<Exception> exceptions) { List<Exception> exceptions) {
try { try {
parseOneFile(project, metadata, job, fileSource, parseOneFile(project, metadata, job, fileSource, archiveFileName,
new XmlParser(inputStream), rootColumnGroup, limit, options, exceptions); new XmlParser(inputStream), rootColumnGroup, limit, options, exceptions);
super.parseOneFile(project, metadata, job, fileSource, inputStream, rootColumnGroup, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, inputStream, rootColumnGroup, limit, options, exceptions);
} catch (XMLStreamException e) { } catch (XMLStreamException e) {
exceptions.add(e); exceptions.add(e);
} catch (IOException e) { } catch (IOException e) {

View File

@ -33,18 +33,22 @@ public class ImportParameters {
protected boolean guessDataType; protected boolean guessDataType;
protected boolean includeFileSources; protected boolean includeFileSources;
protected String fileSource; protected String fileSource;
protected boolean includeArchiveFileName;
protected String archiveFileName;
public ImportParameters(boolean trimStrings, boolean storeEmptyStrings, boolean guessCellValueTypes, public ImportParameters(boolean trimStrings, boolean storeEmptyStrings, boolean guessCellValueTypes,
boolean includeFileSources, String fileSource) { boolean includeFileSources, String fileSource, boolean includeArchiveFileName, String archiveFileName) {
this.trimStrings = trimStrings; this.trimStrings = trimStrings;
this.storeEmptyStrings = storeEmptyStrings; this.storeEmptyStrings = storeEmptyStrings;
this.guessDataType = guessCellValueTypes; this.guessDataType = guessCellValueTypes;
this.includeFileSources = includeFileSources; this.includeFileSources = includeFileSources;
this.fileSource = fileSource; this.fileSource = fileSource;
this.includeArchiveFileName = includeArchiveFileName;
this.archiveFileName = archiveFileName;
} }
public ImportParameters(boolean trimStrings, boolean storeEmptyStrings, boolean guessCellValueTypes) { public ImportParameters(boolean trimStrings, boolean storeEmptyStrings, boolean guessCellValueTypes) {
this(trimStrings, storeEmptyStrings, guessCellValueTypes, false, ""); this(trimStrings, storeEmptyStrings, guessCellValueTypes, false, "", false, "");
} }
} }

View File

@ -112,13 +112,14 @@ abstract public class TreeImportingParserBase extends ImportingParserBase {
) throws IOException { ) throws IOException {
final File file = ImportingUtilities.getFile(job, fileRecord); final File file = ImportingUtilities.getFile(job, fileRecord);
final String fileSource = ImportingUtilities.getFileSource(fileRecord); final String fileSource = ImportingUtilities.getFileSource(fileRecord);
final String archiveFileName = ImportingUtilities.getArchiveFileName(fileRecord);
progress.startFile(fileSource); progress.startFile(fileSource);
try { try {
InputStream inputStream = ImporterUtilities.openAndTrackFile(fileSource, file, progress); InputStream inputStream = ImporterUtilities.openAndTrackFile(fileSource, file, progress);
try { try {
if (useInputStream) { if (useInputStream) {
parseOneFile(project, metadata, job, fileSource, inputStream, parseOneFile(project, metadata, job, fileSource, archiveFileName, inputStream,
rootColumnGroup, limit, options, exceptions); rootColumnGroup, limit, options, exceptions);
} else { } else {
String commonEncoding = JSONUtilities.getString(options, "encoding", null); String commonEncoding = JSONUtilities.getString(options, "encoding", null);
@ -127,7 +128,7 @@ abstract public class TreeImportingParserBase extends ImportingParserBase {
} }
Reader reader = ImportingUtilities.getFileReader(file, fileRecord, commonEncoding); Reader reader = ImportingUtilities.getFileReader(file, fileRecord, commonEncoding);
parseOneFile(project, metadata, job, fileSource, reader, parseOneFile(project, metadata, job, fileSource, archiveFileName, reader,
rootColumnGroup, limit, options, exceptions); rootColumnGroup, limit, options, exceptions);
} }
} finally { } finally {
@ -149,6 +150,7 @@ abstract public class TreeImportingParserBase extends ImportingParserBase {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
Reader reader, Reader reader,
ImportColumnGroup rootColumnGroup, ImportColumnGroup rootColumnGroup,
int limit, int limit,
@ -169,6 +171,7 @@ abstract public class TreeImportingParserBase extends ImportingParserBase {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
InputStream inputStream, InputStream inputStream,
ImportColumnGroup rootColumnGroup, ImportColumnGroup rootColumnGroup,
int limit, int limit,
@ -176,7 +179,7 @@ abstract public class TreeImportingParserBase extends ImportingParserBase {
List<Exception> exceptions List<Exception> exceptions
) { ) {
// throw new NotImplementedException(); // throw new NotImplementedException();
super.parseOneFile(project, metadata, job, fileSource, inputStream, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, archiveFileName, inputStream, limit, options, exceptions);
} }
/** /**
@ -188,6 +191,7 @@ abstract public class TreeImportingParserBase extends ImportingParserBase {
ProjectMetadata metadata, ProjectMetadata metadata,
ImportingJob job, ImportingJob job,
String fileSource, String fileSource,
String archiveFileName,
TreeReader treeParser, TreeReader treeParser,
ImportColumnGroup rootColumnGroup, ImportColumnGroup rootColumnGroup,
int limit, int limit,
@ -214,17 +218,26 @@ abstract public class TreeImportingParserBase extends ImportingParserBase {
boolean guessCellValueTypes = JSONUtilities.getBoolean(options, "guessCellValueTypes", true); boolean guessCellValueTypes = JSONUtilities.getBoolean(options, "guessCellValueTypes", true);
boolean includeFileSources = JSONUtilities.getBoolean(options, "includeFileSources", false); boolean includeFileSources = JSONUtilities.getBoolean(options, "includeFileSources", false);
int filenameColumnIndex = -1; boolean includeArchiveFileName = JSONUtilities.getBoolean(options, "includeArchiveFileName", false);
int filenameColumnIndex = -1, archiveColumnIndex = -1;
if (includeArchiveFileName && archiveFileName != null) {
archiveColumnIndex = addArchiveColumn(project);
assert archiveColumnIndex == 0;
}
if (includeFileSources) { if (includeFileSources) {
filenameColumnIndex = addFilenameColumn(project); filenameColumnIndex = addFilenameColumn(project, includeArchiveFileName);
// If the column add fails for any reason, we'll end up overwriting data in the first column // If the column add fails for any reason, we'll end up overwriting data in the first column
assert filenameColumnIndex == 0; if (includeArchiveFileName) {
assert filenameColumnIndex == 1;
} else {
assert filenameColumnIndex == 0;
}
} }
try { try {
XmlImportUtilities.importTreeData(treeParser, project, recordPath, rootColumnGroup, limit2, XmlImportUtilities.importTreeData(treeParser, project, recordPath, rootColumnGroup, limit2,
new ImportParameters(trimStrings, storeEmptyStrings, guessCellValueTypes, includeFileSources, new ImportParameters(trimStrings, storeEmptyStrings, guessCellValueTypes, includeFileSources,
fileSource)); fileSource, includeArchiveFileName, archiveFileName));
} catch (Exception e){ } catch (Exception e){
exceptions.add(e); exceptions.add(e);
} }

View File

@ -359,7 +359,7 @@ public class XmlImportUtilities extends TreeImportUtilities {
ImportRecord record = new ImportRecord(); ImportRecord record = new ImportRecord();
processSubRecord(project, parser, rootColumnGroup, record, 0, parameter); processSubRecord(project, parser, rootColumnGroup, record, 0, parameter);
addImportRecordToProject(record, project, parameter.includeFileSources, parameter.fileSource); addImportRecordToProject(record, project, parameter.includeFileSources, parameter.fileSource, parameter.includeArchiveFileName, parameter.archiveFileName);
} }
@ -411,20 +411,29 @@ public class XmlImportUtilities extends TreeImportUtilities {
} }
if (record != null) { if (record != null) {
addImportRecordToProject(record, project, addImportRecordToProject(record, project,
parameter.includeFileSources, parameter.fileSource); parameter.includeFileSources, parameter.fileSource, parameter.includeArchiveFileName, parameter.archiveFileName);
} }
} }
static protected void addImportRecordToProject(ImportRecord record, Project project, static protected void addImportRecordToProject(ImportRecord record, Project project,
boolean includeFileSources, String fileSource) { boolean includeFileSources, String fileSource, boolean includeArchiveFileName, String archiveFileName) {
int archiveColumnIndex = -1, fileSourceColumnIndex = -1;
if (includeArchiveFileName && archiveFileName != null) {
archiveColumnIndex = 0;
}
if (includeFileSources) {
fileSourceColumnIndex = archiveColumnIndex == 0? 1 : 0;
}
for (List<Cell> row : record.rows) { for (List<Cell> row : record.rows) {
if (row.size() > 0) { if (row.size() > 0) {
Row realRow = new Row(row.size()); Row realRow = new Row(row.size());
for (int c = 0; c < row.size(); c++) { for (int c = 0; c < row.size(); c++) {
if (c == 0 && includeFileSources) { // to add the file source: if (c == archiveColumnIndex) {
realRow.setCell( realRow.setCell(archiveColumnIndex, new Cell(archiveFileName, null));
0, continue;
new Cell(fileSource, null)); }
if (c == fileSourceColumnIndex) {
realRow.setCell(fileSourceColumnIndex, new Cell(fileSource, null));
continue; continue;
} }
Cell cell = row.get(c); Cell cell = row.get(c);

View File

@ -89,6 +89,7 @@ import com.google.refine.importing.UrlRewriter.Result;
import com.google.refine.model.Project; import com.google.refine.model.Project;
import com.google.refine.util.JSONUtilities; import com.google.refine.util.JSONUtilities;
import com.google.refine.util.ParsingUtilities; import com.google.refine.util.ParsingUtilities;
import java.util.stream.Collectors;
public class ImportingUtilities { public class ImportingUtilities {
final static protected Logger logger = LoggerFactory.getLogger("importing-utilities"); final static protected Logger logger = LoggerFactory.getLogger("importing-utilities");
@ -499,7 +500,20 @@ public class ImportingUtilities {
JSONUtilities.getString(fileRecord, "fileName", "unknown") JSONUtilities.getString(fileRecord, "fileName", "unknown")
); );
} }
static public String getArchiveFileName(ObjectNode fileRecord) {
return JSONUtilities.getString(
fileRecord,
"archiveFileName",
null
);
}
static public boolean hasArchiveFileField(List<ObjectNode> fileRecords) {
List<ObjectNode> filterResults = fileRecords.stream().filter(fileRecord -> getArchiveFileName(fileRecord) != null).collect(Collectors.toList());
return filterResults.size() > 0;
}
static private abstract class SavingUpdate { static private abstract class SavingUpdate {
public long totalExpectedSize = 0; public long totalExpectedSize = 0;
public long totalRetrievedSize = 0; public long totalRetrievedSize = 0;

View File

@ -175,7 +175,7 @@ public class RefineTest extends PowerMockTestCase {
SeparatorBasedImporter importer = new SeparatorBasedImporter(); SeparatorBasedImporter importer = new SeparatorBasedImporter();
List<Exception> exceptions = new ArrayList<Exception>(); List<Exception> exceptions = new ArrayList<Exception>();
importer.parseOneFile(project, metadata, job, "filesource", new StringReader(input), -1, options, exceptions); importer.parseOneFile(project, metadata, job, "filesource", "archivefile", new StringReader(input), -1, options, exceptions);
project.update(); project.update();
ProjectManager.singleton.registerProject(project, metadata); ProjectManager.singleton.registerProject(project, metadata);

View File

@ -114,7 +114,7 @@ public class ExcelImporterTests extends ImporterTest {
whenGetIntegerOption("skipDataLines", options, 0); whenGetIntegerOption("skipDataLines", options, 0);
whenGetIntegerOption("limit", options, -1); whenGetIntegerOption("limit", options, -1);
whenGetBooleanOption("storeBlankCellsAsNulls",options,true); whenGetBooleanOption("storeBlankCellsAsNulls",options,true);
InputStream stream = new FileInputStream(xlsFile); InputStream stream = new FileInputStream(xlsFile);
try { try {
@ -140,6 +140,35 @@ public class ExcelImporterTests extends ImporterTest {
verify(options, times(1)).get("limit"); verify(options, times(1)).get("limit");
verify(options, times(1)).get("storeBlankCellsAsNulls"); verify(options, times(1)).get("storeBlankCellsAsNulls");
} }
@Test
public void readXlsFromArchiveFile() throws FileNotFoundException, IOException{
ArrayNode sheets = ParsingUtilities.mapper.createArrayNode();
sheets.add(ParsingUtilities.mapper.readTree("{name: \"file-source#Test Sheet 0\", fileNameAndSheetIndex: \"file-source#0\", rows: 31, selected: true}"));
whenGetArrayOption("sheets", options, sheets);
whenGetIntegerOption("ignoreLines", options, 0);
whenGetIntegerOption("headerLines", options, 0);
whenGetIntegerOption("skipDataLines", options, 0);
whenGetIntegerOption("limit", options, -1);
whenGetBooleanOption("storeBlankCellsAsNulls",options,true);
whenGetBooleanOption("includeArchiveFileName", options, true);
InputStream stream = new FileInputStream(xlsFile);
try {
parseOneFile(SUT, stream);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertEquals(project.rows.get(0).cells.size(), COLUMNS + 1);
Assert.assertEquals(project.columnModel.columns.get(0).getName(), "Archive");
Assert.assertEquals(project.rows.get(0).cells.get(0).value, "archive-file");
verify(options, times(1)).get("includeArchiveFileName");
}
@Test @Test
public void readXlsx() throws FileNotFoundException, IOException{ public void readXlsx() throws FileNotFoundException, IOException{

View File

@ -90,7 +90,7 @@ public class FixedWidthImporterTests extends ImporterTest {
whenGetIntegerOption("skipDataLines", options, 0); whenGetIntegerOption("skipDataLines", options, 0);
whenGetIntegerOption("limit", options, -1); whenGetIntegerOption("limit", options, -1);
whenGetBooleanOption("storeBlankCellsAsNulls",options,true); whenGetBooleanOption("storeBlankCellsAsNulls",options,true);
try { try {
parseOneFile(SUT, reader); parseOneFile(SUT, reader);
} catch (Exception e) { } catch (Exception e) {
@ -107,4 +107,38 @@ public class FixedWidthImporterTests extends ImporterTest {
Assert.assertEquals((String)project.rows.get(2).getCellValue(1), "rt"); Assert.assertEquals((String)project.rows.get(2).getCellValue(1), "rt");
Assert.assertNull(project.rows.get(2).getCellValue(2)); Assert.assertNull(project.rows.get(2).getCellValue(2));
} }
@Test
public void readFixedWidthFromArchiveFile(){
StringReader reader = new StringReader(SAMPLE_ROW + "\nTooShort");
ArrayNode columnWidths = ParsingUtilities.mapper.createArrayNode();
JSONUtilities.append(columnWidths, 6);
JSONUtilities.append(columnWidths, 9);
JSONUtilities.append(columnWidths, 5);
whenGetArrayOption("columnWidths", options, columnWidths);
ArrayNode columnNames = ParsingUtilities.mapper.createArrayNode();
columnNames.add("Col 1");
columnNames.add("Col 2");
columnNames.add("Col 3");
whenGetArrayOption("columnNames", options, columnNames);
whenGetIntegerOption("ignoreLines", options, 0);
whenGetIntegerOption("headerLines", options, 0);
whenGetIntegerOption("skipDataLines", options, 0);
whenGetIntegerOption("limit", options, -1);
whenGetBooleanOption("storeBlankCellsAsNulls",options,true);
whenGetBooleanOption("includeArchiveFileName", options, true);
try {
parseOneFile(SUT, reader);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertEquals(project.rows.get(0).cells.size(), 4);
Assert.assertEquals(project.columnModel.columns.get(0).getName(), "Archive");
Assert.assertEquals(project.rows.get(0).cells.get(0).value, "archive-file");
}
} }

View File

@ -90,6 +90,7 @@ public abstract class ImporterTest extends RefineTest {
metadata, metadata,
job, job,
"file-source", "file-source",
"archive-file",
reader, reader,
-1, -1,
options, options,
@ -104,6 +105,7 @@ public abstract class ImporterTest extends RefineTest {
metadata, metadata,
job, job,
"file-source", "file-source",
"archive-file",
inputStream, inputStream,
-1, -1,
options, options,
@ -119,6 +121,7 @@ public abstract class ImporterTest extends RefineTest {
metadata, metadata,
job, job,
"file-source", "file-source",
"archive-file",
reader, reader,
rootColumnGroup, rootColumnGroup,
-1, -1,
@ -143,6 +146,7 @@ public abstract class ImporterTest extends RefineTest {
metadata, metadata,
job, job,
"file-source", "file-source",
"archive-file",
inputStream, inputStream,
rootColumnGroup, rootColumnGroup,
-1, -1,
@ -163,6 +167,7 @@ public abstract class ImporterTest extends RefineTest {
metadata, metadata,
job, job,
"file-source", "file-source",
"archive-file",
reader, reader,
rootColumnGroup, rootColumnGroup,
-1, -1,

View File

@ -135,6 +135,7 @@ public class JsonImporterTests extends ImporterTest {
metadata, metadata,
job, job,
"file-source", "file-source",
"archive-file",
inputStream, inputStream,
rootColumnGroup, rootColumnGroup,
-1, -1,

View File

@ -118,6 +118,27 @@ public class TsvCsvImporterTests extends ImporterTest {
Assert.assertEquals(project.rows.get(0).cells.get(2).value, "data3"); Assert.assertEquals(project.rows.get(0).cells.get(2).value, "data3");
} }
@Test(dataProvider = "CSV-TSV-AutoDetermine")
public void readSimpleData_CSV_fromArchiveFileName(String sep){
//create input to test with
String inputSeparator = sep == null ? "\t" : sep;
String input = "col1" + inputSeparator + "col2" + inputSeparator + "col3\n" +
"data1" + inputSeparator + "data2" + inputSeparator + "data3";
try {
prepareOptions(sep, -1, 0, 0, 1, false, false,"\"","[]", true);
parseOneFile(SUT, new StringReader(input));
} catch (Exception e) {
Assert.fail("Exception during file parse",e);
}
Assert.assertEquals(project.columnModel.columns.size(), 4);
Assert.assertEquals(project.columnModel.columns.get(0).getName(), "Archive");
Assert.assertEquals(project.rows.get(0).cells.size(), 4);
Assert.assertEquals(project.rows.get(0).cells.get(0).value, "archive-file");
}
@Test(dataProvider = "CSV-TSV-AutoDetermine") @Test(dataProvider = "CSV-TSV-AutoDetermine")
public void readSimpleData_CSV_1Header_1Row_GuessValues(String sep){ public void readSimpleData_CSV_1Header_1Row_GuessValues(String sep){
//create input to test with //create input to test with
@ -579,7 +600,7 @@ public class TsvCsvImporterTests extends ImporterTest {
String input = "data1" + inputSeparator + "data2" + inputSeparator + "data3\n"; String input = "data1" + inputSeparator + "data2" + inputSeparator + "data3\n";
try { try {
prepareOptions(sep, -1, 0, 0, 1, false, false,"\"","[\"col1\",\"col2\",\"col3\"]"); prepareOptions(sep, -1, 0, 0, 1, false, false,"\"","[\"col1\",\"col2\",\"col3\"]", false);
parseOneFile(SUT, new StringReader(input)); parseOneFile(SUT, new StringReader(input));
} catch (Exception e) { } catch (Exception e) {
Assert.fail("Exception during file parse",e); Assert.fail("Exception during file parse",e);
@ -655,7 +676,7 @@ public class TsvCsvImporterTests extends ImporterTest {
String sep, int limit, int skip, int ignoreLines, String sep, int limit, int skip, int ignoreLines,
int headerLines, boolean guessValueType, boolean ignoreQuotes, String quoteCharacter) { int headerLines, boolean guessValueType, boolean ignoreQuotes, String quoteCharacter) {
prepareOptions(sep, limit, skip, ignoreLines, headerLines, guessValueType, ignoreQuotes, quoteCharacter,"[]"); prepareOptions(sep, limit, skip, ignoreLines, headerLines, guessValueType, ignoreQuotes, quoteCharacter,"[]", false);
} }
protected void prepareOptions( protected void prepareOptions(
@ -673,7 +694,7 @@ public class TsvCsvImporterTests extends ImporterTest {
protected void prepareOptions( protected void prepareOptions(
String sep, int limit, int skip, int ignoreLines, String sep, int limit, int skip, int ignoreLines,
int headerLines, boolean guessValueType, boolean ignoreQuotes, String quoteCharacter, String columnNames) { int headerLines, boolean guessValueType, boolean ignoreQuotes, String quoteCharacter, String columnNames, boolean includeArchiveFileName) {
whenGetStringOption("separator", options, sep); whenGetStringOption("separator", options, sep);
whenGetStringOption("quoteCharacter", options, quoteCharacter); whenGetStringOption("quoteCharacter", options, quoteCharacter);
@ -685,5 +706,6 @@ public class TsvCsvImporterTests extends ImporterTest {
whenGetBooleanOption("processQuotes", options, !ignoreQuotes); whenGetBooleanOption("processQuotes", options, !ignoreQuotes);
whenGetBooleanOption("storeBlankCellsAsNulls", options, true); whenGetBooleanOption("storeBlankCellsAsNulls", options, true);
whenGetArrayOption("columnNames", options, ParsingUtilities.evaluateJsonStringToArrayNode(columnNames)); whenGetArrayOption("columnNames", options, ParsingUtilities.evaluateJsonStringToArrayNode(columnNames));
whenGetBooleanOption("includeArchiveFileName", options, includeArchiveFileName);
} }
} }

View File

@ -202,7 +202,7 @@ public class KeyValueColumnizeTests extends RefineTest {
+ "price,3.1\n"; + "price,3.1\n";
prepareOptions(",", 20, 0, 0, 1, false, false); prepareOptions(",", 20, 0, 0, 1, false, false);
List<Exception> exceptions = new ArrayList<Exception>(); List<Exception> exceptions = new ArrayList<Exception>();
importer.parseOneFile(project, pm, job, "filesource", new StringReader(csv), -1, options, exceptions); importer.parseOneFile(project, pm, job, "filesource", "archivefile", new StringReader(csv), -1, options, exceptions);
project.update(); project.update();
ProjectManager.singleton.registerProject(project, pm); ProjectManager.singleton.registerProject(project, pm);

View File

@ -123,7 +123,8 @@
"core-index-parser/tabs": "mga tab (TSV)", "core-index-parser/tabs": "mga tab (TSV)",
"core-index-parser/escape": "Tangtanga ang espesyal nga karakter uban ni \\", "core-index-parser/escape": "Tangtanga ang espesyal nga karakter uban ni \\",
"core-index-parser/lines-header": "Mga linya nga nagsugod sa kolum", "core-index-parser/lines-header": "Mga linya nga nagsugod sa kolum",
"core-index-parser/store-source": "Pagbutang ug gigikan sa papeles<br/> 1(file names, URLs)<br/> 2sa kada laray", "core-index-parser/store-source": "Pagbutang ug gigikan sa papeles",
"core-index-parser/store-archive": "ibutang ang file archive",
"core-index-parser/use-quote": "Gamit ug karakter", "core-index-parser/use-quote": "Gamit ug karakter",
"core-index-parser/ignore-first": "Ibaliwala ug una", "core-index-parser/ignore-first": "Ibaliwala ug una",
"core-index-parser/quote-delimits-cells": "para isarado ang cells nga adunay kolum nga ibulag", "core-index-parser/quote-delimits-cells": "para isarado ang cells nga adunay kolum nga ibulag",

View File

@ -123,7 +123,8 @@
"core-index-parser/tabs": "Tabs (TSV)", "core-index-parser/tabs": "Tabs (TSV)",
"core-index-parser/escape": "Markiere Sonderzeichen mit \\", "core-index-parser/escape": "Markiere Sonderzeichen mit \\",
"core-index-parser/lines-header": "Zeile(n) als Spaltenüberschriften", "core-index-parser/lines-header": "Zeile(n) als Spaltenüberschriften",
"core-index-parser/store-source": "Dateiquelle in jeder<br/>Zeile speichern<br/>(Dateinamen, URLs)", "core-index-parser/store-source": "Dateiquelle speichern",
"core-index-parser/store-archive": "Archivdatei speichern",
"core-index-parser/use-quote": "Zeichen verwenden", "core-index-parser/use-quote": "Zeichen verwenden",
"core-index-parser/ignore-first": "Erste ignorieren", "core-index-parser/ignore-first": "Erste ignorieren",
"core-index-parser/quote-delimits-cells": "zum Einschließen von Zellen mit Spaltentrennern", "core-index-parser/quote-delimits-cells": "zum Einschließen von Zellen mit Spaltentrennern",

View File

@ -139,7 +139,8 @@
"core-index-parser/parse-references": "Extract references in additional columns", "core-index-parser/parse-references": "Extract references in additional columns",
"core-index-parser/wiki-base-url": "Reconcile to wiki with base URL:", "core-index-parser/wiki-base-url": "Reconcile to wiki with base URL:",
"core-index-parser/invalid-wikitext": "No table could be parsed. Are you sure this is a valid wiki table?", "core-index-parser/invalid-wikitext": "No table could be parsed. Are you sure this is a valid wiki table?",
"core-index-parser/store-source": "Store file source <br/>(file names, URLs)<br/>in each row", "core-index-parser/store-source": "Store file source",
"core-index-parser/store-archive": "Store archive file",
"core-index-parser/preserve-empty": "Preserve empty strings", "core-index-parser/preserve-empty": "Preserve empty strings",
"core-index-parser/trim": "Trim leading &amp; trailing whitespace from strings", "core-index-parser/trim": "Trim leading &amp; trailing whitespace from strings",
"core-index-parser/json-parser": "Click on the first JSON { } node corresponding to the first record to load.", "core-index-parser/json-parser": "Click on the first JSON { } node corresponding to the first record to load.",

View File

@ -121,7 +121,8 @@
"core-index-parser/parse-next": "Seleccionar primera(s)", "core-index-parser/parse-next": "Seleccionar primera(s)",
"core-index-parser/commas": "comas (CSV)", "core-index-parser/commas": "comas (CSV)",
"core-index-parser/tabs": "tabulaciones (TSV)", "core-index-parser/tabs": "tabulaciones (TSV)",
"core-index-parser/store-source": "Cargar el origen del archivo<br/>(nombres, URLs)<br/>en cada fila", "core-index-parser/store-source": "Cargar el origen del archivo",
"core-index-parser/store-archive": "almacenar archivo de almacenamiento",
"core-index-parser/lines-header": "linea(s) para los nombres de las columnas", "core-index-parser/lines-header": "linea(s) para los nombres de las columnas",
"core-index-parser/escape": "Ignorar caracteres especiales con \\", "core-index-parser/escape": "Ignorar caracteres especiales con \\",
"core-index-parser/ignore-first": "Ignorar primera(s)", "core-index-parser/ignore-first": "Ignorar primera(s)",

View File

@ -123,7 +123,8 @@
"core-index-parser/tabs": "mga tab (TSV)", "core-index-parser/tabs": "mga tab (TSV)",
"core-index-parser/escape": "Eskapo ang mga espesyal na character na may \\", "core-index-parser/escape": "Eskapo ang mga espesyal na character na may \\",
"core-index-parser/lines-header": "(mga) linya bilang mga header ng hanay", "core-index-parser/lines-header": "(mga) linya bilang mga header ng hanay",
"core-index-parser/store-source": "I-imbak ang pinagmulang file <br/> 1 (mga pangalan ng file, mga URL) <br/> 2in sa bawat hilera", "core-index-parser/store-source": "pinagmulan ng file file",
"core-index-parser/store-archive": "mag-imbak ng file archive",
"core-index-parser/use-quote": "Gamitin ang character", "core-index-parser/use-quote": "Gamitin ang character",
"core-index-parser/ignore-first": "Huwag pansinin muna", "core-index-parser/ignore-first": "Huwag pansinin muna",
"core-index-parser/quote-delimits-cells": "upang masakop ang mga cell na naglalaman ng mga separator ng haligi", "core-index-parser/quote-delimits-cells": "upang masakop ang mga cell na naglalaman ng mga separator ng haligi",

View File

@ -124,7 +124,8 @@
"core-index-parser/parse-next": "Analyser la ou les", "core-index-parser/parse-next": "Analyser la ou les",
"core-index-parser/commas": "une virgule (CSV)", "core-index-parser/commas": "une virgule (CSV)",
"core-index-parser/tabs": "une tabulation (TSV)", "core-index-parser/tabs": "une tabulation (TSV)",
"core-index-parser/store-source": "Indiquer la source du fichier<br/>(noms des fichiers, URLs)<br/>dans chaque ligne", "core-index-parser/store-source": "Indiquer la source du fichier",
"core-index-parser/store-archive": "stocker le fichier d'archive",
"core-index-parser/lines-header": "ligne(s) suivante(s) comme des entêtes de colonnes", "core-index-parser/lines-header": "ligne(s) suivante(s) comme des entêtes de colonnes",
"core-index-parser/escape": "Protéger les caractères spéciaux avec \\", "core-index-parser/escape": "Protéger les caractères spéciaux avec \\",
"core-index-parser/use-quote": "Utiliser le caractère", "core-index-parser/use-quote": "Utiliser le caractère",

View File

@ -102,7 +102,8 @@
"core-index-parser/parse-cell": "נתח תוכן התא כ <br/>מספרים, תאריכים וכו' ...", "core-index-parser/parse-cell": "נתח תוכן התא כ <br/>מספרים, תאריכים וכו' ...",
"core-index-parser/store-blank": "אכסון שורות ריקות", "core-index-parser/store-blank": "אכסון שורות ריקות",
"core-index-parser/store-nulls": "אכסון תאים ריקים כ-nulls", "core-index-parser/store-nulls": "אכסון תאים ריקים כ-nulls",
"core-index-parser/store-source": "אכסון קובץ המקור <br/>(file names, URLs)<br/>בכל שורה", "core-index-parser/store-source": "אחסן את מקור הקבצים",
"core-index-parser/store-archive": "אחסן קובץ ארכיב",
"core-index-parser/preserve-empty": "שימור מחרוזות ריקות", "core-index-parser/preserve-empty": "שימור מחרוזות ריקות",
"core-index-parser/trim": "חיתוך רווחים מקדימים ממחרוזות &amp; ", "core-index-parser/trim": "חיתוך רווחים מקדימים ממחרוזות &amp; ",
"core-index-parser/json-parser": "הקליקו על צומת הג'ייסון {} התואם לרשומה הראשונה לטעינה.", "core-index-parser/json-parser": "הקליקו על צומת הג'ייסון {} התואם לרשומה הראשונה לטעינה.",

View File

@ -123,7 +123,8 @@
"core-index-parser/tabs": "tabulátor (TSV)", "core-index-parser/tabs": "tabulátor (TSV)",
"core-index-parser/escape": "Különleges karakterek feloldása ezzel \\", "core-index-parser/escape": "Különleges karakterek feloldása ezzel \\",
"core-index-parser/lines-header": "sort mint oszlopfejlécet", "core-index-parser/lines-header": "sort mint oszlopfejlécet",
"core-index-parser/store-source": "Fájlforrás <br/>(fájlnév, URL) <br/>tárolása minden sorban", "core-index-parser/store-source": "Tárolja a fájlforrást",
"core-index-parser/store-archive": "Tárolja az archívum fájlt",
"core-index-parser/use-quote": "Használja a", "core-index-parser/use-quote": "Használja a",
"core-index-parser/ignore-first": "Hagyja ki az első", "core-index-parser/ignore-first": "Hagyja ki az első",
"core-index-parser/quote-delimits-cells": "karaktert az oszlopelválasztót tartalmazó cellák befoglalására", "core-index-parser/quote-delimits-cells": "karaktert az oszlopelválasztót tartalmazó cellák befoglalására",

View File

@ -121,7 +121,8 @@
"core-index-parser/parse-next": "Analizza la/e prossima/e", "core-index-parser/parse-next": "Analizza la/e prossima/e",
"core-index-parser/commas": "virgole (CSV)", "core-index-parser/commas": "virgole (CSV)",
"core-index-parser/tabs": "tabs (TSV)", "core-index-parser/tabs": "tabs (TSV)",
"core-index-parser/store-source": "Salva la sorgente <br/>(nome file, URLs)<br/>in ogni riga", "core-index-parser/store-source": "Salva la sorgente",
"core-index-parser/store-archive": "Salva il file di archivio",
"core-index-parser/lines-header": "linea/e come nomi delle colonne", "core-index-parser/lines-header": "linea/e come nomi delle colonne",
"core-index-parser/escape": "Effettua l'escape di caratteri speciali con \\", "core-index-parser/escape": "Effettua l'escape di caratteri speciali con \\",
"core-index-parser/use-quote": "Usa character", "core-index-parser/use-quote": "Usa character",

View File

@ -123,6 +123,7 @@
"core-index-parser/tabs": "タブTSV", "core-index-parser/tabs": "タブTSV",
"core-index-parser/escape": "特殊文字はバックスラッシュでエスケープしてください", "core-index-parser/escape": "特殊文字はバックスラッシュでエスケープしてください",
"core-index-parser/lines-header": "行分", "core-index-parser/lines-header": "行分",
"core-index-parser/store-archive": "アーカイブファイルの保存",
"core-index-parser/store-source": "ソースファイル<br/>ファイル名やURLを<br/>各行に保存する", "core-index-parser/store-source": "ソースファイル<br/>ファイル名やURLを<br/>各行に保存する",
"core-index-parser/use-quote": "文字", "core-index-parser/use-quote": "文字",
"core-index-parser/ignore-first": "先頭を無視", "core-index-parser/ignore-first": "先頭を無視",

View File

@ -120,7 +120,8 @@
"core-index-parser/parse-references": "Trekk ut referanser i ekstra kolonner", "core-index-parser/parse-references": "Trekk ut referanser i ekstra kolonner",
"core-index-parser/wiki-base-url": "Avstem mot wiki med rotnettadresse:", "core-index-parser/wiki-base-url": "Avstem mot wiki med rotnettadresse:",
"core-index-parser/invalid-wikitext": "Ingen tabell kunne fortolkes. Er du sikker på at dette er en gyldig wikitabell?", "core-index-parser/invalid-wikitext": "Ingen tabell kunne fortolkes. Er du sikker på at dette er en gyldig wikitabell?",
"core-index-parser/store-source": "Lagre filkilde<br/>(filnavn, URL-er)<br/>i hver rad", "core-index-parser/store-source": "Lagre filkilde",
"core-index-parser/store-archive": "Gem arkivfil",
"core-index-parser/preserve-empty": "Bevar tomme strenger", "core-index-parser/preserve-empty": "Bevar tomme strenger",
"core-index-parser/trim": "Fjern innledende og avsluttende tomrom fra strenger", "core-index-parser/trim": "Fjern innledende og avsluttende tomrom fra strenger",
"core-index-parser/col-separated-by": "Kolonner adskilles av", "core-index-parser/col-separated-by": "Kolonner adskilles av",

View File

@ -128,7 +128,8 @@
"core-index-parser/include-raw-templates": "Sjablonen en afbeeldingen als ruwe wikitekst invoegen", "core-index-parser/include-raw-templates": "Sjablonen en afbeeldingen als ruwe wikitekst invoegen",
"core-index-parser/parse-references": "Referenties in extra kolommen bijvoegen", "core-index-parser/parse-references": "Referenties in extra kolommen bijvoegen",
"core-index-parser/invalid-wikitext": "Geen tabel kon worden verwerkt. Weet u zeker dat dit een geldige wikitabel is?", "core-index-parser/invalid-wikitext": "Geen tabel kon worden verwerkt. Weet u zeker dat dit een geldige wikitabel is?",
"core-index-parser/store-source": "Bestandsbron<br/>(bestandsnamen, URL's)<br/>in elke rij opslaan", "core-index-parser/store-source": "Bestandsbron opslaan",
"core-index-parser/store-archive": "Bewaar archiefbestand",
"core-index-parser/preserve-empty": "Lege tekenreeksen behouden", "core-index-parser/preserve-empty": "Lege tekenreeksen behouden",
"core-index-parser/trim": "Voorloop- en volgspaties van tekenreeksen verwijderen", "core-index-parser/trim": "Voorloop- en volgspaties van tekenreeksen verwijderen",
"core-index-parser/parse-every": "Verwerk elke", "core-index-parser/parse-every": "Verwerk elke",

View File

@ -123,7 +123,8 @@
"core-index-parser/tabs": "tabs (TSV)", "core-index-parser/tabs": "tabs (TSV)",
"core-index-parser/escape": "Ignorar caracteres especiais com \\", "core-index-parser/escape": "Ignorar caracteres especiais com \\",
"core-index-parser/lines-header": "linha(s) como nomes das colunas", "core-index-parser/lines-header": "linha(s) como nomes das colunas",
"core-index-parser/store-source": "Armazenar a origem do arquivo <br/>(nomes dos arquivos, URLs)<br/> em cada linha", "core-index-parser/store-source": "Armazenar a origem do arquivo",
"core-index-parser/store-archive": "Armazene o arquivo morto",
"core-index-parser/use-quote": "Usar caracter", "core-index-parser/use-quote": "Usar caracter",
"core-index-parser/ignore-first": "Ignorar primeira(s)", "core-index-parser/ignore-first": "Ignorar primeira(s)",
"core-index-parser/quote-delimits-cells": "encerrar células contendo separadores de coluna", "core-index-parser/quote-delimits-cells": "encerrar células contendo separadores de coluna",

View File

@ -162,7 +162,8 @@
"core-index-parser/parse-next": "Парсить следующие", "core-index-parser/parse-next": "Парсить следующие",
"core-index-parser/commas": "запятыми (CSV)", "core-index-parser/commas": "запятыми (CSV)",
"core-index-parser/tabs": "табами (TSV)", "core-index-parser/tabs": "табами (TSV)",
"core-index-parser/store-source": "Сохранять источники файла <br/>(имена файлов, URLs)<br/>в отдельной строке", "core-index-parser/store-source": "Сохранять источники файла",
"core-index-parser/store-archive": "сохранить архивный файл",
"core-index-parser/lines-header": "строк как заголовки колонок", "core-index-parser/lines-header": "строк как заголовки колонок",
"core-index-parser/escape": "Спецсимволы обрамлять с помощью \\", "core-index-parser/escape": "Спецсимволы обрамлять с помощью \\",
"core-index-parser/ignore-first": "Не учитывать первые", "core-index-parser/ignore-first": "Не учитывать первые",

View File

@ -130,7 +130,8 @@
"core-index-parser/parse-references": "Extrahera referenser i extra kolumner", "core-index-parser/parse-references": "Extrahera referenser i extra kolumner",
"core-index-parser/wiki-base-url": "Stäm av mot wiki med basadress:", "core-index-parser/wiki-base-url": "Stäm av mot wiki med basadress:",
"core-index-parser/invalid-wikitext": "Tabellen kunde ej tolkas. Är du säker på att detta är en giltig wiki-tabell?", "core-index-parser/invalid-wikitext": "Tabellen kunde ej tolkas. Är du säker på att detta är en giltig wiki-tabell?",
"core-index-parser/store-source": "Spara filkälla<br/>(filnamn, webbadresser)<br/>i varje rad", "core-index-parser/store-source": "Spara filkälla",
"core-index-parser/store-achive": "Lagra arkivfil",
"core-index-parser/preserve-empty": "Behåll tomma strängar", "core-index-parser/preserve-empty": "Behåll tomma strängar",
"core-index-parser/trim": "Ta bort inledande och avslutande tomrum från strängar", "core-index-parser/trim": "Ta bort inledande och avslutande tomrum från strängar",
"core-index-parser/json-parser": "Klicka på den första JSON {}-noden som motsvarar första posten som ska laddas.", "core-index-parser/json-parser": "Klicka på den första JSON {}-noden som motsvarar första posten som ska laddas.",

View File

@ -123,7 +123,8 @@
"core-index-parser/tabs": "mga tab (TSV)", "core-index-parser/tabs": "mga tab (TSV)",
"core-index-parser/escape": "Iwasan ang espesyal na mga karakter na may \\", "core-index-parser/escape": "Iwasan ang espesyal na mga karakter na may \\",
"core-index-parser/lines-header": "Ang mga linya bilang header ng mga kolum", "core-index-parser/lines-header": "Ang mga linya bilang header ng mga kolum",
"core-index-parser/store-source": "I-imbak ang pinagmulan ng file <br/>(mga pangalan ng file, URLs)<br/>bawat hilera", "core-index-parser/store-source": "I-imbak ang pinagmulan ng file",
"core-index-parser/store-archive": "I-store ang archive file",
"core-index-parser/use-quote": "Gumamit ng karakter", "core-index-parser/use-quote": "Gumamit ng karakter",
"core-index-parser/ignore-first": "Huwag munang intindihin", "core-index-parser/ignore-first": "Huwag munang intindihin",
"core-index-parser/quote-delimits-cells": "ang pagpaloob sa mga cells na mayroong tagapaghiwalay ng kolum", "core-index-parser/quote-delimits-cells": "ang pagpaloob sa mga cells na mayroong tagapaghiwalay ng kolum",

View File

@ -102,7 +102,8 @@
"core-index-parser/parse-cell": "将单元格中的<br/>文本解析<br/>为<br/>数字,日期,…", "core-index-parser/parse-cell": "将单元格中的<br/>文本解析<br/>为<br/>数字,日期,…",
"core-index-parser/store-blank": "保留空白行", "core-index-parser/store-blank": "保留空白行",
"core-index-parser/store-nulls": "将空白单元格作为nulls保留", "core-index-parser/store-nulls": "将空白单元格作为nulls保留",
"core-index-parser/store-source": "在每一行<br/>(文件名称, URLs)<br/>保留文件信息", "core-index-parser/store-source": "保留文件信息",
"core-index-parser/store-archive": "保留压缩文件",
"core-index-parser/preserve-empty": "保留空字符串", "core-index-parser/preserve-empty": "保留空字符串",
"core-index-parser/trim": "移除字符串首尾的空白", "core-index-parser/trim": "移除字符串首尾的空白",
"core-index-parser/json-parser": "点击的第一个JSON { } 节点 对应于第一个要加载的数据记录.", "core-index-parser/json-parser": "点击的第一个JSON { } 节点 对应于第一个要加载的数据记录.",

View File

@ -42,6 +42,8 @@
<td colspan="2"><label for="$store-blank-cells" id="or-import-null"></label></td></tr> <td colspan="2"><label for="$store-blank-cells" id="or-import-null"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td> <tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td>
<td><label for="$include-file-sources" id="or-import-source"></label></td></tr> <td><label for="$include-file-sources" id="or-import-source"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeArchiveFileCheckbox" id="$include-archive-file" /></td>
<td><label for="$include-archive-file" id="or-import-archive"></label></td></tr>
</table></div></td> </table></div></td>
</tr> </tr>
</table></div> </table></div>

View File

@ -108,6 +108,7 @@ Refine.ExcelParserUI.prototype.getOptions = function() {
options.storeBlankRows = this._optionContainerElmts.storeBlankRowsCheckbox[0].checked; options.storeBlankRows = this._optionContainerElmts.storeBlankRowsCheckbox[0].checked;
options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked; options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked;
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked; options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
return options; return options;
}; };
@ -136,6 +137,7 @@ Refine.ExcelParserUI.prototype._initialize = function() {
$('#or-import-blank').text($.i18n('core-index-parser/store-blank')); $('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
$('#or-import-null').text($.i18n('core-index-parser/store-nulls')); $('#or-import-null').text($.i18n('core-index-parser/store-nulls'));
$('#or-import-source').html($.i18n('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
$('#or-import-archive').html($.i18n('core-index-parser/store-archive'));
var sheetTable = this._optionContainerElmts.sheetRecordContainer[0]; var sheetTable = this._optionContainerElmts.sheetRecordContainer[0];
$.each(this._config.sheetRecords, function(i, v) { $.each(this._config.sheetRecords, function(i, v) {
@ -188,6 +190,9 @@ Refine.ExcelParserUI.prototype._initialize = function() {
if (this._config.includeFileSources) { if (this._config.includeFileSources) {
this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true); this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true);
} }
if (this._config.includeArchiveFileName) {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
var onChange = function() { var onChange = function() {
self._scheduleUpdatePreview(); self._scheduleUpdatePreview();

View File

@ -48,6 +48,8 @@
<td colspan="2"><label for="$store-blank-cells" id="or-import-null"></label></td></tr> <td colspan="2"><label for="$store-blank-cells" id="or-import-null"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td> <tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td>
<td><label for="$include-file-sources" id="or-import-source"></label></td></tr> <td><label for="$include-file-sources" id="or-import-source"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeArchiveFileCheckbox" id="$include-archive-file" /></td>
<td><label for="$include-archive-file" id="or-import-archive"></label></td></tr>
</table></div></td> </table></div></td>
</tr> </tr>
</table></div> </table></div>

View File

@ -109,6 +109,8 @@ Refine.FixedWidthParserUI.prototype.getOptions = function() {
options.storeBlankRows = this._optionContainerElmts.storeBlankRowsCheckbox[0].checked; options.storeBlankRows = this._optionContainerElmts.storeBlankRowsCheckbox[0].checked;
options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked; options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked;
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked; options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFile = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
return options; return options;
}; };
@ -140,6 +142,8 @@ Refine.FixedWidthParserUI.prototype._initialize = function() {
$('#or-import-blank').text($.i18n('core-index-parser/store-blank')); $('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
$('#or-import-null').text($.i18n('core-index-parser/store-nulls')); $('#or-import-null').text($.i18n('core-index-parser/store-nulls'));
$('#or-import-source').html($.i18n('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
$('#or-import-archive').html($.i18n('core-index-parser/store-archive'));
this._optionContainerElmts.encodingInput this._optionContainerElmts.encodingInput
.attr('value', this._config.encoding || '') .attr('value', this._config.encoding || '')
@ -184,6 +188,9 @@ Refine.FixedWidthParserUI.prototype._initialize = function() {
if (this._config.includeFileSources) { if (this._config.includeFileSources) {
this._optionContainerElmts.includeFileSourcesCheckbox.attr("checked", "checked"); this._optionContainerElmts.includeFileSourcesCheckbox.attr("checked", "checked");
} }
if (this._config.includeArchiveFileName) {
this._optionContainerElmts.includeArchiveFileCheckbox.attr("checked", "checked");
}
var onChange = function() { var onChange = function() {
self._scheduleUpdatePreview(); self._scheduleUpdatePreview();

View File

@ -22,6 +22,8 @@
<td><label for="$guess" id="or-import-parseCell"></label></td></tr> <td><label for="$guess" id="or-import-parseCell"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td> <tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td>
<td colspan="2"><label for="$include-file-sources" id="or-import-source"></label></td></tr> <td colspan="2"><label for="$include-file-sources" id="or-import-source"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeArchiveFileCheckbox" id="$include-archive-file" /></td>
<td colspan="2"><label for="$include-archive-file" id="or-import-archive"></label></td></tr>
</table></div></td> </table></div></td>
</tr> </tr>
</table></div> </table></div>

View File

@ -95,6 +95,8 @@ Refine.JsonParserUI.prototype.getOptions = function() {
options.storeEmptyStrings = this._optionContainerElmts.storeEmptyStringsCheckbox[0].checked; options.storeEmptyStrings = this._optionContainerElmts.storeEmptyStringsCheckbox[0].checked;
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked; options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
return options; return options;
}; };
@ -115,6 +117,7 @@ Refine.JsonParserUI.prototype._initialize = function() {
$('#or-import-trim').html($.i18n('core-index-parser/trim')); $('#or-import-trim').html($.i18n('core-index-parser/trim'));
$('#or-import-parseCell').html($.i18n('core-index-parser/parse-cell')); $('#or-import-parseCell').html($.i18n('core-index-parser/parse-cell'));
$('#or-import-source').html($.i18n('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
$('#or-import-archive').html($.i18n('core-index-parser/store-archive'));
$('#or-import-jsonParser').text($.i18n('core-index-parser/json-parser')); $('#or-import-jsonParser').text($.i18n('core-index-parser/json-parser'));
if (this._config.limit > 0) { if (this._config.limit > 0) {
@ -133,6 +136,9 @@ Refine.JsonParserUI.prototype._initialize = function() {
if (this._config.includeFileSources) { if (this._config.includeFileSources) {
this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true); this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true);
} }
if (this._config.includeArchiveFileName) {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
this._optionContainerElmts.pickRecordElementsButton.click(function() { this._optionContainerElmts.pickRecordElementsButton.click(function() {
self._showPickRecordNodesUI(); self._showPickRecordNodesUI();
}); });

View File

@ -25,6 +25,8 @@
<td colspan="2"><label for="$store-blank-cells" id="or-import-null"></label></td></tr> <td colspan="2"><label for="$store-blank-cells" id="or-import-null"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td> <tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td>
<td><label for="$include-file-sources" id="or-import-source"></label></td></tr> <td><label for="$include-file-sources" id="or-import-source"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeArchiveFileCheckbox" id="$include-archive-file" /></td>
<td><label for="$include-archive-file" id="or-import-archive"></label></td></tr>
</table></div></td> </table></div></td>
<td><div class="grid-layout layout-tightest"><table> <td><div class="grid-layout layout-tightest"><table>

View File

@ -98,6 +98,7 @@ Refine.LineBasedParserUI.prototype.getOptions = function() {
options.storeBlankRows = this._optionContainerElmts.storeBlankRowsCheckbox[0].checked; options.storeBlankRows = this._optionContainerElmts.storeBlankRowsCheckbox[0].checked;
options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked; options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked;
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked; options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
return options; return options;
}; };
@ -117,6 +118,7 @@ Refine.LineBasedParserUI.prototype._initialize = function() {
$('#or-import-blank').text($.i18n('core-index-parser/store-blank')); $('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
$('#or-import-null').text($.i18n('core-index-parser/store-nulls')); $('#or-import-null').text($.i18n('core-index-parser/store-nulls'));
$('#or-import-source').html($.i18n('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
$('#or-import-archive').html($.i18n('core-index-parser/store-archive'));
$('#or-import-ignore').text($.i18n('core-index-parser/ignore-first')); $('#or-import-ignore').text($.i18n('core-index-parser/ignore-first'));
$('#or-import-lines').text($.i18n('core-index-parser/lines-beg')); $('#or-import-lines').text($.i18n('core-index-parser/lines-beg'));
$('#or-import-parse').text($.i18n('core-index-parser/parse-next')); $('#or-import-parse').text($.i18n('core-index-parser/parse-next'));
@ -158,6 +160,9 @@ Refine.LineBasedParserUI.prototype._initialize = function() {
if (this._config.includeFileSources) { if (this._config.includeFileSources) {
this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true); this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true);
} }
if (this._config.includeArchiveFileName) {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
var onChange = function() { var onChange = function() {
self._scheduleUpdatePreview(); self._scheduleUpdatePreview();

View File

@ -78,6 +78,8 @@
<tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td> <tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td>
<td><label for="$include-file-sources" id="or-import-source"></label></td></tr> <td><label for="$include-file-sources" id="or-import-source"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeArchiveFileCheckbox" id="$include-archive-file" /></td>
<td><label for="$include-archive-file" id="or-import-archive"></label></td></tr>
</table></div></td> </table></div></td>
</tr> </tr>
</table></div> </table></div>

View File

@ -117,6 +117,7 @@ Refine.SeparatorBasedParserUI.prototype.getOptions = function() {
options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked; options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked;
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked; options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
options.trimStrings = this._optionContainerElmts.trimStringsCheckbox[0].checked; options.trimStrings = this._optionContainerElmts.trimStringsCheckbox[0].checked;
if (this._optionContainerElmts.columnNamesCheckbox[0].checked) { if (this._optionContainerElmts.columnNamesCheckbox[0].checked) {
@ -164,6 +165,7 @@ Refine.SeparatorBasedParserUI.prototype._initialize = function() {
$('#or-import-blank').text($.i18n('core-index-parser/store-blank')); $('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
$('#or-import-null').text($.i18n('core-index-parser/store-nulls')); $('#or-import-null').text($.i18n('core-index-parser/store-nulls'));
$('#or-import-source').html($.i18n('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
$('#or-import-archive').html($.i18n('core-index-parser/store-archive'));
this._optionContainerElmts.encodingInput this._optionContainerElmts.encodingInput
.attr('value', this._config.encoding || '') .attr('value', this._config.encoding || '')
@ -238,6 +240,9 @@ Refine.SeparatorBasedParserUI.prototype._initialize = function() {
if (this._config.includeFileSources) { if (this._config.includeFileSources) {
this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true); this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true);
} }
if (this._config.includeArchiveFileName) {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
if (this._config.trimStrings) { if (this._config.trimStrings) {
this._optionContainerElmts.trimStringsCheckbox.attr("checked", "unchecked"); this._optionContainerElmts.trimStringsCheckbox.attr("checked", "unchecked");
} }

View File

@ -29,6 +29,9 @@
<tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td> <tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td>
<td><label for="$include-file-sources" id="or-import-source"></label></td></tr> <td><label for="$include-file-sources" id="or-import-source"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeArchiveFileCheckbox" id="$include-archive-file" /></td>
<td><label for="$include-archive-file" id="or-import-archive"></label></td></tr>
<tr> <tr>
<td width="1%"></td> <td width="1%"></td>
<td><button class="button" bind="previewButton"></button></td> <td><button class="button" bind="previewButton"></button></td>

View File

@ -100,6 +100,7 @@ Refine.WikitextParserUI.prototype.getOptions = function() {
options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked; options.storeBlankCellsAsNulls = this._optionContainerElmts.storeBlankCellsAsNullsCheckbox[0].checked;
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked; options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
options.reconService = ReconciliationManager.ensureDefaultServicePresent(); options.reconService = ReconciliationManager.ensureDefaultServicePresent();
@ -128,6 +129,8 @@ Refine.WikitextParserUI.prototype._initialize = function() {
$('#or-import-blank').text($.i18n('core-index-parser/store-blank')); $('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
$('#or-import-null').text($.i18n('core-index-parser/store-nulls')); $('#or-import-null').text($.i18n('core-index-parser/store-nulls'));
$('#or-import-source').html($.i18n('core-index-parser/store-source')); $('#or-import-source').html($.i18n('core-index-parser/store-source'));
$('#or-import-archive').html($.i18n('core-index-parser/store-archive'));
/* /*
this._optionContainerElmts.encodingInput this._optionContainerElmts.encodingInput
@ -181,6 +184,9 @@ Refine.WikitextParserUI.prototype._initialize = function() {
if (this._config.includeFileSources) { if (this._config.includeFileSources) {
this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true); this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true);
} }
if (this._config.includeArchiveFileName) {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
var onChange = function() { var onChange = function() {
self._scheduleUpdatePreview(); self._scheduleUpdatePreview();

View File

@ -23,6 +23,8 @@
<td><label for="$guess" id="or-import-parseCell"></label></td></tr> <td><label for="$guess" id="or-import-parseCell"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td> <tr><td width="1%"><input type="checkbox" bind="includeFileSourcesCheckbox" id="$include-file-sources" /></td>
<td colspan="2"><label for="$include-file-sources" id="or-import-store"></label></td></tr> <td colspan="2"><label for="$include-file-sources" id="or-import-store"></label></td></tr>
<tr><td width="1%"><input type="checkbox" bind="includeArchiveFileCheckbox" id="$include-archive-file" /></td>
<td colspan="2"><label for="$include-archive-file" id="or-import-archive"></label></td></tr>
</table></div></td> </table></div></td>
</tr> </tr>
</table></div> </table></div>

View File

@ -93,6 +93,7 @@ Refine.XmlParserUI.prototype.getOptions = function() {
options.storeEmptyStrings = this._optionContainerElmts.storeEmptyStringsCheckbox[0].checked; options.storeEmptyStrings = this._optionContainerElmts.storeEmptyStringsCheckbox[0].checked;
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked; options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
return options; return options;
}; };
@ -113,6 +114,7 @@ Refine.XmlParserUI.prototype._initialize = function() {
$('#or-import-trim').html($.i18n('core-index-parser/trim')); $('#or-import-trim').html($.i18n('core-index-parser/trim'));
$('#or-import-parseCell').html($.i18n('core-index-parser/parse-cell')); $('#or-import-parseCell').html($.i18n('core-index-parser/parse-cell'));
$('#or-import-store').html($.i18n('core-index-parser/store-source')); $('#or-import-store').html($.i18n('core-index-parser/store-source'));
$('#or-import-archive').html($.i18n('core-index-parser/store-archive'));
if (this._config.limit > 0) { if (this._config.limit > 0) {
this._optionContainerElmts.limitCheckbox.prop("checked", true); this._optionContainerElmts.limitCheckbox.prop("checked", true);
@ -130,6 +132,9 @@ Refine.XmlParserUI.prototype._initialize = function() {
if (this._config.includeFileSources) { if (this._config.includeFileSources) {
this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true); this._optionContainerElmts.includeFileSourcesCheckbox.prop("checked", true);
} }
if (this._config.includeArchiveFileName) {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
this._optionContainerElmts.pickRecordElementsButton.click(function() { this._optionContainerElmts.pickRecordElementsButton.click(function() {
self._config.recordPath = undefined; self._config.recordPath = undefined;
self._showPickRecordElementsUI(); self._showPickRecordElementsUI();