Diff for /loncom/interface/lonfeedback.pm between versions 1.221 and 1.229

version 1.221, 2006/11/29 03:55:15 version 1.229, 2006/12/06 19:03:37
Line 44  use HTML::LCParser(); Line 44  use HTML::LCParser();
 use Apache::lonspeller();  use Apache::lonspeller();
 use Apache::longroup;  use Apache::longroup;
 use Cwd;  use Cwd;
 use lib '/home/httpd/lib/perl/';  
 use LONCAPA;  use LONCAPA;
   
 sub discussion_open {  sub discussion_open {
Line 93  sub list_discussion { Line 92  sub list_discussion {
         }          }
     }      }
   
       my ($blocked,$blocktext) = &blocking_posts('boards',1);
       if ($blocked) {
           return $blocktext;
       }
   
     my @bgcols = ("#cccccc","#eeeeee");      my @bgcols = ("#cccccc","#eeeeee");
     my $discussiononly=0;      my $discussiononly=0;
     if ($mode eq 'board') { $discussiononly=1; }      if ($mode eq 'board') { $discussiononly=1; }
Line 421  imscp_v1p1.xsd http://www.imsglobal.org/ Line 425  imscp_v1p1.xsd http://www.imsglobal.org/
 </script>  </script>
             |;              |;
     $discussion.='<form name="readchoices" method="post" action="/adm/feedback?chgreads='.$ressymb.'" ><table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">';      $discussion.='<form name="readchoices" method="post" action="/adm/feedback?chgreads='.$ressymb.'" ><table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">';
     $discussion .='<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'.              $discussion .= &action_links_bar($colspan,$ressymb,$visible,
  '<table border="0" width="100%" bgcolor="#DDDDBB"><tr>';                                               $newpostsflag,$group,
     my $escsymb=&escape($ressymb);                                               $prevread,$markondisp);
     if ($visible>2) {              my $escsymb=&escape($ressymb);
  $discussion.='<td align="left">'.  
     '<a href="/adm/feedback?cmd=threadedon&amp;symb='.$escsymb;  
  if ($newpostsflag) {  
     $discussion .= '&previous='.$prevread;  
  }  
  $discussion .= &group_args($group);  
  $discussion .='">'.&mt('Threaded View').'</a>&nbsp;&nbsp;'.  
     '<a href="/adm/feedback?cmd=threadedoff&amp;symb='.$escsymb;  
  if ($newpostsflag) {  
     $discussion .= '&previous='.$prevread;  
  }  
  $discussion .= &group_args($group);  
  $discussion .='">'.&mt('Chronological View').'</a>&nbsp;&nbsp;  
                               <a href= "/adm/feedback?cmd=sortfilter&amp;symb='.$escsymb;  
                 if ($newpostsflag) {  
                     $discussion .= '&previous='.$prevread;  
                 }  
  $discussion .= &group_args($group);  
                 $discussion .='">'.&mt('Sorting/Filtering options').'</a>&nbsp;&nbsp';  
             } else {  
                 $discussion .= '<td align="left">';  
             }  
             $discussion .='<a href= "/adm/feedback?export='.$escsymb;  
             if ($newpostsflag) {  
                 $discussion .= '&previous='.$prevread;  
             }  
     $discussion .= &group_args($group);  
             $discussion .= '">'.&mt('Export').'?</a>&nbsp;&nbsp;</td>';  
     if ($newpostsflag) {  
  if (!$markondisp) {  
     $discussion .='<td align="right"><a href="/adm/preferences?action=changediscussions';  
     $discussion .= &group_args($group);  
     $discussion .= '">'.  
                         &mt('Preferences on what is marked as NEW').  
  '</a><br /><a href="/adm/feedback?markread=1&amp;symb='.$escsymb;  
     $discussion .= &group_args($group);  
                     $discussion .= '">'.&mt('Mark NEW posts no longer new').'</a>';  
  } else {  
     $discussion .= '<td>&nbsp;</td>';  
  }  
     } else {  
  $discussion .= '<td>&nbsp;</td>';  
     }  
     $discussion .= '</tr></table></td></tr>';  
   
             my $numhidden = keys(%notshown);              my $numhidden = keys(%notshown);
             if ($numhidden > 0) {              if ($numhidden > 0) {
                 my $colspan = $maxdepth+1;                  my $colspan = $maxdepth+1;
Line 680  END Line 639  END
               </table>                </table>
              </td>               </td>
             </tr>              </tr>
            </table>  
            <br /><br /></form>  
 END  END
               $discussion .= &action_links_bar($colspan,$ressymb,$visible,
                                                $newpostsflag,$group,
                                                $prevread,$markondisp);
               $discussion .= "
              </table>
              <br /><br /></form>\n";
         }           } 
         if ($outputtarget eq 'export') {          if ($outputtarget eq 'export') {
             if ($manifestok) {              if ($manifestok) {
Line 779  END Line 742  END
     return $discussion;      return $discussion;
 }  }
   
   sub action_links_bar {
       my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_;
       my $discussion = '<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'.
                        '<table border="0" width="100%" bgcolor="#DDDDBB"><tr>';
       my $escsymb=&escape($ressymb);
       if ($visible>2) {
           $discussion .= '<td align="left">'.
                          '<a href="/adm/feedback?cmd=threadedon&amp;symb='.$escsymb;
           if ($newpostsflag) {
               $discussion .= '&previous='.$prevread;
           }
           $discussion .= &group_args($group);
           $discussion .='">'.&mt('Threaded View').'</a>&nbsp;&nbsp;'.
                         '<a href="/adm/feedback?cmd=threadedoff&amp;symb='.$escsymb;
           if ($newpostsflag) {
               $discussion .= '&previous='.$prevread;
           }
           $discussion .= &group_args($group);
           $discussion .='">'.&mt('Chronological View').'</a>&nbsp;&nbsp;
                          <a href= "/adm/feedback?cmd=sortfilter&amp;symb='.$escsymb;
           if ($newpostsflag) {
               $discussion .= '&previous='.$prevread;
           }
           $discussion .= &group_args($group);
           $discussion .='">'.&mt('Sorting/Filtering options').'</a>&nbsp;&nbsp';
       } else {
           $discussion .= '<td align="left">';
       }
       $discussion .='<a href= "/adm/feedback?export='.$escsymb;
       if ($newpostsflag) {
           $discussion .= '&previous='.$prevread;
       }
       $discussion .= &group_args($group);
       $discussion .= '">'.&mt('Export').'?</a>&nbsp;&nbsp;</td>';
       if ($newpostsflag) {
           if (!$markondisp) {
               $discussion .='<td align="right"><a href="/adm/preferences?action=changediscussions';
               $discussion .= &group_args($group);
               $discussion .= '">'.
                              &mt('Preferences on what is marked as NEW').
                              '</a><br /><a href="/adm/feedback?markread=1&amp;symb='.$escsymb;
               $discussion .= &group_args($group);
               $discussion .= '">'.&mt('Mark NEW posts no longer new').'</a>';
           } else {
               $discussion .= '<td>&nbsp;</td>';
           }
       } else {
           $discussion .= '<td>&nbsp;</td>';
       }
       $discussion .= '</tr></table></td></tr>';
       return $discussion;
   }
   
   sub blocking_posts {
       my ($type,$showstatus) = @_;
       my %setters;
       my ($blocked,$output);
       my ($startblock,$endblock) =
             &Apache::loncommon::blockcheck(\%setters,$type);
       if ($startblock && $endblock) {
           $blocked = 1;
           if ($showstatus) {
               my $showstart = &Apache::lonlocal::locallocaltime($startblock);
               my $showend = &Apache::lonlocal::locallocaltime($endblock);
               $output = &mt('Discussion postings will not be viewable for resources in this course between [_1] and [_2] because communication is being blocked.',$showstart, $showend).'<br />'.
                       &Apache::loncommon::build_block_table($startblock,$endblock,
                                                            \%setters);
           }
       }
       return ($blocked,$output);
   }
   
 sub postingform_display {  sub postingform_display {
     my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum,      my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum,
         $currnewattach,$currdelold,$group) = @_;          $currnewattach,$currdelold,$group) = @_;
Line 815  ENDDISCUSS Line 850  ENDDISCUSS
     if ($group ne '') {      if ($group ne '') {
         $postingform .='<input type="hidden" name="group" value="'.$group.'" />';          $postingform .='<input type="hidden" name="group" value="'.$group.'" />';
     }      }
       my ($blockblog) = &blocking_posts('blogs');
       if (!$blockblog) {
           $postingform .= &add_blog_checkbox();
       }
     $postingform .= "</form>\n";      $postingform .= "</form>\n";
     if ($outputtarget ne 'tex') {      if ($outputtarget ne 'tex') {
         $postingform .= &generate_attachments_button('',$attachnum,$ressymb,          $postingform .= &generate_attachments_button('',$attachnum,$ressymb,
                                                      $now,$currnewattach,                                                       $now,$currnewattach,
                                                      $currdelold,'',$mode);                                                       $currdelold,'',$mode,
                                                        $blockblog);
         if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {          if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {
             $newattachmsg = '<br /><b>'.$lt{'newa'}.'</b><br />';              $newattachmsg = '<br /><b>'.$lt{'newa'}.'</b><br />';
             if (@{$currnewattach} > 1) {              if (@{$currnewattach} > 1) {
Line 1520  END Line 1560  END
               if ($idx > 0) {                if ($idx > 0) {
                   my %subversions = ();                    my %subversions = ();
                   &get_post_versions(\%subversions,$contrib{$idx.':subject'},1,$numoldver);                    &get_post_versions(\%subversions,$contrib{$idx.':subject'},1,$numoldver);
                   $subject = &mt('Re: ')..$subversions{$numoldver};                    $subject = &mt('Re: ').$subversions{$numoldver};
               }                }
               $subject = &HTML::Entities::encode($subject,'<>&"');                $subject = &HTML::Entities::encode($subject,'<>&"');
           } else {            } else {
Line 1695  END Line 1735  END
         if (@currnewattach > 0) {          if (@currnewattach > 0) {
             $attachnum += @currnewattach;              $attachnum += @currnewattach;
         }          }
         $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver));          my ($blockblog) = &blocking_posts('blogs');
           $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver,'',$blockblog));
         if ($attachnum > 0) {          if ($attachnum > 0) {
             if (@currnewattach > 0) {              if (@currnewattach > 0) {
                 $newattachmsg .= '<br /><b>'.&mt('New attachments').'</b><br />';                  $newattachmsg .= '<br /><b>'.&mt('New attachments').'</b><br />';
Line 2531  sub screen_header { Line 2572  sub screen_header {
     &Apache::lonnet::allowed('pch',      &Apache::lonnet::allowed('pch',
      $env{'request.course.id'}.       $env{'request.course.id'}.
      ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {       ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
     $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.              my ($blocked) = &blocking_posts('boards');
  &mt('Contribution to course discussion of resource');              if (!$blocked) {
     $discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '.          $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.
  &mt('Anonymous contribution to course discussion of resource').      &mt('Contribution to course discussion of resource');
  ' <i>('.&mt('name only visible to course faculty').')</i></label> '.          $discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
  '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';      &mt('Anonymous contribution to course discussion of resource').
       ' <i>('.&mt('name only visible to course faculty').')</i></label> '.
       '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
               }
           }
           my ($blockblog) = &blocking_posts('blogs');
           if (!$blockblog) {
               $discussoptions.= &add_blog_checkbox();
         }          }
         $discussoptions.='<br /><label><input type="checkbox" name="blog" /> '.  
     &mt('Add to my public course blog').'</label>';  
     }      }
     if ($msgoptions) { $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" />'.&mt('Sending Messages').'</h2>'.$msgoptions; }      if ($msgoptions) { $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" />'.&mt('Sending Messages').'</h2>'.$msgoptions; }
     if ($discussoptions) {       if ($discussoptions) { 
Line 2664  sub decide_receiver { Line 2710  sub decide_receiver {
   my %to=();    my %to=();
   if ($env{'form.discuss'} eq 'author' ||$author) {    if ($env{'form.discuss'} eq 'author' ||$author) {
     $typestyle.='Submitting as Author Feedback<br />';      $typestyle.='Submitting as Author Feedback<br />';
     $feedurl=~/^\/res\/(\w+)\/(\w+)\//;      $feedurl=~ {^/res/($LONCAPA::domain_re)/($LONCAPA::username_re)/};
     $to{$2.':'.$1}=1;      $to{$2.':'.$1}=1;
   }    }
   if ($env{'form.discuss'} eq 'question' ||$question) {    if ($env{'form.discuss'} eq 'question' ||$question) {
Line 3036  sub process_attachments { Line 3082  sub process_attachments {
 }  }
   
 sub generate_attachments_button {  sub generate_attachments_button {
     my ($idx,$attachnum,$ressymb,$now,$currnewattach,$deloldattach,$numoldver,$mode) = @_;      my ($idx,$attachnum,$ressymb,$now,$currnewattach,$deloldattach,
           $numoldver,$mode,$blockblog) = @_;
     my $origpage = $ENV{'REQUEST_URI'};      my $origpage = $ENV{'REQUEST_URI'};
     my $att=$attachnum.' '.&mt("attachments");      my $att=$attachnum.' '.&mt("attachments");
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
Line 3048  sub generate_attachments_button { Line 3095  sub generate_attachments_button {
 $lt{'clic'}:&nbsp;<input type="button" value="$att"  $lt{'clic'}:&nbsp;<input type="button" value="$att"
 onClick="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=escape(document.mailform.comment.value);this.form.subject.value=escape(document.mailform.subject.value);  onClick="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=escape(document.mailform.comment.value);this.form.subject.value=escape(document.mailform.subject.value);
 END  END
       if (!$blockblog) {
           $response .= 'setblogvalue();';
       }
     unless ($mode eq 'board') {      unless ($mode eq 'board') {
         $response .= 'javascript:anonchk();';          $response .= 'javascript:anonchk();';
     }      }
Line 3187  sub construct_attachmenturl { Line 3237  sub construct_attachmenturl {
     return $newattachmenturl;       return $newattachmenturl; 
 }  }
   
   sub add_blog_checkbox {
       my ($checkstatus);
       if ($env{'form.blog'}) {
           $checkstatus = 'checked="checked"';
       }
       my $output = '
   <script type="text/javascript">
   function setblogvalue() {
       if (document.mailform.blog.checked) {
           document.attachment.blog.value = 1;
       } else {
           document.attachment.blog.value = 0;
       }
   }
   </script><br />
   <label><input type="checkbox" name="blog" '.$checkstatus.' /> '.
   &mt('Add to my public course blog').'</label><br />'."\n";
       return $output;
   }
   
 sub has_discussion {  sub has_discussion {
     my $resourcesref = shift;      my $resourcesref = shift;
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();

Removed from v.1.221  
changed lines
  Added in v.1.229


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