';
my @linkdests = ('aboutme');
if ($permission->{'cusr'}) {
@@ -2386,6 +2402,7 @@ END
$env{'request.course.sec'})) {
push(@linkdests,'track');
}
+
$output .= '';
my $usernamelink = $env{'form.usernamelink'};
if ($usernamelink eq '') {
@@ -2418,27 +2435,32 @@ END
}
}
foreach my $item (@cols) {
- $output .= " | $lt{$item} | \n";
+ if (grep(/^\Q$item\E$/,@sortable)) {
+ $output .= "$lt{$item} | \n";
+ } else {
+ $output .= "$lt{$item} | \n";
+ }
}
my %role_types = &role_type_names();
if ($context eq 'course' && $mode ne 'autoenroll') {
if ($env{'form.showrole'} eq 'st' || $env{'form.showrole'} eq 'Any') {
# Clicker display on or off?
- my %clicker_options = (
- 'on' => 'Show',
- 'off' => 'Hide',
- );
- my $clickerchg = 'on';
- if ($displayclickers eq 'on') {
- $clickerchg = 'off';
- }
- $output .= ' '."\n".' '
- .&mt('[_1]'.$clicker_options{$clickerchg}.'[_2] clicker id'
+ if ($clickersupport) {
+ my %clicker_options = (
+ 'on' => 'Show',
+ 'off' => 'Hide',
+ );
+ my $clickerchg = 'on';
+ if ($displayclickers eq 'on') {
+ $clickerchg = 'off';
+ }
+ $output .= ' | '."\n".' '
+ .&mt('[_1]'.$clicker_options{$clickerchg}.'[_2] clicker id'
,''
,'')
."\n".' | '."\n";
-
+ }
# Photo display on or off?
if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
my %photo_options = &Apache::lonlocal::texthash(
@@ -2477,14 +2499,18 @@ END
$CSVfile = undef;
}
#
- push @cols,'clicker';
+ if ($clickersupport) {
+ push @cols,'clicker';
+ }
# Write headers and data to file
print $CSVfile '"'.$results_description.'"'."\n";
print $CSVfile '"'.join('","',map {
&Apache::loncommon::csv_translate($lt{$_})
} (@cols))."\"\n";
} elsif ($mode eq 'excel') {
- push @cols,'clicker';
+ if ($clickersupport) {
+ push @cols,'clicker';
+ }
# Create the excel spreadsheet
($excel_workbook,$excel_filename,$format) =
&Apache::loncommon::create_workbook($r);
@@ -2520,6 +2546,40 @@ END
Future => 'Future',
Expired => 'Expired',
);
+ # If this is for a single course get last course "log-in" and submissions.
+ my (%crslogins,%stusubmissions,%elapsed,$numparts,%nummultipart,$multipart);
+ my $now = time;
+ if ($context eq 'course') {
+ if ($custommenu) {
+ %crslogins=&Apache::lonnet::dump('nohist_crslastlogin',$cdom,$cnum);
+ %stusubmissions=&Apache::lonnet::dump('nohist_submissiontracker',$cdom,$cnum);
+ %elapsed = &Apache::lonlocal::texthash(
+ -1 => 'more than a month ago',
+ 2592000 => 'within last 30 days',
+ 604800 => 'within last 7 days',
+ 86400 => 'within last 24 hours',
+ );
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (defined($navmap)) {
+ my @allres=$navmap->retrieveResources('/uploaded/'.$cdom.'/'.$cnum.'/default_1261144274.sequence',sub { $_[0]->is_problem() },0);
+ foreach my $resource (@allres) {
+ my @parts = $resource->parts();
+ my $count = scalar(@parts);
+ if ($count > 1) {
+ $nummultipart{$count} ++;
+ }
+ $numparts += $count;
+ }
+ if (keys(%nummultipart) > 0) {
+ $multipart = '
'.'contains';
+ foreach my $key (sort {$a <=> $b} keys(%nummultipart)) {
+ $multipart .= " nummultipart{$key} multipart questions (with $key parts)";
+ }
+ }
+ }
+ }
+ }
+
# Get groups, role, permanent e-mail so we can sort on them if
# necessary.
foreach my $user (keys(%{$userlist})) {
@@ -2655,7 +2715,7 @@ END
if ($clickers!~/\w/) { $clickers='-'; }
$in{'clicker'} = $clickers;
my $role = $in{'role'};
- $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype);
+ $in{'role'}=&Apache::lonnet::plaintext($sdata->[$index{'role'}],$crstype);
if (! defined($in{'start'}) || $in{'start'} == 0) {
$in{'start'} = &mt('none');
} else {
@@ -2666,6 +2726,34 @@ END
} else {
$in{'end'} = &Apache::lonlocal::locallocaltime($in{'end'});
}
+ if ($context eq 'course') {
+ if ($custommenu) {
+ my $lastlogin = $crslogins{$in{'username'}.':'.$in{'domain'}.':'.$in{'section'}.':'.$role};
+ if ($lastlogin ne '') {
+ my $sincelogin = $now - $lastlogin;
+ if ($sincelogin < 86400) {
+ $in{'lastlogin'} = $elapsed{'86400'};
+ } elsif ($sincelogin < 604800) {
+ $in{'lastlogin'} = $elapsed{'604800'};
+ } elsif ($sincelogin < 2592000 ) {
+ $in{'lastlogin'} = $elapsed{'2592000'};
+ } else {
+ $in{'lastlogin'} = $elapsed{'-1'};
+ }
+ }
+ }
+ if ($role eq 'st') {
+ my $numsub = $stusubmissions{$in{'username'}.':'.$in{'domain'}."\0attempts"} +
+ $stusubmissions{$in{'username'}.':'.$in{'domain'}."\0pilotsubs"};
+ if (!$numsub) {
+ $in{'submissions'} = 'not attempted';
+ } elsif ($numsub < $numparts) {
+ $in{'submissions'} = 'incomplete ('.$numsub.'/'.$numparts.')';
+ } else {
+ $in{'submissions'} = 'completed';
+ }
+ }
+ }
if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll' || $mode eq 'pickauthor') {
$r->print(&Apache::loncommon::start_data_table_row());
my $checkval;
@@ -2739,19 +2827,27 @@ END
$showitem = $ltstatus{$in{$item}};
}
$r->print(''.$showitem.' | '."\n");
+ } elsif ($item eq 'submissions') {
+ if ($in{$item} =~ /^incomplete/) {
+ $r->print(''.$in{$item}.$multipart.' | ');
+ } else {
+ $r->print(''.$in{$item}.' | '."\n");
+ }
} else {
$r->print(''.$in{$item}.' | '."\n");
}
}
if (($context eq 'course') && ($mode ne 'autoenroll')) {
if ($env{'form.showrole'} eq 'st' || $env{'form.showrole'} eq 'Any') {
- if ($displayclickers eq 'on') {
- my $clickers =
+ if ($clickersupport) {
+ if ($displayclickers eq 'on') {
+ my $clickers =
(&Apache::lonnet::userenvironment($in{'domain'},$in{'username'},'clickers'))[1];
- if ($clickers!~/\w/) { $clickers='-'; }
- $r->print(''.$clickers.' | ');
- } else {
- $r->print(' | ');
+ if ($clickers!~/\w/) { $clickers='-'; }
+ $r->print(''.$clickers.' | ');
+ } else {
+ $r->print(' | ');
+ }
}
if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
if ($displayphotos eq 'on' && $role eq 'st' && $in{'photo'} ne '') {
@@ -2942,7 +3038,7 @@ sub print_username_link {
$output = $in->{'username'};
} else {
$output = '{'username'}','$in->{'domain'}'".')">'.
+ "'$in->{'username'}','$in->{'domain'}'".')" />'.
$in->{'username'}.'';
}
return $output;
@@ -2954,7 +3050,6 @@ sub role_type_names {
'author' => 'Co-Author Roles',
'course' => 'Course Roles',
'community' => 'Community Roles',
-
);
return %lt;
}
@@ -3409,7 +3504,6 @@ sub results_header_row {
}
} elsif (($env{'form.roletype'} eq 'course') ||
($env{'form.roletype'} eq 'community')) {
-
my $coursefilter = $env{'form.coursepick'};
if ($env{'form.roletype'} eq 'course') {
if ($coursefilter eq 'category') {
@@ -3469,6 +3563,10 @@ sub show_drop_list {
my ($r,$classlist,$nosort,$permission,$crstype) = @_;
my $cid = $env{'request.course.id'};
my ($cnum,$cdom) = &get_course_identity($cid);
+ my $displaygroups;
+ unless (&Apache::loncommon::needs_gci_custom()) {
+ $displaygroups = 1;
+ }
if (! exists($env{'form.sortby'})) {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['sortby']);
@@ -3546,8 +3644,10 @@ END
$lt{'sec'} |
$lt{'start'} |
$lt{'end'} |
- $lt{'groups'} |
END
+ if ($displaygroups) {
+ $r->print(" $lt{'groups'} | \n");
+ }
$r->print(&Apache::loncommon::end_data_table_header_row());
} else {
$r->print(&Apache::loncommon::start_data_table().
@@ -3568,10 +3668,13 @@ END
$lt{'start'}
$lt{'end'}
- |
- $lt{'groups'}
|
END
+ if ($displaygroups) {
+ $r->print("
+ $lt{'groups'}
+ | \n");
+ }
$r->print(&Apache::loncommon::end_data_table_header_row());
}
#
@@ -3624,8 +3727,10 @@ END
$section |
$start $startitem |
$end |
- $active_groups |
END
+ if ($displaygroups) {
+ $r->print(" $active_groups | \n");
+ }
$r->print(&Apache::loncommon::end_data_table_row());
}
$r->print(&Apache::loncommon::end_data_table().'
');
@@ -3662,8 +3767,7 @@ sub print_first_users_upload_form {
$str .= '';
$str .= '';
-
- $str .= ''.&mt('Upload a file containing information about users').'
'."\n";
+ $str .= ''.&mt('Upload a file containing information about users').'
'."\n";
# Excel and CSV Help
$str .= ''
@@ -3750,7 +3854,7 @@ sub upfile_drop_add {
}
my ($startdate,$enddate) = &get_dates_from_form();
if ($env{'form.makedatesdefault'}) {
- $r->print(&make_dates_default($startdate,$enddate,$context,$crstype);
+ $r->print(&make_dates_default($startdate,$enddate,$context,$crstype));
}
# Determine domain and desired host (home server)
my $defdom=$env{'request.role.domain'};
@@ -3809,7 +3913,7 @@ sub upfile_drop_add {
} elsif ($setting eq 'course') {
$defaultrole = $env{'form.courserole'};
$defaultsec = $env{'form.sections'};
- }
+ }
} elsif ($context eq 'author') {
$defaultrole = $env{'form.defaultrole'};
} elsif ($context eq 'course') {
@@ -4161,7 +4265,7 @@ sub upfile_drop_add {
$role = 'cr_'.$env{'user.domain'}.'_'.
$env{'user.name'}.'_'.$role;
}
- if (($role ne 'cc') && ($role ne 'co')) {
+ if (($role ne 'cc') && ($role ne 'co')) {
if (@secs > 1) {
$multiple = 1;
foreach my $sec (@secs) {
@@ -4820,7 +4924,7 @@ sub setsections_javascript {
accr => 'A course coordinator role will be added with access to all sections.',
acor => 'A coordinator role will be added with access to all sections',
inea => 'In each course, each user may only have one student role at a time.',
- inec => 'In each community, each user may only have one member role at a time.',
+ inec => 'In each community, each user may only have on member role at a time.',
youh => 'You had selected ',
secs => 'sections.',
plmo => 'Please modify your selections so they include no more than one section.',
@@ -4828,13 +4932,11 @@ sub setsections_javascript {
plch => 'Please choose a different section name.',
mnot => 'may not be used as a section name, as it is the name of a course group.',
secn => 'Section names and group names must be distinct. Please choose a different section name.',
- nonw => 'Section names may only contain letters or numbers.',
);
$setsection_js .= <<"ENDSECCODE";
function setSections(formname,crstype) {
var re1 = /^currsec_/;
- var re2 =/\\W/;
var groups = new Array($groupslist);
for (var i=0;i 0) {
- alert("$alerts{'nonw'}\\n$alerts{'plch'}");
- return;
- }
- numsec = numsec + validsecs.length;
}
if ((role == 'st') && (numsec > 1)) {
@@ -5047,14 +5135,22 @@ sub roles_by_context {
if ($env{'request.role'} =~ m{^dc\./}) {
push(@allroles,'ad');
}
- push(@allroles,('ta','ep','in'));
- if ($crstype eq 'Community') {
- push(@allroles,'co');
+ if (&Apache::loncommon::needs_gci_custom()) {
+ if ($crstype eq 'Community') {
+ push(@allroles,'co');
+ } else {
+ push(@allroles,'cc');
+ }
} else {
- push(@allroles,'cc');
- }
- if ($custom) {
- push(@allroles,'cr');
+ push(@allroles,('ta','ep','in'));
+ if ($crstype eq 'Community') {
+ push(@allroles,'co');
+ } else {
+ push(@allroles,'cc');
+ }
+ if ($custom) {
+ push(@allroles,'cr');
+ }
}
} elsif ($context eq 'author') {
@allroles = ('ca','aa');
@@ -5378,7 +5474,7 @@ sub sectioncheck_alerts {
my %alerts = &Apache::lonlocal::texthash(
curd => 'You must select a course or community in the current domain',
inea => 'In each course, each user may only have one student role at a time',
- inco => 'In each community, each user may only have one member role at a time',
+ inco => 'In each community, each user may only have one member role at a time',
youh => 'You had selected',
sect => 'sections',
plsm => 'Please modify your selections so they include no more than one section',