--- loncom/interface/domainprefs.pm 2009/08/20 20:13:06 1.103 +++ loncom/interface/domainprefs.pm 2009/08/22 18:09:17 1.104 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.103 2009/08/20 20:13:06 raeburn Exp $ +# $Id: domainprefs.pm,v 1.104 2009/08/22 18:09:17 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 @@ -1149,7 +1149,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 { @@ -1331,6 +1331,9 @@ sub print_quotas { 'value="'.$currlimit.'" />'; } $defcell{$item} .= '  '; + if ($option eq 'autolimit') { + $defcell{$item} .= $titles{'unlimited'} + } } } else { my $checked = 'checked="checked" '; @@ -1366,9 +1369,13 @@ 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 .= &mt('overrides affiliation, if set'); + } else { + $datatable .= &mt('overrides affiliation, if checked'); + } + $datatable .= ''. ''; if ($context eq 'requestcourses') { $datatable .= ''; @@ -1387,10 +1394,15 @@ sub print_quotas { } } } - if (!$curroption) { - $curroption = 'norequest'; - } $datatable .= ''; + my $checked = ''; + if ($curroption eq '') { + $checked = ' checked="checked"'; + } + $advcell{$item} .= '  '; foreach my $option (@options) { my $val = $option; if ($option eq 'norequest') { @@ -1406,7 +1418,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/) { @@ -1423,6 +1435,9 @@ sub print_quotas { 'value="'.$currlimit.'" />'; } $advcell{$item} .= '  '; + if ($option eq 'autolimit') { + $advcell{$item} .= $titles{'unlimited'} + } } } else { my $checked = 'checked="checked" '; @@ -1455,7 +1470,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); @@ -1470,12 +1485,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); } @@ -1501,7 +1516,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]); @@ -1872,7 +1887,7 @@ 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)', @@ -1882,7 +1897,7 @@ sub courserequest_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; @@ -3773,7 +3788,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); @@ -3828,7 +3843,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/) { @@ -3849,7 +3869,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 { @@ -3860,7 +3880,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 { @@ -3986,7 +4006,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).'
  • '; + } } } }
    '.$titles{$item}.'