Skip to content

Commit

Permalink
SAK-44876 Fix auto provision broken / in the wrong place (sakaiprojec…
Browse files Browse the repository at this point in the history
  • Loading branch information
csev authored Jan 11, 2021
1 parent f2927dd commit 8d0cbd0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,8 @@ public String buildAutoInsertPanelContext(VelocityPortlet portlet, Context conte
{
context.put("tlang", rb);
context.put("includeLatestJQuery", PortalUtils.includeLatestJQuery("LTIAdminTool"));
if (!ltiService.isMaintain(getSiteId(state))) {
addAlert(state, rb.getString("error.maintain.view"));
if (!ltiService.isAdmin(getSiteId(state))) {
addAlert(state, rb.getString("error.admin.view"));
return "lti_error";
}
context.put("messageSuccess", state.getAttribute(STATE_SUCCESS));
Expand Down Expand Up @@ -724,10 +724,16 @@ public void doAutoInsert(RunData data, Context context)
String peid = ((JetspeedRunData) data).getJs_peid();
SessionState state = ((JetspeedRunData) data).getPortletSessionState(peid);

if (!ltiService.isAdmin(getSiteId(state))) {
addAlert(state, rb.getString("error.admin.view"));
switchPanel(state, "Error");
return;
}

String title = data.getParameters().getString("title");
if (title == null || title.length() < 1) {
addAlert(state, rb.getString("tool.lti13.auto.start.title.required"));
switchPanel(state, "AutoStart");
switchPanel(state, "AutoInsert");
return;
}

Expand Down Expand Up @@ -757,9 +763,10 @@ public void doAutoInsert(RunData data, Context context)
public String buildAutoStartPanelContext(VelocityPortlet portlet, Context context,
RunData data, SessionState state)
{

context.put("tlang", rb);
context.put("includeLatestJQuery", PortalUtils.includeLatestJQuery("LTIAdminTool"));
if (!ltiService.isMaintain(getSiteId(state))) {
if (!ltiService.isAdmin(getSiteId(state))) {
addAlert(state, rb.getString("error.maintain.view"));
return "lti_error";
}
Expand Down
4 changes: 4 additions & 0 deletions basiclti/basiclti-tool/src/webapp/vm/lti_tool_insert.vm
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
#if ($messageSuccess)<div class="sak-banner-success">$tlang.getString("gen.success") $formattedText.escapeHtml($messageSuccess)</div>#end
#if ($alertMessage)<div class="sak-banner-error">$tlang.getString("gen.alert") $formattedText.escapeHtml($alertMessage)</div>#end
<form action="#toolForm("")" method="post" name="customizeForm" >
#if ($isEdit && $isAdmin && $autoStartUrl )
<div style="float:right" id="lti-advantage-div"><a href="$autoStartUrl" class="btn btn-primary" target="sakai-basiclti-admin-iframe"
title="$tlang.getString("tool.lti13.auto.title")" role="button"
onclick="showIframe(this.title, false);">$tlang.getString("tool.lti13.auto.button")</a></div>
#end
$formInput
<input type="hidden" name="sakai_csrf_token" value="$sakai_csrf_token" />
<p class="act">
Expand Down Expand Up @@ -138,6 +140,7 @@ $(document).ready( function() {

});

#if ($isEdit && $isAdmin && $autoStartUrl )
function importLTI13Config() {

var importUrl = '$autoRegistrationUrl';
Expand Down Expand Up @@ -261,6 +264,7 @@ window.addEventListener('message', function (e) {
break;
}
});
#end

</script>
</div>

0 comments on commit 8d0cbd0

Please sign in to comment.