Diff for /loncom/interface/lonpreferences.pm between versions 1.77 and 1.87

version 1.77, 2006/03/21 19:43:21 version 1.87, 2006/06/14 18:54:23
Line 33 Line 33
 package Apache::lonpreferences;  package Apache::lonpreferences;
   
 use strict;  use strict;
   use LONCAPA;
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::File;  use Apache::File;
 use Crypt::DES;  use Crypt::DES;
Line 98  sub wysiwygchanger { Line 99  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="1"';      my $onselect='checked="checked"';
     my $offselect='';      my $offselect='';
     if ($userenv{'wysiwygeditor'} eq 'on') {      if ($userenv{'wysiwygeditor'} eq 'on') {
  $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');
Line 208  sub texenginechanger { Line 209  sub texenginechanger {
 </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 229  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 306  People with very few roles should leave Line 307  People with very few roles should leave
   
 <form name="prefs" action="/adm/preferences" method="POST">  <form name="prefs" action="/adm/preferences" method="POST">
 <input type="hidden" name="action" value="verify_and_change_rolespref" />  <input type="hidden" name="action" value="verify_and_change_rolespref" />
 <br />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 505  ENDVCMSG Line 506  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 515  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 569  sub colorschanger { Line 564  sub colorschanger {
 </form>  </form>
 <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_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 577  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 601  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">
Line 890  sub discussionchanger { Line 880  sub discussionchanger {
 <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_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 939  sub verify_and_change_discussion { Line 927  sub verify_and_change_discussion {
     if (defined($env{'form.discdisp'}) ) {      if (defined($env{'form.discdisp'}) ) {
         my $newdisp  = $env{'form.newdisp'};          my $newdisp  = $env{'form.newdisp'};
         if ($newdisp eq 'unread') {          if ($newdisp eq 'unread') {
             $message .='In discussions: only new posts will be displayed.<br/>';              $message .='In discussions: only new posts will be displayed.<br />';
             &Apache::lonnet::put('environment',{'discdisplay' => $newdisp});              &Apache::lonnet::put('environment',{'discdisplay' => $newdisp});
             &Apache::lonnet::appenv('environment.discdisplay' => $newdisp);              &Apache::lonnet::appenv('environment.discdisplay' => $newdisp);
         } else {          } else {
             $message .= 'In discussions: all posts will be displayed.<br/>';              $message .= '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');
         }          }
Line 951  sub verify_and_change_discussion { Line 939  sub verify_and_change_discussion {
     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.='In discussions: new posts will be cease to be identified as "new" after display.<br/>';             $message.='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.='In discussions: posts will be identified as "new" until marked as read by the reader.<br/>';              $message.='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');
         }          }
Line 1016  sub verify_and_change_coursepage { Line 1004  sub verify_and_change_coursepage {
     my $newdisp  = $env{'form.newdisp'};      my $newdisp  = $env{'form.newdisp'};
     $message = '<b>'.$lt{'defs'}.'</b>: '.$lt{'when'}.', ';      $message = '<b>'.$lt{'defs'}.'</b>: '.$lt{'when'}.', ';
     if ($newdisp eq 'firstres') {      if ($newdisp eq 'firstres') {
         $message .= $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{'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');
     }      }
Line 1224  sub handler { Line 1212  sub handler {
                             text => 'Change Math Preferences'},                              text => 'Change Math Preferences'},
                       printmenu => 'yes',                        printmenu => 'yes',
                       }));                        }));
   
       if ($env{'environment.remote'} eq 'off') {
    push (@Options,({ action => 'launch',
     linktext => 'Launch Remote Control',
     href => '/adm/remote?url=/adm/preferences',
         }));
       } else {
    push (@Options,({ action => 'collapse',
     linktext => 'Collapse Remote Control',
     href => '/adm/remote?url=/adm/preferences',
         }));
       }
   
     if (&Apache::lonnet::allowed('whn',$env{'request.course.id'})      if (&Apache::lonnet::allowed('whn',$env{'request.course.id'})
  || &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/'   || &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/'
     .$env{'request.course.sec'})) {      .$env{'request.course.sec'})) {
Line 1266  sub handler { Line 1267  sub handler {
     $help=$option->{'help'};      $help=$option->{'help'};
         }          }
     }      }
     $r->print(&Apache::lonhtmlcommon::breadcrumbs      $r->print(&Apache::lonhtmlcommon::breadcrumbs('Change Preferences',$help));
               (undef,'Change Preferences',$help));  
     my $error;      my $error;
     if (defined($call)) {      if (defined($call)) {
         $error = $call->($r);          $error = $call->($r);
Line 1291  sub handler { Line 1291  sub handler {
         foreach my $option(@Options) {          foreach my $option(@Options) {
             my $optiontext = '';              my $optiontext = '';
             if (exists($option->{'href'})) {              if (exists($option->{'href'})) {
                 $optiontext .=    $option->{'href_args'}{'action'}=$option->{'action'};
                     '<a href="'.$option->{'href'}.   $optiontext .= 
                     '?action='.$option->{'action'}.'">'.                      '<a href="'.&add_get_param($option->{'href'},
          $option->{'href_args'}).'">'.
                     &mt($option->{'linktext'}).'</a>';                      &mt($option->{'linktext'}).'</a>';
             }              }
             if (exists($option->{'text'})) {              if (exists($option->{'text'})) {

Removed from v.1.77  
changed lines
  Added in v.1.87


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