[LON-CAPA-cvs] cvs: loncom(GCI_3) /auth lonroles.pm /interface loncommon.pm

raeburn raeburn@source.lon-capa.org
Sat, 16 Jan 2010 19:57:01 -0000


raeburn		Sat Jan 16 19:57:01 2010 EDT

  Modified files:              (Branch: GCI_3)
    /loncom/interface	loncommon.pm 
    /loncom/auth	lonroles.pm 
  Log:
  - Customization for GCI_3.
    - If user's %env currently has no roles:
       get roles added since log-in with &loncommon::new_user_roles().
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.925.2.8 loncom/interface/loncommon.pm:1.925.2.9
--- loncom/interface/loncommon.pm:1.925.2.8	Sat Jan 16 15:57:51 2010
+++ loncom/interface/loncommon.pm	Sat Jan 16 19:56:54 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.925.2.8 2010/01/16 15:57:51 raeburn Exp $
+# $Id: loncommon.pm,v 1.925.2.9 2010/01/16 19:56:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -10703,6 +10703,7 @@
         next unless ($envkey =~ /^user\.role\./);
         $rolecount ++;
     }
+    my $newrolecount = 0;
     if (!$rolecount) {
         my %userenv;
         foreach my $crstype ('official','unofficial','community') {
@@ -10726,6 +10727,7 @@
             &Apache::lonnet::set_arearole($role,$where,$tstart,$tend,
                                           $env{'user.domain'},$env{'user.name'});
             $userroles{'user.role.'.$spec} = $tstart.'.'.$tend;
+            $newrolecount ++;
             unless (grep(/^\Q$role\E$/,@newroles)) {
                 push(@newroles,$role);
             }
@@ -10746,7 +10748,7 @@
         }
         &Apache::lonnet::appenv(\%userenv);
     }
-    return;
+    return $newrolecount;
 }
 
 # --- Get the symbolic name of a problem and the url
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.240.2.10 loncom/auth/lonroles.pm:1.240.2.11
--- loncom/auth/lonroles.pm:1.240.2.10	Sat Jan 16 15:06:22 2010
+++ loncom/auth/lonroles.pm	Sat Jan 16 19:57:01 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.240.2.10 2010/01/16 15:06:22 raeburn Exp $
+# $Id: lonroles.pm,v 1.240.2.11 2010/01/16 19:57:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -723,6 +723,13 @@
 
     $refresh = $now;
     &Apache::lonnet::appenv({'user.refresh.time'  => $refresh});
+    if (!$countactive && !$countfuture) {
+        if (&Apache::loncommon::new_roles_update()) {
+            ($countactive,$countfuture,$inrole,$possiblerole) =
+                &gather_roles($then,$refresh,$now,$reinit,$nochoose,\%roletext,\%sortrole,
+                              \%roleclass,\%futureroles,\%timezones);
+        }
+    }
     if ($custommenu) {
         if ($env{'form.destinationurl'} eq '/adm/gci_info') {
             $r->print(&gci_info_page()).