Author: tchemit Date: 2014-03-17 15:10:02 +0100 (Mon, 17 Mar 2014) New Revision: 976 Url: http://forge.codelutin.com/projects/echobase/repository/revisions/976 Log: refs-80 #2931 (RAF sources) + improve long action download Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/CommandLineUtils.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapConfiguration.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapService.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/SpeciesExportModel.java trunk/echobase-services/src/main/resources/rscript/extractMap.r trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Configure.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Export.java trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml trunk/echobase-ui/src/main/resources/config/struts-embeddedApplication.xml trunk/echobase-ui/src/main/resources/config/struts-exportDb.xml trunk/echobase-ui/src/main/resources/config/struts-exportMap.xml trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/exportMap/Configure-validation.xml trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/embeddedApplication/result.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportDb/result.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/configure.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/result.jsp Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/CommandLineUtils.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/CommandLineUtils.java 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/CommandLineUtils.java 2014-03-17 14:10:02 UTC (rev 976) @@ -74,20 +74,24 @@ // invoke int exitValue; + String log = executorLog.getLog(); try { if (logger.isInfoEnabled()) { logger.info("Command line '" + commandLine.toString() + "' will be execute"); } exitValue = executor.execute(commandLine); } catch (IOException eee) { - throw new EchoBaseTechnicalException(errorMsg + "\n" + executorLog.getLog(), eee); + throw new EchoBaseTechnicalException(errorMsg + "\n" + log, eee); } if (logger.isInfoEnabled()) { logger.info("Command line end with exit with value : " + exitValue); } if (exitValue != 0) { - throw new EchoBaseTechnicalException(errorMsg + "\n" + executorLog.getLog()); + if (logger.isErrorEnabled()) { + logger.error("Command failed:\n"+ log); + } + throw new EchoBaseTechnicalException(errorMsg + "\n" + log.replaceAll("\\n","<br/>\n")); } } Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapConfiguration.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapConfiguration.java 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapConfiguration.java 2014-03-17 14:10:02 UTC (rev 976) @@ -33,18 +33,13 @@ * Created on 3/1/14. * * @author Tony Chemit <chemit@codelutin.com> - * @since XXX + * @since 2.6 */ public class ExportMapConfiguration extends AbstractEchobaseActionConfiguration { private static final long serialVersionUID = 1L; /** - * File of of export file. - */ - private String fileName; - - /** * Working directory. */ private File workingDirectory; @@ -59,6 +54,29 @@ */ private String missionId; + /** + * Name of the facade. + */ + private String facadeName; + + /** + * Name of the export zone. + */ + private String zoneName; + + /** + * Should we produce raw data? + */ + private boolean publishRawData; + + /** + * Name of user performing the action. + */ + private String userName; + + /** + * Database configuration. + */ private JdbcConfiguration dbConfiguration; public ExportMapConfiguration() { @@ -68,14 +86,6 @@ super(progressModel); } - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - } - public File getWorkingDirectory() { return workingDirectory; } @@ -100,6 +110,22 @@ this.missionId = missionId; } + public String getFacadeName() { + return facadeName; + } + + public void setFacadeName(String facadeName) { + this.facadeName = facadeName; + } + + public String getZoneName() { + return zoneName; + } + + public void setZoneName(String zoneName) { + this.zoneName = zoneName; + } + public JdbcConfiguration getDbConfiguration() { return dbConfiguration; } @@ -108,6 +134,22 @@ this.dbConfiguration = dbConfiguration; } + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public boolean isPublishRawData() { + return publishRawData; + } + + public void setPublishRawData(boolean publishRawData) { + this.publishRawData = publishRawData; + } + @Override public void destroy() throws IOException { if (workingDirectory != null) { Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapService.java 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapService.java 2014-03-17 14:10:02 UTC (rev 976) @@ -43,7 +43,8 @@ import java.io.File; import java.io.FilenameFilter; import java.io.IOException; -import java.util.Map; +import java.util.Calendar; +import java.util.Date; /** * Created on 3/1/14. @@ -58,24 +59,21 @@ public static final TimeLog timeLog = new TimeLog(ExportMapService.class); + public static final String EXTRACT_MAP_R_SCRIPT = "extractMap.r"; + @Inject private UserDbPersistenceService persistenceService; public void doExport(ExportMapConfiguration model) throws IOException { Preconditions.checkNotNull(model); - Preconditions.checkNotNull(model.getFileName()); Preconditions.checkNotNull(model.getDbConfiguration()); + Preconditions.checkNotNull(model.getFacadeName()); + Preconditions.checkNotNull(model.getZoneName()); Preconditions.checkNotNull(model.getMissionId()); - // compute nb steps (invoke EchoR + extract souces + create archive tree + create archive) - int nbSteps = 4; + model.setNbSteps(7); - if (log.isInfoEnabled()) { - log.info("NB steps: " + nbSteps); - } - model.setNbSteps(nbSteps); - Mission mission = persistenceService.getMission(model.getMissionId()); Preconditions.checkNotNull(mission); @@ -83,66 +81,71 @@ File tempDirectory = model.getWorkingDirectory(); - // 1 - invoke EchoR - File echoRBaseDir = invokeEchoR(missionName, + File echRMapsDir = generateMaps(missionName, tempDirectory, model.getDbConfiguration()); - model.incrementsProgress(); - // 2 - Extract source files - + // 2 - create echobase project + EchoBaseProject echoBaseProject = createProject(tempDirectory, + model, + missionName); model.incrementsProgress(); - // 3 - create archive tree - File archiveBaseDir = new File(tempDirectory, "echobase"); - EchoBaseIOUtil.forceMkdir(archiveBaseDir); - if (log.isInfoEnabled()) { - log.info("Will store maps in " + archiveBaseDir); + // 3 - Extract source files + if (model.isPublishRawData()) { + extractRawData(echoBaseProject, model); } + model.incrementsProgress(); - createArchiveContent(archiveBaseDir, echoRBaseDir, missionName); + // 4 - Export species file + exportSpeciesFile(echoBaseProject); model.incrementsProgress(); - // 4 - create archive + // 5 - Copy maps + copyMaps(echoBaseProject, echRMapsDir); + model.incrementsProgress(); - String fileName = model.getFileName(); - File zipFile = new File(tempDirectory, fileName + ".zip"); + // 6 - create archive + String fileName = model.getZoneName() + "-" + missionName + "-" + echoBaseProject.getName() + ".zip"; + File zipFile = new File(tempDirectory, fileName); - if (log.isInfoEnabled()) { - log.info("Will export map to " + zipFile); - } model.setExportFile(zipFile); - EchoBaseIOUtil.compressZipFile(zipFile, archiveBaseDir); + EchoBaseIOUtil.compressZipFile(zipFile, echoBaseProject.getBasedir()); + model.incrementsProgress(); + + // 7 - delete archive + FileUtils.deleteDirectory(echoBaseProject.getBasedir()); + zipFile.deleteOnExit(); + model.incrementsProgress(); } - protected File invokeEchoR(String missionName, - File tempDirectory, - JdbcConfiguration dbConfiguration) throws IOException { - if (log.isInfoEnabled()) { - log.info("Will invoke EchoR on mission: " + missionName); - log.info("Will connect to db: " + dbConfiguration.getUrl()); - } - File workingDirectory = new File(tempDirectory, "r"); - EchoBaseIOUtil.forceMkdir(workingDirectory); - String scriptPrefixPath = new File(workingDirectory, "EchoR").getAbsolutePath(); + protected File generateMaps(String missionName, + File tempDirectory, + JdbcConfiguration dbConfiguration) throws IOException { File rExecutableFile = getConfiguration().getRscriptExecutablePath(); if (!EchoBaseIOUtil.isExecutableFile(rExecutableFile)) { throw new EchoBaseTechnicalException("Could not find R executable at: " + rExecutableFile); } - // copy script to temporary directory - File scriptFile = new File(tempDirectory, "extractMaps.r"); if (log.isInfoEnabled()) { - log.info("Copy R script to " + scriptFile); + log.info("Will invoke EchoR on mission: " + missionName); + log.info("Will connect to db: " + dbConfiguration.getUrl()); } - EchoBaseIOUtil.copyResource("rscript/extractMaps.r", scriptFile, true); + File workingDirectory = new File(tempDirectory, "r"); + EchoBaseIOUtil.forceMkdir(workingDirectory); + // copy script to temporary directory + String scriptPrefixPath = new File(workingDirectory, "EchoR").getAbsolutePath(); + File scriptFile = new File(tempDirectory, EXTRACT_MAP_R_SCRIPT); + EchoBaseIOUtil.copyResource("/rscript/" + EXTRACT_MAP_R_SCRIPT, scriptFile, true); + // Extract params from jdbcurl - //jdbc:postgresql://demo.codelutin.com:5433/echobase-latest-2011-2.6 + // example jdbc:postgresql://demo.codelutin.com/echobase-latest-2011-2.6 (port=5432) + // example jdbc:postgresql://demo.codelutin.com:5433/echobase-latest-2011-2.6 String url = StringUtils.substringAfter(dbConfiguration.getUrl(), "jdbc:postgresql://"); if (!url.contains("/")) { throw new CoserTechnicalException("Invalid jdbc url: " + url + " (should contains a /"); @@ -155,7 +158,6 @@ dbHost = StringUtils.substringBefore(dbHost, ":"); dbPort = StringUtils.substringAfter(dbHost, ":"); } - if (log.isInfoEnabled()) { log.info("mission: " + missionName); log.info("extractPath: " + scriptPrefixPath); @@ -166,11 +168,12 @@ CommandLine commandLine = CommandLineUtils.newCommand( rExecutableFile, + scriptFile, missionName, scriptPrefixPath, dbHost, + dbPort, dbName, - dbPort, dbConfiguration.getLogin(), dbConfiguration.getPassword()); @@ -180,44 +183,68 @@ return result; } - /** - * Execute R script passed in param and add args to call script - * - * @param workingDirectory working directory - * @param scriptFile script to execute - * @param args arguments to pass to script - */ - public void executeRScript(File workingDirectory, - File scriptFile, - Map<String, String> args) { + protected EchoBaseProject createProject(File tempDirectory, + ExportMapConfiguration model, + String missionName) throws IOException { - // launch R command - File rExecutableFile = getConfiguration().getRscriptExecutablePath(); - if (!EchoBaseIOUtil.isExecutableFile(rExecutableFile)) { - throw new EchoBaseTechnicalException("Could not find R executable at: " + rExecutableFile); + // Get current Year + Date currentDate = serviceContext.newDate(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(currentDate); + int currentYear = calendar.get(Calendar.YEAR); + + // create project directory + File projectDirectory = new File(tempDirectory, missionName + "-" + currentYear); + EchoBaseIOUtil.forceMkdir(projectDirectory); + + // create project + EchoBaseProject project = new EchoBaseProject(projectDirectory); + + project.setFacadeName(model.getFacadeName()); + project.setZoneName(model.getZoneName()); + project.setSurveyName(missionName); + project.setAuthor("EchoBase user: " + model.getUserName()); + project.setCreationDate(serviceContext.newDate()); + project.setComment("Created by Echobase application (db: " + getUserDbUrl() + ")"); + project.setPubliableResult(model.isPublishRawData()); + + project.save(); + + if (log.isInfoEnabled()) { + log.info("Project created at: " + project.getBasedir() + " with name: " + project.getName()); } - CommandLine commandLine = CommandLineUtils.newCommand(rExecutableFile, args); - - CommandLineUtils.invokeCommandeLine(log, commandLine, "Failed to launch R script: " + scriptFile, workingDirectory); + return project; } - protected void createArchiveContent(File archiveBaseDir, File mapsDirectory, String missionName) throws IOException { + protected void extractRawData(EchoBaseProject project, + ExportMapConfiguration model) throws IOException { + //TODO Do this + if (log.isInfoEnabled()) { + log.info("Extract raw data for mission: " + model.getMissionId() + + " to : " + project.getRawDataDirectory()); + } - EchoBaseProject coserProject = new EchoBaseProject(archiveBaseDir); + FileUtils.write(new File(project.getRawDataDirectory(), "TODO.txt"), "TODO"); + } - coserProject.setSurveyName(missionName); - coserProject.setFacadeName("atlantique"); - coserProject.setZoneName("gdgciem8"); - coserProject.setAuthor("EchoBase"); - coserProject.setComment("Created by Echobase application (db: " + getUserDbUrl() + ")"); + protected void exportSpeciesFile(EchoBaseProject coserProject) { + File speciesFile = coserProject.getSpeciesDefinitionFile(); + SpeciesExportModel speciesExportModel = new SpeciesExportModel(getCsvSeparator()); + try { + Export.exportToFile(speciesExportModel, persistenceService.getSpecies(), speciesFile); + } catch (Exception e) { + throw new EchoBaseTechnicalException("Could not export species list to " + speciesFile, e); + } + } - coserProject.save(); + protected void copyMaps(EchoBaseProject coserProject, File mapsDirectory) throws IOException { File mapDir = coserProject.getMapsDirectory(); EchoBaseIOUtil.forceMkdir(mapDir); - FilenameFilter filter = EchoBaseProject.newMapSpeciesFilenameFilter(missionName); + FilenameFilter filter = + EchoBaseProject.newMapSpeciesFilenameFilter(coserProject.getSurveyName()); // copy all of them in mapDir File[] files = mapsDirectory.listFiles(filter); @@ -226,14 +253,5 @@ FileUtils.copyFileToDirectory(file, mapDir); } } - - // create species.csv - File speciesFile = coserProject.getSpeciesDefinitionFile(); - SpeciesExportModel speciesExportModel = new SpeciesExportModel(getCsvSeparator()); - try { - Export.exportToFile(speciesExportModel, persistenceService.getSpecies(), speciesFile); - } catch (Exception e) { - throw new EchoBaseTechnicalException("Could not export species list to " + speciesFile, e); - } } } Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/SpeciesExportModel.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/SpeciesExportModel.java 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/SpeciesExportModel.java 2014-03-17 14:10:02 UTC (rev 976) @@ -34,14 +34,14 @@ public SpeciesExportModel(char separator) { super(separator); - newColumnForExport(Species.PROPERTY_TAXON_CODE, "C_Perm"); - newColumnForExport(Species.PROPERTY_TAXON_SYSTEMATIC_ORDER, "NumSys"); - newColumnForExport(Species.PROPERTY_TAXON_SYSTEMATIC_LEVEL, "NivSys"); - newColumnForExport(Species.PROPERTY_CODE_MEMO, "C_VALIDE"); - newColumnForExport(Species.PROPERTY_GENUS_SPECIES, "L_VALIDE"); - newColumnForExport(Species.PROPERTY_AUTHOR_REFERENCE, "AA_VALIDE"); - newColumnForExport(Species.PROPERTY_TAXON_FATHER_MEMOCODE, "C_TxPère"); - newColumnForExport("taxaCode", "Taxa"); + newColumnForExport("C_Perm", Species.PROPERTY_TAXON_CODE); + newColumnForExport("NumSys", Species.PROPERTY_TAXON_SYSTEMATIC_ORDER); + newColumnForExport("NivSys", Species.PROPERTY_TAXON_SYSTEMATIC_LEVEL); + newColumnForExport("C_VALIDE", Species.PROPERTY_CODE_MEMO); + newColumnForExport("L_VALIDE", Species.PROPERTY_GENUS_SPECIES); + newColumnForExport("AA_VALIDE", Species.PROPERTY_AUTHOR_REFERENCE); + newColumnForExport("C_TxPère", Species.PROPERTY_TAXON_FATHER_MEMOCODE); + newColumnForExport("Taxa", "taxaCode"); } } Modified: trunk/echobase-services/src/main/resources/rscript/extractMap.r =================================================================== --- trunk/echobase-services/src/main/resources/rscript/extractMap.r 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-services/src/main/resources/rscript/extractMap.r 2014-03-17 14:10:02 UTC (rev 976) @@ -3,26 +3,26 @@ ## missionName ## exportPrefixPath ## dbHost +## dbPort ## dbName ## dbUser ## dbPwd -## dbPort args <- commandArgs(TRUE) missionName <- args[1] exportPrefixPath <- args[2] dbHost <- args[3] -dbName <- args[4] -dbUser <- args[5] -dbPwd <- args[6] -dbPort <- args[7] +dbPort <- args[4] +dbName <- args[5] +dbUser <- args[6] +dbPwd <- args[7] library('EchoR'); GridMaps4Echobase(mission=missionName, voyage='%', path.export=exportPrefixPath, host=dbHost, + port=dbPort, dbname=dbName, user=dbUser, - password=dbPwd, - port=dbPort); \ No newline at end of file + password=dbPwd); \ No newline at end of file Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Configure.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Configure.java 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Configure.java 2014-03-17 14:10:02 UTC (rev 976) @@ -59,18 +59,37 @@ return missions; } - public void setFileName(String fileName) { - getModel().setFileName(fileName); + + public String getFacadeName() { + return getModel().getFacadeName(); } + public void setFacadeName(String facadeName) { + getModel().setFacadeName(facadeName); + } + + public String getZoneName() { + return getModel().getZoneName(); + } + + public void setZoneName(String zoneName) { + getModel().setZoneName(zoneName); + } + + public String getMissionId() { + return getModel().getMissionId(); + } + @Override protected ExportMapConfiguration createModel() { ExportMapConfiguration result = new ExportMapConfiguration(); - result.setFileName("echobase"); + result.setFacadeName("atlantique"); + result.setZoneName("gdgciem8"); EchoBaseSession userSession = getEchoBaseSession(); JdbcConfiguration workingDbConfiguration = userSession.getWorkingDbConfiguration(); result.setDbConfiguration(workingDbConfiguration); + result.setUserName(userSession.getUser().getEmail()); return result; } @@ -86,7 +105,8 @@ File tempDirectory = FileUtils.getTempDirectory(); File dataDirectory = new File(tempDirectory, "echobase-exportMap-" + - System.currentTimeMillis()); + System.currentTimeMillis() + ); FileUtil.createDirectoryIfNecessary(dataDirectory); model.setWorkingDirectory(dataDirectory); if (log.isInfoEnabled()) { Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Export.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Export.java 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Export.java 2014-03-17 14:10:02 UTC (rev 976) @@ -48,7 +48,7 @@ protected void startAction(ExportMapService service, ExportMapConfiguration model) throws Exception { if (log.isInfoEnabled()) { - log.info("Start export map to file " + model.getFileName()); + log.info("Start export map for mission" + model.getMissionId()); } service.doExport(model); } @@ -71,7 +71,7 @@ @Override protected String getResultMessage(ExportMapConfiguration model) { String result = t("echobase.message.exportMap.result", - model.getFileName(), + model.getExportFile().getName(), model.getActionTime()); if (log.isInfoEnabled()) { Modified: trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml 2014-03-17 14:10:02 UTC (rev 976) @@ -85,7 +85,7 @@ <result type="stream"> <param name="contentType">${contentType}</param> <param name="contentLength">${contentLength}</param> - <param name="contentDisposition">filename="${exportFileName}"</param> + <param name="contentDisposition">attachment; filename="${exportFileName}"</param> </result> </action> Modified: trunk/echobase-ui/src/main/resources/config/struts-embeddedApplication.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-embeddedApplication.xml 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/resources/config/struts-embeddedApplication.xml 2014-03-17 14:10:02 UTC (rev 976) @@ -65,7 +65,7 @@ <result type="stream"> <param name="contentType">${contentType}</param> <param name="contentLength">${contentLength}</param> - <param name="contentDisposition">filename="${fileName}"</param> + <param name="contentDisposition">attachment; filename="${fileName}"</param> </result> </action> Modified: trunk/echobase-ui/src/main/resources/config/struts-exportDb.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-exportDb.xml 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/resources/config/struts-exportDb.xml 2014-03-17 14:10:02 UTC (rev 976) @@ -67,7 +67,7 @@ <result type="stream"> <param name="contentType">${contentType}</param> <param name="contentLength">${contentLength}</param> - <param name="contentDisposition">filename="${fileName}"</param> + <param name="contentDisposition">attachment; filename="${fileName}"</param> </result> </action> Modified: trunk/echobase-ui/src/main/resources/config/struts-exportMap.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-exportMap.xml 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/resources/config/struts-exportMap.xml 2014-03-17 14:10:02 UTC (rev 976) @@ -67,7 +67,7 @@ <result type="stream"> <param name="contentType">${contentType}</param> <param name="contentLength">${contentLength}</param> - <param name="contentDisposition">filename="${fileName}"</param> + <param name="contentDisposition">attachment; filename="${fileName}"</param> </result> </action> Modified: trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml 2014-03-17 14:10:02 UTC (rev 976) @@ -125,7 +125,7 @@ <result type="stream"> <param name="contentType">${contentType}</param> <param name="contentLength">${contentLength}</param> - <param name="contentDisposition">filename="${fileName}"</param> + <param name="contentDisposition">attachment; filename="${fileName}"</param> </result> </action> Modified: trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml 2014-03-17 14:10:02 UTC (rev 976) @@ -143,7 +143,7 @@ <result type="stream"> <param name="contentType">${contentType}</param> <param name="contentLength">${contentLength}</param> - <param name="contentDisposition">filename="${fileName}"</param> + <param name="contentDisposition">attachment; filename="${fileName}"</param> </result> </action> Modified: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/exportMap/Configure-validation.xml =================================================================== --- trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/exportMap/Configure-validation.xml 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/exportMap/Configure-validation.xml 2014-03-17 14:10:02 UTC (rev 976) @@ -26,10 +26,16 @@ </field-validator> </field> - <field name="model.fileName"> + <field name="model.facadeName"> <field-validator type="requiredstring"> - <message key="echobase.error.exportMap.filename.required"/> + <message key="echobase.error.exportMap.facadeName.required"/> </field-validator> </field> + <field name="model.zoneName"> + <field-validator type="requiredstring"> + <message key="echobase.error.exportMap.zoneName.required"/> + </field-validator> + </field> + </validators> Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties =================================================================== --- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties 2014-03-17 14:10:02 UTC (rev 976) @@ -168,8 +168,10 @@ echobase.error.export.sqlQuery.forbidden.insert.word=La requète contient le mot 'INSERT', ce qui est interdit echobase.error.export.sqlQuery.forbidden.update.word=La requète contient le mot 'UPDATE', ce qui est interdit echobase.error.export.sqlQuery.requiredstring=La requète de l'export est obligatoire +echobase.error.exportMap.facadeName.required=Name of facade is mandatory echobase.error.exportMap.filename.required=Export filename required echobase.error.exportMap.mission.required=No mission selected +echobase.error.exportMap.zoneName.required=Name of zone is mandatory echobase.error.import.acousticDensityUnit.required=acousticDensityUnit non renseigné echobase.error.import.acquisitionSoftwareVersionER60.required=acquisitionSoftwareVersionER60 non renseigné echobase.error.import.acquisitionSoftwareVersionME70.required=acquisitionSoftwareVersionME70 non renseigné @@ -297,6 +299,9 @@ echobase.label.exportAsSeen=Export as displayed on the screen echobase.label.exportDbFileName=Name of export file echobase.label.exportFileName=Name of export file +echobase.label.exportMap.facadeName=Facade +echobase.label.exportMap.publishRawData=Publish raw data +echobase.label.exportMap.zoneName=Zone echobase.label.exportMapFileName=Name of export file echobase.label.importFile=File to export echobase.label.login=Connection Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties =================================================================== --- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2014-03-17 14:10:02 UTC (rev 976) @@ -168,8 +168,10 @@ echobase.error.export.sqlQuery.forbidden.insert.word=La requète contient le mot 'INSERT', ce qui est interdit echobase.error.export.sqlQuery.forbidden.update.word=La requète contient le mot 'UPDATE', ce qui est interdit echobase.error.export.sqlQuery.requiredstring=La requète de l'export est obligatoire +echobase.error.exportMap.facadeName.required=Le nom de la facade est obligatoire echobase.error.exportMap.filename.required=Le nom d'un fichier d'export est obligatoire echobase.error.exportMap.mission.required=La sélection d'une série est obligatoire +echobase.error.exportMap.zoneName.required=Le nom de la zone est obligatoire echobase.error.import.acousticDensityUnit.required=acousticDensityUnit non renseigné echobase.error.import.acquisitionSoftwareVersionER60.required=acquisitionSoftwareVersionER60 non renseigné echobase.error.import.acquisitionSoftwareVersionME70.required=acquisitionSoftwareVersionME70 non renseigné @@ -297,6 +299,9 @@ echobase.label.exportAsSeen=Exporter "comme à l'écran" echobase.label.exportDbFileName=Nom du fichier d'export echobase.label.exportFileName=Nom du fichier d'export +echobase.label.exportMap.facadeName=Facade +echobase.label.exportMap.publishRawData=Publier les sources +echobase.label.exportMap.zoneName=Zone echobase.label.exportMapFileName=Nom du fichier d'export echobase.label.importFile=Fichier à importer echobase.label.login=Connexion Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/embeddedApplication/result.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/embeddedApplication/result.jsp 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/embeddedApplication/result.jsp 2014-03-17 14:10:02 UTC (rev 976) @@ -23,15 +23,17 @@ <s:url id="downloadUrl" namespace="/embeddedApplication" action="download"/> -<script type="text/javascript"> +<s:if test="error == null"> + <script type="text/javascript"> - jQuery(document).ready(function () { + jQuery(document).ready(function () { - // start to download by it-self the result of import - window.open("${downloadUrl}"); - }); + // start to download by it-self the result of import + window.location="${downloadUrl}"; + }); + </script> +</s:if> -</script> <title><s:text name="echobase.title.embeddedApplicationResult"/></title> <div class="cleanBoth help"> @@ -43,11 +45,11 @@ <br/> <%@ include file="/WEB-INF/includes/actionResult.jsp" %> - +<s:if test="error == null"> <div> <s:text name="echobase.message.download.link"/> <a href="${downloadUrl}"> <s:text name="echobase.action.downloadEmbeddedApplicationFile"/> </a> </div> - +</s:if> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportDb/result.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportDb/result.jsp 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportDb/result.jsp 2014-03-17 14:10:02 UTC (rev 976) @@ -23,29 +23,28 @@ <s:url id="downloadUrl" namespace="/exportDb" action="download"/> -<script type="text/javascript"> +<s:if test="error == null"> + <script type="text/javascript"> - jQuery(document).ready(function () { + jQuery(document).ready(function () { - // start to download by it-self the result of import - window.open("${downloadUrl}"); - }); + // start to download by it-self the result of import + window.location="${downloadUrl}"; + }); + </script> +</s:if> -</script> <title><s:text name="echobase.title.exportDbResult"/></title> <%@ include file="/WEB-INF/includes/actionResult.jsp" %> -<div> - L'export de la base complête a réussi en <s:property value="model.actionTime"/>. -</div> - <br/> - +<s:if test="error == null"> <div> Si le téléchargement n'a pas démarré automatiquement, suivez ce lien : <a href="${downloadUrl}" target="download"> <s:text name="echobase.action.downloadExportDbFile"/> </a> </div> +</s:if> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/configure.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/configure.jsp 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/configure.jsp 2014-03-17 14:10:02 UTC (rev 976) @@ -47,13 +47,14 @@ <div class="cleanBoth"></div> <br/> - <s:textfield key="model.fileName" requiredLabel="true" size="100" - label="%{getText('echobase.label.exportMapFileName')} (*)"/> - - <div class="cleanBoth"> - <br/> - (*) <s:text name="echobase.info.exportMap.archive"/> - </div> + <s:textfield key="model.facadeName" requiredLabel="true" size="100" + label="%{getText('echobase.label.exportMap.facadeName')}"/> + <br/> + <s:textfield key="model.zoneName" requiredLabel="true" size="100" + label="%{getText('echobase.label.exportMap.zoneName')}"/> + <s:checkbox key="model.publishRawData" + label="%{getText('echobase.label.exportMap.publishRawData')}"/> + <br/> </fieldset> <br/> <s:submit action="configure" value='%{getText("echobase.action.export")}'/> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/result.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/result.jsp 2014-03-17 10:10:45 UTC (rev 975) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/result.jsp 2014-03-17 14:10:02 UTC (rev 976) @@ -21,29 +21,27 @@ <s:url id="downloadUrl" namespace="/exportMap" action="download"/> +<s:if test="error == null"> <script type="text/javascript"> jQuery(document).ready(function () { // start to download by it-self the result of import - window.open("${downloadUrl}"); + window.location="${downloadUrl}"; }); - </script> +</s:if> <title><s:text name="echobase.title.exportMapResult"/></title> <%@ include file="/WEB-INF/includes/actionResult.jsp" %> -<div> - L'export des cartes de la campagne a réussi en <s:property value="model.actionTime"/>. -</div> - +<s:if test="error == null"> <br/> - <div> Si le téléchargement n'a pas démarré automatiquement, suivez ce lien : - <a href="${downloadUrl}" target="download"> + <a href="${downloadUrl}" target="download" id="download"> <s:text name="echobase.action.downloadExportMapFile"/> </a> </div> +</s:if>