[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm loncreateuser.pm lonuserutils.pm

raeburn raeburn at source.lon-capa.org
Fri Nov 3 20:06:00 EDT 2023


raeburn		Sat Nov  4 00:06:00 2023 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm lonuserutils.pm loncoursedata.pm 
  Log:
  - Bug 5273. Authors can show which unexpired co-author roles are managers via: 
    People > "Manage Co-authors" 
  
  
-------------- next part --------------
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.471 loncom/interface/loncreateuser.pm:1.472
--- loncom/interface/loncreateuser.pm:1.471	Fri Nov  3 21:40:22 2023
+++ loncom/interface/loncreateuser.pm	Sat Nov  4 00:06:00 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.471 2023/11/03 21:40:22 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.472 2023/11/04 00:06:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5506,7 +5506,7 @@
         }
         $output .= "</p>\n";
         if (@possmanagers) {
-            $output .= '<p>'.&mt('Select manager(s)').': ';
+            $output .= '<p>'.&mt('If checked, can manage').': ';
             foreach my $user (@possmanagers) {
                  my $checked;
                  if (grep(/^\Q$user\E$/, at custommanagers)) {
@@ -6510,6 +6510,15 @@
                 document.getElementById('showcolstart').checked = false;
                 document.getElementById('showcolend').checked = false;
             }
+            if (context == 'author') {
+                if (document.studentform.Status.options[document.studentform.Status.selectedIndex].value == 'Expired') {
+                    document.getElementById('showcolmanager').checked = false;
+                    document.getElementById('showcolmanager').disabled = 'disabled';
+                } else if (document.studentform.showrole.options[document.studentform.showrole.selectedIndex].value != 'aa') {
+                    document.getElementById('showcolmanager').checked = true;
+                    document.getElementById('showcolmanager').disabled = '';
+                }
+            }
         }
     }
     if (caller == 'output') {
@@ -6595,6 +6604,15 @@
                 }
             }
         }
+        if (context == 'author') {
+            if (document.studentform.showrole.options[document.studentform.showrole.selectedIndex].value == 'aa') {
+                document.getElementById('showcolmanager').checked = false;
+                document.getElementById('showcolmanager').disabled = 'disabled';
+            } else if (document.studentform.Status.options[document.studentform.Status.selectedIndex].value != 'Expired') {
+                document.getElementById('showcolmanager').checked = true;
+                document.getElementById('showcolmanager').disabled = '';
+            }
+        }
     }
     return;
 }
@@ -6900,7 +6918,7 @@
              linktitle => 'View change log.',
             },
             {
-             linktext => 'Co-authors who can add/revoke co-author roles',
+             linktext => 'Co-author Managers',
              icon => 'helpdesk-access.png',
              #help => 'Coauthor_Management',
              url => '/adm/createuser?action=camanagers',
@@ -6908,7 +6926,7 @@
              linktitle => 'Assign/Revoke right to manage co-author roles',
             },
             {
-             linktext => 'Configure coauthor-viewable listing',
+             linktext => 'Configure Coauthor Listing',
              icon => 'helpdesk-access.png',
              #help => 'Coauthor_Settings',
              url => '/adm/createuser?action=calist&forceedit=1',
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.218 loncom/interface/lonuserutils.pm:1.219
--- loncom/interface/lonuserutils.pm:1.218	Fri Nov  3 01:12:15 2023
+++ loncom/interface/lonuserutils.pm	Sat Nov  4 00:06:00 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.218 2023/11/03 01:12:15 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.219 2023/11/04 00:06:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2632,7 +2632,10 @@
             push(@cols,'photo');
         }
         if ($context eq 'domain') {
-            push (@cols,('authorusage','authorquota','extent'));
+            push(@cols,('authorusage','authorquota','extent'));
+        }
+        if ($context eq 'author') {
+            push(@cols,'manager');
         }
     }
     return @cols;
@@ -2673,6 +2676,11 @@
             } elsif ($env{'form.roletype'} eq 'domain') {
                 $disabledchk{'extent'} = 1; 
             }
