Skip to content

Commit

Permalink
SAK-32440 - Fix an introduced bug (sakaiproject#4660)
Browse files Browse the repository at this point in the history
  • Loading branch information
csev authored Aug 1, 2017
1 parent 53a9c29 commit 0a378dc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -633,18 +633,33 @@ protected Object insertToolContentDao(String id, String toolId, Properties reqPr
String returnUrl = reqProps.getProperty("returnUrl");

Long contentKey = null;
Long toolKey = new Long(toolId);
Map<String,Object> tool = getToolDao(toolKey, siteId, isAdminRole);
if ( tool == null ) {
retval = rb.getString("error.tool.not.found");
return retval;
}

// Make sure any missing required bits are inherited from the tool.
if ( ! reqProps.containsKey(LTIService.LTI_TOOL_ID) ) {
reqProps.setProperty(LTIService.LTI_TOOL_ID,toolId);
}

if ( ! reqProps.containsKey(LTIService.LTI_TITLE) ) {
reqProps.setProperty(LTIService.LTI_TITLE,(String) tool.get(LTIService.LTI_TITLE));
}

if ( ! reqProps.containsKey(LTIService.LTI_PAGETITLE) ) {
reqProps.setProperty(LTIService.LTI_PAGETITLE,(String) tool.get(LTIService.LTI_PAGETITLE));
}

if ( id == null )
{
reqProps.setProperty(LTIService.LTI_PLACEMENTSECRET, UUID.randomUUID().toString());
// insertContentDao checks to make sure that the TOOL_ID in reqProps is suitable
retval = insertContentDao(reqProps, siteId, isAdminRole, isMaintainRole);
} else {
contentKey = new Long(id);
Long toolKey = new Long(toolId);
Map<String,Object> tool = getToolDao(toolKey, siteId, isAdminRole);
if ( tool == null ) {
retval = rb.getString("error.tool.not.found");
}
if ( returnUrl != null ) {
if ( LTI_SECRET_INCOMPLETE.equals((String) tool.get(LTI_SECRET)) &&
LTI_SECRET_INCOMPLETE.equals((String) tool.get(LTI_CONSUMERKEY)) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11699,7 +11699,6 @@ else if (toolId.startsWith(LTITOOL_ID_PREFIX))

// Decide if any LTI tools need a configuration dialog
Object showDialog = toolMap.get(LTIService.LTI_SITEINFOCONFIG);
if ( showDialog == null || ! "1".equals(showDialog.toString()) ) continue;
if (existingLtiIds == null)
{
ltiToolNeedsConfig = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@
#set($ltiToolId=$ltiTool.getKey())
#set($ltiToolValues=$ltiTool.getValue())
#set($ltiToolTitle=$ltiToolValues.get("title"))
#set($ltiToolReqProps=$ltiToolValues.get("reqProperties"))
#if ($ltiToolReqProps && $ltiToolReqProps.containsKey("pagetitle"))
#set($ltiToolTitle=$ltiToolReqProps.get("pagetitle"))
#end
#if ($ltiToolReqProps && $ltiToolReqProps.containsKey("title"))
#set($ltiToolTitle=$ltiToolReqProps.get("title"))
#end
#if (!$!oldLtiTools.containsKey($ltiToolId))
## highlight for newly selected lti tools
<span class="highlight">
Expand Down

0 comments on commit 0a378dc

Please sign in to comment.