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 tag which is a base for the grid - url: "qb/collection/getCollectionGridData.do?showUsage=true&collectionUid=" + collectionGrid.data('collectionUid'), + url: "qb/collection/getCollectionGridData.do?showUsage=true&collectionUid=${collection.uid}", height: "100%", autowidth:true, shrinkToFit: true, @@ -89,6 +93,7 @@ rowNum: 10, viewrecords: true, recordpos: "left", + hidegrid: false, colNames:[ "ID", "Name", @@ -223,15 +228,14 @@ // share a collection with authors of an organisation function shareCollection() { var grid = $('#collection-grid'), - collectionUid = grid.data('collectionUid'), organisationId = $('#targetOrganisationSelect').val(); $.ajax({ 'url' : 'qb/collection/shareCollection.do', 'type' : 'POST', 'dataType' : 'text', 'data' : { - 'collectionUid' : collectionUid, + 'collectionUid' : ${collection.uid}, 'organisationId': organisationId }, 'cache' : false @@ -242,29 +246,50 @@ // stop sharing a collection with authors of an organisation function unshareCollection(organisationId) { - var grid = $('#collection-grid'), - collectionUid = grid.data('collectionUid'); + var grid = $('#collection-grid'); $.ajax({ 'url' : 'qb/collection/unshareCollection.do', 'type' : 'POST', 'dataType' : 'text', 'data' : { - 'collectionUid' : collectionUid, + 'collectionUid' : ${collection.uid}, 'organisationId': organisationId }, 'cache' : false }).done(function(){ document.location.reload(); }); } + + function importQTI(){ + window.open('questions/questionFile.jsp', + 'QuestionFile','width=500,height=240,scrollbars=yes'); + } + function saveQTI(formHTML, formName) { + var form = $($.parseHTML(formHTML)); + $.ajax({ + type: "POST", + url: '?contentFolderID=${contentFolderID}&collectionUid=${collection.uid}', + data: form.serializeArray(), + success: function() { + location.reload(); + } + }); + } + + function exportQTI(){ + var frame = document.getElementById("downloadFileDummyIframe"); + frame.src = '?collectionUid=${collection.uid}'; + } + //create proper href for "Create question" button - function initLinkHref(collectionUid) { + function initLinkHref() { var questionType = document.getElementById("question-type").selectedIndex + 1; $("#create-question-href").attr("href", "?questionType=" + questionType - + "&collectionUid=" + collectionUid + + "&collectionUid=${collection.uid}" + "&KeepThis=true&TB_iframe=true&modal=true"); }; @@ -283,20 +308,37 @@ -

- - - -   +
- - - Private collection +
+ + + + - +   -
-
+ + + Private collection + + +
+ +
+
+ + + + + + + + + +
+ +
  - - - + + +
-

+ <%-- jqGrid placeholder with some useful attributes --%>
-
-
+
-
+
There are no questions in this collection
@@ -387,6 +427,8 @@ + + \ No newline at end of file Fisheye: Tag 28f74fe44f679cfe7305cb1ddf42150f2de4c52c refers to a dead (removed) revision in file `lams_central/web/questions/importExport.jsp'. Fisheye: No comparison available. Pass `N' to diff?