[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 15 Nov 2004 22:16:59 -0000


This is a MIME encoded message

--albertel1100557019
Content-Type: text/plain

albertel		Mon Nov 15 17:16:59 2004 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - moved some $r handling in redirect_back
  
  
--albertel1100557019
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20041115171659.txt"

Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.134 loncom/interface/lonfeedback.pm:1.135
--- loncom/interface/lonfeedback.pm:1.134	Mon Nov 15 16:51:19 2004
+++ loncom/interface/lonfeedback.pm	Mon Nov 15 17:16:59 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.134 2004/11/15 21:51:19 albertel Exp $
+# $Id: lonfeedback.pm,v 1.135 2004/11/15 22:16:59 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1475,7 +1475,8 @@
 
 sub print_display_options {
     my ($r,$symb,$previous,$dispchgA,$dispchgB,$markchg,$toggchg,$feedurl) = @_;
-    &dewrapper(\$feedurl);
+    &Apache::loncommon::content_type($r,'text/html');
+    $r->send_http_header;
 
     my $function = &Apache::loncommon::get_users_function();
     my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg',
@@ -1674,7 +1675,9 @@
 sub print_sortfilter_options {
     my ($r,$symb,$previous,$feedurl) = @_;
 
-    &dewrapper(\$feedurl);
+    &Apache::loncommon::content_type($r,'text/html');
+    $r->send_http_header;
+
     my @sections = ();
     my $section_sel = '';
     my $numsections = 0;
@@ -1997,6 +2000,9 @@
   my $qrystr = '';
   my $prevtag = '';
 
+  &Apache::loncommon::content_type($r,'text/html');
+  $r->send_http_header;
+
   &dewrapper(\$feedurl);
   if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };
   if ($previous > 0) {
@@ -2396,6 +2402,8 @@
 
 sub show_preview {
     my $r=shift;
+    &Apache::loncommon::content_type($r,'text/html');
+    $r->send_http_header;
     my $message=&clear_out_html($ENV{'form.comment'});
     $message=~s/\n/\<br \/\>/g;
     $message=&Apache::lonspeller::markeduptext($message);
@@ -2752,8 +2760,6 @@
           &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',
 			  \%readinghash,$ENV{'user.domain'},$ENV{'user.name'});
       }
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       &redirect_back($r,$feedurl,&mt('Marked postings read/unread').'<br />',
 		     '0','0','',$ENV{'form.previous'},'','','',);
       return OK;
@@ -2793,16 +2799,12 @@
       return OK;
   }
   if ($ENV{'form.posterlist'}) {
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.applysort'});
       &print_showposters($r,$symb,$ENV{'form.previous'},$feedurl,
 			 $ENV{'form.sortposts'});
       return OK;
   }
   if ($ENV{'form.userpick'}) {
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       my @posters = &Apache::loncommon::get_env_multiple('form.stuinfo');
       my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.userpick'});
       my $numpicks = @posters;
@@ -2816,8 +2818,6 @@
       return OK;
   }
   if ($ENV{'form.applysort'}) {
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.applysort'});
       &redirect_back($r,$feedurl,&mt('Changed sort/filter').'<br />','0','0',
 		     '',$ENV{'form.previous'},$ENV{'form.sortposts'},
@@ -2825,8 +2825,6 @@
 		     $ENV{'form.secpick'});
       return OK;
   } elsif ($ENV{'form.sortfilter'}) {
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.sortfilter'});
       &print_sortfilter_options($r,$symb,$ENV{'form.previous'},$feedurl);
       return OK;
@@ -2889,8 +2887,6 @@
 ENDREDIR
       return OK;
   } elsif ($ENV{'form.modifydisp'}) {
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.modifydisp'});
       my ($dispchgA,$dispchgB,$markchg,$toggchg) = 
 	  split(/_/,$ENV{'form.changes'});
@@ -2901,8 +2897,6 @@
 	   $ENV{'form.allposts'}   || $ENV{'form.onlyunread'} ||
 	   $ENV{'form.onlyunmark'} || $ENV{'form.toggoff'}    ||
 	   $ENV{'form.toggon'} ) {
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       my $feedurl;
       if ( ($ENV{'form.toggoff'}) || ($ENV{'form.toggon'}) ) {
 # ------------------------ Modify setting for read/unread toggle for each post 
@@ -2964,8 +2958,6 @@
       return OK;
   } elsif ($ENV{'form.markread'}) {
 # ----------------------------------------------------- Mark new posts not NEW 
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.markread'});
       &Apache::lonnet::logthis("\n last read w symb ".$symb);
       my %discinfo;
@@ -2977,9 +2969,6 @@
       return OK;
   } elsif (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) {
 # ----------------------------------------------------------------- Hide/unhide
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
-
       my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'};
       my ($symb,$idx)=split(/\:\:\:/,$entry);
       ($symb,my $feedurl)=&get_feedurl_and_clean_symb($symb);
@@ -3017,9 +3006,8 @@
 
       &redirect_back($r,$feedurl,&mt('Changed discussion status').'<br />',
 		     '0','0','',$ENV{'form.previous'});
+      return OK;
   } elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) {
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       my $symb;
       if ($ENV{'form.threadedon'}) {
 	  $symb=$ENV{'form.threadedon'};
@@ -3033,27 +3021,25 @@
       my ($symb,$feedurl)=&get_feedurl_and_clean_symb($symb);
       &redirect_back($r,$feedurl,&mt('Changed discussion view mode').'<br />',
 		     '0','0','',$ENV{'form.previous'});
+      return OK;
   } elsif ($ENV{'form.deldisc'}) {
 # --------------------------------------------------------------- Hide for good
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
-
       my ($symb,$idx)=split(/\:\:\:/,$ENV{'form.deldisc'});
       ($symb,my $feedurl)=&get_feedurl_and_clean_symb($symb);
       my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},
                           $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
 		          $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
-    my %newhash=('deleted' => $contrib{'deleted'}.".$idx.");
-    &Apache::lonnet::store(\%newhash,$symb,$ENV{'request.course.id'},
-                          $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
-		          $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
-    &redirect_back($r,$feedurl,&mt('Changed discussion status').'<br />',
-		   '0','0','',$ENV{'form.previous'});
+      my %newhash=('deleted' => $contrib{'deleted'}.".$idx.");
+      &Apache::lonnet::store(\%newhash,$symb,$ENV{'request.course.id'},
+			   $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+			   $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+      &redirect_back($r,$feedurl,&mt('Changed discussion status').'<br />',
+		     '0','0','',$ENV{'form.previous'});
+      return OK;
   } elsif ($ENV{'form.preview'}) {
 # -------------------------------------------------------- User wants a preview
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       &show_preview($r);
+      return OK;
   } elsif ($ENV{'form.attach'}) {
 # -------------------------------------------------------- Work on attachments
       &Apache::loncommon::content_type($r,'text/html');
@@ -3079,12 +3065,12 @@
       }
       &modify_attachments($r,\@currnewattach,\@currdelold,$symb,$idx,
 			  $attachmenturls);
+      return OK;
   } elsif ($ENV{'form.chgreads'}) {
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
       my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ENV{'form.chgreads'});
       &redirect_back($r,&Apache::lonnet::clutter($url),
 		     &mt('Changed read status').'<br />','0','0');
+      return OK;
   } elsif ($ENV{'form.export'}) {
       &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;
@@ -3144,9 +3130,6 @@
 	  return OK;
       }
 # Go ahead with feedback, no ambiguous reference
-      &Apache::loncommon::content_type($r,'text/html');
-      $r->send_http_header;
-  
       unless (
 	  (
 	   ($feedurl=~m:^/res:) && ($feedurl!~m:^/res/adm:)
@@ -3156,11 +3139,15 @@
 	  ||
 	  ($ENV{'request.course.id'} && ($symb=~/^bulletin\_\_\_/))
 	  ) {
+	  &Apache::loncommon::content_type($r,'text/html');
+	  $r->send_http_header;
 # Unable to give feedback
 	  &no_redirect_back($r,$feedurl);
       }
 # --------------------------------------------------- Print login screen header
       unless ($ENV{'form.sendit'}) {
+	  &Apache::loncommon::content_type($r,'text/html');
+	  $r->send_http_header;
 	  my $options=&screen_header($feedurl);
 	  if ($options) {
 	      &mail_screen($r,$feedurl,$options);

--albertel1100557019--