[LON-CAPA-cvs] cvs: loncom /interface lonpreferences.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 23 Jan 2007 04:09:04 -0000


albertel		Mon Jan 22 23:09:04 2007 EDT

  Modified files:              
    /loncom/interface	lonpreferences.pm 
  Log:
  - bug 5129, use course for purely studnet users (not role)
  
  
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.95 loncom/interface/lonpreferences.pm:1.96
--- loncom/interface/lonpreferences.pm:1.95	Wed Dec  6 17:22:37 2006
+++ loncom/interface/lonpreferences.pm	Mon Jan 22 23:09:03 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.95 2006/12/06 22:22:37 albertel Exp $
+# $Id: lonpreferences.pm,v 1.96 2007/01/23 04:09:03 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -280,6 +280,8 @@
 ################################################################
 sub rolesprefchanger {
     my $r = shift;
+    my $role    = ($env{'user.adv'} ? 'Role' : 'Course');
+    my $lc_role = ($env{'user.adv'} ? 'role' : 'course');
     my $user       = $env{'user.name'};
     my $domain     = $env{'user.domain'};
     my %userenv = &Apache::lonnet::get
@@ -314,8 +316,8 @@
         $roles_check_list .=
 	    &Apache::loncommon::start_data_table().
 	    &Apache::loncommon::start_data_table_header_row().
-	    "<th>".&mt('Freeze Role')."</th>".
-	    "<th>".&mt('Role')."</td>".
+	    "<th>".&mt('Freeze '.$role)."</th>".
+	    "<th>".&mt($role)."</td>".
 	    &Apache::loncommon::end_data_table_header_row().
 	    "\n";
 	my $count;
@@ -339,17 +341,17 @@
     }
 
     $r->print('
-<p>'.&mt('Some LON-CAPA users have a long list of roles. The Recent Roles Hotlist feature keeps track of the last N roles which have been visited and places a table of these at the top of the roles page. People with very few roles should leave this feature disabled.').'
+<p>'.&mt('Some LON-CAPA users have a long list of '.$lc_role.'s. The Recent '.$role.'s Hotlist feature keeps track of the last N '.$lc_role.'s which have been visited and places a table of these at the top of the '.$lc_role.'s page. People with very few '.$lc_role.'s should leave this feature disabled.').'
 </p>
 <form name="prefs" action="/adm/preferences" method="POST">
 <input type="hidden" name="action" value="verify_and_change_rolespref" />
-<br /><label>'.&mt('Enable Recent Roles Hotlist:').'
+<br /><label>'.&mt('Enable Recent '.$role.'s Hotlist:').'
 <input type="checkbox" '.$checked.' name="recentroles" value="true" /></label>
-<br />'.&mt('Number of roles in Hotlist:').'
+<br />'.&mt('Number of '.$role.'s in Hotlist:').'
 <select name="recentrolesn" size="1">
 '.$options.'
 </select>
-<p>'.&mt('This list below can be used to <q>freeze</q> roles on your screen. Those marked as frozen will not be removed from the list, even if they have not been used recently.').'
+<p>'.&mt('This list below can be used to <q>freeze</q> '.$lc_role.'s on your screen. Those marked as frozen will not be removed from the list, even if they have not been used recently.').'
 </p>
 '.$roles_check_list.'
 <br />
@@ -389,6 +391,7 @@
 
 sub verify_and_change_rolespref {
     my $r = shift;
+    my $role = ($env{'user.adv'} ? 'Role' : 'Course');
     my $user       = $env{'user.name'};
     my $domain     = $env{'user.domain'};
 # Recent Roles Hotlist Flag
@@ -398,18 +401,18 @@
     if ($hotlist_flag) {
         &Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag});
         &Apache::lonnet::appenv('environment.recentroles' => $hotlist_flag);
-        $message=&mt('Recent Roles Hotlist is Enabled');
+        $message=&mt('Recent '.$role.'s Hotlist is Enabled');
     } else {
         &Apache::lonnet::del('environment',['recentroles']);
         &Apache::lonnet::delenv('environment\.recentroles');
-        $message=&mt('Recent Roles Hotlist is Disabled');
+        $message=&mt('Recent '.$role.'s Hotlist is Disabled');
     }
     if ($hotlist_n) {
         &Apache::lonnet::put('environment',{'recentrolesn' => $hotlist_n});
         &Apache::lonnet::appenv('environment.recentrolesn' => $hotlist_n);
         if ($hotlist_flag) {
             $message.="<br />".
-		&mt('Display [_1] Most Recent Roles',$hotlist_n)."\n";
+		&mt('Display [_1] Most Recent '.$role.'s',$hotlist_n)."\n";
         }
     }
 
@@ -431,7 +434,7 @@
 # Unset any roles that were previously frozen but aren't in list
     foreach my $role_key (sort(keys(%recent_roles))) {
         if (($frozen_roles{$role_key}) && (!exists($freeze{$role_key}))) {
-	    $message .= "<br />".&mt('Unfreezing Role: [_1]',$role_text{$role_key})."\n";
+	    $message .= "<br />".&mt('Unfreezing '.$role.': [_1]',$role_text{$role_key})."\n";
 	    &Apache::lonhtmlcommon::store_recent('roles',$role_key,' ',0);
         }
     }
@@ -439,7 +442,7 @@
 # Freeze selected roles
     foreach my $role_key (@freeze_list) {
         if (!$frozen_roles{$role_key}) {
-             $message .= "<br />".&mt('Freezing Role: [_1]',$role_text{$role_key})."\n";
+             $message .= "<br />".&mt('Freezing '.$role.': [_1]',$role_text{$role_key})."\n";
              &Apache::lonhtmlcommon::store_recent('roles',
                                           $role_key,' ',1);
         }
@@ -1421,20 +1424,21 @@
                       printmenu => 'yes',
                       subroutine => \&verify_and_change_discussion, }
                     ));
-                       
+
+    my $role = ($env{'user.adv'} ? 'Roles' : 'Course');
     push (@Options,({ action   => 'changerolespref',
-                      linktext => 'Change Roles Page Preferences',
+                      linktext => 'Change '.$role.' Page Preferences',
                       href     => '/adm/preferences',
                       subroutine => \&rolesprefchanger,
                       breadcrumb =>
                           { href => '/adm/preferences?action=changerolespref',
-                            text => 'Change Roles Pref'},
+                            text => 'Change '.$role.' Page Pref'},
                       },
                     { action   => 'verify_and_change_rolespref',
                       subroutine => \&verify_and_change_rolespref,
                       breadcrumb =>
                           { href => '/adm/preferences?action=changerolespref',
-                            text => 'Change Roles Preferences'},
+                            text => 'Change '.$role.' Page Preferences'},
                       printmenu => 'yes',
                       }));