--- loncom/interface/domainprefs.pm 2019/01/27 14:39:48 1.346 +++ loncom/interface/domainprefs.pm 2019/04/22 00:36:32 1.352 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.346 2019/01/27 14:39:48 raeburn Exp $ +# $Id: domainprefs.pm,v 1.352 2019/04/22 00:36:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2857,7 +2857,7 @@ function toggleLTI(form,setting,item) { } } } - for (var j=0; j' .''. $titles{$item}.''.(' 'x3); if ($item eq 'csv') { @@ -8258,7 +8290,16 @@ sub print_scantronconfig { } $datatable .= ''; } - $datatable .= ''; + $datatable .= ''. + '
'. + ''.&mt('CSV Options').''; + foreach my $option ('hdr','pad','rem') { + $datatable .= ''.$titles{$option}.':'. + ''.(' 'x2)."\n". + '
'; + } + $datatable .= '
'; $itemcount ++; } } @@ -8271,6 +8312,9 @@ sub scantronconfig_titles { return &Apache::lonlocal::texthash( dat => 'Standard format (.dat)', csv => 'Comma separated values (.csv)', + hdr => 'Remove first line in file (contains column titles)', + pad => 'Prepend 0s to PaperID', + rem => 'Remove leading spaces (except Question Response columns)', CODE => 'CODE', ID => 'Student ID', PaperID => 'Paper ID', @@ -12993,7 +13037,7 @@ sub modify_contacts { my (%others,%to,%bcc,%includestr,%includeloc); my @contacts = ('supportemail','adminemail'); my @mailings = ('errormail','packagesmail','helpdeskmail','otherdomsmail', - 'lonstatusmail','requestsmail','updatesmail','idconflictsmail'); + 'lonstatusmail','requestsmail','updatesmail','idconflictsmail','hostipmail'); my @toggles = ('reporterrors','reportupdates','reportstatus'); my @lonstatus = ('threshold','sysmail','weights','excluded'); my ($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields(); @@ -13282,6 +13326,7 @@ sub modify_contacts { $default{'lonstatusmail'} = 'adminemail'; $default{'requestsmail'} = 'adminemail'; $default{'updatesmail'} = 'adminemail'; + $default{'hostipmail'} = 'adminemail'; foreach my $item (@contacts) { if ($to{$item} ne $default{$item}) { $changes{$item} = 1; @@ -15137,18 +15182,20 @@ sub modify_scantron { if ($env{'form.scantronformat_del'}) { $confhash{'scantron'}{'scantronformat'} = ''; $changes{'scantronformat'} = 1; + } else { + $confhash{'scantron'}{'scantronformat'} = $domconfig{'scantron'}{'scantronformat'}; } } } + my @options = ('hdr','pad','rem'); my @fields = &scantroncsv_fields(); my %titles = &scantronconfig_titles(); - my @formats = &Apache::loncommon::get_env_multiple('form.scantronformat'); + my @formats = &Apache::loncommon::get_env_multiple('form.scantronconfig'); my ($newdat,$currdat,%newcol,%currcol); if (grep(/^dat$/,@formats)) { $confhash{'scantron'}{config}{dat} = 1; $newdat = 1; } else { - $confhash{'scantron'}{config}{dat} = 0; $newdat = 0; } if (grep(/^csv$/,@formats)) { @@ -15157,21 +15204,30 @@ sub modify_scantron { if ($env{'form.scantronconfig_csv_'.$field} =~ /^(\d+)$/) { my $posscol = $1; if (($posscol < 20) && (!$bynum{$posscol})) { - $confhash{'scantron'}{config}{csv}{$field} = $posscol; + $confhash{'scantron'}{config}{csv}{fields}{$field} = $posscol; $bynum{$posscol} = $field; $newcol{$field} = $posscol; } } } + if (keys(%newcol)) { + foreach my $option (@options) { + if ($env{'form.scantroncsv_'.$option}) { + $confhash{'scantron'}{config}{csv}{options}{$option} = 1; + } + } + } } $currdat = 1; if (ref($domconfig{'scantron'}) eq 'HASH') { if (ref($domconfig{'scantron'}{'config'}) eq 'HASH') { - if (!$domconfig{'scantron'}{'config'}{'dat'}) { + unless (exists($domconfig{'scantron'}{'config'}{'dat'})) { $currdat = 0; } if (ref($domconfig{'scantron'}{'config'}{'csv'}) eq 'HASH') { - %currcol = %{$domconfig{'scantron'}{'config'}{'csv'}}; + if (ref($domconfig{'scantron'}{'config'}{'csv'}{'fields'}) eq 'HASH') { + %currcol = %{$domconfig{'scantron'}{'config'}{'csv'}{'fields'}}; + } } } } @@ -15183,7 +15239,7 @@ sub modify_scantron { if ($currcol{$field} ne $newcol{$field}) { $changes{'config'} = 1; last; - } + } } elsif ($newcol{$field} ne '') { $changes{'config'} = 1; last; @@ -15204,21 +15260,34 @@ sub modify_scantron { $resulttext .= '
  • '.&mt('Custom bubblesheet format file ([_1]) uploaded for use with courses in this domain.',$custom).'
  • '; } } - if ($changes{'config'}) { + if ($changes{'config'}) { if (ref($confhash{'scantron'}{'config'}) eq 'HASH') { if ($confhash{'scantron'}{'config'}{'dat'}) { $resulttext .= '
  • '.&mt('Bubblesheet data upload formats includes .dat format').'
  • '; } if (ref($confhash{'scantron'}{'config'}{'csv'}) eq 'HASH') { - if (keys(%{$confhash{'scantron'}{'config'}{'csv'}})) { - '
  • '.&mt('Bubblesheet data upload formats includes .csv format, with following fields/column numbers supported:').'
      '; - foreach my $field (@fields) { - if ($confhash{'scantron'}{'config'}{'csv'}{$field} ne '') { - my $showcol = $confhash{'scantron'}{'config'}{'csv'}{$field} + 1; - $resulttext .= '
    • '.$titles{$field}.': '.$showcol.'
    • '; + if (ref($confhash{'scantron'}{'config'}{'csv'}{'fields'}) eq 'HASH') { + if (keys(%{$confhash{'scantron'}{'config'}{'csv'}{'fields'}})) { + $resulttext .= '
    • '.&mt('Bubblesheet data upload formats includes .csv format, with following fields/column numbers supported:').'
        '; + foreach my $field (@fields) { + if ($confhash{'scantron'}{'config'}{'csv'}{'fields'}{$field} ne '') { + my $showcol = $confhash{'scantron'}{'config'}{'csv'}{'fields'}{$field} + 1; + $resulttext .= '
      • '.$titles{$field}.': '.$showcol.'
      • '; + } + } + $resulttext .= '
    • '; + if (ref($confhash{'scantron'}{'config'}{'csv'}{'options'}) eq 'HASH') { + if (keys(%{$confhash{'scantron'}{'config'}{'csv'}{'options'}})) { + $resulttext .= '
    • '.&mt('Bubblesheet data upload formats includes .csv format, with following options:').'
        '; + foreach my $option (@options) { + if ($confhash{'scantron'}{'config'}{'csv'}{'options'}{$option} ne '') { + $resulttext .= '
      • '.$titles{$option}.'
      • '; + } + } + $resulttext .= '
    • '; + } } } - $resulttext .= '
  • '; } } } else { @@ -16066,7 +16135,6 @@ sub modify_coursedefaults { $defaultshash{'coursedefaults'}{$setting}{$type} = $newdef; } if ($currdef ne $newdef) { - my $staticdef; if ($item eq 'anonsurvey_threshold') { unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) { $changes{$item} = 1; @@ -16082,11 +16150,12 @@ sub modify_coursedefaults { my $texengine; if ($env{'form.texengine'} =~ /^(MathJax|mimetex|tth)$/) { $texengine = $env{'form.texengine'}; - if ($defaultshash{'coursedefaults'}{'texengine'} eq '') { - unless ($texengine eq 'MathJax') { + my $currdef = $domconfig{'coursedefaults'}{'texengine'}; + if ($currdef eq '') { + unless ($texengine eq $Apache::lonnet::deftex) { $changes{'texengine'} = 1; } - } elsif ($defaultshash{'coursedefaults'}{'texengine'} ne $texengine) { + } elsif ($currdef ne $texengine) { $changes{'texengine'} = 1; } }