Diff for /loncom/interface/lonfeedback.pm between versions 1.2 and 1.3

version 1.2, 2001/02/05 17:38:17 version 1.3, 2001/02/06 14:22:30
Line 9 Line 9
 #  #
 # 3/1/1 Gerd Kortemeyer)  # 3/1/1 Gerd Kortemeyer)
 #  #
 # 3/1,2/3,2/5 Gerd Kortemeyer  # 3/1,2/3,2/5,2/6 Gerd Kortemeyer
 #  #
 package Apache::lonfeedback;  package Apache::lonfeedback;
   
 use strict;  use strict;
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
   use Apache::lonmsg();
   
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
Line 41  sub handler { Line 42  sub handler {
         }          }
  if ($ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}) {   if ($ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}) {
            $options.=             $options.=
  '<br><input type=checkbox name=question> '.   '<br><input type=checkbox name=comment> '.
  'Question/Comment/Feedback about course content';   'Question/Comment/Feedback about course content';
         }          }
  if ($ENV{'course.'.$ENV{'request.course.id'}.'.policy.email'}) {   if ($ENV{'course.'.$ENV{'request.course.id'}.'.policy.email'}) {
            $options.=             $options.=
  '<br><input type=checkbox name=question> '.   '<br><input type=checkbox name=policy> '.
  'Question/Comment/Feedback about course policy';   'Question/Comment/Feedback about course policy';
         }          }
        $r->print(<<ENDDOCUMENT);         $r->print(<<ENDDOCUMENT);
Line 71  My question/comment/feedback:<p> Line 72  My question/comment/feedback:<p>
 </html>  </html>
 ENDDOCUMENT  ENDDOCUMENT
 } else {  } else {
   #
   # Get previous user input
   #
     my $symb=&Apache::lonnet::symbread($feedurl);      my $symb=&Apache::lonnet::symbread($feedurl);
     my $prevattempts='';      my $prevattempts='';
     if ($symb) {      if ($symb) {
Line 108  ENDDOCUMENT Line 112  ENDDOCUMENT
        } keys %lasthash;         } keys %lasthash;
        $prevattempts.='</tr></table>';         $prevattempts.='</tr></table>';
     }      }
   #
   # Get output from resource
   #
     my $usersaw=&Apache::lonnet::ssi($feedurl);      my $usersaw=&Apache::lonnet::ssi($feedurl);
     $usersaw=~s/\<body[^\>]*\>//gi;      $usersaw=~s/\<body[^\>]*\>//gi;
     $usersaw=~s/\<\/body\>//gi;      $usersaw=~s/\<\/body\>//gi;
Line 116  ENDDOCUMENT Line 123  ENDDOCUMENT
     $usersaw=~s/\<head\>//gi;      $usersaw=~s/\<head\>//gi;
     $usersaw=~s/\<\/head\>//gi;      $usersaw=~s/\<\/head\>//gi;
     $usersaw=~s/action\s*\=/would_be_action\=/gi;      $usersaw=~s/action\s*\=/would_be_action\=/gi;
 # <meta HTTP-EQUIV="Refresh" CONTENT="1; url=$feedurl">  #
       # Filter HTML out of message (could be nasty)
   #
       my $message=$ENV{'form.comment'};
       $message=~s/\</\&lt\;/g;
       $message=~s/\>/\&gt\;/g;
   
   #
   # Assemble email
   #
       my $email=<<"ENDEMAIL";
   Refers to <a href="$feedurl">$feedurl</a>
   <hr>
   <h2>Message</h2>
   <pre>
   $message
   </pre>
   <hr>
   <h2>Previous attempts of student (if applicable)</h2>
   $prevattempts
   <p><hr>
   <h2>Original screen output (if applicable)</h2>
   $usersaw
   ENDEMAIL
   #
   # Who gets this?
   #
       my %to=();
       if ($ENV{'form.author'}) {
    $feedurl=~/^\/res\/(\w+)\/(\w+)\//;
           $to{$2.':'.$1}=1;
       }
       if ($ENV{'form.question'}) {
    map {
               $to{$_}=1;
           } split(/\,/,
             $ENV{'course.'.$ENV{'request.course.id'}.'.question.email'});
       }
       if ($ENV{'form.comment'}) {
    map {
               $to{$_}=1;
           } split(/\,/,
             $ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'});
       }
       if ($ENV{'form.policy'}) {
    map {
               $to{$_}=1;
           } split(/\,/,
             $ENV{'course.'.$ENV{'request.course.id'}.'.policy.email'});
       }
   #
   # Actually send mail
   #
       my $status='';
       map {
          if ($_) {
             unless (
             &Apache::lonmsg::user_normal_msg(split(/\:/,$_),'Feedback '.$feedurl,
                                              $email) eq 'ok') {
               $status.='<br>Error sending message to '.$_.'<br>';
     }
          }
       } keys %to;
   #
   # Receipt screen and redirect back to where came from
   #
     print (<<ENDREDIR);      print (<<ENDREDIR);
 <head><title>Feedback sent</title>  <head>
   <title>Feedback sent</title>
   <meta HTTP-EQUIV="Refresh" CONTENT="1; url=$feedurl">
 </head>  </head>
 <html>  <html>
 <body bgcolor="#FFFFFF">  <body bgcolor="#FFFFFF">
 <b>Feedback sent ...</b>  <b>Feedback sent ...</b>
 $prevattempts  <font color=red>$status</font>
 <hr>  
 $usersaw  
 </body>  </body>
 </html>  </html>
 ENDREDIR  ENDREDIR

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


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