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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 12 Feb 2005 01:13:56 -0000


albertel		Fri Feb 11 20:13:56 2005 EDT

  Modified files:              
    /loncom/homework	matchresponse.pm 
  Log:
  - implementing direction for the item list for <mr> for the web, LaTeXx's tables piss me off so printing isnt working yet
  
  
Index: loncom/homework/matchresponse.pm
diff -u loncom/homework/matchresponse.pm:1.50 loncom/homework/matchresponse.pm:1.51
--- loncom/homework/matchresponse.pm:1.50	Mon Jan 31 17:00:40 2005
+++ loncom/homework/matchresponse.pm	Fri Feb 11 20:13:56 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Full matching style response
 #
-# $Id: matchresponse.pm,v 1.50 2005/01/31 22:00:40 albertel Exp $
+# $Id: matchresponse.pm,v 1.51 2005/02/12 01:13:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -101,11 +101,15 @@
 					   'location',
 					   ['top','bottom','left','right'],
 					   $token);
+	$result.=&Apache::edit::select_arg('Items Display Directection:',
+					   'direction',
+					   ['vertical','horizontal'],
+					   $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,'randomize',
-						     'location');
+						     'location','direction');
 	if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
     } elsif ($target eq 'web' or $target eq 'tex') {
 	$Apache::matchresponse::itemtable{'location'}=
@@ -142,15 +146,19 @@
     }
     $Apache::response::itemgroup{'letter_name_map'}=\%letter_name_map;
     $Apache::response::itemgroup{'name_letter_map'}=\%name_letter_map;
+    my $direction=&Apache::lonxml::get_param('direction',$parstack,$safeeval);
     if ($target eq 'web') {
 	my $table='<table>';
 	my $i=0;
+	if ($direction eq 'horizontal') { $table .='<tr>';}
 	foreach my $name (@names) {
-	    $table.='<tr><td>'.$alphabet[$i].'</td><td>'.
-		$Apache::response::itemgroup{$name.'.text'}.
-		    '</td></tr>';
+	    if ($direction ne 'horizontal') { $table.='<tr>'; }
+	    $table.='<td>'.$alphabet[$i].'</td><td>'.
+		$Apache::response::itemgroup{$name.'.text'}.'</td>';
+	    if ($direction ne 'horizontal') { $table.='</tr>'; }
 	    $i++;
 	}
+	if ($direction eq 'horizontal') { $table .='</tr>';}
 	$table.='</table>';
 	$Apache::matchresponse::itemtable{'display'}=$table;
     } elsif ($target eq 'tex') {