Diff for /loncom/interface/lonfeedback.pm between versions 1.370.2.6 and 1.389

version 1.370.2.6, 2022/01/19 01:35:58 version 1.389, 2022/01/18 17:33:13
Line 118  sub list_discussion { Line 118  sub list_discussion {
             $outputtarget = 'export';              $outputtarget = 'export';
         }          }
     }      }
       my ($nofooter,$nodisclink,$nofdbklink);
     if (not &discussion_visible($status)) {      if (not &discussion_visible($status)) {
         if ($mode ne 'board') {          if ($mode ne 'board') {
             &Apache::lonenc::check_encrypt(\$ressymb);               ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll();
             return '<br /><div class="LC_feedback_link">'.&send_message_link($ressymb)."</div>";              if ($nofooter || $nofdbklink) {
                   return '<br />';
               } else {
                   &Apache::lonenc::check_encrypt(\$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 130  sub list_discussion { Line 136  sub list_discussion {
         }          }
     }      }
   
     my ($blocked,$blocktext) =       unless ($outputtarget eq 'export') {
         &Apache::loncommon::blocking_status('boards');          ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll();
     if ($blocked) {      }
         $blocktext = '<br /><div class="LC_feedback_link"><span class="LC_feedback_link">'.$blocktext."</span>";  
         &Apache::lonenc::check_encrypt(\$ressymb);      unless ($nofooter) {
         if ($mode ne 'board') {          my ($blocked,$blocktext) = 
             $blocktext.=&send_message_link($ressymb).'</div>';              &Apache::loncommon::blocking_status('boards');
         }else{          if ($blocked) {
             $blocktext.="</div>";              my $footer = '<br /><div class="LC_feedback_link">';
               unless ($nodisclink) {
                   $footer .= '<span class="LC_feedback_link">'.$blocktext.'</span>';
               }
               &Apache::lonenc::check_encrypt(\$ressymb);
               if ($mode ne 'board') {
                   unless ($nofdbklink) {
                       $footer.=&send_message_link($ressymb);
                   }
               }
               $footer.='</div>';
               return $footer;
         }          }
         return $blocktext;   
     }      }
   
     my @bgcols = ("LC_disc_old_item","LC_disc_new_item");      my @bgcols = ("LC_disc_old_item","LC_disc_new_item");
Line 674  END Line 690  END
                                              $newpostsflag,$group,                                               $newpostsflag,$group,
                                              $prevread,$markondisp,$seehidden);                                               $prevread,$markondisp,$seehidden);
             $discussion .= "</table></form>\n";              $discussion .= "</table></form>\n";
         }           }
         if ($outputtarget eq 'export') {          if ($outputtarget eq 'export') {
             if ($manifestok) {              if ($manifestok) {
                 while ($currdepth > 0) {                  while ($currdepth > 0) {
Line 774  END Line 790  END
                           &mt('This discussion is closed.').'</span>';                            &mt('This discussion is closed.').'</span>';
         }          }
     } elsif ($outputtarget ne 'tex') {      } elsif ($outputtarget ne 'tex') {
         $discussion.='<div class="LC_feedback_link">';          unless ($nofooter) {
         if (&discussion_open($status) &&              $discussion.='<div class="LC_feedback_link">';
             &Apache::lonnet::allowed('pch',              unless ($nodisclink) {
            $env{'request.course.id'}.                  if (&discussion_open($status) &&
         ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {                      &Apache::lonnet::allowed('pch',
             $discussion.= &send_feedback_link($ressymb);                     $env{'request.course.id'}.
             if ($env{'request.role.adv'}) {                  ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
                 my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);                      $discussion.= &send_feedback_link($ressymb);
                 my $canvote = &Apache::lonnet::EXT('resource.0.discussvote',$ressymb);                      if ($env{'request.role.adv'}) {
                 if (defined($close) && $close ne '' && $close < time) {                          my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
                     if ($canvote eq 'notended') {                          my $canvote = &Apache::lonnet::EXT('resource.0.discussvote',$ressymb);
                         $discussion .= '&nbsp;'.&mt('(Posting and voting closed for [_1] roles)',                          if (defined($close) && $close ne '' && $close < time) {
                                                     &Apache::lonnet::plaintext('st',$crstype));                              if ($canvote eq 'notended') {
                     } else {                                  $discussion .= '&nbsp;'.&mt('(Posting and voting closed for [_1] roles)',
                         $discussion .= '&nbsp;'.&mt('(Closed for [_1] roles)',                                                              &Apache::lonnet::plaintext('st',$crstype));
                                                     &Apache::lonnet::plaintext('st',$crstype));                              } else {
                                   $discussion .= '&nbsp;'.&mt('(Closed for [_1] roles)',
                                                               &Apache::lonnet::plaintext('st',$crstype));
                               }
                           }
                     }                      }
           } else {
                       $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';
                 }                  }
             }              }
  } else {              unless ($nofdbklink) {
             $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';          $discussion.= &send_message_link($ressymb);
               }
               $discussion.='</div>';
         }          }
  $discussion.= &send_message_link($ressymb).'</div>';  
     }      }
     return $discussion;      return $discussion;
 }  }
   
   sub check_menucoll {
       my ($nofooter,$nodisclink,$nofdbklink);
       my ($menucoll,$deeplinkmenu,$menuref) = &Apache::loncommon::menucoll_in_effect();
       if ($menucoll) {
           if (ref($menuref) eq 'HASH') {
               if ($menuref->{'foot'} eq 'n') {
                   $nofooter = 1;
               } else {
                   unless ($menuref->{'disc'}) {
                       $nodisclink = 1;
                   }
                   unless ($menuref->{'fdbk'}) {
                       $nofdbklink = 1;
                   }
               }
           }
       }
       return ($nofooter,$nodisclink,$nofdbklink);
   }
   
 sub can_see_hidden {  sub can_see_hidden {
     my ($mode,$ressymb,$feedurl,$group,$cdom,$cnum,$crs) = @_;      my ($mode,$ressymb,$feedurl,$group,$cdom,$cnum,$crs) = @_;
     my $seehidden;      my $seehidden;
Line 960  sub postingform_display { Line 1003  sub postingform_display {
             }              }
         }          }
     }      }
       my $postanon;
       if (&Apache::lonnet::allowed('pac',$env{'request.course.id'}.
          ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
           $postanon = '<input type="submit" name="anondiscuss" value="'.$lt{'poan'}.'" />';
       }
     $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'}" />
 <input type="submit" name="anondiscuss" value="$lt{'poan'}" /> <input type="hidden" name="symb" value="$ressymb" />  $postanon<input type="hidden" name="symb" value="$ressymb" />
 <input type="hidden" name="sendit" value="true" />  <input type="hidden" name="sendit" value="true" />
 <input type="hidden" name="timestamp" value="$now" />  <input type="hidden" name="timestamp" value="$now" />
 <a name="newpost"></a>  <a name="newpost"></a>
Line 2067  END Line 2115  END
         $r->print('<input type="hidden" name="ref" value="'.$env{'form.ref'}.'" />');          $r->print('<input type="hidden" name="ref" value="'.$env{'form.ref'}.'" />');
     }      }
     $r->print(<<END);      $r->print(<<END);
 <input type="hidden" name="sendit" value="1" />  <input type="hidden" name="sendit" value="1" /><br /><br />
 <input type="button" value="$send" onclick='gosubmit();' />  <input type="button" value="$send" onclick='gosubmit();' />
 </form>  </form>
 END  END
