Index: lams_central/src/java/org/lamsfoundation/lams/authoring/template/web/LdTemplateController.java =================================================================== diff -u -r8dbb8f629af8c4b3666f8b8a364631507614d904 -rb072b4e03e4d50c9013514f96a7ab5fcf30b5391 --- lams_central/src/java/org/lamsfoundation/lams/authoring/template/web/LdTemplateController.java (.../LdTemplateController.java) (revision 8dbb8f629af8c4b3666f8b8a364631507614d904) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/template/web/LdTemplateController.java (.../LdTemplateController.java) (revision b072b4e03e4d50c9013514f96a7ab5fcf30b5391) @@ -129,40 +129,42 @@ // icon strings found in the lams_learningdesign_activity table protected static final String ASSESSMENT_TOOL_SIGNATURE = "laasse10"; - protected static final String ASSESSMENT_ICON = "tool/laasse10/images/icon_assessment.swf"; + protected static final String ASSESSMENT_ICON = "tool/laasse10/images/icon_assessment.svg"; protected static final String ASSESSMENT_TOOL_OUTPUT_DEFINITION = "learner.total.score"; protected static final String CHAT_TOOL_SIGNATURE = "lachat11"; - protected static final String CHAT_ICON = "tool/lachat11/images/icon_chat.swf"; + protected static final String CHAT_ICON = "tool/lachat11/images/icon_chat.svg"; + protected static final String DOKU_TOOL_SIGNATURE = "ladoku11"; + protected static final String DOKU_ICON = "tool/ladoku11/images/icon_dokumaran.svg"; protected static final String FORUM_TOOL_SIGNATURE = "lafrum11"; - protected static final String FORUM_ICON = "tool/lafrum11/images/icon_forum.swf"; + protected static final String FORUM_ICON = "tool/lafrum11/images/icon_forum.svg"; protected static final String LEADER_TOOL_SIGNATURE = "lalead11"; - protected static final String LEADER_ICON = "tool/lalead11/images/icon_leaderselection.swf"; + protected static final String LEADER_ICON = "tool/lalead11/images/icon_leaderselection.svg"; protected static final String MCQ_TOOL_SIGNATURE = "lamc11"; - protected static final String MCQ_ICON = "tool/lamc11/images/icon_mcq.swf"; + protected static final String MCQ_ICON = "tool/lamc11/images/icon_mcq.svg"; protected static final String MCQ_TOOL_OUTPUT_DEFINITION = "learner.mark"; protected static final String NOTEBOOK_TOOL_SIGNATURE = "lantbk11"; - protected static final String NOTEBOOK_ICON = "tool/lantbk11/images/icon_notebook.swf"; + protected static final String NOTEBOOK_ICON = "tool/lantbk11/images/icon_notebook.svg"; protected static final String NOTICEBOARD_TOOL_SIGNATURE = "lanb11"; - protected static final String NOTICEBOARD_ICON = "tool/lanb11/images/icon_htmlnb.swf"; + protected static final String NOTICEBOARD_ICON = "tool/lanb11/images/icon_htmlnb.svg"; protected static final String QA_TOOL_SIGNATURE = "laqa11"; - protected static final String QA_ICON = "tool/laqa11/images/icon_questionanswer.swf"; + protected static final String QA_ICON = "tool/laqa11/images/icon_questionanswer.svg"; protected static final String SHARE_RESOURCES_TOOL_SIGNATURE = "larsrc11"; - protected static final String SHARE_RESOURCES_ICON = "tool/larsrc11/images/icon_rsrc.swf"; + protected static final String SHARE_RESOURCES_ICON = "tool/larsrc11/images/icon_rsrc.svg"; protected static final String SCRATCHIE_TOOL_SIGNATURE = "lascrt11"; - protected static final String SCRATCHIE_ICON = "tool/lascrt11/images/icon_scratchie.swf"; + protected static final String SCRATCHIE_ICON = "tool/lascrt11/images/icon_scratchie.svg"; protected static final String SCRATCHIE_TOOL_OUTPUT_DEFINITION = "learner.mark"; protected static final String SCRIBE_TOOL_SIGNATURE = "lascrb11"; - protected static final String SCRIBE_ICON = "tool/lascrb11/images/icon_scribe.swf"; + protected static final String SCRIBE_ICON = "tool/lascrb11/images/icon_scribe.svg"; protected static final String SUBMIT_TOOL_SIGNATURE = "lasbmt11"; - protected static final String SUBMIT_ICON = "tool/lasbmt11/images/icon_reportsubmission.swf"; + protected static final String SUBMIT_ICON = "tool/lasbmt11/images/icon_reportsubmission.svg"; protected static final String SURVEY_TOOL_SIGNATURE = "lasurv11"; - protected static final String SURVEY_ICON = "tool/lasurv11/images/icon_survey.swf"; + protected static final String SURVEY_ICON = "tool/lasurv11/images/icon_survey.svg"; protected static final String WIKI_TOOL_SIGNATURE = "lawiki10"; - protected static final String WIKI_ICON = "tool/lawiki10/images/icon_wiki.swf"; + protected static final String WIKI_ICON = "tool/lawiki10/images/icon_wiki.svg"; protected static final String MINDMAP_TOOL_SIGNATURE = "lamind10"; - protected static final String MINDMAP_ICON = "tool/lamind10/images/icon_mindmap.swf"; + protected static final String MINDMAP_ICON = "tool/lamind10/images/icon_mindmap.svg"; protected static final String VOTE_TOOL_SIGNATURE = "lavote11"; - protected static final String VOTE_ICON = "tool/lavote11/images/icon_ranking.swf"; + protected static final String VOTE_ICON = "tool/lavote11/images/icon_ranking.svg"; protected static final String PEER_REVIEW_TOOL_SIGNATURE = "laprev11"; protected static final String PEER_REVIEW_ICON = "tool/laprev11/images/icon_peerreview.svg"; @@ -1249,6 +1251,33 @@ } /** + * Helper method to create a doKumaran tool content. + */ + protected Long createDokumaranToolContent(UserDTO user, String title, String description, String instructions, + boolean selectLeaderToolOutput, boolean galleryWalkEnabled, String reflectionInstructions) + throws IOException { + + ObjectNode toolContentJSON = AuthoringService.createStandardToolContent(title, description, + reflectionInstructions, null, null, user); + toolContentJSON.put(RestTags.USE_SELECT_LEADER_TOOL_OUTPUT, selectLeaderToolOutput); + toolContentJSON.put("etherpadInstructions", instructions); + toolContentJSON.put("galleryWalkEnabled", galleryWalkEnabled); + return authoringService.createToolContent(user, LdTemplateController.DOKU_TOOL_SIGNATURE, toolContentJSON); + } + + /** + * Creates a doKumaran activity's JSON details. + */ + protected ObjectNode createDokumaranActivity(AtomicInteger uiid, int order, Integer[] layoutCoords, + Long toolContentID, String contentFolderID, Integer groupingUIID, Integer parentUIID, + Integer parentActivityType, String activityTitle) { + + return createToolActivity(uiid, order, layoutCoords, LdTemplateController.DOKU_TOOL_SIGNATURE, + LdTemplateController.DOKU_ICON, toolContentID, contentFolderID, groupingUIID, parentUIID, + parentActivityType, activityTitle != null ? activityTitle : "doKumaran"); + } + + /** * * /* ************************************** Service related methods ********************************************** */ Index: lams_central/src/java/org/lamsfoundation/lams/authoring/template/web/TBLTemplateController.java =================================================================== diff -u -rc7b53dd877e2de7f9efc231db3b07ad4379eae87 -rb072b4e03e4d50c9013514f96a7ab5fcf30b5391 --- lams_central/src/java/org/lamsfoundation/lams/authoring/template/web/TBLTemplateController.java (.../TBLTemplateController.java) (revision c7b53dd877e2de7f9efc231db3b07ad4379eae87) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/template/web/TBLTemplateController.java (.../TBLTemplateController.java) (revision b072b4e03e4d50c9013514f96a7ab5fcf30b5391) @@ -40,6 +40,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.lamsfoundation.lams.authoring.template.AssessMCAnswer; import org.lamsfoundation.lams.authoring.template.Assessment; @@ -224,16 +225,28 @@ int assessmentNumber = 1; String applicationExerciseTitle = applicationExercise.title; currentActivityPosition = calcPositionNextRight(currentActivityPosition); - ArrayNode questionsJSONArray = JsonNodeFactory.instance.arrayNode(); - for (Assessment exerciseQuestion : applicationExercise.assessments.values()) { - questionsJSONArray.add(exerciseQuestion.getAsObjectNode(assessmentNumber)); - assessmentNumber++; + + if (applicationExercise.assessments == null) { + // it is doKumaran type AE + Long aetoolContentId = createDokumaranToolContent(userDTO, applicationExerciseTitle, + applicationExercise.dokuDescription, applicationExercise.dokuInstructions, true, false, + null); + activities.add(createDokumaranActivity(maxUIID, order++, currentActivityPosition, aetoolContentId, + data.contentFolderID, groupingUIID, null, null, applicationExerciseTitle)); + } else { + // it is Assessment type AE + ArrayNode questionsJSONArray = JsonNodeFactory.instance.arrayNode(); + for (Assessment exerciseQuestion : applicationExercise.assessments.values()) { + questionsJSONArray.add(exerciseQuestion.getAsObjectNode(assessmentNumber)); + assessmentNumber++; + } + + Long aetoolContentId = authoringService.createTblAssessmentToolContent(userDTO, + applicationExerciseTitle, data.getText("boilerplate.ae.instructions"), null, true, false, + false, true, true, questionsJSONArray); + activities.add(createAssessmentActivity(maxUIID, order++, currentActivityPosition, aetoolContentId, + data.contentFolderID, groupingUIID, null, null, applicationExerciseTitle)); } - Long aetoolContentId = authoringService.createTblAssessmentToolContent(userDTO, - applicationExerciseTitle, data.getText("boilerplate.ae.instructions"), null, true, false, false, - true, true, questionsJSONArray); - activities.add(createAssessmentActivity(maxUIID, order++, currentActivityPosition, aetoolContentId, - data.contentFolderID, groupingUIID, null, null, applicationExerciseTitle)); // Optional Gate / Noticeboard. Don't add the extra gate in LAMS TBL or we will get too many scheduled gates to manage if (applicationExercise.useNoticeboard) { @@ -312,6 +325,8 @@ class AppExData { String title = "Fix me"; SortedMap assessments; + String dokuDescription; + String dokuInstructions; boolean useNoticeboard = false; String noticeboardInstructions; } @@ -527,9 +542,17 @@ String appexDiv = "divappex" + i; AppExData newAppex = new AppExData(); newAppex.title = WebUtil.readStrParam(request, appexDiv + "Title", true); - newAppex.assessments = processAssessments(request, i, newAppex.title); - // null indicates appex was deleted - if (newAppex.assessments != null) { + newAppex.dokuDescription = WebUtil.readStrParam(request, appexDiv + "dokuDescription", true); + newAppex.dokuInstructions = WebUtil.readStrParam(request, appexDiv + "dokuInstructions", true); + + // if doKumaran data is present, it is doku type + // otherwise either it is Assessment type or the AE got deleted + if (StringUtils.isBlank(newAppex.dokuDescription) && StringUtils.isBlank(newAppex.dokuInstructions)) { + newAppex.assessments = processAssessments(request, i, newAppex.title); + } + + if (newAppex.assessments != null || StringUtils.isNotBlank(newAppex.dokuDescription) + || StringUtils.isNotBlank(newAppex.dokuInstructions)) { newAppex.useNoticeboard = WebUtil.readBooleanParam(request, appexDiv + "NB", false); if (newAppex.useNoticeboard) { newAppex.noticeboardInstructions = getTrimmedString(request, appexDiv + "NBEntry", true); @@ -770,10 +793,11 @@ } else { for (Map.Entry appExEntry : applicationExercises.entrySet()) { AppExData appEx = appExEntry.getValue(); - if (appEx.assessments == null || appEx.assessments.size() == 0) { + if (StringUtils.isBlank(appEx.dokuDescription) && StringUtils.isBlank(appEx.dokuInstructions) + && (appEx.assessments == null)) { addValidationErrorMessage("authoring.error.application.exercise.num", new String[] { "\"" + appEx.title + "\"" }, applicationExerciseErrors); - } else { + } else if (appEx.assessments != null) { for (Map.Entry assessmentEntry : appEx.assessments.entrySet()) { assessmentEntry.getValue().validate(applicationExerciseErrors, appBundle, formatter, appExEntry.getKey(), "\"" + appEx.title + "\"", assessmentEntry.getKey()); Index: lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/service/DokumaranService.java =================================================================== diff -u -r3eb8dcbf308a6b082c30d57f51e7000ebbe1c184 -rb072b4e03e4d50c9013514f96a7ab5fcf30b5391 --- lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/service/DokumaranService.java (.../DokumaranService.java) (revision 3eb8dcbf308a6b082c30d57f51e7000ebbe1c184) +++ lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/service/DokumaranService.java (.../DokumaranService.java) (revision b072b4e03e4d50c9013514f96a7ab5fcf30b5391) @@ -1166,7 +1166,8 @@ Dokumaran dokumaran = new Dokumaran(); dokumaran.setContentId(toolContentID); dokumaran.setTitle(JsonUtil.optString(toolContentJSON, RestTags.TITLE)); - dokumaran.setInstructions(JsonUtil.optString(toolContentJSON, RestTags.INSTRUCTIONS)); + dokumaran.setDescription(JsonUtil.optString(toolContentJSON, RestTags.INSTRUCTIONS)); + dokumaran.setInstructions(JsonUtil.optString(toolContentJSON, "etherpadInstructions")); dokumaran.setCreated(updateDate); dokumaran.setTimeLimit(JsonUtil.optInt(toolContentJSON, "timeLimit", 0));