--- loncom/interface/domainprefs.pm 2014/04/16 13:33:14 1.160.6.39 +++ loncom/interface/domainprefs.pm 2014/04/13 00:42:06 1.234 @@ -1,8 +1,8 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.160.6.39 2014/04/16 13:33:14 raeburn Exp $ -## +# $Id: domainprefs.pm,v 1.234 2014/04/13 00:42:06 raeburn Exp $ +# # Copyright Michigan State University Board of Trustees # # This file is part of the LearningOnline Network with CAPA (LON-CAPA). @@ -165,7 +165,6 @@ use Apache::lonlocal; use Apache::lonmsg(); use Apache::lonconfigsettings; use Apache::lonuserutils(); -use Apache::loncoursequeueadmin(); use LONCAPA qw(:DEFAULT :match); use LONCAPA::Enrollment; use LONCAPA::lonauthcgi(); @@ -213,15 +212,15 @@ sub handler { 'quotas','autoenroll','autoupdate','autocreate', 'directorysrch','usercreation','usermodification', 'contacts','defaults','scantron','coursecategories', - 'serverstatuses','requestcourses','coursedefaults', - 'usersessions','loadbalancing','requestauthor', - 'selfenrollment'],$dom); + 'serverstatuses','requestcourses','helpsettings', + 'coursedefaults','usersessions','loadbalancing', + 'requestauthor','selfenrollment'],$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'}}; @@ -366,9 +365,7 @@ sub handler { {col1 => 'Setting', col2 => 'Value'}, {col1 => 'Available textbooks', - col2 => ''}, - {col1 => 'Validation (not official courses)', - col2 => 'Value'},], + col2 => ''}], print => \&print_quotas, modify => \&modify_quotas, }, @@ -403,6 +400,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', @@ -425,6 +430,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', @@ -609,6 +622,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') { @@ -660,8 +675,8 @@ sub print_config_box { '; $rowtotal ++; if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') || - ($action eq 'usermodification') || ($action eq 'selfenrollment') || - ($action eq 'usersessions')) { + ($action eq 'usermodification') || ($action eq 'coursedefaults') || + ($action eq 'selfenrollment') || ($action eq 'usersessions')) { $output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); } elsif ($action eq 'coursecategories') { $output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal); @@ -738,18 +753,7 @@ sub print_config_box { '.&mt($item->{'header'}->[2]->{'col1'}).' '.&mt($item->{'header'}->[2]->{'col2'}).' '. - &print_textbookcourses($dom,$settings,\$rowtotal).' - - - - - - - - - - '. - &print_validation_rows('requestcourses',$dom,$settings,\$rowtotal); + &print_textbookcourses($dom,$settings,\$rowtotal); } elsif ($action eq 'requestauthor') { $output .= &print_requestmail($dom,$action,$settings,\$rowtotal); } elsif ($action eq 'rolecolors') { @@ -2970,85 +2974,48 @@ sub print_selfenrollment { $datatable .= '
'.&mt($item->{'header'}->[3]->{'col1'}).''.&mt($item->{'header'}->[3]->{'col2'}).'
'; } } elsif ($position eq 'bottom') { - $datatable .= &print_validation_rows('selfenroll',$dom,$settings,\$itemcount); - } - $$rowtotal += $itemcount; - return $datatable; -} - -sub print_validation_rows { - my ($caller,$dom,$settings,$rowtotal) = @_; - my ($itemsref,$namesref,$fieldsref); - if ($caller eq 'selfenroll') { - ($itemsref,$namesref,$fieldsref) = &Apache::lonuserutils::selfenroll_validation_types(); - } elsif ($caller eq 'requestcourses') { - ($itemsref,$namesref,$fieldsref) = &Apache::loncoursequeueadmin::requestcourses_validation_types(); - } - my %currvalidation; - if (ref($settings) eq 'HASH') { - if (ref($settings->{'validation'}) eq 'HASH') { - %currvalidation = %{$settings->{'validation'}}; + my ($itemsref,$namesref,$fieldsref) = &Apache::lonuserutils::selfenroll_validation_types(); + my %currvalidation; + if (ref($settings) eq 'HASH') { + if (ref($settings->{'validation'}) eq 'HASH') { + %currvalidation = %{$settings->{'validation'}}; + } } - } - my $datatable; - my $itemcount = 0; - foreach my $item (@{$itemsref}) { - my $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - $datatable .= ''. - $namesref->{$item}. - ''. - ''; - if (($item eq 'url') || ($item eq 'button')) { - $datatable .= ''. - ''; - } elsif ($item eq 'fields') { - my @currfields; - if (ref($currvalidation{$item}) eq 'ARRAY') { - @currfields = @{$currvalidation{$item}}; - } - foreach my $field (@{$fieldsref}) { - my $check = ''; - if (grep(/^\Q$field\E$/,@currfields)) { - $check = ' checked="checked"'; - } - $datatable .= ' '; - } - } elsif ($item eq 'markup') { - $datatable .= ''; - } - $datatable .= ''."\n"; - if (ref($rowtotal)) { + } + $datatable .= ''."\n"; $itemcount ++; } } - if ($caller eq 'requestcourses') { - my %currhash; - if (ref($settings->{'validation'}) eq 'HASH') { - if ($settings->{'validation'}{'dc'} ne '') { - $currhash{$settings->{'validation'}{'dc'}} = 1; - } - } - my $numinrow = 2; - my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio', - 'validationdc',%currhash); - if ($numdc > 1) { - $datatable .= ''. - &mt('Course creation processed as: (choose Dom. Coord.)'). - ''.$dctable.''; - } else { - $datatable .= $dctable.''; - } - $itemcount ++; - } - if (ref($rowtotal)) { - $$rowtotal += $itemcount; - } + $$rowtotal += $itemcount; return $datatable; } @@ -6455,8 +6422,7 @@ sub modify_quotas { my ($r,$dom,$action,$lastactref,%domconfig) = @_; my ($context,@usertools,@options,%validations,%titles,%confhash,%toolshash, %limithash,$toolregexp,%conditions,$resulttext,%changes,$confname,$configuserok, - $author_ok,$switchserver,$errors,$validationitemsref,$validationnamesref, - $validationfieldsref); + $author_ok,$switchserver,$errors); if ($action eq 'quotas') { $context = 'tools'; } else { @@ -6472,8 +6438,6 @@ sub modify_quotas { $confname = $dom.'-domainconfig'; my $servadm = $r->dir_config('lonAdmEMail'); ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); - ($validationitemsref,$validationnamesref,$validationfieldsref) = - &Apache::loncoursequeueadmin::requestcourses_validation_types(); } elsif ($context eq 'requestauthor') { @usertools = ('author'); %titles = &authorrequest_titles(); @@ -6541,7 +6505,6 @@ sub modify_quotas { ''; } } - } if (ref($domconfig{$action}) eq 'HASH') { if (ref($domconfig{$action}{'notify'}) eq 'HASH') { @@ -6648,7 +6611,7 @@ sub modify_quotas { } if ($env{'form.addbook_image.filename'} ne '') { my ($cdom,$cnum) = split(/_/,$newbook); - my ($imageurl,$error) = + my ($imageurl,$error) = &process_textbook_image($r,$dom,$confname,'addbook_image',$cdom,$cnum,$configuserok, $switchserver,$author_ok); if ($imageurl) { @@ -6678,78 +6641,6 @@ sub modify_quotas { } } } - if (ref($validationitemsref) eq 'ARRAY') { - foreach my $item (@{$validationitemsref}) { - if ($item eq 'fields') { - my @changed; - @{$confhash{'validation'}{$item}} = &Apache::loncommon::get_env_multiple('form.requestcourses_validation_'.$item); - if (@{$confhash{'validation'}{$item}} > 0) { - @{$confhash{'validation'}{$item}} = sort(@{$confhash{'validation'}{$item}}); - } - if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { - if (ref($domconfig{'requestcourses'}{'validation'}{$item}) eq 'ARRAY') { - @changed = &Apache::loncommon::compare_arrays($confhash{'validation'}{$item}, - $domconfig{'requestcourses'}{'validation'}{$item}); - } else { - @changed = @{$confhash{'validation'}{$item}}; - } - } else { - @changed = @{$confhash{'validation'}{$item}}; - } - if (@changed) { - if ($confhash{'validation'}{$item}) { - $changes{'validation'}{$item} = join(', ',@{$confhash{'validation'}{$item}}); - } else { - $changes{'validation'}{$item} = &mt('None'); - } - } - } else { - $confhash{'validation'}{$item} = $env{'form.requestcourses_validation_'.$item}; - if ($item eq 'markup') { - if ($env{'form.requestcourses_validation_'.$item}) { - $env{'form.requestcourses_validation_'.$item} =~ s/[\n\r\f]+/\s/gs; - } - } - if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { - if ($domconfig{'requestcourses'}{'validation'}{$item} ne $confhash{'validation'}{$item}) { - $changes{'validation'}{$item} = $confhash{'validation'}{$item}; - } - } else { - if ($confhash{'validation'}{$item} ne '') { - $changes{'validation'}{$item} = $confhash{'validation'}{$item}; - } - } - } - } - } - if ($env{'form.validationdc'}) { - my $newval = $env{'form.validationdc'}; - my %domcoords = &get_active_dcs($dom); - if (exists($domcoords{$newval})) { - $confhash{'validation'}{'dc'} = $newval; - } - } - if (ref($confhash{'validation'}) eq 'HASH') { - if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { - if ($domconfig{'requestcourses'}{'validation'}{'dc'}) { - unless ($confhash{'validation'}{'dc'} eq $domconfig{'requestcourses'}{'validation'}{'dc'}) { - if ($confhash{'validation'}{'dc'} eq '') { - $changes{'validation'}{'dc'} = &mt('None'); - } else { - $changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; - } - } - } elsif ($confhash{'validation'}{'dc'} ne '') { - $changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; - } - } elsif ($confhash{'validation'}{'dc'} ne '') { - $changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; - } - } elsif (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { - if ($domconfig{'requestcourses'}{'validation'}{'dc'}) { - $changes{'validation'}{'dc'} = &mt('None'); - } - } } } else { $confhash{'defaultquota'}{'default'} = $env{'form.defaultquota'}; @@ -7065,26 +6956,6 @@ sub modify_quotas { } $resulttext .= ''; } - if (ref($changes{'validation'}) eq 'HASH') { - if ((ref($validationitemsref) eq 'ARRAY') && (ref($validationnamesref) eq 'HASH')) { - $resulttext .= '
  • '.&mt('Validation of courses/communities updated').''; if (keys(%newenv)) { @@ -10270,7 +10141,7 @@ sub get_active_dcs { sub active_dc_picker { my ($dom,$numinrow,$inputtype,$name,%currhash) = @_; - my %domcoords = &get_active_dcs($dom); + my %domcoords = &get_active_dcs($dom); my @domcoord = keys(%domcoords); if (keys(%currhash)) { foreach my $dc (keys(%currhash)) {