Diff for /loncom/interface/lonfeedback.pm between versions 1.254 and 1.255

version 1.254, 2008/06/05 00:15:24 version 1.255, 2008/06/06 05:24:28
Line 1472  sub replicate_attachments { Line 1472  sub replicate_attachments {
 }  }
   
 sub mail_screen {  sub mail_screen {
   my ($r,$feedurl,$options,$caller_symb) = @_;    my ($r,$feedurl,$options,$caller_symb,$attachmaxtext) = @_;
   if (exists($env{'form.origpage'})) {    if (exists($env{'form.origpage'})) {
       &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog','group','ref']);        &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog','group','ref']);
   }    }
Line 1482  sub mail_screen { Line 1482  sub mail_screen {
             'myqu' => 'My question/comment/feedback:',              'myqu' => 'My question/comment/feedback:',
             'title' => 'Title',              'title' => 'Title',
             'reta' => 'Retained attachments',              'reta' => 'Retained attachments',
             'atta' => 'Attachment (128 KB max size)',              'atta' => 'Attachment',
            );             );
   my $restitle = &get_resource_title($caller_symb,$feedurl);    my $restitle = &get_resource_title($caller_symb,$feedurl);
   my $quote='';    my $quote='';
Line 1721  END Line 1721  END
         }          }
     } else {      } else {
         $r->print(<<END);          $r->print(<<END);
 $lt{'atta'}: <input type="file" name="attachment" />  $lt{'atta'} $attachmaxtext: <input type="file" name="attachment" />
 </p>  </p>
 END  END
     }      }
Line 2391  ENDFAILREDIR Line 2391  ENDFAILREDIR
 }  }
   
 sub redirect_back {  sub redirect_back {
   my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$blog,$status,$previous,$sort,$rolefilter,$statusfilter,$sectionpick,$grouppick,$numpicks,$group) = @_;    my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$blog,$status,$previous,$sort,$rolefilter,$statusfilter,$sectionpick,$grouppick,$numpicks,$group,$toolarge) = @_;
   my $sorttag = '';    my $sorttag = '';
   my $roletag = '';    my $roletag = '';
   my $statustag = '';    my $statustag = '';
Line 2505  $start_page Line 2505  $start_page
 $typestyle  $typestyle
 <b>Sent $sendsomething message(s), and $sendposts post(s).</b>  <b>Sent $sendsomething message(s), and $sendposts post(s).</b>
 $blog  $blog
   $toolarge
 <font color="red">$status</font>  <font color="red">$status</font>
 <form name="reldt" action="$feedurl" target="loncapaclient">  <form name="reldt" action="$feedurl" target="loncapaclient">
 $prevtag  $prevtag
