Diff for /loncom/interface/lonfeedback.pm between versions 1.110 and 1.111

version 1.110, 2004/07/29 22:42:25 version 1.111, 2004/08/01 16:05:14
Line 65  sub discussion_visible { Line 65  sub discussion_visible {
   
 sub list_discussion {  sub list_discussion {
     my ($mode,$status,$symb)=@_;      my ($mode,$status,$symb)=@_;
   
     my $outputtarget=$ENV{'form.grade_target'};      my $outputtarget=$ENV{'form.grade_target'};
     if (not &discussion_visible($status)) { return ''; }      if (not &discussion_visible($status)) { return ''; }
     my @bgcols = ("#cccccc","#eeeeee");      my @bgcols = ("#cccccc","#eeeeee");
Line 96  sub list_discussion { Line 95  sub list_discussion {
 # Get discussion display settings for this discussion  # Get discussion display settings for this discussion
     my $lastkey = $ressymb.'_lastread';      my $lastkey = $ressymb.'_lastread';
     my $showkey = $ressymb.'_showonlyunread';      my $showkey = $ressymb.'_showonlyunread';
       my $markkey = $ressymb.'_showonlyunmark',
     my $visitkey = $ressymb.'_visit';      my $visitkey = $ressymb.'_visit';
     my $ondispkey = $ressymb.'_markondisp';      my $ondispkey = $ressymb.'_markondisp';
     my $userpickkey = $ressymb.'_userpick';      my $userpickkey = $ressymb.'_userpick';
     my %dischash = &Apache::lonnet::get('nohist_'.$ENV{'request.course.id'}.'_discuss',[$lastkey,$showkey,$visitkey,$ondispkey,$userpickkey],$ENV{'user.domain'},$ENV{'user.name'});      my $toggkey = $ressymb.'_readtoggle';
       my $readkey = $ressymb.'_read';
   
       my %dischash = &Apache::lonnet::get('nohist_'.$ENV{'request.course.id'}.'_discuss',[$lastkey,$showkey,$markkey,$visitkey,$ondispkey,$userpickkey,$toggkey,$readkey],$ENV{'user.domain'},$ENV{'user.name'});
     my %discinfo = ();      my %discinfo = ();
     my $showonlyunread = 0;      my $showonlyunread = 0;
       my $showunmark = 0; 
     my $markondisp = 0;      my $markondisp = 0;
     my $prevread = 0;      my $prevread = 0;
     my $previous = 0;      my $previous = 0;
Line 176  sub list_discussion { Line 180  sub list_discussion {
         $showonlyunread = $dischash{$showkey};          $showonlyunread = $dischash{$showkey};
     }      }
   
       if (defined($dischash{$markkey})) {
           $showunmark = $dischash{$markkey};
       }
   
     if (defined($dischash{$visitkey})) {      if (defined($dischash{$visitkey})) {
         $visit = $dischash{$visitkey};          $visit = $dischash{$visitkey};
     }      }
Line 205  sub list_discussion { Line 213  sub list_discussion {
     $ENV{'environment.remote'} eq 'off' ) {      $ENV{'environment.remote'} eq 'off' ) {
  $target='target="LONcom"';   $target='target="LONcom"';
     }      }
       
     my $now = time;      my $now = time;
     $discinfo{$visitkey} = $visit;      $discinfo{$visitkey} = $visit;
   
Line 434  sub list_discussion { Line 442  sub list_discussion {
  $vgrlink=&Apache::loncommon::submlink('Submissions',   $vgrlink=&Apache::loncommon::submlink('Submissions',
             $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb);              $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$symb);
     }      }
                       my $ctlink;
                       if ($dischash{$readkey}=~/\.$idx\./) { 
                           $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.'" />';
                       }
 #figure out at what position this needs to print  #figure out at what position this needs to print
     my $thisindex=$idx;      my $thisindex=$idx;
     if ( (($ENV{'environment.threadeddiscussion'}) && (($sortposts eq '') || ($sortposts eq 'ascdate'))) || ($sortposts eq 'thread')) {      if ( (($ENV{'environment.threadeddiscussion'}) && (($sortposts eq '') || ($sortposts eq 'ascdate'))) || ($sortposts eq 'thread')) {
Line 445  sub list_discussion { Line 459  sub list_discussion {
                     my $spansize = 2;                      my $spansize = 2;
                     if ($showonlyunread && $prevread > $posttime) {                      if ($showonlyunread && $prevread > $posttime) {
                         $notshown{$idx} = 1;                          $notshown{$idx} = 1;
                       } elsif ($showunmark && $dischash{$readkey}=~/\.$idx\./) {
                           $notshown{$idx} = 1;
                     } else {                      } else {
 # apply filters  # apply filters
                         my $uname = $contrib{$idx.':sendername'};                          my $uname = $contrib{$idx.':sendername'};
Line 508  sub list_discussion { Line 524  sub list_discussion {
                         $discussionitems[$idx] .= '<td align ="left">&nbsp;&nbsp;'.                          $discussionitems[$idx] .= '<td align ="left">&nbsp;&nbsp;'.
                             '<b>'.$subject.'</b>&nbsp;&nbsp;'.                              '<b>'.$subject.'</b>&nbsp;&nbsp;'.
                             $sender.'</b> '.$vgrlink.' ('.                              $sender.'</b> '.$vgrlink.' ('.
                             &Apache::lonlocal::locallocaltime($posttime).')</td></tr>'.                              &Apache::lonlocal::locallocaltime($posttime).')</td>';
                             '</table><blockquote>'.$message.'</blockquote></p>';                          if ($dischash{$toggkey}) {
                               $discussionitems[$idx].='<td align="right">&nbsp;&nbsp;'.
                                 $ctlink.'</td>';
                           }
                           $discussionitems[$idx].= '</tr></table><blockquote>'.$message.'</blockquote></p>';
                         if ($contrib{$idx.':history'}) {                          if ($contrib{$idx.':history'}) {
                             my @postversions = ();                              my @postversions = ();
                             $discussionitems[$idx] .= '<br />'.&mt('This post has been edited by the author.');                              $discussionitems[$idx] .= '<br />'.&mt('This post has been edited by the author.');
Line 542  sub list_discussion { Line 562  sub list_discussion {
         'cuse' => 'Current discussion settings',          'cuse' => 'Current discussion settings',
         'allposts' => 'All posts',          'allposts' => 'All posts',
         'unread' => 'New posts only',          'unread' => 'New posts only',
           'unmark' => 'Unread only',
         'ondisp' => 'Once displayed',          'ondisp' => 'Once displayed',
         'onmark' => 'Once marked read',          'onmark' => 'Once marked not NEW',
           'toggoff' => 'Off',
           'toggon' => 'On',
         'disa' => 'Posts to be displayed',          'disa' => 'Posts to be displayed',
         'npce' => 'Posts cease to be marked "NEW"',          'npce' => 'Posts cease to be marked "NEW"',
           'epcb' => 'Each post can be toggled read/unread', 
         'chgt' => 'Change',          'chgt' => 'Change',
         'disp' => 'Display',          'disp' => 'Display',
         'nolo' => 'Not new',          'nolo' => 'Not new',
           'togg' => 'Toggle read/unread',
     );      );
   
     my $currdisp = $lt{'allposts'};      my $currdisp = $lt{'allposts'};
     my $currmark = $lt{'onmark'};      my $currmark = $lt{'onmark'};
       my $currtogg = $lt{'toggoff'};
     my $dispchange = $lt{'unread'};      my $dispchange = $lt{'unread'};
     my $markchange = $lt{'ondisp'};      my $markchange = $lt{'ondisp'};
       my $toggchange = $lt{'toggon'};
     my $chglink = '/adm/feedback?modifydisp='.$ressymb;      my $chglink = '/adm/feedback?modifydisp='.$ressymb;
     my $displink = 'onlyunread';      my $displinkA = 'onlyunread';
       my $displinkB = 'onlyunmark';
     my $marklink = 'markondisp';      my $marklink = 'markondisp';
       my $togglink = 'toggon';
   
     if ($markondisp) {      if ($markondisp) {
         $currmark = $lt{'ondisp'};          $currmark = $lt{'ondisp'};
Line 568  sub list_discussion { Line 597  sub list_discussion {
     if ($showonlyunread) {      if ($showonlyunread) {
         $currdisp = $lt{'unread'};          $currdisp = $lt{'unread'};
         $dispchange = $lt{'allposts'};          $dispchange = $lt{'allposts'};
         $displink = 'allposts';          $displinkA = 'allposts';
     }      }
   
       if ($showunmark) {
           $currdisp = $lt{'unmark'};
           $dispchange = $lt{'unmark'};
           $displinkA='allposts';
           $displinkB='onlyunread';
           $showonlyunread = 0;
       }
   
       if ($dischash{$toggkey}) {
           $currtogg = $lt{'toggon'};
           $toggchange = $lt{'toggoff'};
           $togglink = 'toggoff';
       } 
         
     $chglink .= '&changes='.$displink.'_'.$marklink;      $chglink .= '&changes='.$displinkA.'_'.$displinkB.'_'.$marklink.'_'.$togglink;
   
     if ($newpostsflag) {      if ($newpostsflag) {
         $chglink .= '&previous='.$prevread;          $chglink .= '&previous='.$prevread;
Line 595  sub list_discussion { Line 638  sub list_discussion {
    }     }
 </script>  </script>
             |;              |;
     $discussion.='<table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">';      $discussion.='<form name="readchoices" method="post" action="/adm/feedback?chgreads='.$symb.'"><table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">';
     $discussion .='<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'.      $discussion .='<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'.
  '<table border="0" width="100%" bgcolor="#DDDDBB"><tr>';   '<table border="0" width="100%" bgcolor="#DDDDBB"><tr>';
     if ($visible>2) {      if ($visible>2) {
Line 625  sub list_discussion { Line 668  sub list_discussion {
             $discussion .= '">'.&mt('Export').'?</a>&nbsp;&nbsp;</td>';              $discussion .= '">'.&mt('Export').'?</a>&nbsp;&nbsp;</td>';
     if ($newpostsflag) {      if ($newpostsflag) {
  if (!$markondisp) {   if (!$markondisp) {
     $discussion .='<td align="right"><a href="/adm/feedback?markread='.$ressymb.'">'.&mt('Mark new posts as read').'</a>&nbsp;&nbsp;';      $discussion .='<td align="right"><a href="/adm/feedback?markread='.$ressymb.'">'.&mt('Mark NEW posts no longer new').'</a>&nbsp;&nbsp;';
  } else {   } else {
     $discussion .= '<td>&nbsp;</td>';      $discussion .= '<td>&nbsp;</td>';
  }   }
Line 649  sub list_discussion { Line 692  sub list_discussion {
                 $discussion .= '&previous='.$prevread;                  $discussion .= '&previous='.$prevread;
             }              }
             $discussion .= '">'.&mt('Show all posts').'</a> '.&mt('to display').' '.              $discussion .= '">'.&mt('Show all posts').'</a> '.&mt('to display').' '.
                          $numhidden.' '.&mt('previously viewed posts').                           $numhidden.' ';
                          '<br/></td></tr>';              if ($showunmark) {
                   $discussion .= &mt('posts previously marked read');
               } else {
                   $discussion .= &mt('previously viewed posts');
               }
               $discussion .= '<br/></td></tr>';
         }          }
   
 # Choose sort mechanism  # Choose sort mechanism
Line 723  sub list_discussion { Line 771  sub list_discussion {
         }          }
  if ($outputtarget ne 'tex') {   if ($outputtarget ne 'tex') {
             my $colspan=$maxdepth+1;              my $colspan=$maxdepth+1;
             $discussion .= <<END;               $discussion .= <<END;
             <tr bgcolor="#FFFFFF">              <tr bgcolor="#FFFFFF">
              <td colspan="$colspan" valign="top">               <td colspan="$colspan" valign="top">
               <table border="0" bgcolor="#FFFFFF" width="100%" cellspacing="2" cellpadding="2">                <table border="0" bgcolor="#FFFFFF" width="100%" cellspacing="2" cellpadding="2">
Line 734  sub list_discussion { Line 782  sub list_discussion {
                    <td>                     <td>
                     <font size="-1"><b>$lt{'cuse'}</b>:</td>                      <font size="-1"><b>$lt{'cuse'}</b>:</td>
                    <td>&nbsp;</td>                     <td>&nbsp;</td>
                      <td><font size="-1">
 END  END
             if ($newpostsflag) {              if ($newpostsflag) {
                 $discussion .=                   $discussion .= 
                    '<td><font size="-1">1.&nbsp;'.$lt{'disp'}.'&nbsp;-&nbsp;<i>'.$currdisp.'</i>&nbsp;&nbsp;2.&nbsp;'.$lt{'nolo'}.'&nbsp;-&nbsp;<i>'.$currmark.'</i></font></td>';                     '1.&nbsp;'.$lt{'disp'}.'&nbsp;-&nbsp;<i>'.$currdisp.'</i>&nbsp;&nbsp;2.&nbsp;'.$lt{'nolo'}.'&nbsp;-&nbsp;<i>'.$currmark.'</i>';
                   if ($dischash{$toggkey}) {
                      $discussion .= '&nbsp;&nbsp;3.&nbsp;'.$lt{'togg'}.'&nbsp;-&nbsp;<i>'.$currtogg.'</i>';
                   }
             } else {              } else {
                 $discussion .=                  if ($dischash{$toggkey}) {
                    '<td><font size="-1">'.$lt{'disp'}.'&nbsp;-&nbsp;<i>'.$currdisp.'</i></font></td>';                     $discussion .= '1.&nbsp;'.$lt{'disp'}.'&nbsp;-&nbsp;<i>'.$currdisp.'</i>&nbsp;2.&nbsp;'.$lt{'togg'}.'&nbsp;-&nbsp;<i>'.$currtogg.'</i>';
                   } else {
                       $discussion .=
                            $lt{'disp'}.'&nbsp;-&nbsp;<i>'.$currdisp.'</i>';
                   }
             }              }
             $discussion .= <<END;              $discussion .= <<END;
                      </font></td>
                    <td>&nbsp;</td>                     <td>&nbsp;</td>
                    <td>                     <td>
                     <font size="-1"><b><a href="$chglink">$lt{'chgt'}</a>?</font></b></td>                      <font size="-1"><b><a href="$chglink">$lt{'chgt'}</a>?</font></b>
                      </td>
                   </tr>                    </tr>
                  </table>                   </table>
                 </td>                  </td>
   END
               if ($dischash{$toggkey}) {
                   my $storebutton = &mt('Store read/unread changes');
                   $discussion.='<td align="right">'.
                 '<input type="hidden" name="discsymb" value="'.$ressymb.'">'."\n".
                 '<input type="button" name="readoptions" value="'.$storebutton.'"'.
                 ' onClick="this.form.submit();">'."\n".
                 '</td>';
               }
               $discussion .= (<<END);
                </tr>                 </tr>
               </table>                </table>
              </td>               </td>
             </tr>              </tr>
            </table>             </table>
            <br /><br />             <br /><br /></form>
 END  END
  }   }
     }      }
Line 1137  END Line 1205  END
 }  }
   
 sub print_display_options {  sub print_display_options {
     my ($r,$symb,$previous,$dispchg,$markchg,$feedurl) = @_;      my ($r,$symb,$previous,$dispchgA,$dispchgB,$markchg,$toggchg,$feedurl) = @_;
  # backward compatibility (bulletin boards used to be 'wrapped')   # backward compatibility (bulletin boards used to be 'wrapped')
     if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) {      if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) {
         $feedurl=~s|^/adm/wrapper||;          $feedurl=~s|^/adm/wrapper||;
Line 1157  sub print_display_options { Line 1225  sub print_display_options {
         'deff' => 'Default for all discussions',          'deff' => 'Default for all discussions',
         'prca' => 'Preferences can be set for this discussion that determine ....',          'prca' => 'Preferences can be set for this discussion that determine ....',
         'whpo' => 'Which posts are displayed when you display this bulletin board or resource, and',          'whpo' => 'Which posts are displayed when you display this bulletin board or resource, and',
         'unwh' => 'Under what circumstances posts are identfied as "New."',          'unwh' => 'Under what circumstances posts are identified as "NEW", and',
           'wipa' => 'Whether individual posts can be marked as read/unread',
         'allposts' => 'All posts',          'allposts' => 'All posts',
         'unread' => 'New posts only',          'unread' => 'New posts only',
           'unmark' => 'Posts not marked read',
         'ondisp' => 'Once displayed',          'ondisp' => 'Once displayed',
         'onmark' => 'Once marked as read',          'onmark' => 'Once marked not NEW ',
           'toggon' => 'Shown',
           'toggoff' => 'Not shown',
         'disa' => 'Posts displayed?',          'disa' => 'Posts displayed?',
         'npmr' => 'New posts cease to be identified as "New"?',          'npmr' => 'New posts cease to be identified as "NEW"?',
           'dotm' => 'Option to mark each post as read/unread?',  
         'chgt' => 'Change to ',          'chgt' => 'Change to ',
         'mkdf' => 'Set to ',          'mkdf' => 'Set to ',
         'yhni' => 'You have not indicated that you wish to change either of the discussion settings',          'yhni' => 'You have not indicated that you wish to change any of the discussion settings',
         'ywbr' => 'You will be returned to the previous page if you click OK.'          'ywbr' => 'You will be returned to the previous page if you click OK.'
     );      );
   
     my $dispchange = $lt{'unread'};      my $dispchangeA = $lt{'unread'};
       my $dispchangeB = $lt{'unmark'};
     my $markchange = $lt{'ondisp'};      my $markchange = $lt{'ondisp'};
       my $toggchange = $lt{'toggon'};
     my $currdisp = $lt{'allposts'};      my $currdisp = $lt{'allposts'};
     my $currmark = $lt{'onmark'};      my $currmark = $lt{'onmark'};
     my $discdisp = 'allposts';      my $discdisp = 'allposts';
     my $discmark = 'onmark';      my $discmark = 'onmark';
       my $currtogg = $lt{'toggoff'};
       my $disctogg = 'toggoff';
                                                                                                                                                                               
     if ($dispchg eq 'allposts') {      if ($dispchgA eq 'allposts') {
         $dispchange = $lt{'allposts'};          $dispchangeA = $lt{'allposts'};
         $currdisp = $lt{'unread'};          $currdisp = $lt{'unread'};
         $discdisp = 'unread';          $discdisp = 'unread';
     }      }
                                                                                         
     if ($markchg eq 'markonread') {      if ($markchg eq 'markonread') {
         $markchange = $lt{'onmark'};          $markchange = $lt{'onmark'};
         $currmark = $lt{'ondisp'};          $currmark = $lt{'ondisp'};
         $discmark = 'ondisp';          $discmark = 'ondisp';
     }      }
   
       if ($dispchgB eq 'onlyunread') {
           $dispchangeB = $lt{'unread'};
           $currdisp = $lt{'unmark'};
           $discdisp = 'unmark';
       }
       if ($toggchg eq 'toggoff') {
           $toggchange = $lt{'toggoff'};
           $currtogg = $lt{'toggon'};
           $disctogg = 'toggon';
       }
     $r->print(<<END);      $r->print(<<END);
 <html>  <html>
 <head>  <head>
 <title>$lt{'dido'}</title>  <title>$lt{'dido'}</title>
 <meta http-equiv="pragma" content="no-cache" />  <meta http-equiv="pragma" content="no-cache" />
 <script>  <script>
   function discdispChk(caller) {
       var disctogg = '$toggchg'
       if (caller == 0) {
           if (document.modifydisp.discdisp[0].checked == true) {
               if (document.modifydisp.discdisp[1].checked == true) {
                   document.modifydisp.discdisp[1].checked = false
               }
           }
       }
       if (caller == 1) {
           if (document.modifydisp.discdisp[1].checked == true) {
               if (document.modifydisp.discdisp[0].checked == true) {
                   document.modifydisp.discdisp[0].checked = false
               }
               if (disctogg == 'toggon') {
                   document.modifydisp.disctogg.checked = true
               }
               if (disctogg == 'toggoff') {
                   document.modifydisp.disctogg.checked = false
               }
           }
       }
       if (caller == 2) {
           var dispchgB = '$dispchgB'
           if (disctogg == 'toggoff') {
               if (document.modifydisp.disctogg.checked == true) {
                   if (dispchgB == 'onlyunmark') {
                       document.modifydisp.discdisp[1].checked = false
                   }
               }
           }
       }  
   }
   
 function setDisp() {  function setDisp() {
     var prev = "$previous"      var prev = "$previous"
     var chktotal = 0      var chktotal = 0
     if (document.modifydisp.discdisp.checked == true) {      if (document.modifydisp.discdisp[0].checked == true) {
         document.modifydisp.$dispchg.value = "$symb"          document.modifydisp.$dispchgA.value = "$symb"
           chktotal ++
       }
       if (document.modifydisp.discdisp[1].checked == true) {
           document.modifydisp.$dispchgB.value = "$symb"
         chktotal ++          chktotal ++
     }      }
     if (document.modifydisp.discmark.checked == true) {      if (document.modifydisp.discmark.checked == true) {
         document.modifydisp.$markchg.value = "$symb"          document.modifydisp.$markchg.value = "$symb"
         chktotal ++          chktotal ++
     }      }
       if (document.modifydisp.disctogg.checked == true) {
           document.modifydisp.$toggchg.value = "$symb"
           chktotal ++
       }
     if (chktotal > 0) {       if (chktotal > 0) { 
         document.modifydisp.submit()          document.modifydisp.submit()
     } else {      } else {
Line 1221  function setDisp() { Line 1351  function setDisp() {
 </head>  </head>
 $bodytag  $bodytag
 <form name="modifydisp" method="post" action="/adm/feedback">  <form name="modifydisp" method="post" action="/adm/feedback">
 $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li></ol>  $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li><li>$lt{'wipa'}</li></ol>
 <br />  <br />
 <table border="0" cellpadding="0" cellspacing="0">  <table border="0" cellpadding="0" cellspacing="0">
  <tr>   <tr>
Line 1238  $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$l Line 1368  $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$l
        <tr bgcolor="#dddddd">         <tr bgcolor="#dddddd">
        <td>$lt{'disa'}</td>         <td>$lt{'disa'}</td>
        <td>$lt{$discdisp}</td>         <td>$lt{$discdisp}</td>
        <td><input type="checkbox" name="discdisp" />&nbsp;$lt{'chgt'} "$dispchange"</td>         <td><input type="checkbox" name="discdisp" onClick="discdispChk('0')" />&nbsp;$lt{'chgt'} "$dispchangeA"
              <br />
              <input type="checkbox" name="discdisp" onClick="discdispChk('1')" />&nbsp;$lt{'chgt'} "$dispchangeB"
          </td>
       </tr><tr bgcolor="#eeeeee">        </tr><tr bgcolor="#eeeeee">
        <td>$lt{'npmr'}</td>         <td>$lt{'npmr'}</td>
        <td>$lt{$discmark}</td>         <td>$lt{$discmark}</td>
        <td><input type="checkbox" name="discmark" />$lt{'chgt'} "$markchange"</td>         <td><input type="checkbox" name="discmark" />$lt{'chgt'} "$markchange"</td>
         </tr><tr bgcolor="#dddddd">
          <td>$lt{'dotm'}</td>
          <td>$lt{$disctogg}</td>
          <td><input type="checkbox" name="disctogg" onClick="discdispChk('2')" />$lt{'chgt'} "$toggchange"</td>
       </tr>        </tr>
      </table>       </table>
     </td>      </td>
Line 1254  $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$l Line 1391  $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$l
 <br />  <br />
 <br />  <br />
 <input type="hidden" name="previous" value="$previous" />  <input type="hidden" name="previous" value="$previous" />
 <input type="hidden" name="$dispchg" value=""/>  <input type="hidden" name="$dispchgA" value=""/>
   <input type="hidden" name="$dispchgB" value=""/>
 <input type="hidden" name="$markchg" value=""/>  <input type="hidden" name="$markchg" value=""/>
   <input type="hidden" name="$toggchg" value="" />
 <input type="button" name="sub" value="Store Changes" onClick="javascript:setDisp()" />  <input type="button" name="sub" value="Store Changes" onClick="javascript:setDisp()" />
 <br />  <br />
 <br />  <br />
Line 2258  sub handler { Line 2397  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','editdisc','threadedon','threadedoff','onlyunread','allposts','previous','markread','markonread','markondisp','modifydisp','changes','navmaps','navurl','sortfilter','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions']);           ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','threadedon','threadedoff','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navmaps','navurl','sortfilter','sortposts','applysort','rolefilter','statusfilter','sectionpick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions']);
     if ($ENV{'form.discsymb'}) {
         my $symb = $ENV{'form.discsymb'};
         my $readkey = $symb.'_read';
         my %readinghash = ();
         my $chgcount = 0;
         %readinghash = &Apache::lonnet::get('nohist_'.$ENV{'request.course.id'}.'_discuss',[$readkey],$ENV{'user.domain'},$ENV{'user.name'});
         foreach my $key (keys %ENV) {
             if ($key =~ m/^form\.postunread_(\d+)/) {
                 if ($readinghash{$readkey} =~ /\.$1\./) {
                     $readinghash{$readkey} =~ s/\.$1\.//;
                     $chgcount ++;
                 }
             } elsif ($key =~ m/^form\.postread_(\d+)/) {
                 unless ($readinghash{$readkey} =~ /\.$1\./) {
                     $readinghash{$readkey} .= '.'.$1.'.';
                     $chgcount ++;
                 }
             }
         }
         if ($chgcount > 0) {
             &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;
         my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
         my $previous=$ENV{'form.previous'};
         my $feedurl = &Apache::lonnet::clutter($url);
         &redirect_back($r,$feedurl,&mt('Marked postings read/unread').'<br />','0','0','',$previous,'','','',);
         return OK;
     }
   if ($ENV{'form.allversions'}) {    if ($ENV{'form.allversions'}) {
       &Apache::loncommon::content_type($r,'text/html');        &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;        $r->send_http_header;
Line 2479  ENDREDIR Line 2648  ENDREDIR
       my $symb=$ENV{'form.modifydisp'};        my $symb=$ENV{'form.modifydisp'};
       my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);        my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
       my $previous=$ENV{'form.previous'};        my $previous=$ENV{'form.previous'};
       my ($dispchg,$markchg) = split/_/,$ENV{'form.changes'};        my ($dispchgA,$dispchgB,$markchg,$toggchg) = split/_/,$ENV{'form.changes'};
       my $feedurl = &Apache::lonnet::clutter($url);        my $feedurl = &Apache::lonnet::clutter($url);
  # backward compatibility (bulletin boards used to be 'wrapped')     # backward compatibility (bulletin boards used to be 'wrapped')  
       if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) {        if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) {
           $feedurl=~s|^/adm/wrapper||;            $feedurl=~s|^/adm/wrapper||;
       }        }
       &print_display_options($r,$symb,$previous,$dispchg,$markchg,$feedurl);        &print_display_options($r,$symb,$previous,$dispchgA,$dispchgB,$markchg,$toggchg,$feedurl);
       return OK;        return OK;
   } elsif (($ENV{'form.markondisp'}) || ($ENV{'form.markonread'}) || ($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'}) ) {    } elsif (($ENV{'form.markondisp'}) || ($ENV{'form.markonread'}) || ($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'}) || $ENV{'form.onlyunmark'} || $ENV{'form.toggoff'} || $ENV{'form.toggon'} ) {
       &Apache::loncommon::content_type($r,'text/html');        &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;        $r->send_http_header;
       my $previous=$ENV{'form.previous'};        my $previous=$ENV{'form.previous'};
       my ($map,$ind,$url);        my ($map,$ind,$url);
         if ( ($ENV{'form.toggoff'}) || ($ENV{'form.toggon'}) ) {
   # ------------------------------ Modify setting for read/unread toggle for each post 
             my $symb=$ENV{'form.toggoff'}?$ENV{'form.toggoff'}:$ENV{'form.toggon'};
             my $ressymb = $symb;
             ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
             unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) {
                 $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|;
             }
             my %discinfo = ();
             my $toggkey = $ressymb.'_readtoggle';
             if ($ENV{'form.toggon'}) {
                 $discinfo{$toggkey} = 1;
             } elsif ($ENV{'form.toggoff'}) {
                 $discinfo{$toggkey} = 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.markondisp'}) || ($ENV{'form.markonread'})) {
 # ---------------------- Modify setting for identification of 'NEW' posts in this discussion  # ---------------------- Modify setting for identification of 'NEW' posts in this discussion
           my $symb=$ENV{'form.markondisp'}?$ENV{'form.markondisp'}:$ENV{'form.markonread'};            my $symb=$ENV{'form.markondisp'}?$ENV{'form.markondisp'}:$ENV{'form.markonread'};
Line 2514  ENDREDIR Line 2700  ENDREDIR
           }            }
           &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'});            &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
       }        }
       if (($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'})) {        if (($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'}) || ($ENV{'form.onlyunmark'}) ) {
 # ----------------------------------------------------------------- Modify display setting for this discussion   # ----------------------------------------------------------------- Modify display setting for this discussion 
           my $symb=$ENV{'form.allposts'}?$ENV{'form.allposts'}:$ENV{'form.onlyunread'};            my $symb;
             if ($ENV{'form.allposts'}) {
                 $symb = $ENV{'form.allposts'};
             } elsif ($ENV{'form.onlyunread'}) {
                 $symb = $ENV{'form.onlyunread'};
             } else {
                 $symb = $ENV{'form.onlyunmark'};
             }
           my $ressymb = $symb;            my $ressymb = $symb;
           ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);            ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
           unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) {            unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) {
Line 2525  ENDREDIR Line 2718  ENDREDIR
           my %discinfo = ();            my %discinfo = ();
           if ($ENV{'form.allposts'}) {            if ($ENV{'form.allposts'}) {
               $discinfo{$ressymb.'_showonlyunread'} = 0;                $discinfo{$ressymb.'_showonlyunread'} = 0;
                 $discinfo{$ressymb.'_showonlyunmark'} = 0;
           } elsif ($ENV{'form.onlyunread'}) {            } elsif ($ENV{'form.onlyunread'}) {
               $discinfo{$ressymb.'_showonlyunread'} = 1;                $discinfo{$ressymb.'_showonlyunread'} = 1;
             } else {
                 $discinfo{$ressymb.'_showonlyunmark'} = 1;
           }            }
           &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'});            &Apache::lonnet::put('nohist_'.$ENV{'request.course.id'}.'_discuss',\%discinfo,$ENV{'user.domain'},$ENV{'user.name'});
       }        }
       if (($ENV{'form.markonread'}) || ($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'}) ) {        if (($ENV{'form.markonread'}) || ($ENV{'form.allposts'}) || ($ENV{'form.onlyunread'}) || ($ENV{'form.onlyunmark'}) ||($ENV{'form.toggoff'}) || ($ENV{'form.toggon'}) ) {
           &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'<br />','0','0','',$previous);            &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'<br />','0','0','',$previous);
       } else {        } else {
           &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'<br />','0','0');            &redirect_back($r,&Apache::lonnet::clutter($url),&mt('Changed display status').'<br />','0','0');
       }        }
       return OK;        return OK;
   } elsif ($ENV{'form.markread'}) {    } elsif ($ENV{'form.markread'}) {
 # ----------------------------------------------------------------- Mark new posts as read  # ----------------------------------------------------------------- Mark new posts not NEW 
       &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'};        my $symb=$ENV{'form.markread'};
Line 2668  ENDREDIR Line 2864  ENDREDIR
           $attachmenturls = $contrib{$idx.':attachmenturl'};            $attachmenturls = $contrib{$idx.':attachmenturl'};
       }        }
       &modify_attachments($r,\@currnewattach,\@currdelold,$symb,$idx,$attachmenturls);        &modify_attachments($r,\@currnewattach,\@currdelold,$symb,$idx,$attachmenturls);
     } 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');
   } else {    } else {
 # ------------------------------------------------------------- Normal feedback  # ------------------------------------------------------------- Normal feedback
   my $feedurl=$ENV{'form.postdata'};    my $feedurl=$ENV{'form.postdata'};

Removed from v.1.110  
changed lines
  Added in v.1.111


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