Index: lams_build/3rdParty.userlibraries
===================================================================
diff -u -rbdadb88084e9f69dce20ea8d0094121174832db2 -r7060fa5b595fa324e138924099faf98e52cb5ca1
--- lams_build/3rdParty.userlibraries (.../3rdParty.userlibraries) (revision bdadb88084e9f69dce20ea8d0094121174832db2)
+++ lams_build/3rdParty.userlibraries (.../3rdParty.userlibraries) (revision 7060fa5b595fa324e138924099faf98e52cb5ca1)
@@ -5,7 +5,10 @@
+
+
+
Index: lams_build/build.xml
===================================================================
diff -u -r49dd0e4536336f2f5250264924badee6329cef1d -r7060fa5b595fa324e138924099faf98e52cb5ca1
--- lams_build/build.xml (.../build.xml) (revision 49dd0e4536336f2f5250264924badee6329cef1d)
+++ lams_build/build.xml (.../build.xml) (revision 7060fa5b595fa324e138924099faf98e52cb5ca1)
@@ -389,7 +389,6 @@
-
${ant.project.name}: Deploying libraries as WildFly modules
@@ -410,6 +409,14 @@
+
+
+
+
+
+
+
Index: lams_build/conf/j2ee/jboss-deployment-structure.xml
===================================================================
diff -u -rb6d0779192887979b5d3d244dec3506d12a7e401 -r7060fa5b595fa324e138924099faf98e52cb5ca1
--- lams_build/conf/j2ee/jboss-deployment-structure.xml (.../jboss-deployment-structure.xml) (revision b6d0779192887979b5d3d244dec3506d12a7e401)
+++ lams_build/conf/j2ee/jboss-deployment-structure.xml (.../jboss-deployment-structure.xml) (revision 7060fa5b595fa324e138924099faf98e52cb5ca1)
@@ -19,6 +19,7 @@
+
Index: lams_build/lib/apache-poi/poi.module.xml
===================================================================
diff -u -ra7136940932826c124abfb4a8e39a412a82fe1a6 -r7060fa5b595fa324e138924099faf98e52cb5ca1
--- lams_build/lib/apache-poi/poi.module.xml (.../poi.module.xml) (revision a7136940932826c124abfb4a8e39a412a82fe1a6)
+++ lams_build/lib/apache-poi/poi.module.xml (.../poi.module.xml) (revision 7060fa5b595fa324e138924099faf98e52cb5ca1)
@@ -27,6 +27,7 @@
+
Index: lams_build/liblist.txt
===================================================================
diff -u -rc42f68a09110f060149fba432df9ff60ccc84751 -r7060fa5b595fa324e138924099faf98e52cb5ca1
--- lams_build/liblist.txt (.../liblist.txt) (revision c42f68a09110f060149fba432df9ff60ccc84751)
+++ lams_build/liblist.txt (.../liblist.txt) (revision 7060fa5b595fa324e138924099faf98e52cb5ca1)
@@ -5,8 +5,12 @@
apache-poi poi-4.0.1.jar 4.0.1 Apache License 2.0 Apache the Java API for Microsoft Documents
poi-ooxml-4.0.1.jar
poi-ooxml-schemas-4.0.1.jar
+ poi-scratchpad-4.0.1.jar
xmlbeans-3.0.2.jar 3.0.2
+apache-tika tika-core-1.24.jar 1.24 Apache License 2.0 Apache a content analysis toolkit that detects and extracts metadata and text from over a thousand different file types
+ tika-parsers-1.24.jar
+
autopatch autopatch-1.4.2-lams.jar 1.4.2-lams Apache License Tacit Knowledge automated Java patching system
discovery-1.0.5-lams.jar 1.0.5-lams
Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties
===================================================================
diff -u -r625a1082501027cf4b35af4cebcf34178d0bec67 -r7060fa5b595fa324e138924099faf98e52cb5ca1
--- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 625a1082501027cf4b35af4cebcf34178d0bec67)
+++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 7060fa5b595fa324e138924099faf98e52cb5ca1)
@@ -321,6 +321,7 @@
label.tab.conditions.timelimit.individual = Is this time limit for each individual?
label.tab.conditions.enable = Enable
label.questions.file.title = Choose IMS QTI file
+label.choose.word.document =Choose Word file
label.questions.file.missing = Please select a ZIP or XML file with questions in IMS QTIformat.
label.questions.choice.title = Choose questions
label.questions.choice.select.all = Select all
@@ -915,6 +916,7 @@
label.search.question.bank = Search question bank
label.question.type = Type:
label.question.successfully.imported = Question successfully imported
+label.import.word =Import questions from Word document
label.import.qti = Import questions in IMS QTI format
label.export.qti = Export questions in IMS QTI format
label.import.xml = Import questions in XML format
@@ -978,6 +980,7 @@
label.qb.collection.remove = Remove collection
label.qb.collection.xml = XML
label.qb.collection.qti = QTI
+label.qb.collection.word =Word
label.qb.collection.questions.none = There are no questions in this collection
label.qb.collection.share.title = Share collection with courses
label.qb.collection.shared = Shared
Index: lams_central/src/java/org/lamsfoundation/lams/web/QuestionsController.java
===================================================================
diff -u -rf92b1383638a766c5d8496c6f607322dd2af8329 -r7060fa5b595fa324e138924099faf98e52cb5ca1
--- lams_central/src/java/org/lamsfoundation/lams/web/QuestionsController.java (.../QuestionsController.java) (revision f92b1383638a766c5d8496c6f607322dd2af8329)
+++ lams_central/src/java/org/lamsfoundation/lams/web/QuestionsController.java (.../QuestionsController.java) (revision 7060fa5b595fa324e138924099faf98e52cb5ca1)
@@ -14,6 +14,7 @@
import org.lamsfoundation.lams.qb.service.IQbService;
import org.lamsfoundation.lams.questions.Question;
import org.lamsfoundation.lams.questions.QuestionParser;
+import org.lamsfoundation.lams.questions.QuestionWordParser;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.util.Configuration;
import org.lamsfoundation.lams.util.ConfigurationKeys;
@@ -30,7 +31,8 @@
import org.springframework.web.bind.annotation.RequestParam;
/**
- * Runs extraction of chosen IMS QTI zip file and prepares form for user to manually choose interesting question.
+ * Runs extraction of the chosen IMS QTI zip file or .docx file. Prepares form for user to manually choose interesting
+ * question.
*/
@Controller
public class QuestionsController {
@@ -44,8 +46,9 @@
@RequestMapping("/questions")
public String execute(@RequestParam String tmpFileUploadId, @RequestParam String returnURL,
- @RequestParam("limitType") String limitTypeParam, @RequestParam String callerID,
- @RequestParam(required = false) Boolean collectionChoice, HttpServletRequest request) throws Exception {
+ @RequestParam("limitType") String limitTypeParam, @RequestParam(required = false) String importType,
+ @RequestParam String callerID, @RequestParam(required = false) Boolean collectionChoice,
+ HttpServletRequest request) throws Exception {
MultiValueMap errorMap = new LinkedMultiValueMap<>();
String packageName = null;
@@ -71,13 +74,17 @@
// show only chosen types of questions
request.setAttribute("limitType", limitTypeParam);
+ boolean isWordInput = "word".equals(importType);
+ request.setAttribute("importType", importType);
+
if (collectionChoice != null && collectionChoice) {
// in the view a drop down with collections will be displayed
request.setAttribute("collections", qbService.getUserCollections(QuestionsController.getUserId()));
}
// user did not choose a file
- if (file == null || !(packageName.endsWith(".zip") || packageName.endsWith(".xml"))) {
+ if (file == null || (isWordInput ? !packageName.endsWith(".docx")
+ : !(packageName.endsWith(".zip") || packageName.endsWith(".xml")))) {
errorMap.add("GLOBAL", messageService.getMessage("label.questions.file.missing"));
}
@@ -102,11 +109,18 @@
InputStream uploadedFileStream = new FileInputStream(file);
- Question[] questions = packageName.endsWith(".xml")
- ? QuestionParser.parseQTIFile(uploadedFileStream, null, limitType)
- : QuestionParser.parseQTIPackage(uploadedFileStream, limitType);
+ Question[] questions;
+ if (packageName.endsWith(".xml")) {
+ questions = QuestionParser.parseQTIFile(uploadedFileStream, null, limitType);
+
+ } else if (packageName.endsWith(".docx")) {
+ questions = QuestionWordParser.parseWordFile(uploadedFileStream, packageName);
+
+ } else {
+ questions = QuestionParser.parseQTIPackage(uploadedFileStream, limitType);
+ }
request.setAttribute("questions", questions);
-
+
FileUtil.deleteTmpFileUploadDir(tmpFileUploadId);
return "questions/questionChoice";
Index: lams_central/web/qb/collection.jsp
===================================================================
diff -u -radd24141d43ff78942c251760e1614925db89464 -r7060fa5b595fa324e138924099faf98e52cb5ca1
--- lams_central/web/qb/collection.jsp (.../collection.jsp) (revision add24141d43ff78942c251760e1614925db89464)
+++ lams_central/web/qb/collection.jsp (.../collection.jsp) (revision 7060fa5b595fa324e138924099faf98e52cb5ca1)
@@ -370,6 +370,11 @@
});
}
+ function importWordQuestions(){
+ window.open('questions/questionFile.jsp?importType=word',
+ 'QuestionFile','width=500,height=240,scrollbars=yes');
+ }
+
function importQTI(){
window.open('questions/questionFile.jsp',
'QuestionFile','width=500,height=370,scrollbars=yes');
@@ -489,6 +494,16 @@
+
+