Diff for /loncom/interface/lonfeedback.pm between versions 1.117 and 1.124

version 1.117, 2004/08/19 02:08:27 version 1.124, 2004/09/13 12:19:14
Line 41  use Apache::lonspeller(); Line 41  use Apache::lonspeller();
 use Cwd;  use Cwd;
   
 sub discussion_open {  sub discussion_open {
     my ($status)=@_;      my ($status,$symb)=@_;
     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;
     }      }
     my $close=&Apache::lonnet::EXT('resource.0.discussend');      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 59  sub discussion_visible { Line 59  sub discussion_visible {
     if (not &discussion_open($status)) {      if (not &discussion_open($status)) {
  my $hidden=&Apache::lonnet::EXT('resource.0.discusshide');   my $hidden=&Apache::lonnet::EXT('resource.0.discusshide');
  if (lc($hidden) eq 'yes' or $hidden eq '' or !defined($hidden))  {   if (lc($hidden) eq 'yes' or $hidden eq '' or !defined($hidden))  {
     return 0;      if (!$ENV{'request.role.adv'}) { return 0; }
  }   }
     }      }
     return 1;      return 1;
Line 177  sub list_discussion { Line 177  sub list_discussion {
   
 # Override user's default if user specified display setting for this discussion  # Override user's default if user specified display setting for this discussion
     if (defined($dischash{$ondispkey})) {      if (defined($dischash{$ondispkey})) {
         $markondisp = $dischash{$ondispkey};          unless ($dischash{$ondispkey} eq '') {
               $markondisp = $dischash{$ondispkey};
           }
     }      }
     if ($markondisp) {      if ($markondisp) {
         $discinfo{$lastkey} = time;          $discinfo{$lastkey} = time;
     }      }
   
     if (defined($dischash{$showkey})) {      if (defined($dischash{$showkey})) {
         $showonlyunread = $dischash{$showkey};          unless ($dischash{$showkey} eq '') {
               $showonlyunread = $dischash{$showkey};
           }
     }      }
   
     if (defined($dischash{$markkey})) {      if (defined($dischash{$markkey})) {
         $showunmark = $dischash{$markkey};          unless ($dischash{$markkey} eq '') {
               $showunmark = $dischash{$markkey};
           }
     }      }
   
     if (defined($dischash{$visitkey})) {      if (defined($dischash{$visitkey})) {
         $visit = $dischash{$visitkey};          unless ($dischash{$visitkey} eq '') {
               $visit = $dischash{$visitkey};
           }
     }      }
     $visit ++;      $visit ++;
   
Line 618  END Line 626  END
         my $subject = '';          my $subject = '';
         if ($ENV{'form.origpage'}) {          if ($ENV{'form.origpage'}) {
             &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['addnewattach','deloldattach','delnewattach','timestamp','idx','subject','comment']);              &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['addnewattach','deloldattach','delnewattach','timestamp','idx','subject','comment']);
             $subject = &HTML::Entities::encode($ENV{'form.subject'},'<>&"');              $subject = &Apache::lonnet::unescape($ENV{'form.subject'});
             $comment = &HTML::Entities::encode($ENV{'form.comment'},'<>&"');              $comment = &Apache::lonnet::unescape($ENV{'form.comment'});
             my @keepold = ();              my @keepold = ();
             &process_attachments(\@currnewattach,\@currdelold,\@keepold);              &process_attachments(\@currnewattach,\@currdelold,\@keepold);
             if (@currnewattach > 0) {              if (@currnewattach > 0) {
                 $attachnum += @currnewattach;                  $attachnum += @currnewattach;
             }              }
         }          }
  $discussion.=(<<ENDDISCUSS);   if (&discussion_open($status)) {
       $discussion.=(<<ENDDISCUSS);
 <form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data">  <form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data">
 <input type="submit" name="discuss" value="Post Discussion" />  <input type="submit" name="discuss" value="Post Discussion" />
 <input type="submit" name="anondiscuss" value="Post Anonymous Discussion" />  <input type="submit" name="anondiscuss" value="Post Anonymous Discussion" />
Line 665  ENDDISCUSS Line 674  ENDDISCUSS
             $discussion.=$newattachmsg;              $discussion.=$newattachmsg;
     $discussion.=&generate_preview_button();      $discussion.=&generate_preview_button();
  }   }
    }
         } else {          } else {
  if (&discussion_open($status) &&   if (&discussion_open($status) &&
     &Apache::lonnet::allowed('pch',      &Apache::lonnet::allowed('pch',
Line 1306  END Line 1316  END
   }    }
   
   if ($ENV{'form.origpage'}) {    if ($ENV{'form.origpage'}) {
       $subject = $ENV{'form.subject'};        $subject = &Apache::lonnet::unescape($ENV{'form.subject'});
       $comment = $ENV{'form.comment'};        $comment = &Apache::lonnet::unescape($ENV{'form.comment'});
       &process_attachments(\@currnewattach,\@currdelold,\@keepold);        &process_attachments(\@currnewattach,\@currdelold,\@keepold);
   }    }
   my $latexHelp=&Apache::loncommon::helpLatexCheatsheet();    my $latexHelp=&Apache::loncommon::helpLatexCheatsheet();
Line 1355  $htmlheader Line 1365  $htmlheader
         }          }
   
         if (rec) {          if (rec) {
             if (typeof(document.mailform.onsubmit)!='undefined') {              if (typeof(document.mailform.onsubmit)=='function') {
  document.mailform.onsubmit();   document.mailform.onsubmit();
     }      }
     document.mailform.submit();      document.mailform.submit();
Line 1977  sub get_post_attachments { Line 1987  sub get_post_attachments {
     return;      return;
 }  }
   
 sub build_ims_export {  
     my ($r,$symb,$previous,$feedurl) = @_;  
  # backward compatibility (bulletin boards used to be 'wrapped')  
     if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) {  
         $feedurl=~s|^/adm/wrapper||;  
     }  
     my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'},  
                           $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},  
                           $ENV{'course.'.$ENV{'request.course.id'}.'.num'});  
     my @depth=();  
     my %alldiscussion=();  
     my @discussionitems=();  
     my %usernamesort = ();  
     my %subjectsort = ();  
     my %namesort = ();  
     my %notshown = ();  
     my %newitem = ();  
     my %dischash = ();  
     my %shown = ();  
     my %roleinfo = ();  
     my @posters=();  
     my $maxdepth=0;  
     my $visible=0;  
     my $newpostsflag=0;  
     my $status;  
     my $viewgrades;  
     my $seeid;  
     my $prevread;  
     my $sortposts;  
     my $ressymb;  
     my $target;  
     my $readkey;  
     my $showunmark;  
     my $showonlyunread;  
   
 }  
   
   
   
 sub fail_redirect {;  sub fail_redirect {;
   my ($r,$feedurl) = @_;    my ($r,$feedurl) = @_;
   if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };    if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };
