Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r5bc88174180046cd153cfc46a0c8ef13675bd4bf -rbca8248580df6c46e6a8462d80e4341598cd9f28 --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 5bc88174180046cd153cfc46a0c8ef13675bd4bf) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision bca8248580df6c46e6a8462d80e4341598cd9f28) @@ -825,8 +825,10 @@ authoring.msg.close.cancel.save = Do you want to close this window without saving? authoring.msg.list.cancel.save = Do you want to return to the wizard list without saving? authoring.fla.page.menu.new.template = Use Learning Design Wizards +authoring.fla.page.menu.new.ai = Use AI Wizard authoring.template.list.introduction = Select a teaching strategy to explore it. authoring.learning.design.templates = Learning Design Wizards +authoring.learning.design.ai.wizard = Learning Design AI Wizard authoring.template.successful = Your design has been saved as {0}. authoring.label.sequence.title = Name authoring.error.question.correct.num = RAT Questions: One of the answers for Question {0} needs to be correct. Index: lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringController.java =================================================================== diff -u -ra40a77e307317e8038ed9e6b8699c18386286497 -rbca8248580df6c46e6a8462d80e4341598cd9f28 --- lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringController.java (.../AuthoringController.java) (revision a40a77e307317e8038ed9e6b8699c18386286497) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/web/AuthoringController.java (.../AuthoringController.java) (revision bca8248580df6c46e6a8462d80e4341598cd9f28) @@ -72,6 +72,7 @@ import org.lamsfoundation.lams.usermanagement.exception.UserException; import org.lamsfoundation.lams.usermanagement.exception.WorkspaceFolderException; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.FileUtil; import org.lamsfoundation.lams.util.JsonUtil; import org.lamsfoundation.lams.util.WebUtil; @@ -136,10 +137,13 @@ request.setAttribute("access", JsonUtil.toString(accessList)); request.setAttribute("licenses", authoringService.getAvailableLicenses()); - boolean canSetReadOnly = userManagementService.isUserAppAdmin() - || userManagementService.isUserGlobalGroupManager(); + boolean canSetReadOnly = + userManagementService.isUserAppAdmin() || userManagementService.isUserGlobalGroupManager(); request.setAttribute("canSetReadOnly", canSetReadOnly); + boolean aiEnabled = Configuration.isLamsModuleAvailable(Configuration.AI_MODULE_CLASS); + request.setAttribute(AttributeNames.ATTR_IS_AI_ENABLED, aiEnabled); + return "authoring/authoring"; } @@ -223,8 +227,8 @@ try { authoringService.finishEditOnFly(learningDesignID, getUserId(), cancelled); } catch (Exception e) { - String errorMsg = "Error occured ending EditOnFly" + e.getMessage() + " learning design id " - + learningDesignID; + String errorMsg = + "Error occured ending EditOnFly" + e.getMessage() + " learning design id " + learningDesignID; log.error(errorMsg, e); throw new IOException(e); } @@ -320,8 +324,8 @@ // if learning library ID is not set explicitly, derive it from tool learningLibraryID = tool.getLearningLibraryId(); } - WebApplicationContext wac = WebApplicationContextUtils - .getRequiredWebApplicationContext(applicationContext.getServletContext()); + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext( + applicationContext.getServletContext()); ToolContentManager toolManager = (ToolContentManager) wac.getBean(tool.getServiceName()); String title = toolManager.getToolContentTitle(toolContentID); if (title == null || title.trim().length() == 0) { @@ -419,8 +423,7 @@ } /** - * Updates an existing activity coordinates. - * It is run when SVG gets recreated in Monitoring or Add Lesson dialog + * Updates an existing activity coordinates. It is run when SVG gets recreated in Monitoring or Add Lesson dialog * and activities need to be rearranged as one of them is a branching designed in the old Flash Authoring. */ @ResponseBody Index: lams_central/web/authoring/authoring.jsp =================================================================== diff -u -r3eab31a1109437bc25679e6ebe38be0a350e17ac -rbca8248580df6c46e6a8462d80e4341598cd9f28 --- lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision 3eab31a1109437bc25679e6ebe38be0a350e17ac) +++ lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision bca8248580df6c46e6a8462d80e4341598cd9f28) @@ -135,6 +135,8 @@ INPUT_DETACHED_ERROR : decoderDiv.html('').text(), TEMPLATES : decoderDiv.html('').text(), + + AI_WIZARD : decoderDiv.html('').text(), LIVE_EDIT_SAVE : decoderDiv.html('').text(), @@ -313,6 +315,7 @@ Toggle Dropdown @@ -1160,4 +1163,4 @@ - + \ No newline at end of file Index: lams_central/web/includes/javascript/authoring/authoringMenu.js =================================================================== diff -u -r57d5bb83f49b691633de2f85b6c7c722108e2c3c -rbca8248580df6c46e6a8462d80e4341598cd9f28 --- lams_central/web/includes/javascript/authoring/authoringMenu.js (.../authoringMenu.js) (revision 57d5bb83f49b691633de2f85b6c7c722108e2c3c) +++ lams_central/web/includes/javascript/authoring/authoringMenu.js (.../authoringMenu.js) (revision bca8248580df6c46e6a8462d80e4341598cd9f28) @@ -8,34 +8,34 @@ */ addAnnotationLabel : function() { HandlerLib.resetCanvasMode(); - + layout.infoDialog.data('show')(LABELS.ANNOTATION_LABEL_PLACE_PROMPT, true); canvas.css('cursor', 'pointer').click(function(event){ layout.infoDialog.modal('hide'); var translatedEvent = GeneralLib.translateEventOnCanvas(event), x = translatedEvent[0], y = translatedEvent[1]; - + HandlerLib.resetCanvasMode(true); - + DecorationLib.addLabel(x, y); }); }, - - + + /** * Creates a new annotation Region. */ addAnnotationRegion : function() { HandlerLib.resetCanvasMode(); - + layout.infoDialog.data('show')(LABELS.ANNOTATION_REGION_PLACE_PROMPT, true); - + canvas.css('cursor', 'crosshair').mousedown(function(event){ layout.infoDialog.modal('hide'); var targetElement = Snap.getElementByPoint(event.pageX, event.pageY); - + if (targetElement.type == 'svg') { HandlerDecorationLib.drawRegionStartHandler(event); } else { @@ -44,8 +44,8 @@ } }); }, - - + + /** * Creates a new transition. */ @@ -58,14 +58,14 @@ } else { layout.isTransitionStarted = true; HandlerLib.resetCanvasMode(); - + layout.infoDialog.data('show')(LABELS.TRANSITION_PLACE_PROMPT, true); - + canvas.css('cursor', 'pointer').click(function(event){ layout.isTransitionStarted = false; - + layout.infoDialog.modal('hide'); - + var startActivity = null, targetElement = Snap.getElementByPoint(event.pageX, event.pageY); if (targetElement) { @@ -77,24 +77,24 @@ }); } }, - + /** * Mark an activity as ready for pasting. */ copyActivity : function(){ $('#copyButton').blur(); layout.copiedActivity = layout.selectedObject; }, - + /** * Opens a pop up for exporting LD. */ exportLearningDesign : function(){ if (layout.modified || layout.activities.length == 0) { return; } - + // dialog for downloading the sequence as ZIP var exportLDDialog = showDialog('exportLDDialog',{ 'autoOpen' : false, @@ -108,46 +108,46 @@ //dynamically create a form and submit it var exportExcelUrl = LAMS_URL + 'authoring/exportToolContent/export.do?learningDesignID=' + layout.ld.learningDesignID; var form = $('
'); - var hiddenInput = $(''); - form.append(hiddenInput); - $(document.body).append(form); - form.submit(); + var hiddenInput = $(''); + form.append(hiddenInput); + $(document.body).append(form); + form.submit(); } }, false) - .addClass('smallHeader') - .click(function(){ - exportLDDialog.modal('hide'); - }); + .addClass('smallHeader') + .click(function(){ + exportLDDialog.modal('hide'); + }); $('#exportLDDialogContents').clone().attr('id', null).appendTo($('.modal-body', exportLDDialog).empty()).show(); exportLDDialog.modal('show'); }, - + /** * Creates a SVG image out of current SVG contents. */ exportSVG : function(){ ActivityLib.removeSelectEffect(); - + var crop = MenuLib.getCanvasCrop(); if (crop.x >= crop.x2) { return; } // set viewBox so content is nicely aligned var width = crop.x2 - crop.x + 2, height = crop.y2 - crop.y + 2; - svg = $('svg', crop.canvasClone)[0]; - + svg = $('svg', crop.canvasClone)[0]; + // need to set attributes using pure JS as jQuery sets them with lower case, which is unacceptable in SVG svg.setAttribute('viewBox', crop.x + ' ' + crop.y + ' ' + width + ' ' + height); svg.setAttribute('preserveAspectRatio', 'xMinYMin slice'); svg.setAttribute('width', width); svg.setAttribute('height', height); $(svg).addClass('svg-learning-design'); - + // reset any cursor=pointer styles $('*[style*="cursor"]', svg).css('cursor', 'default'); - + // append SVG CSS straight into SVG file $.ajax({ 'url' : LAMS_URL + 'css/authoring-svg.css', @@ -160,11 +160,11 @@ svg.appendChild(styleElement); } }); - + return crop.canvasClone.html(); }, - - + + /** * Finds coordinates of canvas content, minus surrounding whitespace. */ @@ -175,7 +175,7 @@ x2 : 0, y2 : 0 }; - + var boxes = layout.activities.concat(layout.regions).concat(layout.labels); if (layout.floatingActivity) { boxes.push(layout.floatingActivity); @@ -195,19 +195,19 @@ result.y2 = box.y2; } }); - + var canvasClone = result.canvasClone = canvas.clone(); // remove the rubbish bin icon canvasClone.find('#rubbishBin').remove(); // IE needs this. There are 2 xmlns declarations and no xmlns:xlink // jQuery attr() or prop() do not work var canvasHTML = canvasClone.html().replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"/g, '').replace('systemLanguage=""','') - .replace(' oldQuestions = (assessmentPO == null) ? new HashSet<>() : assessmentPO.getQuestions(); - Set oldReferences = (assessmentPO == null) ? new HashSet<>() + Set oldReferences = (assessmentPO == null) + ? new HashSet<>() : assessmentPO.getQuestionReferences(); Set oldSections = (assessmentPO == null) ? new HashSet<>() : assessmentPO.getSections(); @@ -552,8 +553,8 @@ } else { //replace QbQuestion with the new version of it for (QuestionReference reference : references) { - if (!reference.isRandomQuestion() - && oldQbQuestionUid.equals(reference.getQuestion().getQbQuestion().getUid())) { + if (!reference.isRandomQuestion() && oldQbQuestionUid.equals( + reference.getQuestion().getQbQuestion().getUid())) { AssessmentQuestion assessmentQuestion = reference.getQuestion(); assessmentQuestion.setQbQuestion(qbQuestion); break; @@ -683,8 +684,8 @@ //check whether this question is a duplicate for (QuestionReference reference : references) { - if (!reference.isRandomQuestion() - && qbQuestionUid.equals(reference.getQuestion().getQbQuestion().getUid())) { + if (!reference.isRandomQuestion() && qbQuestionUid.equals( + reference.getQuestion().getQbQuestion().getUid())) { //let jsp know it's a duplicate return "forward:/authoring/showDuplicateQuestionError.do"; } @@ -834,10 +835,12 @@ ArrayNode questionData = JsonNodeFactory.instance.arrayNode(); questionData.add(question.getUid()); - String title = question.getName() == null ? "" + String title = question.getName() == null + ? "" : question.getName().replaceAll("\\<.*?\\>", "").replaceAll("\\n", " ").trim(); questionData.add(HtmlUtils.htmlEscape(title)); - String description = question.getDescription() == null ? "" + String description = question.getDescription() == null + ? "" : question.getDescription().replaceAll("\\<.*?\\>", "").trim(); questionData.add(HtmlUtils.htmlEscape(description)); @@ -872,8 +875,8 @@ AssessmentConstants.ATTR_REFERENCES_SEQUENCE_IDS); List updatedQuestionReferences = new LinkedList<>(); for (QuestionReference questionReference : questionReferences.toArray(new QuestionReference[0])) { - String newSequenceId = sequenceIdsParamMap - .get(AssessmentConstants.PARAM_SEQUENCE_ID + questionReference.getSequenceId()); + String newSequenceId = sequenceIdsParamMap.get( + AssessmentConstants.PARAM_SEQUENCE_ID + questionReference.getSequenceId()); questionReference.setSequenceId(Integer.valueOf(newSequenceId)); updatedQuestionReferences.add(questionReference); @@ -954,8 +957,8 @@ */ @SuppressWarnings("unchecked") private SortedSet getQuestionReferences(SessionMap sessionMap) { - SortedSet list = (SortedSet) sessionMap - .get(AssessmentConstants.ATTR_QUESTION_REFERENCES); + SortedSet list = (SortedSet) sessionMap.get( + AssessmentConstants.ATTR_QUESTION_REFERENCES); if (list == null) { list = new TreeSet<>(new SequencableComparator()); sessionMap.put(AssessmentConstants.ATTR_QUESTION_REFERENCES, list); @@ -1012,8 +1015,8 @@ int count = NumberUtils.toInt(request.getParameter(AssessmentConstants.ATTR_OVERALL_FEEDBACK_COUNT)); TreeSet overallFeedbackList = new TreeSet<>(new SequencableComparator()); for (int i = 0; i < count; i++) { - String gradeBoundaryStr = request - .getParameter(AssessmentConstants.ATTR_OVERALL_FEEDBACK_GRADE_BOUNDARY_PREFIX + i); + String gradeBoundaryStr = request.getParameter( + AssessmentConstants.ATTR_OVERALL_FEEDBACK_GRADE_BOUNDARY_PREFIX + i); String feedback = request.getParameter(AssessmentConstants.ATTR_OVERALL_FEEDBACK_FEEDBACK_PREFIX + i); String sequenceId = request.getParameter(AssessmentConstants.ATTR_OVERALL_FEEDBACK_SEQUENCE_ID_PREFIX + i); @@ -1055,8 +1058,8 @@ AssessmentOverallFeedback overallFeedback = new AssessmentOverallFeedback(); overallFeedback.setSequenceId(NumberUtils.toInt(sequenceId)); if (!StringUtils.isBlank(gradeBoundaryStr)) { - int gradeBoundary = NumberUtils - .toInt(paramMap.get(AssessmentConstants.ATTR_OVERALL_FEEDBACK_GRADE_BOUNDARY_PREFIX + i)); + int gradeBoundary = NumberUtils.toInt( + paramMap.get(AssessmentConstants.ATTR_OVERALL_FEEDBACK_GRADE_BOUNDARY_PREFIX + i)); overallFeedback.setGradeBoundary(gradeBoundary); } overallFeedback.setFeedback(feedback); @@ -1070,7 +1073,7 @@ * * @param request * @param parameterName - * parameterName + * parameterName */ private Map splitRequestParameter(HttpServletRequest request, String parameterName) { String list = request.getParameter(parameterName); @@ -1128,4 +1131,4 @@ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); return user != null ? user.getUserID() : null; } -} +} \ No newline at end of file