--- loncom/interface/domainprefs.pm 2009/08/13 20:38:45 1.102.2.1
+++ loncom/interface/domainprefs.pm 2009/08/22 21:10:32 1.108
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.102.2.1 2009/08/13 20:38:45 raeburn Exp $
+# $Id: domainprefs.pm,v 1.108 2009/08/22 21:10:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -105,7 +105,7 @@ affiliate type (and also default, and _L
(official, unofficial and community). In each case the radio buttons allow the
selection of one of four values:
-0, approve, validate, autolimit=N (where N is blank, or a positive integer).
+0, approval, validate, autolimit=N (where N is blank, or a positive integer).
which have the following effects:
0
@@ -116,7 +116,7 @@ which have the following effects:
=back
-approve
+approval
=over
@@ -763,6 +763,7 @@ sub print_rolecolors {
my %defaults = (
img => $defaultdesign{$role.'.img'},
font => $defaultdesign{$role.'.font'},
+ fontmenu => $defaultdesign{$role.'.fontmenu'},
);
foreach my $item (@bgs) {
$defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item};
@@ -780,6 +781,10 @@ sub print_rolecolors {
$designs{'font'} = $settings->{$role}->{'font'};
$is_custom{'font'} = 1;
}
+ if ($settings->{$role}->{'fontmenu'} ne '') {
+ $designs{'fontmenu'} = $settings->{$role}->{'fontmenu'};
+ $is_custom{'fontmenu'} = 1;
+ }
foreach my $item (@bgs) {
if ($settings->{$role}->{$item} ne '') {
$designs{'bgs'}{$item} = $settings->{$role}->{$item};
@@ -798,6 +803,10 @@ sub print_rolecolors {
$designs{img} = $designhash{$dom.'.'.$role.'.img'};
$is_custom{'img'} = 1;
}
+ if ($designhash{$dom.'.'.$role.'.fontmenu'} ne '') {
+ $designs{fontmenu} = $designhash{$dom.'.'.$role.'.fontmenu'};
+ $is_custom{'fontmenu'} = 1;
+ }
if ($designhash{$dom.'.'.$role.'.font'} ne '') {
$designs{font} = $designhash{$dom.'.'.$role.'.font'};
$is_custom{'font'} = 1;
@@ -826,7 +835,7 @@ sub display_color_options {
my ($dom,$confname,$phase,$role,$itemcount,$choices,$is_custom,$defaults,$designs,
$images,$bgs,$links,$alt_text,$rowtotal,$logintext,$loginheader) = @_;
my $css_class = $itemcount%2?' class="LC_odd_row"':'';
- my $datatable = '
'.
- ''.&mt('LON-CAPA Advanced Users').
- ' ('.
- &mt('overrides affiliation').') | '.
+ ''.&mt('LON-CAPA Advanced Users').' ';
+ if ($context eq 'requestcourses') {
+ $datatable .= &mt('(overrides affiliation, if set)');
+ } else {
+ $datatable .= &mt('(overrides affiliation, if checked)');
+ }
+ $datatable .= ' | '.
'';
if ($context eq 'requestcourses') {
$datatable .= '';
}
@@ -1429,7 +1472,7 @@ sub print_quotas {
sub print_courserequestmail {
my ($dom,$settings,$rowtotal) = @_;
- my ($now,$datatable,%dompersonnel,@domcoord,@currapprove,$rows);
+ my ($now,$datatable,%dompersonnel,@domcoord,@currapproval,$rows);
$now = time;
$rows = 0;
%dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc'],$now,$now);
@@ -1444,12 +1487,12 @@ sub print_courserequestmail {
if (ref($settings) eq 'HASH') {
if (ref($settings->{'notify'}) eq 'HASH') {
if ($settings->{'notify'}{'approval'} ne '') {
- @currapprove = split(',',$settings->{'notify'}{'approval'});
+ @currapproval = split(',',$settings->{'notify'}{'approval'});
}
}
}
- if (@currapprove) {
- foreach my $dc (@currapprove) {
+ if (@currapproval) {
+ foreach my $dc (@currapproval) {
unless (grep(/^\Q$dc\E$/,@domcoord)) {
push(@domcoord,$dc);
}
@@ -1475,7 +1518,7 @@ sub print_courserequestmail {
$rows ++;
}
my $check = ' ';
- if (grep(/^\Q$domcoord[$i]\E$/,@currapprove)) {
+ if (grep(/^\Q$domcoord[$i]\E$/,@currapproval)) {
$check = ' checked="checked" ';
}
my ($uname,$udom) = split(':',$domcoord[$i]);
@@ -1846,16 +1889,17 @@ sub courserequest_titles {
unofficial => 'Unofficial',
community => 'Communities',
norequest => 'Not allowed',
- approve => 'Approval by Dom. Coord.',
+ approval => 'Approval by Dom. Coord.',
validate => 'With validation',
autolimit => 'Numerical limit',
+ unlimited => '(blank for unlimited)',
);
return %titles;
}
sub courserequest_conditions {
my %conditions = &Apache::lonlocal::texthash (
- approve => '(Processing of request subject to approval by Domain Coordinator).',
+ approval => '(Processing of request subject to approval by Domain Coordinator).',
validate => '(Processing of request subject to instittutional validation).',
);
return %conditions;
@@ -3116,6 +3160,7 @@ sub color_font_choices {
links => "Link colors",
images => "Images",
font => "Font color",
+ fontmenu => "Font Menu",
pgbg => "Page",
tabbg => "Header",
sidebg => "Border",
@@ -3173,6 +3218,7 @@ sub modify_colors {
@logintext = ('textcol','bgcol');
} else {
%choices = &color_font_choices();
+ $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'};
}
if ($role eq 'login') {
@images = ('img','logo','domlogo','login');
@@ -3295,6 +3341,17 @@ sub modify_colors {
$changes{$role}{'font'} = 1;
}
}
+ if ($role ne 'login') {
+ if ($domconfig->{$role}{'fontmenu'} ne '') {
+ if ($confhash->{$role}{'fontmenu'} ne $domconfig->{$role}{'fontmenu'}) {
+ $changes{$role}{'fontmenu'} = 1;
+ }
+ } else {
+ if ($confhash->{$role}{'fontmenu'}) {
+ $changes{$role}{'fontmenu'} = 1;
+ }
+ }
+ }
foreach my $item (@bgs) {
if ($domconfig->{$role}{$item} ne '') {
if ($confhash->{$role}{$item} ne $domconfig->{$role}{$item}) {
@@ -3735,7 +3792,7 @@ sub modify_quotas {
}
if ($context eq 'requestcourses') {
@usertools = ('official','unofficial','community');
- @options =('norequest','approve','autolimit','validate');
+ @options =('norequest','approval','validate','autolimit');
%validations = &Apache::lonnet::auto_courserequest_checks($dom);
%titles = &courserequest_titles();
$toolregexp = join('|',@usertools);
@@ -3790,7 +3847,12 @@ sub modify_quotas {
}
foreach my $item (@usertools) {
foreach my $type (@{$types},'default','_LC_adv') {
+ my $unset;
if ($context eq 'requestcourses') {
+ $unset = '0';
+ if ($type eq '_LC_adv') {
+ $unset = '';
+ }
if ($confhash{$item}{$type} eq 'autolimit') {
$confhash{$item}{$type} .= '=';
unless ($limithash{$item}{$type} =~ /\D/) {
@@ -3811,7 +3873,7 @@ sub modify_quotas {
}
} else {
if ($context eq 'requestcourses') {
- if ($confhash{$item}{$type} ne 'norequest') {
+ if ($confhash{$item}{$type} ne $unset) {
$changes{$item}{$type} = 1;
}
} else {
@@ -3822,7 +3884,7 @@ sub modify_quotas {
}
} else {
if ($context eq 'requestcourses') {
- if ($confhash{$item}{$type} eq 'norequest') {
+ if ($confhash{$item}{$type} ne $unset) {
$changes{$item}{$type} = 1;
}
} else {
@@ -3914,8 +3976,8 @@ sub modify_quotas {
$env{'user.domain'},
$item,'reload',$context);
if ($context eq 'requestcourses') {
- if ($env{'environment.crsrequest.'.$item} ne $newacc) {
- $newenv{'environment.crsrequest.'.$item} = $newacc;
+ if ($env{'environment.canrequest.'.$item} ne $newacc) {
+ $newenv{'environment.canrequest.'.$item} = $newacc;
}
} else {
if ($env{'environment.availabletools.'.$item} ne $newacc) {
@@ -3948,7 +4010,15 @@ sub modify_quotas {
$resulttext .= ''.&mt('Set to be available to [_1]',$typetitle).'';
}
} else {
- $resulttext .= ''.&mt('Set to be unavailable to [_1]',$typetitle).'';
+ if ($type eq '_LC_adv') {
+ if ($confhash{$item}{$type} eq '0') {
+ $resulttext .= ''.&mt('Set to be unavailable to [_1]',$typetitle).'';
+ } else {
+ $resulttext .= ''.&mt('No override set for [_1]',$typetitle).'';
+ }
+ } else {
+ $resulttext .= ''.&mt('Set to be unavailable to [_1]',$typetitle).'';
+ }
}
}
}
@@ -4496,6 +4566,8 @@ sub modify_usercreation {
if (@{$types} > 0) {
@{$cancreate{'statustocreate'}} =
&Apache::loncommon::get_env_multiple('form.statustocreate');
+ } else {
+ @{$cancreate{'statustocreate'}} = ();
}
push(@contexts,'statustocreate');
}
@@ -4504,9 +4576,11 @@ sub modify_usercreation {
if (($item eq 'selfcreate') || ($item eq 'statustocreate')) {
if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') {
foreach my $curr (@{$curr_usercreation{'cancreate'}{$item}}) {
- if (!grep(/^$curr$/,@{$cancreate{$item}})) {
- if (!grep(/^$item$/,@{$changes{'cancreate'}})) {
- push(@{$changes{'cancreate'}},$item);
+ if (ref($cancreate{$item}) eq 'ARRAY') {
+ if (!grep(/^$curr$/,@{$cancreate{$item}})) {
+ if (!grep(/^$item$/,@{$changes{'cancreate'}})) {
+ push(@{$changes{'cancreate'}},$item);
+ }
}
}
}
@@ -4975,8 +5049,10 @@ sub modify_defaults {
if ($newvalues{$item} ne '') {
if ($newvalues{$item} =~ /^(\w+)/) {
my $langcode = $1;
- if (code2language($langcode) eq '') {
- push(@errors,$item);
+ if ($langcode ne 'x_chef') {
+ if (code2language($langcode) eq '') {
+ push(@errors,$item);
+ }
}
} else {
push(@errors,$item);
|