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

www lon-capa-cvs@mail.lon-capa.org
Thu, 14 Aug 2003 16:08:46 -0000


www		Thu Aug 14 12:08:46 2003 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
  Log:
  Bug #1542 more correctly.
  
  
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.81 loncom/interface/londropadd.pm:1.82
--- loncom/interface/londropadd.pm:1.81	Thu Aug 14 10:16:42 2003
+++ loncom/interface/londropadd.pm	Thu Aug 14 12:08:46 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.81 2003/08/14 14:16:42 www Exp $
+# $Id: londropadd.pm,v 1.82 2003/08/14 16:08:46 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -32,7 +32,7 @@
 # (TeX Content Handler
 #
 ###############################################################
-###############################################################
+##############################################################
 
 package Apache::londropadd;
 
@@ -185,6 +185,7 @@
 	$javascript=&upload_manager_javascript_forward_associate();
     }
     my $javascript_validations=&javascript_validations($krbdefdom);
+    my $checked=(($ENV{'form.noFirstLine'})?' checked="1"':'');
     $r->print(<<ENDPICK);
 <h3>Uploading Class List</h3>
 <hr>
@@ -198,7 +199,7 @@
 <input type="hidden" name="associate"  value="" />
 <input type="hidden" name="datatoken"  value="$datatoken" />
 <input type="hidden" name="fileupload" value="$ENV{'form.fileupload'}" />
-<input type="hidden" name="noFirstLine" value="$ENV{'form.noFirstLine'}" />
+<input type="checkbox" name="noFirstLine" $checked />Ignore First Line
 <input type="hidden" name="upfiletype" value="$ENV{'form.upfiletype'}" />
 <input type="hidden" name="upfile_associate" 
                                        value="$ENV{'form.upfile_associate'}" />
@@ -506,7 +507,7 @@
 # ======================================================= Menu Phase Two Upload
 sub print_upload_manager_form {
     my $r=shift;
-
+    my $firstLine;
     my $datatoken;
     if (!$ENV{'form.datatoken'}) {
       $datatoken=&Apache::loncommon::upfile_store($r);
@@ -515,6 +516,7 @@
       &Apache::loncommon::load_tmp_file($r);
     }
     my @records=&Apache::loncommon::upfile_record_sep();
+    if($ENV{'form.noFirstLine'}){$firstLine=shift(@records);}
     my $total=$#records;
     my $distotal=$total+1;
     my $today=time;
@@ -525,7 +527,6 @@
     &print_upload_manager_header($r,$datatoken,$distotal,$krbdefdom);
     my $i;
     my $keyfields;
-    my $dummy;
     if ($total>=0) {
 	my @d=(['username','Username'],
                ['names','Last Name, First Names'],
@@ -537,10 +538,6 @@
                ['sec','Group/Section'],
 	       ['ipwd','Initial Password'],
                ['email','EMail Address']);
-	if($ENV{'form.noFirstLine'}){
-	    ($dummy,@records)=@records;
-	}
-
 	if ($ENV{'form.upfile_associate'} eq 'reverse') {	
 	    &Apache::loncommon::csv_print_samples($r,\@records);
 	    $i=&Apache::loncommon::csv_print_select_table($r,\@records,\@d);
@@ -1548,6 +1545,7 @@
     my $r=shift;
     &Apache::loncommon::load_tmp_file($r);
     my @studentdata=&Apache::loncommon::upfile_record_sep();
+    if($ENV{'form.noFirstLine'}){shift(@studentdata);}
     my @keyfields = split(/\,/,$ENV{'form.keyfields'});
     my $cid = $ENV{'request.course.id'};
     my %fields=();