Index: lams_central/src/java/org/lamsfoundation/lams/web/QuestionsController.java =================================================================== diff -u -r7060fa5b595fa324e138924099faf98e52cb5ca1 -r52f835246c157f47eed9df1d47f9e7bb0c16315d --- lams_central/src/java/org/lamsfoundation/lams/web/QuestionsController.java (.../QuestionsController.java) (revision 7060fa5b595fa324e138924099faf98e52cb5ca1) +++ lams_central/src/java/org/lamsfoundation/lams/web/QuestionsController.java (.../QuestionsController.java) (revision 52f835246c157f47eed9df1d47f9e7bb0c16315d) @@ -114,7 +114,7 @@ questions = QuestionParser.parseQTIFile(uploadedFileStream, null, limitType); } else if (packageName.endsWith(".docx")) { - questions = QuestionWordParser.parseWordFile(uploadedFileStream, packageName); + questions = QuestionWordParser.parseWordFile(uploadedFileStream, packageName, limitType); } else { questions = QuestionParser.parseQTIPackage(uploadedFileStream, limitType); Index: lams_central/web/authoring/template/tbl/appex.jsp =================================================================== diff -u -r0e518f584efa4e32e8543163e92537911eddabcf -r52f835246c157f47eed9df1d47f9e7bb0c16315d --- lams_central/web/authoring/template/tbl/appex.jsp (.../appex.jsp) (revision 0e518f584efa4e32e8543163e92537911eddabcf) +++ lams_central/web/authoring/template/tbl/appex.jsp (.../appex.jsp) (revision 52f835246c157f47eed9df1d47f9e7bb0c16315d) @@ -39,8 +39,8 @@
  • -
  • ...
  • -
  • ...
  • +
  • ...
  • +
  • ...
  • Index: lams_common/src/java/org/lamsfoundation/lams/questions/QuestionParser.java =================================================================== diff -u -r50f84b60c632e10ccc6981f1ce142e28b23eb44c -r52f835246c157f47eed9df1d47f9e7bb0c16315d --- lams_common/src/java/org/lamsfoundation/lams/questions/QuestionParser.java (.../QuestionParser.java) (revision 50f84b60c632e10ccc6981f1ce142e28b23eb44c) +++ lams_common/src/java/org/lamsfoundation/lams/questions/QuestionParser.java (.../QuestionParser.java) (revision 52f835246c157f47eed9df1d47f9e7bb0c16315d) @@ -611,7 +611,7 @@ /** * Checks if given type has a correct value and should be processed. Also sets question property for convenience. */ - private static boolean isQuestionTypeAcceptable(String type, Set limitType, Question question) { + static boolean isQuestionTypeAcceptable(String type, Set limitType, Question question) { if ((type == null) || !Question.QUESTION_TYPES.contains(type)) { return false; } Index: lams_common/src/java/org/lamsfoundation/lams/questions/QuestionWordParser.java =================================================================== diff -u -r313df184c7e7f788cca5c101e266e39f1a543449 -r52f835246c157f47eed9df1d47f9e7bb0c16315d --- lams_common/src/java/org/lamsfoundation/lams/questions/QuestionWordParser.java (.../QuestionWordParser.java) (revision 313df184c7e7f788cca5c101e266e39f1a543449) +++ lams_common/src/java/org/lamsfoundation/lams/questions/QuestionWordParser.java (.../QuestionWordParser.java) (revision 52f835246c157f47eed9df1d47f9e7bb0c16315d) @@ -70,7 +70,7 @@ /** * Extracts questions from IMS QTI zip file. */ - public static Question[] parseWordFile(InputStream uploadedFileStream, String fileName) + public static Question[] parseWordFile(InputStream uploadedFileStream, String fileName, Set limitType) throws XPathExpressionException, ZipFileUtilException, TransformerConfigurationException, IOException, SAXException, TikaException, ParserConfigurationException { final String TEMP_IMAGE_FOLDER = ZipFileUtil.prepareTempDirectory(fileName); @@ -258,24 +258,26 @@ } Question question = new Question(); + if (answers.isEmpty()) { + if (!QuestionParser.isQuestionTypeAcceptable(Question.QUESTION_TYPE_ESSAY, limitType, question)) { + continue; + } + } else { + if (!QuestionParser + .isQuestionTypeAcceptable(isMultipleResponse ? Question.QUESTION_TYPE_MULTIPLE_RESPONSE + : Question.QUESTION_TYPE_MULTIPLE_CHOICE, limitType, question)) { + continue; + } + question.setAnswers(answers); + } + question.setResourcesFolderPath(TEMP_IMAGE_FOLDER); question.setTitle(title); question.setText(description); question.setFeedback(feedback); question.setLearningOutcomes(learningOutcomes); - if (answers.isEmpty()) { - question.setType(Question.QUESTION_TYPE_ESSAY); - } else { - question.setAnswers(answers); - if (isMultipleResponse) { - question.setType(Question.QUESTION_TYPE_MULTIPLE_RESPONSE); - } else { - question.setType(Question.QUESTION_TYPE_MULTIPLE_CHOICE); - } - } questions.add(question); - } return questions.toArray(Question.QUESTION_ARRAY_TYPE);