Line 2932  ENDPREVIEW Line 2933  ENDPREVIEW
 }  }
   
 sub modify_attachments {  sub modify_attachments {
     my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls)=@_;      my ($r,$currnewattach,$currdelold,$symb,$idx,$attachmenturls,
           $attachmaxtext,$toolarge)=@_;
   
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                'subj' => 'Subject',                 'subj' => 'Subject',
Line 2974  END Line 2976  END
                 
     $r->print(<<END);      $r->print(<<END);
 $start_page  $start_page
   $toolarge
 <form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb">  <form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb">
  <table border="2">   <br />
    <table class="LC_data_table">
   <tr>    <tr>
    <td>     <td colspan="2">
     <b>Subject:</b> $subject</b><br /><br />      <b>Subject:</b> $subject</b><br /><br />
 END  END
     if ($idx) {      if ($idx) {
Line 3003  END Line 3007  END
         $r->print("<br />");           $r->print("<br />"); 
     }      }
     $r->print(<<END);      $r->print(<<END);
    $lt{'adda'}&nbsp;<input type="file" name="addnewattach" /><input type="button" name="upload" value="Upload" onClick="this.form.submit()" />         </td></tr>
      <tr>
       <td>
      $lt{'adda'}</td><td><input type="file" name="addnewattach" /><input type="button" name="upload" value="Upload" onClick="this.form.submit()" />    
    </td>     </td>
   </tr>    </tr>
     <tr>
      <td colspan="2">$attachmaxtext</td>
     </tr>
  </table>   </table>
 <input type="hidden" name="subject" value="$env{'form.subject'}" />  <input type="hidden" name="subject" value="$env{'form.subject'}" />
 <input type="hidden" name="comment" value="$env{'form.comment'}" />  <input type="hidden" name="comment" value="$env{'form.comment'}" />
Line 3288  sub handler { Line 3298  sub handler {
   &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']);           ['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 = (
                       text => '(128 KB max size)',
                       num  => 131072,
                     );
   if ($env{'form.editdisc'}) {    if ($env{'form.editdisc'}) {
       if (!(&editing_allowed($env{'form.editdisc'},$env{'form.group'}))) {        if (!(&editing_allowed($env{'form.editdisc'},$env{'form.group'}))) {
           my $symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0];            my $symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0];
Line 3596  ENDREDIR Line 3610  ENDREDIR
       &Apache::loncommon::content_type($r,'text/html');        &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;        $r->send_http_header;
       &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','addnewattach','delnewattach','timestamp','numoldver','idx','discuss','blog']);        &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','addnewattach','delnewattach','timestamp','numoldver','idx','discuss','blog']);
       my (@currnewattach,@currdelold,@keepold);        my (@currnewattach,@currdelold,@keepold,$toolarge);
       &process_attachments(\@currnewattach,\@currdelold,\@keepold);        &process_attachments(\@currnewattach,\@currdelold,\@keepold);
       if (exists($env{'form.addnewattach.filename'})) {        if (exists($env{'form.addnewattach.filename'})) {
           unless (length($env{'form.addnewattach'})>131072) {            if (length($env{'form.addnewattach'})<=$attachmax{'num'}) {
               my $subdir = 'feedback/'.$env{'form.timestamp'};                my $subdir = 'feedback/'.$env{'form.timestamp'};
               my $newattachment=&Apache::lonnet::userfileupload('addnewattach',undef,$subdir);                my $newattachment=&Apache::lonnet::userfileupload('addnewattach',undef,$subdir);
       push(@currnewattach, $newattachment);        push(@currnewattach, $newattachment);
             } else {
                 $toolarge = '<p><span class="LC_warning">'.&mt('Attachment not included - exceeded permitted length').'</span><br /></p>';
           }            }
       }        }
       my $attachmenturls;        my $attachmenturls;
Line 3615  ENDREDIR Line 3631  ENDREDIR
           $attachmenturls = $contrib{$idx.':attachmenturl'};            $attachmenturls = $contrib{$idx.':attachmenturl'};
       }        }
       &modify_attachments($r,\@currnewattach,\@currdelold,$symb,$idx,        &modify_attachments($r,\@currnewattach,\@currdelold,$symb,$idx,
   $attachmenturls);    $attachmenturls,$attachmax{'text'},$toolarge);
       return OK;        return OK;
   } elsif ($env{'form.export'}) {    } elsif ($env{'form.export'}) {
       &Apache::loncommon::content_type($r,'text/html');        &Apache::loncommon::content_type($r,'text/html');
Line 3704  ENDREDIR Line 3720  ENDREDIR
           }            }
   my $options=&screen_header($feedurl,$symb);    my $options=&screen_header($feedurl,$symb);
   if ($options) {    if ($options) {
       &mail_screen($r,$feedurl,$options,$symb);        &mail_screen($r,$feedurl,$options,$symb,$attachmax{'text'});
   } else {    } else {
       &fail_redirect($r,$feedurl);        &fail_redirect($r,$feedurl);
   }    }
Line 3730  ENDREDIR Line 3746  ENDREDIR
       &Apache::lonnet::delenv('allowed.vgr');        &Apache::lonnet::delenv('allowed.vgr');
 # Get attachments, if any, and not too large  # Get attachments, if any, and not too large
       my $attachmenturl='';        my $attachmenturl='';
         my $toolarge='';
       if (($env{'form.origpage'}) || ($env{'form.editdisc'}) ||        if (($env{'form.origpage'}) || ($env{'form.editdisc'}) ||
   ($env{'form.replydisc'})) {    ($env{'form.replydisc'})) {
   my ($symb,$idx);    my ($symb,$idx);
Line 3748  ENDREDIR Line 3765  ENDREDIR
   $symb=~s|(bulletin___\d+___)adm/wrapper/|$1|;    $symb=~s|(bulletin___\d+___)adm/wrapper/|$1|;
   $attachmenturl=&construct_attachmenturl(\@currnewattach,\@keepold,$symb,$idx);    $attachmenturl=&construct_attachmenturl(\@currnewattach,\@keepold,$symb,$idx);
       } elsif ($env{'form.attachment.filename'}) {        } elsif ($env{'form.attachment.filename'}) {
   unless (length($env{'form.attachment'})>131072) {    if (length($env{'form.attachment'})<=$attachmax{'num'}) {
       $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,'feedback');                my $now = time;
   }                my $subdir = 'feedback/'.$now;
         $attachmenturl=&Apache::lonnet::userfileupload('attachment',undef,$subdir);
     } else {
                 $toolarge = '<p><span class="LC_warning">'.&mt('Attachment not included - exceeded permitted length').'</span><br /></p>';
             }
       }        }
 # 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 $message=&clear_out_html($env{'form.comment'});
Line 3793  ENDREDIR Line 3814  ENDREDIR
       }        }
       
 # Receipt screen and redirect back to where came from  # Receipt screen and redirect back to where came from
       &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},undef,undef,undef,undef,undef,undef,$group);        &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},undef,undef,undef,undef,undef,undef,$group,$toolarge);
   }    }
   return OK;    return OK;
 }  }

Removed from v.1.254  
changed lines
  Added in v.1.255


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