\n");
+ "\n".''.&mt('Warning: data retrieval for multiple courses can take considerable time, as this operation is not currently optimized.').''."\n");
if ($env{'form.coursepick'}) {
$r->print(''.&mt('Searching').' ...
');
}
@@ -1331,8 +1322,6 @@ sub print_userlist {
$userlist{$student} = $classlist->{$student};
}
}
- my $cid = $env{'request.course.id'};
- my ($cnum,$cdom) = &get_course_identity($cid);
my $showroles;
if ($env{'form.showrole'} ne 'Any') {
$showroles = [$env{'form.showrole'}];
@@ -1340,8 +1329,9 @@ sub print_userlist {
$showroles = undef;
}
my $withsec = 1;
+ my $hidepriv = 1;
my %advrolehash = &Apache::lonnet::get_my_roles($cnum,$cdom,undef,
- \@statuses,$showroles,undef,$withsec);
+ \@statuses,$showroles,undef,$withsec,$hidepriv);
&gather_userinfo($context,$format,\%userlist,$indexhash,\%userinfo,
\%advrolehash,$permission);
} else {
@@ -1392,7 +1382,8 @@ sub print_userlist {
} elsif ($env{'form.roletype'} eq 'course') {
if ($env{'form.coursepick'}) {
my %courses = &process_coursepick();
- my %allusers;
+ my %allusers;
+ my $hidepriv = 1;
foreach my $cid (keys(%courses)) {
my ($cnum,$cdom,$cdesc) = &get_course_identity($cid);
next if ($cnum eq '' || $cdom eq '');
@@ -1410,7 +1401,7 @@ sub print_userlist {
foreach my $type (@statuses) {
$access{$type} = $type;
}
- &Apache::loncommon::get_course_users($cdom,$cnum,\%access,\@roles,\@sections,\%users,\%userdata,\%statushash);
+ &Apache::loncommon::get_course_users($cdom,$cnum,\%access,\@roles,\@sections,\%users,\%userdata,\%statushash,$hidepriv);
foreach my $user (keys(%userdata)) {
next if (ref($userinfo{$user}) eq 'HASH');
foreach my $item ('fullname','id') {
@@ -1468,6 +1459,62 @@ sub print_userlist {
$env{'form.phase'}.'" />');
}
+sub section_group_filter {
+ my ($cnum,$cdom) = @_;
+ my @filters;
+ if ($env{'request.course.sec'} eq '') {
+ @filters = ('sec');
+ }
+ push(@filters,'grp');
+ my %name = (
+ sec => 'secfilter',
+ grp => 'grpfilter',
+ );
+ my %title = &Apache::lonlocal::texthash (
+ sec => 'Section(s)',
+ grp => 'Group(s)',
+ all => 'all',
+ none => 'none',
+ );
+ my ($output,@options);
+ foreach my $item (@filters) {
+ my $markup;
+ if ($env{'form.'.$name{$item}} eq '') {
+ $env{'form.'.$name{$item}} = 'all';
+ }
+ if ($item eq 'sec') {
+ if ($env{'form.showrole'} eq 'cc') {
+ $env{'form.'.$name{$item}} = 'none';
+ }
+ my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum);
+ @options = sort(keys(%sections_count));
+ } elsif ($item eq 'grp') {
+ my %curr_groups = &Apache::longroup::coursegroups();
+ @options = sort(keys(%curr_groups));
+ }
+ if (@options > 0) {
+ my $currsel;
+ $markup = ''."\n";
+ foreach my $option ('all','none',@options) {
+ $currsel = '';
+ if ($env{'form.'.$name{$item}} eq $option) {
+ $currsel = ' selected="selected" ';
+ }
+ $markup .= ' '."\n";
+ }
+ $markup .= ''."\n";
+ $output .= (' 'x3).'';
+ }
+ }
+ return $output;
+}
+
sub list_submit_button {
my ($text) = @_;
return '';
@@ -1860,7 +1907,19 @@ END
my $alert = &mt("You must select at least one user by checking a user's 'Select' checkbox");
my $singconfirm = &mt(' for a single user?');
my $multconfirm = &mt(' for multiple users?');
- my $date_sec_selector = &date_section_javascript($context,$setting,$statusmode);
+ my $date_sec_selector = &date_section_javascript($context,$setting,$statusmode);
+ my %lt = &Apache::lonlocal::texthash(
+ acwi => 'Access will be set to start immediately',
+ asyo => 'as you did not select an end date in the pop-up window',
+ accw => 'Access will be set to continue indefinitely',
+ asyd => 'as you did not select an end date in the pop-up window',
+ sewi => "Sections will be switched to 'No section'",
+ ayes => "as you either selected the 'No section' option",
+ oryo => 'or you did not select a section in the pop-up window',
+ arol => 'A role with no section will be added',
+ swbs => 'Sections will be switched to:',
+ rwba => 'Roles will be added for section(s):',
+ );
$r->print(<
@@ -1886,12 +1945,47 @@ function verify_action (field) {
}
else {
var message = document.studentform.bulkaction[document.studentform.bulkaction.selectedIndex].text;
+ var choice = document.studentform.bulkaction[document.studentform.bulkaction.selectedIndex].value;
if (numchecked == 1) {
message += singconf;
}
else {
message += multconf;
}
+ if (choice == 'chgdates' || choice == 'reenable' || choice == 'activate') {
+ var datemsg = '';
+ if ((document.studentform.startdate_month.value == '') &&
+ (document.studentform.startdate_day.value == '') &&
+ (document.studentform.startdate_year.value == '')) {
+ datemsg = "\\n$lt{'acwi'},\\n$lt{'asyo'}.\\n";
+ }
+ if ((document.studentform.enddate_month.value == '') &&
+ (document.studentform.enddate_day.value == '') &&
+ (document.studentform.enddate_year.value == '')) {
+ datemsg += "\\n$lt{'accw'},\\n$lt{'asyd'}.\\n";
+ }
+ if (datemsg != '') {
+ message += "\\n"+datemsg;
+ }
+ }
+ if (choice == 'chgsec') {
+ var rolefilter = document.studentform.showrole.options[document.studentform.showrole.selectedIndex].value;
+ var retained = document.studentform.retainsec.value;
+ var secshow = document.studentform.newsecs.value;
+ if (secshow == '') {
+ if (rolefilter == 'st' || retained == 0 || retained == "") {
+ message += "\\n\\n$lt{'sewi'},\\n$lt{'ayes'},\\n$lt{'oryo'}.\\n";
+ } else {
+ message += "\\n\\n$lt{'arol'}\\n$lt{'ayes'},\\n$lt{'oryo'}.\\n";
+ }
+ } else {
+ if (rolefilter == 'st' || retained == 0 || retained == "") {
+ message += "\\n\\n$lt{'swbs'} "+secshow+".\\n";
+ } else {
+ message += "\\n\\n$lt{'rwba'} "+secshow+".\\n";
+ }
+ }
+ }
if (confirm(message)) {
document.studentform.phase.value = 'bulkchange';
document.studentform.submit();
@@ -1942,6 +2036,7 @@ END
'clicker' => "clicker id",
'photo' => "photo",
'extent' => "extent",
+ 'go' => "go",
'pr' => "Proceed",
'ca' => "check all",
'ua' => "uncheck all",
@@ -2024,10 +2119,10 @@ END
$output .= &mt("Click on a username to view the user's personal page.").' ';
}
if ($actionselect) {
- $output .= <<"END";
-$lt{'ac'}: $actionselect
+ $output .= <<"END";
+$lt{'ac'}: $actionselect
-
+
END
my @allroles;
if ($env{'form.showrole'} eq 'Any') {
@@ -2047,6 +2142,11 @@ END
$env{'request.role.domain'})) {
$canchange{$role} = 1;
}
+ } elsif ($setting eq 'author') {
+ if (&Apache::lonnet::allowed('c'.$role,
+ $env{'request.role.domain'})) {
+ $canchange{$role} = 1;
+ }
}
} elsif ($context eq 'author') {
if (&Apache::lonnet::allowed('c'.$role,
@@ -2158,6 +2258,17 @@ END
$index{$idx} = $i++;
}
my $usercount = 0;
+ my ($secfilter,$grpfilter);
+ if ($context eq 'course') {
+ $secfilter = $env{'form.secfilter'};
+ $grpfilter = $env{'form.grpfilter'};
+ if ($secfilter eq '') {
+ $secfilter = 'all';
+ }
+ if ($grpfilter eq '') {
+ $grpfilter = 'all';
+ }
+ }
# Get groups, role, permanent e-mail so we can sort on them if
# necessary.
foreach my $user (keys(%{$userlist})) {
@@ -2195,11 +2306,40 @@ END
delete($userlist->{$user});
next;
}
- if (ref($classgroups) eq 'HASH') {
- $groups = $classgroups->{$user};
- }
- if (ref($groups->{active}) eq 'HASH') {
- $userlist->{$user}->[$index{'groups'}] = join(', ',keys(%{$groups->{'active'}}));
+ if ($context eq 'course') {
+ my @ac_groups;
+ if (ref($classgroups) eq 'HASH') {
+ $groups = $classgroups->{$user};
+ }
+ if (ref($groups->{'active'}) eq 'HASH') {
+ @ac_groups = keys(%{$groups->{'active'}});
+ $userlist->{$user}->[$index{'groups'}] = join(', ',@ac_groups);
+ }
+ if ($mode ne 'autoenroll') {
+ my $section = $userlist->{$user}->[$index{'section'}];
+ if ($secfilter eq 'none') {
+ if ($section ne '') {
+ delete($userlist->{$user});
+ next;
+ }
+ } elsif ($secfilter ne 'all') {
+ if ($section ne $secfilter) {
+ delete($userlist->{$user});
+ next;
+ }
+ }
+ if ($grpfilter eq 'none') {
+ if (@ac_groups > 0) {
+ delete($userlist->{$user});
+ next;
+ }
+ } elsif ($grpfilter ne 'all') {
+ if (!grep(/^\Q$grpfilter\E$/,@ac_groups)) {
+ delete($userlist->{$user});
+ next;
+ }
+ }
+ }
}
my %emails = &Apache::loncommon::getemails($uname,$udom);
if ($emails{'permanentemail'} =~ /\S/) {
@@ -2274,7 +2414,6 @@ END
$r->print("
$cellentry
\n");
} else {
$r->print("
$rowcount
\n");
- $checkval;
if ($actionselect) {
my $showcheckbox;
if ($role =~ /^cr\//) {
@@ -2487,7 +2626,7 @@ sub select_actions {
}
}
if ($options) {
- $output = ''."\n".
+ $output = ''."\n".
''."\n".$options."\n".'';
if ($choices{'dates'}) {
@@ -2524,13 +2663,29 @@ sub date_section_javascript {
} else {
$title = &mt('Date selector');
}
+ my %nopopup = &Apache::lonlocal::texthash (
+ revoke => "Check the boxes for any users for whom roles are to be revoked, and click 'Proceed'",
+ delete => "Check the boxes for any users for whom roles are to be deleted, and click 'Proceed'",
+ none => "Choose an action to take for selected users",
+ );
my $output = '