--- loncom/interface/lonfeedback.pm 2001/01/03 16:20:59 1.1 +++ loncom/interface/lonfeedback.pm 2001/02/05 17:38:17 1.2 @@ -9,7 +9,7 @@ # # 3/1/1 Gerd Kortemeyer) # -# 3/1 Gerd Kortemeyer +# 3/1,2/3,2/5 Gerd Kortemeyer # package Apache::lonfeedback; @@ -22,20 +22,132 @@ sub handler { $r->send_http_header; return OK if $r->header_only; + my $feedurl=$ENV{'form.postdata'}; + $feedurl=~s/^http\:\/\///; + $feedurl=~s/^$ENV{'SERVER_NAME'}//; + $feedurl=~s/^$ENV{'HTTP_HOST'}//; + + if (($feedurl=~/^\/res/) || ($ENV{'request.course.id'})) { # --------------------------------------------------- Print login screen header - $r->print(< Feedback to resource author'; + } + if ($ENV{'course.'.$ENV{'request.course.id'}.'.question.email'}) { + $options.= + '
Question about resource content'; + } + if ($ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}) { + $options.= + '
'. + 'Question/Comment/Feedback about course content'; + } + if ($ENV{'course.'.$ENV{'request.course.id'}.'.policy.email'}) { + $options.= + '
'. + 'Question/Comment/Feedback about course policy'; + } + $r->print(< The LearningOnline Network with CAPA +

Feedback

- +

$feedurl

+
+ +Please check at least one of the following: +$options
+My question/comment/feedback:

+

+ +

ENDDOCUMENT +} else { + my $symb=&Apache::lonnet::symbread($feedurl); + 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); + 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{$_}.'
'; + } + my $usersaw=&Apache::lonnet::ssi($feedurl); + $usersaw=~s/\]*\>//gi; + $usersaw=~s/\<\/body\>//gi; + $usersaw=~s/\//gi; + $usersaw=~s/\<\/html\>//gi; + $usersaw=~s/\//gi; + $usersaw=~s/\<\/head\>//gi; + $usersaw=~s/action\s*\=/would_be_action\=/gi; +# + + print (<Feedback sent + + + +Feedback sent ... +$prevattempts +
+$usersaw + + +ENDREDIR +} +} else { + print (<Feedback not sent + + + + +Sorry, no feedback possible on this resource ... + + +ENDNOREDIR +} return OK; } 1; __END__ + + +