');
$r->rflush();
if ($context eq 'course') {
my $classlist = &Apache::loncoursedata::get_classlist();
@@ -1269,7 +1286,7 @@ sub print_userlist {
my %advrolehash = &Apache::lonnet::get_my_roles($cnum,$cdom,undef,
\@statuses,$showroles);
&gather_userinfo($context,$format,\%userlist,$indexhash,\%userinfo,
- \%advrolehash);
+ \%advrolehash,$permission);
} else {
my (%cstr_roles,%dom_roles);
if ($context eq 'construction_space') {
@@ -1278,14 +1295,14 @@ sub print_userlist {
%cstr_roles = &Apache::lonnet::get_my_roles(undef,undef,undef,
\@statuses,\@possroles);
&gather_userinfo($context,$format,\%userlist,$indexhash,\%userinfo,
- \%cstr_roles);
+ \%cstr_roles,$permission);
} elsif ($context eq 'domain') {
if ($env{'form.roletype'} eq 'domain') {
%dom_roles = &Apache::lonnet::get_domain_roles($env{'request.role.domain'});
foreach my $key (keys(%dom_roles)) {
if (ref($dom_roles{$key}) eq 'HASH') {
&gather_userinfo($context,$format,\%userlist,$indexhash,
- \%userinfo,$dom_roles{$key});
+ \%userinfo,$dom_roles{$key},$permission);
}
}
} elsif ($env{'form.roletype'} eq 'construction_space') {
@@ -1295,7 +1312,7 @@ sub print_userlist {
if (ref($dom_roles{$key}) eq 'HASH') {
if ($env{'form.showrole'} eq 'au') {
&gather_userinfo($context,$format,\%userlist,$indexhash,
- \%userinfo,$dom_roles{$key});
+ \%userinfo,$dom_roles{$key},$permission);
} else {
my @possroles;
if ($env{'form.showrole'} eq 'Any') {
@@ -1311,7 +1328,7 @@ sub print_userlist {
$authordom,undef,\@statuses,\@possroles);
}
&gather_userinfo($context,$format,\%userlist,
- $indexhash,\%userinfo,\%coauthors);
+ $indexhash,\%userinfo,\%coauthors,$permission);
}
}
}
@@ -1324,6 +1341,7 @@ sub print_userlist {
&Apache::lonnet::coursedescription($cid,{'one_time' => 1});
my $cdom = $coursehash{'domain'};
my $cnum = $coursehash{'num'};
+ next if ($cnum eq '' || $cdom eq '');
my $cdesc = $coursehash{'description'};
my (@roles,@sections,%access,%users,%userdata,
%statushash);
@@ -1356,7 +1374,7 @@ sub print_userlist {
}
}
&gather_userinfo($context,$format,\%userlist,$indexhash,
- \%userinfo,\%allusers);
+ \%userinfo,\%allusers,$permission);
} else {
$r->print('');
@@ -1399,11 +1417,11 @@ sub print_userlist {
sub list_submit_button {
my ($text) = @_;
- return '';
+ return '';
}
sub gather_userinfo {
- my ($context,$format,$userlist,$indexhash,$userinfo,$rolehash) = @_;
+ my ($context,$format,$userlist,$indexhash,$userinfo,$rolehash,$permission) = @_;
foreach my $item (keys(%{$rolehash})) {
@{$userlist->{$item}} = ();
my %userdata;
@@ -1433,6 +1451,7 @@ sub gather_userinfo {
($userdata{'username'},$userdata{'domain'},$userdata{'role'}) =
split(/:/,$item);
if (ref($rolehash->{$item}) eq 'HASH') {
+ my $numcids = keys(%{$rolehash->{$item}});
foreach my $cid (sort(keys(%{$rolehash->{$item}}))) {
if (ref($rolehash->{$item}{$cid}) eq 'HASH') {
my $spanstart = '';
@@ -1440,6 +1459,13 @@ sub gather_userinfo {
my $space = ', ';
if ($format eq 'html' || $format eq 'view') {
$spanstart = '';
+ if ($permission->{'cusr'}) {
+ if ($numcids > 1) {
+ $spanstart .= '';
+ } else {
+ $spanstart .= '';
+ }
+ }
$spanend = ' ';
$space = ', ';
}
@@ -1462,6 +1488,7 @@ sub gather_userinfo {
sub build_user_record {
my ($userdata,$userinfo,$indexhash,$record_key,$userlist) = @_;
+ next if ($userdata->{'start'} eq '-1' && $userdata->{'end'} eq '-1');
&process_date_info($userdata);
my $username = $userdata->{'username'};
my $domain = $userdata->{'domain'};
@@ -1717,6 +1744,7 @@ sub show_users_list {
if (!grep(/^\Q$sortby\E$/,@sortable)) {
$sortby = 'username';
}
+ my $setting = $env{'form.roleaction'};
my ($cid,$cdom,$cnum,$classgroups,$displayphotos,$displayclickers);
if ($context eq 'course') {
$cid=$env{'request.course.id'};
@@ -1751,9 +1779,48 @@ function photowindow(photolink) {
END
}
unless ($mode eq 'autoenroll') {
+ my $check_uncheck_js = &Apache::loncommon::check_uncheck_jscript();
+ 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);
$r->print(<
+$check_uncheck_js
+
+function verify_action (field) {
+ var numchecked = 0;
+ var singconf = '$singconfirm';
+ var multconf = '$multconfirm';
+ if (field.length > 0) {
+ for (i = 0; i < field.length; i++) {
+ if (field[i].checked == true) {
+ numchecked ++;
+ }
+ }
+ } else {
+ if (field.checked == true) {
+ numchecked ++;
+ }
+ }
+ if (numchecked == 0) {
+ alert("$alert");
+ }
+ else {
+ var message = document.studentform.bulkaction[document.studentform.bulkaction.selectedIndex].text;
+ if (numchecked == 1) {
+ message += singconf;
+ }
+ else {
+ message += multconf;
+ }
+ if (confirm(message)) {
+ document.studentform.phase.value = 'bulkchange';
+ document.studentform.submit();
+ }
+ }
+}
function username_display_launch(username,domain) {
var target;
@@ -1774,7 +1841,7 @@ function username_display_launch(usernam
}
}
-
+$date_sec_selector
END
}
@@ -1798,6 +1865,10 @@ END
'clicker' => "clicker id",
'photo' => "photo",
'extent' => "extent",
+ 'pr' => "Proceed",
+ 'ca' => "check all",
+ 'ua' => "uncheck all",
+ 'ac' => "Action to take for selected users",
'link' => "Behavior of username links",
'aboutme' => "Display a user's personal page",
'modify' => "Modify a user's information",
@@ -1839,14 +1910,17 @@ END
my $results_description = &results_header_row($rolefilter,$statusmode,
$context);
$r->print(''.$results_description.' ');
- my $output;
+ my ($output,$actionselect);
if ($mode eq 'html' || $mode eq 'view') {
+ if ($permission->{'cusr'}) {
+ $actionselect = &select_actions($context,$setting,$statusmode);
+ }
$r->print(<
-
+
END
if ($mode ne 'autoenroll') {
$output = '
';
@@ -1869,6 +1943,13 @@ END
} else {
$output .= &mt("Click on a username to view the user's personal page.").' ';
}
+ if ($actionselect) {
+ $output .= <<"END";
+$lt{'ac'}: $actionselect
+
+
+END
+ }
}
$output .= "\n
\n".
&Apache::loncommon::start_data_table().
@@ -1878,9 +1959,10 @@ END