Diff for /loncom/interface/lonpreferences.pm between versions 1.53 and 1.54

version 1.53, 2005/02/17 08:29:43 version 1.54, 2005/02/25 05:54:01
Line 178  ENDVCSCREEN Line 178  ENDVCSCREEN
 }  }
   
 ################################################################  ################################################################
   #         Tex Engine Change Subroutines                        #
   ################################################################
   sub texenginechanger {
       my $r = shift;
       my $user       = $ENV{'user.name'};
       my $domain     = $ENV{'user.domain'};
       my %userenv = &Apache::lonnet::get('environment',['texengine']);
       my $texengine=$userenv{'texengine'};
   
       my $pref=&mt('Preferred method to display Math');
       my %mathchoices=('' => 'No Preference',
        'tth' => 'TeX to HTML',
        #'ttm' => 'TeX to MathML',
        'jsMath' => 'jsMath',
        #'mimetex' => 'Convert to Images'
                        );
       my $selectionbox=&Apache::loncommon::select_form($texengine,'texengine',
        %mathchoices);
       my $mathexample='$$\int\left(\frac{a+b}{c^6*d}\right)$$';
       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);
       my $change=&mt('Change');
       $r->print(<<ENDLSCREEN);
   <form name="server" action="/adm/preferences" method="post">
   <input type="hidden" name="action" value="verify_and_change_texengine" />
   <p>$pref: $selectionbox</p>
   <p><input type="submit" value="$change" /></p>
   </form>
   Examples:
   <p> TeX to HTML <br /> $tth_example</p>
   <script type"text/javascript">function NoFontMessage () { }</script>
   <script src="/adm/jsMath/jsMath.js"></script>
   <p>jsMath <br /> 
   
   <script type"text/javascript">
   if (jsMath.nofonts == 1) {
       document.writeln
           ('<center><div style="padding: 10; border-style: solid; border-width:3;'
    +' border-color: #DD0000; background-color: #FFF8F8; width: 75%; text-align: left">'
    +'<small><font color="#AA0000"><b>Warning:</b> '
    +'It looks like you don\\\'t have the TeX math fonts installed. '
    +'The jsMath example on this page may not look right without them. '
    +'The <a href="http://www.math.union.edu/locate/jsMath/" target="_blank"> '
    +'jsMath Home Page</a> has information on how to download the '
    +'needed fonts.  In the meantime, jsMath will do the best it can '
    +'with the fonts you have, but it may not be pretty and some equations '
    +'may not be rendered correctly. '
    +'</font></small></div></center>');
   }
   </script>
   
   $jsMath_example</p>
   <script type="text/javascript">jsMath.Process()</script>
   ENDLSCREEN
   }
   
   
   sub verify_and_change_texengine {
       my $r = shift;
       my $user       = $ENV{'user.name'};
       my $domain     = $ENV{'user.domain'};
   # Screenname
       my $newtexengine  = $ENV{'form.texengine'};
       $newtexengine=~s/[^\-\w]//g;
       my $message='';
       if ($newtexengine) {
           &Apache::lonnet::put('environment',{'texengine' => $newtexengine});
           &Apache::lonnet::appenv('environment.texengine' => $newtexengine);
           $message='Set new preferred math display to '.$newtexengine;
       } else {
           &Apache::lonnet::del('environment',['texengine']);
           &Apache::lonnet::delenv('environment\.texengine');
           $message='Reset preferred math display.';
       }
       $r->print(<<ENDVCSCREEN);
   </p>
   $message
   ENDVCSCREEN
   }
   
   ################################################################
 #         Roles Page Preference Change Subroutines         #  #         Roles Page Preference Change Subroutines         #
 ################################################################  ################################################################
 sub rolesprefchanger {  sub rolesprefchanger {
Line 1048  sub handler { Line 1130  sub handler {
                       printmenu => 'yes',                        printmenu => 'yes',
                       }));                        }));
   
       push (@Options,({ action   => 'changetexenginepref',
                         linktext => 'Change How Math Equations Are Displayed',
                         href     => '/adm/preferences',
                         subroutine => \&texenginechanger,
                         breadcrumb =>
                             { href => '/adm/preferences?action=changetexenginepref',
                               text => 'Change Math Pref'},
                         },
                       { action   => 'verify_and_change_texengine',
                         subroutine => \&verify_and_change_texengine,
                         breadcrumb =>
                             { href => '/adm/preferences?action=changetexenginepref',
                               text => 'Change Math Preferences'},
                         printmenu => 'yes',
                         }));
   
   
     if ($ENV{'user.name'} =~ /^(albertel|fox|foxr|koretemey|korte|hallmat3|turtle)$/) {      if ($ENV{'user.name'} =~ /^(albertel|fox|foxr|koretemey|korte|hallmat3|turtle)$/) {
         push (@Options,({ action => 'debugtoggle',          push (@Options,({ action => 'debugtoggle',
Line 1126  ENDHEADER Line 1224  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(<<ENDFOOTER);      $r->print(&Apache::loncommon::endbodytag().'</html>');
 </body>  
 </html>  
 ENDFOOTER  
     return OK;      return OK;
 }  }
   

Removed from v.1.53  
changed lines
  Added in v.1.54


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