Author: echatellier Date: 2011-12-23 15:17:30 +0100 (Fri, 23 Dec 2011) New Revision: 927 Url: http://forge.codelutin.com/repositories/revision/coser/927 Log: #520 : Page d'administration des projets en ligne Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/DeleteProjectsAction.java trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/IndexAction.java trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ListProjectsAction.java trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/LoginAction.java trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/LoginInterceptor.java trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/PerformLoginAction.java trunk/coser-web/src/main/webapp/WEB-INF/content/admin/ trunk/coser-web/src/main/webapp/WEB-INF/content/admin/index.jsp trunk/coser-web/src/main/webapp/WEB-INF/content/admin/list-projects.jsp trunk/coser-web/src/main/webapp/WEB-INF/content/admin/login.jsp trunk/coser-web/src/main/webapp/WEB-INF/content/admin/perform-login-input.jsp Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package.properties trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_en.properties trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_fr.properties trunk/coser-web/src/main/resources/struts.xml trunk/coser-web/src/main/webapp/WEB-INF/content/com/graph.jsp trunk/coser-web/src/main/webapp/styles/coser.css Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java 2011-12-23 14:16:06 UTC (rev 926) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java 2011-12-23 14:17:30 UTC (rev 927) @@ -944,7 +944,7 @@ /** * Fait le menage dans le dossier courant des projets en supprimant - * tout les resulat qui ont un result id non present dans la liste + * tout les resulat qui ont un result id present dans la liste * {@code newResultIds}. * * Supprime egalement les selections qui n'ont plus de résultats et @@ -1135,8 +1135,36 @@ return zonesForFacade; } - + /** + * Retourne les zones disponible par facade. + * + * @return couple facadeid/list<zoneid> + * @throws CoserBusinessException + */ + public Map<String, List<String>> getZoneByFacade() throws CoserBusinessException { + Map<String, List<String>> zonesByFacade = new HashMap<String, List<String>>(); + + // get subzone for main zone + List<String> subZones = new ArrayList<String>(); + Iterator<String[]> itZone = getZonesMap().iterator(true); + while (itZone.hasNext()) { + // "id";"facadeid";"facade";"zone";"periode";"serie";"comment";"map" + String[] tuple = itZone.next(); + String facadeid = tuple[1]; + String zoneid = tuple[0]; + List<String> zones = zonesByFacade.get(facadeid); + if (zones == null) { + zones = new ArrayList<String>(); + zonesByFacade.put(facadeid, zones); + } + zones.add(zoneid); + } + + return zonesByFacade; + } + + /** * Pour une zone principale, recupere la liste des campagnes qui sont * disponible dans cette zone principale. * @@ -2330,4 +2358,95 @@ return result; } + + /** + * Recupere dans le repertoire des projets d'indicateur les resultats + * disponible par zone (il ne peut y en avoir qu'un par zone). + * + * @return une map avec par zone, son resultat associé (ProjectName/SelectionName) + * @throws CoserBusinessException + */ + public Map<String, String> getIndicatorsResultsPerZone() throws CoserBusinessException { + return getResultsPerZone(config.getWebIndicatorsProjectsDirectory()); + } + + /** + * Recupere dans le repertoire des projets d'indicateur les resultats + * disponible par zone (il ne peut y en avoir qu'un par zone). + * + * @return une map avec par zone, son resultat associé (ProjectName/SelectionName) + * @throws CoserBusinessException + */ + public Map<String, String> getMapsResultsPerZone() throws CoserBusinessException { + return getResultsPerZone(config.getWebMapsProjectsDirectory()); + } + + /** + * Recupere dans le repertoire des projets d'indicateur les resultats + * disponible par zone (il ne peut y en avoir qu'un par zone). + * + * @param scanDirectory le repertoire a scanner + * @return une map avec par zone, son resultat associé (ProjectName/SelectionName/RSUfiName) + * @throws CoserBusinessException + */ + protected Map<String, String> getResultsPerZone(File scanDirectory) throws CoserBusinessException { + + Map<String, String> resultIds = new HashMap<String, String>(); + File[] projectFiles = scanDirectory.listFiles(); + if (projectFiles != null) { + for (File projectFile : projectFiles) { + if (projectFile.isDirectory()) { + + File selectionsDirectory = new File(projectFile, CoserConstants.STORAGE_SELECTION_DIRECTORY); + File[] selectionFiles = selectionsDirectory.listFiles(); + if (selectionFiles != null) { + for (File selectionFile : selectionFiles) { + if (selectionFile.isDirectory()) { + + File resultsDirectory = new File(selectionFile, CoserConstants.STORAGE_RESULTS_DIRECTORY); + File[] resultFiles = resultsDirectory.listFiles(); + if (resultFiles != null) { + for (File resultFile : resultFiles) { + if (resultFile.isDirectory()) { + RSufiResult rsufiResult = projectService.getRSufiResult(resultFile); + String resultResultId = rsufiResult.getZone(); + String name = projectFile.getName() + "/" + selectionFile.getName() + + "/" + resultFile.getName(); + resultIds.put(resultResultId, name); + } + } + } + } + } + } + } + } + } + + return resultIds; + } + + /** + * Supprime des résultats par leur identifiant de zone de ratachement (car + * un seul resultat par zone). + * + * Utilisé par l'interface d'admin. + * @param deleteZoneId + * @throws CoserBusinessException + */ + public void deleteIndicatorsResult(List<String> deleteZoneId) throws CoserBusinessException { + cleanCurrentProjectDirectory(config.getWebIndicatorsProjectsDirectory(), deleteZoneId); + } + + /** + * Supprime des résultats par leur identifiant de zone de ratachement (car + * un seul resultat par zone). + * + * Utilisé par l'interface d'admin. + * @param deleteZoneId + * @throws CoserBusinessException + */ + public void deleteMapsResult(List<String> deleteZoneId) throws CoserBusinessException { + cleanCurrentProjectDirectory(config.getWebMapsProjectsDirectory(), deleteZoneId); + } } Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/DeleteProjectsAction.java =================================================================== --- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/DeleteProjectsAction.java (rev 0) +++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/DeleteProjectsAction.java 2011-12-23 14:17:30 UTC (rev 927) @@ -0,0 +1,110 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, 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.admin; + +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.struts2.convention.annotation.InterceptorRef; +import org.apache.struts2.convention.annotation.InterceptorRefs; +import org.apache.struts2.convention.annotation.ParentPackage; +import org.apache.struts2.convention.annotation.Result; + +import fr.ifremer.coser.CoserBusinessException; +import fr.ifremer.coser.services.WebService; +import fr.ifremer.coser.web.CoserWebException; +import fr.ifremer.coser.web.ServiceFactory; +import fr.ifremer.coser.web.actions.common.CoserAction; + +/** + * Project list action. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +@ParentPackage("admin") +@InterceptorRefs({ + @InterceptorRef("loginInterceptor"), + @InterceptorRef("defaultStack") +}) +@Result(name="success", type="redirect", location="list-projects") +public class DeleteProjectsAction extends CoserAction { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6024588562104111883L; + + private static final Log log = LogFactory.getLog(DeleteProjectsAction.class); + + /** + * Contient les identifiants des zones dont on souhaites supprimer le + * resultat conrespondant dans le stockage indicateur. + */ + protected List<String> indicatorsZonesId; + + /** + * Contient les identifiants des zones dont on souhaites supprimer le + * resultat conrespondant dans le stockage cartes. + */ + protected List<String> mapsZonesId; + + public void setIndicatorsZonesId(List<String> indicatorsZonesId) { + this.indicatorsZonesId = indicatorsZonesId; + } + + public void setMapsZonesId(List<String> mapsZonesId) { + this.mapsZonesId = mapsZonesId; + } + + public String execute() { + WebService webService = ServiceFactory.getWebService(); + + try { + if (log.isDebugEnabled()) { + log.debug("Delete indicators zone : " + indicatorsZonesId); + } + if (CollectionUtils.isNotEmpty(indicatorsZonesId)) { + webService.deleteIndicatorsResult(indicatorsZonesId); + } + + if (log.isDebugEnabled()) { + log.debug("Delete maps zone : " + mapsZonesId); + } + if (CollectionUtils.isNotEmpty(mapsZonesId)) { + webService.deleteMapsResult(mapsZonesId); + } + } catch (CoserBusinessException ex) { + throw new CoserWebException("Can't get data from web service", ex); + } + + return SUCCESS; + } +} Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/DeleteProjectsAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/IndexAction.java =================================================================== --- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/IndexAction.java (rev 0) +++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/IndexAction.java 2011-12-23 14:17:30 UTC (rev 927) @@ -0,0 +1,53 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, 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.admin; + +import org.apache.struts2.convention.annotation.InterceptorRef; +import org.apache.struts2.convention.annotation.InterceptorRefs; +import org.apache.struts2.convention.annotation.ParentPackage; + +import fr.ifremer.coser.web.actions.common.CoserAction; + +/** + * Admin index action. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +@ParentPackage("admin") +@InterceptorRefs({ + @InterceptorRef("loginInterceptor"), + @InterceptorRef("defaultStack") +}) +public class IndexAction extends CoserAction { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6024588562104111883L; + +} Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/IndexAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ListProjectsAction.java =================================================================== --- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ListProjectsAction.java (rev 0) +++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ListProjectsAction.java 2011-12-23 14:17:30 UTC (rev 927) @@ -0,0 +1,107 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, 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.admin; + +import java.util.List; +import java.util.Map; + +import org.apache.struts2.convention.annotation.InterceptorRef; +import org.apache.struts2.convention.annotation.InterceptorRefs; +import org.apache.struts2.convention.annotation.ParentPackage; + +import fr.ifremer.coser.CoserBusinessException; +import fr.ifremer.coser.services.WebService; +import fr.ifremer.coser.web.CoserWebException; +import fr.ifremer.coser.web.ServiceFactory; +import fr.ifremer.coser.web.actions.common.CoserAction; + +/** + * Project list action. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +@ParentPackage("admin") +@InterceptorRefs({ + @InterceptorRef("loginInterceptor"), + @InterceptorRef("defaultStack") +}) +public class ListProjectsAction extends CoserAction { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6024588562104111883L; + + protected Map<String, String> facades; + protected Map<String, List<String>> zonesByFacades; + + protected Map<String, String> indicatorsResults; + protected Map<String, String> mapsResults; + + public Map<String, String> getFacades() { + return facades; + } + + public Map<String, List<String>> getZonesByFacades() { + return zonesByFacades; + } + + public Map<String, String> getIndicatorsResults() { + return indicatorsResults; + } + + public Map<String, String> getMapsResults() { + return mapsResults; + } + + public String getZoneDisplayName(String zoneId) { + WebService webService = ServiceFactory.getWebService(); + String zoneDisplayName = null; + try { + zoneDisplayName = webService.getZoneFullName(zoneId); + } catch (CoserBusinessException ex) { + throw new CoserWebException("Can't get zone name", ex); + } + return zoneDisplayName; + } + + public String execute() { + WebService webService = ServiceFactory.getWebService(); + + try { + facades = webService.getFacades(); + zonesByFacades = webService.getZoneByFacade(); + indicatorsResults = webService.getIndicatorsResultsPerZone(); + mapsResults = webService.getMapsResultsPerZone(); + } catch (CoserBusinessException ex) { + throw new CoserWebException("Can't get data from web service", ex); + } + + return SUCCESS; + } +} Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ListProjectsAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/LoginAction.java =================================================================== --- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/LoginAction.java (rev 0) +++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/LoginAction.java 2011-12-23 14:17:30 UTC (rev 927) @@ -0,0 +1,44 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 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.admin; + +import fr.ifremer.coser.web.actions.common.CoserAction; + +/** + * Login action. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class LoginAction extends CoserAction { + + /** serialVersionUID. */ + private static final long serialVersionUID = -1576602720835497842L; + +} Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/LoginAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/LoginInterceptor.java =================================================================== --- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/LoginInterceptor.java (rev 0) +++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/LoginInterceptor.java 2011-12-23 14:17:30 UTC (rev 927) @@ -0,0 +1,78 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 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.admin; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.apache.struts2.StrutsStatics; + +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.ActionInvocation; +import com.opensymphony.xwork2.interceptor.Interceptor; + +/** + * Authentication interceptor. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class LoginInterceptor implements Interceptor { + + /** serialVersionUID. */ + private static final long serialVersionUID = -5760224375232019437L; + + /* + * @see com.opensymphony.xwork2.interceptor.Interceptor#init() + */ + @Override + public void init() { + + } + + public String intercept(ActionInvocation invocation) throws Exception { + ActionContext context = invocation.getInvocationContext(); + HttpServletRequest request = (HttpServletRequest) context.get(StrutsStatics.HTTP_REQUEST); + HttpSession session = request.getSession(true); + Object login = session.getAttribute("login"); + if (login == null) { + return "redirect-login"; + } else { + return invocation.invoke(); + } + } + + /* + * @see com.opensymphony.xwork2.interceptor.Interceptor#destroy() + */ + @Override + public void destroy() { + + } +} \ No newline at end of file Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/LoginInterceptor.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/PerformLoginAction.java =================================================================== --- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/PerformLoginAction.java (rev 0) +++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/PerformLoginAction.java 2011-12-23 14:17:30 UTC (rev 927) @@ -0,0 +1,112 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, 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.admin; + +import java.util.Map; + +import org.apache.struts2.convention.annotation.Result; +import org.apache.struts2.interceptor.SessionAware; +import org.nuiton.util.StringUtil; + +import fr.ifremer.coser.web.CoserWebConfig; +import fr.ifremer.coser.web.ServiceFactory; +import fr.ifremer.coser.web.actions.common.CoserAction; + +/** + * Perform login action. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +@Result(name="success", type="redirect", location="index") +public class PerformLoginAction extends CoserAction implements SessionAware { + + /** serialVersionUID. */ + private static final long serialVersionUID = -1576602720835497842L; + + protected String login; + + protected String password; + + private Map<String, Object> session; + + public void setLogin(String login) { + this.login = login; + } + + public void setPassword(String password) { + this.password = password; + } + + /* + * @see org.apache.struts2.interceptor.SessionAware#setSession(java.util.Map) + */ + @Override + public void setSession(Map<String, Object> session) { + this.session = session; + } + + @Override + public String execute() throws Exception { + CoserWebConfig config = ServiceFactory.getCoserConfig(); + if (config.getAdminLogin().equals(login) && equalsSHA1Password(config, password)) { + session.put("login", login); + return SUCCESS; + } else { + addActionError("Invalid login/password"); + return INPUT; + } + } + + /** + * Check if sha1 password equals to config password. + * + * Config password can be plain or sha1 encoded. + * + * @param config config + * @param password password to check + * @return equality + */ + protected boolean equalsSHA1Password(CoserWebConfig config, String password) { + + // first test sha1 equality + String configSha1Password = config.getAdminPassword(); + String sha1Password = StringUtil.encodeSHA1(password); + boolean result = configSha1Password.equals(sha1Password); + + // second test to encode sha1 of plain password + if (!result) { + configSha1Password = StringUtil.encodeSHA1(configSha1Password); + result = configSha1Password.equals(sha1Password); + } + + return result; + } + +} Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/PerformLoginAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package.properties =================================================================== --- trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package.properties 2011-12-23 14:16:06 UTC (rev 926) +++ trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package.properties 2011-12-23 14:17:30 UTC (rev 927) @@ -21,6 +21,15 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # #L% ### +message.admin.title=Coser admin +message.admin.indexaction=Administration actions +message.admin.listprojects.deleteselected=Delete selected projects +message.admin.listprojects.title=Projects management +message.admin.listprojects.indicatorsprojects=Indicators projects by zones +message.admin.listprojects.mapsprojects=Maps projects by zones +message.admin.login=Login +message.admin.loginrequiered=Autentication required +message.admin.password=Password message.com.downloadascsv=Download as CSV message.com.downloadaszip=Download as ZIP message.com.moredetailspdf=More information on calculated community indices @@ -39,6 +48,7 @@ message.common.selectsurvey=Select a survey message.common.selectzone=Select an area message.common.validform=Valid +message.common.zone=Zone message.documents.genparagraph1=Grands invert�br�s et poissons observ�s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. 2009. {0} message.documents.genparagraph2=Grands invert�br�s et poissons observ�s par les campagnes scientifiques. Bilan 2007. 2009. {0} message.documents.genparagraph3=L''�tat des communaut�s exploit�es au large des c\u00F4tes de France. Application d''indicateurs � l''�valuation de l''impact de la p�che. Bilan 2004 Edition 2009. {0} Modified: trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_en.properties =================================================================== --- trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_en.properties 2011-12-23 14:16:06 UTC (rev 926) +++ trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_en.properties 2011-12-23 14:17:30 UTC (rev 927) @@ -21,6 +21,15 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # #L% ### +message.admin.title=Coser admin +message.admin.indexaction=Administration actions +message.admin.listprojects.deleteselected=Delete selected projects +message.admin.listprojects.title=Projects management +message.admin.listprojects.indicatorsprojects=Indicators projects by zones +message.admin.listprojects.mapsprojects=Maps projects by zones +message.admin.login=Login +message.admin.loginrequiered=Autentication required +message.admin.password=Password message.com.downloadascsv=Download as CSV message.com.downloadaszip=Download as ZIP message.com.moredetailspdf=More information on calculated community indices @@ -39,6 +48,7 @@ message.common.selectsurvey=Select a survey message.common.selectzone=Select an area message.common.validform=Valid +message.common.zone=Zone message.documents.genparagraph1=Grands invert�br�s et poissons observ�s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. 2009. {0} message.documents.genparagraph2=Grands invert�br�s et poissons observ�s par les campagnes scientifiques. Bilan 2007. 2009. {0} message.documents.genparagraph3=L''�tat des communaut�s exploit�es au large des c\u00F4tes de France. Application d''indicateurs � l''�valuation de l''impact de la p�che. Bilan 2004 Edition 2009. {0} Modified: trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_fr.properties =================================================================== --- trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_fr.properties 2011-12-23 14:16:06 UTC (rev 926) +++ trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_fr.properties 2011-12-23 14:17:30 UTC (rev 927) @@ -21,6 +21,15 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # #L% ### +message.admin.title=Coser admin +message.admin.indexaction=Actions d''administration +message.admin.listprojects.deleteselected=Supprimer les projets s�lectionn�s +message.admin.listprojects.title=Gestion des projets +message.admin.listprojects.indicatorsprojects=Projects d'indicateur par zones +message.admin.listprojects.mapsprojects=Projects de cartes par zones +message.admin.login=Identifiant +message.admin.loginrequiered=Autentification requise +message.admin.password=Mot de passe message.com.downloadascsv=T�l�charger en CSV message.com.downloadaszip=T�l�charger en ZIP message.com.moredetailspdf=Plus d''informations sur les indices calcul�s des communaut�s @@ -39,6 +48,7 @@ message.common.selectsurvey=S�lectionnez une campagne message.common.selectzone=S�lectionnez une zone message.common.validform=Valider +message.common.zone=Zone message.documents.genparagraph1=Grands invert�br�s et poissons observ�s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. 2009. {0} message.documents.genparagraph2=Grands invert�br�s et poissons observ�s par les campagnes scientifiques. Bilan 2007. 2009. {0} message.documents.genparagraph3=L''�tat des communaut�s exploit�es au large des c�tes de France. Application d''indicateurs � l''�valuation de l''impact de la p�che. Bilan 2004 Edition 2009. {0} Modified: trunk/coser-web/src/main/resources/struts.xml =================================================================== --- trunk/coser-web/src/main/resources/struts.xml 2011-12-23 14:16:06 UTC (rev 926) +++ trunk/coser-web/src/main/resources/struts.xml 2011-12-23 14:17:30 UTC (rev 927) @@ -6,7 +6,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2010 - 2011 Ifremer, Codelutin + Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric %% 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 @@ -23,10 +23,19 @@ #L% --> -<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> +<!DOCTYPE struts PUBLIC + "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" + "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> - <!-- taille maximale des uploads --> + <constant name="struts.i18n.encoding" value="UTF-8"/> <constant name="struts.multipart.maxSize" value="100097152"/> - <!-- pour ne pas rajouter des balises dans les formulaires html - <constant name="struts.ui.theme" value="simple" /> --> + + <package name="admin" extends="convention-default"> + <interceptors> + <interceptor name="loginInterceptor" class="fr.ifremer.coser.web.actions.admin.LoginInterceptor" /> + </interceptors> + <global-results> + <result name="redirect-login" type="redirect">/admin/login</result> + </global-results> + </package> </struts> Added: trunk/coser-web/src/main/webapp/WEB-INF/content/admin/index.jsp =================================================================== --- trunk/coser-web/src/main/webapp/WEB-INF/content/admin/index.jsp (rev 0) +++ trunk/coser-web/src/main/webapp/WEB-INF/content/admin/index.jsp 2011-12-23 14:17:30 UTC (rev 927) @@ -0,0 +1,41 @@ +<!-- + #%L + Coser :: Web + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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 language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<%@taglib uri="/struts-tags" prefix="s" %> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title><s:text name="message.admin.title" /></title> + </head> + <body> + + <h2><s:text name="message.admin.title" /></h2> + + <h3><s:text name="message.admin.indexaction" /></h3> + + <ul> + <li><s:a action="list-projects" namespace='/admin'><s:text name="message.admin.listprojects.title" /></s:a></li> + </ul> + </body> +</html> \ No newline at end of file Added: trunk/coser-web/src/main/webapp/WEB-INF/content/admin/list-projects.jsp =================================================================== --- trunk/coser-web/src/main/webapp/WEB-INF/content/admin/list-projects.jsp (rev 0) +++ trunk/coser-web/src/main/webapp/WEB-INF/content/admin/list-projects.jsp 2011-12-23 14:17:30 UTC (rev 927) @@ -0,0 +1,85 @@ +<!-- + #%L + Coser :: Web + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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 language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<%@taglib uri="/struts-tags" prefix="s" %> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title><s:text name="message.admin.listprojects.title" /></title> + </head> + <body> + + <h2><s:text name="message.admin.listprojects.title" /></h2> + + <h3><s:text name="message.admin.listprojects.indicatorsprojects" /></h3> + + <form action="delete-projects" class="listprojects" method="post"> + <s:iterator value="facades"> + <div class="listprojects-facade"> + <span class="title"><s:text name="message.common.facade" /> : <s:property value='value' /></span> + <s:iterator value="%{getZonesByFacades().get(key)}" var="zone"> + <div class="listprojects-zone"> + <span class="title"><s:text name="message.common.zone" /> : <s:property value="getZoneDisplayName(#zone)"/></span> + <div class="listprojects-result"> + <s:if test="%{indicatorsResults.get(#zone) == null}"> + Aucun projet trouvé + </s:if> + <s:else> + <input type="checkbox" name="indicatorsZonesId" value="<s:property value="zone" />" /> + <s:property value="%{indicatorsResults.get(#zone)}" /> + </s:else> + </div> + </div> + </s:iterator> + </div> + </s:iterator> + <s:submit value='%{getText("message.admin.listprojects.deleteselected")}'/> + </form> + + <h3><s:text name="message.admin.listprojects.mapsprojects" /></h3> + + <form action="delete-projects" class="listprojects" method="post"> + <s:iterator value="facades"> + <div class="listprojects-facade"> + <span class="title"><s:text name="message.common.facade" /> : <s:property value='value' /></span> + <s:iterator value="%{getZonesByFacades().get(key)}" var="zone"> + <div class="listprojects-zone"> + <span class="title"><s:text name="message.common.zone" /> : <s:property value="getZoneDisplayName(#zone)"/></span> + <div class="listprojects-result"> + <s:if test="%{mapsResults.get(#zone) == null}"> + Aucun projet trouvé + </s:if> + <s:else> + <input type="checkbox" name="mapsZonesId" value="<s:property value="zone" />" /> + <s:property value="%{mapsResults.get(#zone)}" /> + </s:else> + </div> + </div> + </s:iterator> + </div> + </s:iterator> + <s:submit value='%{getText("message.admin.listprojects.deleteselected")}'/> + </form> + </body> +</html> \ No newline at end of file Added: trunk/coser-web/src/main/webapp/WEB-INF/content/admin/login.jsp =================================================================== --- trunk/coser-web/src/main/webapp/WEB-INF/content/admin/login.jsp (rev 0) +++ trunk/coser-web/src/main/webapp/WEB-INF/content/admin/login.jsp 2011-12-23 14:17:30 UTC (rev 927) @@ -0,0 +1,45 @@ +<!-- + #%L + Coser :: Web + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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 language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<%@taglib uri="/struts-tags" prefix="s" %> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title><s:text name="message.admin.title" /></title> + </head> + <body> + + <h2><s:text name="message.admin.title" /></h2> + + <h3><s:text name="message.admin.loginrequiered" /></h3> + + <s:form action="perform-login" method="post"> + <s:actionerror /> + <s:textfield name="login" label="%{getText('message.admin.login')}" /> + <s:password name="password" label="%{getText('message.admin.password')}" /> + <s:submit value="%{getText('message.common.validform')}"/> + </s:form> + + </body> +</html> \ No newline at end of file Added: trunk/coser-web/src/main/webapp/WEB-INF/content/admin/perform-login-input.jsp =================================================================== --- trunk/coser-web/src/main/webapp/WEB-INF/content/admin/perform-login-input.jsp (rev 0) +++ trunk/coser-web/src/main/webapp/WEB-INF/content/admin/perform-login-input.jsp 2011-12-23 14:17:30 UTC (rev 927) @@ -0,0 +1,45 @@ +<!-- + #%L + Coser :: Web + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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 language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<%@taglib uri="/struts-tags" prefix="s" %> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title><s:text name="message.admin.title" /></title> + </head> + <body> + + <h2><s:text name="message.admin.title" /></h2> + + <h3><s:text name="message.admin.loginrequiered" /></h3> + + <s:form action="perform-login" method="post"> + <s:actionerror /> + <s:textfield name="login" label="%{getText('message.admin.login')}" /> + <s:password name="password" label="%{getText('message.admin.password')}" /> + <s:submit value="%{getText('message.common.validform')}"/> + </s:form> + + </body> +</html> \ No newline at end of file Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/com/graph.jsp =================================================================== --- trunk/coser-web/src/main/webapp/WEB-INF/content/com/graph.jsp 2011-12-23 14:16:06 UTC (rev 926) +++ trunk/coser-web/src/main/webapp/WEB-INF/content/com/graph.jsp 2011-12-23 14:17:30 UTC (rev 927) @@ -44,7 +44,7 @@ <s:a action="indicator" namespace='/com'> <s:param name="facade" value="facade" /> <s:param name="zone" value="zone" /> - <s:property value='zoneDisplayName' /> + <s:property value='zoneDisplayName' /> </s:a> > </li> <li> Modified: trunk/coser-web/src/main/webapp/styles/coser.css =================================================================== --- trunk/coser-web/src/main/webapp/styles/coser.css 2011-12-23 14:16:06 UTC (rev 926) +++ trunk/coser-web/src/main/webapp/styles/coser.css 2011-12-23 14:17:30 UTC (rev 927) @@ -515,39 +515,6 @@ margin-left: 20px; } -#middle .page .degrade table { - width: 558px; -} - -#middle .page .degrade table th { - background-color: #375a94; - color: #ffffff; - height: 36px; -} - -#middle .page .degrade table td { - padding: 20px; - text-transform: uppercase; -} - -#middle .page .degrade table .pdf { - background: url(../images/ico_pdf.png) no-repeat; - display: block; - height: 45px; - text-indent: -999999px; - width: 41px; - margin-left: 35px; -} - -#middle .page .degrade table .carte { - background: transparent url(images/ico_carte.png) no-repeat scroll 0 0; - display: block; - height: 51px; - text-indent: -999999px; - width: 47px; - margin-left: 35px; -} - .annotations { font-size: 100%; color: #6e6e6e; @@ -658,42 +625,6 @@ vertical-align:top; } -/*#conteneur_int .part_bottom .barre_select { - background: url(../images/barre_select.png) no-repeat; - height: 23px; - padding: 20px 20px 30px; - width: 588px; - float: left; -} - -.barre_select form { - float: right; -} - -.barre_select p { - display: inline; - text-transform: uppercase; - color: #ffffff; - font-size: 120%; - line-height: 30px; - margin: 0; -} - -.barre_select input { - border: none; - background: url(../images/bt_suite.png) no-repeat; - color: #305594; - height: 31px; - width: 85px; - font-size: 140%; - cursor: pointer; -} - -.barre_select select { - background-color: #fff; - border: 1px solid #ccc; -}*/ - .errorMessage { color:red; } @@ -705,4 +636,23 @@ } .breadcrumb ul li { display:inline; +} + +.listprojects { + +} +.listprojects .listprojects-facade>.title { + color: #375A94; + font-weight:bold; +} + +.listprojects .listprojects-zone { + padding-left:20px; +} +.listprojects .listprojects-zone>.title { + font-style:italic; +} + +.listprojects .listprojects-result { + padding-left:20px; } \ No newline at end of file