[LON-CAPA-cvs] cvs: loncom / startup.pl /interface lonviewcoauthors.pm

raeburn raeburn at source.lon-capa.org
Fri Nov 3 21:56:05 EDT 2023


raeburn		Sat Nov  4 01:56:05 2023 EDT

  Modified files:              
    /loncom/interface	lonviewcoauthors.pm 
    /loncom	startup.pl 
  Log:
  - Bug 5273
    - If any co-authors listed have rights to add/revoke co-author roles then
      show that.
    - Add lonviewcoauthors.pm and lonviewclasslist.pm on startup.
  
  
Index: loncom/interface/lonviewcoauthors.pm
diff -u loncom/interface/lonviewcoauthors.pm:1.2 loncom/interface/lonviewcoauthors.pm:1.3
--- loncom/interface/lonviewcoauthors.pm:1.2	Sat Nov  4 01:33:47 2023
+++ loncom/interface/lonviewcoauthors.pm	Sat Nov  4 01:56:04 2023
@@ -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 @@
 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 @@
     } 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 @@
         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 @@
             ($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 @@
             }
             $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 @@
                 $count ++;
                 $table .= &Apache::loncommon::start_data_table_row()."\n".
                           '<td>'.$count.'</td>'.
-                          '<td>'.&Apache::loncommon::aboutmewrapper($showuser{$user}{fullname},
-                                                                    $username,$domain).
+                          '<td>';
+                if ($camanagers{$user}) {
+                    $table .= '<span style="font-face:bold;">*</span>';
+                } else {
+                    $table .= ' 'x2;
+                }
+                $table .= &Apache::loncommon::aboutmewrapper($showuser{$user}{fullname},
+                                                             $username,$domain).
                           '</td>'.
                           '<td>'.&Apache::loncommon::messagewrapper
                                 ('<img src="/adm/lonIcons/mailto.gif" border="0" /> '.
@@ -540,6 +556,12 @@
             }
             $table .= &Apache::loncommon::end_data_table()."\n";
             $r->print($table);
+            if (keys(%camanagers)) {
+                $r->print('<br /><span class="LC_fontsize_medium">'.
+                          &mt('[_1]*[_2] indicates co-author can add/revoke co-author roles',
+                              '<span style="font-face:bold;">','</span>').
+                          '</span>');
+            }
         } else {
             $r->print('<div class="LC_info">'.$output.'</div>');
         }
Index: loncom/startup.pl
diff -u loncom/startup.pl:1.44 loncom/startup.pl:1.45
--- loncom/startup.pl:1.44	Fri Oct 22 00:35:02 2021
+++ loncom/startup.pl	Sat Nov  4 01:56:05 2023
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: startup.pl,v 1.44 2021/10/22 00:35:02 raeburn Exp $
+# $Id: startup.pl,v 1.45 2023/11/04 01:56:05 raeburn Exp $
 
 BEGIN {
     eval "use Apache2::compat();";
@@ -159,6 +159,8 @@
 use Apache::lonshibauth();
 use Apache::lonshibacc();
 use Apache::lonpopulate();
+use Apache::lonviewclasslist();
+use Apache::lonviewcoauthors(); 
 1;
 __END__
 




More information about the LON-CAPA-cvs mailing list