Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAllSessionsDTO.java =================================================================== diff -u -r796f0357fbc2197eb4fda5397cc0c01c6de41d0d -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAllSessionsDTO.java (.../VoteAllSessionsDTO.java) (revision 796f0357fbc2197eb4fda5397cc0c01c6de41d0d) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAllSessionsDTO.java (.../VoteAllSessionsDTO.java) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) @@ -42,6 +42,33 @@ private String sessionName; private Map mapStandardNominationsContent; private Map mapStandardNominationsHTMLedContent; + + private Map mapStandardQuestionUid; + private Map mapStandardToolSessionUid; + /** + * @return Returns the mapStandardQuestionUid. + */ + public Map getMapStandardQuestionUid() { + return mapStandardQuestionUid; + } + /** + * @param mapStandardQuestionUid The mapStandardQuestionUid to set. + */ + public void setMapStandardQuestionUid(Map mapStandardQuestionUid) { + this.mapStandardQuestionUid = mapStandardQuestionUid; + } + /** + * @return Returns the mapStandardToolSessionUid. + */ + public Map getMapStandardToolSessionUid() { + return mapStandardToolSessionUid; + } + /** + * @param mapStandardToolSessionUid The mapStandardToolSessionUid to set. + */ + public void setMapStandardToolSessionUid(Map mapStandardToolSessionUid) { + this.mapStandardToolSessionUid = mapStandardToolSessionUid; + } private Map mapStandardUserCount; private Map mapStandardRatesContent; private List listUserEntries; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java =================================================================== diff -u -r5534ee285138a23ab091f9799228254e3459ea8c -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 5534ee285138a23ab091f9799228254e3459ea8c) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) @@ -76,6 +76,8 @@ public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid); + public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid); + public void removeAttemptsForUser(final Long queUsrId); public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java =================================================================== diff -u -r5534ee285138a23ab091f9799228254e3459ea8c -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 5534ee285138a23ab091f9799228254e3459ea8c) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) @@ -363,7 +363,31 @@ } + public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid) + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT) + .setLong("voteQueContentId", voteQueContentId.longValue()) + .list(); + + List userEntries= new ArrayList(); + if(list != null && list.size() > 0){ + Iterator listIterator=list.iterator(); + while (listIterator.hasNext()) + { + VoteUsrAttempt attempt=(VoteUsrAttempt)listIterator.next(); + if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) + { + userEntries.add(attempt.getVoteQueUsr().getFullname()); + } + } + } + return userEntries; + + } + + public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid) { HibernateTemplate templ = this.getHibernateTemplate(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java =================================================================== diff -u -r35f1843c3f562fb2e648e7b2c55565cc38ea990a -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 35f1843c3f562fb2e648e7b2c55565cc38ea990a) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) @@ -105,6 +105,8 @@ public int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException; + public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid); + public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionId) throws VoteApplicationException; public int getAllEntriesCount() throws VoteApplicationException; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java =================================================================== diff -u -rcc504e79fcfddaab61fdb673e9866a1b57c2d12c -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision cc504e79fcfddaab61fdb673e9866a1b57c2d12c) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) @@ -235,7 +235,22 @@ e); } } + + public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid) + { + try + { + return voteUsrAttemptDAO.getStandardAttemptUsersForQuestionContentAndSessionUid(voteQueContentId, voteSessionUid); + } + catch (DataAccessException e) + { + throw new VoteApplicationException("Exception occured when lams is retrieving usernames for votes: " + + e.getMessage(), + e); + } + } + public List getContentEntries(final Long voteContentUid) throws VoteApplicationException { @@ -919,8 +934,8 @@ e); } } + - public VoteSession retrieveVoteSession(Long voteSessionId) throws VoteApplicationException { try Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java =================================================================== diff -u -r84774fe0902da622d65434831fd9c6335c15b238 -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 84774fe0902da622d65434831fd9c6335c15b238) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) @@ -736,6 +736,9 @@ logger.debug("using entriesCount: " + entriesCount); Map mapStandardNominationsHTMLedContent= new TreeMap(new VoteComparator()); + Map mapStandardQuestionUid= new TreeMap(new VoteComparator()); + Map mapStandardToolSessionUid= new TreeMap(new VoteComparator()); + while (queIterator.hasNext()) { VoteQueContent voteQueContent=(VoteQueContent) queIterator.next(); @@ -750,6 +753,10 @@ int votesCount=0; logger.debug("getting votesCount based on session: " + voteSession.getUid()); votesCount=voteService.getStandardAttemptsForQuestionContentAndSessionUid(voteQueContent.getUid(), voteSession.getUid()); + + mapStandardQuestionUid.put(mapIndex.toString(),voteQueContent.getUid().toString()); + mapStandardToolSessionUid.put(mapIndex.toString(),voteSession.getUid()); + logger.debug("votesCount for questionContent uid: " + votesCount + " for" + voteQueContent.getUid()); mapStandardUserCount.put(mapIndex.toString(),new Integer(votesCount).toString()); totalStandardVotesCount=totalStandardVotesCount + votesCount; @@ -810,6 +817,8 @@ voteAllSessionsDTO.setMapStandardNominationsHTMLedContent(mapStandardNominationsHTMLedContent); voteAllSessionsDTO.setMapStandardUserCount(mapStandardUserCount); voteAllSessionsDTO.setMapStandardRatesContent(mapStandardRatesContent); + voteAllSessionsDTO.setMapStandardQuestionUid(mapStandardQuestionUid); + voteAllSessionsDTO.setMapStandardToolSessionUid(mapStandardToolSessionUid); VoteMonitoringAction voteMonitoringAction= new VoteMonitoringAction(); List listUserEntries=voteMonitoringAction.processUserEnteredNominations(voteService, voteContent, voteSession.getVoteSessionId().toString(), true, null, false); @@ -911,6 +920,8 @@ logger.debug("using entriesCount: " + entriesCount); Map mapStandardNominationsHTMLedContent= new TreeMap(new VoteComparator()); + Map mapStandardQuestionUid= new TreeMap(new VoteComparator()); + Map mapStandardToolSessionUid= new TreeMap(new VoteComparator()); while (queIterator.hasNext()) { VoteQueContent voteQueContent=(VoteQueContent) queIterator.next(); @@ -927,6 +938,10 @@ { logger.debug("getting votesCount based on session: " + toolSessionUid); votesCount=voteService.getStandardAttemptsForQuestionContentAndSessionUid(voteQueContent.getUid(), toolSessionUid); + + mapStandardQuestionUid.put(mapIndex.toString(),voteQueContent.getUid().toString()); + mapStandardToolSessionUid.put(mapIndex.toString(),toolSessionUid.toString()); + logger.debug("votesCount for questionContent uid: " + votesCount + " for" + voteQueContent.getUid()); mapStandardUserCount.put(mapIndex.toString(),new Integer(votesCount).toString()); totalStandardVotesCount=totalStandardVotesCount + votesCount; @@ -996,6 +1011,12 @@ request.getSession().setAttribute(MAP_STANDARD_USER_COUNT, mapStandardUserCount); logger.debug("test2: MAP_STANDARD_USER_COUNT: " + request.getSession().getAttribute(MAP_STANDARD_USER_COUNT)); + + request.getSession().setAttribute("mapStandardQuestionUid", mapStandardQuestionUid); + logger.debug("test2: mapStandardQuestionUid: " + request.getSession().getAttribute("mapStandardQuestionUid")); + + request.getSession().setAttribute("mapStandardToolSessionUid", mapStandardToolSessionUid); + logger.debug("test2: mapStandardToolSessionUid: " + request.getSession().getAttribute("mapStandardToolSessionUid")); } /** Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteNominationViewer.java =================================================================== diff -u --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteNominationViewer.java (revision 0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteNominationViewer.java (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) @@ -0,0 +1,113 @@ +/*************************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * 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 General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * ***********************************************************************/ + +package org.lamsfoundation.lams.tool.vote.web; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.vote.VoteAppConstants; +import org.lamsfoundation.lams.tool.vote.service.IVoteService; + +/** + *

presents students voted for a particular nomination

+ * + * @author Ozgur Demirtas + * + */ +public class VoteNominationViewer extends HttpServlet implements VoteAppConstants { + static Logger logger = Logger.getLogger(VoteChartGenerator.class.getName()); + + public VoteNominationViewer(){ + } + + public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + { + logger.debug("dispatching doGet for VoteChartGenerator..."); + + PrintWriter out= new PrintWriter(response.getWriter()); + + try{ + String questionUid=request.getParameter("questionUid"); + String sessionUid=request.getParameter("sessionUid"); + + logger.debug("questionUid: " + questionUid); + logger.debug("sessionUid: " + sessionUid); + + IVoteService voteService=null; + voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE); + logger.debug("voteService: " + voteService); + + List userNames=voteService.getStandardAttemptUsersForQuestionContentAndSessionUid(new Long(questionUid), new Long(sessionUid)); + logger.debug("userNames: " + userNames); + + response.setContentType("text/html"); + out.println(""); + out.println(""); + out.println(""); out.println("Learners Voted");out.println(""); + out.println(""); + + out.println(" " + + " " + + " "); + + out.println(""); + out.println(""); + out.println(""); + out.println(""); + + Iterator userIterator=userNames.iterator(); + while (userIterator.hasNext()) + { + String userName=(String)userIterator.next(); + out.println(""); + out.println(""); + out.println(""); + } + out.println("
Students Voted
"); + out.println(userName); + out.println("
"); + + out.println(""); + out.println("
"); + out.flush(); + out.close(); + } + catch(Exception e) + { + logger.error("error occurred: " + e.toString()); + } + finally + { + out.close(); + } + } + +} Index: lams_tool_vote/web/WEB-INF/web.xml =================================================================== diff -u -rbe0f74b3d01318467107b6a074df9a097ca56fc1 -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 --- lams_tool_vote/web/WEB-INF/web.xml (.../web.xml) (revision be0f74b3d01318467107b6a074df9a097ca56fc1) +++ lams_tool_vote/web/WEB-INF/web.xml (.../web.xml) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) @@ -138,8 +138,13 @@ org.lamsfoundation.lams.tool.vote.web.VoteChartGenerator + + voteNominationViewer + org.lamsfoundation.lams.tool.vote.web.VoteNominationViewer + + Connector @@ -175,6 +180,12 @@ /chartGenerator/* + + voteNominationViewer + /voteNominationViewer/* + + + Connector /fckeditor/editor/filemanager/browser/default/connectors/jsp/connector Index: lams_tool_vote/web/monitoring/AllSessionsSummary.jsp =================================================================== diff -u -r796f0357fbc2197eb4fda5397cc0c01c6de41d0d -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 --- lams_tool_vote/web/monitoring/AllSessionsSummary.jsp (.../AllSessionsSummary.jsp) (revision 796f0357fbc2197eb4fda5397cc0c01c6de41d0d) +++ lams_tool_vote/web/monitoring/AllSessionsSummary.jsp (.../AllSessionsSummary.jsp) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) @@ -136,11 +136,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -150,8 +182,8 @@  ( ) - - + + Index: lams_tool_vote/web/monitoring/IndividualSessionSummary.jsp =================================================================== diff -u -r796f0357fbc2197eb4fda5397cc0c01c6de41d0d -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 --- lams_tool_vote/web/monitoring/IndividualSessionSummary.jsp (.../IndividualSessionSummary.jsp) (revision 796f0357fbc2197eb4fda5397cc0c01c6de41d0d) +++ lams_tool_vote/web/monitoring/IndividualSessionSummary.jsp (.../IndividualSessionSummary.jsp) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) @@ -129,11 +129,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +