[LON-CAPA-cvs] cvs: loncom /interface londropadd.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Wed, 16 Oct 2002 13:00:57 -0000
matthew Wed Oct 16 09:00:57 2002 EDT
Modified files:
/loncom/interface londropadd.pm
Log:
Added a status selection box to the routines which display the classlist.
This is mainly for debugging as many of our test classes have few active
students.
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.56 loncom/interface/londropadd.pm:1.57
--- loncom/interface/londropadd.pm:1.56 Tue Oct 15 10:41:31 2002
+++ loncom/interface/londropadd.pm Wed Oct 16 09:00:57 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.56 2002/10/15 14:41:31 matthew Exp $
+# $Id: londropadd.pm,v 1.57 2002/10/16 13:00:57 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -752,10 +752,26 @@
# ============================================== view classlist
sub print_html_classlist {
my $r=shift;
+ if (! exists($ENV{'form.sortby'})) {
+ $ENV{'form.sortby'} = 'username';
+ }
+ if (! exists($ENV{'form.Status'}) ||
+ $ENV{'form.Status'} !~ /^(Any|Expired|Active)$/) {
+ $ENV{'form.Status'} = 'Active';
+ }
+ my $status_select = &Apache::lonhtmlcommon::StatusOptions
+ ($ENV{'form.Status'},'studentform');
$r->print(<<END);
+<input type="hidden" name="action" value="classlist" />
+<input type="hidden" name="state" value="" />
<p>
-<font size="+1">Current Classlist</font>
-<font size="+1"><a href="/adm/dropadd?action=classlist&state=csv">CSV format</a></font>
+<font size="+1">Current Classlist</font>
+
+<font size="+1">
+<a href="javascript:document.studentform.state.value='csv';document.studentform.submit();">CSV format</a>
+</font>
+
+$status_select
</p>
END
my $cid=$ENV{'request.course.id'};
@@ -766,10 +782,10 @@
# Print out the available choices
if ($ENV{'form.action'} eq 'modifystudent') {
&show_class_list($r,'view','modify','modifystudent',
- 'Active',$classlist,$keylist);
+ $ENV{'form.Status'},$classlist,$keylist);
} else {
&show_class_list($r,'view','aboutme','classlist',
- 'Active',$classlist,$keylist);
+ $ENV{'form.Status'},$classlist,$keylist);
}
}
}
@@ -783,7 +799,7 @@
$r->print("There are no students currently enrolled.\n");
} else {
&show_class_list($r,'csv','nolink','csv',
- 'Active',$classlist,$keylist);
+ $ENV{'form.Status'},$classlist,$keylist);
}
}
@@ -791,8 +807,8 @@
sub show_class_list {
my ($r,$mode,$linkto,$action,$statusmode,$classlist,$keylist)=@_;
my $cid=$ENV{'request.course.id'};
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['sortby']);
+# &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+# ['sortby']);
my $sortby = $ENV{'form.sortby'};
if ($sortby !~ /^(username|domain|section|fullname|id)$/) {
$sortby = 'username';
@@ -809,15 +825,15 @@
<p>
<table border=2>
<tr><th>
- <a href="/adm/dropadd?action=$action&sortby=username">username</a>
+ <a href="javascript:document.studentform.sortby.value='username';document.studentform.submit();">username</a>
</th><th>
- <a href="/adm/dropadd?action=$action&sortby=domain">domain</a>
+ <a href="javascript:document.studentform.sortby.value='domain';document.studentform.submit();">domain</a>
</th><th>
- <a href="/adm/dropadd?action=$action&sortby=id">ID</a>
+ <a href="javascript:document.studentform.sortby.value='id';document.studentform.submit();">ID</a>
</th><th>
- <a href="/adm/dropadd?action=$action&sortby=fullname">student name</a>
+ <a href="javascript:document.studentform.sortby.value='fullname';document.studentform.submit();">student name</a>
</th><th>
- <a href="/adm/dropadd?action=$action&sortby=section">section</a>
+ <a href="javascript:document.studentform.sortby.value='section';document.studentform.submit();">section</a>
</th>
</tr>
END
@@ -849,7 +865,7 @@
my $name = $classlist->{$student}->[$index{'fullname'}];
my $id = $classlist->{$student}->[$index{'id'}];
my $status = $classlist->{$student}->[$index{'status'}];
- next if (($statusmode ne 'any') && ($status ne $statusmode));
+ next if (($statusmode ne 'Any') && ($status ne $statusmode));
if ($mode eq 'view') {
$r->print("<tr>\n <td>\n ");
if ($linkto eq 'nothing') {