Index: lams_central/src/java/org/lamsfoundation/lams/web/qb/ImsQtiController.java =================================================================== diff -u -r99d2b23140678283fd284b18e7aeeb24d93e0534 -r28f74fe44f679cfe7305cb1ddf42150f2de4c52c --- lams_central/src/java/org/lamsfoundation/lams/web/qb/ImsQtiController.java (.../ImsQtiController.java) (revision 99d2b23140678283fd284b18e7aeeb24d93e0534) +++ lams_central/src/java/org/lamsfoundation/lams/web/qb/ImsQtiController.java (.../ImsQtiController.java) (revision 28f74fe44f679cfe7305cb1ddf42150f2de4c52c) @@ -27,6 +27,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; /** * Exports and imports IMS QTI questions. @@ -52,8 +53,11 @@ * Parses questions extracted from IMS QTI file and adds them as new QB questions. */ @RequestMapping("/saveQTI") - public String saveQTI(HttpServletRequest request, @RequestParam long collectionUid, + @ResponseBody + public void saveQTI(HttpServletRequest request, @RequestParam long collectionUid, @RequestParam String contentFolderID) throws UnsupportedEncodingException { + int questionId = qbService.getMaxQuestionId(); + Question[] questions = QuestionParser.parseQuestionChoiceForm(request); for (Question question : questions) { QbQuestion qbQuestion = new QbQuestion(); @@ -63,6 +67,7 @@ qbQuestion.setFeedback(QuestionParser.processHTMLField(question.getFeedback(), false, contentFolderID, question.getResourcesFolderPath())); qbQuestion.setPenaltyFactor(0); + qbQuestion.setQuestionId(++questionId); int questionMark = 1; @@ -103,6 +108,7 @@ option.setName(answerText); option.setDisplayOrder(orderId++); option.setFeedback(answer.getFeedback()); + option.setQbQuestion(qbQuestion); if ((answer.getScore() != null) && (answer.getScore() > 0)) { // for fill in blanks question all answers are correct and get full mark @@ -156,6 +162,7 @@ assessmentAnswer.setName(answerText); assessmentAnswer.setDisplayOrder(orderId++); assessmentAnswer.setFeedback(answer.getFeedback()); + assessmentAnswer.setQbQuestion(qbQuestion); if ((answer.getScore() != null) && (answer.getScore() > 0)) { // set the factor of score for correct answers @@ -222,6 +229,7 @@ assessmentAnswer.setName(matchAnswer.getText()); assessmentAnswer.setDisplayOrder(orderId++); assessmentAnswer.setFeedback(answer.getFeedback()); + assessmentAnswer.setQbQuestion(qbQuestion); optionList.add(assessmentAnswer); } @@ -253,6 +261,7 @@ option.setName(answerText); option.setDisplayOrder(orderId++); option.setFeedback(answer.getFeedback()); + option.setQbQuestion(qbQuestion); if ((answer.getScore() != null) && (answer.getScore() > 0)) { // for fill in blanks question all answers are correct and get full mark @@ -293,11 +302,9 @@ qbService.addQuestionToCollection(collectionUid, qbQuestion.getUid(), false); if (log.isDebugEnabled()) { - log.debug("Added question: " + qbQuestion.getName()); + log.debug("Imported QTI question. Name: " + qbQuestion.getName() + ", uid: " + qbQuestion.getUid()); } } - - return "qb/qtiquestions"; } /** Index: lams_central/web/qb/collection.jsp =================================================================== diff -u -r1dcc990ddb1ab499f9afb8435f9b9e6fdb0481a7 -r28f74fe44f679cfe7305cb1ddf42150f2de4c52c --- lams_central/web/qb/collection.jsp (.../collection.jsp) (revision 1dcc990ddb1ab499f9afb8435f9b9e6fdb0481a7) +++ lams_central/web/qb/collection.jsp (.../collection.jsp) (revision 28f74fe44f679cfe7305cb1ddf42150f2de4c52c) @@ -47,6 +47,11 @@ margin-right: 50px; } + #collection-name-row { + min-height: 20px; + margin-top: 20px; + } + #collection-name:hover+span+i { visibility:visible } @@ -75,8 +80,7 @@ iconSet: 'fontAwesome', caption: "Questions", datatype: "xml", - // data comes from data-collection-* attributes of