version 1.59, 2008/06/30 15:56:23
|
version 1.60, 2008/07/06 22:14:46
|
Line 1847 sub defaults_titles {
|
Line 1847 sub defaults_titles {
|
sub print_scantronformat { |
sub print_scantronformat { |
my ($r,$dom,$confname,$settings,$rowtotal) = @_; |
my ($r,$dom,$confname,$settings,$rowtotal) = @_; |
my $itemcount = 1; |
my $itemcount = 1; |
my ($datatable,$css_class,$scantronurl,$is_custom,%error,%scantronurls); |
my ($datatable,$css_class,$scantronurl,$is_custom,%error,%scantronurls, |
|
%confhash); |
my $switchserver = &check_switchserver($dom,$confname); |
my $switchserver = &check_switchserver($dom,$confname); |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
default => 'Default scantron format file error', |
default => 'Default scantron format file error', |
Line 1874 sub print_scantronformat {
|
Line 1875 sub print_scantronformat {
|
); |
); |
my %md5chk; |
my %md5chk; |
foreach my $type (keys(%legacyfile)) { |
foreach my $type (keys(%legacyfile)) { |
$md5chk{$type} = split(/ /,`md5sum $legacyfile{$type}`); |
($md5chk{$type}) = split(/ /,`md5sum $legacyfile{$type}`); |
chop($md5chk{$type}); |
chomp($md5chk{$type}); |
} |
} |
if ($md5chk{'default'} ne $md5chk{'custom'}) { |
if ($md5chk{'default'} ne $md5chk{'custom'}) { |
foreach my $type (keys(%legacyfile)) { |
foreach my $type (keys(%legacyfile)) { |
($scantronurls{$type},$error{$type}) = |
($scantronurls{$type},my $error) = |
&legacy_scantronformat($r,$dom,$confname, |
&legacy_scantronformat($r,$dom,$confname, |
$type,$legacyfile{$type}, |
$type,$legacyfile{$type}, |
$scantronurls{$type}, |
$scantronurls{$type}, |
$scantronfiles{$type}); |
$scantronfiles{$type}); |
|
if ($error ne '') { |
|
$error{$type} = $error; |
|
} |
|
} |
|
if (keys(%error) == 0) { |
|
$is_custom = 1; |
|
$confhash{'scantron'}{'scantronformat'} = |
|
$scantronurls{'custom'}; |
|
my $putresult = |
|
&Apache::lonnet::put_dom('configuration', |
|
\%confhash,$dom); |
|
if ($putresult ne 'ok') { |
|
$error{'custom'} = |
|
'<span class="LC_error">'. |
|
&mt('An error occurred updating the domain configuration: [_1]',$putresult).'</span>'; |
|
} |
} |
} |
} else { |
} else { |
($scantronurls{'default'},$error{'default'}) = |
($scantronurls{'default'},my $error) = |
&legacy_scantronformat($r,$dom,$confname, |
&legacy_scantronformat($r,$dom,$confname, |
'default',$legacyfile{'default'}, |
'default',$legacyfile{'default'}, |
$scantronurls{'default'}, |
$scantronurls{'default'}, |
$scantronfiles{'default'}); |
$scantronfiles{'default'}); |
|
if ($error eq '') { |
|
$confhash{'scantron'}{'scantronformat'} = ''; |
|
my $putresult = |
|
&Apache::lonnet::put_dom('configuration', |
|
\%confhash,$dom); |
|
if ($putresult ne 'ok') { |
|
$error{'default'} = |
|
'<span class="LC_error">'. |
|
&mt('An error occurred updating the domain configuration: [_1]',$putresult).'</span>'; |
|
} |
|
} else { |
|
$error{'default'} = $error; |
|
} |
} |
} |
} |
} |
} |
} |
Line 1911 sub print_scantronformat {
|
Line 1941 sub print_scantronformat {
|
$scantronurl = $scantronurls{'default'}; |
$scantronurl = $scantronurls{'default'}; |
} |
} |
} else { |
} else { |
$scantronurl = $scantronurls{'default'}; |
if ($is_custom) { |
|
$scantronurl = $scantronurls{'custom'}; |
|
} else { |
|
$scantronurl = $scantronurls{'default'}; |
|
} |
} |
} |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr'.$css_class.'>'; |
$datatable .= '<tr'.$css_class.'>'; |
Line 1923 sub print_scantronformat {
|
Line 1957 sub print_scantronformat {
|
} else { |
} else { |
$datatable = &mt('File unavailable for display'); |
$datatable = &mt('File unavailable for display'); |
} |
} |
$datatable .= '</td><td valign="bottom">'.&mt('Upload:').'<br />'; |
$datatable .= '</td>'; |
|
if (keys(%error) == 0) { |
|
$datatable .= '<td valign="bottom">'; |
|
if (!$switchserver) { |
|
$datatable .= &mt('Upload:').'<br />'; |
|
} |
|
} else { |
|
my $errorstr; |
|
foreach my $key (sort(keys(%error))) { |
|
$errorstr .= $lt{$key}.': '.$error{$key}.'<br />'; |
|
} |
|
$datatable .= '<td>'.$errorstr; |
|
} |
} else { |
} else { |
if (keys(%error) > 0) { |
if (keys(%error) > 0) { |
my $errorstr; |
my $errorstr; |
foreach my $key (sort(keys(%error))) { |
foreach my $key (sort(keys(%error))) { |
$errorstr .= $lt{$key}.': '.$error{$key}.'<br />'; |
$errorstr .= $lt{$key}.': '.$error{$key}.'<br />'; |
} |
} |
$datatable .= '<td>'.$errorstr.'</td><td>'; |
$datatable .= '<td>'.$errorstr.'</td><td> '; |
} elsif ($scantronurl) { |
} elsif ($scantronurl) { |
$datatable .= '<td><a href="'.$scantronurl.'" target="_blank">' .&mt('Custom scantron format file').'</a>' |
$datatable .= '<td><a href="'.$scantronurl.'" target="_blank">' .&mt('Custom scantron format file').'</a>' |
.'<span class="LC_nobreak"><label>' |
.'<span class="LC_nobreak"><label>' |
Line 1990 sub print_coursecategories {
|
Line 2036 sub print_coursecategories {
|
); |
); |
my %level = &Apache::lonlocal::texthash ( |
my %level = &Apache::lonlocal::texthash ( |
dom => 'Set in "Modify Course" (Domain)', |
dom => 'Set in "Modify Course" (Domain)', |
crs => 'Set in "Parameters" (Course)', |
crs => 'Set in "Modify Parameters" (Course)', |
); |
); |
$datatable = '<tr class="LC_odd_row">'. |
$datatable = '<tr class="LC_odd_row">'. |
'<td>'.$title{'togglecats'}.'</td>'. |
'<td>'.$title{'togglecats'}.'</td>'. |