--- loncom/interface/domainprefs.pm 2009/12/07 01:43:27 1.102.4.4 +++ loncom/interface/domainprefs.pm 2009/08/20 20:13:06 1.103 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.102.4.4 2009/12/07 01:43:27 raeburn Exp $ +# $Id: domainprefs.pm,v 1.103 2009/08/20 20:13:06 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, approval, validate, autolimit=N (where N is blank, or a positive integer). +0, approve, 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 -approval +approve =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 = ''. + my $datatable = ''. ''.$choices->{'font'}.''; if (!$is_custom->{'font'}) { $datatable .= ''.&mt('Default in use:').' '.$defaults->{'font'}.''; @@ -840,6 +849,20 @@ 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 ++; @@ -1126,7 +1149,7 @@ sub print_quotas { my ($css_class,%titles); if ($context eq 'requestcourses') { @usertools = ('official','unofficial','community'); - @options =('norequest','approval','autolimit','validate'); + @options =('norequest','approve','autolimit','validate'); %validations = &Apache::lonnet::auto_courserequest_checks($dom); %titles = &courserequest_titles(); } else { @@ -1201,10 +1224,10 @@ sub print_quotas { $item.'_limit_'.$type.'" size="1" '. 'value="'.$currlimit.'" />'; } + $cell{$item} .= '  '; if ($option eq 'autolimit') { - $cell{$item} .= $titles{'unlimited'}; + $cell{$item} .= $titles{'unlimited'} } - $cell{$item} .= '  '; } } else { my $checked = 'checked="checked" '; @@ -1226,7 +1249,7 @@ sub print_quotas { if ($context eq 'requestcourses') { $datatable .= ''; foreach my $item (@usertools) { - $datatable .= ''.$cell{$item}.''; + $datatable .= ''.$cell{$item}.''; } $datatable .= ''; } @@ -1308,9 +1331,6 @@ sub print_quotas { 'value="'.$currlimit.'" />'; } $defcell{$item} .= '  '; - if ($option eq 'autolimit') { - $defcell{$item} .= $titles{'unlimited'}; - } } } else { my $checked = 'checked="checked" '; @@ -1332,7 +1352,7 @@ sub print_quotas { if ($context eq 'requestcourses') { $datatable .= ''; foreach my $item (@usertools) { - $datatable .= ''.$defcell{$item}.''; + $datatable .= ''.$defcell{$item}.''; } $datatable .= ''; } @@ -1346,17 +1366,14 @@ sub print_quotas { $typecount ++; $css_class = $typecount%2?' class="LC_odd_row"':''; $datatable .= ''. - ''.&mt('LON-CAPA Advanced Users').' '; + ''.&mt('LON-CAPA Advanced Users'). + ' ('. + &mt('overrides affiliation').')'. + ''; if ($context eq 'requestcourses') { - $datatable .= &mt('(overrides affiliation, if set)'). - ''. - ''. - ''; + $datatable .= '
'; } else { - $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') { @@ -1394,7 +1406,7 @@ sub print_quotas { next if (!$canvalidate); } my $checked = ''; - if ($val eq $curroption) { + if ($option eq $curroption) { $checked = ' checked="checked"'; } elsif ($option eq 'autolimit') { if ($curroption =~ /^autolimit/) { @@ -1411,9 +1423,6 @@ sub print_quotas { 'value="'.$currlimit.'" />'; } $advcell{$item} .= '  '; - if ($option eq 'autolimit') { - $advcell{$item} .= $titles{'unlimited'}; - } } } else { my $checked = 'checked="checked" '; @@ -1435,7 +1444,7 @@ sub print_quotas { if ($context eq 'requestcourses') { $datatable .= ''; foreach my $item (@usertools) { - $datatable .= ''; + $datatable .= ''; } $datatable .= '
'. - '
'; + $datatable .= '
'; } my %advcell; foreach my $item (@usertools) { @@ -1370,15 +1387,10 @@ sub print_quotas { } } } + if (!$curroption) { + $curroption = 'norequest'; + } $datatable .= '
'.$titles{$item}.'
'.$advcell{$item}.''.$advcell{$item}.'
'; } @@ -1446,7 +1455,7 @@ sub print_quotas { sub print_courserequestmail { my ($dom,$settings,$rowtotal) = @_; - my ($now,$datatable,%dompersonnel,@domcoord,@currapproval,$rows); + my ($now,$datatable,%dompersonnel,@domcoord,@currapprove,$rows); $now = time; $rows = 0; %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc'],$now,$now); @@ -1461,12 +1470,12 @@ sub print_courserequestmail { if (ref($settings) eq 'HASH') { if (ref($settings->{'notify'}) eq 'HASH') { if ($settings->{'notify'}{'approval'} ne '') { - @currapproval = split(',',$settings->{'notify'}{'approval'}); + @currapprove = split(',',$settings->{'notify'}{'approval'}); } } } - if (@currapproval) { - foreach my $dc (@currapproval) { + if (@currapprove) { + foreach my $dc (@currapprove) { unless (grep(/^\Q$dc\E$/,@domcoord)) { push(@domcoord,$dc); } @@ -1492,7 +1501,7 @@ sub print_courserequestmail { $rows ++; } my $check = ' '; - if (grep(/^\Q$domcoord[$i]\E$/,@currapproval)) { + if (grep(/^\Q$domcoord[$i]\E$/,@currapprove)) { $check = ' checked="checked" '; } my ($uname,$udom) = split(':',$domcoord[$i]); @@ -1863,7 +1872,7 @@ sub courserequest_titles { unofficial => 'Unofficial', community => 'Communities', norequest => 'Not allowed', - approval => 'Approval by Dom. Coord.', + approve => 'Approval by Dom. Coord.', validate => 'With validation', autolimit => 'Numerical limit', unlimited => '(blank for unlimited)', @@ -1873,7 +1882,7 @@ sub courserequest_titles { sub courserequest_conditions { my %conditions = &Apache::lonlocal::texthash ( - approval => '(Processing of request subject to approval by Domain Coordinator).', + approve => '(Processing of request subject to approval by Domain Coordinator).', validate => '(Processing of request subject to instittutional validation).', ); return %conditions; @@ -2633,7 +2642,7 @@ sub print_serverstatuses { sub serverstatus_pages { return ('userstatus','lonstatus','loncron','server-status','codeversions', 'clusterstatus','metadata_keywords','metadata_harvest', - 'takeoffline','takeonline','showenv','toggledebug'); + 'takeoffline','takeonline','showenv'); } sub coursecategories_javascript { @@ -2660,7 +2669,6 @@ sub coursecategories_javascript { } $output = <<"ENDSCRIPT"; ENDSCRIPT @@ -3136,6 +3143,7 @@ sub color_font_choices { links => "Link colors", images => "Images", font => "Font color", + fontmenu => "Font Menu", pgbg => "Page", tabbg => "Header", sidebg => "Border", @@ -3202,6 +3210,7 @@ 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}; } @@ -3315,6 +3324,15 @@ 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}) { @@ -3755,7 +3773,7 @@ sub modify_quotas { } if ($context eq 'requestcourses') { @usertools = ('official','unofficial','community'); - @options =('norequest','approval','autolimit','validate'); + @options =('norequest','approve','autolimit','validate'); %validations = &Apache::lonnet::auto_courserequest_checks($dom); %titles = &courserequest_titles(); $toolregexp = join('|',@usertools); @@ -3810,12 +3828,7 @@ 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/) { @@ -3836,7 +3849,7 @@ sub modify_quotas { } } else { if ($context eq 'requestcourses') { - if ($confhash{$item}{$type} ne $unset) { + if ($confhash{$item}{$type} ne 'norequest') { $changes{$item}{$type} = 1; } } else { @@ -3847,7 +3860,7 @@ sub modify_quotas { } } else { if ($context eq 'requestcourses') { - if ($confhash{$item}{$type} ne $unset) { + if ($confhash{$item}{$type} eq 'norequest') { $changes{$item}{$type} = 1; } } else { @@ -3939,8 +3952,8 @@ sub modify_quotas { $env{'user.domain'}, $item,'reload',$context); if ($context eq 'requestcourses') { - if ($env{'environment.canrequest.'.$item} ne $newacc) { - $newenv{'environment.canrequest.'.$item} = $newacc; + if ($env{'environment.crsrequest.'.$item} ne $newacc) { + $newenv{'environment.crsrequest.'.$item} = $newacc; } } else { if ($env{'environment.availabletools.'.$item} ne $newacc) { @@ -3973,15 +3986,7 @@ sub modify_quotas { $resulttext .= '
  • '.&mt('Set to be available to [_1]',$typetitle).'
  • '; } } else { - 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).'
  • '; - } + $resulttext .= '
  • '.&mt('Set to be unavailable to [_1]',$typetitle).'
  • '; } } } @@ -5012,8 +5017,7 @@ sub modify_defaults { if ($newvalues{$item} ne '') { if ($newvalues{$item} =~ /^(\w+)/) { my $langcode = $1; - if (($langcode ne 'gci') && ($langcode ne 'gct') && - ($langcode ne 'x_chef')) { + if ($langcode ne 'x_chef') { if (code2language($langcode) eq '') { push(@errors,$item); }