Diff for /loncom/interface/loncommon.pm between versions 1.3 and 1.8

version 1.3, 2001/07/26 16:00:24 version 1.8, 2001/10/26 17:29:28
Line 8 Line 8
 package Apache::loncommon;  package Apache::loncommon;
   
 use strict;  use strict;
   use POSIX qw(strftime);
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::lonmsg();  use Apache::lonmsg();
   
Line 23  sub get_previous_attempt { Line 24  sub get_previous_attempt {
       for ($version=1;$version<=$returnhash{'version'};$version++) {        for ($version=1;$version<=$returnhash{'version'};$version++) {
         map {          map {
   $lasthash{$_}=$returnhash{$version.':'.$_};    $lasthash{$_}=$returnhash{$version.':'.$_};
         } split(/\:/,$returnhash{$version.':keys'});          } sort(split(/\:/,$returnhash{$version.':keys'}));
       }        }
       $prevattempts='<table border=2></tr><th>History</th>';        $prevattempts='<table border=2></tr><th>History</th>';
       map {        map {
         $prevattempts.='<th>'.$_.'</th>';          $prevattempts.='<th>'.$_.'</th>';
       } keys %lasthash;        } sort(keys %lasthash);
       for ($version=1;$version<=$returnhash{'version'};$version++) {        for ($version=1;$version<=$returnhash{'version'};$version++) {
         $prevattempts.='</tr><tr><th>Attempt '.$version.'</th>';          $prevattempts.='</tr><tr><th>Attempt '.$version.'</th>';
         map {          map {
   $prevattempts.='<td>'.$returnhash{$version.':'.$_}.'</td>';       my $value;
         } keys %lasthash;    if ($_ =~ /timestamp/) {
       $value=scalar(localtime($returnhash{$version.':'.$_}));
     } else {
       $value=$returnhash{$version.':'.$_};
     }
     $prevattempts.='<td>'.$value.'</td>';   
           } sort(keys %lasthash);
       }        }
       $prevattempts.='</tr><tr><th>Current</th>';        $prevattempts.='</tr><tr><th>Current</th>';
       map {        map {
         $prevattempts.='<td>'.$lasthash{$_}.'</td>';   my $value;
       } keys %lasthash;   if ($_ =~ /timestamp/) {
     $value=scalar(localtime($lasthash{$_}));
    } else {
     $value=$lasthash{$_};
    }
    $prevattempts.='<td>'.$value.'</td>';
         } sort(keys %lasthash);
       $prevattempts.='</tr></table>';        $prevattempts.='</tr></table>';
     } else {      } else {
       $prevattempts='Nothing submitted - no attempts.';        $prevattempts='Nothing submitted - no attempts.';
Line 48  sub get_previous_attempt { Line 61  sub get_previous_attempt {
   }    }
 }  }
   
   sub get_unprocessed_cgi {
     my ($query)= @_;
     map {
       my ($name, $value) = split(/=/,$_);
       $value =~ tr/+/ /;
       $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
       if (!defined($ENV{'form.'.$name})) { $ENV{'form.'.$name}=$value; }
     } (split(/&/,$query));
   }
   
   sub cacheheader {
     my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime);
     my $output .='<meta HTTP-EQUIV="Expires" CONTENT="'.$date.'" />
                   <meta HTTP-EQUIV="Cache-control" CONTENT="no-cache" />
                   <meta HTTP-EQUIV="Pragma" CONTENT="no-cache" />';
     return $output;
   }
   
 1;  1;
 __END__;  __END__;

Removed from v.1.3  
changed lines
  Added in v.1.8


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