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

riegler lon-capa-cvs-allow@mail.lon-capa.org
Fri, 05 Sep 2008 20:23:57 -0000


riegler		Fri Sep  5 16:23:57 2008 EDT

  Modified files:              
    /loncom/homework	chemresponse.pm 
  Log:
  Replaced Edit Answer button by pencil icon.
  
  
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.79 loncom/homework/chemresponse.pm:1.80
--- loncom/homework/chemresponse.pm:1.79	Fri Sep  5 12:09:39 2008
+++ loncom/homework/chemresponse.pm	Fri Sep  5 16:23:57 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.79 2008/09/05 16:09:39 riegler Exp $
+# $Id: chemresponse.pm,v 1.80 2008/09/05 20:23:57 riegler Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -342,7 +342,6 @@
 	}
     }
     if (($target eq 'web' ) && ($Apache::lonhomework::type ne 'exam') && ($Apache::inputtags::status['-1'] eq 'CAN_ANSWER')){
-# hierher
             my $options=&Apache::lonxml::get_param('options',$parstack,
                                                    $safeeval);
             my $shown_text;
@@ -455,6 +454,8 @@
     my $field_es=&escape($field);
     my $reaction_es=&escape($reaction);
     my $docopen=&Apache::lonhtmlcommon::javascript_docopen();
+    my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'};
+    my $display=&mt('Edit Answer');
     my $start_page = 
 	&Apache::loncommon::start_page('LON-CAPA Reaction Editor',undef,
 				       {'frameset'    => 1,
@@ -476,7 +477,7 @@
     }
 // -->
 </script>
-<input type='button' value='Edit Answer' onclick="javascript:create_reaction_window_${id}_${field}();void(0);" />
+<a href="javascript:create_reaction_window_${id}_${field}();void(0);"><img class="stift" src='$iconpath/stift.gif' alt='$display' title='$display' /></a>
 EDITREACTION
     return $result;
 }
@@ -492,10 +493,6 @@
 	my $id = $Apache::inputtags::response['-1'];
 	my $reaction=$Apache::lonhomework::history{"resource.$partid.$id.submission"};
 	if ($reaction eq '') {  $reaction=&Apache::lonxml::get_param('initial',$parstack,$safeeval); }
-	my $status=$Apache::inputtags::status['-1'];
-	if ($status eq 'CAN_ANSWER') {
-	    $result.=&edit_reaction_button($id,"HWVAL_$id",$reaction);
-	}
 	if (  &Apache::response::show_answer() ) {
 	    my $ans=&Apache::lonxml::get_param('answer',$parstack,$safeeval);
 	    if (!$Apache::lonxml::default_homework_loaded) {
@@ -510,11 +507,9 @@
 						$safeeval);
 	$result .='<nobr>'.
 	    &Apache::edit::text_arg('Answer:','answer',$token,40);
-	$result .=&edit_reaction_button($id,&Apache::edit::html_element_name('answer'),$answer).'</nobr>';
 	my $initial=&Apache::lonxml::get_param('initial',$parstack,$safeeval);
 	$result.='<nobr>'.
 	    &Apache::edit::text_arg('Initial Reaction:','initial',$token,40);
-	$result .=&edit_reaction_button($id,&Apache::edit::html_element_name('initial'),$initial).'</nobr>';
 	
 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
     }  elsif ($target eq 'modified') {
@@ -589,6 +584,14 @@
             &Apache::lonhomework::set_bubble_lines();
         }
     }
+     my $status=$Apache::inputtags::status['-1'];
+        if  (($target eq 'web') && ($Apache::lonhomework::type ne 'exam') && ($status eq 'CAN_ANSWER')) {
+             my $partid = $Apache::inputtags::part;
+             my $id = $Apache::inputtags::response['-1'];
+             my $reaction=$Apache::lonhomework::history{"resource.$partid.$id.submission"};
+             $result.=&edit_reaction_button($id,"HWVAL_$id",$reaction);
+
+        }  
     &Apache::response::end_response();
     return $result;
 }