--- loncom/interface/domainprefs.pm 2013/12/24 21:59:36 1.217 +++ loncom/interface/domainprefs.pm 2014/01/08 17:18:11 1.223 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.217 2013/12/24 21:59:36 raeburn Exp $ +# $Id: domainprefs.pm,v 1.223 2014/01/08 17:18:11 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -95,7 +95,7 @@ institutional affiliation in the domain but is now also used to manage availability of user tools: i.e., blogs, aboutme page, and portfolios, and the course request tool, used by course owners to request creation of a course, and to display/store -default quota sizes for authoring spaces. +default quota sizes for Authoring Spaces. Outputs: 1 @@ -334,7 +334,7 @@ sub handler { col2 => ''}], }, 'requestauthor' => - {text => 'Request authoring space', + {text => 'Request Authoring Space', help => 'Domain_Configuration_Request_Author', header => [{col1 => 'User affiliation', col2 => 'Availability/Processing of requests',}, @@ -420,7 +420,7 @@ sub handler { if ($phase eq 'process') { my $result = &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order, \%prefs,\%domconfig,$confname,\@roles); - if (ref($result) eq 'HASH') { + if ((ref($result) eq 'HASH') && (keys(%{$result}))) { $r->rflush(); &devalidate_remote_domconfs($dom,$result); } @@ -2002,7 +2002,7 @@ sub print_requestmail { if ($action eq 'requestcourses') { $text = &mt('Receive notification of course requests requiring approval'); } else { - $text = &mt('Receive notification of authoring space requests requiring approval') + $text = &mt('Receive notification of Authoring Space requests requiring approval') } $datatable = ''. ' '.$text.''. @@ -2022,14 +2022,28 @@ sub print_requestmail { sub print_studentcode { my ($settings,$rowtotal) = @_; my $rownum = 0; - my %choices; - $choices{'uniquecode'} = &mt('Generate unique six character code as course identifier?'); - my @toggles = ('uniquecode'); - my %defaultchecked = ('uniquecode' => 'off'); - (my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, - \%choices,$rownum); - $$rowtotal += $rownum; - return $reports; + my ($output,%current); + my @crstypes = ('official','unofficial','community','textbook'); + if (ref($settings->{'uniquecode'}) eq 'HASH') { + foreach my $type (@crstypes) { + $current{$type} = $settings->{'uniquecode'}{$type}; + } + } + $output .= ''. + ''.&mt('Generate unique six character code as course identifier?').''. + ''; + foreach my $type (@crstypes) { + my $check = ' '; + if ($current{$type}) { + $check = ' checked="checked" '; + } + $output .= ''.(' 'x2).' '; + } + $output .= ''; + $$rowtotal ++; + return $output; } sub print_textbookcourses { @@ -4532,7 +4546,8 @@ sub print_serverstatuses { sub serverstatus_pages { return ('userstatus','lonstatus','loncron','server-status','codeversions', 'checksums','clusterstatus','metadata_keywords','metadata_harvest', - 'takeoffline','takeonline','showenv','toggledebug','ping','domconf'); + 'takeoffline','takeonline','showenv','toggledebug','ping','domconf', + 'uniquecodes'); } sub coursecategories_javascript { @@ -6109,10 +6124,12 @@ sub modify_quotas { my @approvalnotify = &Apache::loncommon::get_env_multiple('form.reqapprovalnotify'); @approvalnotify = sort(@approvalnotify); $confhash{'notify'}{'approval'} = join(',',@approvalnotify); - if ($env{'form.uniquecode'}) { - $confhash{'uniquecode'} = 1; - } else { - $confhash{'uniquecode'} = ''; + my @crstypes = ('official','unofficial','community','textbook'); + my @hasuniquecode = &Apache::loncommon::get_env_multiple('form.uniquecode'); + foreach my $type (@hasuniquecode) { + if (grep(/^\Q$type\E$/,@crstypes)) { + $confhash{'uniquecode'}{$type} = 1; + } } my ($newbook,@allpos); if ($context eq 'requestcourses') { @@ -6147,14 +6164,25 @@ sub modify_quotas { $changes{'notify'}{'approval'} = 1; } } - if ($domconfig{$action}{'uniquecode'}) { - unless ($confhash{'uniquecode'}) { - $changes{'uniquecode'} = 1; - } - } else { - if ($confhash{'uniquecode'}) { - $changes{'uniquecode'} = 1; - } + if (ref($domconfig{$action}{'uniquecode'}) eq 'HASH') { + if (ref($confhash{'uniquecode'}) eq 'HASH') { + foreach my $crstype (keys(%{$domconfig{$action}{'uniquecode'}})) { + unless ($confhash{'uniquecode'}{$crstype}) { + $changes{'uniquecode'} = 1; + } + } + unless ($changes{'uniquecode'}) { + foreach my $crstype (keys(%{$confhash{'uniquecode'}})) { + unless ($domconfig{$action}{'uniquecode'}{$crstype}) { + $changes{'uniquecode'} = 1; + } + } + } + } else { + $changes{'uniquecode'} = 1; + } + } elsif (ref($confhash{'uniquecode'}) eq 'HASH') { + $changes{'uniquecode'} = 1; } if ($context eq 'requestcourses') { if (ref($domconfig{$action}{'textbooks'}) eq 'HASH') { @@ -6216,7 +6244,7 @@ sub modify_quotas { if ($confhash{'notify'}{'approval'}) { $changes{'notify'}{'approval'} = 1; } - if ($confhash{'uniquecode'}) { + if (ref($confhash{'uniquecode'} eq 'HASH')) { $changes{'uniquecode'} = 1; } } @@ -6437,7 +6465,7 @@ sub modify_quotas { $resulttext .= ''; } if (ref($changes{'authorquota'}) eq 'HASH') { - $resulttext .= '
  • '.&mt('Authoring space default quotas').'