Diff for /loncom/interface/lonpreferences.pm between versions 1.131 and 1.155

version 1.131, 2008/12/08 23:09:26 version 1.155, 2009/04/29 16:57:29
Line 101  sub wysiwygchanger { Line 101  sub wysiwygchanger {
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changewysiwyg',      { href => '/adm/preferences?action=changewysiwyg',
                 text => 'Change WYSIWYG Preferences'});                  text => 'Change WYSIWYG Preferences'});
     $r->print(Apache::loncommon::start_page('Change WYSIWYG Preferences'));      $r->print(Apache::loncommon::start_page('Content Display Settings'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change WYSIWYG Preferences'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Change WYSIWYG Preferences'));
   
     my %userenv = &Apache::lonnet::get      my %userenv = &Apache::lonnet::get
Line 126  $warning Line 126  $warning
 <label><input type="radio" name="wysiwyg" value="off" $onselect /> $switchoff</label><br />  <label><input type="radio" name="wysiwyg" value="off" $onselect /> $switchoff</label><br />
 <label><input type="radio" name="wysiwyg" value="on" $offselect /> $switchon</label>  <label><input type="radio" name="wysiwyg" value="on" $offselect /> $switchon</label>
 ENDLSCREEN  ENDLSCREEN
     $r->print('<br /><input type="submit" value="'.&mt('Change').'" />');      $r->print('<br /><input type="submit" value="'.&mt('Save').'" />');
 }  }
   
   
Line 135  sub verify_and_change_wysiwyg { Line 135  sub verify_and_change_wysiwyg {
     my $newsetting=$env{'form.wysiwyg'};      my $newsetting=$env{'form.wysiwyg'};
     &Apache::lonnet::put('environment',{'wysiwygeditor' => $newsetting});      &Apache::lonnet::put('environment',{'wysiwygeditor' => $newsetting});
     &Apache::lonnet::appenv({'environment.wysiwygeditor' => $newsetting});      &Apache::lonnet::appenv({'environment.wysiwygeditor' => $newsetting});
 #   $r->print('<p>'.&mt('Setting WYSIWYG editor to:').' '.&mt($newsetting).'</p>');      &print_main_menu($r,'<p>'.&Apache::lonhtmlcommon::confirm_success(&mt('Setting WYSIWYG editor to:').' '
     print_main_menu($r,'<p>'.&mt('Setting WYSIWYG editor to:').' '   .&mt($newsetting)).'</p>');
  .&mt($newsetting).'</p>');  
 }  }
   
 ################################################################  ################################################################
Line 149  sub languagechanger { Line 148  sub languagechanger {
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changelanguages',      { href => '/adm/preferences?action=changelanguages',
                 text => 'Change Language'});                  text => 'Change Language'});
     $r->print(Apache::loncommon::start_page('Change Language'));      $r->print(Apache::loncommon::start_page('Content Display Settings'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Language'));       $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Language')); 
     my $user       = $env{'user.name'};      my $user       = $env{'user.name'};
     my $domain     = $env{'user.domain'};      my $domain     = $env{'user.domain'};
Line 172  sub languagechanger { Line 171  sub languagechanger {
 <input type="hidden" name="action" value="verify_and_change_languages" />  <input type="hidden" name="action" value="verify_and_change_languages" />
 <br />$pref: $selectionbox  <br />$pref: $selectionbox
 ENDLSCREEN  ENDLSCREEN
     $r->print('<br /><input type="submit" value="'.&mt('Change').'" />');      $r->print('<br /><input type="submit" value="'.&mt('Save').'" />');
 }  }
   
   
Line 187  sub verify_and_change_languages { Line 186  sub verify_and_change_languages {
     if ($newlanguage) {      if ($newlanguage) {
         &Apache::lonnet::put('environment',{'languages' => $newlanguage});          &Apache::lonnet::put('environment',{'languages' => $newlanguage});
         &Apache::lonnet::appenv({'environment.languages' => $newlanguage});          &Apache::lonnet::appenv({'environment.languages' => $newlanguage});
         $message=&mt('Set new preferred languages to ').'<tt>"'.$newlanguage.'"</tt>.';          $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set new preferred languages to ').'<tt>"'.$newlanguage.'"</tt>.');
     } else {      } else {
         &Apache::lonnet::del('environment',['languages']);          &Apache::lonnet::del('environment',['languages']);
         &Apache::lonnet::delenv('environment\.languages');          &Apache::lonnet::delenv('environment.languages');
         $message=&mt('Reset preferred language.');          $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset preferred language.'));
     }      }
     print_main_menu($r, $message);      &Apache::loncommon::flush_langs_cache($user,$domain);
 #    $r->print(<<ENDVCSCREEN);      &print_main_menu($r, $message);
 #$message  
 #ENDVCSCREEN  
 }  }
   
 ################################################################  ################################################################
Line 207  sub texenginechanger { Line 204  sub texenginechanger {
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changetexenginepref',      { href => '/adm/preferences?action=changetexenginepref',
                 text => 'Change How Math Equations Are Displayed'});                  text => 'Change How Math Equations Are Displayed'});
     $r->print(Apache::loncommon::start_page('Change How Math Equations Are Displayed'));      $r->print(Apache::loncommon::start_page('Content Display Settings'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change How Math Equations Are Displayed'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Change How Math Equations Are Displayed'));
     my $user       = $env{'user.name'};      my $user       = $env{'user.name'};
     my $domain     = $env{'user.domain'};      my $domain     = $env{'user.domain'};
