[LON-CAPA-cvs] cvs: loncom /interface lonpickstudent.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 02 Aug 2007 01:39:27 -0000
albertel Wed Aug 1 21:39:27 2007 EDT
Modified files:
/loncom/interface lonpickstudent.pm
Log:
- always make filter available
- improve the display when there are now mathcing students
Index: loncom/interface/lonpickstudent.pm
diff -u loncom/interface/lonpickstudent.pm:1.21 loncom/interface/lonpickstudent.pm:1.22
--- loncom/interface/lonpickstudent.pm:1.21 Fri Jul 20 20:48:55 2007
+++ loncom/interface/lonpickstudent.pm Wed Aug 1 21:39:26 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a student from the classlist
#
-# $Id: lonpickstudent.pm,v 1.21 2007/07/21 00:48:55 albertel Exp $
+# $Id: lonpickstudent.pm,v 1.22 2007/08/02 01:39:26 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -70,25 +70,24 @@
# See if filter present
my $filter=$env{'form.filter'};
my $filtermsg;
- if ($filter eq '') {
- $filter = '.'
- } else {
- my $encoded_filter = &HTML::Entities::encode($filter,'<>&"');
- $filter = quotemeta($filter);
- my $change = &mt('Change');
- my $filterbutton =<<FILTER;
+ my $encoded_filter = &HTML::Entities::encode($filter,'<>&"');
+ $filter = quotemeta($filter);
+ my $change = &mt('Change');
+ my $filterbutton =<<FILTER;
<input type="text" name="filter" value="$encoded_filter" />
<input type="submit" name="Change" value="$change" />
FILTER
- foreach my $name ('form','unameelement','udomelement','roles') {
- my $value = &HTML::Entities::encode($env{"form.$name"},'<>&"');
- $filterbutton .= <<HIDDEN;
+ foreach my $name ('form','unameelement','udomelement','roles') {
+ my $value = &HTML::Entities::encode($env{"form.$name"},'<>&"');
+ $filterbutton .= <<HIDDEN;
<input type="hidden" name="$name" value="$value" />
HIDDEN
- }
- $filtermsg = '<br />'.
- &mt('Showing users with a name starting with [_1]',
- $filterbutton).'<br />';
+ }
+ $filtermsg = '<br />'.
+ &mt('Showing users with a name starting with [_1]',
+ $filterbutton).'<br />';
+ if ($filter eq '') {
+ $filter = '.'
}
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -139,19 +138,10 @@
$r->print($filtermsg);
- $r->print('</p><p>'.
- &Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_header_row().
- &Apache::loncommon::end_data_table_header_row().
- '<th> </th>'.
- '<th>'.&mt('username').'</th>'.
- '<th>'.&mt('domain').'</th>'.
- '<th>'.&mt('Name').'</th>'.
- '<th>'.&mt('ID').'</th>'.
- '<th>'.&mt('section').'</th>'.
- '<th>'.&mt('active group(s)').'</th>'.
- &Apache::loncommon::end_data_table_header_row());
+ $r->print('</p>');
+
# ------------------------------------------------------------------ Students
+ my $result;
foreach my $user (sort(keys(%$classlist))) {
# the following undefs are for 'domain', and 'username' respectively.
my (undef,undef,$end,$start,$id,$section,$fullname,$status)=
@@ -173,7 +163,7 @@
}
}
$grouplist =~ s/,$//;
- $r->print(&Apache::loncommon::start_data_table_row().
+ $result .=&Apache::loncommon::start_data_table_row().
'<td>'.
'<input type="button" value="'.&mt('Select').'" onClick="gochoose('.
"'".$uname."','".$udom."')".'" /></td>'.
@@ -183,12 +173,27 @@
$uname,$udom).
'</td><td>'.$id.'</td><td>'.$section.
'</td><td>'.$grouplist.'</td>'.
- &Apache::loncommon::end_data_table_row());
+ &Apache::loncommon::end_data_table_row();
}
}
}
-
- $r->print(&Apache::loncommon::end_data_table().'</p>');
+ if (!$result) {
+ $r->print('<p>'.&mt('No students found.').'</p>');
+ } else {
+ $r->print(&Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ &Apache::loncommon::end_data_table_header_row().
+ '<th> </th>'.
+ '<th>'.&mt('username').'</th>'.
+ '<th>'.&mt('domain').'</th>'.
+ '<th>'.&mt('Name').'</th>'.
+ '<th>'.&mt('ID').'</th>'.
+ '<th>'.&mt('section').'</th>'.
+ '<th>'.&mt('active group(s)').'</th>'.
+ &Apache::loncommon::end_data_table_header_row().
+ $result.
+ &Apache::loncommon::end_data_table());
+ }
} else {
$r->print('<h3>'.&mt('Users with Roles Assigned by').' '.
&Apache::loncommon::plainname($env{'user.name'},