Line 2028  sub fail_redirect {; Line 1999  sub fail_redirect {;
 <body bgcolor="#FFFFFF">  <body bgcolor="#FFFFFF">
 <img align="right" src="/adm/lonIcons/lonlogos.gif" />  <img align="right" src="/adm/lonIcons/lonlogos.gif" />
 <b>Sorry, no recipients  ...</b>  <b>Sorry, no recipients  ...</b>
   <br /><a href="$feedurl">Continue</a>
 </body>  </body>
 </html>  </html>
 ENDFAILREDIR  ENDFAILREDIR
Line 2098  $roletag Line 2070  $roletag
 $sectag  $sectag
 $userpicktag  $userpicktag
 </form>  </form>
   <br /><a href="$feedurl">Continue</a>
 </body>  </body>
 </html>  </html>
 ENDREDIR  ENDREDIR
Line 2106  ENDREDIR Line 2079  ENDREDIR
 sub no_redirect_back {  sub no_redirect_back {
   my ($r,$feedurl) = @_;    my ($r,$feedurl) = @_;
   my $nofeed=&mt('Sorry, no feedback possible on this resource  ...');    my $nofeed=&mt('Sorry, no feedback possible on this resource  ...');
     my $continue=&mt('Continue');
   $r->print (<<ENDNOREDIR);    $r->print (<<ENDNOREDIR);
 <html>  <html>
 <head><title>Feedback not sent</title>  <head><title>Feedback not sent</title>
Line 2121  ENDNOREDIR Line 2095  ENDNOREDIR
 <body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.close(); }'>  <body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.close(); }'>
 <img align="right" src="/adm/lonIcons/lonlogos.gif" />  <img align="right" src="/adm/lonIcons/lonlogos.gif" />
 <b>$nofeed</b>  <b>$nofeed</b>
   <br /><a href="$feedurl">$continue</a>
 </body>  </body>
 </html>  </html>
 ENDNOREDIRTWO  ENDNOREDIRTWO
Line 2330  sub send_msg { Line 2305  sub send_msg {
 sub adddiscuss {  sub adddiscuss {
     my ($symb,$email,$anon,$attachmenturl,$subject)=@_;      my ($symb,$email,$anon,$attachmenturl,$subject)=@_;
     my $status='';      my $status='';
     if (&discussion_open() &&      my $realsymb;
       if ($symb=~/^bulletin___/) {
    my $filename=(&Apache::lonnet::decode_symb($symb))[2];
    $filename=~s|^adm/wrapper/||;
    $realsymb=&Apache::lonnet::symbread($filename);
       }
       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'}:''))) {
   
Line 2453  sub generate_preview_button { Line 2434  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.mailform.onsubmit)!='undefined') {document.mailform.onsubmit();};this.form.comment.value=document.mailform.comment.value;this.form.subject.value=document.mailform.subject.value;this.form.submit();" />  onClick="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=document.mailform.comment.value;this.form.subject.value=document.mailform.subject.value;this.form.submit();" />
 </form>  </form>
 ENDPREVIEW  ENDPREVIEW
 }  }
   
 sub modify_attachments {  sub modify_attachments {
     my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_;      my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_;
     my $subject=&clear_out_html($ENV{'form.subject'});      my $orig_subject = &Apache::lonnet::unescape($ENV{'form.subject'});
       my $subject=&clear_out_html($orig_subject);
     $subject=~s/\n/\<br \/\>/g;      $subject=~s/\n/\<br \/\>/g;
     $subject=&Apache::lontexconvert::msgtexconverted($subject);      $subject=&Apache::lontexconvert::msgtexconverted($subject);
     my $timestamp=$ENV{'form.timestamp'};      my $timestamp=$ENV{'form.timestamp'};
Line 2489  $bodytag Line 2471  $bodytag
  <table border="2">   <table border="2">
   <tr>    <tr>
    <td>     <td>
     <b>Subject:</b>$subject</b><br /><br />      <b>Subject:</b> $subject</b><br /><br />
 END  END
     if ($idx) {      if ($idx) {
         if ($attachmenturls) {          if ($attachmenturls) {
Line 2596  sub generate_attachments_button { Line 2578  sub generate_attachments_button {
     my $response = (<<END);      my $response = (<<END);
 <form name="attachment" action="/adm/feedback?attach=$ressymb" method="post">  <form name="attachment" action="/adm/feedback?attach=$ressymb" method="post">
 Click to add/remove attachments:&nbsp;<input type="button" value="$att"  Click to add/remove attachments:&nbsp;<input type="button" value="$att"
 onClick="this.form.subject.value=document.mailform.subject.value;this.form.comment.value=document.mailform.comment.value;  onClick="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=escape(document.mailform.comment.value);this.form.subject.value=escape(document.mailform.subject.value);
 END  END
     unless ($mode eq 'board') {      unless ($mode eq 'board') {
         $response .= 'javascript:anonchk();';          $response .= 'javascript:anonchk();';
Line 2938  END Line 2920  END
 <b>$lt{'mnpa'} $numitems $lt{'robb'}</b>  <b>$lt{'mnpa'} $numitems $lt{'robb'}</b>
 <form name="reldt" action="$feedurl" target="loncapaclient">  <form name="reldt" action="$feedurl" target="loncapaclient">
 </form>  </form>
   <br /><a href="$feedurl">Continue</a>
 </body>  </body>
 </html>  </html>
 ENDREDIR  ENDREDIR
Line 3189  ENDREDIR Line 3172  ENDREDIR
           $status=$Apache::inputtags::status[-1];            $status=$Apache::inputtags::status[-1];
       }        }
       my $discussion = &list_discussion($mode,$status,$symb);         my $discussion = &list_discussion($mode,$status,$symb); 
 #      &build_ims_export($r,$symb,$previous,$feedurl);  
       my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion');        my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion');
       $r->print($bodytag.$discussion);                                             $r->print($bodytag.$discussion);                                     
       return OK;        return OK;

Removed from v.1.117  
changed lines
  Added in v.1.124


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