\n");
if ($env{'form.coursepick'}) {
my %courses = &process_coursepick();
my %allusers;
@@ -1264,29 +1264,33 @@ sub print_userlist {
}
}
}
- if (keys(%userlist) == 0) {
- if ($context eq 'construction_space') {
- $r->print(&mt('There are no co-authors to display.')."\n");
- } elsif ($context eq 'domain') {
- if ($env{'form.roletype'} eq 'domain') {
- $r->print(&mt('There are no users with domain roles to display.')."\n");
- } elsif ($env{'form.roletype'} eq 'construction_space') {
- $r->print(&mt('There are no authors or co-authors to display.')."\n");
- } elsif ($env{'form.roletype'} eq 'course') {
- $r->print(&mt('There are no course users to display')."\n");
- }
- } elsif ($context eq 'course') {
- $r->print(&mt('There are no course users to display.')."\n");
+ }
+ if (keys(%userlist) == 0) {
+ if ($context eq 'construction_space') {
+ $r->print(&mt('There are no co-authors to display.')."\n");
+ } elsif ($context eq 'domain') {
+ if ($env{'form.roletype'} eq 'domain') {
+ $r->print(&mt('There are no users with domain roles to display.')."\n");
+ } elsif ($env{'form.roletype'} eq 'construction_space') {
+ $r->print(&mt('There are no authors or co-authors to display.')."\n");
+ } elsif ($env{'form.roletype'} eq 'course') {
+ $r->print(&mt('There are no course users to display')."\n");
}
- } else {
- # Print out the available choices
- if ($env{'form.action'} eq 'modifystudent') {
- &show_users_list($r,$context,'view','modify',
- $env{'form.Status'},\%userlist,$keylist);
- } else {
- &show_users_list($r,$context,$env{'form.output'},'aboutme',
+ } elsif ($context eq 'course') {
+ $r->print(&mt('There are no course users to display.')."\n");
+ }
+ } else {
+ # Print out the available choices
+ my $usercount;
+ if ($env{'form.action'} eq 'modifystudent') {
+ ($usercount) = &show_users_list($r,$context,'view','modify',
$env{'form.Status'},\%userlist,$keylist);
- }
+ } else {
+ ($usercount) = &show_users_list($r,$context,$env{'form.output'},
+ 'aboutme',$env{'form.Status'},\%userlist,$keylist);
+ }
+ if (!$usercount) {
+ $r->print(' '.&mt('There are no users matching the search criteria.'));
}
}
$r->print('');
@@ -1603,14 +1607,14 @@ sub show_users_list {
my ($CSVfile,$CSVfilename);
#
my $sortby = $env{'form.sortby'};
+ my @sortable = ('username','domain','id','fullname','start','end','email','role');
if ($context eq 'course') {
- if ($sortby !~ /^(username|domain|section|groups|fullname|id|start|end|type)$/) {
- $sortby = 'username';
- }
+ push(@sortable,('section','groups','type'));
} else {
- if ($sortby !~ /^(username|domain|id|fullname|start|end|role|email|extent)$/) {
- $sortby = 'username';
- }
+ push(@sortable,'extent');
+ }
+ if (!grep(/^\Q$sortby\E$/,@sortable)) {
+ $sortby = 'username';
}
my ($cid,$cdom,$cnum,$classgroups,$displayphotos,$displayclickers);
if ($context eq 'course') {
@@ -1683,7 +1687,7 @@ END
if (!($context eq 'domain' && $env{'form.roletype'} eq 'course')) {
push(@cols,('start','end'));
}
- if ($env{'form.showrole'} eq 'Any') {
+ if ($env{'form.showrole'} eq 'Any' || $env{'form.showrole'} eq 'cr') {
push(@cols,'role');
}
if ($context eq 'domain' && ($env{'form.roletype'} eq 'construction_space' ||
@@ -1699,76 +1703,76 @@ END
}
push(@cols,'email');
- my $rolefilter;
+ my $rolefilter = $env{'form.showrole'};
if ($env{'form.showrole'} ne 'Any') {
$rolefilter = &Apache::lonnet::plaintext($env{'form.showrole'});
}
my $results_description = &results_header_row($rolefilter,$statusmode,
$context);
-
+ $r->print(''.$results_description.' ');
+ my $output;
if ($mode eq 'html' || $mode eq 'view') {
- $r->print(''.&mt('Searching').' ...
');
- $r->rflush();
- $r->print(''.$results_description.' ');
- if ($linkto eq 'aboutme') {
- $r->print(&mt("Select a user name to view the user's personal page."));
- } elsif ($linkto eq 'modify') {
- $r->print(&mt("Select a user name to modify the user's information"));
- }
$r->print(<
END
- $r->print("\n
\n".
+ if ($linkto eq 'aboutme') {
+ $output = &mt("Select a user name to view the user's personal page.");
+ } elsif ($linkto eq 'modify') {
+ $output = &mt("Select a user name to modify the user's information");
+ }
+ $output .= "\n