Diff for /loncom/interface/lonfeedback.pm between versions 1.24 and 1.32

version 1.24, 2002/03/02 03:50:27 version 1.32, 2002/09/16 19:54:01
Line 53  use Apache::loncommon(); Line 53  use Apache::loncommon();
   
 sub mail_screen {  sub mail_screen {
   my ($r,$feedurl,$options) = @_;    my ($r,$feedurl,$options) = @_;
     my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion',
                                             '','onLoad="window.focus();"');
   $r->print(<<ENDDOCUMENT);    $r->print(<<ENDDOCUMENT);
 <html>  <html>
 <head>  <head>
Line 100  sub mail_screen { Line 102  sub mail_screen {
     }      }
 </script>  </script>
 </head>  </head>
 <body bgcolor="#FFFFFF" onLoad="window.focus();">  $bodytag
 <img align=right src=/adm/lonIcons/lonlogos.gif>  
 <h1>Feedback</h1>  
 <h2><tt>$feedurl</tt></h2>  <h2><tt>$feedurl</tt></h2>
 <form action="/adm/feedback" method=post name=mailform>  <form action="/adm/feedback" method=post name=mailform>
 <input type=hidden name=postdata value="$feedurl">  <input type=hidden name=postdata value="$feedurl">
Line 136  ENDFAILREDIR Line 136  ENDFAILREDIR
 }  }
   
 sub redirect_back {  sub redirect_back {
   my ($r,$feedurl,$typestyle,$sendsomething,$status) = @_;    my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status) = @_;
   $r->print (<<ENDREDIR);    $r->print (<<ENDREDIR);
 <head>  <head>
 <title>Feedback sent</title>  <title>Feedback sent</title>
Line 147  sub redirect_back { Line 147  sub redirect_back {
 <body bgcolor="#FFFFFF">  <body bgcolor="#FFFFFF">
 <img align=right src=/adm/lonIcons/lonlogos.gif>  <img align=right src=/adm/lonIcons/lonlogos.gif>
 $typestyle  $typestyle
 <b>Sent $sendsomething message(s).</b>  <b>Sent $sendsomething message(s), and $sendposts post(s).</b>
 <font color=red>$status</font>  <font color=red>$status</font>
 </body>  </body>
 </html>  </html>
Line 323  sub adddiscuss { Line 323  sub adddiscuss {
   
     my %contrib=('message'      => $email,      my %contrib=('message'      => $email,
                  'sendername'   => $ENV{'user.name'},                   'sendername'   => $ENV{'user.name'},
                  'senderdomain' => $ENV{'user.domain'});                   'senderdomain' => $ENV{'user.domain'},
                    'screenname'   => $ENV{'environment.screenname'},
                    'plainname'    => $ENV{'environment.firstname'}.' '.
                      $ENV{'environment.middlename'}.' '.
                                      $ENV{'environment.lastname'}.' '.
                                      $ENV{'enrironment.generation'});
     if ($anon) {      if ($anon) {
  $contrib{'anonymous'}='true';   $contrib{'anonymous'}='true';
     }      }
Line 363  sub handler { Line 368  sub handler {
   
 # --------------------------- Get query string for limited number of parameters  # --------------------------- Get query string for limited number of parameters
   
     foreach (split(/&/,$ENV{'QUERY_STRING'})) {     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
        my ($name, $value) = split(/=/,$_);                                             ['hide','unhide','postdata']);
        $value =~ tr/+/ /;  
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;  
        if (($name eq 'hide') || ($name eq 'unhide')) {  
            unless ($ENV{'form.'.$name}) {  
               $ENV{'form.'.$name}=$value;  
    }  
        }  
     }  
   
   if (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) {    if (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) {
 # ----------------------------------------------------------------- Hide/unhide  # ----------------------------------------------------------------- Hide/unhide
Line 402  sub handler { Line 399  sub handler {
                      $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},                       $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
      $ENV{'course.'.$ENV{'request.course.id'}.'.num'});       $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
   
     &redirect_back($r,'/res/'.$url,'Changed discussion status<p>','0');      &redirect_back($r,&Apache::lonnet::clutter($url),
          'Changed discussion status<p>','0','0');
         
   } else {    } else {
 # ------------------------------------------------------------- Normal feedback  # ------------------------------------------------------------- Normal feedback
   my $feedurl=$ENV{'form.postdata'};    my $feedurl=$ENV{'form.postdata'};
Line 413  sub handler { Line 409  sub handler {
   $feedurl=~s/^$ENV{'HTTP_HOST'}//;    $feedurl=~s/^$ENV{'HTTP_HOST'}//;
   
   my $symb=&Apache::lonnet::symbread($feedurl);    my $symb=&Apache::lonnet::symbread($feedurl);
     unless ($symb) {
         $symb=$ENV{'form.symb'};
         if ($symb) {
     my ($map,$id,$url)=split(/\_\_\_/,$symb);
             $feedurl=&Apache::lonnet::clutter($url);
         }
     }
   my $goahead=1;    my $goahead=1;
   if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form)$/) {    if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form)$/) {
       unless ($symb) { $goahead=0; }        unless ($symb) { $goahead=0; }
Line 429  sub handler { Line 432  sub handler {
       )         ) 
       ||         || 
       ($ENV{'request.course.id'} && ($feedurl!~m:^/adm:))        ($ENV{'request.course.id'} && ($feedurl!~m:^/adm:))
         ||
         ($ENV{'request.course.id'} && ($symb=~/^bulletin\_\_\_/))
      ) {       ) {
 # --------------------------------------------------- Print login screen header  # --------------------------------------------------- Print login screen header
     unless ($ENV{'form.sendit'}) {      unless ($ENV{'form.sendit'}) {
Line 463  sub handler { Line 468  sub handler {
   
 # Discussion? Store that.  # Discussion? Store that.
   
         my $numpost=0;
       if ($ENV{'form.discuss'}) {        if ($ENV{'form.discuss'}) {
   $typestyle.=&adddiscuss($symb,$message);    $typestyle.=&adddiscuss($symb,$message);
     $numpost++;
       }        }
   
       if ($ENV{'form.anondiscuss'}) {        if ($ENV{'form.anondiscuss'}) {
   $typestyle.=&adddiscuss($symb,$message,1);    $typestyle.=&adddiscuss($symb,$message,1);
     $numpost++;
       }        }
   
   
 # Receipt screen and redirect back to where came from  # Receipt screen and redirect back to where came from
       &redirect_back($r,$feedurl,$typestyle,$numsent,$status);        &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$status);
   
     }      }
    } else {     } else {
Line 490  sub handler { Line 498  sub handler {
   
 1;  1;
 __END__  __END__
   
   
   
   

Removed from v.1.24  
changed lines
  Added in v.1.32


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