Diff for /loncom/interface/lonpreferences.pm between versions 1.95 and 1.98

version 1.95, 2006/12/06 22:22:37 version 1.98, 2007/04/13 13:39:32
Line 280  ENDVCSCREEN Line 280  ENDVCSCREEN
 ################################################################  ################################################################
 sub rolesprefchanger {  sub rolesprefchanger {
     my $r = shift;      my $r = shift;
       my $role    = ($env{'user.adv'} ? 'Role' : 'Course');
       my $lc_role = ($env{'user.adv'} ? 'role' : 'course');
     my $user       = $env{'user.name'};      my $user       = $env{'user.name'};
     my $domain     = $env{'user.domain'};      my $domain     = $env{'user.domain'};
     my %userenv = &Apache::lonnet::get      my %userenv = &Apache::lonnet::get
Line 314  sub rolesprefchanger { Line 316  sub rolesprefchanger {
         $roles_check_list .=          $roles_check_list .=
     &Apache::loncommon::start_data_table().      &Apache::loncommon::start_data_table().
     &Apache::loncommon::start_data_table_header_row().      &Apache::loncommon::start_data_table_header_row().
     "<th>".&mt('Freeze Role')."</th>".      "<th>".&mt('Freeze '.$role)."</th>".
     "<th>".&mt('Role')."</td>".      "<th>".&mt($role)."</td>".
     &Apache::loncommon::end_data_table_header_row().      &Apache::loncommon::end_data_table_header_row().
     "\n";      "\n";
  my $count;   my $count;
Line 339  sub rolesprefchanger { Line 341  sub rolesprefchanger {
     }      }
   
     $r->print('      $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>  </p>
 <form name="prefs" action="/adm/preferences" method="POST">  <form name="prefs" action="/adm/preferences" method="POST">
 <input type="hidden" name="action" value="verify_and_change_rolespref" />  <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>  <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">  <select name="recentrolesn" size="1">
 '.$options.'  '.$options.'
 </select>  </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>  </p>
 '.$roles_check_list.'  '.$roles_check_list.'
 <br />  <br />
Line 389  sub rolespref_get_role_text { Line 391  sub rolespref_get_role_text {
   
 sub verify_and_change_rolespref {  sub verify_and_change_rolespref {
     my $r = shift;      my $r = shift;
       my $role = ($env{'user.adv'} ? 'Role' : 'Course');
     my $user       = $env{'user.name'};      my $user       = $env{'user.name'};
     my $domain     = $env{'user.domain'};      my $domain     = $env{'user.domain'};
 # Recent Roles Hotlist Flag  # Recent Roles Hotlist Flag
Line 398  sub verify_and_change_rolespref { Line 401  sub verify_and_change_rolespref {
     if ($hotlist_flag) {      if ($hotlist_flag) {
         &Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag});          &Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag});
         &Apache::lonnet::appenv('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 {      } else {
         &Apache::lonnet::del('environment',['recentroles']);          &Apache::lonnet::del('environment',['recentroles']);
         &Apache::lonnet::delenv('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) {      if ($hotlist_n) {
         &Apache::lonnet::put('environment',{'recentrolesn' => $hotlist_n});          &Apache::lonnet::put('environment',{'recentrolesn' => $hotlist_n});
         &Apache::lonnet::appenv('environment.recentrolesn' => $hotlist_n);          &Apache::lonnet::appenv('environment.recentrolesn' => $hotlist_n);
         if ($hotlist_flag) {          if ($hotlist_flag) {
             $message.="<br />".              $message.="<br />".
  &mt('Display [_1] Most Recent Roles',$hotlist_n)."\n";   &mt('Display [_1] Most Recent '.$role.'s',$hotlist_n)."\n";
         }          }
     }      }
   
Line 431  sub verify_and_change_rolespref { Line 434  sub verify_and_change_rolespref {
 # Unset any roles that were previously frozen but aren't in list  # Unset any roles that were previously frozen but aren't in list
     foreach my $role_key (sort(keys(%recent_roles))) {      foreach my $role_key (sort(keys(%recent_roles))) {
         if (($frozen_roles{$role_key}) && (!exists($freeze{$role_key}))) {          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);      &Apache::lonhtmlcommon::store_recent('roles',$role_key,' ',0);
         }          }
     }      }
Line 439  sub verify_and_change_rolespref { Line 442  sub verify_and_change_rolespref {
 # Freeze selected roles  # Freeze selected roles
     foreach my $role_key (@freeze_list) {      foreach my $role_key (@freeze_list) {
         if (!$frozen_roles{$role_key}) {          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',               &Apache::lonhtmlcommon::store_recent('roles',
                                           $role_key,' ',1);                                            $role_key,' ',1);
         }          }
Line 513  ENDVCSCREEN Line 516  ENDVCSCREEN
 }  }
   
 ################################################################  ################################################################
   #                     Icon Subroutines                         #
   ################################################################
   sub iconchanger {
       my $r = shift;
       my $user       = $env{'user.name'};
       my $domain     = $env{'user.domain'};
       my %userenv = &Apache::lonnet::get
           ('environment',['icons']);
       my $iconic='checked="checked"';
       my $classic='';
       if ($userenv{'icons'} eq 'classic') {
          $classic='checked="checked"';
          $iconic='';
       }
       my $useicons=&mt('Use icons');
       my $usebuttons=&mt('Use classic buttons');
       my $change=&mt('Change');
       $r->print(<<ENDSCREEN);
   <form name="prefs" action="/adm/preferences" method="post">
   <input type="hidden" name="action" value="verify_and_change_icons" />
   <label><input type="radio" name="menumode" value="iconic" $iconic /> $useicons</label><br />
   <label><input type="radio" name="menumode" value="classic" $classic /> $usebuttons</label><br />
   <input type="submit" value="$change" />
   </form>
   ENDSCREEN
   }
   
   sub verify_and_change_icons {
       my $r = shift;
       my $user       = $env{'user.name'};
       my $domain     = $env{'user.domain'};
       my $newicons  = $env{'form.menumode'};
   
       &Apache::lonnet::put('environment',{'icons' => $newicons});
       &Apache::lonnet::appenv('environment.icons' => $newicons);
       $r->print(&mt('Set menu mode to [_1].',$newicons));
   }
   
   ################################################################
 #         Message Forward                                      #  #         Message Forward                                      #
 ################################################################  ################################################################
   
Line 849  sub client_form { Line 891  sub client_form {
     if ($caller eq 'reset_by_email') {      if ($caller eq 'reset_by_email') {
         $output .= qq|          $output .= qq|
 <tr><td align="right"> E-mail address:                        </td>  <tr><td align="right"> E-mail address:                        </td>
     <td><input type="text" name="email" size="15" /> </td></tr>      <td><input type="text" name="email" size="30" /> </td></tr>
 <tr><td align="right"> Username:                        </td>  <tr><td align="right"> Username:                        </td>
     <td>      <td>
      <input type="text" name="uname" size="10" />       <input type="text" name="uname" size="15" />
      <input type="hidden" name="currentpass" value="$currentpass" />       <input type="hidden" name="currentpass" value="$currentpass" />
     </td></tr>      </td></tr>
 <tr><td align="right"> Domain:                               </td>  <tr><td align="right"> Domain:                               </td>
Line 1337  sub handler { Line 1379  sub handler {
                       }));                        }));
   
     push (@Options,({ action   => 'changemsgforward',      push (@Options,({ action   => 'changemsgforward',
                       linktext => 'Change Message Forwarding and Notification Addresses',                        linktext => 'Change Message Forwarding and Notification Email Addresses',
                       href     => '/adm/preferences',                        href     => '/adm/preferences',
                       help     => 'Prefs_Forwarding',                        help     => 'Prefs_Forwarding',
                       breadcrumb =>                         breadcrumb => 
Line 1421  sub handler { Line 1463  sub handler {
                       printmenu => 'yes',                        printmenu => 'yes',
                       subroutine => \&verify_and_change_discussion, }                        subroutine => \&verify_and_change_discussion, }
                     ));                      ));
                          
       my $role = ($env{'user.adv'} ? 'Roles' : 'Course');
     push (@Options,({ action   => 'changerolespref',      push (@Options,({ action   => 'changerolespref',
                       linktext => 'Change Roles Page Preferences',                        linktext => 'Change '.$role.' Page Preferences',
                       href     => '/adm/preferences',                        href     => '/adm/preferences',
                       subroutine => \&rolesprefchanger,                        subroutine => \&rolesprefchanger,
                       breadcrumb =>                        breadcrumb =>
                           { href => '/adm/preferences?action=changerolespref',                            { href => '/adm/preferences?action=changerolespref',
                             text => 'Change Roles Pref'},                              text => 'Change '.$role.' Page Pref'},
                       },                        },
                     { action   => 'verify_and_change_rolespref',                      { action   => 'verify_and_change_rolespref',
                       subroutine => \&verify_and_change_rolespref,                        subroutine => \&verify_and_change_rolespref,
                       breadcrumb =>                        breadcrumb =>
                           { href => '/adm/preferences?action=changerolespref',                            { href => '/adm/preferences?action=changerolespref',
                             text => 'Change Roles Preferences'},                              text => 'Change '.$role.' Page Preferences'},
                       printmenu => 'yes',                        printmenu => 'yes',
                       }));                        }));
   
Line 1466  sub handler { Line 1509  sub handler {
       }));        }));
     }      }
   
       push (@Options,({ action   => 'changeicons',
                         linktext => 'Change How Main Menu is Displayed',
                         href     => '/adm/preferences',
                         subroutine => \&iconchanger,
                         breadcrumb =>
                             { href => '/adm/preferences?action=changeicons',
                               text => 'Change Main Menu'},
                         },
                       { action   => 'verify_and_change_icons',
                         subroutine => \&verify_and_change_icons,
                         breadcrumb =>
                             { href => '/adm/preferences?action=changeicons',
                               text => 'Change Main Menu'},
                         printmenu => 'yes',
                         }));
   
     if (&Apache::lonnet::allowed('whn',$env{'request.course.id'})      if (&Apache::lonnet::allowed('whn',$env{'request.course.id'})
  || &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/'   || &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/'
     .$env{'request.course.sec'})) {      .$env{'request.course.sec'})) {

Removed from v.1.95  
changed lines
  Added in v.1.98


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>