Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAK-50788 Assignments LTI Adding a single (resource link) popup setting fix #13131

Merged
merged 2 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@
class="form-control" maxlength="100"
placeholder="$tlang.getString('external.tool.placeholder')" value="$!value_ContentTitle">
<input type="hidden" id="returnContentId" name="$name_ContentId" value="$value_ContentId">
<input type="hidden" id="returnContentLaunchNewWindow" name="$name_ContentLaunchNewWindow" value="$value_ContentLaunchNewWindow">
<input type="hidden" id="returnContentToolNewpage" name="$name_ContentToolNewpage" value="$value_ContentToolNewpage">
<script>
window.returnContentItem = function (contentItem) {
console.debug("returnContentItem", contentItem);
Expand Down
20 changes: 17 additions & 3 deletions lti/lti-tool/src/java/org/sakaiproject/lti/tool/LTIAdminTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -3324,6 +3324,9 @@ public String buildPostContentConfigPanelContext(VelocityPortlet portlet, Contex
return "lti_error";
}

Long key = foorm.getLongNull(content.get(LTIService.LTI_TOOL_ID));
Map<String, Object> tool = ltiService.getTool(key, getSiteId(state));

JSONArray new_content = new JSONArray();

JSONObject item = (JSONObject) new JSONObject();
Expand All @@ -3335,22 +3338,33 @@ public String buildPostContentConfigPanelContext(VelocityPortlet portlet, Contex
}
item.put(ContentItem.TITLE, title);

Long contentNewPage = foorm.getLongNull(content.get(LTIService.LTI_NEWPAGE));
if ( contentNewPage == null ) contentNewPage = Long.valueOf(0);
item.put("content_newpage", contentNewPage);

Long toolNewPage = Long.valueOf(LTIService.LTI_TOOL_NEWPAGE_CONTENT);
if ( tool != null ) {
toolNewPage = foorm.getLongNull(tool.get(LTIService.LTI_NEWPAGE));
if ( toolNewPage == null ) toolNewPage = Long.valueOf(LTIService.LTI_TOOL_NEWPAGE_CONTENT);
item.put("tool_newpage", toolNewPage);
}

new_content.add(item);
context.put("new_content", new_content);

context.put("new_content", new_content);

log.debug("contentKey={} flow={} returnUrl={}", contentKey, flow, returnUrl);

if ( FLOW_PARAMETER_ASSIGNMENT.equals(flow) ) {
context.put("contentId", contentKey);
context.put("contentTitle", (String) content.get(LTIService.LTI_TITLE));
context.put("contentLaunchNewWindow", contentNewPage);
context.put("contentToolNewpage", toolNewPage);

SakaiLineItem sakaiLineItem = (SakaiLineItem) state.getAttribute(STATE_LINE_ITEM);
state.removeAttribute(STATE_LINE_ITEM);
context.put("lineItem", sakaiLineItem);

Long key = foorm.getLongNull(content.get(LTIService.LTI_TOOL_ID));
Map<String, Object> tool = ltiService.getTool(key, getSiteId(state));
if ( tool != null ) {
context.put("toolTitle", (String) tool.get(LTIService.LTI_TITLE));
} else {
Expand Down
2 changes: 2 additions & 0 deletions lti/lti-tool/src/webapp/vm/lti_assignment_return.vm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<script>
window.parent.$("#returnContentId").val($contentId);
window.parent.$("#returnToolTitle").val("$formattedText.escapeHtml($toolTitle)");
window.parent.$("#returnContentLaunchNewWindow").val($contentLaunchNewWindow);
window.parent.$("#returnContentToolNewpage").val($contentToolNewpage);
window.parent.returnContentTitle("$formattedText.escapeHtml($contentTitle)");
// This is a tweaked SakaiLineItem that compensated for the CI / DL differences
#if ($new_content)
Expand Down
Loading