--- loncom/interface/lonpreferences.pm 2003/04/01 22:21:45 1.18 +++ loncom/interface/lonpreferences.pm 2003/08/29 03:08:18 1.27 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.18 2003/04/01 22:21:45 www Exp $ +# $Id: lonpreferences.pm,v 1.27 2003/08/29 03:08:18 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,6 +50,7 @@ use Apache::File; use Crypt::DES; use DynaLoader; # for Crypt::DES version use Apache::loncommon(); +use Apache::lonhtmlcommon(); # # Write lonnet::passwd to do the call below. @@ -179,16 +180,23 @@ sub msgforwardchanger { my $r = shift; my $user = $ENV{'user.name'}; my $domain = $ENV{'user.domain'}; - my %userenv = &Apache::lonnet::get('environment',['msgforward']); + my %userenv = &Apache::lonnet::get('environment',['msgforward','notification','critnotification']); my $msgforward=$userenv{'msgforward'}; my $notification=$userenv{'notification'}; my $critnotification=$userenv{'critnotification'}; my $bodytag=&Apache::loncommon::bodytag( 'Change Your Message Forwarding and Notification'); + my $forwardingHelp = Apache::loncommon::help_open_topic("Prefs_Forwarding", + "What are forwarding ". + "and notification ". + "addresses"); + my $criticalMessageHelp = Apache::loncommon::help_open_topic("Course_Critical_Message", + "What are critical messages"); + $r->print(< $bodytag - +$forwardingHelp
New Forwarding Address(es) (user:domain,user:domain,...): @@ -196,7 +204,7 @@ New Forwarding Address(es) (user:dom New Message Notification Email Address(es) (joe\@doe.com,jane\@doe.edu,...):
New Critical Message Notification Email Address(es) (joe\@doe.com,jane\@doe.edu,...): -
+$criticalMessageHelp
@@ -265,6 +273,145 @@ $message ENDVCMSG } +################################################################ +# Colors # +################################################################ + +sub colorschanger { + my $r = shift; + my $bodytag=&Apache::loncommon::bodytag( + 'Change Color Scheme for Current Role Type','', + 'onUnload="pclose();"'); +# figure out colors + my $function='student'; + 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 %colortypes=('pgbg' => 'Page Background', + 'tabbg' => 'Header Background', + 'sidebg'=> 'Header Border', + 'font' => 'Font', + 'link' => 'Un-Visited Link', + 'vlink' => 'Visited Link', + 'alink' => 'Active Link'); + my $chtable=''; + foreach my $item (sort(keys(%colortypes))) { + my $curcol=&Apache::loncommon::designparm($function.'.'.$item,$domain); + $chtable.=''.$colortypes{$item}.'      Select'; + } + my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); + $r->print(< + +$bodytag +
+ + + +
+
+ + +$chtable +
+ + +
+ + +ENDCOL +} + +sub verify_and_change_colors { + my $r = shift; +# figure out colors + my $function='student'; + 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 %colortypes=('pgbg' => 'Page Background', + 'tabbg' => 'Header Background', + 'sidebg'=> 'Header Border', + 'font' => 'Font', + 'link' => 'Un-Visited Link', + 'vlink' => 'Visited Link', + 'alink' => 'Active Link'); + + my $message=''; + foreach my $item (keys %colortypes) { + my $color=$ENV{'form.'.$item}; + my $entry='color.'.$function.'.'.$item; + if (($color=~/^\#[0-9A-Fa-f]{6}$/) && (!$ENV{'form.resetall'})) { + &Apache::lonnet::put('environment',{$entry => $color}); + &Apache::lonnet::appenv('environment.'.$entry => $color); + $message.='Set '.$colortypes{$item}.' to '.$color.'
'; + } else { + &Apache::lonnet::del('environment',[$entry]); + &Apache::lonnet::delenv('environment\.'.$entry); + $message.='Reset '.$colortypes{$item}.'
'; + } + } + my $bodytag=&Apache::loncommon::bodytag( + 'Change Color Scheme for Current Role Type'); + $r->print(< +$bodytag +

+$message +
+ + +
+ +ENDVCCOL +} + ###################################################### # password handler subroutines # ###################################################### @@ -506,8 +653,14 @@ sub handler { &msgforwardchanger($r); } elsif ($ENV{'form.action'} eq 'verify_and_change_msgforward') { &verify_and_change_msgforward($r); + } elsif ($ENV{'form.action'} eq 'changecolors') { + &colorschanger($r); + } elsif ($ENV{'form.action'} eq 'verify_and_change_colors') { + &verify_and_change_colors($r); } elsif ($ENV{'form.action'} eq 'debugtoggle') { - if ($ENV{'user.name'} eq 'albertel' ) { + if (($ENV{'user.name'} eq 'albertel' ) || + ($ENV{'user.name'} eq 'kortemey' ) || + ($ENV{'user.name'} eq 'korte')) { if ($ENV{'user.debug'}) { &Apache::lonnet::delenv('user\.debug'); } else { @@ -552,10 +705,19 @@ ENDMSGFORWARDFORM $r->print(< - + ENDABOUTME - if ($ENV{'user.name'} eq 'albertel') { + $r->print(< + + + +ENDCOLORFORM + + if (($ENV{'user.name'} eq 'albertel' ) || + ($ENV{'user.name'} eq 'kortemey' ) || + ($ENV{'user.name'} eq 'korte')) { $r->print(<