Skip to content

Commit

Permalink
SAK-50298 LTI Automatically launch popup when appropriate in left nav (
Browse files Browse the repository at this point in the history
  • Loading branch information
csev authored Jul 25, 2024
1 parent 01dd527 commit 5db9e54
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion basiclti/web-ifp/src/bundle/vm/main.vm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## See also assignment/tool/src/webapp/vm/assignment/chef_assignments_view_launch.vm
#if ($!newpage)
<p>
<sakai-lti-popup launch-url="$!source"></sakai-lti-popup>
<sakai-lti-popup auto-launch="true" launch-url="$!source"></sakai-lti-popup>
</p>
#else
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ public void doView(RenderRequest request, RenderResponse response)
Object newpageValue = content.get("newpage");
newpage = getLongNull(newpageValue) == 1;

// Check the tool for its policy w.r.t content selecting popup
// 0 = never, 1=always, 2=leave it up to the content
if ( tool != null ) {
newpageValue = tool.get("newpage");
Long toolNewpage = getLongNull(newpageValue);
if ( toolNewpage == 0 ) newpage = false;
if ( toolNewpage == 1 ) newpage = true;
}

String launch = (String) content.get("launch");
// Force http:// to pop-up if we are https://
String serverUrl = ServerConfigurationService.getServerUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class SakaiLTIPopup extends SakaiElement {
preLaunchText: { attribute: "pre-launch-text", type: String },
postLaunchText: { attribute: "post-launch-text", type: String },
launchUrl: { attribute: "launch-url", type: String },
auto: { attribute: "auto-launch", type: Boolean },
};

constructor() {
Expand All @@ -18,6 +19,7 @@ export class SakaiLTIPopup extends SakaiElement {
this.randomId = randomId;
this.preLaunchText = null;
this.postLaunchText = null;
this.auto = false;
this.loadTranslations("lti").then(t => {

this.i18n = t;
Expand All @@ -38,6 +40,12 @@ export class SakaiLTIPopup extends SakaiElement {
return this.preLaunchText && this.postLaunchText && this.launchUrl;
}

firstUpdated(changedProperties) {
changedProperties.forEach((oldValue, propName) => {
if ( propName == "auto" && this.auto ) setTimeout(this.launchPopup(), 1000);
});
}

render() {

return html`
Expand Down

0 comments on commit 5db9e54

Please sign in to comment.