diff --git a/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpStructuresFormSectionFeature.html b/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpStructuresFormSectionFeature.html
index 7d01eb35545..0d7ffa144ce 100644
--- a/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpStructuresFormSectionFeature.html
+++ b/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpStructuresFormSectionFeature.html
@@ -5,7 +5,7 @@
|
diff --git a/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpStructuresFormSectionFeature.java b/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpStructuresFormSectionFeature.java
index f7c7ca0ed41..255f345974b 100644
--- a/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpStructuresFormSectionFeature.java
+++ b/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpStructuresFormSectionFeature.java
@@ -35,6 +35,7 @@
import org.apache.wicket.request.resource.IResource;
import org.apache.wicket.request.resource.ResourceReference;
import org.apache.wicket.util.lang.Bytes;
+import org.apache.wicket.util.upload.FileItem;
import org.dgfoundation.amp.onepager.OnePagerUtil;
import org.dgfoundation.amp.onepager.components.ListEditorRemoveButton;
import org.dgfoundation.amp.onepager.components.ListItem;
@@ -46,6 +47,7 @@
import org.dgfoundation.amp.onepager.components.fields.AmpTextAreaFieldPanel;
import org.dgfoundation.amp.onepager.components.fields.AmpTextFieldPanel;
import org.dgfoundation.amp.onepager.components.fields.LatAndLongValidator;
+import org.dgfoundation.amp.onepager.components.upload.FileUploadPanel;
import org.dgfoundation.amp.onepager.helper.structure.ColorData;
import org.dgfoundation.amp.onepager.helper.structure.CoordinateData;
import org.dgfoundation.amp.onepager.helper.structure.MapData;
@@ -334,49 +336,54 @@ public void onClick(AjaxRequestTarget target) {
// final FileUploadField fileUploadField = new FileUploadField("fileUpload");
// fileUploadField.setOutputMarkupId(true);
+ final Model fileItemModel = new Model();
+
+ FileUploadPanel fileUpload = new FileUploadPanel("fileUpload",String.valueOf(am.getObject().getAmpActivityId()), fileItemModel);
+
+
final Form> form = new Form("structuresImportForm") {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit() {
-// FileUpload upload = new FileUploadField("fileUpload").getFileUpload();
-// if (upload == null) {
-// logger.info("No file uploaded");
-// } else {
-// logger.info("File-Name: " + upload.getClientFileName() + " File-Size: " +
-// Bytes.bytes(upload.getSize()));
-// try {
-// XSSFWorkbook workbook = new XSSFWorkbook(upload.getInputStream());
-// XSSFSheet sheet = workbook.getSheetAt(0);
-// Iterator rowIterator = sheet.iterator();
-// rowIterator.next();
-//
-// while (rowIterator.hasNext()) {
-// XSSFRow row = (XSSFRow) rowIterator.next();
-// String title = getStringValueFromCell(row.getCell(0));
-// String description = getStringValueFromCell(row.getCell(1));
-// String latitude = getStringValueFromCell(row.getCell(2));
-// String longitude = getStringValueFromCell(row.getCell(3));
-//
-// AmpStructure stru = new AmpStructure();
-// stru.setTitle(title);
-// stru.setDescription(description);
-// stru.setLatitude(latitude);
-// stru.setLongitude(longitude);
-// list.addItem(stru);
-// list.goToLastPage();
-// }
-// } catch (IOException e) {
-// throw new RuntimeException(e);
-// }
-// }
+ FileUpload upload = new FileUpload(fileItemModel.getObject());
+ if (upload == null) {
+ logger.info("No file uploaded");
+ } else {
+ logger.info("File-Name: " + upload.getClientFileName() + " File-Size: " +
+ Bytes.bytes(upload.getSize()));
+ try {
+ XSSFWorkbook workbook = new XSSFWorkbook(upload.getInputStream());
+ XSSFSheet sheet = workbook.getSheetAt(0);
+ Iterator rowIterator = sheet.iterator();
+ rowIterator.next();
+
+ while (rowIterator.hasNext()) {
+ XSSFRow row = (XSSFRow) rowIterator.next();
+ String title = getStringValueFromCell(row.getCell(0));
+ String description = getStringValueFromCell(row.getCell(1));
+ String latitude = getStringValueFromCell(row.getCell(2));
+ String longitude = getStringValueFromCell(row.getCell(3));
+
+ AmpStructure stru = new AmpStructure();
+ stru.setTitle(title);
+ stru.setDescription(description);
+ stru.setLatitude(latitude);
+ stru.setLongitude(longitude);
+ list.addItem(stru);
+ list.goToLastPage();
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
};
-// form.setMultiPart(true);
-// form.setMaxSize(Bytes.megabytes(10));
-// form.add(fileUploadField);
+ form.setMultiPart(true);
+ form.setMaxSize(Bytes.megabytes(10));
+ form.add(fileUpload);
Button importStructures = new Button("importStructures");
importStructures.setOutputMarkupId(true);