Skip to content

Commit

Permalink
SAK-44928 - Reduce information in LTI screens (sakaiproject#9513)
Browse files Browse the repository at this point in the history
  • Loading branch information
csev authored Aug 6, 2021
1 parent 93ed0df commit 541b00d
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public interface LTIService extends LTISubstitutionsFilter {
"pagetitle:text:label=bl_pagetitle:required=true:allowed=true:maxlength=1024",
"fa_icon:text:label=bl_fa_icon:allowed=true:maxlength=1024",
"frameheight:integer:label=bl_frameheight:allowed=true",
"toolorder:integer:label=bl_toolorder:maxlength=2",
"toolorder:integer:label=bl_toolorder:maxlength=2:role=admin",
"newpage:checkbox:label=bl_newpage",
"protect:checkbox:label=bl_protect:role=admin",
"debug:checkbox:label=bl_debug",
Expand Down
2 changes: 1 addition & 1 deletion basiclti/basiclti-tool/src/bundle/ltitool.properties
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ error.need.key.secret=This tool will not function without a key and secret.
error.link.placement.update=Error updating placement information in configuration item
error.tool.no.encryption.key=This server does not have basiclti.encryption.key set in its sakai.properties. Until you set this value, LTI secrets will be unencrypted in the database.
need.tool.info=<p>Note: This tool was imported and needs a key and secret before it will function.</p>
need.tool.info=<p>Note: This tool needs a key and secret before it will function.</p>
need.tool.secret=Tool secret
need.tool.key=Tool key
Expand Down
2 changes: 1 addition & 1 deletion basiclti/basiclti-tool/src/bundle/ltitool_ar.properties
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ error.need.key.secret=This tool will not function without a key and secret.
error.link.placement.update=Error updating placement information in configuration item
error.tool.no.encryption.key=This server does not have basiclti.encryption.key set in its sakai.properties. Until you set this value, LTI secrets will be unencrypted in the database.
need.tool.info=<p>Note\: This tool was imported and needs a key and secret before it will function.</p>
need.tool.info=<p>Note\: This tool needs a key and secret before it will function.</p>
need.tool.secret=Tool secret
need.tool.key=Tool key
Expand Down
2 changes: 1 addition & 1 deletion basiclti/basiclti-tool/src/bundle/ltitool_eu.properties
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ error.need.key.secret=This tool will not function without a key and secret.
error.link.placement.update=Error updating placement information in configuration item
error.tool.no.encryption.key=This server does not have basiclti.encryption.key set in its sakai.properties. Until you set this value, LTI secrets will be unencrypted in the database.
need.tool.info=<p>Note\: This tool was imported and needs a key and secret before it will function.</p>
need.tool.info=<p>Note\: This tool needs a key and secret before it will function.</p>
need.tool.secret=Tool secret
need.tool.key=Tool key
Expand Down
2 changes: 1 addition & 1 deletion basiclti/basiclti-tool/src/bundle/ltitool_fr_FR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ error.need.key.secret=Cet outil ne fonctionnera pas sans une cl\u00e9 et un secr
error.link.placement.update=Erreur de mise \u00e0 jour des informations de placement dans l'\u00e9l\u00e9ment de configuration
error.tool.no.encryption.key=This server does not have basiclti.encryption.key set in its sakai.properties. Until you set this value, LTI secrets will be unencrypted in the database.

need.tool.info=<p>Note\: This tool was imported and needs a key and secret before it will function.</p>
need.tool.info=<p>Note\: This tool needs a key and secret before it will function.</p>
need.tool.secret=Secret de l'outil
need.tool.key=Cl\u00e9 de l'outil

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public class LTIAdminTool extends VelocityPortletPaneledAction {
private static String FLOW_PARAMETER_EDITOR = "editor";
private static String FLOW_PARAMETER_ASSIGNMENT = "assignment";
private static String FLOW_PARAMETER_IMPORT = "import";
private static String SECRETONLY_PARAMETER = "secretonly";

/**
* Service Implementations
Expand Down Expand Up @@ -1234,7 +1235,14 @@ public String buildContentPanelContext(VelocityPortlet portlet, Context context,

public List<Map<String, Object>> getAvailableTools (String ourSite, String contextString) {

List<Map<String, Object>> tools = ltiService.getTools(null, null, 0, 0, ourSite);
Boolean isAdmin = ltiService.isAdmin(ourSite);
List<Map<String, Object>> tools = null;
if ( isAdmin ) {
tools = ltiService.getTools(null, null, 0, 0, ourSite);
} else {
tools = ltiService.getToolsLaunch(ourSite);
}

// only list the tools available in the system
List<Map<String, Object>> systemTools = new ArrayList<Map<String, Object>>();
for (Map<String, Object> tool : tools) {
Expand Down Expand Up @@ -1370,6 +1378,9 @@ public String buildContentPutPanelContext(VelocityPortlet portlet, Context conte
context.put("tool_visible", visible);
}

String flow = data.getParameters().getString(FLOW_PARAMETER);
context.put("flow", flow);

return "lti_content_insert";
}

Expand Down Expand Up @@ -2375,7 +2386,11 @@ public String buildContentConfigPanelContext(VelocityPortlet portlet, Context co
if (flow == null && previousPost != null) {
flow = previousPost.getProperty(FLOW_PARAMETER);
}
log.debug("buildContentConfigPanelContext flow={}", flow);
String secretonly = data.getParameters().getString(SECRETONLY_PARAMETER);
if (secretonly == null && previousPost != null) {
secretonly = previousPost.getProperty(SECRETONLY_PARAMETER);
}
log.debug("buildContentConfigPanelContext flow={} secretonly={}", flow, secretonly);

// TODO: Have Lessons use the normal entry point instead of coming directly here
if (flow == null) {
Expand Down Expand Up @@ -2480,7 +2495,8 @@ public String buildContentConfigPanelContext(VelocityPortlet portlet, Context co
}

// We will handle the tool_id field ourselves in the Velocity code
String[] contentForm = foorm.filterForm(null, ltiService.getContentModel(toolKey, getSiteId(state)), null, "^tool_id:.*|^SITE_ID:.*");
// We handle the description separateely below
String[] contentForm = foorm.filterForm(null, ltiService.getContentModel(toolKey, getSiteId(state)), null, "^tool_id:.*|^SITE_ID:.*|^description:.*");
if (contentForm == null) {
addAlert(state, rb.getString("error.tool.not.found"));
return "lti_error";
Expand Down Expand Up @@ -2527,6 +2543,7 @@ public String buildContentConfigPanelContext(VelocityPortlet portlet, Context co
String formInput = ltiService.formInput(previousData, contentForm);
context.put("formInput", formInput);
context.put("flow", flow);
context.put("secretonly", secretonly);

return "lti_content_config";
}
Expand Down
8 changes: 8 additions & 0 deletions basiclti/basiclti-tool/src/webapp/vm/lti_content_config.vm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ $tlang.getString("need.tool.info")
<input type="hidden" name="sakai_csrf_token" value="$sakai_csrf_token" />
<input type="hidden" name="tool_id" value="$tool_id" />
<input type="hidden" name="flow" value="$flow" />
<input type="hidden" name="secretonly" value="$secretonly" />
#if ( $returnUrl )
<input type="hidden" name="returnUrl" value="$returnUrl" />
#end
Expand All @@ -64,6 +65,13 @@ $tlang.getString("content.admin.note")
#if ( ! $isAdmin )
<script>
$(document).ready( function() {
#if ( $secretonly == 'true' )
$("#description-input").hide();
$("#title-input").hide();
$("#pagetitle-input").hide();
$("#custom-input").hide();
$("#launch-input").hide();
#end
## Does nothing if we are not in a frame of the right name
setMainFrameHeight('sakai-basiclti-admin-iframe');
$(window).resize( function() {
Expand Down
6 changes: 6 additions & 0 deletions basiclti/basiclti-tool/src/webapp/vm/lti_content_insert.vm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</h3>
#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
<!-- Flow: $flow -->
<form action="#toolForm("")" method="post" name="customizeForm" >
## Let admins still see stealthed tools in the list
#if ( !$isAdmin && $tool_id && $tool_visible == 1 )
Expand Down Expand Up @@ -44,7 +45,12 @@
#end
#if ( $formInput )
$formInput
## If we are admin and in the admin worksite - this makes no sense
#if ( ! $isAdmin )
<div id="input-add-site-link">
<input #if($placement) disabled="disabled" checked="checked" #end type="checkbox" name="add_site_link"/> $tlang.getString("bl_addlink")
</div>
#end
#else
#if ( $oldContentId )
$tlang.getString("add.tool.select")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,11 @@ public String getUrl() {
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;
}
}
Expand Down

0 comments on commit 541b00d

Please sign in to comment.