Diff for /loncom/interface/lonfeedback.pm between versions 1.298 and 1.311

version 1.298, 2010/08/14 15:24:46 version 1.311, 2011/12/12 02:46:12
Line 135  sub list_discussion { Line 135  sub list_discussion {
     $crs=~s/\_/\//g;      $crs=~s/\_/\//g;
     my $encsymb=&Apache::lonenc::check_encrypt($ressymb);      my $encsymb=&Apache::lonenc::check_encrypt($ressymb);
     my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs)      my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs)
   && ($ressymb=~/\.(problem|exam|quiz|assess|survey|form|task)$/));    && ($ressymb=~/$LONCAPA::assess_re/));
           
     my %usernamesort = ();      my %usernamesort = ();
     my %namesort =();      my %namesort =();
Line 281  sub list_discussion { Line 281  sub list_discussion {
     my $maxdepth=0;      my $maxdepth=0;
     my %anonhash=();      my %anonhash=();
     my $anoncnt=0;      my $anoncnt=0;
     my $target='';  
   
     my $now = time;      my $now = time;
     $discinfo{$visitkey} = $visit;      $discinfo{$visitkey} = $visit;
   
     &Apache::lonnet::put('nohist_'.$cid.'_discuss',\%discinfo,$env{'user.domain'},$env{'user.name'});      &Apache::lonnet::put('nohist_'.$cid.'_discuss',\%discinfo,$env{'user.domain'},$env{'user.name'});
     &build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$encsymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,\@grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,\%anonhash,$anoncnt,$group);      &build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$encsymb,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,\@grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,\%anonhash,$anoncnt,$group);
   
     my $discussion='';      my $discussion='';
     my $manifestfile;      my $manifestfile;
