--- loncom/interface/domainprefs.pm 2014/05/09 15:23:28 1.160.6.46 +++ loncom/interface/domainprefs.pm 2014/05/31 04:00:02 1.247 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.160.6.46 2014/05/09 15:23:28 raeburn Exp $ +# $Id: domainprefs.pm,v 1.247 2014/05/31 04:00:02 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,6 +409,14 @@ 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', @@ -431,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', @@ -615,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') { @@ -668,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') { @@ -744,8 +762,9 @@ sub print_config_box { $output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal); } } elsif ($action eq 'requestcourses') { - $output .= &print_requestmail($dom,$action,$settings,\$rowtotal). - &print_studentcode($settings,\$rowtotal).' + $output .= &print_requestmail($dom,$action,$settings,\$rowtotal); + $rowtotal ++; + $output .= &print_studentcode($settings,\$rowtotal).' @@ -780,6 +799,7 @@ 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).' @@ -2056,7 +2076,6 @@ sub print_requestmail { $datatable .= &mt('There are no active Domain Coordinators'); } $datatable .=''; - $$rowtotal += $rows; return $datatable; } @@ -2117,11 +2136,12 @@ sub print_textbookcourses { my $key = $ordered{$items[$i]}; my %coursehash=&Apache::lonnet::coursedescription($key); my $coursetitle = $coursehash{'description'}; - my ($subject,$title,$author,$image,$imgsrc,$cdom,$cnum); + my ($subject,$title,$author,$publisher,$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 '') { @@ -2151,6 +2171,8 @@ sub print_textbookcourses { ''.&mt('Title:').' '; if ($type eq 'textbooks') { $datatable .= (' 'x2). + ''.&mt('Publisher:').' '. + (' 'x2). ''.&mt('Author(s):').' '. (' 'x2). ''.&mt('Thumbnail:'); @@ -2194,7 +2216,9 @@ sub print_textbookcourses { ''.&mt('Title:').' '."\n". (' 'x2); if ($type eq 'textbooks') { - $datatable .= ''.&mt('Author(s):').' '."\n". + $datatable .= ''.&mt('Publisher:').' '."\n". + (' 'x2). + ''.&mt('Author(s):').' '."\n". (' 'x2). ''.&mt('Image:').' '; if ($switchserver) { @@ -2496,13 +2520,15 @@ 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.)'). - ''.$dctable.''; + $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)'). + ''; } else { - $datatable .= $dctable.''; + $datatable .= &mt('Course creation processed as:'). + ''; } + $datatable .= $dctable.''; $$rowtotal += $rows; return $datatable; } @@ -3102,13 +3128,14 @@ 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.)'). - ''.$dctable.''; + $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)'); } else { - $datatable .= $dctable.''; + $datatable .= &mt('Course creation processed as: '); } + $datatable .= ''.$dctable.''; $itemcount ++; } if (ref($rowtotal)) { @@ -6950,8 +6977,9 @@ sub modify_quotas { } else { my $newpos = $env{'form.'.$itemid}; $newpos =~ s/\D+//g; - foreach my $item ('subject','title','author') { - next if (($item eq 'author') && ($type eq 'templates')); + foreach my $item ('subject','title','publisher','author') { + next if ((($item eq 'author') || ($item eq 'publisher')) && + ($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; @@ -6996,8 +7024,9 @@ sub modify_quotas { foreach my $type ('textbooks','templates') { if ($newbook{$type}) { $changes{$type}{$newbook{$type}} = 1; - foreach my $item ('subject','title','author') { - next if (($item eq 'author') && ($type eq 'template')); + foreach my $item ('subject','title','publisher','author') { + next if ((($item eq 'author') || ($item eq 'publisher')) && + ($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}; @@ -7411,8 +7440,9 @@ sub modify_quotas { my $coursetitle = $coursehash{'description'}; my $position = $confhash{$type}{$key}{'order'} + 1; $resulttext .= '
  • '; - foreach my $item ('subject','title','author') { - next if (($item eq 'author') && ($type eq 'templates')); + foreach my $item ('subject','title','publisher','author') { + next if ((($item eq 'author') || ($item eq 'publisher')) && + ($type eq 'templates')); my $name = $item.':'; $name =~ s/^(\w)/\U$1/; $resulttext .= &mt($name).' '.$confhash{$type}{$key}{$item}.'
    '; @@ -8504,7 +8534,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'} eq 'email') { + if ($env{'form.cancreate_email'}) { push(@contexts,'emailusername'); if (ref($types) eq 'ARRAY') { foreach my $type (@{$types}) { @@ -8922,17 +8952,19 @@ 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}'").'
    '; } } } @@ -9739,9 +9771,17 @@ sub modify_coursecategories { } $resulttext .= ''; if ($changes{'unauth'} || $changes{'auth'}) { - &Apache::loncommon::devalidate_domconfig_cache($dom); + 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); if (ref($lastactref) eq 'HASH') { - $lastactref->{'domainconfig'} = 1; + $lastactref->{'domdefaults'} = 1; } } } else { @@ -10949,7 +10989,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.')'; } @@ -10958,9 +10998,9 @@ sub active_dc_picker { if (exists($currhash{$domcoord[0]})) { $check = ' checked="checked"'; } - $table .= '