Author: tchemit Date: 2012-02-28 16:32:26 +0100 (Tue, 28 Feb 2012) New Revision: 3151 Url: http://chorem.org/repositories/revision/pollen/3151 Log: continue vote and result page Added: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResult.java branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResultList.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GenerateChart.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GetPollImageChoice.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-io.xml branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/results.css branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/vote.css Removed: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResultListBean.java Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollResultsService.java branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/pom.xml branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp branches/pollen-1.2.6-struts2/pom.xml Copied: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResult.java (from rev 3149, branches/pollen-1.2.6-struts2/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java) =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResult.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResult.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -0,0 +1,147 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 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 org.chorem.pollen.bean; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.chorem.pollen.common.ChoiceType; +import org.chorem.pollen.common.VoteCountingType; + +import java.io.Serializable; + +/** + * Classe DTO représentant un résultat de sondage. + * + * @since 1.2.6 + */ +public class PollResult implements Serializable { + + private static final long serialVersionUID = 1L; + + private String id; + + private String name; + + private String value; + + private String pollId; + + private ChoiceType choiceType; + + private VoteCountingType voteCountingType; + + private boolean byGroup; + + private boolean hidden; + + public PollResult() { + + } + + public PollResult(String id) { + this.id = id; + } + + public PollResult(String name, + String pollId, + ChoiceType choiceType, + VoteCountingType voteCountingType) { + super(); + this.name = name; + this.pollId = pollId; + this.choiceType = choiceType; + this.voteCountingType = voteCountingType; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getPollId() { + return pollId; + } + + public void setPollId(String pollId) { + this.pollId = pollId; + } + + public ChoiceType getChoiceType() { + return choiceType; + } + + public void setChoiceType(ChoiceType choiceType) { + this.choiceType = choiceType; + } + + public VoteCountingType getVoteCountingType() { + return voteCountingType; + } + + public void setVoteCountingType(VoteCountingType voteCountingType) { + this.voteCountingType = voteCountingType; + } + + public boolean isByGroup() { + return byGroup; + } + + public void setByGroup(boolean byGroup) { + this.byGroup = byGroup; + } + + public boolean isHidden() { + return hidden; + } + + public void setHidden(boolean hidden) { + this.hidden = hidden; + } + + @Override + public String toString() { + return new ToStringBuilder(this). + append("name", name). + append("value", value). + toString(); + } +} \ No newline at end of file Copied: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResultList.java (from rev 3149, branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResultListBean.java) =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResultList.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResultList.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -0,0 +1,60 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 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 org.chorem.pollen.bean; + +import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO; + +import java.util.List; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since TODO + */ +public class PollResultList { + + /** Liste des résultats */ + private List<PollResult> pollResults; + + /** Résultat issu du dépouillement du vote */ + private VoteCountingResultDTO voteCountingResult; + + public List<PollResult> getPollResults() { + return pollResults; + } + + public void setPollResults(List<PollResult> pollResults) { + this.pollResults = pollResults; + } + + public VoteCountingResultDTO getVoteCountingResult() { + return voteCountingResult; + } + + public void setVoteCountingResult(VoteCountingResultDTO voteCountingResult) { + this.voteCountingResult = voteCountingResult; + } + +} Property changes on: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResultList.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResultListBean.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResultListBean.java 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollResultListBean.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -1,38 +0,0 @@ -package org.chorem.pollen.bean; - -import org.chorem.pollen.business.persistence.Result; -import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO; - -import java.util.List; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since TODO - */ -public class PollResultListBean { - - /** Liste des résultats */ - private List<Result> resultDTOs = null; - - /** Résultat issu du dépouillement du vote */ - private VoteCountingResultDTO voteCountingResultDTO = null; - - public List<Result> getResultDTOs() { - return resultDTOs; - } - - public void setResultDTOs(List<Result> resultDTOs) { - this.resultDTOs = resultDTOs; - } - - public VoteCountingResultDTO getVoteCountingResultDTO() { - return voteCountingResultDTO; - } - - public void setVoteCountingResultDTO(VoteCountingResultDTO voteCountingResultDTO) { - this.voteCountingResultDTO = voteCountingResultDTO; - } - -} Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -186,4 +186,23 @@ } } + public List<Comment> getAllComments(String pollId) { + + Preconditions.checkNotNull(pollId); + + CommentDAO dao = getDAO(Comment.class); + + try { + + TopiaQuery query = dao.createQuery("e"). + addWhere("e." + Comment.PROPERTY_POLL + ".pollId", + TopiaQuery.Op.EQ, pollId); + query.addOrderDesc(Comment.PROPERTY_POST_DATE); + List<Comment> result = dao.findAllByQuery(query); + return result; + } catch (TopiaException e) { + throw new PollenTechnicalException(e); + } + } + } Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollResultsService.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollResultsService.java 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollResultsService.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -1,3 +1,26 @@ +/* + * #%L + * Pollen :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 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 org.chorem.pollen.services.impl; import com.google.common.collect.Lists; @@ -3,5 +26,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.bean.PollResultListBean; +import org.chorem.pollen.bean.PollResult; +import org.chorem.pollen.bean.PollResultList; import org.chorem.pollen.business.persistence.Choice; import org.chorem.pollen.business.persistence.Poll; @@ -12,6 +36,7 @@ import org.chorem.pollen.common.PollType; import org.chorem.pollen.common.VoteCountingType; import org.chorem.pollen.services.PollenServiceSupport; +import org.chorem.pollen.votecounting.business.NumberMethod; import org.chorem.pollen.votecounting.dto.ChoiceDTO; import org.chorem.pollen.votecounting.dto.PollDTO; import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO; @@ -36,25 +61,34 @@ /** log. */ private static final Log log = LogFactory.getLog(PollResultsService.class); - public PollResultListBean getAllResults(String pollId) { + public PollResultList getAllResults(String pollId) { return getResults(pollId, null, false, false); } - public PollResultListBean getResultsByVoteCounting(String pollId, - VoteCountingType voteCounting) { + public PollResultList getResultsByVoteCounting(String pollId, + VoteCountingType voteCounting) { return getResults(pollId, voteCounting, false, false); } - public PollResultListBean getGroupResults(String pollId) { + public PollResultList getGroupResults(String pollId) { return getResults(pollId, null, true, true); } - public PollResultListBean getNormalResults(String pollId) { + public PollResultList getNormalResults(String pollId) { return getResults(pollId, null, true, false); } + public List<PollResult> getNormalPollResults(String pollId) { + PollResultList results = getResults(pollId, null, true, false); + return results.getPollResults(); + } + + public PollResultList generateNormalResults(String pollId) { + return generateResults(pollId, null, true, false); + } + /** - * Récupère les résultats d'un sondage. + * Génère les résultats d'un sondage (= un dépouillement). * * @param pollId le sondage * @param voteCounting type de dépouillement @@ -62,10 +96,10 @@ * @param groupOnly résultats uniquement par groupe * @return les résultats du sondage */ - private PollResultListBean getResults(String pollId, - VoteCountingType voteCounting, - boolean byGroup, - boolean groupOnly) { + private PollResultList generateResults(String pollId, + VoteCountingType voteCounting, + boolean byGroup, + boolean groupOnly) { PollService pollService = newService(PollService.class); Poll poll = pollService.getPollByPollId(pollId); @@ -114,13 +148,13 @@ } // Conversion et trie des résultats - List<Result> list = Lists.newArrayList(poll.getResult()); + List<PollResult> list = createPollResults(poll); VoteCountingType voteCountingType = poll.getVoteCountingType(); - Iterator<Result> it = list.iterator(); + Iterator<PollResult> it = list.iterator(); while (it.hasNext()) { - Result currentResult = it.next(); + PollResult currentResult = it.next(); // Cas d'un dépouillement particulier // Suppression des resultats qui ne sont pas de se dépouillement @@ -133,12 +167,12 @@ if (byGroup) { // Filtre group : Suppression resultats non group - if (groupOnly && !currentResult.getByGroup()) { + if (groupOnly && !currentResult.isByGroup()) { it.remove(); } // Filtre non group : Suppression resultats group - else if (!groupOnly && currentResult.getByGroup()) { + else if (!groupOnly && currentResult.isByGroup()) { it.remove(); } @@ -149,14 +183,142 @@ } } - PollResultListBean resultListDTO = new PollResultListBean(); - resultListDTO.setResultDTOs(list); - resultListDTO.setVoteCountingResultDTO(result); + PollResultList resultListDTO = new PollResultList(); + resultListDTO.setPollResults(list); + resultListDTO.setVoteCountingResult(result); return resultListDTO; } /** + * Récupère les résultats d'un sondage (sans rien dépouiller). + * + * @param pollId le sondage + * @param voteCounting type de dépouillement + * @param byGroup résultats par groupe + * @param groupOnly résultats uniquement par groupe + * @return les résultats du sondage + */ + private PollResultList getResults(String pollId, + VoteCountingType voteCounting, + boolean byGroup, + boolean groupOnly) { + + PollService pollService = newService(PollService.class); + Poll poll = pollService.getPollByPollId(pollId); + +// DataResultConverter converter = new DataResultConverter(transaction); + if (log.isDebugEnabled()) { + log.debug(poll.getPollId() + " (" + voteCounting + + ") has results: " + hasResults(poll, voteCounting)); + } + + // Dépouillement du sondage. + // S'il n'existe pas de résultats ou si le sondage est encore ouvert. + //if (!hasResults(ePoll, voteCounting) || !ePoll.getIsClosed()) { + PollDTO dto = pollService.createPollDTOForVoteCounting(poll); + + if (voteCounting != null) { + dto.setVoteCounting(voteCounting); + } + +// // clear result (they will be regenerated ! (a big shame)) +// poll.clearResult(); + +// ServiceVoteCounting service = new ServiceVoteCountingImpl(); +// +// VoteCountingResultDTO result; +// +// if (PollType.GROUP == poll.getPollType()) { +// result = service.executeGroupCounting(dto); +// } else { +// result = service.executeVoteCounting(dto); +// } +// for (ChoiceDTO choice : result.getChoices()) { +// +// ResultDAO daoResult = getDAO(Result.class); +// Result eResult = create(daoResult); +// +// Choice eChoice = poll.getChoiceByTopiaId(choice.getIdChoice()); +// +// poll.addResult(eResult); +// +// eResult.setName(eChoice.getName()); +// eResult.setByGroup(result.isByGroup()); +// eResult.setPoll(poll); +// eResult.setResultValue(String.valueOf(choice.getValue())); +// eResult.setVoteCountingType(result.getTypeVoteCounting()); +// } + + // Conversion et trie des résultats + List<PollResult> list = createPollResults(poll); + + VoteCountingType voteCountingType = poll.getVoteCountingType(); + + Iterator<PollResult> it = list.iterator(); + while (it.hasNext()) { + PollResult currentResult = it.next(); + + // Cas d'un dépouillement particulier + // Suppression des resultats qui ne sont pas de se dépouillement + if (voteCounting != null + && currentResult.getVoteCountingType() != voteCounting) { + it.remove(); + } + + // Cas d'un sondage de type GROUP avec filtre + if (byGroup) { + + // Filtre group : Suppression resultats non group + if (groupOnly && !currentResult.isByGroup()) { + it.remove(); + } + + // Filtre non group : Suppression resultats group + else if (!groupOnly && currentResult.isByGroup()) { + it.remove(); + } + + // Suppression des autres resultats de depouillements differents + if (currentResult.getVoteCountingType() != voteCountingType) { + it.remove(); + } + } + } + + PollResultList resultListDTO = new PollResultList(); + resultListDTO.setPollResults(list); + resultListDTO.setVoteCountingResult(null); + + return resultListDTO; + } + + /** + * Retourne la liste des résultats d'un sondage sous forme de DTOs. + * + * @param poll le sondage (entitée Poll) + * @return la liste des DTO Result + */ + public List<PollResult> createPollResults(Poll poll) { + List<PollResult> results = Lists.newArrayList(); + for (Result res : poll.getResult()) { + PollResult dto = new PollResult(); + dto.setId(res.getTopiaId()); + dto.setPollId(poll.getPollId()); + String resName = res.getName(); + dto.setName(resName); + dto.setHidden(resName != null && + resName.startsWith(NumberMethod.HIDDEN_PREFIX)); + dto.setValue(res.getResultValue()); + dto.setByGroup(res.getByGroup()); + dto.setChoiceType(poll.getChoiceType()); + dto.setVoteCountingType(poll.getVoteCountingType()); + results.add(dto); + } + return results; + } + + /** * Retourne une chaîne contenant les résultats du sondage. * * @param poll le sondage @@ -184,12 +346,12 @@ return res.toString(); } - public String getResultValue(Choice choice, Collection<Result> results) { + public String getResultValue(Choice choice, Collection<PollResult> results) { String val = ""; - for (Result result : results) { + for (PollResult result : results) { if (result.getName().equals(choice.getName())) { - val = removeTrailing0(result.getResultValue()); + val = removeTrailing0(result.getValue()); break; } } Property changes on: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollResultsService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -57,6 +57,7 @@ import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.web.struts2.FilterPagerUtil; +import java.io.File; import java.util.List; public class PollService extends PollenServiceSupport { @@ -942,6 +943,8 @@ if (userAccount != null) { String displayName = userAccount.getDisplayName(); result.setVotingId(displayName); + } else { + result.setVotingId(""); } return result; } @@ -1018,51 +1021,51 @@ } } - public PollDTO createPollDTOForVoteCounting(Poll ePoll) { - PollDTO pollDTO = new PollDTO(ePoll.getPollId()); - pollDTO.setTitle(ePoll.getTitle()); - pollDTO.setDescription(ePoll.getDescription()); - pollDTO.setBeginChoiceDate(ePoll.getBeginChoiceDate()); - pollDTO.setBeginDate(ePoll.getBeginDate()); - pollDTO.setEndDate(ePoll.getEndDate()); - pollDTO.setAnonymous(ePoll.getAnonymous()); - pollDTO.setAnonymousVoteAllowed(ePoll.getAnonymousVoteAllowed()); - pollDTO.setPublicResults(ePoll.getPublicResults()); - pollDTO.setContinuousResults(ePoll.getContinuousResults()); - pollDTO.setChoiceAddAllowed(ePoll.getChoiceAddAllowed()); - pollDTO.setClosed(ePoll.getClosed()); - pollDTO.setCreatorId(ePoll.getCreator().getVotingId()); - pollDTO.setCreatorEmail(ePoll.getCreator().getEmail()); - pollDTO.setMaxChoiceNb(ePoll.getMaxChoiceNb()); - pollDTO.setPollType(ePoll.getPollType()); - pollDTO.setChoiceType(ePoll.getChoiceType()); - pollDTO.setVoteCounting(ePoll.getVoteCountingType()); + public PollDTO createPollDTOForVoteCounting(Poll poll) { + PollDTO result = new PollDTO(poll.getPollId()); + result.setTitle(poll.getTitle()); + result.setDescription(poll.getDescription()); + result.setBeginChoiceDate(poll.getBeginChoiceDate()); + result.setBeginDate(poll.getBeginDate()); + result.setEndDate(poll.getEndDate()); + result.setAnonymous(poll.getAnonymous()); + result.setAnonymousVoteAllowed(poll.getAnonymousVoteAllowed()); + result.setPublicResults(poll.getPublicResults()); + result.setContinuousResults(poll.getContinuousResults()); + result.setChoiceAddAllowed(poll.getChoiceAddAllowed()); + result.setClosed(poll.getClosed()); + result.setCreatorId(poll.getCreator().getVotingId()); + result.setCreatorEmail(poll.getCreator().getEmail()); + result.setMaxChoiceNb(poll.getMaxChoiceNb()); + result.setPollType(poll.getPollType()); + result.setChoiceType(poll.getChoiceType()); + result.setVoteCounting(poll.getVoteCountingType()); - for (Comment comment : ePoll.getComment()) { - pollDTO.getComments().add(createPollCommentDTO(comment)); + for (Comment comment : poll.getComment()) { + result.getComments().add(createPollCommentDTO(comment)); } - for (Choice choice : ePoll.getChoice()) { - pollDTO.getChoices().add(createPollChoiceDTO(choice)); + for (Choice choice : poll.getChoice()) { + result.getChoices().add(createPollChoiceDTO(choice)); } - if (ePoll.getVotingList() != null && !ePoll.getVotingList().isEmpty()) { - for (VotingList list : ePoll.getVotingList()) { - pollDTO.getVotingGroups().add(createVotingGroupDTO(list)); + if (poll.getVotingList() != null && !poll.getVotingList().isEmpty()) { + for (VotingList list : poll.getVotingList()) { + result.getVotingGroups().add(createVotingGroupDTO(list)); } } else { // un groupe par défaut si il y en a pas VotingGroupDTO group = new VotingGroupDTO("unique", 1); group.setName("unique"); - for (Vote vote : ePoll.getVote()) { + for (Vote vote : poll.getVote()) { group.getVotingPersons().add(createVotingPersonDTO(vote)); } - pollDTO.getVotingGroups().add(group); + result.getVotingGroups().add(group); } - return pollDTO; + return result; } private CommentDTO createPollCommentDTO(Comment comment) { - CommentDTO commentDTO = new CommentDTO(comment.getPollAccount() - .getVotingId(), comment.getText()); + CommentDTO commentDTO = new CommentDTO( + comment.getPollAccount().getVotingId(), comment.getText()); return commentDTO; } @@ -1084,7 +1087,8 @@ for (PersonToList pToList : list.getPollAccountPersonToList()) { Vote vote = getPollVoteByPollAccount(list.getPoll(), pToList .getPollAccount()); - if (vote != null) { // Pas de vote pour cette personne : doit engendrer erreur ?!? + if (vote != null) { + // Pas de vote pour cette personne : doit engendrer erreur ?!? group.getVotingPersons().add(createVotingPersonDTO(vote)); } } @@ -1121,4 +1125,19 @@ } return null; } + + public File getPollChoiceImageFile(String pollId, + String choiceId, + boolean thumb) { + File imageDirectory = getConfiguration().getImageDirectory(); + File pollDirectory = new File(imageDirectory, pollId); + + + if (thumb) { + choiceId = "thumb_" + choiceId; + } + File result = new File(pollDirectory, choiceId); + + return result; + } } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/pom.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/pom.xml 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/pom.xml 2012-02-28 15:32:26 UTC (rev 3151) @@ -114,6 +114,16 @@ </dependency> <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-jfreechart-plugin</artifactId> + </dependency> + + <dependency> + <groupId>org.jfree</groupId> + <artifactId>jfreechart</artifactId> + </dependency> + + <dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-runner</artifactId> </dependency> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -44,6 +44,7 @@ import javax.servlet.http.HttpServletRequest; import java.net.URL; +import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -74,9 +75,9 @@ private static final Log log = LogFactory.getLog(PollenActionSupport.class); - private SimpleDateFormat dateFormat; + private static DateFormat dateTimeFormat; - private SimpleDateFormat monthFormat; + private DateFormat dateFormat; public static PollenApplicationContext getPollenApplicationContext() { Map<String, Object> application = getActionContext().getApplication(); @@ -201,16 +202,16 @@ this.transaction = transaction; } - public String formatDate(Date date) { - String result = getDateFormat().format(date); - return result; - } +// public String formatDate(Date date) { +// String result = getDateFormat().format(date); +// return result; +// } +// +// public String formatMonth(Date date) { +// String result = getMonthFormat().format(date); +// return result; +// } - public String formatMonth(Date date) { - String result = getMonthFormat().format(date); - return result; - } - public static final List<String> SAFE_LANGUAGES = Lists.newArrayList("en", "fr"); @@ -222,22 +223,40 @@ return language; } - protected SimpleDateFormat getDateFormat() { + protected static DateFormat getDateTimeFormat() { + if (dateTimeFormat == null) { + dateTimeFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm"); + } + return dateTimeFormat; + } + + protected DateFormat getDateFormat() { if (dateFormat == null) { dateFormat = new SimpleDateFormat("dd/MM/yyyy"); } return dateFormat; } - protected SimpleDateFormat getMonthFormat() { - if (monthFormat == null) { - monthFormat = new SimpleDateFormat("mm-yyyy"); - } - return monthFormat; + protected void setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; } protected static ActionContext getActionContext() { return ActionContext.getContext(); } + public static String getCurrentDateTime() { + String result = getDateTimeFormat().format(new Date()); + return result; + } + + public String formatDate(Date date) { + String result = getDateFormat().format(date); + return result; + } + + public String formatDateTime(Date date) { + String result = getDateTimeFormat().format(date); + return result; + } } Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GenerateChart.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GenerateChart.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GenerateChart.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -0,0 +1,176 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 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 org.chorem.pollen.ui.actions.io; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.pollen.ui.actions.PollenActionSupport; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.labels.StandardPieSectionLabelGenerator; +import org.jfree.chart.plot.PiePlot; +import org.jfree.chart.plot.PiePlot3D; +import org.jfree.chart.plot.RingPlot; +import org.jfree.chart.title.TextTitle; +import org.jfree.data.DefaultKeyedValues; +import org.jfree.data.general.DefaultPieDataset; +import org.jfree.data.general.PieDataset; +import org.jfree.util.SortOrder; + +import java.awt.Color; +import java.awt.Font; +import java.util.List; + +/** + * Action to generate a chart given the values (and optional subtitles). + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public class GenerateChart extends PollenActionSupport { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(GenerateChart.class); + + /** diagramme de type PIE. */ + public static final int PIE = 1; + + /** diagramme de type PIE3D. */ + public static final int PIE3D = 2; + + /** diagramme de type RING. */ + public static final int RING = 3; + + protected int type; + + protected List<String> values; + + protected List<String> subtitles; + + protected int width; + + protected int height; + + protected String title; + + protected JFreeChart chart; + + public void setType(int type) { + this.type = type; + } + + public void setValues(List<String> values) { + this.values = values; + } + + public void setSubtitles(List<String> subtitles) { + this.subtitles = subtitles; + } + + public int getWidth() { + return width; + } + + public void setWidth(int width) { + this.width = width; + } + + public int getHeight() { + return height; + } + + public void setHeight(int height) { + this.height = height; + } + + public void setTitle(String title) { + this.title = title; + } + + public JFreeChart getChart() { + return chart; + } + + @Override + public String execute() throws Exception { + + DefaultKeyedValues vals = new DefaultKeyedValues(); + + if (log.isInfoEnabled()) { + log.info("Title = " + title); + log.info("Values = " + values); + log.info("Subtitles = " + subtitles); + } + + for (int i = 0, nbValues = values.size() / 2; i < nbValues; i += 1) { + String key = values.get(2 * i); + Double value = Double.valueOf(values.get(2 * i + 1)); + vals.addValue(key, value); + } + + vals.sortByValues(SortOrder.DESCENDING); + PieDataset data = new DefaultPieDataset(vals); + + // create the chart look according to the type + PiePlot plot; + switch (type) { + case PIE: + plot = new PiePlot(data); + break; + case PIE3D: + plot = new PiePlot3D(data); + break; + case RING: + plot = new RingPlot(data); + break; + default: + plot = new PiePlot(data); + break; + } + + //plot.setForegroundAlpha(0.7f); + plot.setCircular(true); + plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {2}")); + plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator( + "{0} = {1}")); + plot.setNoDataMessage("No Data"); + + chart = new JFreeChart(plot); + chart.setTitle(new TextTitle(title, new Font(Font.SANS_SERIF, + Font.BOLD, 12))); + chart.setBackgroundPaint(new Color(255, 255, 255)); + + if (CollectionUtils.isNotEmpty(subtitles)) { + Font subtitlesFont = new Font(Font.SANS_SERIF, Font.ITALIC, 11); + for (int i = 0; i < subtitles.size(); i += 2) { + String subtitle = subtitles.get(i) + "=" + subtitles.get(i + 1); + TextTitle textTitle = new TextTitle(subtitle, subtitlesFont); + chart.addSubtitle(textTitle); + } + } + return SUCCESS; + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GenerateChart.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GetPollImageChoice.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GetPollImageChoice.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GetPollImageChoice.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -0,0 +1,92 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 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 org.chorem.pollen.ui.actions.io; + +import com.google.common.base.Preconditions; +import org.chorem.pollen.services.impl.PollService; +import org.chorem.pollen.ui.actions.PollenActionSupport; + +import javax.activation.MimetypesFileTypeMap; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +/** + * Obtain the image choice of a given choice of an image-like poll. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public class GetPollImageChoice extends PollenActionSupport { + + private static final long serialVersionUID = 1L; + + protected String pollId; + + protected String choiceId; + + protected boolean thumb; + + protected transient InputStream inputStream; + + protected String contentType; + + public void setPollId(String pollId) { + this.pollId = pollId; + } + + public void setChoiceId(String choiceId) { + this.choiceId = choiceId; + } + + public void setThumb(boolean thumb) { + this.thumb = thumb; + } + + public String getContentType() { + return contentType; + } + + public InputStream getInputStream() { + return inputStream; + } + + @Override + public String execute() throws Exception { + + Preconditions.checkNotNull(pollId); + Preconditions.checkNotNull(choiceId); + + PollService service = newService(PollService.class); + + File file = service.getPollChoiceImageFile(pollId, choiceId, thumb); + + MimetypesFileTypeMap mimes = new MimetypesFileTypeMap(); + contentType = mimes.getContentType(file); + + inputStream = new FileInputStream(file); + + return SUCCESS; + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GetPollImageChoice.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -26,11 +26,12 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.pollen.bean.PollResultListBean; +import org.chorem.pollen.bean.PollResult; +import org.chorem.pollen.bean.PollResultList; import org.chorem.pollen.business.persistence.Choice; +import org.chorem.pollen.business.persistence.Comment; import org.chorem.pollen.business.persistence.Poll; import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.Result; import org.chorem.pollen.business.persistence.UserAccount; import org.chorem.pollen.business.persistence.Vote; import org.chorem.pollen.business.persistence.VoteToChoice; @@ -38,11 +39,13 @@ import org.chorem.pollen.common.PollType; import org.chorem.pollen.common.VoteCountingType; import org.chorem.pollen.services.exceptions.PollNotFoundException; +import org.chorem.pollen.services.impl.PollCommentService; import org.chorem.pollen.services.impl.PollFeedService; import org.chorem.pollen.services.impl.PollResultsService; import org.chorem.pollen.services.impl.PollService; import org.chorem.pollen.services.impl.VoteService; +import java.text.DateFormat; import java.util.Date; import java.util.List; @@ -89,10 +92,12 @@ private PollAccount pollAccount; - private String pollAccountId; +// private String pollAccountId; - private List<Result> results; + private List<PollResult> results; + private List<Comment> comments; + @Override public final String getPageLogo() { return "Vote"; @@ -106,9 +111,9 @@ // this.accountId = accountId; // } - public String getPollAccountId() { - return pollAccountId; - } +// public String getPollAccountId() { +// return pollAccountId; +// } public final Poll getPoll() { return poll; @@ -151,19 +156,28 @@ return commentName; } - public List<Result> getResults() { + public List<PollResult> getResults() { return results; } + public List<Comment> getComments() { + return comments; + } + public void prepareVotePage() throws Exception { loadPoll(); + setDateFormat(DateFormat.getDateTimeInstance( + DateFormat.SHORT, + DateFormat.SHORT, getLocale())); + if (poll != null) { loadPollAccount(); loadPollResults(); + loadPollComments(); PollFeedService pollFeedService = newService(PollFeedService.class); @@ -247,24 +261,31 @@ return val; } + protected void loadPollComments() { + + PollCommentService service = newService(PollCommentService.class); + + comments = service.getAllComments(poll.getPollId()); + } + protected void loadPollResults() { PollResultsService service = getPollResultsService(); - PollResultListBean resultListDTO; + PollResultList resultListDTO; if (isGroupPoll()) { resultListDTO = service.getGroupResults(poll.getPollId()); } else { resultListDTO = service.getNormalResults(poll.getPollId()); } - results = resultListDTO.getResultDTOs(); + results = resultListDTO.getPollResults(); if (log.isDebugEnabled()) { - for (Result res : results) { - log.debug(res.getName() + ": " + res.getResultValue() + for (PollResult res : results) { + log.debug(res.getName() + ": " + res.getValue() + ", (voteCounting=" + res.getVoteCountingType() - + ", byGroup=" + res.getByGroup() + ")"); + + ", byGroup=" + res.isByGroup() + ")"); } } } @@ -377,8 +398,8 @@ PollAccount votePollAccount = vote.getPollAccount(); // si le votant du vote correspond au votant actuel (pollAccountId) - if (pollAccountId != null - && pollAccountId.equals(votePollAccount.getAccountId())) { + if (accountId != null + && accountId.equals(votePollAccount.getAccountId())) { result = true; } @@ -497,4 +518,7 @@ return poll.getEndDate() != null && poll.getEndDate().before(now); } + public String formatChoiceNameAsDate(Choice choice) { + return formatDate(new Date(Long.valueOf(choice.getName()))); + } } \ No newline at end of file Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java 2012-02-28 15:32:26 UTC (rev 3151) @@ -23,15 +23,416 @@ */ package org.chorem.pollen.ui.actions.poll; -import org.chorem.pollen.ui.actions.PollenActionSupport; +import com.google.common.base.Preconditions; +import com.google.common.collect.LinkedHashMultimap; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.struts2.views.util.UrlHelper; +import org.chorem.pollen.bean.PollResult; +import org.chorem.pollen.bean.PollResultList; +import org.chorem.pollen.business.persistence.Poll; +import org.chorem.pollen.business.persistence.PollAccount; +import org.chorem.pollen.business.persistence.Result; +import org.chorem.pollen.common.ChoiceType; +import org.chorem.pollen.common.PollType; +import org.chorem.pollen.common.VoteCountingType; +import org.chorem.pollen.services.impl.PollResultsService; +import org.chorem.pollen.services.impl.PollService; +import org.chorem.pollen.votecounting.business.NumberMethod; +import org.chorem.pollen.votecounting.dto.ChoiceDTO; +import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO; +import org.nuiton.util.StringUtil; +import java.net.URL; +import java.text.DateFormat; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Map; + /** * Display results of a poll. * * @author tchemit <chemit@codelutin.com> * @since 1.2.6 */ -public class ResultForPoll extends PollenActionSupport { +public class ResultForPoll extends AbstractPollUriIdAction { private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(ResultForPoll.class); + + protected boolean userAllowed; + +// protected String victoryMessage; + + protected Result result; + + /** + * Résultats du sondage. + * <p/> + * La map est indexée par les noms de choix. + */ + private transient Multimap<String, String> choicesResults; + +// /** Résultat courant */ +// private Map.Entry<String, List<String>> choicesResult; + + /** Résultats du sondage. */ + private transient Multimap<String, String> subtitles; + + private Poll poll; + + private List<PollResult> results; + + private List<PollResult> ranking; + + private List<PollResult> topRanking; + + @Override + public final String getPageLogo() { + return "VoteCounting"; + } + + public Poll getPoll() { + return poll; + } + + public boolean isUserAllowed() { + return userAllowed; + } + + public Result getResult() { + return result; + } + + public List<PollResult> getResults() { + return results; + } + + public Date getResultNameAsDate(Result result) { + return new Date(Long.valueOf(result.getName())); + } + + public Multimap<String, String> getChoicesResults() { + return choicesResults; + } + + public Multimap<String, String> getSubtitles() { + return subtitles; + } + + public String getVictoryMessage() { + + String victoryMessage; + + if (poll.getVoteCountingType() == VoteCountingType.NUMBER) { + victoryMessage = null; + } else if (CollectionUtils.isEmpty(topRanking)) { + victoryMessage = ""; + } else if (topRanking.size() == 1) { + victoryMessage = _("pollen.common.victory"); + } else { + victoryMessage = _("pollen.common.victories"); + } + return victoryMessage; + } + + /** + * @param result la résultat à utiliser. + * @return la valeur du résultat courant sans le .0 final + */ + public String getTrimValue(PollResult result) { + + String value = result.getValue(); + + // le résultat peut-être un double : 1,0 -> 1 et 1,2 -> 1,2 + if (value.endsWith(".0")) { + value = value.substring(0, value.indexOf('.')); + } + return value; + } + + @Override + public String execute() throws Exception { + + Preconditions.checkNotNull(pollId); + + PollService service = newService(PollService.class); + + poll = service.getPollByPollId(pollId); + + if (poll == null) { + addActionError(_("pollen.error.pollNotFound")); + } else { + + setDateFormat(DateFormat.getDateTimeInstance( + DateFormat.SHORT, + DateFormat.SHORT, getLocale())); + + if (poll.getPublicResults()) { + userAllowed = true; + } else if (StringUtils.isNotEmpty(accountId)) { + + PollAccount creator = poll.getCreator(); + if (accountId.equals(creator.getAccountId())) { + userAllowed = true; + } + } + + if (!userAllowed) { + addActionError(_("pollen.error.userNotAllowed")); + } else if (!poll.getClosed()) { + addActionError(_("pollen.error.pollNotClosed")); + loadResults(); + } else { + + loadResults(); + } + } + + return SUCCESS; + } + + public List<PollResult> getTopRanking() { + return topRanking; + } + + public List<PollResult> getRanking() { + return ranking; + } + + public boolean isFreePoll() { + return poll.getPollType() == PollType.FREE; + } + + public boolean isRestrictedPoll() { + return poll.getPollType() == PollType.RESTRICTED; + } + + public boolean isGroupPoll() { + return poll.getPollType() == PollType.GROUP; + } + + public boolean isTextType() { + return poll.getChoiceType() == ChoiceType.TEXT; + } + + public boolean isDateType() { + return poll.getChoiceType() == ChoiceType.DATE; + } + + public boolean isImageType() { + return poll.getChoiceType() == ChoiceType.IMAGE; + } + + public boolean isNormalVoteCounting() { + return poll.getVoteCountingType() == VoteCountingType.NORMAL; + } + + public boolean isPercentageVoteCounting() { + return poll.getVoteCountingType() == VoteCountingType.PERCENTAGE; + } + + public boolean isCondorcetVoteCounting() { + return poll.getVoteCountingType() == VoteCountingType.CONDORCET; + } + + public boolean isNumberVoteCounting() { + return poll.getVoteCountingType() == VoteCountingType.NUMBER; + } + + protected void loadResults() { + + PollResultsService pollResultService = + newService(PollResultsService.class); + + PollResultList resultListDTO; + if (isGroupPoll()) { + resultListDTO = pollResultService.getGroupResults(poll.getPollId()); + } else { + resultListDTO = pollResultService.getNormalResults(poll.getPollId()); + } + + results = resultListDTO.getPollResults(); + + if (log.isDebugEnabled()) { + for (PollResult res : results) { + log.debug(res + + ", (voteCounting=" + res.getVoteCountingType() + + ", byGroup=" + res.isByGroup() + ")"); + } + } + + if (isNumberVoteCounting()) { + + // resultats des choix cachés + + choicesResults = LinkedHashMultimap.create(); + + // sous-titres des vrais choix (les choix pas cachés) + subtitles = LinkedHashMultimap.create(); + + /* + * liste des vrais choix (les choix pas cachés). + * cette variable sera affectée à la variable results + */ + List<PollResult> results2 = Lists.newArrayList(); + + // Ajout des résultats des choix cachés + for (PollResult result : getResults()) { + if (result.isHidden()) { + String name = result.getName(); + int indexOf = name.indexOf('#'); + String choice = name.substring( + NumberMethod.HIDDEN_PREFIX.length(), indexOf); + + String votingId = name.substring(indexOf + 1); + String value = result.getValue(); + + choicesResults.put(choice, votingId); + choicesResults.put(choice, value); + + } else { + results2.add(result); + } + } + + for (String choiceName : choicesResults.keySet()) { + Collection<String> values = choicesResults.get(choiceName); + + // Récupération du choix correspondant au résultat + VoteCountingResultDTO voteCountingResult = resultListDTO + .getVoteCountingResult(); + + for (ChoiceDTO choice : voteCountingResult.getChoices()) { + if (choiceName.equals(choice.getName())) { + subtitles.put( + choiceName, + _("pollen.common.numberVote-total")); + subtitles.put( + choiceName, + String.valueOf(choice.getValue())); + + subtitles.put( + choiceName, + _("pollen.common.numberVote-average")); + subtitles.put( + choiceName, + String.valueOf(choice.getAverage())); + + subtitles.put( + choiceName, + _("pollen.common.numberVote-blank-votes")); + subtitles.put( + choiceName, + String.valueOf(choice.getNbBlankVotes())); + + subtitles.put( + choiceName, + _("pollen.common.numberVote-total-votes")); + subtitles.put( + choiceName, + String.valueOf(values.size() / 2)); + break; + } + } + } + + results = results2; + if (results.size() == 1) { + results.remove(0); + } + } + + ranking = Lists.newArrayList(results); + + Collections.sort(ranking, new Comparator<PollResult>() { + @Override + public int compare(PollResult o1, PollResult o2) { + Double result1 = Double.parseDouble(o1.getValue()); + Double result2 = Double.parseDouble(o2.getValue()); + int comp = 0; // résultat de la comparaison + + if (result1 > result2) { + comp = -1; + } else if (result1 < result2) { + comp = 1; + } + if (comp == 0) { + comp = o1.getName().compareTo(o2.getName()); + } + return comp; + } + }); + + topRanking = Lists.newArrayList(); + + if (CollectionUtils.isNotEmpty(ranking)) { + String winValue = ranking.get(0).getValue(); + for (PollResult r : ranking) { + if (winValue.equals(r.getValue())) { + topRanking.add(r); + } + } + } + + if (log.isInfoEnabled()) { + log.info("rankings = " + ranking); + log.info("topRanking = " + topRanking); + } + } + + /** @return Récupération de la liste des résultats pour le diagramme. */ + public List<String> getChoices() { + + List<String> choiceValues = Lists.newArrayList(); + + for (PollResult result : results) { + String name = result.getName(); + String value = result.getValue(); + + if (isDateType()) { + // mise en forme de la date + Date date = new Date(Long.parseLong(name)); + name = getDateFormat().format(date); + } + + choiceValues.add(name); + choiceValues.add(value); + } + return choiceValues; + } + + public String getNormalPollResultChartUrl(int width, int height) { + URL applicationUrl = getApplicationUrl(); + StringBuilder url = new StringBuilder(applicationUrl.toString()); + + url.append("/io/generateChart"); + + Map<String, Object> params = Maps.newHashMap(); + params.put("width", width); + params.put("height", height); + params.put("title", ""); + params.put("values", getChoices()); + + + UrlHelper.buildParametersString(params, url, "&"); + + String chartUrl = url.toString(); + return chartUrl; + } + + public String getChoicesAsString() { + List<String> choices = getChoices(); + return StringUtil.join(choices, ",", true); + } } Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-io.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-io.xml (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-io.xml 2012-02-28 15:32:26 UTC (rev 3151) @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + #%L + Pollen :: UI (strust2) + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit + %% + 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% + --> + + +<!DOCTYPE struts PUBLIC + "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" + "http://struts.apache.org/dtds/struts-2.1.7.dtd"> + +<struts> + + <package name="io" extends="default" namespace="/io"> + + <result-types> + <result-type name="chart" + class="org.apache.struts2.dispatcher.ChartResult"/> + </result-types> + + <!-- generate a chart as an image --> + <action name="generateChart" + class="org.chorem.pollen.ui.actions.io.GenerateChart"> + <result type="chart"> + <param name="width">${width}</param> + <param name="height">${height}</param> + </result> + </action> + + <!-- generate a chart as an image --> + <action name="getPollChoiceImage" + class="org.chorem.pollen.ui.actions.io.GetPollImageChoice"> + <result type="stream"> + <param name="contentType">${contentType}</param> + </result> + </action> + + </package> + + +</struts> + Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-io.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-02-28 15:32:26 UTC (rev 3151) @@ -37,8 +37,6 @@ class="org.apache.struts2.dispatcher.ServletActionRedirectResult"> <param name="namespace">/poll</param> <param name="actionName">votefor/${uriId}</param> - <param name="method">input</param> - <!--<param name="uriId">${uriId}</param>--> </result-type> </result-types> @@ -57,14 +55,14 @@ </action> <!-- vote poll --> - <action name="vote" + <action name="vote" method="execute" class="org.chorem.pollen.ui.actions.poll.VoteForPoll"> <result name="input">/WEB-INF/jsp/poll/vote.jsp</result> - <result>/WEB-INF/jsp/poll/vote.jsp</result> + <result type="redirectToVote"/> </action> <!-- vote poll --> - <action name="votefor/*" + <action name="votefor/*" method="input" class="org.chorem.pollen.ui.actions.poll.VoteForPoll"> <param name="uriId">{1}</param> <result name="input">/WEB-INF/jsp/poll/vote.jsp</result> @@ -100,10 +98,10 @@ </action> <!-- display poll result --> - <action name="result" + <action name="results/*" method="execute" class="org.chorem.pollen.ui.actions.poll.ResultForPoll"> - <result name="input">/WEB-INF/jsp/poll/result.jsp</result> - <result>/WEB-INF/jsp/home.jsp</result> + <param name="uriId">{1}</param> + <result>/WEB-INF/jsp/poll/result.jsp</result> </action> <!-- display createds polls --> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-02-28 15:32:26 UTC (rev 3151) @@ -4,8 +4,9 @@ poll.common.select.userFavoriteList=List poll.common.vote.results=Results poll.common.vote.results-help=Display results -poll.legend.addNewComment=Add a comment -pollen.action.addComment=Add +poll.common.vote.return=Back to poll +poll.common.vote.return-help=Back to poll +pollen.action.addComment=Add a comment pollen.action.backToFavoriteLists=Back to favorite lists pollen.action.create=Create pollen.action.createFavoriteList=Create a new list @@ -39,15 +40,21 @@ pollen.common.beginChoiceDate=Begin choice date pollen.common.beginDate=Begin date pollen.common.bugReport=Bug report +pollen.common.chartType-pie=Pie +pollen.common.chartType-pie3d=Pie 3D +pollen.common.chartType-ring=Ring pollen.common.commentName=Name pollen.common.commentText=Comment pollen.common.csvImport=CSV import pollen.common.description=Description +pollen.common.displayType-group=Results by groups +pollen.common.displayType-normal=Results pollen.common.email=Em@il pollen.common.endChoiceDate=end choice date pollen.common.endDate=End date pollen.common.firstName=First name pollen.common.functions=Functions +pollen.common.group=group pollen.common.lastName=Last name pollen.common.ldapImport=LDAP import pollen.common.license=Licence @@ -56,6 +63,11 @@ pollen.common.nbAccounts=Number of members pollen.common.newPassword=New password pollen.common.newPassword2=Reenter new passworsd +pollen.common.normal=normal +pollen.common.numberVote-average=Average of numbers +pollen.common.numberVote-blank-votes=Number of blank votes +pollen.common.numberVote-total=Sum of numbers +pollen.common.numberVote-total-votes=Total votes pollen.common.or=or pollen.common.password=Password pollen.common.password2=Renter your password @@ -73,13 +85,18 @@ pollen.common.pollOption.reminderHourCountdown=Hours before end pollen.common.pollType=Poll type pollen.common.postDate=Comment date +pollen.common.results=Results\: pollen.common.title=Title pollen.common.userSupport=User support +pollen.common.victories=Winners\: +pollen.common.victory=Winner\: +pollen.common.voteCounting-label=Vote Counting\: pollen.common.voteCountingType=Counting type pollen.common.voteCountingTypeHelp.condorcet=Condorcet vote\: rank choices by preference order from 1 to N (1\=favorite). Only the rank is taken into account, not the values. Two choices can have the same value. pollen.common.voteCountingTypeHelp.normal=Normal vote\: vote for your favorite choice. pollen.common.voteCountingTypeHelp.number=Voting by number\: The answer is free, leave blank or enter a integer. pollen.common.voteCountingTypeHelp.percentage=Percentage vote\: allocate choices to get a 100%% total. +pollen.common.voteNbVotes=%d existing votes pollen.common.voterName=Votant pollen.error.accountNotFound= pollen.error.comment.name.empty=Comment name mandatory @@ -100,6 +117,8 @@ pollen.error.pollAccount.email.required=Em@il mandatory pollen.error.pollAccount.not.found=Poll account not found pollen.error.pollAccount.votingId.required=Name mandatory +pollen.error.pollNotClosed=The poll is not closed. Results may change. +pollen.error.pollNotFound=The poll you want to count does not exist. pollen.error.user.alreadyVoted=Someone has already used the name %s to vote. pollen.error.user.bad.login.or.password=Login or password invalid. pollen.error.user.email.already.used=This email is already used @@ -107,6 +126,7 @@ pollen.error.user.login.already.used=This login is already used pollen.error.user.not.found=User not found pollen.error.user.restrictedListsForbidden=The poll is restricted and you are not allowed to vote. Check if you have correctly used the link sent to you by email. +pollen.error.userNotAllowed=You are not allowed to count the votes for this poll. pollen.fieldset.connexionInformation=Connexion informations pollen.fieldset.login=Login pollen.fieldset.poll.choices=Choices Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-02-28 15:32:26 UTC (rev 3151) @@ -4,8 +4,9 @@ poll.common.select.userFavoriteList=Liste poll.common.vote.results=Résultats poll.common.vote.results-help=Voir les résultats -poll.legend.addNewComment=Ajouter un commentaire -pollen.action.addComment=Ajouter +poll.common.vote.return=Retour au sondage +poll.common.vote.return-help=Retour au sondage +pollen.action.addComment=Ajouter un commentaire pollen.action.backToFavoriteLists=Retour à la liste des favoris pollen.action.create=Créer pollen.action.createFavoriteList=Créer une ouvelle liste @@ -39,24 +40,35 @@ pollen.common.beginChoiceDate=Date de début des choix pollen.common.beginDate=Date de début pollen.common.bugReport=Rapport de bug +pollen.common.chartType-pie=Camembert +pollen.common.chartType-pie3d=Camembert 3D +pollen.common.chartType-ring=Anneau pollen.common.commentName=Nom pollen.common.commentText=Commentaire pollen.common.csvImport=Import CSV pollen.common.description=Description +pollen.common.displayType-group=Résultats par groupes +pollen.common.displayType-normal=Résultats pollen.common.email=Em@il pollen.common.endChoiceDate=Date de fin des choix pollen.common.endDate=Date de fin pollen.common.firstName=Prénom pollen.common.functions=Fonctions +pollen.common.group=groupes pollen.common.lastName=Nom pollen.common.ldapImport=Import LDAP pollen.common.license=Licence pollen.common.login=Identifiant pollen.common.name=Nom pollen.common.nbAccounts=Nombre de membres -pollen.common.nbVotes=vote-size\=%d votes ont été enregistrés +pollen.common.nbVotes=%d votes ont été enregistrés pollen.common.newPassword=Nouveau mot de passe pollen.common.newPassword2=Répétez votre nouveau mot de passe +pollen.common.normal=normal +pollen.common.numberVote-average=Moyenne des nombres +pollen.common.numberVote-blank-votes=Nombre de votes blancs +pollen.common.numberVote-total=Somme des nombres +pollen.common.numberVote-total-votes=Nombre total de votes pollen.common.or=ou pollen.common.password=Mot de passe pollen.common.password2=Répétez votre mot de passe @@ -74,13 +86,17 @@ pollen.common.pollOption.reminderHourCountdown=heures avant la fin du sondage pollen.common.pollType=Type de sondage pollen.common.postDate=Date du commentaire +pollen.common.results=Résultats \: pollen.common.title=Titre pollen.common.userSupport=Support utilisateur +pollen.common.victories=Gagnants \: +pollen.common.victory=Gagnant \: pollen.common.voteCountingType=Type de dépouillement pollen.common.voteCountingTypeHelp.condorcet=Vote Condorcet \: classer les choix par ordre de préférence de 1 à N (1\=préféré). Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la même valeur. pollen.common.voteCountingTypeHelp.normal=Vote normal \: voter pour le ou les choix préférés. pollen.common.voteCountingTypeHelp.number=Vote par nombre \: La réponse est libre, laissez vide ou entrez un nombre entier pollen.common.voteCountingTypeHelp.percentage=Vote par pourcentage \: répartir les choix de manière à obtenir 100%% au total. +pollen.common.voteNbVotes=%d votes existants pollen.common.voterName=Votant pollen.common.x=Dépouillement pollen.error.accountNotFound= @@ -102,6 +118,8 @@ pollen.error.pollAccount.email.required=Em@il obliqatoire pollen.error.pollAccount.not.found=Membre non trouvé pollen.error.pollAccount.votingId.required=Nom obliqatoire +pollen.error.pollNotClosed=Ce sondage n'est pas clos. Les résultats peuvent encore changer. +pollen.error.pollNotFound=Le sondage que vous voulez dépouiller n'existe pas. pollen.error.user.alreadyVoted=Une personne a déjà voté sous le nom %s. pollen.error.user.bad.login.or.password=Mauvais identifiant ou mot de passe. pollen.error.user.email.already.used=Le courriel saisi est déjà utilisé par un autre utilisateur @@ -109,6 +127,7 @@ pollen.error.user.login.already.used=Le login saisie est déjà utilisé par un autre utilisateur pollen.error.user.not.found=Utilisateur non trouvé pollen.error.user.restrictedListsForbidden=Le sondage est restreint et vous n'êtes pas autorisé à voter. Vérifiez que vous avez bien utiliser le lien qui vous a été envoyé. +pollen.error.userNotAllowed=Vous n'êtes pas autorisé à dépouiller ce sondage. pollen.fieldset.connexionInformation=Information de connexion pollen.fieldset.login=Connexion pollen.fieldset.poll.choices=Les choix Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml 2012-02-28 15:32:26 UTC (rev 3151) @@ -193,6 +193,7 @@ <include file="config/struts-admin.xml"/> <include file="config/struts-poll.xml"/> <include file="config/struts-user.xml"/> + <include file="config/struts-io.xml"/> </struts> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-02-28 15:32:26 UTC (rev 3151) @@ -58,7 +58,7 @@ href="mailto:%{configuration.adminEmail}"> <img src="<s:url value='/img/contact.png' />" alt="Contact"/> </s:a> - | Date - Heure | + | <%=PollenActionSupport.getCurrentDateTime()%> | <s:a action="changeLang" id="localeFr"> <s:param name="request_locale">fr_FR</s:param> <img src="<s:url value='/img/fr.png' />" alt="Français"/> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml 2012-02-28 15:32:26 UTC (rev 3151) @@ -30,6 +30,7 @@ <pattern>/config-browser/*</pattern> <pattern>/json/*</pattern> <pattern>/poll/confirmDelete*</pattern> + <pattern>/io/*</pattern> </excludes> <decorator name="layout-default" page="layout-default.jsp"> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp 2012-02-28 15:32:26 UTC (rev 3151) @@ -22,4 +22,158 @@ #L% --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> -<h2>result poll TODO</h2> \ No newline at end of file +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> +<link rel="stylesheet" type="text/css" + href="<s:url value='/css/results.css'/>"/> + +<script type="text/javascript"> + + function displayNormalChartUrl(type) { + var url = "<s:url value='%{getNormalPollResultChartUrl(400,300)}' escapeAmp='false'/>&type=" + type; + $('#normalChartImg').attr('src', url); + return false; + } + + jQuery(document).ready(function () { + $('#displayChart1').click(); + }); + + +</script> +<s:if test="userAllowed"> + + <h1 class="titleVoteCounting"><s:property value="poll.title"/></h1> + + <!-- Informations sur le sondage --> + <div id="resultTop"> + <s:property value="poll.description"/> + <fieldset> + <legend><s:text name="poll.common.aboutPoll"/></legend> + <div style="float: right"> + <s:a namespace="/poll" action="votefor/%{uriId}"> + <img src="<s:url value='/img/vote.png'/>" + title="<s:text name="poll.common.vote.return-help"/>" + alt="<s:text name="poll.common.vote.return"/>"/> + </s:a> + </div> + <s:label value="%{poll.creator.votingId}" + key='pollen.common.pollCreator'/> + <s:label value="%{poll.beginDate}" key='pollen.common.beginDate'/> + <s:label value="%{poll.endDate}" + label='%{getText("pollen.common.endDate")}'/> + <s:label value="%{poll.voteCountingType}" + label='%{getText("pollen.common.voteCountingType")}' + tooltip="%{voteCountingTypeHelp}" + tooltipIconPath="/img/help.png"/> + </fieldset> + </div> + + <!-- Victoire --> + <s:if test="victoryMessage != ''"> + <h4><s:property value="victoryMessage"/> + <br/> + <s:iterator value="topRanking" var="result"> + + <s:if test="textType"> + <s:property value="%{#result.name}"/> + </s:if> + <s:if test="dateType"> + <s:property value="%{getResultNameAsDate(#result.name)}"/> + </s:if> + <s:if test="imageType"> + <s:url id="imageUrl" namespace="/io" action="getPollChoiceImage" + escapeAmp="false"> + <s:param name="choiceId" value="name"/> + <s:param name="pollId" value="poll.pollId"/> + <s:param name="thumb" value="true"/> + </s:url> + + <img alt="<s:property value='name'/>" + title="<s:property value='name'/>" + src="<s:property value='imageUrl'/>"> + + </s:if> + <br/> + </s:iterator> + </h4> + </s:if> + + <!-- Diagramme --> + <div id="resultChart"> + <div class="chartTypeDiv"> + <sj:a id='displayChart1' href="#" + onclick="return displayNormalChartUrl(1);"> + <img src="<s:url value='/img/rep1.png'/>" + title='<s:text name="pollen.common.chartType-pie"/>' alt="1"/> + </sj:a> + <sj:a id='displayChart2' href="#" + onclick="return displayNormalChartUrl(2);"> + <img src="<s:url value='/img/rep2.png'/>" + title='<s:text name="pollen.common.chartType-pie3d"/>' alt="2"/> + </sj:a> + <sj:a id='displayChart3' href="#" + onclick="return displayNormalChartUrl(3);"> + <img src="<s:url value='/img/rep3.png'/>" + title='<s:text name="pollen.common.chartType-ring"/>' alt="3"/> + </sj:a> + </div> + + <div class="displayTypeDiv"> + <s:if test="groupPoll"> + <s:text name="pollen.common.results"/> + <s:if test="byGroup"> + <s:a href="#" onclick="return false;"> + <s:text name="pollen.common.normal"/> + </s:a> + - <s:text name="pollen.common.group"/> + </s:if> + <s:else> + <s:text name="pollen.common.normal"/> - + <s:a href="#" onclick="return false;"> + <s:text name="pollen.common.group"/> + </s:a> + </s:else> + </s:if> + </div> + + <sj:div id='chartContainer'> + <img id='normalChartImg'/> + </sj:div> + + <!-- Diagramme par choix --> + <s:if test="choicesResults != null"> + <div id="resultChart"> + <div> + <s:iterator value="choicesResults.entrySet()" var="choicesResult"> + <s:property value="%{#choicesResult.key}"/> + <s:property value="%{#choicesResult.value}"/> + <%--<t:chart title="${choicesResult.key}" width="400" height="300"--%> + <%--values="choicesResult.value" type="${type}"--%> + <%--t:subtitles="subtitles.get(choicesResult.key)" />--%> + </s:iterator> + </div> + </div> + </s:if> + </div> + <!-- Classement --> + <%--<t:remove>--%> + <%--<div id="resultList">--%> + <%--<ol>--%> + <%--<s:iterator value="ranking" var="result">--%> + <%--<li>--%> + <%--<s:if test="dateType">--%> + <%--<s:property value="%{getResultNameAsDate(#result.name)}"/>--%> + <%--<%–<t:output value="resultNameAsDate" format="dateFormat"/>–%>--%> + <%--</s:if>--%> + <%--<s:else>--%> + <%--<s:property value="name"/>--%> + <%--</s:else>--%> + <%--(<s:property value="%{getTrimValue(#result)}"/>)--%> + <%--</li>--%> + <%--</s:iterator>--%> + <%--</ol>--%> + <%--</div>--%> + <%--</t:remove>--%> + +</s:if> \ No newline at end of file Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-02-28 15:32:26 UTC (rev 3151) @@ -26,11 +26,12 @@ <%@ taglib prefix="sj" uri="/struts-jquery-tags" %> <%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> +<link rel="stylesheet" type="text/css" + href="<s:url value='/css/vote.css'/>"/> + <script type="text/javascript" src="<s:url value='/js/gridHelper.js' />"></script> -<%--<s:url id="deleteCommentUrl" action="confirmDeleteComment" namespace="/poll"/>--%> - <s:url id='deleteImg' value='/img/delete.png'/> <s:set id='deleteTitle'><s:text name="pollen.action.pollCommentDelete"/></s:set> @@ -104,8 +105,7 @@ <div style="float: right"> <s:if test="poll.publicResults"> - <s:a namespace="/poll" action="result" method="input"> - <s:param name="pollId" value="poll.pollId"/> + <s:a namespace="/poll" action="results/%{uriId}"> <img src="<s:url value='/img/count.png'/>" title="<s:text name="poll.common.vote.results-help"/>" alt="<s:text name="poll.common.vote.results"/>"/> @@ -119,25 +119,23 @@ </s:a> </s:if> </div> - <s:label value="%{poll.creator.votingId}" key='pollen.common.pollCreator'/> + <s:label value="%{creatorName}" key='pollen.common.pollCreator'/> <s:label value="%{poll.beginDate}" key='pollen.common.beginDate'/> - <s:label value="%{poll.endDate}" - label='%{getText("pollen.common.endDate")}'/> + <s:label value="%{poll.endDate}" key='pollen.common.endDate'/> <s:label value="%{poll.voteCountingType}" label='%{getText("pollen.common.voteCountingType")}' tooltip="%{voteCountingTypeHelp}" tooltipIconPath="/img/help.png"/> </fieldset> </div> +<div id="pollZone"> <s:if test="pollChoiceOrVoteStarted"> -<br/> - <!-- Sondage --> <s:if test="poll.anonymous"> <p> - <s:text name="pollen.common.nbVotes"> + <s:text name="pollen.common.voteNbVotes"> <s:param><s:property value="%{poll.sizeVote()}"/></s:param> </s:text> </p> @@ -145,6 +143,11 @@ </s:if> <s:else> <%--TODO Do me!--%> + <div class="p-pager"> + <s:text name="pollen.common.voteNbVotes"> + <s:param><s:property value="%{poll.sizeVote()}"/></s:param> + </s:text> + </div> <%--<t:pager t:nbRowsPerPage="nbVotesPerPage" t:nbTotalRows="poll.nbVotes"--%> <%--t:currentPage="page" t:noPagerText="prop:noPagerText"/>--%> </s:else> @@ -178,19 +181,17 @@ <span title="<s:text name="pollen.common.description"/>" value="%{escapeLineBreak(#choice.description)}"> <span class="desc"> - <s:property value="%{#choice.name}"/> + <s:property value="name"/> </span> </span> </s:if> <s:else> - <s:property value="%{#choice.name}"/> + <s:property value="name"/> </s:else> <s:if test="pollChoiceRunning"> <s:if test="creatorUser"> <s:a action="deleteChoice" namespace="/poll"> - <s:param name="choiceId"> - <s:property value="%{#choice.id}"/> - </s:param> + <s:param name="choiceId"><s:property value="id"/></s:param> <img src="<s:url value="/img/delete.png"/>" title="<s:text name="pollen.action.deleteChoice"/>" alt="<s:text name="pollen.action.deleteChoice"/>"/> @@ -208,16 +209,15 @@ <s:if test="!isDescNull(#choice)"> <th class="desc"> - <span title="<s:text name="pollen.common.description"/>" - value="%{escapeLineBreak(#choice.description)}"> - <s:property value="%{#choice.choiceNameAsDate}"/> + <span + title='<s:property value="escapeLineBreak(#choice.description)"/>'> + <s:property value="%{formatChoiceNameAsDate(#choice)}"/> </span> </th> </s:if> <s:else> <th> - <s:property value="%{#choice.choiceNameAsDate}"/> - <%--<t:output value="choiceNameAsDate" format="dateFormat"/>--%> + <s:property value="%{formatChoiceNameAsDate(#choice)}"/> </th> </s:else> </s:if> @@ -227,25 +227,27 @@ <s:if test="imageType"> <s:iterator value="poll.choice" var="choice"> <s:if test="!isChoiceHidden(#choice)"> + <s:url id="imageUrl" namespace="/io" + action="getPollChoiceImage" + escapeAmp="false"> + <s:param name="choiceId" value="name"/> + <s:param name="pollId" value="poll.pollId"/> + <s:param name="thumb" value="true"/> + </s:url> <s:if test="!isDescNull(#choice)"> <th class="desc"> - <span title="<s:text name="pollen.common.description"/>" - value="%{escapeLineBreak(#choice.description)}"> - <%--Obtain image from poll.pollId/choice.name--%> - <s:property value="%{#choice.name}"/> - <%--<t:image--%> - <%--t:src="#choice.name"--%> - <%--alt="#choice.description"--%> - <%--t:dir="poll.pollId"/>--%> - </span> + <img alt="<s:property value='name'/>" + title='<s:property value="escapeLineBreak(#choice.description)"/>' + src="<s:property value='imageUrl'/>"> </th> </s:if> <s:else> <th> - <%--Obtain image from poll.pollId/choice.name--%> - <s:property value="%{#choice.name}"/> + <img alt="<s:property value='name'/>" + title='<s:property value="escapeLineBreak(#choice.description)"/>' + src="<s:property value='imageUrl'/>"> </th> </s:else> </s:if> @@ -269,24 +271,20 @@ <s:if test="!isChoiceHidden(#choice)"> <th> - <s:if - test="normalVoteCounting"> - <s:checkbox value="addChoice" theme="simple"/> + <s:if test="normalVoteCounting"> + <s:checkbox name="addChoice" theme="simple"/> </s:if> - <s:if - test="percentageVoteCounting"> + <s:if test="percentageVoteCounting"> <s:textfield value="#choice.value" size="3" required="true" theme="simple"/> <%--t:validate="required, min=0, max=100"/>%--%> </s:if> - <s:if - test="condorcetVoteCounting"> + <s:if test="condorcetVoteCounting"> <s:textfield id="condorcetInput" value="choice.value" size="3" theme="simple"/> <%--t:nulls="zero" t:validate="min=0, max=99"/>--%> </s:if> - <s:if - test="numberVoteCounting"> + <s:if test="numberVoteCounting"> <s:textfield value="addNumberVote" size="3" theme="simple"/> </s:if> </th> @@ -302,7 +300,7 @@ <td> <s:if test="accountFieldDisplayed"> <s:if test="!#vote.anonymous"> - <s:property value="%{#vote.pollAccount.votingId}"/> + <s:property value="pollAccount.votingId"/> </s:if> <s:else> ? @@ -321,8 +319,6 @@ <s:if test="creatorUser"> <s:a action="deleteVote" namespace="/poll" href="#" onclick="return openDeleteVoteDialog('%{#vote.topiaId}');"> - <%--<s:param name="uriId" value="%{uriId}"/>--%> - <%--<s:param name="voteId" value="%{#vote.topiaId}"/>--%> <img src="<s:url value="/img/delete.png"/>" title="<s:text name="pollen.action.deleteVote"/>" alt="<s:text name="pollen.action.deleteVote"/>"/> @@ -366,8 +362,7 @@ <td class="notVoted"></td> </s:else> </s:if> - <s:if - test="numberVoteCounting"> + <s:if test="numberVoteCounting"> <s:if test="isChoiceInVote(#currentVoteChoice)"> <td class="voted"> <s:property value="%{#currentVoteChoice.voteValue}"/> @@ -386,12 +381,9 @@ <s:if test="poll.continuousResults"> <tr> <td> - <s:a namespace="/poll" action="result" method="input"> - <s:param name="pollId" value="poll.pollId"/> + <s:a namespace="/poll" action="results/%{poll.pollId}"> <s:text name="poll.common.vote.results"/> </s:a> - <%--<t:PageLink t:page="poll/results"--%> - <%--t:context="${poll.pollId}">${message:results}</t:PageLink>--%> </td> <s:iterator value="poll.choice" var="choice"> @@ -416,55 +408,83 @@ <%--<t:label for="anonymousVote"/>--%> <br/> </s:if> - <s:submit action="vote" key="pollen.action.vote"/> + <s:submit action="vote" key="pollen.action.pollVote"/> <%--<input id="submitVote" t:type="Submit" t:value="${message:submitVote}"/>--%> </div> </s:if> </s:form> - +</div> <!-- Ajout de commentaires --> <h3><s:text name="poll.common.comments"/></h3> -<div id="commentsDiv"> +<div id="commentZone"> + <div id="commentsDiv"> + <s:iterator value="comments" var="comment" status="status"> + <div + <s:if test="#status.even">class="even"</s:if> + <s:else>class="odd"</s:else> + > + <s:if test="creatorUser"> + <span class="cmd"> + <s:a href="#" + onclick="return openDeleteCommentDialog('%{#comment.topiaId}');"> + <img src="<s:url value='/img/delete.png'/>" + title="<s:text name="pollen.action.pollCommentDelete"/>" + alt="<s:text name="pollen.action.pollCommentDelete"/>"/> + </s:a> + </span> + </s:if> + <span class="name"><s:property value='pollAccount.votingId'/></span> : + <span class="date"> + <s:property value='%{formatDateTime(postDate)}'/> + </span> - <s:url id="loadPollComments" action="getPollComments" namespace="/json" - escapeAmp="false"> - <s:param name="pollId" value="%{poll.pollId}"/> - </s:url> + <p> + <s:property value='text'/> + </p> + </div> + </s:iterator> + </div> + <%--div id="commentsDiv"> - <sjg:grid id="comments" dataType="json" href="%{loadPollComments}" - gridModel="comments" sortable="true" pager="true" - pagerButtons="true" pagerInput="true" navigator="true" - rownumbers="false" autowidth="true" editinline="false" - navigatorEdit="false" navigatorDelete="false" - navigatorSearch="false" navigatorRefresh="false" - navigatorAdd="false" viewrecords="true" sortorder="desc" - sortname="postDate" rowList="10,15,20,50,100" rowNum="10"> + <s:url id="loadPollComments" action="getPollComments" namespace="/json" + escapeAmp="false"> + <s:param name="pollId" value="%{poll.pollId}"/> + </s:url> - <sjg:gridColumn name="id" title="id" hidden="true"/> - <sjg:gridColumn name="postDate" title='%{getText("pollen.common.postDate")}' - sortable="true" formatter="date" width="50" - formatoptions="{newformat : 'd.m.Y H:i', srcformat : 'Y-m-d H:i:s'}"/> - <sjg:gridColumn name="pollAccount.votingId" - title='%{getText("pollen.common.commentName")}' - sortable="true"/> - <sjg:gridColumn name="text" title='%{getText("pollen.common.commentText")}' - sortable="true"/> - <sjg:gridColumn name="functions" sortable="false" title='' width="10" - formatter="commentFunctions"/> - </sjg:grid> -</div> + <sjg:grid id="comments" dataType="json" href="%{loadPollComments}" + gridModel="comments" sortable="true" pager="true" + pagerButtons="true" pagerInput="true" navigator="true" + rownumbers="false" autowidth="true" editinline="false" + navigatorEdit="false" navigatorDelete="false" + navigatorSearch="false" navigatorRefresh="false" + navigatorAdd="false" viewrecords="true" sortorder="desc" + sortname="postDate" rowList="10,15,20,50,100" rowNum="10"> -<br/> + <sjg:gridColumn name="id" title="id" hidden="true"/> + <sjg:gridColumn name="postDate" + title='%{getText("pollen.common.postDate")}' + sortable="true" formatter="date" width="50" + formatoptions="{newformat : 'd.m.Y H:i', srcformat : 'Y-m-d H:i:s'}"/> + <sjg:gridColumn name="pollAccount.votingId" + title='%{getText("pollen.common.commentName")}' + sortable="true"/> + <sjg:gridColumn name="text" + title='%{getText("pollen.common.commentText")}' + sortable="true"/> + <sjg:gridColumn name="functions" sortable="false" title='' width="10" + formatter="commentFunctions"/> + </sjg:grid> + </div--%> -<div id="commentFormDiv"> + <%--<br/>--%> - <fieldset> - <legend><s:text name="poll.legend.addNewComment"/></legend> + <div id="commentFormDiv"> + <s:form id='addCommentForm' method="POST" namespace="/poll"> <s:hidden key="pollId" label=''/> - <s:textfield key="commentName" required="true" + <s:textfield key="commentName" required="true" size="78" label="%{getText('pollen.common.commentName')}"/> <s:textarea key="commentText" required="true" value='' label="%{getText('pollen.common.commentText')}"/> @@ -474,11 +494,12 @@ align="left"/> </div> </s:form> - </fieldset> -</div> -<sj:dialog id="deleteCommentDialog" resizable="false" - title="%{getText('pollen.title.delete.pollComment')}" - autoOpen="false" modal="true" width="800"/> + </div> + <sj:dialog id="deleteCommentDialog" resizable="false" + title="%{getText('pollen.title.delete.pollComment')}" + autoOpen="false" modal="true" width="800"/> + +</div> </s:if> \ No newline at end of file Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-02-28 15:32:26 UTC (rev 3151) @@ -29,11 +29,11 @@ <s:url id="loadUrl" action="getPolls" namespace="/json" method="input"/> -<s:url id="voteUrl" action="vote" namespace="/poll" method="input"/> +<s:url id="voteUrl" action="votefor/" namespace="/poll"/> <s:url id='voteImg' value='/img/vote.png'/> <s:set id='voteTitle'><s:text name="pollen.action.pollVote"/></s:set> -<s:url id="resultUrl" action="result" namespace="/poll" method="input"/> +<s:url id="resultUrl" action="results/" namespace="/poll"/> <s:url id='resultImg' value='/img/count.png'/> <s:set id='resultTitle'><s:text name="pollen.action.pollResult"/></s:set> @@ -69,10 +69,10 @@ if (rowObject['voteId']) { id = rowObject['voteId']; } - result += formatLink(id, "${voteUrl}", "${voteImg}", "Vote", "${voteTitle}") + result += formatLink(null, "${voteUrl}"+id, "${voteImg}", "Vote", "${voteTitle}") } if (cellvalue.indexOf('result') > -1) { - result += formatLink(id, "${resultUrl}", "${resultImg}", "Result", "${resultTitle}") + result += formatLink(null, "${resultUrl}"+id, "${resultImg}", "Result", "${resultTitle}") } if (cellvalue.indexOf('edit') > -1) { result += formatLink(id, "${editUrl}", "${editImg}", "Edit", "${editTitle}") @@ -92,7 +92,10 @@ return result; } function formatLink(id, baseUrl, image, imageAlt, imageTitle) { - var url = $.prepareUrl(baseUrl, {pollId:id}); + var url = baseUrl; + if (id) { + url = $.prepareUrl(baseUrl, {pollId:id}); + } return "<a href='" + url + "'><image alt='" + imageAlt + "' title='" + imageTitle + "' src='" + image + "'> </a>"; } </script> Copied: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/results.css (from rev 3149, branches/pollen-1.2.6-struts2/pollen-ui/src/main/webapp/css/results.css) =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/results.css (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/results.css 2012-02-28 15:32:26 UTC (rev 3151) @@ -0,0 +1,67 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 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% + */ +#resultTop { + width: 700px; + margin: auto; + text-align: center; +} + +#resultTop legend { + color: #727a7e; + font-weight: bold; +} + +#resultTop fieldset { + width: 350px; + border: 1px solid #aab; + padding: 15px; + padding-bottom: 10px; + margin: auto; + margin-top: 20px; + margin-bottom: 20px; + vertical-align: top; + text-align: left; +} + +#resultChart { + width: 400px; + margin: auto; + text-align: left; +} + +#resultChart .displayTypeDiv { + margin-left: 10px; +} + +#resultChart .chartTypeDiv { + margin-right: 10px; + float: right; +} + +#resultList { + width: 500px; + margin: auto; + margin-top: 20px; + text-align: center; +} Copied: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/vote.css (from rev 3149, branches/pollen-1.2.6-struts2/pollen-ui/src/main/webapp/css/vote.css) =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/vote.css (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/vote.css 2012-02-28 15:32:26 UTC (rev 3151) @@ -0,0 +1,215 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 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% + */ +#pollTop { + width: 700px; + margin: auto; + text-align: center; +} + +#pollTop legend { + color: #727a7e; + font-weight: bold; +} + +#pollTop fieldset { + width: 350px; + border: 1px solid #aab; + padding: 15px; + padding-bottom: 10px; + margin: auto; + margin-top: 20px; + margin-bottom: 20px; + vertical-align: top; + text-align: left; +} + +#pollZone { + /*padding: 10px;*/ + text-align: center; + -moz-border-radius: 15px; +} + +#pollZone form { + margin-top: 10px; +} + +#poll { + border-collapse: collapse; + border-left: 1px solid #aab; + border-top: 1px solid #aab; + background-color: #fff; + font-size: 14px; + margin: auto; +} + +#poll THEAD, +#poll TFOOT { + border-top: 1px solid #aab; /* For Firefox */ +} + +#poll THEAD TR { + color: #fff; + background-color: #55cb00; +} + +#poll THEAD TR a { + color: #fff; + background-color: #55cb00; +} + +#poll THEAD TR TH { + text-align: left; + padding: 2px 3px; + white-space: nowrap; + border-right: 1px solid #aab; + border-bottom: 1px solid #aab; + background-color: #55cb00; +} + +#poll THEAD TR TH .desc { + padding: 2px 3px; + text-decoration: overline; +} + +#poll TFOOT TR TH { + padding: 2px 3px; + white-space: nowrap; + border-right: 1px solid #aab; + border-bottom: 1px solid #aab; + background-color: #55cb00; +} + +#poll TFOOT TR #voterName { + text-align: left; +} + +#poll TBODY TR { + background-color: #fff; +} + +#poll TBODY TR .odd { + background-color: #b0f580; +} + +#poll TBODY TR .anonymous { + background-color: #ddd; + text-align: center; +} + +#poll TBODY TR .voted { + background-color: #6f6; + color: #242; + text-align: center; +} + +#poll TBODY TR .notVoted { + background-color: #f66; +} + +#poll TBODY TR .result { + background-color: #e5e5e5; + color: #555; + text-align: center; +} + +#poll TBODY TR TD { + border-right: 1px solid #aab; + border-bottom: 1px solid #aab; + padding: 2px 5px; +} + +#buttons { + text-align: center; + margin: 10px; +} + +#voteError { + width: 600px; + margin: auto; + margin-top: 10px; +} + +#voteError .t-error div, +#voteError .t-error ul { + padding: 3px; +} + +#voteError .t-error LI +{ + list-style:disc; + margin-left: 20px; +} + +#choiceFormDiv form { + width: 200px; + margin: auto; + margin-top: 20px; + margin-bottom: 20px; + padding: 10px 50px 10px 50px; + border-top: 1px solid #aab; +} + +#commentZone { + width: 600px; + margin: auto; +} + +#commentZone textarea { + width: 500px; + height: 100px; +} + +#commentFormDiv form { + margin-top: 20px; + padding: 10px 50px 0px 50px; + border-top: 1px solid #aab; +} + +#commentsDiv .odd { + background-color: #d7fabf; +} + +#commentsDiv .name { + color: #55cb00; + font-weight: bold; +} + +#commentsDiv .date { + color: #555555; + font-size: 11px; +} + +#commentsDiv .cmd { + float: right; +} + +#commentsDiv p { + font-size: 12px; + margin-top: 0px; + margin-bottom: 0px; +} + +#commentsDiv div { + padding: 5px 15px; +} \ No newline at end of file Modified: branches/pollen-1.2.6-struts2/pom.xml =================================================================== --- branches/pollen-1.2.6-struts2/pom.xml 2012-02-28 15:31:30 UTC (rev 3150) +++ branches/pollen-1.2.6-struts2/pom.xml 2012-02-28 15:32:26 UTC (rev 3151) @@ -197,6 +197,12 @@ </dependency> <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-jfreechart-plugin</artifactId> + <version>${struts2Version}</version> + </dependency> + + <dependency> <groupId>org.apache.struts.xwork</groupId> <artifactId>xwork-core</artifactId> <version>${struts2Version}</version>