version 1.37, 2004/03/16 19:13:09
|
version 1.55, 2005/02/25 06:48:00
|
Line 25
|
Line 25
|
# |
# |
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
# |
# |
# 2/13/02 2/14 2/15 Matthew Hall |
|
# |
|
# This package uses the "londes.js" javascript code. |
# This package uses the "londes.js" javascript code. |
# |
# |
# TODOs that have to be completed: |
# TODOs that have to be completed: |
Line 94 sub des_decrypt {
|
Line 92 sub des_decrypt {
|
################################################################ |
################################################################ |
# Language Change Subroutines # |
# Language Change Subroutines # |
################################################################ |
################################################################ |
|
|
|
sub wysiwygchanger { |
|
my $r = shift; |
|
my %userenv = &Apache::lonnet::get |
|
('environment',['wysiwygeditor']); |
|
my $offselect=''; |
|
my $onselect='checked="1"'; |
|
if ($userenv{'wysiwygeditor'}) { |
|
$onselect=''; |
|
$offselect='checked="1"'; |
|
} |
|
my $switchoff=&mt('Disable WYSIWYG editor'); |
|
my $switchon=&mt('Enable WYSIWYG editor'); |
|
$r->print(<<ENDLSCREEN); |
|
<form name="server" action="/adm/preferences" method="post"> |
|
<input type="hidden" name="action" value="set_wysiwyg" /> |
|
<br /> |
|
<input type="radio" name="wysiwyg" value="off" $onselect /> $switchoff<br /> |
|
<input type="radio" name="wysiwyg" value="on" $offselect /> $switchon |
|
ENDLSCREEN |
|
$r->print('<br /><input type="submit" value="'.&mt('Change').'" />'); |
|
} |
|
|
|
|
|
sub verify_and_change_wysiwyg { |
|
my $r = shift; |
|
my $newsetting=$ENV{'form.wysiwyg'}; |
|
&Apache::lonnet::put('environment',{'wysiwygeditor' => $newsetting}); |
|
&Apache::lonnet::appenv('environment.wysiwygeditor' => $newsetting); |
|
$r->print('<p>'.&mt('Setting WYSIWYG editor to:').' '.&mt($newsetting).'</p>'); |
|
} |
|
|
|
################################################################ |
|
# Language Change Subroutines # |
|
################################################################ |
sub languagechanger { |
sub languagechanger { |
my $r = shift; |
my $r = shift; |
my $user = $ENV{'user.name'}; |
my $user = $ENV{'user.name'}; |
Line 144 $message
|
Line 177 $message
|
ENDVCSCREEN |
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> |
|
ENDLSCREEN |
|
if ($ENV{'environment.texengine'} ne 'jsMath') { |
|
$r->print('<script type="text/javascript">jsMath.Process()</script>'); |
|
} |
|
} |
|
|
|
|
|
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 # |
|
################################################################ |
|
sub rolesprefchanger { |
|
my $r = shift; |
|
my $user = $ENV{'user.name'}; |
|
my $domain = $ENV{'user.domain'}; |
|
my %userenv = &Apache::lonnet::get |
|
('environment',['recentroles','recentrolesn']); |
|
my $hotlist_flag=$userenv{'recentroles'}; |
|
my $hotlist_n=$userenv{'recentrolesn'}; |
|
my $checked; |
|
if ($hotlist_flag) { |
|
$checked = 'checked="checked"'; |
|
} |
|
|
|
if (!$hotlist_n) { $hotlist_n=3; } |
|
my $options; |
|
for (my $i=1; $i<10; $i++) { |
|
my $select; |
|
if ($hotlist_n == $i) { $select = 'selected="selected"'; } |
|
$options .= "<option $select>$i</option>\n"; |
|
} |
|
|
|
$r->print(<<ENDSCREEN); |
|
<p>Some LON-CAPA users have a long list of roles. The Recent Roles Hotlist |
|
feature keeps track of the last N roles which have been |
|
visited and places a table of these at the top of the roles page. |
|
People with very few roles should leave this feature disabled. |
|
</p> |
|
|
|
<form name="server" action="/adm/preferences" method="post"> |
|
<input type="hidden" name="action" value="verify_and_change_rolespref" /> |
|
<br />Enable Recent Roles Hotlist: |
|
<input type="checkbox" $checked name="recentroles" value="true" /> |
|
<br />Number of roles in Hotlist: |
|
<select name="recentrolesn" size="1"> |
|
$options |
|
</select> |
|
<br /> |
|
<input type="submit" value="Change" /> |
|
</form> |
|
ENDSCREEN |
|
} |
|
|
|
sub verify_and_change_rolespref { |
|
my $r = shift; |
|
my $user = $ENV{'user.name'}; |
|
my $domain = $ENV{'user.domain'}; |
|
# Recent Roles Hotlist Flag |
|
my $hotlist_flag = $ENV{'form.recentroles'}; |
|
my $hotlist_n = $ENV{'form.recentrolesn'}; |
|
my $message=''; |
|
if ($hotlist_flag) { |
|
&Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag}); |
|
&Apache::lonnet::appenv('environment.recentroles' => $hotlist_flag); |
|
$message='Recent Roles Hotlist is Enabled'; |
|
} else { |
|
&Apache::lonnet::del('environment',['recentroles']); |
|
&Apache::lonnet::delenv('environment\.recentroles'); |
|
$message='Recent Roles Hotlist is Disabled'; |
|
} |
|
if ($hotlist_n) { |
|
&Apache::lonnet::put('environment',{'recentrolesn' => $hotlist_n}); |
|
&Apache::lonnet::appenv('environment.recentrolesn' => $hotlist_n); |
|
if ($hotlist_flag) { |
|
$message.="<br />Display $hotlist_n Most Recent Roles\n"; |
|
} |
|
} |
|
|
|
$r->print(<<ENDRPSCREEN); |
|
</p> |
|
$message |
|
ENDRPSCREEN |
|
} |
|
|
|
|
|
|
################################################################ |
################################################################ |
# Anonymous Discussion Name Change Subroutines # |
# Anonymous Discussion Name Change Subroutines # |
Line 457 sub passwordchanger {
|
Line 651 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 |
$r->print("<html><head>"); |
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 471 sub passwordchanger {
|
Line 666 sub passwordchanger {
|
lextkey=this.document.client.elements.lkey_cpass.value; |
lextkey=this.document.client.elements.lkey_cpass.value; |
initkeys(); |
initkeys(); |
|
|
this.document.server.elements.currentpass.value |
this.document.pserver.elements.currentpass.value |
=crypted(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.server.elements.newpass_1.value |
this.document.pserver.elements.newpass_1.value |
=crypted(this.document.client.elements.newpass_1.value); |
=crypted(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.server.elements.newpass_2.value |
this.document.pserver.elements.newpass_2.value |
=crypted(this.document.client.elements.newpass_2.value); |
=crypted(this.document.client.elements.newpass_2.value); |
|
|
this.document.server.submit(); |
this.document.pserver.submit(); |
} |
} |
|
|
</script> |
</script> |
Line 497 $errormessage
|
Line 692 $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="server" 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 538 sub verify_and_change_password {
|
Line 733 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); |
$r->print(<<ENDHEADER); |
<html> |
$html |
<head> |
<head> |
<title>LON-CAPA Preferences: Change password for $user</title> |
<title>LON-CAPA Preferences: Change password for $user</title> |
</head> |
</head> |
Line 628 ENDERROR
|
Line 824 ENDERROR
|
return; |
return; |
} |
} |
|
|
|
################################################################ |
|
# discussion display subroutines |
|
################################################################ |
|
sub discussionchanger { |
|
my $r = shift; |
|
my $user = $ENV{'user.name'}; |
|
my $domain = $ENV{'user.domain'}; |
|
my %userenv = &Apache::lonnet::get |
|
('environment',['discdisplay','discmarkread']); |
|
my $discdisp = 'allposts'; |
|
my $discmark = 'onmark'; |
|
|
|
if (defined($userenv{'discdisplay'})) { |
|
unless ($userenv{'discdisplay'} eq '') { |
|
$discdisp = $userenv{'discdisplay'}; |
|
} |
|
} |
|
if (defined($userenv{'discmarkread'})) { |
|
unless ($userenv{'discdisplay'} eq '') { |
|
$discmark = $userenv{'discmarkread'}; |
|
} |
|
} |
|
|
|
my $newdisp = 'unread'; |
|
my $newmark = 'ondisp'; |
|
|
|
my $function = &Apache::loncommon::get_users_function(); |
|
my $color = &Apache::loncommon::designparm($function.'.tabbg', |
|
$ENV{'user.domain'}); |
|
my %lt = &Apache::lonlocal::texthash( |
|
'pref' => 'Display Preference', |
|
'curr' => 'Current setting ', |
|
'actn' => 'Action', |
|
'sdpf' => 'Set display preferences for discussion posts for both bulletin boards and individual resources in all your courses.', |
|
'prca' => 'Preferences can be set that determine', |
|
'whpo' => 'Which posts are displayed when you display a bulletin board or resource, and', |
|
'unwh' => 'Under what circumstances posts are identfied as "New"', |
|
'allposts' => 'All posts', |
|
'unread' => 'New posts only', |
|
'ondisp' => 'Once displayed', |
|
'onmark' => 'Once marked as read', |
|
'disa' => 'Posts displayed?', |
|
'npmr' => 'New posts cease to be identified as "New"?', |
|
'thde' => 'The preferences you set here can be overridden within each individual discussion.', |
|
'chgt' => 'Change to ' |
|
); |
|
my $dispchange = $lt{'unread'}; |
|
my $markchange = $lt{'ondisp'}; |
|
my $currdisp = $lt{'allposts'}; |
|
my $currmark = $lt{'onmark'}; |
|
|
|
if ($discdisp eq 'unread') { |
|
$dispchange = $lt{'allposts'}; |
|
$currdisp = $lt{'unread'}; |
|
$newdisp = 'allposts'; |
|
} |
|
|
|
if ($discmark eq 'ondisp') { |
|
$markchange = $lt{'onmark'}; |
|
$currmark = $lt{'ondisp'}; |
|
$newmark = 'onmark'; |
|
} |
|
|
|
$r->print(<<"END"); |
|
<form name="server" action="/adm/preferences" method="post"> |
|
<input type="hidden" name="action" value="verify_and_change_discussion" /> |
|
<br /> |
|
$lt{'sdpf'}<br/> $lt{'prca'} <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li></ol> |
|
<br /> |
|
<br /> |
|
<table border="0" cellpadding="0" cellspacing="0"> |
|
<tr> |
|
<td width="100%" bgcolor="#000000"> |
|
<table width="100%" border="0" cellpadding="1" cellspacing="0"> |
|
<tr> |
|
<td width="100%" bgcolor="#000000"> |
|
<table border="0" cellpadding="3" cellspacing="3" bgcolor="#FFFFFF"> |
|
<tr bgcolor="$color"> |
|
<td><b>$lt{'pref'}</b></td> |
|
<td><b>$lt{'curr'}</b></td> |
|
<td><b>$lt{'actn'}?</b></td> |
|
</tr> |
|
<tr bgcolor="#dddddd"> |
|
<td>$lt{'disa'}</td> |
|
<td>$lt{$discdisp}</td> |
|
<td><input type="checkbox" name="discdisp" /><input type="hidden" name="newdisp" value="$newdisp" /> $lt{'chgt'} "$dispchange"</td> |
|
</tr><tr bgcolor="#eeeeee"> |
|
<td>$lt{'npmr'}</td> |
|
<td>$lt{$discmark}</td> |
|
<td><input type="checkbox" name="discmark" /><input type="hidden" name="newmark" value="$newmark" /> $lt{'chgt'} "$markchange"</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
</table> |
|
<br /> |
|
<br /> |
|
<input type="submit" name="sub" value="Store Changes" /> |
|
<br /> |
|
<br /> |
|
Note: $lt{'thde'} |
|
</form> |
|
END |
|
} |
|
|
|
sub verify_and_change_discussion { |
|
my $r = shift; |
|
my $user = $ENV{'user.name'}; |
|
my $domain = $ENV{'user.domain'}; |
|
my $message=''; |
|
if (defined($ENV{'form.discdisp'}) ) { |
|
my $newdisp = $ENV{'form.newdisp'}; |
|
if ($newdisp eq 'unread') { |
|
$message .='In discussions: only new posts will be displayed.<br/>'; |
|
&Apache::lonnet::put('environment',{'discdisplay' => $newdisp}); |
|
&Apache::lonnet::appenv('environment.discdisplay' => $newdisp); |
|
} else { |
|
$message .= 'In discussions: all posts will be displayed.<br/>'; |
|
&Apache::lonnet::del('environment',['discdisplay']); |
|
&Apache::lonnet::delenv('environment\.discdisplay'); |
|
} |
|
} |
|
if (defined($ENV{'form.discmark'}) ) { |
|
my $newmark = $ENV{'form.newmark'}; |
|
if ($newmark eq 'ondisp') { |
|
$message.='In discussions: new posts will be cease to be identified as "new" after display.<br/>'; |
|
&Apache::lonnet::put('environment',{'discmarkread' => $newmark}); |
|
&Apache::lonnet::appenv('environment.discmarkread' => $newmark); |
|
} else { |
|
$message.='In discussions: posts will be identified as "new" until marked as read by the reader.<br/>'; |
|
&Apache::lonnet::del('environment',['discmarkread']); |
|
&Apache::lonnet::delenv('environment\.discmarkread'); |
|
} |
|
} |
|
$r->print(<<ENDVCSCREEN); |
|
</p> |
|
$message |
|
ENDVCSCREEN |
|
} |
|
|
###################################################### |
###################################################### |
# other handler subroutines # |
# other handler subroutines # |
###################################################### |
###################################################### |
Line 646 sub handler {
|
Line 985 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']); |
['action','wysiwyg','returnurl']); |
# |
# |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
Line 658 sub handler {
|
Line 997 sub handler {
|
my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain); |
my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain); |
if ($currentauth =~ /^(unix|internal):/) { |
if ($currentauth =~ /^(unix|internal):/) { |
push (@Options,({ action => 'changepass', |
push (@Options,({ action => 'changepass', |
linktext => 'Change password', |
linktext => 'Change Password', |
href => '/adm/preferences', |
href => '/adm/preferences', |
help => 'Change_Password', |
help => 'Change_Password', |
subroutine => \&passwordchanger, |
subroutine => \&passwordchanger, |
Line 692 sub handler {
|
Line 1031 sub handler {
|
})); |
})); |
|
|
push (@Options,({ action => 'changemsgforward', |
push (@Options,({ action => 'changemsgforward', |
linktext => 'Change Message Forwarding', |
linktext => 'Change Message Forwarding and Notification Addresses', |
text => 'and Notification Addresses', |
|
href => '/adm/preferences', |
href => '/adm/preferences', |
help => 'Prefs_Forwarding', |
help => 'Prefs_Forwarding', |
breadcrumb => |
breadcrumb => |
Line 711 sub handler {
|
Line 1049 sub handler {
|
'/adm/'.$ENV{'user.domain'}.'/'.$ENV{'user.name'}.'/aboutme'; |
'/adm/'.$ENV{'user.domain'}.'/'.$ENV{'user.name'}.'/aboutme'; |
push (@Options,{ action => 'none', |
push (@Options,{ action => 'none', |
linktext => |
linktext => |
q{Edit the 'About Me' personal information screen}, |
q{Edit the 'About Me' Personal Information Screen}, |
|
help => 'Prefs_About_Me', |
href => $aboutmeaction}); |
href => $aboutmeaction}); |
push (@Options,({ action => 'changecolors', |
push (@Options,({ action => 'changecolors', |
linktext => 'Change Color Scheme', |
linktext => 'Change Color Scheme', |
Line 730 sub handler {
|
Line 1069 sub handler {
|
subroutine => \&verify_and_change_colors, |
subroutine => \&verify_and_change_colors, |
})); |
})); |
push (@Options,({ action => 'changelanguages', |
push (@Options,({ action => 'changelanguages', |
linktext => 'Change Language Prefences', |
linktext => 'Change Language Preferences', |
href => '/adm/preferences', |
href => '/adm/preferences', |
|
help => 'Prefs_Language', |
breadcrumb=> |
breadcrumb=> |
{ href => '/adm/preferences?action=changelanguages', |
{ href => '/adm/preferences?action=changelanguages', |
text => 'Change Language'}, |
text => 'Change Language'}, |
Line 744 sub handler {
|
Line 1084 sub handler {
|
printmenu => 'yes', |
printmenu => 'yes', |
subroutine=>\&verify_and_change_languages, } |
subroutine=>\&verify_and_change_languages, } |
)); |
)); |
if ($ENV{'user.name'} =~ /^(albertel|koretemey|korte|hallmat3|turtle)$/) { |
push (@Options,({ action => 'changewysiwyg', |
|
linktext => 'Change WYSIWYG Editor Preferences', |
|
href => '/adm/preferences', |
|
breadcrumb => |
|
{ href => '/adm/preferences?action=changewysiwyg', |
|
text => 'Change WYSIWYG Preferences'}, |
|
subroutine => \&wysiwygchanger, |
|
}, |
|
{ action => 'set_wysiwyg', |
|
breadcrumb => |
|
{ href => '/adm/preferences?action=changewysiwyg', |
|
text => 'Change WYSIWYG Preferences'}, |
|
printmenu => 'yes', |
|
subroutine => \&verify_and_change_wysiwyg, } |
|
)); |
|
push (@Options,({ action => 'changediscussions', |
|
linktext => 'Change Discussion Display Preferences', |
|
href => '/adm/preferences', |
|
help => 'Change_Discussion_Display', |
|
breadcrumb => |
|
{ href => '/adm/preferences?action=changediscussions', |
|
text => 'Change Discussion Preferences'}, |
|
subroutine => \&discussionchanger, |
|
}, |
|
{ action => 'verify_and_change_discussion', |
|
breadcrumb => |
|
{ href => '/adm/preferences?action=changediscussions', |
|
text => 'Change Discussion Preferences'}, |
|
printmenu => 'yes', |
|
subroutine => \&verify_and_change_discussion, } |
|
)); |
|
|
|
push (@Options,({ action => 'changerolespref', |
|
linktext => 'Change Roles Page Preferences', |
|
href => '/adm/preferences', |
|
subroutine => \&rolesprefchanger, |
|
breadcrumb => |
|
{ href => '/adm/preferences?action=changerolespref', |
|
text => 'Change Roles Pref'}, |
|
}, |
|
{ action => 'verify_and_change_rolespref', |
|
subroutine => \&verify_and_change_rolespref, |
|
breadcrumb => |
|
{ href => '/adm/preferences?action=changerolespref', |
|
text => 'Change Roles Preferences'}, |
|
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)$/) { |
push (@Options,({ action => 'debugtoggle', |
push (@Options,({ action => 'debugtoggle', |
printmenu => 'yes', |
printmenu => 'yes', |
subroutine => \&toggle_debug, |
subroutine => \&toggle_debug, |
})); |
})); |
} |
} |
|
my $html=&Apache::lonxml::xmlbegin(); |
$r->print(<<ENDHEADER); |
$r->print(<<ENDHEADER); |
<html> |
$html |
<head> |
<head> |
<title>LON-CAPA Preferences</title> |
<title>LON-CAPA Preferences</title> |
</head> |
</head> |
ENDHEADER |
ENDHEADER |
my $call = undef; |
my $call = undef; |
|
my $help = undef; |
my $printmenu = 'yes'; |
my $printmenu = 'yes'; |
foreach my $option (@Options) { |
foreach my $option (@Options) { |
if ($option->{'action'} eq $ENV{'form.action'}) { |
if ($option->{'action'} eq $ENV{'form.action'}) { |
&Apache::lonnet::logthis('got action '.$option->{'action'}); |
|
$call = $option->{'subroutine'}; |
$call = $option->{'subroutine'}; |
$printmenu = $option->{'printmenu'}; |
$printmenu = $option->{'printmenu'}; |
if (exists($option->{'breadcrumb'})) { |
if (exists($option->{'breadcrumb'})) { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
($option->{'breadcrumb'}); |
($option->{'breadcrumb'}); |
} |
} |
|
$help=$option->{'help'}; |
} |
} |
} |
} |
$r->print(&Apache::loncommon::bodytag('Change Preferences')); |
$r->print(&Apache::loncommon::bodytag('Change Preferences')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
(undef,'Change Preferences')); |
(undef,'Change Preferences',$help)); |
if (defined($call)) { |
if (defined($call)) { |
$call->($r); |
$call->($r); |
} |
} |
if ($printmenu eq 'yes') { |
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|korte|hallmat3|turtle)$/ |
/^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle)$/ |
) { |
) { |
push (@Options,({ action => 'debugtoggle', |
push (@Options,({ action => 'debugtoggle', |
linktext => 'Toggle Debug Messages', |
linktext => 'Toggle Debug Messages', |
Line 795 ENDHEADER
|
Line 1202 ENDHEADER
|
$optiontext .= |
$optiontext .= |
'<a href="'.$option->{'href'}. |
'<a href="'.$option->{'href'}. |
'?action='.$option->{'action'}.'">'. |
'?action='.$option->{'action'}.'">'. |
$option->{'linktext'}.'</a>'; |
&mt($option->{'linktext'}).'</a>'; |
} |
} |
if (exists($option->{'text'})) { |
if (exists($option->{'text'})) { |
$optiontext .= ' '.$option->{'text'}; |
$optiontext .= ' '.&mt($option->{'text'}); |
} |
} |
if ($optiontext ne '') { |
if ($optiontext ne '') { |
$optiontext = '<font size="+1">'.$optiontext.'</font>'; |
$optiontext = '<font size="+1">'.$optiontext.'</font>'; |
Line 815 ENDHEADER
|
Line 1222 ENDHEADER
|
} |
} |
$optionlist .= '</table>'; |
$optionlist .= '</table>'; |
$r->print($optionlist); |
$r->print($optionlist); |
|
} elsif ($ENV{'form.returnurl'}) { |
|
$r->print('<br /><a href="'.$ENV{'form.returnurl'}.'"><font size="+1">'. |
|
&mt('Return').'</font></a>'); |
} |
} |
$r->print(<<ENDFOOTER); |
$r->print(&Apache::loncommon::endbodytag().'</html>'); |
</body> |
|
</html> |
|
ENDFOOTER |
|
return OK; |
return OK; |
} |
} |
|
|