Skip to content

Commit 89f1867

Browse files
committed
Add message about accessing set via LMS.
When viewing the set information before access a set via an LMS for homework grade passback, show a warning that they must access the set via the LMS before starting. They will be able to see the set info, they just won't be able to access any problems or start any test versions.
1 parent 247204c commit 89f1867

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

lib/WeBWorK/Authz.pm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,17 +486,21 @@ sub checkSet {
486486
# for this set before students access it.
487487
my $LTIGradeMode = $ce->{LTIGradeMode} // '';
488488

489-
if ($LTIGradeMode eq 'homework' && !$self->hasPermissions($userName, "view_unopened_sets")) {
489+
if ($LTIGradeMode eq 'homework'
490+
&& !$self->hasPermissions($userName, "view_unopened_sets")
491+
&& !($set->lis_source_did || ($ce->{LTIVersion} eq 'v1p3' && $ce->{LTI}{v1p3}{ignoreMissingSourcedID})))
492+
{
490493
my $LMS =
491494
$ce->{LTI}{ $ce->{LTIVersion} }{LMS_url}
492495
? $c->link_to($ce->{LTI}{ $ce->{LTIVersion} }{LMS_name} => $ce->{LTI}{ $ce->{LTIVersion} }{LMS_url})
493496
: $ce->{LTI}{ $ce->{LTIVersion} }{LMS_name};
497+
$c->{viewSetCheck} = 'lti_restricted'
498+
if $node_name eq 'problem_list' && $self->hasPermissions($userName, 'view_unopened_set_info');
494499
return $c->b($c->maketext(
495500
'You must use your Learning Management System ([_1]) to access this set. '
496501
. 'Try logging in to the Learning Management System and visiting the set from there.',
497502
$LMS
498-
))
499-
unless $set->lis_source_did || ($ce->{LTIVersion} eq 'v1p3' && $ce->{LTI}{v1p3}{ignoreMissingSourcedID});
503+
));
500504
}
501505

502506
return 0;

lib/WeBWorK/ContentGenerator/ProblemSet.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ sub siblings ($c) {
167167
}
168168

169169
sub info ($c) {
170-
return $c->include('ContentGenerator/ProblemSet/info');
170+
return $c->{pg} ? $c->include('ContentGenerator/ProblemSet/info') : '';
171171
}
172172

173173
# This is called by the ContentGenerator/ProblemSet/body template for a regular homework set.

templates/ContentGenerator/ProblemSet.html.ep

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
% if ($c->{viewSetCheck} && $c->{viewSetCheck} eq 'restricted') {
3434
<div class="alert alert-warning"><%= $c->{invalidSet} %></div>
3535
% }
36+
% # Show a warning that the user must access the set via their LMS before they can start.
37+
% if ($c->{viewSetCheck} && $c->{viewSetCheck} eq 'lti_restricted') {
38+
<div class="alert alert-warning">
39+
<%= maketext('You must access this set via your Learning Management System ([_1]) before starting.',
40+
$ce->{LTI}{ $ce->{LTIVersion} }{LMS_url}
41+
? $c->link_to($ce->{LTI}{ $ce->{LTIVersion} }{LMS_name} => $ce->{LTI}{ $ce->{LTIVersion} }{LMS_url})
42+
: $ce->{LTI}{ $ce->{LTIVersion} }{LMS_name}) %>
43+
</div>
44+
% }
3645
%
3746
<%= include 'ContentGenerator/ProblemSet/auxiliary_tools' =%>
3847
%

0 commit comments

Comments
 (0)