Diff for /loncom/interface/lonfeedback.pm between versions 1.273.4.12 and 1.274

version 1.273.4.12, 2010/11/20 01:33:04 version 1.274, 2009/05/28 19:38:33
Line 48  use LONCAPA; Line 48  use LONCAPA;
   
 sub discussion_open {  sub discussion_open {
     my ($status,$symb)=@_;      my ($status,$symb)=@_;
 # Advanced roles can always discuss  
     if ($env{'request.role.adv'}) { return 1; }      if ($env{'request.role.adv'}) { return 1; }
 # Get discussion closing date  
     my $close=&Apache::lonnet::EXT('resource.0.discussend',$symb);  
 # If it is defined and in the future, the instructor wants this discussion to be open  
     if (defined($close) && $close ne '' && $close > time) {  
         return 1;  
     }  
 # It was not explicitly open, check if the problem is available.  
 # If the problem is not available, close the discussion  
     if (defined($status) &&      if (defined($status) &&
  !($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER'   !($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER'
   || $status eq 'OPEN')) {    || $status eq 'OPEN')) {
  return 0;   return 0;
     }      }
 # The problem is available, but check if the instructor explictly closed discussion      my $close=&Apache::lonnet::EXT('resource.0.discussend',$symb);
     if (defined($close) && $close ne '' && $close < time) {      if (defined($close) && $close ne '' && $close < time) {
  return 0;   return 0;
     }      }
Line 100  sub list_discussion { Line 91  sub list_discussion {
     if (not &discussion_visible($status)) {      if (not &discussion_visible($status)) {
         if ($mode ne 'board') {          if ($mode ne 'board') {
             &Apache::lonenc::check_encrypt(\$ressymb);               &Apache::lonenc::check_encrypt(\$ressymb); 
             return '<br />'.&send_message_link($ressymb);              return '<br /><div class="LC_feedback_link">'.&send_message_link($ressymb)."</div>";
         }          }
     }      }
     if ($group ne '' && $mode eq 'board') {      if ($group ne '' && $mode eq 'board') {
Line 114  sub list_discussion { Line 105  sub list_discussion {
     if ($blocked) {      if ($blocked) {
         &Apache::lonenc::check_encrypt(\$ressymb);          &Apache::lonenc::check_encrypt(\$ressymb);
         if ($mode ne 'board') {          if ($mode ne 'board') {
             $blocktext.='<br />'.&send_message_link($ressymb);              $blocktext.='<br /><div class="LC_feedback_link">'.&send_message_link($ressymb).'</div>';
         }          }
         return $blocktext;           return $blocktext; 
     }      }
Line 178  sub list_discussion { Line 169  sub list_discussion {
   
     my $cdom = $env{'course.'.$cid.'.domain'};      my $cdom = $env{'course.'.$cid.'.domain'};
     my $cnum = $env{'course.'.$cid.'.num'};      my $cnum = $env{'course.'.$cid.'.num'};
     my $crstype = &Apache::loncommon::course_type();  
   
   
 # Get information about students and non-students in course for filtering display of posts  # Get information about students and non-students in course for filtering display of posts
     my %roleshash = ();      my %roleshash = ();
Line 363  sub list_discussion { Line 352  sub list_discussion {
         $togglink = 'toggoff';          $togglink = 'toggoff';
     }       } 
         
     $chglink .= '&amp;changes='.$displinkA.'_'.$displinkB.'_'.$marklink.'_'.$togglink;      $chglink .= '&changes='.$displinkA.'_'.$displinkB.'_'.$marklink.'_'.$togglink;
   
     if ($newpostsflag) {      if ($newpostsflag) {
         $chglink .= '&amp;previous='.$prevread;          $chglink .= '&previous='.$prevread;
     }      }
     $chglink.=&group_args($group);      $chglink.=&group_args($group);
   
Line 409  sub list_discussion { Line 398  sub list_discussion {
             my $manifestfilename = $tempexport.$manifest;              my $manifestfilename = $tempexport.$manifest;
             if ($manifestfile = Apache::File->new('>'.$manifestfilename)) {              if ($manifestfile = Apache::File->new('>'.$manifestfilename)) {
                 $manifestok=1;                  $manifestok=1;
                 print $manifestfile qq|<?xml version="1.0" encoding="UTF-8"?>                  print $manifestfile qq|
   <?xml version="1.0" encoding="UTF-8"?>
 <manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2  <manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
 identifier="MANIFEST-$ressymb" xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1   identifier="MANIFEST-$ressymb" xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1 
Line 429  imscp_v1p1.xsd http://www.imsglobal.org/ Line 418  imscp_v1p1.xsd http://www.imsglobal.org/
        var symbparm = symb+':::'+idx         var symbparm = symb+':::'+idx
        var prevparm = ""         var prevparm = ""
        if (newflag == 1) {         if (newflag == 1) {
            prevparm = "&amp;previous="+previous             prevparm = "&previous="+previous
        }         }
        if (caller == 'studentdelete') {         if (caller == 'studentdelete') {
            if (confirm("$lt{'aysu'}\\n$lt{'dpwn'},\\n$lt{'bwco'}")) {             if (confirm("$lt{'aysu'}\\n$lt{'dpwn'},\\n$lt{'bwco'}")) {
Line 457  imscp_v1p1.xsd http://www.imsglobal.org/ Line 446  imscp_v1p1.xsd http://www.imsglobal.org/
                 $discussion.="\n".'<tr><td bgcolor="#CCCCCC" colspan="'.$colspan.'">'.                  $discussion.="\n".'<tr><td bgcolor="#CCCCCC" colspan="'.$colspan.'">'.
                          '<a href="/adm/feedback?allposts=1&amp;symb='.$escsymb;                           '<a href="/adm/feedback?allposts=1&amp;symb='.$escsymb;
                 if ($newpostsflag) {                  if ($newpostsflag) {
                     $discussion .= '&amp;previous='.$prevread;                      $discussion .= '&previous='.$prevread;
                 }                  }
  $discussion .= &group_args($group);   $discussion .= &group_args($group);
                 $discussion .= '">'.&mt('Show all posts').'</a> '.&mt('to display').' '.                  $discussion .= '">'.&mt('Show all posts').'</a> '.&mt('to display').' '.
Line 537  imscp_v1p1.xsd http://www.imsglobal.org/ Line 526  imscp_v1p1.xsd http://www.imsglobal.org/
                         print $manifestfile "\n".                           print $manifestfile "\n". 
       '<item identifier="ITEM-'.$ressymb.'-'.$alldiscussion{$post}.'" isvisible="'.        '<item identifier="ITEM-'.$ressymb.'-'.$alldiscussion{$post}.'" isvisible="'.
         $imsitems{$alldiscussion{$post}}{'isvisible'}.'" identifieref="RES-'.$ressymb.'-'.$alldiscussion{$post}.'">'.          $imsitems{$alldiscussion{$post}}{'isvisible'}.'" identifieref="RES-'.$ressymb.'-'.$alldiscussion{$post}.'">'.
         '<title>'.$imsitems{$alldiscussion{$post}}{'title'}.'</title></item>';          '<title>'.$imsitems{$alldiscussion{$post}}{'title'}.'</title>';
                         $imsresources .= "\n".                          $imsresources .= "\n".
     '<resource identifier="RES-'.$ressymb.'-'.$alldiscussion{$post}.'" type="webcontent" href="'.$postfilename.'">'."\n".      '<resource identifier="RES-'.$ressymb.'-'.$alldiscussion{$post}.'" type="webcontent" href="'.$postfilename.'">'."\n".
       '<file href="'.$postfilename.'">'."\n".        '<file href="'.$postfilename.'">'."\n".
       $imsfiles{$alldiscussion{$post}}{$imsitems{$alldiscussion{$post}}{'currversion'}}.'</file>'."\n".        $imsfiles{$alldiscussion{$post}}{$imsitems{$alldiscussion{$post}}{'currversion'}}."\n".
     '</resource>';      '</resource>';
                     }                      }
                     my $postingfile;                      my $postingfile;
Line 576  imscp_v1p1.xsd http://www.imsglobal.org/ Line 565  imscp_v1p1.xsd http://www.imsglobal.org/
                  <table border="0" cellpadding="0" cellspacing="4">                   <table border="0" cellpadding="0" cellspacing="4">
                   <tr>                    <tr>
                    <td>                     <td>
                     <font size="-1"><b>$lt{'cuse'}</b>:</font></td>                      <font size="-1"><b>$lt{'cuse'}</b>:</td>
                    <td>&nbsp;</td>                     <td>&nbsp;</td>
                    <td><font size="-1">                     <td><font size="-1">
 END  END
Line 598  END Line 587  END
                    </font></td>                     </font></td>
                    <td>&nbsp;</td>                     <td>&nbsp;</td>
                    <td align="left">                     <td align="left">
                     <font size="-1"><b><a href="$chglink">$lt{'chgt'}</a>?</b></font>                      <font size="-1"><b><a href="$chglink">$lt{'chgt'}</a>?</font></b>
                    </td>                     </td>
                   </tr>                    </tr>
                  </table>                   </table>
Line 608  END Line 597  END
                 my %sort_types = ();                  my %sort_types = ();
                 my %role_types = ();                  my %role_types = ();
                 my %status_types = ();                  my %status_types = ();
                 &sort_filter_names(\%sort_types,\%role_types,\%status_types,$crstype);                  &sort_filter_names(\%sort_types,\%role_types,\%status_types);
   
                 $discussion .= '<td><font size="-1"><b>'.&mt('Sorted by').'</b>: '.$sort_types{$sortposts}.'<br />';                  $discussion .= '<td><font size="-1"><b>'.&mt('Sorted by').'</b>: '.$sort_types{$sortposts}.'<br />';
                 if (defined($env{'form.totposters'})) {                  if (defined($env{'form.totposters'})) {
Line 727  END Line 716  END
                 $attachnum += @{$currnewattach};                  $attachnum += @{$currnewattach};
             }              }
         }          }
  if ((&discussion_open($status)) && ($outputtarget ne 'tex')) {   if (&discussion_open($status)) {
             if (($group ne '') && ($mode eq 'board')) {                if (($group ne '') && ($mode eq 'board')) {  
                 if ((&check_group_priv($group,'pgd') eq 'ok') &&                   if (&check_group_priv($group,'pgd') eq 'ok') {
                     ($ressymb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$})) {  
                     $discussion .=                      $discussion .=
  &postingform_display($mode,$ressymb,$now,$subject,   &postingform_display($mode,$ressymb,$now,$subject,
      $comment,$outputtarget,$attachnum,       $comment,$outputtarget,$attachnum,
      $currnewattach,$currdelold,       $currnewattach,$currdelold,
      $group,$crstype);       $group);
                 }                  }
             } else {              } else {
                 if (&Apache::lonnet::allowed('pch',$env{'request.course.id'}.          $discussion.= 
                     ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {      &postingform_display($mode,$ressymb,$now,$subject,
    $comment,$outputtarget,$attachnum,
                     $discussion.=   $currnewattach,$currdelold);
         &postingform_display($mode,$ressymb,$now,$subject,  
      $comment,$outputtarget,$attachnum,  
      $currnewattach,$currdelold,'',$crstype);  
                 } else {  
                     $discussion.= '<span class="LC_feedback_link">'.  
                                   &mt('This discussion is closed.').'</span>';  
                 }  
             }              }
  }   }
         if (!(&discussion_open($status)) && ($outputtarget ne 'tex')) {  
             $discussion.= '<span class="LC_feedback_link">'.  
                           &mt('This discussion is closed.').'</span>';  
         }  
     } else {      } else {
         $discussion.='<div class="LC_feedback_link">';          $discussion.='<div class="LC_feedback_link">';
         if (&discussion_open($status) &&          if (&discussion_open($status) &&
Line 762  END Line 739  END
            $env{'request.course.id'}.             $env{'request.course.id'}.
         ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {          ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
     if ($outputtarget ne 'tex') {      if ($outputtarget ne 'tex') {
                 $discussion.= &send_feedback_link($ressymb,$target);   $discussion.= &send_feedback_link($ressymb,$target);
                 if ($env{'request.role.adv'}) {  
                     my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);  
                     if (defined($close) && $close ne '' && $close < time) {  
                         $discussion .= '&nbsp;'.&mt('(Closed for [_1] roles)',  
                                                     &Apache::lonnet::plaintext('st',$crstype));  
                     }  
                 }  
             }  
         } else {  
             if ($outputtarget ne 'tex') {  
         $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';  
             }              }
    }
           if ($outputtarget ne 'tex') {
       $discussion.= &send_message_link($ressymb);
         }          }
         $discussion.=&send_message_link($ressymb).'</div>';          $discussion.='</div>';
     }      }
     return $discussion;      return $discussion;
 }  }
Line 786  sub send_feedback_link { Line 755  sub send_feedback_link {
     my $output = '<span class="LC_feedback_link">'.      my $output = '<span class="LC_feedback_link">'.
                  ' <a href="/adm/feedback?replydisc='.                   ' <a href="/adm/feedback?replydisc='.
                  &escape($ressymb).':::" '.$target.'>'.                   &escape($ressymb).':::" '.$target.'>'.
                  '<img alt="" src="'.                   '<img alt="" class="LC_noBorder" src="'.
                  &Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').                   &Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').
                  '" border="0" />'.&mt('Post Discussion').'</a></span>';                   '" border="0" /><span class="LC_menubuttons_inline_text">'.&mt('Post Discussion').'</span></a></span>';
     return $output;      return $output;
 }  }
   
Line 796  sub send_message_link { Line 765  sub send_message_link {
     my ($ressymb) = @_;      my ($ressymb) = @_;
     my $output = '<span class="LC_message_link">'.      my $output = '<span class="LC_message_link">'.
                  '  <a href="/adm/feedback?sendmessageonly=1&amp;symb='.                   '  <a href="/adm/feedback?sendmessageonly=1&amp;symb='.
                  &escape($ressymb).'"><img alt="" src="'.                   &escape($ressymb).'"><img alt="" class="LC_noBorder" src="'.
                  &Apache::loncommon::lonhttpdurl('/res/adm/pages/com.png').                   &Apache::loncommon::lonhttpdurl('/res/adm/pages/com.png').
                  '" border="0" />'.&mt('Send Feedback').'</a></span>';                   '" border="0" /><span class="LC_menubuttons_inline_text">'.&mt('Send Feedback').'</span></a></span>';
     return $output;      return $output;
 }  }
   
 sub action_links_bar {  sub action_links_bar {
     my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_;      my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_;
     my $discussion = '<tr><td class="LC_disc_action_links_bar" colspan="'.$colspan.'">'.      my $discussion = '<tr><td class="LC_disc_action_links_bar" colspan="'.$colspan.'">'.
                      '<table width="100%" class="LC_disc_action_table"><tr>'.                       '<table width="100%" class="LC_disc_action_table"><tr>';
                      '<td class="LC_disc_action_left">';  
     my $escsymb=&escape($ressymb);      my $escsymb=&escape($ressymb);
     if ($visible>2) {      if ($visible>2) {
         $discussion .= '<a href="/adm/feedback?cmd=threadedon&amp;symb='.$escsymb;          $discussion .= '<td class="LC_disc_action_left">'.
                          '<a href="/adm/feedback?cmd=threadedon&amp;symb='.$escsymb;
         if ($newpostsflag) {          if ($newpostsflag) {
             $discussion .= '&amp;previous='.$prevread;              $discussion .= '&previous='.$prevread;
         }          }
         $discussion .= &group_args($group);          $discussion .= &group_args($group);
         $discussion .='">'.&mt('Threaded View').'</a>&nbsp;&nbsp;'.          $discussion .='">'.&mt('Threaded View').'</a>&nbsp;&nbsp;'.
Line 827  sub action_links_bar { Line 796  sub action_links_bar {
         }          }
         $discussion .= &group_args($group);          $discussion .= &group_args($group);
         $discussion .='">'.&mt('Sorting/Filtering options').'</a>'.('&nbsp;' x2);          $discussion .='">'.&mt('Sorting/Filtering options').'</a>'.('&nbsp;' x2);
       } else {
           $discussion .= '<td class="LC_disc_action_left>';
     }      }
     $discussion .='<a href="/adm/feedback?export='.$escsymb;      $discussion .='<a href="/adm/feedback?export='.$escsymb;
     if ($newpostsflag) {      if ($newpostsflag) {
Line 842  sub action_links_bar { Line 813  sub action_links_bar {
                            &mt('Preferences on what is marked as NEW').                             &mt('Preferences on what is marked as NEW').
                            '</a><br /><a href="/adm/feedback?markread=1&amp;symb='.$escsymb;                             '</a><br /><a href="/adm/feedback?markread=1&amp;symb='.$escsymb;
             $discussion .= &group_args($group);              $discussion .= &group_args($group);
             $discussion .= '">'.&mt('Mark NEW posts no longer new').'</a></td>';              $discussion .= '">'.&mt('Mark NEW posts no longer new').'</a>';
         } else {          } else {
             $discussion .= '<td>&nbsp;</td>';              $discussion .= '<td>&nbsp;</td>';
         }          }
Line 855  sub action_links_bar { Line 826  sub action_links_bar {
   
 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,$crstype) = @_;          $currnewattach,$currdelold,$group) = @_;
     my $newattachmsg;      my $newattachmsg;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
               'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',                'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
Line 864  sub postingform_display { Line 835  sub postingform_display {
              'poan' => 'Post Anonymous Discussion',               'poan' => 'Post Anonymous Discussion',
              'newa' => 'New attachments',               'newa' => 'New attachments',
     );      );
     if ($crstype eq 'Community') {  
         $lt{'note'} = &mt('Note: in anonymous discussion, your name is visible only to community facilitators');  
     }  
     my $postingform = (<<ENDDISCUSS);      my $postingform = (<<ENDDISCUSS);
 <form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data"> <input type="submit" name="discuss" value="$lt{'podi'}" />  <form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data"> <input type="submit" name="discuss" value="$lt{'podi'}" />
 <input type="submit" name="anondiscuss" value="$lt{'poan'}" /> <input type="hidden" name="symb" value="$ressymb" />  <input type="submit" name="anondiscuss" value="$lt{'poan'}" /> <input type="hidden" name="symb" value="$ressymb" />
Line 875  sub postingform_display { Line 843  sub postingform_display {
 <br /><a name="newpost"></a>  <br /><a name="newpost"></a>
 <font size="1">$lt{'note'}</font><br />  <font size="1">$lt{'note'}</font><br />
 <b>$lt{'title'}:</b>&nbsp;<input type="text" name="subject" value="$subject" size="30" /><br /><br />  <b>$lt{'title'}:</b>&nbsp;<input type="text" name="subject" value="$subject" size="30" /><br /><br />
 <textarea name="comment" cols="80" rows="14">$comment</textarea>  <textarea name="comment" cols="80" rows="14" wrap="hard">$comment</textarea>
 ENDDISCUSS  ENDDISCUSS
     if ($env{'form.origpage'}) {      if ($env{'form.origpage'}) {
         $postingform .= '<input type="hidden" name="origpage" value="'.          $postingform .= '<input type="hidden" name="origpage" value="'.
Line 894  ENDDISCUSS Line 862  ENDDISCUSS
     }      }
     my $blockblog = &Apache::loncommon::blocking_status('blogs');      my $blockblog = &Apache::loncommon::blocking_status('blogs');
     if (!$blockblog) {      if (!$blockblog) {
         $postingform .= &add_blog_checkbox($crstype);          $postingform .= &add_blog_checkbox();
     }      }
     $postingform .= "</form>\n";      $postingform .= "</form>\n";
     if ($outputtarget ne 'tex') {      if ($outputtarget ne 'tex') {
Line 1043  sub build_posting_display { Line 1011  sub build_posting_display {
  $contrib{$idx.':senderdomain'}).' ('.   $contrib{$idx.':senderdomain'}).' ('.
  $contrib{$idx.':sendername'}.':'.   $contrib{$idx.':sendername'}.':'.
  $contrib{$idx.':senderdomain'}.')';   $contrib{$idx.':senderdomain'}.')';
                             $sender = '<b>'.$sender.'</b>';  
     if ($contrib{$idx.':anonymous'}) {      if ($contrib{$idx.':anonymous'}) {
         $sender.=' <font color="red"><b>['.$$anonhash{$key}.']</b></font> '.          $sender.=' <font color="red"><b>['.$$anonhash{$key}.']</b></font> '.
     $screenname;      $screenname;
Line 1051  sub build_posting_display { Line 1018  sub build_posting_display {
     if ($see_anonymous) {      if ($see_anonymous) {
  $sender.=&Apache::loncommon::student_image_tag($contrib{$idx.':senderdomain'},$contrib{$idx.':sendername'});   $sender.=&Apache::loncommon::student_image_tag($contrib{$idx.':senderdomain'},$contrib{$idx.':sendername'});
     }      }
                             $sender = '<b>'.$sender.'</b>';  
 # Set up for sorting by domain, then username  # Set up for sorting by domain, then username
                             unless (defined($$usernamesort{$contrib{$idx.':senderdomain'}})) {                              unless (defined($$usernamesort{$contrib{$idx.':senderdomain'}})) {
                                 %{$$usernamesort{$contrib{$idx.':senderdomain'}}} = ();                                  %{$$usernamesort{$contrib{$idx.':senderdomain'}}} = ();
Line 1086  sub build_posting_display { Line 1052  sub build_posting_display {
                                     $sender.=' <a href="/adm/feedback?editdisc='.                                      $sender.=' <a href="/adm/feedback?editdisc='.
                                          $escsymb.':::'.$idx;                                           $escsymb.':::'.$idx;
                                     if ($$newpostsflag) {                                      if ($$newpostsflag) {
                                         $sender .= '&amp;previous='.$prevread;                                          $sender .= '&previous='.$prevread;
                                     }                                      }
     $sender .= &group_args($group);      $sender .= &group_args($group);
                                     $sender .= '" '.$target.'>'.&mt('Edit').'</a>';                                      $sender .= '" '.$target.'>'.&mt('Edit').'</a>';
Line 1112  sub build_posting_display { Line 1078  sub build_posting_display {
     $sender.=' <a href="/adm/feedback?hide='.      $sender.=' <a href="/adm/feedback?hide='.
         $escsymb.':::'.$idx;          $escsymb.':::'.$idx;
                                     if ($$newpostsflag) {                                      if ($$newpostsflag) {
                                         $sender .= '&amp;previous='.$prevread;                                          $sender .= '&previous='.$prevread;
                                     }                                      }
     $sender .= &group_args($group);      $sender .= &group_args($group);
                                     $sender .= '">'.&mt('Hide').'</a>';                                      $sender .= '">'.&mt('Hide').'</a>';
Line 1153  sub build_posting_display { Line 1119  sub build_posting_display {
                                  $sender.=' <a href="/adm/feedback?replydisc='.                                   $sender.=' <a href="/adm/feedback?replydisc='.
                                           $escsymb.':::'.$idx;                                            $escsymb.':::'.$idx;
                                 if ($$newpostsflag) {                                  if ($$newpostsflag) {
                                     $sender .= '&amp;previous='.$prevread;                                      $sender .= '&previous='.$prevread;
                                 }                                  }
                                 $sender .= &group_args($group);                                  $sender .= &group_args($group);
                                 $sender .= '" '.$target.'>'.&mt('Reply').'</a>';                                  $sender .= '" '.$target.'>'.&mt('Reply').'</a>';
Line 1201  sub build_posting_display { Line 1167  sub build_posting_display {
                     $$imsitems{$idx}{'attach'}=$attachtxt{$numoldver};                      $$imsitems{$idx}{'attach'}=$attachtxt{$numoldver};
                     $$imsitems{$idx}{'timestamp'}=$contrib{$idx.':timestamp'};                      $$imsitems{$idx}{'timestamp'}=$contrib{$idx.':timestamp'};
                     $$imsitems{$idx}{'sender'}=$plainname.' ('.                      $$imsitems{$idx}{'sender'}=$plainname.' ('.
                                          $contrib{$idx.':sendername'}.':'.                                           $contrib{$idx.':sendername'}.' at '.
                                          $contrib{$idx.':senderdomain'}.')';                                           $contrib{$idx.':senderdomain'}.')';
                     $$imsitems{$idx}{'isanonymous'}='false';                      $$imsitems{$idx}{'isanonymous'}='false';
                     if ($contrib{$idx.':anonymous'}) {                      if ($contrib{$idx.':anonymous'}) {
Line 1274  sub build_posting_display { Line 1240  sub build_posting_display {
                             if ($prevread > 0 && $prevread <= $posttime) {                              if ($prevread > 0 && $prevread <= $posttime) {
                                 $$newitem{$idx} = 1;                                  $$newitem{$idx} = 1;
                                 $$discussionitems[$idx] .= '                                  $$discussionitems[$idx] .= '
                                  <table border="0" width="100%">                                   <p><table border="0" width="100%">
                                   <tr><td align="left"><font color="#FF0000"><b>'.&mt('NEW').'</b></font></td>';                                    <tr><td align="left"><font color="#FF0000"><b>'.&mt('NEW').'</b></font></td>';
                             } else {                              } else {
                                 $$newitem{$idx} = 0;                                  $$newitem{$idx} = 0;
                                 $$discussionitems[$idx] .= '                                  $$discussionitems[$idx] .= '
                                  <table border="0" width="100%">                                   <p><table border="0" width="100%">
                                   <tr><td align="left">&nbsp;</td>';                                    <tr><td align="left">&nbsp;</td>';
                             }                              }
                             $$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.' '.$vgrlink.' ('.                                  $sender.'</b> '.$vgrlink.' ('.
                                 &Apache::lonlocal::locallocaltime($posttime).')</td>';                                  &Apache::lonlocal::locallocaltime($posttime).')</td>';
                             if ($$dischash{$toggkey}) {                              if ($$dischash{$toggkey}) {
                                 $$discussionitems[$idx].='<td align="right">&nbsp;&nbsp;'.                                  $$discussionitems[$idx].='<td align="right">&nbsp;&nbsp;'.
                                   $ctlink.'</td>';                                    $ctlink.'</td>';
                             }                              }
                             $$discussionitems[$idx].= '</tr></table><blockquote>'.                              $$discussionitems[$idx].= '</tr></table><blockquote>'.
                                     $message.'</blockquote>';                                      $message.'</blockquote></p>';
                             if ($contrib{$idx.':history'}) {                              if ($contrib{$idx.':history'}) {
                                 my @postversions = ();                                  my @postversions = ();
                                 $$discussionitems[$idx] .= &mt('This post has been edited by the author.');                                  $$discussionitems[$idx] .= &mt('This post has been edited by the author.');
Line 1398  sub get_post_contents { Line 1364  sub get_post_contents {
                                  $$plainname,                                   $$plainname,
                                  $$contrib{$idx.':sendername'},                                   $$contrib{$idx.':sendername'},
                                  $$contrib{$idx.':senderdomain'}).' ('.                                   $$contrib{$idx.':senderdomain'}).' ('.
                                  $$contrib{$idx.':sendername'}.':'.                                   $$contrib{$idx.':sendername'}.' at '.
                                  $$contrib{$idx.':senderdomain'}.')';                                   $$contrib{$idx.':senderdomain'}.')';
     my $attachmenturls = $$contrib{$idx.':attachmenturl'};      my $attachmenturls = $$contrib{$idx.':attachmenturl'};
     my @postversions = ();      my @postversions = ();
Line 1426  sub get_post_contents { Line 1392  sub get_post_contents {
         my ($timesent,$attachmsg);          my ($timesent,$attachmsg);
         my %currattach = ();          my %currattach = ();
         $timesent = &Apache::lonlocal::locallocaltime($postversions[$i]);          $timesent = &Apache::lonlocal::locallocaltime($postversions[$i]);
         unless (&contains_block_html($messages->{$i})) {   &newline_to_br(\$messages->{$i});
             &newline_to_br(\$messages->{$i});  
         }  
         $$messages{$i}=&Apache::lontexconvert::msgtexconverted($$messages{$i});          $$messages{$i}=&Apache::lontexconvert::msgtexconverted($$messages{$i});
         $$subjects{$i}=~s/\n/\<br \/\>/g;          $$subjects{$i}=~s/\n/\<br \/\>/g;
         $$subjects{$i}=&Apache::lontexconvert::msgtexconverted($$subjects{$i});          $$subjects{$i}=&Apache::lontexconvert::msgtexconverted($$subjects{$i});
Line 1442  sub get_post_contents { Line 1406  sub get_post_contents {
                 foreach my $key (sort(keys(%currattach))) {                  foreach my $key (sort(keys(%currattach))) {
                     if ($$allattachments{$key}{'filename'} =~ m-^/uploaded/([^/]+/[^/]+)(/feedback)?(/?\d*)/([^/]+)$-) {                      if ($$allattachments{$key}{'filename'} =~ m-^/uploaded/([^/]+/[^/]+)(/feedback)?(/?\d*)/([^/]+)$-) {
                         my $fname = $1.$3.'/'.$4;                          my $fname = $1.$3.'/'.$4;
                         $$imsfiles{$idx}{$i} .= '<file href="'.$fname.'" />'."\n";                          $$imsfiles{$idx}{$i} .= '<file href="'.$fname.'">'."\n";
                         $$attachtxt{$i}.= '<a href="'.$fname.'">'.$4.'</a><br />';                          $$attachtxt{$i}.= '<a href="'.$fname.'">'.$4.'</a><br />';
                     }                      }
                 }                  }
Line 1515  sub mail_screen { Line 1479  sub mail_screen {
   }    }
   
   my %lt = &Apache::lonlocal::texthash(    my %lt = &Apache::lonlocal::texthash(
               'plch' => 'Please check at least one of the following feedback types:',
             'myqu' => 'My question/comment/feedback:',              'myqu' => 'My question/comment/feedback:',
             'title' => 'Title',              'title' => 'Title',
             'reta' => 'Retained attachments',              'reta' => 'Retained attachments',
Line 1702  END Line 1667  END
      {'add_entries' => \%onload});       {'add_entries' => \%onload});
   
   if ($quote ne '') {    if ($quote ne '') {
       $quote = &HTML::Entities::decode($quote);        &newline_to_br(\$quote);
       unless (&contains_block_html($quote)) {  
           &newline_to_br(\$quote);  
       }  
       $quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($quote).'</blockquote>';        $quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($quote).'</blockquote>';
   }    }
   
Line 1728  END Line 1690  END
 END  END
   }    }
   $r->print(<<END);    $r->print(<<END);
   $lt{'plch'}
 $options<hr />  $options<hr />
 $quote  $quote
 <p>$lt{'myqu'}</p>  <p>$lt{'myqu'}</p>
Line 1737  $latexHelp Line 1700  $latexHelp
 <p>  <p>
 $lt{'title'}: <input type="text" name="subject" size="30" value="$subject" /></p>  $lt{'title'}: <input type="text" name="subject" size="30" value="$subject" /></p>
 <p>  <p>
 <textarea name="comment" id="comment" cols="60" rows="10">$comment  <textarea name="comment" id="comment" cols="60" rows="10" wrap="hard">$comment
 </textarea></p>  </textarea></p>
   <p>
 END  END
     if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {      if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
         if ($env{'form.origpage'}) {          if ($env{'form.origpage'}) {
Line 1760  END Line 1724  END
         }          }
     } else {      } else {
         $r->print(<<END);          $r->print(<<END);
 <p>  
 $lt{'atta'} $attachmaxtext: <input type="file" name="attachment" />  $lt{'atta'} $attachmaxtext: <input type="file" name="attachment" />
 </p>  </p>
 END  END
Line 1774  END Line 1737  END
     $r->print(<<END);      $r->print(<<END);
 <p>  <p>
 <input type="hidden" name="sendit" value="1" />  <input type="hidden" name="sendit" value="1" />
 <input type="button" value="$send" onclick='gosubmit();' />  <input type="button" value="$send" onClick='gosubmit();' />
 </p>  </p>
 </form>  </form>
 END  END
Line 1981  END Line 1944  END
     $r->print(<<END);      $r->print(<<END);
        <td>$lt{'disa'}</td>         <td>$lt{'disa'}</td>
        <td>$lt{$discdisp}</td>         <td>$lt{$discdisp}</td>
        <td><label><input type="checkbox" name="discdisp" onclick="discdispChk('0')" />&nbsp;$lt{'chgt'} "$dispchangeA"</label>         <td><label><input type="checkbox" name="discdisp" onClick="discdispChk('0')" />&nbsp;$lt{'chgt'} "$dispchangeA"</label>
            <br />             <br />
            <label><input type="checkbox" name="discdisp" onclick="discdispChk('1')" />&nbsp;$lt{'chgt'} "$dispchangeB"</label>             <label><input type="checkbox" name="discdisp" onClick="discdispChk('1')" />&nbsp;$lt{'chgt'} "$dispchangeB"</label>
        </td>         </td>
 END  END
     $r->print(&Apache::loncommon::end_data_table_row());      $r->print(&Apache::loncommon::end_data_table_row());
Line 1998  END Line 1961  END
     $r->print(<<END);      $r->print(<<END);
        <td>$lt{'dotm'}</td>         <td>$lt{'dotm'}</td>
        <td>$lt{$disctogg}</td>         <td>$lt{$disctogg}</td>
        <td><label><input type="checkbox" name="disctogg" onclick="discdispChk('2')" />$lt{'chgt'} "$toggchange"</label></td>         <td><label><input type="checkbox" name="disctogg" onClick="discdispChk('2')" />$lt{'chgt'} "$toggchange"</label></td>
 END  END
     my $save = &mt('Save');      my $save = &mt('Save');
     $r->print(&Apache::loncommon::end_data_table_row());      $r->print(&Apache::loncommon::end_data_table_row());
Line 2012  END Line 1975  END
 <input type="hidden" name="$dispchgB" 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="hidden" name="$toggchg" value="" />
 <input type="button" name="sub" value="$save" onclick="javascript:setDisp()" />  <input type="button" name="sub" value="$save" onClick="javascript:setDisp()" />
 END  END
     if (exists($env{'form.group'})) {      if (exists($env{'form.group'})) {
         $r->print('<input type="hidden" name="group" value="'.$env{'form.group'}.'" />');          $r->print('<input type="hidden" name="group" value="'.$env{'form.group'}.'" />');
Line 2043  sub print_sortfilter_options { Line 2006  sub print_sortfilter_options {
     my $group_sel = '';      my $group_sel = '';
     my $numgroupvis = 5;      my $numgroupvis = 5;
     my %sectioncount = &Apache::loncommon::get_sections();      my %sectioncount = &Apache::loncommon::get_sections();
     my @courseroles = qw(st ad ep ta in);  
     my $crstype = &Apache::loncommon::course_type();  
     my $ccrole = 'cc';  
     if ($crstype eq 'Community') {  
         $ccrole = 'co';  
     }  
     push(@courseroles,$ccrole);  
   
     if ($env{'request.course.sec'} !~ /^\s*$/) {  #Restrict section choice to current section       if ($env{'request.course.sec'} !~ /^\s*$/) {  #Restrict section choice to current section 
         @sections = ('all',$env{'request.course.sec'});          @sections = ('all',$env{'request.course.sec'});
Line 2113  sub print_sortfilter_options { Line 2069  sub print_sortfilter_options {
     my %sort_types = ();      my %sort_types = ();
     my %role_types = ();      my %role_types = ();
     my %status_types = ();      my %status_types = ();
     &sort_filter_names(\%sort_types,\%role_types,\%status_types,$crstype);      &sort_filter_names(\%sort_types,\%role_types,\%status_types);
   
     my $js = <<END;      my $js = <<END;
 <script type="text/javascript">  <script type="text/javascript">
Line 2165  $start_page Line 2121  $start_page
 <br /><br />  <br /><br />
 <table border="0">  <table border="0">
  <tr>   <tr>
   <th>$lt{'soor'}</th>    <td><b>$lt{'soor'}</b></td>
   <th>&nbsp;</th>    <td>&nbsp;</td>
   <th>$lt{'sprs'}</th>    <td><b>$lt{'sprs'}</b></td>
   <th>&nbsp;</th>    <td>&nbsp;</td>
   <th>$lt{'spur'}</th>    <td><b>$lt{'spur'}</b></td>
   <th>&nbsp;</th>    <td>&nbsp;</td>
   <th>$lt{'spse'}</th>    <td><b>$lt{'spse'}</b></td>
   <th>&nbsp;</th>    <td>&nbsp;</td>
   <th>$lt{'spgr'}</th>    <td><b>$lt{'spgr'}</b></td>
   <th>&nbsp;</th>    <td>&nbsp;</td>
   <th>$lt{'psub'}</th>    <td><b>$lt{'psub'}</b></td>
  </tr>   </tr>
  <tr>   <tr>
   <td align="center" valign="top">    <td align="center" valign="top">
Line 2202  $start_page Line 2158  $start_page
    <select name="rolefilter" multiple="multiple" size="5">     <select name="rolefilter" multiple="multiple" size="5">
     <option value="all">$role_types{'all'}</option>      <option value="all">$role_types{'all'}</option>
     <option value="st">$role_types{'st'}</option>      <option value="st">$role_types{'st'}</option>
     <option value="$ccrole">$role_types{$ccrole}</option>      <option value="cc">$role_types{'cc'}</option>
     <option value="in">$role_types{'in'}</option>      <option value="in">$role_types{'in'}</option>
     <option value="ta">$role_types{'ta'}</option>      <option value="ta">$role_types{'ta'}</option>
     <option value="ep">$role_types{'ep'}</option>      <option value="ep">$role_types{'ep'}</option>
     <option value="ad">$role_types{'ad'}</option>  
     <option value="cr">$role_types{'cr'}</option>      <option value="cr">$role_types{'cr'}</option>
    </select>     </select>
   </td>    </td>
Line 2230  $start_page Line 2185  $start_page
 <br />  <br />
 <input type="hidden" name="previous" value="$previous" />  <input type="hidden" name="previous" value="$previous" />
 <input type="hidden" name="applysort" value="$symb" />  <input type="hidden" name="applysort" value="$symb" />
 <input type="button" name="sub" value="$lt{'stor'}" onclick="verifyFilter()" />  <input type="button" name="sub" value="$lt{'stor'}" onClick="verifyFilter()" />
 END  END
     if (exists($env{'form.group'})) {      if (exists($env{'form.group'})) {
         $r->print('<input type="hidden" name="group" value="'.$env{'form.group'}.'" />');          $r->print('<input type="hidden" name="group" value="'.$env{'form.group'}.'" />');
Line 2264  sub print_showposters { Line 2219  sub print_showposters {
     my $group = $env{'form.group'};      my $group = $env{'form.group'};
     my $ressymb = &wrap_symb($symb);      my $ressymb = &wrap_symb($symb);
     if (($group ne '') &&      if (($group ne '') &&
         ($ressymb =~ m|^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$|)) {          ($ressymb =~ m|^bulletin___ \d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$|)) {
         if (&check_group_priv($group,'dgp') eq 'ok') {          if (&check_group_priv($group,'dgp') eq 'ok') {
             $seeid = 1;              $seeid = 1;
         }          }
Line 2353  END Line 2308  END
 <br />  <br />
 <input type="hidden" name="sortposts" value="$sortposts" />  <input type="hidden" name="sortposts" value="$sortposts" />
 <input type="hidden" name="userpick" value="$symb" />  <input type="hidden" name="userpick" value="$symb" />
 <input type="button" name="store" value="Display posts" onclick="javascript:document.pickpostersform.submit()" />  <input type="button" name="store" value="Display posts" onClick="javascript:document.pickpostersform.submit()" />
 </form>  </form>
 $end_page  $end_page
 END  END
Line 2456  sub redirect_back { Line 2411  sub redirect_back {
   if ($previous > 0) {    if ($previous > 0) {
       $qrystr = 'previous='.$previous;        $qrystr = 'previous='.$previous;
       if ($feedurl =~ /\?register=1/) {        if ($feedurl =~ /\?register=1/) {
           $feedurl .= '&amp;'.$qrystr;            $feedurl .= '&'.$qrystr;
       } else {        } else {
           $feedurl .= '?'.$qrystr;            $feedurl .= '?'.$qrystr;
       }        }
Line 2465  sub redirect_back { Line 2420  sub redirect_back {
   if (defined($sort)) {    if (defined($sort)) {
       my $sortqry = 'sortposts='.$sort;        my $sortqry = 'sortposts='.$sort;
       if (($feedurl =~ /\?register=1/) || ($feedurl =~ /\?previous=/)) {        if (($feedurl =~ /\?register=1/) || ($feedurl =~ /\?previous=/)) {
           $feedurl .= '&amp;'.$sortqry;            $feedurl .= '&'.$sortqry;
       } else {        } else {
           $feedurl .= '?'.$sortqry;            $feedurl .= '?'.$sortqry;
       }        }
       $sorttag = '<input type="hidden" name="sortposts" value="'.$sort.'" />';        $sorttag = '<input type="hidden" name="sortposts" value="'.$sort.'" />';
       if (defined($numpicks)) {        if (defined($numpicks)) {
           my $userpickqry = 'totposters='.$numpicks;            my $userpickqry = 'totposters='.$numpicks;
           $feedurl .= '&amp;'.$userpickqry;            $feedurl .= '&'.$userpickqry;
           $userpicktag = '<input type="hidden" name="totposters" value="'.$numpicks.'" />';            $userpicktag = '<input type="hidden" name="totposters" value="'.$numpicks.'" />';
       } else {        } else {
           if (ref($sectionpick) eq 'ARRAY') {            if (ref($sectionpick) eq 'ARRAY') {
Line 2486  sub redirect_back { Line 2441  sub redirect_back {
               $sectag =~ s/,$//;                $sectag =~ s/,$//;
               $sectag .= '" />';                $sectag .= '" />';
           } else {            } else {
               $feedurl .= '&amp;sectionpick='.$sectionpick;                $feedurl .= '&sectionpick='.$sectionpick;
               $sectag = '<input type="hidden" name="sectionpick" value="'.$sectionpick.'" />';                $sectag = '<input type="hidden" name="sectionpick" value="'.$sectionpick.'" />';
           }            }
           if (ref($grouppick) eq 'ARRAY') {            if (ref($grouppick) eq 'ARRAY') {
Line 2500  sub redirect_back { Line 2455  sub redirect_back {
               $grptag =~ s/,$//;                $grptag =~ s/,$//;
               $grptag .= '" />';                $grptag .= '" />';
           } else {            } else {
               $feedurl .= '&amp;grouppick='.$grouppick;                $feedurl .= '&grouppick='.$grouppick;
               $grptag = '<input type="hidden" name="grouppick" value="'.$grouppick.'" />';                $grptag = '<input type="hidden" name="grouppick" value="'.$grouppick.'" />';
           }            }
           if (ref($rolefilter) eq 'ARRAY') {            if (ref($rolefilter) eq 'ARRAY') {
Line 2517  sub redirect_back { Line 2472  sub redirect_back {
               $feedurl .= '&rolefilter='.$rolefilter;                $feedurl .= '&rolefilter='.$rolefilter;
               $roletag = '<input type="hidden" name="rolefilter" value="'.$rolefilter.'" />';                $roletag = '<input type="hidden" name="rolefilter" value="'.$rolefilter.'" />';
           }            }
           $feedurl .= '&amp;statusfilter='.$statusfilter;            $feedurl .= '&statusfilter='.$statusfilter;
           $statustag ='<input type="hidden" name="statusfilter" value="'.$statusfilter.'" />';            $statustag ='<input type="hidden" name="statusfilter" value="'.$statusfilter.'" />';
       }        }
   }    }
Line 2605  ENDNOREDIRTWO Line 2560  ENDNOREDIRTWO
 }  }
   
 sub screen_header {  sub screen_header {
     my ($feedurl,$symb,$group) = @_;      my ($feedurl,$symb) = @_;
     my $crscontent = &mt('Question/Comment/Feedback about course content');  
     my $crspolicy = &mt('Question/Comment/Feedback about course policy');  
     my $contribdisc = &mt('Contribution to course discussion of resource');  
     my $anoncontrib = &mt('Anonymous contribution to course discussion of resource');  
     my $namevis = &mt('name only visible to course faculty');  
     my $crstype;  
     if ($env{'request.course.id'}) {  
         $crstype = &Apache::loncommon::course_type();  
         if ($crstype eq 'Community') {  
             $crscontent = &mt('Question/Comment/Feedback about community content');  
             $crspolicy = &mt('Question/Comment/Feedback about community policy');  
             $contribdisc = &mt('Contribution to community discussion of resource');  
             $anoncontrib = &mt('Anonymous contribution to community discussion of resource');  
             $namevis = &mt('name only visible to community facilitators');  
         }  
     }  
     my $msgoptions='';      my $msgoptions='';
     my $discussoptions='';      my $discussoptions='';
     unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) {      unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) {
Line 2642  sub screen_header { Line 2581  sub screen_header {
  if (&feedback_available(0,1)) {   if (&feedback_available(0,1)) {
     $msgoptions.=      $msgoptions.=
  '<p><label><input type="radio" name="discuss" value="course" /> '.   '<p><label><input type="radio" name="discuss" value="course" /> '.
  ($optionhash{'comment'}?$optionhash{'comment'}:$crscontent).   ($optionhash{'comment'}?$optionhash{'comment'}:&mt('Question/Comment/Feedback about course content')).
  '</label></p>';   '</label></p>';
  }   }
  if (&feedback_available(0,0,1)) {   if (&feedback_available(0,0,1)) {
     $msgoptions.=      $msgoptions.=
  '<p><label><input type="radio" name="discuss" value="policy" /> '.   '<p><label><input type="radio" name="discuss" value="policy" /> '.
  ($optionhash{'policy'}?$optionhash{'policy'}:$crspolicy).   ($optionhash{'policy'}?$optionhash{'policy'}:&mt('Question/Comment/Feedback about course policy')).
  '</label></p>';   '</label></p>';
  }   }
     }      }
     if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) {      if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) {
         my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('boards');          my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('boards');
         my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};          if (!$blocked && &discussion_open(undef,$symb) && 
         my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};      &Apache::lonnet::allowed('pch',
         my $realsymb = $symb;       $env{'request.course.id'}.
         if ($symb=~/^bulletin___/) {       ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
             my $filename=(&Apache::lonnet::decode_symb($symb))[2];  
             $filename=~s|^adm/wrapper/||;  
             $realsymb=&Apache::lonnet::symbread($filename);  
         }  
         if (!$blocked && &discussion_open(undef,$realsymb) &&  
             (&Apache::lonnet::allowed('pch',  
                                       $env{'request.course.id'}.  
                                       ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) ||   
             (($group ne '') && ($symb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$}) && (&check_group_priv($group,'pgd') eq 'ok')))) {  
     $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.      $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.
                 $contribdisc.   &mt('Contribution to course discussion of resource');
                 '</label><br /><label><input type="radio" name="discuss" value="anon" /> '.          $discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
                 $anoncontrib.   &mt('Anonymous contribution to course discussion of resource').
                 ' <i>('.$namevis.')</i></label> '.   ' <i>('.&mt('name only visible to course faculty').')</i></label> '.
   
  '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';   '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
             my $blockblog = &Apache::loncommon::blocking_status('blogs');              my $blockblog = &Apache::loncommon::blocking_status('blogs');
             if (!$blockblog) {              if (!$blockblog) {
                 $discussoptions.= &add_blog_checkbox($crstype);                  $discussoptions.= &add_blog_checkbox();
             }              }
         }          }
     }      }
     if ($msgoptions) {      if ($msgoptions) {
         $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/com.png').'" />'          $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/com.png').'" />'
                    .' '.&mt('Send Feedback').'</h2><p>'.&Apache::lonhtmlcommon::coursepreflink(&mt('Feedback Settings'),'feedback').'</p>'                     .' '.&mt('Send Feedback').'</h2>'
                    .$msgoptions;                     .$msgoptions;
     }      }
     if ($discussoptions) {       if ($discussoptions) { 
  $discussoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" alt="" />'   $discussoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" />'
                         .' '.&mt('Discussion Contributions').'</h2><p>'.&Apache::lonhtmlcommon::coursepreflink(&mt('Discussion Settings'),'discussion').'</p>'                          .' '.&mt('Discussion Contributions').'</h2>'
                         .$discussoptions;                          .$discussoptions;
     }      }
     return $msgoptions.$discussoptions;      return $msgoptions.$discussoptions;
Line 2718  sub clear_out_html { Line 2647  sub clear_out_html {
       ($override)) {        ($override)) {
       # allows <B> <I> <P> <A> <LI> <OL> <UL> <EM> <BR> <TT> <STRONG>         # allows <B> <I> <P> <A> <LI> <OL> <UL> <EM> <BR> <TT> <STRONG> 
       # <BLOCKQUOTE> <DIV .*> <DIV> <IMG> <M> <SPAN> <H1> <H2> <H3> <H4> <SUB>        # <BLOCKQUOTE> <DIV .*> <DIV> <IMG> <M> <SPAN> <H1> <H2> <H3> <H4> <SUB>
       # <SUP> <TABLE> <TR> <TD> <TH> <TBODY>        # <SUP>
       %html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1,        %html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1,
      BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1,       BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1,
      M=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1,        M=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1, 
      H1=>1, H2=>1, H3=>1, H4=>1, H5=>1, H6=>1,        H1=>1, H2=>1, H3=>1, H4=>1, H5=>1);
      TABLE=>1, TR=>1, TD=>1, TH=>1, TBODY=>1);  
   
   }    }
 # Do the substitution of everything that is not explicitly allowed  # Do the substitution of everything that is not explicitly allowed
   $message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/    $message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/
Line 2806  sub send_msg { Line 2733  sub send_msg {
 }  }
   
 sub adddiscuss {  sub adddiscuss {
     my ($symb,$email,$anon,$attachmenturl,$subject,$group)=@_;      my ($symb,$email,$anon,$attachmenturl,$subject)=@_;
     my $status='';      my $status='';
     my $realsymb;      my $realsymb;
     if ($symb=~/^bulletin___/) {      if ($symb=~/^bulletin___/) {
Line 2814  sub adddiscuss { Line 2741  sub adddiscuss {
  $filename=~s|^adm/wrapper/||;   $filename=~s|^adm/wrapper/||;
  $realsymb=&Apache::lonnet::symbread($filename);   $realsymb=&Apache::lonnet::symbread($filename);
     }      }
     my ($cnum,$cdom);  
     if ($env{'request.course.id'}) {  
         $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};  
         $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};  
     }  
     if (&discussion_open(undef,$realsymb) &&      if (&discussion_open(undef,$realsymb) &&
  (&Apache::lonnet::allowed('pch',$env{'request.course.id'}.   &Apache::lonnet::allowed('pch',$env{'request.course.id'}.
          ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) ||          ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
          (($group ne '') && (&check_group_priv($group,'pgd') eq 'ok') &&  
          ($symb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$})))) {  
   
     my %contrib=('message'      => $email,      my %contrib=('message'      => $email,
                  'sendername'   => $env{'user.name'},                   'sendername'   => $env{'user.name'},
Line 2994  sub show_preview { Line 2914  sub show_preview {
     );      );
 }  }
   
 sub contains_block_html {  
     my ($message)=@_;  
     return ($message =~ m{  
         <(br|h1|h2|h3|h4|h5|h6|p|ol|ul|table|pre|address|blockquote|center|div)  
           \s*  
          (\w+\=['"]\w+['"])*  
           \s*  
         (  
           \s*/>|  
           >.*</\1\s*>  
         )}xs  
     );  
 }  
   
 sub newline_to_br {  sub newline_to_br {
     my ($message)=@_;      my ($message)=@_;
Line 3040  sub generate_preview_button { Line 2947  sub generate_preview_button {
 <input type="hidden" name="subject" />  <input type="hidden" name="subject" />
 <input type="hidden" name="comment" />  <input type="hidden" name="comment" />
 <input type="button" value="$pre"  <input type="button" value="$pre"
 onclick="if (typeof(document.$formname.onsubmit)=='function') {document.$formname.onsubmit();};this.form.comment.value=document.$formname.$fieldname.value;this.form.subject.value=document.$formname.subject.value;this.form.submit();" />  onClick="if (typeof(document.$formname.onsubmit)=='function') {document.$formname.onsubmit();};this.form.comment.value=document.$formname.$fieldname.value;this.form.subject.value=document.$formname.subject.value;this.form.submit();" />
 </form>  </form>
 ENDPREVIEW  ENDPREVIEW
 }  }
Line 3095  $toolarge Line 3002  $toolarge
  <table class="LC_data_table">   <table class="LC_data_table">
   <tr>    <tr>
    <td colspan="2">     <td colspan="2">
     <b>Subject:</b> <b>$subject</b><br /><br />      <b>Subject:</b> $subject</b><br /><br />
 END  END
     if ($idx) {      if ($idx) {
         if ($attachmenturls) {          if ($attachmenturls) {
Line 3123  END Line 3030  END
    </td></tr>     </td></tr>
    <tr>     <tr>
     <td>      <td>
    $lt{'adda'}</td><td><input type="file" name="addnewattach" /><input type="button" name="upload" value="Upload" onclick="this.form.submit()" />         $lt{'adda'}</td><td><input type="file" name="addnewattach" /><input type="button" name="upload" value="Upload" onClick="this.form.submit()" />    
    </td>     </td>
   </tr>    </tr>
   <tr>    <tr>
Line 3146  END Line 3053  END
         $r->print('<input type="hidden" name="deloldattach" value="'.$item.'" />'."\n");          $r->print('<input type="hidden" name="deloldattach" value="'.$item.'" />'."\n");
     }      }
     $r->print(<<END);      $r->print(<<END);
  <input type="button" name="rtntoedit" value="$lt{'stch'}" onclick="setAction()" />   <input type="button" name="rtntoedit" value="$lt{'stch'}" onClick="setAction()" />
 </form>  </form>
 $end_page  $end_page
 END  END
Line 3338  sub construct_attachmenturl { Line 3245  sub construct_attachmenturl {
 }  }
   
 sub add_blog_checkbox {  sub add_blog_checkbox {
     my ($crstype) = @_;      my ($checkstatus);
     my $checkstatus;  
     if ($env{'form.blog'}) {      if ($env{'form.blog'}) {
         $checkstatus = 'checked="checked"';          $checkstatus = 'checked="checked"';
     }      }
Line 3353  function setblogvalue() { Line 3259  function setblogvalue() {
     }      }
 }  }
 </script><br />  </script><br />
 <label><input type="checkbox" name="blog" '.$checkstatus.' /> ';  <label><input type="checkbox" name="blog" '.$checkstatus.' /> '.
     if ($crstype eq 'Community') {  &mt('Add to my public course blog').'</label><br />'."\n";
         $output .= &mt('Add to my public community blog');  
     } else {  
         $output .= &mt('Add to my public course blog');  
     }   
     $output .= '</label><br />'."\n";  
     return $output;      return $output;
 }  }
   
Line 3383  sub has_discussion { Line 3284  sub has_discussion {
 }  }
   
 sub sort_filter_names {  sub sort_filter_names {
     my ($sort_types,$role_types,$status_types,$crstype) = @_;      my ($sort_types,$role_types,$status_types) = @_;
     if (ref($sort_types) eq 'HASH') {      %{$sort_types} = (
         %{$sort_types} = (  
                      ascdate => 'Date order - oldest first',                       ascdate => 'Date order - oldest first',
                      descdate => 'Date order - newest first',                       descdate => 'Date order - newest first',
                      thread => 'Threaded',                       thread => 'Threaded',
Line 3393  sub sort_filter_names { Line 3293  sub sort_filter_names {
                      username => 'By domain and username',                       username => 'By domain and username',
                      lastfirst => 'By last name, first name'                       lastfirst => 'By last name, first name'
                    );                     );
     }      %{$role_types} = (
     my @courseroles = qw(st in ta ep ad);                       all => 'All roles',
     if ($crstype eq 'Community') {                       st  => 'Students',
         push(@courseroles,'co');                       cc  => 'Course Coordinators',
     } else {                       in  => 'Instructors',
         push(@courseroles,'cc');                       ta  => 'TAs',
     }                       ep  => 'Exam proctors',
     if (ref($role_types) eq 'HASH') {                       ad  => 'Administrators',
         foreach my $role (@courseroles) {                       cr  => 'Custom roles'
             $role_types->{$role} = &Apache::lonnet::plaintext($role,$crstype);                     );
         }      %{$status_types} = (
         $role_types->{'all'} = 'All roles';                       all     => 'Roles of any status',
         $role_types->{'cr'} = 'Custom role';                       Active  => 'Only active roles',
     }                       Expired => 'Only past roles',
     if (ref($status_types) eq 'HASH') {                       Future  => 'Only future roles',
         %{$status_types} = (                     );
                       all     => 'Roles of any status',  
                       Active  => 'Only active roles',  
                       Expired => 'Only past roles',  
                       Future  => 'Only future roles',  
                     );  
     }  
 }  }
     
 sub handler {  sub handler {
   my $r = shift;    my $r = shift;
   if ($r->header_only) {    if ($r->header_only) {
Line 3850  ENDREDIR Line 3744  ENDREDIR
                   return OK;                    return OK;
               }                }
           }            }
   my $options=&screen_header($feedurl,$symb,$group);    my $options=&screen_header($feedurl,$symb);
   if ($options) {    if ($options) {
       &mail_screen($r,$feedurl,$options,$symb,$attachmax{'text'});        &mail_screen($r,$feedurl,$options,$symb,$attachmax{'text'});
   } else {    } else {
Line 3929  ENDREDIR Line 3823  ENDREDIR
   my $subject = &clear_out_html($env{'form.subject'},undef,1);    my $subject = &clear_out_html($env{'form.subject'},undef,1);
   my $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} );    my $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} );
   $typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl,    $typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl,
   $subject,$group);    $subject);
   $numpost++;    $numpost++;
       }        }
   
Line 3942  ENDREDIR Line 3836  ENDREDIR
     $env{'user.domain'},      $env{'user.domain'},
     'CourseBlog_'.$env{'request.course.id'},      'CourseBlog_'.$env{'request.course.id'},
     $subject,$message,$feedurl,'public');      $subject,$message,$feedurl,'public');
           if (&Apache::loncommon::course_type() eq 'Community') {    $blog='<br />'.&mt('Added to my course blog').'<br />';
               $blog='<br />'.&mt('Added to my community blog').'<br />';  
           } else {  
       $blog='<br />'.&mt('Added to my course blog').'<br />';  
           }  
       }        }
       
 # Receipt screen and redirect back to where came from  # Receipt screen and redirect back to where came from

Removed from v.1.273.4.12  
changed lines
  Added in v.1.274


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