Diff for /loncom/interface/lonfeedback.pm between versions 1.290.2.7 and 1.303

version 1.290.2.7, 2010/12/24 23:18:57 version 1.303, 2010/11/19 20:32:38
Line 58  sub discussion_open { Line 58  sub discussion_open {
         return 1;          return 1;
     }      }
 # It was not explicitly open, check if the problem is available.  # It was not explicitly open, check if the problem is available.
 # If the problem is not available, close the discussion  # 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  # The problem is available, but check if the instructor explictly closed discussion
     if (defined($close) && $close ne '' && $close < time) {      if (defined($close) && $close ne '' && $close < time) {
         return 0;   return 0;
     }      }
     return 1;      return 1;
 }  }
Line 282  sub list_discussion { Line 282  sub list_discussion {
     my %anonhash=();      my %anonhash=();
     my $anoncnt=0;      my $anoncnt=0;
     my $target='';      my $target='';
     unless ($env{'browser.interface'} eq 'textual' ||  
     $env{'environment.remote'} eq 'off' ) {  
  $target='target="LONcom"';  
     }  
   
     my $now = time;      my $now = time;
     $discinfo{$visitkey} = $visit;      $discinfo{$visitkey} = $visit;
Line 425  imscp_v1p1.xsd http://www.imsglobal.org/ Line 421  imscp_v1p1.xsd http://www.imsglobal.org/
             }              }
  } else {   } else {
             my $colspan=$maxdepth+1;              my $colspan=$maxdepth+1;
 #JW  
             $discussion.= &Apache::lonhtmlcommon::scripttag(qq|              $discussion.= &Apache::lonhtmlcommon::scripttag(qq|
    function verifydelete (caller,symb,idx,newflag,previous,groupparm) {     function verifydelete (caller,symb,idx,newflag,previous,groupparm) {
        var symbparm = symb+':::'+idx         var symbparm = symb+':::'+idx
Line 728  END Line 723  END
             }              }
         }          }
  if ((&discussion_open($status)) && ($outputtarget ne 'tex')) {   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 741  END Line 735  END
                 if (&Apache::lonnet::allowed('pch',$env{'request.course.id'}.                  if (&Apache::lonnet::allowed('pch',$env{'request.course.id'}.
                     ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {                      ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
   
                     $discussion.=              $discussion.= 
                         &postingform_display($mode,$ressymb,$now,$subject,          &postingform_display($mode,$ressymb,$now,$subject,
                                              $comment,$outputtarget,$attachnum,       $comment,$outputtarget,$attachnum,
                                              $currnewattach,$currdelold,'',$crstype);       $currnewattach,$currdelold,'',$crstype);
                 } else {                  } else {
                     $discussion.= '<span class="LC_feedback_link">'.                      $discussion.= '<span class="LC_feedback_link">'.
                                   &mt('This discussion is closed.').'</span>';                                    &mt('This discussion is closed.').'</span>';
Line 761  END Line 755  END
             &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'}:''))) {
     $discussion.= &send_feedback_link($ressymb,$target);              $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) {
Line 769  END Line 763  END
                                                 &Apache::lonnet::plaintext('st',$crstype));                                                  &Apache::lonnet::plaintext('st',$crstype));
                 }                  }
             }              }
         } else {   } else {
             $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';              $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';
         }          }
  $discussion.= &send_message_link($ressymb).'</div>';   $discussion.= &send_message_link($ressymb).'</div>';
Line 904  ENDDISCUSS Line 898  ENDDISCUSS
     }      }
     $postingform .= "</form>\n";      $postingform .= "</form>\n";
     $postingform .= &generate_attachments_button('',$attachnum,$ressymb,      $postingform .= &generate_attachments_button('',$attachnum,$ressymb,
                                                  $now,$currnewattach,                                                       $now,$currnewattach,
                                                  $currdelold,'',$mode,                                                       $currdelold,'',$mode,
                                                  $blockblog);                                                       $blockblog);
     if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {      if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {
         $newattachmsg = '<br /><b>'.$lt{'newa'}.'</b><br />';          $newattachmsg = '<br /><b>'.$lt{'newa'}.'</b><br />';
         if (@{$currnewattach} > 1) {          if (@{$currnewattach} > 1) {
             $newattachmsg .= '<ol>';               $newattachmsg .= '<ol>';
             foreach my $item (@{$currnewattach}) {               foreach my $item (@{$currnewattach}) {
                 $item =~ m#.*/([^/]+)$#;                  $item =~ m#.*/([^/]+)$#;
                 $newattachmsg .= '<li><a href="'.$item.'">'.$1.'</a></li>'."\n";                  $newattachmsg .= '<li><a href="'.$item.'">'.$1.'</a></li>'."\n";
             }               }
             $newattachmsg .= '</ol>'."\n";               $newattachmsg .= '</ol>'."\n";
         } else {           } else {
             $$currnewattach[0] =~ m#.*/([^/]+)$#;               $$currnewattach[0] =~ m#.*/([^/]+)$#;
             $newattachmsg .= '<a href="'.$$currnewattach[0].'">'.$1.'</a><br />'."\n";               $newattachmsg .= '<a href="'.$$currnewattach[0].'">'.$1.'</a><br />'."\n";
         }           }
     }      }
     $postingform .= $newattachmsg;      $postingform .= $newattachmsg;
     $postingform .= &generate_preview_button();      $postingform .= &generate_preview_button();
