Diff for /loncom/interface/lonfeedback.pm between versions 1.79 and 1.80

version 1.79, 2004/04/28 23:59:53 version 1.80, 2004/05/05 21:04:14
Line 37  use Apache::lontexconvert(); Line 37  use Apache::lontexconvert();
 use Apache::lonlocal;  use Apache::lonlocal;
   
 sub list_discussion {  sub list_discussion {
     my ($mode,$status,$symb)=@_;      my ($mode,$status,$symb,$previous)=@_;
 #    &Apache::lonnet::logthis("status is $status");  #    &Apache::lonnet::logthis("status is $status");
     if (!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER'      if (!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER'
   || $status eq 'OPEN')) {    || $status eq 'OPEN')) {
Line 56  sub list_discussion { Line 56  sub list_discussion {
     }      }
     unless ($symb) { return ''; }      unless ($symb) { return ''; }
   
     my %dischash = &Apache::lonnet::restore($symb,'nohist_'.$ENV{'request.course.id'}.'_discuss',$ENV{'user.domain'},$ENV{'user.name'});  # backward compatibility (bulletin boards used to be 'wrapped')
     my %readids = ();      my $ressymb=$symb;
     my $showonlyunread;      if ($mode eq 'board') {
           unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) {
               $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|;
           }
       }
   
   # Get discussion display settings for this discussion
       my $lastkey = $ressymb.'_lastread';
       my $showkey = $ressymb.'_showonlyunread';
       my $visitkey = $ressymb.'_visit';
       my %dischash = &Apache::lonnet::get('nohist_'.$ENV{'request.course.id'}.'_discuss',[$lastkey,$showkey,$visitkey],$ENV{'user.domain'},$ENV{'user.name'});
       my $showonlyunread = 0;
     my $prevread = 0;      my $prevread = 0;
       my $visit = 0;
       my $newpostsflag = 0;
   
     foreach my $key (keys %dischash) {      if ($previous > 0) {
         if ($key eq 'lastread') {          $prevread = $previous;
             $prevread = $dischash{$key};      } elsif (defined($dischash{$lastkey})) {
         }          $prevread = $dischash{$lastkey};
         if ($key eq 'showonlyunread') {      }
             $showonlyunread = $dischash{$key};  
         } else {      if (defined($dischash{$showkey})) {
             if ($dischash{$key} eq 'read') {          $showonlyunread = $dischash{$showkey};
                 $readids{$key} = 1;  
             }  
         }  
     }      }
   
       if (defined($dischash{$visitkey})) {
           $visit = $dischash{$visitkey};
       }
       $visit ++;
   
     my $seeid=&Apache::lonnet::allowed('rin',$crs);      my $seeid=&Apache::lonnet::allowed('rin',$crs);
     my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs)      my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs)
  && ($symb=~/\.(problem|exam|quiz|assess|survey|form)$/));   && ($symb=~/\.(problem|exam|quiz|assess|survey|form)$/));
     my @discussionitems=();      my @discussionitems=();
     # backward compatibility (bulletin boards used to be 'wrapped')  
     my $ressymb=$symb;  
     if ($mode eq 'board') {  
  $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|;  
     }  
     my %contrib=&Apache::lonnet::restore($ressymb,$ENV{'request.course.id'},      my %contrib=&Apache::lonnet::restore($ressymb,$ENV{'request.course.id'},
   $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'});
Line 92  sub list_discussion { Line 102  sub list_discussion {
     my @index=();      my @index=();
     my @replies=();      my @replies=();
     my %alldiscussion=();      my %alldiscussion=();
       my %notshown = ();
     my $maxdepth=0;      my $maxdepth=0;
   
     my $target='';      my $target='';
Line 101  sub list_discussion { Line 112  sub list_discussion {
     }      }
           
     my $now = time;      my $now = time;
     my %discinfo = (      my %discinfo = ();
                    'lastread' => $now,      $discinfo{$visitkey} = $visit;
                    );       $discinfo{$lastkey} = $now;
     &Apache::lonnet::cstore(\%discinfo,$symb,'nohist_'.$ENV{'request.course.id'}.'_discuss',$ENV{'user.domain'},$ENV{'user.name'});  
       &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
   
     if ($contrib{'version'}) {      if ($contrib{'version'}) {
  for (my $id=1;$id<=$contrib{'version'};$id++) {   for (my $id=1;$id<=$contrib{'version'};$id++) {
     my $idx=$id;      my $idx=$id;
               my $posttime = $contrib{$idx.':timestamp'};
               if ($prevread > 0 && $prevread <= $posttime) {
                   $newpostsflag = 1;
               }
     my $hidden=($contrib{'hidden'}=~/\.$idx\./);      my $hidden=($contrib{'hidden'}=~/\.$idx\./);
     my $deleted=($contrib{'deleted'}=~/\.$idx\./);      my $deleted=($contrib{'deleted'}=~/\.$idx\./);
     my $origindex='0.';      my $origindex='0.';
Line 172  sub list_discussion { Line 188  sub list_discussion {
  if ($seeid) {   if ($seeid) {
     if ($hidden) {      if ($hidden) {
  $sender.=' <a href="/adm/feedback?unhide='.   $sender.=' <a href="/adm/feedback?unhide='.
     $ressymb.':::'.$idx.'">'.&mt('Make Visible').'</a>';      $ressymb.':::'.$idx;
                                   if ($newpostsflag) {
                                       $sender .= '&previous='.$prevread;
                                   }
                                   $sender .= '">'.&mt('Make Visible').'</a>';
     } else {      } else {
  $sender.=' <a href="/adm/feedback?hide='.   $sender.=' <a href="/adm/feedback?hide='.
     $ressymb.':::'.$idx.'">'.&mt('Hide').'</a>';      $ressymb.':::'.$idx;
                                   if ($newpostsflag) {
                                       $sender .= '&previous='.$prevread;
                                   }
                                   $sender .= '">'.&mt('Hide').'</a>';
     }                           }                     
     $sender.=' <a href="/adm/feedback?deldisc='.      $sender.=' <a href="/adm/feedback?deldisc='.
  $ressymb.':::'.$idx.'">'.&mt('Delete').'</a>';   $ressymb.':::'.$idx;
                                   if ($newpostsflag) {
                                       $sender .= '&previous='.$prevread;
                                   }
                                   $sender .= '">'.&mt('Delete').'</a>';
  }   }
     } else {      } else {
  if ($screenname) {   if ($screenname) {
Line 189  sub list_discussion { Line 217  sub list_discussion {
  $ENV{'request.course.id'}.   $ENV{'request.course.id'}.
  ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) {   ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) {
  $sender.=' <a href="/adm/feedback?replydisc='.   $sender.=' <a href="/adm/feedback?replydisc='.
     $ressymb.':::'.$idx.'" '.$target.'>'.&mt('Reply').'</a>';      $ressymb.':::'.$idx;
                           if ($newpostsflag) {
                               $sender .= '&previous='.$prevread;
                           }
                           $sender .= '" '.$target.'>'.&mt('Reply').'</a>';
     }      }
     my $vgrlink;      my $vgrlink;
                     my $ctlink;  
                     if ($readids{$idx} == 1) {  
                         $ctlink = '<b>'.&mt('Mark unread').'?</b>&nbsp;'.  
                             '<input type="checkbox" name="'.  
                             'postunread_'.$idx.'" />';  
                     } else {  
                         $ctlink = '<b>'.&mt('Mark read').'?</b>&nbsp;'.  
                             '<input type="checkbox" name="'.  
                             'postread_'.$idx.'" />';  
                     }  
     if ($viewgrades) {      if ($viewgrades) {
  $vgrlink=&Apache::loncommon::submlink('Submissions',   $vgrlink=&Apache::loncommon::submlink('Submissions',
             $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb);              $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb);
Line 213  sub list_discussion { Line 235  sub list_discussion {
     }      }
     $alldiscussion{$thisindex}=$idx;      $alldiscussion{$thisindex}=$idx;
     $index[$idx]=$thisindex;      $index[$idx]=$thisindex;
                     my $posttime = $contrib{$idx.':timestamp'};  
                     my $spansize = 2;                      my $spansize = 2;
                     $discussionitems[$idx]='<p><table border="0" width="100%"><tr>';                      if ($showonlyunread && $prevread > $posttime) {
                     if ($prevread > 0 && $prevread < $posttime) {                          $notshown{$idx} = 1;
                         $discussionitems[$idx] .= '<td align="left" bgcolor="#FFFFFF"><font color="#FF0000">NEW</font></td>';  
                         $spansize ++;  
                     }  
                     $discussionitems[$idx] .= '<td align ="left">&nbsp;&nbsp;'.  
                         '<b>'.$subject.'</b>&nbsp;&nbsp;'.  
                         $sender.'</b> '.$vgrlink.' ('.  
                         localtime($posttime).')'.  
                         '</td><td align="right">&nbsp;&nbsp;'.  
                         $ctlink.'</td></tr>';  
                     if ($showonlyunread && $readids{$idx}) {  
                         $discussionitems[$idx] .= '<tr><td colspan="'.$spansize.'" align="right"><i><font size="-1">Check "Show all posts?" or "Mark unread?", then "Save read settings" to display message</font></i></td></tr></table>';  
                     } else {                      } else {
                         $discussionitems[$idx] .= '</table><blockquote>'.$message.'</blockquote></p>';                          $discussionitems[$idx]='<p><table border="0" width="100%"><tr>';
                           if ($prevread > 0 && $prevread <= $posttime) {
                               $discussionitems[$idx] .= '<td align="left" bgcolor="#FFFFFF"><font color="#FF0000">NEW</font></td>';
                           }
                           $discussionitems[$idx] .= '<td align ="left">&nbsp;&nbsp;'.
                               '<b>'.$subject.'</b>&nbsp;&nbsp;'.
                               $sender.'</b> '.$vgrlink.' ('.
                               localtime($posttime).')</td></tr>'.
                               '</table><blockquote>'.$message.'</blockquote></p>';
                     }                      }
                 }                  }
             }              }
  }   }
     }      }
   
     my $discussion='';      my $discussion='';
     if ($visible) {      if ($visible) {
 # Print a the discusssion  # Print the discusssion
         $discussion .= '<form name="readchoices" method="post" action="/adm/feedback?chgreads='.$symb.'">';  
  $discussion.='<table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">';   $discussion.='<table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">';
  if ($visible>2) {   if ($visible>2) {
     my $colspan=$maxdepth+1;      my $colspan=$maxdepth+1;
 my $showoption = '<tr><td align="right" bgcolor="#FFFFFF" colspan="'.$colspan.'">';      $discussion.='<tr><td bgcolor="DDDDBB" colspan="'.$colspan.'">'.
             my $showflag = 'all';              '<table border="0" width="100%" bgcolor="#DDDDBB"><tr><td align="left">'.
               '<a href="/adm/feedback?threadedon='.$ressymb.'">'.&mt('Threaded View').'</a>&nbsp;&nbsp;'.
               '<a href="/adm/feedback?threadedoff='.$ressymb.'">'.&mt('Chronological View').'</a>&nbsp;&nbsp;</td>'.
               '<td align="right"><a href="/adm/feedback?';
             if ($showonlyunread) {              if ($showonlyunread) {
                 $showoption .= '<b>Show all posts?</b><input type="checkbox"                  $discussion .= 'allposts='.$ressymb;
 name="allposts" value="1"></td></tr>';                  if ($newpostsflag) {
                       $discussion .= '&previous='.$prevread;
                   }
                   $discussion .='">'.&mt('Show all posts').'?';
             } else {              } else {
                 $showoption .= '<b>Show only unread posts?</b><input type="checkbox" name="onlyunread" value="1"></td></tr>';                  $discussion .= 'onlyunread='.$ressymb;
                   if ($newpostsflag) {
                       $discussion .= '&previous='.$prevread;
                   }
                   $discussion .= '">'.&mt('Show only unread posts').'?';
             }              }
             $discussion.=$showoption;              $discussion .= '</a>&nbsp;&nbsp;</td></tr></table></td></tr>';
     $discussion.='<tr><td bgcolor="DDDDBB" colspan="'.$colspan.'">'.  
             '<table border="0" width="100%" bgcolor="#DDDDBB"><tr><td align="left">'.  
             '<a href="/adm/feedback?threadedon='.$symb.'">'.&mt('Threaded View').'</a>&nbsp;&nbsp;'.  
             '<a href="/adm/feedback?threadedoff='.$symb.'">'.&mt('Chronological View').'</a>&nbsp;&nbsp;</td>'.  
             '<td align="right"><a href="/adm/feedback?markread='.$symb.'">'.&mt('Mark all read').'</a>&nbsp;&nbsp;'.  
             '<a href="/adm/feedback?markunread='.$symb.'">'.&mt('Mark all unread').'</a>&nbsp;&nbsp;'.  
             '</td></tr></table></td></tr>';  
  }   }
           my $numhidden = keys %notshown;
           if ($numhidden > 0) {
               my $colspan = $maxdepth+1;
               $discussion.="\n".'<tr><td bgcolor="#CCCCCC" colspan="'.$colspan.'">'.
                            '<a href="/adm/feedback?allposts='.$ressymb;
               if ($newpostsflag) {
                   $discussion .= '&previous='.$prevread;
               }
               $discussion .= '">'.&mt('Show all posts').'</a> '.&mt('to display').' '.
                            $numhidden.' '.&mt('previously viewed posts').
                            '<br/></td></tr>';
           }
  foreach (sort { $a <=> $b } keys %alldiscussion) {   foreach (sort { $a <=> $b } keys %alldiscussion) {
     $discussion.="\n<tr>";              unless ($notshown{$alldiscussion{$_}} eq '1') {
     my $thisdepth=$depth[$alldiscussion{$_}];          $discussion.="\n<tr>";
     for (1..$thisdepth) {          my $thisdepth=$depth[$alldiscussion{$_}];
  $discussion.='<td>&nbsp;&nbsp;&nbsp;</td>';          for (1..$thisdepth) {
       $discussion.='<td>&nbsp;&nbsp;&nbsp;</td>';
           }
           my $colspan=$maxdepth-$thisdepth+1;
                   $discussion.='<td  bgcolor="#CCCCCC" colspan="'.$colspan.'">'.
                                $discussionitems[$alldiscussion{$_}].
                        '</td></tr>';
     }      }
     my $colspan=$maxdepth-$thisdepth+1;          }
             $discussion.='<td  bgcolor="#CCCCCC" colspan="'.$colspan.'">'.          $discussion.='</table><br /><br />';
                          $discussionitems[$alldiscussion{$_}].  
                  '</td></tr>';  
  }  
         my $colspan=$maxdepth+1;  
         $discussion.='<tr><td bgcolor="#FFFFFF" align="right" colspan="'.  
         $colspan.'"><br /><input type="hidden" name="storereads" value="0">'.            '<input type="hidden" name="discsymb" value="'.$symb.'">'.  
         '<input type="button" name="readoptions" '.  
         'value="Save read settings" onClick="this.form.storereads.value=1;this.form.submit();"></td></tr>';  
         $discussion .= '</table><br /><br /></form>';  
     }      }
     if ($discussiononly) {      if ($discussiononly) {
  $discussion.=(<<ENDDISCUSS);   $discussion.=(<<ENDDISCUSS);
Line 317  sub mail_screen { Line 346  sub mail_screen {
   if (!$title) { $title = $feedurl; }    if (!$title) { $title = $feedurl; }
   my $quote='';    my $quote='';
   my $subject = '';    my $subject = '';
     my $prevtag = '';
   if ($ENV{'form.replydisc'}) {    if ($ENV{'form.replydisc'}) {
       my ($symb,$idx)=split(/\:\:\:/,$ENV{'form.replydisc'});        my ($symb,$idx)=split(/\:\:\:/,$ENV{'form.replydisc'});
       my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},        my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},
    $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'});
       unless (($contrib{'hidden'}=~/\.$idx\./) || ($contrib{'deleted'}=~/\.$idx\./)) {         unless (($contrib{'hidden'}=~/\.$idx\./) || ($contrib{'deleted'}=~/\.$idx\./)) {
   my $message=$contrib{$idx.':message'};    my $message=$contrib{$idx.':message'};
   $message=~s/\n/\<br \/\>/g;    $message=~s/\n/\<br \/\>/g;
   $quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($message).'</blockquote>';    $quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($message).'</blockquote>';
Line 330  sub mail_screen { Line 360  sub mail_screen {
               $subject = 'Re: '.$contrib{$idx.':subject'};                $subject = 'Re: '.$contrib{$idx.':subject'};
           }            }
       }        }
         if ($ENV{'form.previous'}) {
             $prevtag = '<input type="hidden" name="previous" value="'.$ENV{'form.previous'}.'" />';
         }
   }    }
   my $latexHelp = Apache::loncommon::helpLatexCheatsheet();    my $latexHelp = Apache::loncommon::helpLatexCheatsheet();
   my $send=&mt('Send');    my $send=&mt('Send');
Line 386  $bodytag Line 419  $bodytag
 <h2><tt>$title</tt></h2>  <h2><tt>$title</tt></h2>
 <form action="/adm/feedback" method="post" name="mailform"  <form action="/adm/feedback" method="post" name="mailform"
 enctype="multipart/form-data">  enctype="multipart/form-data">
   $prevtag
 <input type="hidden" name="postdata" value="$feedurl" />  <input type="hidden" name="postdata" value="$feedurl" />
 <input type="hidden" name="replydisc" value="$ENV{'form.replydisc'}" />  <input type="hidden" name="replydisc" value="$ENV{'form.replydisc'}" />
 Please check at least one of the following feedback types:  Please check at least one of the following feedback types:
Line 428  ENDFAILREDIR Line 462  ENDFAILREDIR
 }  }
   
 sub redirect_back {  sub redirect_back {
   my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status) = @_;    my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status,$previous) = @_;
     my $prevtag = '';
     my $qrystr = '';
   if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };    if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };
     if ($previous > 0) {
         $qrystr = 'previous='.$previous;
         if ($feedurl =~ /\?register=1/) {
             $feedurl .= '&'.$qrystr;
         } else {
             $feedurl .= '?'.$qrystr;
         }
         $prevtag = '<input type="hidden" name="previous" value="'.$previous.'" />';
     }
   $r->print (<<ENDREDIR);    $r->print (<<ENDREDIR);
 <html>  <html>
 <head>  <head>
 <title>Feedback sent</title>  <title>Feedback sent</title>
 <meta http-equiv="pragma" content="no-cache" />  <meta http-equiv="pragma" content="no-cache" />
 <meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl">  <meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" />
 </head>  </head>
 <body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'>  <body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'>
 <img align="right" src="/adm/lonIcons/lonlogos.gif" />  <img align="right" src="/adm/lonIcons/lonlogos.gif" />
Line 443  $typestyle Line 488  $typestyle
 <b>Sent $sendsomething message(s), and $sendposts post(s).</b>  <b>Sent $sendsomething message(s), and $sendposts post(s).</b>
 <font color="red">$status</font>  <font color="red">$status</font>
 <form name="reldt" action="$feedurl" target="loncapaclient">  <form name="reldt" action="$feedurl" target="loncapaclient">
   $prevtag
 </form>  </form>
 </body>  </body>
 </html>  </html>
Line 754  sub handler { Line 800  sub handler {
 # --------------------------- Get query string for limited number of parameters  # --------------------------- Get query string for limited number of parameters
   
    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 #         ['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff']);           ['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff','onlyunread','allposts','previous']);
          ['hide','unhide','deldisc','postdata','preview','replydisc','threadedon','threadedoff','markread','markunread','storereads','onlyunread','allposts','chgreads']);  
   
   if (($ENV{'form.markread'}) || ($ENV{'form.markunread'})) {    if (($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'})) {
 # ----------------------------------------------------------------- Modify read/unread for all  # ----------------------------------------------------------------- Modify display setting for this discussion 
       &Apache::loncommon::content_type($r,'text/html');        &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;        $r->send_http_header;
       my $symb=$ENV{'form.markread'}?$ENV{'form.markread'}:$ENV{'form.markunread'};        my $symb=$ENV{'form.allposts'}?$ENV{'form.allposts'}:$ENV{'form.onlyunread'};
       my $ressymb = $symb;  
       my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);        my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
       $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|;        my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},
       my %contrib=&Apache::lonnet::restore($ressymb,$ENV{'request.course.id'},  
                           $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'});
       my %readinghash = ();        my %readinghash = ();
                                                                                                                                                                     
       if ($contrib{'version'}) {        if ($contrib{'version'}) {
           for (my $id=1;$id<=$contrib{'version'};$id++) {  
               my $msgid = $id.':message';  
               if (defined($contrib{$msgid})) {  
                   if ($ENV{'form.markread'}) {  
                       $readinghash{$id} = 'read';  
                   } else {  
                        $readinghash{$id} = 'unread';  
                   }  
               }  
           }  
           if ($ENV{'form.allposts'}) {            if ($ENV{'form.allposts'}) {
               $readinghash{'showonlyunread'} = 0;                $readinghash{$symb.'_showonlyunread'} = 0;
           } elsif ($ENV{'form.onlyunread'}) {            } elsif ($ENV{'form.onlyunread'}) {
               $readinghash{'showonlyunread'} = 1;                $readinghash{$symb.'_showonlyunread'} = 1;
           }            }
           &Apache::lonnet::cstore(\%readinghash,$symb,'nohist_'.$ENV{'request.course.id'}.'_discuss',$ENV{'user.domain'},$ENV{'user.name'});            &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%readinghash,$ENV{'user.domain'},$ENV{'user.name'});
       }        }
                                                                                          &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed reading status').'<br />','0','0','',$ENV{'form.previous'});
       &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed reading status'),'0','0');  
       return OK;        return OK;
   } else {  
       my $symb = $ENV{'form.discsymb'};  
       my %readinghash = ();  
       my $chgcount = 0;  
       foreach my $key (keys %ENV) {  
           if ($key =~ m/^form\.postunread_(\d+)/) {  
               $readinghash{$1} = 'unread';  
               $chgcount ++;  
           } elsif ($key =~ m/^form\.postread_(\d+)/) {  
               $readinghash{$1} = 'read';  
               $chgcount ++;  
           }  
       }  
       if ($ENV{'form.allposts'}) {  
           $readinghash{'showonlyunread'} = 0;  
           $chgcount ++;  
       } elsif ($ENV{'form.onlyunread'}) {  
           $readinghash{'showonlyunread'} = 1;  
           $chgcount ++;  
       }  
                                                                                    
       if ($chgcount > 0) {  
           &Apache::lonnet::cstore(\%readinghash,$symb,'nohist_'.$ENV{'request.course.id'}.'_discuss',$ENV{'user.domain'},$ENV{'user.name'});  
       }  
   }  
   
   if ($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');  
   } elsif (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) {    } elsif (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) {
 # ----------------------------------------------------------------- Hide/unhide  # ----------------------------------------------------------------- Hide/unhide
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
Line 852  sub handler { Line 852  sub handler {
      $ENV{'course.'.$ENV{'request.course.id'}.'.num'});       $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
   
     &redirect_back($r,&Apache::lonnet::clutter($url),      &redirect_back($r,&Apache::lonnet::clutter($url),
        &mt('Changed discussion status').'<br />','0','0');         &mt('Changed discussion status').'<br />','0','0','',$ENV{'form.previous'});
   } elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) {    } elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) {
       &Apache::loncommon::content_type($r,'text/html');        &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;        $r->send_http_header;
Line 866  sub handler { Line 866  sub handler {
       my $symb=$ENV{'form.threadedon'}?$ENV{'form.threadedon'}:$ENV{'form.threadedoff'};        my $symb=$ENV{'form.threadedon'}?$ENV{'form.threadedon'}:$ENV{'form.threadedoff'};
       my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);        my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
       &redirect_back($r,&Apache::lonnet::clutter($url),        &redirect_back($r,&Apache::lonnet::clutter($url),
      &mt('Changed discussion view mode').'<br />','0','0');       &mt('Changed discussion view mode').'<br />','0','0','',$ENV{'form.previous'});
   } elsif ($ENV{'form.deldisc'}) {    } elsif ($ENV{'form.deldisc'}) {
 # --------------------------------------------------------------- Hide for good  # --------------------------------------------------------------- Hide for good
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
Line 893  sub handler { Line 893  sub handler {
      $ENV{'course.'.$ENV{'request.course.id'}.'.num'});       $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
   
     &redirect_back($r,&Apache::lonnet::clutter($url),      &redirect_back($r,&Apache::lonnet::clutter($url),
        &mt('Changed discussion status').'<br />','0','0');         &mt('Changed discussion status').'<br />','0','0','',$ENV{'form.previous'});
   } elsif ($ENV{'form.preview'}) {    } elsif ($ENV{'form.preview'}) {
 # -------------------------------------------------------- User wants a preview  # -------------------------------------------------------- User wants a preview
       $r->content_type('text/html');        $r->content_type('text/html');
Line 1006  sub handler { Line 1006  sub handler {
   
   
 # Receipt screen and redirect back to where came from  # Receipt screen and redirect back to where came from
       &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$status);        &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$status,$ENV{'form.previous'});
   
     }      }
    } else {     } else {

Removed from v.1.79  
changed lines
  Added in v.1.80


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