[LON-CAPA-cvs] cvs: loncom /homework essayresponse.pm

ng lon-capa-cvs@mail.lon-capa.org
Fri, 19 Jul 2002 20:43:11 -0000


ng		Fri Jul 19 16:43:11 2002 EDT

  Modified files:              
    /loncom/homework	essayresponse.pm 
  Log:
  put the collaborator field in. Needs to check whether it is greater than 0.
  
  
  
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.8 loncom/homework/essayresponse.pm:1.9
--- loncom/homework/essayresponse.pm:1.8	Tue Jul  9 13:18:25 2002
+++ loncom/homework/essayresponse.pm	Fri Jul 19 16:43:11 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # essay (ungraded) style responses
 #
-# $Id: essayresponse.pm,v 1.8 2002/07/09 17:18:25 ng Exp $
+# $Id: essayresponse.pm,v 1.9 2002/07/19 20:43:11 ng Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -40,10 +40,16 @@
   if ($target eq 'meta') {
     $result=&Apache::response::meta_package_write('essayresponse');
   }
-#  if ($target eq 'web') {
-#      $result='<br />Collaborators: <input type="text" size="20" name="HWCOL'.
-#              $Apache::inputtags::response['-1']."' />';
-#  }
+  if ($target eq 'web') {
+      my $id  = $Apache::inputtags::response['-1'];
+      my $part= $Apache::inputtags::part;
+      my $symb= &Apache::lonnet::symbread($ENV{'form.url'});
+#      my $ncol= &Apache::lonnet::EXT('parameter\_$part\_$id\_maxcollaborators',$symb);
+      my $ncol= &Apache::lonnet::get($symb,['parameter\_$part\_$id\_maxcollaborators']);
+      $result ='<br />Collaborators: <input type="text" size="40" max="70" name="HWCOL'.
+              $Apache::inputtags::response['-1'].'" /><br />'.$ncol.':<br>'.
+	      '(Enter collaborators using username or username@domain, e.g. smithje or doej@msu or smithje@fsu.)';
+  }
   return $result;
 }
 
@@ -51,14 +57,16 @@
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   if ( $target eq 'grade' ) {
     if ( defined $ENV{'form.submitted'}) {
-      my $id = $Apache::inputtags::response['-1'];
-      my $response = $ENV{'form.HWVAL'.$Apache::inputtags::response['-1']};
-      my $collaborators = $ENV{'form.HWCOL'.$Apache::inputtags::response['-1']};
+      my $id            = $Apache::inputtags::response['-1'];
+      my $response      = $ENV{'form.HWVAL'.$id};
+      my $collaborators = $ENV{'form.HWCOL'.$id};
+#      my $response = $ENV{'form.HWVAL'.$Apache::inputtags::response['-1']};
+#      my $collaborators = $ENV{'form.HWCOL'.$Apache::inputtags::response['-1']};
       if ( $response =~ /[^\s]/) {
 	my $part=$Apache::inputtags::part;
 	$Apache::lonhomework::results{"resource.$part.$id.submission"}=$response;
 	$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}="SUBMITTED";
-#	$Apache::lonhomework::results{"resource.$part.$id.collaborators"}=$collaborators;
+	$Apache::lonhomework::results{"resource.$part.$id.collaborators"}=$collaborators;
 	my %previous=&Apache::response::check_for_previous($response,$part,$id);
 	&Apache::response::handle_previous(\%previous,'SUBMITTED');
       }