--- loncom/interface/lonpickstudent.pm 2007/07/21 00:48:55 1.21 +++ loncom/interface/lonpickstudent.pm 2007/08/02 01:39:26 1.22 @@ -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 @@ sub handler { # 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 = quotemeta($filter); + my $change = &mt('Change'); + my $filterbutton =< FILTER - foreach my $name ('form','unameelement','udomelement','roles') { - my $value = &HTML::Entities::encode($env{"form.$name"},'<>&"'); - $filterbutton .= <&"'); + $filterbutton .= < HIDDEN - } - $filtermsg = '
'. - &mt('Showing users with a name starting with [_1]', - $filterbutton).'
'; + } + $filtermsg = '
'. + &mt('Showing users with a name starting with [_1]', + $filterbutton).'
'; + if ($filter eq '') { + $filter = '.' } my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; @@ -139,19 +138,10 @@ ENDSCRIPT $r->print($filtermsg); - $r->print('

'. - &Apache::loncommon::start_data_table(). - &Apache::loncommon::start_data_table_header_row(). - &Apache::loncommon::end_data_table_header_row(). - ' '. - ''.&mt('username').''. - ''.&mt('domain').''. - ''.&mt('Name').''. - ''.&mt('ID').''. - ''.&mt('section').''. - ''.&mt('active group(s)').''. - &Apache::loncommon::end_data_table_header_row()); + $r->print('

'); + # ------------------------------------------------------------------ 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 @@ ENDSCRIPT } } $grouplist =~ s/,$//; - $r->print(&Apache::loncommon::start_data_table_row(). + $result .=&Apache::loncommon::start_data_table_row(). ''. ''. @@ -183,12 +173,27 @@ ENDSCRIPT $uname,$udom). ''.$id.''.$section. ''.$grouplist.''. - &Apache::loncommon::end_data_table_row()); + &Apache::loncommon::end_data_table_row(); } } } - - $r->print(&Apache::loncommon::end_data_table().'

'); + if (!$result) { + $r->print('

'.&mt('No students found.').'

'); + } else { + $r->print(&Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + &Apache::loncommon::end_data_table_header_row(). + ' '. + ''.&mt('username').''. + ''.&mt('domain').''. + ''.&mt('Name').''. + ''.&mt('ID').''. + ''.&mt('section').''. + ''.&mt('active group(s)').''. + &Apache::loncommon::end_data_table_header_row(). + $result. + &Apache::loncommon::end_data_table()); + } } else { $r->print('

'.&mt('Users with Roles Assigned by').' '. &Apache::loncommon::plainname($env{'user.name'},