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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 11 Sep 2007 19:46:49 -0000


albertel		Tue Sep 11 15:46:49 2007 EDT

  Modified files:              
    /loncom/homework	externalresponse.pm 
  Log:
  - BUG#5419
       - adding edit interface to externalresponse
       - adding extrenal response to insertable list, but as hidden 
  
  
Index: loncom/homework/externalresponse.pm
diff -u loncom/homework/externalresponse.pm:1.9 loncom/homework/externalresponse.pm:1.10
--- loncom/homework/externalresponse.pm:1.9	Tue Sep 11 15:24:14 2007
+++ loncom/homework/externalresponse.pm	Tue Sep 11 15:46:48 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # external style responses
 #
-# $Id: externalresponse.pm,v 1.9 2007/09/11 19:24:14 albertel Exp $
+# $Id: externalresponse.pm,v 1.10 2007/09/11 19:46:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -37,13 +37,31 @@
 }
 
 #FIXME
-# send of response params and there current values
-# accept a string to be printed out (Where does it get shown?) (.message)
-# need to get a correct answer from somewhere (probably here since randomized)
+# send of response params and their current values (form good enough?
+# what parameters to send?)
+# Need to get returned message displayed 
 sub start_externalresponse {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;
     my $id = &Apache::response::start_response($parstack,$safeeval);
+
+    if ($target eq 'edit') {
+  	$result .=&Apache::edit::tag_start($target,$token);
+	$result .=&Apache::edit::text_arg('URL:','url',$token,60).'<br />';
+	$result .=&Apache::edit::text_arg('Answer:','answer',$token);
+	$result .=&Apache::edit::text_arg('Form:','form',$token);
+	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
+    } elsif ($target eq 'modified') {
+	my $constructtag =
+	    &Apache::edit::get_new_args($token,$parstack,$safeeval,
+					'answer','form','url');
+	if ($constructtag) {
+	    $result = &Apache::edit::rebuild_tag($token);
+	}
+    } elsif ($target eq 'meta') {
+  	$result=&Apache::response::meta_package_write('externalresponse');
+    }
+    
     return $result;
 }