[LON-CAPA-cvs] cvs: loncom /homework imageresponse.pm insertlist.tab

www lon-capa-cvs@mail.lon-capa.org
Mon, 05 May 2003 18:24:50 -0000


www		Mon May  5 14:24:50 2003 EDT

  Modified files:              
    /loncom/homework	imageresponse.pm insertlist.tab 
  Log:
  You can finally edit an imageresponse ... if you can guess the coordinates.
  
  
Index: loncom/homework/imageresponse.pm
diff -u loncom/homework/imageresponse.pm:1.24 loncom/homework/imageresponse.pm:1.25
--- loncom/homework/imageresponse.pm:1.24	Tue Feb 25 11:09:01 2003
+++ loncom/homework/imageresponse.pm	Mon May  5 14:24:50 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # image click response style
 #
-# $Id: imageresponse.pm,v 1.24 2003/02/25 16:09:01 sakharuk Exp $
+# $Id: imageresponse.pm,v 1.25 2003/05/05 18:24:50 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -26,7 +26,8 @@
 # http://www.lon-capa.org/
 #
 
-#FIXME assumes multiple possbile submissions but only one is possible currently
+#FIXME LATER assumes multiple possible submissions but only one is possible 
+#currently
 
 package Apache::imageresponse;
 use strict;
@@ -233,8 +234,20 @@
 
 sub start_text {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
-  if ($target eq 'web' || $target eq 'tex') { &Apache::lonxml::startredirection; }
-  return '';
+  my $result='';
+  if ($target eq 'web' || $target eq 'tex') { 
+     &Apache::lonxml::startredirection; 
+  } elsif ($target eq 'edit') {
+    my $descr=$$parser[$#$parser]->get_text("/text");
+    $result=&Apache::edit::tag_start($target,$token,'Task Description').
+	&Apache::edit::editfield($token->[1],$descr,'Text',60,2).
+        &Apache::edit::end_row().&Apache::edit::start_spanning_row();     
+  } elsif ($target eq "modified") {
+    my $bgimg=$$parser[$#$parser]->get_text("/text");
+    $result=$token->[4].&Apache::edit::modifiedfield($token);
+    &Apache::lonxml::debug($result);
+  }
+  return $result;
 }
 
 sub end_text {
@@ -253,8 +266,22 @@
 
 sub start_image {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
-  if ($target eq 'web' || $target eq 'tex') { &Apache::lonxml::startredirection; }
-  return '';
+  my $result='';
+  if ($target eq 'web' || $target eq 'tex') { 
+      &Apache::lonxml::startredirection; 
+  } elsif ($target eq 'edit') {
+    my $bgimg=$$parser[$#$parser]->get_text("/image");
+    $result=&Apache::edit::tag_start($target,$token,'Clickable Image').
+	&Apache::edit::editline($token->[1],$bgimg,'Image Source File',40);
+    $result.=&Apache::edit::browse(undef,'textnode').' ';
+    $result.=&Apache::edit::search(undef,'textnode').
+        &Apache::edit::end_row().&Apache::edit::start_spanning_row();     
+  } elsif ($target eq "modified") {
+    my $bgimg=$$parser[$#$parser]->get_text("/image");
+    $result=$token->[4].&Apache::edit::modifiedfield($token);
+    &Apache::lonxml::debug($result);
+  }
+  return $result;
 }
 
 sub end_image {
@@ -347,8 +374,20 @@
 
 sub start_rectangle {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
-  if ($target eq 'web' || $target eq 'grade' || $target eq 'tex') { &Apache::lonxml::startredirection; }
-  return '';
+  my $result='';
+  if ($target eq 'web' || $target eq 'grade' || $target eq 'tex') { 
+     &Apache::lonxml::startredirection; 
+  } elsif ($target eq 'edit') {
+    my $coords=$$parser[$#$parser]->get_text("/rectangle");
+    $result=&Apache::edit::tag_start($target,$token,'Rectangle').
+	&Apache::edit::editline($token->[1],$coords,'Coordinate Pairs',40).
+        &Apache::edit::end_row().&Apache::edit::start_spanning_row();     
+  } elsif ($target eq "modified") {
+    my $coords=$$parser[$#$parser]->get_text("/rectangle");
+    $result=$token->[4].&Apache::edit::modifiedfield($token);
+    &Apache::lonxml::debug($result);
+  }
+  return $result;
 }
 
 sub grade_rectangle {
Index: loncom/homework/insertlist.tab
diff -u loncom/homework/insertlist.tab:1.34 loncom/homework/insertlist.tab:1.35
--- loncom/homework/insertlist.tab:1.34	Mon Jan 27 19:12:52 2003
+++ loncom/homework/insertlist.tab	Mon May  5 14:24:50 2003
@@ -11,13 +11,13 @@
 optionhint,Option Response Hint Condition,#ccaacc,insert_optionhint
 radiobuttonhint,Radiobutton Hint Condition,#ccaacc,insert_radiobuttonhint
 stringhint,String Hint Condition,#ccaacc,insert_stringhint
-imageresponse::conceptgroup,Collection of similar foils,#FFFFFF,default
-imageresponse::foil,Image response foil,#cccccc,Apache::imageresponse::insert_foil
-imageresponse::foilgroup,Collection of Imageresponse foils,#FFFFFF,default,no
-imageresponse::image,Imageresponse Image,#FFFFFF,default
-imageresponse,Response: Click on Image,#FFFFFF,Apache::imageresponse::insert_imageresponse,no
-imageresponse::rectangle,Rectangular area in image,#FFFFFF,default
-imageresponse::text,Text to describe option,#FFFFFF,default
+imageresponse::conceptgroup,Collection of similar foils,#99FFFF,default
+imageresponse::foil,Image response foil,#99ff88,Apache::imageresponse::insert_foil
+imageresponse::foilgroup,Collection of Imageresponse foils,#55cc55,default,no
+imageresponse::image,Imageresponse Image,#aaFFcc,default
+imageresponse,Response: Click on Image,#ccFFaa,Apache::imageresponse::insert_imageresponse,no
+imageresponse::rectangle,Rectangular area in image,#ccFFdd,default
+imageresponse::text,Text to describe option,#ddFFee,default
 datasubmission,Stored Entry Field,#1144dd,default,no
 textfield,Large Text Entry Area,#1144dd,default
 textline,Single Line Text Entry Area,#1144dd,default
@@ -52,8 +52,8 @@
 library,Start of Library,#FFFFFF,default
 notsolved,Block For When Not Solved,#FFFFFF,default
 part,Problem Part,#F0F0F0,default
-postanswerdate,After Answer Date Block,#FFFFFF,default
-preduedate,Before Due Date Block,#FFFFFF,default
+postanswerdate,After Answer Date Block,#EE9999,default
+preduedate,Before Due Date Block,#FFaaaa,default
 problem,Start of Homework,#FFFFFF,default
 randomlabel,Randomly labeled image,#cc77aa,default
 randomlabel::labelgroup,Group of Labels,#11FFaa,default