Index: lams_build/lib/lams/lams-gradebook.jar =================================================================== diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c Binary files differ Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/util/GradebookUtil.java =================================================================== diff -u -r941922b2ef901dad643b18f6a349b156b5a822ea -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/util/GradebookUtil.java (.../GradebookUtil.java) (revision 941922b2ef901dad643b18f6a349b156b5a822ea) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/util/GradebookUtil.java (.../GradebookUtil.java) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -321,8 +321,9 @@ throw new IllegalArgumentException("[" + view + "] is not a legal gradebook view"); } - public static void exportGradebookLessonToExcel(OutputStream out, String dateHeader, - LinkedHashMap dataToExport) throws IOException { + public static void exportGradebookLessonToExcel(OutputStream out, + LinkedHashMap dataToExport, String dateHeader, boolean displaySheetTitle) + throws IOException { Workbook workbook = new SXSSFWorkbook(100); // keep 100 rows in memory, exceeding rows will be flushed to disk boldStyle = workbook.createCellStyle(); @@ -333,7 +334,8 @@ int i = 0; for (String sheetName : dataToExport.keySet()) { if (dataToExport.get(sheetName) != null) { - createSheet(workbook, sheetName, sheetName, i, dateHeader, dataToExport.get(sheetName)); + String sheetTitle = (displaySheetTitle) ? sheetName : null; + createSheet(workbook, sheetName, sheetTitle, i, dateHeader, dataToExport.get(sheetName)); i++; } } @@ -365,8 +367,12 @@ if (data != null) { // Print data for (int rowIndex = 0; rowIndex < data.length; rowIndex++) { - Row row = sheet.createRow(rowIndex + 4); + //in case there is a sheet title or dateHeader available start from 4th row + int rowIndexOffset = (StringUtils.isBlank(sheetTitle) && StringUtils.isBlank(dateHeader)) ? 0 : 4; + + Row row = sheet.createRow(rowIndex + rowIndexOffset); + for (int columnIndex = 0; columnIndex < data[rowIndex].length; columnIndex++) { ExcelCell excelCell = data[rowIndex][columnIndex]; createCell(excelCell, columnIndex, row); Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/action/GradebookMonitoringAction.java =================================================================== diff -u -rd9a8907ef60b47f5dbe1c024a93cb44c3e0a4174 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/action/GradebookMonitoringAction.java (.../GradebookMonitoringAction.java) (revision d9a8907ef60b47f5dbe1c024a93cb44c3e0a4174) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/action/GradebookMonitoringAction.java (.../GradebookMonitoringAction.java) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -327,8 +327,8 @@ fileDownloadTokenCookie.setPath("/"); response.addCookie(fileDownloadTokenCookie); - GradebookUtil.exportGradebookLessonToExcel(out, gradebookService.getMessage("gradebook.export.dateheader"), - dataToExport); + GradebookUtil.exportGradebookLessonToExcel(out, dataToExport, + gradebookService.getMessage("gradebook.export.dateheader"), true); return null; } @@ -369,8 +369,8 @@ //Code to generate file and write file contents to response ServletOutputStream out = response.getOutputStream(); - GradebookUtil.exportGradebookLessonToExcel(out, gradebookService.getMessage("gradebook.export.dateheader"), - dataToExport); + GradebookUtil.exportGradebookLessonToExcel(out, dataToExport, + gradebookService.getMessage("gradebook.export.dateheader"), true); return null; } Index: lams_tool_scratchie/.classpath =================================================================== diff -u -rded32af47a9de99cb3319fdd7461906323f7e293 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_tool_scratchie/.classpath (.../.classpath) (revision ded32af47a9de99cb3319fdd7461906323f7e293) +++ lams_tool_scratchie/.classpath (.../.classpath) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -15,5 +15,6 @@ + Index: lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -rbc65717cc947dfd5b941ab4ac8f31a59c8f68bf4 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision bc65717cc947dfd5b941ab4ac8f31a59c8f68bf4) +++ lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -117,3 +117,60 @@ label.waiting.for.leader =Please, wait while somebody will become a group leader. label.manage.leaders =Manage Leaders label.plese.select.leaders =Please, select leaders +label.export.excel =Export Excel +label.research.analysis =Research and Analysis +label.scratchie.report =Scratchie Report +label.overall.summary.by.team =Overall Summary by Team +label.for.question =For Question {0} +label.first.choice =First choice +label.incorrect =Incorrect +label.correct =Correct +label.attempts =Attempts +label.mark =Mark +label.overall.summary.by.individual.student =Overall Summary By Individual Student in each Team +label.group =Group +label.question.reports =Question Reports +label.question.semicolon =Question:{0} +label.all.teams.summary =All Teams summary +label.breakdown.by.team =Breakdown by Team +label.breakdown.by.student.with.timing =Breakdown By Student with Timing +label.team.leader =Team leader: +label.for.immediate.analysis =For Immediate Analysis +label.quick.analysis =Quick analysis +label.in.table.below.we.show =In the table below we show weather the team go the first answer correct or not. +label.questions =Questions +label.teams =TEAMS +label.yes =yes +label.no =no +label.spss.analysis =For_XLS_export(SPSS analysis) +label.student.name =Student Name +label.team =Team +label.question.number =Question number +label.question =Question +label.correct.answer =Correct answer +label.first.choice.accuracy =First choice accuracy +label.number.of.attempts =Number of attempts +label.mark.awarded =Mark awarded +label.1.answer.selected =First answer selected +label.2.answer.selected =Second answer selected +label.3.answer.selected =Third answer selected +label.4.answer.selected =Fourth answer selected +label.5.answer.selected =Fifth answer selected +label.6.answer.selected =Sixth answer selected +label.7.answer.selected =Seventh answer selected +label.8.answer.selected =Eighth answer selected +label.9.answer.selected =Ninth answer selected +label.10.answer.selected =Tenth answer selected +label.date =Date +label.time.of.selection.1 =Time of selection for 1st choice +label.time.of.selection.2 =Time of selection for 2nd choice +label.time.of.selection.3 =Time of selection for 3rd choice +label.time.of.selection.4 =Time of selection for 4th choice +label.time.of.selection.5 =Time of selection for 5th choice +label.time.of.selection.6 =Time of selection for 6th choice +label.time.of.selection.7 =Time of selection for 7th choice +label.time.of.selection.8 =Time of selection for 8th choice +label.time.of.selection.9 =Time of selection for 9th choice +label.time.of.selection.10 =Time of selection for 10th choice +label.none =None + Index: lams_tool_scratchie/conf/xdoclet/struts-actions.xml =================================================================== diff -u -rbc65717cc947dfd5b941ab4ac8f31a59c8f68bf4 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_tool_scratchie/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision bc65717cc947dfd5b941ab4ac8f31a59c8f68bf4) +++ lams_tool_scratchie/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -257,6 +257,10 @@ parameter="viewReflection"> + + Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/GroupSummary.java =================================================================== diff -u -red23aef88626fa70acd34abbd3d044bec1b4a998 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/GroupSummary.java (.../GroupSummary.java) (revision ed23aef88626fa70acd34abbd3d044bec1b4a998) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/GroupSummary.java (.../GroupSummary.java) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -35,6 +35,7 @@ private String sessionName; private Collection users; + private Collection items; private Collection answers; /** @@ -71,6 +72,14 @@ return users; } + public void setItems(Collection items) { + this.items = items; + } + + public Collection getItems() { + return items; + } + public void setUsers(Collection users) { this.users = users; } Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/scratchieApplicationContext.xml =================================================================== diff -u -rbc65717cc947dfd5b941ab4ac8f31a59c8f68bf4 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/scratchieApplicationContext.xml (.../scratchieApplicationContext.xml) (revision bc65717cc947dfd5b941ab4ac8f31a59c8f68bf4) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/scratchieApplicationContext.xml (.../scratchieApplicationContext.xml) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -87,9 +87,6 @@ - - - Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java =================================================================== diff -u -rbc65717cc947dfd5b941ab4ac8f31a59c8f68bf4 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java (.../IScratchieService.java) (revision bc65717cc947dfd5b941ab4ac8f31a59c8f68bf4) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java (.../IScratchieService.java) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -24,12 +24,14 @@ package org.lamsfoundation.lams.tool.scratchie.service; import java.util.Collection; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.events.IEventNotificationService; +import org.lamsfoundation.lams.gradebook.dto.ExcelCell; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.tool.scratchie.dto.GroupSummary; import org.lamsfoundation.lams.tool.scratchie.dto.ReflectDTO; @@ -244,6 +246,14 @@ List getMonitoringSummary(Long contentId); List getQuestionSummary(Long contentId, Long itemUid); + + /** + * Export excel spreadheet + * + * @param scratchie + * @return + */ + LinkedHashMap exportExcel(Long contentId); /** * Get scratchie item Summary list according to sessionId and skipHide flag. @@ -309,11 +319,9 @@ * * @param key * key of the message - * @param args - * arguments for the message * @return message content */ - String getLocalisedMessage(String key, Object[] args); + String getMessage(String key); /** * Finds out which lesson the given tool content belongs to and returns its monitoring users. Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java =================================================================== diff -u -r6d64356f052f244905a7f2974227e25cbd5b9687 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision 6d64356f052f244905a7f2974227e25cbd5b9687) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -26,27 +26,27 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.sql.Timestamp; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; -import java.util.TreeMap; import java.util.TreeSet; -import java.util.Vector; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.contentrepository.AccessDeniedException; import org.lamsfoundation.lams.contentrepository.ICredentials; import org.lamsfoundation.lams.contentrepository.ITicket; -import org.lamsfoundation.lams.contentrepository.IVersionedNode; import org.lamsfoundation.lams.contentrepository.InvalidParameterException; import org.lamsfoundation.lams.contentrepository.LoginException; import org.lamsfoundation.lams.contentrepository.NodeKey; @@ -55,6 +55,7 @@ import org.lamsfoundation.lams.contentrepository.service.IRepositoryService; import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials; import org.lamsfoundation.lams.events.IEventNotificationService; +import org.lamsfoundation.lams.gradebook.dto.ExcelCell; import org.lamsfoundation.lams.learning.service.ILearnerService; import org.lamsfoundation.lams.learningdesign.service.ExportToolContentException; import org.lamsfoundation.lams.learningdesign.service.IExportToolContentService; @@ -73,20 +74,20 @@ import org.lamsfoundation.lams.tool.exception.SessionDataExistsException; import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.scratchie.ScratchieConstants; -import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieItemDAO; import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieAnswerVisitDAO; import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieAttachmentDAO; import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieDAO; +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieItemDAO; import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieSessionDAO; import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieUserDAO; import org.lamsfoundation.lams.tool.scratchie.dto.GroupSummary; import org.lamsfoundation.lams.tool.scratchie.dto.ReflectDTO; import org.lamsfoundation.lams.tool.scratchie.dto.Summary; import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAnswer; -import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAnswerVisitLog; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAttachment; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; import org.lamsfoundation.lams.tool.scratchie.util.ReflectDTOComparator; @@ -98,18 +99,16 @@ import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.util.MessageService; -import org.lamsfoundation.lams.util.WebUtil; -import org.lamsfoundation.lams.util.audit.IAuditService; -import org.lamsfoundation.lams.util.wddx.WDDXProcessor; -import org.lamsfoundation.lams.util.wddx.WDDXProcessorConversionException; /** * * @author Andrey Balan */ public class ScratchieServiceImpl implements IScratchieService, ToolContentManager, ToolSessionManager, ToolContentImport102Manager { - static Logger log = Logger.getLogger(ScratchieServiceImpl.class.getName()); + private static Logger log = Logger.getLogger(ScratchieServiceImpl.class.getName()); + + private static final ExcelCell[] EMPTY_ROW = new ExcelCell[4]; private ScratchieDAO scratchieDao; @@ -135,8 +134,6 @@ private ILearnerService learnerService; - private IAuditService auditService; - private IUserManagementService userManagementService; private IExportToolContentService exportContentService; @@ -152,44 +149,7 @@ // ******************************************************************************* // Service method // ******************************************************************************* - /** - * Try to get the file. If forceLogin = false and an access denied exception occurs, call this method again to get a - * new ticket and retry file lookup. If forceLogin = true and it then fails then throw exception. - * - * @param uuid - * @param versionId - * @param relativePath - * @param attemptCount - * @return file node - * @throws ImscpApplicationException - */ - private IVersionedNode getFile(Long uuid, Long versionId, String relativePath) throws ScratchieApplicationException { - ITicket tic = getRepositoryLoginTicket(); - - try { - - return repositoryService.getFileItem(tic, uuid, versionId, relativePath); - - } catch (AccessDeniedException e) { - - String error = "Unable to access repository to get file uuid " + uuid + " version id " + versionId - + " path " + relativePath + "."; - - error = error + "AccessDeniedException: " + e.getMessage() + " Unable to retry further."; - ScratchieServiceImpl.log.error(error); - throw new ScratchieApplicationException(error, e); - - } catch (Exception e) { - - String error = "Unable to access repository to get file uuid " + uuid + " version id " + versionId - + " path " + relativePath + "." + " Exception: " + e.getMessage(); - ScratchieServiceImpl.log.error(error); - throw new ScratchieApplicationException(error, e); - - } - } - /** * This method verifies the credentials of the Scratchie Tool and gives it the Ticket to login and * access the Content Repository. @@ -216,6 +176,7 @@ } } + @Override public Scratchie getScratchieByContentId(Long contentId) { Scratchie rs = scratchieDao.getByContentId(contentId); if (rs == null) { @@ -224,6 +185,7 @@ return rs; } + @Override public Scratchie getDefaultContent(Long contentId) throws ScratchieApplicationException { if (contentId == null) { String error = messageService.getMessage("error.msg.default.content.not.find"); @@ -238,10 +200,12 @@ return content; } + @Override public List getAuthoredItems(Long scratchieUid) { return scratchieItemDao.getAuthoringItems(scratchieUid); } + @Override public ScratchieAttachment uploadInstructionFile(FormFile uploadFile, String fileType) throws UploadScratchieFileException { if (uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) { @@ -263,16 +227,19 @@ return file; } + @Override public void createUser(ScratchieUser scratchieUser) { scratchieUserDao.saveObject(scratchieUser); } + @Override public ScratchieUser getUserByIDAndContent(Long userId, Long contentId) { return scratchieUserDao.getUserByUserIDAndContentID(userId, contentId); } + @Override public ScratchieUser getUserByIDAndSession(Long userId, Long sessionId) { return scratchieUserDao.getUserByUserIDAndSessionID(userId, sessionId); @@ -290,19 +257,18 @@ } } + @Override public void saveOrUpdateScratchie(Scratchie scratchie) { scratchieDao.saveObject(scratchie); } + @Override public void deleteScratchieAttachment(Long attachmentUid) { scratchieAttachmentDao.removeObject(ScratchieAttachment.class, attachmentUid); } - public void saveOrUpdateScratchieItem(ScratchieItem item) { - scratchieItemDao.saveObject(item); - } - + @Override public void deleteScratchieItem(Long uid) { scratchieItemDao.removeObject(ScratchieItem.class, uid); } @@ -438,6 +404,7 @@ return groupList; } + @Override public Scratchie getScratchieBySessionId(Long sessionId) { ScratchieSession session = scratchieSessionDao.getSessionBySessionId(sessionId); // to skip CGLib problem @@ -446,10 +413,12 @@ return res; } + @Override public ScratchieSession getScratchieSessionBySessionId(Long sessionId) { return scratchieSessionDao.getSessionBySessionId(sessionId); } + @Override public void saveOrUpdateScratchieSession(ScratchieSession resSession) { scratchieSessionDao.saveObject(resSession); } @@ -512,7 +481,6 @@ @Override public Set getAllLearners(Long contentId) { - Scratchie scratchie = scratchieDao.getByContentId(contentId); Set users = new TreeSet(); List sessionList = scratchieSessionDao.getByContentId(contentId); @@ -539,8 +507,6 @@ public List getMonitoringSummary(Long contentId) { List groupSummaryList = new ArrayList(); - Scratchie scratchie = scratchieDao.getByContentId(contentId); - List sessionList = scratchieSessionDao.getByContentId(contentId); for (ScratchieSession session : sessionList) { Long sessionId = session.getSessionId(); @@ -589,6 +555,7 @@ } + @Override public void retrieveScratched(Collection items, ScratchieUser user) { for (ScratchieItem item : items) { @@ -620,8 +587,8 @@ return isItemUnraveled; } + @Override public int getUserMark(Long sessionId, Long userId) { - ScratchieUser user = getUserByIDAndSession(userId, sessionId); ScratchieSession session = scratchieSessionDao.getSessionBySessionId(sessionId); Scratchie scratchie = session.getScratchie(); Set items = scratchie.getScratchieItems(); @@ -659,8 +626,8 @@ return mark; } + @Override public Set populateItemsResults(Long sessionId, Long userId) { - ScratchieUser user = getUserByIDAndSession(userId, sessionId); ScratchieSession session = scratchieSessionDao.getSessionBySessionId(sessionId); Scratchie scratchie = session.getScratchie(); Set items = scratchie.getScratchieItems(); @@ -684,11 +651,11 @@ return items; } + @Override public List getQuestionSummary(Long contentId, Long itemUid) { List groupSummaryList = new ArrayList(); - Scratchie scratchie = scratchieDao.getByContentId(contentId); ScratchieItem item = scratchieItemDao.getByUid(itemUid); Collection answers = item.getAnswers(); @@ -766,6 +733,7 @@ return groupSummaryList; } + @Override public Map> getReflectList(Long contentId, boolean setEntry) { Map> map = new HashMap>(); @@ -796,12 +764,14 @@ return map; } + @Override public Long createNotebookEntry(Long sessionId, Integer notebookToolType, String toolSignature, Integer userId, String entryText) { return coreNotebookService.createNotebookEntry(sessionId, notebookToolType, toolSignature, userId, "", entryText); } + @Override public NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID) { List list = coreNotebookService.getEntry(sessionId, idType, signature, userID); if (list == null || list.isEmpty()) { @@ -811,20 +781,504 @@ } } - /** - * @param notebookEntry - */ + @Override public void updateEntry(NotebookEntry notebookEntry) { coreNotebookService.updateEntry(notebookEntry); } + @Override public ScratchieUser getUser(Long uid) { return (ScratchieUser) scratchieUserDao.getObject(ScratchieUser.class, uid); } + + @Override + public LinkedHashMap exportExcel(Long contentId) { + Scratchie scratchie = scratchieDao.getByContentId(contentId); + Collection items = new TreeSet(new ScratchieItemComparator()); + items.addAll(scratchie.getScratchieItems()); + + LinkedHashMap dataToExport = new LinkedHashMap(); + + //======================================================= Research and Analysis page ======================================= + + // all rows + List rowList = new LinkedList(); + + // Caption + ExcelCell[] row = new ExcelCell[2]; + row[0] = new ExcelCell(getMessage("label.scratchie.report"), true); + rowList.add(row); + rowList.add(EMPTY_ROW); + rowList.add(EMPTY_ROW); + + // Overall Summary by Team -------------------------------------------------- + row = new ExcelCell[2]; + row[0] = new ExcelCell(getMessage("label.overall.summary.by.team"), true); + rowList.add(row); + row = new ExcelCell[items.size()*3 + 1]; + int columnCount = 1; + for (int itemCount = 0; itemCount summaryByTeam = getSummaryByTeam(scratchie, items); + for (GroupSummary summary : summaryByTeam) { + row = new ExcelCell[items.size() * 3 + 1]; + columnCount = 0; + + row[columnCount++] = new ExcelCell(summary.getSessionName(), false); + + for (ScratchieItem item : summary.getItems()) { + int attempts = item.getUserAttempts(); + + String isFirstChoice; + if (item.getCorrectAnswer().equals(Boolean.TRUE.toString())) { + isFirstChoice = getMessage("label.correct"); + } else if (attempts == 0) { + isFirstChoice = null; + } else { + isFirstChoice = getMessage("label.incorrect"); + } + row[columnCount++] = new ExcelCell(isFirstChoice, false); + row[columnCount++] = new ExcelCell(new Long(attempts), false); + Long mark = (item.getUserMark() == -1) ? null : new Long(item.getUserMark()); + row[columnCount++] = new ExcelCell(mark, false); + } + rowList.add(row); + } + rowList.add(EMPTY_ROW); + rowList.add(EMPTY_ROW); + rowList.add(EMPTY_ROW); + + // Overall Summary By Individual Student in each Team---------------------------------------- + row = new ExcelCell[2]; + row[0] = new ExcelCell(getMessage("label.overall.summary.by.individual.student"), true); + rowList.add(row); + rowList.add(EMPTY_ROW); + + row = new ExcelCell[4]; + row[1] = new ExcelCell(getMessage("label.attempts"), false); + row[2] = new ExcelCell(getMessage("label.mark"), false); + row[3] = new ExcelCell(getMessage("label.group"), false); + rowList.add(row); + + List summaryList = getMonitoringSummary(contentId); + for (GroupSummary summary : summaryList) { + for (ScratchieUser user : summary.getUsers()) { + row = new ExcelCell[4]; + row[0] = new ExcelCell(user.getFirstName() + " " + user.getLastName(), false); + row[1] = new ExcelCell(new Long(user.getTotalAttempts()), false); + Long mark = (user.getMark() == -1) ? null : new Long(user.getMark()); + row[2] = new ExcelCell(mark, false); + row[3] = new ExcelCell(summary.getSessionName(), false); + rowList.add(row); + } + } + rowList.add(EMPTY_ROW); + rowList.add(EMPTY_ROW); + + // Question Reports----------------------------------------------------------------- + row = new ExcelCell[1]; + row[0] = new ExcelCell(getMessage("label.question.reports"), true); + rowList.add(row); + rowList.add(EMPTY_ROW); + + SimpleDateFormat fullDateFormat = new SimpleDateFormat("dd/MM/yy HH:mm:ss"); + + for (ScratchieItem item : items) { + List itemSummary = getQuestionSummary(contentId, item.getUid()); + + row = new ExcelCell[1]; + row[0] = new ExcelCell(getMessage("label.question.semicolon", new Object[] {item.getTitle()}), true); + rowList.add(row); + + row = new ExcelCell[1]; + row[0] = new ExcelCell(removeHtmlMarkup(item.getDescription()), true); + rowList.add(row); + rowList.add(EMPTY_ROW); + rowList.add(EMPTY_ROW); + + //show all team summary in case there is more than 1 group + if (summaryList.size() > 1) { + row = new ExcelCell[1]; + row[0] = new ExcelCell(getMessage("label.all.teams.summary"), true); + rowList.add(row); + + GroupSummary allTeamSummary = itemSummary.get(0); + Collection answers = allTeamSummary.getAnswers(); + + row = new ExcelCell[1 + answers.size()]; + for (int i = 0; i < answers.size(); i++ ) { + row[i + 1] = new ExcelCell((long) i + 1, false); + } + rowList.add(row); + + for (ScratchieAnswer answer : answers) { + row = new ExcelCell[1 + answers.size()]; + String answerTitle = removeHtmlMarkup(answer.getDescription()); + if (answer.isCorrect()) { + answerTitle += "(" + getMessage("label.monitoring.item.summary.correct") + ")"; + } + columnCount = 0; + row[columnCount++] = new ExcelCell(answerTitle, false); + + for (int numberAttempts : answer.getAttempts()) { + row[columnCount++] = new ExcelCell(new Long(numberAttempts), false); + } + rowList.add(row); + } + rowList.add(EMPTY_ROW); + rowList.add(EMPTY_ROW); + } + + row = new ExcelCell[1]; + row[0] = new ExcelCell(getMessage("label.breakdown.by.team"), true); + rowList.add(row); + for (GroupSummary groupSummary : itemSummary) { + if (groupSummary.getSessionId().equals(0L)) { + continue; + } + + Collection answers = groupSummary.getAnswers(); + + row = new ExcelCell[1]; + row[0] = new ExcelCell(groupSummary.getSessionName(), true); + rowList.add(row); + + row = new ExcelCell[1 + answers.size()]; + for (int i = 0; i < answers.size(); i++ ) { + row[i+1] = new ExcelCell(new Long(i+1), false); + } + rowList.add(row); + + for (ScratchieAnswer answer : answers) { + row = new ExcelCell[1 + answers.size()]; + String answerTitle = removeHtmlMarkup(answer.getDescription()); + if (answer.isCorrect()) { + answerTitle += "(" + getMessage("label.monitoring.item.summary.correct") + ")"; + } + columnCount = 0; + row[columnCount++] = new ExcelCell(answerTitle, false); + + for (int numberAttempts : answer.getAttempts()) { + row[columnCount++] = new ExcelCell(new Long(numberAttempts), false); + } + rowList.add(row); + } + + } + rowList.add(EMPTY_ROW); + rowList.add(EMPTY_ROW); + } + + //Breakdown By Student with Timing---------------------------------------------------- + + row = new ExcelCell[1]; + row[0] = new ExcelCell(getMessage("label.breakdown.by.student.with.timing"), true); + rowList.add(row); + rowList.add(EMPTY_ROW); + + List sessionList = scratchieSessionDao.getByContentId(scratchie.getContentId()); + for (ScratchieSession session : sessionList) { + + ScratchieUser groupLeader = getGroupLeader(session.getSessionId()); + Long sessionId = session.getSessionId(); + + if (groupLeader != null) { + + Long userId = groupLeader.getUserId(); + row = new ExcelCell[5]; + row[0] = new ExcelCell(groupLeader.getFirstName() + " " + groupLeader.getLastName(), true); + row[1] = new ExcelCell(getMessage("label.attempts") + ":", false); + Long attempts = (long) scratchieAnswerVisitDao.getLogCountTotal(sessionId, userId); + row[2] = new ExcelCell(attempts, false); + row[3] = new ExcelCell(getMessage("label.mark") + ":", false); + row[4] = new ExcelCell(new Long(getUserMark(sessionId, userId)), false); + rowList.add(row); + + row = new ExcelCell[1]; + row[0] = new ExcelCell(getMessage("label.team.leader") + session.getSessionName(), false); + rowList.add(row); + + for (ScratchieItem item : items) { + row = new ExcelCell[1]; + row[0] = new ExcelCell(getMessage("label.question.semicolon", new Object[] {item.getTitle()}), false); + rowList.add(row); + rowList.add(EMPTY_ROW); + + int i = 1; + List logs = scratchieAnswerVisitDao.getLogsByScratchieUserAndItem(groupLeader.getUid(), item.getUid()); + for (ScratchieAnswerVisitLog log : logs) { + row = new ExcelCell[4]; + row[0] = new ExcelCell(new Long(i++), false); + String answerDescr = removeHtmlMarkup(log.getScratchieAnswer().getDescription()); + row[1] = new ExcelCell(answerDescr, false); + row[3] = new ExcelCell(fullDateFormat.format(log.getAccessDate()), false); + rowList.add(row); + } + rowList.add(EMPTY_ROW); + } + + } + } + + + ExcelCell[][] firstPageData = rowList.toArray(new ExcelCell[][] {}); + dataToExport.put(getMessage("label.research.analysis"), firstPageData); + + //======================================================= For Immediate Analysis page ======================================= + + rowList = new LinkedList(); + + row = new ExcelCell[1]; + row[0] = new ExcelCell(getMessage("label.quick.analysis"), true); + rowList.add(row); + row = new ExcelCell[2]; + row[1] = new ExcelCell(getMessage("label.in.table.below.we.show"), false); + rowList.add(row); + rowList.add(EMPTY_ROW); + + row = new ExcelCell[3]; + row[2] = new ExcelCell(getMessage("label.questions"), false); + rowList.add(row); + + row = new ExcelCell[items.size() + 2]; + columnCount = 1; + row[columnCount++] = new ExcelCell(getMessage("label.teams"), true); + for (int itemCount = 0; itemCount(); + + //Table header------------------------------------ + + int maxAnswers = 0; + for (ScratchieItem item : items) { + if (item.getAnswers().size() > maxAnswers) { + maxAnswers = item.getAnswers().size(); + } + } + + row = new ExcelCell[9 + maxAnswers * 2]; + columnCount = 0; + row[columnCount++] = new ExcelCell(getMessage("label.student.name"), true); + row[columnCount++] = new ExcelCell(getMessage("label.team"), true); + row[columnCount++] = new ExcelCell(getMessage("label.question.number"), true); + row[columnCount++] = new ExcelCell(getMessage("label.question"), true); + row[columnCount++] = new ExcelCell(getMessage("label.correct.answer"), true); + row[columnCount++] = new ExcelCell(getMessage("label.first.choice.accuracy"), true); + row[columnCount++] = new ExcelCell(getMessage("label.number.of.attempts"), true); + row[columnCount++] = new ExcelCell(getMessage("label.mark.awarded"), true); + for (int i = 0; i < maxAnswers; i++) { + row[columnCount++] = new ExcelCell(getMessage("label." + (i + 1) + ".answer.selected"), true); + } + row[columnCount++] = new ExcelCell(getMessage("label.date"), true); + for (int i = 0; i < maxAnswers; i++) { + row[columnCount++] = new ExcelCell(getMessage("label.time.of.selection." + (i + 1)), true); + } + rowList.add(row); + + //Table content------------------------------------ + + for (GroupSummary summary : summaryByTeam) { + Long sessionId = summary.getSessionId(); + + ScratchieUser groupLeader = getGroupLeader(sessionId); + List users = scratchieUserDao.getBySessionID(sessionId); + + for (ScratchieUser user: users) { + + int questionCount = 1; + for (ScratchieItem item : summary.getItems()) { + + row = new ExcelCell[9 + maxAnswers * 2]; + columnCount = 0; + //user name + row[columnCount++] = new ExcelCell(user.getFirstName() + " " + user.getLastName(), false); + //group name + row[columnCount++] = new ExcelCell(summary.getSessionName(), false); + //question number + row[columnCount++] = new ExcelCell(new Long(questionCount++), false); + //question title + row[columnCount++] = new ExcelCell(item.getTitle(), false); + + //correct answer + String correctAnswer = ""; + Set answers = item.getAnswers(); + for (ScratchieAnswer answer : answers) { + if (answer.isCorrect()) { + correctAnswer = removeHtmlMarkup(answer.getDescription()); + } + } + row[columnCount++] = new ExcelCell(correctAnswer, false); + + //isFirstChoice + int attempts = item.getUserAttempts(); + String isFirstChoice; + if (item.getCorrectAnswer().equals(Boolean.TRUE.toString())) { + isFirstChoice = getMessage("label.correct"); + } else if (attempts == 0) { + isFirstChoice = null; + } else { + isFirstChoice = getMessage("label.incorrect"); + } + row[columnCount++] = new ExcelCell(isFirstChoice, false); + //attempts + row[columnCount++] = new ExcelCell(new Long(attempts), false); + //mark + Object mark = (item.getUserMark() == -1) ? "" : new Long(item.getUserMark()); + row[columnCount++] = new ExcelCell(mark, false); + + //Answers selected + List logs = (groupLeader != null) ? scratchieAnswerVisitDao + .getLogsByScratchieUserAndItem(groupLeader.getUid(), item.getUid()) + : new ArrayList(); + for (ScratchieAnswerVisitLog log : logs) { + String answer = removeHtmlMarkup(log.getScratchieAnswer().getDescription()); + row[columnCount++] = new ExcelCell(answer, false); + } + for (int i = logs.size(); i < item.getAnswers().size(); i++) { + row[columnCount++] = new ExcelCell(getMessage("label.none"), false); + } + for (int i = answers.size(); i < maxAnswers; i++) { + row[columnCount++] = new ExcelCell("", false); + } + + //Date + String dateStr = ""; + if (logs.size() > 0) { + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yy"); + Date accessDate = logs.iterator().next().getAccessDate(); + dateStr = dateFormat.format(accessDate); + } + row[columnCount++] = new ExcelCell(dateStr, false); + + //time of selection + SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); + for (ScratchieAnswerVisitLog log : logs) { + Date accessDate = log.getAccessDate(); + String timeStr = timeFormat.format(accessDate); + row[columnCount++] = new ExcelCell(timeStr, false); + } + for (int i = logs.size(); i < maxAnswers; i++) { + row[columnCount++] = new ExcelCell("", false); + } + + rowList.add(row); + } + + } + + } + + ExcelCell[][] userData = rowList.toArray(new ExcelCell[][] {}); + dataToExport.put(getMessage("label.spss.analysis"), userData); + + return dataToExport; + } + // ***************************************************************************** // private methods // ***************************************************************************** + + + /** + * Currently removes only
tags. + */ + private String removeHtmlMarkup(String string) { + return string.replaceAll("[<](/)?div[^>]*[>]", ""); + } + + /** + * Serves merely for excel export purposes. Produces data for "Summary By Team" section. + */ + private List getSummaryByTeam(Scratchie scratchie, Collection sortedItems) { + List groupSummaries = new ArrayList(); + + List sessionList = scratchieSessionDao.getByContentId(scratchie.getContentId()); + for (ScratchieSession session : sessionList) { + Long sessionId = session.getSessionId(); + // one new summary for one session. + GroupSummary groupSummary = new GroupSummary(sessionId, session.getSessionName()); + ArrayList items = new ArrayList(); + + ScratchieUser groupLeader = getGroupLeader(sessionId); + + for (ScratchieItem item : sortedItems) { + ScratchieItem newItem = new ScratchieItem(); + int attempts = 0; + int mark = -1; + boolean isFirstChoice = false; + + // if there is no group leader don't calculate numbers - they aren't any + if (groupLeader != null) { + attempts = scratchieAnswerVisitDao.getLogCountPerItem(sessionId, groupLeader.getUserId(), item.getUid()); + + // for displaying purposes if there is no attemps we assign -1 which will be shown as "-" + mark = (attempts == 0) ? -1 : getUserMarkPerItem(scratchie, item, sessionId, groupLeader.getUserId()); + + isFirstChoice = (attempts == 1) && isItemUnraveled(item, groupLeader.getUserId()); + } + + newItem.setUid(item.getUid()); + newItem.setTitle(item.getTitle()); + newItem.setAnswers(item.getAnswers()); + newItem.setUserAttempts(attempts); + newItem.setUserMark(mark); + newItem.setCorrectAnswer("" + isFirstChoice); + + items.add(newItem); + } + + groupSummary.setItems(items); + groupSummaries.add(groupSummary); + } + + return groupSummaries; + } + private Scratchie getDefaultScratchie() throws ScratchieApplicationException { Long defaultScratchieId = getToolDefaultContentIdBySignature(ScratchieConstants.TOOL_SIGNATURE); Scratchie defaultScratchie = getScratchieByContentId(defaultScratchieId); @@ -877,29 +1331,13 @@ return node; } - private NodeKey processPackage(String packageDirectory, String initFile) throws UploadScratchieFileException { - NodeKey node = null; - try { - node = scratchieToolContentHandler.uploadPackage(packageDirectory, initFile); - } catch (InvalidParameterException e) { - throw new UploadScratchieFileException(messageService.getMessage("error.msg.invaid.param.upload")); - } catch (RepositoryCheckedException e) { - throw new UploadScratchieFileException(messageService.getMessage("error.msg.repository")); - } - return node; - } - public boolean isGroupedActivity(long toolContentID) { return toolService.isGroupedActivity(toolContentID); } // ***************************************************************************** // set methods for Spring Bean // ***************************************************************************** - public void setAuditService(IAuditService auditService) { - this.auditService = auditService; - } - public void setLearnerService(ILearnerService learnerService) { this.learnerService = learnerService; } @@ -1227,8 +1665,16 @@ public void setEventNotificationService(IEventNotificationService eventNotificationService) { this.eventNotificationService = eventNotificationService; } + + @Override + public String getMessage(String key) { + return messageService.getMessage(key); + } - public String getLocalisedMessage(String key, Object[] args) { + /** + * Returns localized message + */ + public String getMessage(String key, Object[] args) { return messageService.getMessage(key, args); } Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/MonitoringAction.java =================================================================== diff -u -rbc65717cc947dfd5b941ab4ac8f31a59c8f68bf4 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/MonitoringAction.java (.../MonitoringAction.java) (revision bc65717cc947dfd5b941ab4ac8f31a59c8f68bf4) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/MonitoringAction.java (.../MonitoringAction.java) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -25,10 +25,12 @@ package org.lamsfoundation.lams.tool.scratchie.web.action; import java.io.IOException; +import java.util.LinkedHashMap; import java.util.List; import java.util.Set; import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -37,17 +39,19 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; +import org.lamsfoundation.lams.gradebook.dto.ExcelCell; +import org.lamsfoundation.lams.gradebook.util.GradebookUtil; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.scratchie.ScratchieConstants; import org.lamsfoundation.lams.tool.scratchie.dto.GroupSummary; import org.lamsfoundation.lams.tool.scratchie.dto.ReflectDTO; import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; -import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAnswerVisitLog; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; import org.lamsfoundation.lams.tool.scratchie.service.IScratchieService; +import org.lamsfoundation.lams.util.FileUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; @@ -79,14 +83,17 @@ if (param.equals("viewReflection")) { return viewReflection(mapping, form, request, response); } + if (param.equals("exportExcel")) { + return exportExcel(mapping, form, request, response); + } return mapping.findForward(ScratchieConstants.ERROR); } - + private ActionForward summary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { // initialize Session Map - SessionMap sessionMap = new SessionMap(); + SessionMap sessionMap = new SessionMap(); request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); @@ -106,16 +113,16 @@ sessionMap.put(ScratchieConstants.ATTR_SCRATCHIE, scratchie); sessionMap.put(ScratchieConstants.ATTR_LEARNERS, learners); sessionMap.put(ScratchieConstants.ATTR_TOOL_CONTENT_ID, contentId); - sessionMap.put(AttributeNames.PARAM_CONTENT_FOLDER_ID, WebUtil.readStrParam(request, - AttributeNames.PARAM_CONTENT_FOLDER_ID)); - + sessionMap.put(AttributeNames.PARAM_CONTENT_FOLDER_ID, + WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID)); + return mapping.findForward(ScratchieConstants.SUCCESS); } private ActionForward itemSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String sessionMapID = request.getParameter(ScratchieConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); Long itemUid = WebUtil.readLongParam(request, ScratchieConstants.ATTR_ITEM_UID); @@ -124,51 +131,51 @@ } ScratchieItem item = getScratchieService().getScratchieItemByUid(itemUid); request.setAttribute(ScratchieConstants.ATTR_ITEM, item); - + Long contentId = (Long) sessionMap.get(ScratchieConstants.ATTR_TOOL_CONTENT_ID); List summaryList = getScratchieService().getQuestionSummary(contentId, itemUid); request.setAttribute(ScratchieConstants.ATTR_SUMMARY_LIST, summaryList); return mapping.findForward(ScratchieConstants.SUCCESS); } - + /** * Show leaders manage page */ private ActionForward manageLeaders(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String sessionMapID = request.getParameter(ScratchieConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); return mapping.findForward(ScratchieConstants.SUCCESS); } - + /** * Save selected users as a leaders */ private ActionForward saveLeaders(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String sessionMapID = request.getParameter(ScratchieConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); IScratchieService service = getScratchieService(); - + List summaryList = (List) sessionMap.get(ScratchieConstants.ATTR_SUMMARY_LIST); - for (GroupSummary summary: summaryList) { + for (GroupSummary summary : summaryList) { Long toolSessionId = summary.getSessionId(); Long leaderUserId = WebUtil.readLongParam(request, "sessionId" + toolSessionId, true); - - //save selected users as a leaders + + // save selected users as a leaders if (leaderUserId != null) { service.setGroupLeader(leaderUserId, toolSessionId); } } - - //refresh users leadership status in summaryList + + // refresh users leadership status in summaryList Long contentId = (Long) sessionMap.get(ScratchieConstants.ATTR_TOOL_CONTENT_ID); summaryList = service.getMonitoringSummary(contentId); sessionMap.put(ScratchieConstants.ATTR_SUMMARY_LIST, summaryList); - + return null; } @@ -199,6 +206,33 @@ return mapping.findForward("success"); } + /** + * Exports tool results into excel. + * @throws IOException + */ + public ActionForward exportExcel(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException { + + IScratchieService scratchieService = getScratchieService(); + String sessionMapID = request.getParameter(ScratchieConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + Scratchie scratchie = (Scratchie) sessionMap.get(ScratchieConstants.ATTR_SCRATCHIE); + + LinkedHashMap dataToExport = scratchieService.exportExcel(scratchie.getContentId()); + + String fileName = "scratchie_export.xlsx"; + fileName = FileUtil.encodeFilenameForDownload(request, fileName); + + response.setContentType("application/x-download"); + response.setHeader("Content-Disposition", "attachment;filename=" + fileName); + + // Code to generate file and write file contents to response + ServletOutputStream out = response.getOutputStream(); + GradebookUtil.exportGradebookLessonToExcel(out, dataToExport, null, false); + + return null; + } + // ************************************************************************************* // Private method // ************************************************************************************* Index: lams_tool_scratchie/web/pages/monitoring/summary.jsp =================================================================== diff -u -rbc65717cc947dfd5b941ab4ac8f31a59c8f68bf4 -r8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c --- lams_tool_scratchie/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision bc65717cc947dfd5b941ab4ac8f31a59c8f68bf4) +++ lams_tool_scratchie/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 8de4e6f48a6ad07b55ce8cc4a4eced6490838d0c) @@ -4,6 +4,11 @@ + +