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

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


This is a MIME encoded message

--albertel1100558932
Content-Type: text/plain

albertel		Mon Nov 15 17:48:52 2004 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - some more consolidations
  
  
--albertel1100558932
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20041115174852.txt"

Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.136 loncom/interface/lonfeedback.pm:1.137
--- loncom/interface/lonfeedback.pm:1.136	Mon Nov 15 17:17:51 2004
+++ loncom/interface/lonfeedback.pm	Mon Nov 15 17:48:51 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.136 2004/11/15 22:17:51 albertel Exp $
+# $Id: lonfeedback.pm,v 1.137 2004/11/15 22:48:51 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -360,17 +360,17 @@
 		'<table border="0" width="100%" bgcolor="#DDDDBB"><tr>';
 	    if ($visible>2) {
 		$discussion.='<td align="left">'.
-		    '<a href="/adm/feedback?threadedon='.$ressymb;
+		    '<a href="/adm/feedback?cmd=threadedon&amp;symb='.$ressymb;
 		if ($newpostsflag) {
 		    $discussion .= '&previous='.$prevread;
 		}
 		$discussion .='">'.&mt('Threaded View').'</a>&nbsp;&nbsp;'.
-		    '<a href="/adm/feedback?threadedoff='.$ressymb;
+		    '<a href="/adm/feedback?cmd=threadedoff&amp;symb='.$ressymb;
 		if ($newpostsflag) {
 		    $discussion .= '&previous='.$prevread;
 		}
 		$discussion .='">'.&mt('Chronological View').'</a>&nbsp;&nbsp;
-                              <a href= "/adm/feedback?sortfilter='.$ressymb;
+                              <a href= "/adm/feedback?cmd=sortfilter&amp;symb='.$ressymb;
                 if ($newpostsflag) {
                     $discussion .= '&previous='.$prevread;
                 }
@@ -385,7 +385,7 @@
             $discussion .= '">'.&mt('Export').'?</a>&nbsp;&nbsp;</td>';
 	    if ($newpostsflag) {
 		if (!$markondisp) {
-		    $discussion .='<td align="right"><a href="/adm/feedback?markread='.$ressymb.'">'.&mt('Mark NEW posts no longer new').'</a>&nbsp;&nbsp;';
+		    $discussion .='<td align="right"><a href="/adm/feedback?markread=1&amp;symb='.$ressymb.'">'.&mt('Mark NEW posts no longer new').'</a>&nbsp;&nbsp;';
 		} else {
 		    $discussion .= '<td>&nbsp;</td>';
 		}
@@ -1657,6 +1657,7 @@
 </table>
 <br />
 <br />
+<input type="hidden" name="symb" value="$symb" />
 <input type="hidden" name="previous" value="$previous" />
 <input type="hidden" name="$dispchgA" value=""/>
 <input type="hidden" name="$dispchgB" value=""/>
@@ -2737,7 +2738,7 @@
 # --------------------------- Get query string for limited number of parameters
 
   &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-         ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','threadedon','threadedoff','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortfilter','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export']);
+         ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export']);
   if ($ENV{'form.discsymb'}) {
       my ($symb,$feedurl) = &get_feedurl_and_clean_symb($ENV{'form.discsymb'});
       my $readkey = $symb.'_read';
@@ -2824,8 +2825,8 @@
 		     $ENV{'form.rolefilter'},$ENV{'form.statusfilter'},
 		     $ENV{'form.secpick'});
       return OK;
-  } elsif ($ENV{'form.sortfilter'}) {
-      my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.sortfilter'});
+  } elsif ($ENV{'form.cmd'} eq 'sortfilter') {
+      my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.symb'});
       &print_sortfilter_options($r,$symb,$ENV{'form.previous'},$feedurl);
       return OK;
   } elsif ($ENV{'form.navtime'}) {
@@ -2896,77 +2897,39 @@
   } elsif ($ENV{'form.markondisp'} || $ENV{'form.markonread'} ||
 	   $ENV{'form.allposts'}   || $ENV{'form.onlyunread'} ||
 	   $ENV{'form.onlyunmark'} || $ENV{'form.toggoff'}    ||
-	   $ENV{'form.toggon'} ) {
-      my $feedurl;
-      if ( ($ENV{'form.toggoff'}) || ($ENV{'form.toggon'}) ) {
+	   $ENV{'form.toggon'}     || $ENV{'form.markread'}) {
+      my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.symb'});
+      my %discinfo;
 # ------------------------ Modify setting for read/unread toggle for each post 
-          my $symb=$ENV{'form.toggoff'}?$ENV{'form.toggoff'}:$ENV{'form.toggon'};
-	  ($symb,$feedurl)=&get_feedurl_and_clean_symb($symb);
-          my %discinfo;
-          $discinfo{$symb.'_readtoggle'}=1;
-          if ($ENV{'form.toggoff'}) { $discinfo{$symb.'_readtoggle'}=0; }
-          &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',
-			     \%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
-      }
-      if (($ENV{'form.markondisp'}) || ($ENV{'form.markonread'})) {
+      if ($ENV{'form.toggoff'}) { $discinfo{$symb.'_readtoggle'}=1; }
+      if ($ENV{'form.toggon'})  { $discinfo{$symb.'_readtoggle'}=0;  }
 # --------- Modify setting for identification of 'NEW' posts in this discussion
-          my $symb=$ENV{'form.markondisp'}?$ENV{'form.markondisp'}:$ENV{'form.markonread'};
-	  ($symb,$feedurl)=&get_feedurl_and_clean_symb($symb);
-          my %discinfo;
-          my $lastkey = $symb.'_lastread';
-          my $ondispkey = $symb.'_markondisp';
-          if ($ENV{'form.markondisp'}) {
-              $discinfo{$lastkey} = time;
-              $discinfo{$ondispkey} = 1;
-          } elsif ($ENV{'form.markonread'}) {
-              if ( $ENV{'form.previous'} > 0 ) {
-                  $discinfo{$lastkey} = $ENV{'form.previous'};
-              }
-              $discinfo{$ondispkey} = 0;
-          }
-          &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',
-			     \%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
+      if ($ENV{'form.markondisp'}) {
+	  $discinfo{$symb.'_lastread'} = time;
+	  $discinfo{$symb.'_markondisp'} = 1;
+      }
+      if ($ENV{'form.markonread'}) {
+	  if ( $ENV{'form.previous'} > 0 ) {
+	      $discinfo{$symb.'_lastread'} = $ENV{'form.previous'};
+	  }
+	  $discinfo{$symb.'_markondisp'} = 0;
       }
-      if ($ENV{'form.allposts'} || $ENV{'form.onlyunread'} ||
-	  $ENV{'form.onlyunmark'}) {
 # --------------------------------- Modify display setting for this discussion 
-          my $symb;
-          if ($ENV{'form.allposts'}) {
-              $symb = $ENV{'form.allposts'};
-          } elsif ($ENV{'form.onlyunread'}) {
-              $symb = $ENV{'form.onlyunread'};
-          } else {
-              $symb = $ENV{'form.onlyunmark'};
-          }
-	  ($symb,$feedurl)=&get_feedurl_and_clean_symb($symb);
-          my %discinfo;
-          if ($ENV{'form.allposts'}) {
-              $discinfo{$symb.'_showonlyunread'} = 0;
-              $discinfo{$symb.'_showonlyunmark'} = 0;
-          } elsif ($ENV{'form.onlyunread'}) {
-              $discinfo{$symb.'_showonlyunread'} = 1;
-          } else {
-              $discinfo{$symb.'_showonlyunmark'} = 1;
-          }
-          &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',
-			     \%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
+      if ($ENV{'form.allposts'}) {
+	  $discinfo{$symb.'_showonlyunread'} = 0;
+	  $discinfo{$symb.'_showonlyunmark'} = 0;
       }
+      if ($ENV{'form.onlyunread'}) { $discinfo{$symb.'_showonlyunread'} = 1;  }
+      if ($ENV{'form.onlyunmark'}) { $discinfo{$symb.'_showonlyunmark'} = 1;  }
+# ----------------------------------------------------- Mark new posts not NEW 
+      if ($ENV{'form.markread'})   { $discinfo{$symb.'_lastread'} = time; }
+      &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',
+			   \%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
       my $previous=$ENV{'form.previous'};
       if ($ENV{'form.markondisp'}) { $previous=undef; }
       &redirect_back($r,$feedurl,&mt('Changed display status').'<br />',
 		     '0','0','',$previous);
       return OK;
-  } elsif ($ENV{'form.markread'}) {
-# ----------------------------------------------------- Mark new posts not NEW 
-      my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.markread'});
-      &Apache::lonnet::logthis("\n last read w symb ".$symb);
-      my %discinfo;
-      $discinfo{$symb.'_lastread'} = time;
-      &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',
-			   \%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
-      &redirect_back($r,$feedurl,&mt('Changed reading status').'<br />',
-		     '0','0');
-      return OK;
   } elsif (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) {
 # ----------------------------------------------------------------- Hide/unhide
       my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'};
@@ -3007,18 +2970,15 @@
       &redirect_back($r,$feedurl,&mt('Changed discussion status').'<br />',
 		     '0','0','',$ENV{'form.previous'});
       return OK;
-  } elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) {
-      my $symb;
-      if ($ENV{'form.threadedon'}) {
-	  $symb=$ENV{'form.threadedon'};
+  } elsif ($ENV{'form.cmd'}=~/^(threadedoff|threadedon)$/) {
+      my ($symb,$feedurl)=&get_feedurl_and_clean_symb($ENV{'form.symb'});
+      if ($ENV{'form.cmd'} eq 'threadedon') {
 	  &Apache::lonnet::put('environment',{'threadeddiscussion' => 'on'});
 	  &Apache::lonnet::appenv('environment.threadeddiscussion' => 'on');
       } else {
-	  $symb=$ENV{'form.threadedoff'};
  	  &Apache::lonnet::del('environment',['threadeddiscussion']);
 	  &Apache::lonnet::delenv('environment\.threadeddiscussion');
       }
-      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;

--albertel1100558932--