');
+}
+
+################################################################
+# Language Change Subroutines #
+################################################################
sub languagechanger {
my $r = shift;
my $user = $ENV{'user.name'};
@@ -144,6 +177,83 @@ $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 .= "\n";
+ }
+
+ $r->print(<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.
+
+
+
+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.=" Display $hotlist_n Most Recent Roles\n";
+ }
+ }
+
+ $r->print(<
+$message
+ENDRPSCREEN
+}
+
+
################################################################
# Anonymous Discussion Name Change Subroutines #
@@ -628,6 +738,149 @@ ENDERROR
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");
+
+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. ';
+ &Apache::lonnet::put('environment',{'discdisplay' => $newdisp});
+ &Apache::lonnet::appenv('environment.discdisplay' => $newdisp);
+ } else {
+ $message .= 'In discussions: all posts will be displayed. ';
+ &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. ';
+ &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. ';
+ &Apache::lonnet::del('environment',['discmarkread']);
+ &Apache::lonnet::delenv('environment\.discmarkread');
+ }
+ }
+ $r->print(<
+$message
+ENDVCSCREEN
+}
+
######################################################
# other handler subroutines #
######################################################
@@ -646,7 +899,7 @@ sub handler {
return OK if $r->header_only;
#
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['action']);
+ ['action','wysiwyg','returnurl']);
#
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb
@@ -658,7 +911,7 @@ sub handler {
my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain);
if ($currentauth =~ /^(unix|internal):/) {
push (@Options,({ action => 'changepass',
- linktext => 'Change password',
+ linktext => 'Change Password',
href => '/adm/preferences',
help => 'Change_Password',
subroutine => \&passwordchanger,
@@ -692,8 +945,7 @@ sub handler {
}));
push (@Options,({ action => 'changemsgforward',
- linktext => 'Change Message Forwarding',
- text => 'and Notification Addresses',
+ linktext => 'Change Message Forwarding and Notification Addresses',
href => '/adm/preferences',
help => 'Prefs_Forwarding',
breadcrumb =>
@@ -711,7 +963,8 @@ sub handler {
'/adm/'.$ENV{'user.domain'}.'/'.$ENV{'user.name'}.'/aboutme';
push (@Options,{ action => 'none',
linktext =>
- q{Edit the 'About Me' personal information screen},
+ q{Edit the 'About Me' Personal Information Screen},
+ help => 'Prefs_About_Me',
href => $aboutmeaction});
push (@Options,({ action => 'changecolors',
linktext => 'Change Color Scheme',
@@ -730,8 +983,9 @@ sub handler {
subroutine => \&verify_and_change_colors,
}));
push (@Options,({ action => 'changelanguages',
- linktext => 'Change Language Prefences',
+ linktext => 'Change Language Preferences',
href => '/adm/preferences',
+ help => 'Prefs_Language',
breadcrumb=>
{ href => '/adm/preferences?action=changelanguages',
text => 'Change Language'},
@@ -744,6 +998,55 @@ sub handler {
printmenu => 'yes',
subroutine=>\&verify_and_change_languages, }
));
+ 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',
+ }));
+
+
if ($ENV{'user.name'} =~ /^(albertel|koretemey|korte|hallmat3|turtle)$/) {
push (@Options,({ action => 'debugtoggle',
printmenu => 'yes',
@@ -757,6 +1060,7 @@ sub handler {
ENDHEADER
my $call = undef;
+ my $help = undef;
my $printmenu = 'yes';
foreach my $option (@Options) {
if ($option->{'action'} eq $ENV{'form.action'}) {
@@ -766,15 +1070,16 @@ ENDHEADER
&Apache::lonhtmlcommon::add_breadcrumb
($option->{'breadcrumb'});
}
+ $help=$option->{'help'};
}
}
$r->print(&Apache::loncommon::bodytag('Change Preferences'));
$r->print(&Apache::lonhtmlcommon::breadcrumbs
- (undef,'Change Preferences'));
+ (undef,'Change Preferences',$help));
if (defined($call)) {
$call->($r);
}
- if ($printmenu eq 'yes') {
+ if (($printmenu eq 'yes') && (!$ENV{'form.returnurl'})) {
my $optionlist = '