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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 18 Feb 2005 05:41:32 -0000


albertel		Fri Feb 18 00:41:32 2005 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  - <textline readonly="yes" />
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.156 loncom/homework/inputtags.pm:1.157
--- loncom/homework/inputtags.pm:1.156	Mon Jan 31 17:00:40 2005
+++ loncom/homework/inputtags.pm	Fri Feb 18 00:41:31 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.156 2005/01/31 22:00:40 albertel Exp $
+# $Id: inputtags.pm,v 1.157 2005/02/18 05:41:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -222,7 +222,12 @@
 		if ($addchars) {
 		    $result.=&addchars('HWVAL_'.$id,$addchars);
 		}
-		$result.= '<input type="text" name="HWVAL_'.$id.'" value="'.
+		my $readonly=&Apache::lonxml::get_param('readonly',$parstack,
+							$safeeval);
+		if (lc($readonly) eq 'yes') {
+		    $readonly=' readonly="readonly" ';
+		}
+		$result.= '<input type="text" '.$readonly.' name="HWVAL_'.$id.'" value="'.
 		    $oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />';
 	    }
 	} else {
@@ -233,11 +238,16 @@
     } elsif ($target eq 'edit') {
 	$result=&Apache::edit::tag_start($target,$token);
 	$result.=&Apache::edit::text_arg('Size:','size',$token,'5').
-	    &Apache::edit::text_arg
-	    ('Click-On Texts (comma sep):','addchars',$token,10)."</td></tr>";
-	$result.=&Apache::edit::end_table;
+	    &Apache::edit::text_arg('Click-On Texts (comma sep):',
+				    'addchars',$token,10);
+        $result.=&Apache::edit::select_arg('Readonly:','readonly',
+					   ['no','yes'],$token);
+	$result.=&Apache::edit::end_row();
+	$result.=&Apache::edit::end_table();
     } elsif ($target eq 'modified') {
-	my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'size','addchars');
+	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
+						     $safeeval,'size',
+						     'addchars','readonly');
 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
     } elsif ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
 	my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);