version 1.9, 2003/05/29 18:31:27
|
version 1.16.2.1, 2003/12/05 22:24:20
|
Line 65 my %Exportrows = ();
|
Line 65 my %Exportrows = ();
|
my $current_course; |
my $current_course; |
|
|
sub initialize { |
sub initialize { |
|
&Apache::assesscalc::initialize(); |
&initialize_sequence_cache(); |
&initialize_sequence_cache(); |
} |
} |
|
|
Line 143 sub parent_link {
|
Line 144 sub parent_link {
|
return $link; |
return $link; |
} |
} |
|
|
|
sub convenience_links { |
|
my $self = shift; |
|
my ($resource) = @_; |
|
my $symb = &Apache::lonnet::escape($resource->{'symb'}); |
|
my $result = <<"END"; |
|
<a href="/adm/grades?symb=$symb&command=submission" target="LONcatInfo"> |
|
<img src="/adm/lonMisc/subm_button.gif" border=0 /> |
|
</a> |
|
<a href="/adm/grades?symb=$symb&command=gradingmenu" target="LONcatInfo"> |
|
<img src="/adm/lonMisc/pgrd_button.gif" border=0 /> |
|
</a> |
|
<a href="/adm/parmset?symb=$symb" target="LONcatInfo"> |
|
<img src="/adm/lonMisc/pprm_button.gif" border=0 /> |
|
</a> |
|
END |
|
return $result; |
|
} |
|
|
sub outsheet_html { |
sub outsheet_html { |
my $self = shift; |
my $self = shift; |
my ($r) = @_; |
my ($r) = @_; |
|
my $importcolor = '#FFFFAA'; |
|
my $exportcolor = '#88FF88'; |
#################################### |
#################################### |
# Get the list of assessment files # |
# Get the list of assessment files # |
#################################### |
#################################### |
Line 153 sub outsheet_html {
|
Line 174 sub outsheet_html {
|
my $editing_is_allowed = &Apache::lonnet::allowed('mgr', |
my $editing_is_allowed = &Apache::lonnet::allowed('mgr', |
$ENV{'request.course.id'}); |
$ENV{'request.course.id'}); |
#################################### |
#################################### |
|
# Report any calculation errors # |
|
#################################### |
|
$r->print($self->html_report_error()); |
|
#################################### |
# Determine table structure # |
# Determine table structure # |
#################################### |
#################################### |
my $num_uneditable = 26; |
my $num_uneditable = 26; |
Line 162 sub outsheet_html {
|
Line 187 sub outsheet_html {
|
<table border="2"> |
<table border="2"> |
<tr> |
<tr> |
<th colspan="2" rowspan="2"><font size="+2">Student</font></th> |
<th colspan="2" rowspan="2"><font size="+2">Student</font></th> |
<td bgcolor="#FFDDDD" colspan="$num_uneditable"> |
<td bgcolor="$importcolor" colspan="$num_uneditable"> |
<b><font size="+1">Import</font></b></td> |
<b><font size="+1">Import</font></b></td> |
<td colspan="$num_left"> |
<td colspan="$num_left"> |
<b><font size="+1">Calculations</font></b></td> |
<b><font size="+1">Calculations</font></b></td> |
Line 171 END
|
Line 196 END
|
my $label_num = 0; |
my $label_num = 0; |
foreach (split(//,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')){ |
foreach (split(//,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')){ |
if ($label_num<$num_uneditable) { |
if ($label_num<$num_uneditable) { |
$tableheader .='<td bgcolor="#FFDDDD">'; |
$tableheader .='<td bgcolor="'.$importcolor.'">'; |
} else { |
} else { |
$tableheader .='<td>'; |
$tableheader .='<td>'; |
} |
} |
Line 190 END
|
Line 215 END
|
# Print out template row |
# Print out template row |
if (exists($ENV{'request.role.adv'}) && $ENV{'request.role.adv'}) { |
if (exists($ENV{'request.role.adv'}) && $ENV{'request.role.adv'}) { |
$r->print('<tr><td>Template</td><td> </td>'. |
$r->print('<tr><td>Template</td><td> </td>'. |
$self->html_template_row($num_uneditable)."</tr>\n"); |
$self->html_template_row($num_uneditable, |
|
$importcolor)."</tr>\n"); |
} |
} |
# |
# |
# Print out summary/export row |
# Print out summary/export row |
$r->print('<tr><td>Summary</td><td>0</td>'. |
$r->print('<tr><td>Summary</td><td>0</td>'. |
$self->html_export_row()."</tr>\n"); |
$self->html_export_row($exportcolor)."</tr>\n"); |
} |
} |
$r->print("</table>\n"); |
$r->print("</table>\n"); |
# |
# |
Line 204 END
|
Line 230 END
|
$tableheader =<<"END"; |
$tableheader =<<"END"; |
</p><p> |
</p><p> |
<table border="2"> |
<table border="2"> |
<tr><th>Row</th><th>Assessment</th> |
<tr><th>Row</th><th> </th><th>Assessment</th> |
END |
END |
} else { |
} else { |
$tableheader =<<"END"; |
$tableheader =<<"END"; |
Line 238 END
|
Line 264 END
|
my $row_output = '<tr>'; |
my $row_output = '<tr>'; |
if ($editing_is_allowed) { |
if ($editing_is_allowed) { |
$row_output .= '<td>'.$rownum.'</td>'; |
$row_output .= '<td>'.$rownum.'</td>'; |
|
$row_output .= '<td>'.$self->convenience_links($resource).'</td>'; |
$row_output .= '<td>'. |
$row_output .= '<td>'. |
'<a href="/adm/assesscalc?sname='.$self->{'name'}. |
'<a href="/adm/assesscalc?sname='.$self->{'name'}. |
'&sdomain='.$self->{'domain'}. |
'&sdomain='.$self->{'domain'}. |
Line 258 END
|
Line 285 END
|
$row_output .= |
$row_output .= |
'<td colspan="52">Unavailable at this time</td></tr>'."\n"; |
'<td colspan="52">Unavailable at this time</td></tr>'."\n"; |
} else { |
} else { |
$row_output .= $self->html_row($num_uneditable,$rownum). |
$row_output .= $self->html_row($num_uneditable,$rownum, |
|
$exportcolor,$importcolor). |
"</tr>\n"; |
"</tr>\n"; |
} |
} |
$r->print($row_output); |
$r->print($row_output); |
Line 332 sub csv_rows {
|
Line 360 sub csv_rows {
|
# |
# |
# Write a header row |
# Write a header row |
$self->csv_output_row($filehandle,undef, |
$self->csv_output_row($filehandle,undef, |
('Container','Assessment title')); |
('Sequence or Folder','Assessment title')); |
# |
# |
# Write each assessments row |
# Write each assessments row |
if (scalar(@Sequences)< 1) { |
if (scalar(@Sequences)< 1) { |
Line 387 sub outsheet_recursive_excel {
|
Line 415 sub outsheet_recursive_excel {
|
|
|
sub compute { |
sub compute { |
my $self = shift; |
my $self = shift; |
$self->logthis('computing'); |
|
if (! defined($current_course) || |
if (! defined($current_course) || |
$current_course ne $ENV{'request.course.id'}) { |
$current_course ne $ENV{'request.course.id'}) { |
$current_course = $ENV{'request.course.id'}; |
$current_course = $ENV{'request.course.id'}; |
Line 429 sub compute {
|
Line 456 sub compute {
|
$assess_filename, |
$assess_filename, |
$resource->{'symb'}); |
$resource->{'symb'}); |
my @exportdata = $assessSheet->export_data(); |
my @exportdata = $assessSheet->export_data(); |
|
if ($assessSheet->badcalc()) { |
|
$self->set_calcerror( |
|
'Error computing row for assessment '. |
|
$assessSheet->get_title().'(row '.$rownum.'):'. |
|
$assessSheet->calcerror()); |
|
} |
if ($assessSheet->blackout()) { |
if ($assessSheet->blackout()) { |
$self->blackout(1); |
$self->blackout(1); |
$self->{'blackout_rows'}->{$rownum} = 1; |
$self->{'blackout_rows'}->{$rownum} = 1; |
Line 558 sub save_export_data {
|
Line 591 sub save_export_data {
|
my $self = shift; |
my $self = shift; |
return if ($self->temporary()); |
return if ($self->temporary()); |
my $student = $self->{'name'}.':'.$self->{'domain'}; |
my $student = $self->{'name'}.':'.$self->{'domain'}; |
|
if ($self->badcalc()){ |
|
# do not save data away when calculations have not been done properly. |
|
delete($Exportrows{$student}); |
|
return; |
|
} |
return if (! exists($Exportrows{$student})); |
return if (! exists($Exportrows{$student})); |
return if (! $self->is_default()); |
return if (! $self->is_default()); |
my $key = join(':',($self->{'name'},$self->{'domain'},'studentcalc')).':'; |
my $key = join(':',($self->{'name'},$self->{'domain'},'studentcalc')).':'; |
Line 565 sub save_export_data {
|
Line 603 sub save_export_data {
|
my $newstore = join('___;___', |
my $newstore = join('___;___', |
@{$Exportrows{$student}->{'data'}}); |
@{$Exportrows{$student}->{'data'}}); |
$newstore = '___=___'.$newstore; |
$newstore = '___=___'.$newstore; |
&Apache::lonnet::put('nohist_calculatedsheets', |
my $result= &Apache::lonnet::put('nohist_calculatedsheets', |
{ $key => $newstore, |
{ $key => $newstore, |
$timekey => $Exportrows{$student}->{'time'} }, |
$timekey => $Exportrows{$student}->{'time'} }, |
$self->{'cdom'}, |
$self->{'cdom'}, |
Line 591 sub export_data {
|
Line 629 sub export_data {
|
my $self = shift; |
my $self = shift; |
my $student = $self->{'name'}.':'.$self->{'domain'}; |
my $student = $self->{'name'}.':'.$self->{'domain'}; |
if (! exists($Exportrows{$student}) || |
if (! exists($Exportrows{$student}) || |
|
! defined($Exportrows{$student}) || |
|
! exists($Exportrows{$student}->{'data'}) || |
|
! defined($Exportrows{$student}->{'data'}) || |
|
! exists($Exportrows{$student}->{'time'}) || |
|
! defined($Exportrows{$student}->{'time'}) || |
! $self->check_expiration_time($Exportrows{$student}->{'time'})) { |
! $self->check_expiration_time($Exportrows{$student}->{'time'})) { |
$self->compute(); |
$self->compute(); |
} |
} |
my @Data = @{$Exportrows{$student}->{'data'}}; |
my @Data; |
for (my $i=0; $i<=$#Data;$i++) { |
if ($self->badcalc()) { |
$Data[$i]="'".$Data[$i]."'" if ($Data[$i]=~/\D/ && defined($Data[$i])); |
@Data = (); |
|
} else { |
|
@Data = @{$Exportrows{$student}->{'data'}}; |
|
for (my $i=0; $i<=$#Data;$i++) { |
|
if ($Data[$i]=~/\D/ && defined($Data[$i])) { |
|
$Data[$i]="'".$Data[$i]."'"; |
|
} |
|
} |
} |
} |
return @Data; |
return @Data; |
} |
} |