--- loncom/interface/lonhelper.pm 2015/08/15 20:11:57 1.195
+++ loncom/interface/lonhelper.pm 2022/06/27 20:35:51 1.204
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.195 2015/08/15 20:11:57 raeburn Exp $
+# $Id: lonhelper.pm,v 1.204 2022/06/27 20:35:51 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1800,7 +1800,7 @@ sub render {
if (lc($time) eq 'anytime') {
$anytime=1;
$date = &get_date_object(time);
- $date->min(0);
+ $date->set_minute(0);
} elsif (defined($time) && $time ne 0) {
$date = &get_date_object($time);
} else {
@@ -1810,7 +1810,7 @@ sub render {
if (!defined($date)) {
$date = &get_date_object(time);
- $date->min(0);
+ $date->set_minute(0);
}
if ($anytime) {
@@ -2047,7 +2047,9 @@ be filtered out. The 'addstatus' attribu
and long status display columns to the display. The 'addparts'
attribute will add in a part selector beside problems that have more
than 1 part. The 'includecourse' attribute if true, will include
-the toplevel default.sequence in the results.
+the toplevel default.sequence in the results. The 'modalLink' attribute,
+if true, will cause links to be launched as modal pop-ups, instead of
+replacing the resource selection listing, currently being displayed.
=head3 SUB-TAGS
@@ -2159,6 +2161,9 @@ sub start_resource {
$paramHash->{'toponly'} = $token->[2]{'toponly'};
$paramHash->{'addstatus'} = $token->[2]{'addstatus'};
$paramHash->{'addparts'} = $token->[2]{'addparts'};
+ $paramHash->{'modalLink'} = $token->[2]{'modallink'};
+ $paramHash->{'nocurrloc'} = $token->[2]{'nocurrloc'};
+ $paramHash->{'suppressNavmap'} = $token->[2]{'suppressNavmap'};
if ($paramHash->{'addparts'}) {
$helper->declareVar($paramHash->{'variable'}.'_part');
}
@@ -2365,6 +2370,7 @@ BUTTONS
my $option_texts = $self->{OPTION_TEXTS};
my $option_types = $self->{OPTION_TYPES};
my $addparts = $self->{'addparts'};
+ my $modalLink = $self->{'modalLink'};
my $headings_done = 0;
# Evaluate the map url as needed
@@ -2464,7 +2470,7 @@ BUTTONS
$resource_name . "'/> ";
} else {
$col .=
- "
";
}
@@ -2540,6 +2546,10 @@ RADIO
push @$cols, (Apache::lonnavmaps::part_status_summary());
}
+ my $caller;
+ if ($helper->{TITLE} eq 'Printing Helper') {
+ $caller = 'printout';
+ }
$result .=
&Apache::lonnavmaps::render( { 'cols' => $cols,
'showParts' => 0,
@@ -2549,7 +2559,11 @@ RADIO
'suppressEmptySequences' => $self->{'suppressEmptySequences'},
'include_top_level_map' => $self->{'include_top_level_map'},
'iterator_map' => $mapUrl,
- 'map_no_edit_link' => 1, }
+ 'map_no_edit_link' => 1,
+ 'modalLink' => $modalLink,
+ 'nocurrloc' => $self->{'nocurrloc'},
+ 'suppressNavmap' => $self->{'suppressNavmap'},
+ 'caller' => $caller, }
);
$result .= $buttons;
@@ -2621,6 +2635,12 @@ selection. Defaults to false.
If true, only active students and course personnel will be
shown. Defaults to false.
+=item * B:
+
+If true, and user's role is in a specific section, only course personnel
+will be shown if they also have a section-specific role in the same section.
+Defaults to false.
+
=item * B:
If true, the selection of no users is allowed. Defaults to false.
@@ -2656,6 +2676,7 @@ sub start_student {
$helper->declareVar($paramHash->{'variable'});
$paramHash->{'multichoice'} = $token->[2]{'multichoice'};
$paramHash->{'coursepersonnel'} = $token->[2]{'coursepersonnel'};
+ $paramHash->{'sectiononly'} = $token->[2]{'sectiononly'};
$paramHash->{'activeonly'} = $token->[2]{'activeonly'};
if (defined($token->[2]{'nextstate'})) {
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'};
@@ -2697,11 +2718,17 @@ sub render {
delete($defaultUsers{''});
}
+ my $personnel_section;
+ if ($self->{'sectiononly'}) {
+ $personnel_section = $env{'request.course.sec'};
+ }
+
my ($course_personnel,
$current_members,
$expired_members,
$future_members) =
- &Apache::lonselstudent::get_people_in_class($env{'request.course.sec'});
+ &Apache::lonselstudent::get_people_in_class($env{'request.course.sec'},
+ $personnel_section);
# Load up the non-students, if necessary
@@ -2709,26 +2736,44 @@ sub render {
unshift @$current_members, (@$course_personnel);
}
+ my %titles = &Apache::lonlocal::texthash(
+ 'active' => 'Select Currently Enrolled Students and Active Course Personnel',
+ 'future' => 'Select Future Enrolled Students',
+ 'expired' => 'Select Previously Enrolled Students',
+ );
+
+ if ($env{'request.course.sec'}) {
+ if ($self->{'sectiononly'}) {
+ $titles{'active'} = &mt('Select Currently Enrolled Students and Active Course Personnel in Section: [_1]',
+ $env{'request.course.sec'});
+ } else {
+ $titles{'active'} = &mt('Select Currently Enrolled Students in Section: [_1], and Active Course Personnel',
+ $env{'request.course.sec'});
+ }
+ $titles{'future'} = &mt('Select Future Enrolled Students in Section: [_1]',
+ $env{'request.course.sec'});
+ $titles{'expired'} = &mt('Select Previously Enrolled Students in Section: [_1]',
+ $env{'request.course.sec'});
+ }
- # Current personel
+ # Current personnel
- $result .= '
'.&mt('Select Currently Enrolled Students and Active Course Personnel').'
';
+ $result .= '
'.$titles{'active'}.'
';
$result .= &Apache::lonselstudent::render_student_list( $current_members,
"helpform",
- "current",
+ "current",
\%defaultUsers,
$self->{'multichoice'},
$self->{'variable'},
1);
-
# If activeonly is not set then we can also give the expired students:
#
if (!$self->{'activeonly'} && ((scalar(@$future_members)) > 0)) {
# And future.
- $result .= '
'.&mt('Select Future Enrolled Students and Future Course Personnel').'
';
+ $result .= '
'.$titles{'future'}.'
';
$result .= &Apache::lonselstudent::render_student_list( $future_members,
"helpform",
@@ -2741,7 +2786,7 @@ sub render {
if (!$self->{'activeonly'} && ((scalar(@$expired_members)) > 0)) {
# Past
- $result .= '
'.&mt('Select Previously Enrolled Students and Inactive Course Personnel').'
';
+ $result .= '
'.$titles{'expired'}.'
';
$result .= &Apache::lonselstudent::render_student_list($expired_members,
"helpform",
"past",
@@ -3152,7 +3197,7 @@ It takes the standard attributes "variab
"allowempty" and "nextstate", meaning what they do for most other
elements.
-also takes a boolean 'onlysections' whcih will restrict this to only
+also takes a boolean 'onlysections' which will restrict this to only
have sections and not include groups
=cut
@@ -3246,6 +3291,10 @@ It takes the standard attributes "variab
"allowempty" and "nextstate", meaning what they do for most other
elements.
+also takes a boolean grouponly, which if true, will restrict choice to
+groups in which user is a member, unless user has the mdg priv in the course,
+in which case all groups will be possible choices. Defaults to false.
+
=cut
no strict;
@@ -3275,6 +3324,7 @@ sub start_group {
$helper->declareVar($paramHash->{'variable'});
$paramHash->{'multichoice'} = $token->[2]{'multichoice'};
$paramHash->{'allowempty'} = $token->[2]{'allowempty'};
+ $paramHash->{'grouponly'} = $token->[2]{'grouponly'};
if (defined($token->[2]{'nextstate'})) {
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'};
}
@@ -3282,7 +3332,12 @@ sub start_group {
# Populate the CHOICES element
my %choices;
- my %curr_groups = &Apache::longroup::coursegroups();
+ my %curr_groups;
+ if ((!$paramHash->{'grouponly'}) || (&Apache::lonnet::allowed('mdg',$Apache::lonnet::env{'request.course.id'}))) {
+ %curr_groups = &Apache::longroup::coursegroups();
+ } elsif ($Apache::lonnet::env{'request.course.groups'} ne '') {
+ map { $curr_groups{$_} = 1; } split(/:/,$Apache::lonnet::env{'request.course.groups'});
+ }
foreach my $group_name (sort {lc($a) cmp lc($b)} (keys(%curr_groups))) {
push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]);
}
@@ -3785,38 +3840,54 @@ sub render {
if ($vars->{GRANULARITY} eq 'whole_course') {
$resourceString .= '
'.&mt('for [_1]all resources in the course[_2]','','').'