[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 15 Jan 2004 19:25:25 -0000


matthew		Thu Jan 15 14:25:25 2004 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  Modifications to implement fix for Bug 2140: classlist upload should remember
  field order.
  &authform_header now takes parameter curr_authtype, which indicates the
  current authentication type in use.
  &csv_print_select_table and &csv_samples_select_table now set default values
  for the <select> forms they print out.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.173 loncom/interface/loncommon.pm:1.174
--- loncom/interface/loncommon.pm:1.173	Thu Jan 15 13:12:59 2004
+++ loncom/interface/loncommon.pm	Thu Jan 15 14:25:25 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.173 2004/01/15 18:12:59 www Exp $
+# $Id: loncommon.pm,v 1.174 2004/01/15 19:25:25 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1158,6 +1158,11 @@
     }
 
     my $radioval = "'nochange'";
+    if (exists($in{'curr_authtype'}) &&
+        defined($in{'curr_authtype'}) &&
+        $in{'curr_authtype'} ne '') {
+        $radioval = "'$in{'curr_authtype'}arg'";
+    }
     my $argfield = 'null';
     if ( grep/^mode$/,(keys %in) ) {
         if ($in{'mode'} eq 'modifycourse')  {
@@ -2795,7 +2800,7 @@
 
 $r is an Apache Request ref,
 $records is an arrayref from &Apache::loncommon::upfile_record_sep,
-$d is an array of 2 element arrays (internal name, displayed name)
+$d is an array of 2 element arrays (internal name, displayed name,defaultcol)
 
 =cut
 
@@ -2810,14 +2815,16 @@
               '<th>'.&mt('Attribute').'</th>'.
               '<th>'.&mt('Column').'</th></tr>'."\n");
     foreach (@$d) {
-	my ($value,$display)=@{ $_ };
+	my ($value,$display,$defaultcol)=@{ $_ };
 	$r->print('<tr><td>'.$display.'</td>');
 
 	$r->print('<td><select name=f'.$i.
 		  ' onchange="javascript:flip(this.form,'.$i.');">');
 	$r->print('<option value="none"></option>');
 	foreach (sort({$a <=> $b} keys(%sone))) {
-	    $r->print('<option value="'.$_.'">Column '.($_+1).'</option>');
+	    $r->print('<option value="'.$_.'"'.
+                      ($_ eq $defaultcol ? ' selected ' : '').
+                      '>Column '.($_+1).'</option>');
 	}
 	$r->print('</select></td></tr>'."\n");
 	$i++;
@@ -2858,8 +2865,10 @@
 	$r->print('<tr><td><select name="f'.$i.'"'.
 		  ' onchange="javascript:flip(this.form,'.$i.');">');
 	foreach (@$d) {
-	    my ($value,$display)=@{ $_ };
-	    $r->print('<option value="'.$value.'">'.$display.'</option>');
+	    my ($value,$display,$defaultcol)=@{ $_ };
+	    $r->print('<option value="'.$value.'"'.
+                      ($i eq $defaultcol ? ' selected ':'').'>'.
+                      $display.'</option>');
 	}
 	$r->print('</select></td><td>');
 	if (defined($sone{$_})) { $r->print($sone{$_}."</br>\n"); }