Diff for /loncom/interface/spreadsheet/assesscalc.pm between versions 1.13 and 1.18

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

Removed from v.1.13  
changed lines
  Added in v.1.18


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>