[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm /interface lonnavdisplay.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 20 Oct 2008 03:25:53 -0000


raeburn		Sun Oct 19 23:25:53 2008 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
    /loncom/interface	lonnavdisplay.pm 
  Log:
  - "Re-initialize" button in roles screen no longer restricted to advanced users.
  - Show appropriate message on roles screen when navmap object could not be created because inactivity caused deletion of $user_$course.db and/or $user_$course_params.db from lonDaemns/tmp directory.
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.208 loncom/auth/lonroles.pm:1.209
--- loncom/auth/lonroles.pm:1.208	Tue Oct  7 23:37:20 2008
+++ loncom/auth/lonroles.pm	Sun Oct 19 23:25:48 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.208 2008/10/08 03:37:20 raeburn Exp $
+# $Id: lonroles.pm,v 1.209 2008/10/20 03:25:48 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -483,6 +483,8 @@
     my $advanced=$env{'user.adv'};
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['tryagain']);
     my $tryagain=$env{'form.tryagain'};
+    my $reinit=$env{'user.reinit'};
+    delete $env{'user.reinit'};
 
 # -------------------------------------------------------- Generate Page Output
 # --------------------------------------------------------------- Error Header?
@@ -512,10 +514,16 @@
 					&Apache::lonenc::check_encrypt($fn));
     } else {
         if ($env{'user.error.msg'}) {
-	    $r->print(
+            if ($reinit) {
+                $r->print(
+ '<h3><span class="LC_error">'.
+ &mt('As your session file for the course has expired, you will need to re-select the course.').'</span></h3>');
+            } else {
+	        $r->print(
  '<h3><span class="LC_error">'.
  &mt('You need to choose another user role or enter a specific course for this function').'</span></h3>');
-	}
+	    }
+        }
     }
 # -------------------------------------------------------- Choice or no choice?
     if ($nochoose) {
@@ -689,7 +697,7 @@
                     $twhere=&mt('system wide');
 		    $sortkey=$role.$twhere;
                 }
-                $roletext.=&build_roletext($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver);
+                $roletext.=&build_roletext($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver,$reinit);
 		$roletext{$envkey}=$roletext;
 		if (!$sortkey) {$sortkey=$twhere."\0".$envkey;}
 		$sortrole{$sortkey}=$envkey;
@@ -988,7 +996,7 @@
 }
 
 sub build_roletext {
-    my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver) = @_;
+    my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver,$reinit) = @_;
     my $roletext='<tr bgcolor="'.$tbg.'" class="LC_rolesmenu_'.$tstatus.'">';
     my $is_dc=($trolecode =~ m/^dc\./);
     my $rowspan=($is_dc) ? ''
@@ -1018,8 +1026,16 @@
                 '<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'.
                 &mt('Re-Initialize').'" onClick="javascript:enterrole(this.form,\''.
                         $trolecode."','".$buttonname.'\');" /></td>';
+        } elsif ($reinit) {
+            $roletext.= 
+                '<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'.
+                &mt('Re-Select').'" onClick="javascript:enterrole(this.form,\''.
+                        $trolecode."','".$buttonname.'\');" /></td>';
         } else {
-            $roletext.='<td'.$rowspan.'>&nbsp;</td>';
+            $roletext.=
+                '<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'.
+                &mt('Re-Initialize').'" onClick="javascript:enterrole(this.form,\''.
+                        $trolecode."','".$buttonname.'\');" /></td>';
         }
     }
     if ($trolecode !~ m/^(dc|ca|au|aa)\./) {
Index: loncom/interface/lonnavdisplay.pm
diff -u loncom/interface/lonnavdisplay.pm:1.4 loncom/interface/lonnavdisplay.pm:1.5
--- loncom/interface/lonnavdisplay.pm:1.4	Fri Apr 11 09:17:09 2008
+++ loncom/interface/lonnavdisplay.pm	Sun Oct 19 23:25:49 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavdisplay.pm,v 1.4 2008/04/11 13:17:09 bisitz Exp $
+# $Id: lonnavdisplay.pm,v 1.5 2008/10/20 03:25:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -133,6 +133,7 @@
     if (!defined($navmap)) {
         my $requrl = $r->uri;
         $env{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized";
+        $env{'user.reinit'} = 1;
         return HTTP_NOT_ACCEPTABLE;
     }
     $r->send_http_header;