Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java,v diff -u -r1.11 -r1.12 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java 18 May 2006 17:52:11 -0000 1.11 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java 29 May 2006 15:40:58 -0000 1.12 @@ -172,7 +172,8 @@ public String toString() { return new ToStringBuilder(this) - .append("uid", getUid()) + .append("nomination:", voteQueContent.getQuestion()) + .append("userEntry:", userEntry) .toString(); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java,v diff -u -r1.33 -r1.34 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java 29 May 2006 14:15:37 -0000 1.33 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java 29 May 2006 15:40:57 -0000 1.34 @@ -1154,14 +1154,19 @@ } } - + /** + * logs hiding of a user entered vote + */ public void hideOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException { logger.debug("hiding user entry: " + voteUsrAttempt.getUserEntry()); auditService.logHideEntry(MY_SIGNATURE, voteUsrAttempt.getQueUsrId(), voteUsrAttempt.getVoteQueUsr().getUsername(), voteUsrAttempt.getUserEntry()); } - + + /** + * logs showing of a user entered vote + */ public void showOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException { logger.debug("showing user entry: " + voteUsrAttempt.getUserEntry()); @@ -1174,9 +1179,6 @@ { try { - //auditService.logShowEntry(MY_SIGNATURE, voteQueUsr.getQueUsrId(), - // voteQueUsr.getUsername(), voteQueUsr.toString()); - voteUserDAO.removeVoteUser(voteQueUsr); } catch(DataAccessException e) Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java,v diff -u -r1.6 -r1.7 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java 23 May 2006 12:48:52 -0000 1.6 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java 29 May 2006 15:40:57 -0000 1.7 @@ -24,12 +24,20 @@ package org.lamsfoundation.lams.tool.vote.web; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; +import org.jfree.chart.ChartUtilities; +import org.jfree.chart.JFreeChart; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.vote.VoteAppConstants; import org.lamsfoundation.lams.tool.vote.VoteApplicationException; @@ -62,7 +70,10 @@ }else if (StringUtils.equals(mode,ToolAccessMode.TEACHER.toString())){ teacher(request,response,directoryName,cookies); } - + + logger.debug("writing out chart to directoryName: " + directoryName); + writeOutChart(request, "pie", directoryName); + writeOutChart(request, "bar", directoryName); logger.debug("basePath: " + basePath); writeResponseToFile(basePath+"/export/exportportfolio.jsp",directoryName,FILENAME,cookies); @@ -158,4 +169,42 @@ logger.debug("ending teacher mode: "); } + + /** + * creates JFreeCharts for offline visibility + * @param request + * @param chartType + * @param directoryName + */ + public void writeOutChart(HttpServletRequest request, String chartType, String directoryName) { + logger.debug("File.separator: " + File.separator) ; + String fileName=chartType + ".png"; + logger.debug("output image fileName: " + fileName) ; + logger.debug("full folder name:" + directoryName + File.separator + fileName); + + try{ + OutputStream out = new FileOutputStream(directoryName + File.separator + fileName); + VoteChartGenerator voteChartGenerator= new VoteChartGenerator(); + JFreeChart chart=null; + if (chartType.equals("pie")) + { + chart = voteChartGenerator.createChart(request, "pie"); + } + else + { + chart = voteChartGenerator.createChart(request, "bar"); + } + logger.debug("chart:" + chart); + + ChartUtilities.writeChartAsPNG(out, chart, 400, 300); + } + catch(FileNotFoundException e) + { + logger.debug("exception creating chart: " + e) ; + } + catch(IOException e) + { + logger.debug("exception creating chart: " + e) ; + } + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteChartGenerator.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/Attic/VoteChartGenerator.java,v diff -u -r1.10 -r1.11 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteChartGenerator.java 26 May 2006 23:06:45 -0000 1.10 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteChartGenerator.java 29 May 2006 15:40:57 -0000 1.11 @@ -115,25 +115,24 @@ } - private JFreeChart createChart(HttpServletRequest request, String type) + public JFreeChart createChart(HttpServletRequest request, String type) { logger.debug("chartType: " + type); if (type.equals("pie")) { - return createPieChart (request, type); + return createPieChart (request); } else if (type.equals("bar")) { - return createBarChart (request, type); + return createBarChart (request); } return null; } - private JFreeChart createPieChart(HttpServletRequest request, String chartType) + public JFreeChart createPieChart(HttpServletRequest request) { - logger.debug("chartType: " + chartType); - + logger.debug("starting createPieChart..."); DefaultPieDataset data= new DefaultPieDataset(); @@ -161,10 +160,8 @@ return chart; } - private JFreeChart createBarChart(HttpServletRequest request, String chartType) + public JFreeChart createBarChart(HttpServletRequest request) { - logger.debug("chartType: " + chartType); - logger.debug("starting createBarChart..."); DefaultCategoryDataset data= new DefaultCategoryDataset(); Index: lams_tool_vote/web/export/ExportContent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/web/export/ExportContent.jsp,v diff -u -r1.4 -r1.5 --- lams_tool_vote/web/export/ExportContent.jsp 22 May 2006 21:18:50 -0000 1.4 +++ lams_tool_vote/web/export/ExportContent.jsp 29 May 2006 15:41:10 -0000 1.5 @@ -126,20 +126,20 @@ - - - - Pie Chart - - + + + Pie Chart + + + + + + Bar Chart + + + - - - Bar Chart - - -