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

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 09 Sep 2002 20:54:52 -0000


matthew		Mon Sep  9 16:54:52 2002 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
  Log:
  Interface cleanups.  Instead of an ugly page with forms and buttons it now 
  displays an ugly page with links.  Working towards adding a 
  'modify one student' page, bug 264.
  
  
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.47 loncom/interface/londropadd.pm:1.48
--- loncom/interface/londropadd.pm:1.47	Thu Aug 22 17:05:25 2002
+++ loncom/interface/londropadd.pm	Mon Sep  9 16:54:52 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.47 2002/08/22 21:05:25 albertel Exp $
+# $Id: londropadd.pm,v 1.48 2002/09/09 20:54:52 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -142,34 +142,17 @@
 # ============================================================== Menu Phase One
 sub menu_phase_one {
     my $r=shift;
-    my $upfile_select=&Apache::loncommon::upfile_select_html();
-    my $create_classlist_help = 
-	&Apache::loncommon::help_open_topic("Course_Create_Class_List",
-           "How do I create a class list from a spreadsheet");
-    my $create_csv_help =
-	&Apache::loncommon::help_open_topic("Course_Convert_To_CSV",
-           "How do I create a CSV file from a spreadsheet");
-    $r->print(<<ENDUPFORM);
-<input type=hidden name=phase value=two>
-<hr>
-<h3>Upload a courselist</h3>
-$upfile_select
-<p><input type=submit name="fileupload" value="Upload Courselist">
-<br />
-$create_classlist_help <br />
-$create_csv_help
-
-<hr />
-<h3>Enroll a single student</h3>
-<p><input type=submit name="enroll" value="Enroll Student"></p>
-<hr />
-<h3>Classlist</h3>
-<p><input type=submit name="view" value="View Class List">
-<input type=submit name="viewcsv" value="Comma Separated Class List"></p>
-<hr />
-<h3>Drop students</h3>
-<p><input type=submit name="drop" value="Selection List"></p>
-ENDUPFORM
+    $r->print(<<END);
+<p>
+<font size="+1"><a href="/adm/dropadd?phase=two&uplist=yes">Upload a course list</a></font>
+</p><p>
+<font size="+1"><a href="/adm/dropadd?phase=two&enroll=yes">Enroll a single student</a></font>
+</p><p>
+<font size="+1"><a href="/adm/dropadd?phase=two&view=yes">View Classlist</a></font>
+</p><p>
+<font size="+1"><a href="/adm/dropadd?phase=two&drop=yes">Drop Students</a></font>
+</p>
+END
 }
 
 sub phase_two_header {
@@ -731,7 +714,10 @@
 # ============================================== view classlist
 sub menu_phase_two_view {
     my $r=shift;
-    $r->print("<h3>Current Classlist</h3>");
+    $r->print(<<END);
+<font size="+1">Current Classlist</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<font size="+1"><a href="/adm/dropadd?phase=two&viewcsv=yes">CSV format</a></font><br />
+END
     my $cid=$ENV{'request.course.id'};
     my ($error,%currentlist)=&get_current_classlist
         ($ENV{'course.'.$cid.'.domain'},$ENV{'course.'.$cid.'.num'});
@@ -890,6 +876,32 @@
 END
 }
 
+#
+# Print out the initial form to get the courselist file
+#
+sub print_first_courselist_upload_form {
+    my $r=shift;
+    my $upfile_select=&Apache::loncommon::upfile_select_html();
+    my $create_classlist_help = 
+	&Apache::loncommon::help_open_topic("Course_Create_Class_List",
+           "How do I create a class list from a spreadsheet");
+    my $create_csv_help =
+	&Apache::loncommon::help_open_topic("Course_Convert_To_CSV",
+           "How do I create a CSV file from a spreadsheet");
+    $r->print(<<ENDUPFORM);
+<input type=hidden name=phase value=two>
+<hr>
+<h3>Upload a courselist</h3>
+$upfile_select
+<p><input type=submit name="fileupload" value="Upload Courselist">
+<br />
+$create_classlist_help <br />
+$create_csv_help
+</body></html>
+ENDUPFORM
+    return;
+}
+
 # ================================================= Drop/Add from uploaded file
 sub upfile_drop_add {
     my $r=shift;
@@ -1098,6 +1110,9 @@
         $r->send_http_header;
         return OK;
     }
+    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+                                            ['enroll','drop','view','phase',
+                                             'viewcsv','uplist']);
     #  Needs to be in a course
     if (($ENV{'request.course.fn'}) && 
         (&Apache::lonnet::allowed('cst',$ENV{'request.course.id'}))) {
@@ -1119,7 +1134,9 @@
             }
         }
         if ($ENV{'form.phase'} eq 'two') {
-            if ($ENV{'form.fileupload'}) {
+            if ($ENV{'form.uplist'}) {
+                &print_first_courselist_upload_form($r);
+            } elsif ($ENV{'form.fileupload'}) {
                 &menu_phase_two_upload($r);
             } elsif ($ENV{'form.enroll'}) {
                 &menu_phase_two_enroll($r);