Author: chatellier Date: 2010-12-09 14:05:20 +0000 (Thu, 09 Dec 2010) New Revision: 381 Log: Begin directory listing Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/IndexAction.java trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/SelectIndicatorAction.java Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/WelcomeUserAction.java trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp trunk/coser-web/src/main/webapp/WEB-INF/content/upload-result-success.jsp trunk/coser-web/src/main/webapp/WEB-INF/content/upload-result.jsp Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/IndexAction.java =================================================================== --- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/IndexAction.java (rev 0) +++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/IndexAction.java 2010-12-09 14:05:20 UTC (rev 381) @@ -0,0 +1,81 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.coser.web.actions; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.nuiton.util.ArgumentsParserException; + +import com.opensymphony.xwork2.ActionSupport; + +import fr.ifremer.coser.web.CoserWebConfig; + +/** + * Action index, recupere la liste des resultats. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class IndexAction extends ActionSupport { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1663244944108703571L; + + protected List<String> results; + + public List<String> getResults() { + return results; + } + + @Override + public String execute() { + + CoserWebConfig config = new CoserWebConfig(); + try { + config.parse(new String[]{}); + } catch (ArgumentsParserException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + File directory = config.getResultDirectory(); + File[] subDirectories = directory.listFiles(); + + results = new ArrayList<String>(); + for (File subDirectory : subDirectories) { + if (subDirectory.isDirectory()) { + results.add(subDirectory.getName()); + } + } + + return SUCCESS; + } +} Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/IndexAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/SelectIndicatorAction.java =================================================================== --- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/SelectIndicatorAction.java (rev 0) +++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/SelectIndicatorAction.java 2010-12-09 14:05:20 UTC (rev 381) @@ -0,0 +1,90 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package fr.ifremer.coser.web.actions; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.nuiton.util.ArgumentsParserException; + +import com.opensymphony.xwork2.ActionSupport; + +import fr.ifremer.coser.web.CoserWebConfig; + +/** + * Action index, recupere la liste des resultats. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class SelectIndicatorAction extends ActionSupport { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1663244944108703571L; + + protected String result; + + protected List<String> indicatorNames; + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public List<String> getIndicatorNames() { + return indicatorNames; + } + + public void setIndicatorNames(List<String> indicatorNames) { + this.indicatorNames = indicatorNames; + } + + @Override + public String execute() { + + CoserWebConfig config = new CoserWebConfig(); + try { + config.parse(new String[]{}); + } catch (ArgumentsParserException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + File directory = config.getResultDirectory(); + File resultDirectory = new File(directory, result); + + + + return SUCCESS; + } +} Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/SelectIndicatorAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/WelcomeUserAction.java =================================================================== --- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/WelcomeUserAction.java 2010-12-09 14:04:55 UTC (rev 380) +++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/WelcomeUserAction.java 2010-12-09 14:05:20 UTC (rev 381) @@ -26,9 +26,6 @@ package fr.ifremer.coser.web.actions; import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.Namespace; -import org.apache.struts2.convention.annotation.Result; -import org.apache.struts2.convention.annotation.ResultPath; import com.opensymphony.xwork2.ActionSupport; Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp =================================================================== --- trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp 2010-12-09 14:04:55 UTC (rev 380) +++ trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp 2010-12-09 14:05:20 UTC (rev 381) @@ -16,5 +16,9 @@ <s:textfield name="userName" label="User Name" /> <s:submit /> </s:form> + <hr /> + <s:form action="select-indicator"> + <s:select name="result" list="results" label="Result name"/> + </s:form> </body> </html> \ No newline at end of file Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/upload-result-success.jsp =================================================================== --- trunk/coser-web/src/main/webapp/WEB-INF/content/upload-result-success.jsp 2010-12-09 14:04:55 UTC (rev 380) +++ trunk/coser-web/src/main/webapp/WEB-INF/content/upload-result-success.jsp 2010-12-09 14:05:20 UTC (rev 381) @@ -7,6 +7,7 @@ <title>Hello World</title> </head> <body> + Success !!! <s:form action="upload-result" method="post" enctype="multipart/form-data"> <s:file name="resultFile" label="Result archive" /> <s:submit /> Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/upload-result.jsp =================================================================== --- trunk/coser-web/src/main/webapp/WEB-INF/content/upload-result.jsp 2010-12-09 14:04:55 UTC (rev 380) +++ trunk/coser-web/src/main/webapp/WEB-INF/content/upload-result.jsp 2010-12-09 14:05:20 UTC (rev 381) @@ -7,7 +7,8 @@ <title>Hello World</title> </head> <body> - Success !!! + <s:a action="index">Index</s:a> + <s:form action="upload-result" method="post" enctype="multipart/form-data"> <s:actionerror /> <s:file name="resultFile" label="Result archive" />