Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -ra703dc22dba0e0bd9da0c71fb843626f506f3722 -r24e5af6213a4fa2fe6531a1c7dec78df2110c0d0 --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision a703dc22dba0e0bd9da0c71fb843626f506f3722) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 24e5af6213a4fa2fe6531a1c7dec78df2110c0d0) @@ -897,6 +897,8 @@ authoring.fla.input.detached.error = Activity "{0}" had an input activity that is missing or is not one of previous activities. Input was cleared. label.question.not.added = This question has already been added label.questions.choice.collection = Choose a collection: +label.questions.choice.collection.new.option = +label.questions.choice.collection.new.prompt = Enter a name for the new collection: authoring.fla.branch.mapping.ordered.asc = Start with branches mapped to highest ordered answers title.import.instruction.antivirus = An antivirus scan will be performed. It can take a while. outcome.authoring.create.new = [create new] @@ -1144,4 +1146,4 @@ label.branching.general.instructions = Place the lesson participants in their branches. Initially you can add and remove learners, but once a participant starts one of the branches then you will not be able to remove learners from any branches. If you try to remove someone from a branch and they will not remove then check their progress - if they start using the branch while you are on this screen you will not get any errors but you will not be able to remove them from the branch. You will still be able to add learners to branches. label.grouping.popup.viewmode.message = You are presently in group view mode. Groups can not be modified. authoring.tbl.shuffle.questions = Shuffle question order in iRAT -authoring.tbl.shuffle.questions.tooltip = Shuffles the order of questions in the iRAT for all students. In the tRAT the order of question will be the same for all students. +authoring.tbl.shuffle.questions.tooltip = Shuffles the order of questions in the iRAT for all students. In the tRAT the order of question will be the same for all students. \ No newline at end of file Index: lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java =================================================================== diff -u -r9d47641d6f9dc421a253351549dc6fe532694589 -r24e5af6213a4fa2fe6531a1c7dec78df2110c0d0 --- lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java (.../QbCollectionController.java) (revision 9d47641d6f9dc421a253351549dc6fe532694589) +++ lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java (.../QbCollectionController.java) (revision 24e5af6213a4fa2fe6531a1c7dec78df2110c0d0) @@ -22,32 +22,20 @@ package org.lamsfoundation.lams.web.qb; -import java.io.IOException; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - import org.apache.log4j.Logger; import org.lamsfoundation.lams.outcome.service.IOutcomeService; import org.lamsfoundation.lams.qb.model.QbCollection; import org.lamsfoundation.lams.qb.model.QbQuestion; import org.lamsfoundation.lams.qb.service.IQbService; import org.lamsfoundation.lams.security.ISecurityService; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; -import org.lamsfoundation.lams.util.CommonConstants; -import org.lamsfoundation.lams.util.Configuration; -import org.lamsfoundation.lams.util.ConfigurationKeys; -import org.lamsfoundation.lams.util.MessageService; -import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.util.*; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @@ -57,6 +45,15 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + @Controller @RequestMapping("/qb/collection") public class QbCollectionController { @@ -186,13 +183,15 @@ qbService.addQuestionToCollection(targetCollectionUid, qbQuestionId, copy); } - @RequestMapping(path = "/addCollection", method = RequestMethod.POST) + @RequestMapping(path = "/addCollection", method = RequestMethod.POST, produces = "text/plain") @ResponseBody - public void addCollection(@RequestParam String name) { + public ResponseEntity addCollection(@RequestParam String name) { if (!Configuration.getAsBoolean(ConfigurationKeys.QB_COLLECTIONS_CREATE_ALLOW)) { - throw new SecurityException("New collections are disabled"); + log.error("Trying to create a new collection when it is disabled: " + name); + return ResponseEntity.status(HttpStatus.FORBIDDEN).body("-1"); } - qbService.addCollection(getUserId(), name); + QbCollection collection = qbService.addCollection(getUserId(), name); + return ResponseEntity.ok(collection.getUid().toString()); } @RequestMapping(path = "/changeCollectionName", method = RequestMethod.POST) @@ -277,15 +276,13 @@ rowElement.setAttribute(CommonConstants.ELEMENT_ID, uid); // the last cell is for creating stats button - String usage = !view.equalsIgnoreCase("list") ? String.valueOf( - view.equalsIgnoreCase("version") ? qbService.getCountQuestionActivitiesByUid(question.getUid()) - : qbService.getCountQuestionActivitiesByQuestionId(question.getQuestionId())) - : null; + String usage = !view.equalsIgnoreCase("list") ? String.valueOf(view.equalsIgnoreCase("version") + ? qbService.getCountQuestionActivitiesByUid(question.getUid()) + : qbService.getCountQuestionActivitiesByQuestionId(question.getQuestionId())) : null; boolean hasVersions = qbService.countQuestionVersions(question.getQuestionId()) > 1; - String learningOutcomes = view.equalsIgnoreCase("single") - ? outcomeService.getOutcomeMappings(null, null, null, question.getQuestionId()).stream() - .map(m -> m.getOutcome().getName()).collect(Collectors.joining("
")) - : null; + String learningOutcomes = view.equalsIgnoreCase("single") ? outcomeService.getOutcomeMappings(null, + null, null, question.getQuestionId()).stream().map(m -> m.getOutcome().getName()) + .collect(Collectors.joining("
")) : null; String[] data = { question.getQuestionId().toString(), WebUtil.removeHTMLtags(question.getName()).trim(), Index: lams_central/web/questions/questionChoice.jsp =================================================================== diff -u -rad1a520d923cb1d641fe38596855996390795267 -r24e5af6213a4fa2fe6531a1c7dec78df2110c0d0 --- lams_central/web/questions/questionChoice.jsp (.../questionChoice.jsp) (revision ad1a520d923cb1d641fe38596855996390795267) +++ lams_central/web/questions/questionChoice.jsp (.../questionChoice.jsp) (revision 24e5af6213a4fa2fe6531a1c7dec78df2110c0d0) @@ -2,327 +2,365 @@ <%@ include file="/common/taglibs.jsp"%> - - <fmt:message key="title.lams" /> :: <fmt:message key="label.questions.choice.title" /> - - - - - + + - + + - + - - - + + + - - - - - - - -
- -
-
- - - - - -
- - - - - - - -
- + + + + + + + +
+
- - - - label.questions.choice.type.${question.type} - - <%-- Question itself --%> -
+ + + + + + + + + + + + + + + +
- - - - - - - - +   +
- - - - -
${question.text}
- - - - - - <%-- Question feedback --%> - - <%-- If question contains images, where to take them from --%> - - <%-- Answers, if required and exist --%> - -
- - - <%-- Answer itself --%> + + + + label.questions.choice.type.${question.type} + + <%-- Question itself --%> +
+
- - - <%-- Learning Outcomes, if required and exist --%> - - - - - - -
- -
- - -
- - - + + + + + + + + + +
+
- - - - + <%-- Learning Outcomes, if required and exist --%> + + + + + + + + +
+ + +
+ +
+ + + + + + \ No newline at end of file