diff --git a/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java b/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java index 9baaaeef3ee2..7fd542b66935 100644 --- a/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java +++ b/assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java @@ -9100,24 +9100,13 @@ private void post_save_assignment(RunData data, String postOrSave) { } if ((newAssignment && !a.getDraft()) || (!a.getDraft() && !newAssignment)) { - - Collection aGroups = a.getGroups(); - if (aGroups.size() != 0) { - // If already open - if (openTime.isBefore(Instant.now())) { - eventTrackingService.post(eventTrackingService.newEvent(AssignmentConstants.EVENT_UPDATE_ASSIGNMENT_ACCESS, assignmentReference, true)); - } else { - // Not open yet, delay the event - eventTrackingService.delay(eventTrackingService.newEvent(AssignmentConstants.EVENT_AVAILABLE_ASSIGNMENT, assignmentReference, - true), openTime); - } + // If already open + if (openTime.isBefore(Instant.now())) { + // post new assignment event since it is fully initialized by now + eventTrackingService.post(eventTrackingService.newEvent(AssignmentConstants.EVENT_ADD_ASSIGNMENT, assignmentReference, true)); } else { - if (openTime.isBefore(Instant.now())) { - // post new assignment event since it is fully initialized by now - eventTrackingService.post(eventTrackingService.newEvent(AssignmentConstants.EVENT_ADD_ASSIGNMENT, assignmentReference, true)); - } else { - eventTrackingService.delay(eventTrackingService.newEvent(AssignmentConstants.EVENT_AVAILABLE_ASSIGNMENT, assignmentReference, true), openTime); - } + // Not open yet, delay the event + eventTrackingService.delay(eventTrackingService.newEvent(AssignmentConstants.EVENT_AVAILABLE_ASSIGNMENT, assignmentReference, true), openTime); } } } diff --git a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/GradeSummaryTablePanel.java b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/GradeSummaryTablePanel.java index 8595fd46547b..fe518f4d63dd 100644 --- a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/GradeSummaryTablePanel.java +++ b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/GradeSummaryTablePanel.java @@ -398,12 +398,12 @@ public boolean isVisible() { sakaiRubricButton.setVisible(true); } + String ownerId = studentUuid; if (assignment.getExternallyMaintained()) { sakaiRubricButton.add(AttributeModifier.append("tool-id", AssignmentConstants.TOOL_ID)); String[] bits = assignment.getExternalId().split("/"); if (bits != null && bits.length >= 1) { String assignmentId = bits[bits.length-1]; - String ownerId = studentUuid; if (assignment.getExternalAppName().equals(assignmentService.getToolId())) { try { org.sakaiproject.assignment.api.model.Assignment assignmentsAssignment = assignmentService.getAssignment(assignmentId); @@ -419,7 +419,8 @@ public boolean isVisible() { }).findAny(); if (groupId.isPresent()) { - ownerId = groupId.get(); + String[] groupBits = groupId.get().split("/"); + ownerId = groupBits[groupBits.length-1]; } else { log.error("Assignment {} is a group assignment, but {} was not in any of the groups", assignmentId, studentUuid); } @@ -454,7 +455,7 @@ public boolean isVisible() { } } - sakaiRubricButton.add(AttributeModifier.append("evaluated-item-owner-id", studentUuid)); + sakaiRubricButton.add(AttributeModifier.append("evaluated-item-owner-id", ownerId)); gradeScore.add(sakaiRubricButton); } diff --git a/lessonbuilder/api/src/resources/lessons.properties b/lessonbuilder/api/src/resources/lessons.properties index c2d0d4c80d6a..ce460081329c 100644 --- a/lessonbuilder/api/src/resources/lessons.properties +++ b/lessonbuilder/api/src/resources/lessons.properties @@ -275,10 +275,12 @@ simplepage.additional-instructions-label=Frequently Asked Questions about multim simplepage.additional-website-instructions-label=Frequently Asked Questions about uploading content from ZIP file simplepage.link=Add Link +simplepage.linkTitle=Link Title simplepage.addlink_header=Add A New Link simplepage.addLink_label=URL: simplepage.addLink_label_add=Add a URL: simplepage.addlink_label_name = Custom name to display for URL [optional] +simplepage.addFile_label_name = Custom name for uploaded file [optional] simplepage.addLink_label_add_or=Or add a URL or "embed code" simplepage.editText=Edit This Text simplepage.editItem=Edit @@ -675,8 +677,7 @@ simplepage.format.heading=Display Options simplepage.format.window=Open in New Window simplepage.format.inline=Embed on page simplepage.format.page=Open in New Lessons tool Page with 'next' and 'back' buttons -simplepage.format.item_removed=
ERROR: The item that should have been displayed here has been removed. Please use the "Edit" button next to this item and pick "Change External Tool" to recreate the item or choose a new one.
- +simplepage.format.item_removed_text=The item that should have been displayed here has been removed. Please use the "Edit" button next to this item and pick "Change External Tool" to recreate the item or choose a new one. simplepage.more-tools=More Tools simplepage.forum-descrip=Link to a Forum or Topic simplepage.blti-descrip=Link to a web service that uses the IMS LTI standard to integrate with this system @@ -961,3 +962,7 @@ simplepage.max-file-upload-size=The upload size limit of simplepage.max-file-upload-size-save=MB has been exceeded. Remove one or more files below to proceed. Other files may be uploaded assuming the total file size does not exceed this limit. lessons_comment=Lessons Comment + +lti.tool.missing=Content Item has no LTI tool, please re-select +lti.tool.import.incomplete=LTI tool for this item needs further configuration +lti.tool.is.draft=LTI tool for this item is still draft, needs configuration diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/BltiEntity.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/BltiEntity.java index 94a21280d79e..e26ea77b0a72 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/BltiEntity.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/BltiEntity.java @@ -33,6 +33,8 @@ import java.util.HashMap; import java.util.Properties; +import org.apache.commons.lang3.StringUtils; + import org.json.simple.JSONObject; import lombok.extern.slf4j.Slf4j; @@ -51,6 +53,7 @@ import org.sakaiproject.site.api.ToolConfiguration; import org.sakaiproject.site.api.SiteService; import org.sakaiproject.tool.api.ToolManager; +import org.sakaiproject.util.ResourceLoader; import org.tsugi.lti.LTIUtil; import org.sakaiproject.lti.util.SakaiLTIUtil; @@ -67,6 +70,7 @@ public class BltiEntity implements LessonEntity, BltiInterface { private static Cache bltiCache = null; protected static final int DEFAULT_EXPIRATION = 10 * 60; + protected static ResourceLoader rb = new ResourceLoader("lessons"); private SimplePageBean simplePageBean; @@ -313,27 +317,37 @@ public String getIcon() { } private String getErrorUrl() { - return "javascript:document.write('" + messageLocator.getMessage("simplepage.format.item_removed").replace("'", "\\'") + "')"; + return "javascript:alert('" + messageLocator.getMessage("simplepage.format.item_removed_text").replace("'", "\\'") + "')"; + } + + public String getEditNote() { + loadContent(); + if ( content == null ) return null; // Lessons will show *deleted* + + if ( tool == null ) { + return rb.getString("lti.tool.missing"); + } + + + String siteId = getSiteId(); + if ( StringUtils.isNotEmpty(siteId) && siteId.equals((String) tool.get(LTIService.LTI_SITE_ID)) + && LTIService.LTI_SECRET_INCOMPLETE.equals((String) tool.get(LTIService.LTI_SECRET)) + && LTIService.LTI_SECRET_INCOMPLETE.equals((String) tool.get(LTIService.LTI_CONSUMERKEY)) ) { + return rb.getString("lti.tool.import.incomplete"); + } + + if ( ltiService.isDraft(tool) ) { + return rb.getString("lti.tool.is.draft"); + } + + return null; } - // TODO: Concern regarding the lack of the returnUrl when this is called public String getUrl() { loadContent(); - // If I return null here, it appears that I cause an NPE in LB if ( content == null ) return getErrorUrl(); String ret = (String) content.get("launch_url"); - if ( ltiService != null && tool != null && ltiService.isMaintain(getSiteId()) - && LTIService.LTI_SECRET_INCOMPLETE.equals((String) tool.get(LTIService.LTI_SECRET)) - && LTIService.LTI_SECRET_INCOMPLETE.equals((String) tool.get(LTIService.LTI_CONSUMERKEY)) ) { - - String toolId = getCurrentTool("sakai.siteinfo"); - if ( toolId != null ) { - ret = editItemUrl(toolId); - ret = ret + "&secretonly=true"; - return ret; - } - } - + if ( ret == null ) return getErrorUrl(); ret = ServerConfigurationService.getServerUrl() + ret; return ret; } @@ -457,6 +471,7 @@ public String doImportTool(String launchUrl, String bltiTitle, String strXml, St // Allow the content item to choose open in popup so the user can change it in the Lessons UI props.setProperty(LTIService.LTI_NEWPAGE, "2"); props.setProperty(LTIService.LTI_XMLIMPORT,strXml); + props.setProperty(LTIService.LTI13,"0"); if (custom != null) props.setProperty(LTIService.LTI_CUSTOM, custom); Object result = ltiService.insertTool(props, simplePageBean.getCurrentSiteId()); diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonEntity.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonEntity.java index 9b7dbfec14d3..b4550ca7a438 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonEntity.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonEntity.java @@ -112,6 +112,10 @@ public interface LessonEntity { public String getTitle(); public String getDescription(); public String getUrl(); + // Returns a note to display near the link for editors (i.e. like Deleted) + default public String getEditNote() { + return null; + } public Date getDueDate(); // for forums, where we have a hiearchy of topics public int getLevel(); diff --git a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java index a34397817e96..dd6e31e429d4 100644 --- a/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java +++ b/lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java @@ -1530,6 +1530,7 @@ public void printSubpage(List" + SakaiLTIUtil.getRB(rb, "error.no.oidc_endpoint", "Missing oidc_endpoint value for LTI 1.3 launch") + "
"; org.tsugi.lti.LTIUtil.sendHTMLPage(res, errorMessage); return false; @@ -414,7 +414,7 @@ public void handleAccess(HttpServletRequest req, HttpServletResponse res, Refere // Sanity check for missing config data if ( ! sanityCheck(req, res, null, tool, rb) ) return; - if (SakaiLTIUtil.isLTI13(tool, null) && StringUtils.isNotBlank(oidc_endpoint) && + if (SakaiLTIUtil.isLTI13(tool) && StringUtils.isNotBlank(oidc_endpoint) && ( StringUtils.isEmpty(state) || StringUtils.isEmpty(state) ) ) { redirectOIDC(req, res, null, tool, oidc_endpoint, rb); return; @@ -494,7 +494,7 @@ else if ( refId.startsWith("content:") && refId.length() > 8 ) // Sanity check for missing config data if ( ! sanityCheck(req, res, content, tool, rb) ) return; - if (SakaiLTIUtil.isLTI13(tool, content) && StringUtils.isNotBlank(oidc_endpoint) && + if (SakaiLTIUtil.isLTI13(tool) && StringUtils.isNotBlank(oidc_endpoint) && (StringUtils.isEmpty(state) || StringUtils.isEmpty(nonce) ) ) { redirectOIDC(req, res, content, tool, oidc_endpoint, rb); return; diff --git a/master/pom.xml b/master/pom.xml index fc73ad566e18..3efa5308a339 100644 --- a/master/pom.xml +++ b/master/pom.xml @@ -797,7 +797,7 @@