--- loncom/interface/lonviewcoauthors.pm 2023/11/04 01:33:47 1.2 +++ loncom/interface/lonviewcoauthors.pm 2023/11/04 01:56:04 1.3 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to display the coauthors # -# $Id: lonviewcoauthors.pm,v 1.2 2023/11/04 01:33:47 raeburn Exp $ +# $Id: lonviewcoauthors.pm,v 1.3 2023/11/04 01:56:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,7 +33,7 @@ package Apache::lonviewcoauthors; use strict; use Apache::loncommon(); use Apache::lonhtmlcommon(); -use Apache::Constants qw(:common :http REDIRECT); +use Apache::Constants qw(:common :http); use Apache::lonlocal; use Apache::lonnet; use LONCAPA qw(:DEFAULT :match); @@ -214,7 +214,7 @@ sub edit_settings { } else { %viewsettings = &retrieve_view_settings($auname,$audom,$role); } - my %userenv = &Apache::lonnet::userenvironment($audom,$auname,'', + my %userenv = &Apache::lonnet::userenvironment($audom,$auname, 'coauthorlist','coauthoroptin'); my %titles = &Apache::lonlocal::texthash ( coauthorlist => 'List availability', @@ -380,6 +380,7 @@ sub print_coauthors { my $fullcount = 0; my $viewablecount = 0; my $displaycount = 0; + my $getmanagers = 1; my ($output,$roletype); my @showroles; if ($env{'request.role'} eq "au./$env{'user.domain'}/") { @@ -388,6 +389,9 @@ sub print_coauthors { ($roletype) = ($env{'request.role'} =~ m{^(ca|aa)\./$audom/$auname$}); if ($roletype ne '') { @showroles = ($roletype); + if ($roletype eq 'aa') { + undef($getmanagers); + } } } else { @showroles = ('ca','aa'); @@ -515,6 +519,12 @@ sub print_coauthors { } $table .= &Apache::loncommon::end_data_table_header_row()."\n"; my $count = 0; + my %camanagers; + if ($getmanagers) { + my %userenv = &Apache::lonnet::userenvironment($audom,$auname, + 'authormanagers'); + map { $camanagers{$_} = 1; } split(/,/,$userenv{'authormanagers'}); + } my @sorted = sort { lc($showuser{$a}{fullname}) cmp lc($showuser{$b}{fullname}) } (keys(%showuser)); @@ -523,8 +533,14 @@ sub print_coauthors { $count ++; $table .= &Apache::loncommon::start_data_table_row()."\n". ''.$count.''. - ''.&Apache::loncommon::aboutmewrapper($showuser{$user}{fullname}, - $username,$domain). + ''; + if ($camanagers{$user}) { + $table .= '*'; + } else { + $table .= ' 'x2; + } + $table .= &Apache::loncommon::aboutmewrapper($showuser{$user}{fullname}, + $username,$domain). ''. ''.&Apache::loncommon::messagewrapper (' '. @@ -540,6 +556,12 @@ sub print_coauthors { } $table .= &Apache::loncommon::end_data_table()."\n"; $r->print($table); + if (keys(%camanagers)) { + $r->print('
'. + &mt('[_1]*[_2] indicates co-author can add/revoke co-author roles', + '',''). + ''); + } } else { $r->print('
'.$output.'
'); }