Skip to content

Commit

Permalink
SAK-32725 - Listen for LTI tool page refresh requests (sakaiproject#4641
Browse files Browse the repository at this point in the history
)
  • Loading branch information
csev authored Jul 27, 2017
1 parent 8adbfaf commit 8d7f6a9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ <h1>Testing lti.frameResize</h1>
height: num
}), "*");
}
function ref() {
console.log("Refresh");
parent.postMessage(JSON.stringify({
subject: "lti.pageRefresh"
}), "*");
}
</script>
<button onclick="zap();return false;" value="click">Press to Send Random Height</button><br/>
<button onclick="ref();return false;" value="click">Refresh</button><br/>

</body>
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,14 @@ public void doView(RenderRequest request, RenderResponse response)
text.append(" if ( message.subject == 'lti.frameResize' ) {\n");
text.append(" var height = message.height;\n");
text.append(" document.getElementById(idval).height = height;\n");
text.append(" console.log('Reveived lti.frameResize height='+height);\n");
text.append(" window.console && console.log('Received lti.frameResize height='+height);\n");
text.append(" }\n");
text.append(" else if ( message.subject == 'lti.pageRefresh' ) {\n");
text.append(" location.reload(true);\n");
text.append(" }\n");
text.append(" } catch (error) {\n");
text.append(" console.log('lti.frameResize of '+idval+' failed height='+height);\n");
text.append(" console.log(e.data);\n");
text.append(" window.console && console.log('lti.frameResize of '+idval+' failed height='+height);\n");
text.append(" window.console && console.log(e.data);\n");
text.append(" }\n");
text.append("});\n");
text.append("</script>\n");
Expand Down
3 changes: 3 additions & 0 deletions lessonbuilder/tool/src/webapp/templates/ShowItem.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@
document.getElementById(idval).height = height;
console.log('Reveived lti.frameResize height='+height);
}
else if ( message.subject == 'lti.pageRefresh' ) {
location.reload(true);
}
} catch (error) {
console.log('lti.frameResize of '+idval+' failed height='+height);
console.log(e.data);
Expand Down

0 comments on commit 8d7f6a9

Please sign in to comment.