--- loncom/interface/lonfeedback.pm 2001/02/10 14:10:13 1.8 +++ loncom/interface/lonfeedback.pm 2001/02/13 18:18:40 1.9 @@ -12,12 +12,14 @@ # 3/1,2/3,2/5,2/6,2/8 Gerd Kortemeyer # 2/9 Guy Albertelli # 2/10 Gerd Kortemeyer +# 2/13 Guy Albertelli package Apache::lonfeedback; use strict; use Apache::Constants qw(:common); use Apache::lonmsg(); +use Apache::loncommon(); sub mail_screen { my ($r,$feedurl,$options) = @_; @@ -158,52 +160,6 @@ sub screen_header { return $options; } -sub get_previous_attempt { - my ($symb)=@_; - my $prevattempts=''; - if ($symb) { - my $answer=&Apache::lonnet::reply( - "restore:".$ENV{'user.domain'}.':'.$ENV{'user.name'}.':'. - $ENV{'request.course.id'}.':'. - &Apache::lonnet::escape($symb), - $ENV{'user.home'}); - my %returnhash=(); - map { - my ($name,$value)=split(/\=/,$_); - $returnhash{&Apache::lonnet::unescape($name)}= - &Apache::lonnet::unescape($value); - } split(/\&/,$answer); - if ($returnhash{'version'}) { - my %lasthash=(); - my $version; - for ($version=1;$version<=$returnhash{'version'};$version++) { - map { - $lasthash{$_}=$returnhash{$version.':'.$_}; - } split(/\:/,$returnhash{$version.':keys'}); - } - $prevattempts=''; - map { - $prevattempts.=''; - } keys %lasthash; - for ($version=1;$version<=$returnhash{'version'};$version++) { - $prevattempts.=''; - map { - $prevattempts.=''; - } keys %lasthash; - } - $prevattempts.=''; - map { - $prevattempts.=''; - } keys %lasthash; - $prevattempts.='
History'.$_.'
Attempt '.$version.''.$returnhash{$version.':'.$_}.'
Current'.$lasthash{$_}.'
'; - } else { - $prevattempts='Nothing submitted - no attempts.'; - } - } else { - $prevattempts='No data.'; - } -} - sub resource_output { my ($feedurl) = @_; my $usersaw=&Apache::lonnet::ssi($feedurl); @@ -334,7 +290,9 @@ sub handler { } else { # Get previous user input - my $prevattempts=&get_previous_attempt($symb); + my $prevattempts=&Apache::loncommon::get_previous_attempt( + $symb,$ENV{'user.name'},$ENV{'user.domain'},$ENV{'user.home'}, + $ENV{'request.course.id'}); # Get output from resource my $usersaw=&resource_output($feedurl);