Diff for /loncom/interface/Attic/lonspreadsheet.pm between versions 1.47 and 1.54

version 1.47, 2001/03/20 20:11:27 version 1.54, 2001/04/09 17:59:04
Line 5 Line 5
 # 12/08,12/09,12/11,12/12,12/15,12/16,12/18,12/19,12/30,  # 12/08,12/09,12/11,12/12,12/15,12/16,12/18,12/19,12/30,
 # 01/01/01,02/01,03/01,19/01,20/01,22/01,  # 01/01/01,02/01,03/01,19/01,20/01,22/01,
 # 03/05,03/08,03/10,03/12,03/13,03/15,03/17,  # 03/05,03/08,03/10,03/12,03/13,03/15,03/17,
 # 03/19,03/20 Gerd Kortemeyer  # 03/19,03/20,03/21,03/27,04/05,04/09 Gerd Kortemeyer
   
 package Apache::lonspreadsheet;  package Apache::lonspreadsheet;
                           
Line 1093  sub updatestudentassesssheet { Line 1093  sub updatestudentassesssheet {
                        &GDBM_READER,0640)) {                         &GDBM_READER,0640)) {
 # --------------------------------------------------------- Get all assessments  # --------------------------------------------------------- Get all assessments
   
  my %allkeys=();   my %allkeys=('timestamp' => 
                        'Timestamp of Last Transaction<br>timestamp');
         my %allassess=();          my %allassess=();
   
           my $adduserstr='';
           if ((&getuname($safeeval) ne $ENV{'user.name'}) ||
               (&getudom($safeeval) ne $ENV{'user.domain'})) {
               $adduserstr='&uname='.&getuname($safeeval).
    '&udom='.&getudom($safeeval);
           }
   
         map {          map {
     if ($_=~/^src\_(\d+)\.(\d+)$/) {      if ($_=~/^src\_(\d+)\.(\d+)$/) {
        my $mapid=$1;         my $mapid=$1;
Line 1108  sub updatestudentassesssheet { Line 1116  sub updatestudentassesssheet {
     '___'.$resid.'___'.      '___'.$resid.'___'.
     &Apache::lonnet::declutter($srcf);      &Apache::lonnet::declutter($srcf);
  $allassess{$symb}=   $allassess{$symb}=
     '<a href="/adm/assesscalc?usymb='.$symb.'">'.$bighash{'title_'.$id}.'</a>';              '<a href="/adm/assesscalc?usymb='.$symb.$adduserstr.'">'.
                        $bighash{'title_'.$id}.'</a>';
                  if ($stype eq 'assesscalc') {                   if ($stype eq 'assesscalc') {
                    map {                     map {
                        if (($_=~/^stores\_(.*)/) || ($_=~/^parameter\_(.*)/)) {                         if (($_=~/^stores\_(.*)/) || ($_=~/^parameter\_(.*)/)) {
Line 1260  sub loadcourse { Line 1269  sub loadcourse {
 <script>  <script>
     popwin=open('','popwin','width=400,height=100');      popwin=open('','popwin','width=400,height=100');
     popwin.document.writeln('<html><body bgcolor="#FFFFFF">'+      popwin.document.writeln('<html><body bgcolor="#FFFFFF">'+
       '<h1>Spreadsheet Calculation Progress</h1>'+        '<h3>Spreadsheet Calculation Progress</h3>'+
       '<form name=popremain>'+        '<form name=popremain>'+
       '<input type=text size=35 name=remaining value=Starting></form>'+        '<input type=text size=35 name=remaining value=Starting></form>'+
       '</body></html>');        '</body></html>');
Line 1498  sub forcedrecalc { Line 1507  sub forcedrecalc {
     my ($uname,$udom,$stype,$usymb)=@_;      my ($uname,$udom,$stype,$usymb)=@_;
     my $key=$uname.':'.$udom.':'.$stype.':'.$usymb;      my $key=$uname.':'.$udom.':'.$stype.':'.$usymb;
     my $time=$oldsheets{$key.'.time'};      my $time=$oldsheets{$key.'.time'};
       if ($ENV{'form.forcerecalc'}) { return 1; }
     unless ($time) { return 1; }      unless ($time) { return 1; }
     if ($stype eq 'assesscalc') {      if ($stype eq 'assesscalc') {
         my $map=(split(/\_\_\_/,$usymb))[0];          my $map=(split(/\_\_\_/,$usymb))[0];
         if (&checkthis('::assesscalc:',$time) ||          if (&checkthis('::assesscalc:',$time) ||
             &checkthis('::assesscalc:'.$map,$time) ||              &checkthis('::assesscalc:'.$map,$time) ||
             &checkthis('::assesscalc:'.$usymb,$time) ||              &checkthis('::assesscalc:'.$usymb,$time) ||
             &checkthis($uname.':'.$udom.':assesscalc:',$time)) {              &checkthis($uname.':'.$udom.':assesscalc:',$time) ||
               &checkthis($uname.':'.$udom.':assesscalc:'.$map,$time) ||
               &checkthis($uname.':'.$udom.':assesscalc:'.$usymb,$time)) {
             return 1;              return 1;
         }           } 
     } else {      } else {
         if (&checkthis('::studentcalc:',$time) ||           if (&checkthis('::studentcalc:',$time) || 
             &checkthis($uname.':'.$udom.':studencalc:',$time)) {              &checkthis($uname.':'.$udom.':studentcalc:',$time)) {
     return 1;      return 1;
         }          }
     }      }
Line 1637  sub exportsheet { Line 1649  sub exportsheet {
  }   }
  return @exportarr;   return @exportarr;
 }  }
   # ============================================================ Expiration Dates
   #
   # Load previously cached student spreadsheets for this course
   #
   
   sub expirationdates {
       undef %expiredates;
       my $cid=$ENV{'request.course.id'};
       my $reply=&Apache::lonnet::reply('dump:'.
        $ENV{'course.'.$cid.'.domain'}.':'.
                                        $ENV{'course.'.$cid.'.num'}.
        ':nohist_expirationdates',
                                        $ENV{'course.'.$cid.'.home'});
       unless ($reply=~/^error\:/) {
    map {
               my ($name,$value)=split(/\=/,$_);
               $expiredates{&Apache::lonnet::unescape($name)}
                           =&Apache::lonnet::unescape($value);
           } split(/\&/,$reply);
       }
   }
   
 # ===================================================== Calculated sheets cache  # ===================================================== Calculated sheets cache
 #  #
Line 1778  ENDSCRIPT Line 1811  ENDSCRIPT
   
     $r->rflush();      $r->rflush();
   
   # ---------------------------------------------------------------- Full recalc?
   
   
       if ($ENV{'form.forcerecalc'}) {
    $r->print('<h4>Completely Recalculating Sheet ...</h4>');
           undef %spreadsheets;
           undef %courserdatas;
           undef %userrdatas;
           undef %defaultsheets;
           undef %updatedata;
      }
    
 # ---------------------------------------- Read new sheet or modified worksheet  # ---------------------------------------- Read new sheet or modified worksheet
   
     $r->uri=~/\/(\w+)$/;      $r->uri=~/\/(\w+)$/;
Line 1820  ENDSCRIPT Line 1865  ENDSCRIPT
     $r->print('<h1>'.      $r->print('<h1>'.
             $ENV{'course.'.$ENV{'request.course.id'}.'.description'}.'</h1>');              $ENV{'course.'.$ENV{'request.course.id'}.'.description'}.'</h1>');
   
   # ---------------------------------------------------- See if user can see this
   
       if ((&gettype($asheet) eq 'classcalc') || 
           (&getuname($asheet) ne $ENV{'user.name'}) ||
           (&getudom($asheet) ne $ENV{'user.domain'})) {
           unless (&Apache::lonnet::allowed('vgr',&getcid($asheet))) {
       $r->print(
              '<h1>Access Permission Denied</h1></form></body></html>');
               return OK;
           }
       }
   
 # ---------------------------------------------------- See if something to save  # ---------------------------------------------------- See if something to save
   
Line 1842  ENDSCRIPT Line 1898  ENDSCRIPT
   
    &tmpwrite($asheet);     &tmpwrite($asheet);
   
   # ---------------------------------------------------------- Additional options
   
       $r->print(
    '<input type=submit name=forcerecalc value="Completely Recalculate Sheet"><p>'
    );
       if (&gettype($asheet) eq 'assesscalc') {
          $r->print ('<p><font size=+2><a href="/adm/studentcalc?uname='.
                                                  &getuname($asheet).
                                                  '&udom='.&getudom($asheet).
                     '">Level up: Student Sheet</a></font><p>');
       }
       
       if ((&gettype($asheet) eq 'studentcalc') && 
           (&Apache::lonnet::allowed('vgr',&getcid($asheet)))) {
          $r->print (
                      '<p><font size=+2><a href="/adm/classcalc">'.
                      'Level up: Course Sheet</a></font><p>');
       }
       
   
 # ----------------------------------------------------------------- Save dialog  # ----------------------------------------------------------------- Save dialog
   
   
Line 1858  ENDSCRIPT Line 1934  ENDSCRIPT
   
 # --------------------------------------------------------------- Cached sheets  # --------------------------------------------------------------- Cached sheets
   
       &expirationdates();
   
     undef %oldsheets;      undef %oldsheets;
     undef %loadedcaches;      undef %loadedcaches;
   

Removed from v.1.47  
changed lines
  Added in v.1.54


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