Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r94c04097735e68f9ff6f4639adb00b93b2695058 -rc2b79a48e116ee67d7de18bfb4b793fda02b58e7 --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 94c04097735e68f9ff6f4639adb00b93b2695058) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision c2b79a48e116ee67d7de18bfb4b793fda02b58e7) @@ -1182,3 +1182,5 @@ label.completed.activity = Activity completed label.current.activity = Current activity label.not.started.activity = Activity not reached yet +label.qb.print.hide.answers = Hide correct answers +label.qb.print.title = LAMS questions {0} \ No newline at end of file Index: lams_central/src/java/org/lamsfoundation/lams/web/qb/PrintQuestionsController.java =================================================================== diff -u --- lams_central/src/java/org/lamsfoundation/lams/web/qb/PrintQuestionsController.java (revision 0) +++ lams_central/src/java/org/lamsfoundation/lams/web/qb/PrintQuestionsController.java (revision c2b79a48e116ee67d7de18bfb4b793fda02b58e7) @@ -0,0 +1,30 @@ +package org.lamsfoundation.lams.web.qb; + +import org.lamsfoundation.lams.util.imgscalr.Scalr; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.support.RequestContextUtils; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + +@Controller +@RequestMapping("/qb") +public class PrintQuestionsController { + + @GetMapping("/printQuestions.do") + public String printQuestions(HttpServletRequest request, Model model) { + // read Flash Attributes set by another module and put them in the model + Map inputFlashMap = RequestContextUtils.getInputFlashMap(request); + if (inputFlashMap != null) { + for (String key : inputFlashMap.keySet()) { + if (key.startsWith("print")) { + model.addAttribute(key, inputFlashMap.get(key)); + } + } + } + return "qb/printQuestions"; + } +} \ No newline at end of file Index: lams_central/web/qb/printQuestions.jsp =================================================================== diff -u --- lams_central/web/qb/printQuestions.jsp (revision 0) +++ lams_central/web/qb/printQuestions.jsp (revision c2b79a48e116ee67d7de18bfb4b793fda02b58e7) @@ -0,0 +1,106 @@ + +<%@ include file="/common/taglibs.jsp"%> + + + + + <fmt:message key="label.qb.print.title"> + <fmt:param value="${printTitleSuffix}" /> + </fmt:message> + + + + + + + + + + +
+ + +
+ + +
+ +
+ +
    + +
  1. + +
      + +
    1. +
      + + + + () + + +
      + + "> + + + +
    2. +
      +
    +
  2. +
    +
+ +
\ No newline at end of file Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/controller/AuthoringController.java =================================================================== diff -u -r7521e0cd5b5f4b01d188ca0ddad1e5f59d3bde27 -rc2b79a48e116ee67d7de18bfb4b793fda02b58e7 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/controller/AuthoringController.java (.../AuthoringController.java) (revision 7521e0cd5b5f4b01d188ca0ddad1e5f59d3bde27) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/controller/AuthoringController.java (.../AuthoringController.java) (revision c2b79a48e116ee67d7de18bfb4b793fda02b58e7) @@ -60,12 +60,16 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import org.springframework.web.servlet.view.RedirectView; import org.springframework.web.util.HtmlUtils; import javax.servlet.ServletException; @@ -951,6 +955,26 @@ return "pages/authoring/parts/overallfeedbacklist"; } + @GetMapping("/printQuestions") + public String printQuestions(HttpServletRequest request, RedirectAttributes redirectAttributes) { + // need to set up FlashAttributes so they are read in Central after redirect + SessionMap sessionMap = getSessionMap(request); + Collection questionReferences = getQuestionReferences(sessionMap); + List questions = new ArrayList<>(); + for (QuestionReference questionReference : questionReferences) { + if (!questionReference.isRandomQuestion()) { + questions.add(questionReference.getQuestion().getQbQuestion()); + } + } + if (!questions.isEmpty()) { + redirectAttributes.addFlashAttribute("printQuestions", questions); + } + Long toolContentId = (Long) sessionMap.get(AssessmentConstants.ATTR_TOOL_CONTENT_ID); + Assessment assessment = service.getAssessmentByContentId(toolContentId); + redirectAttributes.addFlashAttribute("printTitleSuffix", assessment.getTitle()); + return "redirect:" + Configuration.get(ConfigurationKeys.SERVER_URL) + "qb/printQuestions.do"; + } + // ************************************************************************************* // Private methods // ************************************************************************************* Index: lams_tool_assessment/web/pages/authoring/basic.jsp =================================================================== diff -u -r0eccc3568bb012eb92f9c0dafa04267bf0e3c0f5 -rc2b79a48e116ee67d7de18bfb4b793fda02b58e7 --- lams_tool_assessment/web/pages/authoring/basic.jsp (.../basic.jsp) (revision 0eccc3568bb012eb92f9c0dafa04267bf0e3c0f5) +++ lams_tool_assessment/web/pages/authoring/basic.jsp (.../basic.jsp) (revision c2b79a48e116ee67d7de18bfb4b793fda02b58e7) @@ -244,7 +244,7 @@ } function showQuestionsPrintPage() { - let url = ''; + let url = ''; window.open(url, "_blank"); } @@ -287,7 +287,7 @@ Fisheye: Tag c2b79a48e116ee67d7de18bfb4b793fda02b58e7 refers to a dead (removed) revision in file `lams_tool_assessment/web/pages/authoring/printQuestions.jsp'. Fisheye: No comparison available. Pass `N' to diff?