version 1.217, 2016/01/27 00:24:09
|
version 1.222, 2016/09/16 00:51:49
|
Line 160 sub texenginechanger {
|
Line 160 sub texenginechanger {
|
my $domain = $env{'user.domain'}; |
my $domain = $env{'user.domain'}; |
my %userenv = &Apache::lonnet::get('environment',['texengine']); |
my %userenv = &Apache::lonnet::get('environment',['texengine']); |
my $texengine=$userenv{'texengine'}; |
my $texengine=$userenv{'texengine'}; |
|
if (lc($texengine) eq 'jsmath') { |
|
$texengine = 'MathJax'; |
|
} |
|
|
my %mathchoices=('' => 'Default', |
my %mathchoices=('' => 'Default', |
'tth' => 'tth (TeX to HTML)', |
'tth' => 'tth (TeX to HTML)', |
#'ttm' => 'TeX to MathML', |
#'ttm' => 'TeX to MathML', |
'jsMath' => 'jsMath', |
|
'MathJax' => 'MathJax', |
'MathJax' => 'MathJax', |
'mimetex' => 'mimetex (Convert to Images)', |
'mimetex' => 'mimetex (Convert to Images)', |
'raw' => 'Raw (Screen Reader)' |
'raw' => 'Raw (Screen Reader)' |
Line 176 sub texenginechanger {
|
Line 178 sub texenginechanger {
|
'texengine', |
'texengine', |
\%mathchoices); |
\%mathchoices); |
my $MathJax_start=&Apache::lontexconvert::MathJax_header(); |
my $MathJax_start=&Apache::lontexconvert::MathJax_header(); |
my $jsMath_start=&Apache::lontexconvert::jsMath_header(); |
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'headline' => 'Change how math is displayed', |
'headline' => 'Change how math is displayed', |
'preftxt' => 'Preferred method to display math', |
'preftxt' => 'Preferred method to display math', |
Line 184 sub texenginechanger {
|
Line 185 sub texenginechanger {
|
'exmpl' => 'Examples', |
'exmpl' => 'Examples', |
'mathjax' => 'MathJax:', |
'mathjax' => 'MathJax:', |
'mathjaxinfo' => 'MathJax provides rendered equations whose source code can be extracted in TeX and MathML formats by right clicking the equation.', |
'mathjaxinfo' => 'MathJax provides rendered equations whose source code can be extracted in TeX and MathML formats by right clicking the equation.', |
'jsmath' => 'jsMath:', |
|
'tth' => 'tth (TeX to HTML):', |
'tth' => 'tth (TeX to HTML):', |
'mimetex' => 'mimetex (Convert to Images):', |
'mimetex' => 'mimetex (Convert to Images):', |
); |
); |
|
|
my $jsMathWarning='<p>' |
|
.'<div class="LC_warning">' |
|
.&mt("It looks like you don't have the TeX math fonts installed.") |
|
.'</div>' |
|
.'<div>' |
|
.&mt('The jsMath example on this page may not look right without them. ' |
|
.'The [_1]jsMath Home Page[_2] 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.' |
|
,'<a href="http://www.math.union.edu/locate/jsMath/" target="_blank">' |
|
,'</a>') |
|
.'</div>' |
|
.'</p>'; |
|
|
|
$r->print(<<ENDLSCREEN); |
$r->print(<<ENDLSCREEN); |
<h2>$lt{'headline'}</h2> |
<h2>$lt{'headline'}</h2> |
<form name="prefs" action="/adm/preferences" method="post"> |
<form name="prefs" action="/adm/preferences" method="post"> |
Line 226 $lt{'exmpl'}
|
Line 211 $lt{'exmpl'}
|
$lt{'mathjaxinfo'} |
$lt{'mathjaxinfo'} |
</p> |
</p> |
|
|
<h3>$lt{'jsmath'}</h3> |
|
<p> |
|
$jsMath_start |
|
<script type="text/javascript" language="JavaScript"> |
|
if (jsMath.nofonts == 1) { |
|
document.writeln($jsMathWarning); |
|
} |
|
|
|
</script> |
|
<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=jsMath" width="400" height="150"></iframe> |
|
</p> |
|
|
|
<h3>$lt{'mimetex'}</h3> |
<h3>$lt{'mimetex'}</h3> |
<p> |
<p> |
<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=mimetex" width="400" height="150"></iframe> |
<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=mimetex" width="400" height="150"></iframe> |
Line 248 if (jsMath.nofonts == 1) {
|
Line 221 if (jsMath.nofonts == 1) {
|
<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=tth" width="400" height="150"></iframe> |
<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=tth" width="400" height="150"></iframe> |
</p> |
</p> |
ENDLSCREEN |
ENDLSCREEN |
if ($env{'environment.texengine'} ne 'jsMath') { |
|
$r->print('<script type="text/javascript" language="JavaScript">jsMath.Process()</script>'); |
|
} |
|
} |
} |
|
|
|
|
Line 261 sub verify_and_change_texengine {
|
Line 231 sub verify_and_change_texengine {
|
# Screenname |
# Screenname |
my $newtexengine = $env{'form.texengine'}; |
my $newtexengine = $env{'form.texengine'}; |
$newtexengine=~s/[^\-\w]//g; |
$newtexengine=~s/[^\-\w]//g; |
|
if (lc($newtexengine) eq 'jsmath') { |
|
$newtexengine = 'MathJax'; |
|
} |
if ($newtexengine eq 'ttm') { |
if ($newtexengine eq 'ttm') { |
&Apache::lonnet::appenv({'browser.mathml' => 1}); |
&Apache::lonnet::appenv({'browser.mathml' => 1}); |
} else { |
} else { |
Line 713 sub verify_and_change_clicker {
|
Line 686 sub verify_and_change_clicker {
|
my $r = shift; |
my $r = shift; |
my $user = $env{'user.name'}; |
my $user = $env{'user.name'}; |
my $domain = $env{'user.domain'}; |
my $domain = $env{'user.domain'}; |
|
my $uhome = $env{'user.home'}; |
my $newclickers = $env{'form.clickers'}; |
my $newclickers = $env{'form.clickers'}; |
|
my $message; |
$newclickers=~s/[^\w\:\-]+/\,/gs; |
$newclickers=~s/[^\w\:\-]+/\,/gs; |
$newclickers=~tr/a-z/A-Z/; |
$newclickers=~tr/a-z/A-Z/; |
$newclickers=~s/[\:\-]+/\-/g; |
$newclickers=~s/[\:\-]+/\-/g; |
$newclickers=~s/\,+/\,/g; |
$newclickers=~s/\,+/\,/g; |
$newclickers=~s/^\,//; |
$newclickers=~s/^\,//; |
$newclickers=~s/\,$//; |
$newclickers=~s/\,$//; |
&Apache::lonnet::put('environment',{'clickers' => $newclickers}); |
my @oldclickers = split(/,/,$env{'environment.clickers'}); |
&Apache::lonnet::appenv({'environment.clickers' => $newclickers}); |
my @newclickers = split(/,/,$newclickers); |
my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Registering clickers: [_1]',$newclickers)); |
my %newuniq; |
|
map { $newuniq{$_} = 1; } @newclickers; |
|
@newclickers = sort(keys(%newuniq)); |
|
my @differences = &Apache::loncommon::compare_arrays(\@oldclickers,\@newclickers); |
|
if (@differences) { |
|
my $putres = &Apache::lonnet::put('environment',{'clickers' => $newclickers}); |
|
if ($putres eq 'ok') { |
|
my @adds = (); |
|
my @dels = (); |
|
foreach my $item (@differences) { |
|
if (grep(/^\Q$item\E$/,@newclickers)) { |
|
push(@adds,$item); |
|
} else { |
|
push(@dels,$item); |
|
} |
|
} |
|
if (@dels) { |
|
my %delclicker; |
|
map { $delclicker{$_} = $user; } @dels; |
|
my $putresult = &Apache::lonnet::iddel($domain,\%delclicker,$uhome,'clickers'); |
|
} |
|
if (@adds) { |
|
my %addclicker; |
|
map { $addclicker{$_} = $user; } @adds; |
|
my $putresult = &Apache::lonnet::updateclickers($domain,'add',\%addclicker,$uhome,1); |
|
} |
|
&Apache::lonnet::appenv({'environment.clickers' => $newclickers}); |
|
$message=&Apache::lonhtmlcommon::confirm_success(&mt('Registering clickers: [_1]',$newclickers)); |
|
} else { |
|
$message=&Apache::lonhtmlcommon::confirm_success(&mt('Error saving clicker ID').1); |
|
} |
|
} else { |
|
$message='<span class="LC_info">'.&mt('Clicker information unchanged').'</span>'; |
|
} |
$message=&Apache::loncommon::confirmwrapper($message); |
$message=&Apache::loncommon::confirmwrapper($message); |
&print_main_menu($r, $message); |
&print_main_menu($r, $message); |
} |
} |
Line 1374 sub jscript_send {
|
Line 1382 sub jscript_send {
|
uextkey=this.document.client.elements.ukey_cpass.value; |
uextkey=this.document.client.elements.ukey_cpass.value; |
lextkey=this.document.client.elements.lkey_cpass.value; |
lextkey=this.document.client.elements.lkey_cpass.value; |
initkeys(); |
initkeys(); |
|
this.document.pserver.elements.currentpass.value = |
this.document.pserver.elements.currentpass.value |
getCrypted(this.document.client.elements.currentpass.value); |
=crypted(this.document.client.elements.currentpass.value); |
|
|
|
uextkey=this.document.client.elements.ukey_npass1.value; |
uextkey=this.document.client.elements.ukey_npass1.value; |
lextkey=this.document.client.elements.lkey_npass1.value; |
lextkey=this.document.client.elements.lkey_npass1.value; |
initkeys(); |
initkeys(); |
this.document.pserver.elements.newpass_1.value |
this.document.pserver.elements.newpass_1.value |
=crypted(this.document.client.elements.newpass_1.value); |
=getCrypted(this.document.client.elements.newpass_1.value); |
|
|
uextkey=this.document.client.elements.ukey_npass2.value; |
uextkey=this.document.client.elements.ukey_npass2.value; |
lextkey=this.document.client.elements.lkey_npass2.value; |
lextkey=this.document.client.elements.lkey_npass2.value; |
initkeys(); |
initkeys(); |
this.document.pserver.elements.newpass_2.value |
this.document.pserver.elements.newpass_2.value |
=crypted(this.document.client.elements.newpass_2.value); |
=getCrypted(this.document.client.elements.newpass_2.value); |
|; |
|; |
if ($caller eq 'reset_by_email') { |
if ($caller eq 'reset_by_email') { |
$output .= qq| |
$output .= qq| |
Line 1403 sub jscript_send {
|
Line 1408 sub jscript_send {
|
$ output .= qq| |
$ output .= qq| |
this.document.pserver.submit(); |
this.document.pserver.submit(); |
} |
} |
|
|
</script> |
</script> |
|; |
|; |
} |
} |
Line 1419 sub client_form {
|
Line 1425 sub client_form {
|
'changepass' => 'Save', |
'changepass' => 'Save', |
); |
); |
|
|
|
my $mobileargs; |
|
(undef,undef,undef,undef,undef,undef,my $clientmobile) = |
|
&Apache::loncommon::decode_user_agent(); |
|
if ($clientmobile) { |
|
$mobileargs = 'autocapitalize="off" autocorrect="off" '; |
|
} |
my $output = '<form name="client" action="">' |
my $output = '<form name="client" action="">' |
.&Apache::lonhtmlcommon::start_pick_box(); |
.&Apache::lonhtmlcommon::start_pick_box(); |
if ($caller eq 'reset_by_email') { |
if ($caller eq 'reset_by_email') { |
|
my $mobileargs; |
|
(undef,undef,undef,undef,undef,undef,my $clientmobile) = |
|
&Apache::loncommon::decode_user_agent(); |
|
if ($clientmobile) { |
|
$mobileargs = 'autocapitalize="off" autocorrect="off" '; |
|
} |
$output .= &Apache::lonhtmlcommon::row_title( |
$output .= &Apache::lonhtmlcommon::row_title( |
'<label for="email">'.$lt{'email'}.'</label>') |
'<label for="email">'.$lt{'email'}.'</label>') |
.'<input type="text" name="email" size="30" />' |
.'<input type="text" name="email" size="30" '.$mobileargs.'/>' |
.&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_title( |
.&Apache::lonhtmlcommon::row_title( |
'<label for="uname">'.$lt{'username'}.'</label>') |
'<label for="uname">'.$lt{'username'}.'</label>') |
.'<input type="text" name="uname" size="15" />' |
.'<input type="text" name="uname" size="20" '.$mobileargs.'/>' |
.'<input type="hidden" name="currentpass" value="'.$currentpass.'" />' |
.'<input type="hidden" name="currentpass" value="'.$currentpass.'" />' |
.&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_title( |
.&Apache::lonhtmlcommon::row_title( |
Line 1438 sub client_form {
|
Line 1456 sub client_form {
|
} else { |
} else { |
$output .= &Apache::lonhtmlcommon::row_title( |
$output .= &Apache::lonhtmlcommon::row_title( |
'<label for="currentpass">'.$lt{'currentpass'}.'</label>') |
'<label for="currentpass">'.$lt{'currentpass'}.'</label>') |
.'<input type="password" name="currentpass" size="10"/>' |
.'<input type="password" name="currentpass" size="20"/>' |
.&Apache::lonhtmlcommon::row_closure(); |
.&Apache::lonhtmlcommon::row_closure(); |
} |
} |
$output .= &Apache::lonhtmlcommon::row_title( |
$output .= &Apache::lonhtmlcommon::row_title( |
'<label for="newpass_1">'.$lt{'newpass'}.'</label>') |
'<label for="newpass_1">'.$lt{'newpass'}.'</label>') |
.'<input type="password" name="newpass_1" size="10" />' |
.'<input type="password" name="newpass_1" size="20" />' |
.&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_title( |
.&Apache::lonhtmlcommon::row_title( |
'<label for="newpass_2">'.$lt{'confirmpass'}.'</label>') |
'<label for="newpass_2">'.$lt{'confirmpass'}.'</label>') |
.'<input type="password" name="newpass_2" size="10" />' |
.'<input type="password" name="newpass_2" size="20" />' |
.&Apache::lonhtmlcommon::row_closure(1) |
.&Apache::lonhtmlcommon::row_closure(1) |
.&Apache::lonhtmlcommon::end_pick_box(); |
.&Apache::lonhtmlcommon::end_pick_box(); |
$output .= '<p><input type="button" value="'.$lt{'changepass'}.'" onclick="send();" /></p>' |
$output .= '<p><input type="button" value="'.$lt{'changepass'}.'" onclick="send();" /></p>' |
Line 1570 ENDERROR
|
Line 1588 ENDERROR
|
return 1; |
return 1; |
} |
} |
my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo); |
my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo); |
# |
# |
$currentpass = &Apache::loncommon::des_decrypt($ckey ,$currentpass); |
$currentpass = &Apache::loncommon::des_decrypt($ckey ,$currentpass); |
$newpass1 = &Apache::loncommon::des_decrypt($n1key,$newpass1); |
$newpass1 = &Apache::loncommon::des_decrypt($n1key,$newpass1); |
$newpass2 = &Apache::loncommon::des_decrypt($n2key,$newpass2); |
$newpass2 = &Apache::loncommon::des_decrypt($n2key,$newpass2); |
Line 2182 push(@{ $menu[4]->{items} }, {
|
Line 2200 push(@{ $menu[4]->{items} }, {
|
|
|
} |
} |
|
|
my %author_roles = &Apache::lonnet::get_my_roles($user,$domain,'userroles','',['au','ca','aa']); |
my %author_coauthor_roles = &Apache::lonnet::get_my_roles($user,$domain,'userroles','',['au','ca','aa']); |
if (keys(%author_roles) > 0) { |
if (keys(%author_coauthor_roles) > 0) { |
push(@{ $menu[4]->{items} }, { |
push(@{ $menu[4]->{items} }, { |
linktext => 'Authoring Space Configuration', |
linktext => 'Authoring Space Configuration', |
url => '/adm/preferences?action=authorsettings', |
url => '/adm/preferences?action=authorsettings', |
Line 2248 sub handler {
|
Line 2266 sub handler {
|
}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'){ |
&verify_and_change_password($r); |
&verify_and_change_password($r,'preferences'); |
}elsif($env{'form.action'} eq 'changescreenname'){ |
}elsif($env{'form.action'} eq 'changescreenname'){ |
&screennamechanger($r); |
&screennamechanger($r); |
}elsif($env{'form.action'} eq 'verify_and_change_screenname'){ |
}elsif($env{'form.action'} eq 'verify_and_change_screenname'){ |