Line 2715  sub fail_redirect { Line 2763  sub fail_redirect {
   my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');    my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
   my %parms=('only_body'   => 1);    my %parms=('only_body'   => 1);
   if ($delay !~ /^\d+(|\.\d+)$/) {    if ($delay !~ /^\d+(|\.\d+)$/) {
       $delay = 2;        $delay = 0;
   }    }
   if ($env{'form.modal'}) {    if ($env{'form.modal'}) {
       my $onload = 'document.forms.reldt.submit()';        my $onload = 'document.forms.reldt.submit()';
Line 2731  sub fail_redirect { Line 2779  sub fail_redirect {
   }    }
   $r->print(&Apache::loncommon::start_page('Feedback not sent',undef,\%parms));    $r->print(&Apache::loncommon::start_page('Feedback not sent',undef,\%parms));
   my $windowname = 'loncapaclient';    my $windowname = 'loncapaclient';
     if ($env{'request.lti.login'}) {
        $windowname .= 'lti';
     }
   $r->print(<<ENDFAILREDIR);    $r->print(<<ENDFAILREDIR);
 <img align="right" src="$logo" />  <img align="right" src="$logo" />
 <p class="LC_warning">$lt{'sorr'}</p>  <p class="LC_warning">$lt{'sorr'}</p>
Line 2859  sub redirect_back { Line 2910  sub redirect_back {
   my $start_page=    my $start_page=
       &Apache::loncommon::start_page('Feedback sent',undef,\%parms);        &Apache::loncommon::start_page('Feedback sent',undef,\%parms);
   my $end_page = &Apache::loncommon::end_page();    my $end_page = &Apache::loncommon::end_page();
     my $windowname = 'loncapaclient';
     if ($env{'request.lti.login'}) {
        $windowname .= 'lti';
     }
   $r->print(<<ENDREDIR);    $r->print(<<ENDREDIR);
 $start_page  $start_page
 <img align="right" src="$logo" />  <img align="right" src="$logo" />
Line 2867  $typestyle Line 2922  $typestyle
 $blog  $blog
 $toolarge  $toolarge
 <font color="red">$status</font>  <font color="red">$status</font>
 <form name="reldt" action="$feedurl" target="loncapaclient">  <form name="reldt" action="$feedurl" target="$windowname">
 $prevtag  $prevtag
 $sorttag  $sorttag
 $statustag  $statustag
Line 2901  sub no_redirect_back { Line 2956  sub no_redirect_back {
           }            }
           $parms{'add_entries'}={'onload' => $onload};            $parms{'add_entries'}={'onload' => $onload};
           my $windowname = 'loncapaclient';            my $windowname = 'loncapaclient';
             if ($env{'request.lti.login'}) {
                 $windowname .= 'lti';
             }
           $form_for_modal = <<ENDFORM;            $form_for_modal = <<ENDFORM;
 <form name="reldt" action="$feedurl" target="$windowname">  <form name="reldt" action="$feedurl" target="$windowname">
 </form>  </form>
Line 2911  ENDFORM Line 2969  ENDFORM
           $parms{'redirect'}=[$delay,$feedurl];            $parms{'redirect'}=[$delay,$feedurl];
       }        }
   }    }
    
   my $start_page=    my $start_page=
       &Apache::loncommon::start_page('Feedback not sent',undef,        &Apache::loncommon::start_page('Feedback not sent',undef,
      \%parms);       \%parms);
Line 2934  sub screen_header { Line 2993  sub screen_header {
                     question => 'Question about resource content',                      question => 'Question about resource content',
                     comment => 'Question/Comment/Feedback about course content',                      comment => 'Question/Comment/Feedback about course content',
                     policy => 'Question/Comment/Feedback about course policy',                      policy => 'Question/Comment/Feedback about course policy',
                   );                    );  
     my $contribdisc = &mt('Contribution to course discussion of resource');      my $contribdisc = &mt('Contribution to course discussion of resource');
     my $anoncontrib = &mt('Anonymous 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 $namevis = &mt('name only visible to course faculty');
Line 2943  sub screen_header { Line 3002  sub screen_header {
         $crstype = &Apache::loncommon::course_type();          $crstype = &Apache::loncommon::course_type();
         if ($crstype eq 'Community') {          if ($crstype eq 'Community') {
             $default{'comment'} = &mt('Question/Comment/Feedback about community content');              $default{'comment'} = &mt('Question/Comment/Feedback about community content');
             $default{'policy'} = &mt('Question/Comment/Feedback about community policy');              $default{'policy'} = &mt('Question/Comment/Feedback about community policy'); 
             $contribdisc = &mt('Contribution to community discussion of resource');              $contribdisc = &mt('Contribution to community discussion of resource');
             $anoncontrib = &mt('Anonymous contribution to community discussion of resource');              $anoncontrib = &mt('Anonymous contribution to community discussion of resource');
             $namevis = &mt('name only visible to community facilitators');              $namevis = &mt('name only visible to community facilitators');
Line 2976  sub screen_header { Line 3035  sub screen_header {
         if (!$blocked && &discussion_open(undef,$realsymb) &&          if (!$blocked && &discussion_open(undef,$realsymb) &&
             (&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'}:'')) ||
             (($group ne '') && ($symb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$}) && (&check_group_priv($group,'pgd') eq 'ok')))) {              (($group ne '') && ($symb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$}) && (&check_group_priv($group,'pgd') eq 'ok')))) {
             $discoptions{'nonanon'} = 1;              $discoptions{'nonanon'} = 1;
             $discoptions{'anon'} = 1;              if (&Apache::lonnet::allowed('pac',$env{'request.course.id'}.
                  ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
                   $discoptions{'anon'} = 1;
               }
             $blockblog = &Apache::loncommon::blocking_status('blogs');              $blockblog = &Apache::loncommon::blocking_status('blogs');
         }          }
     }      }
Line 2990  sub screen_header { Line 3052  sub screen_header {
     }      }
     if (keys(%fdbkoptions)) {      if (keys(%fdbkoptions)) {
         if ($fdbkoptions{'author'}) {          if ($fdbkoptions{'author'}) {
             $msgoptions =      $msgoptions =
                 '<label><input type="radio" name="discuss" value="author"'.$checkradio.' /> '.   '<label><input type="radio" name="discuss" value="author"'.$checkradio.' /> '.
                 &mt('Feedback to resource author').'</label><br />';   &mt('Feedback to resource author').'</label><br />';
         }   }
         foreach my $item ('question','comment','policy') {          foreach my $item ('question','comment','policy') {
             my $type = $item;              my $type = $item;
             if ($item eq 'comment') {              if ($item eq 'comment') {
Line 3003  sub screen_header { Line 3065  sub screen_header {
             if ($fdbkoptions{$type}) {              if ($fdbkoptions{$type}) {
                 $msgoptions .=                  $msgoptions .=
                     '<label><input type="radio" name="discuss" value="'.$type.'"'.$checkradio.' />'.                      '<label><input type="radio" name="discuss" value="'.$type.'"'.$checkradio.' />'.
                     ($optionhash?$optionhash:$default{$item}).'</label><br />';                      ($optionhash?$optionhash:$default{$item}).'</label><br />'; 
             }      }
         }          }
     }      }
     if (keys(%discoptions)) {      if (keys(%discoptions)) {
Line 3111  sub send_msg { Line 3173  sub send_msg {
     my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,$clientip,%to)=@_;      my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,$clientip,%to)=@_;
     my $status='';      my $status='';
     my $sendsomething=0;      my $sendsomething=0;
     my $delay;      my $delay; 
     my $senthide;      my $senthide;
     my %setters;      my %setters;
     my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) =      my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) =
Line 3600  sub modify_attachments { Line 3662  sub modify_attachments {
    document.modattachments.action = document.modattachments.origpage.value;     document.modattachments.action = document.modattachments.origpage.value;
    document.modattachments.submit();     document.modattachments.submit();
  }   }
 </script>  </script> 
 <script type="text/javascript" src="/res/adm/includes/file_upload.js"></script>  <script type="text/javascript" src="/res/adm/includes/file_upload.js"></script>
 END  END
   
Line 4132  sub handler { Line 4194  sub handler {
   'only_body'   => 1,    'only_body'   => 1,
   'add_entries' => \%onload});    'add_entries' => \%onload});
       my $end_page = &Apache::loncommon::end_page();        my $end_page = &Apache::loncommon::end_page();
         my $windowname = 'loncapaclient';
         if ($env{'request.lti.login'}) {
             $windowname .= 'lti';
         }
       $r->print (<<ENDREDIR);        $r->print (<<ENDREDIR);
 $start_page  $start_page
 <img align="right" src="$logo" />  <img align="right" src="$logo" />
 $textline  $textline
 <form name="reldt" action="$feedurl" target="loncapaclient">  <form name="reldt" action="$feedurl" target="$windowname">
 </form>  </form>
 <br />  <br />
 $end_page  $end_page
Line 4643  ENDREDIR Line 4709  ENDREDIR
   ($env{'request.course.id'} && ($feedurl!~m:^/adm:))    ($env{'request.course.id'} && ($feedurl!~m:^/adm:))
   ||    ||
   ($env{'request.course.id'} && ($symb=~/^bulletin\_\_\_/))    ($env{'request.course.id'} && ($symb=~/^bulletin\_\_\_/))
             ||
             (($env{'request.course.id'}) && ($feedurl =~ /ext\.tool$/))
   ) {    ) {
   &Apache::loncommon::content_type($r,'text/html');    &Apache::loncommon::content_type($r,'text/html');
   $r->send_http_header;    $r->send_http_header;
Line 4668  ENDREDIR Line 4736  ENDREDIR
   if ($options) {    if ($options) {
       &mail_screen($r,$feedurl,$options,$symb,$attachmax{'text'});        &mail_screen($r,$feedurl,$options,$symb,$attachmax{'text'});
   } else {    } else {
       &fail_redirect($r,$feedurl,2);        &fail_redirect($r,$feedurl,1);
   }    }
   return OK;    return OK;
       }        }
Line 4745  ENDREDIR Line 4813  ENDREDIR
      && $env{'form.discuss'} !~ /^(?:author|question|course|policy)/)       && $env{'form.discuss'} !~ /^(?:author|question|course|policy)/)
    || $env{'form.anondiscuss'} ne '') {     || $env{'form.anondiscuss'} ne '') {
   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;
             if (&Apache::lonnet::allowed('pac',$env{'request.course.id'}.
                ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
         $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} );
             }
   $typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl,    $typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl,
   $subject,$group);    $subject,$group);
   $numpost++;    $numpost++;

Removed from v.1.370.2.6  
changed lines
  Added in v.1.389


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