Line 999  sub build_posting_display { Line 993  sub build_posting_display {
     } else {      } else {
  $$replies[$$depth[$idx]]=1;   $$replies[$$depth[$idx]]=1;
     }      }
     unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx})) {              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 1115  sub build_posting_display { Line 1109  sub build_posting_display {
                                         }                                          }
                                     }                                      }
                                 }                                  }
                                 if ($seeid) {          if ($seeid) {
             if ($hiddens{$idx}) {              if ($hiddens{$idx}) {
                                         unless ($studenthidden) {                                          unless ($studenthidden) {
                     $sender.=' <a href="/adm/feedback?unhide='.                      $sender.=' <a href="/adm/feedback?unhide='.
                     $escsymb.':::'.$idx;                       $escsymb.':::'.$idx;
                                             if ($$newpostsflag) {                                              if ($$newpostsflag) {
                                                 $sender .= '&amp;previous='.$prevread;                                                  $sender .= '&amp;previous='.$prevread;
                                             }                                              }
Line 1127  sub build_posting_display { Line 1121  sub build_posting_display {
                                         }                                          }
             } else {              } else {
         $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 .= '&amp;previous='.$prevread;
                                         }                                          }
Line 1140  sub build_posting_display { Line 1134  sub build_posting_display {
                                     $sender .= &mt('Delete').'</a>';                                      $sender .= &mt('Delete').'</a>';
                                 }                                  }
                             }                              }
         } else {                          } else {
     if ($screenname) {      if ($screenname) {
         $sender='<i>'.$screenname.'</i>';          $sender='<i>'.$screenname.'</i>';
     } else {      } else {
Line 1167  sub build_posting_display { Line 1161  sub build_posting_display {
                             }                              }
         }          }
                         if ($outputtarget ne 'tex') {                          if ($outputtarget ne 'tex') {
                             if (&discussion_open($status)) {              if (&discussion_open($status)) {
                                 if (($group ne '') &&                                   if (($group ne '') && 
                                     (&check_group_priv($group,'pgd') eq 'ok')) {                                      (&check_group_priv($group,'pgd') eq 'ok')) {
                                      $sender.=' <a href="/adm/feedback?replydisc='.                                       $sender.=' <a href="/adm/feedback?replydisc='.
Line 1189  sub build_posting_display { Line 1183  sub build_posting_display {
                                     $sender .= '" '.$target.'>'.&mt('Reply').'</a>';                                      $sender .= '" '.$target.'>'.&mt('Reply').'</a>';
                                 }                                  }
                             }                              }
                             if ($viewgrades) {              if ($viewgrades) {
         $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\./) {                              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>';
Line 1776  $latexHelp Line 1770  $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"  $textareaclass>$comment  <textarea name="comment" id="comment" cols="60" rows="10" $textareaclass>$comment
 </textarea></p>  </textarea></p>
 END  END
     if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {      if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
Line 2302  sub print_showposters { Line 2296  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 2576  sub redirect_back { Line 2570  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 %onload;
   if ($env{'environment.remote'} ne 'off') {  
       $onload{'onload'} =  
   "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }";  
   }  
   my $start_page=    my $start_page=
       &Apache::loncommon::start_page('Feedback sent',undef,        &Apache::loncommon::start_page('Feedback sent',undef,
      {'redirect'    => [0,$feedurl],       {'redirect'    => [0,$feedurl],
Line 2613  sub no_redirect_back { Line 2603  sub no_redirect_back {
   my $nofeed=&mt('Sorry, no feedback possible on this resource ...');    my $nofeed=&mt('Sorry, no feedback possible on this resource ...');
     
   my %onload;    my %onload;
   if ($env{'environment.remote'} ne 'off') {  
       $onload{'onload'} =   
   "if (window.name!='loncapaclient') { self.window.close(); }";  
   }  
   
   my %body_options = ('only_body'   => 1,    my %body_options = ('only_body'   => 1,
       'bgcolor'     => '#FFFFFF',        'bgcolor'     => '#FFFFFF',
Line 2692  sub screen_header { Line 2678  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');
         my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};  
         my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};  
         my $realsymb = $symb;          my $realsymb = $symb;
         if ($symb=~/^bulletin___/) {          if ($symb=~/^bulletin___/) {
             my $filename=(&Apache::lonnet::decode_symb($symb))[2];              my $filename=(&Apache::lonnet::decode_symb($symb))[2];
Line 2702  sub screen_header { Line 2686  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 '') && (&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')))) {  
     $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 2755  sub clear_out_html { Line 2738  sub clear_out_html {
       # <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> <TABLE> <TR> <TD> <TH> <TBODY>
       %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, PRE=>1, DIV=>1, IMG=>1,       BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, PRE=>1, DIV=>1, IMG=>1,
              M=>1, CHEM=>1, ALGEBRA=>1, SUB=>1, SUP=>1, SPAN=>1,       M=>1, CHEM=>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, H6=>1, 
      TABLE=>1, TR=>1, TD=>1, TH=>1, TBODY=>1);       TABLE=>1, TR=>1, TD=>1, TH=>1, TBODY=>1);
   }    }
Line 2851  sub adddiscuss { Line 2834  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') &&           ($group ne '' && &check_group_priv($group,'pgd')))) {
          ($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 3639  sub handler { Line 3616  sub handler {
       $r->send_http_header;        $r->send_http_header;
       my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');        my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
       my %onload;        my %onload;
       if ($env{'environment.remote'} ne 'off') {  
   $onload{'onload'} =  
       "if (window.name!='loncapaclient') { this.document.reldt.submit(); self.window.close(); }";  
       }  
   
       my $start_page=        my $start_page=
   &Apache::loncommon::start_page('New posts marked as read',undef,    &Apache::loncommon::start_page('New posts marked as read',undef,

Removed from v.1.290.2.7  
changed lines
  Added in v.1.303


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