Index: lams_common/src/java/org/lamsfoundation/lams/questions/QuestionExporter.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/questions/QuestionExporter.java,v diff -u -r1.1 -r1.2 --- lams_common/src/java/org/lamsfoundation/lams/questions/QuestionExporter.java 25 Mar 2014 15:12:49 -0000 1.1 +++ lams_common/src/java/org/lamsfoundation/lams/questions/QuestionExporter.java 27 Mar 2014 07:46:03 -0000 1.2 @@ -150,8 +150,12 @@ } String targetZipFileName = "lams_qti_" + packageTitle + ".zip"; + String zipPath = ZipFileUtil.createZipFile(targetZipFileName, dir.getAbsolutePath(), rootDir); - return ZipFileUtil.createZipFile(targetZipFileName, dir.getAbsolutePath(), rootDir); + // remove the directory containing the original sources from file system + FileUtils.deleteDirectory(dir); + + return zipPath; } catch (Exception e) { QuestionExporter.log.error("Error while exporti QTI package", e); } @@ -450,6 +454,7 @@ /** * Fill the existing template file with current data. + * * @return contents of XML template file */ private String createManifest() throws IOException { Index: lams_tool_scratchie/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/conf/language/lams/ApplicationResources.properties,v diff -u -r1.2 -r1.3 --- lams_tool_scratchie/conf/language/lams/ApplicationResources.properties 26 Feb 2014 18:54:31 -0000 1.2 +++ lams_tool_scratchie/conf/language/lams/ApplicationResources.properties 27 Mar 2014 07:46:05 -0000 1.3 @@ -154,6 +154,7 @@ label.learners.feedback =Learner's feedback label.monitoring.team.leader =team leader label.authoring.import.qti =Import IMS QTI +label.authoring.export.qti =Export IMS QTI label.waiting.for.leader =Please, wait while somebody will become a group leader. label.users.from.group =Other learners participating in current group: label.total =Total Index: lams_tool_scratchie/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/conf/xdoclet/struts-actions.xml,v diff -u -r1.17 -r1.18 --- lams_tool_scratchie/conf/xdoclet/struts-actions.xml 17 Jan 2014 22:12:29 -0000 1.17 +++ lams_tool_scratchie/conf/xdoclet/struts-actions.xml 27 Mar 2014 07:46:05 -0000 1.18 @@ -72,6 +72,13 @@ + + + itemList = getItemList(sessionMap); + List questions = new LinkedList(); + for (ScratchieItem item : itemList) { + Question question = new Question(); + + question.setType(Question.QUESTION_TYPE_MULTIPLE_CHOICE); + question.setTitle(item.getTitle()); + question.setText(item.getDescription()); + List answers = new ArrayList(); + + for (ScratchieAnswer itemAnswer : (Set) item.getAnswers()) { + Answer answer = new Answer(); + + answer.setText(itemAnswer.getDescription()); + // there is no LAMS interface to adjust, so use the default 1 point + Float score = itemAnswer.isCorrect() ? 1F : 0; + answer.setScore(score); + // answer order ID is 0-based, but questions is 1-based... + answers.add(itemAnswer.getOrderId(), answer); + } + + question.setAnswers(answers); + questions.add(item.getOrderId() - 1, question); + } + + String title = request.getParameter("title"); + QuestionExporter exporter = new QuestionExporter(title, questions.toArray(Question.QUESTION_ARRAY_TYPE)); + exporter.exportQTIPackage(request, response); + + return null; + } + /** * Ajax call, remove the given line of instruction of resource item. * Index: lams_tool_scratchie/web/pages/authoring/basic.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/authoring/basic.jsp,v diff -u -r1.6 -r1.7 --- lams_tool_scratchie/web/pages/authoring/basic.jsp 20 Mar 2013 13:44:13 -0000 1.6 +++ lams_tool_scratchie/web/pages/authoring/basic.jsp 27 Mar 2014 07:46:05 -0000 1.7 @@ -84,7 +84,7 @@ }; function importQTI(){ - window.open('questionFile.jsp?limitType=mc', + window.open('questions/questionFile.jsp?limitType=mc', 'QuestionFile','width=500,height=200,scrollbars=yes'); } @@ -100,6 +100,13 @@ } }); } + + function exportQTI(){ + var frame = document.getElementById("downloadFileDummyIframe"), + title = encodeURIComponent(document.getElementsByName("scratchie.title")[0].value); + frame.src = '' + + '&title=' + title; + } @@ -136,8 +143,14 @@ - + + + + - \ No newline at end of file + + + + \ No newline at end of file