[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm /xml lonxml.pm

www lon-capa-cvs@mail.lon-capa.org
Sat, 29 Mar 2003 22:50:22 -0000


www		Sat Mar 29 17:50:22 2003 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
    /loncom/xml	lonxml.pm 
  Log:
  Work on small attachments for discussion and feedback
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.41 loncom/interface/lonfeedback.pm:1.42
--- loncom/interface/lonfeedback.pm:1.41	Tue Feb 18 10:47:40 2003
+++ loncom/interface/lonfeedback.pm	Sat Mar 29 17:50:22 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.41 2003/02/18 15:47:40 albertel Exp $
+# $Id: lonfeedback.pm,v 1.42 2003/03/29 22:50:22 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -112,8 +112,12 @@
 My question/comment/feedback:<p>
 <textarea name=comment cols=60 rows=10 wrap=hard>
 </textarea><p>
-<input type=hidden name=sendit value=1>
-<input type=button value="Send Feedback" onClick='gosubmit();'></input>
+Attachment (128 KB max size): <input type="file" name="attachment" />
+</p>
+<p>
+<input type="hidden" name="sendit" value="1" />
+<input type=button value="Send Feedback" onClick='gosubmit();' />
+</p>
 </form>
 ENDDOCUMENT
 $r->print(&generate_preview_button().'</body></html>');
@@ -365,7 +369,7 @@
 }
 
 sub adddiscuss {
-    my ($symb,$email,$anon)=@_;
+    my ($symb,$email,$anon,$attachmenturl)=@_;
     my $status='';
     if (&Apache::lonnet::allowed('pch',$ENV{'request.course.id'}.
         ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) {
@@ -377,7 +381,8 @@
                  'plainname'    => $ENV{'environment.firstname'}.' '.
 		                   $ENV{'environment.middlename'}.' '.
                                    $ENV{'environment.lastname'}.' '.
-                                   $ENV{'enrironment.generation'});
+                                   $ENV{'enrironment.generation'},
+                 'attachment'   => $attachmenturl);
     if ($anon) {
 	$contrib{'anonymous'}='true';
     }
@@ -556,7 +561,13 @@
       my $useranswer=&Apache::loncommon::get_student_answers(
                        $symb,$ENV{'user.name'},$ENV{'user.domain'},
 		       $ENV{'request.course.id'});
-
+# Get attachments, if any, and not too large
+      my $attachmenturl='';
+      if ($ENV{'form.attachment.filename'}) {
+	  unless (length($ENV{'form.attachment'})>131072) {
+	      $attachmenturl=&Apache::lonnet::userfileupload('attachment',1);
+	  }
+      }
 # Filter HTML out of message (could be nasty)
       my $message=&clear_out_html($ENV{'form.comment'});
 
@@ -574,12 +585,12 @@
 
       my $numpost=0;
       if ($ENV{'form.discuss'}) {
-	  $typestyle.=&adddiscuss($symb,$message);
+	  $typestyle.=&adddiscuss($symb,$message,0,$attachmenturl);
 	  $numpost++;
       }
 
       if ($ENV{'form.anondiscuss'}) {
-	  $typestyle.=&adddiscuss($symb,$message,1);
+	  $typestyle.=&adddiscuss($symb,$message,1,$attachmenturl);
 	  $numpost++;
       }
 
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.241 loncom/xml/lonxml.pm:1.242
--- loncom/xml/lonxml.pm:1.241	Tue Mar 25 17:51:48 2003
+++ loncom/xml/lonxml.pm	Sat Mar 29 17:50:22 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.241 2003/03/25 22:51:48 albertel Exp $
+# $Id: lonxml.pm,v 1.242 2003/03/29 22:50:22 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -257,6 +257,9 @@
 <font size="1">Note: in anonymous discussion, your name is visible only to
 course faculty</font><br />
 <textarea name=comment cols=60 rows=10 wrap=hard></textarea>
+<p>
+Attachment (128 KB max size): <input type="file" name="attachment" />
+</p>
 </form>
 ENDDISCUSS
              $discussion.=&Apache::lonfeedback::generate_preview_button();