--- loncom/interface/domainprefs.pm 2014/05/31 04:32:12 1.160.6.50 +++ loncom/interface/domainprefs.pm 2014/05/09 15:02:31 1.242 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.160.6.50 2014/05/31 04:32:12 raeburn Exp $ +# $Id: domainprefs.pm,v 1.242 2014/05/09 15:02:31 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -213,15 +213,15 @@ sub handler { 'quotas','autoenroll','autoupdate','autocreate', 'directorysrch','usercreation','usermodification', 'contacts','defaults','scantron','coursecategories', - 'serverstatuses','requestcourses','coursedefaults', - 'usersessions','loadbalancing','requestauthor', - 'selfenrollment','inststatus'],$dom); + 'serverstatuses','requestcourses','helpsettings', + 'coursedefaults','usersessions','loadbalancing', + 'requestauthor','selfenrollment','inststatus'],$dom); my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', 'autoupdate','autocreate','directorysrch','contacts', 'usercreation','selfcreation','usermodification','scantron', 'requestcourses','requestauthor','coursecategories', - 'serverstatuses','coursedefaults','selfenrollment', - 'usersessions'); + 'serverstatuses','helpsettings', + 'coursedefaults','selfenrollment','usersessions'); my %existing; if (ref($domconfig{'loadbalancing'}) eq 'HASH') { %existing = %{$domconfig{'loadbalancing'}}; @@ -409,10 +409,20 @@ sub handler { print => \&print_serverstatuses, modify => \&modify_serverstatuses, }, + 'helpsettings' => + {text => 'Help page settings', + help => 'Domain_Configuration_Help_Settings', + header => [{col1 => 'Help Settings (logged-in users)', + col2 => 'Value'}], + print => \&print_helpsettings, + modify => \&modify_helpsettings, + }, 'coursedefaults' => {text => 'Course/Community defaults', help => 'Domain_Configuration_Course_Defaults', - header => [{col1 => 'Defaults which can be overridden for each course by a DC', + header => [{col1 => 'Defaults which can be overridden in each course by a CC', + col2 => 'Value',}, + {col1 => 'Defaults which can be overridden for each course by a DC', col2 => 'Value',},], print => \&print_coursedefaults, modify => \&modify_coursedefaults, @@ -429,6 +439,14 @@ sub handler { print => \&print_selfenrollment, modify => \&modify_selfenrollment, }, + 'privacy' => + {text => 'User Privacy', + help => 'Domain_Configuration_User_Privacy', + header => [{col1 => 'Setting', + col2 => 'Value',}], + print => \&print_privacy, + modify => \&modify_privacy, + }, 'usersessions' => {text => 'User session hosting/offloading', help => 'Domain_Configuration_User_Sessions', @@ -613,6 +631,8 @@ sub process_changes { $output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); } elsif ($action eq 'requestauthor') { $output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); + } elsif ($action eq 'helpsettings') { + $output = &modify_helpsettings($r,$dom,$confname,%domconfig); } elsif ($action eq 'coursedefaults') { $output = &modify_coursedefaults($dom,$lastactref,%domconfig); } elsif ($action eq 'selfenrollment') { @@ -666,7 +686,7 @@ sub print_config_box { '; $rowtotal ++; if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') || - ($action eq 'usermodification') || ($action eq 'defaults') || + ($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') || ($action eq 'selfenrollment') || ($action eq 'usersessions')) { $output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); } elsif ($action eq 'coursecategories') { @@ -721,7 +741,8 @@ sub print_config_box { $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } $rowtotal ++; - } elsif (($action eq 'usermodification') || ($action eq 'defaults')) { + } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') || + ($action eq 'defaults')) { $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } elsif ($action eq 'login') { if ($numheaders == 3) { @@ -741,9 +762,8 @@ sub print_config_box { $output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal); } } elsif ($action eq 'requestcourses') { - $output .= &print_requestmail($dom,$action,$settings,\$rowtotal); - $rowtotal ++; - $output .= &print_studentcode($settings,\$rowtotal).' + $output .= &print_requestmail($dom,$action,$settings,\$rowtotal). + &print_studentcode($settings,\$rowtotal).' @@ -778,7 +798,6 @@ sub print_config_box { &print_validation_rows('requestcourses',$dom,$settings,\$rowtotal); } elsif ($action eq 'requestauthor') { $output .= &print_requestmail($dom,$action,$settings,\$rowtotal); - $rowtotal ++; } elsif ($action eq 'rolecolors') { $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' @@ -864,8 +883,6 @@ sub print_config_box { $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); } elsif ($action eq 'helpsettings') { $output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal); - } elsif ($action eq 'coursedefaults') { - $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } } $output .= ' @@ -2057,6 +2074,7 @@ sub print_requestmail { $datatable .= &mt('There are no active Domain Coordinators'); } $datatable .=''; + $$rowtotal += $rows; return $datatable; } @@ -2117,12 +2135,11 @@ sub print_textbookcourses { my $key = $ordered{$items[$i]}; my %coursehash=&Apache::lonnet::coursedescription($key); my $coursetitle = $coursehash{'description'}; - my ($subject,$title,$author,$publisher,$image,$imgsrc,$cdom,$cnum); + my ($subject,$title,$author,$image,$imgsrc,$cdom,$cnum); if (ref($bookshash->{$key}) eq 'HASH') { $subject = $bookshash->{$key}->{'subject'}; $title = $bookshash->{$key}->{'title'}; if ($type eq 'textbooks') { - $publisher = $bookshash->{$key}->{'publisher'}; $author = $bookshash->{$key}->{'author'}; $image = $bookshash->{$key}->{'image'}; if ($image ne '') { @@ -2152,8 +2169,6 @@ sub print_textbookcourses { ''.&mt('Title:').' '; if ($type eq 'textbooks') { $datatable .= (' 'x2). - ''.&mt('Publisher:').' '. - (' 'x2). ''.&mt('Author(s):').' '. (' 'x2). ''.&mt('Thumbnail:'); @@ -2197,9 +2212,7 @@ sub print_textbookcourses { ''.&mt('Title:').' '."\n". (' 'x2); if ($type eq 'textbooks') { - $datatable .= ''.&mt('Publisher:').' '."\n". - (' 'x2). - ''.&mt('Author(s):').' '."\n". + $datatable .= ''.&mt('Author(s):').' '."\n". (' 'x2). ''.&mt('Image:').' '; if ($switchserver) { @@ -2501,15 +2514,13 @@ sub print_autocreate { $createoff{'req'}.' value="0" />'.&mt('No').''; my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio', 'autocreate_xmldc',%currhash); - $datatable .= ''; if ($numdc > 1) { - $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)'). - ''; + $datatable .= ''. + &mt('Course creation processed as: (choose Dom. Coord.)'). + ''.$dctable.''; } else { - $datatable .= &mt('Course creation processed as:'). - ''; + $datatable .= $dctable.''; } - $datatable .= $dctable.''; $$rowtotal += $rows; return $datatable; } @@ -3109,14 +3120,13 @@ sub print_validation_rows { my $numinrow = 2; my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio', 'validationdc',%currhash); - my $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - $datatable .= ''; if ($numdc > 1) { - $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)'); + $datatable .= ''. + &mt('Course creation processed as: (choose Dom. Coord.)'). + ''.$dctable.''; } else { - $datatable .= &mt('Course creation processed as: '); + $datatable .= $dctable.''; } - $datatable .= ''.$dctable.''; $itemcount ++; } if (ref($rowtotal)) { @@ -6958,9 +6968,8 @@ sub modify_quotas { } else { my $newpos = $env{'form.'.$itemid}; $newpos =~ s/\D+//g; - foreach my $item ('subject','title','publisher','author') { - next if ((($item eq 'author') || ($item eq 'publisher')) && - ($type eq 'templates')); + foreach my $item ('subject','title','author') { + next if (($item eq 'author') && ($type eq 'templates')); $confhash{$type}{$key}{$item} = $env{'form.'.$type.'_'.$item.'_'.$i}; if ($domconfig{$action}{$type}{$key}{$item} ne $confhash{$type}{$key}{$item}) { $changes{$type}{$key} = 1; @@ -7005,9 +7014,8 @@ sub modify_quotas { foreach my $type ('textbooks','templates') { if ($newbook{$type}) { $changes{$type}{$newbook{$type}} = 1; - foreach my $item ('subject','title','publisher','author') { - next if ((($item eq 'author') || ($item eq 'publisher')) && - ($type eq 'template')); + foreach my $item ('subject','title','author') { + next if (($item eq 'author') && ($type eq 'template')); $env{'form.'.$type.'_addbook_'.$item} =~ s/(`)/'/g; if ($env{'form.'.$type.'_addbook_'.$item}) { $confhash{$type}{$newbook{$type}}{$item} = $env{'form.'.$type.'_addbook_'.$item}; @@ -7421,9 +7429,8 @@ sub modify_quotas { my $coursetitle = $coursehash{'description'}; my $position = $confhash{$type}{$key}{'order'} + 1; $resulttext .= '
  • '; - foreach my $item ('subject','title','publisher','author') { - next if ((($item eq 'author') || ($item eq 'publisher')) && - ($type eq 'templates')); + foreach my $item ('subject','title','author') { + next if (($item eq 'author') && ($type eq 'templates')); my $name = $item.':'; $name =~ s/^(\w)/\U$1/; $resulttext .= &mt($name).' '.$confhash{$type}{$key}{$item}.'
    '; @@ -8515,7 +8522,7 @@ sub modify_selfcreation { # value set to one), if self-creation with e-mail address permitted, where $type is user type: faculty, staff, student etc. # - if ($env{'form.cancreate_email'}) { + if ($env{'form.cancreate_email'} eq 'email') { push(@contexts,'emailusername'); if (ref($types) eq 'ARRAY') { foreach my $type (@{$types}) { @@ -8933,19 +8940,17 @@ sub modify_selfcreation { foreach my $type (@{$types}) { if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') { if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) { - $chgtext .= &mt('When self-creating account with e-mail as username, the following information will be provided by [_1]:',"'$usertypes->{$type}'"). + $chgtext .= &mt('When self-creating account with e-mail as username, the following information will be provided by [_1]:',$usertypes->{$type}). '
      '; foreach my $field (@{$infofields}) { if ($cancreate{'emailusername'}{$type}{$field}) { $chgtext .= '
    • '.$infotitles->{$field}.'
    • '; } } - $chgtext .= '
    '; - } else { - $chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'
    '; } + $chgtext .= ''; } else { - $chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'
    '; + $chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',$usertypes->{$type}).'
    '; } } } @@ -9752,17 +9757,9 @@ sub modify_coursecategories { } $resulttext .= ''; if ($changes{'unauth'} || $changes{'auth'}) { - my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); - if ($changes{'auth'}) { - $domdefaults{'catauth'} = $domconfig{'coursecategories'}{'auth'}; - } - if ($changes{'unauth'}) { - $domdefaults{'catunauth'} = $domconfig{'coursecategories'}{'unauth'}; - } - my $cachetime = 24*60*60; - &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); + &Apache::loncommon::devalidate_domconfig_cache($dom); if (ref($lastactref) eq 'HASH') { - $lastactref->{'domdefaults'} = 1; + $lastactref->{'domainconfig'} = 1; } } } else { @@ -10970,7 +10967,7 @@ sub active_dc_picker { my ($dcname,$dcdom) = split(':',$domcoord[0]); my $user = &Apache::loncommon::plainname($dcname,$dcdom); if ($inputtype eq 'radio') { - $table = ''.$user; + $table .= ''.$user; if ($user ne $dcname.':'.$dcdom) { $table .= ' ('.$dcname.':'.$dcdom.')'; } @@ -10979,9 +10976,9 @@ sub active_dc_picker { if (exists($currhash{$domcoord[0]})) { $check = ' checked="checked"'; } - $table = '