--- loncom/interface/domainprefs.pm 2015/05/12 00:20:42 1.160.6.63 +++ loncom/interface/domainprefs.pm 2014/10/06 21:08:03 1.255 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.160.6.63 2015/05/12 00:20:42 raeburn Exp $ +# $Id: domainprefs.pm,v 1.255 2014/10/06 21:08:03 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'}}; @@ -250,8 +250,6 @@ sub handler { header => [{col1 => 'Log-in Page Items', col2 => '',}, {col1 => 'Log-in Help', - col2 => 'Value'}, - {col1 => 'Custom HTML in document head', col2 => 'Value'}], print => \&print_login, modify => \&modify_login, @@ -411,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', @@ -433,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', @@ -465,8 +479,6 @@ sub handler { {col1 => 'Log-in Page Items', col2 => ''}, {col1 => 'Log-in Help', - col2 => 'Value'}, - {col1 => 'Custom HTML in document head', col2 => 'Value'}], print => \&print_login, modify => \&modify_login, @@ -619,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') { @@ -656,7 +670,7 @@ sub print_config_box { my $colspan = ''; my $rightcolspan = ''; if (($action eq 'rolecolors') || ($action eq 'defaults') || - (($action eq 'login') && ($numheaders < 4))) { + (($action eq 'login') && ($numheaders < 3))) { $colspan = ' colspan="2"'; } if ($action eq 'usersessions') { @@ -678,7 +692,7 @@ sub print_config_box { } elsif ($action eq 'coursecategories') { $output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal); } elsif ($action eq 'login') { - if ($numheaders == 4) { + if ($numheaders == 3) { $colspan = ' colspan="2"'; $output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal); } else { @@ -731,7 +745,7 @@ sub print_config_box { ($action eq 'defaults')) { $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } elsif ($action eq 'login') { - if ($numheaders == 4) { + if ($numheaders == 3) { $output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).' @@ -747,27 +761,6 @@ sub print_config_box { } else { $output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal); } - $output .= ' - - - - - - - '; - if ($numheaders == 4) { - $output .= ' - - - '; - } else { - $output .= ' - - - '; - } - $rowtotal ++; - $output .= &print_login('headtag',$dom,$confname,$phase,$settings,\$rowtotal); } elsif ($action eq 'requestcourses') { $output .= &print_requestmail($dom,$action,$settings,\$rowtotal); $rowtotal ++; @@ -1188,57 +1181,6 @@ sub print_login { $itemcount ++; } $datatable .= &captcha_choice('login',$settings,$itemcount); - } elsif ($caller eq 'headtag') { - my %domservers = &Apache::lonnet::get_servers($dom); - my $choice = $choices{'headtag'}; - $css_class = ' class="LC_odd_row"'; - $datatable .= ''. - ''; } return $datatable; } @@ -1272,9 +1214,6 @@ sub login_choices { link => "Link", alink => "Active link", vlink => "Visited link", - headtag => "Custom markup", - action => "Action", - current => "Current", ); return %choices; } @@ -2826,7 +2765,7 @@ sub print_helpsettings { sub radiobutton_prefs { my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick, - $additional,$align) = @_; + $additional) = @_; return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && (ref($choices) eq 'HASH')); @@ -2860,14 +2799,8 @@ sub radiobutton_prefs { $datatable .= ''; - if ($align eq 'left') { - $datatable .= ''. + '
'.&mt($item->{'header'}->[3]->{'col1'}).''.&mt($item->{'header'}->[3]->{'col2'}).'
'.&mt($item->{'header'}->[2]->{'col1'}).''.&mt($item->{'header'}->[2]->{'col2'}).'
'.$choice.''. - ''. - ''. - ''."\n"; - my (%currurls,%currexempt); - if (ref($settings) eq 'HASH') { - if (ref($settings->{'headtag'}) eq 'HASH') { - foreach my $lonhost (keys(%{$settings->{'headtag'}})) { - if (ref($settings->{'headtag'}{$lonhost}) eq 'HASH') { - $currurls{$lonhost} = $settings->{'headtag'}{$lonhost}{'url'}; - $currexempt{$lonhost} = $settings->{'headtag'}{$lonhost}{'exempt'}; - } - } - } - } - my %lt = &Apache::lonlocal::texthash( - del => 'Delete?', - rep => 'Replace:', - upl => 'Upload:', - curr => 'View contents', - none => 'None', - ); - my $switchserver = &check_switchserver($dom,$confname); - foreach my $lonhost (sort(keys(%domservers))) { - my $exempt = &check_exempt_addresses($currexempt{$lonhost}); - $datatable .= ''; - if ($currurls{$lonhost}) { - $datatable .= ''. - ''; - } - $datatable .= '
'.$choices{'hostid'}.''.$choices{'current'}.''.$choices{'action'}.''.$choices{'exempt'}.'
'.$domservers{$lonhost}.''.$lt{'curr'}.' '.$lt{'rep'}.''; - } else { - $datatable .= ''.$lt{'none'}.''.$lt{'upl'}; - } - $datatable .='
'; - if ($switchserver) { - $datatable .= &mt('Upload to library server: [_1]',$switchserver); - } else { - $datatable .= ''; - } - $datatable .= '
'. ''.$choices->{$item}. - ''; - } else { - $datatable .= ''; - } - $datatable .= - ''. + ''. ' '. &mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.'); @@ -3535,7 +3412,7 @@ sub current_offloads_to { } sub spares_row { - my ($dom,$servers,$spareid,$serverhomes,$altids,$curroffloadnow,$rowtotal) = @_; + my ($dom,$servers,$spareid,$serverhomes,$altids,$rowtotal) = @_; my $css_class; my $numinrow = 4; my $itemcount = 1; @@ -3555,21 +3432,12 @@ sub spares_row { } } next unless (ref($spareid->{$server}) eq 'HASH'); - my $checkednow; - if (ref($curroffloadnow) eq 'HASH') { - if ($curroffloadnow->{$server}) { - $checkednow = ' checked="checked"'; - } - } $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; $datatable .= ' '. &mt('[_1] when busy, offloads to:' - ,''.$server.'').'
'. - ''."\n". - ''. + ,''.$server.''). "\n"; my (%current,%canselect); my @choices = @@ -4696,8 +4564,11 @@ sub print_defaults { my $includeempty = 1; $datatable .= &Apache::loncommon::select_datelocale($item,$defaults{$item},undef,$includeempty); } elsif ($item eq 'lang_def') { - my $includeempty = 1; - $datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty); + my %langchoices = &get_languages_hash(); + $langchoices{''} = 'No language preference'; + %langchoices = &Apache::lonlocal::texthash(%langchoices); + $datatable .= &Apache::loncommon::select_form($defaults{$item},$item, + \%langchoices); } else { my $size; if ($item eq 'portal_def') { @@ -4766,7 +4637,7 @@ sub print_defaults { $datatable .= ''; } $datatable .= ' '.&mt('Internal ID:'). - ''. + ''. ' '.&mt('(new)'). '
'. &mt('Name displayed:'). @@ -5303,12 +5174,12 @@ sub serverstatus_pages { return ('userstatus','lonstatus','loncron','server-status','codeversions', 'checksums','clusterstatus','metadata_keywords','metadata_harvest', 'takeoffline','takeonline','showenv','toggledebug','ping','domconf', - 'uniquecodes','diskusage','coursecatalog'); + 'uniquecodes','diskusage'); } sub defaults_javascript { my ($settings) = @_; - return unless (ref($settings) eq 'HASH'); + return unless (ref($settings) eq 'HASH'); if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { my $maxnum = scalar(@{$settings->{'inststatusorder'}}); if ($maxnum eq '') { @@ -5908,7 +5779,6 @@ sub modify_login { } my %servers = &Apache::lonnet::internet_dom_servers($dom); - my %domservers = &Apache::lonnet::get_servers($dom); my @loginvia_attribs = ('serverpath','custompath','exempt'); if (keys(%servers) > 1) { foreach my $lonhost (keys(%servers)) { @@ -5951,7 +5821,22 @@ sub modify_login { $changes{'loginvia'}{$lonhost} = 1; } if ($item eq 'exempt') { - $new = &check_exempt_addresses($new); + $new =~ s/^\s+//; + $new =~ s/\s+$//; + my @poss_ips = split(/\s*[,:]\s*/,$new); + my @okips; + foreach my $ip (@poss_ips) { + if ($ip =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { + if (($1 <= 255) && ($2 <= 255) && ($3 <= 255) && ($4 <= 255)) { + push(@okips,$ip); + } + } + } + if (@okips > 0) { + $new = join(',',@okips); + } else { + $new = ''; + } } $loginhash{login}{loginvia}{$lonhost}{$item} = $new; } @@ -6063,85 +5948,6 @@ sub modify_login { $errors .= '
  • '.$error.'
  • '; } } - - my (%currheadtagurls,%currexempt,@newhosts,%newheadtagurls,%possexempt); - if (ref($domconfig{'login'}) eq 'HASH') { - if (ref($domconfig{'login'}{'headtag'}) eq 'HASH') { - foreach my $lonhost (keys(%{$domconfig{'login'}{'headtag'}})) { - if ($domservers{$lonhost}) { - if (ref($domconfig{'login'}{'headtag'}{$lonhost}) eq 'HASH') { - $currheadtagurls{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'url'}; - $currexempt{$lonhost} = $domconfig{'login'}{'headtagexempt'}{$lonhost}{'exempt'} - } - } - } - } - } - my @delheadtagurls = &Apache::loncommon::get_env_multiple('form.loginheadtag_del'); - foreach my $lonhost (sort(keys(%domservers))) { - if (grep(/^\Q$lonhost\E$/,@delheadtagurls)) { - $changes{'headtag'}{$lonhost} = 1; - } else { - if ($env{'form.loginheadtagexempt_'.$lonhost}) { - $possexempt{$lonhost} = &check_exempt_addresses($env{'form.loginheadtagexempt_'.$lonhost}); - } - if ($env{'form.loginheadtag_'.$lonhost.'.filename'}) { - push(@newhosts,$lonhost); - } elsif ($currheadtagurls{$lonhost}) { - $loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $currheadtagurls{$lonhost}; - if ($currexempt{$lonhost}) { - if ((!exists($possexempt{$lonhost})) || ($possexempt{$lonhost} ne $currexempt{$lonhost})) { - $changes{'headtag'}{$lonhost} = 1; - } - } elsif ($possexempt{$lonhost}) { - $changes{'headtag'}{$lonhost} = 1; - } - if ($possexempt{$lonhost}) { - $loginhash{'login'}{'headtag'}{$lonhost}{'exempt'} = $possexempt{$lonhost}; - } - } - } - } - if (@newhosts) { - my $error; - my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); - if ($configuserok eq 'ok') { - if ($switchserver) { - $error = &mt("Upload of custom markup is not permitted to this server: [_1]",$switchserver); - } elsif ($author_ok eq 'ok') { - foreach my $lonhost (@newhosts) { - my $formelem = 'loginheadtag_'.$lonhost; - (my $result,$newheadtagurls{$lonhost}) = &publishlogo($r,'upload',$formelem,$dom,$confname, - "login/headtag/$lonhost",'','', - $env{'form.loginheadtag_'.$lonhost.'.filename'}); - if ($result eq 'ok') { - $loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $newheadtagurls{$lonhost}; - $changes{'headtag'}{$lonhost} = 1; - if ($possexempt{$lonhost}) { - $loginhash{'login'}{'headtag'}{$lonhost}{'exempt'} = $possexempt{$lonhost}; - } - } else { - my $puberror = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].", - $newheadtagurls{$lonhost},$result); - $errors .= '
  • '.$puberror.'
  • '; - if ((grep(/^\Q$lonhost\E$/,keys(%currheadtagurls))) && - (!grep(/^\Q$lonhost\E$/,@delheadtagurls))) { - $loginhash{'login'}{'headtag'}{$lonhost} = $currheadtagurls{$lonhost}; - } - } - } - } else { - $error = &mt("Upload of custom markup file(s) failed because an author role could not be assigned to a Domain Configuration user ([_1]) in domain: [_2]. Error was: [_3].",$confname,$dom,$author_ok); - } - } else { - $error = &mt("Upload of custom markup file(s) failed because a Domain Configuration user ([_1]) could not be created in domain: [_2]. Error was: [_3].",$confname,$dom,$configuserok); - } - if ($error) { - &Apache::lonnet::logthis($error); - $errors .= '
  • '.$error.'
  • '; - } - } - &process_captcha('login',\%changes,$loginhash{'login'},$domconfig{'login'}); my $defaulthelpfile = '/adm/loginproblems.html'; @@ -6242,25 +6048,6 @@ sub modify_login { } } } - } elsif ($item eq 'headtag') { - if (ref($changes{$item}) eq 'HASH') { - foreach my $lonhost (sort(keys(%{$changes{$item}}))) { - if (grep(/^\Q$lonhost\E$/,@delheadtagurls)) { - $resulttext .= '
  • '.&mt('custom markup file removed for [_1]',$domservers{$lonhost}).'
  • '; - } elsif (ref($loginhash{'login'}{'headtag'}{$lonhost}) eq 'HASH') { - $resulttext .= '
  • '.&mt('custom markup').' '.&mt('(for [_1])',$servers{$lonhost}).' '; - if ($possexempt{$lonhost}) { - $resulttext .= &mt('not included for client IP(s): [_1]',$possexempt{$lonhost}); - } else { - $resulttext .= &mt('included for any client IP'); - } - $resulttext .= '
  • '; - } - } - } } elsif ($item eq 'captcha') { if (ref($loginhash{'login'}) eq 'HASH') { my $chgtxt; @@ -6316,27 +6103,6 @@ sub modify_login { return $resulttext; } -sub check_exempt_addresses { - my ($iplist) = @_; - $iplist =~ s/^\s+//; - $iplist =~ s/\s+$//; - my @poss_ips = split(/\s*[,:]\s*/,$iplist); - my (@okips,$new); - foreach my $ip (@poss_ips) { - if ($ip =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { - if (($1 <= 255) && ($2 <= 255) && ($3 <= 255) && ($4 <= 255)) { - push(@okips,$ip); - } - } - } - if (@okips > 0) { - $new = join(',',@okips); - } else { - $new = ''; - } - return $new; -} - sub color_font_choices { my %choices = &Apache::lonlocal::texthash ( @@ -7225,7 +6991,7 @@ sub modify_quotas { my $newpos = $env{'form.'.$itemid}; $newpos =~ s/\D+//g; foreach my $item ('subject','title','publisher','author') { - next if ((($item eq 'author') || ($item eq 'publisher')) && + 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}) { @@ -10225,18 +9991,14 @@ sub modify_helpsettings { sub modify_coursedefaults { my ($dom,$lastactref,%domconfig) = @_; my ($resulttext,$errors,%changes,%defaultshash); - my %defaultchecked = ( - 'uselcmath' => 'on', - 'usejsme' => 'on' - ); - my @toggles = ('uselcmath','usejsme'); + my %defaultchecked = ('canuse_pdfforms' => 'off'); + my @toggles = ('canuse_pdfforms'); my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial', 'uploadquota_community','uploadquota_textbook'); my @types = ('official','unofficial','community','textbook'); my %staticdefaults = ( anonsurvey_threshold => 10, uploadquota => 500, - postsubmit => 60, ); $defaultshash{'coursedefaults'} = {}; @@ -10298,81 +10060,26 @@ sub modify_coursedefaults { } } - my %credits; - foreach my $type (@types) { - unless ($type eq 'community') { - $credits{$type} = $env{'form.'.$type.'_credits'}; - $credits{$type} =~ s/[^\d.]+//g; - } - } - if ((ref($domconfig{'coursedefaults'}{'coursecredits'}) ne 'HASH') && - ($env{'form.coursecredits'} eq '1')) { - $changes{'coursecredits'} = 1; - foreach my $type (keys(%credits)) { - $defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type}; - } - } else { - if ($env{'form.coursecredits'} eq '1') { - foreach my $type (@types) { - unless ($type eq 'community') { - if ($domconfig{'coursedefaults'}{'coursecredits'}{$type} ne $credits{$type}) { - $changes{'coursecredits'} = 1; - } - $defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type}; - } - } - } elsif (ref($domconfig{'coursedefaults'}{'coursecredits'}) eq 'HASH') { - foreach my $type (@types) { - unless ($type eq 'community') { - if ($domconfig{'coursedefaults'}{'coursecredits'}{$type}) { - $changes{'coursecredits'} = 1; - last; - } - } - } - } - } - if ($env{'form.postsubmit'} eq '1') { - $defaultshash{'coursedefaults'}{'postsubmit'}{'client'} = 'on'; - my %currtimeout; - if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') { - if ($domconfig{'coursedefaults'}{'postsubmit'}{'client'} eq 'off') { - $changes{'postsubmit'} = 1; - } - if (ref($domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') { - %currtimeout = %{$domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}}; - } - } else { - $changes{'postsubmit'} = 1; - } - foreach my $type (@types) { - my $timeout = $env{'form.'.$type.'_timeout'}; - $timeout =~ s/\D//g; - if ($timeout == $staticdefaults{'postsubmit'}) { - $timeout = ''; - } elsif (($timeout eq '') || ($timeout =~ /^0+$/)) { - $timeout = '0'; - } - unless ($timeout eq '') { - $defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type} = $timeout; - } - if (exists($currtimeout{$type})) { - if ($timeout ne $currtimeout{$type}) { - $changes{'postsubmit'} = 1; - } - } elsif ($timeout ne '') { - $changes{'postsubmit'} = 1; - } - } - } else { - $defaultshash{'coursedefaults'}{'postsubmit'}{'client'} = 'off'; - if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') { - if ($domconfig{'coursedefaults'}{'postsubmit'}{'client'} eq 'on') { - $changes{'postsubmit'} = 1; - } - } else { - $changes{'postsubmit'} = 1; - } + my $officialcreds = $env{'form.official_credits'}; + $officialcreds =~ s/[^\d.]+//g; + my $unofficialcreds = $env{'form.unofficial_credits'}; + $unofficialcreds =~ s/[^\d.]+//g; + my $textbookcreds = $env{'form.textbook_credits'}; + $textbookcreds =~ s/[^\d.]+//g; + if (ref($domconfig{'coursedefaults'}{'coursecredits'} ne 'HASH') && + ($env{'form.coursecredits'} eq '1')) { + $changes{'coursecredits'} = 1; + } else { + if (($domconfig{'coursedefaults'}{'coursecredits'}{'official'} ne $officialcreds) || + ($domconfig{'coursedefaults'}{'coursecredits'}{'unofficial'} ne $unofficialcreds) || + ($domconfig{'coursedefaults'}{'coursecredits'}{'textbook'} ne $textbookcreds)) { + $changes{'coursecredits'} = 1; + } + } + $defaultshash{'coursedefaults'}{'coursecredits'} = { + official => $officialcreds, + unofficial => $unofficialcreds, + textbook => $textbookcreds, } } my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, @@ -10380,30 +10087,19 @@ sub modify_coursedefaults { if ($putresult eq 'ok') { if (keys(%changes) > 0) { my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); - if (($changes{'uploadquota'}) || ($changes{'postsubmit'}) || - ($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'})) { - foreach my $item ('uselcmath','usejsme') { - if ($changes{$item}) { - $domdefaults{$item}=$defaultshash{'coursedefaults'}{$item}; - } + if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'}) || + ($changes{'uploadquota'})) { + if ($changes{'canuse_pdfforms'}) { + $domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'}; } if ($changes{'coursecredits'}) { if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { - foreach my $type (keys(%{$defaultshash{'coursedefaults'}{'coursecredits'}})) { - $domdefaults{$type.'credits'} = - $defaultshash{'coursedefaults'}{'coursecredits'}{$type}; - } - } - } - if ($changes{'postsubmit'}) { - if (ref($defaultshash{'coursedefaults'}{'postsubmit'}) eq 'HASH') { - $domdefaults{'postsubmit'} = $defaultshash{'coursedefaults'}{'postsubmit'}{'client'}; - if (ref($defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') { - foreach my $type (keys(%{$defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}})) { - $domdefaults{$type.'postsubtimeout'} = - $defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type}; - } - } + $domdefaults{'officialcredits'} = + $defaultshash{'coursedefaults'}{'coursecredits'}{'official'}; + $domdefaults{'unofficialcredits'} = + $defaultshash{'coursedefaults'}{'coursecredits'}{'unofficial'}; + $domdefaults{'textbookcredits'} = + $domdefaults{'coursedefaults'}{'coursecredits'}{'textbook'}; } } if ($changes{'uploadquota'}) { @@ -10421,17 +10117,11 @@ sub modify_coursedefaults { } $resulttext = &mt('Changes made:').'
      '; foreach my $item (sort(keys(%changes))) { - if ($item eq 'uselcmath') { - if ($env{'form.'.$item} eq '1') { - $resulttext .= '
    • '.&mt('Math preview uses LON-CAPA previewer (javascript), if supported by browser.').'
    • '; - } else { - $resulttext .= '
    • '.&mt('Math preview uses DragMath (Java), if supported by client OS.').'
    • '; - } - } elsif ($item eq 'usejsme') { + if ($item eq 'canuse_pdfforms') { if ($env{'form.'.$item} eq '1') { - $resulttext .= '
    • '.&mt('Molecule editor uses JSME (HTML5), if supported by browser.').'
    • '; + $resulttext .= '
    • '.&mt("Course/Community users can create/upload PDF forms set to 'on'").'
    • '; } else { - $resulttext .= '
    • '.&mt('Molecule editor uses JME (Java), if supported by client OS.').'
    • '; + $resulttext .= '
    • '.&mt('Course/Community users can create/upload PDF forms set to "off"').'
    • '; } } elsif ($item eq 'anonsurvey_threshold') { $resulttext .= '
    • '.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'
    • '; @@ -10448,42 +10138,6 @@ sub modify_coursedefaults { } else { $resulttext .= '
    • '.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).'
    • '; } - } elsif ($item eq 'postsubmit') { - if ($domdefaults{'postsubmit'} eq 'off') { - $resulttext .= '
    • '.&mt('Submit button(s) remain enabled on page after student makes submission.'); - } else { - $resulttext .= '
    • '.&mt('Submit button(s) disabled on page after student makes submission').'; '; - if (ref($defaultshash{'coursedefaults'}{'postsubmit'}) eq 'HASH') { - $resulttext .= &mt('durations:').'
        '; - foreach my $type (@types) { - $resulttext .= '
      • '; - my $timeout; - if (ref($defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') { - $timeout = $defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type}; - } - my $display; - if ($timeout eq '0') { - $display = &mt('unlimited'); - } elsif ($timeout eq '') { - $display = &mt('[quant,_1,second] (default)',$staticdefaults{'postsubmit'}); - } else { - $display = &mt('[quant,_1,second]',$timeout); - } - if ($type eq 'community') { - $resulttext .= &mt('Communities'); - } elsif ($type eq 'official') { - $resulttext .= &mt('Official courses'); - } elsif ($type eq 'unofficial') { - $resulttext .= &mt('Unofficial courses'); - } elsif ($type eq 'textbook') { - $resulttext .= &mt('Textbook courses'); - } - $resulttext .= ' -- '.$display.'
      • '; - } - $resulttext .= '
      '; - } - $resulttext .= '
    • '; - } } elsif ($item eq 'coursecredits') { if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { if (($domdefaults{'officialcredits'} eq '') && @@ -10919,23 +10573,7 @@ sub modify_usersessions { $changes{'spares'}{$lonhost} = \%spareschg; } } - $defaultshash{'usersessions'}{'offloadnow'} = {}; - my @offloadnow = &Apache::loncommon::get_env_multiple('form.offloadnow'); - my @okoffload; - if (@offloadnow) { - foreach my $server (@offloadnow) { - if (&Apache::lonnet::hostname($server) ne '') { - unless (grep(/^\Q$server\E$/,@okoffload)) { - push(@okoffload,$server); - } - } - } - if (@okoffload) { - foreach my $lonhost (@okoffload) { - $defaultshash{'usersessions'}{'offloadnow'}{$lonhost} = 1; - } - } - } + if (ref($domconfig{'usersessions'}) eq 'HASH') { if (ref($domconfig{'usersessions'}{'spares'}) eq 'HASH') { if (ref($changes{'spares'}) eq 'HASH') { @@ -10946,27 +10584,8 @@ sub modify_usersessions { } else { $savespares = 1; } - if (ref($domconfig{'usersessions'}{'offloadnow'}) eq 'HASH') { - foreach my $lonhost (keys(%{$domconfig{'usersessions'}{'offloadnow'}})) { - unless ($defaultshash{'usersessions'}{'offloadnow'}{$lonhost}) { - $changes{'offloadnow'} = 1; - last; - } - } - unless ($changes{'offloadnow'}) { - foreach my $lonhost (keys(%{$defaultshash{'usersessions'}{'offloadnow'}})) { - unless ($domconfig{'usersessions'}{'offloadnow'}{$lonhost}) { - $changes{'offloadnow'} = 1; - last; - } - } - } - } elsif (@okoffload) { - $changes{'offloadnow'} = 1; - } - } elsif (@okoffload) { - $changes{'offloadnow'} = 1; } + my $nochgmsg = &mt('No changes made to settings for user session hosting/offloading.'); if ((keys(%changes) > 0) || ($savespares)) { my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, @@ -10979,9 +10598,6 @@ sub modify_usersessions { if (ref($defaultshash{'usersessions'}{'hosted'}) eq 'HASH') { $domdefaults{'hostedsessions'} = $defaultshash{'usersessions'}{'hosted'}; } - if (ref($defaultshash{'usersessions'}{'offloadnow'}) eq 'HASH') { - $domdefaults{'offloadnow'} = $defaultshash{'usersessions'}{'offloadnow'}; - } } my $cachetime = 24*60*60; &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); @@ -11050,21 +10666,6 @@ sub modify_usersessions { $resulttext .= '
    '; } } - if ($changes{'offloadnow'}) { - if (ref($defaultshash{'usersessions'}{'offloadnow'}) eq 'HASH') { - if (keys(%{$defaultshash{'usersessions'}{'offloadnow'}}) > 0) { - $resulttext .= '
  • '.&mt('Switch active users on next access, for server(s):').'
      '; - foreach my $lonhost (sort(keys(%{$defaultshash{'usersessions'}{'offloadnow'}}))) { - $resulttext .= '
    • '.$lonhost.'
    • '; - } - $resulttext .= '
    '; - } else { - $resulttext .= '
  • '.&mt('No servers now set to switch active users on next access.'); - } - } else { - $resulttext .= '
  • '.&mt('No servers now set to switch active users on next access.').'
  • '; - } - } $resulttext .= ''; } else { $resulttext = $nochgmsg; @@ -11179,7 +10780,7 @@ sub modify_loadbalancing { } if ($rule eq 'specific') { my $specifiedhost = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type}; - if (exists($servers{$specifiedhost})) { + if (exists($servers{$specifiedhost})) { $rule = $specifiedhost; } } @@ -11255,7 +10856,7 @@ sub modify_loadbalancing { if ($rule eq '') { $balancetext = $ruletitles{'default'}; } elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') || - ($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { + ($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { if (($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { foreach my $sparetype (@sparestypes) { if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') { @@ -12013,9 +11614,6 @@ function toggleDisplay(domForm,caller) { if (caller == 'emailoptions') { optionsElement = domForm.cancreate_email; } - if (caller == 'studentsubmission') { - optionsElement = domForm.postsubmit; - } if (optionsElement.length) { var currval; for (var i=0; i 1) { foreach my $server (keys(%servers)) { next if ($thismachine{$server}); my @cached;