version 1.53, 2005/02/17 08:29:43
|
version 1.92, 2006/06/22 23:30:33
|
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 40 use DynaLoader; # for Crypt::DES version
|
Line 41 use DynaLoader; # for Crypt::DES version
|
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonnet; |
|
|
# |
# |
# Write lonnet::passwd to do the call below. |
# Write lonnet::passwd to do the call below. |
Line 97 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="checked"'; |
my $offselect=''; |
my $offselect=''; |
my $onselect='checked="1"'; |
if ($userenv{'wysiwygeditor'} eq 'on') { |
if ($userenv{'wysiwygeditor'}) { |
|
$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'); |
$r->print(<<ENDLSCREEN); |
$r->print(<<ENDLSCREEN); |
<form name="server" action="/adm/preferences" method="post"> |
<form name="prefs" 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 118 ENDLSCREEN
|
Line 120 ENDLSCREEN
|
|
|
sub verify_and_change_wysiwyg { |
sub verify_and_change_wysiwyg { |
my $r = shift; |
my $r = shift; |
my $newsetting=$ENV{'form.wysiwyg'}; |
my $newsetting=$env{'form.wysiwyg'}; |
&Apache::lonnet::put('environment',{'wysiwygeditor' => $newsetting}); |
&Apache::lonnet::put('environment',{'wysiwygeditor' => $newsetting}); |
&Apache::lonnet::appenv('environment.wysiwygeditor' => $newsetting); |
&Apache::lonnet::appenv('environment.wysiwygeditor' => $newsetting); |
$r->print('<p>'.&mt('Setting WYSIWYG editor to:').' '.&mt($newsetting).'</p>'); |
$r->print('<p>'.&mt('Setting WYSIWYG editor to:').' '.&mt($newsetting).'</p>'); |
Line 129 sub verify_and_change_wysiwyg {
|
Line 131 sub verify_and_change_wysiwyg {
|
################################################################ |
################################################################ |
sub languagechanger { |
sub languagechanger { |
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 %userenv = &Apache::lonnet::get |
my %userenv = &Apache::lonnet::get |
('environment',['languages']); |
('environment',['languages']); |
my $language=$userenv{'languages'}; |
my $language=$userenv{'languages'}; |
Line 146 sub languagechanger {
|
Line 148 sub languagechanger {
|
my $selectionbox=&Apache::loncommon::select_form($language,'language', |
my $selectionbox=&Apache::loncommon::select_form($language,'language', |
%langchoices); |
%langchoices); |
$r->print(<<ENDLSCREEN); |
$r->print(<<ENDLSCREEN); |
<form name="server" action="/adm/preferences" method="post"> |
<form name="prefs" action="/adm/preferences" method="post"> |
<input type="hidden" name="action" value="verify_and_change_languages" /> |
<input type="hidden" name="action" value="verify_and_change_languages" /> |
<br />$pref: $selectionbox |
<br />$pref: $selectionbox |
ENDLSCREEN |
ENDLSCREEN |
Line 156 ENDLSCREEN
|
Line 158 ENDLSCREEN
|
|
|
sub verify_and_change_languages { |
sub verify_and_change_languages { |
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'}; |
# Screenname |
# Screenname |
my $newlanguage = $ENV{'form.language'}; |
my $newlanguage = $env{'form.language'}; |
$newlanguage=~s/[^\-\w]//g; |
$newlanguage=~s/[^\-\w]//g; |
my $message=''; |
my $message=''; |
if ($newlanguage) { |
if ($newlanguage) { |
Line 172 sub verify_and_change_languages {
|
Line 174 sub verify_and_change_languages {
|
$message='Reset preferred language'; |
$message='Reset preferred language'; |
} |
} |
$r->print(<<ENDVCSCREEN); |
$r->print(<<ENDVCSCREEN); |
|
$message |
|
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=('' => 'Default', |
|
'tth' => 'TeX to HTML', |
|
#'ttm' => 'TeX to MathML', |
|
'jsMath' => 'jsMath', |
|
'mimetex' => 'Convert to Images' |
|
); |
|
my $selectionbox=&Apache::loncommon::select_form($texengine,'texengine', |
|
%mathchoices); |
|
my $jsMath_start=&Apache::lontexconvert::jsMath_header(); |
|
my $change=&mt('Change'); |
|
$r->print(<<ENDLSCREEN); |
|
<br /> |
|
|
|
<form name="prefs" 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 /> |
|
<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=tth" width="400" hieght="200"></iframe> |
|
</p> |
|
<p>jsMath <br /> |
|
$jsMath_start |
|
<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> |
|
<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=jsMath" width="400" hieght="200"></iframe> |
|
|
</p> |
</p> |
|
<p> Convert to Images <br /> |
|
<br /> |
|
<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=mimetex" width="400" hieght="200"></iframe> |
|
</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; |
|
if ($newtexengine eq 'ttm') { |
|
&Apache::lonnet::appenv('browser.mathml' => 1); |
|
} else { |
|
if ($env{'environment.texengine'} eq 'ttm') { |
|
&Apache::lonnet::appenv('browser.mathml' => 0); |
|
} |
|
} |
|
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); |
$message |
$message |
ENDVCSCREEN |
ENDVCSCREEN |
} |
} |
Line 182 ENDVCSCREEN
|
Line 279 ENDVCSCREEN
|
################################################################ |
################################################################ |
sub rolesprefchanger { |
sub rolesprefchanger { |
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 %userenv = &Apache::lonnet::get |
my %userenv = &Apache::lonnet::get |
('environment',['recentroles','recentrolesn']); |
('environment',['recentroles','recentrolesn']); |
my $hotlist_flag=$userenv{'recentroles'}; |
my $hotlist_flag=$userenv{'recentroles'}; |
Line 201 sub rolesprefchanger {
|
Line 298 sub rolesprefchanger {
|
$options .= "<option $select>$i</option>\n"; |
$options .= "<option $select>$i</option>\n"; |
} |
} |
|
|
$r->print(<<ENDSCREEN); |
# Get list of recent roles and display with checkbox in front |
<p>Some LON-CAPA users have a long list of roles. The Recent Roles Hotlist |
my $roles_check_list = ''; |
feature keeps track of the last N roles which have been |
my $role_key=''; |
visited and places a table of these at the top of the roles page. |
if ($env{'environment.recentroles'}) { |
People with very few roles should leave this feature disabled. |
my %recent_roles = |
</p> |
&Apache::lonhtmlcommon::get_recent('roles',$env{'environment.recentrolesn'}); |
|
my %frozen_roles = |
|
&Apache::lonhtmlcommon::get_recent_frozen('roles',$env{'environment.recentrolesn'}); |
|
|
|
my %role_text = &rolespref_get_role_text(keys(%recent_roles)); |
|
my @sorted_roles = sort {$role_text{$a} cmp $role_text{$b}} keys(%role_text); |
|
|
|
$roles_check_list .= |
|
&Apache::loncommon::start_data_table(). |
|
&Apache::loncommon::start_data_table_header_row(). |
|
"<th>".&mt('Freeze Role')."</th>". |
|
"<th>".&mt('Role')."</td>". |
|
&Apache::loncommon::end_data_table_header_row(). |
|
"\n"; |
|
my $count; |
|
foreach $role_key (@sorted_roles) { |
|
my $checked = ""; |
|
my $value = $recent_roles{$role_key}; |
|
if ($frozen_roles{$role_key}) { |
|
$checked = "checked=\"checked\""; |
|
} |
|
$count++; |
|
$roles_check_list .= |
|
&Apache::loncommon::start_data_table_row(). |
|
'<td class="LC_table_cell_checkbox">'. |
|
"<input type=\"checkbox\" $checked name=\"freezeroles\"". |
|
" id=\"freezeroles$count\" value=\"$role_key\" /></td>". |
|
"<td><label for=\"freezeroles$count\">". |
|
"$role_text{$role_key}</label></td>". |
|
&Apache::loncommon::end_data_table_row(). "\n"; |
|
} |
|
$roles_check_list .= "</table>\n"; |
|
} |
|
|
<form name="server" action="/adm/preferences" method="post"> |
$r->print(' |
|
<p>'.&mt('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="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>'.&mt('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 />'.&mt('Number of roles in Hotlist:').' |
<select name="recentrolesn" size="1"> |
<select name="recentrolesn" size="1"> |
$options |
'.$options.' |
</select> |
</select> |
|
<p>'.&mt('This list below can be used to <q>freeze</q> roles on your screen. Those marked as frozen will not be removed from the list, even if they have not been used recently.').' |
|
</p> |
|
'.$roles_check_list.' |
<br /> |
<br /> |
<input type="submit" value="Change" /> |
<input type="submit" value="'.&mt('Change').'" /> |
</form> |
</form>'); |
ENDSCREEN |
} |
|
|
|
sub rolespref_get_role_text { |
|
# Get a line of text for each role |
|
my ($roles) = @_; |
|
my %roletext = (); |
|
|
|
foreach my $item (@$roles) { |
|
# get course information |
|
my ($role,$rest) = split(/\./, $item); |
|
my $trole = &Apache::lonnet::plaintext($role); |
|
my ($tdomain,$other,$tsection)= split(/\//,Apache::lonnet::declutter($rest)); |
|
my $tother = '-'; |
|
if ($role =~ /cc|st|in|ta/ ) { |
|
my %newhash=&Apache::lonnet::coursedescription($tdomain."_".$other); |
|
$tother = " - ".$newhash{'description'}; |
|
} elsif ($role =~ /dc/) { |
|
$tother = ""; |
|
} else { |
|
$tother = " - $other"; |
|
} |
|
|
|
my $section=""; |
|
if ($tsection) { |
|
$section = " - Section/Group: $tsection"; |
|
} |
|
$roletext{$item} = $tdomain." - ".$trole.$tother.$section; |
|
} |
|
return %roletext; |
} |
} |
|
|
sub verify_and_change_rolespref { |
sub verify_and_change_rolespref { |
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'}; |
# Recent Roles Hotlist Flag |
# Recent Roles Hotlist Flag |
my $hotlist_flag = $ENV{'form.recentroles'}; |
my $hotlist_flag = $env{'form.recentroles'}; |
my $hotlist_n = $ENV{'form.recentrolesn'}; |
my $hotlist_n = $env{'form.recentrolesn'}; |
my $message=''; |
my $message='<hr />'; |
if ($hotlist_flag) { |
if ($hotlist_flag) { |
&Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag}); |
&Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag}); |
&Apache::lonnet::appenv('environment.recentroles' => $hotlist_flag); |
&Apache::lonnet::appenv('environment.recentroles' => $hotlist_flag); |
$message='Recent Roles Hotlist is Enabled'; |
$message=&mt('Recent Roles Hotlist is Enabled'); |
} else { |
} else { |
&Apache::lonnet::del('environment',['recentroles']); |
&Apache::lonnet::del('environment',['recentroles']); |
&Apache::lonnet::delenv('environment\.recentroles'); |
&Apache::lonnet::delenv('environment\.recentroles'); |
$message='Recent Roles Hotlist is Disabled'; |
$message=&mt('Recent Roles Hotlist is Disabled'); |
} |
} |
if ($hotlist_n) { |
if ($hotlist_n) { |
&Apache::lonnet::put('environment',{'recentrolesn' => $hotlist_n}); |
&Apache::lonnet::put('environment',{'recentrolesn' => $hotlist_n}); |
&Apache::lonnet::appenv('environment.recentrolesn' => $hotlist_n); |
&Apache::lonnet::appenv('environment.recentrolesn' => $hotlist_n); |
if ($hotlist_flag) { |
if ($hotlist_flag) { |
$message.="<br />Display $hotlist_n Most Recent Roles\n"; |
$message.="<br />". |
|
&mt('Display [_1] Most Recent Roles',$hotlist_n)."\n"; |
|
} |
|
} |
|
|
|
# Get list of froze roles and list of recent roles |
|
my @freeze_list = &Apache::loncommon::get_env_multiple('form.freezeroles'); |
|
my %freeze = (); |
|
my %roletext = (); |
|
|
|
foreach my $key (@freeze_list) { |
|
$freeze{$key}='1'; |
|
} |
|
|
|
my %recent_roles = |
|
&Apache::lonhtmlcommon::get_recent('roles',$env{'environment.recentrolesn'}); |
|
my %frozen_roles = |
|
&Apache::lonhtmlcommon::get_recent_frozen('roles',$env{'environment.recentrolesn'}); |
|
my %role_text = &rolespref_get_role_text([keys(%recent_roles)]); |
|
|
|
# Unset any roles that were previously frozen but aren't in list |
|
foreach my $role_key (sort(keys(%recent_roles))) { |
|
if (($frozen_roles{$role_key}) && (!exists($freeze{$role_key}))) { |
|
$message .= "<br />".&mt('Unfreezing Role: [_1]',$role_text{$role_key})."\n"; |
|
&Apache::lonhtmlcommon::store_recent('roles',$role_key,' ',0); |
} |
} |
} |
} |
|
|
|
# Freeze selected roles |
|
foreach my $role_key (@freeze_list) { |
|
if (!$frozen_roles{$role_key}) { |
|
$message .= "<br />".&mt('Freezing Role: [_1]',$role_text{$role_key})."\n"; |
|
&Apache::lonhtmlcommon::store_recent('roles', |
|
$role_key,' ',1); |
|
} |
|
} |
|
$message .= "<hr /><br />\n"; |
|
|
$r->print(<<ENDRPSCREEN); |
$r->print(<<ENDRPSCREEN); |
</p> |
|
$message |
$message |
ENDRPSCREEN |
ENDRPSCREEN |
} |
} |
Line 260 ENDRPSCREEN
|
Line 456 ENDRPSCREEN
|
################################################################ |
################################################################ |
sub screennamechanger { |
sub screennamechanger { |
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 %userenv = &Apache::lonnet::get |
my %userenv = &Apache::lonnet::get |
('environment',['screenname','nickname']); |
('environment',['screenname','nickname']); |
my $screenname=$userenv{'screenname'}; |
my $screenname=$userenv{'screenname'}; |
my $nickname=$userenv{'nickname'}; |
my $nickname=$userenv{'nickname'}; |
$r->print(<<ENDSCREEN); |
$r->print(<<ENDSCREEN); |
<form name="server" action="/adm/preferences" method="post"> |
<form name="prefs" action="/adm/preferences" method="post"> |
<input type="hidden" name="action" value="verify_and_change_screenname" /> |
<input type="hidden" name="action" value="verify_and_change_screenname" /> |
<br />New screenname (shown if you post anonymously): |
<br />New screenname (shown if you post anonymously): |
<input type="text" size="20" value="$screenname" name="screenname" /> |
<input type="text" size="20" value="$screenname" name="screenname" /> |
Line 280 ENDSCREEN
|
Line 476 ENDSCREEN
|
|
|
sub verify_and_change_screenname { |
sub verify_and_change_screenname { |
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'}; |
# Screenname |
# Screenname |
my $newscreen = $ENV{'form.screenname'}; |
my $newscreen = $env{'form.screenname'}; |
$newscreen=~s/[^ \w]//g; |
$newscreen=~s/[^ \w]//g; |
my $message=''; |
my $message=''; |
if ($newscreen) { |
if ($newscreen) { |
Line 297 sub verify_and_change_screenname {
|
Line 493 sub verify_and_change_screenname {
|
} |
} |
# Nickname |
# Nickname |
$message.='<br />'; |
$message.='<br />'; |
$newscreen = $ENV{'form.nickname'}; |
$newscreen = $env{'form.nickname'}; |
$newscreen=~s/[^ \w]//g; |
$newscreen=~s/[^ \w]//g; |
if ($newscreen) { |
if ($newscreen) { |
&Apache::lonnet::put('environment',{'nickname' => $newscreen}); |
&Apache::lonnet::put('environment',{'nickname' => $newscreen}); |
Line 308 sub verify_and_change_screenname {
|
Line 504 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); |
</p> |
|
$message |
$message |
ENDVCSCREEN |
ENDVCSCREEN |
} |
} |
Line 321 ENDVCSCREEN
|
Line 516 ENDVCSCREEN
|
|
|
sub msgforwardchanger { |
sub msgforwardchanger { |
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 %userenv = &Apache::lonnet::get('environment',['msgforward','notification','critnotification']); |
my %userenv = &Apache::lonnet::get('environment',['msgforward','notification','critnotification']); |
my $msgforward=$userenv{'msgforward'}; |
my $msgforward=$userenv{'msgforward'}; |
my $notification=$userenv{'notification'}; |
my $notification=$userenv{'notification'}; |
Line 336 sub msgforwardchanger {
|
Line 531 sub msgforwardchanger {
|
|
|
$r->print(<<ENDMSG); |
$r->print(<<ENDMSG); |
$forwardingHelp <br /> |
$forwardingHelp <br /> |
<form name="server" action="/adm/preferences" method="post"> |
<form name="prefs" action="/adm/preferences" method="post"> |
<input type="hidden" name="action" value="verify_and_change_msgforward" /> |
<input type="hidden" name="action" value="verify_and_change_msgforward" /> |
New Forwarding Address(es) (<tt>user:domain,user:domain,...</tt>): |
New Forwarding Address(es) (<tt>user:domain,user:domain,...</tt>): |
<input type="text" size="40" value="$msgforward" name="msgforward" /><hr /> |
<input type="text" size="40" value="$msgforward" name="msgforward" /><hr /> |
Line 351 ENDMSG
|
Line 546 ENDMSG
|
|
|
sub verify_and_change_msgforward { |
sub verify_and_change_msgforward { |
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 $newscreen = ''; |
my $newscreen = ''; |
my $message=''; |
my $message=''; |
foreach (split(/\,/,$ENV{'form.msgforward'})) { |
foreach (split(/\,/,$env{'form.msgforward'})) { |
my ($msuser,$msdomain)=split(/[\@\:]/,$_); |
my ($msuser,$msdomain)=split(/[\@\:]/,$_); |
$msuser=~s/\W//g; |
$msuser=~s/\W//g; |
$msdomain=~s/\W//g; |
$msdomain=~s/\W//g; |
Line 377 sub verify_and_change_msgforward {
|
Line 572 sub verify_and_change_msgforward {
|
&Apache::lonnet::delenv('environment\.msgforward'); |
&Apache::lonnet::delenv('environment\.msgforward'); |
$message.='Reset message forwarding<br />'; |
$message.='Reset message forwarding<br />'; |
} |
} |
my $notification=$ENV{'form.notification'}; |
my $notification=$env{'form.notification'}; |
$notification=~s/\s//gs; |
$notification=~s/\s//gs; |
if ($notification) { |
if ($notification) { |
&Apache::lonnet::put('environment',{'notification' => $notification}); |
&Apache::lonnet::put('environment',{'notification' => $notification}); |
Line 388 sub verify_and_change_msgforward {
|
Line 583 sub verify_and_change_msgforward {
|
&Apache::lonnet::delenv('environment\.notification'); |
&Apache::lonnet::delenv('environment\.notification'); |
$message.='Reset message notification<br />'; |
$message.='Reset message notification<br />'; |
} |
} |
my $critnotification=$ENV{'form.critnotification'}; |
my $critnotification=$env{'form.critnotification'}; |
$critnotification=~s/\s//gs; |
$critnotification=~s/\s//gs; |
if ($critnotification) { |
if ($critnotification) { |
&Apache::lonnet::put('environment',{'critnotification' => $critnotification}); |
&Apache::lonnet::put('environment',{'critnotification' => $critnotification}); |
Line 400 sub verify_and_change_msgforward {
|
Line 595 sub verify_and_change_msgforward {
|
$message.='Reset critical message notification<br />'; |
$message.='Reset critical message notification<br />'; |
} |
} |
$r->print(<<ENDVCMSG); |
$r->print(<<ENDVCMSG); |
</p> |
|
$message |
$message |
ENDVCMSG |
ENDVCMSG |
} |
} |
Line 412 ENDVCMSG
|
Line 606 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 431 sub colorschanger {
|
Line 615 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. |
'"> </td><td><input name="'.$item. |
'"> </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 457 sub colorschanger {
|
Line 645 sub colorschanger {
|
pclose(); |
pclose(); |
if (document.parmform.pres_marker.value!='') { |
if (document.parmform.pres_marker.value!='') { |
if (document.parmform.pres_type.value!='') { |
if (document.parmform.pres_type.value!='') { |
eval('document.server.'+ |
eval('document.prefs.'+ |
document.parmform.pres_marker.value+ |
document.parmform.pres_marker.value+ |
'.value=document.parmform.pres_value.value;'); |
'.value=document.parmform.pres_value.value;'); |
} |
} |
Line 474 sub colorschanger {
|
Line 662 sub colorschanger {
|
<input type="hidden" name="pres_type" /> |
<input type="hidden" name="pres_type" /> |
<input type="hidden" name="pres_value" /> |
<input type="hidden" name="pres_value" /> |
</form> |
</form> |
<form name="server" 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 488 ENDCOL
|
Line 677 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 510 sub verify_and_change_colors {
|
Line 689 sub verify_and_change_colors {
|
|
|
my $message=''; |
my $message=''; |
foreach my $item (keys %colortypes) { |
foreach my $item (keys %colortypes) { |
my $color=$ENV{'form.'.$item}; |
my $color=$env{'form.'.$item}; |
my $entry='color.'.$function.'.'.$item; |
my $entry='color.'.$function.'.'.$item; |
if (($color=~/^\#[0-9A-Fa-f]{6}$/) && (!$ENV{'form.resetall'})) { |
if (($color=~/^\#[0-9A-Fa-f]{6}$/) && (!$env{'form.resetall'})) { |
&Apache::lonnet::put('environment',{$entry => $color}); |
&Apache::lonnet::put('environment',{$entry => $color}); |
&Apache::lonnet::appenv('environment.'.$entry => $color); |
&Apache::lonnet::appenv('environment.'.$entry => $color); |
$message.='Set '.$colortypes{$item}.' to '.$color.'<br />'; |
$message.='Set '.$colortypes{$item}.' to '.$color.'<br />'; |
Line 522 sub verify_and_change_colors {
|
Line 701 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); |
</p> |
|
$message |
$message |
<form name="client" action="/adm/preferences" method="post"> |
<form name="client" action="/adm/preferences" method="post"> |
<input type="hidden" name="action" value="changecolors" /> |
<input type="hidden" name="action" value="changecolors" /> |
Line 540 sub passwordchanger {
|
Line 722 sub passwordchanger {
|
my $r = shift; |
my $r = shift; |
my $errormessage = shift; |
my $errormessage = shift; |
$errormessage = ($errormessage || ''); |
$errormessage = ($errormessage || ''); |
my $user = $ENV{'user.name'}; |
my $user = $env{'user.name'}; |
my $domain = $ENV{'user.domain'}; |
my $domain = $env{'user.domain'}; |
my $homeserver = $ENV{'user.home'}; |
my $homeserver = $env{'user.home'}; |
my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain); |
my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain); |
# 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):/); |
Line 567 sub passwordchanger {
|
Line 749 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 |
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 642 ENDFORM
|
Line 822 ENDFORM
|
|
|
sub verify_and_change_password { |
sub verify_and_change_password { |
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 $homeserver = $ENV{'user.home'}; |
my $homeserver = $env{'user.home'}; |
my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain); |
my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain); |
# 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(); |
my $currentpass = $env{'form.currentpass'}; |
$r->print(<<ENDHEADER); |
my $newpass1 = $env{'form.newpass_1'}; |
$html |
my $newpass2 = $env{'form.newpass_2'}; |
<head> |
my $logtoken = $env{'form.logtoken'}; |
<title>LON-CAPA Preferences: Change password for $user</title> |
|
</head> |
|
ENDHEADER |
|
# |
|
my $currentpass = $ENV{'form.currentpass'}; |
|
my $newpass1 = $ENV{'form.newpass_1'}; |
|
my $newpass2 = $ENV{'form.newpass_2'}; |
|
my $logtoken = $ENV{'form.logtoken'}; |
|
# Check for empty data |
# Check for empty data |
unless (defined($currentpass) && |
unless (defined($currentpass) && |
defined($newpass1) && |
defined($newpass1) && |
Line 681 password decryption. Please log out and
|
Line 853 password decryption. Please log out and
|
</p> |
</p> |
ENDERROR |
ENDERROR |
# Probably should log an error here |
# Probably should log an error here |
return; |
return 1; |
} |
} |
my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo); |
my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo); |
# |
# |
Line 694 ENDERROR
|
Line 866 ENDERROR
|
'<font color="#ff0000">ERROR:</font>'. |
'<font color="#ff0000">ERROR:</font>'. |
'The new passwords you entered do not match. '. |
'The new passwords you entered do not match. '. |
'Please try again.'); |
'Please try again.'); |
return; |
return 1; |
} |
} |
if (length($newpass1) < 7) { |
if (length($newpass1) < 7) { |
&passwordchanger($r, |
&passwordchanger($r, |
'<font color="#ff0000">ERROR:</font>'. |
'<font color="#ff0000">ERROR:</font>'. |
'Passwords must be a minimum of 7 characters long. '. |
'Passwords must be a minimum of 7 characters long. '. |
'Please try again.'); |
'Please try again.'); |
return; |
return 1; |
} |
} |
# |
# |
# Check for bad characters |
# Check for bad characters |
Line 736 ENDTEXT
|
Line 908 ENDTEXT
|
<h2><font color="#ff0000">The password for $user was not changed</font></h2> |
<h2><font color="#ff0000">The password for $user was not changed</font></h2> |
Please make sure your old password was entered correctly. |
Please make sure your old password was entered correctly. |
ENDERROR |
ENDERROR |
|
return 1; |
} |
} |
return; |
return; |
} |
} |
Line 745 ENDERROR
|
Line 918 ENDERROR
|
################################################################ |
################################################################ |
sub discussionchanger { |
sub discussionchanger { |
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 %userenv = &Apache::lonnet::get |
my %userenv = &Apache::lonnet::get |
('environment',['discdisplay','discmarkread']); |
('environment',['discdisplay','discmarkread']); |
my $discdisp = 'allposts'; |
my $discdisp = 'allposts'; |
Line 768 sub discussionchanger {
|
Line 941 sub discussionchanger {
|
|
|
my $function = &Apache::loncommon::get_users_function(); |
my $function = &Apache::loncommon::get_users_function(); |
my $color = &Apache::loncommon::designparm($function.'.tabbg', |
my $color = &Apache::loncommon::designparm($function.'.tabbg', |
$ENV{'user.domain'}); |
$env{'user.domain'}); |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'pref' => 'Display Preference', |
'pref' => 'Display Preference', |
'curr' => 'Current setting ', |
'curr' => 'Current setting ', |
Line 804 sub discussionchanger {
|
Line 977 sub discussionchanger {
|
} |
} |
|
|
$r->print(<<"END"); |
$r->print(<<"END"); |
<form name="server" 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" /> $lt{'chgt'} "$dispchange"</td> |
<td><label><input type="checkbox" name="discdisp" /><input type="hidden" name="newdisp" value="$newdisp" /> $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" /> $lt{'chgt'} "$markchange"</td> |
<td><label><input type="checkbox" name="discmark" /><input type="hidden" name="newmark" value="$newmark" /> $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 850 END
|
Line 1021 END
|
|
|
sub verify_and_change_discussion { |
sub verify_and_change_discussion { |
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 $message=''; |
my $message=''; |
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'); |
} |
} |
} |
} |
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'); |
} |
} |
} |
} |
$r->print(<<ENDVCSCREEN); |
$r->print(<<ENDVCSCREEN); |
</p> |
|
$message |
$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 = ''; |
|
my $whatsnewselect = 'checked="checked"'; |
|
if (exists($userenv{'course_init_display'})) { |
|
if ($userenv{'course_init_display'} eq 'firstres') { |
|
$currvalue = 'firstres'; |
|
$firstselect = 'checked="checked"'; |
|
$whatsnewselect = ''; |
|
} |
|
} |
|
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> '.&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="prefs" action="/adm/preferences" method="post"> |
|
<input type="hidden" name="action" value="verify_and_change_coursepage" /> |
|
<br /> |
|
<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 892 ENDVCSCREEN
|
Line 1141 ENDVCSCREEN
|
################################################################ |
################################################################ |
sub handler { |
sub handler { |
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'}; |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
# Some pages contain DES keys and should not be cached. |
# Some pages contain DES keys and should not be cached. |
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
Line 901 sub handler {
|
Line 1150 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 926 sub handler {
|
Line 1175 sub handler {
|
breadcrumb => |
breadcrumb => |
{ href =>'/adm/preferences?action=changepass', |
{ href =>'/adm/preferences?action=changepass', |
text => 'Change Password'}, |
text => 'Change Password'}, |
printmenu => 'yes', |
printmenu => 'not_on_error', |
})); |
})); |
} |
} |
push (@Options,({ action => 'changescreenname', |
push (@Options,({ action => 'changescreenname', |
Line 962 sub handler {
|
Line 1211 sub handler {
|
printmenu => 'yes', |
printmenu => 'yes', |
subroutine => \&verify_and_change_msgforward })); |
subroutine => \&verify_and_change_msgforward })); |
my $aboutmeaction= |
my $aboutmeaction= |
'/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}, |
Line 1048 sub handler {
|
Line 1297 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{'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'}) |
|
|| &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/' |
|
.$env{'request.course.sec'})) { |
|
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)$/) { |
if ($env{'user.name'} =~ /^(albertel|fox|foxr|koretemey|korte|hallmat3|turtle|raeburn)$/) { |
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(&Apache::loncommon::start_page('Change Preferences')); |
$html |
|
<head> |
|
<title>LON-CAPA Preferences</title> |
|
</head> |
|
ENDHEADER |
|
my $call = undef; |
my $call = undef; |
my $help = 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'}) { |
$call = $option->{'subroutine'}; |
$call = $option->{'subroutine'}; |
$printmenu = $option->{'printmenu'}; |
$printmenu = $option->{'printmenu'}; |
if (exists($option->{'breadcrumb'})) { |
if (exists($option->{'breadcrumb'})) { |
Line 1076 ENDHEADER
|
Line 1367 ENDHEADER
|
$help=$option->{'help'}; |
$help=$option->{'help'}; |
} |
} |
} |
} |
$r->print(&Apache::loncommon::bodytag('Change Preferences')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Change Preferences',$help)); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
my $error; |
(undef,'Change Preferences',$help)); |
|
if (defined($call)) { |
if (defined($call)) { |
$call->($r); |
$error = $call->($r); |
} |
} |
if (($printmenu eq 'yes') && (!$ENV{'form.returnurl'})) { |
if ( ( ($printmenu eq 'yes') |
|
|| ($printmenu eq 'not_on_error' && !$error) ) |
|
&& (!$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', |
text => 'Current Debug status is -'. |
text => 'Current Debug status is -'. |
$ENV{'user.debug'}.'-.', |
$env{'user.debug'}.'-.', |
href => '/adm/preferences', |
href => '/adm/preferences', |
printmenu => 'yes', |
printmenu => 'yes', |
subroutine => \&toggle_debug, |
subroutine => \&toggle_debug, |
Line 1099 ENDHEADER
|
Line 1391 ENDHEADER
|
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'})) { |
Line 1122 ENDHEADER
|
Line 1415 ENDHEADER
|
} |
} |
$optionlist .= '</table>'; |
$optionlist .= '</table>'; |
$r->print($optionlist); |
$r->print($optionlist); |
} elsif ($ENV{'form.returnurl'}) { |
} elsif ($env{'form.returnurl'}) { |
$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::end_page()); |
</body> |
|
</html> |
|
ENDFOOTER |
|
return OK; |
return OK; |
} |
} |
|
|
sub toggle_debug { |
sub toggle_debug { |
if ($ENV{'user.debug'}) { |
if ($env{'user.debug'}) { |
&Apache::lonnet::delenv('user\.debug'); |
&Apache::lonnet::delenv('user\.debug'); |
} else { |
} else { |
&Apache::lonnet::appenv('user.debug' => 1); |
&Apache::lonnet::appenv('user.debug' => 1); |