--- loncom/interface/lonpickstudent.pm 2009/11/05 14:24:01 1.28 +++ loncom/interface/lonpickstudent.pm 2011/01/23 01:04:26 1.29 @@ -1,7 +1,7 @@ # The LearningOnline Network # Pick a student from the classlist # -# $Id: lonpickstudent.pm,v 1.28 2009/11/05 14:24:01 raeburn Exp $ +# $Id: lonpickstudent.pm,v 1.29 2011/01/23 01:04:26 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,7 +50,7 @@ sub handler { &Apache::loncommon::get_unprocessed_cgi ($ENV{'QUERY_STRING'},['filter','form','unameelement','udomelement', - 'roles','courseadvonly']); + 'roles','courseadvonly','clicker']); # Allowed? my $allowed; my $scope = $env{'request.course.id'}; @@ -136,6 +136,26 @@ ENDSCRIPT unless ($env{'form.courseadvonly'}) { # ------------------------------------------------------------------ Students + +# Do we have a clicker? + + my $clicker=$env{'form.clicker'}; + my @fragments=(); + if ($clicker) { + $r->print('

'.&mt('Clicker: [_1]',$clicker).'

'); + my $clicklength=length($clicker); + my $maxlength=$clicklength-1; + if ($maxlength>2) { + my $minlength=$maxlength-2; + if ($minlength<2) { $minlength=2; } + for (my $length=$maxlength;$length>=$minlength;$length--) { + for (my $startidx=0; $startidx<=$clicklength-$length; $startidx++) { + push(@fragments,substr($clicker,$startidx,$length)); + } + } + } + } + my $result; my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; @@ -164,6 +184,20 @@ ENDSCRIPT } } $grouplist =~ s/,$//; + my $markedupclicker; + if ($clicker) { + $markedupclicker=(&Apache::lonnet::userenvironment($udom,$uname,'clickers'))[1]; + if ($markedupclicker!~/\w/) { + $markedupclicker='-'; + } else { + foreach my $frag (@fragments) { + if ($markedupclicker=~/\Q$frag\E/is) { + $markedupclicker=~s/(\Q$frag\E)/$1<\/b><\/font>/gis; + last; + } + } + } + } $result .=&Apache::loncommon::start_data_table_row(). ''. '