--- loncom/interface/domainprefs.pm 2009/08/11 23:24:29 1.102 +++ loncom/interface/domainprefs.pm 2009/09/23 02:40:13 1.102.4.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.102 2009/08/11 23:24:29 raeburn Exp $ +# $Id: domainprefs.pm,v 1.102.4.1 2009/09/23 02:40:13 gci 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,7 +763,6 @@ 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}; @@ -781,10 +780,6 @@ 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}; @@ -803,10 +798,6 @@ 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; @@ -835,7 +826,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 = ''. + my $datatable = ''. ''.$choices->{'font'}.''; if (!$is_custom->{'font'}) { $datatable .= ''.&mt('Default in use:').' '.$defaults->{'font'}.''; @@ -849,20 +840,6 @@ sub display_color_options { '    '. ''; - $datatable .= ''. - ''.$choices->{'fontmenu'}.''; - if (!$is_custom->{'fontmenu'}) { - $datatable .= ''.&mt('Default in use:').' '.$defaults->{'fontmenu'}.''; - } else { - $datatable .= ' '; - } - $fontlink = &color_pick($phase,$role,'fontmenu',$choices->{'fontmenu'},$designs->{'fontmenu'}); - $datatable .= ''. - ' '.$fontlink. - '    '. - ''; my $switchserver = &check_switchserver($dom,$confname); foreach my $img (@{$images}) { $itemcount ++; @@ -1149,7 +1126,7 @@ sub print_quotas { my ($css_class,%titles); if ($context eq 'requestcourses') { @usertools = ('official','unofficial','community'); - @options =('norequest','approve','autolimit','validate'); + @options =('norequest','approval','autolimit','validate'); %validations = &Apache::lonnet::auto_courserequest_checks($dom); %titles = &courserequest_titles(); } else { @@ -1222,7 +1199,10 @@ sub print_quotas { if ($option eq 'autolimit') { $cell{$item} .= ''; + 'value="'.$currlimit.'" />'; + } + if ($option eq 'autolimit') { + $cell{$item} .= $titles{'unlimited'}; } $cell{$item} .= '  '; } @@ -1246,7 +1226,7 @@ sub print_quotas { if ($context eq 'requestcourses') { $datatable .= ''; foreach my $item (@usertools) { - $datatable .= ''.$cell{$item}.''; + $datatable .= ''.$cell{$item}.''; } $datatable .= ''; } @@ -1328,6 +1308,9 @@ sub print_quotas { 'value="'.$currlimit.'" />'; } $defcell{$item} .= '  '; + if ($option eq 'autolimit') { + $defcell{$item} .= $titles{'unlimited'}; + } } } else { my $checked = 'checked="checked" '; @@ -1349,7 +1332,7 @@ sub print_quotas { if ($context eq 'requestcourses') { $datatable .= ''; foreach my $item (@usertools) { - $datatable .= ''.$defcell{$item}.''; + $datatable .= ''.$defcell{$item}.''; } $datatable .= ''; } @@ -1363,14 +1346,17 @@ sub print_quotas { $typecount ++; $css_class = $typecount%2?' class="LC_odd_row"':''; $datatable .= ''. - ''.&mt('LON-CAPA Advanced Users'). - ' ('. - &mt('overrides affiliation').')'. - ''; + ''.&mt('LON-CAPA Advanced Users').' '; if ($context eq 'requestcourses') { - $datatable .= ''; + $datatable .= &mt('(overrides affiliation, if set)'). + ''. + '
'. + ''; } else { - $datatable .= '
'; + $datatable .= &mt('(overrides affiliation, if checked)'). + ''. + ''; + my $checked = ''; + if ($curroption eq '') { + $checked = ' checked="checked"'; + } + $advcell{$item} .= '  '; foreach my $option (@options) { my $val = $option; if ($option eq 'norequest') { @@ -1403,7 +1394,7 @@ sub print_quotas { next if (!$canvalidate); } my $checked = ''; - if ($option eq $curroption) { + if ($val eq $curroption) { $checked = ' checked="checked"'; } elsif ($option eq 'autolimit') { if ($curroption =~ /^autolimit/) { @@ -1420,6 +1411,9 @@ sub print_quotas { 'value="'.$currlimit.'" />'; } $advcell{$item} .= '  '; + if ($option eq 'autolimit') { + $advcell{$item} .= $titles{'unlimited'}; + } } } else { my $checked = 'checked="checked" '; @@ -1441,7 +1435,7 @@ sub print_quotas { if ($context eq 'requestcourses') { $datatable .= ''; foreach my $item (@usertools) { - $datatable .= ''; + $datatable .= ''; } $datatable .= '
'. + '
'; } my %advcell; foreach my $item (@usertools) { @@ -1384,10 +1370,15 @@ sub print_quotas { } } } - if (!$curroption) { - $curroption = 'norequest'; - } $datatable .= '
'.$titles{$item}.'
'.$advcell{$item}.''.$advcell{$item}.'
'; } @@ -1452,7 +1446,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); @@ -1467,12 +1461,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); } @@ -1498,7 +1492,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]); @@ -1869,16 +1863,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; @@ -2665,6 +2660,7 @@ sub coursecategories_javascript { } $output = <<"ENDSCRIPT"; ENDSCRIPT @@ -3139,7 +3136,6 @@ sub color_font_choices { links => "Link colors", images => "Images", font => "Font color", - fontmenu => "Font Menu", pgbg => "Page", tabbg => "Header", sidebg => "Border", @@ -3206,7 +3202,6 @@ sub modify_colors { @bgs = ('pgbg','tabbg','sidebg'); } $confhash->{$role}{'font'} = $env{'form.'.$role.'_font'}; - $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'}; foreach my $item (@bgs,@links,@logintext) { $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; } @@ -3320,15 +3315,6 @@ sub modify_colors { $changes{$role}{'font'} = 1; } } - 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}) { @@ -3769,7 +3755,7 @@ sub modify_quotas { } if ($context eq 'requestcourses') { @usertools = ('official','unofficial','community'); - @options =('norequest','approve','autolimit','validate'); + @options =('norequest','approval','autolimit','validate'); %validations = &Apache::lonnet::auto_courserequest_checks($dom); %titles = &courserequest_titles(); $toolregexp = join('|',@usertools); @@ -3824,7 +3810,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/) { @@ -3845,7 +3836,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 { @@ -3856,7 +3847,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 { @@ -3948,8 +3939,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) { @@ -3982,7 +3973,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).'
  • '; + } } } } @@ -4530,6 +4529,8 @@ sub modify_usercreation { if (@{$types} > 0) { @{$cancreate{'statustocreate'}} = &Apache::loncommon::get_env_multiple('form.statustocreate'); + } else { + @{$cancreate{'statustocreate'}} = (); } push(@contexts,'statustocreate'); } @@ -4538,9 +4539,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); + } } } } @@ -5009,8 +5012,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);