Diff for /loncom/interface/lonpreferences.pm between versions 1.68 and 1.84

version 1.68, 2005/11/17 16:57:54 version 1.84, 2006/05/08 18:50:27
Line 98  sub wysiwygchanger { Line 98  sub wysiwygchanger {
     my $r = shift;      my $r = shift;
     my %userenv = &Apache::lonnet::get      my %userenv = &Apache::lonnet::get
         ('environment',['wysiwygeditor']);          ('environment',['wysiwygeditor']);
       my $onselect='checked="checked"';
     my $offselect='';      my $offselect='';
     my $onselect='checked="1"';      if ($userenv{'wysiwygeditor'} eq 'on') {
     if ($userenv{'wysiwygeditor'}) {  
  $onselect='';   $onselect='';
  $offselect='checked="1"';   $offselect='checked="checked"';
     }      }
     my $switchoff=&mt('Disable WYSIWYG editor');      my $switchoff=&mt('Disable WYSIWYG editor');
     my $switchon=&mt('Enable WYSIWYG editor');      my $switchon=&mt('Enable WYSIWYG editor');
     $r->print(<<ENDLSCREEN);      $r->print(<<ENDLSCREEN);
 <form name="server" action="/adm/preferences" method="post">  <form name="prefs" action="/adm/preferences" method="POST">
 <input type="hidden" name="action" value="set_wysiwyg" />  <input type="hidden" name="action" value="set_wysiwyg" />
 <br />  <br />
 <label><input type="radio" name="wysiwyg" value="off" $onselect /> $switchoff</label><br />  <label><input type="radio" name="wysiwyg" value="off" $onselect /> $switchoff</label><br />
Line 147  sub languagechanger { Line 147  sub languagechanger {
     my $selectionbox=&Apache::loncommon::select_form($language,'language',      my $selectionbox=&Apache::loncommon::select_form($language,'language',
      %langchoices);       %langchoices);
     $r->print(<<ENDLSCREEN);      $r->print(<<ENDLSCREEN);
 <form name="server" action="/adm/preferences" method="post">  <form name="prefs" action="/adm/preferences" method="POST">
 <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
Line 188  sub texenginechanger { Line 188  sub texenginechanger {
     my $texengine=$userenv{'texengine'};      my $texengine=$userenv{'texengine'};
   
     my $pref=&mt('Preferred method to display Math');      my $pref=&mt('Preferred method to display Math');
     my %mathchoices=('' => 'No Preference',      my %mathchoices=('' => 'Default',
      'tth' => 'TeX to HTML',       'tth' => 'TeX to HTML',
      #'ttm' => 'TeX to MathML',       #'ttm' => 'TeX to MathML',
      'jsMath' => 'jsMath',       'jsMath' => 'jsMath',
Line 201  sub texenginechanger { Line 201  sub texenginechanger {
     $r->print(<<ENDLSCREEN);      $r->print(<<ENDLSCREEN);
 <br />  <br />
   
 <form name="server" 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>$pref: $selectionbox</p>  <p>$pref: $selectionbox</p>
 <p><input type="submit" value="$change" /></p>  <p><input type="submit" value="$change" /></p>
 </form>  </form>
 Examples:  Examples:
 <p> TeX to HTML <br />   <p> TeX to HTML <br /> 
 <iframe src="/res/adm/pages/math_example.tex?buttons=no&mode=tth" width="400" hieght="200"></iframe>  <iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=tth" width="400" hieght="200"></iframe>
 </p>  </p>
 <p>jsMath <br />   <p>jsMath <br /> 
 $jsMath_start  $jsMath_start
Line 228  if (jsMath.nofonts == 1) { Line 228  if (jsMath.nofonts == 1) {
  +'</font></small></div></center>');   +'</font></small></div></center>');
 }  }
 </script>  </script>
 <iframe src="/res/adm/pages/math_example.tex?buttons=no&mode=jsMath" width="400" hieght="200"></iframe>  <iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=jsMath" width="400" hieght="200"></iframe>
   
 </p>  </p>
 <p> Convert to Images <br />  <p> Convert to Images <br />
 <br />  <br />
 <iframe src="/res/adm/pages/math_example.tex?buttons=no&mode=mimetex" width="400" hieght="200"></iframe>  <iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=mimetex" width="400" hieght="200"></iframe>
 </p>  </p>
 ENDLSCREEN  ENDLSCREEN
     if ($env{'environment.texengine'} ne 'jsMath') {      if ($env{'environment.texengine'} ne 'jsMath') {
Line 304  visited and places a table of these at t Line 304  visited and places a table of these at t
 People with very few roles should leave this feature disabled.  People with very few roles should leave this feature disabled.
 </p>  </p>
   
 <form name="server" 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 />Enable Recent Roles Hotlist:  <br /><label>Enable Recent Roles Hotlist:
 <input type="checkbox" $checked name="recentroles" value="true" />  <input type="checkbox" $checked name="recentroles" value="true" /></label>
 <br />Number of roles in Hotlist:  <br />Number of roles in Hotlist:
 <select name="recentrolesn" size="1">  <select name="recentrolesn" size="1">
 $options  $options
Line 362  sub screennamechanger { Line 362  sub screennamechanger {
     my $screenname=$userenv{'screenname'};      my $screenname=$userenv{'screenname'};
     my $nickname=$userenv{'nickname'};      my $nickname=$userenv{'nickname'};
     $r->print(<<ENDSCREEN);      $r->print(<<ENDSCREEN);
 <form name="server" action="/adm/preferences" method="post">  <form name="prefs" action="/adm/preferences" method="POST">
 <input type="hidden" name="action" value="verify_and_change_screenname" />  <input type="hidden" name="action" value="verify_and_change_screenname" />
 <br />New screenname (shown if you post anonymously):  <br />New screenname (shown if you post anonymously):
 <input type="text" size="20" value="$screenname" name="screenname" />  <input type="text" size="20" value="$screenname" name="screenname" />
Line 430  sub msgforwardchanger { Line 430  sub msgforwardchanger {
   
     $r->print(<<ENDMSG);      $r->print(<<ENDMSG);
 $forwardingHelp <br />  $forwardingHelp <br />
 <form name="server" action="/adm/preferences" method="post">  <form name="prefs" action="/adm/preferences" method="POST">
 <input type="hidden" name="action" value="verify_and_change_msgforward" />  <input type="hidden" name="action" value="verify_and_change_msgforward" />
 New Forwarding Address(es) (<tt>user:domain,user:domain,...</tt>):  New Forwarding Address(es) (<tt>user:domain,user:domain,...</tt>):
 <input type="text" size="40" value="$msgforward" name="msgforward" /><hr />  <input type="text" size="40" value="$msgforward" name="msgforward" /><hr />
Line 505  ENDVCMSG Line 505  ENDVCMSG
 sub colorschanger {  sub colorschanger {
     my $r = shift;      my $r = shift;
 # figure out colors  # figure out colors
     my $function='student';      my $function=&Apache::loncommon::get_users_function();
     if ($env{'request.role'}=~/^(cc|in|ta|ep)/) {  
  $function='coordinator';  
     }  
     if ($env{'request.role'}=~/^(su|dc|ad|li)/) {  
  $function='admin';  
     }  
     if (($env{'request.role'}=~/^(au|ca)/) ||  
  ($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) {  
  $function='author';  
     }  
     my $domain=&Apache::loncommon::determinedomain();      my $domain=&Apache::loncommon::determinedomain();
     my %colortypes=('pgbg'  => 'Page Background',      my %colortypes=('pgbg'  => 'Page Background',
                     'tabbg' => 'Header Background',                      'tabbg' => 'Header Background',
Line 524  sub colorschanger { Line 514  sub colorschanger {
                     'link'  => 'Un-Visited Link',                      'link'  => 'Un-Visited Link',
                     'vlink' => 'Visited Link',                      'vlink' => 'Visited Link',
                     'alink' => 'Active Link');                      'alink' => 'Active Link');
       my $start_data_table = &Apache::loncommon::start_data_table();
     my $chtable='';      my $chtable='';
     foreach my $item (sort(keys(%colortypes))) {      foreach my $item (sort(keys(%colortypes))) {
        my $curcol=&Apache::loncommon::designparm($function.'.'.$item,$domain);         my $curcol=&Apache::loncommon::designparm($function.'.'.$item,$domain);
        $chtable.='<tr><td>'.$colortypes{$item}.'</td><td bgcolor="'.$curcol.         $chtable.=&Apache::loncommon::start_data_table_row().
      '<td>'.$colortypes{$item}.'</td><td style="background: '.$curcol.
         '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td><input name="'.$item.          '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td><input name="'.$item.
         '" size="10" value="'.$curcol.          '" size="10" value="'.$curcol.
 '" /></td><td><a href="javascript:pjump('."'color_custom','".$colortypes{$item}.  '" /></td><td><a href="javascript:pjump('."'color_custom','".$colortypes{$item}.
 "','".$curcol."','"  "','".$curcol."','"
     .$item."','parmform.pres','psub'".');">Select</a></td></tr>';      .$item."','parmform.pres','psub'".');">Select</a></td>'.
       &Apache::loncommon::end_data_table_row()."\n";
     }      }
       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();
     $r->print(<<ENDCOL);      $r->print(<<ENDCOL);
 <script>  <script type="text/javascript">
   
     function pclose() {      function pclose() {
         parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",          parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
Line 550  sub colorschanger { Line 544  sub colorschanger {
         pclose();          pclose();
         if (document.parmform.pres_marker.value!='') {          if (document.parmform.pres_marker.value!='') {
             if (document.parmform.pres_type.value!='') {              if (document.parmform.pres_type.value!='') {
                 eval('document.server.'+                  eval('document.prefs.'+
                      document.parmform.pres_marker.value+                       document.parmform.pres_marker.value+
      '.value=document.parmform.pres_value.value;');       '.value=document.parmform.pres_value.value;');
     }      }
Line 567  sub colorschanger { Line 561  sub colorschanger {
 <input type="hidden" name="pres_type" />  <input type="hidden" name="pres_type" />
 <input type="hidden" name="pres_value" />  <input type="hidden" name="pres_value" />
 </form>  </form>
 <form name="server" action="/adm/preferences" method="post">  <form name="prefs" action="/adm/preferences" method="POST">
 <input type="hidden" name="action" value="verify_and_change_colors" />  <input type="hidden" name="action" value="verify_and_change_colors" />
 <table border="2">  $start_data_table
 $chtable  $chtable
   $end_data_table
 </table>  </table>
 <input type="submit" value="Change Custom Colors" />  <input type="submit" value="Change Custom Colors" />
 <input type="submit" name="resetall" value="Reset All Colors to Default" />  <input type="submit" name="resetall" value="Reset All Colors to Default" />
Line 581  ENDCOL Line 576  ENDCOL
 sub verify_and_change_colors {  sub verify_and_change_colors {
     my $r = shift;      my $r = shift;
 # figure out colors  # figure out colors
     my $function='student';      my $function=&Apache::loncommon::get_users_function();
     if ($env{'request.role'}=~/^(cc|in|ta|ep)/) {  
  $function='coordinator';  
     }  
     if ($env{'request.role'}=~/^(su|dc|ad|li)/) {  
  $function='admin';  
     }  
     if (($env{'request.role'}=~/^(au|ca)/) ||  
  ($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) {  
  $function='author';  
     }  
     my $domain=&Apache::loncommon::determinedomain();      my $domain=&Apache::loncommon::determinedomain();
     my %colortypes=('pgbg'  => 'Page Background',      my %colortypes=('pgbg'  => 'Page Background',
                     'tabbg' => 'Header Background',                      'tabbg' => 'Header Background',
Line 615  sub verify_and_change_colors { Line 600  sub verify_and_change_colors {
     $message.='Reset '.$colortypes{$item}.'<br />';      $message.='Reset '.$colortypes{$item}.'<br />';
  }   }
     }      }
       my $now = time;
       &Apache::lonnet::put('environment',{'color.timestamp' => $now});
       &Apache::lonnet::appenv('environment.color.timestamp' => $now);
   
     $r->print(<<ENDVCCOL);      $r->print(<<ENDVCCOL);
 $message  $message
 <form name="client" action="/adm/preferences" method="post">  <form name="client" action="/adm/preferences" method="POST">
 <input type="hidden" name="action" value="changecolors" />  <input type="hidden" name="action" value="changecolors" />
 </form>  </form>
 ENDVCCOL  ENDVCCOL
Line 659  sub passwordchanger { Line 648  sub passwordchanger {
     $lkey_npass2= hex($lkey_npass2);      $lkey_npass2= hex($lkey_npass2);
     # Output javascript to deal with passwords      # Output javascript to deal with passwords
     # Output DES javascript      # Output DES javascript
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print($html."<head>");  
     {      {
  my $include = $r->dir_config('lonIncludes');   my $include = $r->dir_config('lonIncludes');
  my $jsh=Apache::File->new($include."/londes.js");   my $jsh=Apache::File->new($include."/londes.js");
Line 700  $errormessage Line 687  $errormessage
      ensure that unencrypted passwords will not be sent out by a       ensure that unencrypted passwords will not be sent out by a
      crappy browser -->       crappy browser -->
   
 <form name="pserver" action="/adm/preferences" method="post">  <form name="pserver" action="/adm/preferences" method="POST">
 <input type="hidden" name="logtoken"    value="$logtoken" />  <input type="hidden" name="logtoken"    value="$logtoken" />
 <input type="hidden" name="action"      value="verify_and_change_pass" />  <input type="hidden" name="action"      value="verify_and_change_pass" />
 <input type="hidden" name="currentpass" value="" />  <input type="hidden" name="currentpass" value="" />
Line 741  sub verify_and_change_password { Line 728  sub verify_and_change_password {
     # Check for authentication types that allow changing of the password.      # Check for authentication types that allow changing of the password.
     return if ($currentauth !~ /^(unix|internal):/);      return if ($currentauth !~ /^(unix|internal):/);
     #      #
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<ENDHEADER);  
 $html  
 <head>  
 <title>LON-CAPA Preferences:  Change password for $user</title>  
 </head>  
 ENDHEADER  
     #  
     my $currentpass = $env{'form.currentpass'};       my $currentpass = $env{'form.currentpass'}; 
     my $newpass1    = $env{'form.newpass_1'};       my $newpass1    = $env{'form.newpass_1'}; 
     my $newpass2    = $env{'form.newpass_2'};      my $newpass2    = $env{'form.newpass_2'};
Line 773  password decryption.  Please log out and Line 752  password decryption.  Please log out and
 </p>  </p>
 ENDERROR  ENDERROR
         # Probably should log an error here          # Probably should log an error here
         return;          return 1;
     }      }
     my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo);      my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo);
     #       # 
Line 786  ENDERROR Line 765  ENDERROR
  '<font color="#ff0000">ERROR:</font>'.   '<font color="#ff0000">ERROR:</font>'.
  'The new passwords you entered do not match.  '.   'The new passwords you entered do not match.  '.
  'Please try again.');   'Please try again.');
  return;   return 1;
     }      }
     if (length($newpass1) < 7) {      if (length($newpass1) < 7) {
  &passwordchanger($r,   &passwordchanger($r,
  '<font color="#ff0000">ERROR:</font>'.   '<font color="#ff0000">ERROR:</font>'.
  'Passwords must be a minimum of 7 characters long.  '.   'Passwords must be a minimum of 7 characters long.  '.
  'Please try again.');   'Please try again.');
  return;   return 1;
     }      }
     #      #
     # Check for bad characters      # Check for bad characters
Line 828  ENDTEXT Line 807  ENDTEXT
 <h2><font color="#ff0000">The password for $user was not changed</font></h2>  <h2><font color="#ff0000">The password for $user was not changed</font></h2>
 Please make sure your old password was entered correctly.  Please make sure your old password was entered correctly.
 ENDERROR  ENDERROR
           return 1;
     }      }
     return;      return;
 }  }
Line 896  sub discussionchanger { Line 876  sub discussionchanger {
     }      }
           
     $r->print(<<"END");      $r->print(<<"END");
 <form name="server" action="/adm/preferences" method="post">  <form name="prefs" action="/adm/preferences" method="POST">
 <input type="hidden" name="action" value="verify_and_change_discussion" />  <input type="hidden" name="action" value="verify_and_change_discussion" />
 <br />  <br />
 $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li></ol>   $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li></ol> 
 <br />  <br />
 <br />  <br />
 <table border="0" cellpadding="0" cellspacing="0">  END
  <tr>      $r->print(&Apache::loncommon::start_data_table());
   <td width="100%" bgcolor="#000000">      $r->print(<<"END");
    <table width="100%" border="0" cellpadding="1" cellspacing="0">         <tr>
     <tr>          <th>$lt{'pref'}</th>
      <td width="100%" bgcolor="#000000">          <th>$lt{'curr'}</th>
       <table border="0" cellpadding="3" cellspacing="3" bgcolor="#FFFFFF">          <th>$lt{'actn'}?</th>
        <tr bgcolor="$color">  
         <td><b>$lt{'pref'}</b></td>  
         <td><b>$lt{'curr'}</b></td>  
         <td><b>$lt{'actn'}?</b></td>  
        </tr>         </tr>
        <tr bgcolor="#dddddd">  END
       $r->print(&Apache::loncommon::start_data_table_row());
       $r->print(<<"END");
        <td>$lt{'disa'}</td>         <td>$lt{'disa'}</td>
        <td>$lt{$discdisp}</td>         <td>$lt{$discdisp}</td>
        <td><input type="checkbox" name="discdisp" /><input type="hidden" name="newdisp" value="$newdisp" />&nbsp;$lt{'chgt'} "$dispchange"</td>         <td><label><input type="checkbox" name="discdisp" /><input type="hidden" name="newdisp" value="$newdisp" />&nbsp;$lt{'chgt'} "$dispchange"</label></td>
       </tr><tr bgcolor="#eeeeee">  END
       $r->print(&Apache::loncommon::end_data_table_row().
         &Apache::loncommon::start_data_table_row());
       $r->print(<<"END");
        <td>$lt{'npmr'}</td>         <td>$lt{'npmr'}</td>
        <td>$lt{$discmark}</td>         <td>$lt{$discmark}</td>
        <td><input type="checkbox" name="discmark" /><input type="hidden" name="newmark" value="$newmark" />&nbsp;$lt{'chgt'} "$markchange"</td>         <td><label><input type="checkbox" name="discmark" /><input type="hidden" name="newmark" value="$newmark" />&nbsp;$lt{'chgt'} "$markchange"</label></td>
       </tr>        </tr>
      </table>  END
     </td>      $r->print(&Apache::loncommon::end_data_table_row().
    </tr>        &Apache::loncommon::end_data_table());
   </table>      $r->print(<<"END");
  </td>  
 </tr>  
 </table>  
 <br />  <br />
 <br />  <br />
 <input type="submit" name="sub" value="Store Changes" />  <input type="submit" name="sub" value="Store Changes" />
Line 982  sub coursedisplaychanger { Line 960  sub coursedisplaychanger {
     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('environment',['course_init_display']);      my %userenv = &Apache::lonnet::get('environment',['course_init_display']);
       my $currvalue = 'whatsnew';
     my $firstselect='checked="checked"';      my $firstselect = '';
     my $whatsnewselect='';      my $whatsnewselect = 'checked="checked"';
     if ($userenv{'course_init_display'} ne 'firstres') {      if (exists($userenv{'course_init_display'})) {
         $firstselect='';          if ($userenv{'course_init_display'} eq 'firstres') {
         $whatsnewselect='checked="checked"';              $currvalue = 'firstres';
               $firstselect = 'checked="checked"';
       $whatsnewselect = '';
           }
     }      }
     my $whatsnew_off=&mt('Display the first resource in the course.');      my %pagenames = (
     my $whatsnew_on=&mt('Display a summary of items in the course which require action from the course coordinator.');                         firstres => 'First resource',
                          whatsnew => "What's new page",
                       );
       my $whatsnew_off=&mt('Display the [_1] in the course.','<b>first resource</b>');
       my $whatsnew_on=&mt('Display the "[_1]" page - a summary of items in the course which require attention.',"<b>What's New</b>");
   
     $r->print('<br /><b>'.&mt('Set the page to be displayed when you select the role of Course Coordinator').':</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(<<ENDLSCREEN);      $r->print(<<ENDLSCREEN);
 <form name="server" 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" />
   <br />
 <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>  <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 /><input type="submit" value="'.&mt('Change').'" />      $r->print('<br /><br /><input type="submit" value="'.&mt('Change').'" />
 </form>');  </form>');
 }  }
   
Line 1007  sub verify_and_change_coursepage { Line 993  sub verify_and_change_coursepage {
     my $r = shift;      my $r = shift;
     my $message='';      my $message='';
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         'when' => 'Whenever you select the Course Coordinator role from the roles screen',          'defs' => 'Default now set',
           'when' => 'when you select a course role from the roles screen',
         '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 a summary page listing course action items',           'dasp' => "Display the What's New page listing course action items", 
     );      );
     my $newdisp  = $env{'form.newdisp'};      my $newdisp  = $env{'form.newdisp'};
       $message = '<b>'.$lt{'defs'}.'</b>: '.$lt{'when'}.', ';
     if ($newdisp eq 'firstres') {      if ($newdisp eq 'firstres') {
         $message .= $lt{'when'}.', '.$lt{'ywbt'}.'<br/>';          $message .= $lt{'ywbt'}.'<br/>';
         &Apache::lonnet::put('environment',{'course_init_display' => $newdisp});          &Apache::lonnet::put('environment',{'course_init_display' => $newdisp});
         &Apache::lonnet::appenv('environment.course_init_display' => $newdisp);          &Apache::lonnet::appenv('environment.course_init_display' => $newdisp);
     } else {      } else {
         $message .= $lt{'when'}.', '.$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'};
     if (($env{'request.course.fn'}) && ($env{'request.course.id'})) {      if (($env{'request.course.fn'}) && ($env{'request.course.id'})) {
         if ($newdisp eq 'firstres') {          if ($newdisp eq 'firstres') {
             my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};              my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
Line 1031  sub verify_and_change_coursepage { Line 1020  sub verify_and_change_coursepage {
                 &Apache::lonuserstate::readmap($cdom.'/'.$cnum);                  &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
             $message .= '<br /><font size="+1"><a href="'.$furl.'">'.$lt{'gtts'}.' <i>'.&mt('now').'</i></a></font>';              $message .= '<br /><font size="+1"><a href="'.$furl.'">'.$lt{'gtts'}.' <i>'.&mt('now').'</i></a></font>';
         } else {          } else {
             $message .= '<br /><font size="+1"><a href="/adm/whatsnew">'.$lt{'dasp'}.'</a></font>';              $message .= '<br /><font size="+1"><a href="/adm/whatsnew?refpage='.
                           $refpage.'">'.$lt{'dasp'}.'</a></font>';
         }          }
     }      }
     $r->print(<<ENDVCSCREEN);      $r->print(<<ENDVCSCREEN);
Line 1059  sub handler { Line 1049  sub handler {
     return OK if $r->header_only;      return OK if $r->header_only;
     #      #
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['action','wysiwyg','returnurl']);                                     ['action','wysiwyg','returnurl','refpage']);
     #      #
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
Line 1084  sub handler { Line 1074  sub handler {
                           breadcrumb =>                             breadcrumb => 
                               { href =>'/adm/preferences?action=changepass',                                { href =>'/adm/preferences?action=changepass',
                                 text => 'Change Password'},                                  text => 'Change Password'},
                           printmenu => 'yes',                            printmenu => 'not_on_error',
                           }));                            }));
     }      }
     push (@Options,({ action   => 'changescreenname',      push (@Options,({ action   => 'changescreenname',
Line 1221  sub handler { Line 1211  sub handler {
                             text => 'Change Math Preferences'},                              text => 'Change Math Preferences'},
                       printmenu => 'yes',                        printmenu => 'yes',
                       }));                        }));
     if($env{'request.role'} =~ /^cc\.\//) {      if (&Apache::lonnet::allowed('whn',$env{'request.course.id'})
    || &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/'
       .$env{'request.course.sec'})) {
         push (@Options,({ action => 'changecourseinit',          push (@Options,({ action => 'changecourseinit',
                           linktext => 'Change Course Initialization Preference',                            linktext => 'Change Course Initialization Preference',
                           href => '/adm/preferences',                            href => '/adm/preferences',
Line 1244  sub handler { Line 1236  sub handler {
                           subroutine => \&toggle_debug,                            subroutine => \&toggle_debug,
                           }));                            }));
     }      }
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<ENDHEADER);      $r->print(&Apache::loncommon::start_page('Change Preferences'));
 $html  
 <head>  
 <title>LON-CAPA Preferences</title>  
 </head>  
 ENDHEADER  
     my $call = undef;      my $call = undef;
     my $help = undef;      my $help = undef;
     my $printmenu = 'yes';      my $printmenu = 'yes';
Line 1265  ENDHEADER Line 1253  ENDHEADER
     $help=$option->{'help'};      $help=$option->{'help'};
         }          }
     }      }
     $r->print(&Apache::loncommon::bodytag('Change Preferences'));      $r->print(&Apache::lonhtmlcommon::breadcrumbs('Change Preferences',$help));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs      my $error;
               (undef,'Change Preferences',$help));  
     if (defined($call)) {      if (defined($call)) {
         $call->($r);          $error = $call->($r);
     }      }
     if (($printmenu eq 'yes') && (!$env{'form.returnurl'})) {      if ( ( ($printmenu eq 'yes')
      || ($printmenu eq 'not_on_error' && !$error) )
    && (!$env{'form.returnurl'})) {
         my $optionlist = '<table cellpadding="5">';          my $optionlist = '<table cellpadding="5">';
         if ($env{'user.name'} =~           if ($env{'user.name'} =~ 
                          /^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/                           /^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/
Line 1315  ENDHEADER Line 1304  ENDHEADER
  $r->print('<br /><a href="'.$env{'form.returnurl'}.'"><font size="+1">'.   $r->print('<br /><a href="'.$env{'form.returnurl'}.'"><font size="+1">'.
   &mt('Return').'</font></a>');    &mt('Return').'</font></a>');
     }      }
     $r->print(&Apache::loncommon::endbodytag().'</html>');      $r->print(&Apache::loncommon::end_page());
     return OK;      return OK;
 }  }
   

Removed from v.1.68  
changed lines
  Added in v.1.84


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