Index: lams_tool_laqa/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rb036e6dd6d2afe9c0e0b9143c9be3af1d53a1e0e -r51f3b0856ffbb784386faf0ccb30a75bff8a98b5 --- lams_tool_laqa/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b036e6dd6d2afe9c0e0b9143c9be3af1d53a1e0e) +++ lams_tool_laqa/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 51f3b0856ffbb784386faf0ccb30a75bff8a98b5) @@ -255,5 +255,7 @@ label.other.options =More settings label.allow.review.other.responses =Allow review other responses? +label.username =Username +label.fullname =Full Name #======= End labels: Exported 249 labels for en AU ===== Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java =================================================================== diff -u -rd155ca37f59279685d43369e8d0496700ccef527 -r51f3b0856ffbb784386faf0ccb30a75bff8a98b5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision d155ca37f59279685d43369e8d0496700ccef527) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 51f3b0856ffbb784386faf0ccb30a75bff8a98b5) @@ -44,7 +44,9 @@ public static final String ACTIVITY_INSTRUCTIONS_KEY = "activityInstructionsKey"; public static final String LIST_QUESTION_DTOS = "questionDTOs"; public static final String LIST_DELETED_QUESTION_DTOS = "deletedQuestionDTOs"; - + public static final String QUESTION_DTO = "questionDTO"; + public static final String RESPONSES = "responses"; + public static final String TOOL_SERVICE = "toolService"; public static final String AUTHORING_STARTER = "starter"; public static final String TITLE = "title"; Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUsrRespDAO.java =================================================================== diff -u -r729f1d10a1efd78ec420b373a7af23ee66ec3454 -r51f3b0856ffbb784386faf0ccb30a75bff8a98b5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUsrRespDAO.java (.../QaUsrRespDAO.java) (revision 729f1d10a1efd78ec420b373a7af23ee66ec3454) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUsrRespDAO.java (.../QaUsrRespDAO.java) (revision 51f3b0856ffbb784386faf0ccb30a75bff8a98b5) @@ -234,10 +234,13 @@ } query.setLong("questionId", questionId.longValue()) .setLong("qaSessionId", qaSessionId.longValue()) - .setLong("excludeUserId", excludeUserId.longValue()) - .setFirstResult(page * size) - .setMaxResults(size); + .setLong("excludeUserId", excludeUserId.longValue()); + if ( size > 0 ) { + query.setFirstResult(page * size); + query.setMaxResults(size); + } + List list = (List) query.list(); List respList = new ArrayList(list.size()); for ( Object[] row : list ) { Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/action/QaMonitoringAction.java =================================================================== diff -u -r32eb376c59d7c17cfa9d51cac14c00aae8cf44ff -r51f3b0856ffbb784386faf0ccb30a75bff8a98b5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/action/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 32eb376c59d7c17cfa9d51cac14c00aae8cf44ff) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/action/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 51f3b0856ffbb784386faf0ccb30a75bff8a98b5) @@ -24,8 +24,13 @@ package org.lamsfoundation.lams.tool.qa.web.action; import java.io.IOException; +import java.util.Collection; import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.TimeZone; import javax.servlet.ServletException; @@ -41,10 +46,16 @@ import org.apache.tomcat.util.json.JSONArray; import org.apache.tomcat.util.json.JSONException; import org.apache.tomcat.util.json.JSONObject; +import org.lamsfoundation.lams.rating.dto.ItemRatingDTO; +import org.lamsfoundation.lams.rating.dto.RatingCommentDTO; +import org.lamsfoundation.lams.rating.model.LearnerItemRatingCriteria; import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.qa.QaAppConstants; import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueContent; +import org.lamsfoundation.lams.tool.qa.QaSession; import org.lamsfoundation.lams.tool.qa.QaUsrResp; +import org.lamsfoundation.lams.tool.qa.dto.QaQuestionDTO; import org.lamsfoundation.lams.tool.qa.service.IQaService; import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -215,4 +226,83 @@ return null; } + /** + * Start to download the page that has an HTML version of the answers. Calls answersDownload + * which forwards to the jsp to download the file. + * @throws ServletException + */ + public ActionForward getPrintAnswers(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws ServletException { + + IQaService qaService = getQAService(); + Long allUserIdValue = -1L; + + Long toolSessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); + QaSession qaSession = qaService.getSessionById(toolSessionID); + QaContent qaContent = qaSession.getQaContent(); + + Long questionUid = WebUtil.readLongParam(request, "questionUid"); + QaQueContent question = null; + for ( QaQueContent check : qaContent.getQaQueContents() ) { + if ( check.getUid().equals(questionUid) ) { + question = check; + break; + } + } + + if ( question == null ) { + log.error("Cannot display printable answers as we cannot find question details for toolSessionId "+toolSessionID+" questionUid "+questionUid); + throw new ServletException("Question details missing."); + } + + QaQuestionDTO questionDTO = new QaQuestionDTO(question); + request.setAttribute(QaAppConstants.QUESTION_DTO, questionDTO); + + List responses = qaService.getResponsesForTablesorter(qaContent.getQaContentId(), + toolSessionID, questionUid, allUserIdValue, qaContent.isUseSelectLeaderToolOuput(), + 1, 0, QaAppConstants.SORT_BY_USERNAME_ASC, null); + request.setAttribute(QaAppConstants.RESPONSES, responses); + request.setAttribute(QaAppConstants.ATTR_CONTENT, qaContent); + + boolean isAllowRateAnswers = qaContent.isAllowRateAnswers(); + boolean isCommentsEnabled = false; + if ( isAllowRateAnswers ) { + Set criterias = qaContent.getRatingCriterias(); + for ( LearnerItemRatingCriteria criteria : criterias ) { + if ( criteria.isCommentRating() ) { + isCommentsEnabled = true; + break; + } + } + } + request.setAttribute("isCommentsEnabled", isCommentsEnabled); + + // handle rating criterias - even though we may have searched on ratings earlier we can't use the average ratings + // calculated as they may have been averages over more than one criteria. + Map criteriaMap = null; + Map> commentMap = null; + if (isAllowRateAnswers && !responses.isEmpty()) { + //create itemIds list + List itemIds = new LinkedList(); + for (QaUsrResp usrResponse : responses) { + itemIds.add(usrResponse.getResponseId()); + } + List itemRatingDtos = qaService.getRatingCriteriaDtos(qaContent.getQaContentId(), toolSessionID, itemIds, + true, allUserIdValue); + if ( itemRatingDtos.size() > 0 ) { + criteriaMap = new HashMap(); + commentMap = new HashMap>(); + for ( ItemRatingDTO itemRatingDto: itemRatingDtos) { + criteriaMap.put(itemRatingDto.getItemId(), itemRatingDto.getCriteriaDtos()); + commentMap.put(itemRatingDto.getItemId(), itemRatingDto.getCommentDtos()); + } + } + } + request.setAttribute("criteriaMap", criteriaMap); + request.setAttribute("commentMap", commentMap); + request.setAttribute(QaAppConstants.ATTR_CONTENT, qaContent); + + return (mapping.findForward("PrintAnswers")); + } + } \ No newline at end of file Index: lams_tool_laqa/web/WEB-INF/struts-config.xml =================================================================== diff -u -r32eb376c59d7c17cfa9d51cac14c00aae8cf44ff -r51f3b0856ffbb784386faf0ccb30a75bff8a98b5 --- lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 32eb376c59d7c17cfa9d51cac14c00aae8cf44ff) +++ lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 51f3b0856ffbb784386faf0ccb30a75bff8a98b5) @@ -296,7 +296,11 @@ parameter="dispatch" unknown="false" validate="true"> - + Index: lams_tool_laqa/web/monitoring/PrintAnswers.jsp =================================================================== diff -u --- lams_tool_laqa/web/monitoring/PrintAnswers.jsp (revision 0) +++ lams_tool_laqa/web/monitoring/PrintAnswers.jsp (revision 51f3b0856ffbb784386faf0ccb30a75bff8a98b5) @@ -0,0 +1,80 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%@ page import="org.lamsfoundation.lams.tool.qa.QaAppConstants"%> + + + + + + + + + + ${content.title} + + + + + + + + + +

${content.title}

+ +

${questionDTO.question}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
${response.answer} + +
+ ${criteriaDTO.ratingCriteria.title}
+ +

+
+
+
+ +
+ +
+ ${commentDTO.comment}

+
+
+
+ + +
Index: lams_tool_laqa/web/monitoring/SummaryContent.jsp =================================================================== diff -u -rf846a24dfa25cb1e349da1a96c7a46385f637261 -r51f3b0856ffbb784386faf0ccb30a75bff8a98b5 --- lams_tool_laqa/web/monitoring/SummaryContent.jsp (.../SummaryContent.jsp) (revision f846a24dfa25cb1e349da1a96c7a46385f637261) +++ lams_tool_laqa/web/monitoring/SummaryContent.jsp (.../SummaryContent.jsp) (revision 51f3b0856ffbb784386faf0ccb30a75bff8a98b5) @@ -52,6 +52,8 @@