Index: lams_common/src/java/org/lamsfoundation/lams/questions/QuestionExporter.java
===================================================================
diff -u -rf26fb3937b73bfdefd25a6166863ea188d5f8cb9 -r0cf1ce0d39dab80bbb0e11968010c727f5e002e4
--- lams_common/src/java/org/lamsfoundation/lams/questions/QuestionExporter.java (.../QuestionExporter.java) (revision f26fb3937b73bfdefd25a6166863ea188d5f8cb9)
+++ lams_common/src/java/org/lamsfoundation/lams/questions/QuestionExporter.java (.../QuestionExporter.java) (revision 0cf1ce0d39dab80bbb0e11968010c727f5e002e4)
@@ -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
===================================================================
diff -u -r9dcdc46408a8664a0fb27f09ae58a340c15f5764 -r0cf1ce0d39dab80bbb0e11968010c727f5e002e4
--- lams_tool_scratchie/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 9dcdc46408a8664a0fb27f09ae58a340c15f5764)
+++ lams_tool_scratchie/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 0cf1ce0d39dab80bbb0e11968010c727f5e002e4)
@@ -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
===================================================================
diff -u -rbe07c35c372d904a65581d98660e73f3b13b69db -r0cf1ce0d39dab80bbb0e11968010c727f5e002e4
--- lams_tool_scratchie/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision be07c35c372d904a65581d98660e73f3b13b69db)
+++ lams_tool_scratchie/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 0cf1ce0d39dab80bbb0e11968010c727f5e002e4)
@@ -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
===================================================================
diff -u -ra1e990f3ee5ec7091752683571061da802f58bb2 -r0cf1ce0d39dab80bbb0e11968010c727f5e002e4
--- lams_tool_scratchie/web/pages/authoring/basic.jsp (.../basic.jsp) (revision a1e990f3ee5ec7091752683571061da802f58bb2)
+++ lams_tool_scratchie/web/pages/authoring/basic.jsp (.../basic.jsp) (revision 0cf1ce0d39dab80bbb0e11968010c727f5e002e4)
@@ -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