Line 722  END Line 721  END
                 $attachnum += @{$currnewattach};                  $attachnum += @{$currnewattach};
             }              }
         }          }
  if (&discussion_open($status)) {   if ((&discussion_open($status)) && ($outputtarget ne 'tex')) {
             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,
Line 732  END Line 732  END
      $group,$crstype);       $group,$crstype);
                 }                  }
             } else {              } else {
         $discussion.=                   if (&Apache::lonnet::allowed('pch',$env{'request.course.id'}.
     &postingform_display($mode,$ressymb,$now,$subject,                      ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
  $comment,$outputtarget,$attachnum,  
  $currnewattach,$currdelold,'',$crstype);              $discussion.= 
           &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>';
                   }
             }              }
  }   }
     } else {          if (!(&discussion_open($status)) && ($outputtarget ne 'tex')) {
               $discussion.= '<span class="LC_feedback_link">'.
                             &mt('This discussion is closed.').'</span>';
           }
       } elsif ($outputtarget ne 'tex') {
         $discussion.='<div class="LC_feedback_link">';          $discussion.='<div class="LC_feedback_link">';
         if (&discussion_open($status) &&          if (&discussion_open($status) &&
             &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'}:''))) {
     if ($outputtarget ne 'tex') {              $discussion.= &send_feedback_link($ressymb);
                 $discussion.= &send_feedback_link($ressymb,$target);              if ($env{'request.role.adv'}) {
                 if ($env{'request.role.adv'}) {                  my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
                     my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);                  if (defined($close) && $close ne '' && $close < time) {
                     if (defined($close) && $close ne '' && $close < time) {                      $discussion .= '&nbsp;'.&mt('(Closed for [_1] roles)',
                         $discussion .= '&nbsp;'.&mt('(Closed for [_1] roles)',                                                  &Apache::lonnet::plaintext('st',$crstype));
                                                     &Apache::lonnet::plaintext('st',$crstype));  
                     }  
                 }                  }
             }              }
  } else {   } else {
             if ($outputtarget ne 'tex') {              $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';
                 $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';  
             }  
         }  
         if ($outputtarget ne 'tex') {  
     $discussion.= &send_message_link($ressymb);  
         }          }
         $discussion.='</div>';   $discussion.= &send_message_link($ressymb).'</div>';
     }      }
     return $discussion;      return $discussion;
 }  }
   
   
   sub discussion_link {
      my ($ressymb,$linktext,$cmd,$item,$flag,$prev,$adds)=@_;
      my $link='/adm/feedback?inhibitmenu=yes&modal=yes&'.$cmd.'='.&escape($ressymb).':::'.$item;
      if ($flag) { $link .= '&amp;previous='.$prev; }
      if ($adds) { $link .= $adds; }
      return &Apache::loncommon::modal_link($link,$linktext,600,600);
   }
   
   
 sub send_feedback_link {  sub send_feedback_link {
     my ($ressymb,$target) = @_;      my ($ressymb) = @_;
     my $output = '<span class="LC_feedback_link">'.      return '<span class="LC_feedback_link">'.
                  ' <a href="/adm/feedback?replydisc='.                   &discussion_link($ressymb,
                  &escape($ressymb).':::" '.$target.'>'.                      '<img alt="" class="LC_noBorder" src="'.
                  '<img alt="" class="LC_noBorder" src="'.                      &Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').
                  &Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').                      '" border="0" /><span class="LC_menubuttons_inline_text">'.&mt('Post Discussion').'</span>',
                  '" border="0" /><span class="LC_menubuttons_inline_text">'.&mt('Post Discussion').'</span></a></span>';                      'replydisc').
     return $output;             '</span>';
 }  }
   
 sub send_message_link {  sub send_message_link {
Line 794  sub action_links_bar { Line 808  sub action_links_bar {
                      '<table width="100%" class="LC_disc_action_table"><tr>'.                       '<table width="100%" class="LC_disc_action_table"><tr>'.
                      '<td class="LC_disc_action_left">';                       '<td class="LC_disc_action_left">';
     my $escsymb=&escape($ressymb);      my $escsymb=&escape($ressymb);
     if ($visible>2) {      if ($visible) {
         $discussion .= '<a href="/adm/feedback?cmd=threadedon&amp;symb='.$escsymb;          $discussion .= '<a href="/adm/feedback?cmd=threadedon&amp;symb='.$escsymb;
         if ($newpostsflag) {          if ($newpostsflag) {
             $discussion .= '&amp;previous='.$prevread;              $discussion .= '&amp;previous='.$prevread;
Line 842  sub action_links_bar { Line 856  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,$crstype) = @_;
     if ($outputtarget eq 'tex') { return ''; }  
     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 858  sub postingform_display { Line 871  sub postingform_display {
     if (&Apache::lonhtmlcommon::htmlareabrowser()) {      if (&Apache::lonhtmlcommon::htmlareabrowser()) {
         $postingform = &Apache::lonhtmlcommon::htmlareaselectactive();          $postingform = &Apache::lonhtmlcommon::htmlareaselectactive();
         $textareaclass = 'class="LC_richDefaultOff"';          $textareaclass = 'class="LC_richDefaultOff"';
           if ($env{'request.course.id'}) {
               unless (($env{'course.'.$env{'request.course.id'}.'.allow_limited_html_in_feedback'} =~ /^\s*yes\s*$/i) || ($env{'form.sendmessageonly'})) {
                   undef($textareaclass);
               }
           }
     }      }
     $postingform .= (<<ENDDISCUSS);      $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'}" />
Line 913  ENDDISCUSS Line 931  ENDDISCUSS
 }  }
   
 sub build_posting_display {  sub build_posting_display {
     my ($usernamesort,$subjectsort,$namesort,$notshown,$newitem,$dischash,$shown,$alldiscussion,$imsitems,$imsfiles,$roleinfo,$discussionitems,$replies,$depth,$posters,$maxdepth,$visible,$newpostsflag,$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$ressymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_;      my ($usernamesort,$subjectsort,$namesort,$notshown,$newitem,$dischash,$shown,$alldiscussion,$imsitems,$imsfiles,$roleinfo,$discussionitems,$replies,$depth,$posters,$maxdepth,$visible,$newpostsflag,$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$ressymb,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_;
     my @original=();      my @original=();
     my @index=();      my @index=();
     my $skip_group_check = 0;      my $skip_group_check = 0;
Line 929  sub build_posting_display { Line 947  sub build_posting_display {
     if ((@{$grouppick} == 0) || (grep(/^all$/,@{$grouppick}))) {      if ((@{$grouppick} == 0) || (grep(/^all$/,@{$grouppick}))) {
         $skip_group_check = 1;          $skip_group_check = 1;
     }      }
       my (%deletions,%hiddens);
       if ($contrib{'deleted'}) {
          my $deleted = $contrib{'deleted'};
          $deleted =~ s/^\.//;
          $deleted =~ s/\.$//;
          %deletions = map { $_ => 1 } (split(/\.\./,$deleted));
       }
       if ($contrib{'hidden'}) {
          my $hidden = $contrib{'hidden'};
          $hidden =~ s/^\.//;
          $hidden =~ s/\.$//;
          %hiddens = map { $_ => 1 } (split(/\.\./,$hidden));
       }
     if ($contrib{'version'}) {      if ($contrib{'version'}) {
         my $oldest = $contrib{'1:timestamp'};          my $oldest = $contrib{'1:timestamp'};
         if ($prevread eq '0') {          if ($prevread eq '0') {
Line 942  sub build_posting_display { Line 973  sub build_posting_display {
         }           } 
  for (my $id=1;$id<=$contrib{'version'};$id++) {   for (my $id=1;$id<=$contrib{'version'};$id++) {
     my $idx=$id;      my $idx=$id;
               next if ($contrib{$idx.':deleted'});
               next if ($contrib{$idx.':hidden'});
             my $posttime = $contrib{$idx.':timestamp'};              my $posttime = $contrib{$idx.':timestamp'};
             if ($prevread <= $posttime) {              if ($prevread <= $posttime) {
                 $$newpostsflag = 1;                  $$newpostsflag = 1;
             }              }
     my $hidden=($contrib{'hidden'}=~/\.$idx\./);  
             my $studenthidden=($contrib{'studenthidden'}=~/\.$idx\./);              my $studenthidden=($contrib{'studenthidden'}=~/\.$idx\./);
     my $deleted=($contrib{'deleted'}=~/\.$idx\./);  
     my $origindex='0.';      my $origindex='0.';
             my $numoldver=0;              my $numoldver=0;
     if ($contrib{$idx.':replyto'}) {      if ($contrib{$idx.':replyto'}) {
Line 972  sub build_posting_display { Line 1003  sub build_posting_display {
     } else {      } else {
  $$replies[$$depth[$idx]]=1;   $$replies[$$depth[$idx]]=1;
     }      }
     unless ((($hidden) && (!$seeid)) || ($deleted)) {              unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx})) {
  $$visible++;   $$visible++;
                 if ($contrib{$idx.':history'}) {                  if ($contrib{$idx.':history'}) {
                     if ($contrib{$idx.':history'} =~ /:/) {                      if ($contrib{$idx.':history'} =~ /:/) {
Line 1006  sub build_posting_display { Line 1037  sub build_posting_display {
                     $message.=$attachtxt{$numoldver};                      $message.=$attachtxt{$numoldver};
                     $subject=$subjects{$numoldver};                      $subject=$subjects{$numoldver};
                     if ($message) {                      if ($message) {
           if ($hidden) {            if ($hiddens{$idx}) {
     $message='<font color="#888888">'.$message.'</font>';      $message='<font color="#888888">'.$message.'</font>';
                             if ($studenthidden) {                              if ($studenthidden) {
                                 $message .='<br /><br />Deleted by poster (student).';                                  $message .='<br /><br />Deleted by poster (student).';
Line 1070  sub build_posting_display { Line 1101  sub build_posting_display {
                             } else {                              } else {
                                 @{$$namesort{$lastname}{$firstname}} = ("$idx");                                  @{$$namesort{$lastname}{$firstname}} = ("$idx");
                             }                              }
                             if ((&editing_allowed($escsymb.':::'.$idx,$group)) && ($outputtarget ne 'tex')) {                              if ($outputtarget ne 'tex') {
                                 if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {                                  if (&editing_allowed($escsymb.':::'.$idx,$group)) {
                                     $sender.=' <a href="/adm/feedback?editdisc='.                                      if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
                                          $escsymb.':::'.$idx;                                          $sender.=' '.
                                     if ($$newpostsflag) {                                           &discussion_link($symb,&mt('Edit'),'editdisc',$idx,$$newpostsflag,$prevread,&group_args($group));
                                         $sender .= '&amp;previous='.$prevread;                                          unless ($seeid) {
                                     }                                              my $grpargs = &group_args($group);
     $sender .= &group_args($group);                                              $sender.=" <a href=\"javascript:verifydelete('studentdelete','$escsymb','$idx','$$newpostsflag','$prevread','$grpargs')";
                                     $sender .= '" '.$target.'>'.&mt('Edit').'</a>';                                              $sender .= '">'.&mt('Delete').'</a>';
                                                                               }
                                     unless ($seeid) {  
                                         my $grpargs = &group_args($group);  
                                         $sender.=" <a href=\"javascript:verifydelete('studentdelete','$escsymb','$idx','$$newpostsflag','$prevread','$grpargs')";  
                                         $sender .= '">'.&mt('Delete').'</a>';  
                                     }                                      }
                                 }                                  }
                             }           if ($seeid) {
     if (($seeid) && ($outputtarget ne 'tex')) {              if ($hiddens{$idx}) {
         if ($hidden) {                                          unless ($studenthidden) {
                                     unless ($studenthidden) {                              $sender.=' '.
                 $sender.=' <a href="/adm/feedback?unhide='.                                              &discussion_link($symb,&mt('Make Visible'),'unhide',$idx,$$newpostsflag,$prevread,&group_args($group));
                 $escsymb.':::'.$idx;  
                                         if ($$newpostsflag) {  
                                             $sender .= '&amp;previous='.$prevread;  
                                         }                                          }
                                         $sender .= '">'.&mt('Make Visible').'</a>';              } else {
                                     }                                          $sender.=' '.
         } else {                                           &discussion_link($symb,&mt('Hide'),'hide',$idx,$$newpostsflag,$prevread,&group_args($group));
     $sender.=' <a href="/adm/feedback?hide='.              }
         $escsymb.':::'.$idx;                                      my $grpargs = &group_args($group);
                                     if ($$newpostsflag) {              $sender.= 
                                         $sender .= '&amp;previous='.$prevread;                                          " <a href=\"javascript:verifydelete('seeiddelete','$escsymb','$idx','$$newpostsflag','$prevread','$grpargs')\">";
                                     }                                      $sender .= &mt('Delete').'</a>';
     $sender .= &group_args($group);                                  }
                                     $sender .= '">'.&mt('Hide').'</a>';  
         }  
                                 my $grpargs = &group_args($group);  
         $sender.=   
                                     " <a href=\"javascript:verifydelete('seeiddelete','$escsymb','$idx','$$newpostsflag','$prevread','$grpargs')\">";  
                                 $sender .= &mt('Delete').'</a>';  
                             }                              }
         } else {                          } else {
     if ($screenname) {      if ($screenname) {
         $sender='<i>'.$screenname.'</i>';          $sender='<i>'.$screenname.'</i>';
     } else {      } else {
Line 1137  sub build_posting_display { Line 1155  sub build_posting_display {
                                 @{$$namesort{'__anon'}{'__anon'}} = ("$idx");                                  @{$$namesort{'__anon'}{'__anon'}} = ("$idx");
                             }                              }
         }          }
         if ((&discussion_open($status)) && ($outputtarget ne 'tex')) {                          if ($outputtarget ne 'tex') {
                             if (($group ne '') &&               if (&discussion_open($status)) {
                                 (&check_group_priv($group,'pgd') eq 'ok')) {                                  if (($group ne '') && 
                                  $sender.=' <a href="/adm/feedback?replydisc='.                                      (&check_group_priv($group,'pgd') eq 'ok')) {
                                           $escsymb.':::'.$idx;                                       $sender.=' '.
                                 if ($$newpostsflag) {                                           &discussion_link($symb,&mt('Reply'),'replydisc',$idx,$$newpostsflag,$prevread,&group_args($group));
                                     $sender .= '&amp;previous='.$prevread;                                  } elsif (&Apache::lonnet::allowed('pch', 
                                 }       $env{'request.course.id'}.
                                 $sender .= &group_args($group);       ($env{'request.course.sec'}?'/'.
                                 $sender .= '" '.$target.'>'.&mt('Reply').'</a>';                                        $env{'request.course.sec'}:''))) {
                             } elsif (&Apache::lonnet::allowed('pch',                $sender.=' '.
  $env{'request.course.id'}.                                           &discussion_link($symb,&mt('Reply'),'replydisc',$idx,$$newpostsflag,$prevread);
  ($env{'request.course.sec'}?'/'.  
                                   $env{'request.course.sec'}:''))) {  
          $sender.=' <a href="/adm/feedback?replydisc='.  
                   $escsymb.':::'.$idx;  
                                 if ($$newpostsflag) {  
                                     $sender .= '&amp;previous='.$prevread;  
                                 }                                  }
                                 $sender .= '" '.$target.'>'.&mt('Reply').'</a>';  
                             }                              }
                         }              if ($viewgrades) {
         if (($viewgrades) && ($outputtarget ne 'tex')) {  
         $vgrlink=&Apache::loncommon::submlink(&mt('Submissions'),          $vgrlink=&Apache::loncommon::submlink(&mt('Submissions'),
                             $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb);                                  $contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb);
         }              }
                         if (($$dischash{$readkey}=~/\.$idx\./) && ($outputtarget ne 'tex')) {                               if ($$dischash{$readkey}=~/\.$idx\./) { 
                             $ctlink = '<label><b>'.&mt('Mark unread').'?</b>&nbsp;<input type="checkbox" name="postunread_'.$idx.'" /></label>';                                  $ctlink = '<label><b>'.&mt('Mark unread').'?</b>&nbsp;<input type="checkbox" name="postunread_'.$idx.'" /></label>';
                         } else {                              } else {
                             $ctlink = '<label><b>'.&mt('Mark read').'?</b>&nbsp;<input type="checkbox" name="postread_'.$idx.'" /></label>';                                  $ctlink = '<label><b>'.&mt('Mark read').'?</b>&nbsp;<input type="checkbox" name="postread_'.$idx.'" /></label>';
                               }
                         }                          }
                     }                      }
 #figure out at what position this needs to print  #figure out at what position this needs to print
Line 1183  sub build_posting_display { Line 1194  sub build_posting_display {
                 if ($outputtarget eq 'export') {                  if ($outputtarget eq 'export') {
                     %{$$imsitems{$idx}} = ();                      %{$$imsitems{$idx}} = ();
                     $$imsitems{$idx}{'isvisible'}='true';                      $$imsitems{$idx}{'isvisible'}='true';
                     if ($hidden) {                      if ($hiddens{$idx}) {
                         $$imsitems{$idx}{'isvisible'}='false';                          $$imsitems{$idx}{'isvisible'}='false';
                     }                      }
                     $$imsitems{$idx}{'title'}=$subjects{$numoldver};                      $$imsitems{$idx}{'title'}=$subjects{$numoldver};
Line 1286  sub build_posting_display { Line 1297  sub build_posting_display {
                                 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.');
                                 if ($seeid) {                                  if ($seeid) {
                                     $$discussionitems[$idx] .= '&nbsp;&nbsp;<a href="/adm/feedback?allversions='.$escsymb.':::'.$idx;                                      $$discussionitems[$idx] .= '&nbsp;&nbsp;'.
     $$discussionitems[$idx] .= &group_args($group);                                           &discussion_link($symb,&mt('Display all versions'),'allversions',$idx,$$newpostsflag,$prevread,&group_args($group));
                                     $$discussionitems[$idx] .= '">'.&mt('Display all versions').'</a>';  
                                 }                                  }
                                 $$discussionitems[$idx].='<br/>'.&mt('Earlier version(s) were posted on: ');                                  $$discussionitems[$idx].='<br/>'.&mt('Earlier version(s) were posted on: ');
                                 if ($contrib{$idx.':history'} =~ m/:/) {                                  if ($contrib{$idx.':history'} =~ m/:/) {
Line 1644  END Line 1654  END
       $comment = &unescape($env{'form.comment'});        $comment = &unescape($env{'form.comment'});
       &process_attachments(\@currnewattach,\@currdelold,\@keepold);        &process_attachments(\@currnewattach,\@currdelold,\@keepold);
   }    }
   my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(undef,undef,1);    my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(undef,undef,1,'popup');
   my $send=&mt('Send');    my $send=&mt('Send');
   my $alert = &mt('Please select a feedback type.');    my $alert = &mt('Please select a feedback type.');
   my $js= <<END;    my $js= <<END;
Line 1690  END Line 1700  END
   if (&Apache::lonhtmlcommon::htmlareabrowser()) {    if (&Apache::lonhtmlcommon::htmlareabrowser()) {
       $textareaheader = &Apache::lonhtmlcommon::htmlareaselectactive();        $textareaheader = &Apache::lonhtmlcommon::htmlareaselectactive();
       $textareaclass = 'class="LC_richDefaultOff"';        $textareaclass = 'class="LC_richDefaultOff"';
         if ($env{'request.course.id'}) {
             unless (($env{'course.'.$env{'request.course.id'}.'.allow_limited_html_in_feedback'} =~ /^\s*yes\s*$/i) || ($env{'form.sendmessageonly'})) {
                 undef($textareaclass);
             }
         }
   }    }
   
   # Breadcrumbs    # Breadcrumbs
Line 1697  END Line 1712  END
                  'text' => 'Resource Feedback and Discussion'}];                   'text' => 'Resource Feedback and Discussion'}];
   
   my %onload = ('onload' => 'window.focus();setposttype();');    my %onload = ('onload' => 'window.focus();setposttype();');
     my %parms=('add_entries' => \%onload);
     if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum }
   my $start_page=    my $start_page=
       &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,        &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,\%parms);
                                      {'add_entries' => \%onload,  
                                       'bread_crumbs' => $brcrum,});  
   
   if ($quote ne '') {    if ($quote ne '') {
       $quote = &HTML::Entities::decode($quote);        $quote = &HTML::Entities::decode($quote);
Line 1709  END Line 1724  END
       }        }
       $quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($quote).'</blockquote>';        $quote='<blockquote>'.&Apache::lontexconvert::msgtexconverted($quote).'</blockquote>';
   }    }
     my $header='';
     unless ($env{'form.modal'}) {
        $header="<h2><tt>$restitle</tt></h2>";
     }
   $r->print(<<END);    $r->print(<<END);
 $start_page  $start_page
 <h2><tt>$restitle</tt></h2>  $header
 <form action="/adm/feedback" method="post" name="mailform"  <form action="/adm/feedback" method="post" name="mailform"
 enctype="multipart/form-data">  enctype="multipart/form-data">
 $prevtag  $prevtag
 <input type="hidden" name="postdata" value="$feedurl" />  <input type="hidden" name="postdata" value="$feedurl" />
   <input type="hidden" name="modal" value="$env{'form.modal'}" />
 END  END
   if ($env{'form.replydisc'}) {    if ($env{'form.replydisc'}) {
       $r->print(<<END);        $r->print(<<END);
Line 1729  END Line 1748  END
 END  END
   }    }
   $r->print(<<END);    $r->print(<<END);
 $options<hr />  $options
 $quote  $quote
 <p>$lt{'myqu'}  <p>$lt{'myqu'}
 $textareaheader  $textareaheader
Line 2266  sub print_showposters { Line 2285  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 2539  sub redirect_back { Line 2558  sub redirect_back {
   }     } 
   &Apache::lonenc::check_encrypt(\$feedurl);    &Apache::lonenc::check_encrypt(\$feedurl);
   my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');    my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
   my %onload;    my %parms=('only_body'   => 1);
     if ($env{'form.modal'}) {
         $parms{'add_entries'}={'onLoad' => 'document.forms.reldt.submit()'};
     } else {
         $parms{'redirect'}=[0,$feedurl];
     }
   my $start_page=    my $start_page=
       &Apache::loncommon::start_page('Feedback sent',undef,        &Apache::loncommon::start_page('Feedback sent',undef,\%parms);
      {'redirect'    => [0,$feedurl],  
       'only_body'   => 1,  
       'add_entries' => \%onload});  
   my $end_page = &Apache::loncommon::end_page();    my $end_page = &Apache::loncommon::end_page();
   $r->print(<<ENDREDIR);    $r->print(<<ENDREDIR);
 $start_page  $start_page
Line 2599  ENDNOREDIRTWO Line 2620  ENDNOREDIRTWO
 }  }
   
 sub screen_header {  sub screen_header {
     my ($feedurl,$symb) = @_;      my ($feedurl,$symb,$group) = @_;
     my $crscontent = &mt('Question/Comment/Feedback about course content');      my $crscontent = &mt('Question/Comment/Feedback about course content');
     my $crspolicy = &mt('Question/Comment/Feedback about course policy');      my $crspolicy = &mt('Question/Comment/Feedback about course policy');
     my $contribdisc = &mt('Contribution to course discussion of resource');      my $contribdisc = &mt('Contribution to course discussion of resource');
Line 2648  sub screen_header { Line 2669  sub screen_header {
     }      }
     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');
         if (!$blocked && &discussion_open(undef,$symb) &&           my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     &Apache::lonnet::allowed('pch',          my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
      $env{'request.course.id'}.          my $realsymb = $symb;
      ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {          if ($symb=~/^bulletin___/) {
               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.   $contribdisc.
         '</label><br /><label><input type="radio" name="discuss" value="anon" /> '.          '</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
Line 2665  sub screen_header { Line 2695  sub screen_header {
         }          }
     }      }
     if ($msgoptions) {      if ($msgoptions) {
         $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/feedback.png').'" />'          $msgoptions='<tr><th><img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/feedback.png').'" />'
                    .' '.&mt('Send Feedback').'</h2><p>'.&Apache::lonhtmlcommon::coursepreflink(&mt('Feedback Settings'),'feedback').'</p>'                     .'<br />'.&mt('Send Feedback').'<br />'.&Apache::lonhtmlcommon::coursepreflink(&mt('Feedback Settings'),'feedback').'</th>'.
                    .$msgoptions;                     '<td>'.$msgoptions.'</td></tr>';
     }      }
     if ($discussoptions) {       if ($discussoptions) { 
  $discussoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" alt="" />'   $discussoptions='<tr><th><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" alt="" />'
                         .' '.&mt('Discussion Contributions').'</h2><p>'.&Apache::lonhtmlcommon::coursepreflink(&mt('Discussion Settings'),'discussion').'</p>'                          .'<br />'.&mt('Discussion Contributions').'<br />'.&Apache::lonhtmlcommon::coursepreflink(&mt('Discussion Settings'),'discussion').'</th>'.
                         .$discussoptions;                          '<td>'.$discussoptions.'</td></tr>';
     }      }
     return $msgoptions.$discussoptions;      return  &Apache::loncommon::start_data_table().$msgoptions.$discussoptions.&Apache::loncommon::end_data_table();
 }  }
   
 sub resource_output {  sub resource_output {
Line 2790  sub send_msg { Line 2820  sub send_msg {
 }  }
   
 sub adddiscuss {  sub adddiscuss {
     my ($symb,$email,$anon,$attachmenturl,$subject)=@_;      my ($symb,$email,$anon,$attachmenturl,$subject,$group)=@_;
     my $status='';      my $status='';
     my $realsymb;      my $realsymb;
     if ($symb=~/^bulletin___/) {      if ($symb=~/^bulletin___/) {
Line 2798  sub adddiscuss { Line 2828  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 3058  END Line 3095  END
     # Breadcrumbs      # Breadcrumbs
     my $brcrum = [{'href' => '',      my $brcrum = [{'href' => '',
                    'text' => 'Discussion Post Attachments'}];                     'text' => 'Discussion Post Attachments'}];
       my %parms=();
       if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum }
   
     my $start_page =       my $start_page = 
  &Apache::loncommon::start_page('Discussion Post Attachments',$js,   &Apache::loncommon::start_page('Discussion Post Attachments',$js,\%parms);
                                    {'bread_crumbs' => $brcrum,});  
   
     my $orig_subject = &unescape($env{'form.subject'});      my $orig_subject = &unescape($env{'form.subject'});
     my $subject=&clear_out_html($orig_subject);      my $subject=&clear_out_html($orig_subject);
Line 3421  sub handler { Line 3460  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','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','groupick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export','sendmessageonly','group','ref']);           ['modal','hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','groupick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export','sendmessageonly','group','ref']);
   my $group = $env{'form.group'};    my $group = $env{'form.group'};
   my %attachmax = (    my %attachmax = (
                     text => &mt('(128 KB max size)'),                      text => &mt('(128 KB max size)'),
Line 3472  sub handler { Line 3511  sub handler {
       # Breadcrumbs        # Breadcrumbs
       my $brcrum = [{'href' => '',        my $brcrum = [{'href' => '',
                      'text' => 'Discussion Post Versions'}];                       'text' => 'Discussion Post Versions'}];
         
         my %parms=();
         if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum }
   
       $r->print(&Apache::loncommon::start_page('Discussion Post Versions',undef,        $r->print(&Apache::loncommon::start_page('Discussion Post Versions',undef,\%parms));
                                                {'bread_crumbs' => $brcrum,})  
       );  
   
       my $crs='/'.$env{'request.course.id'};        my $crs='/'.$env{'request.course.id'};
       if ($env{'request.course.sec'}) {        if ($env{'request.course.sec'}) {
Line 3767  ENDREDIR Line 3807  ENDREDIR
       my $mode='board';        my $mode='board';
       my $status='OPEN';        my $status='OPEN';
       my $previous=$env{'form.previous'};        my $previous=$env{'form.previous'};
       if ($feedurl =~ /\.(problem|exam|quiz|assess|survey|form|library|task)$/) {        if ($feedurl =~ /$LONCAPA::assess_re/) {
           $mode='problem';            $mode='problem';
           $status=$Apache::inputtags::status[-1];            $status=$Apache::inputtags::status[-1];
       }        }
Line 3807  ENDREDIR Line 3847  ENDREDIR
           &dewrapper(\$feedurl);            &dewrapper(\$feedurl);
       }        }
       my $goahead=1;        my $goahead=1;
       if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form|task)$/) {        if ($feedurl=~/$LONCAPA::assess_re/) {
   unless ($symb) { $goahead=0; }    unless ($symb) { $goahead=0; }
       }        }
       if (!$goahead) {        if (!$goahead) {
Line 3845  ENDREDIR Line 3885  ENDREDIR
                   return OK;                    return OK;
               }                }
           }            }
   my $options=&screen_header($feedurl,$symb);    my $options=&screen_header($feedurl,$symb,$group);
   if ($options) {    if ($options) {
       &mail_screen($r,$feedurl,$options,$symb,$attachmax{'text'});        &mail_screen($r,$feedurl,$options,$symb,$attachmax{'text'});
   } else {    } else {
Line 3901  ENDREDIR Line 3941  ENDREDIR
           }            }
       }        }
 # Filter HTML out of message (could be nasty)  # Filter HTML out of message (could be nasty)
       my $message=&clear_out_html($env{'form.comment'});        my $override;
         if ($env{'form.discuss'} =~ /^(?:author|question|course|policy)$/) {
             $override = 1;
         }
         my $message=&clear_out_html($env{'form.comment'},$override);
   
 # Assemble email  # Assemble email
       my ($email,$citations)=&assemble_email($message,$prevattempts,        my ($email,$citations)=&assemble_email($message,$prevattempts,
Line 3923  ENDREDIR Line 3967  ENDREDIR
   my $subject = &clear_out_html($env{'form.subject'});    my $subject = &clear_out_html($env{'form.subject'});
   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);    $subject,$group);
   $numpost++;    $numpost++;
       }        }
   

Removed from v.1.298  
changed lines
  Added in v.1.311


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