--- loncom/interface/spreadsheet/assesscalc.pm 2003/06/12 21:17:11 1.13 +++ loncom/interface/spreadsheet/assesscalc.pm 2003/09/05 01:06:45 1.18 @@ -1,5 +1,5 @@ # -# $Id: assesscalc.pm,v 1.13 2003/06/12 21:17:11 matthew Exp $ +# $Id: assesscalc.pm,v 1.18 2003/09/05 01:06:45 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,6 +44,8 @@ assesscalc package Apache::assesscalc; use strict; +use warnings FATAL=>'all'; +no warnings 'uninitialized'; use Apache::Constants qw(:common :http); use Apache::lonnet; use Apache::loncommon; @@ -167,7 +169,6 @@ sub load_parameter_caches { # # Course Parameters Cache if (! %courseopt) { - &Apache::lonnet::logthis("loading course options"); $current_course = $ENV{'request.course.id'}; undef(%courseopt); if (! defined($current_name) || ! defined($current_domain)) { @@ -247,7 +248,7 @@ this user and course. ################################################## sub parmval { my $self = shift; - my ($what,$symb,$uname,$udom,$csec)=@_; + my ($what,$symb,$uname,$udom,$csec,$recurse)=@_; $uname = $self->{'name'} if (! defined($uname)); $udom = $self->{'domain'} if (! defined($udom)); $csec = $self->{'section'} if (! defined($csec)); @@ -312,9 +313,12 @@ sub parmval { if ($part eq '') { $part='0'; } my $newwhat=$rwhat; $newwhat=~s/\Q$space\E/$part/; - my $partgeneral=$self->parmval($newwhat,$symb,$uname,$udom,$csec); + my $partgeneral=$self->parmval($newwhat,$symb,$uname,$udom,$csec,1); if (defined($partgeneral)) { return $partgeneral; } } + if ($recurse) { return undef; } + my $pack_def=&Apache::lonnet::packages_tab_default($fn,'resource.'.$what); + if (defined($pack_def)) { return $pack_def; } #nothing defined return ''; } @@ -334,11 +338,11 @@ sub get_html_title { sub get_title { my $self = shift; my @title = (); - if (($self->{'usymb'} eq '_feedback') || - ($self->{'usymb'} eq '_evaluation') || - ($self->{'usymb'} eq '_discussion') || - ($self->{'usymb'} eq '_tutoring')) { - my $assess_title = ucfirst($self->{'usymb'}); + if (($self->{'symb'} eq '_feedback') || + ($self->{'symb'} eq '_evaluation') || + ($self->{'symb'} eq '_discussion') || + ($self->{'symb'} eq '_tutoring')) { + my $assess_title = ucfirst($self->{'symb'}); $assess_title =~ s/^_//; push(@title,$assess_title); } else { @@ -371,13 +375,15 @@ sub outsheet_html { ################################### # Determine table structure ################################### + my $importcolor = '#FFFFFF'; + my $exportcolor = '#FFFFAA'; my $num_uneditable = 1; my $num_left = 52-$num_uneditable; my $tableheader =<<"END"; - + @@ -385,7 +391,7 @@ END my $label_num = 0; foreach (split(//,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')){ if ($label_num<$num_uneditable) { - $tableheader .= ''. - $self->html_template_row($num_uneditable)."\n"); + $self->html_template_row($num_uneditable,$importcolor). + "\n"); # # Print out summary/export row $r->print(''. - $self->html_export_row()."\n"); + $self->html_export_row($exportcolor)."\n"); # # Prepare to output rows $tableheader =<<"END"; @@ -411,7 +418,7 @@ END END foreach (split(//,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')){ if ($label_num<$num_uneditable) { - $tableheader.='
Assessment   Calculations
'; + $tableheader .= ''; } else { $tableheader .= ''; } @@ -398,11 +404,12 @@ END # # Print out template row $r->print('
Template 
Export0
'; + $tableheader.=''; } else { $tableheader.=''; } @@ -424,7 +431,7 @@ END $r->print("
\n".$tableheader); } $r->print(''.$rownum.''. - $self->assess_html_row($rownum)."\n"); + $self->assess_html_row($rownum,$importcolor)."\n"); } $r->print("\n"); return; @@ -432,7 +439,7 @@ END sub assess_html_row { my $self = shift(); - my ($row) = @_; + my ($row,$importcolor) = @_; my $parameter_name = $self->{'formulas'}->{'A'.$row}; my @rowdata = $self->get_row($row); my $num_cols_output = 0; @@ -446,7 +453,7 @@ sub assess_html_row { } foreach my $cell (@rowdata) { if ($num_cols_output < 1) { - $row_html .= ''; + $row_html .= ''; $row_html .= &Apache::Spreadsheet::html_uneditable_cell($cell, '#FFDDDD'); } else { @@ -683,7 +690,7 @@ These rows are saved in the students dir ######################################################## ######################################################## sub load_cached_export_rows { - %Exportrows = undef; + undef(%Exportrows); my @tmp = &Apache::lonnet::dump('nohist_calculatedsheets_'. $ENV{'request.course.id'}, $current_domain,$current_name,undef); @@ -729,7 +736,9 @@ sub export_data { ! exists($Exportrows{$symb}) || ! defined($Exportrows{$symb}) || ! $self->check_expiration_time($Exportrows{$symb}->{'time'}) || ! exists($Exportrows{$symb}->{$self->{'filename'}}) || - ! defined($Exportrows{$symb}->{$self->{'filename'}})) { + ! defined($Exportrows{$symb}->{$self->{'filename'}}) || + ! ref($Exportrows{$symb}->{$self->{'filename'}}) + ) { $self->compute(); } my @Data = @{$Exportrows{$symb}->{$self->{'filename'}}};