--- loncom/interface/loncommon.pm 2001/07/30 22:24:34 1.4 +++ loncom/interface/loncommon.pm 2001/10/31 17:44:42 1.9 @@ -8,6 +8,7 @@ package Apache::loncommon; use strict; +use POSIX qw(strftime); use Apache::Constants qw(:common); use Apache::lonmsg(); @@ -32,12 +33,24 @@ sub get_previous_attempt { for ($version=1;$version<=$returnhash{'version'};$version++) { $prevattempts.='Attempt '.$version.''; map { - $prevattempts.=''.$returnhash{$version.':'.$_}.''; + my $value; + if ($_ =~ /timestamp/) { + $value=scalar(localtime($returnhash{$version.':'.$_})); + } else { + $value=$returnhash{$version.':'.$_}; + } + $prevattempts.=''.$value.''; } sort(keys %lasthash); } $prevattempts.='Current'; map { - $prevattempts.=''.$lasthash{$_}.''; + my $value; + if ($_ =~ /timestamp/) { + $value=scalar(localtime($lasthash{$_})); + } else { + $value=$lasthash{$_}; + } + $prevattempts.=''.$value.''; } sort(keys %lasthash); $prevattempts.=''; } else { @@ -48,5 +61,30 @@ 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 .=' + + '; + return $output; +} + +sub no_cache { + my ($r) = @_; + my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime); + $r->no_cache(1); + $r->header_out("Pragma" => "no-cache"); + $r->header_out("Expires" => $date); +} 1; __END__;