Line 226  sub texenginechanger { Line 223  sub texenginechanger {
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
       'headline' => 'Change Math Preferences',        'headline' => 'Change Math Preferences',
       'preftxt'  => 'Preferred method to display Math',        'preftxt'  => 'Preferred method to display Math',
       'change'   => 'Change',        'change'   => 'Save',
       'exmpl'    => 'Examples',        'exmpl'    => 'Examples',
       'jsmath'   => 'jsMath:',        'jsmath'   => 'jsMath:',
       'tth'      => 'tth (TeX to HTML):',        'tth'      => 'tth (TeX to HTML):',
Line 238  sub texenginechanger { Line 235  sub texenginechanger {
 <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_texengine" />  <input type="hidden" name="action" value="verify_and_change_texengine" />
 <p>  <p>
 $lt{'preftxt'}:<br />  $lt{'preftxt'}: $selectionbox 
 $selectionbox <input type="submit" value="$lt{'change'}" />  <br />
   <input type="submit" value="$lt{'change'}" />
 </p>  </p>
 </form>  </form>
 <br />  <br />
Line 249  $lt{'exmpl'} Line 247  $lt{'exmpl'}
 <h3>$lt{'jsmath'}</h3>   <h3>$lt{'jsmath'}</h3> 
 <p>  <p>
 $jsMath_start  $jsMath_start
 <script type="text/javascript">  <script type="text/javascript" language="JavaScript">
 if (jsMath.nofonts == 1) {  if (jsMath.nofonts == 1) {
     document.writeln      document.writeln
         ('<div style="padding: 10; border-style: solid; border-width:3;'          ('<div style="padding: 10; border-style: solid; border-width:3;'
Line 279  if (jsMath.nofonts == 1) { Line 277  if (jsMath.nofonts == 1) {
 </p>  </p>
 ENDLSCREEN  ENDLSCREEN
     if ($env{'environment.texengine'} ne 'jsMath') {      if ($env{'environment.texengine'} ne 'jsMath') {
  $r->print('<script type="text/javascript">jsMath.Process()</script>');   $r->print('<script type="text/javascript" language="JavaScript">jsMath.Process()</script>');
     }      }
 }  }
   
Line 302  sub verify_and_change_texengine { Line 300  sub verify_and_change_texengine {
     if ($newtexengine) {      if ($newtexengine) {
         &Apache::lonnet::put('environment',{'texengine' => $newtexengine});          &Apache::lonnet::put('environment',{'texengine' => $newtexengine});
         &Apache::lonnet::appenv({'environment.texengine' => $newtexengine});          &Apache::lonnet::appenv({'environment.texengine' => $newtexengine});
         $message=&mt('Set new preferred math display to ').'<tt>"'.$newtexengine.'"</tt>.';          $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set new preferred math display to ').'<tt>"'.$newtexengine.'"</tt>.');
     } else {      } else {
         &Apache::lonnet::del('environment',['texengine']);          &Apache::lonnet::del('environment',['texengine']);
         &Apache::lonnet::delenv('environment\.texengine');          &Apache::lonnet::delenv('environment.texengine');
         $message=&mt('Reset preferred math display.');          $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset preferred math display.'));
     }      }
       &print_main_menu($r, $message);
   
 #    $r->print(<<ENDVCSCREEN);  
 #$message  
 #ENDVCSCREEN  
     print_main_menu($r, $message);  
 }  }
   
 ################################################################  ################################################################
Line 330  sub rolesprefchanger { Line 323  sub rolesprefchanger {
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changerolespref',      { href => '/adm/preferences?action=changerolespref',
                 text => 'Change '.$role.' Page Pref'});                  text => 'Change '.$role.' Page Pref'});
     $r->print(Apache::loncommon::start_page('Change '.$role.' Page Pref'));      $r->print(Apache::loncommon::start_page('Content Display Settings'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change '.$role.' Page Pref'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Change '.$role.' Page Pref'));
     my $hotlist_flag=$userenv{'recentroles'};      my $hotlist_flag=$userenv{'recentroles'};
     my $hotlist_n=$userenv{'recentrolesn'};      my $hotlist_n=$userenv{'recentrolesn'};
Line 401  sub rolesprefchanger { Line 394  sub rolesprefchanger {
 </p>  </p>
 '.$roles_check_list.'  '.$roles_check_list.'
 <br />  <br />
 <input type="submit" value="'.&mt('Change').'" />  <input type="submit" value="'.&mt('Save').'" />
 </form>');  </form>');
 }  }
   
Line 450  sub verify_and_change_rolespref { Line 443  sub verify_and_change_rolespref {
         $message=&mt('Recent '.$role.'s 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 '.$role.'s Hotlist is Disabled');          $message=&mt('Recent '.$role.'s Hotlist is Disabled');
     }      }
     if ($hotlist_n) {      if ($hotlist_n) {
Line 480  sub verify_and_change_rolespref { Line 473  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 />".&Apache::lonhtmlcommon::confirm_success(&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 488  sub verify_and_change_rolespref { Line 481  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 />".
                &Apache::lonhtmlcommon::confirm_success(&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);
         }          }
     }      }
     $message .= "<hr /><br />\n";      $message .= "<hr /><br />\n";
       &print_main_menu($r, $message);
 #    $r->print(<<ENDRPSCREEN);  
 #$message  
 #ENDRPSCREEN  
     print_main_menu($r, $message);  
 }  }
   
   
Line 514  sub screennamechanger { Line 504  sub screennamechanger {
         ('environment',['screenname','nickname']);          ('environment',['screenname','nickname']);
     my $screenname=$userenv{'screenname'};      my $screenname=$userenv{'screenname'};
     my $nickname=$userenv{'nickname'};      my $nickname=$userenv{'nickname'};
     my %lt = &Apache::lonlocal::texthash(  
                                           text_screenname  => 'New screenname (shown if you post anonymously):',  
                                           text_nickname  => 'New nickname (shown if you post non-anonymously):',  
                                           text_submit => 'Change',  
                                         );  
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
  { href => '/adm/preferences?action=changescreenname',   { href => '/adm/preferences?action=changescreenname',
                   text => 'Change Screen Name'});                    text => 'Change Screen Name'});
     $r->print(Apache::loncommon::start_page('Change Screen Name'));      $r->print(Apache::loncommon::start_page('Personal Data'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Screen Name'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Screen Name'));
     $r->print(<<ENDSCREEN);      $r->print('<p>'
 <form name="prefs" action="/adm/preferences" method="post">               .&mt('Change the name that is displayed in your posts.')
 <input type="hidden" name="action" value="verify_and_change_screenname" />               .'</p>'
 <br />$lt{'text_screenname'}      );
 <input type="text" size="20" value="$screenname" name="screenname" />      $r->print('<form name="prefs" action="/adm/preferences" method="post">'
 <br />$lt{'text_nickname'}               .'<input type="hidden" name="action" value="verify_and_change_screenname" />'
 <input type="text" size="20" value="$nickname" name="nickname" />               .&Apache::lonhtmlcommon::start_pick_box()
 <br />               .&Apache::lonhtmlcommon::row_title(&mt('New screenname (shown if you post anonymously)'))
 <input type="submit" value="$lt{'text_submit'}" />               .'<input type="text" size="20" value="'.$screenname.'" name="screenname" />'
 </form>               .&Apache::lonhtmlcommon::row_closure()
 ENDSCREEN               .&Apache::lonhtmlcommon::row_title(&mt('New nickname (shown if you post non-anonymously)'))
                .'<input type="text" size="20" value="'.$nickname.'" name="nickname" />'
                .&Apache::lonhtmlcommon::row_closure()
                .&Apache::lonhtmlcommon::row_title()
                .'<input type="submit" value="'.&mt('Save').'" />'
                .&Apache::lonhtmlcommon::row_closure(1)
                .&Apache::lonhtmlcommon::end_pick_box()
                .'</form>'
       );
 }  }
   
 sub verify_and_change_screenname {  sub verify_and_change_screenname {
Line 548  sub verify_and_change_screenname { Line 541  sub verify_and_change_screenname {
     if ($newscreen) {      if ($newscreen) {
         &Apache::lonnet::put('environment',{'screenname' => $newscreen});          &Apache::lonnet::put('environment',{'screenname' => $newscreen});
         &Apache::lonnet::appenv({'environment.screenname' => $newscreen});          &Apache::lonnet::appenv({'environment.screenname' => $newscreen});
         $message=&mt('Set new screenname to ').'<tt>"'.$newscreen.'."</tt>.';          $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set new screenname to ').'<tt>"'.$newscreen.'."</tt>.');
     } else {      } else {
         &Apache::lonnet::del('environment',['screenname']);          &Apache::lonnet::del('environment',['screenname']);
         &Apache::lonnet::delenv('environment\.screenname');          &Apache::lonnet::delenv('environment.screenname');
         $message=&mt('Reset screenname.');          $message=&Apache::lonhtmlcommon::confirm_success(&mt('Reset screenname.'));
     }      }
 # Nickname  # Nickname
     $message.='<br />';      $message.='<br />';
Line 561  sub verify_and_change_screenname { Line 554  sub verify_and_change_screenname {
     if ($newscreen) {      if ($newscreen) {
         &Apache::lonnet::put('environment',{'nickname' => $newscreen});          &Apache::lonnet::put('environment',{'nickname' => $newscreen});
         &Apache::lonnet::appenv({'environment.nickname' => $newscreen});          &Apache::lonnet::appenv({'environment.nickname' => $newscreen});
         $message.=&mt('Set new nickname to ').'<tt>"'.$newscreen.'"</tt>.';          $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set new nickname to ').'<tt>"'.$newscreen.'"</tt>.');
     } else {      } else {
         &Apache::lonnet::del('environment',['nickname']);          &Apache::lonnet::del('environment',['nickname']);
         &Apache::lonnet::delenv('environment\.nickname');          &Apache::lonnet::delenv('environment.nickname');
         $message.=&mt('Reset nickname.');          $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset nickname.'));
     }      }
     &Apache::lonnet::devalidate_cache_new('namescache',$user.':'.$domain);      &Apache::lonnet::devalidate_cache_new('namescache',$user.':'.$domain);
 #    $r->print(<<ENDVCSCREEN);      &print_main_menu($r, $message);
 #$message  
 #ENDVCSCREEN  
     print_main_menu($r, $message);  
 }  }
   
 ################################################################  ################################################################
Line 579  sub verify_and_change_screenname { Line 569  sub verify_and_change_screenname {
 ################################################################  ################################################################
 sub iconchanger {  sub iconchanger {
     my $r = shift;      my $r = shift;
     Apache::lonhtmlcommon::add_breadcrumb(      &Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changeicons',      { href => '/adm/preferences?action=changeicons',
                 text => 'Change Main Menu'});                  text => 'Change Main Menu'});
     $r->print(Apache::loncommon::start_page('Change Main Menu'));      $r->print(Apache::loncommon::start_page('Page Display Settings'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Main Menu'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Main Menu'));
   
     my $user       = $env{'user.name'};      my $user       = $env{'user.name'};
Line 603  sub iconchanger { Line 593  sub iconchanger {
     my $useicons=&mt('Use icons and text');      my $useicons=&mt('Use icons and text');
     my $usebuttons=&mt('Use buttons and text');      my $usebuttons=&mt('Use buttons and text');
     my $useicononly=&mt('Use icons only');      my $useicononly=&mt('Use icons only');
     my $change=&mt('Change');      my $change=&mt('Save');
     $r->print(<<ENDSCREEN);      $r->print(<<ENDSCREEN);
 <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_icons" />  <input type="hidden" name="action" value="verify_and_change_icons" />
Line 623  sub verify_and_change_icons { Line 613  sub verify_and_change_icons {
   
     &Apache::lonnet::put('environment',{'icons' => $newicons});      &Apache::lonnet::put('environment',{'icons' => $newicons});
     &Apache::lonnet::appenv({'environment.icons' => $newicons});      &Apache::lonnet::appenv({'environment.icons' => $newicons});
 #    $r->print(&mt('Set menu mode to [_1].',$newicons));      &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success(&mt('Set menu mode to [_1].',$newicons)));
     print_main_menu($r, &mt('Set menu mode to [_1].',$newicons));  
 }  }
   
 ################################################################  ################################################################
Line 633  sub verify_and_change_icons { Line 622  sub verify_and_change_icons {
   
 sub clickerchanger {  sub clickerchanger {
     my $r = shift;      my $r = shift;
     Apache::lonhtmlcommon::add_breadcrumb(      &Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changeclicker',      { href => '/adm/preferences?action=changeclicker',
                 text => 'Register Clicker'});                  text => 'Register Clicker'});
     $r->print(Apache::loncommon::start_page('Register Clicker'));      $r->print(Apache::loncommon::start_page('Other'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Register Clicker'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Register Clicker'));
     my $user       = $env{'user.name'};      my $user       = $env{'user.name'};
     my $domain     = $env{'user.domain'};      my $domain     = $env{'user.domain'};
Line 645  sub clickerchanger { Line 634  sub clickerchanger {
     my $clickers=$userenv{'clickers'};      my $clickers=$userenv{'clickers'};
     $clickers=~s/\,/\n/gs;      $clickers=~s/\,/\n/gs;
     my $text=&mt('Enter response device ("clicker") numbers');      my $text=&mt('Enter response device ("clicker") numbers');
     my $change=&mt('Register');      my $change=&mt('Save');
     my $helplink=&Apache::loncommon::help_open_topic('Clicker_Registration',&mt('Locating your clicker ID'));      my $helplink=&Apache::loncommon::help_open_topic('Clicker_Registration',&mt('Locating your clicker ID'));
     $r->print(<<ENDSCREEN);      $r->print(<<ENDSCREEN);
 <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_clicker" />  <input type="hidden" name="action" value="verify_and_change_clicker" />
 <label>$text $helplink<br />  <label>$helplink<br /><br />$text<br />
 <textarea name="clickers" rows="5" cols="20">$clickers</textarea>  <textarea name="clickers" rows="5" cols="20">$clickers</textarea>
 </label>  </label>
   <br />
 <input type="submit" value="$change" />  <input type="submit" value="$change" />
 </form>  </form>
 ENDSCREEN  ENDSCREEN
Line 671  sub verify_and_change_clicker { Line 661  sub verify_and_change_clicker {
     $newclickers=~s/\,$//;      $newclickers=~s/\,$//;
     &Apache::lonnet::put('environment',{'clickers' => $newclickers});      &Apache::lonnet::put('environment',{'clickers' => $newclickers});
     &Apache::lonnet::appenv({'environment.clickers' => $newclickers});      &Apache::lonnet::appenv({'environment.clickers' => $newclickers});
 #    $r->print(&mt('Registering clickers: [_1]',$newclickers));      &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success(&mt('Registering clickers: [_1]',$newclickers)));
     print_main_menu($r, &mt('Registering clickers: [_1]',$newclickers));  
 }  }
   
 ################################################################  ################################################################
Line 681  sub verify_and_change_clicker { Line 670  sub verify_and_change_clicker {
   
 sub domcoordchanger {  sub domcoordchanger {
     my $r = shift;      my $r = shift;
     Apache::lonhtmlcommon::add_breadcrumb(      &Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changedomcoord',      { href => '/adm/preferences?action=changedomcoord',
                 text => 'Restrict Domain Coordinator Access'});                  text => 'Restrict Domain Coordinator Access'});
     $r->print(Apache::loncommon::start_page('Restrict Domain Coordinator Access'));      $r->print(Apache::loncommon::start_page('Restrict Domain Coordinator Access'));
Line 696  sub domcoordchanger { Line 685  sub domcoordchanger {
     }      }
     my $text=&mt('By default, the Domain Coordinator can enter your construction space.');      my $text=&mt('By default, the Domain Coordinator can enter your construction space.');
     my $construction=&mt('Block access to construction space');      my $construction=&mt('Block access to construction space');
     my $change=&mt('Change');      my $change=&mt('Save');
     $r->print(<<ENDSCREEN);      $r->print(<<ENDSCREEN);
 <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_domcoord" />  <input type="hidden" name="action" value="verify_and_change_domcoord" />
Line 715  sub verify_and_change_domcoord { Line 704  sub verify_and_change_domcoord {
     if ($env{'form.construction'}) { $domcoord{'domcoord.author'}='blocked'; }      if ($env{'form.construction'}) { $domcoord{'domcoord.author'}='blocked'; }
     &Apache::lonnet::put('environment',\%domcoord);      &Apache::lonnet::put('environment',\%domcoord);
     &Apache::lonnet::appenv({'environment.domcoord.author' => $domcoord{'domcoord.author'}});      &Apache::lonnet::appenv({'environment.domcoord.author' => $domcoord{'domcoord.author'}});
 #    $r->print(&mt('Registering Domain Coordinator access restrictions.'));      &print_main_menu($r,&Apache::lonhtmlcommon::confirm_success(&mt('Registering Domain Coordinator access restrictions.')));
     print_main_menu($r, &mt('Registering Domain Coordinator access restrictions.'));  
 }  }
   
 #################################################################  #################################################################
Line 775  sub msgforwardchanger { Line 763  sub msgforwardchanger {
                                           mnot  => 'E-mail Address(es) which should be notified about new LON-CAPA messages',                                            mnot  => 'E-mail Address(es) which should be notified about new LON-CAPA messages',
  # old: 'Message Notification Email Address(es)',   # old: 'Message Notification Email Address(es)',
                                           mnot_exmpl => 'e.g. <tt>joe@doe.com</tt>',                                            mnot_exmpl => 'e.g. <tt>joe@doe.com</tt>',
                                           chg   => 'Change',                                            chg   => 'Save',
                                           email => 'The e-mail address entered in row ',                                            email => 'The e-mail address entered in row ',
                                           notv => 'is not a valid e-mail address',                                            notv => 'is not a valid e-mail address',
                                           toen => "To enter multiple addresses, enter one address at a time, click 'Change' and then add the next one",                                             toen => "To enter multiple addresses, enter one address at a time, click 'Change' and then add the next one", 
                                           prme => 'Back to preferences menu',                                            prme => 'Back',
                                         );                                          );
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changemsgforward',      { href => '/adm/preferences?action=changemsgforward',
  text => 'Change Message Forwarding/Notification'});   text => 'Change Message Forwarding/Notification'});
     $r->print(Apache::loncommon::start_page('Change Message Forwarding/Notification'));      $r->print(Apache::loncommon::start_page('Message Management'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Message Forwarding/Notification'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Message Forwarding/Notification'));
     my $forwardingHelp = &Apache::loncommon::help_open_topic("Prefs_Forwarding");      my $forwardingHelp = &Apache::loncommon::help_open_topic("Prefs_Forwarding");
     my $notificationHelp = &Apache::loncommon::help_open_topic("Prefs_Notification");      my $notificationHelp = &Apache::loncommon::help_open_topic("Prefs_Notification");
Line 793  sub msgforwardchanger { Line 781  sub msgforwardchanger {
     my %allnot = &get_notifications(\%userenv);      my %allnot = &get_notifications(\%userenv);
     my $validatescript = &Apache::lonhtmlcommon::javascript_valid_email();      my $validatescript = &Apache::lonhtmlcommon::javascript_valid_email();
     my $jscript = qq|      my $jscript = qq|
 <script type="text/javascript">  <script type="text/javascript" language="JavaScript">
 function validate() {  function validate() {
     for (var i=0; i<document.prefs.numnotify.value; i++) {      for (var i=0; i<document.prefs.numnotify.value; i++) {
         var checkaddress = 0;          var checkaddress = 0;
Line 951  ENDMSG Line 939  ENDMSG
     $r->print(qq|      $r->print(qq|
 <br /><hr />  <br /><hr />
 <input type="hidden" name="numnotify" value="$num" />  <input type="hidden" name="numnotify" value="$num" />
 <input type="button" value="$lt{'chg'}" onclick="javascript:validate()" />  
 <input type="button" value="$lt{'prme'}" onclick="location.href='/adm/preferences'" />  <input type="button" value="$lt{'prme'}" onclick="location.href='/adm/preferences'" />
   <input type="button" value="$lt{'chg'}" onclick="javascript:validate()" />
 </form>  </form>
 |);  |);
   
Line 998  sub verify_and_change_msgforward { Line 986  sub verify_and_change_msgforward {
                     .'<br />';                      .'<br />';
     } else {      } else {
         &Apache::lonnet::del('environment',['msgforward']);          &Apache::lonnet::del('environment',['msgforward']);
         &Apache::lonnet::delenv('environment\.msgforward');          &Apache::lonnet::delenv('environment.msgforward');
         $message.= &mt("Set message forwarding to 'off'.").'<br />';          $message.= &mt("Set message forwarding to 'off'.").'<br />';
     }      }
     my $critnotification;      my $critnotification;
Line 1038  sub verify_and_change_msgforward { Line 1026  sub verify_and_change_msgforward {
         $message.=&mt('Set non-critical message notification address(es) to ').'<tt>"'.$notification.'"</tt>.<br />';          $message.=&mt('Set non-critical message notification address(es) to ').'<tt>"'.$notification.'"</tt>.<br />';
     } else {      } else {
         &Apache::lonnet::del('environment',['notification']);          &Apache::lonnet::del('environment',['notification']);
         &Apache::lonnet::delenv('environment\.notification');          &Apache::lonnet::delenv('environment.notification');
         $message.=&mt("Set non-critical message notification to 'off'.").'<br />';          $message.=&mt("Set non-critical message notification to 'off'.").'<br />';
     }      }
     if ($critnotification) {      if ($critnotification) {
Line 1047  sub verify_and_change_msgforward { Line 1035  sub verify_and_change_msgforward {
         $message.=&mt('Set critical message notification address(es) to ').'<tt>"'.$critnotification.'"</tt>.<br />';          $message.=&mt('Set critical message notification address(es) to ').'<tt>"'.$critnotification.'"</tt>.<br />';
     } else {      } else {
         &Apache::lonnet::del('environment',['critnotification']);          &Apache::lonnet::del('environment',['critnotification']);
         &Apache::lonnet::delenv('environment\.critnotification');          &Apache::lonnet::delenv('environment.critnotification');
         $message.=&mt("Set critical message notification to 'off'.").'<br />';          $message.=&mt("Set critical message notification to 'off'.").'<br />';
     }      }
     if ($critnotification || $notification) {      if ($critnotification || $notification) {
Line 1057  sub verify_and_change_msgforward { Line 1045  sub verify_and_change_msgforward {
             $message.=&mt('Set address(es) to receive excerpts with html retained ').'<tt>"'.$notify_with_html.'"</tt>.';              $message.=&mt('Set address(es) to receive excerpts with html retained ').'<tt>"'.$notify_with_html.'"</tt>.';
         } else {          } else {
             &Apache::lonnet::del('environment',['notifywithhtml']);              &Apache::lonnet::del('environment',['notifywithhtml']);
             &Apache::lonnet::delenv('environment\.notifywithhtml');              &Apache::lonnet::delenv('environment.notifywithhtml');
             if ($totaladdresses == 1) {              if ($totaladdresses == 1) {
                 $message.=&mt("Set notification address to receive excerpts with html stripped.");                  $message.=&mt("Set notification address to receive excerpts with html stripped.");
             } else {              } else {
Line 1066  sub verify_and_change_msgforward { Line 1054  sub verify_and_change_msgforward {
         }          }
     } else {      } else {
         &Apache::lonnet::del('environment',['notifywithhtml']);          &Apache::lonnet::del('environment',['notifywithhtml']);
         &Apache::lonnet::delenv('environment\.notifywithhtml');          &Apache::lonnet::delenv('environment.notifywithhtml');
     }      }
     if ($message) {      if ($message) {
         $message .= '<br /><hr />';          $message .= '<br /><hr />';
Line 1084  sub colorschanger { Line 1072  sub colorschanger {
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changecolors',      { href => '/adm/preferences?action=changecolors',
                 text => 'Change Colors'});                  text => 'Change Colors'});
     $r->print(Apache::loncommon::start_page('Change Colors'));      $r->print(Apache::loncommon::start_page('Page Display Settings'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Colors'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Colors'));
 # figure out colors  # figure out colors
     my $function=&Apache::loncommon::get_users_function();      my $function=&Apache::loncommon::get_users_function();
Line 1111  sub colorschanger { Line 1099  sub colorschanger {
     }      }
     my $end_data_table = &Apache::loncommon::end_data_table();      my $end_data_table = &Apache::loncommon::end_data_table();
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();      my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
       my $save = &mt('Save');
       my $rstall = &mt('Reset All');
       my $resetdefault = &mt('Reset All Colors to Default');
     $r->print(<<ENDCOL);      $r->print(<<ENDCOL);
 <script type="text/javascript">  <script type="text/javascript" language="JavaScript">
   
     function pclose() {      function pclose() {
         parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",          parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
Line 1149  $start_data_table Line 1140  $start_data_table
 $chtable  $chtable
 $end_data_table  $end_data_table
 </table>  </table>
 <input type="submit" value="Change Custom Colors" />  <input type="submit" value="$save" />
 <input type="submit" name="resetall" value="Reset All Colors to Default" />  <input type="submit" name="resetall" value="$rstall" title="$resetdefault" />
 </form>  </form>
 ENDCOL  ENDCOL
 }  }
Line 1175  sub verify_and_change_colors { Line 1166  sub verify_and_change_colors {
  if (($color=~/^\#[0-9A-Fa-f]{6}$/) && (!$env{'form.resetall'})) {   if (($color=~/^\#[0-9A-Fa-f]{6}$/) && (!$env{'form.resetall'})) {
     &Apache::lonnet::put('environment',{$entry => $color});      &Apache::lonnet::put('environment',{$entry => $color});
     &Apache::lonnet::appenv({'environment.'.$entry => $color});      &Apache::lonnet::appenv({'environment.'.$entry => $color});
     $message.=&mt('Set '.$colortypes{$item}.' to ').'<tt>"'.$color.'"</tt>.<br />';      $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set '.$colortypes{$item}.' to ').'<tt>"'.$color.'"</tt>').'<br />';
  } else {   } else {
     &Apache::lonnet::del('environment',[$entry]);      &Apache::lonnet::del('environment',[$entry]);
     &Apache::lonnet::delenv('environment\.'.$entry);      &Apache::lonnet::delenv('environment.'.$entry);
     $message.=&mt('Reset '.$colortypes{$item}.'.').'<br />';      $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Reset '.$colortypes{$item}.'.')).'<br />';
  }   }
     }      }
     my $now = time;      my $now = time;
     &Apache::lonnet::put('environment',{'color.timestamp' => $now});      &Apache::lonnet::put('environment',{'color.timestamp' => $now});
     &Apache::lonnet::appenv({'environment.color.timestamp' => $now});      &Apache::lonnet::appenv({'environment.color.timestamp' => $now});
   
     print_main_menu($r, $message);      &print_main_menu($r, $message);
 #    $r->print(<<ENDVCCOL);  
 #$message  
 #<form name="client" action="/adm/preferences" method="post">  
 #<input type="hidden" name="action" value="changecolors" />  
 #</form>  
 #ENDVCCOL  
 }  }
   
 ######################################################  ######################################################
Line 1204  sub passwordchanger { Line 1189  sub passwordchanger {
     # Passwords are encrypted using londes.js (DES encryption)      # Passwords are encrypted using londes.js (DES encryption)
     $errormessage = ($errormessage || '');      $errormessage = ($errormessage || '');
     my ($user,$domain,$currentpass,$defdom);      my ($user,$domain,$currentpass,$defdom);
     Apache::lonhtmlcommon::add_breadcrumb(      &Apache::lonhtmlcommon::add_breadcrumb(
  { href => '/adm/preferences?action=changepass',   { href => '/adm/preferences?action=changepass',
                   text => 'Change Password'});                    text => 'Change Password'});
     $r->print(Apache::loncommon::start_page('Change Password'));      unless ($caller eq 'reset_by_email') {
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Password'));          $r->print(Apache::loncommon::start_page('Personal Data'));
           $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Password'));
       }
     if ((!defined($caller)) || ($caller eq 'preferences')) {      if ((!defined($caller)) || ($caller eq 'preferences')) {
         $user = $env{'user.name'};          $user = $env{'user.name'};
         $domain = $env{'user.domain'};          $domain = $env{'user.domain'};
Line 1219  sub passwordchanger { Line 1206  sub passwordchanger {
             $defdom = $r->dir_config('lonDefDomain');              $defdom = $r->dir_config('lonDefDomain');
             my %data = &Apache::lonnet::tmpget($mailtoken);              my %data = &Apache::lonnet::tmpget($mailtoken);
             if (keys(%data) == 0) {              if (keys(%data) == 0) {
                 $r->print(&mt('Sorry, the URL you provided to complete the reset of your password was invalid. Either the token included in the URL has been deleted or the URL you provided was invalid. Please submit a <a href="/adm/resetpw">new request</a> for a password reset, and follow the link to the new URL included in the e-mail that will be sent to you, to allow you to enter a new password.'));                  $r->print(&mt('Sorry, the URL you provided to complete the reset of your password was invalid. Either the token included in the URL has been deleted or the URL you provided was invalid. Please submit a [_1]new request[_2] for a password reset, and follow the link to the new URL included in the e-mail that will be sent to you, to allow you to enter a new password.'
                                ,'<a href="/adm/resetpw">','</a>')
                   );
                 return;                  return;
             }              }
             if (defined($data{time})) {              if (defined($data{time})) {
Line 1288  ENDFORM Line 1277  ENDFORM
 sub jscript_send {  sub jscript_send {
     my ($caller) = @_;      my ($caller) = @_;
     my $output = qq|      my $output = qq|
 <script language="JavaScript">  <script type="text/javascript" language="JavaScript">
   
     function send() {      function send() {
         uextkey=this.document.client.elements.ukey_cpass.value;          uextkey=this.document.client.elements.ukey_cpass.value;
Line 1334  sub client_form { Line 1323  sub client_form {
                 'currentpass' => 'Current Password',                  'currentpass' => 'Current Password',
                 'newpass' => 'New Password',                  'newpass' => 'New Password',
                 'confirmpass' => 'Confirm Password',                  'confirmpass' => 'Confirm Password',
                 'changepass' => 'Change Password');                  'changepass' => 'Save');
   
     my $output = qq|      my $output = qq|
 <form name="client" >  <form name="client" >
Line 1368  sub client_form { Line 1357  sub client_form {
 <tr><td class="LC_preferences_labeltext"><label for="newpass_2">$lt{'confirmpass'}</label></td>  <tr><td class="LC_preferences_labeltext"><label for="newpass_2">$lt{'confirmpass'}</label></td>
     <td><input type="password" name="newpass_2" size="10"  /> </td></tr>      <td><input type="password" name="newpass_2" size="10"  /> </td></tr>
 <tr><td colspan="2" align="center">  <tr><td colspan="2" align="center">
     <input type="button" value="$lt{'changepass'}" onClick="send();">      <input type="button" value="$lt{'changepass'}" onClick="send();" />
 </table>  </table>
 <input type="hidden" name="ukey_cpass"  value="$hexkey->{'ukey_cpass'}" />  <input type="hidden" name="ukey_cpass"  value="$hexkey->{'ukey_cpass'}" />
 <input type="hidden" name="lkey_cpass"  value="$hexkey->{'lkey_cpass'}" />  <input type="hidden" name="lkey_cpass"  value="$hexkey->{'lkey_cpass'}" />
Line 1544  ENDERROR Line 1533  ENDERROR
     # Inform the user the password has (not?) been changed      # Inform the user the password has (not?) been changed
     my $message;      my $message;
     if ($result =~ /^ok$/) {      if ($result =~ /^ok$/) {
         $message = &mt('The password for [_1] was successfully changed',$user);          $message = &Apache::lonhtmlcommon::confirm_success(&mt('The password for [_1] was successfully changed.',$user));
         print_main_menu($r, $message);          if ($caller eq 'reset_by_email') {
 # $r->print("<h3>".&mt('The password for [_1] was successfully changed',$user)."</h3>");              $r->print($message.'<br />');
           } else {
               &print_main_menu($r, $message);
           }
     } else {      } else {
  # error error: run in circles, scream and shout   # error error: run in circles, scream and shout
         $message = &mt("The password for [_1] was not changed",$user)          $message = &Apache::lonhtmlcommon::confirm_success(
  .&mt('Please make sure your old password was entered correctly.');            &mt("The password for [_1] was not changed.",$user).' '.&mt('Please make sure your old password was entered correctly.'),1);
         print_main_menu($r, $message);          unless ($caller eq 'reset_by_email') {
 #        $r->print("<h3><span class='LC_error'>".&mt("The password for [_1] was not changed",$user)."</span></h3>".              &print_main_menu($r, $message);
 #                  &mt('Please make sure your old password was entered correctly.'));          }
         return 1;          return 1;
     }      }
     return;      return;
Line 1567  sub discussionchanger { Line 1559  sub discussionchanger {
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changediscussions',      { href => '/adm/preferences?action=changediscussions',
                 text => 'Change Discussion Preferences'});                  text => 'Change Discussion Preferences'});
     $r->print(Apache::loncommon::start_page('Change Discussion Preferences'));      $r->print(Apache::loncommon::start_page('Message Management'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Discussion Preferences'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Discussion Preferences'));
     my $user       = $env{'user.name'};      my $user       = $env{'user.name'};
     my $domain     = $env{'user.domain'};      my $domain     = $env{'user.domain'};
Line 1597  sub discussionchanger { Line 1589  sub discussionchanger {
         'pref' => 'Display Preference',          'pref' => 'Display Preference',
         'curr' => 'Current setting ',          'curr' => 'Current setting ',
         'actn' => 'Action',          'actn' => 'Action',
         'sdpf' => 'Set display preferences for discussion posts for both bulletin boards and individual resources in all your courses.',          'sdpf' => 'Set display preferences for discussion posts for both discussion boards and individual resources in all your courses.',
         'prca' => 'Preferences can be set that determine',          'prca' => 'Preferences can be set that determine',
         'whpo' => 'Which posts are displayed when you display a bulletin board or resource, and',          'whpo' => 'Which posts are displayed when you display a discussion board or resource, and',
         'unwh' => 'Under what circumstances posts are identfied as "New"',          'unwh' => 'Under what circumstances posts are identfied as "New"',
         'allposts' => 'All posts',          'allposts' => 'All posts',
         'unread' => 'New posts only',          'unread' => 'New posts only',
Line 1659  END Line 1651  END
 END  END
     $r->print(&Apache::loncommon::end_data_table_row().      $r->print(&Apache::loncommon::end_data_table_row().
       &Apache::loncommon::end_data_table());        &Apache::loncommon::end_data_table());
     $r->print(<<"END");  
 <br />      $r->print('<br /><br /><input type="submit" name="sub" value="'.&mt('Save').'" /><br /><br />'.&mt('Note').': '.$lt{'thde'}.'</form>');
 <br />  
 <input type="submit" name="sub" value="Save Changes" />  
 <br />  
 <br />  
 Note: $lt{'thde'}  
 </form>  
 END  
 }  }
                                                                                                                                                                                                                                   
 sub verify_and_change_discussion {  sub verify_and_change_discussion {
Line 1684  sub verify_and_change_discussion { Line 1669  sub verify_and_change_discussion {
         } else {          } else {
             $message .= &mt('In discussions: all posts will be displayed.').'<br />';              $message .= &mt('In discussions: all posts will be displayed.').'<br />';
             &Apache::lonnet::del('environment',['discdisplay']);              &Apache::lonnet::del('environment',['discdisplay']);
             &Apache::lonnet::delenv('environment\.discdisplay');              &Apache::lonnet::delenv('environment.discdisplay');
         }          }
     }      }
     if (defined($env{'form.discmark'}) ) {      if (defined($env{'form.discmark'}) ) {
         my $newmark = $env{'form.newmark'};          my $newmark = $env{'form.newmark'};
         if ($newmark eq 'ondisp') {          if ($newmark eq 'ondisp') {
            $message.=&mt('In discussions: new posts will be cease to be identified as "NEW" after display.').'<br />';              $message.=&Apache::lonhtmlcommon::confirm_success(&mt('In discussions: new posts will be cease to be identified as "NEW" after display.')).'<br />';
             &Apache::lonnet::put('environment',{'discmarkread' => $newmark});              &Apache::lonnet::put('environment',{'discmarkread' => $newmark});
             &Apache::lonnet::appenv({'environment.discmarkread' => $newmark});              &Apache::lonnet::appenv({'environment.discmarkread' => $newmark});
         } else {          } else {
             $message.=&mt('In discussions: posts will be identified as "NEW" until marked as read by the reader.').'<br />';              $message.=&Apache::lonhtmlcommon::confirm_success(&mt('In discussions: posts will be identified as "NEW" until marked as read by the reader.')).'<br />';
             &Apache::lonnet::del('environment',['discmarkread']);              &Apache::lonnet::del('environment',['discmarkread']);
             &Apache::lonnet::delenv('environment\.discmarkread');              &Apache::lonnet::delenv('environment.discmarkread');
         }          }
     }      }
 #    $r->print(<<ENDVCSCREEN);      &print_main_menu($r, $message);
 #$message  
 #ENDVCSCREEN  
     print_main_menu($r, $message);  
 }  }
   
 ################################################################  ################################################################
Line 1710  sub verify_and_change_discussion { Line 1692  sub verify_and_change_discussion {
 ################################################################  ################################################################
 sub coursedisplaychanger {  sub coursedisplaychanger {
     my $r = shift;      my $r = shift;
     Apache::lonhtmlcommon::add_breadcrumb(      &Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changecourseinit',      { href => '/adm/preferences?action=changecourseinit',
                 text => 'Change Course Init. Pref.'});                  text => 'Change Course Init. Pref.'});
     $r->print(Apache::loncommon::start_page('Change Course Initialization Preference'));      $r->print(Apache::loncommon::start_page('Change Course Initialization Preference'));
Line 1728  sub coursedisplaychanger { Line 1710  sub coursedisplaychanger {
     $whatsnewselect = '';      $whatsnewselect = '';
         }          }
     }      }
     my %pagenames = (      my %pagenames = &Apache::lonlocal::texthash(
                        firstres => 'First resource',                         firstres => 'First resource',
                        whatsnew => "What's new page",                         whatsnew => "What's New Page",
                     );                      );
     my $whatsnew_off=&mt('Display the [_1] in the course.','<b>first resource</b>');      my $whatsnew_off=&mt('Display the [_1]first resource[_2] in the course.','<b>','</b>');
     my $whatsnew_on=&mt('Display the "[_1]" page - a summary of items in the course which require attention.',"<b>What's New</b>");      my $whatsnew_on=&mt("Display the [_1]What's New Page[_2] - a summary of items in the course which require attention.",'<b>','</b>');
   
     $r->print('<br /><b>'.&mt('Set the default page to be displayed when you select a course role').'</b>&nbsp;'.&mt('(Currently: [_1])',$pagenames{$currvalue}).'<br />'.&mt('The global user preference you set for your courses can be overridden in an individual course by setting a course specific setting via the "[_1]" page in the course',"<i>What's New</i>").'<br /><br />');      $r->print('<br /><b>'
                .&mt('Set the default page to be displayed when you select a course role')
                .'</b>&nbsp;'
                .&mt('(Currently: [_1])',$pagenames{$currvalue})
                .'<br />'
                .&mt("The global user preference you set for your courses can be overridden in an individual course by setting a course specific setting via the [_1]What's New Page[_2] in the course.",'<i>','</i>')
                .'<br /><br />'
       );
     $r->print(<<ENDLSCREEN);      $r->print(<<ENDLSCREEN);
 <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_coursepage" />  <input type="hidden" name="action" value="verify_and_change_coursepage" />
Line 1743  sub coursedisplaychanger { Line 1732  sub coursedisplaychanger {
 <label><input type="radio" name="newdisp" value="firstres" $firstselect /> $whatsnew_off</label><br />  <label><input type="radio" name="newdisp" value="firstres" $firstselect /> $whatsnew_off</label><br />
 <label><input type="radio" name="newdisp" value="whatsnew" $whatsnewselect /> $whatsnew_on</label><input type="hidden" name="refpage" value="$env{'form.refpage'}" />  <label><input type="radio" name="newdisp" value="whatsnew" $whatsnewselect /> $whatsnew_on</label><input type="hidden" name="refpage" value="$env{'form.refpage'}" />
 ENDLSCREEN  ENDLSCREEN
     $r->print('<br /><br /><input type="submit" value="'.&mt('Change').'" />      $r->print('<br /><br /><input type="submit" value="'.&mt('Save').'" />
 </form>');  </form>');
 }  }
   
Line 1756  sub verify_and_change_coursepage { Line 1745  sub verify_and_change_coursepage {
         'ywbt' => 'you will be taken to the start of the course.',          'ywbt' => 'you will be taken to the start of the course.',
         'apwb' => 'a page will be displayed that lists items in the course that may require action from you.',          'apwb' => 'a page will be displayed that lists items in the course that may require action from you.',
         'gtts' => 'Go to the start of the course',          'gtts' => 'Go to the start of the course',
         'dasp' => "Display the What's New page listing course action items",           'dasp' => "Display the What's New Page", 
     );      );
     my $newdisp  = $env{'form.newdisp'};      my $newdisp  = $env{'form.newdisp'};
     $message = '<b>'.$lt{'defs'}.'</b>: '.$lt{'when'}.', ';      $message = '<b>'.$lt{'defs'}.'</b>: '.$lt{'when'}.', ';
Line 1767  sub verify_and_change_coursepage { Line 1756  sub verify_and_change_coursepage {
     } else {      } else {
         $message .= $lt{'apwb'}.'<br />';          $message .= $lt{'apwb'}.'<br />';
         &Apache::lonnet::del('environment',['course_init_display']);          &Apache::lonnet::del('environment',['course_init_display']);
         &Apache::lonnet::delenv('environment\.course_init_display');          &Apache::lonnet::delenv('environment.course_init_display');
     }      }
     my $refpage = $env{'form.refpage'};      my $refpage = $env{'form.refpage'};
     if (($env{'request.course.fn'}) && ($env{'request.course.id'})) {      if (($env{'request.course.fn'}) && ($env{'request.course.id'})) {
Line 1782  sub verify_and_change_coursepage { Line 1771  sub verify_and_change_coursepage {
                         $refpage.'">'.$lt{'dasp'}.'</a></font>';                          $refpage.'">'.$lt{'dasp'}.'</a></font>';
         }          }
     }      }
 #    $r->print(<<ENDVCSCREEN);      &print_main_menu($r, &Apache::lonhtmlcommon::confirm_success($message));
 #$message  
 #<br /><br />  
 #ENDVCSCREEN  
     print_main_menu($r, $message);  
 }  }
   
 sub print_main_menu {  sub print_main_menu {
Line 1806  if (&Apache::lonnet::usertools_access($u Line 1791  if (&Apache::lonnet::usertools_access($u
 my @menu=  my @menu=
     ({ categorytitle=>'Personal Data',      ({ categorytitle=>'Personal Data',
  items =>[   items =>[
     { linktext => 'About Me',      { linktext => 'Personal Information Page',
  url => $aboutmeurl,   url => $aboutmeurl,
  permission => $permissions{'aboutme'},   permission => $permissions{'aboutme'},
  #help => 'Prefs_About_Me',   #help => 'Prefs_About_Me',
Line 1875  my @menu= Line 1860  my @menu=
     },      },
     { categorytitle=>'Message Management',      { categorytitle=>'Message Management',
  items =>[   items =>[
     { linktext => 'Messages & Notifications',      { linktext => 'Messages &amp; Notifications',
  url => '/adm/preferences?action=changemsgforward',   url => '/adm/preferences?action=changemsgforward',
  permission => 'F',   permission => 'F',
  #help => 'Prefs_Messages',   #help => 'Prefs_Messages',
Line 1887  my @menu= Line 1872  my @menu=
  permission => 'F',   permission => 'F',
  #help => 'Change_Discussion_Display',   #help => 'Change_Discussion_Display',
  icon => 'mail-message-new.png',   icon => 'mail-message-new.png',
  linktitle => 'Set display preferences for discussion posts for both bulletin boards and individual resources in all your courses.'   linktitle => 'Set display preferences for discussion posts for both discussion boards and individual resources in all your courses.'
     },      },
  ]   ]
     },      },
     { categorytitle=>'Other',      { categorytitle=>'Other',
  items =>[   items =>[
     { linktext => 'Register Response Devices ("Clickers")',      { linktext => 'Register Response Devices (&quot;Clickers&quot;)',
  url => '/adm/preferences?action=changeclicker',   url => '/adm/preferences?action=changeclicker',
  permission => 'F',   permission => 'F',
  #help => '',   #help => '',
Line 1969  push(@{ $menu[4]->{items} }, { Line 1954  push(@{ $menu[4]->{items} }, {
  });   });
     }         }   
   
     $r->print(&Apache::loncommon::start_page('Change Preferences'));      $r->print(&Apache::loncommon::start_page('My Space'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Preferences'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Preferences'));
     $r->print($message);      $r->print($message);
     $r->print(Apache::lonhtmlcommon::generate_menu(@menu));      $r->print(Apache::lonhtmlcommon::generate_menu(@menu));
Line 1997  sub handler { Line 1982  sub handler {
     Apache::lonhtmlcommon::clear_breadcrumbs();      Apache::lonhtmlcommon::clear_breadcrumbs();
     Apache::lonhtmlcommon::add_breadcrumb      Apache::lonhtmlcommon::add_breadcrumb
         ({href => '/adm/preferences',          ({href => '/adm/preferences',
           text => 'Set User Preferences'});            text => 'Set User Preferences',
             help =>
             'Prefs_About_Me,Prefs_Language,Prefs_Screen_Name_Nickname,Change_Colors,Change_Password,Prefs_Messages,Change_Discussion_Display'});
     if(!exists $env{'form.action'}) {      if(!exists $env{'form.action'}) {
  &print_main_menu($r);      &print_main_menu($r);
     }elsif($env{'form.action'} eq 'changepass'){      }elsif($env{'form.action'} eq 'changepass'){
         &passwordchanger($r);          &passwordchanger($r);
     }elsif($env{'form.action'} eq 'verify_and_change_pass'){      }elsif($env{'form.action'} eq 'verify_and_change_pass'){
Line 2057  sub handler { Line 2044  sub handler {
     }elsif($env{'form.action'} eq 'verify_and_change_coursepage'){      }elsif($env{'form.action'} eq 'verify_and_change_coursepage'){
         &verify_and_change_coursepage($r);          &verify_and_change_coursepage($r);
     }elsif($env{'form.action'} eq 'debugtoggle'){      }elsif($env{'form.action'} eq 'debugtoggle'){
         toggle_debug();          &toggle_debug();
  print_main_menu($r);   &print_main_menu($r);
     }      }
   
     return OK;      return OK;
Line 2143  sub handler2 { Line 2130  sub handler2 {
         '/adm/'.$env{'user.domain'}.'/'.$env{'user.name'}.'/aboutme';          '/adm/'.$env{'user.domain'}.'/'.$env{'user.name'}.'/aboutme';
     push (@Options,{ action => 'none',       push (@Options,{ action => 'none', 
                      linktext =>                       linktext =>
                          q{Edit the 'About Me' Personal Information Screen},                           q{Edit the Personal Information Page},
      help => 'Prefs_About_Me',       help => 'Prefs_About_Me',
                      href => $aboutmeaction});                       href => $aboutmeaction});
     push (@Options,({ action => 'changecolors',      push (@Options,({ action => 'changecolors',
Line 2339  sub handler2 { Line 2326  sub handler2 {
                        }));                         }));
     }      }
   
     if ($env{'user.name'} =~ /^(albertel|fox|foxr|kortemey|korte|raeburn)$/) {      if (($env{'user.name'} =~ /^(albertel|fox|foxr|kortemey|korte|raeburn)$/)
        && ($env{'user.domain'} =~/^(msu|gerd)$/)){
         push (@Options,({ action => 'debugtoggle',          push (@Options,({ action => 'debugtoggle',
                           printmenu => 'yes',                            printmenu => 'yes',
                           subroutine => \&toggle_debug,                            subroutine => \&toggle_debug,
Line 2420  sub handler2 { Line 2408  sub handler2 {
   
 sub toggle_debug {  sub toggle_debug {
     if ($env{'user.debug'}) {      if ($env{'user.debug'}) {
         &Apache::lonnet::delenv('user\.debug');          &Apache::lonnet::delenv('user.debug');
     } else {      } else {
         &Apache::lonnet::appenv({'user.debug' => 1});          &Apache::lonnet::appenv({'user.debug' => 1});
     }      }

Removed from v.1.131  
changed lines
  Added in v.1.155


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