version 1.346, 2019/01/27 14:39:48
|
version 1.349, 2019/02/15 20:56:14
|
Line 5272 sub print_coursedefaults {
|
Line 5272 sub print_coursedefaults {
|
mysqltables => 'Lifetime (s) of "Temporary" MySQL tables (student performance data) on homeserver', |
mysqltables => 'Lifetime (s) of "Temporary" MySQL tables (student performance data) on homeserver', |
); |
); |
my %staticdefaults = ( |
my %staticdefaults = ( |
texengine => 'MathJax', |
|
anonsurvey_threshold => 10, |
anonsurvey_threshold => 10, |
uploadquota => 500, |
uploadquota => 500, |
postsubmit => 60, |
postsubmit => 60, |
Line 5286 sub print_coursedefaults {
|
Line 5285 sub print_coursedefaults {
|
'canclone' => 'none', |
'canclone' => 'none', |
); |
); |
@toggles = ('canuse_pdfforms','uselcmath','usejsme'); |
@toggles = ('canuse_pdfforms','uselcmath','usejsme'); |
my $deftex = $staticdefaults{'texengine'}; |
my $deftex = $Apache::lonnet::deftex; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{'texengine'}) { |
if ($settings->{'texengine'}) { |
if ($settings->{'texengine'} =~ /^(MathJax|mimetex|tth)$/) { |
if ($settings->{'texengine'} =~ /^(MathJax|mimetex|tth)$/) { |
Line 7996 sub scantron_javascript {
|
Line 7995 sub scantron_javascript {
|
// <![CDATA[ |
// <![CDATA[ |
|
|
function toggleScantron(form) { |
function toggleScantron(form) { |
|
var csvfieldset = new Array(); |
if (document.getElementById('scantroncsv_cols')) { |
if (document.getElementById('scantroncsv_cols')) { |
var csvfieldset = document.getElementById('scantroncsv_cols'); |
csvfieldset.push(document.getElementById('scantroncsv_cols')); |
|
} |
|
if (document.getElementById('scantroncsv_options')) { |
|
csvfieldset.push(document.getElementById('scantroncsv_options')); |
|
} |
|
if (csvfieldset.length) { |
if (document.getElementById('scantronconfcsv')) { |
if (document.getElementById('scantronconfcsv')) { |
var scantroncsv = document.getElementById('scantronconfcsv'); |
var scantroncsv = document.getElementById('scantronconfcsv'); |
if (scantroncsv.checked) { |
if (scantroncsv.checked) { |
csvfieldset.style.display = 'inline-block'; |
for (var i=0; i<csvfieldset.length; i++) { |
|
csvfieldset[i].style.display = 'block'; |
|
} |
} else { |
} else { |
csvfieldset.style.display = 'none'; |
for (var i=0; i<csvfieldset.length; i++) { |
|
csvfieldset[i].style.display = 'none'; |
|
} |
var csvselects = document.getElementsByClassName('scantronconfig_csv'); |
var csvselects = document.getElementsByClassName('scantronconfig_csv'); |
if (csvselects.length) { |
if (csvselects.length) { |
for (var j=0; j<csvselects.length; j++) { |
for (var j=0; j<csvselects.length; j++) { |
Line 8199 sub print_scantronconfig {
|
Line 8208 sub print_scantronconfig {
|
my ($dom,$settings,$rowtotal) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my $itemcount = 2; |
my $itemcount = 2; |
my $is_checked = ' checked="checked"'; |
my $is_checked = ' checked="checked"'; |
|
my %optionson = ( |
|
hdr => ' checked="checked"', |
|
pad => ' checked="checked"', |
|
rem => ' checked="checked"', |
|
); |
|
my %optionsoff = ( |
|
hdr => '', |
|
pad => '', |
|
rem => '', |
|
); |
my $currcsvsty = 'none'; |
my $currcsvsty = 'none'; |
my ($datatable,%csvfields,%checked,%onclick); |
my ($datatable,%csvfields,%checked,%onclick,%csvoptions); |
my @fields = &scantroncsv_fields(); |
my @fields = &scantroncsv_fields(); |
my %titles = &scantronconfig_titles(); |
my %titles = &scantronconfig_titles(); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
Line 8209 sub print_scantronconfig {
|
Line 8228 sub print_scantronconfig {
|
$checked{'dat'} = $is_checked; |
$checked{'dat'} = $is_checked; |
} |
} |
if (ref($settings->{config}->{csv}) eq 'HASH') { |
if (ref($settings->{config}->{csv}) eq 'HASH') { |
%csvfields = %{$settings->{config}->{csv}}; |
if (ref($settings->{config}->{csv}->{fields}) eq 'HASH') { |
if (keys(%csvfields) > 0) { |
%csvfields = %{$settings->{config}->{csv}->{fields}}; |
$checked{'csv'} = $is_checked; |
if (keys(%csvfields) > 0) { |
$currcsvsty = 'inline-block'; |
$checked{'csv'} = $is_checked; |
|
$currcsvsty = 'block'; |
|
} |
|
} |
|
if (ref($settings->{config}->{csv}->{options}) eq 'HASH') { |
|
%csvoptions = %{$settings->{config}->{csv}->{options}}; |
|
foreach my $option (keys(%optionson)) { |
|
unless ($csvoptions{$option}) { |
|
$optionsoff{$option} = $optionson{$option}; |
|
$optionson{$option} = ''; |
|
} |
|
} |
} |
} |
} |
} |
} else { |
} else { |
Line 8229 sub print_scantronconfig {
|
Line 8259 sub print_scantronconfig {
|
my $id; |
my $id; |
if ($item eq 'csv') { |
if ($item eq 'csv') { |
$id = 'id="scantronconfcsv" '; |
$id = 'id="scantronconfcsv" '; |
} |
} |
$datatable .= '<label><input type="checkbox" name="scantronconfig" '.$id.'value="'.$item.'"'.$checked{$item}.$onclick{$item}.' />'. |
$datatable .= '<label><input type="checkbox" name="scantronconfig" '.$id.'value="'.$item.'"'.$checked{$item}.$onclick{$item}.' />'. |
$titles{$item}.'</label>'.(' 'x3); |
$titles{$item}.'</label>'.(' 'x3); |
if ($item eq 'csv') { |
if ($item eq 'csv') { |
Line 8258 sub print_scantronconfig {
|
Line 8288 sub print_scantronconfig {
|
} |
} |
$datatable .= '</select></td></tr>'; |
$datatable .= '</select></td></tr>'; |
} |
} |
$datatable .= '</table></fieldset>'; |
$datatable .= '</table></fieldset>'. |
|
'<fieldset style="display:'.$currcsvsty.'" id="scantroncsv_options">'. |
|
'<legend>'.&mt('CSV Options').'</legend>'; |
|
foreach my $option ('hdr','pad','rem') { |
|
$datatable .= '<span class="LC_nobreak">'.$titles{$option}.':'. |
|
'<label><input type="radio" name="scantroncsv_'.$option.'" value="1"'.$optionson{$option}.' />'. |
|
&mt('Yes').'</label>'.(' 'x2)."\n". |
|
'<label><input type="radio" name="scantroncsv_'.$option.'" value="0"'.$optionsoff{$option}.' />'.&mt('No').'</label></span><br />'; |
|
} |
|
$datatable .= '</fieldset>'; |
$itemcount ++; |
$itemcount ++; |
} |
} |
} |
} |
Line 8271 sub scantronconfig_titles {
|
Line 8310 sub scantronconfig_titles {
|
return &Apache::lonlocal::texthash( |
return &Apache::lonlocal::texthash( |
dat => 'Standard format (.dat)', |
dat => 'Standard format (.dat)', |
csv => 'Comma separated values (.csv)', |
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', |
CODE => 'CODE', |
ID => 'Student ID', |
ID => 'Student ID', |
PaperID => 'Paper ID', |
PaperID => 'Paper ID', |
Line 15137 sub modify_scantron {
|
Line 15179 sub modify_scantron {
|
if ($env{'form.scantronformat_del'}) { |
if ($env{'form.scantronformat_del'}) { |
$confhash{'scantron'}{'scantronformat'} = ''; |
$confhash{'scantron'}{'scantronformat'} = ''; |
$changes{'scantronformat'} = 1; |
$changes{'scantronformat'} = 1; |
|
} else { |
|
$confhash{'scantron'}{'scantronformat'} = $domconfig{'scantron'}{'scantronformat'}; |
} |
} |
} |
} |
} |
} |
|
my @options = ('hdr','pad','rem'); |
my @fields = &scantroncsv_fields(); |
my @fields = &scantroncsv_fields(); |
my %titles = &scantronconfig_titles(); |
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); |
my ($newdat,$currdat,%newcol,%currcol); |
if (grep(/^dat$/,@formats)) { |
if (grep(/^dat$/,@formats)) { |
$confhash{'scantron'}{config}{dat} = 1; |
$confhash{'scantron'}{config}{dat} = 1; |
$newdat = 1; |
$newdat = 1; |
} else { |
} else { |
$confhash{'scantron'}{config}{dat} = 0; |
|
$newdat = 0; |
$newdat = 0; |
} |
} |
if (grep(/^csv$/,@formats)) { |
if (grep(/^csv$/,@formats)) { |
Line 15157 sub modify_scantron {
|
Line 15201 sub modify_scantron {
|
if ($env{'form.scantronconfig_csv_'.$field} =~ /^(\d+)$/) { |
if ($env{'form.scantronconfig_csv_'.$field} =~ /^(\d+)$/) { |
my $posscol = $1; |
my $posscol = $1; |
if (($posscol < 20) && (!$bynum{$posscol})) { |
if (($posscol < 20) && (!$bynum{$posscol})) { |
$confhash{'scantron'}{config}{csv}{$field} = $posscol; |
$confhash{'scantron'}{config}{csv}{fields}{$field} = $posscol; |
$bynum{$posscol} = $field; |
$bynum{$posscol} = $field; |
$newcol{$field} = $posscol; |
$newcol{$field} = $posscol; |
} |
} |
} |
} |
} |
} |
|
if (keys(%newcol)) { |
|
foreach my $option (@options) { |
|
if ($env{'form.scantroncsv_'.$option}) { |
|
$confhash{'scantron'}{config}{csv}{options}{$option} = 1; |
|
} |
|
} |
|
} |
} |
} |
$currdat = 1; |
$currdat = 1; |
if (ref($domconfig{'scantron'}) eq 'HASH') { |
if (ref($domconfig{'scantron'}) eq 'HASH') { |
if (ref($domconfig{'scantron'}{'config'}) eq 'HASH') { |
if (ref($domconfig{'scantron'}{'config'}) eq 'HASH') { |
if (!$domconfig{'scantron'}{'config'}{'dat'}) { |
unless (exists($domconfig{'scantron'}{'config'}{'dat'})) { |
$currdat = 0; |
$currdat = 0; |
} |
} |
if (ref($domconfig{'scantron'}{'config'}{'csv'}) eq 'HASH') { |
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'}}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 15183 sub modify_scantron {
|
Line 15236 sub modify_scantron {
|
if ($currcol{$field} ne $newcol{$field}) { |
if ($currcol{$field} ne $newcol{$field}) { |
$changes{'config'} = 1; |
$changes{'config'} = 1; |
last; |
last; |
} |
} |
} elsif ($newcol{$field} ne '') { |
} elsif ($newcol{$field} ne '') { |
$changes{'config'} = 1; |
$changes{'config'} = 1; |
last; |
last; |
Line 15204 sub modify_scantron {
|
Line 15257 sub modify_scantron {
|
$resulttext .= '<li>'.&mt('Custom bubblesheet format file ([_1]) uploaded for use with courses in this domain.',$custom).'</li>'; |
$resulttext .= '<li>'.&mt('Custom bubblesheet format file ([_1]) uploaded for use with courses in this domain.',$custom).'</li>'; |
} |
} |
} |
} |
if ($changes{'config'}) { |
if ($changes{'config'}) { |
if (ref($confhash{'scantron'}{'config'}) eq 'HASH') { |
if (ref($confhash{'scantron'}{'config'}) eq 'HASH') { |
if ($confhash{'scantron'}{'config'}{'dat'}) { |
if ($confhash{'scantron'}{'config'}{'dat'}) { |
$resulttext .= '<li>'.&mt('Bubblesheet data upload formats includes .dat format').'</li>'; |
$resulttext .= '<li>'.&mt('Bubblesheet data upload formats includes .dat format').'</li>'; |
} |
} |
if (ref($confhash{'scantron'}{'config'}{'csv'}) eq 'HASH') { |
if (ref($confhash{'scantron'}{'config'}{'csv'}) eq 'HASH') { |
if (keys(%{$confhash{'scantron'}{'config'}{'csv'}})) { |
if (ref($confhash{'scantron'}{'config'}{'csv'}{'fields'}) eq 'HASH') { |
'<li>'.&mt('Bubblesheet data upload formats includes .csv format, with following fields/column numbers supported:').'<ul>'; |
if (keys(%{$confhash{'scantron'}{'config'}{'csv'}{'fields'}})) { |
foreach my $field (@fields) { |
$resulttext .= '<li>'.&mt('Bubblesheet data upload formats includes .csv format, with following fields/column numbers supported:').'<ul>'; |
if ($confhash{'scantron'}{'config'}{'csv'}{$field} ne '') { |
foreach my $field (@fields) { |
my $showcol = $confhash{'scantron'}{'config'}{'csv'}{$field} + 1; |
if ($confhash{'scantron'}{'config'}{'csv'}{'fields'}{$field} ne '') { |
$resulttext .= '<li>'.$titles{$field}.': '.$showcol.'</li>'; |
my $showcol = $confhash{'scantron'}{'config'}{'csv'}{'fields'}{$field} + 1; |
|
$resulttext .= '<li>'.$titles{$field}.': '.$showcol.'</li>'; |
|
} |
|
} |
|
$resulttext .= '</ul></li>'; |
|
if (ref($confhash{'scantron'}{'config'}{'csv'}{'options'}) eq 'HASH') { |
|
if (keys(%{$confhash{'scantron'}{'config'}{'csv'}{'options'}})) { |
|
$resulttext .= '<li>'.&mt('Bubblesheet data upload formats includes .csv format, with following options:').'<ul>'; |
|
foreach my $option (@options) { |
|
if ($confhash{'scantron'}{'config'}{'csv'}{'options'}{$option} ne '') { |
|
$resulttext .= '<li>'.$titles{$option}.'</li>'; |
|
} |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
} |
} |
} |
} |
$resulttext .= '</ul></li>'; |
|
} |
} |
} |
} |
} else { |
} else { |
Line 16066 sub modify_coursedefaults {
|
Line 16132 sub modify_coursedefaults {
|
$defaultshash{'coursedefaults'}{$setting}{$type} = $newdef; |
$defaultshash{'coursedefaults'}{$setting}{$type} = $newdef; |
} |
} |
if ($currdef ne $newdef) { |
if ($currdef ne $newdef) { |
my $staticdef; |
|
if ($item eq 'anonsurvey_threshold') { |
if ($item eq 'anonsurvey_threshold') { |
unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) { |
unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) { |
$changes{$item} = 1; |
$changes{$item} = 1; |
Line 16082 sub modify_coursedefaults {
|
Line 16147 sub modify_coursedefaults {
|
my $texengine; |
my $texengine; |
if ($env{'form.texengine'} =~ /^(MathJax|mimetex|tth)$/) { |
if ($env{'form.texengine'} =~ /^(MathJax|mimetex|tth)$/) { |
$texengine = $env{'form.texengine'}; |
$texengine = $env{'form.texengine'}; |
if ($defaultshash{'coursedefaults'}{'texengine'} eq '') { |
my $currdef = $domconfig{'coursedefaults'}{'texengine'}; |
unless ($texengine eq 'MathJax') { |
if ($currdef eq '') { |
|
unless ($texengine eq $Apache::lonnet::deftex) { |
$changes{'texengine'} = 1; |
$changes{'texengine'} = 1; |
} |
} |
} elsif ($defaultshash{'coursedefaults'}{'texengine'} ne $texengine) { |
} elsif ($currdef ne $texengine) { |
$changes{'texengine'} = 1; |
$changes{'texengine'} = 1; |
} |
} |
} |
} |