+        } elsif ($context eq 'author') {
+            if (($env{'form.Status'} eq 'Expired') ||
+                ($env{'form.showrole'} eq 'aa')) {
+                $disabledchk{'manager'} = 1;
+            }
         }
     }
     my $numposs = scalar(@cols);
@@ -2764,6 +2772,7 @@
         'ca'         => "check all",
         'ua'         => "uncheck all",
         'clicker'    => "clicker-ID",
+        'manager'    => "co-author manager",
     );
     if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
         $lt{'extent'} = &mt('course(s): description, section(s), status');
@@ -3048,6 +3057,7 @@
     $index->{'instsec'} = &Apache::loncoursedata::CL_INSTSEC();
     $index->{'authorquota'} = &Apache::loncoursedata::CL_AUTHORQUOTA();
     $index->{'authorusage'} = &Apache::loncoursedata::CL_AUTHORUSAGE();
+    $index->{'manager'} = &Apache::loncoursedata::CL_CAMANAGER();
     foreach my $key (keys(%{$index})) {
         $keylist->[$index->{$key}] = $key;
     }
@@ -3122,6 +3132,9 @@
             (($env{'form.showrole'} eq 'Any') || ($env{'form.showrole'} eq 'au'))) {
             push(@sortable,('authorusage','authorquota'));
         }
+        if ($context eq 'author') {
+            push(@sortable,'manager');
+        }
     }
     if ($mode eq 'pickauthor') {
         @sortable = ('username','fullname','email','status');
@@ -3439,6 +3452,7 @@
     foreach my $idx (@$keylist) {
         $index{$idx} = $i++;
     }
+    my $now = time;
     my $usercount = 0;
     my ($secfilter,$grpfilter);
     if ($context eq 'course') {
@@ -3456,10 +3470,12 @@
                                                 Future  => 'Future',
                                                 Expired => 'Expired',
                                                );
-    # If this is for a single course get last course "log-in".
-    my %crslogins;
+    my (%crslogins,%camanagers);
     if ($context eq 'course') {
+        # If this is for a single course get last course "log-in".
         %crslogins=&Apache::lonnet::dump('nohist_crslastlogin',$cdom,$cnum);
+    } elsif ($context eq 'author') {
+        map { $camanagers{$_.':ca'} = 1; } split(/,/,$env{'environment.authormanagers'});
     }
     # Get groups, role, permanent e-mail so we can sort on them if
     # necessary.
@@ -3559,6 +3575,16 @@
                 }
             }
         }
+        if ($context eq 'author') {
+            if (($camanagers{$user}) &&
+                ((!defined($userlist->{$user}->[$index{'end'}])) ||
+                 ($userlist->{$user}->[$index{'end'}] == 0) ||
+                 ($userlist->{$user}->[$index{'end'}] > $now))) {
+                $userlist->{$user}->[$index{'manager'}] = &mt('Yes');
+            } else {
+                $userlist->{$user}->[$index{'manager'}] = &mt('No');
+            }
+        }
         my %emails   = &Apache::loncommon::getemails($uname,$udom);
         if ($emails{'permanentemail'} =~ /\S/) {
             $userlist->{$user}->[$index{'email'}] = $emails{'permanentemail'};
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.208 loncom/interface/loncoursedata.pm:1.209
--- loncom/interface/loncoursedata.pm:1.208	Thu Sep 16 16:02:41 2021
+++ loncom/interface/loncoursedata.pm	Sat Nov  4 00:06:00 2023
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.208 2021/09/16 16:02:41 raeburn Exp $
+# $Id: loncoursedata.pm,v 1.209 2023/11/04 00:06:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2619,6 +2619,7 @@
 sub CL_THUMBNAIL { return 17; }
 sub CL_AUTHORQUOTA { return 18; }
 sub CL_AUTHORUSAGE { return 19; }
+sub CL_CAMANAGER {return 20; }
 
 sub get_classlist {
     my ($cdom,$cnum) = @_;


More information about the LON-CAPA-cvs mailing list