--- loncom/interface/lonpreferences.pm 2004/11/19 20:17:52 1.50
+++ loncom/interface/lonpreferences.pm 2006/05/01 22:54:43 1.83
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.50 2004/11/19 20:17:52 albertel Exp $
+# $Id: lonpreferences.pm,v 1.83 2006/05/01 22:54:43 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,6 +40,7 @@ use DynaLoader; # for Crypt::DES version
use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::lonlocal;
+use Apache::lonnet;
#
# Write lonnet::passwd to do the call below.
@@ -97,20 +98,20 @@ sub wysiwygchanger {
my $r = shift;
my %userenv = &Apache::lonnet::get
('environment',['wysiwygeditor']);
+ my $onselect='checked="checked"';
my $offselect='';
- my $onselect='checked="1"';
- if ($userenv{'wysiwygeditor'}) {
+ if ($userenv{'wysiwygeditor'} eq 'on') {
$onselect='';
- $offselect='checked="1"';
+ $offselect='checked="checked"';
}
my $switchoff=&mt('Disable WYSIWYG editor');
my $switchon=&mt('Enable WYSIWYG editor');
$r->print(<
+
ENDERROR
# Probably should log an error here
- return;
+ return 1;
}
my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo);
#
@@ -692,14 +761,14 @@ ENDERROR
'ERROR:'.
'The new passwords you entered do not match. '.
'Please try again.');
- return;
+ return 1;
}
if (length($newpass1) < 7) {
&passwordchanger($r,
'ERROR:'.
'Passwords must be a minimum of 7 characters long. '.
'Please try again.');
- return;
+ return 1;
}
#
# Check for bad characters
@@ -734,6 +803,7 @@ ENDTEXT
The password for $user was not changed
Please make sure your old password was entered correctly.
ENDERROR
+ return 1;
}
return;
}
@@ -743,8 +813,8 @@ ENDERROR
################################################################
sub discussionchanger {
my $r = shift;
- my $user = $ENV{'user.name'};
- my $domain = $ENV{'user.domain'};
+ my $user = $env{'user.name'};
+ my $domain = $env{'user.domain'};
my %userenv = &Apache::lonnet::get
('environment',['discdisplay','discmarkread']);
my $discdisp = 'allposts';
@@ -766,7 +836,7 @@ sub discussionchanger {
my $function = &Apache::loncommon::get_users_function();
my $color = &Apache::loncommon::designparm($function.'.tabbg',
- $ENV{'user.domain'});
+ $env{'user.domain'});
my %lt = &Apache::lonlocal::texthash(
'pref' => 'Display Preference',
'curr' => 'Current setting ',
@@ -802,40 +872,38 @@ sub discussionchanger {
}
$r->print(<<"END");
-
@@ -848,11 +916,11 @@ END
sub verify_and_change_discussion {
my $r = shift;
- my $user = $ENV{'user.name'};
- my $domain = $ENV{'user.domain'};
+ my $user = $env{'user.name'};
+ my $domain = $env{'user.domain'};
my $message='';
- if (defined($ENV{'form.discdisp'}) ) {
- my $newdisp = $ENV{'form.newdisp'};
+ 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});
@@ -863,8 +931,8 @@ sub verify_and_change_discussion {
&Apache::lonnet::delenv('environment\.discdisplay');
}
}
- if (defined($ENV{'form.discmark'}) ) {
- my $newmark = $ENV{'form.newmark'};
+ 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});
@@ -876,11 +944,89 @@ sub verify_and_change_discussion {
}
}
$r->print(<
$message
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.','first resource');
+ my $whatsnew_on=&mt('Display the "[_1]" page - a summary of items in the course which require attention.',"What's New");
+
+ $r->print(' '.&mt('Set the default page to be displayed when you select a course role').' '.&mt('(Currently: [_1])',$pagenames{$currvalue}).' '.&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',"What's New").'