r55 - in trunk/echobase-ui/src/main: java/fr/ifremer/echobase/ui java/fr/ifremer/echobase/ui/actions java/fr/ifremer/echobase/ui/actions/dbeditor java/fr/ifremer/echobase/ui/actions/export resources resources/config resources/i18n webapp/WEB-INF/includes webapp/WEB-INF/jsp/export
Author: tchemit Date: 2011-11-13 23:22:54 +0100 (Sun, 13 Nov 2011) New Revision: 55 Url: http://forge.codelutin.com/repositories/revision/echobase/55 Log: reformat some codes implements the CreateEmbeddedApplication actions + ui rename some actions and action mappings Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/CreateEmbeddedApplication.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/DownloadEmbeddedApplication.java trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/createEmbeddedApplication.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportSql.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportSqlResult.jsp Removed: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/export.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportGrid.jsp Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractJSONPaginedAction.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadEntities.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/DownloadExportSqlResult.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/ExportSql.java trunk/echobase-ui/src/main/resources/config/struts-export.xml trunk/echobase-ui/src/main/resources/echobase.properties trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2011-11-13 22:22:54 UTC (rev 55) @@ -30,8 +30,6 @@ import fr.ifremer.echobase.EchoBaseTopiaRootContextSupplierFactory; import fr.ifremer.echobase.entities.EchoBaseEntityEnum; import fr.ifremer.echobase.entities.EchoBaseUser; -import fr.ifremer.echobase.entities.EchoBaseUserDTO; -import fr.ifremer.echobase.entities.EchoBaseUserDTOImpl; import fr.ifremer.echobase.entities.EchoBaseUserImpl; import fr.ifremer.echobase.entities.meta.DbMeta; import fr.ifremer.echobase.services.EchoBaseServiceContext; @@ -204,7 +202,7 @@ TopiaContext transaction = rootContextSupplier.get().beginTransaction(); try { - EchoBaseServiceContext serviceContext = new EchoBaseServiceContextImpl( + EchoBaseServiceContext serviceContext = EchoBaseServiceContextImpl.newContext( Locale.getDefault(), transaction, configuration, @@ -225,24 +223,7 @@ "admin user (password admin)."); } - EchoBaseUserDTO userDTO; - userDTO = new EchoBaseUserDTOImpl(); - userDTO.setEmail("admin"); - userDTO.setPassword("admin"); - userDTO.setAdmin(true); - service.createOrUpdate(userDTO); - - if (configuration.getOptionAsBoolean("createAdmins")) { - for (int i = 0; i < 1000; i++) { - userDTO = new EchoBaseUserDTOImpl(); - userDTO.setEmail("admin" + i); - userDTO.setPassword("admin"); - userDTO.setAdmin(i % 2 == 0); - service.createOrUpdate(userDTO); - - } - } - + service.createDefaultAdminUser(); } } finally { transaction.closeContext(); Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractJSONPaginedAction.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractJSONPaginedAction.java 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractJSONPaginedAction.java 2011-11-13 22:22:54 UTC (rev 55) @@ -24,7 +24,7 @@ package fr.ifremer.echobase.ui.actions; import fr.ifremer.echobase.services.Pager; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.struts2.json.JSONException; import org.apache.struts2.json.JSONUtil; Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2011-11-13 22:22:54 UTC (rev 55) @@ -132,7 +132,7 @@ */ protected EchoBaseServiceContext getServiceContext() { if (serviceContext == null) { - serviceContext = new EchoBaseServiceContextImpl( + serviceContext = EchoBaseServiceContextImpl.newContext( getLocale(), getTransaction(), getConfiguration(), Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadEntities.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadEntities.java 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadEntities.java 2011-11-13 22:22:54 UTC (rev 55) @@ -29,7 +29,7 @@ import fr.ifremer.echobase.entities.meta.TableMeta; import fr.ifremer.echobase.services.DbEditorService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.nuiton.topia.persistence.TopiaEntity; import java.util.List; Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java 2011-11-13 22:22:54 UTC (rev 55) @@ -27,7 +27,7 @@ import fr.ifremer.echobase.entities.meta.TableMeta; import fr.ifremer.echobase.services.DbEditorService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.struts2.interceptor.ParameterAware; import org.nuiton.util.beans.PropertyDiff; Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/CreateEmbeddedApplication.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/CreateEmbeddedApplication.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/CreateEmbeddedApplication.java 2011-11-13 22:22:54 UTC (rev 55) @@ -0,0 +1,91 @@ +/* + * #%L + * EchoBase :: UI + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package fr.ifremer.echobase.ui.actions.export; + +import fr.ifremer.echobase.EchoBaseConfiguration; +import fr.ifremer.echobase.entities.Voyage; +import fr.ifremer.echobase.services.VoyageService; +import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; +import org.nuiton.util.Version; + +import java.io.File; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * To create the embeddedApplication. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class CreateEmbeddedApplication extends EchoBaseActionSupport { + + private static final long serialVersionUID = 1L; + + /** Universe of voyages to export in db. */ + protected Map<String, String> voyages; + + /** Default file name to create. */ + protected String fileName; + + /** File name of the war used. */ + protected String warFileName; + + public Map<String, String> getVoyages() { + return voyages; + } + + public Set<String> getVoyageIds() { + return voyages.keySet(); + } + + public String getFileName() { + return fileName; + } + + public String getWarFileName() { + return warFileName; + } + + @Override + public String execute() throws Exception { + + VoyageService service = newService(VoyageService.class); + List<Voyage> allVoyages = service.getVoyages(); + voyages = sortAndDecorate(allVoyages, null); + + EchoBaseConfiguration configuration = getConfiguration(); + Version version = configuration.getApplicationVersion(); + fileName = "echobase-embedded-" + version.toString(); + File warLocation = configuration.getWarLocation(); + if (!warLocation.exists()) { + addActionError(_("echobase.error.warlocation.notFound", + warLocation)); + } + warFileName = warLocation.getName(); + return SUCCESS; + } + +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/CreateEmbeddedApplication.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/DownloadEmbeddedApplication.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/DownloadEmbeddedApplication.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/DownloadEmbeddedApplication.java 2011-11-13 22:22:54 UTC (rev 55) @@ -0,0 +1,94 @@ +/* + * #%L + * EchoBase :: UI + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package fr.ifremer.echobase.ui.actions.export; + +import fr.ifremer.echobase.services.EmbeddedApplicationService; +import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +/** + * Download the result of sql request in csv format. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class DownloadEmbeddedApplication extends EchoBaseActionSupport { + + private static final long serialVersionUID = 1L; + + /** Input stream of the file to download. */ + protected transient InputStream inputStream; + + /** File name of the download. */ + protected String fileName; + + /** Length of the file to download. */ + protected long contentLength; + + /** Content type of the file to download. */ + protected String contentType; + + /** Selected voyage ids to export. */ + protected String[] voyageIds; + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public void setVoyageIds(String[] voyageIds) { + this.voyageIds = voyageIds; + } + + public InputStream getInputStream() { + return inputStream; + } + + public long getContentLength() { + return contentLength; + } + + public String getContentType() { + return contentType; + } + + public String getFileName() { + return fileName; + } + + @Override + public String execute() throws Exception { + + EmbeddedApplicationService service = + newService(EmbeddedApplicationService.class); + contentType = "application/zip"; + File zipFile = service.createEmbeddedApplication(fileName, voyageIds); + contentLength = zipFile.length(); + fileName += ".zip"; + inputStream = new FileInputStream(zipFile); + return SUCCESS; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/DownloadEmbeddedApplication.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/DownloadExportSqlResult.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/DownloadExportSqlResult.java 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/DownloadExportSqlResult.java 2011-11-13 22:22:54 UTC (rev 55) @@ -30,7 +30,7 @@ import java.io.InputStream; /** - * To export sql to a csv file. + * Download the result of sql request in csv format. * * @author tchemit <chemit@codelutin.com> * @since 0.1 @@ -84,7 +84,7 @@ ExportSqlService service = newService(ExportSqlService.class); contentType = "text/csv"; - String content = service.createCsvStream( + String content = service.createCsvFileContent( sql, getEchoBaseSession().getEchoBaseUser() ); Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/ExportSql.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/ExportSql.java 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/export/ExportSql.java 2011-11-13 22:22:54 UTC (rev 55) @@ -27,7 +27,7 @@ import fr.ifremer.echobase.entities.ExportQueryImpl; import fr.ifremer.echobase.services.ExportSqlService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.util.Collection; import java.util.Map; @@ -84,7 +84,7 @@ } else { // load query from database - query = service.getQuery(selectedQueryId); + query = service.getQueryById(selectedQueryId); } return SUCCESS; } Modified: trunk/echobase-ui/src/main/resources/config/struts-export.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-export.xml 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/resources/config/struts-export.xml 2011-11-13 22:22:54 UTC (rev 55) @@ -32,7 +32,7 @@ <package name="export" extends="loggued" namespace="/export"> <result-types> - <result-type name="redirectToMainPage" + <result-type name="redirectExportSql" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"> <param name="actionName">exportSql</param> <param name="namespace">export</param> @@ -43,41 +43,47 @@ <!-- Display export sql main page --> <action name="exportSql" class="fr.ifremer.echobase.ui.actions.export.ExportSql"> - <result>/WEB-INF/jsp/export/export.jsp</result> + <result>/WEB-INF/jsp/export/exportSql.jsp</result> </action> <!-- Display the result of the sql query execution --> - <action name="loadResult" + <action name="exportSqlResult" class="fr.ifremer.echobase.ui.actions.export.ExportSqlResult"> - <result>/WEB-INF/jsp/export/exportGrid.jsp</result> + <result>/WEB-INF/jsp/export/exportSqlResult.jsp</result> </action> + <!-- Display the create embedded application main page --> + <action name="createEmbeddedApplication" + class="fr.ifremer.echobase.ui.actions.export.CreateEmbeddedApplication"> + <result>/WEB-INF/jsp/export/createEmbeddedApplication.jsp</result> + </action> + <!-- Get result of the sql query execution --> - <action name="getExportSqlResult" method="execute" + <action name="getExportSqlResult" class="fr.ifremer.echobase.ui.actions.export.GetSqlResult"> <result type="json"/> </action> <!-- Clone the sql query --> - <action name="cloneQuery" method="cloneQuery" + <action name="cloneExportQuery" method="cloneQuery" class="fr.ifremer.echobase.ui.actions.export.ManageExportQuery"> - <result type="redirectToMainPage"/> + <result type="redirectExportSql"/> </action> <!-- Save the sql query --> - <action name="saveQuery" method="saveQuery" + <action name="saveExportQuery" method="saveQuery" class="fr.ifremer.echobase.ui.actions.export.ManageExportQuery"> - <result type="redirectToMainPage"/> + <result type="redirectExportSql"/> </action> <!-- Delete the sql query --> - <action name="deleteQuery" method="deleteQuery" + <action name="deleteExportQuery" method="deleteQuery" class="fr.ifremer.echobase.ui.actions.export.ManageExportQuery"> - <result type="redirectToMainPage"/> + <result type="redirectExportSql"/> </action> - <!-- Download the sql query csb file --> - <action name="downloadExport" + <!-- Download the sql query csv file --> + <action name="downloadExportSqlResult" class="fr.ifremer.echobase.ui.actions.export.DownloadExportSqlResult"> <result type="stream"> <param name="contentType">${contentType}</param> @@ -86,6 +92,16 @@ </result> </action> + <!-- Download the embedded application zip file --> + <action name="downloadEmbeddedApplication" + class="fr.ifremer.echobase.ui.actions.export.DownloadEmbeddedApplication"> + <result type="stream"> + <param name="contentType">${contentType}</param> + <param name="contentLength">${contentLength}</param> + <param name="contentDisposition">filename="${fileName}"</param> + </result> + </action> + </package> </struts> Modified: trunk/echobase-ui/src/main/resources/echobase.properties =================================================================== --- trunk/echobase-ui/src/main/resources/echobase.properties 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/resources/echobase.properties 2011-11-13 22:22:54 UTC (rev 55) @@ -22,14 +22,14 @@ # #L% ### -application.version=${project.version} -application.site.url=${project.url} +project.version=${project.version} +project.site.url=${project.url} hibernate.hbm2ddl.auto=none hibernate.show_sql=false hibernate.dialect=org.hibernate.dialect.H2Dialect hibernate.connection.driver_class=org.h2.Driver -hibernate.connection.url=jdbc:h2:file:${data.directory}/db/h2data +hibernate.connection.url=jdbc:h2:file:${data.directory}/db/echobase hibernate.connection.username=sa hibernate.connection.password=sa \ No newline at end of file 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 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2011-11-13 22:22:54 UTC (rev 55) @@ -2,6 +2,7 @@ echobase.action.backToUserList=Retour à la liste des utilisateurs echobase.action.cloneSqlQuery=Cloner la requête echobase.action.create=Créer +echobase.action.createEmbeddedApplication=Créer l'application echobase.action.delete=Suppression echobase.action.deleteSqlQuery=Supprimer la requête echobase.action.exportSqlData=Exporter les données @@ -16,6 +17,8 @@ echobase.common.admin=Administrateur echobase.common.comment=Commentaire echobase.common.email=Email +echobase.common.embeddedApplicationFileName=Nom de l'archive à télécharger +echobase.common.embeddedWarFileName=Nom du war à utiliser echobase.common.exportFileName=Nom du fichier d'export echobase.common.import=Import configuration echobase.common.jdbcLogin=Login de connexion @@ -29,12 +32,15 @@ echobase.common.tableName=Nom de la table echobase.common.user=Utilisateur echobase.common.voyage=Campagne +echobase.common.voyagesToSelect=Campagnes à exporter +echobase.embeddedApplication.configuration=Configuration de l'application embarquée echobase.error.bad.password=Mot de passe incorrrect echobase.error.email.already.used= echobase.error.importArgument= echobase.error.login.unknown=Utilisateur inconnu echobase.error.required.email=L'email est obligatoire echobase.error.required.password=Le mot de passe est obligatoire +echobase.error.warlocation.notFound=L'application n'a pas été trouvé à l'emplacement suivant %s echobase.export.queryDescription=Description echobase.export.queryName=Nom echobase.export.querySql=SQL @@ -58,6 +64,7 @@ echobase.label.user.login=Utilisateur \: %s echobase.label.welcome=Bienvenue dans EchoBase echobase.menu.connectToDbInformations=Se connecter à la base +echobase.menu.createEmbeddedApplication=Créer une application embarquée echobase.menu.dbeditor=Modifier les données echobase.menu.export=Exporter des données echobase.menu.import=Importer des données @@ -71,6 +78,7 @@ echobase.sqlQuery.result=Résultats de la requête echobase.title.connectToDbInformations=Se connecter à la base de données echobase.title.connectionToDb.detail=Détail de la connection à la base de données +echobase.title.createEmbeddedApplication=Création de l'application embarquée echobase.title.dbEditor=Modification de la base echobase.title.entityModificationLogs=Journal des modifications echobase.title.export=Export Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2011-11-13 22:22:54 UTC (rev 55) @@ -78,13 +78,17 @@ <s:text name="echobase.menu.connectToDbInformations"/> </s:a> </li> - <s:if - test="%{userIsAdmin}"> + <s:if test="%{userIsAdmin}"> <li> <s:a action="userList" namespace="/user"> <s:text name="echobase.menu.users"/> </s:a> </li> + <li> + <s:a action="createEmbeddedApplication" namespace="/export"> + <s:text name="echobase.menu.createEmbeddedApplication"/> + </s:a> + </li> </s:if> </ul> </div> Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/createEmbeddedApplication.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/createEmbeddedApplication.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/createEmbeddedApplication.jsp 2011-11-13 22:22:54 UTC (rev 55) @@ -0,0 +1,60 @@ +<%-- + #%L + EchoBase :: UI + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + +<title><s:text name="echobase.title.createEmbeddedApplication"/></title> + +<s:form namespace="/export"> + + <br/> + + <fieldset> + <legend><s:text name="echobase.embeddedApplication.configuration"/></legend> + + <s:checkboxlist list="voyages" key="voyageIds" + label="%{getText('echobase.common.voyagesToSelect')}"/> + + <s:textfield key="fileName" required="true" size="100" + label="%{getText('echobase.common.embeddedApplicationFileName')} (*)"/> + + <s:label value="%{warFileName}" readonly="true" + label="%{getText('echobase.common.embeddedWarFileName')}"/> + + <s:if test="!hasActionErrors()"> + + <br/> + <s:submit key="echobase.action.createEmbeddedApplication" + action="downloadEmbeddedApplication" + align="right"/> + + </s:if> + + </fieldset> + <div>(*) Il s'agit du nom de l'archvie et du répertoire contenu dans l'archive, + l'extension <strong>.zip</strong> sera automatiquement rajoutée.</div> +</s:form> + + Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/createEmbeddedApplication.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/export.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/export.jsp 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/export.jsp 2011-11-13 22:22:54 UTC (rev 55) @@ -1,136 +0,0 @@ -<%-- - #%L - EchoBase :: UI - - $Id$ - $HeadURL$ - %% - Copyright (C) 2011 Ifremer, Codelutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% - --%> -<%@page contentType="text/html" pageEncoding="UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> - -<s:url id="loadUrl" action='exportSql' namespace='/export'/> -<s:url id="loadGridUrl" action="loadResult" namespace="/export"/> -<script type="text/javascript"> - - function reloadQuery() { - var queryId = $('[name="query.topiaId"]').val(); - var url = "${loadUrl}?" + $.param({ 'query.topiaId':queryId}); - window.location = url; - return false; - } - - function loadGridData() { - // get sql query - var sqlQuery = "${loadGridUrl}?" + $.param({ sql :$('[name="query.sqlQuery"]').val()}); - - $.ajax(sqlQuery, { - success: function(data, textStatus, jqXHR) { - $('#resultGrid').html(data); - } - }); - return false; - } - - jQuery(document).ready(function () { - - $('[name="query.topiaId"]').change(function(event) { - var url = "${loadUrl}?" + $.param({ 'query.topiaId':this.value}); - window.location = url; - }); - - var queryId = $('[name="query.topiaId"]').val(); - if (queryId) { - // auto launch query - loadGridData(); - } - - }); - - -</script> - -<title><s:text name="echobase.title.export"/></title> - - -<s:set var="queryExists" value="query.topiaId != null && query.topiaId != ''"/> - -<s:form id="exportQueryForm" namespace="/export"> - - <s:select key="query.topiaId" label="%{getText('echobase.common.sqlQueries')}" - list="queries" headerKey="" headerValue=""/> - - <br/> - - <fieldset> - <legend><s:text name="echobase.sqlQuery.configuration"/></legend> - - <s:textarea key="query.name" required="true" cols="160" rows="1" - label="%{getText('echobase.common.query.name')}"/> - - <s:textarea key="query.description" required="true" cols="160" rows="2" - label="%{getText('echobase.common.query.description')}"/> - - <s:textarea key="query.sqlQuery" required="true" cols="160" rows="4" - label="%{getText('echobase.common.sqlQuery')}"/> - - <s:if test="queryExists"> - - <s:label value="%{query.lastModifiedDate}" readonly="true" - label="%{getText('echobase.common.lastModifiedDate')}"/> - - <s:label value="%{decorate(query.lastModifiedUser, null)}" readonly="true" - label="%{getText('echobase.common.lastModifiedUser')}"/> - - </s:if> - - - <ul class="toolbar floatRight"> - <s:if test="queryExists"> - <li> - <s:submit onclick="return reloadQuery();" - key="echobase.action.reloadSqlQuery" - theme="simple"/> - </li> - <li> - <s:submit action="cloneQuery" key="echobase.action.cloneSqlQuery" - theme="simple"/> - </li> - <li> - <s:submit action="deleteQuery" key="echobase.action.deleteSqlQuery" - theme="simple"/> - </li> - </s:if> - <li> - <s:submit action="saveQuery" key="echobase.action.saveSqlQuery" - theme="simple"/> - </li> - <li> - <s:submit key="echobase.action.applySqlQuery" theme="simple" - onclick="return loadGridData();"/> - </li> - </ul> - </fieldset> -</s:form> - -<br/> - -<div id="resultGrid" class="cleanBoth"></div> - - Deleted: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportGrid.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportGrid.jsp 2011-11-13 22:20:37 UTC (rev 54) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportGrid.jsp 2011-11-13 22:22:54 UTC (rev 55) @@ -1,64 +0,0 @@ -<%-- - #%L - EchoBase :: UI - - $Id$ - $HeadURL$ - %% - Copyright (C) 2011 Ifremer, Codelutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% - --%> -<%@page contentType="text/html" pageEncoding="UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> -<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> - -<s:url id="loadUrl" action="getExportSqlResult" namespace="/export" - escapeAmp="false"> - <s:param name="sql" value="%{sql}"/> -</s:url> - -<s:form action="downloadExport" namespace="/export"> - - <fieldset> - <legend><s:text name="echobase.sqlQuery.result"/></legend> - - <s:hidden key="sql" label=""/> - <s:textfield key="fileName" required="true" size="100" - label="%{getText('echobase.common.exportFileName')}"/> - <s:submit key="echobase.action.exportSqlData" align="left"/> - <br/> -<sjg:grid id="rows" caption="%{getText('echobase.common.request.result')}" - dataType="json" href="%{loadUrl}" gridModel="datas" - pager="true" pagerButtons="true" pagerInput="true" - navigator="true" autowidth="true" rownumbers="false" - navigatorEdit="false" navigatorDelete="false" - navigatorSearch="false" navigatorRefresh="false" - navigatorAdd="false" rowList="10,15,20,50" rowNum="10" - viewrecords="true"> - - <s:iterator value="columnNames" var="name" status="status"> - - <sjg:gridColumn name="%{#name}" title="%{#name}" sortable="false"/> - - </s:iterator> - -</sjg:grid> - </fieldset> -</s:form> - - - Copied: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportSql.jsp (from rev 51, trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/export.jsp) =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportSql.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportSql.jsp 2011-11-13 22:22:54 UTC (rev 55) @@ -0,0 +1,135 @@ +<%-- + #%L + EchoBase :: UI + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + +<s:url id="reloadUrl" action='exportSql' namespace='/export'/> +<s:url id="exportSqlResultUrl" action="exportSqlResult" namespace="/export"/> +<script type="text/javascript"> + + function reloadQuery() { + var queryId = $('[name="query.topiaId"]').val(); + var url = "${reloadUrl}?" + $.param({ 'query.topiaId':queryId}); + window.location = url; + return false; + } + + function loadGridData() { + // get sql query + var sqlQuery = "${exportSqlResultUrl}?" + + $.param({ sql :$('[name="query.sqlQuery"]').val()}); + + $.ajax(sqlQuery, { + success: function(data, textStatus, jqXHR) { + $('#resultGrid').html(data); + } + }); + return false; + } + + jQuery(document).ready(function () { + + $('[name="query.topiaId"]').change(function(event) { + var url = "${reloadUrl}?" + $.param({ 'query.topiaId':this.value}); + window.location = url; + }); + + var queryId = $('[name="query.topiaId"]').val(); + if (queryId) { + // auto launch query + loadGridData(); + } + + }); + + +</script> + +<title><s:text name="echobase.title.export"/></title> + +<s:set var="queryExists" value="query.topiaId != null && query.topiaId != ''"/> + +<s:form id="exportQueryForm" namespace="/export"> + + <s:select key="query.topiaId" label="%{getText('echobase.common.sqlQueries')}" + list="queries" headerKey="" headerValue=""/> + + <br/> + + <fieldset> + <legend><s:text name="echobase.sqlQuery.configuration"/></legend> + + <s:textarea key="query.name" required="true" cols="160" rows="1" + label="%{getText('echobase.common.query.name')}"/> + + <s:textarea key="query.description" required="true" cols="160" rows="2" + label="%{getText('echobase.common.query.description')}"/> + + <s:textarea key="query.sqlQuery" required="true" cols="160" rows="4" + label="%{getText('echobase.common.sqlQuery')}"/> + + <s:if test="queryExists"> + + <s:label value="%{query.lastModifiedDate}" readonly="true" + label="%{getText('echobase.common.lastModifiedDate')}"/> + + <s:label value="%{decorate(query.lastModifiedUser, null)}" readonly="true" + label="%{getText('echobase.common.lastModifiedUser')}"/> + + </s:if> + + + <ul class="toolbar floatRight"> + <s:if test="queryExists"> + <li> + <s:submit onclick="return reloadQuery();" theme="simple" + key="echobase.action.reloadSqlQuery"/> + </li> + <li> + <s:submit action="cloneExportQuery" theme="simple" + key="echobase.action.cloneSqlQuery"/> + </li> + <li> + <s:submit action="deleteExportQuery" theme="simple" + key="echobase.action.deleteSqlQuery"/> + </li> + </s:if> + <li> + <s:submit action="saveExportQuery" theme="simple" + key="echobase.action.saveSqlQuery"/> + </li> + <li> + <s:submit key="echobase.action.applySqlQuery" theme="simple" + onclick="return loadGridData();"/> + </li> + </ul> + </fieldset> +</s:form> + +<br/> + +<div id="resultGrid" class="cleanBoth"></div> + + Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportSql.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportSqlResult.jsp (from rev 51, trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportGrid.jsp) =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportSqlResult.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportSqlResult.jsp 2011-11-13 22:22:54 UTC (rev 55) @@ -0,0 +1,64 @@ +<%-- + #%L + EchoBase :: UI + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> +<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> + +<s:url id="loadUrl" action="getExportSqlResult" namespace="/export" + escapeAmp="false"> + <s:param name="sql" value="%{sql}"/> +</s:url> + +<s:form action="downloadExportSqlResult" namespace="/export"> + + <fieldset> + <legend><s:text name="echobase.sqlQuery.result"/></legend> + + <s:hidden key="sql" label=""/> + <s:textfield key="fileName" required="true" size="100" + label="%{getText('echobase.common.exportFileName')}"/> + <s:submit key="echobase.action.exportSqlData" align="left"/> + <br/> +<sjg:grid id="rows" caption="%{getText('echobase.common.request.result')}" + dataType="json" href="%{loadUrl}" gridModel="datas" + pager="true" pagerButtons="true" pagerInput="true" + navigator="true" autowidth="true" rownumbers="false" + navigatorEdit="false" navigatorDelete="false" + navigatorSearch="false" navigatorRefresh="false" + navigatorAdd="false" rowList="10,15,20,50" rowNum="10" + viewrecords="true"> + + <s:iterator value="columnNames" var="name" status="status"> + + <sjg:gridColumn name="%{#name}" title="%{#name}" sortable="false"/> + + </s:iterator> + +</sjg:grid> + </fieldset> +</s:form> + + + Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportSqlResult.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native
participants (1)
-
tchemit@users.forge.codelutin.com