Diff for /loncom/interface/lonpreferences.pm between versions 1.61 and 1.71

version 1.61, 2005/06/06 02:32:36 version 1.71, 2005/12/20 15:52:27
Line 110  sub wysiwygchanger { Line 110  sub wysiwygchanger {
 <form name="server" action="/adm/preferences" method="post">  <form name="server" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="set_wysiwyg" />  <input type="hidden" name="action" value="set_wysiwyg" />
 <br />  <br />
 <input type="radio" name="wysiwyg" value="off" $onselect /> $switchoff<br />  <label><input type="radio" name="wysiwyg" value="off" $onselect /> $switchoff</label><br />
 <input type="radio" name="wysiwyg" value="on" $offselect /> $switchon  <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('Change').'" />');
 }  }
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',
      'mimetex' => 'Convert to Images'       'mimetex' => 'Convert to Images'
                      );                       );
     my $selectionbox=&Apache::loncommon::select_form($texengine,'texengine',      my $selectionbox=&Apache::loncommon::select_form($texengine,'texengine',
      %mathchoices);       %mathchoices);
     my $mathexample='$$\int\left(\frac{a+b}{c^6*d}\right)$$';      my $jsMath_start=&Apache::lontexconvert::jsMath_header();
     my $jsMath_example=&Apache::lontexconvert::jsMath_converted(\$mathexample);  
     $mathexample='$$\int\left(\frac{a+b}{c^6*d}\right)$$';  
     my $tth_example=&Apache::lontexconvert::tth_converted(\$mathexample);  
     $mathexample='$$\int\left(\frac{a+b}{c^6*d}\right)$$';  
     my $mimetex_example=&Apache::lontexconvert::mimetex_converted(\$mathexample);  
     my $change=&mt('Change');      my $change=&mt('Change');
     $r->print(<<ENDLSCREEN);      $r->print(<<ENDLSCREEN);
   <br />
   
 <form name="server" action="/adm/preferences" method="post">  <form name="server" 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 /> $tth_example</p>  <p> TeX to HTML <br /> 
 <script type="text/javascript">function NoFontMessage () { }</script>  <iframe src="/res/adm/pages/math_example.tex?buttons=no&mode=tth" width="400" hieght="200"></iframe>
 <script src="/adm/jsMath/jsMath.js"></script>  </p>
 <p>jsMath <br />   <p>jsMath <br /> 
   $jsMath_start
 <script type="text/javascript">  <script type="text/javascript">
 if (jsMath.nofonts == 1) {  if (jsMath.nofonts == 1) {
     document.writeln      document.writeln
Line 231  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>
   
 $jsMath_example</p>  </p>
 <p> Convert to Images <br /> $mimetex_example</p>  <p> Convert to Images <br />
   <br />
   <iframe src="/res/adm/pages/math_example.tex?buttons=no&mode=mimetex" width="400" hieght="200"></iframe>
   </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">jsMath.Process()</script>');
Line 402  sub verify_and_change_screenname { Line 403  sub verify_and_change_screenname {
         &Apache::lonnet::delenv('environment\.nickname');          &Apache::lonnet::delenv('environment\.nickname');
         $message.='Reset nickname';          $message.='Reset nickname';
     }      }
       &Apache::lonnet::devalidate_cache_new('namescache',$user.':'.$domain);
     $r->print(<<ENDVCSCREEN);      $r->print(<<ENDVCSCREEN);
 $message  $message
 ENDVCSCREEN  ENDVCSCREEN
Line 973  $message Line 974  $message
 ENDVCSCREEN  ENDVCSCREEN
 }  }
   
   ################################################################
   # Subroutines for page display on course access (Course Coordinators)
   ################################################################
   sub coursedisplaychanger {
       my $r = shift;
       my $user       = $env{'user.name'};
       my $domain     = $env{'user.domain'};
       my %userenv = &Apache::lonnet::get('environment',['course_init_display']);
       my $currvalue = 'whatsnew';
       my $firstselect='checked="checked"';
       my $whatsnewselect='';
       if (exists($userenv{'course_init_display'})) {
           if ($userenv{'course_init_display'} eq 'firstres') {
               $currvalue = 'firstres';
               $firstselect='';
               $whatsnewselect='checked="checked"';
           }
       }
       my %pagenames = (
                          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 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);
   <form name="server" action="/adm/preferences" method="post">
   <input type="hidden" name="action" value="verify_and_change_coursepage" />
   <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'}" />
   ENDLSCREEN
       $r->print('<br /><br /><input type="submit" value="'.&mt('Change').'" />
   </form>');
   }
   
   sub verify_and_change_coursepage {
       my $r = shift;
       my $message='';
       my %lt = &Apache::lonlocal::texthash(
           '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.',
           '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',
           'dasp' => "Display the What's New page listing course action items", 
       );
       my $newdisp  = $env{'form.newdisp'};
       $message = '<b>'.$lt{'defs'}.'</b>: '.$lt{'when'}.', ';
       if ($newdisp eq 'firstres') {
           $message .= $lt{'ywbt'}.'<br/>';
           &Apache::lonnet::put('environment',{'course_init_display' => $newdisp});
           &Apache::lonnet::appenv('environment.course_init_display' => $newdisp);
       } else {
           $message .= $lt{'apwb'}.'<br/>';
           &Apache::lonnet::del('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 ($newdisp eq 'firstres') {
               my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
               my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; 
               my ($furl,$ferr)=
                   &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
               $message .= '<br /><font size="+1"><a href="'.$furl.'">'.$lt{'gtts'}.' <i>'.&mt('now').'</i></a></font>';
           } else {
               $message .= '<br /><font size="+1"><a href="/adm/whatsnew?refpage='.
                           $refpage.'">'.$lt{'dasp'}.'</a></font>';
           }
       }
       $r->print(<<ENDVCSCREEN);
   $message
   <br /><br />
   ENDVCSCREEN
   }
   
   
 ######################################################  ######################################################
 #            other handler subroutines               #  #            other handler subroutines               #
 ######################################################  ######################################################
Line 991  sub handler { Line 1070  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 1153  sub handler { Line 1232  sub handler {
                             text => 'Change Math Preferences'},                              text => 'Change Math Preferences'},
                       printmenu => 'yes',                        printmenu => 'yes',
                       }));                        }));
       if ($env{'user.adv'}) {
           push (@Options,({ action => 'changecourseinit',
                             linktext => 'Change Course Initialization Preference',
                             href => '/adm/preferences',
                             subroutine => \&coursedisplaychanger,
                             breadcrumb =>
                                 { href => '/adm/preferences?action=changecourseinit',
                                   text => 'Change Course Init. Pref.'},
                             },
                           { action => 'verify_and_change_coursepage',
                             breadcrumb =>
                             { href => '/adm/preferences?action=changecourseinit',                               text => 'Change Course Initialization Preference'},
                           printmenu => 'yes',
                           subroutine => \&verify_and_change_coursepage,
                          }));
       }
   
       if ($env{'user.name'} =~ /^(albertel|fox|foxr|koretemey|korte|hallmat3|turtle|raeburn)$/) {
     if ($env{'user.name'} =~ /^(albertel|fox|foxr|koretemey|korte|hallmat3|turtle)$/) {  
         push (@Options,({ action => 'debugtoggle',          push (@Options,({ action => 'debugtoggle',
                           printmenu => 'yes',                            printmenu => 'yes',
                           subroutine => \&toggle_debug,                            subroutine => \&toggle_debug,
Line 1191  ENDHEADER Line 1285  ENDHEADER
     if (($printmenu eq 'yes') && (!$env{'form.returnurl'})) {      if (($printmenu eq 'yes') && (!$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)$/                           /^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/
             ) {              ) {
             push (@Options,({ action => 'debugtoggle',              push (@Options,({ action => 'debugtoggle',
                               linktext => 'Toggle Debug Messages',                                linktext => 'Toggle Debug Messages',

Removed from v.1.61  
changed lines
  Added in v.1.71


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